diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 583986729d..7d846efaeb 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1 @@ -patreon: Fabsol +patreon: CalamityMod \ No newline at end of file diff --git a/Backgrounds/BasaltGullyBG.png b/Backgrounds/BasaltGullyBG.png new file mode 100644 index 0000000000..592d4b0dd6 Binary files /dev/null and b/Backgrounds/BasaltGullyBG.png differ diff --git a/Backgrounds/SunkenSeaBGStyle.cs b/Backgrounds/SunkenSeaBGStyle.cs index b3399fee89..75987a1497 100644 --- a/Backgrounds/SunkenSeaBGStyle.cs +++ b/Backgrounds/SunkenSeaBGStyle.cs @@ -10,6 +10,11 @@ namespace CalamityMod.Backgrounds private int SSBG2; private int SSBG3; + private int BGBG0; + private int BGBG1; + private int BGBG2; + private int BGBG3; + public override void SetStaticDefaults() { if (Main.dedServ) @@ -19,14 +24,35 @@ namespace CalamityMod.Backgrounds SSBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); SSBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); SSBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + + BGBG0 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + BGBG1 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); + BGBG2 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BlankPixel"); + BGBG3 = BackgroundTextureLoader.GetBackgroundSlot("CalamityMod/Backgrounds/BasaltGullyBG"); } public override void FillTextureArray(int[] textureSlots) { - textureSlots[0] = SSBG0; - textureSlots[1] = SSBG1; - textureSlots[2] = SSBG2; - textureSlots[3] = SSBG3; + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome(ModContent.GetInstance()) || + Main.LocalPlayer.InModBiome()) + { + textureSlots[0] = SSBG0; + textureSlots[1] = SSBG1; + textureSlots[2] = SSBG2; + textureSlots[3] = SSBG3; + } + if (!Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome(ModContent.GetInstance()) && + !Main.LocalPlayer.InModBiome()) + { + textureSlots[0] = BGBG0; + textureSlots[1] = BGBG1; + textureSlots[2] = BGBG2; + textureSlots[3] = BGBG3; + } } } } diff --git a/Backgrounds/SunkenSeaBurrowsBG.cs b/Backgrounds/SunkenSeaBurrowsBG.cs index 986d2134c2..c93f47a0ea 100644 --- a/Backgrounds/SunkenSeaBurrowsBG.cs +++ b/Backgrounds/SunkenSeaBurrowsBG.cs @@ -51,11 +51,80 @@ namespace CalamityMod.Backgrounds for (int j = 0; j < drawLimitY; j++) { Point pos = drawPoint + new Point(i, j); - if (Main.tile[pos.X, pos.Y].Slope != SlopeType.Solid) + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.1f); } } } + if (!Main.dedServ && (Main.LocalPlayer.InModBiome(ModContent.GetInstance()))) + { + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) + { + for (int j = 0; j < drawLimitY; j++) + { + Point pos = drawPoint + new Point(i, j); + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0 && + Main.tile[pos.X, pos.Y].LiquidAmount == 0) + Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.2f); + } + } + } + if (!Main.dedServ && (Main.LocalPlayer.InModBiome(ModContent.GetInstance()))) + { + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) + { + for (int j = 0; j < drawLimitY; j++) + { + Point pos = drawPoint + new Point(i, j); + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) + Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.2f); + } + } + } + if (!Main.dedServ && (Main.LocalPlayer.InModBiome(ModContent.GetInstance()))) + { + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) + { + for (int j = 0; j < drawLimitY; j++) + { + Point pos = drawPoint + new Point(i, j); + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) + Lighting.AddLight(pos.X, pos.Y, TorchID.White, 0.2f); + } + } + } + if (!Main.dedServ && (Main.LocalPlayer.InModBiome(ModContent.GetInstance()))) + { + int drawLimitX = Main.screenWidth / 16; + int drawLimitY = Main.screenHeight / 16; + Point drawPoint = (Main.screenPosition / 16).ToPoint(); + for (int i = 0; i < drawLimitX; i++) + { + for (int j = 0; j < drawLimitY; j++) + { + Point pos = drawPoint + new Point(i, j); + if (pos.Y >= Main.maxTilesY - 450) + { + if (!Main.tile[pos.X, pos.Y].HasTile && + Main.tile[pos.X, pos.Y].WallType == 0) + Lighting.AddLight(pos.X, pos.Y, TorchID.Red, 0.6f); + } + } + } + } } private void DrawToTarget(On_Main.orig_CheckMonoliths orig) @@ -73,6 +142,7 @@ namespace CalamityMod.Backgrounds // Leaving this here for other programmers, in case I don't get to doing this myself. Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, null, CalamityUtils.BackgroundMatrix); + DrawShoresBG(); DrawBurrowsBG(); Main.spriteBatch.End(); @@ -97,6 +167,7 @@ namespace CalamityMod.Backgrounds // rendering code if that setting is on. if (Main.WaveQuality > 0 || !CalamityClientConfig.Instance.SunkenSeaBackgroundDistortion) { + DrawShoresBG(); DrawBurrowsBG(); } else @@ -108,11 +179,14 @@ namespace CalamityMod.Backgrounds Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, distortionShader.Shader, CalamityUtils.BackgroundMatrix); - distortionShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); - distortionShader.Shader.Parameters["distortionXSpeed"].SetValue(-0.012f); - distortionShader.Shader.Parameters["distortionYSpeed"].SetValue(0.02f); - distortionShader.Shader.Parameters["distortionStrength"].SetValue(0.035f); - distortionShader.Shader.Parameters["noiseScale"].SetValue(0.075f); + const float distortionXSpeed = -0.012f; + const float distortionYSpeed = 0.02f; + const float noiseScale = 0.075f; + const float noiseStrength = 0.035f; + Vector2 timeOffset = new Vector2(distortionXSpeed, distortionYSpeed) * Main.GlobalTimeWrappedHourly * noiseScale; + Vector2 noiseScaleStrength = new Vector2(noiseScale, noiseStrength); + distortionShader.Shader.Parameters["timeOffset"].SetValue(timeOffset); + distortionShader.Shader.Parameters["noiseScaleStrength"].SetValue(noiseScaleStrength); distortionShader.SetShaderTexture(distortionTexture); Main.spriteBatch.Draw(WaterDistortionTarget.Target, new Rectangle(16, 16, Main.screenWidth, Main.screenHeight), Color.White); @@ -120,14 +194,103 @@ namespace CalamityMod.Backgrounds } public static float Transparency; - public static float TransitionSpeed => 0.02f; + private static void DrawShoresBG() + { + if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) + { + Transparency += 1f; + + if (Transparency > 1f) + Transparency = 1f; + } + else + { + // Make transparency immediately go down so it doesnt look weird, since vanilla underground backgrounds dont have the fade-in effect this background has. + Transparency -= 1f; + + if (Transparency < 0f) + Transparency = 0f; + } + + // Don't bother running any of the background drawing if the transparency is zero (meaning the background isnt actually active). + // Also do not run any of the background drawing if you have the vanilla background config option turned off. + if (Transparency > 0f && Main.BackgroundEnabled) + { + Vector2 vector = Main.screenPosition + new Vector2((Main.screenWidth >> 1), (Main.screenHeight >> 1)); + float num = (Main.GameViewMatrix.Zoom.Y - 1f) * 0.5f * 200f; + float Scale = 1.5f; + float playerDrawPosition = ((Main.LocalPlayer.Center.Y / 16f) - 90) * 16f; + + for (int Layers = 4; Layers >= 0; Layers--) + { + // Get each background texture. + Texture2D BGTexture = ModContent.Request("CalamityMod/Backgrounds/SunkenSeaShoresBG" + Layers).Value; + + Vector2 vector2 = new Vector2(BGTexture.Width, BGTexture.Height) * 0.5f; + float num2 = (Layers * 2 + 3f); + Vector2 vector3 = new Vector2(1f / num2); + Rectangle rectangle = new Rectangle(0, 0, BGTexture.Width, BGTexture.Height); + Vector2 zero = Vector2.Zero; + + switch (Layers) + { + case 0: + { + zero.Y += 200f; + break; + } + case 1: + { + zero.Y += 0f; + break; + } + case 2: + { + zero.Y += 0f; + break; + } + case 3: + { + zero.Y += 0f; + break; + } + case 4: + { + zero.Y += 0f; + break; + } + } + + vector2 *= Scale; + + zero.Y -= num; + float LoopWidth = Scale * rectangle.Width; + float LoopHeight = Scale * rectangle.Height; + int LoopX = (int)((vector.X * vector3.X - vector2.X + zero.X - (Main.screenWidth >> 1)) / LoopWidth); + int LoopY = (int)((vector.Y * vector3.Y - vector2.Y + zero.Y - (Main.screenWidth >> 1)) / LoopWidth); + + for (int i = LoopY - 2; i < LoopY + 4 + (int)(Main.screenWidth / LoopHeight); i++) + { + for (int j = LoopX - 2; j < LoopX + 4 + (int)(Main.screenWidth / LoopWidth); j++) + { + Vector2 drawPosition = (new Vector2(j * Scale * (rectangle.Width / vector3.X), playerDrawPosition) + vector2 - vector) * vector3 + vector - Main.screenPosition - vector2 + zero; + + var frame = rectangle; + var color = Color.White * Transparency; + + Main.spriteBatch.Draw(BGTexture, drawPosition, frame, color, 0f, Vector2.Zero, Scale, SpriteEffects.None, 0f); + } + } + } + } + } private static void DrawBurrowsBG() { if (Main.LocalPlayer.InModBiome(ModContent.GetInstance())) { - Transparency += TransitionSpeed; + Transparency += 1f; if (Transparency > 1f) Transparency = 1f; diff --git a/Backgrounds/SunkenSeaBurrowsBG0.png b/Backgrounds/SunkenSeaBurrowsBG0.png index 26ad2b3f50..21e7232442 100644 Binary files a/Backgrounds/SunkenSeaBurrowsBG0.png and b/Backgrounds/SunkenSeaBurrowsBG0.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG1.png b/Backgrounds/SunkenSeaBurrowsBG1.png index 452e46c78c..9756095977 100644 Binary files a/Backgrounds/SunkenSeaBurrowsBG1.png and b/Backgrounds/SunkenSeaBurrowsBG1.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG2.png b/Backgrounds/SunkenSeaBurrowsBG2.png index 3eb8e53eb6..21e7232442 100644 Binary files a/Backgrounds/SunkenSeaBurrowsBG2.png and b/Backgrounds/SunkenSeaBurrowsBG2.png differ diff --git a/Backgrounds/SunkenSeaBurrowsBG3.png b/Backgrounds/SunkenSeaBurrowsBG3.png index 13524864b4..55795c777e 100644 Binary files a/Backgrounds/SunkenSeaBurrowsBG3.png and b/Backgrounds/SunkenSeaBurrowsBG3.png differ diff --git a/Backgrounds/SunkenSeaShoresBG0.png b/Backgrounds/SunkenSeaShoresBG0.png new file mode 100644 index 0000000000..272e84a3d0 Binary files /dev/null and b/Backgrounds/SunkenSeaShoresBG0.png differ diff --git a/Backgrounds/SunkenSeaShoresBG1.png b/Backgrounds/SunkenSeaShoresBG1.png new file mode 100644 index 0000000000..0d7faa83b7 Binary files /dev/null and b/Backgrounds/SunkenSeaShoresBG1.png differ diff --git a/Backgrounds/SunkenSeaShoresBG2.png b/Backgrounds/SunkenSeaShoresBG2.png new file mode 100644 index 0000000000..ddaffc2a82 Binary files /dev/null and b/Backgrounds/SunkenSeaShoresBG2.png differ diff --git a/Backgrounds/SunkenSeaShoresBG3.png b/Backgrounds/SunkenSeaShoresBG3.png new file mode 100644 index 0000000000..e9668359e5 Binary files /dev/null and b/Backgrounds/SunkenSeaShoresBG3.png differ diff --git a/Backgrounds/SunkenSeaShoresBG4.png b/Backgrounds/SunkenSeaShoresBG4.png new file mode 100644 index 0000000000..4922846eb0 Binary files /dev/null and b/Backgrounds/SunkenSeaShoresBG4.png differ diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 1e5a5fe8b1..064a534dba 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -27,16 +27,16 @@ namespace CalamityMod.Balancing { public sealed class BalancingChangesManager : ModSystem { - internal static List UniversalBalancingChanges = null; internal static List NPCSpecificBalancingChanges = null; // Balancing changes in this method are sorted based on place in progression, NPC name (from A-Z), and strength of resistance in ascending order, in that level of priority. // For ease of change, changes that are not exclusive to one specific weapon are not bundled into one line if they share the same resistance factor. - // To give an example of this, Thanatos having a 50% resist to Chicken Cannon and Prismatic Breaker should be two distinct lines with a 0.5x factor instead of hamfisting them all - // into one single resist that may have to be split later. + // To give an example of this, Thanatos having a 50% resist to Chicken Cannon and Rancor should be two distinct lines with a 0.5x factor instead of hamfisting them all into + // one single resist that may have to be split later. public override void SetStaticDefaults() { // Dirty shorthand for true melee resists, because they're super common and other class resists aren't. + // If you add/change a true melee resist here, be sure to add/change the resist in CalamityGlobalNPC ModifyHitByItem as well. IBalancingRule ResistTrueMelee(float f) => new ClassResistBalancingRule(f, TrueMeleeDamageClass.Instance); // Declare specific filters. @@ -46,49 +46,14 @@ namespace CalamityMod.Balancing bool DragonRageFilter(Projectile p) => p.type == ProjectileType() || p.type == ProjectileType() || (p.type == ProjectileType() && p.CountsAsClass()); - // bool MonkStaffT3Filter(Projectile p) => - // p.type == ProjectileID.MonkStaffT3_AltShot || (p.type == ProjectileID.Electrosphere && Main.player[p.owner].ActiveItem().type == ItemID.MonkStaffT3); - - bool MushroomSpearFilter(Projectile p) => - p.type == ProjectileID.Mushroom && Main.player[p.owner].ActiveItem().type == ItemID.MushroomSpear; - - bool OrichalcumPetalFilter(Projectile p) => - p.type == ProjectileID.FlowerPetal && Main.player[p.owner].onHitPetal; - - bool SpectreMaskSetBonusFilter(Projectile p) => - p.type == ProjectileID.SpectreWrath && Main.player[p.owner].ghostHurt; - bool AotCThrowCombo(Projectile p) => p.type == ProjectileType() && (p.ai[0] == 2 || p.ai[0] == 3); bool HiveBeeFilter(Projectile p) => p.type == ProjectileType() && Main.player[p.owner].ActiveItem().type == ItemType(); - UniversalBalancingChanges = new List() - { - // Nerf Crystal bullet shards by 45% - // Currently crystal bullet projectiles deal 50% of the bullet's damage which is absurd in vanilla, this nerfs them to 27.5% - Do(new ProjectileResistBalancingRule(0.55f, ProjectileID.CrystalShard)), - - // Nerf Luminite Arrow trails by 50%. - Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.MoonlordArrowTrail)), - - // Nerf Seedler seeds by 25%. - Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.SeedlerNut, ProjectileID.SeedlerThorn)), - - // Nerf Cursed Dart flames by 50%. - Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CursedDartFlame)), - - // Nerf Mushroom Spear projectiles by 50%. - Do(new ProjectileSpecificRequirementBalancingRule(0.5f, MushroomSpearFilter)), - - // Nerf Orichalcum armor set bonus petals by 25%. - Do(new ProjectileSpecificRequirementBalancingRule(0.75f, OrichalcumPetalFilter)), - - // Nerf Spectre Mask set bonus projectiles by 50%. - Do(new ProjectileSpecificRequirementBalancingRule(0.5f, SpectreMaskSetBonusFilter)), - - }; + bool EradicatorLaserFilter(Projectile p) => + p.type == ProjectileType() && p.DamageType == RogueDamageClass.Instance; NPCSpecificBalancingChanges = new List(); @@ -97,28 +62,28 @@ namespace CalamityMod.Balancing NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.8f))); #endregion - #region Brain of Cthulhu: Creepers - // 50% resist to true melee. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(ResistTrueMelee(0.5f)))); - - // 50% resist to Demon Scythe. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); - #endregion - #region Eater of Worlds - // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(ResistTrueMelee(0.5f)))); - // 50% resist to Demon Scythe. - NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); // 40% resist to Sky Glaze. - NPCSpecificBalancingChanges.AddRange(Bundle(EaterOfWorldsIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + + // 25% resist to true melee. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.EaterOfWorlds, Do(ResistTrueMelee(0.75f)))); + #endregion + + #region Brain of Cthulhu: Creepers + // 50% resist to Demon Scythe. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.DemonScythe)))); + + // 25% resist to true melee. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.Creeper, Do(ResistTrueMelee(0.75f)))); #endregion #region The Perforators // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(PerforatorWormIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Perforators, Do(ResistTrueMelee(0.5f)))); #endregion #region Wall of Flesh @@ -128,55 +93,58 @@ namespace CalamityMod.Balancing #region Aquatic Scourge // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. // Twisting Thunder and Gael's Greatsword use this projectile too, but they are far beyond progression, so who cares! - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 40% resist to Cryophobia. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(AquaticScourgeIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AquaticScourge, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region The Destroyer // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(ResistTrueMelee(0.5f)))); // 50% resist to Adamantite Throwing Axe's lightning. // See Aquatic Scourge comment. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.CultistBossLightningOrbArc)))); // 50% resist to Dormant Brimseeker. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Mounted Scanner. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); // 30% resist to Meowthrower. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); // 25% resist to Avalanche's Ice Bombs and shards. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); // 25% resist to Snowstorm Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(DestroyerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Destroyer, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType(), ProjectileType())))); #endregion #region Astrum Aureus - // 30% resist to The Ballista's greatarrows. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 25% resist to true melee. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), ResistTrueMelee(0.75f))); + + // 25% resist to The Ballista's greatarrows. + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); #endregion #region Duke Fishron @@ -197,28 +165,22 @@ namespace CalamityMod.Balancing #region Ravager // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(ResistTrueMelee(0.5f)))); // 50% resist to Aegis Blade's explosions because the true melee resist ain't enough. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - // 50% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + // 40% resist to Icicle Arrows. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 35% resist to Flying Dragon. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2SquireSonicBoom)))); - // 30% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - - // 30% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - - // 25% resist to Lucrecia. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + // 20% resist to Aurora Blazer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to The Hive. - NPCSpecificBalancingChanges.AddRange(Bundle(RavagerIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ravager, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); #endregion #region Lunatic Cultist @@ -237,37 +199,37 @@ namespace CalamityMod.Balancing #region Astrum Deus // 75% resist to Plaguenades. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.25f, ProjectileType(), ProjectileType())))); // 70% resist to Charged Blaster Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.ChargedBlasterLaser)))); // 70% resist to Stardust Dragon Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); - - // 55% resist to Flak Kraken. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.45f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.3f, ProjectileID.StardustDragon1, ProjectileID.StardustDragon2, ProjectileID.StardustDragon3, ProjectileID.StardustDragon4)))); // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(ResistTrueMelee(0.5f)))); // 50% resist to Atlantis (Atlantis gaming!). - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - - // 50% resist to Aurora Blazer. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 35% resist to Aerial Bane. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); - - // 35% resist to Ballistic Poison Bomb's clouds. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileID.DD2BetsyArrow)))); // 35% resist to Icicle Arrows. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + + // 30% resist to Aurora Blazer. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 30% resist to Flak Kraken. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + + // 20% resist to Ballistic Poison Bomb's clouds. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Cluster Rocket fragments. - NPCSpecificBalancingChanges.AddRange(Bundle(AstrumDeusIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.AstrumDeus, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.ClusterFragmentsI, ProjectileID.ClusterFragmentsII)))); #endregion #region Moon Lord @@ -301,28 +263,28 @@ namespace CalamityMod.Balancing #region Storm Weaver // 50% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(ResistTrueMelee(0.5f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(ResistTrueMelee(0.5f)))); // 50% resist to Dazzling Stabber Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Last Prism. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileID.LastPrismLaser)))); // 50% resist to Legion of Celestia. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Pristine Fury's alt fire. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Tactician's Trump Card's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 40% resist to Devil's Sunrise's slashes. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); // 35% resist to Event Horizon. - NPCSpecificBalancingChanges.AddRange(Bundle(StormWeaverIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.StormWeaver, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType(), ProjectileType())))); #endregion #region Old Duke @@ -332,19 +294,19 @@ namespace CalamityMod.Balancing #region The Devourer of Gods // 65% resist to Wave Pounder. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 35% resist to Sulphuric Acid Cannon's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 25% resist to Corinth Prime's grenades. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to Valediction's typhoons; will catch Nuclear Fury as well but that doesn't matter. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% vulnerability to Time Bolt stealth strikes. - NPCSpecificBalancingChanges.AddRange(Bundle(DevourerOfGodsIDList.List, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.DevourerOfGods, Do(new StealthStrikeBalancingRule(1.15f, ProjectileType())))); #endregion The Devourer of Gods #region Yharon @@ -357,34 +319,28 @@ namespace CalamityMod.Balancing #region Exo Mechs: Ares // 35% resist to Devil's Devastation's slash. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 30% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType(), ProjectileType())))); // 25% resist to Aetherflux Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); - - // 25% resist to Prismatic Breaker's deathray. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); // 20% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, AotCThrowCombo)))); // 20% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); - - // 20% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, DragonRageFilter)))); // 20% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(AresIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Ares, Do(new ProjectileResistBalancingRule(0.8f, ProjectileID.FinalFractal)))); #endregion #region Exo Mechs: Artemis and Apollo @@ -396,85 +352,73 @@ namespace CalamityMod.Balancing #region Exo Mechs: Thanatos // 65% resist to true melee. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(ResistTrueMelee(0.35f)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(ResistTrueMelee(0.35f)))); // 65% resist to The Final Dawn's lunge. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 65% resist to Stellar Torus Staff. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.35f, ProjectileType())))); // 60% resist to Dynamic Pursuer. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.4f, ProjectileType(), ProjectileType(), ProjectileType())))); // 50% resist to Chicken Cannon. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - - // 50% resist to Omicron's beam. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Rancor. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Vehemence's skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 50% resist to Yharim's Crystal. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); - - // 45% resist to Prismatic Breaker's deathray. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.5f, ProjectileType())))); // 45% resist to Wrathwing's stealth strike fireballs. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.55f, ProjectileType())))); - // 30% resist to Eclipse's Fall. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 40% resist to Omicron's beam. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.6f, ProjectileType())))); - // 30% resist to Sirius. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); - - // 30% resist to Ultima's rays. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType())))); + // 35% resist to Prismatic Breaker's deathray. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.65f, ProjectileType())))); // 30% resist to Dragon Scales and The Wand's tornadoes. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.7f, ProjectileType(), ProjectileType())))); // 25% resist to the Spin Throw part of the Ark of the Cosmos' combo. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, AotCThrowCombo)))); // 25% resist to Dragon Rage projectiles. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, DragonRageFilter)))); // 25% resist to Gael's Greatsword's big skulls. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); - - // 25% resist to Mirror of Kalandra's Paradoxica minion. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileSpecificRequirementBalancingRule(0.75f, BigGaelsSkullFilter)))); // 25% resist to Zenith. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); - - // 20% resist to The Anomaly's Nanogun's bomb explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.75f, ProjectileID.FinalFractal)))); // 20% resist to Ariane's aura (Lilies of Finality). - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Eradicator's beams. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileSpecificRequirementBalancingRule(0.8f, EradicatorLaserFilter)))); - // 20% resist to Plasma Grenade and Dynamic Pursuer's explosions. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 20% resist to Mirror of Kalandra's Paradoxica minion. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 20% resist to Voltaic Climax / Void Vortex hitscan beams. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); // 15% resist to The Final Dawn's AoE sweep flames. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); // 15% resist to Gruesome Eminence. - NPCSpecificBalancingChanges.AddRange(Bundle(ThanatosIDList.List, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); + + // 15% resist to Ultima's rays. + NPCSpecificBalancingChanges.AddRange(Bundle(CalamityNPCTypeSets.Thanatos, Do(new ProjectileResistBalancingRule(0.85f, ProjectileType())))); #endregion #region Supreme Calamitas: Brimstone Hearts @@ -486,9 +430,6 @@ namespace CalamityMod.Balancing // 30% resist to Surge Driver's alt click comets. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.7f, ProjectileType()))); - - // 20% resist to Executioner's Blade stealth strikes. - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCType(), new ProjectileResistBalancingRule(0.8f, ProjectileType()))); #endregion #region Supreme Calamitas: Soul Seekers @@ -511,23 +452,12 @@ namespace CalamityMod.Balancing public override void Unload() { - UniversalBalancingChanges = null; NPCSpecificBalancingChanges = null; } public static void ApplyFromProjectile(NPC npc, ref NPC.HitModifiers modifiers, Projectile proj) { - // Apply universal balancing rules. - foreach (IBalancingRule[] balancingRules in UniversalBalancingChanges) - { - foreach (IBalancingRule balancingRule in balancingRules) - { - if (balancingRule.AppliesTo(npc, modifiers, proj)) - balancingRule.ApplyBalancingChange(npc, ref modifiers); - } - } - - // As well as rules specific to NPCs. + // Apply NPC-specific balancing rules. foreach (NPCBalancingChange balanceChange in NPCSpecificBalancingChanges) { if (npc.type != balanceChange.NPCType) diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index 430de64677..ec3d67b330 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -72,8 +72,6 @@ internal static readonly int AmalgamDodgeCooldownMax = 5400; internal static readonly int MirrorDodgeCooldownMin = 1200; internal static readonly int MirrorDodgeCooldownMax = 5400; - internal static readonly int DaedalusReflectCooldownMin = 1200; - internal static readonly int DaedalusReflectCooldownMax = 5400; internal static readonly int EvolutionReflectCooldownMin = 1200; internal static readonly int EvolutionReflectCooldownMax = 5400; #endregion @@ -117,54 +115,22 @@ #endregion #region Life Steal - // Life steal cap + // Life steal cap (Maximum HP healed per instance of lifesteal) internal static readonly int LifeStealCap = 100; - - // Life steal accessories require a more strict cooldown due to their ease of use and global application - internal static readonly float LifeStealAccessoryCooldownMultiplier = 3f; - // Life steal cooldown multipliers used for armor set bonuses - internal static readonly float LifeStealSetBonusCooldownMultiplier = 2f; - internal static readonly float LifeStealReaverTankCooldownMultiplier = 4f; - - // The range was buffed in vanilla from 1200 to 3000 in 1.4.4, and I agree with that decision - internal static readonly float LifeStealRange = 3000f; - - // Life steal caps (aka, how much life steal the player is allowed before it goes on cooldown) - internal static readonly float LifeStealCap_Classic = 60f; - internal static readonly float LifeStealCap_Expert = 50f; - internal static readonly float LifeStealCap_Revengeance = 40f; - internal static readonly float LifeStealCap_Death = 30f; - - // Master nerfs the life steal cap by 10, resulting in 40 in non-Rev Master, 30 in Rev Master, and 20 in Death Master - internal static readonly float LifeStealCapReduction_Master = 10f; + // Base life steal caps from vanilla (aka, how much life steal the player is allowed before it goes on cooldown) + internal static readonly float LifeStealCap_Classic = 80f; + internal static readonly float LifeStealCap_Expert = 70f; // The base life steal cooldowns from vanilla internal static readonly float LifeStealRecoveryRate_Classic = 0.6f; internal static readonly float LifeStealRecoveryRate_Expert = 0.5f; - // The calculations below show the time (in frames) for 10 life steal cooldown to recover in each difficulty - // Classic: 10 / 0.2 = 50 - // Expert: 10 / 0.15 = 66.667 - // Revengeance: 10 / 0.125 = 80 - // Death: 10 / 0.1 = 100 - // Master: 10 / 0.1 = 100 - // Revengeance Master: 10 / 0.075 = 133.333 - // Death Master: 10 / 0.05 = 200 - // Nerfs the life steal recovery rate in Classic from 0.6/s to 0.2/s + // Nerfs the life steal recovery rate in Classic from 0.6 to 0.2 (36 HP/s to 12 HP/s) internal static readonly float LifeStealRecoveryRateReduction_Classic = 0.4f; - // Nerfs the life steal recovery rate in Expert from 0.5/s to 0.15/s + // Nerfs the life steal recovery rate in Expert from 0.5 to 0.15 (30 HP/s to 9 HP/s) internal static readonly float LifeStealRecoveryRateReduction_Expert = 0.35f; - - // Nerfs the life steal recovery rate in Revengeance from 0.5/s to 0.125/s - internal static readonly float LifeStealRecoveryRateReduction_Revengeance = 0.375f; - - // Nerfs the life steal recovery rate in Death from 0.5/s to 0.1/s - internal static readonly float LifeStealRecoveryRateReduction_Death = 0.4f; - - // Nerfs the life steal recovery rate in Master by 0.05/s, resulting in 0.1/s in non-Rev Master, 0.075/s in Rev Master, and 0.05/s in Death Master - internal static readonly float LifeStealRecoveryRateReduction_Master = 0.05f; #endregion #region Rogue Base Stats diff --git a/BiomeManagers/AbyssLayer3Biome.cs b/BiomeManagers/AbyssLayer3Biome.cs index 8b62bf1917..f03fc82fa4 100644 --- a/BiomeManagers/AbyssLayer3Biome.cs +++ b/BiomeManagers/AbyssLayer3Biome.cs @@ -17,7 +17,12 @@ namespace CalamityMod.BiomeManagers { if (CalamityPlayer.areThereAnyDamnBosses) return Main.curMusic; - return CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3") ?? MusicID.Hell; + + int? musicSlot = CalamityClientConfig.Instance.AbyssLayer3Alt ? + CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3Alt") : + CalamityMod.Instance.GetMusicFromMusicMod("AbyssLayer3"); + + return musicSlot ?? MusicID.Hell; } } diff --git a/BiomeManagers/BasaltGullyBiome.cs b/BiomeManagers/BasaltGullyBiome.cs index 5f4b388829..f5642e3647 100644 --- a/BiomeManagers/BasaltGullyBiome.cs +++ b/BiomeManagers/BasaltGullyBiome.cs @@ -1,9 +1,33 @@ -using Terraria.ModLoader; +using CalamityMod.Systems; +using CalamityMod.Waters; +using Terraria.ID; +using Terraria; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.Furniture; namespace CalamityMod.BiomeManagers { public class BasaltGullyBiome : ModBiome { + public override ModWaterStyle WaterStyle => SunkenSeaBurrowsWater.Instance; + public override ModUndergroundBackgroundStyle UndergroundBackgroundStyle => ModContent.Find("CalamityMod/SunkenSeaBGStyle"); + public override int BiomeTorchItemType => ModContent.ItemType(); + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + public override SceneEffectPriority Priority => SceneEffectPriority.Environment; + public override string BestiaryIcon => "CalamityMod/BiomeManagers/SunkenSeaIcon"; + // Placeholder until we get a dedicated Basalt Gully background + public override string BackgroundPath => "Terraria/Images/MapBG3"; + public override string MapBackground => "Terraria/Images/MapBG3"; + public override bool IsBiomeActive(Player player) + { + bool MoreThanShores = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaShoresTiles; + bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaBasaltTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanUnderground = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.UndergroundTiles; + + return BiomeTileCounterSystem.SunkenSeaBasaltTiles > 2500 && (MoreThanShores || MoreThanReefs || MoreThanPolyp || MoreThanBurrows); + } } } diff --git a/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs b/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs index 8f7d2a9a30..a7d599d6c6 100644 --- a/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs +++ b/BiomeManagers/BestiaryCategories/AstralCaveDesert.cs @@ -7,5 +7,6 @@ namespace CalamityMod.BiomeManagers.BestiaryCategories public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralCaveDesertIcon"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; } } diff --git a/BiomeManagers/BestiaryCategories/AstralDesert.cs b/BiomeManagers/BestiaryCategories/AstralDesert.cs index 29b0a3f907..12450ebde2 100644 --- a/BiomeManagers/BestiaryCategories/AstralDesert.cs +++ b/BiomeManagers/BestiaryCategories/AstralDesert.cs @@ -7,5 +7,6 @@ namespace CalamityMod.BiomeManagers.BestiaryCategories public override string BestiaryIcon => "CalamityMod/BiomeManagers/AstralDesertIcon"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; } } diff --git a/BiomeManagers/BestiaryCategories/AstralUnderground.cs b/BiomeManagers/BestiaryCategories/AstralUnderground.cs index 42d924fd5b..0b3c7b2090 100644 --- a/BiomeManagers/BestiaryCategories/AstralUnderground.cs +++ b/BiomeManagers/BestiaryCategories/AstralUnderground.cs @@ -7,5 +7,6 @@ namespace CalamityMod.BiomeManagers.BestiaryCategories public override string BestiaryIcon => "CalamityMod/BiomeManagers/UndergroundAstralIcon"; public override string MapBackground => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; + public override string BackgroundPath => "CalamityMod/Backgrounds/MapBackgrounds/AstralBG"; } } diff --git a/BiomeManagers/GleamingBurrowsBiome.cs b/BiomeManagers/GleamingBurrowsBiome.cs index 94bd09ac08..bfcc61c206 100644 --- a/BiomeManagers/GleamingBurrowsBiome.cs +++ b/BiomeManagers/GleamingBurrowsBiome.cs @@ -24,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaBurrowsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; - return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 1000 && MoreThanReefs && MoreThanPolyp; + return BiomeTileCounterSystem.SunkenSeaBurrowsTiles > 3000 && MoreThanReefs && MoreThanPolyp; } } } diff --git a/BiomeManagers/PolypForestBiome.cs b/BiomeManagers/PolypForestBiome.cs index b440b5d7a9..564264d40e 100644 --- a/BiomeManagers/PolypForestBiome.cs +++ b/BiomeManagers/PolypForestBiome.cs @@ -24,7 +24,7 @@ namespace CalamityMod.BiomeManagers bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaPolypTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; - return BiomeTileCounterSystem.SunkenSeaPolypTiles > 1000 && MoreThanReefs && MoreThanBurrows; + return BiomeTileCounterSystem.SunkenSeaPolypTiles > 200 && MoreThanReefs && MoreThanBurrows; } } } diff --git a/BiomeManagers/RadiantReefsBiome.cs b/BiomeManagers/RadiantReefsBiome.cs index 7dd90a03fb..c613bfbf67 100644 --- a/BiomeManagers/RadiantReefsBiome.cs +++ b/BiomeManagers/RadiantReefsBiome.cs @@ -21,10 +21,12 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanShores = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaShoresTiles; bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; + bool MoreThanBurrows = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBurrowsTiles; + bool MoreThanBasalt = BiomeTileCounterSystem.SunkenSeaReefsTiles > BiomeTileCounterSystem.SunkenSeaBasaltTiles; - return BiomeTileCounterSystem.SunkenSeaReefsTiles > 1000 && MoreThanBurrows && MoreThanPolyp; + return ((BiomeTileCounterSystem.SunkenSeaReefsTiles > 2000) && MoreThanBasalt && MoreThanBurrows && MoreThanPolyp && MoreThanShores); } } } diff --git a/BiomeManagers/TimelessShoresBiome.cs b/BiomeManagers/TimelessShoresBiome.cs index cb44c6cdc8..66e93668fd 100644 --- a/BiomeManagers/TimelessShoresBiome.cs +++ b/BiomeManagers/TimelessShoresBiome.cs @@ -21,10 +21,11 @@ namespace CalamityMod.BiomeManagers public override bool IsBiomeActive(Player player) { - bool MoreThanPolyp = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaPolypTiles; bool MoreThanReefs = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaReefsTiles; + bool MoreThanBasalt = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.SunkenSeaBasaltTiles; + bool MoreThanUnderground = BiomeTileCounterSystem.SunkenSeaShoresTiles > BiomeTileCounterSystem.UndergroundTiles; - return BiomeTileCounterSystem.SunkenSeaShoresTiles > 1000 && MoreThanPolyp && MoreThanReefs; + return (BiomeTileCounterSystem.SunkenSeaShoresTiles > 1200) && MoreThanReefs && MoreThanBasalt && MoreThanUnderground; } } } diff --git a/Buffs/Alcohol/BloodyMaryBuff.png b/Buffs/Alcohol/BloodyMaryBuff.png index 46cf3a0b57..40355f1d96 100644 Binary files a/Buffs/Alcohol/BloodyMaryBuff.png and b/Buffs/Alcohol/BloodyMaryBuff.png differ diff --git a/Buffs/Alcohol/CaribbeanRumBuff.png b/Buffs/Alcohol/CaribbeanRumBuff.png index c3e5464b05..3996666a07 100644 Binary files a/Buffs/Alcohol/CaribbeanRumBuff.png and b/Buffs/Alcohol/CaribbeanRumBuff.png differ diff --git a/Buffs/Alcohol/CinnamonRollBuff.cs b/Buffs/Alcohol/CinnamonRollBuff.cs index 3d4daff7ea..3b00c5c43a 100644 --- a/Buffs/Alcohol/CinnamonRollBuff.cs +++ b/Buffs/Alcohol/CinnamonRollBuff.cs @@ -1,4 +1,5 @@ using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +18,7 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { player.Calamity().cinnamonRoll = true; + player.Calamity().HeatDebuffMultiplier += 0.5f; } } } diff --git a/Buffs/Alcohol/CinnamonRollBuff.png b/Buffs/Alcohol/CinnamonRollBuff.png index 8d9ff66e26..a1a2c0ae34 100644 Binary files a/Buffs/Alcohol/CinnamonRollBuff.png and b/Buffs/Alcohol/CinnamonRollBuff.png differ diff --git a/Buffs/Alcohol/EverclearBuff.png b/Buffs/Alcohol/EverclearBuff.png index fde2031fa3..3f275ba54f 100644 Binary files a/Buffs/Alcohol/EverclearBuff.png and b/Buffs/Alcohol/EverclearBuff.png differ diff --git a/Buffs/Alcohol/EvergreenGinBuff.cs b/Buffs/Alcohol/EvergreenGinBuff.cs index 26f9f2d161..78f79db5cb 100644 --- a/Buffs/Alcohol/EvergreenGinBuff.cs +++ b/Buffs/Alcohol/EvergreenGinBuff.cs @@ -17,6 +17,8 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { player.Calamity().evergreenGin = true; + player.Calamity().SicknessDebuffMultiplier += 0.25f; + player.Calamity().WaterDebuffMultiplier += 0.25f; } } } diff --git a/Buffs/Alcohol/EvergreenGinBuff.png b/Buffs/Alcohol/EvergreenGinBuff.png index 5e41d87eb6..f7e2133cd3 100644 Binary files a/Buffs/Alcohol/EvergreenGinBuff.png and b/Buffs/Alcohol/EvergreenGinBuff.png differ diff --git a/Buffs/Alcohol/FireballBuff.cs b/Buffs/Alcohol/FireballBuff.cs index aa2e9e9f96..47f5bfbf06 100644 --- a/Buffs/Alcohol/FireballBuff.cs +++ b/Buffs/Alcohol/FireballBuff.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { player.Calamity().fireball = true; + player.Calamity().HeatDebuffMultiplier += 0.25f; } } } diff --git a/Buffs/Alcohol/FireballBuff.png b/Buffs/Alcohol/FireballBuff.png index 8887354d3f..a81dcc472f 100644 Binary files a/Buffs/Alcohol/FireballBuff.png and b/Buffs/Alcohol/FireballBuff.png differ diff --git a/Buffs/Alcohol/GrapeBeerBuff.png b/Buffs/Alcohol/GrapeBeerBuff.png index d951249d12..258910c643 100644 Binary files a/Buffs/Alcohol/GrapeBeerBuff.png and b/Buffs/Alcohol/GrapeBeerBuff.png differ diff --git a/Buffs/Alcohol/MargaritaBuff.png b/Buffs/Alcohol/MargaritaBuff.png index 068aebf1e0..94de724886 100644 Binary files a/Buffs/Alcohol/MargaritaBuff.png and b/Buffs/Alcohol/MargaritaBuff.png differ diff --git a/Buffs/Alcohol/MoonshineBuff.png b/Buffs/Alcohol/MoonshineBuff.png index b079231309..028834ea24 100644 Binary files a/Buffs/Alcohol/MoonshineBuff.png and b/Buffs/Alcohol/MoonshineBuff.png differ diff --git a/Buffs/Alcohol/MoscowMuleBuff.png b/Buffs/Alcohol/MoscowMuleBuff.png index 4ba5245776..a9cf2f5a18 100644 Binary files a/Buffs/Alcohol/MoscowMuleBuff.png and b/Buffs/Alcohol/MoscowMuleBuff.png differ diff --git a/Buffs/Alcohol/OldFashionedBuff.png b/Buffs/Alcohol/OldFashionedBuff.png index 2b6e8fdaf0..a3ba916b88 100644 Binary files a/Buffs/Alcohol/OldFashionedBuff.png and b/Buffs/Alcohol/OldFashionedBuff.png differ diff --git a/Buffs/Alcohol/CirrusVodkaBuff.cs b/Buffs/Alcohol/PurpleHazeBuff.cs similarity index 83% rename from Buffs/Alcohol/CirrusVodkaBuff.cs rename to Buffs/Alcohol/PurpleHazeBuff.cs index cf33f6dd41..9ef31ce2b1 100644 --- a/Buffs/Alcohol/CirrusVodkaBuff.cs +++ b/Buffs/Alcohol/PurpleHazeBuff.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Alcohol { - public class CirrusVodkaBuff : ModBuff + public class PurpleHazeBuff : ModBuff { public override void SetStaticDefaults() { @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Alcohol public override void Update(Player player, ref int buffIndex) { - player.Calamity().cirrusVodka = true; + player.Calamity().purpleHaze = true; } } } diff --git a/Buffs/Alcohol/CirrusVodkaBuff.png b/Buffs/Alcohol/PurpleHazeBuff.png similarity index 100% rename from Buffs/Alcohol/CirrusVodkaBuff.png rename to Buffs/Alcohol/PurpleHazeBuff.png diff --git a/Buffs/Alcohol/RedWineBuff.png b/Buffs/Alcohol/RedWineBuff.png index a3e116c717..556b48d8fc 100644 Binary files a/Buffs/Alcohol/RedWineBuff.png and b/Buffs/Alcohol/RedWineBuff.png differ diff --git a/Buffs/Alcohol/RumBuff.png b/Buffs/Alcohol/RumBuff.png index 29f7cd9fda..e43b540c7a 100644 Binary files a/Buffs/Alcohol/RumBuff.png and b/Buffs/Alcohol/RumBuff.png differ diff --git a/Buffs/Alcohol/ScrewdriverBuff.png b/Buffs/Alcohol/ScrewdriverBuff.png index 2c0984bc98..4d24f45ebd 100644 Binary files a/Buffs/Alcohol/ScrewdriverBuff.png and b/Buffs/Alcohol/ScrewdriverBuff.png differ diff --git a/Buffs/Alcohol/StarBeamRyeBuff.png b/Buffs/Alcohol/StarBeamRyeBuff.png index e678986953..f93dc9cfec 100644 Binary files a/Buffs/Alcohol/StarBeamRyeBuff.png and b/Buffs/Alcohol/StarBeamRyeBuff.png differ diff --git a/Buffs/Alcohol/TequilaBuff.png b/Buffs/Alcohol/TequilaBuff.png index a6c233e3d1..ea4d7ed14a 100644 Binary files a/Buffs/Alcohol/TequilaBuff.png and b/Buffs/Alcohol/TequilaBuff.png differ diff --git a/Buffs/Alcohol/TequilaSunriseBuff.png b/Buffs/Alcohol/TequilaSunriseBuff.png index ef5bee8678..9d36c9250e 100644 Binary files a/Buffs/Alcohol/TequilaSunriseBuff.png and b/Buffs/Alcohol/TequilaSunriseBuff.png differ diff --git a/Buffs/Alcohol/VodkaBuff.png b/Buffs/Alcohol/VodkaBuff.png index 485745f805..ba5666ddbc 100644 Binary files a/Buffs/Alcohol/VodkaBuff.png and b/Buffs/Alcohol/VodkaBuff.png differ diff --git a/Buffs/Alcohol/WhiskeyBuff.png b/Buffs/Alcohol/WhiskeyBuff.png index 56f2662420..fce1a5403b 100644 Binary files a/Buffs/Alcohol/WhiskeyBuff.png and b/Buffs/Alcohol/WhiskeyBuff.png differ diff --git a/Buffs/Alcohol/WhiteWineBuff.png b/Buffs/Alcohol/WhiteWineBuff.png index 548844ed08..bfa64feecc 100644 Binary files a/Buffs/Alcohol/WhiteWineBuff.png and b/Buffs/Alcohol/WhiteWineBuff.png differ diff --git a/Buffs/CalamityGlobalBuff.cs b/Buffs/CalamityGlobalBuff.cs index f2ef8dfbb5..0fe1c1512f 100644 --- a/Buffs/CalamityGlobalBuff.cs +++ b/Buffs/CalamityGlobalBuff.cs @@ -14,14 +14,28 @@ namespace CalamityMod.Buffs public override void Update(int type, Player player, ref int buffIndex) { + // Globally remove summon tag buff stacking + // Other mods need to add to this list because we genuinely don't have any way to tell this + if (CalamityBuffSets.IsSummonTagBuff[type] && buffIndex > 0) + { + for (int i = buffIndex; i >= 0; i--) + { + if (player.buffTime[i] > 0) + { + int buffID = player.buffType[i]; + if (CalamityBuffSets.IsSummonTagBuff[buffID] && buffID != type) + { + player.DelBuff(i); + break; + } + } + } + } + if (type == BuffID.Archery) { player.arrowDamage *= 0.955f; } - else if (type == BuffID.Ironskin) - { - player.statDefense += CalamityUtils.GetScalingDefense(-1) - 8; - } else if (type == BuffID.MagicPower) { player.GetDamage() -= 0.1f; @@ -75,9 +89,13 @@ namespace CalamityMod.Buffs { player.Calamity().shine = true; } - else if (type == BuffID.IceBarrier) + + // Star in a Bottle provides Mana Regeneration Potion effect and cancels out the usual effect if you don't have it + else if (type == BuffID.StarInBottle && !player.manaRegenBuff) { - player.endurance -= 0.1f; + player.manaRegenBuff = true; + player.manaRegenDelayBonus -= 0.5f; + player.manaRegenBonus -= 10; } // Beetle Shell DR is a full compensation, as the vanilla multiplicative DR is removed entirely. @@ -97,6 +115,19 @@ namespace CalamityMod.Buffs else if (type == BuffID.Rabies) { player.GetDamage() -= 0.2f; + + // Reimplementation of random debuff infliction; now occurs on a consistent timer and with a different debuff list + if (player.buffTime[buffIndex] % 600 == 300) + { + int debuffType = Main.rand.Next(4) switch + { + 0 => BuffID.Weak, + 1 => BuffID.Bleeding, + 2 => BuffID.Darkness, + _ => BuffID.BrokenArmor, + }; + player.AddBuff(debuffType, Main.rand.Next(90, 211)); + } } else if (type == BuffID.Werewolf) { @@ -106,30 +137,33 @@ namespace CalamityMod.Buffs public override void Update(int type, NPC npc, ref int buffIndex) { + // Globally remove summon tag debuff stacking, unless allowed in the SummonTag + // Other mods need to add to this list because otherwise we can't tell which IsATag buff is actually for whips + if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out var tag1) && !tag1.AllowsWhipStacking && buffIndex > 0) + { + for (int i = buffIndex; i >= 0; i--) + { + if (npc.buffTime[i] > 0) + { + int buffID = npc.buffType[i]; + if (CalamityBuffSets.SummonTagDebuff.TryGetValue(buffID, out var tag2) && !tag2.AllowsWhipStacking && buffID != type) + { + npc.DelBuff(i); + break; + } + } + } + } + if (type == BuffID.Webbed) { - if (npc.Calamity().webbed < npc.buffTime[buffIndex]) - npc.Calamity().webbed = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().webbed; - npc.DelBuff(buffIndex); - buffIndex--; - } - else if (type == BuffID.Slow) - { - if (npc.Calamity().slowed < npc.buffTime[buffIndex]) - npc.Calamity().slowed = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().slowed; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().webbed = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; } if (type == BuffID.Electrified) { - if (npc.Calamity().electrified < npc.buffTime[buffIndex]) - npc.Calamity().electrified = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().electrified = true; } } @@ -174,14 +208,6 @@ namespace CalamityMod.Buffs tip = tip.Replace("25", "15"); break; - case BuffID.Ironskin: - tip = tip.Replace("8", CalamityUtils.GetScalingDefense(-1).ToString()); - break; - - case BuffID.LeafCrystal: - tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.LeafCrystal"); - break; - case BuffID.MagicPower: tip = tip.Replace("20", "10"); break; @@ -215,6 +241,10 @@ namespace CalamityMod.Buffs tip = tip.Replace("45", "22.5"); break; + case BuffID.Rabies: + tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.Rabies"); + break; + case BuffID.SugarRush: tip = tip.Replace("20", "10"); break; @@ -223,10 +253,6 @@ namespace CalamityMod.Buffs tip = tip.Replace("25", "15"); break; - case BuffID.Warmth: - tip += "\n" + CalamityUtils.GetTextValue("Vanilla.BuffDescription.WarmthExtra"); - break; - case BuffID.WeaponImbueConfetti: tip = CalamityUtils.GetTextValue("Vanilla.BuffDescription.WeaponImbueConfetti"); break; diff --git a/Buffs/DamageOverTime/AstralInfectionDebuff.cs b/Buffs/DamageOverTime/AstralInfectionDebuff.cs index ba0bc276cf..f2245d91aa 100644 --- a/Buffs/DamageOverTime/AstralInfectionDebuff.cs +++ b/Buffs/DamageOverTime/AstralInfectionDebuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class AstralInfectionDebuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 75, + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().astralInfection < npc.buffTime[buffIndex]) - npc.Calamity().astralInfection = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().astralInfection = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/AuricRebuke.cs b/Buffs/DamageOverTime/AuricRebuke.cs index 3e465fa7a3..ccd2315908 100644 --- a/Buffs/DamageOverTime/AuricRebuke.cs +++ b/Buffs/DamageOverTime/AuricRebuke.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class AuricRebuke : ModBuff { + public static DebuffData debuffData = new DebuffData(DebuffData.DebuffBehavior.Electric) + { + EnemyLostRegen = 200, + ElectricDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().auricRebuke < npc.buffTime[buffIndex]) - npc.Calamity().auricRebuke = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().auricRebuke = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/BanishingFire.cs b/Buffs/DamageOverTime/BanishingFire.cs index 0e01549c42..23daa2a06f 100644 --- a/Buffs/DamageOverTime/BanishingFire.cs +++ b/Buffs/DamageOverTime/BanishingFire.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,12 +7,24 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BanishingFire : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 4000, //This is the minimum DoT. Banishing Fire scales with max HP + HeatDebuffScaling = 1, //Unused in the method, but kept so other things can know this is a heat debuff + NPCLifeRegenMethod = BanishingFireNPCLifeRegen + }; + public static void BanishingFireNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + int baseBanishingFireDoTValue = (int)npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo((npc.lifeMax >= 1000000 ? npc.lifeMax / 500 : debuffData.EnemyLostRegen)); + npc.Calamity().ApplyDPSDebuff(baseBanishingFireDoTValue, baseBanishingFireDoTValue / 5, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -21,10 +34,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().banishingFire < npc.buffTime[buffIndex]) - npc.Calamity().banishingFire = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().banishingFire = true; } } } diff --git a/Buffs/DamageOverTime/BrainRot.cs b/Buffs/DamageOverTime/BrainRot.cs index 6a2069e42b..0ff949281b 100644 --- a/Buffs/DamageOverTime/BrainRot.cs +++ b/Buffs/DamageOverTime/BrainRot.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BrainRot : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 40, + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().brainRot < npc.buffTime[buffIndex]) - npc.Calamity().brainRot = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().brainRot = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/BrimstoneFlames.cs b/Buffs/DamageOverTime/BrimstoneFlames.cs index 95a2d128b1..b05c42232b 100644 --- a/Buffs/DamageOverTime/BrimstoneFlames.cs +++ b/Buffs/DamageOverTime/BrimstoneFlames.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BrimstoneFlames : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 60, + HeatDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().bFlames = true; + player.Calamity().brimstoneFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().bFlames < npc.buffTime[buffIndex]) - npc.Calamity().bFlames = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().brimstoneFlames = true; } internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) diff --git a/Buffs/DamageOverTime/BurningBlood.cs b/Buffs/DamageOverTime/BurningBlood.cs index e8d988b9a4..76cf242847 100644 --- a/Buffs/DamageOverTime/BurningBlood.cs +++ b/Buffs/DamageOverTime/BurningBlood.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class BurningBlood : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 40, + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().bBlood = true; + player.Calamity().burningBlood = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().bBlood < npc.buffTime[buffIndex]) - npc.Calamity().bBlood = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().burningBlood = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/CrushDepth.cs b/Buffs/DamageOverTime/CrushDepth.cs index b10bc709aa..63c9fa2ebc 100644 --- a/Buffs/DamageOverTime/CrushDepth.cs +++ b/Buffs/DamageOverTime/CrushDepth.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class CrushDepth : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 100, + WaterDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().cDepth = true; + player.Calamity().crushDepth = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().cDepth < npc.buffTime[buffIndex]) - npc.Calamity().cDepth = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().crushDepth = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/Daybroken.cs b/Buffs/DamageOverTime/Daybroken.cs index 854ac4e535..81298bf7f4 100644 --- a/Buffs/DamageOverTime/Daybroken.cs +++ b/Buffs/DamageOverTime/Daybroken.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Boss; +using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; @@ -16,6 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = DebuffData.Daybroken; } public override void Update(Player player, ref int buffIndex) @@ -23,13 +26,13 @@ namespace CalamityMod.Buffs.DamageOverTime player.Calamity().daybroken = true; } - internal static void DrawEffects(PlayerDrawSet drawInfo, bool reducedEffects) + internal static void DrawEffects(PlayerDrawSet drawInfo) { Player Player = drawInfo.drawPlayer; - if (Main.rand.Next(reducedEffects ? 8 : 4) < 3) + if (Main.rand.Next(4) < 3) { - Dust solarDust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.OrangeTorch, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, reducedEffects ? 175 : 100, default, reducedEffects ? 2f : 3f); + Dust solarDust = Dust.NewDustDirect(Player.position, Player.width, Player.height, DustID.OrangeTorch, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); solarDust.noGravity = true; solarDust.velocity *= 2.8f; solarDust.velocity.Y -= 0.5f; diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 7b35b79c72..b0dd928cf1 100644 --- a/Buffs/DamageOverTime/DemonicFlames.cs +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Particles; using CalamityMod.Projectiles.Pets; @@ -12,6 +13,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class DemonicFlames : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 60, //Unused in the method, this is the amount of DoT from Forbidden Oathblade demon flames + HeatDebuffScaling = 1, //Unused in the method, but kept so other things can know this is a heat debuff + NPCLifeRegenMethod = DemonFlamesNPCLifeRegen + }; + public static void DemonFlamesNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + int baseDemonicFlamesDoTValue = (int)Math.Max(npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(npc.Calamity().demonicFlamesBonusDamage), npc.Calamity().demonicFlamesBonusDamage); + npc.Calamity().ApplyDPSDebuff(baseDemonicFlamesDoTValue, baseDemonicFlamesDoTValue / 15, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; @@ -27,10 +39,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().demonicFlames < npc.buffTime[buffIndex]) - npc.Calamity().demonicFlames = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().demonicFlames = true; } internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) diff --git a/Buffs/DamageOverTime/Dragonfire.cs b/Buffs/DamageOverTime/Dragonfire.cs index 6314a32eef..bc3ff034b3 100644 --- a/Buffs/DamageOverTime/Dragonfire.cs +++ b/Buffs/DamageOverTime/Dragonfire.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Dragonfire : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 960, + HeatDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().dragonFire < npc.buffTime[buffIndex]) - npc.Calamity().dragonFire = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().dragonFire = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/ElementalMix.cs b/Buffs/DamageOverTime/ElementalMix.cs index 6f64dace2c..d53e442b47 100644 --- a/Buffs/DamageOverTime/ElementalMix.cs +++ b/Buffs/DamageOverTime/ElementalMix.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -10,12 +11,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class ElementalMix : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 400 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -25,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().elementalMix < npc.buffTime[buffIndex]) - npc.Calamity().elementalMix = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().elementalMix = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/GodSlayerInferno.cs b/Buffs/DamageOverTime/GodSlayerInferno.cs index 9f892fb2b2..f7d799fafa 100644 --- a/Buffs/DamageOverTime/GodSlayerInferno.cs +++ b/Buffs/DamageOverTime/GodSlayerInferno.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class GodSlayerInferno : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 500, + HeatDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().gsInferno = true; + player.Calamity().godSlayerInferno = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().gsInferno < npc.buffTime[buffIndex]) - npc.Calamity().gsInferno = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().godSlayerInferno = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/HadopelagicPressure.cs b/Buffs/DamageOverTime/HadopelagicPressure.cs index f4edd97b85..7cde6908ed 100644 --- a/Buffs/DamageOverTime/HadopelagicPressure.cs +++ b/Buffs/DamageOverTime/HadopelagicPressure.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HadopelagicPressure : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 400, + WaterDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().hPressure = true; + player.Calamity().hadopelagicPressure = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().hPressure < npc.buffTime[buffIndex]) - npc.Calamity().hPressure = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().hadopelagicPressure = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/HeavyBleeding.cs b/Buffs/DamageOverTime/HeavyBleeding.cs index 340845ce9e..1818a4d299 100644 --- a/Buffs/DamageOverTime/HeavyBleeding.cs +++ b/Buffs/DamageOverTime/HeavyBleeding.cs @@ -1,6 +1,7 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,12 +11,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HeavyBleeding : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 80 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -25,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().heavybleeding < npc.buffTime[buffIndex]) - npc.Calamity().heavybleeding = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().heavyBleeding = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) { diff --git a/Buffs/DamageOverTime/HolyFlames.cs b/Buffs/DamageOverTime/HolyFlames.cs index c4936b2e2a..84a60b5e22 100644 --- a/Buffs/DamageOverTime/HolyFlames.cs +++ b/Buffs/DamageOverTime/HolyFlames.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HolyFlames : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 300, + HeatDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().hFlames = true; + player.Calamity().holyFlames = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().hFlames < npc.buffTime[buffIndex]) - npc.Calamity().hFlames = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().holyFlames = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/HolyInferno.cs b/Buffs/DamageOverTime/HolyInferno.cs index 1cf1741ee8..eaf25ad6a1 100644 --- a/Buffs/DamageOverTime/HolyInferno.cs +++ b/Buffs/DamageOverTime/HolyInferno.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,17 +7,24 @@ namespace CalamityMod.Buffs.DamageOverTime { public class HolyInferno : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 10000, //this is never applied to enemies + HeatDebuffScaling = 1, + GearCanModifyDebuff = false + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().hInferno = true; + player.Calamity().holyInferno = true; } } } diff --git a/Buffs/DamageOverTime/Laceration.cs b/Buffs/DamageOverTime/Laceration.cs index 621b51dfe4..4e81b40d4a 100644 --- a/Buffs/DamageOverTime/Laceration.cs +++ b/Buffs/DamageOverTime/Laceration.cs @@ -1,6 +1,7 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; -using System; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,12 +11,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Laceration : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 400 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -25,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().laceration < npc.buffTime[buffIndex]) - npc.Calamity().laceration = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().laceration = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) { diff --git a/Buffs/DamageOverTime/ManaBurn.cs b/Buffs/DamageOverTime/ManaBurn.cs index c14439fd3b..c3b1cc9dd2 100644 --- a/Buffs/DamageOverTime/ManaBurn.cs +++ b/Buffs/DamageOverTime/ManaBurn.cs @@ -6,47 +6,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class ManaBurn : ModBuff { + //as of now, this doesn't use the custom debuff system due to the debuff being a front for the actual effects in the Chaos Stone rework public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + Main.buffNoTimeDisplay[Type] = true; } - - // Mana Burn's actual effects are controlled by CalamityPlayer code. - // However, every frame you have Mana Burn, it automatically scans for and removes Mana Sickness if you somehow have it simultaneously. - // This would only occur if other mods added Mana Burn to the player via esoteric means, as AddBuff is IL edited by Calamity. - // If found, it adds the remaining time of that Mana Sickness to Mana Burn, capping at its usual duration cap. public override void Update(Player player, ref int buffIndex) { player.Calamity().ManaBurn = true; - - int manaSicknessIndex = player.FindBuffIndex(BuffID.ManaSickness); - if (manaSicknessIndex != -1) - { - // Set the remaining duration of Mana Sickness to 1 frame so it disappears either this or the next frame. - // If it would disappear the next frame because it was already iterated over, then add 1 less frame of Mana Burn. - bool extraFrame = manaSicknessIndex < buffIndex; - int timeToAdd = player.buffTime[manaSicknessIndex] - (extraFrame ? 1 : 0); - player.buffTime[manaSicknessIndex] = 1; - - // Add that time to Mana Burn. - int newBuffTime = player.buffTime[buffIndex] + timeToAdd; - if (newBuffTime > Player.manaSickTimeMax) - newBuffTime = Player.manaSickTimeMax; - player.buffTime[buffIndex] = newBuffTime; - } - } - - public override bool ReApply(Player player, int time, int buffIndex) - { - // Logic copy pasted from Mana Sickness - player.buffTime[buffIndex] += time; - if (player.buffTime[buffIndex] > Player.manaSickTimeMax) - player.buffTime[buffIndex] = Player.manaSickTimeMax; - - // Skip vanilla re-apply logic - return true; } } } diff --git a/Buffs/DamageOverTime/MiracleBlight.cs b/Buffs/DamageOverTime/MiracleBlight.cs index df93272cbd..690550c58c 100644 --- a/Buffs/DamageOverTime/MiracleBlight.cs +++ b/Buffs/DamageOverTime/MiracleBlight.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,17 @@ namespace CalamityMod.Buffs.DamageOverTime { public class MiracleBlight : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 3000 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +30,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().miracleBlight < npc.buffTime[buffIndex]) - npc.Calamity().miracleBlight = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().miracleBlight = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/Nightwither.cs b/Buffs/DamageOverTime/Nightwither.cs index a6d24f65c1..dbdbef4d02 100644 --- a/Buffs/DamageOverTime/Nightwither.cs +++ b/Buffs/DamageOverTime/Nightwither.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Nightwither : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 200, + ColdDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,29 +31,26 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().nightwither < npc.buffTime[buffIndex]) - npc.Calamity().nightwither = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().nightwither = true; } - internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + internal static void DrawEffects(PlayerDrawSet drawInfo) { Player Player = drawInfo.drawPlayer; - if (Main.rand.NextBool(hasDebuffResistance ? 4 : 2)) + if (Main.rand.NextBool(2)) { Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); - CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, (hasDebuffResistance ? 0.4f : 0.8f), 15, 2f, 1.9f); + CritSpark spark = new CritSpark(Player.Calamity().RandomDebuffVisualSpot, Vect, Main.rand.NextBool() ? Color.Cyan : Color.Turquoise, Color.PaleTurquoise, 0.8f, 15, 2f, 1.9f); GeneralParticleHandler.SpawnParticle(spark); } - for (int i = 0; i < (hasDebuffResistance ? 1 : 2); i++) + for (int i = 0; i < 2; i++) { Vector2 dustCorner = Player.position - 2f * Vector2.One; Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); Dust moonDust = Dust.NewDustDirect(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 300 : 323, dustVel.X, dustVel.Y); moonDust.noGravity = true; - moonDust.scale = hasDebuffResistance ? Main.rand.NextFloat(0.3f, 0.3f) : Main.rand.NextFloat(0.5f, 0.5f); + moonDust.scale = Main.rand.NextFloat(0.5f, 0.5f); moonDust.alpha = 235; } } diff --git a/Buffs/DamageOverTime/Plague.cs b/Buffs/DamageOverTime/Plague.cs index f776337e36..45875dc587 100644 --- a/Buffs/DamageOverTime/Plague.cs +++ b/Buffs/DamageOverTime/Plague.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,25 +10,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Plague : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 100, + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().pFlames = true; + player.Calamity().plague = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().pFlames < npc.buffTime[buffIndex]) - npc.Calamity().pFlames = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().plague = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/RiptideDebuff.cs b/Buffs/DamageOverTime/RiptideDebuff.cs index 62816f8004..3757d46763 100644 --- a/Buffs/DamageOverTime/RiptideDebuff.cs +++ b/Buffs/DamageOverTime/RiptideDebuff.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -8,25 +9,28 @@ namespace CalamityMod.Buffs.DamageOverTime { public class RiptideDebuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 30, + WaterDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().rTide = true; + player.Calamity().riptide = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().rTide < npc.buffTime[buffIndex]) - npc.Calamity().rTide = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().riptide = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/SagePoison.cs b/Buffs/DamageOverTime/SagePoison.cs index 623c95a1a5..27cbd603f0 100644 --- a/Buffs/DamageOverTime/SagePoison.cs +++ b/Buffs/DamageOverTime/SagePoison.cs @@ -1,22 +1,57 @@ -using Terraria; +using CalamityMod.DataStructures; +using CalamityMod.Systems.Collections; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime { public class SagePoison : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 50, + SicknessDebuffScaling = 1, + NPCLifeRegenMethod = SagePoisonPower + }; + + public static float ViridVanguardPoisonMultiplier => 2; + public static void SagePoisonPower(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + // The base DoT is multiplied by the amount of Viral Sprouts you have when applied + // See SageNeedle.cs for details + + //Reduce power of weakness/resistances but leave sickness debuff boosters at full power + //We first need to apply Irradiated as that isn't included in SicknessDebuffMultiplier due to needing to dynamically update if Irradiated is applied + StatModifier multiplier = npc.Calamity().SicknessDebuffMultiplier; + if (npc.Calamity().irradiated) + multiplier += npc.Calamity().scionsCurioEffected ? 1.75f : 1f; + + bool wormBoss = CalamityNPCTypeSets.DesertScourge.Contains(npc.type) || CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || CalamityNPCTypeSets.Perforators.Contains(npc.type) || + CalamityNPCTypeSets.AquaticScourge.Contains(npc.type) || CalamityNPCTypeSets.AstrumDeus.Contains(npc.type) || CalamityNPCTypeSets.StormWeaver.Contains(npc.type); + float NewWeaknessEffectiveness = 1.25f; //1.25x DPS instead of 2x - 1/4th the effectiveness + float NewWeaknessEffectivenessWorm = 1.125f; //1.125x DPS instead of 1.5x - 1/4th the effectiveness + float NewResistanceEffectiveness = 0.875f; // 0.875x instead of 0.5x - 1/4th the effectiveness + + if (npc.Calamity().VulnerableToSickness.HasValue) + if (npc.Calamity().VulnerableToSickness.Value) + multiplier *= (wormBoss ? NewWeaknessEffectivenessWorm : NewWeaknessEffectiveness); + else + multiplier *= NewResistanceEffectiveness; + + //Apply the DOT + int baseSagePoisonDoTValue = (int)multiplier.ApplyTo(npc.Calamity().sagePoisonDamage); + npc.Calamity().ApplyDPSDebuff(baseSagePoisonDoTValue, baseSagePoisonDoTValue / 5, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().sagePoisonTime < npc.buffTime[buffIndex]) - npc.Calamity().sagePoisonTime = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().sagePoison = true; } } } diff --git a/Buffs/DamageOverTime/SearingLava.cs b/Buffs/DamageOverTime/SearingLava.cs index c17fff2bcf..539316df4b 100644 --- a/Buffs/DamageOverTime/SearingLava.cs +++ b/Buffs/DamageOverTime/SearingLava.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime @@ -6,17 +7,23 @@ namespace CalamityMod.Buffs.DamageOverTime [LegacyName("CragsLava")] public class SearingLava : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 1000, //Never infliced on enemies, token value. Really high bc this hurts a lot on players + HeatDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.buffNoTimeDisplay[Type] = true; Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().cragsLava = true; + player.Calamity().searingLava = true; } } } diff --git a/Buffs/DamageOverTime/Shadowflame.cs b/Buffs/DamageOverTime/Shadowflame.cs index d97c8889ed..3b89427e23 100644 --- a/Buffs/DamageOverTime/Shadowflame.cs +++ b/Buffs/DamageOverTime/Shadowflame.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.DataStructures; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -17,6 +18,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = DebuffData.Shadowflame; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/DamageOverTime/ShellfishClaps.cs b/Buffs/DamageOverTime/ShellfishClaps.cs index 697a8f241b..00a8c48f9d 100644 --- a/Buffs/DamageOverTime/ShellfishClaps.cs +++ b/Buffs/DamageOverTime/ShellfishClaps.cs @@ -1,23 +1,57 @@ -using Terraria; +using CalamityMod.Balancing; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Summon; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime { public class ShellfishClaps : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 150, //Damage per shellfish + NPCLifeRegenMethod = ShellfishStacking + }; + public static void ShellfishStacking(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + int projectileCount = 0; + int owner = 255; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && + p.ai[0] == 1f && p.ai[1] == npc.whoAmI) + { + owner = p.owner; + projectileCount++; + if (projectileCount >= 5) + { + projectileCount = 5; + break; + } + } + } + + Item heldItem = Main.player[owner].ActiveItem(); + int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(debuffData.EnemyLostRegen); + + if (CalamityUtils.ShouldTriggerSummonPenalty(Main.player[owner], heldItem)) + totalDamage = (int)(totalDamage * BalancingConstants.SummonerCrossClassNerf); + + int totalDisplayedDamage = totalDamage / 5; + npc.Calamity().ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().shellfishVore < npc.buffTime[buffIndex]) - npc.Calamity().shellfishVore = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().shellfishStaffDebuff = true; } } } diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index d46d375305..bd168fd492 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -11,6 +11,8 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Shred : ModBuff { + //This is not ported to the custom debuff system yet due to the complexities of it. + //I didn't want to break it! It will be done in a future PR internal const int StackFalloffFrames = 320; // This deals 600 DPS per stack, is boosted by ranged stats and can supercrit. diff --git a/Buffs/DamageOverTime/SnapClamDebuff.cs b/Buffs/DamageOverTime/SnapClamDebuff.cs index e11f1205a6..83d7f2a580 100644 --- a/Buffs/DamageOverTime/SnapClamDebuff.cs +++ b/Buffs/DamageOverTime/SnapClamDebuff.cs @@ -1,23 +1,47 @@ -using Terraria; +using CalamityMod.Balancing; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime { public class SnapClamDebuff : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 15, //Damage per shellfish + NPCLifeRegenMethod = ShellfishStacking + }; + public static void ShellfishStacking(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + + int projectileCount = 0; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.ai[0] == 1f && p.ai[1] == npc.whoAmI) + { + if (p.type == ModContent.ProjectileType()) + projectileCount += 2; + if (p.type == ModContent.ProjectileType()) + projectileCount++; + } + } + + npc.Calamity().ApplyDPSDebuff((int)(projectileCount * debuffData.EnemyLostRegen), projectileCount * 3, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().clamDebuff < npc.buffTime[buffIndex]) - npc.Calamity().clamDebuff = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().snapClamDebuff = true; } } } diff --git a/Buffs/DamageOverTime/StaticDischarge.cs b/Buffs/DamageOverTime/StaticDischarge.cs index aa7de883cd..53ad81641b 100644 --- a/Buffs/DamageOverTime/StaticDischarge.cs +++ b/Buffs/DamageOverTime/StaticDischarge.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class StaticDischarge : ModBuff { + public static DebuffData debuffData = new DebuffData(DebuffData.DebuffBehavior.Electric) + { + EnemyLostRegen = 5, + ElectricDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().staticDischarge < npc.buffTime[buffIndex]) - npc.Calamity().staticDischarge = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().staticDischarge = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/SulphuricPoisoning.cs b/Buffs/DamageOverTime/SulphuricPoisoning.cs index f71550c714..79c6a49b58 100644 --- a/Buffs/DamageOverTime/SulphuricPoisoning.cs +++ b/Buffs/DamageOverTime/SulphuricPoisoning.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class SulphuricPoisoning : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 240, + SicknessDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; // Acid Venom immunity is granted automatically if you are immune to Sulphuric Poisoning. BuffID.Sets.GrantImmunityWith[BuffID.Venom].Add(Type); @@ -33,10 +40,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().sulphurPoison < npc.buffTime[buffIndex]) - npc.Calamity().sulphurPoison = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().sulphurPoison = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs index 72910c2fa8..dbff53547b 100644 --- a/Buffs/DamageOverTime/TrueVulnerabilityHex.cs +++ b/Buffs/DamageOverTime/TrueVulnerabilityHex.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Systems.Collections; @@ -12,11 +13,13 @@ namespace CalamityMod.Buffs.DamageOverTime { public class TrueVulnerabilityHex : ModBuff { - // The visual number displayed in ticks as the enemy takes damage. - public const int TickNumber = 666; - - // The exact amount True Vulnerability Hex reduces NPC life regen by. - public const int DPS = TickNumber * 6; // -3996 life regen, 1998 DPS + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 3996, //6x the tick size + SicknessDebuffScaling = 1, + MinimumDamageTickSize = 666, //Vhex should always have ticks of 666 + MultiplierDamageTickSize = 0 + }; public override void SetStaticDefaults() { @@ -25,6 +28,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().trueVHex = true; @@ -32,21 +36,14 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { CalamityGlobalNPC cgn = npc.Calamity(); - if (cgn.trueVulnerabilityHex < npc.buffTime[buffIndex]) - { - cgn.trueVulnerabilityHex = npc.buffTime[buffIndex]; - // Set the remaining time of the fire drawer to be exactly right. - if (cgn.VulnerabilityHexFireDrawer != null) - cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + cgn.trueVulnerabilityHex; - } + //If this isn't here the drawcode gives an index out of bounds + if (npc.buffTime[buffIndex] > 1) + cgn.trueVulnerabilityHex = true; + if (cgn.VulnerabilityHexFireDrawer != null) + cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + npc.buffTime[buffIndex]; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && cgn.debuffResistanceTimer <= 0) + cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; - // Apply immunity timer. - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) - cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex; - - // Destroy the vanilla buff, we don't use it. - npc.DelBuff(buffIndex); - buffIndex--; } internal static void DrawEffects(NPC npc, ref Color drawColor) diff --git a/Buffs/DamageOverTime/Vaporfied.cs b/Buffs/DamageOverTime/Vaporfied.cs index f4dd7d5fee..e10223020b 100644 --- a/Buffs/DamageOverTime/Vaporfied.cs +++ b/Buffs/DamageOverTime/Vaporfied.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs; +using CalamityMod.DataStructures; +using CalamityMod.NPCs; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Terraria; @@ -10,12 +11,19 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Vaporfied : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 30, + MinimumDamageTickSize = 6, + MultiplierDamageTickSize = 0 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -25,12 +33,9 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().vaporfied < npc.buffTime[buffIndex]) - npc.Calamity().vaporfied = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().vaporfied = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin +npc.buffTime[buffIndex]; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/VermillionFlux.cs b/Buffs/DamageOverTime/VermillionFlux.cs index f62f39c83c..dcf35efc3e 100644 --- a/Buffs/DamageOverTime/VermillionFlux.cs +++ b/Buffs/DamageOverTime/VermillionFlux.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class VermillionFlux : ModBuff { + public static DebuffData debuffData = new DebuffData(DebuffData.DebuffBehavior.Electric) + { + EnemyLostRegen = 100, + ElectricDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().vermillionFlux < npc.buffTime[buffIndex]) - npc.Calamity().vermillionFlux = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().vermillionFlux = true; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/DamageOverTime/Voidfrost.cs b/Buffs/DamageOverTime/Voidfrost.cs index 8452f0b9cb..145611890b 100644 --- a/Buffs/DamageOverTime/Voidfrost.cs +++ b/Buffs/DamageOverTime/Voidfrost.cs @@ -1,4 +1,5 @@ -using CalamityMod.Particles; +using CalamityMod.DataStructures; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,12 +10,18 @@ namespace CalamityMod.Buffs.DamageOverTime { public class Voidfrost : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 200, + ColdDebuffScaling = 1 + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -24,10 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().voidfrost < npc.buffTime[buffIndex]) - npc.Calamity().voidfrost = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().voidfrost = true; } internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) diff --git a/Buffs/DamageOverTime/VulnerabilityHex.cs b/Buffs/DamageOverTime/VulnerabilityHex.cs index 45c6a98946..fcde0194fb 100644 --- a/Buffs/DamageOverTime/VulnerabilityHex.cs +++ b/Buffs/DamageOverTime/VulnerabilityHex.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Systems.Collections; @@ -12,11 +13,13 @@ namespace CalamityMod.Buffs.DamageOverTime { public class VulnerabilityHex : ModBuff { - // The visual number displayed in ticks as the enemy takes damage. - public const int TickNumber = 666; - - // The exact amount Vulnerability Hex reduces NPC life regen by. - public const int DPS = TickNumber * 4; // -2664 life regen, 1332 DPS + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 2664, //4x tick size + HeatDebuffScaling = 1, + MinimumDamageTickSize = 666, + MultiplierDamageTickSize = 0 + }; public const int CalamityDuration = 60; public const int AflameDuration = 120; @@ -28,6 +31,7 @@ namespace CalamityMod.Buffs.DamageOverTime Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true; @@ -35,21 +39,17 @@ namespace CalamityMod.Buffs.DamageOverTime public override void Update(NPC npc, ref int buffIndex) { CalamityGlobalNPC cgn = npc.Calamity(); - if (cgn.vulnerabilityHex < npc.buffTime[buffIndex]) - { - cgn.vulnerabilityHex = npc.buffTime[buffIndex]; - // Set the remaining time of the fire drawer to be exactly right. - if (cgn.VulnerabilityHexFireDrawer != null) - cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + cgn.vulnerabilityHex; - } + + //If this isn't here the drawcode gives an index out of bounds + if (npc.buffTime[buffIndex] > 1) + cgn.vulnerabilityHex = true; + // Set the remaining time of the fire drawer to be exactly right. + if (cgn.VulnerabilityHexFireDrawer != null) + cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + npc.buffTime[buffIndex]; // Apply immunity timer. - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0) - cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.vulnerabilityHex; - - // Destroy the vanilla buff, we don't use it. - npc.DelBuff(buffIndex); - buffIndex--; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && cgn.debuffResistanceTimer <= 0) + cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + +npc.buffTime[buffIndex]; } internal static void DrawEffects(PlayerDrawSet drawInfo) { diff --git a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs index 026531e132..645c418293 100644 --- a/Buffs/DamageOverTime/WeakBrimstoneFlames.cs +++ b/Buffs/DamageOverTime/WeakBrimstoneFlames.cs @@ -1,16 +1,23 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.DamageOverTime { public class WeakBrimstoneFlames : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 10, //This is never infliced on enemies, this is just a token value + HeatDebuffScaling = 1, + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; Main.buffNoTimeDisplay[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) => player.Calamity().weakBrimstoneFlames = true; diff --git a/Buffs/Mounts/AlicornBuff.cs b/Buffs/Mounts/AlicornBuff.cs deleted file mode 100644 index 34dad87b5a..0000000000 --- a/Buffs/Mounts/AlicornBuff.cs +++ /dev/null @@ -1,21 +0,0 @@ -using CalamityMod.Items.Mounts; -using Terraria; -using Terraria.ModLoader; -namespace CalamityMod.Buffs.Mounts -{ - public class AlicornBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.mount.SetMount(ModContent.MountType(), player); - player.buffTime[buffIndex] = 10; - player.Calamity().fab = true; - } - } -} diff --git a/Buffs/Mounts/AlicornBuff.png b/Buffs/Mounts/AlicornBuff.png deleted file mode 100644 index f821a3a2bb..0000000000 Binary files a/Buffs/Mounts/AlicornBuff.png and /dev/null differ diff --git a/Buffs/Mounts/BrimroseMount.cs b/Buffs/Mounts/BrimroseMount.cs index 787bc90c18..9b8cdac784 100644 --- a/Buffs/Mounts/BrimroseMount.cs +++ b/Buffs/Mounts/BrimroseMount.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Buffs.Mounts public override void Update(Player player, ref int buffIndex) { - player.mount.SetMount(ModContent.MountType(), player); + player.mount.SetMount(ModContent.MountType(), player); player.buffTime[buffIndex] = 10; } } diff --git a/Buffs/Pets/ReaverOrbBuff.cs b/Buffs/Pets/ReaverOrbBuff.cs deleted file mode 100644 index 3be4f5a02b..0000000000 --- a/Buffs/Pets/ReaverOrbBuff.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Projectiles.Typeless; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.Pets -{ - public class ReaverOrbBuff : ModBuff - { - public override void SetStaticDefaults() - { - Main.buffNoTimeDisplay[Type] = true; - Main.buffNoSave[Type] = true; - //Main.persistentBuff[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - CalamityPlayer modPlayer = player.Calamity(); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) - { - modPlayer.rOrb = true; - } - if (!modPlayer.rOrb) - { - player.DelBuff(buffIndex); - buffIndex--; - } - else - { - player.buffTime[buffIndex] = 18000; - } - } - } -} diff --git a/Buffs/Pets/ReaverOrbBuff.png b/Buffs/Pets/ReaverOrbBuff.png deleted file mode 100644 index 61a7e2e2d2..0000000000 Binary files a/Buffs/Pets/ReaverOrbBuff.png and /dev/null differ diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.cs b/Buffs/Placeables/BlueCandleBuff.cs similarity index 95% rename from Buffs/Placeables/CirrusBlueCandleBuff.cs rename to Buffs/Placeables/BlueCandleBuff.cs index 96900379fe..a505abfa28 100644 --- a/Buffs/Placeables/CirrusBlueCandleBuff.cs +++ b/Buffs/Placeables/BlueCandleBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusBlueCandleBuff : ModBuff + public class BlueCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.png b/Buffs/Placeables/BlueCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusBlueCandleBuff.png rename to Buffs/Placeables/BlueCandleBuff.png diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/PinkCandleBuff.cs similarity index 95% rename from Buffs/Placeables/CirrusPinkCandleBuff.cs rename to Buffs/Placeables/PinkCandleBuff.cs index 9701a42348..5bdbbb661b 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/PinkCandleBuff.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusPinkCandleBuff : ModBuff + public class PinkCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.png b/Buffs/Placeables/PinkCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusPinkCandleBuff.png rename to Buffs/Placeables/PinkCandleBuff.png diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/PurpleCandleBuff.cs similarity index 96% rename from Buffs/Placeables/CirrusPurpleCandleBuff.cs rename to Buffs/Placeables/PurpleCandleBuff.cs index 1ac263a413..e4d54e4bee 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/PurpleCandleBuff.cs @@ -5,7 +5,7 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Placeables { - public class CirrusPurpleCandleBuff : ModBuff + public class PurpleCandleBuff : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.png b/Buffs/Placeables/PurpleCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusPurpleCandleBuff.png rename to Buffs/Placeables/PurpleCandleBuff.png diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/YellowCandleBuff.cs similarity index 96% rename from Buffs/Placeables/CirrusYellowCandleBuff.cs rename to Buffs/Placeables/YellowCandleBuff.cs index 8728f074dc..eee56221ff 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/YellowCandleBuff.cs @@ -6,7 +6,8 @@ using static Terraria.NPC; namespace CalamityMod.Buffs.Placeables { - public class CirrusYellowCandleBuff : ModBuff + public class YellowCandleBuff + : ModBuff { public override void SetStaticDefaults() { diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.png b/Buffs/Placeables/YellowCandleBuff.png similarity index 100% rename from Buffs/Placeables/CirrusYellowCandleBuff.png rename to Buffs/Placeables/YellowCandleBuff.png diff --git a/Buffs/PopoBuff.cs b/Buffs/PopoBuff.cs index f5d8e36d54..4b433f99ae 100644 --- a/Buffs/PopoBuff.cs +++ b/Buffs/PopoBuff.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories.Vanity; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -18,11 +19,7 @@ namespace CalamityMod.Buffs public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.snowmanPrevious) - { - modPlayer.snowmanPower = true; - } - else + if (player.Transformation().Type != ModContent.ItemType()) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/PopoNoselessBuff.cs b/Buffs/PopoNoselessBuff.cs index ed87c9db8d..fd284151e7 100644 --- a/Buffs/PopoNoselessBuff.cs +++ b/Buffs/PopoNoselessBuff.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Accessories.Vanity; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,11 +18,8 @@ namespace CalamityMod.Buffs public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.snowmanPrevious) - { - modPlayer.snowmanPower = true; + if (player.Transformation().Type == ModContent.ItemType()) modPlayer.snowmanNoseless = true; - } else { player.DelBuff(buffIndex); diff --git a/Buffs/Potions/ShadowBuff.png b/Buffs/Potions/ShadowBuff.png index ed4141070a..bb0b1ed058 100644 Binary files a/Buffs/Potions/ShadowBuff.png and b/Buffs/Potions/ShadowBuff.png differ diff --git a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs index e1757ba91c..68c5c642f7 100644 --- a/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs +++ b/Buffs/StatBuffs/AbyssalDivingSuitBuff.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Buffs.StatBuffs player.maxFallSpeed = 9f; player.gills = true; } - modPlayer.abyssalDivingSuitPower = true; modPlayer.depthCharm = true; modPlayer.jellyfishNecklace = true; modPlayer.anechoicPlating = true; diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index 84d8e687ad..23871659dc 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.Calamity().adrenalineModeActive = true; - player.Calamity().AdrenalineTrail = true; } public override void ModifyBuffText(ref string buffName, ref string tip, ref int rare) diff --git a/Buffs/StatBuffs/AquaticHeartBuff.cs b/Buffs/StatBuffs/AquaticHeartBuff.cs index 344acacd15..5dde4436f3 100644 --- a/Buffs/StatBuffs/AquaticHeartBuff.cs +++ b/Buffs/StatBuffs/AquaticHeartBuff.cs @@ -20,14 +20,13 @@ namespace CalamityMod.Buffs.StatBuffs CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.aquaticHeartPrevious) { - modPlayer.aquaticHeartPower = true; player.ignoreWater = NPC.downedBoss3; player.accFlipper = true; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss && NPC.downedBoss3) { player.breath = player.breathMax + 3; } - if (Main.myPlayer == player.whoAmI && player.wet && NPC.downedBoss3) + if (Main.myPlayer == player.whoAmI && player.Calamity().countsAsAnyWet && NPC.downedBoss3) { player.AddBuff(ModContent.BuffType(), 360); } diff --git a/Buffs/StatBuffs/BrutalCarnage.cs b/Buffs/StatBuffs/BrutalCarnage.cs deleted file mode 100644 index bcb31db8f7..0000000000 --- a/Buffs/StatBuffs/BrutalCarnage.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Terraria; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class BrutalCarnage : ModBuff - { - public static float MeleeDamageBoost = 0.2f; - public override LocalizedText Description => base.Description.WithFormatArgs(MeleeDamageBoost.ToPercent()); - - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().brutalCarnage = true; - } - } -} diff --git a/Buffs/StatBuffs/BrutalCarnage.png b/Buffs/StatBuffs/BrutalCarnage.png deleted file mode 100644 index 9b3ce4f18a..0000000000 Binary files a/Buffs/StatBuffs/BrutalCarnage.png and /dev/null differ diff --git a/Buffs/StatBuffs/KamiBuff.cs b/Buffs/StatBuffs/KamiBuff.cs deleted file mode 100644 index 1f0a06c940..0000000000 --- a/Buffs/StatBuffs/KamiBuff.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.Items.Weapons.Typeless; -using Terraria; -using Terraria.Audio; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatBuffs -{ - public class KamiBuff : ModBuff - { - public override LocalizedText Description => base.Description.WithFormatArgs(YanmeisKnife.RunSpeedBoost.ToPercent()); - - public override void SetStaticDefaults() - { - Main.debuff[Type] = false; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = true; - } - - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().kamiBoost = true; - if (player.buffTime[buffIndex] == 1) - SoundEngine.PlaySound(YanmeisKnife.ExpireSound, player.Center); - } - } -} diff --git a/Buffs/StatBuffs/KamiBuff.png b/Buffs/StatBuffs/KamiBuff.png deleted file mode 100644 index 4fdc0fff94..0000000000 Binary files a/Buffs/StatBuffs/KamiBuff.png and /dev/null differ diff --git a/Buffs/StatBuffs/Mushy.cs b/Buffs/StatBuffs/Mushy.cs index 23ae4f785c..c5c5fc1aa8 100644 --- a/Buffs/StatBuffs/Mushy.cs +++ b/Buffs/StatBuffs/Mushy.cs @@ -8,7 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class Mushy : ModBuff { - public static int DefenseBoost = 8; + public static int DefenseBoost = 5; public static int RegenBoost = 2; public override LocalizedText Description => base.Description.WithFormatArgs(DefenseBoost, RegenBoost.ToRegenPerSecond()); diff --git a/Buffs/StatBuffs/SpiritDefense.cs b/Buffs/StatBuffs/SpiritDefense.cs index 664de50b2b..ad39d8d70d 100644 --- a/Buffs/StatBuffs/SpiritDefense.cs +++ b/Buffs/StatBuffs/SpiritDefense.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class SpiritDefense : ModBuff { - public override LocalizedText Description => base.Description.WithFormatArgs(SpiritGlyph.DefenseBoost, SpiritGlyph.DamageReductionBoost.ToPercent()); + public override LocalizedText Description => base.Description.WithFormatArgs(SpiritGlyph.DefenseBoost); public override void SetStaticDefaults() { @@ -20,7 +20,6 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.statDefense += SpiritGlyph.DefenseBoost; - player.endurance += SpiritGlyph.DamageReductionBoost; // TODO -- is this applied too late to be affected by the DR softcap? } } } diff --git a/Buffs/StatBuffs/TarragonCloak.cs b/Buffs/StatBuffs/TarragonCloak.cs index bcd5138b3d..12e659b6e0 100644 --- a/Buffs/StatBuffs/TarragonCloak.cs +++ b/Buffs/StatBuffs/TarragonCloak.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Armor.Tarragon; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -7,8 +8,7 @@ namespace CalamityMod.Buffs.StatBuffs { public class TarragonCloak : ModBuff { - public static double ContactDamageReduction = 0.5D; - public override LocalizedText Description => base.Description.WithFormatArgs(ContactDamageReduction.ToPercent()); + public override LocalizedText Description => base.Description.WithFormatArgs(TarragonHeadMelee.CloakContactDamageReduction.ToPercent()); public override void SetStaticDefaults() { diff --git a/Buffs/StatDebuffs/AbsorberAffliction.cs b/Buffs/StatDebuffs/AbsorberAffliction.cs index f166ee030d..55df57f042 100644 --- a/Buffs/StatDebuffs/AbsorberAffliction.cs +++ b/Buffs/StatDebuffs/AbsorberAffliction.cs @@ -1,4 +1,5 @@ -using CalamityMod.Dusts; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; @@ -8,19 +9,24 @@ namespace CalamityMod.Buffs.StatDebuffs { public class AbsorberAffliction : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 400, + SicknessDebuffScaling = 1, + MultiplierDamageTickSize = 1 / 20f + + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; Main.pvpBuff[Type] = true; Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().absorberAffliction < npc.buffTime[buffIndex]) - npc.Calamity().absorberAffliction = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().absorberAffliction = true; } internal static void DrawEffects(NPC npc, ref Color drawColor) diff --git a/Buffs/StatDebuffs/ArmorCrunch.cs b/Buffs/StatDebuffs/ArmorCrunch.cs index d01829fdb0..6d8a7c61b3 100644 --- a/Buffs/StatDebuffs/ArmorCrunch.cs +++ b/Buffs/StatDebuffs/ArmorCrunch.cs @@ -22,15 +22,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().aCrunch < npc.buffTime[buffIndex]) - npc.Calamity().aCrunch = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().armorCrunch = true; } public override void Update(Player player, ref int buffIndex) { - player.Calamity().aCrunch = true; + player.Calamity().armorCrunch = true; } } } diff --git a/Buffs/StatDebuffs/Crumbling.cs b/Buffs/StatDebuffs/Crumbling.cs index 2173cf756b..2539449caf 100644 --- a/Buffs/StatDebuffs/Crumbling.cs +++ b/Buffs/StatDebuffs/Crumbling.cs @@ -22,10 +22,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().crumble < npc.buffTime[buffIndex]) - npc.Calamity().crumble = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().crumble = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/Eutrophication.cs b/Buffs/StatDebuffs/Eutrophication.cs index 0f99d11480..eca32f09f7 100644 --- a/Buffs/StatDebuffs/Eutrophication.cs +++ b/Buffs/StatDebuffs/Eutrophication.cs @@ -25,12 +25,9 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().eutrophication < npc.buffTime[buffIndex]) - npc.Calamity().eutrophication = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().eutrophication; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().eutrophication = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; } internal static void DrawEffects(PlayerDrawSet drawInfo) diff --git a/Buffs/StatDebuffs/FrozenLungs.cs b/Buffs/StatDebuffs/FrozenLungs.cs index 4a7e8fb6ca..49d31a21bf 100644 --- a/Buffs/StatDebuffs/FrozenLungs.cs +++ b/Buffs/StatDebuffs/FrozenLungs.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().iCantBreathe = true; + player.Calamity().frozenLungs = true; } } } diff --git a/Buffs/StatDebuffs/GalvanicCorrosion.cs b/Buffs/StatDebuffs/GalvanicCorrosion.cs index d8b4a6e77c..018e738c30 100644 --- a/Buffs/StatDebuffs/GalvanicCorrosion.cs +++ b/Buffs/StatDebuffs/GalvanicCorrosion.cs @@ -18,12 +18,9 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().tesla < npc.buffTime[buffIndex]) - npc.Calamity().tesla = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tesla; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().galvanicCorrosion = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/StatDebuffs/GlacialState.cs b/Buffs/StatDebuffs/GlacialState.cs index ffbb2a810b..b87a1df91b 100644 --- a/Buffs/StatDebuffs/GlacialState.cs +++ b/Buffs/StatDebuffs/GlacialState.cs @@ -18,34 +18,13 @@ namespace CalamityMod.Buffs.StatDebuffs BuffID.Sets.LongerExpertDebuff[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().gState = true; - } - public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().gState < npc.buffTime[buffIndex]) - npc.Calamity().gState = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().gState; + npc.Calamity().glacialState = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; npc.DelBuff(buffIndex); buffIndex--; } - - internal static void DrawEffects(PlayerDrawSet drawInfo) - { - Player Player = drawInfo.drawPlayer; - - if (Main.rand.NextBool(4)) - { - Dust d = Dust.NewDustDirect(Player.Center - 10 * Vector2.One, 20, 20, DustID.IcyMerman); - d.noGravity = Main.rand.NextBool(); - d.noLight = false; - d.velocity *= 0.2f; - d.velocity.Y -= Main.rand.NextFloat(0.4f, 0.6f); - d.scale = Main.rand.NextFloat(0.4f, 0.7f); - } - } } } diff --git a/Buffs/StatDebuffs/Irradiated.cs b/Buffs/StatDebuffs/Irradiated.cs index ca52ae932a..8244acd871 100644 --- a/Buffs/StatDebuffs/Irradiated.cs +++ b/Buffs/StatDebuffs/Irradiated.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Magic; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -6,6 +8,44 @@ namespace CalamityMod.Buffs.StatDebuffs { public class Irradiated : ModBuff { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 20, //Base irradiated DOT. This is changed with some application sources. + NPCLifeRegenMethod = IrradiatedNPCLifeRegen + }; + public static void IrradiatedNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + int projectileCount = 0; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && + p.ai[0] == 1f && p.ai[1] == npc.whoAmI) + { + projectileCount++; + } + } + int baseIrradiatedDoTValue = (int)(cnpc.scionsCurioEffected ? (int)(debuffData.EnemyLostRegen * 1.5f) : debuffData.EnemyLostRegen); + if (cnpc.scionsCurioEffected) + { + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + if (player.active) + { + float playerRangedDamage = player.GetTotalDamage(DamageClass.Ranged).ApplyTo(baseIrradiatedDoTValue * (1 + player.GetTotalCritChance(DamageClass.Ranged) * 0.01f)); + if (playerRangedDamage > baseIrradiatedDoTValue && player.Calamity().scionsCurio) + { + baseIrradiatedDoTValue = (int)playerRangedDamage; + } + } + } + } + if (projectileCount > 0) + cnpc.ApplyDPSDebuff(projectileCount * baseIrradiatedDoTValue, projectileCount * 4, ref npc.lifeRegen, ref damage); + else + cnpc.ApplyDPSDebuff(baseIrradiatedDoTValue, baseIrradiatedDoTValue / 20, ref npc.lifeRegen, ref damage); + } public override void SetStaticDefaults() { Main.debuff[Type] = true; @@ -13,6 +53,7 @@ namespace CalamityMod.Buffs.StatDebuffs Main.buffNoSave[Type] = true; BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; BuffID.Sets.LongerExpertDebuff[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; } public override void Update(Player player, ref int buffIndex) @@ -22,10 +63,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().irradiated < npc.buffTime[buffIndex]) - npc.Calamity().irradiated = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().irradiated = true; } } } diff --git a/Buffs/StatDebuffs/KamiFlu.cs b/Buffs/StatDebuffs/KamiFlu.cs deleted file mode 100644 index a4f3908529..0000000000 --- a/Buffs/StatDebuffs/KamiFlu.cs +++ /dev/null @@ -1,27 +0,0 @@ -using CalamityMod.NPCs; -using CalamityMod.Systems.Collections; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Buffs.StatDebuffs -{ - public class KamiFlu : ModBuff - { - public override void SetStaticDefaults() - { - Main.debuff[Type] = true; - Main.pvpBuff[Type] = true; - Main.buffNoSave[Type] = false; - } - - public override void Update(NPC npc, ref int buffIndex) - { - if (npc.Calamity().kamiFlu < npc.buffTime[buffIndex]) - npc.Calamity().kamiFlu = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().kamiFlu; - npc.DelBuff(buffIndex); - buffIndex--; - } - } -} diff --git a/Buffs/StatDebuffs/KamiFlu.png b/Buffs/StatDebuffs/KamiFlu.png deleted file mode 100644 index df7af84f98..0000000000 Binary files a/Buffs/StatDebuffs/KamiFlu.png and /dev/null differ diff --git a/Buffs/StatDebuffs/MarkedforDeath.cs b/Buffs/StatDebuffs/MarkedforDeath.cs index 3a0518630c..ac676ccdc4 100644 --- a/Buffs/StatDebuffs/MarkedforDeath.cs +++ b/Buffs/StatDebuffs/MarkedforDeath.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.DataStructures; +using Terraria; using Terraria.ModLoader; namespace CalamityMod.Buffs.StatDebuffs @@ -16,10 +17,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().marked < npc.buffTime[buffIndex]) - npc.Calamity().marked = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().markedForDeath = true; } } } diff --git a/Buffs/StatDebuffs/PearlAura.cs b/Buffs/StatDebuffs/PearlAura.cs index ed0232c4b2..2b0d1bf5bc 100644 --- a/Buffs/StatDebuffs/PearlAura.cs +++ b/Buffs/StatDebuffs/PearlAura.cs @@ -16,10 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().pearlAura < npc.buffTime[buffIndex]) - npc.Calamity().pearlAura = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().pearlAura = true; } internal static void DrawEffects(NPC npc, ref Color drawColor) diff --git a/Buffs/StatDebuffs/ProfanedWeakness.cs b/Buffs/StatDebuffs/ProfanedWeakness.cs index e9d61ddd1a..399deb9bc1 100644 --- a/Buffs/StatDebuffs/ProfanedWeakness.cs +++ b/Buffs/StatDebuffs/ProfanedWeakness.cs @@ -16,10 +16,7 @@ namespace CalamityMod.Buffs.StatDebuffs } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().relicOfResilienceWeakness < npc.buffTime[buffIndex]) - npc.Calamity().relicOfResilienceWeakness = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().relicOfResilienceWeakness = true; } internal static void DrawEffects(NPC npc, ref Color drawColor) { diff --git a/Buffs/StatDebuffs/TemporalSadness.cs b/Buffs/StatDebuffs/TemporalSadness.cs index b3eb4099dc..943fefca48 100644 --- a/Buffs/StatDebuffs/TemporalSadness.cs +++ b/Buffs/StatDebuffs/TemporalSadness.cs @@ -16,12 +16,9 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().tSad < npc.buffTime[buffIndex]) - npc.Calamity().tSad = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().tSad; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().temporalSadness = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; } } } diff --git a/Buffs/StatDebuffs/TimeDistortion.cs b/Buffs/StatDebuffs/TimeDistortion.cs index 95a1cf23fa..3f84b4677e 100644 --- a/Buffs/StatDebuffs/TimeDistortion.cs +++ b/Buffs/StatDebuffs/TimeDistortion.cs @@ -18,12 +18,9 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().timeSlow < npc.buffTime[buffIndex]) - npc.Calamity().timeSlow = npc.buffTime[buffIndex]; - if ((EnemyImmunitiesList.Includes(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) - npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().timeSlow; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().timeDistortion = true; + if ((CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[npc.type] || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0) + npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.buffTime[buffIndex]; } } } diff --git a/Buffs/StatDebuffs/WhisperingDeath.cs b/Buffs/StatDebuffs/WhisperingDeath.cs index b1b0eac60b..218491ff11 100644 --- a/Buffs/StatDebuffs/WhisperingDeath.cs +++ b/Buffs/StatDebuffs/WhisperingDeath.cs @@ -16,15 +16,12 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(Player player, ref int buffIndex) { - player.Calamity().wDeath = true; + player.Calamity().whisperingDeath = true; } public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().wDeath < npc.buffTime[buffIndex]) - npc.Calamity().wDeath = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().whisperingDeath = true; } } } diff --git a/Buffs/StatDebuffs/WitherDebuff.cs b/Buffs/StatDebuffs/WitherDebuff.cs index bc161eae70..57042bb708 100644 --- a/Buffs/StatDebuffs/WitherDebuff.cs +++ b/Buffs/StatDebuffs/WitherDebuff.cs @@ -20,10 +20,7 @@ namespace CalamityMod.Buffs.StatDebuffs public override void Update(NPC npc, ref int buffIndex) { - if (npc.Calamity().wither < npc.buffTime[buffIndex]) - npc.Calamity().wither = npc.buffTime[buffIndex]; - npc.DelBuff(buffIndex); - buffIndex--; + npc.Calamity().wither = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Summon/AqueousHunterDroneBuff.cs b/Buffs/Summon/AqueousHunterDroneBuff.cs new file mode 100644 index 0000000000..292d0df8e0 --- /dev/null +++ b/Buffs/Summon/AqueousHunterDroneBuff.cs @@ -0,0 +1,12 @@ +using CalamityMod.Projectiles.DraedonsArsenal; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon +{ + public class AqueousHunterDroneBuff : BaseSummonBuff + { + protected override int MinionProjectileType => ModContent.ProjectileType(); + + protected override ref bool MinionBool => ref BuffModdedOwner.aqueousHunterDrone; + } +} diff --git a/Buffs/Summon/AqueousHunterDroneBuff.png b/Buffs/Summon/AqueousHunterDroneBuff.png new file mode 100644 index 0000000000..728c691251 Binary files /dev/null and b/Buffs/Summon/AqueousHunterDroneBuff.png differ diff --git a/Buffs/Summon/BrimstoneWaifu.cs b/Buffs/Summon/BrimstoneElemental.cs similarity index 69% rename from Buffs/Summon/BrimstoneWaifu.cs rename to Buffs/Summon/BrimstoneElemental.cs index f6b12d5477..7f2595443c 100644 --- a/Buffs/Summon/BrimstoneWaifu.cs +++ b/Buffs/Summon/BrimstoneElemental.cs @@ -1,12 +1,12 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class BrimstoneWaifu : BaseSummonBuff + public class BrimstoneElemental : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.bWaifu; + protected override ref bool MinionBool => ref BuffModdedOwner.brimEleBuff; } } diff --git a/Buffs/Summon/BrimstoneWaifu.png b/Buffs/Summon/BrimstoneElemental.png similarity index 100% rename from Buffs/Summon/BrimstoneWaifu.png rename to Buffs/Summon/BrimstoneElemental.png diff --git a/Buffs/Summon/CloudyWaifu.cs b/Buffs/Summon/CloudElemental.cs similarity index 80% rename from Buffs/Summon/CloudyWaifu.cs rename to Buffs/Summon/CloudElemental.cs index 4b342af8c1..b276cd9b57 100644 --- a/Buffs/Summon/CloudyWaifu.cs +++ b/Buffs/Summon/CloudElemental.cs @@ -3,10 +3,10 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class CloudyWaifu : BaseSummonBuff + public class CloudElemental : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.cWaifu; + protected override ref bool MinionBool => ref BuffModdedOwner.cloudEleBuff; } } diff --git a/Buffs/Summon/CloudyWaifu.png b/Buffs/Summon/CloudElemental.png similarity index 100% rename from Buffs/Summon/CloudyWaifu.png rename to Buffs/Summon/CloudElemental.png diff --git a/Buffs/Summon/HotE.cs b/Buffs/Summon/HotE.cs index 99bd030f4d..3e8eae1f10 100644 --- a/Buffs/Summon/HotE.cs +++ b/Buffs/Summon/HotE.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Buffs.Summon { CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.allWaifus) + if (!modPlayer.allElementals) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/Summon/ProfanedSoulGuardians.cs b/Buffs/Summon/ProfanedSoulGuardians.cs index 1c2222eada..8e9f098a40 100644 --- a/Buffs/Summon/ProfanedSoulGuardians.cs +++ b/Buffs/Summon/ProfanedSoulGuardians.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ModLoader; @@ -15,7 +16,7 @@ namespace CalamityMod.Buffs.Summon public override void Update(Player player, ref int buffIndex) { CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.pSoulGuardians || modPlayer.profanedCrystalBuffs) + if (player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 || modPlayer.profanedCrystalBuffs) { player.DelBuff(buffIndex); buffIndex--; diff --git a/Buffs/Summon/SandyHealingWaifu.cs b/Buffs/Summon/RareSandElemental.cs similarity index 79% rename from Buffs/Summon/SandyHealingWaifu.cs rename to Buffs/Summon/RareSandElemental.cs index 9d57de49d4..2748620ff6 100644 --- a/Buffs/Summon/SandyHealingWaifu.cs +++ b/Buffs/Summon/RareSandElemental.cs @@ -3,10 +3,10 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyHealingWaifu : BaseSummonBuff + public class RareSandElemental : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.dWaifu; + protected override ref bool MinionBool => ref BuffModdedOwner.rareSandEleBuff; } } diff --git a/Buffs/Summon/SandyHealingWaifu.png b/Buffs/Summon/RareSandElemental.png similarity index 100% rename from Buffs/Summon/SandyHealingWaifu.png rename to Buffs/Summon/RareSandElemental.png diff --git a/Buffs/Summon/SandyWaifu.cs b/Buffs/Summon/SandElemental.cs similarity index 81% rename from Buffs/Summon/SandyWaifu.cs rename to Buffs/Summon/SandElemental.cs index 383abea36f..5b9f22d6bc 100644 --- a/Buffs/Summon/SandyWaifu.cs +++ b/Buffs/Summon/SandElemental.cs @@ -3,10 +3,10 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class SandyWaifu : BaseSummonBuff + public class SandElemental : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.sWaifu; + protected override ref bool MinionBool => ref BuffModdedOwner.sandEleBuff; } } diff --git a/Buffs/Summon/SandyWaifu.png b/Buffs/Summon/SandElemental.png similarity index 100% rename from Buffs/Summon/SandyWaifu.png rename to Buffs/Summon/SandElemental.png diff --git a/Buffs/Summon/SeaSnailBuff.cs b/Buffs/Summon/SeaSnailBuff.cs index da471bc5ad..0e33241c44 100644 --- a/Buffs/Summon/SeaSnailBuff.cs +++ b/Buffs/Summon/SeaSnailBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon diff --git a/Buffs/Summon/ViridVanguardBuff.cs b/Buffs/Summon/ViridVanguardBuff.cs index 51ea3391d7..68ca32a558 100644 --- a/Buffs/Summon/ViridVanguardBuff.cs +++ b/Buffs/Summon/ViridVanguardBuff.cs @@ -1,4 +1,4 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Summon; using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon @@ -7,6 +7,6 @@ namespace CalamityMod.Buffs.Summon { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.ViridVanguard; + protected override ref bool MinionBool => ref BuffModdedOwner.viridVanguard; } } diff --git a/Buffs/Summon/WaterWaifu.cs b/Buffs/Summon/WaterElemental.cs similarity index 80% rename from Buffs/Summon/WaterWaifu.cs rename to Buffs/Summon/WaterElemental.cs index 413f5de434..75db085d1e 100644 --- a/Buffs/Summon/WaterWaifu.cs +++ b/Buffs/Summon/WaterElemental.cs @@ -3,10 +3,10 @@ using Terraria.ModLoader; namespace CalamityMod.Buffs.Summon { - public class WaterWaifu : BaseSummonBuff + public class WaterElemental : BaseSummonBuff { protected override int MinionProjectileType => ModContent.ProjectileType(); - protected override ref bool MinionBool => ref BuffModdedOwner.slWaifu; + protected override ref bool MinionBool => ref BuffModdedOwner.waterEleBuff; } } diff --git a/Buffs/Summon/WaterWaifu.png b/Buffs/Summon/WaterElemental.png similarity index 100% rename from Buffs/Summon/WaterWaifu.png rename to Buffs/Summon/WaterElemental.png diff --git a/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs b/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs new file mode 100644 index 0000000000..fe389e7d6d --- /dev/null +++ b/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon.Whips +{ + public class ForbiddenStealthSummonTagBuff : ModBuff + { + public override string Texture => "CalamityMod/Buffs/Summon/Whips/SentinalLash"; + + public override void SetStaticDefaults() + { + BuffID.Sets.IsATagBuff[Type] = true; + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + } + } +} diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 8036f9864a..83da6aadc7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -6,6 +6,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; using CalamityMod.DataStructures; @@ -21,20 +22,27 @@ using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.Brimflame; using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.Items.Armor.DesertProwler; using CalamityMod.Items.Armor.Empyrean; using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.OmegaBlue; using CalamityMod.Items.Armor.PlagueReaper; +using CalamityMod.Items.Armor.Prismatic; using CalamityMod.Items.Armor.Silva; using CalamityMod.Items.Armor.SnowRuffian; +using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Armor.TitanHeart; using CalamityMod.Items.Armor.Victide; +using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Dyes; +using CalamityMod.Items.Materials; using CalamityMod.Items.Mounts; using CalamityMod.Items.Mounts.Minecarts; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Tools.ClimateChange; using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.DraedonsArsenal; @@ -63,12 +71,16 @@ using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; +using Terraria.GameContent.Creative; +using Terraria.GameContent.NetModules; using Terraria.GameInput; +using Terraria.Graphics.Effects; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; -using Terraria.Graphics.Effects; +using Terraria.Net; +using static Terraria.Main; using static Terraria.ModLoader.ModContent; namespace CalamityMod.CalPlayer @@ -83,10 +95,6 @@ namespace CalamityMod.CalPlayer /// If true, there is an event actively occuring near the player. Solely used for preventing Silva Revive's cooldown from decreasing. public static bool areThereAnyDamnEvents = false; public float calamityBonusLuck = 0f; - /// Custom variable for tracking if the player has Potion Sickness. Used for adding Potion Sickness to the Cooldown Rack. - public bool potionSick = false; - /// Custom variable for tracking how long the player has had Potion Sickness. Solely used for triggering the aura effects of Life Jelly and its upgrades. - public int timePotionSick; public bool drawBossHPBar = true; public float stealthUIAlpha = 1f; public float SulphWaterUIOpacity = 1f; @@ -103,29 +111,23 @@ namespace CalamityMod.CalPlayer public static int chaosStateDuration = 900; /// Constant variable used for how long Chaos State is inflicted by Normality Relocator while a boss is alive. public static int chaosStateDuration_NR = 1200; - /// Used by Sky Stabber and Gods' Paranoia to delete spiky balls when using right-click. - public bool killSpikyBalls = false; - public float KameiTrailXScale = 0.1f; - public int KameiBladeUseDelay = 0; /// Stores the positions of the player within the previous 4 frames. Used for drawing trail effects. public Vector2[] OldPositions = new Vector2[4]; public double contactDamageReduction = 0D; public double projectileDamageReduction = 0D; public int hellbornShots = 0; + public int garandShots = 0; public int searedPanCounter = 0; public int searedPanTimer = 0; /// Used to get around the hardcoded Potion Sickness duration to allow Hadal Stew's reduced duration. public int potionTimer = 0; - public bool cirrusDress = false; /// If set to true, prevents all player dashes. Used by Ball and Chain, and Stygian Shield. public bool blockAllDashes = false; /// Used by Flamsteed Ring to reset the player's hitbox size after dismounting. public bool resetHeightandWidth = false; /// If set to true, completely disables ALL life regeneration effects. Used by Omega Blue armor. public bool noLifeRegen = false; - public bool reducedDaybrokenDamage = false; - public bool reducedNightwitherDamage = false; - public float rangedAmmoCost = 1f; + public float ammoCost = 1f; public float healingPotionMultiplier = 1f; /// /// Tracks whether or not the player is currently holding Gael's Greatsword.
@@ -176,6 +178,28 @@ namespace CalamityMod.CalPlayer public int momentumCapacitorTime = 0; /// A multiplier on the player's movement speed applied while using Momentum Capacitor. public float momentumCapacitorBoost = 0f; + public enum FishingMinigames + { + None, + WulfrumRod, + NavyFishingRod, + HeronRod, + SlurperPole, + VerstaltiteFishingRod, + FeralDoubleRod, + RiftReeler, + EarlyBloomRod, + TheDevourerOfCods + } + public FishingMinigames SelectedFishingMinigame = FishingMinigames.None; + public bool countsAsAnyWet => (Player.armor[0].type == ItemID.FishBowl || Player.wetCount > 0 || Player.wet || Player.honeyWet || Player.lavaWet); + + public StatModifier TypelessDebuffMultiplier = new(); + public StatModifier HeatDebuffMultiplier = new(); + public StatModifier ColdDebuffMultiplier = new(); + public StatModifier SicknessDebuffMultiplier = new(); + public StatModifier WaterDebuffMultiplier = new(); + public StatModifier ElectricDebuffMultiplier = new(); #endregion #region Speedrun Timer @@ -199,7 +223,6 @@ namespace CalamityMod.CalPlayer #region External variables -- Not used by Calamity, only via Mod.Call or reflection public int externalAbyssLight = 0; - public float externalBreathLossMultBoost = 0f; public float externalBreathTickBoost = 0f; public float externalFlightTimeMultBoost = 0f; @@ -244,7 +267,6 @@ namespace CalamityMod.CalPlayer public bool newPrincessInventory = false; public bool newSkeletonMerchantInventory = false; public bool newPermafrostInventory = false; - public bool newCirrusInventory = false; public bool newAmidiasInventory = false; public bool newBanditInventory = false; public bool newCalamitasInventory = false; @@ -255,8 +277,8 @@ namespace CalamityMod.CalPlayer public int arsenalCooldown = 0; public int killModeCooldown = 0; public bool demonSwordKillMode = false; - public bool exaltedKillMode => (demonSwordKillMode && Player.ActiveItem().type == ModContent.ItemType()); - public bool devilsDevastationKillMode => (demonSwordKillMode && Player.ActiveItem().type == ModContent.ItemType()); + public bool exaltedKillMode => (demonSwordKillMode && Player.ActiveItem().type == ItemType()); + public bool devilsDevastationKillMode => (demonSwordKillMode && Player.ActiveItem().type == ItemType()); /// /// Tracks Dragoon Drizzlefish's "gel feed" mechanic in Get fixed boi.
/// Consuming Gel adds 1 to this counter, up to a maximum of 6, and using the weapon has a random chance to decrement the counter.
@@ -266,6 +288,11 @@ namespace CalamityMod.CalPlayer public int deadSunCounter = 6; public int DragonsBreathAudioCooldown = 0; public int DragonsBreathAudioCooldown2 = 0; + public int lucreciaEnergy = 0; + public int lucreciaEnergyTimer = 0; + public bool lucreciaEnergyPaused = false; + public bool lucreciaEnergyMaxSFXPlayed = false; + private int lucreciaParticleTimer = 0; public int PhotoAudioCooldown = 0; public int PhotoTimer = 90; /// Cooldown variable used to add a delay between Anahita's Arpeggio uses. @@ -279,6 +306,8 @@ namespace CalamityMod.CalPlayer public int evilSmasherBoost = 0; /// Cooldown variable for spawning Plague Tainted SMG's drones from left-click bullets. public int plagueTaintedSMGDroneCooldown = 0; + /// Cooldown variable which prevents using Firestorm Cannon or Spectralstorm Cannon during their overheat periods. + public int flareGunOverheat = 0; /// /// If true, this player's Brittle Star Staff minions are in their orbiting mode.
/// While in this mode, they orbit around the player, do not break on hits, and increase defense. @@ -300,10 +329,13 @@ namespace CalamityMod.CalPlayer public bool despoilerNerf = false; /// Variable used to trigger Molten Amputator's stealth effect on right-click. public int amputatorBuff = 0; - /// Variable used to track the fuel of Pristine Fury right click - public int furyFuelMax = 1800; + /// Variables used to track the fuel of Pristine Fury right click public int furyFuel = 1800; + public const int FuryFuelMax = 1800; public float furyRefuelTimer = 0; + /// Variable used to track if Auger can do a big slash + public bool buffedAuger = false; + public int rOfResilienceCooldown = 0; public int rOfResilienceEffect = 0; public int rOfResilienceOrbitOffset = 0; @@ -335,10 +367,10 @@ namespace CalamityMod.CalPlayer public int dragonRageHits = 0; /// Cooldown variable for Dragon Rage's fireball spawning to prevent spamming projectiles when hitting multiple enemies simultaneously. public int dragonRageCooldown = 0; - public float aquaticBoostMax = 10000f; + public const float AquaticBoostMax = 10000f; /// /// Counter variable which controls Aquatic Emblem's stat boosts while underwater.
- /// This counter starts at , and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0. + /// This counter starts at , and is decremented by 2 for every frame the player remains underwater, reaching maximum boosts when it hits 0. ///
public float aquaticBoost = 0f; public int galileoCooldown = 0; @@ -363,7 +395,6 @@ namespace CalamityMod.CalPlayer public int murasamaHitCooldown = 0; public int giantShellPostHit = 0; public int tortShellPostHit = 0; - public int RustyMedallionCooldown = 0; public int MiniSwarmerCooldown = 0; public float SulphWaterPoisoningLevel; public float holyInfernoFadeIntensity; @@ -382,6 +413,10 @@ namespace CalamityMod.CalPlayer public bool canFireGodSlayerRangedProjectile = false; public bool canFireBloodflareMageProjectile = false; public bool canFireBloodflareRangedProjectile = false; + + public int consecutiveCaughtFish = 0; + public float WeakTimeFreezeUseTimer = 0; + public bool WeakTimeFreezeInUse = false; #endregion #region Sound @@ -405,7 +440,6 @@ namespace CalamityMod.CalPlayer public static readonly SoundStyle RogueStealthSound = new("CalamityMod/Sounds/Custom/RogueStealth"); public static readonly SoundStyle DefenseDamageSound = new("CalamityMod/Sounds/Custom/DefenseDamage"); - public static readonly SoundStyle BloodCritSound = new("CalamityMod/Sounds/Custom/BloodPactCrit"); public static readonly SoundStyle IjiDeathSound = new("CalamityMod/Sounds/Custom/IjiDies"); public static readonly SoundStyle DrownSound = new("CalamityMod/Sounds/Custom/AbyssDrown"); @@ -443,10 +477,10 @@ namespace CalamityMod.CalPlayer ///
public bool stealthStrike75Cost = false; /// - /// If true, stealth strikes only require 85% of the player's max stealth to perform.
+ /// If true, stealth strikes only require 90% of the player's max stealth to perform.
/// Used by Coin of Deceit. ///
- public bool stealthStrike85Cost = false; + public bool stealthStrike90Cost = false; /// If true, this player is wearing a rogue or all-class armor set. This bool is required in order to use rogue stealth. public bool wearingRogueArmor = false; /// The sum of the player's stealth generation boosts from accessory modifiers. @@ -458,7 +492,7 @@ namespace CalamityMod.CalPlayer /// This is obtained from a formula derived from the player's current stealth, the weapon's use time, and the player's stealth generation boosts. ///
public float stealthDamage = 0f; - /// An additional damage multiplier applied to rogue stealth strikes. Used by Filthy Glove and its upgrades, and Rotten Dogtooth. + /// An additional damage multiplier applied to rogue stealth strikes. Used by Filthy Glove, Rotten Dogtooth and their upgrades. public double bonusStealthDamage = 0; public float rogueVelocity = 1f; #endregion @@ -466,7 +500,6 @@ namespace CalamityMod.CalPlayer #region Mount public bool onyxExcavator = false; public bool rimehound = false; - public bool fab = false; public bool crysthamyr = false; public bool ExoChair = false; public AndromedaPlayerState andromedaState; @@ -560,7 +593,6 @@ namespace CalamityMod.CalPlayer } } public bool adrenalineModeActive = false; - public bool AdrenalineTrail = false; /// The player's current Adrenaline level. Expressed as a percentage of maximum Adrenaline. public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default @@ -645,6 +677,8 @@ namespace CalamityMod.CalPlayer public bool roverDrive = false; public bool roverDriveShieldVisible = false; + internal float roverDriveShieldPartialRechargeProgress = 0f; + internal bool playedRoverDriveShieldSound = false; // Lunic Corps shield is controlled by its armor set bool // Lunic Corps shield comes from an armor set and its visibility is non optional @@ -664,8 +698,6 @@ namespace CalamityMod.CalPlayer #endregion #region Abyss - /// The amount of breath lost on each tick while in the Abyss. - public float abyssBreathLossStat = 0; /// The rate at which breath is lost while in the Abyss. public float abyssBreathLossRateStat = 0; /// The rate at which health is decreased after running out of breath while in the Abyss. @@ -722,8 +754,8 @@ namespace CalamityMod.CalPlayer public bool gladiatorSword = false; public int gladiatorTimer = 0; public bool unstableGraniteCore = false; - public bool regenator = false; - public float regenatorDamage = 0; + public bool regenerator = false; + public float regeneratorDamage = 0; public bool theBee = false; public bool arcFlashRing = false; public bool arcFlashRingVisual = false; @@ -769,8 +801,6 @@ namespace CalamityMod.CalPlayer public int ascendantInsigniaBuffTime = 0; public int ascendantInsigniaCooldown = 0; public bool ascendantTrail = false; - public bool frozenWingsCold = false; - public bool flameWingsHeat = false; /// Used to toggle dust spawned while swinging, through accessory visibility. public bool magmaStoneVisuals = true; public bool eGauntlet = false; @@ -785,10 +815,6 @@ namespace CalamityMod.CalPlayer public bool eTalisman = false; public bool lastDashWasTabi = false; public bool statisNinjaBelt = false; - /// Used to keep track of how many dashes in the same direction you make to prevent dashing away from bosses forever at max efficency. - public int statisPenaltyTimer = 0; - public int statisAnticheese = 0; - public int statisTimerMax => (int)(Utils.Remap(statisAnticheese, 1, 6, 120, 50, true)); public bool voidSashVisuals = true; public bool statisVoidSash = false; public bool nucleogenesis = false; @@ -805,12 +831,14 @@ namespace CalamityMod.CalPlayer public int transformerCooldown = 0; public int transformerDelay = 0; public int transformerStoredKills = 0; + public int hookPullVisuals = 0; public bool bloomStone = false; public bool bloomStoneHookVisuals = false; - public int bloomStoneHealInc = 0; + public int bloomStoneHealPool = 0; public int bloomStoneTotalHeal = 0; - public int bloomStoneHealTimer = 0; - public int bloomStoneDR = 0; + public float bloomStoneHealTimer = 0; + public float bloomStoneHealRate = 0; + public int bloomStoneBuffedHealRateTimer = 0; public bool hideOfDeus = false; public bool dAmulet = false; public bool rampartOfDeities = false; @@ -819,9 +847,6 @@ namespace CalamityMod.CalPlayer public bool lAmbergrisVisual = false; public bool tortShell = false; public bool absorber = false; - public bool alwaysHoneyRegen = false; - public float alwaysHoneyRegenAmount = 0; - public bool honeyTurboRegen = false; public bool honeyDewHalveDebuffs = false; public bool livingDewHalveDebuffs = false; public int jewelBonusDefense = 0; @@ -838,7 +863,6 @@ namespace CalamityMod.CalPlayer public bool aAmpoule = false; public bool rOoze = false; public float radiantOozeRegen = 0; - public float ambrosialAmpouleRegen = 0; public float purityRegen = 0; public bool fBarrier = false; public bool aBrain = false; @@ -847,7 +871,7 @@ namespace CalamityMod.CalPlayer public int raiderCritLifespan = 0; public int raiderSoundCooldown = 0; public bool gSabaton = false; - public int gSabatonHotkeyHoldTime = 0; + public int gSabatonHotkeyFallWindup = -1; public int gSabatonFall = 0; public bool gSabatonFalling = false; public int gSabatonTempJumpSpeed = 0; @@ -875,11 +899,11 @@ namespace CalamityMod.CalPlayer public bool cleansingjelly = false; public bool GrandGelatin = false; public int CleansingEffect = 0; + public bool spawnedJellyAura = false; public bool community = false; public bool shatteredCommunity = false; public bool fleshTotem = false; public bool bloodPact = false; - public bool bloodPactBoost = false; public bool bloodflareCore = false; public int bloodflareCoreRemainingHealOverTime = 0; @@ -931,15 +955,14 @@ namespace CalamityMod.CalPlayer public bool spiritOrigin = false; public bool spiritOriginVanity = false; public int spiritOriginCritBoost = 0; -/// -/// The amount of bonus crit damage the player has. -/// At 0f, the player has regular crit damage. At 1f, the player has +100% crit damage. -/// + /// + /// The amount of bonus crit damage the player has. + /// At 0f, the player has regular crit damage. At 1f, the player has +100% crit damage. + /// public float critDamage = 0; public bool darkSunRing = false; public bool crawCarapace = false; public bool baroclaw = false; - public bool HasIncreasedDashFirstFrame = false; public bool IsFirstDashFrame = true; public int fallingBootVelCheckTimer = 0; public bool voidOfCalamity = false; @@ -961,6 +984,8 @@ namespace CalamityMod.CalPlayer public bool XykVisualsBlue = false; public bool XykVisualsOrange = false; public Color XykFXColor = Color.Black; + public int XykWingTimer = 0; + public Color lightRGB = Color.Black; public bool manaOverloader = false; /// Used for allowing Calamity slimes to be affected by Royal Gel. public bool royalGel = false; @@ -981,16 +1006,16 @@ namespace CalamityMod.CalPlayer public bool jellyChargedBattery = false; /// General cooldown for accessories which spawn projectiles on minion hits. public float summonProjCooldown; - public bool sandWaifu = false; - public bool sandWaifuVanity = false; - public bool sandBoobWaifu = false; - public bool sandBoobWaifuVanity = false; - public bool cloudWaifu = false; - public bool cloudWaifuVanity = false; - public bool brimstoneWaifu = false; - public bool brimstoneWaifuVanity = false; - public bool sirenWaifu = false; - public bool sirenWaifuVanity = false; + public bool sandElemental = false; + public bool sandElementalVanity = false; + public bool rareSandElemental = false; + public bool rareSandElementalVanity = false; + public bool cloudElemental = false; + public bool cloudElementalVanity = false; + public bool brimElemental = false; + public bool brimElementalVanity = false; + public bool waterElemental = false; + public bool waterElementalVanity = false; public bool fungalClump = false; public bool fungalClumpVanity = false; public bool howlsHeart = false; @@ -1024,6 +1049,9 @@ namespace CalamityMod.CalPlayer public bool veneratedLocket = false; public bool camper = false; public bool corrosiveSpine = false; + public bool scionsCurio = false; + public bool scionsCurioGotHit = false; + public bool scionsCurioVisuals = false; public bool miniOldDuke = false; public bool miniOldDukeVanity = false; public bool starbusterCore = false; @@ -1040,7 +1068,6 @@ namespace CalamityMod.CalPlayer public int phantomicHeartRegen = 0; /// General cooldown variable for spawning projectiles from wing bonus effects. Used by Soul of Cryogen, Tattered Fairy Wings, and Festive Wings. public int wingProjectileCooldown = 0; - public bool RustyMedallionDroplets = false; public bool noStupidNaturalARSpawns = false; /// Used for animating Void Concentration Staff's draw layer. public int voidFrameCounter = 0; @@ -1049,7 +1076,6 @@ namespace CalamityMod.CalPlayer public bool rottenDogTooth = false; public bool angelicAlliance = false; public int angelicActivate = -1; - public bool BloomStoneRegen = false; public bool ChaosStone = false; public bool CryoStone = false; public bool CryoStoneVanity = false; @@ -1063,6 +1089,8 @@ namespace CalamityMod.CalPlayer /// Calamity's Silver armor set bonus; taking over 20 damage heals 10 health if the player avoids damage for 2 seconds. public bool silverMedkit = false; public int silverMedkitTimer = 0; + /// Calamity's Tungsten armor set bonus; makes grappling hooks fly and retract faster. + public bool tungstenArmorHookBoost = false; /// Calamity's Gold armor set bonus; makes enemies drop Gold Coins. public bool goldArmorGoldDrops = false; /// Calamity's Mining armor set bonus; gives a chance for extra items to drop when mining ores. @@ -1083,8 +1111,12 @@ namespace CalamityMod.CalPlayer public bool necroSet = false; /// Calamity's Frost armor set bonus; gives a combined 20% damage boost split between melee and ranged based on distance from the closest enemy. public bool frostSet = false; - public bool victideSet = false; - public bool victideSummoner = false; + public bool victideBarrierSet = false; + public int victideBarrierHeal = 0; + public bool victideBarrierHead = false; + public bool victideBurrowSet = false; + public bool victideBurrowHead = false; + public bool victideSnailSet = false; public bool sulphurSet = false; public bool sulphurJump = false; public int sulphurBubbleCooldown = 0; @@ -1119,7 +1151,6 @@ namespace CalamityMod.CalPlayer public bool godSlayerDashHotKeyPressed = false; public bool SpeedBlasterDashStarted = false; public bool ataxiaBolt = false; - public bool ataxiaFire = false; public bool ataxiaVolley = false; public bool ataxiaBlaze = false; public bool hydrothermalSmoke = false; @@ -1134,19 +1165,15 @@ namespace CalamityMod.CalPlayer /// Demonshade Greaves' movement speed boost. public bool shadowSpeed = false; public bool dsSetBonus = false; - public bool auricBoost = false; public bool auricSetMelee = false; public bool daedalusReflect = false; public bool daedalusSplit = false; public bool titanHeartSet = false; public bool titanHeartMask = false; public bool titanHeartMantle = false; - public bool titanHeartBoots = false; public int titanCooldown = 0; public bool umbraphileSet = false; public bool reaverSpeed = false; - public bool reaverRegen = false; - public int reaverRegenCooldown = 0; public bool reaverDefense = false; public bool reaverExplore = false; public bool fathomSwarmer = false; @@ -1181,9 +1208,7 @@ namespace CalamityMod.CalPlayer public int silvaMageCooldown = 0; public bool silvaSummon = false; public bool hasSilvaEffect = false; - /// Constant variable representing the duration of Silva armor's revive, in frames. - public const int silvaReviveDuration = 300; - public int silvaCountdown = silvaReviveDuration; + public int silvaCountdown = SilvaArmor.ReviveDuration; public bool auricSet = false; public bool omegaBlueChestplate = false; public bool omegaBlueSet = false; @@ -1246,26 +1271,25 @@ namespace CalamityMod.CalPlayer public bool alcoholPoisoning = false; public bool shadowflame = false; public bool daybroken = false; - public bool wDeath = false; + public bool whisperingDeath = false; public bool dragonFire = false; public bool vermillionFlux = false; public bool auricRebuke = false; public bool staticDischarge = false; public bool miracleBlight = false; - public bool aCrunch = false; + public bool armorCrunch = false; public bool crumble = false; public bool irradiated = false; - public bool bFlames = false; + public bool brimstoneFlames = false; public bool weakBrimstoneFlames = false; public bool demonicFlames = false; - public bool gsInferno = false; + public bool godSlayerInferno = false; public bool astralInfection = false; /// Plague debuff. - public bool pFlames = false; - public bool hFlames = false; - public bool hInferno = false; - public bool gState = false; - public bool bBlood = false; + public bool plague = false; + public bool holyFlames = false; + public bool holyInferno = false; + public bool burningBlood = false; public bool brainRot = false; public bool heavybleeding = false; public bool laceration = false; @@ -1276,9 +1300,9 @@ namespace CalamityMod.CalPlayer public bool trueVHex = false; public bool DoGExtremeGravity = false; public bool warped = false; - public bool cDepth = false; - public bool rTide = false; - public bool hPressure = false; + public bool crushDepth = false; + public bool riptide = false; + public bool hadopelagicPressure = false; public bool fishAlert = false; public bool clamity = false; public bool NOU = false; @@ -1288,9 +1312,9 @@ namespace CalamityMod.CalPlayer public bool voidfrost = false; public bool eutrophication = false; /// Frozen Lungs debuff. - public bool iCantBreathe = false; + public bool frozenLungs = false; /// Searing Lava debuff. - public bool cragsLava = false; + public bool searingLava = false; public bool vaporfied = false; public bool banishingFire = false; public bool wither = false; @@ -1321,13 +1345,12 @@ namespace CalamityMod.CalPlayer public bool xWrath = false; public bool graxDefense = false; public bool encased = false; - public bool brutalCarnage = false; public bool omniscience = false; public bool zerg = false; public bool zen = false; public bool isNearbyBoss = false; public bool flaskBrimstone = false; - public bool cirrusVodka = false; + public bool purpleHaze = false; public bool mushy = false; public bool PinkJellyRegen = false; public bool GreenJellyRegen = false; @@ -1389,7 +1412,6 @@ namespace CalamityMod.CalPlayer public int bloodfinTimer = 30; public bool hallowedRegen = false; public bool hallowedPower = false; - public bool kamiBoost = false; public bool avertorBonus = false; public bool divineBless = false; public bool infiniteFlight = false; @@ -1449,21 +1471,21 @@ namespace CalamityMod.CalPlayer /// Enchanted Conch. public bool hCrab = false; /// Heart of the Elements. - public bool allWaifus = false; + public bool allElementals = false; /// Hearts of the Elements; however, the minions will not attack. - public bool allWaifusVanity = false; + public bool allElementalsVanity = false; /// Silva armor's Silva Crystal. public bool sCrystal = false; /// Elemental in a Bottle. - public bool sWaifu = false; + public bool sandEleBuff = false; /// Rare Elemental in a Bottle. - public bool dWaifu = false; + public bool rareSandEleBuff = false; /// Eye of the Storm. - public bool cWaifu = false; + public bool cloudEleBuff = false; /// Rose Stone. - public bool bWaifu = false; + public bool brimEleBuff = false; /// Pearl of Enthrallment. - public bool slWaifu = false; + public bool waterEleBuff = false; public bool fClump = false; /// Demonshade armor's Red Devil. public bool rDevil = false; @@ -1478,8 +1500,6 @@ namespace CalamityMod.CalPlayer public bool victideSnail = false; /// Hydrothermic armor's Vent. public bool cSpirit = false; - /// Reaver armor's Reaver Orb. - public bool rOrb = false; /// Daedalus armor's Daedalus Crystal. public bool dCrystal = false; public bool endoHydra = false; @@ -1514,6 +1534,7 @@ namespace CalamityMod.CalPlayer public bool starSwallowerPetFroge = false; public bool snakeEyes = false; public bool poleWarper = false; + public bool aqueousHunterDrone = false; public bool causticDragon = false; public bool plaguebringerPatronSummon = false; public bool howlTrio = false; @@ -1523,7 +1544,12 @@ namespace CalamityMod.CalPlayer public bool deathstareEyeball = false; public bool witherBlossom = false; public bool flowersOfMortality = false; - public bool ViridVanguard = false; + public bool viridVanguard = false; + public bool ViridVanguardActiveAttackerThisFrame = false; + public float ViridVanguardRotation = 0; + public float ViridVanguardActiveCooldown = 0; + public float ViridVanguardRotationToAdd = 0; + public bool InvertExaltationLineRotationDirections = false; public bool sageSpirit = false; public bool fleshBall = false; public bool eyeOfNight = false; @@ -1541,6 +1567,16 @@ namespace CalamityMod.CalPlayer public bool AmphibiansGuitarBool = false; #endregion + #region Whip + public bool forceSummonTagCrit = false; //Forces whip multiplicative effects to function as crit chance + public bool forceSummonTagMultiplicative = false; //Forces whip multiplicative effects to function as multiplicative damage + + //Allows providing flat, crit, and multiplicative tag values on gear. These will apply on *any* minion or sentry hit, not just if the target is tagged. + public int bonusFlatTag = 0; + public float bonusCritTag = 0; + public float bonusMultTag = 0; + #endregion + #region Biome public bool ZoneSunkenSea => ZoneTimelessShores || ZoneRadiantReefs || ZonePolypForest || ZoneGleamingBurrows || ZoneClamDen || ZoneBasaltGully; public bool ZoneTimelessShores => Player.InModBiome(); @@ -1571,33 +1607,19 @@ namespace CalamityMod.CalPlayer #endregion #region Transformation - public bool abyssalDivingSuitPrevious; public bool abyssalDivingSuit; - public bool abyssalDivingSuitHide; - public bool abyssalDivingSuitForce; - public bool abyssalDivingSuitPower; + public bool abyssalDivingSuitPrevious; public bool profanedCrystal; public int profanedCrystalStatePrevious; public bool profanedCrystalPrevious; public int profanedCrystalAnim; - public bool profanedCrystalForce; public bool profanedCrystalBuffs; - public bool profanedCrystalHide; - public KeyValuePair profanedCrystalWingCounter = new KeyValuePair(0, 10); - public KeyValuePair profanedCrystalAnimCounter = new KeyValuePair(0, 10); + public int pscState; public Color pscLerpColor = Color.White; public bool aquaticHeartPrevious; public bool aquaticHeart; - public bool aquaticHeartHide; - public bool aquaticHeartForce; - public bool aquaticHeartPower; - public bool snowmanPrevious; - public bool snowman; - public bool snowmanHide; - public bool snowmanForce; public bool snowmanNoseless; - public bool snowmanPower; public bool meldTransformationPrevious; public bool meldTransformation; public bool meldTransformationForce; @@ -1606,8 +1628,6 @@ namespace CalamityMod.CalPlayer public bool omegaBlueTransformation; public bool omegaBlueTransformationForce; public bool omegaBlueTransformationPower; - public bool ghostBracelet; - public bool punchCard; #endregion #region Calamitas Enchant Effects @@ -1687,6 +1707,7 @@ namespace CalamityMod.CalPlayer // This may seem like a scuffed setup, but a simple bool will have ordering issues when it comes to drawing. // Until ModSceneMetrics gets implemented, this works for now. public int BrimstoneLavaFountainCounter = 0; + public FireParticleSet ManaBurnFireDrawer = null; #endregion Draw Effects #region Draedon Summoning @@ -1774,7 +1795,6 @@ namespace CalamityMod.CalPlayer newPrincessInventory = false; newSkeletonMerchantInventory = false; newPermafrostInventory = false; - newCirrusInventory = false; newAmidiasInventory = false; newBanditInventory = false; newCalamitasInventory = false; @@ -1828,7 +1848,6 @@ namespace CalamityMod.CalPlayer boost.AddWithCondition("newPrincessInventory", newPrincessInventory); boost.AddWithCondition("newSkeletonMerchantInventory", newSkeletonMerchantInventory); boost.AddWithCondition("newPermafrostInventory", newPermafrostInventory); - boost.AddWithCondition("newCirrusInventory", newCirrusInventory); boost.AddWithCondition("newAmidiasInventory", newAmidiasInventory); boost.AddWithCondition("newBanditInventory", newBanditInventory); boost.AddWithCondition("newCalamitasInventory", newCalamitasInventory); @@ -1920,7 +1939,6 @@ namespace CalamityMod.CalPlayer newPrincessInventory = boost.Contains("newPrincessInventory"); newSkeletonMerchantInventory = boost.Contains("newSkeletonMerchantInventory"); newPermafrostInventory = boost.Contains("newPermafrostInventory"); - newCirrusInventory = boost.Contains("newCirrusInventory"); newAmidiasInventory = boost.Contains("newAmidiasInventory"); newBanditInventory = boost.Contains("newBanditInventory"); newCalamitasInventory = boost.Contains("newCalamitasInventory"); @@ -1994,11 +2012,21 @@ namespace CalamityMod.CalPlayer #region ResetEffects public override void ResetEffects() { + ViridVanguardActiveAttackerThisFrame = Main.projectile.Any(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Player.whoAmI && x.ModProjectile().CurrentState == ViridVanguardBlade.ViridVanguardAIState.PhotonRipperZenithSlashes); + ViridVanguardRotation = MathHelper.WrapAngle(ViridVanguardRotation + ViridVanguardRotationToAdd); + ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed; + + if (Player.HeldItem.type == ModContent.ItemType()) + { + if (ViridVanguardActiveCooldown > 0) + ViridVanguardActiveCooldown--; + } + else if (ViridVanguardActiveCooldown >= 0 && ViridVanguardActiveCooldown < ViridVanguard.ActiveAttackCooldown) + ViridVanguardActiveCooldown++; if (fleshKnuckles) - Player.statLifeMax2 += 45; + Player.statLifeMax2 += 25; int percentMaxLifeIncrease = 0; - // Blood Pact and Chalice of the Blood God stack their HP bonuses if you want to equip both if (bloodPact) percentMaxLifeIncrease += 25; @@ -2038,7 +2066,6 @@ namespace CalamityMod.CalPlayer DashID = string.Empty; externalAbyssLight = 0; - externalBreathLossMultBoost = 0f; externalBreathTickBoost = 0f; externalFlightTimeMultBoost = 0f; externalRageEnabled = externalAdrenalineEnabled = null; @@ -2095,7 +2122,6 @@ namespace CalamityMod.CalPlayer onyxExcavator = false; rimehound = false; - fab = false; crysthamyr = false; ExoChair = false; miniOldDuke = false; @@ -2127,7 +2153,6 @@ namespace CalamityMod.CalPlayer silvaSummon = false; auricSet = false; - auricBoost = false; auricSetMelee = false; GemTechSet = false; @@ -2149,7 +2174,6 @@ namespace CalamityMod.CalPlayer ataxiaBolt = false; ataxiaGeyser = false; - ataxiaFire = false; ataxiaVolley = false; ataxiaBlaze = false; ataxiaMage = false; @@ -2159,7 +2183,6 @@ namespace CalamityMod.CalPlayer shadowSpeed = false; dsSetBonus = false; wearingRogueArmor = false; - cirrusDress = false; blockAllDashes = false; blazingCursorDamage = false; @@ -2171,7 +2194,7 @@ namespace CalamityMod.CalPlayer trinketOfChi = false; gladiatorSword = false; unstableGraniteCore = false; - regenator = false; + regenerator = false; deepDiver = false; theBee = false; arcFlashRing = false; @@ -2210,15 +2233,11 @@ namespace CalamityMod.CalPlayer lAmbergris = false; tortShell = false; absorber = false; - alwaysHoneyRegen = false; - alwaysHoneyRegenAmount = 0; - honeyTurboRegen = false; honeyDewHalveDebuffs = false; livingDewHalveDebuffs = false; aAmpoule = false; rOoze = false; radiantOozeRegen = 0; - ambrosialAmpouleRegen = 0; purityRegen = 0; fBarrier = false; aBrain = false; @@ -2232,8 +2251,6 @@ namespace CalamityMod.CalPlayer cryogenSoul = false; ascendantInsignia = false; ascendantTrail = false; - frozenWingsCold = false; - flameWingsHeat = false; magmaStoneVisuals = true; eGauntlet = false; eGauntletVisuals = true; @@ -2258,6 +2275,7 @@ namespace CalamityMod.CalPlayer lifejelly = false; GrandGelatin = false; cleansingjelly = false; + spawnedJellyAura = false; community = false; shatteredCommunity = false; stressPills = false; @@ -2301,7 +2319,6 @@ namespace CalamityMod.CalPlayer phantomicArtifact = false; hallowedRegen = false; hallowedPower = false; - kamiBoost = false; tracersDust = false; tracersCelestial = false; tracersElysian = false; @@ -2319,17 +2336,14 @@ namespace CalamityMod.CalPlayer starTaintedGenerator = false; camper = false; corrosiveSpine = false; - RustyMedallionDroplets = false; + scionsCurio = false; rottenDogTooth = false; angelicAlliance = false; - BloomStoneRegen = false; ChaosStone = false; CryoStone = false; CryoStoneVanity = false; voidField = false; copyrightInfringementShield = false; - reducedDaybrokenDamage = false; - reducedNightwitherDamage = false; daedalusReflect = false; daedalusSplit = false; @@ -2342,12 +2356,11 @@ namespace CalamityMod.CalPlayer lunicCorpsSet = false; lunicCorpsLegs = false; - rangedAmmoCost = 1f; + ammoCost = 1f; healingPotionMultiplier = 1f; avertorBonus = false; - reaverRegen = false; reaverSpeed = false; reaverDefense = false; reaverExplore = false; @@ -2379,6 +2392,7 @@ namespace CalamityMod.CalPlayer forbiddenCirclet = false; silverMedkit = false; + tungstenArmorHookBoost = false; goldArmorGoldDrops = false; miningSet = false; @@ -2390,8 +2404,11 @@ namespace CalamityMod.CalPlayer necroSet = false; frostSet = false; - victideSet = false; - victideSummoner = false; + victideBarrierSet = false; + victideBarrierHead = false; + victideBurrowSet = false; + victideBurrowHead = false; + victideSnailSet = false; sulphurSet = false; @@ -2402,7 +2419,6 @@ namespace CalamityMod.CalPlayer titanHeartSet = false; titanHeartMask = false; titanHeartMantle = false; - titanHeartBoots = false; umbraphileSet = false; plagueReaper = false; plaguebringerPatronSet = false; @@ -2461,27 +2477,26 @@ namespace CalamityMod.CalPlayer alcoholPoisoning = false; shadowflame = false; daybroken = false; - wDeath = false; + whisperingDeath = false; dragonFire = false; vermillionFlux = false; auricRebuke = false; staticDischarge = false; miracleBlight = false; - aCrunch = false; + armorCrunch = false; crumble = false; irradiated = false; - bFlames = false; + brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; weakBrimstoneFlames = false; demonicFlames = false; - gsInferno = false; + godSlayerInferno = false; astralInfection = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; + plague = false; + holyFlames = false; + holyInferno = false; + burningBlood = false; brainRot = false; heavybleeding = false; laceration = false; @@ -2491,9 +2506,9 @@ namespace CalamityMod.CalPlayer trueVHex = false; DoGExtremeGravity = false; warped = false; - cDepth = false; - rTide = false; - hPressure = false; + crushDepth = false; + riptide = false; + hadopelagicPressure = false; fishAlert = false; clamity = false; NOU = false; @@ -2503,13 +2518,20 @@ namespace CalamityMod.CalPlayer nightwither = false; voidfrost = false; eutrophication = false; - iCantBreathe = false; - cragsLava = false; + frozenLungs = false; + searingLava = false; vaporfied = false; banishingFire = false; wither = false; ManaBurn = false; + TypelessDebuffMultiplier = new(); + HeatDebuffMultiplier = new(); + ColdDebuffMultiplier = new(); + SicknessDebuffMultiplier = new(); + WaterDebuffMultiplier = new(); + ElectricDebuffMultiplier = new(); + trinketOfChiBuff = false; sandsWindBuff = false; aeolianEarthBuff = false; @@ -2520,7 +2542,6 @@ namespace CalamityMod.CalPlayer xWrath = false; graxDefense = false; encased = false; - brutalCarnage = false; omniscience = false; zerg = false; zen = false; @@ -2542,7 +2563,7 @@ namespace CalamityMod.CalPlayer trippy = false; amidiasBlessing = false; flaskBrimstone = false; - cirrusVodka = false; + purpleHaze = false; shine = false; anechoicCoating = false; mushy = false; @@ -2554,8 +2575,6 @@ namespace CalamityMod.CalPlayer bloodfinBoost = false; divineBless = false; - killSpikyBalls = false; - vodka = false; redWine = false; grapeBeer = false; @@ -2583,6 +2602,8 @@ namespace CalamityMod.CalPlayer pinkCandle = false; yellowCandle = false; + SelectedFishingMinigame = FishingMinigames.None; + #region Minion Reset Effects wDroid = false; resButterfly = false; @@ -2614,11 +2635,11 @@ namespace CalamityMod.CalPlayer pGuy = false; cEnergy = false; pSoulGuardians = false; - sWaifu = false; - dWaifu = false; - cWaifu = false; - bWaifu = false; - slWaifu = false; + sandEleBuff = false; + rareSandEleBuff = false; + cloudEleBuff = false; + brimEleBuff = false; + waterEleBuff = false; fClump = false; rDevil = false; aValkyrie = false; @@ -2629,21 +2650,20 @@ namespace CalamityMod.CalPlayer astralProbe = false; victideSnail = false; cSpirit = false; - rOrb = false; dCrystal = false; MutatedTruffleBool = false; - sandWaifu = false; - sandWaifuVanity = false; - sandBoobWaifu = false; - sandBoobWaifuVanity = false; - cloudWaifu = false; - cloudWaifuVanity = false; - brimstoneWaifu = false; - brimstoneWaifuVanity = false; - sirenWaifu = false; - sirenWaifuVanity = false; - allWaifus = false; - allWaifusVanity = false; + sandElemental = false; + sandElementalVanity = false; + rareSandElemental = false; + rareSandElementalVanity = false; + cloudElemental = false; + cloudElementalVanity = false; + brimElemental = false; + brimElementalVanity = false; + waterElemental = false; + waterElementalVanity = false; + allElementals = false; + allElementalsVanity = false; fungalClump = false; fungalClumpVanity = false; howlsHeart = false; @@ -2683,6 +2703,7 @@ namespace CalamityMod.CalPlayer starSwallowerPetFroge = false; snakeEyes = false; poleWarper = false; + aqueousHunterDrone = false; causticDragon = false; plaguebringerPatronSummon = false; howlTrio = false; @@ -2692,7 +2713,7 @@ namespace CalamityMod.CalPlayer deathstareEyeball = false; witherBlossom = false; flowersOfMortality = false; - ViridVanguard = false; + viridVanguard = false; sageSpirit = false; fleshBall = false; eyeOfNight = false; @@ -2710,6 +2731,13 @@ namespace CalamityMod.CalPlayer AmphibiansGuitarBool = false; #endregion + //On GFB both are enabled to cause the game to pick between multiplicative and crit at random + forceSummonTagMultiplicative = (Main.zenithWorld ? true : false); + forceSummonTagCrit = (Main.zenithWorld ? true : false); + bonusFlatTag = 0; + bonusCritTag = 0; + bonusMultTag = 0; + /* Spawn blockers from back when they used to work by being favorited and not a toggleable item noStupidNaturalARSpawns = false disableVoodooSpawns = false; @@ -2720,32 +2748,24 @@ namespace CalamityMod.CalPlayer */ abyssalDivingSuitPrevious = abyssalDivingSuit; - abyssalDivingSuit = abyssalDivingSuitHide = abyssalDivingSuitForce = abyssalDivingSuitPower = false; + abyssalDivingSuit = false; - aquaticHeartPrevious = aquaticHeart; - aquaticHeart = aquaticHeartHide = aquaticHeartForce = aquaticHeartPower = false; + aquaticHeart = false; profanedCrystalStatePrevious = pscState; profanedCrystalPrevious = profanedCrystal; - profanedCrystal = profanedCrystalBuffs = profanedCrystalForce = profanedCrystalHide = false; + profanedCrystal = profanedCrystalBuffs = false; pscState = 0; pscLerpColor = Color.White; - snowmanPrevious = snowman; - snowman = snowmanHide = snowmanForce = snowmanPower = false; - meldTransformationPrevious = meldTransformation; meldTransformation = meldTransformationForce = meldTransformationPower = false; omegaBlueTransformationPrevious = omegaBlueTransformation; omegaBlueTransformation = omegaBlueTransformationForce = omegaBlueTransformationPower = false; - ghostBracelet = false; - punchCard = false; - rageModeActive = false; adrenalineModeActive = false; - AdrenalineTrail = false; RageDuration = BalancingConstants.DefaultRageDuration; RageDamageBoost = BalancingConstants.DefaultRageDamageBoost; @@ -2791,14 +2811,12 @@ namespace CalamityMod.CalPlayer public override void ModifyScreenPosition() { // CIT 08FEB2025: Photosensitivity config also disables screenshake - if (CalamityClientConfig.Instance.ScreenshakePower == 0 || CalamityClientConfig.Instance.Photosensitivity) - return; + bool allowScreenshake = CalamityClientConfig.Instance.ScreenshakePower > 0 && !CalamityClientConfig.Instance.Photosensitivity; - if (GeneralScreenShakePower > 0f) - { + if (GeneralScreenShakePower > 0f && allowScreenshake) Main.screenPosition += Main.rand.NextVector2Circular(GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower, GeneralScreenShakePower * CalamityClientConfig.Instance.ScreenshakePower); - GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); - } + + GeneralScreenShakePower = MathHelper.Clamp(GeneralScreenShakePower - 0.185f, 0f, 20f * CalamityClientConfig.Instance.ScreenshakePower); } #endregion @@ -2845,6 +2863,8 @@ namespace CalamityMod.CalPlayer #endregion #region Buffs, Debuffs, Counters, and Nonsense + if (Player.HeldItem.IsAir || Player.HeldItem.fishingPole == 0) + consecutiveCaughtFish = 0; heldGaelsLastFrame = false; gaelSwipes = 0; whitewaterHeal = 0; @@ -2861,12 +2881,11 @@ namespace CalamityMod.CalPlayer auralisAurora = 0; necroReviveCounter = -1; hideOfDeusTimer = 0; - bloomStoneHealInc = 0; + bloomStoneHealPool = 0; bloomStoneTotalHeal = 0; bloomStoneHealTimer = 0; - bloomStoneDR = 0; + bloomStoneHealRate = 0; murasamaHitCooldown = 0; - RustyMedallionCooldown = 0; SulphWaterPoisoningLevel = 0f; holyInfernoFadeIntensity = 0f; spiritOriginCritBoost = 0; @@ -2875,7 +2894,7 @@ namespace CalamityMod.CalPlayer adrenaline = 0f; raiderCritLifespan = 0; raiderSoundCooldown = 0; - gSabatonHotkeyHoldTime = 0; + gSabatonHotkeyFallWindup = -1; gSabatonFall = 0; gSabatonFalling = false; gSabatonTempJumpSpeed = 0; @@ -2897,7 +2916,6 @@ namespace CalamityMod.CalPlayer demonSwordKillMode = false; externalAbyssLight = 0; - externalBreathLossMultBoost = 0f; externalBreathTickBoost = 0f; externalFlightTimeMultBoost = 0f; externalColdImmunity = externalHeatImmunity = false; @@ -2910,11 +2928,9 @@ namespace CalamityMod.CalPlayer jetPackDirection = 0; andromedaCripple = 0; theBeeCooldown = 0; - killSpikyBalls = false; scuttlerCooldown = 0; rogueCrownCooldown = 0; wingProjectileCooldown = 0; - statisPenaltyTimer = -1; hallowedRuneCooldown = 0; sulphurBubbleCooldown = 0; ladHearts = 0; @@ -2925,27 +2941,26 @@ namespace CalamityMod.CalPlayer alcoholPoisoning = false; shadowflame = false; daybroken = false; - wDeath = false; + whisperingDeath = false; dragonFire = false; vermillionFlux = false; auricRebuke = false; staticDischarge = false; miracleBlight = false; - aCrunch = false; + armorCrunch = false; crumble = false; irradiated = false; - bFlames = false; + brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; weakBrimstoneFlames = false; demonicFlames = false; - gsInferno = false; + godSlayerInferno = false; astralInfection = false; - pFlames = false; - hFlames = false; - hInferno = false; - gState = false; - bBlood = false; + plague = false; + holyFlames = false; + holyInferno = false; + burningBlood = false; brainRot = false; heavybleeding = false; laceration = false; @@ -2955,9 +2970,9 @@ namespace CalamityMod.CalPlayer trueVHex = false; DoGExtremeGravity = false; warped = false; - cDepth = false; - rTide = false; - hPressure = false; + crushDepth = false; + riptide = false; + hadopelagicPressure = false; fishAlert = false; clamity = false; NOU = false; @@ -2967,13 +2982,19 @@ namespace CalamityMod.CalPlayer nightwither = false; voidfrost = false; eutrophication = false; - iCantBreathe = false; - cragsLava = false; + frozenLungs = false; + searingLava = false; vaporfied = false; banishingFire = false; wither = false; PurityHealSlowdownFrames = 0; ImmobilityDebuffImmunityTimer = 0; + TypelessDebuffMultiplier = new(); + HeatDebuffMultiplier = new(); + ColdDebuffMultiplier = new(); + SicknessDebuffMultiplier = new(); + WaterDebuffMultiplier = new(); + ElectricDebuffMultiplier = new(); #endregion #region Rogue @@ -3003,7 +3024,6 @@ namespace CalamityMod.CalPlayer hallowedPower = false; onyxExcavator = false; rimehound = false; - fab = false; crysthamyr = false; ExoChair = false; abyssalDivingSuitPlates = false; @@ -3017,10 +3037,8 @@ namespace CalamityMod.CalPlayer crimEffigy = false; rRage = false; xWrath = false; - kamiBoost = false; graxDefense = false; encased = false; - brutalCarnage = false; omniscience = false; zerg = false; zen = false; @@ -3041,7 +3059,7 @@ namespace CalamityMod.CalPlayer sulphurskin = false; baguette = false; flaskBrimstone = false; - cirrusVodka = false; + purpleHaze = false; shine = false; anechoicCoating = false; mushy = false; @@ -3086,7 +3104,7 @@ namespace CalamityMod.CalPlayer bloodfinTimer = 0; healCounter = 300; danceOfLightCharge = 0; - rangedAmmoCost = 1f; + ammoCost = 1f; healingPotionMultiplier = 1f; avertorBonus = false; divineBless = false; @@ -3097,6 +3115,7 @@ namespace CalamityMod.CalPlayer #region Armor Set Bonuses silverMedkit = false; silverMedkitTimer = 0; + tungstenArmorHookBoost = false; goldArmorGoldDrops = false; miningSet = false; miningSetCooldown = 0; @@ -3107,13 +3126,12 @@ namespace CalamityMod.CalPlayer godSlayerThrowing = false; godSlayerDashHotKeyPressed = false; SpeedBlasterDashStarted = false; - auricBoost = false; auricSetMelee = false; silvaSet = false; silvaMage = false; silvaSummon = false; hasSilvaEffect = false; - silvaCountdown = silvaReviveDuration; + silvaCountdown = SilvaArmor.ReviveDuration; auricSet = false; GemTechSet = false; CobaltSet = false; @@ -3138,8 +3156,6 @@ namespace CalamityMod.CalPlayer lunicCorpsSet = false; lunicCorpsLegs = false; reaverSpeed = false; - reaverRegen = false; - reaverRegenCooldown = 0; reaverDefense = false; reaverExplore = false; shadeRegen = false; @@ -3147,7 +3163,6 @@ namespace CalamityMod.CalPlayer titanHeartSet = false; titanHeartMask = false; titanHeartMantle = false; - titanHeartBoots = false; titanCooldown = 0; umbraphileSet = false; fathomSwarmer = false; @@ -3165,7 +3180,6 @@ namespace CalamityMod.CalPlayer ataxiaMage = false; ataxiaBolt = false; ataxiaGeyser = false; - ataxiaFire = false; ataxiaVolley = false; ataxiaBlaze = false; hydrothermalSmoke = false; @@ -3179,7 +3193,10 @@ namespace CalamityMod.CalPlayer meteorSet = false; necroSet = false; frostSet = false; - victideSet = false; + victideBarrierSet = false; + victideBarrierHead = false; + victideBurrowSet = false; + victideBurrowHead = false; aeroSet = false; sulphurSet = false; statigelSet = false; @@ -3232,12 +3249,13 @@ namespace CalamityMod.CalPlayer CurrentlyViewedHologramText = string.Empty; #endregion - KameiBladeUseDelay = 0; - AdrenalineTrail = false; ascendantTrail = false; evilSmasherBoost = 0; burningSeaBurnOut = 0; + flareGunOverheat = 0; hellbornShots = 0; + lucreciaEnergy = 0; + garandShots = 0; searedPanCounter = 0; searedPanTimer = 0; potionTimer = 0; @@ -3309,7 +3327,7 @@ namespace CalamityMod.CalPlayer ascendantInsigniaBuffTime = 240; //4 seconds } - int numOfBlobs = Player.ownedProjectileCounts[ModContent.ProjectileType()]; + int numOfBlobs = Player.ownedProjectileCounts[ProjectileType()]; if (transformer && numOfBlobs > 0 && Main.myPlayer == Player.whoAmI && CalamityKeybinds.TransformerHotKey.JustPressed && transformerCooldown <= 0 && true) // Add check if projectiles are active { // Go fire all the blobs @@ -3320,7 +3338,7 @@ namespace CalamityMod.CalPlayer for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (projectile.active && projectile.type == ModContent.ProjectileType()) + if (projectile.active && projectile.type == ProjectileType()) { projectile.localAI[0] = 5; } @@ -3336,18 +3354,20 @@ namespace CalamityMod.CalPlayer } - //Only increment hotkey holdtime if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset hold time to zero - if (CalamityKeybinds.GravistarSabatonHotkey.Current && gSabaton && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) + //Only increment the slam if not on ground, not mounted, not on rope, not hooked, not tongued, otherwise reset slam time to zero + if (CalamityKeybinds.GravistarSabatonHotkey.JustPressed && gSabatonHotkeyFallWindup < 0) + gSabatonHotkeyFallWindup = 0; + if (gSabaton && gSabatonHotkeyFallWindup >= 0 && Main.myPlayer == Player.whoAmI && (Player.velocity.Y != 0) && !Player.pulley && !Player.mount.Active && Player.grappling[0] == -1 && !Player.tongued) { - gSabatonHotkeyHoldTime++; - if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime % 3f == 0) + gSabatonHotkeyFallWindup++; + if (gSabatonHotkeyFallWindup < 20 && gSabatonHotkeyFallWindup % 2f == 0) { SpawnGravistarParticle(); } } else if (Main.myPlayer == Player.whoAmI) { - gSabatonHotkeyHoldTime = 0; + gSabatonHotkeyFallWindup = -1; } if (CalamityKeybinds.NormalityRelocatorHotKey.JustPressed && normalityRelocator && Main.myPlayer == Player.whoAmI) @@ -3544,19 +3564,16 @@ namespace CalamityMod.CalPlayer { PlayerLoader.ArmorSetBonusActivated(Player); - if (CalamityClientConfig.Instance.CalamityArmorSetBonusDoubleTap) + // Activate vanilla set bonuses + if (Player.setVortex && !Player.mount.Active) + Player.vortexStealthActive = !Player.vortexStealthActive; + + if (Player.setForbidden) { - // Activate vanilla set bonuses - if (Player.setVortex && !Player.mount.Active) - Player.vortexStealthActive = !Player.vortexStealthActive; + Player.MinionRestTargetAim(); - if (Player.setForbidden) - { - Player.MinionRestTargetAim(); - - if (!Player.setForbiddenCooldownLocked) - Player.CommandForbiddenStorm(); - } + if (!Player.setForbiddenCooldownLocked) + Player.CommandForbiddenStorm(); } } @@ -3635,7 +3652,7 @@ namespace CalamityMod.CalPlayer // Gael's Greatsword replaces Rage Mode with an uber skull attack if (!(Player.HasCooldown(Cooldowns.GaelsRage.ID)) && Player.ActiveItem().type == ItemType() && rage > 0f) { - SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); + SoundEngine.PlaySound(SilvaArmor.DispelSound, Player.Center); for (int i = 0; i < 3; i++) Dust.NewDust(Player.position, 120, 120, DustID.Rain_BloodMoon, 0f, 0f, 100, default, 1.5f); @@ -3769,25 +3786,49 @@ namespace CalamityMod.CalPlayer public override void ArmorSetBonusActivated() { - // Don't trigger set bonuses if the config is disabled and the double-tap hotkey was triggered - if (!(CalamityKeybinds.ArmorSetBonusHotKey.JustPressed || CalamityClientConfig.Instance.CalamityArmorSetBonusDoubleTap)) - return; - // TODO -- It would be nice if triggerable set bonuses used interfaces instead of having to go through this large if chain. + if (victideBurrowSet) + { + if (cooldowns.TryGetValue(BubblyBurrow.ID, out CooldownInstance cd)) + { + // Return to normal if you have the ability active + if (cd.timeLeft > VictideHeadBurrow.BurrowCooldown) + { + cd.timeLeft = VictideHeadBurrow.BurrowCooldown + 1; + SyncCooldownDictionary(false); + } + } + else if (!Player.tongued && !Player.shimmering) + { + SoundEngine.PlaySound(SoundID.Item154, Player.Center); + if (Player.whoAmI == Main.myPlayer) + { + Player.AddCooldown(BubblyBurrow.ID, VictideHeadBurrow.BurrowCooldown + VictideHeadBurrow.BurrowDuration); + + var source = Player.GetSource_Misc("1"); + Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI); + } + } + } + if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID)) + { + // Explosion and dash are handled in the VictideBarrier file + if (Player.whoAmI == Main.myPlayer) + Player.AddCooldown(WardingWave.ID, VictideHeadBarrier.BarrierCooldown); + } if (brimflameSet && !Player.HasCooldown(BrimflameFrenzy.ID)) { if (Player.whoAmI == Main.myPlayer) { if (brimflameFrenzy) { - brimflameFrenzy = false; Player.ClearBuff(BuffType()); + Player.AddCooldown(BrimflameFrenzy.ID, BrimflameCowl.FrenzyCooldown); } else { - brimflameFrenzy = true; - Player.AddBuff(BuffType(), 10 * 60, true); - SoundEngine.PlaySound(BrimflameScowl.ActivationSound, Player.Center); + Player.AddBuff(BuffType(), BrimflameCowl.FrenzyDuration, true); + SoundEngine.PlaySound(BrimflameCowl.ActivationSound, Player.Center); for (int i = 0; i < 36; i++) { Dust brimDust = Dust.NewDustDirect(new Vector2(Player.position.X, Player.position.Y + 16f), Player.width, Player.height - 16, (int)CalamityDusts.Brimstone, 0f, 0f, 0, default, 1f); @@ -3812,13 +3853,13 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer) { - Player.AddBuff(BuffType(), 602, false); + Player.AddBuff(BuffType(), TarragonHeadMelee.CloakDuration, false); } } if (bloodflareRanged && !Player.HasCooldown(BloodflareRangedSet.ID)) { if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(BloodflareRangedSet.ID, 1800); + Player.AddCooldown(BloodflareRangedSet.ID, BloodflareHeadRanged.SoulCooldown); SoundEngine.PlaySound(BloodflareHeadRanged.ActivationSound, Player.Center); for (int d = 0; d < 64; d++) @@ -3842,8 +3883,8 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { var source = Player.GetSource_Misc("1"); - int damage = (int)(Player.GetTotalDamage().ApplyTo(300f)); - for (int i = 0; i < 16; i++) + int damage = (int)(Player.GetTotalDamage().ApplyTo(BloodflareHeadRanged.SoulDamage)); + for (int i = 0; i < BloodflareHeadRanged.SoulAmount; i++) { float ai1 = Main.rand.NextFloat() + 0.5f; Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); @@ -3857,9 +3898,9 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer) { - Player.AddBuff(BuffType(), 300, false); + Player.AddBuff(BuffType(), OmegaBlueHelmet.MadnessDuration, false); } - Player.AddCooldown(OmegaBlue.ID, 1800); + Player.AddCooldown(OmegaBlue.ID, OmegaBlueHelmet.MadnessDuration + OmegaBlueHelmet.MadnessCooldown); SoundEngine.PlaySound(OmegaBlueHelmet.ActivationSound, Player.Center); for (int i = 0; i < 66; i++) { @@ -3892,26 +3933,26 @@ namespace CalamityMod.CalPlayer } if (Player.whoAmI == Main.myPlayer) { - Player.AddBuff(BuffType(), 600, false); + Player.AddBuff(BuffType(), DemonshadeHelm.EnrageDuration, false); } if (Main.netMode != NetmodeID.MultiplayerClient) { foreach (NPC npc in Main.ActiveNPCs) { if (!npc.friendly && !npc.dontTakeDamage && Vector2.Distance(Player.Center, npc.Center) <= 3000f) - npc.AddBuff(BuffType(), 600, false); + npc.AddBuff(BuffType(), DemonshadeHelm.EnrageDuration, false); } } } if (plagueReaper && !Player.HasCooldown(PlagueBlackout.ID)) { SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); - Player.AddCooldown(PlagueBlackout.ID, 1800); + Player.AddCooldown(PlagueBlackout.ID, PlagueReaperMask.BlackoutDuration + PlagueReaperMask.BlackoutCooldown); } - if (forbiddenCirclet && forbiddenCooldown <= 0) + if (forbiddenCirclet && Player.ownedProjectileCounts[ProjectileType()] < 2) { - forbiddenCooldown = 45; - int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); + forbiddenCooldown = ForbiddenCirclet.StormCooldown; + int stormMana = (int)(ForbiddenCirclet.StormManaCost * Player.manaCost); if (Player.statMana < stormMana) { if (Player.manaFlower) @@ -3921,26 +3962,83 @@ namespace CalamityMod.CalPlayer } if (Player.statMana >= stormMana && !Player.silence) { - var source = Player.GetSource_Misc("1"); + var source = Player.GetSource_ItemUse(ContentSamples.ItemsByType[ItemType()]); Player.manaRegenDelay = (int)Player.maxRegenDelay; Player.statMana -= stormMana; // To compute Forbidden Circlet tornado damage, create a fake stat modifier on the spot which combines both classes. StatModifier forbidden = Player.GetTotalDamage().CombineWith(Player.GetDamage()); - int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.tornadoBaseDmg); + int damage = (int)forbidden.ApplyTo(ForbiddenCirclet.StormDamage); - float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.tornadoBaseKB); + float kBack = Player.GetTotalKnockback().ApplyTo(ForbiddenCirclet.StormKB); if (Player.whoAmI == Main.myPlayer) { - int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); - if (mark.WithinBounds(Main.maxProjectiles)) - Main.projectile[mark].DamageType = DamageClass.Generic; + if (Player.ownedProjectileCounts[ProjectileType()] > 0) + { + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.owner != Player.whoAmI || proj.type != ProjectileType()) + continue; + proj.ai[0] = CircletTornado.Lifetime - CircletTornado.Fadetime + proj.ai[0] % 60f; + proj.netUpdate = true; + } + } + Vector2 tornadoPos = Player.ClampedMouseWorld(); + Projectile.NewProjectile(source, tornadoPos, Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); + + Vector2 diff = tornadoPos - Player.Center; + float distance = diff.Length(); + if (distance > 0f) + { + for (float i = 0f; i < distance; i += 15f) + { + Vector2 dustPos = Player.Center + diff * i / distance; + Dust trail = Dust.NewDustDirect(dustPos, 0, 0, DustID.Sandnado); + trail.position = dustPos; + trail.fadeIn = 0.5f; + trail.scale = 0.7f; + trail.velocity *= 0.4f; + trail.noLight = true; + } + } + for (int j = 0; j < 30; j++) + { + Dust cloud = Dust.NewDustDirect(tornadoPos, 0, 0, DustID.Sandnado); + cloud.position = tornadoPos; + cloud.fadeIn = 1f; + cloud.scale = 0.3f; + cloud.noLight = true; + } } } } if (prismaticSet && !Player.HasCooldown(PrismaticLaser.ID) && prismaticLasers <= 0) - prismaticLasers = CalamityUtils.SecondsToFrames(35f); + prismaticLasers = PrismaticHelmet.LaserDuration + PrismaticHelmet.LaserCooldown; + if (WulfrumHat.HasArmorSet(Player)) + { + //Only activate if no cooldown & available scrap. + if (cooldowns.TryGetValue(WulfrumBastion.ID, out CooldownInstance cd)) + { + // Quick dismount if activated again + if (cd.timeLeft > WulfrumHat.BastionCooldown && cd.timeLeft < WulfrumHat.BastionCooldown + WulfrumHat.BastionTime - 60 * 3) + { + cd.timeLeft = WulfrumHat.BastionCooldown + 1; + SyncCooldownDictionary(false); + } + } + + else if (Player.HasItem(ItemType())) + { + Player.ConsumeItem(ItemType()); + //I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right + Player.AddCooldown(WulfrumBastion.ID, WulfrumHat.BastionCooldown + WulfrumHat.BastionTime); + //Though do I need to sync that or is the player inventory auto synced? + WulfrumHat.DummyCannon.SetDefaults(ItemType()); + } + } + if (DesertProwlerHat.HasArmorSet(Player) && !Player.HasCooldown(SandsmokeBomb.ID)) + Player.AddCooldown(SandsmokeBomb.ID, DesertProwlerHat.SmokeCooldown + DesertProwlerHat.SmokeDuration); } #endregion @@ -4050,6 +4148,11 @@ namespace CalamityMod.CalPlayer // Putting this in GlobalItem will run multiple times for each slot, which this system already does, creating a slew of problems. VanillaArmorChangeManager.ApplyPotentialEffectsTo(Player); + // Nerf to the proc rate of Spectre Mask's set bonus souls + // Vanilla subtracts 6.6666665 from this counter per frame, this reduces it to 4 + if (Player.ghostDmg > 0) + Player.ghostDmg += 2.6666665f; + // If the config is enabled, vastly increase the player's base tile and wall placement speeds // This stacks with the Brick Layer and Portable Cement Mixer if (CalamityServerConfig.Instance.FasterTilePlacement) @@ -4064,23 +4167,7 @@ namespace CalamityMod.CalPlayer if (Player.accRunSpeed < accRunSpeedMin) Player.accRunSpeed = accRunSpeedMin; - // Life Jelly regen aura spawn when using a healing potion - if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly && !GrandGelatin) - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - - // Cleansing Jelly cleansing aura spawn when using a healing potion - if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && cleansingjelly && !GrandGelatin) - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - - // Grand Gellatin regen and cleansing aura spawn when using a healing potion - if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && GrandGelatin && !absorber) - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - - // Absorber's regen, cleansing, and buffing aura spawn when using a healing potion - if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && absorber) - Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ProjectileType(), 0, 0, Player.whoAmI); - - if (snowman) + if (Player.Transformation().Type == ItemType()) { if (Player.whoAmI == Main.myPlayer && !snowmanNoseless) Player.AddBuff(BuffType(), 60, true); @@ -4123,16 +4210,16 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer) { - // While holding hotkey, but before slam, bring Y velocity closer to 0 - if (gSabatonHotkeyHoldTime < 30 && gSabatonHotkeyHoldTime != 0 && !gSabatonFalling) - Player.velocity.Y *= (60 - (gSabatonHotkeyHoldTime / 2f)) / 60f; + // While preparing slam, bring Y velocity closer to 0 + if (gSabatonHotkeyFallWindup < 20 && gSabatonHotkeyFallWindup != 0 && !gSabatonFalling) + Player.velocity.Y *= (60 - (gSabatonHotkeyFallWindup * 0.75f)) / 60f; // Play sound a bit early so it goes in time with the fall - if (gSabatonHotkeyHoldTime == 15 && !gSabatonFalling) + if (gSabatonHotkeyFallWindup == 5 && !gSabatonFalling) SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GravistarCharge") { Volume = 0.3f }); // 0.5 seconds passed, falling time - if (gSabatonHotkeyHoldTime == 30) + if (gSabatonHotkeyFallWindup == 20) { gSabatonFalling = true; Player.velocity.Y = 0.01f; @@ -4144,6 +4231,7 @@ namespace CalamityMod.CalPlayer { gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; } if (gSabatonFalling) @@ -4171,6 +4259,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ProjectileType(), damage, 4f, Player.whoAmI, gSabatonFall); gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; // Temporary jump speed is granted for 40 frames gSabatonTempJumpSpeed = 40; @@ -4182,6 +4271,7 @@ namespace CalamityMod.CalPlayer { gSabatonFall = 0; gSabatonFalling = false; + gSabatonHotkeyFallWindup = -1; } // Reset The Evolution's same projectile DR if unequipped or the cooldown ends @@ -4264,6 +4354,12 @@ namespace CalamityMod.CalPlayer { Player.ClearBuff(BuffID.WindPushed); } + if (Player.statMana < 0) + { + Player.AddBuff(BuffType(), 10); + } else if (Player.HasBuff(BuffType())) { + Player.ClearBuff(BuffType()); + } } #endregion @@ -4311,20 +4407,6 @@ namespace CalamityMod.CalPlayer { if (Player.whoAmI == Main.myPlayer && CalamityClientConfig.Instance.VanillaCooldownDisplay) { - if (Player.whoAmI == Main.myPlayer && Player.potionDelay != 0) - potionSick = true; - else - potionSick = false; - - if (!potionSick) - timePotionSick = 0; - else - timePotionSick++; - - // Add a cooldown display for potion sickness if the player has the vanilla counter ticking - if (potionSick && !Player.HasCooldown(PotionSickness.ID)) - Player.AddCooldown(PotionSickness.ID, Player.potionDelay, false); - if (cooldowns.TryGetValue(PotionSickness.ID, out CooldownInstance cd)) { if (Player.potionDelay != cd.timeLeft && cd.timeLeft > 0) @@ -4333,6 +4415,8 @@ namespace CalamityMod.CalPlayer if (cd.timeLeft > cd.duration) cd.duration = cd.timeLeft; // If the new cooldown is larger than the full duration, update, else keep it the same. } + else if (Player.whoAmI == Main.myPlayer && Player.potionDelay > 0) + Player.AddCooldown(PotionSickness.ID, Player.potionDelay, false); // Add a cooldown display for chaos state if the player has the vanilla counter ticking // This will make the cooldown look like vanilla Rod of Discord, as it wasn't applied by either Normality Relocator or Spectral Veil @@ -4353,15 +4437,7 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { float baseRecoveryRate = Main.expertMode ? BalancingConstants.LifeStealRecoveryRate_Expert : BalancingConstants.LifeStealRecoveryRate_Classic; - - float lifeStealRecoveryRateReduction = - CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : - CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : - Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : - BalancingConstants.LifeStealRecoveryRateReduction_Classic; - - if (Main.masterMode) - lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + float lifeStealRecoveryRateReduction = Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : BalancingConstants.LifeStealRecoveryRateReduction_Classic; float lifeStealRecoveryRate = baseRecoveryRate - lifeStealRecoveryRateReduction; if (Player.lifeSteal < -lifeStealRecoveryRate) @@ -4372,17 +4448,6 @@ namespace CalamityMod.CalPlayer } } - //Star in a Bottle gives Mana Regeneration instead of it's usual effect when you don't already have Mana Regeneration - if (!Player.manaRegenBuff && Player.HasBuff(BuffID.StarInBottle)) - { - //Cancel out Star In A Bottle's normal effect - Player.manaRegenDelayBonus -= 0.5f; - Player.manaRegenBonus -= 10; - //Apply Mana Regen Potion effect - Player.manaRegenBuff = true; - - } - ForceVariousEffects(); } #endregion @@ -4447,23 +4512,64 @@ namespace CalamityMod.CalPlayer #endregion + public override void PostUpdate() + { + #region Managing time control + if (Main.netMode != NetmodeID.Server && Player == Main.LocalPlayer) + { + var power = CreativePowerManager.Instance.GetPower(); + double dayrate = CreativePowerManager.Instance.GetPower().TargetTimeRate; + if (CurrentFrameFlags.SleepingPlayersCount == CurrentFrameFlags.ActivePlayersCount && CurrentFrameFlags.SleepingPlayersCount > 0) + dayrate *= 5; + if (Main.IsFastForwardingTime()) + dayrate = 60; + double tileUpdate = 1; + double eventUpdate = 1; + SystemLoader.ModifyTimeRate(ref dayrate, ref tileUpdate, ref eventUpdate); + if (WeakTimeFreezeInUse) + { + if (!power.Enabled) + WeakTimeFreezeInUse = false; + else + { + if (WeakTimeFreezeUseTimer >= Bakidon.FreezeTime / Bakidon.RechargeMultiplier || Main.bloodMoon || Main.eclipse || Main.pumpkinMoon || Main.snowMoon) + { + + NetPacket packet = NetCreativePowersModule.PreparePacket(power.PowerId, 1); + packet.Writer.Write(false); + NetManager.Instance.SendToServerOrLoopback(packet); + WeakTimeFreezeInUse = false; + } + WeakTimeFreezeUseTimer += 1 * (float)dayrate; + } + } + else + { + if (WeakTimeFreezeUseTimer > 0) + WeakTimeFreezeUseTimer -= 1 * (float)dayrate; + else + WeakTimeFreezeUseTimer = 0; + } + } + #endregion + } public override void PostUpdateRunSpeeds() { #region SpeedBoosts if (!Player.mount.Active) { float runAccMult = 1f + - (lunicCorpsLegs ? 0.1f : 0f) + - (shadowSpeed ? 0.5f : 0f) + + (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + (laudanum && Player.HasBuff(BuffID.VortexDebuff) ? 0.15f : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? YanmeisKnife.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + - (silvaSet ? 0.05f : 0f) + + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + (getSandCloakAccelBoost ? 0.75f : 0f) + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + (ascendantInsignia ? 0.25f : 0f ) + // Added to Soaring Insignia's 1.25x multiplier to get 1.5x @@ -4475,16 +4581,16 @@ namespace CalamityMod.CalPlayer (hasteLevel * 0.05f); float runSpeedMult = 1f + - (lunicCorpsLegs ? 0.1f : 0f) + - (shadowSpeed ? 0.5f : 0f) + + (victideBurrowHead ? VictideHeadBurrow.MoveSpeedAccelerationBoost : 0f) + + (lunicCorpsLegs ? LunicCorpsBoots.MoveSpeedAccelerationBoost : 0f) + + (shadowSpeed ? DemonshadeGreaves.AccelerationBoost : 0f) + (stressPills ? 0.05f : 0f) + ((abyssalDivingSuit && Player.IsUnderwater()) ? 0.05f : 0f) + (aquaticHeartWaterBuff ? AquaticHeart.WaterSpeedBoost : 0f) + ((frostFlare && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 0.15f : 0f) + (dragonScales ? 0.1f : 0f) + - (kamiBoost ? YanmeisKnife.RunSpeedBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + - (silvaSet ? 0.05f : 0f) + + (silvaSet ? SilvaArmor.AccelerationBoost : 0f) + (nimbleBounderBoost ? NimbleBounder.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + //(exaltedKillMode ? 0.4f : devilsDevastationKillMode ? 0.7f : 0) + @@ -4506,6 +4612,12 @@ namespace CalamityMod.CalPlayer else momentumCapacitorBoost = 0f; + if (victideBarrierHead) + { + Player.runAcceleration *= VictideHeadBarrier.RunAccelerationMult; + Player.runSlowdown *= VictideHeadBarrier.RunAccelerationMult; + } + Player.runAcceleration *= runAccMult; Player.maxRunSpeed *= runSpeedMult; } @@ -4530,7 +4642,7 @@ namespace CalamityMod.CalPlayer ModDashMovement(); } #endregion - + Player.oldVelocity = Player.velocity; // Apparently this value is not updated on its own, so we do it } #endregion @@ -4584,20 +4696,11 @@ namespace CalamityMod.CalPlayer if (moscowMule) knockback += MoscowMule.KnockbackBoost; - if (titanHeartMask && rogue) - knockback += 0.05f; - if (titanHeartMantle && rogue) - knockback += 0.05f; - - if (titanHeartBoots && rogue) - knockback += 0.05f; - - if (titanHeartSet && rogue) - knockback += 0.2f; + knockback += TitanHeartMantle.RogueKnockbackBoost; if (titanHeartSet && StealthStrikeAvailable() && rogue) - knockback += 1f; + knockback *= TitanHeartMask.StealthStrikeKnockbackMult; } #endregion @@ -4611,7 +4714,7 @@ namespace CalamityMod.CalPlayer #region Modify Mana Cost public override void ModifyManaCost(Item item, ref float reduce, ref float mult) { - if (MagicGunIDList.Includes(item.type) && meteorSet) + if (CalamityItemSets.MagicGun[item.type] && meteorSet) { mult *= 0.33f; } @@ -4773,10 +4876,10 @@ namespace CalamityMod.CalPlayer if (veneratedLocket) { - var LocketSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + var LocketSource = Player.GetSource_Accessory(FindAccessory(ItemType())); if (item.CountsAsClass()) { - if (!VeneratedLocketBanList.Includes(item.type)) + if (!CalamityItemSets.DisablesVeneratedLocketEffect[item.type]) { float veneratedCloneSpeed = item.shootSpeed; Vector2 realPlayerPos = Player.RotatedRelativePoint(Player.MountedCenter, true); @@ -4856,21 +4959,6 @@ namespace CalamityMod.CalPlayer } } } - - if (RustyMedallionDroplets && RustyMedallionCooldown <= 0) - { - if (item.CountsAsClass()) - { - var MedallionSource = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - int d = (int)Player.GetTotalDamage().ApplyTo(RustyMedallion.AcidDropBaseDamage); - - Vector2 mouse = Player.ClampedMouseWorld(); - Vector2 startingPosition = mouse - Vector2.UnitY.RotatedByRandom(0.3f) * 1250f; - Vector2 directionToMouse = (mouse - startingPosition).SafeNormalize(Vector2.UnitX); - Projectile.NewProjectile(MedallionSource, startingPosition, directionToMouse * 15f, ProjectileType(), d, 0f, Player.whoAmI, 3); - RustyMedallionCooldown = RustyMedallion.AcidCreationCooldown; - } - } return true; } #endregion @@ -4883,59 +4971,26 @@ namespace CalamityMod.CalPlayer if (Player.isDisplayDollOrInanimate) { // Body - if (Player.armor[1].type == ModContent.ItemType()) + if (Player.armor[1].type == ItemType()) Player.body = EquipLoader.GetEquipSlot(Mod, "AuricTeslaBodyArmor", EquipType.Body); - else if (Player.armor[1].type == ModContent.ItemType()) + else if (Player.armor[1].type == ItemType()) Player.body = EquipLoader.GetEquipSlot(Mod, "DaedalusBreastplate", EquipType.Body); - else if (Player.armor[1].type == ModContent.ItemType()) + else if (Player.armor[1].type == ItemType()) Player.body = EquipLoader.GetEquipSlot(Mod, "EmpyreanCloak", EquipType.Body); - else if (Player.armor[1].type == ModContent.ItemType()) + else if (Player.armor[1].type == ItemType()) Player.body = EquipLoader.GetEquipSlot(Mod, "SnowRuffianChestplate", EquipType.Body); - else if (Player.armor[1].type == ModContent.ItemType()) + else if (Player.armor[1].type == ItemType()) Player.body = EquipLoader.GetEquipSlot(Mod, "VictideBreastplate", EquipType.Body); // Legs - if (Player.armor[2].type == ModContent.ItemType()) + if (Player.armor[2].type == ItemType()) Player.legs = EquipLoader.GetEquipSlot(Mod, "VictideGreaves", EquipType.Legs); // Set Bonus - if (Player.armor[0].type == ModContent.ItemType() - && Player.armor[1].type == ModContent.ItemType() - && Player.armor[2].type == ModContent.ItemType()) + if (Player.armor[0].type == ItemType() + && Player.armor[1].type == ItemType() + && Player.armor[2].type == ItemType()) snowRuffianSet = true; - - // Accessories - for (int i = 3; i < 8; i++) - { - Item vanity = Player.armor[i]; - - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().transformationActive = true; - if (vanity.type == ModContent.ItemType()) - abyssalDivingSuitForce = true; - if (vanity.type == ModContent.ItemType()) - aquaticHeartForce = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - if (vanity.type == ModContent.ItemType()) - ghostBracelet = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - if (vanity.type == ModContent.ItemType()) - snowmanForce = true; - if (vanity.type == ModContent.ItemType()) - profanedCrystalForce = true; - if (vanity.type == ModContent.ItemType()) - punchCard = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - if (vanity.type == ModContent.ItemType()) - Player.GetModPlayer().vanityEquipped = true; - } } if (Player.Calamity().andromedaState == AndromedaPlayerState.LargeRobot || @@ -4943,58 +4998,8 @@ namespace CalamityMod.CalPlayer { Player.head = EquipLoader.GetEquipSlot(Mod, "HeadlessEquipTexture", EquipType.Head); // To make the head invisible on the map. The map was having a hissy fit because of hitbox changes. } - else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightLegs", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightHead", EquipType.Head); - Player.wings = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightWings", EquipType.Wings); - Player.face = -1; - - bool enrage = pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged; - - if (profanedCrystalWingCounter.Value == 0) - { - int key = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 8); - } - - Player.wingFrame = profanedCrystalWingCounter.Key; - profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); - Player.armorEffectDrawOutlines = true; - if (profanedCrystalBuffs) - { - Player.armorEffectDrawShadow = true; - if (enrage) - { - Player.armorEffectDrawOutlinesForbidden = true; - } - } - } - else if ((snowmanPower || snowmanForce) && !snowmanHide) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); - Player.face = -1; - } else if (AresExoskeleton.ArmExists(Player)) Player.body = EquipLoader.GetEquipSlot(Mod, "AresExoskeleton", EquipType.Body); - - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head); - Player.face = -1; - } - else if ((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head); - Player.face = -1; - } else if (meldTransformationPower || meldTransformationForce) { Player.legs = EquipLoader.GetEquipSlot(Mod, "MeldTransformation", EquipType.Legs); @@ -5009,26 +5014,7 @@ namespace CalamityMod.CalPlayer if (hasOmegaBlueCooldown && cd.timeLeft > 1500) Player.head = EquipLoader.GetEquipSlot(Mod, "OmegaBlueTransformation", EquipType.Head); } - else - { - if (profanedCrystalWingCounter.Key != 1) - profanedCrystalWingCounter = new KeyValuePair(1, 7); - if (profanedCrystalAnimCounter.Key != 0) - profanedCrystalAnimCounter = new KeyValuePair(0, 10); - } - if (ghostBracelet) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); - } - if (punchCard) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head); - } if (snowRuffianSet) { @@ -5038,7 +5024,7 @@ namespace CalamityMod.CalPlayer { if (!Player.mount.Active) { - Player.velocity.Y *= 0.9f; + Player.velocity.Y *= SnowRuffianMask.GlideFallSpeedMult; Player.wingFrame = 3; } Player.noFallDmg = true; @@ -5320,13 +5306,13 @@ namespace CalamityMod.CalPlayer public override void PostNurseHeal(NPC nurse, int health, bool removeDebuffs, int price) { // Remove excess alcohol - if (removeDebuffs && alcoholPoisonLevel > (cirrusDress ? 5 : 3)) + if (removeDebuffs && alcoholPoisonLevel > 3) { List Alcohol = new List(); for (int i = 0; i < Player.MaxBuffs; i++) { int buff = Player.buffType[i]; - if (AlcoholsDict.TryGet(buff, out int level)) + if (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level)) Alcohol.Insert(0, new int[] { i, level }); } @@ -5339,7 +5325,7 @@ namespace CalamityMod.CalPlayer poison -= relation[1]; // Cancel the poison level Alcohol.RemoveAt(0); } - while (poison > (cirrusDress ? 5 : 3)); + while (poison > 3); } } #endregion @@ -5358,7 +5344,7 @@ namespace CalamityMod.CalPlayer stealthStrikeThisFrame = false; stealthStrikeHalfCost = false; stealthStrike75Cost = false; - stealthStrike85Cost = false; + stealthStrike90Cost = false; // stealthAcceleration only resets if you don't have either of the accelerator accessories equipped if (!darkGodSheath && !eclipseMirror) @@ -5412,16 +5398,16 @@ namespace CalamityMod.CalPlayer bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; - // The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items. - if ((it.IsAir || !it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) + // The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items. Forbidden Circlet does this for summon weapons + if ((it.IsAir || (!it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) || (it.CountsAsClass() && forbiddenCirclet)) playerUsingWeapon = false; // Molten Amputator consumes stealth in a special way - if (it.type == ModContent.ItemType()) + if (it.type == ItemType()) playerUsingWeapon = false; // Shock Grenade consumes stealth in a special way - if (it.type == ModContent.ItemType()) + if (it.type == ItemType()) playerUsingWeapon = false; // Animation check depends on whether the item is "clockwork", like Clockwork Assault Rifle. @@ -5553,8 +5539,8 @@ namespace CalamityMod.CalPlayer consumptionMult = 0.5f; else if (stealthStrike75Cost) consumptionMult = 0.75f; - else if (stealthStrike85Cost) - consumptionMult = 0.85f; + else if (stealthStrike90Cost) + consumptionMult = 0.9f; return rogueStealth >= rogueStealthMax * consumptionMult; } @@ -5581,7 +5567,7 @@ namespace CalamityMod.CalPlayer if (rogueStealth <= 0f) rogueStealth = 0f; } - else if (stealthStrike85Cost) + else if (stealthStrike90Cost) { rogueStealth -= 0.9f * stealthToLose; if (rogueStealth <= 0f) @@ -5626,60 +5612,6 @@ namespace CalamityMod.CalPlayer } } - private bool IsValidTransitionFrame(AnimationType currentAnim, AnimationType newAnim, int frame, int counter) //this exists so it doesn't loop through the entire walk/idle anim just to find one frame for switching. - { - bool result = newAnim != AnimationType.Jump && currentAnim != AnimationType.Jump; - if (currentAnim == AnimationType.Walk && newAnim == AnimationType.Idle) - { - result = counter <= 0 && (frame == 11 || frame == 15 || frame == 19); - } - else if (currentAnim == AnimationType.Idle && newAnim == AnimationType.Walk) - { - result = counter <= 0 && (frame == 2 || frame == 6); - } - return currentAnim != newAnim && result; //swapping to jumps should be instant, no need to check the counter here - } - - private int HandlePSCAnimationFrames(AnimationType newType) - { - int key = profanedCrystalAnimCounter.Key; //0-based indexing - int value = profanedCrystalAnimCounter.Value - 1; - AnimationType currentType = key < 8 ? AnimationType.Idle : key == 8 ? AnimationType.Jump : AnimationType.Walk; - - bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother - AnimationType type = isInvalidTransFrame ? newType : currentType; - int frameCount = type == AnimationType.Walk || (!profanedCrystalForce && Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) ? 7 : 10; - int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9; - int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22; - if (value <= 0 || !isInvalidTransFrame) - { - value = frameCount; - if (key >= lowerRange && key < upperRange) - key++; - else - key = lowerRange; - } - profanedCrystalAnimCounter = new KeyValuePair(key, value); - return profanedCrystalAnimCounter.Key; - } - - public override void PostUpdate() //needs to be here else it doesn't work properly, otherwise i'd have stuck it with the wing anim stuffs - { - bool validEquipSlot = Player.legs == EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Legs) || - Player.legs == EquipLoader.GetEquipSlot(Mod, "PscNightLegs", EquipType.Legs); - if (!profanedCrystalHide && (profanedCrystal || profanedCrystalForce) && validEquipSlot) - { - bool usingCarpet = Player.carpetTime > 0 && Player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground - AnimationType animType = AnimationType.Walk; - if ((Player.sliding || Player.velocity.Y != 0 || Player.mount.Active || (Player.grappling[0] != -1 || !Player.CheckSolidGround()) || Player.GoingDownWithGrapple) && !usingCarpet) - animType = AnimationType.Jump; - else if (Player.velocity.X == 0 || usingCarpet) - animType = AnimationType.Idle; - int frame = HandlePSCAnimationFrames(animType); - Player.legFrame.Y = Player.legFrame.Height * frame; - } - } - #endregion #region Misc Stuff @@ -5768,5 +5700,29 @@ namespace CalamityMod.CalPlayer } } #endregion + + #region Controls + // These are used to entirely disable player directional inputs while being able to read them for other features + public bool ShouldHideControls = false; + public bool pressedRight = false; + public bool pressedLeft = false; + public bool pressedUp = false; + public bool pressedDown = false; + public override void SetControls() + { + pressedRight = Player.controlRight; + pressedLeft = Player.controlLeft; + pressedUp = Player.controlUp; + pressedDown = Player.controlDown; + if (ShouldHideControls) + { + Player.controlLeft = false; + Player.controlUp = false; + Player.controlDown = false; + Player.controlRight = false; + } + ShouldHideControls = false; + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerDashEffects.cs b/CalPlayer/CalamityPlayerDashEffects.cs index 426cf2c311..03d45ac712 100644 --- a/CalPlayer/CalamityPlayerDashEffects.cs +++ b/CalPlayer/CalamityPlayerDashEffects.cs @@ -66,6 +66,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + if ((HasCustomDash && Player.dashDelay < 0 && UsedDash.dashTime < UsedDash.dashStartup)) + { + UsedDash.DashStartupEffects(Player); + UsedDash.dashTime++; + return; + } else if (HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime == UsedDash.dashStartup ) + { + if (DoADash(UsedDash.CalculateDashSpeed(Player),true)) + UsedDash.OnDashEffects(Player); + } + var source = new ProjectileSource_PlayerDashHit(Player); // Handle collision slam-through effects. @@ -102,6 +113,7 @@ namespace CalamityMod.CalPlayer } } } + UsedDash.dashTime++; } if (Player.dashDelay > 0) @@ -187,7 +199,8 @@ namespace CalamityMod.CalPlayer } // Dash delay depends on the type of dash used. - Player.dashDelay = dashDelayToApply; + if (!(HasCustomDash && UsedDash.dashStartup > 0 && Player.dashDelay < 0 && UsedDash.dashTime <= UsedDash.dashStartup+10)) + Player.dashDelay = dashDelayToApply; if (UsedDash.IsOmnidirectional) { @@ -223,12 +236,16 @@ namespace CalamityMod.CalPlayer // Handle first-frame effects. else if (HasCustomDash && !Player.mount.Active) { + UsedDash.dashTime = 0; if (DoADash(UsedDash.CalculateDashSpeed(Player))) - UsedDash.OnDashEffects(Player); + if (UsedDash.dashStartup <= 0) + UsedDash.OnDashEffects(Player); + else + UsedDash.OnDashStartupEffects(Player); } } - public bool HandleHorizontalDash(out DashDirection direction) + public bool HandleHorizontalDash(out DashDirection direction, bool forceDash = false) { direction = DashDirection.Directionless; bool dashWasExecuted = false; @@ -236,7 +253,7 @@ namespace CalamityMod.CalPlayer // If the manual hotkey is bound, standard Terraria dashes cannot be triggered by double tapping. var manualDashHotkeys = CalamityKeybinds.DashHotkey.GetAssignedKeys(); bool manualHotkeyBound = (manualDashHotkeys?.Count ?? 0) > 0; - bool pressedManualHotkey = manualHotkeyBound && CalamityKeybinds.DashHotkey.JustPressed; + bool pressedManualHotkey = manualHotkeyBound && (CalamityKeybinds.DashHotkey.JustPressed || forceDash); int dashDirectionToUse = 0; @@ -418,9 +435,9 @@ namespace CalamityMod.CalPlayer return justDashed; } - public bool DoADash(float dashSpeed) + public bool DoADash(float dashSpeed, bool forceDash = false) { - bool justDashed; + bool justDashed = forceDash; bool omnidirectionalDash = UsedDash?.IsOmnidirectional ?? false; DashDirection direction; @@ -434,7 +451,14 @@ namespace CalamityMod.CalPlayer else if (omnidirectionalDash) justDashed = HandleOmnidirectionalDash(out direction); else - justDashed = HandleHorizontalDash(out direction); + justDashed = HandleHorizontalDash(out direction, forceDash); + + if (justDashed && !forceDash && UsedDash.dashStartup > 0) + { + Player.timeSinceLastDashStarted = 0; + Player.dashDelay = -1; + return justDashed; + } // Make dash movements happen if ready. if (justDashed) @@ -506,21 +530,6 @@ namespace CalamityMod.CalPlayer public void ModHorizontalMovement() { - if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.DashSpeed - Player.mount.RunSpeed / 2f) - { - Rectangle damageHitbox = Player.getRect(); - - if (Player.direction == 1) - damageHitbox.Offset(Player.width - 1, 0); - - damageHitbox.Width = 2; - damageHitbox.Inflate(6, 12); - float damage = Player.GetTotalDamage().ApplyTo(800f); - float knockback = 10f; - int NPCImmuneTime = 30; - int playerImmuneTime = 6; - DoMountDashDamage(damageHitbox, damage, knockback, NPCImmuneTime, playerImmuneTime); - } if (Player.mount.Active && Player.mount.Type == ModContent.MountType() && Math.Abs(Player.velocity.X) > Player.mount.RunSpeed) { diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index b5470a17e4..3088a7dd21 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -8,6 +8,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems.Collections; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -35,7 +36,14 @@ namespace CalamityMod.CalPlayer PlayerDrawLayers.Shoes.Hide(); } - if (drawInfo.drawPlayer.Calamity().andromedaState != AndromedaPlayerState.Inactive) + if (drawInfo.drawPlayer.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + foreach (var layer in PlayerDrawLayerLoader.Layers) + { + layer.Hide(); + } + } + else if (drawInfo.drawPlayer.Calamity().andromedaState != AndromedaPlayerState.Inactive) { foreach (var layer in PlayerDrawLayerLoader.Layers) { @@ -110,6 +118,24 @@ namespace CalamityMod.CalPlayer else // This is such a stupid way to reset this but you can't just put it in ResetEffects { calamityPlayer.trippyLevel = 1; + + // Mana Burn VFX disabled when hih + if (Player.statMana < 0) + { + float compactness = Player.width * 0.6f; + if (compactness < 10f) + compactness = 10f; + float power = Player.height / 100f; + if (power > 2.75f) + power = 2.75f; + var color = Color.Blue; + if (ManaBurnFireDrawer is null || ManaBurnFireDrawer.LocalTimer >= ManaBurnFireDrawer.SetLifetime) + ManaBurnFireDrawer = new FireParticleSet(60 - (Player.statMana / 4), 1, color * 1.25f, color, compactness, power); + else + ManaBurnFireDrawer.DrawSet(Player.Bottom - Vector2.UnitY * (12f - Player.gfxOffY)); + } + else + ManaBurnFireDrawer = null; } // TODO -- rogue stealth visuals are an utter catastrophe and should be fully destroyed on next stealth rework @@ -199,10 +225,10 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.auricRebuke && drawInfo.shadow == 0f) AuricRebuke.DrawEffects(drawInfo); - if (calamityPlayer.bBlood && drawInfo.shadow == 0f) + if (calamityPlayer.burningBlood && drawInfo.shadow == 0f) BurningBlood.DrawEffects(drawInfo); - if (calamityPlayer.bFlames && drawInfo.shadow == 0f) + if (calamityPlayer.brimstoneFlames && drawInfo.shadow == 0f) { bool resistsBrimstoneFlames = abaddon; // Looks weaker if you have Abaddon equipped BrimstoneFlames.DrawEffects(drawInfo, resistsBrimstoneFlames); @@ -211,12 +237,11 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.brainRot && drawInfo.shadow == 0f) BrainRot.DrawEffects(drawInfo); - if (calamityPlayer.cDepth && drawInfo.shadow == 0f) + if (calamityPlayer.crushDepth && drawInfo.shadow == 0f) CrushDepth.DrawEffects(drawInfo); - // Daybroken's visual effects are reduced if the player resists it if (calamityPlayer.daybroken && drawInfo.shadow == 0f) - Daybroken.DrawEffects(drawInfo, reducedDaybrokenDamage); + Daybroken.DrawEffects(drawInfo); if (calamityPlayer.demonicFlames && drawInfo.shadow == 0f) DemonicFlames.DrawEffects(drawInfo); @@ -230,26 +255,17 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.eutrophication && drawInfo.shadow == 0f) Eutrophication.DrawEffects(drawInfo); - if (calamityPlayer.gState && drawInfo.shadow == 0f) - { - // These lines cannot be moved to Glacial State's own file - r *= 0.13f; - g *= 0.66f; - - GlacialState.DrawEffects(drawInfo); - } - - if (calamityPlayer.gsInferno && drawInfo.shadow == 0f) + if (calamityPlayer.godSlayerInferno && drawInfo.shadow == 0f) GodSlayerInferno.DrawEffects(drawInfo); if (calamityPlayer.heavybleeding && drawInfo.shadow == 0f) HeavyBleeding.DrawEffects(drawInfo); // Holy Flames, Holy Inferno and Banishing Fire share the same visual effects - if (drawInfo.shadow == 0f && (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire)) + if (drawInfo.shadow == 0f && (calamityPlayer.holyFlames || calamityPlayer.holyInferno || calamityPlayer.banishingFire)) HolyFlames.DrawEffects(drawInfo); - if (calamityPlayer.hPressure && drawInfo.shadow == 0f) + if (calamityPlayer.hadopelagicPressure && drawInfo.shadow == 0f) HadopelagicPressure.DrawEffects(drawInfo); // Icarus' Folly has visual effects but they are mutually exclusive with all Holy Flames variations to prevent visual clutter @@ -266,13 +282,13 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.mushy && drawInfo.shadow == 0f) Mushy.DrawEffects(drawInfo); - if (calamityPlayer.nightwither && drawInfo.shadow == 0f) // Looks weaker if you have Moon Stone equipped - Nightwither.DrawEffects(drawInfo, reducedNightwitherDamage); + if (calamityPlayer.nightwither && drawInfo.shadow == 0f) + Nightwither.DrawEffects(drawInfo); - if (calamityPlayer.pFlames && drawInfo.shadow == 0f) + if (calamityPlayer.plague && drawInfo.shadow == 0f) Plague.DrawEffects(drawInfo); - if (calamityPlayer.rTide && drawInfo.shadow == 0f) + if (calamityPlayer.riptide && drawInfo.shadow == 0f) RiptideDebuff.DrawEffects(drawInfo); if (calamityPlayer.shadowflame && drawInfo.shadow == 0f) @@ -328,7 +344,7 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(Plus); } } - if (calamityPlayer.bloomStoneDR > 0 && drawInfo.shadow == 0f) + if (calamityPlayer.bloomStoneBuffedHealRateTimer > 0 && drawInfo.shadow == 0f) { if (Main.rand.NextBool(10)) { @@ -451,52 +467,6 @@ namespace CalamityMod.CalPlayer Player drawPlayer = drawInfo.drawPlayer; Item item = drawPlayer.ActiveItem(); - // Vanity accessory effects, allows them to draw while the game is paused - if (drawPlayer.Calamity().ghostBracelet) - { - drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Legs); - drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Body); - drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GhostBracelet", EquipType.Head); - } - else if ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) - { - drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Legs); - drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "Popo", EquipType.Body); - drawPlayer.head = EquipLoader.GetEquipSlot(Mod, snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); - drawPlayer.face = -1; - } - else if (drawPlayer.Calamity().punchCard) - { - drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Legs); - drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Body); - drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "PunchCard", EquipType.Head); - } - else if ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) - { - drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Legs); - drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Body); - drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AbyssalDivingSuit", EquipType.Head); - drawPlayer.face = -1; - } - else if ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide) - { - drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Legs); - drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Body); - drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "AquaticHeart", EquipType.Head); - drawPlayer.face = -1; - } - // Need to set all of these so that certain vanity pieces like Capricorn Tail don't screw it up - if (drawPlayer.Calamity().ghostBracelet || ((drawPlayer.Calamity().snowmanPower || drawPlayer.Calamity().snowmanForce) && !drawPlayer.Calamity().snowmanHide) || - drawPlayer.Calamity().punchCard || ((drawPlayer.Calamity().abyssalDivingSuitPower || drawPlayer.Calamity().abyssalDivingSuitForce) && !drawPlayer.Calamity().abyssalDivingSuitHide) || - ((drawPlayer.Calamity().aquaticHeartPower || drawPlayer.Calamity().aquaticHeartForce) && !drawPlayer.Calamity().aquaticHeartHide)) - { - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.bodyGlowMask = -1; - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - if (!drawPlayer.frozen && (item.IsAir || item.type > ItemID.None) && !drawPlayer.dead && diff --git a/CalPlayer/CalamityPlayerFishing.cs b/CalPlayer/CalamityPlayerFishing.cs index c965b451ff..4f0c2b0d76 100644 --- a/CalPlayer/CalamityPlayerFishing.cs +++ b/CalPlayer/CalamityPlayerFishing.cs @@ -10,6 +10,7 @@ using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Fishing.FishingRods; using CalamityMod.Items.Fishing.SulphurCatches; using CalamityMod.Items.Fishing.SunkenSeaCatches; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.SummonItems; using CalamityMod.Items.Weapons.Melee; @@ -169,6 +170,22 @@ namespace CalamityMod.CalPlayer if (canSulphurFish && bait == ModContent.ItemType() && !BossRushEvent.BossRushActive) { CalamityGlobalNPC.OldDukeSpawn(Player.whoAmI, ModContent.NPCType(), bait); + itemDrop = -1; + return; + } + + if (attempt.playerFishingConditions.PoleItemType == ModContent.ItemType()) + { + if (Main.rand.NextBool(5)) + { + itemDrop = ModContent.ItemType(); + return; + } + if (Main.rand.NextBool(15)) + { + itemDrop = ModContent.ItemType(); + return; + } } // Ignore catches if it's junk @@ -370,7 +387,7 @@ namespace CalamityMod.CalPlayer if (ZoneAbyss || ZoneSulphur) canSulphurFish = true; - Item item = Player.ActiveItem(); + Item item = Player.HeldItem; if (!canSulphurFish || item.fishingPole <= 0 || item.holdStyle != 1) fishingLevel = -1; @@ -413,6 +430,8 @@ namespace CalamityMod.CalPlayer if (fishList.Contains(fish.type)) fish.stack += Main.rand.Next(1, 3 + 1); } + if (fish.type == ModContent.ItemType()) + fish.stack = Main.rand.Next(1, 6); } #endregion } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 58ec5db97c..c2693cb4c4 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -14,9 +14,18 @@ using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Aerospec; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.Daedalus; using CalamityMod.Items.Armor.Demonshade; +using CalamityMod.Items.Armor.Empyrean; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Hydrothermic; using CalamityMod.Items.Armor.LunicCorps; +using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.Sulphurous; +using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Mounts; using CalamityMod.Items.Placeables.Furniture; @@ -31,6 +40,7 @@ using CalamityMod.NPCs.Other; using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -76,7 +86,7 @@ namespace CalamityMod.CalPlayer sVeilDust2.noLight = false; } - SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); + SoundEngine.PlaySound(SilvaArmor.DispelSound, Player.Center); NetMessage.SendData(MessageID.Dodge, -1, -1, null, Player.whoAmI, 1f, 0f, 0f, 0, 0, 0); } @@ -155,7 +165,7 @@ namespace CalamityMod.CalPlayer Player.GiveUniversalIFrames(abyssalMirrorDodgeIFrames, true); rogueStealth += 0.5f; - SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); + SoundEngine.PlaySound(SilvaArmor.ActivationSound, Player.Center); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int i = 0; i < 10; i++) @@ -244,7 +254,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), Main.zenithWorld ? Main.rand.Next(5000, 50000 + 1) : 0, 0, Player.whoAmI); } - if (hInferno) + if (holyInferno) { foreach (NPC n in Main.ActiveNPCs) { @@ -292,10 +302,10 @@ namespace CalamityMod.CalPlayer if (silvaSet && silvaCountdown > 0) { - if (silvaCountdown == silvaReviveDuration && !hasSilvaEffect) + if (silvaCountdown == SilvaArmor.ReviveDuration && !hasSilvaEffect) { - SoundEngine.PlaySound(SilvaHeadSummon.ActivationSound, Player.Center); - Player.AddBuff(ModContent.BuffType(), silvaReviveDuration); + SoundEngine.PlaySound(SilvaArmor.ActivationSound, Player.Center); + Player.AddBuff(ModContent.BuffType(), SilvaArmor.ReviveDuration); } hasSilvaEffect = true; @@ -332,6 +342,8 @@ namespace CalamityMod.CalPlayer Player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(3f)); Player.statLife = Player.statLifeMax2 * 3 / 10; + if (Player.statMana < 0) + Player.statMana = 0; SoundEngine.PlaySound(SoundID.Item92, Player.Center); @@ -377,7 +389,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SearingLava" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } - if (gsInferno) + if (godSlayerInferno) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.GodSlayerInferno" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } @@ -408,11 +420,11 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.MiracleBlight" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } - if (hInferno) + if (holyInferno) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyInferno").ToNetworkText(Player.name)); } - if (hFlames || banishingFire) + if (holyFlames || banishingFire) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HolyFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } @@ -424,7 +436,7 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Daybroken").ToNetworkText(Player.name)); } - if (bBlood) + if (burningBlood) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BurningBlood" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } @@ -444,23 +456,23 @@ namespace CalamityMod.CalPlayer { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ElementalMix" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } - if (cDepth) + if (crushDepth) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CrushDepth" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } - if (rTide) + if (riptide) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Riptide" + Main.rand.Next(1, 2 + 1)).ToNetworkText(Player.name)); } - if (hPressure) + if (hadopelagicPressure) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.HadopelagicPressure" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } - if (bFlames || weakBrimstoneFlames || demonicFlames) + if (brimstoneFlames || weakBrimstoneFlames || demonicFlames) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.BrimstoneFlames" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } - if (pFlames) + if (plague) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Plague" + Main.rand.Next(1, 3 + 1)).ToNetworkText(Player.name)); } @@ -485,7 +497,7 @@ namespace CalamityMod.CalPlayer damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.Withered").ToNetworkText(Player.name)); } } - if (profanedCrystalBuffs && !profanedCrystalHide) + if (profanedCrystalBuffs && Player.Transformation().Type == ModContent.ItemType()) { damageSource = PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.ProfanedSoulCrystal").ToNetworkText(Player.name)); } @@ -534,7 +546,10 @@ namespace CalamityMod.CalPlayer // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + modifiers.ModifyHitInfo += YellowCandleBuff.ModifyHitInfo_Spite; + + if (Player.Calamity().scionsCurio && item.CountsAsClass()) + target.Calamity().scionsCurioEffected = true; // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) @@ -618,7 +633,7 @@ namespace CalamityMod.CalPlayer // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + modifiers.ModifyHitInfo += YellowCandleBuff.ModifyHitInfo_Spite; // Stealth strike damage multipliers are applied here. // TODO -- stealth should be its own damage class and this should be applied as player StealthDamage *= XYZ @@ -632,10 +647,8 @@ namespace CalamityMod.CalPlayer modifiers.ScalingBonusDamage += Screwdriver.PiercingDamageBuff; } - // Calamity buffs Inferno Fork by 20%. This is multiplicative because it's supposed to be a buff to the weapon's base damage. - // However, because the weapon is coded like spaghetti, you have to multiply the explosion's damage too. - if (proj.type == ProjectileID.InfernoFriendlyBlast) - modifiers.SourceDamage *= 1.2f; + if (Player.Calamity().scionsCurio && proj.CountsAsClass()) + target.Calamity().scionsCurioEffected = true; // Frost Armor's rework gives +X% melee damage and +Y% ranged damage based on distance, where X+Y = 15. if (frostSet) @@ -702,7 +715,7 @@ namespace CalamityMod.CalPlayer { Item heldItem = Player.ActiveItem(); - if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !DisabledSummonerNerfMinionList.Includes(proj.type)) + if (CalamityUtils.ShouldTriggerSummonPenalty(Player, heldItem) && !CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[proj.type]) modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; } } @@ -717,7 +730,7 @@ namespace CalamityMod.CalPlayer // Enemies deal less contact damage while sick, due to being weakened. if (npc.poisoned) { - float damageReductionFromPoison = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromPoison = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -732,7 +745,7 @@ namespace CalamityMod.CalPlayer if (npc.venom) { - float damageReductionFromVenom = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromVenom = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -745,9 +758,9 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= damageReductionFromVenom; } - if (npc.Calamity().astralInfection > 0) + if (npc.Calamity().astralInfection) { - float damageReductionFromAstralInfection = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromAstralInfection = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -760,9 +773,9 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= damageReductionFromAstralInfection; } - if (npc.Calamity().pFlames > 0) + if (npc.Calamity().plague) { - float damageReductionFromPlague = npc.Calamity().irradiated > 0 ? 0.075f : 0.05f; + float damageReductionFromPlague = (float)((npc.Calamity().irradiated? npc.Calamity().irradiatedContactBoost : 1) * 0.05f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -775,9 +788,9 @@ namespace CalamityMod.CalPlayer modifiers.SourceDamage *= damageReductionFromPlague; } - if (npc.Calamity().wDeath > 0) + if (npc.Calamity().whisperingDeath) { - float damageReductionFromWhisperingDeath = npc.Calamity().irradiated > 0 ? 0.15f : 0.1f; + float damageReductionFromWhisperingDeath = (float)((npc.Calamity().irradiated ? npc.Calamity().irradiatedContactBoost : 1) * 0.1f); if (npc.Calamity().VulnerableToSickness.HasValue) { if (npc.Calamity().VulnerableToSickness.Value) @@ -803,12 +816,12 @@ namespace CalamityMod.CalPlayer contactDamageReduction += 0.5; if (tarragonCloak && tarraMelee && !Player.HasCooldown(Cooldowns.TarragonCloak.ID)) - contactDamageReduction += Buffs.StatBuffs.TarragonCloak.ContactDamageReduction; + contactDamageReduction += TarragonHeadMelee.CloakContactDamageReduction; if (bloodflareMelee && bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) - contactDamageReduction += 0.5; + contactDamageReduction += BloodflareHeadMelee.FrenzyContactDamageReduction; - if (npc.Calamity().tSad > 0) + if (npc.Calamity().temporalSadness) contactDamageReduction += 0.5; if (eskimoSet) @@ -820,11 +833,6 @@ namespace CalamityMod.CalPlayer if (trinketOfChiBuff) contactDamageReduction += 0.08; - // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. - // To prevent abuse, this effect does not work if there are any bosses alive. - if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) - contactDamageReduction += 0.15; - if (abyssalDivingSuitPlates) contactDamageReduction += AbyssalDivingSuit.PlatesAllDamageReduction - abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay; @@ -873,13 +881,13 @@ namespace CalamityMod.CalPlayer // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (contactDamageReduction > 0D) { - if (aCrunch) + if (armorCrunch) contactDamageReduction *= (double)ArmorCrunch.MultiplicativeDamageReductionPlayer; if (crumble) contactDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer; // Contact damage reduction is reduced by DR Damage, which itself is proportional to defense damage - // In GFB, as defense damage is uncapped, DR damage is also uncapped. + // In FTW, as defense damage is uncapped, DR damage is also uncapped. int currentDefense = Player.GetCurrentDefense(false); if (totalDefenseDamage > 0 && currentDefense > 0) { @@ -912,7 +920,7 @@ namespace CalamityMod.CalPlayer #region Modify Hit By Proj public override void ModifyHitByProjectile(Projectile proj, ref Player.HurtModifiers modifiers) { - if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) + if (!CalamityProjectileSets.ShouldNotBeReflected[proj.type] && proj.active && !proj.friendly && proj.hostile && proj.damage > 0 && !modifiers.PvP) { double dodgeDamageGateValuePercent = 0.05; int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); @@ -952,6 +960,21 @@ namespace CalamityMod.CalPlayer return; } + else if (daedalusReflect) + { + proj.hostile = false; + proj.friendly = true; + proj.velocity *= -1f; + proj.penetrate = 1; + + // 17APR2024: Ozzatron: The Daedalus Reflect set bonus also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. + int daedalusReflectIFrames = Player.ComputeReflectIFrames(); + Player.GiveUniversalIFrames(daedalusReflectIFrames, true); + modifiers.Cancel(); + + int cooldownDuration = (int)MathHelper.Lerp(DaedalusHeadMelee.ReflectCooldownMin, DaedalusHeadMelee.ReflectCooldownMax, cooldownDurationScalar); + Player.AddCooldown(GlobalDodge.ID, cooldownDuration); + } } } @@ -981,30 +1004,23 @@ namespace CalamityMod.CalPlayer // Reduce damage from vanilla traps // Explosives - // 350 in normal, 450 in expert + // 350 damage if (proj.type == ProjectileID.Explosives) - modifiers.SourceDamage *= (Main.expertMode ? 0.225f : 0.35f); + modifiers.SourceDamage *= 0.7f; // Rolling Cacti - // 45 in normal, 65 in expert for cactus - // 30 in normal, 36 in expert for spikes + // 42 in normal, 84 in expert for cactus + // 36 in normal, 72 in expert for spikes else if (proj.type == ProjectileID.RollingCactus || proj.type == ProjectileID.RollingCactusSpike) - modifiers.SourceDamage *= (Main.expertMode ? 0.3f : 0.5f); + modifiers.SourceDamage *= 0.6f; - // Normal Boulders and Temple traps - if (Main.expertMode) + // Boulders + if (Main.expertMode && !areThereAnyDamnBosses) { - // 140 in normal, 182 in expert, 273 in master - if (proj.type == ProjectileID.Boulder || proj.type == ProjectileID.MiniBoulder) - modifiers.SourceDamage *= 0.65f; - - // 80 in normal, 100 in expert, 150 in master - else if (proj.type == ProjectileID.SpikyBallTrap || proj.type == ProjectileID.FlamethrowerTrap || proj.type == ProjectileID.FlamesTrap || proj.type == ProjectileID.PoisonDartTrap) - modifiers.SourceDamage *= 0.625f; - - // 120 in normal, 144 in expert, 216 in master - else if (proj.type == ProjectileID.SpearTrap) - modifiers.SourceDamage *= 0.6f; + // 140 in normal, 210 in expert, 315 in master for boulder + // 104 in normal, 156 in expert, 234 in master for mini boulder + if (proj.type == ProjectileID.Boulder || proj.type == ProjectileID.MiniBoulder || proj.type == ProjectileID.BouncyBoulder || proj.type == ProjectileID.LifeCrystalBoulder) + modifiers.SourceDamage *= 0.75f; } bool isFallingBlock = (proj.type == ProjectileID.SandBallFalling) || (proj.type == ProjectileID.SiltBall) || (proj.type == ProjectileID.AshBallFalling) || @@ -1021,7 +1037,7 @@ namespace CalamityMod.CalPlayer if (Player.Calamity().trapProtection && isReducedTrap) modifiers.SourceDamage *= 0.35f; - // Reduce damage dealt by rainbow trails depending on how faded they are. + // Reduce damage dealt by rainbow trails if (proj.type == ProjectileID.HallowBossLastingRainbow) { // Find the oldPos of the projectile that is intersecting the player hitbox. @@ -1036,11 +1052,10 @@ namespace CalamityMod.CalPlayer hitbox.X = (int)trailHitbox.X; hitbox.Y = (int)trailHitbox.Y; - // Adjust damage based on what part of the trail intersected the player hitbox. if (hitbox.Intersects(Player.Hitbox)) { if (k > startOfDamageFalloff) - modifiers.SourceDamage *= MathHelper.Lerp(0.4f, 1f, 1f - (k - startOfDamageFalloff) / (float)(trailLength - startOfDamageFalloff)); + modifiers.SourceDamage *= EmpressofLightAI.EverlastingRainbowTrailDamageMult; break; } @@ -1059,21 +1074,9 @@ namespace CalamityMod.CalPlayer projectileDamageReduction += 0.25; } - if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && proj.damage > 0) - { - // Daedalus Reflect counts as a reflect but doesn't actually stop you from taking damage - if (daedalusReflect && !disableAllDodges && !evolution && !Player.HasCooldown(GlobalDodge.ID)) - projectileDamageReduction += 0.5; - } - if (trinketOfChiBuff) projectileDamageReduction += 0.08; - // Fearmonger set provides 15% multiplicative DR that ignores caps during the Holiday Moons. - // To prevent abuse, this effect does not work if there are any bosses alive. - if (fearmongerSet && !areThereAnyDamnBosses && (Main.pumpkinMoon || Main.snowMoon)) - projectileDamageReduction += 0.15; - if (abyssalDivingSuitPlates) projectileDamageReduction += AbyssalDivingSuit.PlatesAllDamageReduction - abyssalDivingSuitPlateHits * AbyssalDivingSuit.PlatesHitDecay; @@ -1140,7 +1143,7 @@ namespace CalamityMod.CalPlayer // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (projectileDamageReduction > 0D) { - if (aCrunch) + if (armorCrunch) projectileDamageReduction *= (double)ArmorCrunch.MultiplicativeDamageReductionPlayer; if (crumble) projectileDamageReduction *= (double)Crumbling.MultiplicativeDamageReductionPlayer; @@ -1197,7 +1200,7 @@ namespace CalamityMod.CalPlayer Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 7; if (!npc.dontTakeDamage) { - int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(40); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(CrawCarapace.ThornsDamage); Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); } SoundEngine.PlaySound(SoundID.NPCHit33 with { Volume = 0.5f }, Player.Center); @@ -1222,7 +1225,7 @@ namespace CalamityMod.CalPlayer Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 15; if (!npc.dontTakeDamage) { - int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(250); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(Baroclaw.ThornsDamage); Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); npc.AddBuff(ModContent.BuffType(), 900); @@ -1257,8 +1260,8 @@ namespace CalamityMod.CalPlayer Vector2 pushVel = Utils.DirectionTo(Player.Center, npc.Center) * 22; if (!npc.dontTakeDamage) { - int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(350); - Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); + int onHitDamage = (int)Player.GetBestClassDamage().ApplyTo(TheAbsorber.ThornsDamage); + Projectile revenge = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, -1f, Player.whoAmI, npc.whoAmI, pushVel.X, pushVel.Y); npc.AddBuff(ModContent.BuffType(), 900); } @@ -1306,7 +1309,7 @@ namespace CalamityMod.CalPlayer if (Main.npc[proj.Calamity().ParentNPCIndex].active) { if (sulphurSet) - Main.npc[proj.Calamity().ParentNPCIndex].AddBuff(BuffID.Poisoned, 60); + Main.npc[proj.Calamity().ParentNPCIndex].AddBuff(BuffID.Poisoned, SulphurousHelmet.SetBonusPoisonDuration); if (ilSpark) Main.npc[proj.Calamity().ParentNPCIndex].Calamity().shocked = 120; } @@ -1369,90 +1372,10 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(BuffID.BrokenArmor, 600); } - else if (proj.type == ProjectileID.DeathLaser || proj.type == ProjectileID.RocketSkeleton || proj.type == ProjectileID.BombSkeletronPrime) - { - Player.AddBuff(BuffID.OnFire, 180); - } - else if (proj.type == ProjectileID.Skull) - { - Player.AddBuff(BuffID.Weak, 180); - } - else if (proj.type == ProjectileID.CursedFlameHostile || proj.type == ProjectileID.EyeFire) - { - // Guaranteed Cursed Inferno for 1 second (vanilla also has a 68.75% chance of Cursed Inferno for 2 to 3 seconds) - Player.AddBuff(BuffID.CursedInferno, 60); - } else if (proj.type == ProjectileID.DesertDjinnCurse) { Player.AddBuff(BuffID.Cursed, 180); } - else if (proj.type == ProjectileID.Stinger || proj.type == ProjectileID.QueenBeeStinger) - { - // 66.6% chance of Poison for 5 seconds, 2 guaranteed seconds of Poison otherwise (vanilla also has a 33.3% chance of Poison for 10 seconds) - if (Main.rand.Next(3) > 0) - Player.AddBuff(BuffID.Poisoned, 300); - else - Player.AddBuff(BuffID.Poisoned, 120); - } - else if (proj.type == ProjectileID.PoisonSeedPlantera) - { - // 75% chance of Poison for 3 to 5 seconds, guaranteed Poison for 2 seconds (vanilla also has a 50% chance of Poison for 3 to 7 seconds) - if (Main.rand.Next(4) > 0) - Player.AddBuff(BuffID.Poisoned, Main.rand.Next(180, 301)); - else - Player.AddBuff(BuffID.Poisoned, 120); - } - else if (proj.type == ProjectileID.ThornBall) - { - Player.AddBuff(BuffID.Poisoned, 420); - } - else if (proj.type == ProjectileID.CultistBossFireBall) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (proj.type == ProjectileID.CultistBossIceMist) - { - if (!Player.frozen) - Player.AddBuff(BuffID.Frozen, 60); - - Player.AddBuff(BuffID.Chilled, 180); - } - else if (proj.type == ProjectileID.CultistBossLightningOrbArc) - { - Player.AddBuff(BuffID.Electrified, 180); - } - else if (proj.type == ProjectileID.AncientDoomProjectile) - { - Player.AddBuff(ModContent.BuffType(), 120); - } - else if (proj.type == ProjectileID.CultistBossFireBallClone) - { - Player.AddBuff(ModContent.BuffType(), 180); - } - else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) - { - Player.AddBuff(ModContent.BuffType(), 120); - } - else if (proj.type == ProjectileID.PhantasmalSphere) - { - Player.AddBuff(ModContent.BuffType(), 210); - } - else if (proj.type == ProjectileID.PhantasmalDeathray) - { - Player.AddBuff(ModContent.BuffType(), 300); - } - else if ((proj.type == ProjectileID.FairyQueenLance || proj.type == ProjectileID.HallowBossRainbowStreak || proj.type == ProjectileID.HallowBossSplitShotCore) && NPC.ShouldEmpressBeEnraged()) - { - Player.AddBuff(ModContent.BuffType(), 120); - } - else if (proj.type == ProjectileID.HallowBossLastingRainbow && NPC.ShouldEmpressBeEnraged()) - { - Player.AddBuff(ModContent.BuffType(), 210); - } - else if (proj.type == ProjectileID.FairyQueenSunDance && NPC.ShouldEmpressBeEnraged()) - { - Player.AddBuff(ModContent.BuffType(), 300); - } else if (proj.type == ProjectileID.BloodNautilusShot) { Player.AddBuff(ModContent.BuffType(), 240); @@ -1465,42 +1388,49 @@ namespace CalamityMod.CalPlayer { Player.AddBuff(ModContent.BuffType(), 600); } - } - // As these reflects do not cancel damage, they need to be in OnHit rather than ModifyHit - if (!ProjectileDestroyExceptionsList.Includes(proj.type) && proj.active && !proj.friendly && proj.hostile && hurtInfo.Damage > 0) - { - double dodgeDamageGateValuePercent = 0.05; - int dodgeDamageGateValue = (int)Math.Round(Player.statLifeMax2 * dodgeDamageGateValuePercent); - - // Reflects count as dodges. They share the timer and can be disabled by global dodge disabling effects. - if (!disableAllDodges && !Player.HasCooldown(GlobalDodge.ID) && proj.damage >= dodgeDamageGateValue) + if (CalamityWorld.revenge) { - double maxCooldownDurationDamagePercent = 0.5; - int maxCooldownDurationDamageValue = (int)Math.Round(Player.statLifeMax2 * (maxCooldownDurationDamagePercent - dodgeDamageGateValuePercent)); - - // Just in case... - if (maxCooldownDurationDamageValue <= 0) - maxCooldownDurationDamageValue = 1; - - float cooldownDurationScalar = MathHelper.Clamp((proj.damage - dodgeDamageGateValue) / (float)maxCooldownDurationDamageValue, 0f, 1f); - - if (daedalusReflect && !evolution) + if (proj.type == ProjectileID.CursedFlameHostile || proj.type == ProjectileID.EyeFire) { - proj.hostile = false; - proj.friendly = true; - proj.velocity *= -1f; - proj.penetrate = 1; - - // 17APR2024: Ozzatron: The Daedalus Reflect set bonus also functions as a dodge. It uses vanilla dodge iframes and benefits from Cross Necklace. - int daedalusReflectIFrames = Player.ComputeReflectIFrames(); - Player.GiveUniversalIFrames(daedalusReflectIFrames, true); - - int cooldownDuration = (int)MathHelper.Lerp(BalancingConstants.DaedalusReflectCooldownMin, BalancingConstants.DaedalusReflectCooldownMax, cooldownDurationScalar); - Player.AddCooldown(GlobalDodge.ID, cooldownDuration); + // Guaranteed Cursed Inferno for 1 second (vanilla also has a 68.75% chance of Cursed Inferno for 2 to 3 seconds) + Player.AddBuff(BuffID.CursedInferno, 60); + } + else if (proj.type == ProjectileID.ThornBall) + { + Player.AddBuff(BuffID.Venom, 120); + } + else if (proj.type == ProjectileID.CultistBossFireBall) + { + Player.AddBuff(ModContent.BuffType(), 180); + } + else if (proj.type == ProjectileID.CultistBossIceMist && proj.ai[1] == 1f) // Main ice mists only; no shards + { + Player.AddBuff(BuffID.Chilled, 180); + } + else if (proj.type == ProjectileID.CultistBossLightningOrbArc) + { + Player.AddBuff(BuffID.Electrified, 180); + } + else if (proj.type == ProjectileID.CultistBossFireBallClone) + { + Player.AddBuff(ModContent.BuffType(), 240); + } + else if (proj.type == ProjectileID.PhantasmalBolt || proj.type == ProjectileID.PhantasmalEye) + { + Player.AddBuff(ModContent.BuffType(), 120); + } + else if (proj.type == ProjectileID.PhantasmalSphere) + { + Player.AddBuff(ModContent.BuffType(), 180); + } + else if (proj.type == ProjectileID.PhantasmalDeathray) + { + Player.AddBuff(ModContent.BuffType(), 240); } } } + if (NPC.AnyNPCs(ModContent.NPCType())) { Player.AddBuff(ModContent.BuffType(), 15, true); @@ -1744,11 +1674,17 @@ namespace CalamityMod.CalPlayer // Handles energy shields and Boss Rush, in that order modifiers.ModifyHurtInfo += ModifyHurtInfo_Calamity; - // TODO -- At some point it'd be nice to have a "TransformationPlayer" that has all the transformation sfx and visuals so their priorities can be more easily managed. #region Custom Hurt Sounds if (hurtSoundTimer == 0) { - if (roverDrive && RoverDriveShieldDurability > 0) + if(Player.Transformation().Type != -1 && Player.Transformation().currentTransformation.HurtSound(Player) != null) + { + var hurtSound = Player.Transformation().currentTransformation.HurtSound(Player).Value; + modifiers.DisableSound(); + SoundEngine.PlaySound(hurtSound.sound, Player.Center); + hurtSoundTimer = hurtSound.delay; + } + else if (roverDrive && RoverDriveShieldDurability > 0) { modifiers.DisableSound(); SoundEngine.PlaySound(RoverDrive.ShieldHurtSound, Player.Center); @@ -1766,42 +1702,12 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(TheSponge.ShieldHurtSound, Player.Center); hurtSoundTimer = 20; } - else if (((pSoulArtifact && !profanedCrystal) || profanedCrystalBuffs) && pSoulShieldDurability > 0) - { - modifiers.DisableSound(); - SoundEngine.PlaySound(ProfanedGuardianDefender.ShieldDeathSound); - hurtSoundTimer = 20; - } - else if ((profanedCrystal || profanedCrystalForce) && !profanedCrystalHide) - { - modifiers.DisableSound(); - SoundEngine.PlaySound(Providence.HurtSound, Player.Center); - hurtSoundTimer = 20; - } - else if ((abyssalDivingSuitPower || abyssalDivingSuitForce) && !abyssalDivingSuitHide) - { - modifiers.DisableSound(); - SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); //metal hit noise - hurtSoundTimer = 10; - } - else if (((aquaticHeartPower || aquaticHeartForce) && !aquaticHeartHide) || Player.GetModPlayer().vanityEquipped) - { - modifiers.DisableSound(); - SoundEngine.PlaySound(SoundID.FemaleHit, Player.Center); //female hit noise - hurtSoundTimer = 10; - } else if (titanHeartSet) { modifiers.DisableSound(); SoundEngine.PlaySound(NPCs.Astral.Atlas.HurtSound, Player.Center); hurtSoundTimer = 10; } - else if (Player.GetModPlayer().transformationActive) - { - modifiers.DisableSound(); - SoundEngine.PlaySound(SoundID.NPCHit4, Player.Center); - hurtSoundTimer = 10; - } else if (Player.GetModPlayer().wulfrumSet && (Player.name.ToLower() == "wagstaff" || Player.name.ToLower() == "john wulfrum")) { modifiers.DisableSound(); @@ -1917,6 +1823,9 @@ namespace CalamityMod.CalPlayer Player.AddCooldown(ParryCooldown.ID, 1200, false, "shieldoftheocean"); ShieldoftheOcean.ActivateParry(Player); } + + if (Player.Calamity().scionsCurio) + scionsCurioGotHit = true; } private void ModifyHurtInfo_Calamity(ref Player.HurtInfo info) @@ -2145,10 +2054,9 @@ namespace CalamityMod.CalPlayer // Regardless of whether shields took damage, iterate over and stall all shield regen on ANY hit. // This applies even if you are hit while shields are fully down, or if you unequip any of the relevant items. { - // Rover Drive does not recharge while partially full, only when broken. - // If you are hit when recharging, though, that timer gets reset. - if (cooldowns.TryGetValue(WulfrumRoverDriveRecharge.ID, out var roverDriveRechargeCD)) - roverDriveRechargeCD.timeLeft = RoverDrive.ShieldRechargeTime; + // Set Rover Drive's recharge delay to full. Override any existing cooldown instance. + if (roverDrive) + Player.AddCooldown(WulfrumRoverDriveRecharge.ID, RoverDrive.ShieldRechargeDelay, true); // Set the Lunic Corps Armor's recharge delay to full. Override any existing cooldown instance. if (lunicCorpsSet) @@ -2295,8 +2203,8 @@ namespace CalamityMod.CalPlayer if (RageEnabled) rageCombatFrames = BalancingConstants.RageCombatDelayTime; - // Regenator has been CANCLED on TWITTER.COM!!!! (Just keeping this here since it's a neat effect and I'll probably yoink it for something else later) - if (regenator && false) + // Regenerator has been CANCLED on TWITTER.COM!!!! (Just keeping this here since it's a neat effect and I'll probably yoink it for something else later) + if (regenerator && false) { // Projectile damage and count is based on source damage of the hit float hitPower = (hurtInfo.SourceDamage / (Player.statLifeMax2 * 0.5f)); @@ -2338,9 +2246,15 @@ namespace CalamityMod.CalPlayer } } - if (daedalusAbsorb && Main.rand.NextBool(10)) + if (victideBarrierSet && !Player.HasCooldown(WardingWave.ID)) { - int healAmt = (int)(hurtInfo.Damage / 2D); + int healAmt = (int)(hurtInfo.Damage * VictideHeadBarrier.BarrierDamageAbsorptionPercent); + victideBarrierHeal += healAmt; + } + + if (daedalusAbsorb && Main.rand.NextBool(DaedalusHeadMagic.AbsorptionChanceDenominator)) + { + int healAmt = (int)(hurtInfo.Damage * DaedalusHeadMagic.DamageAbsorptionPercent); Player.HealPlayer(healAmt); } @@ -2373,7 +2287,7 @@ namespace CalamityMod.CalPlayer if (trinketOfChi) chiBuffTimer = 0; - if (amidiasBlessing && hurtInfo.Damage > 50) + if (amidiasBlessing && (chaliceOfTheBloodGod ? chaliceBleedoutToApplyOnHurt : hurtInfo.Damage) > 50) { Player.ClearBuff(ModContent.BuffType()); SoundEngine.PlaySound(SoundID.Item96, Player.Center); @@ -2486,15 +2400,15 @@ namespace CalamityMod.CalPlayer if (tarraMelee) { - Player.AddBuff(ModContent.BuffType(), 120); + Player.AddBuff(ModContent.BuffType(), TarragonHeadMelee.TarraLifeDuration); } else if (xerocSet) { - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), EmpyreanMask.WrathDuration); } else if (reaverDefense) { - Player.AddBuff(ModContent.BuffType(), 180); + Player.AddBuff(ModContent.BuffType(), ReaverHeadTank.ReaverRageDuration); } if (fBarrier || (aquaticHeart && NPC.downedBoss3)) @@ -2613,14 +2527,13 @@ namespace CalamityMod.CalPlayer if (!canTriggerHitEffects) return; - if (aeroSet && hurtInfo.Damage > 25) + if (aeroSet && hurtInfo.Damage > AerospecBreastplate.SetBonusHurtDamageThreshold) { // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, AerospecBreastplate.FeatherEntitySourceContext); + int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(AerospecBreastplate.SetBonusFeatherDamage); for (int n = 0; n < 4; n++) { - int featherDamage = (int)Player.GetBestClassDamage().ApplyTo(30); - CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 20f, ModContent.ProjectileType(), featherDamage, 1f, Player.whoAmI); } } @@ -2629,25 +2542,19 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); SoundEngine.PlaySound(SoundID.Item74, Player.Center); - int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(25); - int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(320); - + int blazeDamage = (int)Player.GetBestClassDamage().ApplyTo(HideofAstrumDeus.BlazeDamage); Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, 0f, ModContent.ProjectileType(), blazeDamage, 5f, Player.whoAmI, 0f, 1f); - for (int n = 0; n < 12; n++) - { - CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), astralStarDamage, 5f, Player.whoAmI); - } } // TODO -- Make Deific Amulet and Rampart of Deities' retaliation effects way cooler - // In the meantime, gave them homing astral bombers instead of the lame falling stars + // In the meantime, gave them homing astral stars instead of the lame falling stars. + // This also serves to make the Honeycomb in Sweetheart Necklace make sense if (dAmulet) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int projAmount = (rampartOfDeities ? 12 : 6); for (int n = 0; n < projAmount; n++) { - int baseDamage = 130 * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); - int deificProjDamage = (int)Player.GetBestClassDamage().ApplyTo(baseDamage); + int deificProjDamage = (int)Player.GetBestClassDamage().ApplyTo(DeificAmulet.StarDamage); Projectile onHitProj = Main.projectile[Projectile.NewProjectile(source, Player.Center, new Vector2(0,-15).RotatedBy(MathHelper.TwoPi/projAmount*n), ModContent.ProjectileType(), deificProjDamage, 4f, Player.whoAmI)]; if (onHitProj.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -2684,7 +2591,7 @@ namespace CalamityMod.CalPlayer { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); int effectStrength = amalgam ? 3 : aBrain ? 2 : 1; - int effectDamage = amalgam ? 400 : aBrain ? 35 : 15; + int effectDamage = amalgam ? TheAmalgam.NimbusDamage : aBrain ? AmalgamatedBrain.NimbusDamage : RottenBrain.NimbusDamage; effectDamage = (int)Player.GetBestClassDamage().ApplyTo(effectDamage); Vector2 spawnerVelocity = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 40f) * 12.5f; @@ -2693,15 +2600,20 @@ namespace CalamityMod.CalPlayer } if (inkBomb && !abyssalMirror && !eclipseMirror) { - var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (Player.whoAmI == Main.myPlayer && !Player.HasCooldown(Cooldowns.InkBomb.ID)) + if (Player.whoAmI == Main.myPlayer) { - Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); - rogueStealth += 0.5f; + if (!Player.HasCooldown(Cooldowns.InkBomb.ID)) + { + Player.AddCooldown(Cooldowns.InkBomb.ID, CalamityUtils.SecondsToFrames(20)); + rogueStealth += 0.5f; + SoundEngine.PlaySound(SoundID.NPCDeath28 with { Volume = 2f }, Player.Center); + } + + var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); + SoundEngine.PlaySound(SoundID.Item1, Player.Center); for (int i = 0; i < 3; i++) { - SoundEngine.PlaySound(SoundID.Item61, Player.Center); - int ink = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, Main.rand.NextFloat(-3f, 3f), Main.rand.NextFloat(-0f, -4f), ModContent.ProjectileType(), 0, 0, Player.whoAmI); + int ink = Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.One.RotatedByRandom(MathHelper.TwoPi) * 2f, ModContent.ProjectileType(), 0, 0, Player.whoAmI); if (ink.WithinBounds(Main.maxProjectiles)) Main.projectile[ink].DamageType = DamageClass.Generic; } @@ -2713,7 +2625,7 @@ namespace CalamityMod.CalPlayer if (hurtInfo.Damage > 0) { SoundEngine.PlaySound(SoundID.Item74, Player.Center); - int eDamage = (int)Player.GetBestClassDamage().ApplyTo(230); + int eDamage = (int)Player.GetBestClassDamage().ApplyTo(HydrothermicArmor.BlazeDamage); if (Player.whoAmI == Main.myPlayer) Projectile.NewProjectile(fuckYouBitch, Player.Center, Vector2.Zero, ModContent.ProjectileType(), eDamage, 1f, Player.whoAmI, 0f, 0f); @@ -2721,21 +2633,18 @@ namespace CalamityMod.CalPlayer } else if (daedalusShard) // Daedalus Ranged helm { - var source = Player.GetSource_Misc("22"); if (hurtInfo.Damage > 0) { SoundEngine.PlaySound(SoundID.Item27, Player.Center); - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int sDamage = (int)Player.GetTotalDamage().ApplyTo(60); if (Player.whoAmI == Main.myPlayer) { - for (int i = 0; i < 16; i++) + var source = Player.GetSource_Misc("22"); + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + int sDamage = (int)Player.GetTotalDamage().ApplyTo(DaedalusHeadRanged.ShardDamage); + for (int i = 0; i < 10; i++) { - Vector2 circleVel = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); + Vector2 circleVel = ((MathHelper.TwoPi * i / 10f) + offset).ToRotationVector2() * Main.rand.NextFloat(5f, 8f); int shard = Projectile.NewProjectile(source, Player.Center, circleVel, ProjectileID.CrystalShard, sDamage, 1f, Player.whoAmI); if (shard.WithinBounds(Main.maxProjectiles)) Main.projectile[shard].DamageType = DamageClass.Generic; @@ -2743,28 +2652,17 @@ namespace CalamityMod.CalPlayer } } } - else if (reaverDefense) //Defense and DR Helm - { - var source = Player.GetSource_Misc("23"); - if (hurtInfo.Damage > 0) - { - int rDamage = (int)Player.GetBestClassDamage().ApplyTo(240); - - if (Player.whoAmI == Main.myPlayer) - Projectile.NewProjectile(source, Player.Center.X, Player.position.Y + 36f, 0f, -18f, ModContent.ProjectileType(), rDamage, 0f, Player.whoAmI, 0f, 0f); - } - } else if (godSlayerDamage) //god slayer melee helm { var source = Player.GetSource_Misc("24"); - if (hurtInfo.Damage > 80) + if (hurtInfo.Damage > GodSlayerHeadMelee.SetBonusHurtDamageThreshold) { SoundEngine.PlaySound(SoundID.Item73, Player.Center); float spread = 45f * 0.0174f; double startAngle = Math.Atan2(Player.velocity.X, Player.velocity.Y) - spread / 2; double deltaAngle = spread / 8f; double offsetAngle; - int shrapnelDamage = Player.CalcIntDamage(675); + int shrapnelDamage = Player.CalcIntDamage(GodSlayerHeadMelee.DartDamage); if (Player.whoAmI == Main.myPlayer) { for (int i = 0; i < 4; i++) @@ -2784,7 +2682,7 @@ namespace CalamityMod.CalPlayer var source = Player.GetSource_OnHurt(hurtInfo.DamageSource, DemonshadeHelm.ShadowScytheEntitySourceContext); for (int l = 0; l < 2; l++) { - int shadowbeamDamage = (int)Player.GetBestClassDamage().ApplyTo(300); + int shadowbeamDamage = (int)Player.GetBestClassDamage().ApplyTo(DemonshadeHelm.BeamDamage); Projectile beam = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.ShadowBeamFriendly, shadowbeamDamage, 7f, Player.whoAmI); if (beam.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -2796,7 +2694,7 @@ namespace CalamityMod.CalPlayer } for (int l = 0; l < 5; l++) { - int scytheDamage = (int)Player.GetBestClassDamage().ApplyTo(500); + int scytheDamage = (int)Player.GetBestClassDamage().ApplyTo(DemonshadeHelm.ScytheDamage); Projectile scythe = CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 22f, ProjectileID.DemonScythe, scytheDamage, 7f, Player.whoAmI); if (scythe.whoAmI.WithinBounds(Main.maxProjectiles)) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 3432974a04..20bce9b8de 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -9,6 +9,10 @@ using CalamityMod.Cooldowns; using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Wings; +using CalamityMod.Items.Armor.Fearmonger; +using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Fishing.BrimstoneCragCatches; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Potions; @@ -97,46 +101,46 @@ namespace CalamityMod.CalPlayer } // Whispering Death sets positive regen to zero but doesn't actually deal any damage - ApplyDoTDebuff(wDeath, 0, laudanum); + ApplyDoTDebuff(whisperingDeath, 0, laudanum); ApplyDoTDebuff(irradiated, 4, purity); int sulphurDoT = 6 - (sulphurSet ? 2 : 0) - (sulphurskin ? 2 : 0) - (corrosiveSpine ? 2 : 0); ApplyDoTDebuff(sulphurPoison, sulphurDoT, purity); - ApplyDoTDebuff(rTide, 6, purity); + ApplyDoTDebuff(riptide, 6, purity); ApplyDoTDebuff(weakBrimstoneFlames, 7); - ApplyDoTDebuff(bBlood, 8, purity); + ApplyDoTDebuff(burningBlood, 8, purity); ApplyDoTDebuff(brainRot, 8, purity); - ApplyDoTDebuff(heavybleeding, 16, purity); - ApplyDoTDebuff(laceration, 24, purity); ApplyDoTDebuff(vaporfied, 8, purity); int staticDoT = ((Player.controlLeft || Player.controlRight) ? 12 : 3) / (eleResist ? 2 : 1); ApplyDoTDebuff(staticDischarge, staticDoT, purity); - ApplyDoTDebuff(bFlames, abaddon ? 10 : 20, purity); - ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player - ApplyDoTDebuff(daybroken, reducedDaybrokenDamage ? 15 : 30, purity); - ApplyDoTDebuff(nightwither, reducedNightwitherDamage ? 15 : 30, purity); - ApplyDoTDebuff(hFlames, 24, purity); - ApplyDoTDebuff(voidfrost, 30, purity); - ApplyDoTDebuff(vHex, 24); - ApplyDoTDebuff(trueVHex, 36); - ApplyDoTDebuff(cDepth, 15, purity); - ApplyDoTDebuff(astralInfection, 18, infectedJewel || hideOfDeus || purity); - ApplyDoTDebuff(hPressure, 30, purity); - ApplyDoTDebuff(pFlames, alchFlask ? 12 : 24, purity); - ApplyDoTDebuff(cragsLava, 30); // Being literally submerged in crags lava should do more than brimstone flames + ApplyDoTDebuff(heavybleeding, 16, purity); + ApplyDoTDebuff(crushDepth, 18, purity); + ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); ApplyDoTDebuff(shadowflame, 30, purity); - ApplyDoTDebuff(elementalMix, 50, purity); // Never inflicted on the player - ApplyDoTDebuff(banishingFire, 60); // Never inflicted on the player + ApplyDoTDebuff(brimstoneFlames, abaddon ? 15 : 30, purity); + ApplyDoTDebuff(plague, alchFlask ? 15 : 30, purity); + ApplyDoTDebuff(vHex, 30); // Has other effects + ApplyDoTDebuff(searingLava, 30); + ApplyDoTDebuff(demonicFlames, 33, purity); // Never inflicted on the player + ApplyDoTDebuff(laceration, 36, purity); + ApplyDoTDebuff(daybroken, 40, purity); + ApplyDoTDebuff(nightwither, 40, purity); + ApplyDoTDebuff(holyFlames, 40, purity); + ApplyDoTDebuff(voidfrost, 40, purity); + ApplyDoTDebuff(hadopelagicPressure, 40, purity); // Profaned Soul Crystal turns you into Providence, a God, and you take more damage from God Slayer Inferno - ApplyDoTDebuff(gsInferno, profanedCrystalBuffs ? 45 : 35); + ApplyDoTDebuff(godSlayerInferno, profanedCrystalBuffs ? 50 : 40); int fluxDoT = ((Player.controlLeft || Player.controlRight) ? 50 : 10) / (eleResist ? 2 : 1); ApplyDoTDebuff(vermillionFlux, fluxDoT); - int dragonfireDoT = ((Player.name == "JFL" || Player.name == "MrJFL") ? 240 : 40) / (dynamoStemCells ? 2 : 1); + ApplyDoTDebuff(elementalMix, 50, purity); // Never inflicted on the player + ApplyDoTDebuff(trueVHex, 50); + int dragonfireDoT = ((Player.name == "JFL" || Player.name == "MrJFL") ? 200 : 50) / (dynamoStemCells ? 2 : 1); ApplyDoTDebuff(dragonFire, dragonfireDoT); - int rebukeDoT = ((Player.controlLeft || Player.controlRight) ? 75 : 15) / (eleResist ? 2 : 1); + ApplyDoTDebuff(miracleBlight, 60); + ApplyDoTDebuff(banishingFire, 60); // Never inflicted on the player + int rebukeDoT = ((Player.controlLeft || Player.controlRight) ? 80 : 16) / (eleResist ? 2 : 1); ApplyDoTDebuff(auricRebuke, rebukeDoT); - ApplyDoTDebuff(miracleBlight, 50); // Slowly increase the sulphuric water poisoning effect. Once it's high enough, the player takes damage and the meter resets. bool nearSafeZone = false; @@ -191,7 +195,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int buff = Player.buffType[l]; - if (AlcoholsDict.TryGet(buff, out var level)) + if (CalamityBuffSets.AlcoholStrength.TryGetValue(buff, out int level)) alcoholPoisonLevel += level; } if (vodka) @@ -234,7 +238,7 @@ namespace CalamityMod.CalPlayer Player.fishingSkill += 5; } - if (alcoholPoisonLevel > (cirrusDress ? 5 : 3)) + if (alcoholPoisonLevel > 3) { // Independently of Calamity's nerfs to Nebula life regen, it is disabled entirely by alcohol poisoning. Player.nebulaLevelLife = 0; @@ -251,12 +255,6 @@ namespace CalamityMod.CalPlayer } #endregion - if (manaOverloader) - { - if (Player.statMana > (int)(Player.statManaMax2 * 0.5)) - totalNegativeLifeRegen += 3; - } - if (brimflameFrenzy) { Player.manaRegen = 0; @@ -284,14 +282,9 @@ namespace CalamityMod.CalPlayer else witheredWeaponHoldTime = 0; - if (ManaBurn) + if (Player.statMana < 0) { - int debuffIndex = Player.FindBuffIndex(ModContent.BuffType()); - float debuffIntensity = debuffIndex == -1 ? 0f : Player.buffTime[debuffIndex] / (float)Player.manaSickTimeMax; - - totalNegativeLifeRegen += (int)(Math.Sqrt(debuffIntensity) * Math.Pow(6D, debuffIntensity + 1f)); - if (Player.lifeRegen > 0) - Player.lifeRegen = 0; + totalNegativeLifeRegen -= Player.statMana/10f; } // @@ -300,34 +293,11 @@ namespace CalamityMod.CalPlayer // At the last second, Reaver defense helm reduces DoT debuffs by 20% if (reaverDefense) - totalNegativeLifeRegen = (int)(0.8f * totalNegativeLifeRegen); + totalNegativeLifeRegen -= (int)(totalNegativeLifeRegen * ReaverHeadTank.SetBonusDebuffDamageReduction); Player.lifeRegen -= (int)totalNegativeLifeRegen; #region Life Regen That Works Even During DoT Debuffs - - // Honey Dew (and upgrades) - if (alwaysHoneyRegen) - { - // Exact copy of vanilla Honey behavior, but does not stack with actually standing in Honey - if (!Player.honey) - { - alwaysHoneyRegenAmount += 1; - Player.lifeRegen += 2; - Player.lifeRegenTime += 1; - - // Grants +2 life regen if negative life regen would otherwise occur. - // However, this can't bring regen into the positives. - if (Player.lifeRegen < 0) - { - alwaysHoneyRegenAmount += Math.Min(1f, 0 - Player.lifeRegen/2f); - Player.lifeRegen += 2; - if (Player.lifeRegen > 0) - Player.lifeRegen = 0; - } - } - } - if (honeyDewHalveDebuffs) { // Tick down all sickness debuffs; this makes them expire 2x faster @@ -337,11 +307,11 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2) continue; - bool shouldHalveDuration = SicknessDebuffsList.Includes(buffID); + bool shouldHalveDuration = CalamityBuffSets.IsSicknessDebuff[buffID]; if (livingDewHalveDebuffs) - shouldHalveDuration |= FireDebuffsList.Includes(buffID); + shouldHalveDuration |= CalamityBuffSets.IsFireDebuff[buffID]; if (purity) - shouldHalveDuration |= DebuffsList.Includes(buffID); + shouldHalveDuration |= CalamityBuffSets.IsDebuff[buffID]; if (shouldHalveDuration) --Player.buffTime[l]; @@ -385,10 +355,10 @@ namespace CalamityMod.CalPlayer } // Permafrost's Concoction increases life regen while afflicted with a fire debuff - if (permafrostsConcoction && Player.buffType.Any(FireDebuffsList.Includes)) + if (permafrostsConcoction && Player.buffType.Any(l => CalamityBuffSets.IsFireDebuff[l])) { - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; + if (Player.lifeRegenTime < 900) + Player.lifeRegenTime = 900; Player.lifeRegen += 6; } @@ -397,18 +367,17 @@ namespace CalamityMod.CalPlayer if (rOoze || aAmpoule || purity) { float missingLifeRatio = (Player.statLifeMax2 - Player.statLife) / (float)Player.statLifeMax2; - //Ambrosial Ampule and ooze give between 2 and 6 hp/s - int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp((purity || aAmpoule? 2f : 4f), (purity || aAmpoule ? 8f : 12f), missingLifeRatio));//Rounding is needed for it to ever actually give +6 hp/s, as the integer conversion would otherwise floor it. + //Ambrosial Ampule and ooze give between 2 and 5 hp/s + int lifeRegenToGive = (int)Math.Round(MathHelper.Lerp(4f, 10f, missingLifeRatio));//Rounding is needed for it to ever actually give +5 hp/s, as the integer conversion would otherwise floor it. Player.lifeRegen += lifeRegenToGive; radiantOozeRegen += lifeRegenToGive / 2f; - ambrosialAmpouleRegen += lifeRegenToGive / 2f; purityRegen += lifeRegenToGive / 2f; } if (purity) { int intendedPurityDefense = 0; - int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); + int currentDebuffs = Player.buffType.Count(i => CalamityBuffSets.IsDebuff[i]); if (currentDebuffs > 0) { // Healing rate is normally 5 HP/s (+1 every 12 frames) @@ -425,10 +394,7 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % healFrameCadence == healFrameCadence - 1) Player.Heal(1); - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; - - intendedPurityDefense = 20 + (currentDebuffs - 1) * 8; + intendedPurityDefense = 15 + (currentDebuffs - 1) * 5; if (jewelBonusDefense < intendedPurityDefense) jewelBonusDefense = intendedPurityDefense; @@ -463,14 +429,12 @@ namespace CalamityMod.CalPlayer // If the player has any debuffs, give the extra life regen and defense // More defense is given for each additional debuff int intendedJewelDefense = 0; - int currentDebuffs = Player.buffType.Count(DebuffsList.List.Contains); + int currentDebuffs = Player.buffType.Count(i => CalamityBuffSets.IsDebuff[i]); if (currentDebuffs > 0) { Player.lifeRegen += 4; - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; - intendedJewelDefense = 16 + (currentDebuffs - 1) * 5; + intendedJewelDefense = 12 + (currentDebuffs - 1) * 4; if (jewelBonusDefense < intendedJewelDefense) jewelBonusDefense = intendedJewelDefense; } @@ -489,13 +453,9 @@ namespace CalamityMod.CalPlayer { Player.lifeRegen += 2; - // If any debuff is detected, provide even more life regen and massively accelerate it - if (Player.buffType.Any(DebuffsList.List.Contains)) - { + // If any debuff is detected, provide even more life regen + if (Player.buffType.Any(i => CalamityBuffSets.IsDebuff[i])) Player.lifeRegen += 3; - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; - } } #endregion @@ -531,7 +491,7 @@ namespace CalamityMod.CalPlayer Player.lifeRegenCount = 0; } - if (hInferno) + if (holyInferno) { Player.nebulaLevelLife = 0; @@ -596,7 +556,7 @@ namespace CalamityMod.CalPlayer } if (tRegen) - Player.lifeRegen += 3; + Player.lifeRegen += TarragonHeadMelee.TarraLifeRegenBoost; if (sRegen) Player.lifeRegen += SpiritGlyph.RegenBoost; @@ -631,6 +591,9 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += Main.eclipse ? 2 : 4; } + if (silvaSet) + Player.lifeRegen += SilvaArmor.SetBonusRegenBoost; + if (phantomicHeartRegen <= 720 && phantomicHeartRegen >= 600) { Player.lifeRegen += PhantomicArtifact.RegenBoost; @@ -654,7 +617,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - lesserEffect = AlcoholsDict.TryGet(hasBuff, out var a); + lesserEffect = CalamityBuffSets.AlcoholStrength.TryGetValue(hasBuff, out var a); } if (Player.lifeRegen < 0) Player.lifeRegen += lesserEffect ? 1 : regenBoost; @@ -669,20 +632,13 @@ namespace CalamityMod.CalPlayer Player.lifeRegen += 4; } - if (bloodflareSummon) - { - if (Player.statLife <= (int)(actualMaxLife * 0.5)) - Player.lifeRegen += 2; - } - if (fearmongerSet && fearmongerRegenFrames > 0) { - Player.lifeRegen += 7; + if (Player.lifeRegenTime < FearmongerGreathelm.MinionRegenTimeFloor) + Player.lifeRegenTime = FearmongerGreathelm.MinionRegenTimeFloor; - if (Player.lifeRegenTime < 1800) - Player.lifeRegenTime = 1800; - - Player.lifeRegenTime += 4; + Player.lifeRegen += FearmongerGreathelm.MinionRegenBoost; + Player.lifeRegenTime += FearmongerGreathelm.MinionRegenTimeBoost; } if (pinkCandle && !noLifeRegen) @@ -699,126 +655,62 @@ namespace CalamityMod.CalPlayer else pinkCandleHealFraction = 0D; - if (reaverRegen && reaverRegenCooldown >= 60) + if (manaOverloader) { - reaverRegenCooldown = 0; - - if (Player.statLife != Player.statLifeMax2 && !noLifeRegen) - Player.HealPlayer(1, HealTextType.None); - } - - if (BloomStoneRegen) - { - float dayTimeCompletion = !Main.dayTime ? 1f : (float)(Main.time / Main.dayLength); - float regenBenefitFactor = MathHelper.SmoothStep(0.25f, 1f, Utils.GetLerpValue(0f, 0.24f, dayTimeCompletion, true) * Utils.GetLerpValue(1f, 0.76f, dayTimeCompletion, true)); - - Player.lifeRegen += (int)MathHelper.Lerp(2f, 6f, regenBenefitFactor); - Player.lifeRegenTime += (int)MathHelper.Lerp(1f, 3f, regenBenefitFactor); + float manaRatio = Player.statMana / (float)Player.statManaMax2; + Player.lifeRegen += (int)(MathF.Round(MathHelper.Lerp(4f, -4f, manaRatio)) * (Player.HasBuff(BuffID.ManaSickness) ? 0.5f : 1f)); } #region Standing Still Life Regen // Standing still healing bonuses (all are exclusive with vanilla Shiny Stone, but all function similarly) - if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0) + if (!Player.shinyStone && Player.StandingStill() && Player.velocity.Y == 0 && Player.itemAnimation == 0 && (shadeRegen || cFreeze)) { - bool honeyDewWorking = honeyTurboRegen && Player.honeyWet; - bool anyStandingStillLifeRegen = shadeRegen || cFreeze || honeyDewWorking || aAmpoule || purity; - // Divides all negative life regen by two before applying any other effects. - if (anyStandingStillLifeRegen && Player.lifeRegen < 0) + if (Player.lifeRegen < 0) Player.lifeRegen /= 2; - // Spawn dust of some flavor while actually regenerating, aAmpule and purity have a slightly different looking style + // Spawn dust of some flavor while actually regenerating if (Player.lifeRegen > 0 && Player.statLife < actualMaxLife) { - int dustType = shadeRegen ? 173 : cFreeze ? 67 : honeyDewWorking ? DustID.Honey2 : aAmpoule ? 228 : purity ? 187 : -1; - bool dustSpawnRolled = Main.rand.Next(30000) < Player.lifeRegenTime || purity ? Main.rand.NextBool() : aAmpoule ? Main.rand.NextBool(4) : Main.rand.NextBool(30); + int dustType = shadeRegen ? 173 : 67; + bool dustSpawnRolled = Main.rand.Next(30000) < Player.lifeRegenTime ? Main.rand.NextBool() : Main.rand.NextBool(30); if (dustType != -1 && dustSpawnRolled) { - Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, dustType, 0f, 0f, purity || aAmpoule ? 80 : 200, default, purity || aAmpoule ? 0.5f : 1f); + Dust regen = Dust.NewDustDirect(Player.position, Player.width, Player.height, dustType, 0f, 0f, 200, default, 1f); regen.noGravity = true; regen.fadeIn = 1.3f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 50f, 100f, 0.04f); regen.velocity = velocity; velocity.Normalize(); - velocity *= purity || aAmpoule ? 55f : 34f; regen.position = Player.Center - velocity; } } // Actually apply "standing still" regeneration (the stats are granted even at full health) - float regenTimeNeededForTurboRegen = shadeRegen ? 40f : cFreeze ? 60f : honeyDewWorking ? 90f : aAmpoule ? 90f : purity ? 60f : -1f; + float regenTimeNeededForTurboRegen = shadeRegen ? 40f : 60f; - // 4 = vanilla Shiny Stone - int turboRegenPower = shadeRegen || cFreeze || purity ? 4 : honeyDewWorking || aAmpoule ? 3 : -1; + // After a brief delay determined by your form of standing still regen, min-cap life regen time at 900 / 3600. + if (Player.lifeRegenTime > regenTimeNeededForTurboRegen && Player.lifeRegenTime < 900f) + Player.lifeRegenTime = 900f; - if (turboRegenPower > 0) - { - // After a brief delay determined by your form of standing still regen, min-cap life regen time at 1800 / 3600. - if (Player.lifeRegenTime > regenTimeNeededForTurboRegen && Player.lifeRegenTime < 1800f) - Player.lifeRegenTime = 1800f; - - Player.lifeRegen += turboRegenPower; - Player.lifeRegenTime += turboRegenPower; - purityRegen += turboRegenPower/2f; - if (!shadeRegen || cFreeze || purity) ambrosialAmpouleRegen += turboRegenPower/2f; - } + Player.lifeRegen += 4; + Player.lifeRegenTime += 4; } #endregion - // Life regen soft cap. - if (Player.statLife < actualMaxLife) + if (regenerator) // Gives special regen of it's own, but disables all regular life regen { - // The soft cap doesn't apply if the player is not moving and not using a weapon while having any of the following: - // Shiny Stone, Cosmic Freeze buff from the Cosmic Discharge, Demonshade Armor, Regenator, or The Camper. - int baseLifeRegenBoost = 4; - bool noLifeRegenCap = (Player.shinyStone || cFreeze || shadeRegen || camper || regenator) && - Player.StandingStill() && Player.itemAnimation == 0; - - if (!noLifeRegenCap) - { - // Calculate the % of HP the player has left. - float maxLifeRatio = Player.statLife / (float)actualMaxLife; - - // Calculate the ratio of the player's current max life relative to the starting HP of 100. - // This makes the soft cap far less harsh at lower amounts of max life. - // Ranges from 20 (at 100 max life) to 4 (at 500 max life) to 2 (at 1000 max life) to 1 (at greater than 2000 max life). - int lifeRegenSoftCapMax = 20; - int lifeRegenSoftCapMin = (int)Math.Round(100f / actualMaxLife * lifeRegenSoftCapMax); - - // The soft cap for life regen which ranges from 20 (at less than 5% HP) to 1 (at greater than or equal to 95% HP). - // This value is capped at a min and max amount. - int lifeRegenSoftCap = (int)MathHelper.Clamp((int)Math.Round((1f - maxLifeRatio) * lifeRegenSoftCapMax), lifeRegenSoftCapMin, lifeRegenSoftCapMax); - - // If life regen is greater than the calculated soft cap, reduce it. - if (Player.lifeRegen - baseLifeRegenBoost > lifeRegenSoftCap) - { - // The scalar used to calculate how much the life regen stat should be reduced by. - // Ranges from 1 (at 0% HP) to 2 (at 100% HP). - float lifeRegenScalar = 1f + maxLifeRatio; - - // Calculate the amount of life regen the player should get according to the soft cap and their current % HP remaining. - // The higher the player's % HP remaining the less life regen they get and vice versa. - int defLifeRegen = (int)((Player.lifeRegen - baseLifeRegenBoost) / lifeRegenScalar); - - // Set the player's life regen to the scaled amount. - Player.lifeRegen = baseLifeRegenBoost + defLifeRegen; - } - } - } - - if (regenator) // Gives special regen of it's own, but disables all regular life regen - { - if (Player.miscCounter % 7 == 0 && Player.statLife < (int)(Player.statLifeMax2 * 0.5f)) + if (Player.miscCounter % Regenerator.FramesPerHeal == 0 && Player.statLife < (int)(Player.statLifeMax2 * 0.5f)) Player.HealPlayer(1, HealTextType.None); // Boost life regen time quite a bit. // This is so that in events and such where small hits are common, your damage boost isn't completley negated if (Player.lifeRegenTime < 3600) - Player.lifeRegenTime += 10; + Player.lifeRegenTime += Regenerator.RegenTimeBoost; } else - regenatorDamage = 0; + regeneratorDamage = 0; if (toxicHeart) // Since it needs to know your life regen, it must be placed here { @@ -873,8 +765,8 @@ namespace CalamityMod.CalPlayer } } - // Regenator trades all positive regen for damage, and caps your health gain at 50% - if (regenator) + // Regenerator trades all positive regen for damage, and caps your health gain at 50% + if (regenerator) { int finalRegen = Player.lifeRegen + (int)Math.Round(regen * (Player.statLifeMax2 / 400f * 0.85f + 0.15f)); finalRegen = (int)Math.Max(finalRegen, 0); @@ -884,8 +776,8 @@ namespace CalamityMod.CalPlayer if (Player.palladiumRegen) finalRegen += 4; - regenatorDamage = (finalRegen * 1.75f) * 0.01f; - Player.GetDamage() += regenatorDamage; + regeneratorDamage = finalRegen * Regenerator.RegenToDamageRatio; + Player.GetDamage() += regeneratorDamage; if (Player.lifeRegen > 0) Player.lifeRegen = 0; @@ -894,11 +786,11 @@ namespace CalamityMod.CalPlayer if (Player.lifeRegenCount > 0) Player.lifeRegenCount = 0; - //Hard-lock the player's health to 50%. + //Hard-lock the player's health to a certain ratio. //No lifesteal, no regen, no healing pots - if (Player.statLife >= (int)(Player.statLifeMax2 * 0.5f)) + if (Player.statLife >= (int)(Player.statLifeMax2 * Regenerator.HealthRatioCap)) { - Player.statLife = (int)(Player.statLifeMax2 * 0.5f); + Player.statLife = (int)(Player.statLifeMax2 * Regenerator.HealthRatioCap); Player.moonLeech = true; healingPotionMultiplier = 0; } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index f5743206d3..f13aad2cdd 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -17,12 +17,17 @@ using CalamityMod.ExtraTextures; using CalamityMod.Items; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Armor.Aerospec; +using CalamityMod.Items.Armor.Auric; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.Brimflame; using CalamityMod.Items.Armor.DesertProwler; +using CalamityMod.Items.Armor.Empyrean; +using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Hydrothermic; using CalamityMod.Items.Armor.LunicCorps; using CalamityMod.Items.Armor.OmegaBlue; +using CalamityMod.Items.Armor.PlagueReaper; using CalamityMod.Items.Armor.Prismatic; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Armor.Silva; @@ -161,6 +166,9 @@ namespace CalamityMod.CalPlayer // Drawing parameters UpdateDrawingParameters(); + // Handle Lucrecia's passive energy effects + HandleLucreciaEffects(); + // Update all particle sets for items. // This must be done here instead of in the item logic because these sets are not properly instanced // in the global classes. Attempting to update them there will cause multiple updates to one set for multiple items. @@ -201,12 +209,12 @@ namespace CalamityMod.CalPlayer rage = 0f; } - if (furyFuel < furyFuelMax && furyRefuelTimer >= 0) + if (furyFuel < FuryFuelMax && furyRefuelTimer >= 0) { furyFuel += (int)furyRefuelTimer; furyRefuelTimer = MathHelper.Lerp(furyRefuelTimer, 25, 0.01f); - if (furyFuel > furyFuelMax) - furyFuel = furyFuelMax; + if (furyFuel > FuryFuelMax) + furyFuel = FuryFuelMax; } else if (furyRefuelTimer < 0) furyRefuelTimer++; @@ -221,11 +229,6 @@ namespace CalamityMod.CalPlayer // Apply stealth damage to rogue. Player.GetDamage() += stealthDamage; - //Slow the player down after any other speed modifiers might have been applied. - //Todo - Move this back to the wulfrum set class whenever statmodifiers are implemented for stats other than damage - if (WulfrumHat.PowerModeEngaged(Player, out _)) - Player.moveSpeed *= 0.8f; - if ((XykVisualsBlue || XykVisualsOrange)) { bool Orange = XykVisualsOrange; @@ -254,16 +257,25 @@ namespace CalamityMod.CalPlayer foreach (Projectile p in Main.ActiveProjectiles) if (p.type == ModContent.ProjectileType() && p.owner == Player.whoAmI && p.ai[1] == 0) numOfActiveWings++; - bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && !(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0; + bool spawnWings = numOfActiveWings < maxWingPieces && !Player.dead && Player.wingsLogic > 0 && ((!(Player.wingTime == Player.wingTimeMax && Player.velocity.Y == 0) && Player.wingTime > 0) || XykWingTimer >= 3); if (spawnWings) { - int wingCount = numOfActiveWings; - Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (XykWingTimer >= 3) + { + int wingCount = numOfActiveWings; + Projectile wings = Projectile.NewProjectileDirect(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Player.whoAmI, wingCount); + if (numOfActiveWings + 1 == maxWingPieces) + XykWingTimer = 0; + } + else + XykWingTimer++; } + else + XykWingTimer = 0; } // First Frame dash effects - bool dashStart = (Player.dashDelay == -1 && IsFirstDashFrame); + bool dashStart = (Player.dashDelay == -1 && ((!HasCustomDash && IsFirstDashFrame) || (HasCustomDash && UsedDash.DashTimeAdjustedForStartup == 1))); int dir = MathF.Sign(Player.velocity.X); if (dashStart) @@ -285,24 +297,18 @@ namespace CalamityMod.CalPlayer { if (dashStart) { - Player.velocity.X *= 3.5f; + Player.velocity.X *= 2f; lastDashWasTabi = true; } if (Player.dashDelay == -1) { - Player.velocity.X *= 0.9f; + Player.velocity.X *= 0.95f; + if (Player.timeSinceLastDashStarted > 12) + { + Player.velocity.X *= 0.75f; + } } } - - if (Player.Calamity().statisNinjaBelt) - { - Player.Calamity().DashID = StatisNinjaBeltDash.ID; - } - if (Player.Calamity().statisVoidSash) - { - Player.Calamity().DashID = StatisVoidSashDash.ID; - } - if ((devilsDevastationKillMode || exaltedKillMode) && !Player.mount.Active) { float fxScale = 1; @@ -368,6 +374,51 @@ namespace CalamityMod.CalPlayer Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3()); } + if (Player.HeldItem.type == ModContent.ItemType() && lucreciaEnergy > 0) + { + if (lucreciaEnergy == Lucrecia.MaxEnergy && !lucreciaEnergyPaused) + { + lucreciaEnergyPaused = true; + lucreciaEnergyTimer = 0; + } + + lucreciaEnergyTimer++; + + // If the energy is at max, pause for 180 ticks + if (lucreciaEnergyPaused) + { + if (lucreciaEnergyTimer >= 1 && !lucreciaEnergyMaxSFXPlayed) + { + SoundEngine.PlaySound(SoundID.Item79 with { Volume = 1.6f, Pitch = 0.4f }, Player.Center); + lucreciaEnergyMaxSFXPlayed = true; + + } + // If the pause is Done, resume decrementing. + if (lucreciaEnergyTimer >= 180) + { + lucreciaEnergyPaused = false; + lucreciaEnergyTimer = 0; + lucreciaEnergy--; + } + } + else // Decrementing + { + lucreciaEnergyMaxSFXPlayed = false; + // Once every 8 ticks + if (lucreciaEnergyTimer >= 8) + { + lucreciaEnergy--; + lucreciaEnergyTimer = 0; + } + } + } + else + { + // Reset the timer and pause state if the player isn't holding the weapon. + lucreciaEnergyTimer = 0; + lucreciaEnergyPaused = false; + } + if (lAmbergris) { if (dashStart) @@ -380,7 +431,7 @@ namespace CalamityMod.CalPlayer if (Player.miscCounter % 3 == 2 && Player.dashDelay > 0) // Reduced dash cooldown by 33% Player.dashDelay--; - if (Player.dashDelay == -1) + if (Player.dashDelay == -1 && !(HasCustomDash && UsedDash.DashTimeAdjustedForStartup < 1)) Player.velocity.X *= 0.9f; } @@ -393,7 +444,10 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center + Player.velocity * 1.5f, Vector2.Zero, ModContent.ProjectileType(), damage, 0, Player.whoAmI); } if (Player.dashDelay == -1) + { Player.endurance += 0.1f; + Player.noKnockback = true; + } } @@ -477,13 +531,17 @@ namespace CalamityMod.CalPlayer IsFirstDashFrame = false; else IsFirstDashFrame = true; - + // THIS MUST BE NEAR THE END OF PostUpdateMiscEffects SO ALL OTHER RUN SPEED IS DONE FIRST. DO NOT PUT ANY RUN SPEED AFTER THIS - + // Multiplies movement speed by 1.5x so that you don't feel like a snail in the early game. // This applies to movement speed boosts as well as base speed to ensure they are actually worth their listed value compared to base speed + // // Disabled while Overhaul is enabled, because Overhaul does very similar things to make movement more snappy - if (ExternalMods.overhaul is null && CalamityServerConfig.Instance.FasterBaseSpeed) + // 22JUN2025: Ozzatron: Disabled while Remnants is enabled, because Remnants has its own move speed reworks. + + bool ignoreSpeedConfig = ExternalMods.overhaul is not null || ExternalMods.remnants is not null; + if (!ignoreSpeedConfig && CalamityServerConfig.Instance.FasterBaseSpeed) Player.moveSpeed *= BalancingConstants.DefaultMoveSpeedBoost; // This is used to increase horizontal velocity based on the player's movement speed stat. @@ -504,8 +562,8 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int hasBuff = Player.buffType[l]; - if (Player.buffTime[l] > 360 && hasBuff == BuffID.ShadowDodge) - Player.buffTime[l] = 360; + if (Player.buffTime[l] > 600 && hasBuff == BuffID.ShadowDodge) + Player.buffTime[l] = 600; } } @@ -575,6 +633,22 @@ namespace CalamityMod.CalPlayer if (heldGaelsLastFrame) rageDiff += rageMax * GaelsGreatsword.RagePerSecond / 60f; + float rate = Main.GlobalTimeWrappedHourly * 29; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + lightRGB = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + // Calculate and grant proximity rage. // Regular enemies can give up to 1x proximity rage. Bosses can give up to 3x. Multiple regular enemies don't stack. // Proximity rage is maxed out when within 10 blocks (160 pixels) of the enemy's hitbox. @@ -605,7 +679,7 @@ namespace CalamityMod.CalPlayer // If they're a boss, reduce the boss distance. // Boss distance will always be >= enemy distance, so there's no need to do another check. // Worm boss body and tail segments are not counted as bosses for this calculation. - if (npc.IsABoss() && !NoRageWormSegmentList.Includes(npc.type)) + if (npc.IsABoss() && !CalamityNPCSets.BossSegmentThatDoesNotGenerateRageFaster[npc.type]) bossDistance = hitboxEdgeDist; } } @@ -892,8 +966,11 @@ namespace CalamityMod.CalPlayer if (target.Calamity().cursorFocus >= CalamityGlobalNPC.cursorFocusMax) { - target.Calamity().trueVulnerabilityHex = target.Calamity().vulnerabilityHex >= 300 ? target.Calamity().vulnerabilityHex : 300; - target.Calamity().vulnerabilityHex = 0; + int vHexDuration = 0; + if (target.HasBuff()) + vHexDuration = target.buffTime[target.FindBuffIndex(ModContent.BuffType())]; + target.AddBuff(ModContent.BuffType(),vHexDuration <= 300 ? vHexDuration : 300); + target.RequestBuffRemoval(ModContent.BuffType()); SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/WeaponEnchant"), target.Center); for (int i = 0; i < 18; i++) @@ -918,15 +995,19 @@ namespace CalamityMod.CalPlayer // Create a direct strike to hit this specific NPC. var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, target.whoAmI); + Projectile sigilStrike = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), sigilDamage, 0f, Player.whoAmI, target.whoAmI, 255f); // Enable crits by setting the sigil's damage class to be whatever the player's strongest damage class is. sigilStrike.DamageType = Player.GetBestClass(); // Incinerate the target with either Vulnerability Hex or True Vulnerability Hex, depending on current cursor focus. // This adds 8 to the buff duration, which results in a net increase of 3 frames every time damage is dealt, due to damage occurring every 5 frames. - int buffToInflict = target.Calamity().trueVulnerabilityHex > 0 ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffToInflict, target.Calamity().trueVulnerabilityHex > 0 ? target.Calamity().trueVulnerabilityHex + 8 : target.Calamity().vulnerabilityHex < VulnerabilityHex.CalamityDuration ? VulnerabilityHex.CalamityDuration : target.Calamity().vulnerabilityHex + 8); + int buffToInflict = target.Calamity().trueVulnerabilityHex? ModContent.BuffType() : ModContent.BuffType(); + if (!target.HasBuff(buffToInflict)) + target.AddBuff(buffToInflict, 52); + target.buffTime[target.FindBuffIndex(buffToInflict)] += 8; + if (target.buffTime[target.FindBuffIndex(buffToInflict)] < VulnerabilityHex.CalamityDuration) + target.buffTime[target.FindBuffIndex(buffToInflict)] = VulnerabilityHex.CalamityDuration; // Make some fancy dust to indicate damage is being done. for (int j = 0; j < 12; j++) @@ -943,6 +1024,14 @@ namespace CalamityMod.CalPlayer private void MiscEffects() { + //Mana Burn update + if (ManaBurnFireDrawer != null) + { + ManaBurnFireDrawer.LocalTimer = 0; + ManaBurnFireDrawer.RelativePower = MathHelper.Lerp(0.25f, 0.5f, -Player.statMana / (float)Player.statManaMax2); + ManaBurnFireDrawer.Update(); + } + // Update textures if (!Main.dedServ && Player.whoAmI == Main.myPlayer) { @@ -1099,34 +1188,11 @@ namespace CalamityMod.CalPlayer } } - // Life Steal nerf in difficulties above Expert - // Reduces the max possible life steal before the cooldown occurs (this mostly just nerfs how much life steal the player can get in bursts) - // Master Mode nerfs this by an additional 10 - float lifeStealCap = - CalamityWorld.death ? BalancingConstants.LifeStealCap_Death : - CalamityWorld.revenge ? BalancingConstants.LifeStealCap_Revengeance : - Main.expertMode ? BalancingConstants.LifeStealCap_Expert : - BalancingConstants.LifeStealCap_Classic; - - if (Main.masterMode) - lifeStealCap -= BalancingConstants.LifeStealCapReduction_Master; - - if (Player.lifeSteal > lifeStealCap) - Player.lifeSteal = lifeStealCap; - - // Normal Mode life steal recovery rate is 0.2/s - // Expert Mode life steal recovery rate is 0.15/s - // Revengeance Mode life steal recovery rate is 0.125/s - // Death Mode life steal recovery rate is 0.1/s - // Master Mode life steal recovery rate is nerfed by an additional 0.05/s - float lifeStealRecoveryRateReduction = - CalamityWorld.death ? BalancingConstants.LifeStealRecoveryRateReduction_Death : - CalamityWorld.revenge ? BalancingConstants.LifeStealRecoveryRateReduction_Revengeance : - Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : - BalancingConstants.LifeStealRecoveryRateReduction_Classic; - - if (Main.masterMode) - lifeStealRecoveryRateReduction += BalancingConstants.LifeStealRecoveryRateReduction_Master; + // Reduce the rate of recovery of the Lifesteal variable + // Classic Mode: 36 HP/s to 12 HP/s + // Expert Mode: 30 HP/s to 9 HP/s + float lifeStealRecoveryRateReduction = Main.expertMode ? BalancingConstants.LifeStealRecoveryRateReduction_Expert : BalancingConstants.LifeStealRecoveryRateReduction_Classic; + float lifeStealCap = Main.expertMode ? BalancingConstants.LifeStealCap_Expert : BalancingConstants.LifeStealCap_Classic; if (Player.lifeSteal < lifeStealCap) Player.lifeSteal -= lifeStealRecoveryRateReduction; @@ -1143,7 +1209,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = Player.buffType[l]; - if (Player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) + if (Player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) Player.buffTime[l]--; } } @@ -1157,7 +1223,7 @@ namespace CalamityMod.CalPlayer ProvidenceBurnEffectDrawer.ParticleSpawnRate = int.MaxValue; // If the player has holy inferno, cause the player to ignite into flames. - if (hInferno) + if (holyInferno) ProvidenceBurnEffectDrawer.ParticleSpawnRate = 1; // Otherwise, if the intensity is too weak, but still present, cause the player to release holy cinders. @@ -1178,11 +1244,11 @@ namespace CalamityMod.CalPlayer } ProvidenceBurnEffectDrawer.Update(); - if (hInferno && holyInfernoFadeIntensity < 1f) + if (holyInferno && holyInfernoFadeIntensity < 1f) { holyInfernoFadeIntensity = MathHelper.Clamp(holyInfernoFadeIntensity + 0.015f, 0f, 1f); } - else if (!hInferno && holyInfernoFadeIntensity > 0f) + else if (!holyInferno && holyInfernoFadeIntensity > 0f) { holyInfernoFadeIntensity = MathHelper.Clamp(holyInfernoFadeIntensity - 0.01f, 0f, 1f); } @@ -1204,7 +1270,7 @@ namespace CalamityMod.CalPlayer Player.AddBuff(ModContent.BuffType(), 2, false); } } - if (iCantBreathe) + if (frozenLungs) { if (Player.breath > 0 && Player.miscCounter % 2 == 0) Player.breath--; @@ -1293,21 +1359,17 @@ namespace CalamityMod.CalPlayer { if (!Player.wet) { - if (cirrusDress) - Player.maxFallSpeed = 12f; if (aeroSet) - Player.maxFallSpeed = 15f; + Player.maxFallSpeed = AerospecBreastplate.SetBonusFallSpeed; if (Player.PortalPhysicsEnabled) Player.maxFallSpeed = 20f; } - if (Player.controlDown && !Player.controlJump && ironBoots) + if (Player.controlDown && !Player.controlJump && (ironBoots || gSabaton) && !gSabatonFalling) { - Player.maxFallSpeed = 23f; // This is slightly faster than slimy saddle (so it can be viable) + Player.maxFallSpeed *= 2; //This ties Slimy Saddle. It is made viable by also allowing the player to move horizontal, unlike Saddle, and curbing existing vertical speed very fast if (Player.gravDir == 1 ? Player.velocity.Y <= 0 : Player.velocity.Y >= 0) Player.velocity.Y *= 0.7f; - else if (Player.gravDir == 1 ? Player.velocity.Y < Player.maxFallSpeed : Player.velocity.Y > Player.maxFallSpeed) - Player.velocity.Y = MathHelper.Lerp(Player.velocity.Y, Player.maxFallSpeed, 0.1f); } if (LungingDown) @@ -1328,10 +1390,6 @@ namespace CalamityMod.CalPlayer if (holdingDown && Player.ControlsEnabled() && notInLiquid && notOnRope && notGrappling && airborne && !Player.Calamity().gSabatonFalling) //Player cannot further increase their ridiculous gravity during a Gravistar Slam { Player.velocity.Y += Player.gravity * Player.gravDir * (BalancingConstants.HoldingDownGravityMultiplier - 1f); - if (Player.Calamity().gSabaton && !Player.gravControl2) - { - Player.maxFallSpeed *= 1.5f; - } if (Player.velocity.Y * Player.gravDir > Player.maxFallSpeed) Player.velocity.Y = Player.maxFallSpeed * Player.gravDir; } @@ -1436,7 +1494,7 @@ namespace CalamityMod.CalPlayer { if (!tentaclesPresent[i]) { - int damage = (int)Player.GetBestClassDamage().ApplyTo(350); + int damage = (int)Player.GetBestClassDamage().ApplyTo(OmegaBlueHelmet.TentacleDamage); var source = Player.GetSource_FromThis(OmegaBlueHelmet.TentacleEntitySourceContext); Vector2 vel = new Vector2(Main.rand.Next(-13, 14), Main.rand.Next(-13, 14)) * 0.25f; @@ -1445,15 +1503,11 @@ namespace CalamityMod.CalPlayer } } - float damageUp = 0.1f; - int critUp = 10; if (omegaBlueAbyssalMadness) { - damageUp += 0.1f; - critUp += 10; + Player.GetDamage() += OmegaBlueHelmet.MadnessDamageBoost; + Player.GetCritChance() += OmegaBlueHelmet.MadnessCritBoost; } - Player.GetDamage() += damageUp; - Player.GetCritChance() += critUp; } // Rain armor set effects @@ -1533,11 +1587,9 @@ namespace CalamityMod.CalPlayer // The fire boots debuff boosts if (hellfireTreads) - bootLevel = 2; + HeatDebuffMultiplier += 0.5f; else if (flameWakerBoots) - bootLevel = 1; - else - bootLevel = 0; + HeatDebuffMultiplier += 0.25f; if (rOfResilienceEffect > 0) rOfResilienceEffect--; @@ -1809,7 +1861,7 @@ namespace CalamityMod.CalPlayer { if (dOfTheDeepDefenseBuffTimer > 0) { - int maxDefense = 15; + int maxDefense = 10; int givenDefense = (int)Utils.Remap(dOfTheDeepDefenseBuffTimer, 0, dOfTheDeepDefenseBuffMax * 0.5f, 0, maxDefense); Player.statDefense += givenDefense; dOfTheDeepDefenseBuffTimer--; @@ -1875,6 +1927,41 @@ namespace CalamityMod.CalPlayer dOfTheDeepTimer++; } } + if (hookPullVisuals > 0) + { + if (bloomStone && Player.Calamity().bloomStoneHookVisuals) // Visual flowers while being pulled + { + Vector2 spawnPos = Player.Center + Main.rand.NextVector2Circular(20f, 20f); + float fade = (float)Math.Pow(Utils.GetLerpValue(0, 30, hookPullVisuals, true), 2); + + Particle trail = new CustomSpark(Player.Center, -Player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5f, 8f), + "CalamityMod/Particles/BloomCircle", false, Main.rand.Next(7, 10 + 1), 0.65f, + Color.Lerp(Color.HotPink, Color.Gold, Utils.GetLerpValue(60, 30, hookPullVisuals, true)) * 0.75f * fade, new Vector2(1f, 0.7f), true, shrinkSpeed: 0.6f); + GeneralParticleHandler.SpawnParticle(trail); + + if (Main.rand.NextBool(3)) + { + Particle floweyFromHitGameUndertale = new CustomSpark(spawnPos, -Player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(5f, 8f), + "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(25, 28 + 1), Main.rand.NextFloat(2.3f, 2.6f) * fade, + Color.Lerp(Color.HotPink, Color.Plum, Main.rand.NextFloat(0, 0.65f)), new Vector2(1f, 1f), true, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(floweyFromHitGameUndertale); + } + if (Main.rand.NextBool()) + { + Dust pollenDust = Dust.NewDustPerfect(Player.Center + Main.rand.NextVector2Circular(20f, 20f), ModContent.DustType()); + pollenDust.noLightEmittence = true; + pollenDust.noGravity = true; + pollenDust.scale = Main.rand.NextFloat(0.9f, 1.4f); + pollenDust.color = Color.Lerp(Color.Gold, Color.HotPink, Utils.GetLerpValue(60, 30, hookPullVisuals, true)); + pollenDust.velocity = -Player.velocity.SafeNormalize(Vector2.UnitX) * Main.rand.NextFloat(2f, 5f); + pollenDust.fadeIn = -0.5f * fade; + } + } + + hookPullVisuals--; + if (Player.velocity.Length() < 6) + hookPullVisuals = 0; + } if (unstableGraniteCore) { @@ -1996,7 +2083,7 @@ namespace CalamityMod.CalPlayer SyncCooldownRemoval(Main.dedServ, expiredCooldowns); // Grant the player 5 seconds of immunity to immobilizing debuffs after an immobilizing debuff wears off. - if (Player.stoned || Player.frozen || Player.webbed || gState) + if (Player.stoned || Player.frozen || Player.webbed) { ImmobilityDebuffImmunityTimer = ImmobilityDebuffImmunityTimerMax; } @@ -2006,7 +2093,6 @@ namespace CalamityMod.CalPlayer Player.buffImmune[BuffID.Stoned] = true; Player.buffImmune[BuffID.Frozen] = true; Player.buffImmune[BuffID.Webbed] = true; - Player.buffImmune[ModContent.BuffType()] = true; } if (arsenalCooldown > 0) @@ -2031,14 +2117,14 @@ namespace CalamityMod.CalPlayer --fullRageSoundCountdownTimer; if (plagueTaintedSMGDroneCooldown > 0) plagueTaintedSMGDroneCooldown--; + if (flareGunOverheat > 0) + flareGunOverheat--; if (momentumCapacitorTime > 0) --momentumCapacitorTime; if (phantomicHeartRegen > 0 && phantomicHeartRegen < 1000) phantomicHeartRegen--; if (phantomicBulwarkCooldown > 0) phantomicBulwarkCooldown--; - if (KameiBladeUseDelay > 0) - KameiBladeUseDelay--; if (galileoCooldown > 0) galileoCooldown--; if (gladiatorTimer > 0) @@ -2080,15 +2166,27 @@ namespace CalamityMod.CalPlayer if (theBeeCooldown > 0) theBeeCooldown--; - if (bloomStoneHealTimer > 0) + if (bloomStoneTotalHeal > 0) { - if (bloomStone && bloomStoneHealTimer % 40 == 0) + float healRateDiv = (Player.statLife >= Player.statLifeMax ? 5 : // 5 times as slow if at max hp already (overheal prevention) + bloomStoneBuffedHealRateTimer > 0 ? Utils.Remap(bloomStoneBuffedHealRateTimer, 90, 0, 0.5f, 1f, true) // 2 times faster if pollen buffed, scales back down to regular speed as the buff fades + : 1); // Regular speed + bloomStoneHealRate = 1 / healRateDiv; + + if (!bloomStone) // If you take it off, all your healing is instantly gone + bloomStoneTotalHeal = 0; + + float secondsOfHealing = 16; // Number of seconds healing occurs over at base, this can be met slower or faster depending on heal rate + if (bloomStoneHealTimer >= 60) // heal the player a portion of their potion every second { - Player.HealPlayer(Math.Min(bloomStoneHealInc, bloomStoneTotalHeal)); + int healAmount = (int)(Math.Max(Math.Min(bloomStoneHealPool, (int)(bloomStoneTotalHeal / secondsOfHealing)), 1)); + Player.HealPlayer(healAmount); + bloomStoneHealPool -= healAmount; // Subtract the amount healed from the pool until it's empty + // Special specifically programmed interaction with Chalice of the Blood God: Healing over time clears bits of the bleedout buffer. if (chaliceOfTheBloodGod && chaliceBleedoutBuffer > 0D) { - float amountOfBleedToClear = ChaliceOfTheBloodGod.HealingPotionRatioForBufferClear * bloomStoneHealInc; + float amountOfBleedToClear = ChaliceOfTheBloodGod.HealingPotionRatioForBufferClear * healAmount; chaliceBleedoutBuffer -= amountOfBleedToClear; // Display text indicating that healing was applied to the bleedout buffer. if (!Main.dedServ) @@ -2099,22 +2197,16 @@ namespace CalamityMod.CalPlayer } } - bloomStoneTotalHeal -= bloomStoneHealInc; - if (bloomStoneTotalHeal < 0) + if (bloomStoneHealPool == 0) // When you're out of healing, reset values + { bloomStoneTotalHeal = 0; + } + bloomStoneHealTimer = 0; } - bloomStoneHealTimer--; - } - else - { - bloomStoneTotalHeal = 0; - bloomStoneHealInc = 0; - } - if (bloomStoneDR > 0) - { - Player.endurance += bloomStoneHealTimer > 0 ? 0.12f : 0.06f; - bloomStoneDR--; + bloomStoneHealTimer += bloomStoneHealRate; } + if (bloomStoneBuffedHealRateTimer > 0) + bloomStoneBuffedHealRateTimer--; if (summonProjCooldown > 0f) summonProjCooldown -= 1f; @@ -2140,13 +2232,6 @@ namespace CalamityMod.CalPlayer if (vortexBoosterStealthDelay == 1 && Player.setVortex) Player.vortexStealthActive = true; } - if (statisPenaltyTimer > 0) - statisPenaltyTimer--; - if (statisPenaltyTimer == 0 && statisAnticheese > 0) - { - statisAnticheese--; - statisPenaltyTimer = statisTimerMax; - } if (hallowedRuneCooldown > 0) hallowedRuneCooldown--; if (sulphurBubbleCooldown > 0) @@ -2200,21 +2285,17 @@ namespace CalamityMod.CalPlayer } } } - if (Player.miscCounter % 20 == 0) + if (Player.miscCounter % HydrothermicHeadRanged.FlareCooldown == 0) canFireAtaxiaRangedProjectile = true; - if (Player.miscCounter % 100 == 0) - canFireBloodflareMageProjectile = true; - if (Player.miscCounter % 120 == 0) + if (Player.miscCounter % HydrothermicHeadRogue.VolleyCooldown == 0) canFireAtaxiaRogueProjectile = true; - if (Player.miscCounter % 150 == 0) - { - canFireGodSlayerRangedProjectile = true; + if (Player.miscCounter % BloodflareHeadMagic.GhostBoltCooldown == 0) + canFireBloodflareMageProjectile = true; + if (Player.miscCounter % BloodflareHeadRanged.BloodBombCooldown == 0) canFireBloodflareRangedProjectile = true; - } - if (reaverRegenCooldown < 60 && reaverRegen) - reaverRegenCooldown++; - else - reaverRegenCooldown = 0; + if (Player.miscCounter % GodSlayerHeadRanged.ShrapnelRoundCooldown == 0) + canFireGodSlayerRangedProjectile = true; + if (auralisAurora > 0) auralisAurora--; if (auralisAuroraCooldown > 0) @@ -2297,16 +2378,16 @@ namespace CalamityMod.CalPlayer if (miningSetCooldown > 0) miningSetCooldown--; - if (RustyMedallionCooldown > 0) - RustyMedallionCooldown--; if (MiniSwarmerCooldown > 0) MiniSwarmerCooldown--; // God Slayer Armor dash debuff immunity if (LastUsedDashID == GodslayerArmorDash.ID && Player.dashDelay < 0) { - foreach (int debuff in DebuffsList.List) - Player.buffImmune[debuff] = true; + for (int d = 0; d < Player.buffImmune.Length; d++) + { + Player.buffImmune[d] |= CalamityBuffSets.IsDebuff[d]; + } } // Shield of the High Ruler @@ -2377,8 +2458,11 @@ namespace CalamityMod.CalPlayer if (silvaCountdown > 0 && hasSilvaEffect && silvaSet) { // You become immune to all debuffs - foreach (int debuff in DebuffsList.List) - Player.buffImmune[debuff] = true; + foreach (int debuff in Player.buffType) + { + if (CalamityBuffSets.IsDebuff[debuff]) + Player.buffImmune[debuff] = true; + } // Prevent thorns effects from being abused during invincibility Player.thorns = 0f; @@ -2386,8 +2470,8 @@ namespace CalamityMod.CalPlayer silvaCountdown -= 1; if (silvaCountdown <= 0) { - SoundEngine.PlaySound(SilvaHeadSummon.DispelSound, Player.Center); - Player.AddCooldown(SilvaRevive.ID, CalamityUtils.SecondsToFrames(5 * 60)); + SoundEngine.PlaySound(SilvaArmor.DispelSound, Player.Center); + Player.AddCooldown(SilvaRevive.ID, SilvaArmor.ReviveCooldown); } for (int j = 0; j < 2; j++) @@ -2405,7 +2489,7 @@ namespace CalamityMod.CalPlayer } if (!Player.HasCooldown(SilvaRevive.ID) && hasSilvaEffect && silvaCountdown <= 0 && !areThereAnyDamnBosses && !areThereAnyDamnEvents) { - silvaCountdown = 480; + silvaCountdown = SilvaArmor.ReviveDuration; hasSilvaEffect = false; } @@ -2417,7 +2501,7 @@ namespace CalamityMod.CalPlayer { tarraDefenseTime = 600; if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.TarragonCloak.ID, TarragonHeadMelee.CloakCooldown); } for (int j = 0; j < 2; j++) @@ -2443,11 +2527,11 @@ namespace CalamityMod.CalPlayer if (tarragonImmunity && !disableAllDodges) Player.GiveUniversalIFrames(2, true); - if (tarraThrowingCrits >= 50) + if (tarraThrowingCrits >= TarragonHeadRogue.CritsToActivateImmunity) { tarraThrowingCrits = 0; if (Player.whoAmI == Main.myPlayer && !disableAllDodges) - Player.AddBuff(ModContent.BuffType(), 150, false); + Player.AddBuff(ModContent.BuffType(), TarragonHeadRogue.ImmunityDuration, false); } for (int l = 0; l < Player.MaxBuffs; l++) @@ -2455,11 +2539,10 @@ namespace CalamityMod.CalPlayer int buffID = Player.buffType[l]; if (Player.buffTime[l] <= 2 && buffID == ModContent.BuffType()) if (Player.whoAmI == Main.myPlayer) - Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); + Player.AddCooldown(Cooldowns.TarragonImmunity.ID, TarragonHeadRogue.ImmunityCooldown); - bool shouldAffect = DebuffsList.Includes(buffID); - if (shouldAffect) - Player.GetDamage() += 0.1f; + if (CalamityBuffSets.IsDebuff[buffID]) + Player.GetDamage() += TarragonHeadRogue.RogueDamageBoostWhileDebuffed; } } @@ -2477,7 +2560,7 @@ namespace CalamityMod.CalPlayer { bloodflareMeleeHits = 0; if (Player.whoAmI == Main.myPlayer) - Player.AddBuff(ModContent.BuffType(), 302, false); + Player.AddBuff(ModContent.BuffType(), BloodflareHeadMelee.FrenzyDuration, false); } if (bloodflareFrenzy) @@ -2486,11 +2569,11 @@ namespace CalamityMod.CalPlayer { int hasBuff = Player.buffType[l]; if (Player.buffTime[l] <= 2 && hasBuff == ModContent.BuffType() && Player.whoAmI == Main.myPlayer) - Player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(BloodflareFrenzy.ID, BloodflareHeadMelee.FrenzyCooldown); } - Player.GetCritChance() += 25; - Player.GetDamage() += 0.25f; + Player.GetCritChance() += BloodflareHeadMelee.FrenzyMeleeCritBoost; + Player.GetDamage() += BloodflareHeadMelee.FrenzyMeleeDamageBoost; for (int j = 0; j < 2; j++) { @@ -2507,15 +2590,23 @@ namespace CalamityMod.CalPlayer } } + if (brimflameFrenzy) + { + Player.GetDamage() += BrimflameCowl.FrenzyMagicDamageBoost; + + for (int l = 0; l < Player.MaxBuffs; l++) + { + if (Player.buffTime[l] <= 2 && Player.buffType[l] == ModContent.BuffType() && Player.whoAmI == Main.myPlayer) + Player.AddCooldown(BrimflameFrenzy.ID, BrimflameCowl.FrenzyCooldown); + } + } + // Raider Talisman bonus if (raiderTalisman && !vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) Player.GetCritChance() += RaidersTalisman.RaiderBonus; if (vampiricTalisman && !StealthStrikeAvailable() && raiderCritLifespan > 0f) Player.GetCritChance() += VampiricTalisman.RaiderBonus; - if (kamiBoost) - Player.GetDamage() += YanmeisKnife.DamageBoost; - if (avertorBonus) Player.GetDamage() += 0.1f; @@ -2529,7 +2620,7 @@ namespace CalamityMod.CalPlayer if (Player.isNearFairy()) { Player.lifeRegen += 4; - Player.statDefense += 10; + Player.statDefense += 6; Player.moveSpeed += 0.1f; } } @@ -2539,7 +2630,6 @@ namespace CalamityMod.CalPlayer { Player.moveSpeed += TheAbsorber.MoveSpeedBoost; Player.jumpSpeedBoost += TheAbsorber.JumpSpeedBoost; - Player.thorns += TheAbsorber.ThornsBoost; } // Nimble Bounder bonus @@ -2553,7 +2643,7 @@ namespace CalamityMod.CalPlayer if (affliction || afflicted) { Player.endurance += 0.07f; - Player.statDefense += 13; + Player.statDefense += 9; Player.GetDamage() += 0.1f; } @@ -2593,7 +2683,7 @@ namespace CalamityMod.CalPlayer // Permafrost's Concoction bonuses/debuffs if (permafrostsConcoction) { - Player.manaCost *= 0.85f; + Player.manaCost -= 0.15f; Player.statManaMax2 += 50; } @@ -2610,7 +2700,6 @@ namespace CalamityMod.CalPlayer Player.buffImmune[BuffID.Frozen] = true; Player.buffImmune[BuffID.Chilled] = true; - Player.buffImmune[ModContent.BuffType()] = true; } // Cosmic Discharge Cosmic Freeze buff, gives surrounding enemies the Glacial State debuff @@ -2723,23 +2812,19 @@ namespace CalamityMod.CalPlayer // Plagued Fuel Pack and Blunder Booster effects if (jetPackDash > 0 && Player.whoAmI == Main.myPlayer) { - int velocityAmt = blunderBooster ? 35 : 25; - int velocityMult = jetPackDash > 1 ? velocityAmt : 5; - Player.velocity = new Vector2(jetPackDirection, -1) * velocityMult; + int velocityMult = (int)((blunderBooster ? 35 : 25) * Utils.GetLerpValue(-4, 5, jetPackDash, true)); + Player.velocity = new Vector2(jetPackDirection, -1f) * velocityMult; if (blunderBooster) { - int lightningCount = Main.rand.Next(5, 7); + int lightningCount = 4; var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int i = 0; i < lightningCount; i++) { - Vector2 lightningVel = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - lightningVel.Normalize(); - lightningVel *= Main.rand.NextFloat(1f, 2f); - int damage = (int)Player.GetTotalDamage().ApplyTo(30); + Vector2 lightningVel = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(7f, 10f); + int damage = (int)Player.GetTotalDamage().ApplyTo(35); int projectile = Projectile.NewProjectile(source, Player.Center, lightningVel, ModContent.ProjectileType(), damage, 0, Player.whoAmI, Main.rand.Next(2), 0f); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].DamageType = DamageClass.Generic; } @@ -2754,17 +2839,14 @@ namespace CalamityMod.CalPlayer } else if (plaguedFuelPack) { - int numClouds = Main.rand.Next(8, 10); + int numClouds = 3; var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); for (int i = 0; i < numClouds; i++) { - Vector2 cloudVelocity = new Vector2(Main.rand.NextFloat(-1, 1), Main.rand.NextFloat(-1, 1)); - cloudVelocity.Normalize(); - cloudVelocity *= Main.rand.NextFloat(0f, 1f); - int damage = (int)Player.GetTotalDamage().ApplyTo(20); + Vector2 cloudVelocity = Player.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.3f) * Main.rand.NextFloat(5f, 7f); + int damage = (int)Player.GetTotalDamage().ApplyTo(30); int projectile = Projectile.NewProjectile(source, Player.Center, cloudVelocity, ModContent.ProjectileType(), damage, 0, Player.whoAmI, 0, 0); - Main.projectile[projectile].timeLeft = Main.rand.Next(180, 240); if (projectile.WithinBounds(Main.maxProjectiles)) Main.projectile[projectile].DamageType = DamageClass.Generic; } @@ -2791,32 +2873,32 @@ namespace CalamityMod.CalPlayer { brimflameFrenzy = false; Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(BrimflameFrenzy.ID, BrimflameScowl.CooldownLength); + Player.AddCooldown(BrimflameFrenzy.ID, BrimflameCowl.FrenzyCooldown); } if (!bloodflareMelee && bloodflareFrenzy) { bloodflareFrenzy = false; Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(BloodflareFrenzy.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(BloodflareFrenzy.ID, BloodflareHeadMelee.FrenzyCooldown); } if (!tarraMelee && tarragonCloak) { tarragonCloak = false; Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(Cooldowns.TarragonCloak.ID, CalamityUtils.SecondsToFrames(30)); + Player.AddCooldown(Cooldowns.TarragonCloak.ID, TarragonHeadMelee.CloakCooldown); } if (!tarraThrowing && tarragonImmunity) { tarragonImmunity = false; Player.ClearBuff(ModContent.BuffType()); - Player.AddCooldown(Cooldowns.TarragonImmunity.ID, CalamityUtils.SecondsToFrames(25)); + Player.AddCooldown(Cooldowns.TarragonImmunity.ID, TarragonHeadRogue.ImmunityCooldown); } bool hasOmegaBlueCooldown = cooldowns.TryGetValue(OmegaBlue.ID, out CooldownInstance omegaBlueCD); - if (!omegaBlueSet && hasOmegaBlueCooldown && omegaBlueCD.timeLeft > 1500) + if (!omegaBlueSet && hasOmegaBlueCooldown && omegaBlueCD.timeLeft > OmegaBlueHelmet.MadnessCooldown) { Player.ClearBuff(ModContent.BuffType()); - omegaBlueCD.timeLeft = 1500; + omegaBlueCD.timeLeft = OmegaBlueHelmet.MadnessCooldown; } bool hasKillMode = cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); @@ -2828,13 +2910,13 @@ namespace CalamityMod.CalPlayer } bool hasPlagueBlackoutCD = cooldowns.TryGetValue(PlagueBlackout.ID, out CooldownInstance plagueBlackoutCD); - if (!plagueReaper && hasPlagueBlackoutCD && plagueBlackoutCD.timeLeft > 1500) - plagueBlackoutCD.timeLeft = 1500; + if (!plagueReaper && hasPlagueBlackoutCD && plagueBlackoutCD.timeLeft > PlagueReaperMask.BlackoutCooldown) + plagueBlackoutCD.timeLeft = PlagueReaperMask.BlackoutCooldown; - if (!prismaticSet && prismaticLasers > 1800) + if (!prismaticSet && prismaticLasers > PrismaticHelmet.LaserCooldown) { - prismaticLasers = 1800; - Player.AddCooldown(PrismaticLaser.ID, 1800); + prismaticLasers = PrismaticHelmet.LaserCooldown; + Player.AddCooldown(PrismaticLaser.ID, PrismaticHelmet.LaserCooldown); } if (!angelicAlliance && divineBless) { @@ -2944,36 +3026,7 @@ namespace CalamityMod.CalPlayer } // Breath lost while at zero breath - double breathLoss = Main.remixWorld ? (point.Y < abyssLevel1 ? 50D * depthRatioFromAbyssLayer1 : 0D) : (point.Y > abyssLevel1 ? 50D * depthRatioFromAbyssLayer1 : 0D); - - // Breath Loss Multiplier, depending on gear - // 27AUG2024: Ozzatron: fixed this being subtractive like mining speed. now doesn't stack exponentially - // It is now a multiplier for the time it takes to lose any unit amount of breath - double breathLossTimeMult = 1D + - (Player.gills ? 0.2 : 0D) + // 1.2 - (oceanCrest ? 0.2 : 0D) + // 1.2 - (victideSet ? 0.2 : 0D) + // 1.2 - (Player.accDivingHelm ? 0.25 : 0D) + // 1.25 - (Player.arcticDivingGear ? 0.25 : 0D) + // 1.25 - (aquaticEmblem ? 0.25 : 0D) + // 1.25 - (Player.accMerman ? 0.3 : 0D) + // 1.3 - (reaverExplore ? 0.3 : 0D) + // 1.3 - ((aquaticHeart && NPC.downedBoss3) ? 0.3 : 0D) + // 1.3 - (abyssalDivingSuit ? 0.3 : 0D) + // 1.3 - externalBreathLossMultBoost; - - // Invert the breath loss time multiplier, to get the multiplier for the speed at which breath is actually lost - double breathLossMult = 1D / breathLossTimeMult; - - // Limit the multiplier to 5% - if (breathLossMult < 0.05) - breathLossMult = 0.05; - - // Reduce breath lost while at zero breath, depending on gear - breathLoss *= breathLossTimeMult; - - // Record the final breath loss for the stat meter - abyssBreathLossStat = (float)breathLoss; + double breathLoss = Main.remixWorld ? (point.Y < abyssLevel1 ? 1D : 0D) : (point.Y > abyssLevel1 ? 1D : 0D); // Defense loss int defenseLoss = (int)(120D * depthRatio); @@ -2994,24 +3047,8 @@ namespace CalamityMod.CalPlayer // Record the final defense reduction for the stat meter abyssDefenseLossStat = defenseLoss; - // Bleed effect based on abyss layer - if (ZoneAbyssLayer4) - { - Player.bleed = true; - } - else if (ZoneAbyssLayer3) - { - if (!abyssalDivingSuit) - Player.bleed = true; - } - else if (ZoneAbyssLayer2) - { - if (!depthCharm) - Player.bleed = true; - } - // Ticks (frames) until breath is deducted from the breath meter - double tick = 12D * (1D - depthRatio); + double tick = 10D * (1D - depthRatio); // Prevent 0 if (tick < 1D) @@ -3019,16 +3056,16 @@ namespace CalamityMod.CalPlayer // Tick (frame) multiplier, depending on gear double tickMult = 1D + - (Player.gills ? 4D : 0D) + // 5 - (oceanCrest ? 4D : 0D) + // 5 - (Player.ignoreWater ? 5D : 0D) + // 10 - (Player.accDivingHelm ? 10D : 0D) + // 20 - (Player.arcticDivingGear ? 10D : 0D) + // 30 - (aquaticEmblem ? 10D : 0D) + // 40 - (Player.accMerman ? 15D : 0D) + // 55 - (victideSet ? 5D : 0D) + // 60 - ((aquaticHeart && NPC.downedBoss3) ? 15D : 0D) + // 75 - (abyssalDivingSuit ? 15D : 0D) + // 90 + (Player.gills ? 2D : 0D) + + (oceanCrest ? 2D : 0D) + + (Player.ignoreWater ? 3D : 0D) + + (Player.accDivingHelm ? 5D : 0D) + + (Player.arcticDivingGear ? 5D : 0D) + + (aquaticEmblem ? 5D : 0D) + + (Player.accMerman ? 8D : 0D) + + (victideBurrowHead ? 2D : 0D) + + ((aquaticHeart && NPC.downedBoss3) ? 8D : 0D) + + (abyssalDivingSuit ? 8D : 0D) + externalBreathTickBoost; // Limit the multiplier to 50 @@ -3042,6 +3079,8 @@ namespace CalamityMod.CalPlayer abyssBreathLossRateStat = (float)tick; float resistanceSlowdownFactor = 1f; + if (hadopelagicPressure) + resistanceSlowdownFactor -= abyssalDivingSuit ? 0.2f : 0.5f; // Reduce breath over ticks (frames) abyssBreathCD++; @@ -3053,17 +3092,14 @@ namespace CalamityMod.CalPlayer // Reduce breath if (Player.breath > 0) { - Player.breath -= (int)(cDepth && !depthCharm ? breathLoss + 1D : breathLoss); - - if (hPressure) - resistanceSlowdownFactor -= (int)(!abyssalDivingSuit ? 1.2f : 0.5f); + Player.breath -= (int)(crushDepth && !depthCharm ? breathLoss + 1D : breathLoss); } } // If breath is greater than 0 and player has gills or is merfolk, balance out the effects by reducing breath if (Player.breath > 0) { - if (Player.gills || Player.merman) + if (Player.gills || Player.merman || Player.accMerman) Player.breath -= 3; } @@ -3072,8 +3108,8 @@ namespace CalamityMod.CalPlayer // Resistance to life loss at zero breath int lifeLossAtZeroBreathResist = 0 + - (depthCharm ? 3 : 0) + - (abyssalDivingSuit ? 6 : 0); + (depthCharm ? 4 : 0) + + (abyssalDivingSuit ? 5 : 0); // Reduce life loss, depending on gear lifeLossAtZeroBreath -= lifeLossAtZeroBreathResist; @@ -3106,7 +3142,7 @@ namespace CalamityMod.CalPlayer abyssDeath = false; // Signus headcrab darkness - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) { if (CalamityGlobalNPC.signus != -1) { @@ -3197,7 +3233,7 @@ namespace CalamityMod.CalPlayer // Aquatic Emblem bonus if (aquaticEmblem) { - if (Player.IsUnderwater() && Player.wet && !Player.lavaWet && !Player.honeyWet && + if (countsAsAnyWet && !Player.lavaWet && !Player.honeyWet && !Player.mount.Active) { if (aquaticBoost > 0f) @@ -3214,17 +3250,17 @@ namespace CalamityMod.CalPlayer else { aquaticBoost += 2f; - if (aquaticBoost > aquaticBoostMax) - aquaticBoost = aquaticBoostMax; + if (aquaticBoost > AquaticBoostMax) + aquaticBoost = AquaticBoostMax; if (Player.mount.Active) - aquaticBoost = aquaticBoostMax; + aquaticBoost = AquaticBoostMax; } - Player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 50f); + Player.statDefense += (int)((1f - aquaticBoost * 0.0001f) * 20f); Player.moveSpeed -= (1f - aquaticBoost * 0.0001f) * 0.1f; } else - aquaticBoost = aquaticBoostMax; + aquaticBoost = AquaticBoostMax; if (Player.ActiveItem().type == ModContent.ItemType() && Player.StandingStill(0.1f)) { @@ -3352,21 +3388,6 @@ namespace CalamityMod.CalPlayer if (AdamantiteSet) Player.statDefense += AdamantiteSetDefenseBoost; - // Warmth makes Chilled, Frozen, and Glacial State tick down 3x as fast - if (Player.HasBuff(BuffID.Warmth)) - { - for (int b = 0; b < Player.MaxBuffs; b++) - { - if (Player.buffType[b] == BuffID.Chilled || Player.buffType[b] == BuffID.Frozen || Player.buffType[b] == ModContent.BuffType()) - { - if (Player.buffTime[b] > 3) - { - Player.buffTime[b] -= 2; - } - } - } - } - if (astralInjection) { if (Player.statMana < Player.statManaMax2) @@ -3386,8 +3407,8 @@ namespace CalamityMod.CalPlayer if (xWrath) { - Player.GetDamage() += 0.1f; - Player.GetCritChance() += 5; + Player.GetDamage() += EmpyreanMask.WrathRogueDamageBoost; + Player.GetCritChance() += EmpyreanMask.WrathRogueCritBoost; } if (graxDefense) @@ -3397,11 +3418,6 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += Grax.DamageBoost; } - if (brutalCarnage) - { - Player.GetDamage() += BrutalCarnage.MeleeDamageBoost; - } - // Trinket of Chi bonus if (trinketOfChi) { @@ -3419,7 +3435,7 @@ namespace CalamityMod.CalPlayer Player.GetDamage() += 0.12f; Player.GetKnockback() += 1.2f; if (Main.eclipse || !Main.dayTime) - Player.statDefense += Main.eclipse ? 10 : 20; + Player.statDefense += Main.eclipse ? 8 : 16; } if (AbsorberRegen) @@ -3466,7 +3482,7 @@ namespace CalamityMod.CalPlayer if (tortShellPostHit > 0) { - Player.statDefense -= 8; + Player.statDefense -= 6; tortShellPostHit--; } else @@ -3518,11 +3534,8 @@ namespace CalamityMod.CalPlayer if (Player.chilled) Player.moveSpeed *= 1f + (1f / 6f); - if (cirrusDress) - Player.moveSpeed -= 0.2f; - - if (cirrusVodka) - Player.GetDamage() += CirrusVodka.DamageBoost; + if (purpleHaze) + Player.GetDamage() += PurpleHaze.DamageBoost; if (vodka) { @@ -3587,7 +3600,7 @@ namespace CalamityMod.CalPlayer if (starBeamRye) { Player.GetDamage() += StarBeamRye.MagicDamageBoost; - Player.manaCost *= (1f - StarBeamRye.ManaCostReduction); + Player.manaCost -= StarBeamRye.ManaCostReduction; Player.statManaMax2 += StarBeamRye.MaxManaBoost; } @@ -3618,7 +3631,7 @@ namespace CalamityMod.CalPlayer } } - if (HighTestFishingPoleList.Includes(Player.ActiveItem().type)) + if (CalamityItemSets.FishingPoleThatNeverBreaks[Player.ActiveItem().type]) Player.accFishingLine = true; if (planarSpeedBoost != 0) @@ -3647,12 +3660,12 @@ namespace CalamityMod.CalPlayer // Flight time boosts double flightTimeMult = 1D + (harpyRing ? 0.2 : 0D) + - (reaverSpeed ? 0.1 : 0D) + - (angelTreads ? 0.1 : 0D) + + (reaverSpeed ? ReaverHeadMobility.SetBonusFlightBoost : 0D) + + (angelTreads ? AngelTreads.FlightTimeBoost : 0D) + (blueCandle ? WeightlessCandle.WingTimeBoost : 0D) + (soaring ? SoaringPotion.FlightBoost : 0D) + - (prismaticGreaves ? 0.1 : 0D) + - (plagueReaper ? 0.05 : 0D) + + (prismaticGreaves ? PrismaticGreaves.FlightTimeBoost : 0D) + + (plagueReaper ? PlagueReaperMask.SetBonusFlightTimeBoost : 0D) + (ascendantInsignia ? 0.17 : 0D) + // Added to soaring insignia's flight to get 50% (Player.empressBrooch ? 0.33 : 0D) + externalFlightTimeMultBoost; @@ -3673,7 +3686,7 @@ namespace CalamityMod.CalPlayer // Reaver Tank set nuke flight time if (reaverDefense) - flightTimeMult -= 0.3f; + flightTimeMult -= ReaverHeadTank.SetBonusMobilityReduction; // Increase wing time if (Player.wingTimeMax > 0) @@ -3725,24 +3738,12 @@ namespace CalamityMod.CalPlayer } if (tarraSet) - { - if (!tarraMelee) - Player.calmed = true; Player.lifeMagnet = true; - } - if (wDeath && !laudanum && !purity) + if (whisperingDeath && !laudanum && !purity) Player.GetDamage() -= 0.2f; - if (astralInfection && !(infectedJewel || hideOfDeus || purity)) - Player.GetDamage() -= 0.1f; - - if (pFlames && !purity) - { - Player.GetDamage() -= 0.1f; - } - - if (aCrunch && !laudanum && !purity) + if (armorCrunch && !laudanum && !purity) { Player.statDefense -= ArmorCrunch.DefenseReduction; Player.endurance *= ArmorCrunch.MultiplicativeDamageReductionPlayer; @@ -3753,14 +3754,6 @@ namespace CalamityMod.CalPlayer Player.statDefense -= RemsRevenge.WitherDefenseReduction; } - if (gState) - { - Player.velocity.X *= 0.5f; - Player.velocity.Y += 0.05f; - if (Player.velocity.Y > 15f) - Player.velocity.Y = 15f; - } - if (eutrophication && !purity) Player.velocity = Vector2.Zero; @@ -3802,27 +3795,40 @@ namespace CalamityMod.CalPlayer } if (manaOverloader) - Player.GetDamage() += 0.06f; + { + float manaRatio = Player.statMana / (float)Player.statManaMax2; + Player.GetDamage() += MathHelper.Lerp(0.05f,0.15f,manaRatio); + } if (bloodyWormTooth) { Player.GetDamage() += 0.1f; } + // While making the rogue update verify if we should allow these to stack again - Shade if (filthyGlove) { bonusStealthDamage += nanotech ? 0.05f : 0.08f; } + if (rottenDogTooth && !nanotech) + { + bonusStealthDamage += 0.08f; + } + if (sandsWindBuff) { Player.GetDamage() += PrimordialEarth.BuffDamageBoost; Player.statDefense += PrimordialEarth.BuffDefenseBoost; + Player.manaRegenDelayBonus += 1; + Player.manaRegenBonus += 50 + (int)(400 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2)); } if (aeolianEarthBuff) { Player.GetDamage() += PrimordialAncient.BuffDamageBoost; Player.endurance += PrimordialAncient.BuffDamageReductionBoost; + Player.manaRegenDelayBonus += 1; + Player.manaRegenBonus += 75 + (int)(600 * (float)Math.Pow((1 - ((float)Player.statMana / (float)Player.statManaMax2)), 2)); } if (frostFlare) @@ -3835,7 +3841,7 @@ namespace CalamityMod.CalPlayer if (Player.statLife > (int)(Player.statLifeMax2 * 0.5)) Player.GetDamage() += 0.1f; if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.statDefense += 20; + Player.statDefense += 15; } if (vexation) @@ -3845,47 +3851,40 @@ namespace CalamityMod.CalPlayer if (ataxiaBlaze) { - if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) + if (Player.statLife <= (int)(Player.statLifeMax2 * HydrothermicArmor.InfernoHealthThreshold)) Player.AddBuff(BuffID.Inferno, 2); } if (bloodflareThrowing) { - if (Player.statLife > (int)(Player.statLifeMax2 * 0.8)) - { - Player.GetCritChance() += 5; - Player.statDefense += 30; - } - else - Player.GetDamage() += 0.1f; + if (Player.statLife > (int)(Player.statLifeMax2 * BloodflareHeadRogue.DefenseBoostHealthThreshold)) + Player.statDefense += BloodflareHeadRogue.DefenseBoostAboveHealthThreshold; } if (bloodflareSummon) { - if (Player.statLife >= (int)(Player.statLifeMax2 * 0.9)) - Player.GetDamage() += 0.1f; - else if (Player.statLife <= (int)(Player.statLifeMax2 * 0.5)) - Player.statDefense += 20; + if (Player.statLife <= (int)(Player.statLifeMax2 * BloodflareHeadSummon.DefenseBoostHealthThreshold)) + Player.statDefense += BloodflareHeadSummon.DefenseBoostBelowHealthThreshold; if (bloodflareSummonTimer > 0) bloodflareSummonTimer--; if (Player.whoAmI == Main.myPlayer && bloodflareSummonTimer <= 0) { - bloodflareSummonTimer = 900; + bloodflareSummonTimer = BloodflareHeadSummon.MineCooldown; // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(BloodflareHeadSummon.GhostMineEntitySourceContext); for (int I = 0; I < 3; I++) { float ai1 = I * 120; - int damage = (int)Player.CalcIntDamage(3750); + int damage = (int)Player.CalcIntDamage(BloodflareHeadSummon.MineDamage); int projectile = Projectile.NewProjectile(source, Player.Center.X + (float)(Math.Sin(I * 120) * 550), Player.Center.Y + (float)(Math.Cos(I * 120) * 550), 0f, 0f, ModContent.ProjectileType(), damage, 1f, Player.whoAmI, ai1, 0f); if (projectile.WithinBounds(Main.maxProjectiles)) { - Main.projectile[projectile].originalDamage = 3750; + Main.projectile[projectile].originalDamage = BloodflareHeadSummon.MineDamage; Main.projectile[projectile].DamageType = DamageClass.Generic; } } @@ -3901,11 +3900,12 @@ namespace CalamityMod.CalPlayer } if (Player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { - int damage = (int)Player.GetTotalDamage().ApplyTo(600); + int baseDmg = auricSet ? AuricTeslaHeadSummon.CrystalDamage : SilvaHeadSummon.CrystalDamage; + int damage = (int)Player.GetTotalDamage().ApplyTo(baseDmg); var p = Projectile.NewProjectile(source, Player.Center.X, Player.Center.Y, 0f, -1f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -20f, 0f); if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = 600; + Main.projectile[p].originalDamage = baseDmg; } } @@ -3928,9 +3928,9 @@ namespace CalamityMod.CalPlayer { if (Player.statLife >= Player.statLifeMax2) { - Player.GetCritChance() += 10; - Player.GetDamage() += 0.1f; - rogueVelocity += 0.1f; + Player.GetDamage() += GodSlayerHeadRogue.RogueDamageBoostAtFullHealth; + Player.GetCritChance() += GodSlayerHeadRogue.RogueCritBoostAtFullHealth; + rogueVelocity += GodSlayerHeadRogue.RogueVelocityBoostAtFullHealth; } } @@ -3946,7 +3946,7 @@ namespace CalamityMod.CalPlayer // If the timer rolls over, it's time to deal damage. Only run this code for the client which is wearing the armor. if (tarraLifeAuraTimer == 0 && Player.whoAmI == Main.myPlayer) { - int damage = (int)Player.CalcDamage(120); + int damage = (int)Player.CalcDamage(TarragonHeadSummon.AuraDamage); // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(TarragonHeadSummon.LifeAuraEntitySourceContext); @@ -3963,59 +3963,21 @@ namespace CalamityMod.CalPlayer } } - // Navy Fishing Rod's electric aura when in-use - if (Player.ActiveItem().type == ModContent.ItemType() && Player.ownedProjectileCounts[ModContent.ProjectileType()] != 0) - { - const int FramesPerHit = 120; - - // Constantly increment the timer every frame. - navyRodAuraTimer = (navyRodAuraTimer + 1) % FramesPerHit; - - // If the timer rolls over, it's time to deal damage. Only run this code for the client which is holding the fishing rod, - if (navyRodAuraTimer == 0 && Player.whoAmI == Main.myPlayer) - { - const int BaseDamage = 10; - int damage = (int)Player.GetBestClassDamage().ApplyTo(BaseDamage); - var source = Player.GetSource_ItemUse(Player.ActiveItem()); - float range = 200f; - - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.friendly || npc.damage <= 0 || npc.dontTakeDamage) - continue; - - if (Vector2.Distance(Player.Center, npc.Center) <= range) - Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), damage, 0f, Player.whoAmI, npc.whoAmI); - - // Occasionally spawn cute sparks so it looks like an electrical aura - if (Main.rand.NextBool(10)) - { - Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); - Projectile spark = Projectile.NewProjectileDirect(source, npc.Center, velocity, ModContent.ProjectileType(), damage / 2, 0f, Player.whoAmI); - spark.localNPCHitCooldown = -2; - spark.timeLeft = 30; - } - } - } - } - // Inferno potion boost if (ataxiaBlaze && Player.inferno) { - const int FramesPerHit = 30; - // Constantly increment the timer every frame. - hydrothermicInfernoTimer = (hydrothermicInfernoTimer + 1) % FramesPerHit; + hydrothermicInfernoTimer = (hydrothermicInfernoTimer + 1) % HydrothermicArmor.InfernoHitRate; // Only run this code for the client which is wearing the armor. // Brimstone flames is applied every single frame, but direct damage is only dealt twice per second. if (Player.whoAmI == Main.myPlayer) { - int damage = (int)Player.GetBestClassDamage().ApplyTo(50); + int damage = (int)Player.GetBestClassDamage().ApplyTo(HydrothermicArmor.InfernoDamage); // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(HydrothermicArmor.InfernoPotionEntitySourceContext); - float range = 300f; + float range = HydrothermicArmor.InfernoRange; foreach (NPC npc in Main.ActiveNPCs) { @@ -4056,7 +4018,7 @@ namespace CalamityMod.CalPlayer if (eArtifact) { - Player.manaCost *= 0.75f; + Player.manaCost -= 0.25f; Player.maxMinions++; } @@ -4068,7 +4030,9 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - if (Player.FindBuffIndex(ModContent.BuffType()) == -1) + if (Player.HasBuff(ModContent.BuffType())) + Player.buffTime[Player.FindBuffIndex(ModContent.BuffType())] = 3600; + else Player.AddBuff(ModContent.BuffType(), 3600, true); pSoulGuardians = true; @@ -4267,66 +4231,27 @@ namespace CalamityMod.CalPlayer } } - if (prismaticLasers > 1800 && Player.whoAmI == Main.myPlayer) + if (prismaticLasers > PrismaticHelmet.LaserCooldown && Player.whoAmI == Main.myPlayer) { - float shootSpeed = 18f; - int dmg = (int)Player.GetTotalDamage().ApplyTo(30); - - Vector2 startPos = Player.RotatedRelativePoint(Player.MountedCenter, true); - - // 14NOV2024: Ozzatron: clamped mouse position is inappropriate to apply here due to excessive use of decompiled vanilla shitcode - Vector2 velocity = Main.MouseWorld - startPos; - if (Player.gravDir == -1f) - { - velocity.Y = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - startPos.Y; - } - float travelDist = velocity.Length(); - if ((float.IsNaN(velocity.X) && float.IsNaN(velocity.Y)) || (velocity.X == 0f && velocity.Y == 0f)) - { - velocity.X = Player.direction; - velocity.Y = 0f; - travelDist = shootSpeed; - } - else - { - travelDist = shootSpeed / travelDist; - } + int dmg = (int)Player.GetTotalDamage().ApplyTo(PrismaticHelmet.LaserDamage); // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list var source = Player.GetSource_FromThis(PrismaticHelmet.LaserEntitySourceContext); int laserAmt = Main.rand.Next(2); for (int index = 0; index < laserAmt; index++) { - startPos = new Vector2(Player.Center.X + (Main.rand.Next(201) * -(float)Player.direction) + (Main.mouseX + Main.screenPosition.X - Player.position.X), Player.MountedCenter.Y - 600f); - startPos.X = (startPos.X + Player.Center.X) / 2f + Main.rand.Next(-200, 201); - startPos.Y -= 100 * index; - velocity.X = Main.mouseX + Main.screenPosition.X - startPos.X; - velocity.Y = Main.mouseY + Main.screenPosition.Y - startPos.Y; - if (velocity.Y < 0f) - { - velocity.Y *= -1f; - } - if (velocity.Y < 20f) - { - velocity.Y = 20f; - } - travelDist = velocity.Length(); - travelDist = shootSpeed / travelDist; - velocity.X *= travelDist; - velocity.Y *= travelDist; - velocity.X += Main.rand.Next(-50, 51) * 0.02f; - velocity.Y += Main.rand.Next(-50, 51) * 0.02f; - int laser = Projectile.NewProjectile(source, startPos, velocity, ModContent.ProjectileType(), dmg, 4f, Player.whoAmI, 0f, 0f); - Main.projectile[laser].localNPCHitCooldown = 5; - if (laser.WithinBounds(Main.maxProjectiles)) - Main.projectile[laser].DamageType = DamageClass.Generic; + Vector2 newPos = new Vector2(Player.ClampedMouseWorld().X + Main.rand.NextFloat(-240f, 240f), Player.MountedCenter.Y - 960f); + Vector2 newVel = (Player.ClampedMouseWorld() + Main.rand.NextVector2CircularEdge(24f, 24f) - newPos).SafeNormalize(Vector2.Zero) * 18f; + Projectile laser = Projectile.NewProjectileDirect(source, newPos, newVel, ModContent.ProjectileType(), dmg, 4f, Player.whoAmI); + laser.localNPCHitCooldown = 5; + laser.DamageType = DamageClass.Generic; } SoundEngine.PlaySound(SoundID.Item12, Player.Center); } - if (prismaticLasers == 1800) + if (prismaticLasers == PrismaticHelmet.LaserCooldown) { // At the exact moment the lasers stop, set the cooldown to appear - Player.AddCooldown(PrismaticLaser.ID, 1800); + Player.AddCooldown(PrismaticLaser.ID, PrismaticHelmet.LaserCooldown); } if (prismaticLasers == 1) { @@ -4397,7 +4322,7 @@ namespace CalamityMod.CalPlayer for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = Player.buffType[l]; - if (AmalgamBuffList.Includes(buffID)) + if (CalamityBuffSets.BuffedByAmalgam[buffID]) { if (amalgam) { @@ -4414,7 +4339,7 @@ namespace CalamityMod.CalPlayer else { // Reset buff persistence if Amalgam is removed. - if (Main.persistentBuff[buffID] && !PersistentBuffList.Includes(buffID)) + if (Main.persistentBuff[buffID] && !CalamityBuffSets.IsPersistentBuff[buffID]) Main.persistentBuff[buffID] = false; } } @@ -4462,7 +4387,7 @@ namespace CalamityMod.CalPlayer // Also gives acceleration, which is done in PostUpdateRunSpeeds break; case BuffID.Ichor: - Player.statDefense += 40; // +25 net defense + Player.statDefense += 20; // +10 net defense break; case BuffID.Bleeding: Player.bleed = false; @@ -4480,7 +4405,7 @@ namespace CalamityMod.CalPlayer case BuffID.Weak: Player.GetDamage() += 0.051f; // Cancel melee damage nerf, add 10% all damage Player.GetDamage() += 0.1f; - Player.statDefense += 14; // +10 net defense + Player.statDefense += 10; // +6 net defense Player.moveSpeed += 0.25f; // +15% net move speed break; case BuffID.Slow: @@ -4489,7 +4414,7 @@ namespace CalamityMod.CalPlayer break; case BuffID.Confused: Player.confused = false; - Player.statDefense += 50; + Player.statDefense += 15; break; case BuffID.Cursed: Player.cursed = false; @@ -4536,6 +4461,47 @@ namespace CalamityMod.CalPlayer } #endregion + #region Lucrecia Effects + + public void HandleLucreciaEffects() + { + int lucreciaItemID = ModContent.ItemType(); + if (Player.HeldItem.type == lucreciaItemID && lucreciaEnergy > 0) + { + lucreciaParticleTimer--; + + // If the timer is at or below zero, spawn a particle. + if (lucreciaParticleTimer <= 0) + { + // Reset the timer (spawn rate depends on energy) + lucreciaParticleTimer = (int)(20 - 15 * (lucreciaEnergy / 60)); + + float radius = Main.rand.NextFloat(160f, 190f); // Distance from center + float spawnAngle = Main.rand.NextFloat(MathHelper.TwoPi); // Random angle along the whole radius + + Vector2 spawnPosition = Player.Center + spawnAngle.ToRotationVector2() * radius; + + // Scale opacity with energy + float opacity = lucreciaEnergy / (float)Lucrecia.MaxEnergy; + Color color = Main.rand.NextBool() ? Color.MediumPurple : Color.CornflowerBlue; + color *= opacity; + + if (lucreciaEnergy >= 100) + { + color *= 1.6f; // Brighter + } + + Vector2 dummyVelocity = Vector2.Zero; // We dont want the argument where this is used to have influence on the actual path + float rotationSpeed = 0.04f; + + var particle = new RoundedStarParticle(spawnPosition, dummyVelocity, color, Main.rand.NextFloat(0.05f, 0.065f), Main.rand.Next(30, 60), rotationSpeed, 1f, true, Player.Center, Player.whoAmI); + GeneralParticleHandler.SpawnParticle(particle); + } + } + } + #endregion + + #region Energy Shields private void EnergyShields() { @@ -4727,7 +4693,10 @@ namespace CalamityMod.CalPlayer { if (cooldowns.TryGetValue(WulfrumRoverDriveDurability.ID, out var cdDurability)) cdDurability.timeLeft = 0; - // if (cooldowns.TryGetValue(WulfrumRoverDriveRecharge.ID, out var cdRecharge)) cdRecharge.timeLeft = 0; + + // As Rover Drive's shield can be left in a partially recharged state, this is for safety. + // If the player does not have the accessory equipped for even one frame, discharge all shields. + RoverDriveShieldDurability = 0; } // Stuff to do if the Rover Drive is equipped @@ -4735,16 +4704,38 @@ namespace CalamityMod.CalPlayer { // If the Rover Drive shield is discharged and hasn't started its recharge delay, start that. if (RoverDriveShieldDurability == 0 && !cooldowns.ContainsKey(WulfrumRoverDriveRecharge.ID)) - Player.AddCooldown(WulfrumRoverDriveRecharge.ID, RoverDrive.ShieldRechargeTime); + Player.AddCooldown(WulfrumRoverDriveRecharge.ID, RoverDrive.ShieldRechargeDelay); - // If the shield has greater than zero durability but that durability is not on the cooldown rack, - // add it to the cooldown rack and play a sound of the shield turning on. + // If the shield has greater than zero durability but that durability is not on the cooldown rack, add it to the cooldown rack. if (RoverDriveShieldDurability > 0 && !cooldowns.ContainsKey(WulfrumRoverDriveDurability.ID)) { CooldownInstance durabilityCooldown = Player.AddCooldown(WulfrumRoverDriveDurability.ID, RoverDrive.ShieldDurabilityMax); durabilityCooldown.timeLeft = RoverDriveShieldDurability; } + // If the shield has greater than zero durability and isn't in its recharge delay, actively replenish shield points. + // Play a sound on the first frame this occurs. + if (RoverDriveShieldDurability > 0 && !cooldowns.ContainsKey(WulfrumRoverDriveRecharge.ID)) + { + if (!playedRoverDriveShieldSound) + SoundEngine.PlaySound(RoverDrive.ActivationSound, Player.Center); + playedRoverDriveShieldSound = true; + + // This number is not an integer, and stores exact per-frame recharge progress. + roverDriveShieldPartialRechargeProgress += RoverDrive.ShieldDurabilityMax / (float)RoverDrive.TotalShieldRechargeTime; + + // Floor the value to get whole number of shield points recharged this frame. + int pointsActuallyRecharged = (int)MathF.Floor(roverDriveShieldPartialRechargeProgress); + + // Give those points to the real shield durability, capping the result. Then remove them from recharge progress. + RoverDriveShieldDurability = Math.Min(RoverDriveShieldDurability + pointsActuallyRecharged, RoverDrive.ShieldDurabilityMax); + roverDriveShieldPartialRechargeProgress -= pointsActuallyRecharged; + + // Update the cooldown rack's durability indicator. + if (cooldowns.TryGetValue(WulfrumRoverDriveDurability.ID, out var cdDurability)) + cdDurability.timeLeft = RoverDriveShieldDurability; + } + // Add light if this shield is currently active if (RoverDriveShieldDurability > 0 && !shieldAddedLight) { @@ -4825,10 +4816,10 @@ namespace CalamityMod.CalPlayer // Multiplicative defense reductions. // These are done last because they need to be after the defense lower cap at 0. - if (cirrusVodka) + if (purpleHaze) { if (Player.statDefense > 0) - Player.statDefense -= (int)(Player.statDefense * CirrusVodka.DefenseLossPercent); + Player.statDefense -= (int)(Player.statDefense * PurpleHaze.DefenseLossPercent); } if (vodka) @@ -4907,30 +4898,13 @@ namespace CalamityMod.CalPlayer } if (DesertProwlerHat.ShroudedInSmoke(Player, out _)) - Player.statDefense -= (int)(Player.statDefense * 0.75); + Player.statDefense -= (int)(Player.statDefense * DesertProwlerHat.SmokeDefenseMult); } #endregion #region Limits private void Limits() { - // TODO -- what is Forbidden Circlet actually supposed to do? - if (forbiddenCirclet) - { - ref StatModifier summon = ref Player.GetDamage(); - ref StatModifier rogue = ref Player.GetDamage(); - float boostToSummonFromRogue = 0f; - float boostToRogueFromSummon = 0f; - - if (summon.Additive < rogue.Additive) - boostToSummonFromRogue = rogue.Additive - summon.Additive; - if (rogue.Additive < summon.Additive) - boostToRogueFromSummon = summon.Additive - rogue.Additive; - - summon += boostToSummonFromRogue; - rogue += boostToRogueFromSummon; - } - // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (Player.endurance > 0f) Player.endurance = 1f - (1f / (1f + Player.endurance)); diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index f91dcf823d..9a5dbf505b 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -5,10 +5,23 @@ using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon.Whips; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; +using CalamityMod.Items.Armor.Astral; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.Fearmonger; +using CalamityMod.Items.Armor.Hydrothermic; +using CalamityMod.Items.Armor.Plaguebringer; using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Armor.Silva; +using CalamityMod.Items.Armor.SnowRuffian; +using CalamityMod.Items.Armor.Sulphurous; +using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Armor.TitanHeart; +using CalamityMod.Items.Armor.Umbraphile; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.NPCs; @@ -103,7 +116,7 @@ namespace CalamityMod.CalPlayer break; case ItemID.FieryGreatsword: - target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.OnFire3, 90); break; case ItemID.IceSickle: @@ -138,13 +151,12 @@ namespace CalamityMod.CalPlayer ItemLifesteal(target, item, damageDone); ItemOnHit(item, damageDone, target.Center, hit.Crit, target.IsAnEnemy(false, true), targetIsDummy); - NPCDebuffs(target, item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass()); + NPCDebuffs(target, item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), item.CountsAsClass(), hit.Crit); // Ursa Sergeant slash cooldown is reset on kill if (ursaSergeant && target.life <= 0 && target.realLife == -1) ursaSergeantCooldown = (int)MathHelper.Clamp(ursaSergeantCooldown - 180, 0, 300); - if (generalBandCooldown == 0) { int cooldown = 0; @@ -194,13 +206,14 @@ namespace CalamityMod.CalPlayer // Arc Flash Ring lightning strike (Remember to change the one for projectile hits if applicable when you change this one!) // This one has a lot less limits than the projectile one, but that's because vanilla broadsword code is limiting (wow so surprising) - if (arcFlashRing && (Main.rand.Next(0, 100) < 6)) + bool spawnChance = (Main.rand.Next(0, 100) < 6); + if (arcFlashRing && spawnChance) { var source = item.GetSource_FromThis(); - int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) - Vector2 position = target.Center + new Vector2(0, -750); + int damage = (int)(((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) - Projectile.NewProjectile(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + bolt.DamageType = hit.DamageType; } // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). @@ -234,25 +247,12 @@ namespace CalamityMod.CalPlayer if (witheringWeaponEnchant) witheringDamageDone += (int)(damageDone * (hit.Crit ? 2D : 1D)); - - cgn.IncreasedColdEffects_EskimoSet = eskimoSet; - cgn.IncreasedColdEffects_CryoStone = CryoStone; - - cgn.IncreasedElectricityEffects_Unused = false; - - cgn.IncreasedHeatEffects_Fireball = fireball; - cgn.IncreasedHeatEffects_CinnamonRoll = cinnamonRoll; - cgn.IncreasedHeatEffects_FireBoots = bootLevel; - - cgn.IncreasedSicknessEffects_ToxicHeart = toxicHeart; - - cgn.IncreasedWaterEffects_Amulet1 = sSpiritAmulet; - cgn.IncreasedWaterEffects_Amulet2 = dOfTheDeep; - - cgn.IncreasedSicknessAndWaterEffects_EvergreenGin = evergreenGin; - cgn.IncreasedSicknessAndWaterEffects_CorrosiveSpine = corrosiveSpine; - - cgn.IncreasedDebuffEffects_Amalgam = amalgam; + cgn.TypelessDebuffMultiplier = TypelessDebuffMultiplier; + cgn.HeatDebuffMultiplier = HeatDebuffMultiplier; + cgn.ColdDebuffMultiplier = ColdDebuffMultiplier; + cgn.SicknessDebuffMultiplier = SicknessDebuffMultiplier; + cgn.WaterDebuffMultiplier = WaterDebuffMultiplier; + cgn.ElectricDebuffMultiplier = ElectricDebuffMultiplier; switch (proj.type) { @@ -397,28 +397,31 @@ namespace CalamityMod.CalPlayer CalamityGlobalProjectile globalProj = proj.Calamity(); // Arc Flash Ring lightning strike (Remember to change the one for item hits if applicable when you change this one!) - // Minions ignore the chance penalty on penetration - bool spawnChance = (Main.rand.Next(0, 100) < MathHelper.Clamp(6 - proj.numHits, (proj.minion ? 6 : 1), 6)); - if (arcFlashRing && spawnChance && proj.type != ProjectileType() && globalProj.spawnArcFlash) + bool spawnChance = (Main.rand.Next(0, 100) < 6); + if (arcFlashRing && spawnChance && proj.type != ProjectileType()) { proj.active = true; // Okay so if a projectile manually kills itself on hit, it totally breaks the bolts. to prevent this we set them to active var source = proj.GetSource_FromThis(); - int damage = (int)((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)); // 400% damage (uneffected by crits) - Vector2 position = target.Center + new Vector2(0, -750); + int damage = (int)(((hit.Damage * 4f) * (hit.Crit ? 0.5f : 1)) / (Player.Calamity().adrenalineModeActive ? Player.Calamity().GetAdrenalineDamage() + 1 : 1)); // 400% damage (uneffected by crits and adrenaline) - Projectile bolt = Projectile.NewProjectileDirect(source, position, new Vector2(0, 10), ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI); + Projectile bolt = Projectile.NewProjectileDirect(source, target.Center, Vector2.Zero, ProjectileType(), damage, 0f, Player.whoAmI, target.whoAmI, (globalProj.showArcFlash ? 0 : 1)); bolt.DamageType = hit.DamageType; - globalProj.spawnArcFlash = false; - // This is really only used for long lasting projectiles and contact damage minions - globalProj.arcFlashCooldown = 90; + globalProj.showArcFlash = false; + // This is really only used for piercing and long lasting projectiles so they dont flood the screen with bolts + globalProj.arcFlashCooldown = 30; + } + + if (forbiddenCirclet && globalProj.stealthStrike) + { + target.AddBuff(ModContent.BuffType(), ForbiddenCirclet.TagDuration); } if (!proj.npcProj && !proj.trap && proj.friendly) { - if (plaguebringerCarapace && FriendlyBeesList.Includes(proj.type)) - target.AddBuff(BuffType(), 300); + if (plaguebringerPatronSet && CalamityProjectileSets.IsFriendlyBeeProjectile[proj.type]) + target.AddBuff(BuffType(), PlaguebringerVisor.BeePlagueDuration); // All projectiles fired from Soma Prime are marked using CalamityGlobalProjectile CalamityGlobalProjectile cgp = proj.Calamity(); @@ -575,11 +578,7 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(orb); } - int heal = (int)Math.Round(hit.Damage * 0.035); - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); + Main.player[proj.owner].SpawnLifeStealProjectile(target, proj, ProjectileType(), (int)Math.Round(hit.Damage * 0.035)); } if ((cgp.betterLifeBullet1 || cgp.betterLifeBullet2) && proj.numHits == 0) @@ -595,13 +594,9 @@ namespace CalamityMod.CalPlayer GeneralParticleHandler.SpawnParticle(orb); } - int heal = (int)Math.Round(hit.Damage * 0.01); - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - for (int i = 0; i <= 2; i++) { - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Main.player[proj.owner], heal, ProjectileType(), BalancingConstants.LifeStealRange); + Main.player[proj.owner].SpawnLifeStealProjectile(target, proj, ProjectileType(), (int)Math.Round(hit.Damage * 0.01), 0.75f); } } @@ -609,7 +604,7 @@ namespace CalamityMod.CalPlayer ProjLifesteal(target, proj, damageDone, hit.Crit); ProjOnHit(proj, target.Center, hit.Crit, target.IsAnEnemy(false), targetIsDummy); - NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), true, proj.noEnchantments); + NPCDebuffs(target, proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), proj.CountsAsClass(), hit.Crit, true, proj.noEnchantments); // Shattered Community tracks all damage dealt with Rage Mode (ignoring dummies). if (targetIsDummy) @@ -628,22 +623,19 @@ namespace CalamityMod.CalPlayer if (!item.CountsAsClass() && Player.meleeEnchant == 7) Projectile.NewProjectile(source, position, Player.velocity, ProjectileID.ConfettiMelee, 0, 0f, Player.whoAmI); - if (reaverDefense) - Player.lifeRegenTime += 1; - if (npcCheck) { if (item.CountsAsClass() && hideOfDeus && hideOfDeusTimer == 0) { hideOfDeusTimer = 10; - int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(320); + int bulwarkStarDamage = (int)Player.GetTotalDamage().ApplyTo(HideofAstrumDeus.StarDamage); for (int n = 0; n < 3; n++) CalamityUtils.ProjectileRain(source, Player.Center, 400f, 100f, 500f, 800f, 29f, ProjectileType(), bulwarkStarDamage, 5f, Player.whoAmI); } if (astralStarRain && crit && astralStarRainCooldown <= 0) { - astralStarRainCooldown = 60; + astralStarRainCooldown = AstralHelm.StarRainCooldown; for (int n = 0; n < 3; n++) { int projectileType = Utils.SelectRandom(Main.rand, new int[] @@ -654,7 +646,7 @@ namespace CalamityMod.CalPlayer ProjectileID.StarCannonStar }); - int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); + int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(AstralHelm.StarDamage); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 12f, projectileType, astralStarDamage, 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -667,15 +659,13 @@ namespace CalamityMod.CalPlayer { if (npcCheck) { - if (ataxiaGeyser && Player.ownedProjectileCounts[ProjectileType()] < 3) + if (ataxiaGeyser && Player.ownedProjectileCounts[ProjectileType()] < HydrothermicHeadMelee.GeyserCountLimit) { - // Ataxia True Melee Geysers: 15%, softcap starts at 300 base damage - int geyserDamage = CalamityUtils.DamageSoftCap(damage * 0.15, 45); - - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, Player.whoAmI, 0f, 0f); + int geyserDamage = CalamityUtils.DamageSoftCap(damage * HydrothermicHeadMelee.GeyserDamageRatio, HydrothermicHeadMelee.GeyserDamageSoftcap); + Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), geyserDamage, 2f, Player.whoAmI); } - if (bloodflareMelee && item.CountsAsClass() && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) + if (bloodflareMelee && item.CountsAsClass() && bloodflareMeleeHits < BloodflareHeadMelee.HitsToActivateFrenzy && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) bloodflareMeleeHits++; } } @@ -709,14 +699,11 @@ namespace CalamityMod.CalPlayer if (theBee && lifeAndShieldCondition) SoundEngine.PlaySound(SoundID.Item110, proj.Center); - if (reaverDefense) - Player.lifeRegenTime += 1; - if (npcCheck) { if (astralStarRain && crit && astralStarRainCooldown <= 0) { - astralStarRainCooldown = 60; + astralStarRainCooldown = AstralHelm.StarRainCooldown; for (int n = 0; n < 3; n++) { int projectileType = Utils.SelectRandom(Main.rand, new int[] @@ -727,7 +714,7 @@ namespace CalamityMod.CalPlayer ProjectileID.StarCannonStar }); - int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(120); + int astralStarDamage = (int)Player.GetBestClassDamage().ApplyTo(AstralHelm.StarDamage); Projectile star = CalamityUtils.ProjectileRain(source, position, 400f, 100f, 500f, 800f, 25f, projectileType, astralStarDamage, 5f, Player.whoAmI); if (star.whoAmI.WithinBounds(Main.maxProjectiles)) @@ -798,7 +785,7 @@ namespace CalamityMod.CalPlayer Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), geyserDamage, 0f, Player.whoAmI, 0f, 0f); } - if (bloodflareMelee && proj.IsTrueMelee() && bloodflareMeleeHits < 15 && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) + if (bloodflareMelee && proj.IsTrueMelee() && bloodflareMeleeHits < BloodflareHeadMelee.HitsToActivateFrenzy && !bloodflareFrenzy && !Player.HasCooldown(BloodflareFrenzy.ID)) bloodflareMeleeHits++; } } @@ -813,11 +800,11 @@ namespace CalamityMod.CalPlayer { if (tarraRanged && proj.CountsAsClass() && tarraRangedCooldown <= 0) { - tarraRangedCooldown = 60; + tarraRangedCooldown = TarragonHeadRanged.OnHitEffectCooldown; for (int l = 0; l < 2; l++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int leafDamage = CalamityUtils.DamageSoftCap((int)(0.25f * proj.damage), 150); + int leafDamage = CalamityUtils.DamageSoftCap((int)(proj.damage * TarragonHeadRanged.LeafDamageRatio), TarragonHeadRanged.LeafDamageSoftcap); int leaf = Projectile.NewProjectile(source, position, velocity, ProjectileID.Leaf, leafDamage, 0f, Player.whoAmI); if (leaf.WithinBounds(Main.maxProjectiles)) { @@ -830,7 +817,7 @@ namespace CalamityMod.CalPlayer for (int projCount = 0; projCount < 2; projCount++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int energyDamage = CalamityUtils.DamageSoftCap((int)(0.33f * proj.damage), 200); + int energyDamage = CalamityUtils.DamageSoftCap((int)(proj.damage * TarragonHeadRanged.EnergyDamageRatio), TarragonHeadRanged.EnergyDamageSoftcap); Projectile.NewProjectile(source, proj.Center, velocity, ProjectileType(), energyDamage, 0f, proj.owner); } } @@ -839,8 +826,9 @@ namespace CalamityMod.CalPlayer if (dynamoStemCells && MiniSwarmerCooldown <= 0 && proj.CountsAsClass()) { MiniSwarmerCooldown = DynamoStemCells.MiniSwarmerCooldown; - - Vector2 velocity = proj.velocity.SafeNormalize(Vector2.UnitY) * 19; + Vector2 directionToMouse = Main.MouseWorld - Player.Center; + directionToMouse.Normalize(); + Vector2 velocity = directionToMouse * 19; int MiniSwamerDamage = (int)Player.GetTotalDamage().ApplyTo(DynamoStemCells.MiniSwamerDamage); Projectile.NewProjectile(source, Player.Center, velocity, ProjectileType(), MiniSwamerDamage, 2f, proj.owner); } @@ -853,10 +841,10 @@ namespace CalamityMod.CalPlayer var source = proj.GetSource_FromThis(); if (ataxiaMage && ataxiaDmg <= 0) { - int orbDamage = (int)(proj.damage * 0.6f); + int orbDamage = (int)(proj.damage * HydrothermicHeadMagic.OrbDamageRatio); CalamityUtils.SpawnOrb(proj, orbDamage, ProjectileType(), 800f, 20f); - int cooldown = (int)(orbDamage * 0.5); + int cooldown = (int)(orbDamage * HydrothermicHeadMagic.OrbDamageCooldownMult); ataxiaDmg += cooldown; } if (tarraMage && crit) @@ -867,9 +855,8 @@ namespace CalamityMod.CalPlayer { if (bloodflareMage && bloodflareMageCooldown <= 0 && crit) { - bloodflareMageCooldown = 120; - // Bloodflare Mage Explosion: 50%, softcap starts at 500 base damage to not overly punish slow weapons - int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.5, 250); + bloodflareMageCooldown = BloodflareHeadMagic.BloodsplosionCooldown; + int bloodflareFireballDamage = CalamityUtils.DamageSoftCap(proj.damage * BloodflareHeadMagic.BloodsplosionDamageRatio, BloodflareHeadMagic.BloodsplosionDamageSoftcap); int fire = Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), bloodflareFireballDamage, 0f, Player.whoAmI, 0f, 0f, 1f); if (fire.WithinBounds(Main.maxProjectiles)) @@ -881,10 +868,9 @@ namespace CalamityMod.CalPlayer } if (silvaMage && silvaMageCooldown <= 0 && (proj.penetrate == 1 || proj.timeLeft <= 5)) { - silvaMageCooldown = 300; + silvaMageCooldown = SilvaHeadMagic.BurstCooldown; SoundEngine.PlaySound(SoundID.Zombie103, proj.Center); //So scuffed, just because zombie sounds werent ported normally - // Silva Mage Blasts: 800 + 60%, softcap on the whole combined thing starts at 1400 - int silvaBurstDamage = CalamityUtils.DamageSoftCap(800.0 + 0.6 * proj.damage, 1400); + int silvaBurstDamage = CalamityUtils.DamageSoftCap(SilvaHeadMagic.BurstDamage + proj.damage * SilvaHeadMagic.BurstDamageRatio, SilvaHeadMagic.BurstDamageSoftcap); Projectile.NewProjectile(source, proj.Center, Vector2.Zero, ProjectileType(), silvaBurstDamage, 8f, Player.whoAmI); } } @@ -955,12 +941,12 @@ namespace CalamityMod.CalPlayer } } - // Fearmonger set gains +10 frames (max 90) of regen when any minion lands any hit + // Fearmonger set gains regen duration when any minion lands any hit if (fearmongerSet) { - fearmongerRegenFrames += 10; - if (fearmongerRegenFrames > 90) - fearmongerRegenFrames = 90; + fearmongerRegenFrames += FearmongerGreathelm.RegenBoostDurationPerHit; + if (fearmongerRegenFrames > FearmongerGreathelm.RegenBoostDurationLimit) + fearmongerRegenFrames = FearmongerGreathelm.RegenBoostDurationLimit; } //Priorities: Nucleogenesis => Starbuster Core => Nuclear Rod => Jelly-Charged Battery @@ -1085,7 +1071,7 @@ namespace CalamityMod.CalPlayer { Vector2 source = new Vector2(position.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); Vector2 velocity = (position - source) / 40f; - int damage = (int)Player.GetTotalDamage().ApplyTo(95); + int damage = (int)Player.GetTotalDamage().ApplyTo(110); Projectile.NewProjectile(spawnSource, source, velocity, ProjectileType(), damage, 3f, proj.owner); } } @@ -1126,32 +1112,15 @@ namespace CalamityMod.CalPlayer rogueCrownCooldown = spawnedFeathers ? 15 : 60; } - if (forbiddenCirclet && modProj.stealthStrike && forbiddenCooldown <= 0 && modProj.stealthStrikeHitCount < 3) - { - for (int index2 = 0; index2 < 6; index2++) - { - float xVector = Main.rand.Next(-35, 36) * 0.02f; - float yVector = Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - int damage = (int)Player.GetTotalDamage().ApplyTo(40); - - int eater = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), damage, proj.knockBack, proj.owner); - if (eater.WithinBounds(Main.maxProjectiles)) - Main.projectile[eater].DamageType = DamageClass.Generic; - forbiddenCooldown = 15; - } - } - if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3) { - int damage = (int)Player.GetTotalDamage().ApplyTo(40); + int damage = (int)Player.GetTotalDamage().ApplyTo(TitanHeartMask.ExplosionDamage); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), damage, proj.knockBack, proj.owner, 1f, 0f); SoundEngine.PlaySound(SoundID.Item14, proj.Center); - for (int dustexplode = 0; dustexplode < 180; dustexplode++) + for (int dustexplode = 0; dustexplode < 120; dustexplode++) { - Vector2 dustd = Vector2.One.RotatedBy(MathHelper.ToRadians(dustexplode * 2)) * 1.7f; + Vector2 dustd = Vector2.One.RotatedBy(MathHelper.ToRadians(dustexplode * 3)) * 1.7f; Dust dust = Dust.NewDustPerfect(proj.Center, Main.rand.NextBool() ? DustType() : DustType(), dustd, Alpha: 100); dust.noGravity = true; } @@ -1161,6 +1130,7 @@ namespace CalamityMod.CalPlayer if (raiderTalisman && modProj.stealthStrike) { raiderCritLifespan = CalamityUtils.SecondsToFrames(RaidersTalisman.RaiderCooldown); + // TO DO: Add nanotech here Player.AddCooldown(RaiderBoost.ID, raiderCritLifespan, true, vampiricTalisman ? "Bloodfeast" : "default"); if (raiderSoundCooldown <= 0) { @@ -1174,9 +1144,7 @@ namespace CalamityMod.CalPlayer // Umbraphile cannot trigger off of itself. It is guaranteed on stealth strikes and 20% chance otherwise. if (umbraphileSet && ((modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) || Main.rand.NextBool(5))) { - // Umbraphile Rogue Blasts: 20%, softcap starts at 50 base damage - int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * 0.20, 50); - + int umbraBlastDamage = CalamityUtils.DamageSoftCap(proj.damage * UmbraphileHood.ExplosionDamageRatio, UmbraphileHood.ExplosionDamageSoftcap); Projectile.NewProjectile(spawnSource, proj.Center, Vector2.Zero, ProjectileType(), umbraBlastDamage, 0f, Player.whoAmI); } if (electricianGlove && modProj.stealthStrike && modProj.stealthStrikeHitCount < 3) @@ -1201,7 +1169,7 @@ namespace CalamityMod.CalPlayer #endregion #region Debuffs - public void NPCDebuffs(NPC target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool whip, bool proj = false, bool noFlask = false) + public void NPCDebuffs(NPC target, bool melee, bool ranged, bool magic, bool summon, bool rogue, bool whip, bool crit, bool proj = false, bool noFlask = false) { if (melee && !noFlask) // Prevents Deep Sea Dumbell from snagging true melee debuff memes { @@ -1209,10 +1177,6 @@ namespace CalamityMod.CalPlayer { CalamityUtils.Inflict246DebuffsNPC(target, BuffType()); } - if (ataxiaFire) - { - CalamityUtils.Inflict246DebuffsNPC(target, BuffID.OnFire3, 4f); - } } if ((melee || rogue || whip) && !noFlask) { @@ -1257,7 +1221,7 @@ namespace CalamityMod.CalPlayer } if (titanHeartMask) { - target.AddBuff(BuffType(), 120); + target.AddBuff(BuffType(), TitanHeartMask.OnHitDebuffDuration); } } if (summon) @@ -1307,8 +1271,8 @@ namespace CalamityMod.CalPlayer if (omegaBlueChestplate) target.AddBuff(BuffType(), 180); if (sulphurSet) - target.AddBuff(BuffID.Poisoned, 60); - if (ilSpark && Player.IsUnderwater()) + target.AddBuff(BuffID.Poisoned, SulphurousHelmet.SetBonusPoisonDuration); + if (ilSpark && Player.Calamity().countsAsAnyWet) { int duration = 60; target.AddBuff(BuffType(), duration); @@ -1323,7 +1287,11 @@ namespace CalamityMod.CalPlayer } if (vexation) { - target.AddBuff(BuffID.Venom, 120, false); + target.AddBuff(BuffID.Venom, 120, false); + } + if (snowRuffianSet && ranged && crit) + { + target.AddBuff(BuffID.Frostburn, SnowRuffianMask.SetBonusFrostburnDuration, false); } } #endregion @@ -1332,148 +1300,56 @@ namespace CalamityMod.CalPlayer public void ProjLifesteal(NPC target, Projectile proj, int damage, bool crit) { CalamityGlobalProjectile modProj = proj.Calamity(); - - if (bloodflareSet && !target.IsAnEnemy(false) && !Player.moonLeech && target.lifeMax > 5) + if (target.IsAnEnemy(false)) { - if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) + if (bloodflareSet && !Player.moonLeech) { - bloodflareHeartTimer = 300; - Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.Heart); - } - } - - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) - { - float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); - target.Calamity().gladiatorOnKill = false; - if (healPower >= 1) - { - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); - gladiatorTimer = 300; - } - } - - if (Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) - { - // Increases the degree to which Spectre Healing set contributes to the lifesteal cap - if (Player.ghostHeal && proj.CountsAsClass()) - { - // This doesn't use Math.Round because it doesn't in vanilla - float cooldownMult = 0.2f; - cooldownMult -= proj.numHits * 0.05f; - if (cooldownMult < 0f) - cooldownMult = 0f; - - float cooldown = damage * cooldownMult; - Main.LocalPlayer.lifeSteal -= cooldown; - } - - if (vampiricTalisman && proj.CountsAsClass() && crit) - { - int heal = (int)Math.Round(damage * (Main.zenithWorld ? 0.01 : 0.008)); - if (proj.Calamity().stealthStrike) + if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { - heal /= 2; //stealth strikes heal half due to generally dealing far more dmg - - if (Main.zenithWorld) - heal *= -2; // IT YEARNS FOR MORE BLOOD + bloodflareHeartTimer = 300; + Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.Heart); } - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - // Heals more if the ability is active - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile((raiderCritLifespan > 0) ? 1.5f : 1f, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); } - if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); - - if (target.IsAnEnemy(false)) + if (gladiatorSword && target.life <= 0 && target.Calamity().gladiatorOnKill) { - if (bloodflareThrowing && proj.CountsAsClass() && crit) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); - - if (bloodflareMelee && proj.IsTrueMelee()) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, 2, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); + target.Calamity().gladiatorOnKill = false; + if (healPower >= 1) + { + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; + } } + if (vampiricTalisman && proj.CountsAsClass() && crit && proj.numHits <1) + { + int heal = (int)Math.Round(damage * 0.008); + if (heal > 2) + heal = 2; + + Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, heal, (raiderCritLifespan > 0 && !proj.Calamity().stealthStrike) ? 1.3f : 1.6f); + } + + if (bloodyGlove && proj.CountsAsClass() && modProj.stealthStrike && proj.numHits < 1) + //Nanotech has the same heal as Electrician's glove + Player.SpawnLifeStealProjectile(target, proj, ProjectileID.VampireHeal, electricianGlove ? 10 : 5, 2f); + + if (bloodflareThrowing && proj.CountsAsClass() && crit) + Projectile.NewProjectile(proj.GetSource_OnHit(target), proj.Center, proj.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((proj.velocity.Length() * proj.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 4, 0f, proj.owner); + if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) { if (manaOverloader) { - double healMult = 0.2; - healMult -= proj.numHits * healMult * 0.25; - int heal = (int)Math.Round(damage * healMult * (Player.statMana / (double)Player.statManaMax2)); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); + double healMult = 0.1D - proj.numHits * 0.025D; + Player.SpawnLifeStealProjectile(target, proj, ProjectileType(), (int)Math.Round(damage * healMult), 1.5f); } - } - if (silvaSet) - { - double healMult = 0.1; - healMult -= proj.numHits * healMult * 0.5; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); - } - else if (proj.CountsAsClass() && Player.ActiveItem().CountsAsClass()) - { - if (tarraMage) + if (ataxiaMage) { - double healMult = 0.1; - healMult -= proj.numHits * healMult * 0.5; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); - } - else if (ataxiaMage) - { - double healMult = 0.1; - healMult -= proj.numHits * healMult * 0.5; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); - } - } - - if (reaverDefense) - { - double healMult = 0.1; - healMult -= proj.numHits * healMult * 0.5; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealReaverTankCooldownMultiplier); - } - - if (proj.CountsAsClass()) - { - if (xerocSet && xerocDmg <= 0 && Player.ownedProjectileCounts[ProjectileType()] < 3 && Player.ownedProjectileCounts[ProjectileType()] < 3) - { - double healMult = 0.1; - healMult -= proj.numHits * healMult * 0.5; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (CalamityGlobalProjectile.CanSpawnLifeStealProjectile(healMult, heal)) - CalamityGlobalProjectile.SpawnLifeStealProjectile(proj, Player, heal, ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealSetBonusCooldownMultiplier); + double healMult = HydrothermicHeadMagic.OrbHealingRatio - proj.numHits * HydrothermicHeadMagic.OrbHealingRatioLossPerPierce; + Player.SpawnLifeStealProjectile(target, proj, ProjectileType(), (int)Math.Round(damage * healMult), HydrothermicHeadMagic.OrbHealingCooldownMult); } } } @@ -1481,89 +1357,25 @@ namespace CalamityMod.CalPlayer public void ItemLifesteal(NPC target, Item item, int damage) { - if (bloodflareSet && target.IsAnEnemy(false) && target.lifeMax > 5) + if (target.IsAnEnemy(false)) { - if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) + if (bloodflareSet) { - bloodflareHeartTimer = 300; - Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.Heart); - } - } - - if (bloodflareMelee && item.CountsAsClass() && target.lifeMax > 5) - { - if (target.IsAnEnemy(false) && Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech) - { - int heal = 4; - if (!Main.LocalPlayer.moonLeech) + if ((target.life < target.lifeMax * 0.5) && bloodflareHeartTimer <= 0) { - Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealSetBonusCooldownMultiplier; - - float lowestHealthCheck = 0f; - int healTarget = Player.whoAmI; - foreach (Player otherPlayer in Main.ActivePlayers) - { - if (!otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) - { - float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); - if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) - { - lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; - healTarget = otherPlayer.whoAmI; - } - } - } - - // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list - var source = Player.GetSource_FromThis(ReaverHeadTank.HealOrbEntitySourceContext); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileID.VampireHeal, 0, 0f, Player.whoAmI, healTarget, heal); + bloodflareHeartTimer = 300; + Item.NewItem(target.GetSource_Loot(), target.Hitbox, ItemID.Heart); } } - } - if (gladiatorSword && target.IsAnEnemy(false) && target.life <= 0 && target.Calamity().gladiatorOnKill && target.lifeMax > 5) - { - float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); - target.Calamity().gladiatorOnKill = false; - if (healPower >= 1) + if (gladiatorSword && target.life <= 0 && target.Calamity().gladiatorOnKill) { - Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); - gladiatorTimer = 300; - } - } - - if (reaverDefense) - { - if (Main.LocalPlayer.lifeSteal > 0f && !Player.moonLeech && target.lifeMax > 5) - { - double healMult = 0.1; - int heal = (int)Math.Round(damage * healMult); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (heal > 0 && !Main.LocalPlayer.moonLeech) + float healPower = 10 * Utils.GetLerpValue(300, 0, gladiatorTimer, true); + target.Calamity().gladiatorOnKill = false; + if (healPower >= 1) { - Main.LocalPlayer.lifeSteal -= heal * BalancingConstants.LifeStealReaverTankCooldownMultiplier; - - float lowestHealthCheck = 0f; - int healTarget = Player.whoAmI; - for (int i = 0; i < Main.maxPlayers; i++) - { - Player otherPlayer = Main.player[i]; - if (otherPlayer.active && !otherPlayer.dead && ((!Player.hostile && !otherPlayer.hostile) || Player.team == otherPlayer.team)) - { - float playerDist = Vector2.Distance(target.Center, otherPlayer.Center); - if (playerDist < BalancingConstants.LifeStealRange && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) - { - lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; - healTarget = otherPlayer.whoAmI; - } - } - } - - // https://github.com/tModLoader/tModLoader/wiki/IEntitySource#detailed-list - var source = Player.GetSource_FromThis(ReaverHeadTank.HealOrbEntitySourceContext); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileType(), 0, 0f, Player.whoAmI, healTarget, heal); + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, target.velocity * 0.5f, ProjectileType(), 0, 0, -1, (int)healPower); + gladiatorTimer = 300; } } } diff --git a/CalPlayer/Dashes/AsgardianAegisDash.cs b/CalPlayer/Dashes/AsgardianAegisDash.cs index e3797e4f2d..a96ce8fa39 100644 --- a/CalPlayer/Dashes/AsgardianAegisDash.cs +++ b/CalPlayer/Dashes/AsgardianAegisDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.Graphics.Shaders; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.CalPlayer.Dashes @@ -29,26 +30,39 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { Time += 2; float radiusFactor = MathHelper.Lerp(0f, 1f, Utils.GetLerpValue(2f, 2.5f, Time, true)); - for (int i = 0; i < 3; i++) + if (DashTimeAdjustedForStartup <= 18) { - float offsetRotationAngle = player.velocity.ToRotation() + Time / 5f; - float radius = (15f + (float)Math.Cos(Time / 3f) * 12f) * radiusFactor; - Vector2 dustPosition = player.Center - player.velocity * 2; - dustPosition += offsetRotationAngle.ToRotationVector2().RotatedBy(i / 5f * MathHelper.TwoPi) * radius; - Dust dust = Dust.NewDustPerfect(dustPosition, Main.rand.NextBool(5) ? 181 : 295); - dust.alpha = 220; - dust.noGravity = true; - dust.velocity = player.velocity * 0.8f; - dust.scale = Main.rand.NextFloat(1.7f, 2.0f); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - Dust dust2 = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) + (player.velocity * 1.5f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.7f, 1.9f)); - dust2.alpha = 170; - dust2.noGravity = true; - dust2.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + for (int d = 0; d < 2; d++) + { + Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 180 : 295, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); + hFlameDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + hFlameDust.noGravity = hFlameDust.type == 180 ? false : true; + hFlameDust.fadeIn = 0.5f; + if (hFlameDust.type == 180) + { + hFlameDust.scale = Main.rand.NextFloat(0.8f, 1.2f); + hFlameDust.velocity += new Vector2(0, -2.5f) * Main.rand.NextFloat(0.8f, 1.2f); + } + + Dust dust = Dust.NewDustPerfect(player.Center + Main.rand.NextVector2Circular(6, 6) - player.velocity * 2, DustID.FrostStaff); + dust.velocity = -player.velocity * Main.rand.NextFloat(0.6f, 1.4f); + dust.scale = Main.rand.NextFloat(0.9f, 1.4f); + dust.noGravity = true; + if (d < 1) + { + Particle spark = new CustomSpark(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), "CalamityMod/Particles/ProvidenceMarkParticle", false, 17, Main.rand.NextFloat(1.15f, 1.25f), Main.rand.NextBool() ? Color.Fuchsia : Color.Cyan, new Vector2(1.3f, 0.5f), true, false, 0, false, false, Main.rand.NextFloat(0.4f, 0.5f)); + GeneralParticleHandler.SpawnParticle(spark); + } + } } // Dash at a faster speed than the default value. @@ -57,6 +71,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 18) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 5f; diff --git a/CalPlayer/Dashes/AsgardsValorDash.cs b/CalPlayer/Dashes/AsgardsValorDash.cs index 34262feeae..f73fb8ca42 100644 --- a/CalPlayer/Dashes/AsgardsValorDash.cs +++ b/CalPlayer/Dashes/AsgardsValorDash.cs @@ -8,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.UI.States; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -24,35 +25,39 @@ namespace CalamityMod.CalPlayer.Dashes public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - // Nothing + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + // Dash at a faster speed than the default value. + dashSpeed = 12.5f; // Spawn fire dust around the player's body. - for (int d = 0; d < 4; d++) - { - Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); - holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); - holyFireDashDust.scale *= Main.rand.NextFloat(1f, 1.2f); - holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - holyFireDashDust.noGravity = true; - if (Main.rand.NextBool()) - holyFireDashDust.fadeIn = 0.1f; - } - if (Main.rand.NextBool(3)) - { + if (DashTimeAdjustedForStartup > 14) + return; + for (int d = 0; d < 3; d++) + { + Dust holyFireDashDust = Dust.NewDustDirect(player.position + Vector2.UnitY * 4f, player.width, player.height - 8, Main.rand.NextBool() ? 296 : 158, 0f, 0f, 0, default, 1.2f); + holyFireDashDust.velocity = -player.velocity * Main.rand.NextFloat(0.1f, 0.75f); + holyFireDashDust.scale *= Main.rand.NextFloat(2f, 2.4f); + holyFireDashDust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); + holyFireDashDust.noGravity = true; + if (Main.rand.NextBool()) + holyFireDashDust.fadeIn = 0.1f; + } Vector2 dustPosition = player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f); Dust dust = Dust.NewDustPerfect(dustPosition, 222, -player.velocity * Main.rand.NextFloat(0.15f, 0.4f), 0, default, 0.5f); dust.noGravity = false; dust.shader = GameShaders.Armor.GetSecondaryShader(player.cShield, player); - } } public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 14) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/ElysianAegisDash.cs b/CalPlayer/Dashes/ElysianAegisDash.cs index 8ff41a5806..36fca673b6 100644 --- a/CalPlayer/Dashes/ElysianAegisDash.cs +++ b/CalPlayer/Dashes/ElysianAegisDash.cs @@ -27,8 +27,15 @@ namespace CalamityMod.CalPlayer.Dashes PostHit = false; } + public override void DashStartupEffects(Player player) + { + player.velocity *= 0.9f; + } + public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + + if (DashTimeAdjustedForStartup <= 16) for (int d = 0; d < 4; d++) { Dust hFlameDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.2f), Main.rand.NextBool(8) ? 222 : 162, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(1.8f, 2.8f)); @@ -59,6 +66,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 16) + return; if (!PostHit) { player.Calamity().GeneralScreenShakePower = 3.5f; diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 108819e310..8d1fc22a2d 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -18,8 +18,6 @@ namespace CalamityMod.CalPlayer.Dashes { public static new string ID => "Godslayer Armor"; - public static int GodslayerCooldown = 45; - public SlotId GSDashSlot; public static readonly SoundStyle Impact = new("CalamityMod/Sounds/NPCKilled/DevourerDeathImpact") { Volume = 0.5f }; @@ -61,8 +59,7 @@ namespace CalamityMod.CalPlayer.Dashes // Constantly update the player's velocity direction. Vector2 dashVel = Main.MouseWorld - player.Center; - dashVel = dashVel.SafeNormalize(Vector2.UnitX) * CalculateDashSpeed(player); - player.velocity = dashVel; + player.velocity = player.velocity.ToRotation().AngleTowards(dashVel.ToRotation(), 0.175f).ToRotationVector2() * CalculateDashSpeed(player); // Fall way, way, faster than usual. player.maxFallSpeed = 50f; @@ -114,7 +111,7 @@ namespace CalamityMod.CalPlayer.Dashes runSpeedDecelerationFactor = 0.8f; // Cooldown for God Slayer Armor dash. - player.AddCooldown(Cooldowns.GodSlayerDash.ID, CalamityUtils.SecondsToFrames(GodslayerCooldown)); + player.AddCooldown(Cooldowns.GodSlayerDash.ID, GodSlayerChestplate.DashCooldown); player.Calamity().godSlayerDashHotKeyPressed = false; } @@ -141,14 +138,14 @@ namespace CalamityMod.CalPlayer.Dashes // Define damage parameters. hitContext.damageClass = player.GetBestClass(); - hitContext.BaseDamage = 3000; - hitContext.BaseKnockback = 15f; + hitContext.BaseDamage = GodSlayerChestplate.DashDamage; + hitContext.BaseKnockback = GodSlayerChestplate.DashKnockback; // God Slayer Dash intentionally does not use the vanilla function for collision attack iframes. // This is because its immunity is meant to be completely consistent and not subject to vanilla anticheese. hitContext.PlayerImmunityFrames = GodSlayerChestplate.DashIFrames; - npc.AddBuff(ModContent.BuffType(), 300); + npc.AddBuff(ModContent.BuffType(), GodSlayerChestplate.DashGodSlayerInfernoDuration); } } } diff --git a/CalPlayer/Dashes/OrnateShieldDash.cs b/CalPlayer/Dashes/OrnateShieldDash.cs index 9c94df600a..4dc1749dca 100644 --- a/CalPlayer/Dashes/OrnateShieldDash.cs +++ b/CalPlayer/Dashes/OrnateShieldDash.cs @@ -17,16 +17,16 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.ShieldSlam; public override bool IsOmnidirectional => false; - public override float CalculateDashSpeed(Player player) => 16.9f; - public override void OnDashEffects(Player player) + public override void DashStartupEffects(Player player) { - //nothing left, could add a sound or other effect if we want later + player.velocity *= 0.9f; } public override void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { + if (DashTimeAdjustedForStartup <= 12) for (int d = 0; d < 3; d++) { Dust iceDashDust = Dust.NewDustPerfect(player.Center + new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-15f, 15f)) - (player.velocity * 1.7f), Main.rand.NextBool(8) ? 223 : 180, -player.velocity.RotatedByRandom(MathHelper.ToRadians(10f)) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.6f, 0.8f)); @@ -43,6 +43,8 @@ namespace CalamityMod.CalPlayer.Dashes public override void OnHitEffects(Player player, NPC npc, IEntitySource source, ref DashHitContext hitContext) { + if (DashTimeAdjustedForStartup > 12) + return; // Define hit context variables. int hitDirection = player.direction; if (player.velocity.X != 0f) diff --git a/CalPlayer/Dashes/PlaguebringerArmorDash.cs b/CalPlayer/Dashes/PlaguebringerArmorDash.cs index df2248ff57..bcce9288bc 100644 --- a/CalPlayer/Dashes/PlaguebringerArmorDash.cs +++ b/CalPlayer/Dashes/PlaguebringerArmorDash.cs @@ -1,6 +1,6 @@ using System; using CalamityMod.Enums; -using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Plaguebringer; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -61,12 +61,12 @@ namespace CalamityMod.CalPlayer.Dashes if (player.velocity.X != 0f) hitDirection = Math.Sign(player.velocity.X); hitContext.HitDirection = hitDirection; - hitContext.PlayerImmunityFrames = AsgardsValor.ShieldSlamIFrames; + hitContext.PlayerImmunityFrames = PlaguebringerVisor.PlagueDashIFrames; // Define damage parameters. hitContext.damageClass = DamageClass.Summon; - hitContext.BaseDamage = 50; - hitContext.BaseKnockback = 3f; + hitContext.BaseDamage = PlaguebringerVisor.PlagueDashDamage; + hitContext.BaseKnockback = PlaguebringerVisor.PlagueDashKnockback; } } } diff --git a/CalPlayer/Dashes/PlayerDashEffect.cs b/CalPlayer/Dashes/PlayerDashEffect.cs index 4ea5d0a336..e57802a47d 100644 --- a/CalPlayer/Dashes/PlayerDashEffect.cs +++ b/CalPlayer/Dashes/PlayerDashEffect.cs @@ -9,14 +9,34 @@ namespace CalamityMod.CalPlayer.Dashes // For the sake of easy access without the need for stored instances, this property is defined as static instead of abstract. // Derived classes should use the new keyword on this member to define their own version of it. public static string ID { get; } + public int dashTime { get; set; } + public virtual int dashStartup => 0; + + public int DashTimeAdjustedForStartup => dashTime - dashStartup; public abstract DashCollisionType CollisionType { get; } public abstract bool IsOmnidirectional { get; } public abstract float CalculateDashSpeed(Player player); - + /// + /// Effects that happen once when the main dash starts + /// + /// public virtual void OnDashEffects(Player player) { } + /// + /// Effects that happen once when the dash startup starts + /// This does not run on dashes without set startup + /// + /// + + public virtual void OnDashStartupEffects(Player player) { } + /// + /// Effects that run during the dash startup time + /// This does not run on dashes without set startup + /// + /// + public virtual void DashStartupEffects(Player player) { } public virtual void MidDashEffects(Player player, ref float dashSpeed, ref float dashSpeedDecelerationFactor, ref float runSpeedDecelerationFactor) { } diff --git a/CalPlayer/Dashes/StatisNinjaBeltDash.cs b/CalPlayer/Dashes/StatisNinjaBeltDash.cs index 9c0196c584..2f836c3d9a 100644 --- a/CalPlayer/Dashes/StatisNinjaBeltDash.cs +++ b/CalPlayer/Dashes/StatisNinjaBeltDash.cs @@ -15,24 +15,11 @@ namespace CalamityMod.CalPlayer.Dashes public override DashCollisionType CollisionType => DashCollisionType.NoCollision; public override bool IsOmnidirectional => false; public int Time = 0; - public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => (50f * player.moveSpeed); + public override float CalculateDashSpeed(Player player) => (48f); public override void OnDashEffects(Player player) { - if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) - { - player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; - if (player.Calamity().statisAnticheese < 6) - player.Calamity().statisAnticheese++; - } - else - player.Calamity().statisAnticheese = 0; - if (player.Calamity().statisAnticheese > 1) - player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); - lastDashDir = Math.Sign(player.velocity.X); - lastDashDir = Math.Sign(player.velocity.X); Time = 0; for (int i = 0; i < 15; i++) @@ -69,6 +56,17 @@ namespace CalamityMod.CalPlayer.Dashes dust2.fadeIn = 0.5f; player.velocity.X *= 0.93f; + + if (player.velocity.X > 140) + { + player.velocity.X = 140; + } + if (player.velocity.X < -140) + { + player.velocity.X = -140; + } + if (Time > 8) + player.velocity.X *= 0.5f; } } } diff --git a/CalPlayer/Dashes/StatisVoidSashDash.cs b/CalPlayer/Dashes/StatisVoidSashDash.cs index 35de1b7772..86fa30e36a 100644 --- a/CalPlayer/Dashes/StatisVoidSashDash.cs +++ b/CalPlayer/Dashes/StatisVoidSashDash.cs @@ -24,23 +24,11 @@ namespace CalamityMod.CalPlayer.Dashes public int Time = 0; public Vector2 aimVel; public bool strongVisuals = true; - public int lastDashDir = 0; - public override float CalculateDashSpeed(Player player) => (70f * player.moveSpeed); + public override float CalculateDashSpeed(Player player) => (64f); public override void OnDashEffects(Player player) { - if (Math.Sign(player.velocity.X) == lastDashDir && lastDashDir != 0) - { - player.Calamity().statisPenaltyTimer = player.Calamity().statisTimerMax; - if (player.Calamity().statisAnticheese < 6) - player.Calamity().statisAnticheese++; - } - else - player.Calamity().statisAnticheese = 0; - if (player.Calamity().statisAnticheese > 1) - player.velocity.X *= Utils.Remap(player.Calamity().statisAnticheese, 1, 6, 0.9f, 0.3f, true); - lastDashDir = Math.Sign(player.velocity.X); strongVisuals = player.Calamity().voidSashVisuals; Time = 0; @@ -52,7 +40,7 @@ namespace CalamityMod.CalPlayer.Dashes SoundEngine.PlaySound(sound with { Volume = 0.7f, Pitch = Main.rand.NextFloat(-0.15f, 0.15f) }, player.Center); for (int i = 0; i < 40; i++) { - Vector2 intenededVel = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * 5.5f; + Vector2 intenededVel = (MathHelper.TwoPi * i / 40f).ToRotationVector2() * 3f; Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(player.velocity.ToRotation()); Vector2 fxPlace = player.Center + fxVel.RotatedBy(player.velocity.ToRotation()) + player.velocity.SafeNormalize(Vector2.UnitX) * 60; @@ -61,8 +49,8 @@ namespace CalamityMod.CalPlayer.Dashes } for (int i = 0; i < 30; i++) { - Vector2 intenededVel = (MathHelper.TwoPi * i / 30f).ToRotationVector2() * 5.5f; - Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2.3f).RotatedBy(player.velocity.ToRotation()); + Vector2 intenededVel = (MathHelper.TwoPi * i / 30f).ToRotationVector2() * 3f; + Vector2 fxVel = new Vector2(intenededVel.X, intenededVel.Y * 2f).RotatedBy(player.velocity.ToRotation()); Vector2 fxPlace = player.Center + fxVel.RotatedBy(player.velocity.ToRotation()) + player.velocity.SafeNormalize(Vector2.UnitX) * 60; Color dustColor = Main.rand.NextBool(3) ? Color.Indigo : Color.DarkOrchid; @@ -109,7 +97,17 @@ namespace CalamityMod.CalPlayer.Dashes SignusMetaball.SpawnParticle(fxPlace, fxVelocity * Main.rand.NextFloat(5, 8), 50f * Main.rand.NextFloat(0.7f, 1f), 8, new Vector2(0.8f, 1.2f), 0.18f, 0); } } - player.velocity.X *= 0.912f; + player.velocity.X *= 0.95f; + if (player.velocity.X > 140) + { + player.velocity.X = 140; + } + if (player.velocity.X < -140) + { + player.velocity.X = -140; + } + if (Time > 10) + player.velocity.X *= 0.5f; } } } diff --git a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs index 18ca428d85..e2525ac081 100644 --- a/CalPlayer/DrawLayers/CombHairSparkleLayer.cs +++ b/CalPlayer/DrawLayers/CombHairSparkleLayer.cs @@ -60,10 +60,14 @@ namespace CalamityMod.CalPlayer.DrawLayers { for (int j = TopRange; j <= BottomRange; j++) { + Tile tile = Main.tile[i, j]; + if (!tile.HasTile || !TileID.Sets.IsAContainer[tile.TileType] || TileID.Sets.BasicDresser[tile.TileType]) + continue; + int PotentialChest = Chest.FindChestByGuessing(i, j); - if (PotentialChest != -1 && !TileID.Sets.BasicDresser[Main.tile[i, j].TileType]) + if (PotentialChest != -1) { - // Adjust position ot the center of the chest + // Adjust position to the center of the chest Chest chest = Main.chest[PotentialChest]; Vector2 chestCenter = new Vector2(chest.x + 1, chest.y + 1) * 16f; float distance = Vector2.Distance(chestCenter, drawPlayer.MountedCenter); diff --git a/CalPlayer/DrawLayers/ForbiddenSignLayer.cs b/CalPlayer/DrawLayers/ForbiddenSignLayer.cs index 288ee55479..86e2ac60be 100644 --- a/CalPlayer/DrawLayers/ForbiddenSignLayer.cs +++ b/CalPlayer/DrawLayers/ForbiddenSignLayer.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,7 +12,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { public class ForbiddenSignLayer : PlayerDrawLayer { - public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.Skin); + public override Position GetDefaultPosition() => new BeforeParent(PlayerDrawLayers.ForbiddenSetRing); public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) { @@ -23,45 +24,37 @@ namespace CalamityMod.CalPlayer.DrawLayers protected override void Draw(ref PlayerDrawSet drawInfo) { Player drawPlayer = drawInfo.drawPlayer; - SpriteEffects spriteEffects; - if (drawPlayer.direction == 1) - spriteEffects = SpriteEffects.None; - else spriteEffects = SpriteEffects.FlipHorizontally; - - if (drawPlayer.gravDir != 1f) - spriteEffects |= SpriteEffects.FlipVertically; - - int dyeShader = 0; - if (drawPlayer.dye[1] != null) - dyeShader = drawPlayer.dye[1].dye; - - Color baseColor = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)drawInfo.Center.X / 16, (int)drawInfo.Center.Y / 16, Color.White), drawInfo.shadow); - Color color = Color.Lerp(baseColor, Color.White, 0.7f); + Color color = Color.Lerp(drawInfo.colorArmorBody, Color.White, 0.7f); Texture2D texture = TextureAssets.Extra[ExtrasID.ForbiddenSign].Value; Texture2D glowmask = TextureAssets.GlowMask[GlowMaskID.ForbiddenSign].Value; - float offsetY = (float)Math.Sin(drawPlayer.miscCounter / 300f * MathHelper.TwoPi) * 6f; - float sinusoidalTime = (float)Math.Cos(drawPlayer.miscCounter / 75f * MathHelper.TwoPi); - Color afterimageColor = new Color(80, 70, 40, 0) * (sinusoidalTime * 0.5f + 0.5f) * 0.8f; - float gravCheckOffset = drawPlayer.gravDir != 1f ? -20f : 20f; + int offsetY = (int)(MathF.Sin(drawPlayer.miscCounter / 300f * MathHelper.TwoPi) * 6f); + float shadowMult = MathF.Cos(drawPlayer.miscCounter / 75f * MathHelper.TwoPi) * 4f; + Color afterimageColor = new Color(80, 70, 40, 0) * (shadowMult * 0.125f + 0.5f) * 0.8f; - Vector2 position = new Vector2(drawInfo.Center.X - drawPlayer.bodyFrame.Width / 2 + drawPlayer.width / 2, drawInfo.Center.Y + drawPlayer.height - drawPlayer.bodyFrame.Height + 4f) + drawPlayer.bodyPosition; - position += new Vector2(drawPlayer.bodyFrame.Width / 2, drawPlayer.bodyFrame.Height / 2) + new Vector2(-drawPlayer.direction * 10, offsetY - gravCheckOffset); - position -= Main.screenPosition + drawPlayer.Size * 0.5f; + if (drawPlayer.ownedProjectileCounts[ModContent.ProjectileType()] > 1) + { + offsetY = 0; + shadowMult = 2f; + afterimageColor = new Color(80, 70, 40, 0) * 0.3f; + color = color.MultiplyRGB(new Color(0.5f, 0.5f, 1f)); + } + + Vector2 drawPos = drawInfo.Position + drawPlayer.bodyPosition - Main.screenPosition; + drawPos += new Vector2(drawPlayer.width * 0.5f - drawPlayer.direction * 10f, drawPlayer.height - drawPlayer.bodyFrame.Height * 0.5f + 4f + drawPlayer.gravDir * (offsetY - 20f)); // Draw the original sign. - DrawData drawData = new(texture, position, null, color, drawPlayer.bodyRotation, texture.Size() * 0.5f, 1f, spriteEffects, 0) + DrawData drawData = new(texture, drawPos, null, color, drawPlayer.bodyRotation, texture.Size() * 0.5f, 1f, drawInfo.playerEffect) { - shader = dyeShader + shader = drawInfo.cBody }; drawInfo.DrawDataCache.Add(drawData); // Draw 4 semi-transparent copies. - float timeX4 = sinusoidalTime * 4f; Vector2 origin = texture.Size() * 0.5f; for (float i = 0f; i < 4f; i++) { float angle = MathHelper.PiOver2 * i; - drawData = new(glowmask, position + angle.ToRotationVector2() * timeX4, null, afterimageColor, drawPlayer.bodyRotation, origin, 1f, spriteEffects, 0); + drawData = new(glowmask, drawPos + angle.ToRotationVector2() * shadowMult, null, afterimageColor, drawPlayer.bodyRotation, origin, 1f, drawInfo.playerEffect); drawInfo.DrawDataCache.Add(drawData); } } diff --git a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs index d5a92f8bfc..74577bfced 100644 --- a/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs +++ b/CalPlayer/DrawLayers/HeldItemGlowMaskLayer.cs @@ -35,6 +35,8 @@ namespace CalamityMod.CalPlayer.DrawLayers if (itemType < ItemID.Count) return; + Color color = new Color(250, 250, 250, heldItem.alpha); + // This is ugly and I don't give a fuck. // If you want it to look better, do it yourself. Texture2D glowMask = default; @@ -62,8 +64,6 @@ namespace CalamityMod.CalPlayer.DrawLayers glowMask = ModContent.Request("CalamityMod/Items/Weapons/Summon/EtherealSubjugatorGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/ExcelsusGlow").Value; - else if (itemType == ModContent.ItemType()) - glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value; else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/FatesRevealGlow").Value; else if (itemType == ModContent.ItemType()) @@ -75,7 +75,10 @@ namespace CalamityMod.CalPlayer.DrawLayers else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/SummonItems/NecroplasmicBeaconGlow").Value; else if (itemType == ModContent.ItemType()) + { + color = Color.Lerp(Color.White, drawPlayer.Calamity().lightRGB, 0.75f) with { A = 0 }; glowMask = ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value; + } else if (itemType == ModContent.ItemType()) glowMask = ModContent.Request("CalamityMod/Items/Weapons/Magic/PhotosynthesisGlow").Value; else if (itemType == ModContent.ItemType()) @@ -140,7 +143,6 @@ namespace CalamityMod.CalPlayer.DrawLayers if (drawInfo.shadow != 0f || drawPlayer.frozen || !(inUse || visuallyHeld) || itemType <= 0 || drawPlayer.dead || heldItem.noUseGraphic || (drawPlayer.wet && heldItem.noWet) || (drawPlayer.happyFunTorchTime && drawPlayer.inventory[drawPlayer.selectedItem].createTile == TileID.Torches && drawPlayer.itemAnimation == 0)) return; - Color color = new Color(250, 250, 250, heldItem.alpha); Vector2 originOffset = Vector2.Zero; // Use to adjust glow mask draw offset and color. diff --git a/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs b/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs index d0c1cdcc9b..06a652df22 100644 --- a/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs +++ b/CalPlayer/DrawLayers/MountsAboveOwnerLayer.cs @@ -13,7 +13,7 @@ namespace CalamityMod.CalPlayer.DrawLayers { Player drawPlayer = drawInfo.drawPlayer; CalamityPlayer modPlayer = drawPlayer.Calamity(); - return drawPlayer.mount != null && (modPlayer.fab || modPlayer.crysthamyr || modPlayer.onyxExcavator); + return drawPlayer.mount != null && (modPlayer.crysthamyr || modPlayer.onyxExcavator); } protected override void Draw(ref PlayerDrawSet drawInfo) diff --git a/CalPlayer/DrawLayers/WingsofRebirthLayer.cs b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs new file mode 100644 index 0000000000..f4bd60bbb3 --- /dev/null +++ b/CalPlayer/DrawLayers/WingsofRebirthLayer.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Accessories.Wings; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class WingsofRebirthLayer : PlayerDrawLayer + { + public static Asset yharwingTexture; + + public override void Load() + { + yharwingTexture = ModContent.Request("CalamityMod/Items/Accessories/Wings/WingsofRebirth_Wings_Real"); + } + + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.Wings); + + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) => drawInfo.drawPlayer.wings == EquipLoader.GetEquipSlot(Mod, "WingsofRebirth", EquipType.Wings); + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + + if (drawPlayer.dead) + return; + Texture2D texture = yharwingTexture.Value; + Vector2 Position = drawInfo.Position; + Vector2 pos = new Vector2((int)(Position.X - Main.screenPosition.X + (drawPlayer.width / 2) - (2 * drawPlayer.direction)), (int)(Position.Y - Main.screenPosition.Y + (drawPlayer.height / 2) - 2f * drawPlayer.gravDir)); + Color lightColor = Lighting.GetColor((int)drawPlayer.Center.X / 16, (int)drawPlayer.Center.Y / 16, Color.White); + Color color = lightColor * (1 - drawInfo.shadow); + DrawData d = new DrawData(texture, pos, texture.Frame(1, 9, 0, drawInfo.drawPlayer.wingFrame), color, 0f, new Vector2(texture.Width / 2, texture.Height / 18), 1f, drawInfo.playerEffect, 0); + d.shader = drawInfo.drawPlayer.cWings; + drawInfo.DrawDataCache.Add(d); + } + } +} \ No newline at end of file diff --git a/CalamityConditions.cs b/CalamityConditions.cs index 13b295e844..8fdfb0d11e 100644 --- a/CalamityConditions.cs +++ b/CalamityConditions.cs @@ -21,14 +21,6 @@ namespace CalamityMod public static readonly Condition PlayerHasRogueArmor = Create("HasRogueArmor", () => Main.LocalPlayer.Calamity().rogueStealthMax > 0f && Main.LocalPlayer.Calamity().wearingRogueArmor); public static readonly Condition PlayerHasWings = Create("HasWings", () => Main.LocalPlayer.wingTimeMax > 0); - public static readonly Condition PlayerAlcoholPoisoned = Create("AlcoholPoison", () => Main.LocalPlayer.Calamity().alcoholPoisoning); - - // - // NPC conditions - // - - /// Don't use this. It's always `true`. - public static readonly Condition TrasherTextCondition = Create("Drops.TrasherKill", () => true); // // Calamity Event Flag conditions diff --git a/CalamityConfig.cs b/CalamityConfig.cs index 82b26299a2..2145c5bca2 100644 --- a/CalamityConfig.cs +++ b/CalamityConfig.cs @@ -1,6 +1,7 @@ using System.ComponentModel; using System.Reflection; using System.Runtime.Serialization; +using CalamityMod.Enums; using CalamityMod.UI; using CalamityMod.UI.DraedonsArsenal; using CalamityMod.UI.Rippers; @@ -27,36 +28,6 @@ namespace CalamityMod ParticleLimit = (int)Utils.Clamp(ParticleLimit, MinParticleLimit, MaxParticleLimit); } - internal static void SaveConfig() - { - // There is no current way to manually save a mod configuration file in tModLoader. - // The method which saves mod config files is private in ConfigManager, so reflection is used to invoke it. - try - { - MethodInfo saveMethodInfo = typeof(ConfigManager).GetMethod("Save", BindingFlags.Static | BindingFlags.NonPublic); - if (saveMethodInfo is not null) - saveMethodInfo.Invoke(null, [Instance]); - else - CalamityMod.Instance.Logger.Error("TML ConfigManager.Save reflection failed. Method signature has changed. Notify Calamity Devs if you see this in your log."); - } - catch - { - CalamityMod.Instance.Logger.Error("An error occurred while manually saving Calamity mod configuration. This may be due to a complex mod conflict. It is safe to ignore this error."); - } - } - - #region Multi-Threading Settings - [Header("Multithreading")] - - [BackgroundColor(192, 54, 64, 192)] - [SliderColor(224, 165, 56, 128)] - [Range(0f, 2f)] - [DefaultValue(0f)] - [Increment(1f)] - [DrawTicks] - public float SunkenSeaMultiThreading { get; set; } - #endregion - #region Graphics Changes [Header("Graphics")] @@ -64,6 +35,10 @@ namespace CalamityMod [DefaultValue(false)] public bool DisableGravityScreenSwap { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(true)] + public bool TextEffects { get; set; } + [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool Afterimages { get; set; } @@ -262,25 +237,21 @@ namespace CalamityMod public float FlightBarPosY { get; set; } #endregion - #region Music Events - [Header("MusicEvents")] + #region Music Toggles + [Header("MusicToggles")] [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] - public bool Interlude1 { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool Interlude2 { get; set; } - - [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool Interlude3 { get; set; } + public bool Interludes { get; set; } [BackgroundColor(192, 54, 64, 192)] [DefaultValue(true)] public bool DevourerofGodsEulogy { get; set; } + [BackgroundColor(192, 54, 64, 192)] + [DefaultValue(false)] + public bool AbyssLayer3Alt { get; set; } + #endregion #region General Gameplay Changes @@ -291,8 +262,10 @@ namespace CalamityMod public bool FasterFallHotkey { get; set; } [BackgroundColor(192, 54, 64, 192)] - [DefaultValue(true)] - public bool CalamityArmorSetBonusDoubleTap { get; set; } + [SliderColor(224, 165, 56, 128)] + [DrawTicks] + [DefaultValue(SetBonusDoubleTapOptions.Auto)] + public SetBonusDoubleTapOptions SetBonusDoubleTap { get; set; } [BackgroundColor(192, 54, 64, 192)] [DefaultValue(false)] diff --git a/CalamityMod.cs b/CalamityMod.cs index 04444e41f5..88ad657958 100644 --- a/CalamityMod.cs +++ b/CalamityMod.cs @@ -5,6 +5,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using CalamityMod.FluidSimulation; using CalamityMod.Items; +using CalamityMod.MainMenu; using CalamityMod.Particles; using CalamityMod.Projectiles; using Microsoft.Xna.Framework; @@ -19,10 +20,6 @@ namespace CalamityMod public class CalamityMod : Mod { #region External Flags - // External flag to disable non-Revengeance boss AI edits - // This can be edited by other mods using reflection to prevent compatibility issues - public static bool ExternalFlag_DisableNonRevBossAI = false; - // External flag to disable Defense Damage // This can be edited by other mods using reflection if desired // Note that this flag trumps Bloodflare Core and will stop that accessory from working properly. @@ -37,7 +34,7 @@ namespace CalamityMod public override void Load() { // Initialize the EnemyStats struct as early as it is safe to do so - NPCStats.Load(); + NPCStats.LoadDebuffs(); // Initialize Calamity Balance, since it is tightly coupled with the remaining systems CalamityGlobalItem.LoadTweaks(); @@ -50,12 +47,18 @@ namespace CalamityMod Main.QueueMainThreadAction(() => Main.OnPreDraw += PrepareRenderTargets); } } + + public override void PostSetupContent() + { + // Force open certain ModMenus for various reasons and the added flair of "Hey! Something big has happened! Check it out!" + CalamityMainMenu_Sunken.ForceMenuStyle(); + } #endregion #region Unload public override void Unload() { - NPCStats.Unload(); + NPCStats.UnloadDebuffs(); CalamityGlobalItem.UnloadTweaks(); CalamityGlobalProjectile.UnloadTweaks(); diff --git a/CalamityMod.csproj b/CalamityMod.csproj index 06a7b9a67d..83b5750ac1 100644 --- a/CalamityMod.csproj +++ b/CalamityMod.csproj @@ -1,13 +1,5 @@ - + - - CalamityMod - net8.0 - AnyCPU - latest - - - - + diff --git a/CalamityNetcode.cs b/CalamityNetcode.cs index b40c85cbda..200d9ee9ec 100644 --- a/CalamityNetcode.cs +++ b/CalamityNetcode.cs @@ -215,6 +215,7 @@ namespace CalamityMod CooldownAddition, CooldownRemoval, SyncCooldownDictionary, + ExaltationDirection, // Syncs for specific bosses or entities SyncDestroyerLaserColor, diff --git a/Cooldowns/BubblyBurrow.cs b/Cooldowns/BubblyBurrow.cs new file mode 100644 index 0000000000..0ff4d6f13b --- /dev/null +++ b/Cooldowns/BubblyBurrow.cs @@ -0,0 +1,78 @@ +using System; +using CalamityMod.Items.Armor.Victide; +using CalamityMod.UI; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class BubblyBurrow : CooldownHandler + { + public bool PowerActive => instance.timeLeft > VictideHeadBurrow.BurrowCooldown; + public float PowerPercent => (instance.timeLeft - VictideHeadBurrow.BurrowCooldown) / (float)VictideHeadBurrow.BurrowDuration; + + public static new string ID => "BubblyBurrow"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.BubblyBurrow" + (PowerActive ? "Active" : "Cooldown")); + public override string Texture => PowerActive ? "CalamityMod/Cooldowns/BubblyBurrow" : "CalamityMod/Cooldowns/BubblyBurrowCooldown"; + public override string OutlineTexture => "CalamityMod/Cooldowns/BubblyBurrowOutline"; + public override string OverlayTexture => "CalamityMod/Cooldowns/BubblyBurrowOverlay"; + public override Color OutlineColor => new Color(158, 158, 255); + public override Color CooldownStartColor => PowerActive ? Color.Lerp(new Color(255, 170, 204), new Color(72, 125, 204), PowerPercent) : new Color(72, 125, 204); + public override Color CooldownEndColor => PowerActive ? Color.Lerp(new Color(255, 170, 204), new Color(97, 255, 255), PowerPercent) : new Color(97, 255, 255); + public override SoundStyle? EndSound => SoundID.Item85; + + public override void OnCompleted() + { + Vector2 playerVelocity = instance.player.velocity / 8f; + if (!Main.dedServ) + { + for (int i = 0; i < 16; i++) + { + Vector2 bubblePos = instance.player.MountedCenter + Main.rand.NextVector2Circular(50f, 50f); + Vector2 bubbleSpeed = Main.rand.NextVector2Circular(1f, 1f) + playerVelocity; + Gore bubble = Gore.NewGoreDirect(instance.player.GetSource_Misc("1"), bubblePos, bubbleSpeed, 411, Main.rand.NextFloat(0.8f, 1.6f)); + bubble.timeLeft = 24 + Main.rand.Next(13); + bubble.type = 411; + } + } + } + + //Charge down at first, and then charge back up + private float AdjustedCompletion => CooldownRackUI.DebugFullDisplay ? CooldownRackUI.DebugForceCompletion : PowerActive ? PowerPercent : 1 - (instance.timeLeft / (float)VictideHeadBurrow.BurrowCooldown); + + public override void ApplyBarShaders(float opacity) + { + //Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + //Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + //Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Cooldowns/BubblyBurrow.png b/Cooldowns/BubblyBurrow.png new file mode 100644 index 0000000000..21b3a91620 Binary files /dev/null and b/Cooldowns/BubblyBurrow.png differ diff --git a/Cooldowns/BubblyBurrowCooldown.png b/Cooldowns/BubblyBurrowCooldown.png new file mode 100644 index 0000000000..2fd459cd2e Binary files /dev/null and b/Cooldowns/BubblyBurrowCooldown.png differ diff --git a/Cooldowns/BubblyBurrowOutline.png b/Cooldowns/BubblyBurrowOutline.png new file mode 100644 index 0000000000..76c2b5b9f7 Binary files /dev/null and b/Cooldowns/BubblyBurrowOutline.png differ diff --git a/Cooldowns/BubblyBurrowOverlay.png b/Cooldowns/BubblyBurrowOverlay.png new file mode 100644 index 0000000000..5327154aa6 Binary files /dev/null and b/Cooldowns/BubblyBurrowOverlay.png differ diff --git a/Cooldowns/LucreciaEnergy.cs b/Cooldowns/LucreciaEnergy.cs new file mode 100644 index 0000000000..23a6f489a9 --- /dev/null +++ b/Cooldowns/LucreciaEnergy.cs @@ -0,0 +1,75 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Melee.Shortswords; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.Audio; +using Terraria; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class LucreciaEnergy : CooldownHandler + { + private float AdjustedCompletion => instance.timeLeft / (float)Lucrecia.MaxEnergy; + private Color TextColor => Color.MediumPurple; + private Color TextBorderColor = Color.AntiqueWhite; + + public static new string ID => "LucreciaEnergy"; + public override bool CanTickDown => false; + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => $"CalamityMod/Cooldowns/{ID}"; + public override string OutlineTexture => $"CalamityMod/Cooldowns/{ID}Outline"; + public override string OverlayTexture => $"CalamityMod/Cooldowns/{ID}Overlay"; + + public override Color OutlineColor => Color.SlateGray; + public override Color CooldownStartColor => Color.Lerp(Color.Purple, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => Color.Lerp(Color.DarkBlue, Color.SlateGray, instance.Completion); + + public override void ApplyBarShaders(float opacity) + { + // Use the adjusted completion + GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor); + GameShaders.Misc["CalamityMod:CircularBarShader"].Apply(); + } + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + Texture2D sprite = Request(Texture).Value; + Texture2D outline = Request(OutlineTexture).Value; + Texture2D overlay = Request(OverlayTexture).Value; + + // Draw the outline + spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the icon + spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + // Draw the small overlay + int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion); + Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight); + spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f); + + Vector2 textOffset = new Vector2(instance.timeLeft > 9 ? -11f : -6f, 10f); + DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.timeLeft.ToString(), position + textOffset * scale, TextColor, TextBorderColor, scale); + } + } +} diff --git a/Cooldowns/LucreciaEnergy.png b/Cooldowns/LucreciaEnergy.png new file mode 100644 index 0000000000..9891d6fd0b Binary files /dev/null and b/Cooldowns/LucreciaEnergy.png differ diff --git a/Cooldowns/LucreciaEnergyOutline.png b/Cooldowns/LucreciaEnergyOutline.png new file mode 100644 index 0000000000..247f332da8 Binary files /dev/null and b/Cooldowns/LucreciaEnergyOutline.png differ diff --git a/Cooldowns/LucreciaEnergyOverlay.png b/Cooldowns/LucreciaEnergyOverlay.png new file mode 100644 index 0000000000..851597883b Binary files /dev/null and b/Cooldowns/LucreciaEnergyOverlay.png differ diff --git a/Cooldowns/M1GarandShots.cs b/Cooldowns/M1GarandShots.cs new file mode 100644 index 0000000000..200f8d1c05 --- /dev/null +++ b/Cooldowns/M1GarandShots.cs @@ -0,0 +1,43 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Cooldowns +{ + public class M1GarandShots : CooldownHandler + { + public float CompletionPercentage => MathF.Round(instance.Completion * 100); + private bool IsEmpty => CompletionPercentage == 100; + private float TextXOffset => -5.4f; + private Vector2 TextPosition => new(TextXOffset, 15); + private Color TextColor => Color.Silver; + private Color TextBorderColor = Color.DarkGoldenrod; + + public static new string ID => "M1GarandShots"; + public override bool CanTickDown => false; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override bool ShouldDisplay => instance.player.HeldItem.type == ItemType(); + public override string Texture => "CalamityMod/Cooldowns/" + ID; + + public override Color CooldownStartColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.DarkGoldenrod, Color.SlateGray, instance.Completion); + public override Color CooldownEndColor => IsEmpty ? Color.DimGray : Color.Lerp(Color.LightGoldenrodYellow, Color.SlateGray, instance.Completion); + + public override void DrawExpanded(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawExpanded(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().garandShots.ToString(), position + TextPosition, TextColor, TextBorderColor); + } + + public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale) + { + base.DrawCompact(spriteBatch, position, opacity, scale); + + CalamityUtils.DrawBorderStringEightWay(spriteBatch, FontAssets.MouseText.Value, instance.player.Calamity().garandShots.ToString(), position + TextPosition, TextColor, TextBorderColor); + } + } +} diff --git a/Cooldowns/M1GarandShots.png b/Cooldowns/M1GarandShots.png new file mode 100644 index 0000000000..b50e512ae9 Binary files /dev/null and b/Cooldowns/M1GarandShots.png differ diff --git a/Cooldowns/M1GarandShotsOutline.png b/Cooldowns/M1GarandShotsOutline.png new file mode 100644 index 0000000000..495f87eb5c Binary files /dev/null and b/Cooldowns/M1GarandShotsOutline.png differ diff --git a/Cooldowns/M1GarandShotsOverlay.png b/Cooldowns/M1GarandShotsOverlay.png new file mode 100644 index 0000000000..4d8b9e04e8 Binary files /dev/null and b/Cooldowns/M1GarandShotsOverlay.png differ diff --git a/Cooldowns/WardingWave.cs b/Cooldowns/WardingWave.cs new file mode 100644 index 0000000000..1a52fd7d48 --- /dev/null +++ b/Cooldowns/WardingWave.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class WardingWave : CooldownHandler + { + public static new string ID => "WardingWave"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.WardingWave"); + public override string Texture => "CalamityMod/Cooldowns/WardingWave"; + public override Color OutlineColor => new Color(158, 158, 255); + public override Color CooldownStartColor => new Color(72, 125, 204); + public override Color CooldownEndColor => new Color(97, 200, 255); + public override SoundStyle? EndSound => SoundID.Item85; + } +} diff --git a/Cooldowns/WardingWave.png b/Cooldowns/WardingWave.png new file mode 100644 index 0000000000..6e578a359e Binary files /dev/null and b/Cooldowns/WardingWave.png differ diff --git a/Cooldowns/WardingWaveOutline.png b/Cooldowns/WardingWaveOutline.png new file mode 100644 index 0000000000..558164d44e Binary files /dev/null and b/Cooldowns/WardingWaveOutline.png differ diff --git a/Cooldowns/WardingWaveOverlay.png b/Cooldowns/WardingWaveOverlay.png new file mode 100644 index 0000000000..4bc05e7014 Binary files /dev/null and b/Cooldowns/WardingWaveOverlay.png differ diff --git a/Cooldowns/WulfrumRoverDriveCooldowns.cs b/Cooldowns/WulfrumRoverDriveCooldowns.cs index e4c6485992..9df995f04a 100644 --- a/Cooldowns/WulfrumRoverDriveCooldowns.cs +++ b/Cooldowns/WulfrumRoverDriveCooldowns.cs @@ -91,12 +91,14 @@ namespace CalamityMod.Cooldowns public override Color CooldownStartColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); public override Color CooldownEndColor => Color.Lerp(ringColorLerpStart, ringColorLerpEnd, instance.Completion); + public override void Tick() => instance.player.Calamity().playedRoverDriveShieldSound = false; + // Rover Drive shields are recharged as a side effect of the cooldown completing client side public override void OnCompleted() { CalamityPlayer modPlayer = instance.player.Calamity(); - if (modPlayer.roverDrive) - modPlayer.RoverDriveShieldDurability = RoverDrive.ShieldDurabilityMax; + if (modPlayer.RoverDriveShieldDurability <= 0) + modPlayer.RoverDriveShieldDurability = 1; } public override SoundStyle? EndSound => RoverDrive.ActivationSound; public override bool ShouldPlayEndSound => instance.player.Calamity().roverDrive; diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 683b8a49b1..8c36c52d84 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -508,11 +508,7 @@ namespace CalamityMod.DataStructures { if (Procced) { - if (!player.moonLeech) - { - player.HealPlayer(OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); - } - + player.DoLifestealDirect(null, OmegaBiomeBlade.SuperPogoAttunement_PassiveLifeSteal); Procced = false; } } diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs new file mode 100644 index 0000000000..44e01e60ca --- /dev/null +++ b/DataStructures/DebuffData.cs @@ -0,0 +1,426 @@ +using System; +using System.Diagnostics; +using System.Security.Cryptography; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.DataStructures +{ + [ReinitializeDuringResizeArrays] + public static class BuffDatasets + { + public static DebuffData[] DebuffDataset = BuffID.Sets.Factory.CreateNamedSet("DebuffData") + .Description("Stores DebuffData for a particular debuff") + .RegisterCustomSet(null, + BuffID.OnFire, DebuffData.OnFire, + BuffID.OnFire3, DebuffData.Hellfire, + BuffID.CursedInferno, DebuffData.CursedInferno, + BuffID.ShadowFlame, DebuffData.Shadowflame, + BuffID.Daybreak, DebuffData.Daybroken, + BuffID.Frostburn, DebuffData.Frostburn, + BuffID.Frostburn2, DebuffData.Frostbite, + BuffID.Poisoned, DebuffData.Poisoned, + BuffID.Venom, DebuffData.AcidVenom, + BuffID.Electrified, DebuffData.Electrified + ); + } + public class DebuffData + { + /// + /// Determines the behavior of the debuff. + /// + public enum DebuffBehavior + { + Default, + Electric + } + #region DebuffData data + /// + /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR + /// Amount of life regen lost by a player under this debuff + /// For debuffs with unique scaling, this should usually be the "base" amount. + /// Defaults to 0 + /// + public float PlayerLostRegen = 0; + + /// + /// Amount of life regen lost by an enemy under this debuff. + /// For debuffs with unique scaling, this should usually be the "base" amount. + /// Defaults to 0 + /// + public float EnemyLostRegen = 0; + + /// + /// This is used to cancel Vanilla DoT damage on enemies and allow using Calamity's own instead. + /// + public int EnemyVanillaRegenToCancelOut = 0; + + /// + /// The minimum size of damage ticks from this debuff on an enemy. + /// Ticks can be larger than this due to MultiplierDamageTickSize + /// Defaults to 1 + /// + public int MinimumDamageTickSize = 1; + + /// + /// The size of damage ticks from this debuff on an enemy + /// This is based on the applied regen of the debuff, and will cause the tick to scale with amplifiers + /// Ticks can be larger than this due to MinimumDamageTickSize + /// Defaults to 0.25f + /// + public float MultiplierDamageTickSize = 0.25f; + + /// + /// How much this benefits from heat debuff amplifiers. + /// Default is 0, which means it does not benefit. + /// + public float HeatDebuffScaling = 0; + /// + /// How much this benefits from sickness debuff amplifiers. + /// Default is 0, which means it does not benefit. + /// + public float SicknessDebuffScaling = 0; + /// + /// How much this benefits from cold debuff amplifiers. + /// Default is 0, which means it does not benefit. + /// + public float ColdDebuffScaling = 0; + /// + /// How much this benefits from water debuff amplifiers. + /// Default is 0, which means it does not benefit. + /// + public float WaterDebuffScaling = 0; + /// + /// How much this benefits from electric debuff amplifiers. + /// Default is 0, which means it does not benefit. + /// + public float ElectricDebuffScaling = 0; + + /// + /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR + /// Whether or not this debuff should draw above inflicted NPCs. + /// Defaults to TRUE + /// + public bool DrawAboveNPC = true; + + /// + /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR + /// Whether or not gear can modify the debuff effects such as duration or damage on the player. + /// + public bool GearCanModifyDebuff = true; + + /// + /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR + /// How much alcohol this counts as. + /// Default is 0, most alcohol is 1, and Everclear is 2 + /// + public float AlcoholLevel = 0f; + + /// + /// UNIMPLEMENTED. WILL BE DONE IN A FUTURE PR + /// The UpdatePlayerLifeRegen code to run. Defaults to just applying DoT + /// + public UpdatePlayerLifeRegen PlayerUpdateMethod; + + /// + /// The UpdateNPCLifeRegen code to run. Defaults to just applying DoT + /// Parameters of the method should be (NPC npc, int buffType, ref int buffIndex, ref int damage) + /// + public UpdateNPCLifeRegen NPCLifeRegenMethod; + + public DebuffData() + { + PlayerUpdateMethod = DefaultUpdateOnPlayer; + NPCLifeRegenMethod = BaseUpdateNPCLifeRegen; + } + /// + /// Allows using DebuffBehavior to determine preset behavior + /// "electric" causes debuffs to scale 4x when moving + /// Uses default behavior if no known key is inputed + /// + /// This determines the type of behavior of the debuff + public DebuffData(DebuffBehavior behavior) + { + + PlayerUpdateMethod = DefaultUpdateOnPlayer; + if (behavior == DebuffBehavior.Electric) + NPCLifeRegenMethod = ElectricDebuffNPCLifeRegen; + else + NPCLifeRegenMethod = BaseUpdateNPCLifeRegen; + } + + /// + /// UNIMPLEMENTED. WILL BE IN A FUTURE PR + /// This is the code that should be run when updating the buff on a player. + /// Use for DoT damage. Other effects should be in the ModBuff class, or wherever appropriate. + /// + /// + public delegate void UpdatePlayerLifeRegen(Player player, int buffType, ref int buffIndex, ref int damage); + + /// + /// This is the code that should be run when updating life regen on NPC + /// Use for DoT damage. Other effects should be in the ModBuff class, or wherever appropriate. + /// + /// + public delegate void UpdateNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage); + + /// + /// Applies a scaling amount to a StatModifer + /// + /// + /// + /// + public static StatModifier ApplyScalingToStatModifer(StatModifier Modifer, float scaling) + { + StatModifier output = new(); + output += (Modifer.Additive-1) * scaling; + output *= 1 + (Modifer.Multiplicative-1) * scaling; + output.Base = Modifer.Base * scaling; + output.Flat = Modifer.Flat * scaling; + return output; + } + /// + /// Applies a scaling amount to a StatModifier but ensures all changes end up positive + /// + /// + /// + /// + public static StatModifier ForceModifierPositiveWithScaling(StatModifier Modifer, float scaling) + { + StatModifier output = new(); + output += MathHelper.Max((Modifer.Additive - 1) * scaling,0); + output *= MathHelper.Max(1 + (Modifer.Multiplicative - 1) * scaling,1); + output.Base = MathHelper.Max(Modifer.Base * scaling,0); + output.Flat = MathHelper.Max(Modifer.Flat * scaling, 0); + return output; + } + + /// + /// UNIMPLEMENTED. WILL BE IN A FUTURE PR + /// The default debuff DoT functionality on a player + /// + public void DefaultUpdateOnPlayer(Player player, int buffType, ref int buffIndex, ref int damage) + { + + } + + /// + /// The default debuff DoT functionality on enemies. + /// + public void BaseUpdateNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + float totalDPS = EnemyLostRegen; + StatModifier totalScaling = + HeatDebuffScaling + ColdDebuffScaling + SicknessDebuffScaling + WaterDebuffScaling + ElectricDebuffScaling != 0 + ? + ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier, HeatDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveColdDebuffMultiplier, ColdDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveSicknessDebuffMultiplier, SicknessDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveWaterDebuffMultiplier, WaterDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveElectricDebuffMultiplier, ElectricDebuffScaling) + )))) + : + cnpc.ActiveTypelessDebuffMultiplier; + totalDPS = totalScaling.ApplyTo(totalDPS); + var totalDPSAdjusted = totalDPS-EnemyVanillaRegenToCancelOut; + npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS*MultiplierDamageTickSize,MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + } + /// + /// DoT functionality that takes into account Electric debuff's 4x DPS when moving + /// + /// + /// + /// + /// + public void ElectricDebuffNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + float totalDPS = EnemyLostRegen; + StatModifier totalScaling = + HeatDebuffScaling + ColdDebuffScaling + SicknessDebuffScaling + WaterDebuffScaling + ElectricDebuffScaling != 0 + ? + ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier, HeatDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveColdDebuffMultiplier, ColdDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveSicknessDebuffMultiplier, SicknessDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveWaterDebuffMultiplier, WaterDebuffScaling) + .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveElectricDebuffMultiplier, ElectricDebuffScaling) + )))) + : + cnpc.ActiveTypelessDebuffMultiplier; + totalDPS = totalScaling.ApplyTo(totalDPS); + totalDPS *= (npc.velocity.X == 0 ? 1 : 4); + totalDPS -= EnemyVanillaRegenToCancelOut * (npc.velocity.X == 0 ? 1 : 5); //Vanilla Electrified is 5x when moving, not 4x + npc.Calamity().ApplyDPSDebuff((int)(totalDPS), (int)Math.Max(totalDPS * MultiplierDamageTickSize, MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + } + #region Special Regen Functions + /// + /// 18OCT2023: Ozzatron: im not gonna sugarcoat it + /// vanilla debuff damage from Daybreak impales scales linearly up to 8 for 800 DPS + /// instead of allowing this entire 800 DPS to be multiplied by heat weakness + heat DoT bonuses, + /// each Daybreak spear beyond the first is only affected 25% as much by weaknesses or resistances. + /// This also stops Daybreak's DPS from being utterly shafted by heat resistance. + /// As no other weapon can stack Daybroken, this has no effect on other weapons (they count as "1 Daybreak spear") + /// + /// + /// + /// + /// + public static void DaybrokenRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + int numImpaledSpears = 0; + for (int k = 0; k < Main.maxProjectiles; k++) + { + if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) + numImpaledSpears++; + } + + // If there are no Daybreak impaled spears, Daybroken has 1x potency (it was applied some other way) + float daybrokenMultiplier = numImpaledSpears <= 1 ? 1f : (1f + 0.25f * (numImpaledSpears - 1)); + int adjustedSpears = Math.Max(1, numImpaledSpears); + int baseDaybreakDoTValue = (int)(npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(Daybroken.EnemyLostRegen * adjustedSpears) + npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(Daybroken.EnemyLostRegen * 0.25f * (adjustedSpears - 1))); + var totalDPSAdjusted = baseDaybreakDoTValue - Daybroken.EnemyVanillaRegenToCancelOut*numImpaledSpears; + if (numImpaledSpears == 0) + { + totalDPSAdjusted -= Daybroken.EnemyVanillaRegenToCancelOut; + } + npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(baseDaybreakDoTValue * Daybroken.MultiplierDamageTickSize, Daybroken.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + } + /// + /// Apply Oiled DoT. + /// + public static void OiledNPCMethod(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + double totalDPS = ApplyScalingToStatModifer(cnpc.ActiveHeatDebuffMultiplier,Oiled.HeatDebuffScaling).ApplyTo(Oiled.EnemyLostRegen); + if (totalDPS <= 0) + return; + npc.Calamity().ApplyDPSDebuff((int)(totalDPS), damage+(int)Math.Max(totalDPS * Oiled.MultiplierDamageTickSize, Oiled.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + } + /// + /// Has Dryad's Bane scale with Calamity's town NPC buffs + /// + public static void DryadsBaneNPCMethod(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + // Buffs match 1:1 with Town NPC buffs + // See CalamityGlobalTownNPC: BuffTownNPC + float buffedDryadsBaneMult = 0f + + (NPC.downedMoonlord ? 0.6f : 0f) + + (DownedBossSystem.downedProvidence ? 0.2f : 0f) + + (DownedBossSystem.downedPolterghast ? 0.2f : 0f) + + (DownedBossSystem.downedDoG ? 0.2f : 0f) + + (DownedBossSystem.downedYharon ? 0.2f : 0f) + + (DownedBossSystem.downedExoMechs ? 0.6f : 0f) + + (DownedBossSystem.downedCalamitas ? 0.6f : 0f); + if (Main.expertMode) + buffedDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int buffedDryadsBaneDoTValue = 2 * (int)(4 * buffedDryadsBaneMult); + npc.lifeRegen -= buffedDryadsBaneDoTValue; + + // Scales damage tick if greater than the vanilla amount + float vanillaDryadsBaneMult = 1f + + (NPC.downedBoss1 ? 0.1f : 0f) + + (NPC.downedBoss2 ? 0.1f : 0f) + + (NPC.downedBoss3 ? 0.1f : 0f) + + (NPC.downedQueenBee ? 0.1f : 0f) + + (Main.hardMode ? 0.4f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedMechBoss1 ? 0.15f : 0f) + + (NPC.downedPlantBoss ? 0.15f : 0f) + + (NPC.downedGolemBoss ? 0.15f : 0f) + + (NPC.downedAncientCultist ? 0.15f : 0f); + if (Main.expertMode) + vanillaDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; + int totalDryadsBaneDoTValue = 2 * (int)(4 * vanillaDryadsBaneMult) + buffedDryadsBaneDoTValue; + if (damage < totalDryadsBaneDoTValue / 6) + damage = totalDryadsBaneDoTValue / 6; + } + + #endregion + #endregion + + #region Vanilla debuff stats + public static DebuffData OnFire = new DebuffData() + { + EnemyLostRegen = 12, + EnemyVanillaRegenToCancelOut = 12, + HeatDebuffScaling = 1 + }; + public static DebuffData Hellfire = new DebuffData() + { + EnemyLostRegen = 30, + EnemyVanillaRegenToCancelOut = 30, + HeatDebuffScaling = 1 + }; + public static DebuffData CursedInferno = new DebuffData() + { + EnemyLostRegen = 48, + EnemyVanillaRegenToCancelOut = 48, + HeatDebuffScaling = 1 + }; + public static DebuffData Shadowflame = new DebuffData() + { + EnemyLostRegen = 60, + EnemyVanillaRegenToCancelOut = 60, + HeatDebuffScaling = 1 + }; + public static DebuffData Daybroken = new DebuffData() + { + EnemyLostRegen = 200, + EnemyVanillaRegenToCancelOut = 200, + HeatDebuffScaling = 1, + NPCLifeRegenMethod = DaybrokenRegen + }; + public static DebuffData Frostburn = new DebuffData() + { + EnemyLostRegen = 16, + EnemyVanillaRegenToCancelOut = 16, + ColdDebuffScaling = 1 + }; + public static DebuffData Frostbite = new DebuffData() + { + EnemyLostRegen = 50, + EnemyVanillaRegenToCancelOut = 50, + ColdDebuffScaling = 1 + }; + public static DebuffData Poisoned = new DebuffData() + { + EnemyLostRegen = 12, + EnemyVanillaRegenToCancelOut = 12, + SicknessDebuffScaling = 1 + }; + public static DebuffData AcidVenom = new DebuffData() + { + EnemyLostRegen = 60, + EnemyVanillaRegenToCancelOut = 60, + SicknessDebuffScaling = 1 + }; + public static DebuffData Electrified = new DebuffData(DebuffBehavior.Electric) + { + EnemyLostRegen = 21, + EnemyVanillaRegenToCancelOut = 8, + ElectricDebuffScaling = 1 + }; + public static DebuffData Oiled = new DebuffData() + { + EnemyLostRegen = 50, //This is how much DPS Oiled does when applied alongside a valid debuff + EnemyVanillaRegenToCancelOut = 50, + HeatDebuffScaling = 2, //Oiled scales twice as hard with heat debuff scaling to reward debuff builds who use such a rare and difficult to apply debuff. + NPCLifeRegenMethod = OiledNPCMethod + }; + public static DebuffData DryadsBane = new DebuffData() + { + EnemyLostRegen = 8, //This is not used in the method, serves as a token amount for anything that may need to interface in the future. + NPCLifeRegenMethod = DryadsBaneNPCMethod + }; + #endregion + } +} diff --git a/DataStructures/GemTechArmorState.cs b/DataStructures/GemTechArmorState.cs index 9ec1260c35..d571a9cd05 100644 --- a/DataStructures/GemTechArmorState.cs +++ b/DataStructures/GemTechArmorState.cs @@ -314,6 +314,7 @@ namespace CalamityMod.DataStructures if (IsGreenGemActive) { + Owner.Calamity().ammoCost *= GemTechHeadgear.RangedAmmoReduction; Owner.GetCritChance() += (int)(GemTechHeadgear.RangedCritBoost * 100f); Owner.GetDamage() += GemTechHeadgear.RangedDamageBoost; } diff --git a/DataStructures/NPCStats.cs b/DataStructures/NPCStats.cs deleted file mode 100644 index b9bca0a0aa..0000000000 --- a/DataStructures/NPCStats.cs +++ /dev/null @@ -1,880 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.PrimordialWyrm; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.World; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod -{ - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. - public static partial class NPCStats - { - private const double ExpertContactVanillaMultiplier = 2D; - private const double MasterContactVanillaMultiplier = 3D; - private const double NormalProjectileVanillaMultiplier = 2D; - private const double ExpertProjectileVanillaMultiplier = 4D; - private const double MasterProjectileVanillaMultiplier = 6D; - - #region Enemy Stats Container Struct - internal partial struct EnemyStats - { - public static SortedDictionary ExpertDamageMultiplier; - public static SortedDictionary ContactDamageValues; - public static SortedDictionary, int[]> ProjectileDamageValues; - }; - #endregion - - #region Stat Retrieval Methods - public static void GetNPCDamage(this NPC npc) - { - double damageAdjustment = GetExpertDamageMultiplier(npc) * (Main.masterMode ? MasterContactVanillaMultiplier : ExpertContactVanillaMultiplier); - - // Safety check: If for some reason the contact damage array is not initialized yet, set the NPC's damage to 1. - bool exists = EnemyStats.ContactDamageValues.TryGetValue(npc.type, out int[] contactDamage); - if (!exists) - npc.damage = 1; - - int normalDamage = contactDamage[0]; - int expertDamage = contactDamage[1] == -1 ? -1 : (int)Math.Round(contactDamage[1] / damageAdjustment); - int revengeanceDamage = contactDamage[2] == -1 ? -1 : (int)Math.Round(contactDamage[2] / damageAdjustment); - int deathDamage = contactDamage[3] == -1 ? -1 : (int)Math.Round(contactDamage[3] / damageAdjustment); - int masterDamage = contactDamage[4] == -1 ? -1 : (int)Math.Round(contactDamage[4] / damageAdjustment); - - // If the assigned value would be -1, don't actually assign it. This allows for conditionally disabling the system. - int damageToUse = Main.masterMode ? masterDamage : CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; - if (damageToUse != -1) - npc.damage = damageToUse; - } - - // Gets the amount of damage a given projectile should do from this NPC. - // Automatically compensates for Terraria's internal spaghetti scaling. - public static int GetProjectileDamage(this NPC npc, int projType) - { - double damageAdjustment = Main.masterMode ? MasterProjectileVanillaMultiplier : Main.expertMode ? ExpertProjectileVanillaMultiplier : NormalProjectileVanillaMultiplier; - - // Safety check: If for some reason the projectile damage array is not initialized yet, return 1. - bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npc.type, projType), out int[] projectileDamage); - if (!exists) - return 1; - - int normalDamage = (int)Math.Round(projectileDamage[0] / damageAdjustment); - int expertDamage = (int)Math.Round(projectileDamage[1] / damageAdjustment); - int revengeanceDamage = (int)Math.Round(projectileDamage[2] / damageAdjustment); - int deathDamage = (int)Math.Round(projectileDamage[3] / damageAdjustment); - int masterDamage = (int)Math.Round(projectileDamage[4] / damageAdjustment); - - int damageToUse = Main.masterMode ? masterDamage : CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; - - return damageToUse; - } - - // Gets the amount of damage this projectile should do from a given NPC. - // Automatically compensates for Terraria's internal spaghetti scaling. - public static int GetProjectileDamage(this Projectile projectile, int npcType) - { - double damageAdjustment = Main.masterMode ? MasterProjectileVanillaMultiplier : Main.expertMode ? ExpertProjectileVanillaMultiplier : NormalProjectileVanillaMultiplier; - - // Safety check: If for some reason the projectile damage array is not initialized yet, return 1. - bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npcType, projectile.type), out int[] projectileDamage); - if (!exists) - return 1; - - int normalDamage = (int)Math.Round(projectileDamage[0] / damageAdjustment); - int expertDamage = (int)Math.Round(projectileDamage[1] / damageAdjustment); - int revengeanceDamage = (int)Math.Round(projectileDamage[2] / damageAdjustment); - int deathDamage = (int)Math.Round(projectileDamage[3] / damageAdjustment); - int masterDamage = (int)Math.Round(projectileDamage[4] / damageAdjustment); - - int damageToUse = Main.masterMode ? masterDamage : CalamityWorld.death ? deathDamage : CalamityWorld.revenge ? revengeanceDamage : Main.expertMode ? expertDamage : normalDamage; - - return damageToUse; - } - - // Gets the raw amount of damage a projectile should do from this NPC. - // That is, this doesn't adjust the value to compensate for Terraria's internal spaghetti scaling. - public static int GetProjectileDamageNoScaling(this NPC npc, int projType) - { - bool exists = EnemyStats.ProjectileDamageValues.TryGetValue(new Tuple(npc.type, projType), out int[] projectileDamage); - return !exists ? 1 // Base case for safety, in case the array is not initialized yet. - : Main.masterMode ? projectileDamage[4] - : CalamityWorld.death ? projectileDamage[3] - : CalamityWorld.revenge ? projectileDamage[2] - : Main.expertMode ? projectileDamage[1] - : projectileDamage[0]; - } - - /// - /// Gets the Expert/Master Mode damage multiplier for the specified boss NPC. - /// Useful for determining the base damage a boss NPC should have prior to being run through the Expert/Master scaling code. - /// - /// The NPC you want to get the damage multiplier for - /// Whether Master Mode is enabled or not - /// - public static double GetExpertDamageMultiplier(this NPC npc, bool? master = null) - { - bool exists = EnemyStats.ExpertDamageMultiplier.TryGetValue(npc.type, out double damageMult); - return exists ? damageMult : 1D; - } - #endregion - - #region Load/Unload - internal static void Load() - { - LoadEnemyStats(); - LoadDebuffs(); - } - internal static void Unload() - { - UnloadEnemyStats(); - UnloadDebuffs(); - } - - // A static function, called exactly once, which initializes the EnemyStats struct at a predictable time. - // This is necessary to ensure this dictionary is populated as early as possible. - internal static void LoadEnemyStats() - { - EnemyStats.ExpertDamageMultiplier = new SortedDictionary - { - { NPCID.KingSlime, 0.8 }, - - { ModContent.NPCType(), 1.1 }, - - { ModContent.NPCType(), 0.8 }, - - { NPCID.EaterofWorldsHead, 1.1 }, - { NPCID.EaterofWorldsBody, 0.8 }, - { NPCID.EaterofWorldsTail, 0.8 }, - - { NPCID.BrainofCthulhu, 0.9 }, - - { ModContent.NPCType(), 0.9 }, - - { ModContent.NPCType(), 0.9 }, - - { NPCID.QueenBee, 0.9 }, - { NPCID.Bee, 0.6 }, - { NPCID.BeeSmall, 0.6 }, - - { NPCID.SkeletronHead, 1.1 }, - { NPCID.SkeletronHand, 1.1 }, - - { NPCID.WallofFlesh, 1.5 }, - { NPCID.WallofFleshEye, 1.5 }, - - { ModContent.NPCType(), 1.15 }, - - { NPCID.Spazmatism, 0.85 }, - { NPCID.Retinazer, 0.85 }, - { ModContent.NPCType(), 0.85 }, - - { ModContent.NPCType(), 1.1 }, - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { NPCID.TheDestroyer, 2 }, - { NPCID.TheDestroyerBody, 0.85 }, - { NPCID.TheDestroyerTail, 0.85 }, - - { ModContent.NPCType(), 0.8 }, - - { NPCID.SkeletronPrime, 0.85 }, - { ModContent.NPCType(), 0.85 }, - { NPCID.PrimeCannon, 0.85 }, - { NPCID.PrimeLaser, 0.85 }, - { NPCID.PrimeSaw, 0.85 }, - { NPCID.PrimeVice, 0.85 }, - - { ModContent.NPCType(), 0.8 }, - - { NPCID.Plantera, 1.15 }, - { NPCID.PlanterasTentacle, 1.15 }, - { ModContent.NPCType(), 1.15 }, - - { NPCID.HallowBoss, 0.6875 }, - - { ModContent.NPCType(), 1.2 }, - { ModContent.NPCType(), 0.8 }, - { NPCID.DetonatingBubble, 0.75 }, - - { ModContent.NPCType(), 1.1 }, - - { NPCID.Golem, 0.8 }, - { NPCID.GolemHead, 0.8 }, - { NPCID.GolemFistLeft, 0.8 }, - { NPCID.GolemFistRight, 0.8 }, - - { ModContent.NPCType(), 0.9 }, - - { NPCID.DukeFishron, 0.7 }, - { NPCID.Sharkron, 0.75 }, - { NPCID.Sharkron2, 0.75 }, - - { ModContent.NPCType(), 0.8 }, - - { NPCID.CultistDragonHead, 0.75 }, - { NPCID.CultistDragonBody1, 0.75 }, - { NPCID.CultistDragonBody2, 0.75 }, - { NPCID.CultistDragonBody3, 0.75 }, - { NPCID.CultistDragonBody4, 0.75 }, - { NPCID.CultistDragonTail, 0.75 }, - { NPCID.AncientDoom, 0.75 }, - { NPCID.AncientLight, 0.75 }, - - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.9 }, - - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.9 }, - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.85 }, - { ModContent.NPCType(), 0.85 }, - - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - { ModContent.NPCType(), 0.8 }, - - { ModContent.NPCType(), 0.8 } - }; - - EnemyStats.ContactDamageValues = new SortedDictionary - { - { NPCID.KingSlime, new int[] { 40, 64, 80, 96, 144 } }, - { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, - - { ModContent.NPCType(), new int[] { 45, 66, 88, 110, 165 } }, - { ModContent.NPCType(), new int[] { 24, 32, 40, 48, 72 } }, - { ModContent.NPCType(), new int[] { 18, 24, 30, 36, 54 } }, - { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, - { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 63 } }, - { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 36 } }, - { ModContent.NPCType(), new int[] { 30, 44, 60, 76, 114 } }, - { ModContent.NPCType(), new int[] { 21, 28, 32, 36, 63 } }, - { ModContent.NPCType(), new int[] { 12, 16, 20, 24, 36 } }, - - { NPCID.EyeofCthulhu, new int[] { - 24, // 36 in phase 2 - 30, // 45 in phase 2 - 40, // 48 in phase 2, 56 in phase 3 - 50, // 60 in phase 2, 70 in phase 3 - 75 } }, // Vanilla: 113 in phase 2; Rev+: 90 in phase 2, 105 in phase 3 - { NPCID.ServantofCthulhu, new int[] { 18, 24, 30, 36, 54 } }, - { ModContent.NPCType(), new int[] { 20, 26, 34, 42, 63 } }, // In phase 2: 26, 34, 44, 55, 82 - - { ModContent.NPCType(), new int[] { 40, 64, 80, 96, 144 } }, - { ModContent.NPCType(), new int[] { 25, 50, 62, 74, 111 } }, - - { NPCID.EaterofWorldsHead, new int[] { 38, 55, 77, 99, 165 } }, - { NPCID.EaterofWorldsBody, new int[] { 18, 24, 32, 40, 60 } }, - { NPCID.EaterofWorldsTail, new int[] { 12, 16, 24, 32, 48 } }, - { NPCID.VileSpitEaterOfWorlds, new int[] { -1, 64, 64, 64, 96 } }, - - { NPCID.BrainofCthulhu, new int[] { 36, 54, 81, 108, 162 } }, - { NPCID.Creeper, new int[] { 24, 36, 66, 96, 144 } }, - - { ModContent.NPCType(), new int[] { 42, 63, 81, 99, 162 } }, - { ModContent.NPCType(), new int[] { 30, 50, 62, 74, 111 } }, - - { ModContent.NPCType(), new int[] { 36, 54, 63, 72, 108 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, - { ModContent.NPCType(), new int[] { 28, 48, 56, 64, 96 } }, - { ModContent.NPCType(), new int[] { 22, 36, 42, 48, 72 } }, - { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 147 } }, - { ModContent.NPCType(), new int[] { 24, 42, 50, 58, 87 } }, - { ModContent.NPCType(), new int[] { 18, 28, 34, 40, 60 } }, - { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 126 } }, - { ModContent.NPCType(), new int[] { 20, 36, 42, 48, 72 } }, - { ModContent.NPCType(), new int[] { 14, 20, 26, 32, 48 } }, - - { NPCID.QueenBee, new int[] { 36, 54, 81, 108, 162 } }, - { NPCID.Bee, new int[] { 20, 24, 48, 72, 108 } }, - { NPCID.BeeSmall, new int[] { 15, 18, 36, 54, 81 } }, - - { NPCID.SkeletronHead, new int[] { - 42, // 55 while spinning - 77, // 100 while spinning - 88, // 114 while spinning - 99, // 128 while spinning - 165 } }, // 215 while spinning - { NPCID.SkeletronHand, new int[] { 32, 44, 77, 110, 165 } }, - - { NPCID.Deerclops, new int[] { 20, 40, 50, 60, 90 } }, - - { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 168 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, - { ModContent.NPCType(), new int[] { 48, 80, 96, 112, 168 } }, - { ModContent.NPCType(), new int[] { 60, 100, 120, 140, 210 } }, - { ModContent.NPCType(), new int[] { 54, 90, 108, 126, 189 } }, - { ModContent.NPCType(), new int[] { 36, 60, 72, 84, 126 } }, - { ModContent.NPCType(), new int[] { 24, 40, 48, 56, 84 } }, - { ModContent.NPCType(), new int[] { 42, 70, 84, 98, 147 } }, - { ModContent.NPCType(), new int[] { 30, 50, 60, 70, 105 } }, - - { NPCID.WallofFlesh, new int[] { 100, 150, 180, 210, 315 } }, - { NPCID.WallofFleshEye, new int[] { 100, 150, 180, 210, 315 } }, - { NPCID.TheHungry, new int[] { - 30, // Ranges from 30 to 75 depending on WoF life - 60, // Ranges from 60 to 150 depending on WoF life - 60, // Ranges from 60 to 150 depending on WoF life - 60, // Ranges from 60 to 150 depending on WoF life - 90 } }, // Ranges from 90 to 225 depending on WoF life - { NPCID.TheHungryII, new int[] { 30, 60, 74, 88, 132 } }, - { NPCID.LeechHead, new int[] { 26, 52, 62, 72, 108 } }, - { NPCID.LeechBody, new int[] { 22, 44, 52, 60, 90 } }, - { NPCID.LeechTail, new int[] { 18, 36, 42, 48, 72 } }, - - { NPCID.QueenSlimeBoss, new int[] { 80, 120, 150, 180, 270 } }, - { NPCID.QueenSlimeMinionBlue, new int[] { 60, 80, 100, 120, 180 } }, - { NPCID.QueenSlimeMinionPink, new int[] { 60, 80, 100, 120, 180 } }, - { NPCID.QueenSlimeMinionPurple, new int[] { 70, 100, 120, 140, 210 } }, - - { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, - { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, - - { NPCID.Spazmatism, new int[] { - 70, // 105 in phase 2 - 102, // 153 in phase 2 - 119, // 178 in phase 2 - 136, // 204 in phase 2 - 204 } }, // 306 in phase 2 - { NPCID.Retinazer, new int[] { - 55, // 83 in phase 2 - 85, // 127 in phase 2 - 102, // 153 in phase 2 - 119, // 178 in phase 2 - 153 } }, // 229 in phase 2 - { ModContent.NPCType(), new int[] { - 62, // 93 in phase 2 - 94, // 141 in phase 2 - 110, // 165 in phase 2 - 128, // 192 in phase 2 - 178 } }, // 267 in phase 2 - - { ModContent.NPCType(), new int[] { 110, 176, 187, 198, 330 } }, - { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 240 } }, - { ModContent.NPCType(), new int[] { 70, 104, 112, 120, 192 } }, - { ModContent.NPCType(), new int[] { 65, 96, 104, 112, 168 } }, - - { NPCID.TheDestroyer, new int[] { 140, 280, 300, 320, 480 } }, - { NPCID.TheDestroyerBody, new int[] { 70, 102, 136, 170, 255 } }, - { NPCID.TheDestroyerTail, new int[] { 45, 68, 102, 136, 204 } }, - - { ModContent.NPCType(), new int[] { 75, 112, 136, 160, 240 } }, - - { NPCID.SkeletronPrime, new int[] { - 50, // 100 while spinning - 85, // 170 while spinning - 102, // 204 while spinning - 119, // 238 while spinning - 153 } }, // 306 while spinning - { ModContent.NPCType(), new int[] { - 50, // 100 while spinning - 85, // 170 while spinning - 102, // 204 while spinning - 119, // 238 while spinning - 153 } }, // 306 while spinning - { NPCID.PrimeVice, new int[] { 70, 102, 136, 170, 255 } }, - { NPCID.PrimeSaw, new int[] { 70, 102, 136, 170, 255 } }, - { NPCID.PrimeCannon, new int[] { 30, 51, 68, 85, 102 } }, - { NPCID.PrimeLaser, new int[] { 30, 51, 68, 85, 102 } }, - - { ModContent.NPCType(), new int[] { 95, 144, 168, 192, 288 } }, - { ModContent.NPCType(), new int[] { 80, 120, 138, 156, 240 } }, - { ModContent.NPCType(), new int[] { 85, 130, 150, 170, 255 } }, - - { NPCID.Plantera, new int[] { - 70, // 98 in phase 2 - 100, // 140 in phase 2 - 138, // 193 in phase 2 - 176, // 246 in phase 2 - 276 } }, // 386 in phase 2 - { NPCID.PlanterasTentacle, new int[] { 90, 138, 161, 184, 276 } }, - { ModContent.NPCType(), new int[] { 90, 138, 161, 184, 276 } }, - { NPCID.Spore, new int[] { 90, 140, 160, 180, 270 } }, - - { NPCID.HallowBoss, new int[] { 80, // 120 during charge - 110, // 165 during charge - 143, // 215 during charge - 176, // 264 during charge - 264 } }, // 396 during charge - - { ModContent.NPCType(), new int[] { 140, 216, 240, 264, 414 } }, - { ModContent.NPCType(), new int[] { - 75, // 113 during charge - 112, // 168 during charge - 136, // 204 during charge - 160, // 240 during charge - 240 } }, // 360 during charge - { ModContent.NPCType(), new int[] { 70, 110, 126, 142, 210 } }, - { NPCID.DetonatingBubble, new int[] { 100, 150, 180, 210, 315 } }, - { ModContent.NPCType(), new int[] { 90, 140, 160, 180, 270 } }, - - { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 429 } }, - { ModContent.NPCType(), new int[] { 75, 112, 128, 144, 225 } }, - - { NPCID.Golem, new int[] { 95, 144, 176, 208, 312 } }, - { NPCID.GolemHead, new int[] { 85, 128, 144, 160, 240 } }, - { NPCID.GolemFistLeft, new int[] { 75, 112, 144, 176, 264 } }, - { NPCID.GolemFistRight, new int[] { 75, 112, 144, 176, 264 } }, - - { ModContent.NPCType(), new int[] { 120, 180, 216, 252, 378 } }, - { ModContent.NPCType(), new int[] { 120, 180, 210, 240, 360 } }, - { ModContent.NPCType(), new int[] { 130, 200, 240, 280, 420 } }, - - { NPCID.DukeFishron, new int[] { - 100, // 120 in phase 2 - 140, // 202 in phase 2, 185 in phase 3 - 168, // 242 in phase 2, 222 in phase 3 - 196, // 282 in phase 2, 259 in phase 3 - 294 } }, // 423 in phase 2, 388 in phase 3 - { NPCID.Sharkron, new int[] { 100, 150, 180, 210, 315 } }, - { NPCID.Sharkron2, new int[] { 120, 180, 210, 240, 360 } }, - - { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 384 } }, - { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, - { ModContent.NPCType(), new int[] { 105, 160, 180, 200, 315 } }, - { ModContent.NPCType(), new int[] { 130, 192, 224, 256, 390 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 336 } }, - - { NPCID.CultistDragonHead, new int[] { 120, 180, 210, 240, 360 } }, - { NPCID.CultistDragonBody1, new int[] { 60, 90, 105, 120, 180 } }, - { NPCID.CultistDragonBody2, new int[] { 60, 90, 105, 120, 180 } }, - { NPCID.CultistDragonBody3, new int[] { 60, 90, 105, 120, 180 } }, - { NPCID.CultistDragonBody4, new int[] { 60, 90, 105, 120, 180 } }, - { NPCID.CultistDragonTail, new int[] { 60, 90, 105, 120, 180 } }, - { NPCID.AncientCultistSquidhead, new int[] { 120, 180, 210, 240, 360 } }, - { NPCID.AncientLight, new int[] { 120, 180, 210, 240, 360 } }, - - { ModContent.NPCType(), new int[] { 160, 240, 268, 296, 480 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 336 } }, - { ModContent.NPCType(), new int[] { 85, 128, 160, 192, 288 } }, - - { ModContent.NPCType(), new int[] { 150, 224, 256, 288, 444 } }, - { ModContent.NPCType(), new int[] { 160, 240, 264, 288, 405 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 240, 300 } }, - { ModContent.NPCType(), new int[] { 100, 200, 220, 232, 300 } }, - - { ModContent.NPCType(), new int[] { 170, 256, 288, 320, 504 } }, - { ModContent.NPCType(), new int[] { 145, 220, 242, 264, 435 } }, - - { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, - { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, - - { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, - { ModContent.NPCType(), new int[] { 125, 192, 224, 256, 372 } }, - { ModContent.NPCType(), new int[] { 105, 160, 192, 224, 312 } }, - - { ModContent.NPCType(), new int[] { 210, 315, 351, 387, 621 } }, - { ModContent.NPCType(), new int[] { 175, 260, 288, 316, 525 } }, - { ModContent.NPCType(), new int[] { 190, 280, 300, 320, 570 } }, - - { ModContent.NPCType(), new int[] { - 160, // 192 in phase 2, 224 in phase 3 - 240, // 288 in phase 2, 336 in phase 3 - 264, // 317 in phase 2, 370 in phase 3 - 288, // 346 in phase 2, 403 in phase 3 - 480 } }, // 576 in phase 2, 672 in phase 3 - { ModContent.NPCType(), new int[] { 224, 336, 370, 403, 672 } }, - - { ModContent.NPCType(), new int[] { - 192, // 211 in phase 2, 230 in phase 3 - 288, // 317 in phase 2, 346 in phase 3 - 324, // 356 in phase 2, 389 in phase 3 - 360, // 396 in phase 2, 432 in phase 3 - 567 } }, // 624 in phase 2, 680 in phase 3 - { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, - { ModContent.NPCType(), new int[] { 192, 288, 328, 368, 576 } }, - - { ModContent.NPCType(), new int[] { 470, 700, 750, 800, 1410 } }, - { ModContent.NPCType(), new int[] { 250, 374, 425, 476, 714 } }, - { ModContent.NPCType(), new int[] { 204, 306, 340, 374, 612 } }, - { ModContent.NPCType(), new int[] { 240, 360, 396, 432, 720 } }, - { ModContent.NPCType(), new int[] { 175, 260, 290, 320, 525 } }, - { ModContent.NPCType(), new int[] { 135, 200, 230, 260, 405 } }, - - { ModContent.NPCType(), new int[] { 300, 448, 480, 512, 900 } }, - - { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, - - { ModContent.NPCType(), new int[] { 340, 512, 544, 576, 1020 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, - - { ModContent.NPCType(), new int[] { 375, 560, 592, 624, 1116 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, - { ModContent.NPCType(), new int[] { 320, 480, 512, 544, 960 } }, - { ModContent.NPCType(), new int[] { 270, 400, 424, 448, 804 } }, - - { ModContent.NPCType(), new int[] { 535, 800, 850, 900, 1596 } } - }; - - EnemyStats.ProjectileDamageValues = new SortedDictionary, int[]> - { - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - - { new Tuple(NPCID.EyeofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 26, 44, 60, 76, 114 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.BloodShot), new int[] { 26, 36, 44, 52, 84 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 32, 48, 60, 72, 108 } }, - - { new Tuple(NPCID.EaterofWorldsHead, ProjectileID.CursedFlameHostile), new int[] { 26, 44, 60, 76, 114 } }, - { new Tuple(NPCID.EaterofWorldsHead, ModContent.ProjectileType()), new int[] { 26, 36, 44, 52, 84 } }, - - { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodNautilusShot), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(NPCID.BrainofCthulhu, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 114 } }, - { new Tuple(NPCID.Creeper, ProjectileID.BloodShot), new int[] { 26, 44, 60, 76, 114 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 108 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 30, 48, 60, 72, 108 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 22, 36, 44, 52, 84 } }, - - { new Tuple(NPCID.QueenBee, ProjectileID.QueenBeeStinger), new int[] { 22, 44, 64, 84, 126 } }, - { new Tuple(NPCID.QueenBee, ModContent.ProjectileType()), new int[] { 46, 72, 84, 96, 144 } }, // Beenade Bees: 122 (death mode-exclusive) - - { new Tuple(NPCID.SkeletronHead, ProjectileID.Skull), new int[] { 46, 72, 84, 96, 144 } }, - { new Tuple(NPCID.SkeletronHead, ProjectileID.Shadowflames), new int[] { 36, 72, 88, 104, 156 } }, - { new Tuple(NPCID.SkeletronHand, ProjectileID.Skull), new int[] { 36, 56, 68, 80, 120 } }, - - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsIceSpike), new int[] { 26, 52, 76, 100, 150 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.DeerclopsRangedProjectile), new int[] { 36, 72, 88, 104, 156 } }, - { new Tuple(NPCID.Deerclops, ProjectileID.InsanityShadowHostile), new int[] { 20, 40, 60, 80, 120 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 150 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 150 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 42, 68, 84, 100, 150 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 38, 60, 76, 92, 138 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 34, 52, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 36, 56, 68, 80, 120 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 24, 48, 60, 72, 108 } }, - - { new Tuple(NPCID.WallofFleshEye, ProjectileID.EyeLaser), new int[] { 36, 72, 88, 104, 156 } }, - { new Tuple(NPCID.WallofFlesh, ProjectileID.DemonSickle), new int[] { 52, 92, 112, 132, 198 } }, - { new Tuple(NPCID.WallofFlesh, ProjectileID.Fireball), new int[] { 36, 72, 88, 104, 156 } }, - - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeGelAttack), new int[] { 60, 120, 136, 152, 228 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeSmash), new int[] { 80, 160, 188, 216, 324 } }, - { new Tuple(NPCID.QueenSlimeBoss, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 198 } }, - { new Tuple(NPCID.QueenSlimeMinionBlue, ProjectileID.QueenSlimeMinionBlueSpike), new int[] { 52, 92, 112, 132, 198 } }, - { new Tuple(NPCID.QueenSlimeMinionPink, ProjectileID.QueenSlimeMinionPinkBall), new int[] { 52, 92, 112, 132, 198 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 198 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 52, 92, 112, 132, 198 } }, - - { new Tuple(NPCID.Retinazer, ProjectileID.EyeLaser), new int[] { 40, 92, 116, 140, 210 } }, - { new Tuple(NPCID.Retinazer, ProjectileID.DeathLaser), new int[] { - 50, // 38 in rapid fire - 108, // 81 in rapid fire - 132, // 99 in rapid fire - 156, // 117 in rapid fire - 234 } }, // 176 in rapid fire - { new Tuple(NPCID.Retinazer, ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, - { new Tuple(NPCID.Spazmatism, ProjectileID.CursedFlameHostile), new int[] { 50, 100, 120, 140, 210 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 120, 148, 176, 264 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, - { new Tuple(NPCID.Spazmatism, ModContent.ProjectileType()), new int[] { 60, 100, 128, 156, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 50, 108, 132, 156, 234 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 148, 176, 264 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 60, 100, 120, 140, 210 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 120, 136, 152, 228 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 66, 112, 128, 144, 216 } }, - - { new Tuple(NPCID.TheDestroyer, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 204 } }, - { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 222 } }, - { new Tuple(NPCID.TheDestroyer, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 234 } }, - { new Tuple(NPCID.TheDestroyerBody, ProjectileID.DeathLaser), new int[] { 44, 96, 116, 136, 204 } }, - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 46, 108, 128, 148, 222 } }, - { new Tuple(NPCID.TheDestroyerBody, ModContent.ProjectileType()), new int[] { 48, 116, 136, 156, 234 } }, - { new Tuple(NPCID.Probe, ProjectileID.PinkLaser), new int[] { 50, 88, 100, 112, 168 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 200, 240, 280, 420 } }, // Split shots: 72, 120, 144, 168, 252 - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - - { new Tuple(NPCID.SkeletronPrime, ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } }, - { new Tuple(NPCID.SkeletronPrime, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.Skull), new int[] { 50, 108, 124, 140, 210 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 180, 200, 300 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.FrostBeam), new int[] { 50, 108, 124, 140, 210 } }, - { new Tuple(NPCID.PrimeCannon, ProjectileID.RocketSkeleton), new int[] { 60, 120, 148, 176, 264 } }, - { new Tuple(NPCID.PrimeCannon, ProjectileID.BombSkeletronPrime), new int[] { 80, 160, 0, 0, 300 } }, - { new Tuple(NPCID.PrimeLaser, ProjectileID.DeathLaser), new int[] { 50, 108, 124, 140, 210 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 70, 112, 128, 144, 216 } }, - - { new Tuple(NPCID.Plantera, ProjectileID.SeedPlantera), new int[] { 52, 96, 128, 160, 240 } }, - { new Tuple(NPCID.Plantera, ProjectileID.PoisonSeedPlantera), new int[] { 62, 116, 144, 172, 258 } }, - { new Tuple(NPCID.Plantera, ProjectileID.ThornBall), new int[] { 72, 132, 160, 188, 282 } }, - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(NPCID.Plantera, ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossRainbowStreak), new int[] { 100, 152, 172, 192, 300 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenSunDance), new int[] { 120, 180, 204, 228, 360 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.HallowBossLastingRainbow), new int[] { 100, 152, 172, 192, 300 } }, - { new Tuple(NPCID.HallowBoss, ProjectileID.FairyQueenLance), new int[] { 130, 196, 216, 236, 390 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 80, 140, 160, 180, 270 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 84, 148, 172, 196, 294 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 208, 244, 366 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - - { new Tuple(NPCID.Golem, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, - { new Tuple(NPCID.Golem, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, - { new Tuple(NPCID.GolemHead, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, - { new Tuple(NPCID.GolemFistLeft, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.GolemFistRight, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.Fireball), new int[] { 60, 120, 140, 180, 270 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.EyeBeam), new int[] { 80, 140, 172, 204, 306 } }, - { new Tuple(NPCID.GolemHeadFree, ProjectileID.InfernoHostileBolt), new int[] { 88, 156, 184, 212, 318 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 372 } }, - - { new Tuple(NPCID.DukeFishron, ProjectileID.Sharknado), new int[] { 80, 100, 150, 200, 300 } }, - { new Tuple(NPCID.DukeFishron, ProjectileID.Cthulunado), new int[] { 160, 200, 232, 264, 480 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 144, 172, 200, 300 } }, - - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossFireBall), new int[] { 88, 156, 184, 212, 318 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossIceMist), new int[] { 120, 180, 208, 236, 360 } }, - { new Tuple(NPCID.CultistBoss, ProjectileID.CultistBossLightningOrb), new int[] { 120, 192, 220, 248, 372 } }, - { new Tuple(NPCID.CultistBossClone, ProjectileID.CultistBossFireBallClone), new int[] { 90, 144, 172, 200, 300 } }, - { new Tuple(NPCID.AncientDoom, ProjectileID.AncientDoomProjectile), new int[] { 88, 156, 184, 212, 318 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 90, 152, 176, 200, 300 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 180, 208, 236, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 100, 172, 192, 212, 318 } }, - - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalDeathray), new int[] { 200, 300, 380, 460, 690 } }, - { new Tuple(NPCID.MoonLordHead, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 300 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalEye), new int[] { 90, 120, 160, 200, 300 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalSphere), new int[] { 120, 160, 220, 280, 420 } }, - { new Tuple(NPCID.MoonLordHand, ProjectileID.PhantasmalBolt), new int[] { 90, 120, 160, 200, 300 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalBolt), new int[] { 100, 140, 180, 220, 330 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalEye), new int[] { 100, 140, 180, 220, 330 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalSphere), new int[] { 132, 176, 220, 264, 396 } }, - { new Tuple(NPCID.MoonLordFreeEye, ProjectileID.PhantasmalDeathray), new int[] { 150, 200, 260, 320, 480 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 320, 352, 384, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 300, 332, 364, 600 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, // Split holy fire does: 113, 198, 216, 234, 338 - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 120, 192, 220, 248, 360 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 35, 50, 50, 0, 0 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 105, 171, 189, 207, 315 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 268, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 228, 252, 276, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 400, 440, 480, 600 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.FrostWave), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 332, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrb), new int[] { 150, 264, 288, 312, 450 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 160, 276, 304, 332, 480 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 240, 264, 288, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 150, 264, 288, 312, 450 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 264, 420 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 140, 220, 244, 264, 420 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 420, 460, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 170, 296, 324, 352, 510 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 180, 316, 348, 380, 540 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 200, 340, 376, 412, 600 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 520, 548, 576, 900 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 220, 384, 424, 464, 660 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 250, 440, 464, 488, 750 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 280, 468, 484, 500, 840 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 350, 592, 624, 656, 1050 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 300, 508, 528, 548, 900 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 240, 408, 432, 456, 720 } }, - { new Tuple(ModContent.NPCType(), ModContent.ProjectileType()), new int[] { 400, 608, 640, 672, 1200 } }, - - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossIceMist), new int[] { 400, 600, 632, 664, 1200 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossLightningOrbArc), new int[] { 500, 752, 788, 824, 1500 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.AncientDoomProjectile), new int[] { 400, 600, 632, 664, 1200 } }, - { new Tuple(ModContent.NPCType(), ProjectileID.CultistBossFireBallClone), new int[] { 400, 600, 632, 664, 1200 } } - }; - } - - // Destroys the EnemyStats struct to save memory because mod assemblies will not be fully unloaded until TML 1.4. - internal static void UnloadEnemyStats() - { - EnemyStats.ExpertDamageMultiplier = null; - EnemyStats.ContactDamageValues = null; - EnemyStats.ProjectileDamageValues = null; - } - #endregion - } -} diff --git a/DataStructures/SummonTag.cs b/DataStructures/SummonTag.cs new file mode 100644 index 0000000000..23343fe0e4 --- /dev/null +++ b/DataStructures/SummonTag.cs @@ -0,0 +1,191 @@ +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.DataStructures +{ + /// + /// This is used to store summon tag stats so they can be applied automatically. + /// + public class SummonTag + { + #region SummonTag data + /// + /// Flat tag damage from this summon tag + /// + public int FlatTagDamage = 0; + + /// + /// This is tag damage that isn't added to the tooltip. Used for removing Vanilla whip tag damage. + /// + public int UnlistedTagDamage = 0; + + /// + /// Multiplicative tag damage from this summon tag. Stacks additively with other tags. + /// + public float MultiplicativeTagDamage = 0; + + /// + /// This is tag damage that isn't added to the tooltip. Used for removing Firecracker whip damage. + /// + public float UnlistedMultiplicativeTagDamage = 0; + + /// + /// Tag critical strike chance from this stummon tag. Stacks additively with other tags. + /// + public float TagCritChance = 0; + + /// + /// How much the Critical Strike damage multiplier should be adjusted with this tag. Stacks additively with other tags. + /// + public float TagCritDamage = 0; + + /// + /// UNIMPLEMENTED. Need to add animation frame support before using. + /// What the texture for the tag effect should be. + /// + public Asset TagTexture; + + /// + /// What item inflicted this tag + /// + public int TagItem = -1; + + /// + /// The ModifyHitByProjectileTag code to run. Defaults to just applying the tag effects. + /// + public ModifyHitByProjectileTag TagModifyHitEffects; + + /// + /// Disable to stop tooltips from drawing automatically, for things that change TagModifyHitEffects + /// + public bool AutoDrawTooltip = true; + + /// + /// Setting to true allows this tag to be used alongside other tag effects. + /// + public bool AllowsWhipStacking = false; + + /// + /// The OnHitByProjectile code to run when this tag is applied. Defaults to nothing. + /// + public OnHitByProjectile TagOnHit = BlankOnHit; + public SummonTag() + { + TagModifyHitEffects = ApplyTagModifyHit; + } + + public SummonTag(int itemType) + { + TagItem = itemType; + TagModifyHitEffects = ApplyTagModifyHit; + } + + /// + /// A modified version of ModifyHitByProjectile that incorporates tag damage multipliers and tag critical chance. + /// This delegate is used for TagModifyHitEffects + /// + /// + /// + /// + /// + /// + public delegate void ModifyHitByProjectileTag(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance); + + /// + /// This delegate is used for TagOnHit + /// + /// + /// + /// + /// + public delegate void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone); + + /// + /// The default tag damage functionality + /// + public void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + modifiers.FlatBonusDamage += (FlatTagDamage + UnlistedTagDamage) * tagDamageMult; + modifiers.ScalingBonusDamage += (MultiplicativeTagDamage + UnlistedMultiplicativeTagDamage) * tagDamageMult; + critChance += TagCritChance; + modifiers.CritDamage += TagCritDamage; + } + + /// + /// Blank tag damage functionality + /// + public static void BlankTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + } + /// + /// Due to how Firecracker works, this allows it to work with crit accessories. + /// + public static void FirecrackerModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + modifiers.ScalingBonusDamage += (Firecracker.MultiplicativeTagDamage + Firecracker.UnlistedMultiplicativeTagDamage) * tagDamageMult; + modifiers.CritDamage += Firecracker.TagCritDamage; + } + /// + /// This is replaced by custom tag on hit effects. Does nothing. + /// + public static void BlankOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { } + #endregion + + #region Vanilla whip stats + public static SummonTag LeatherWhip = new SummonTag(ItemID.BlandWhip) + { + FlatTagDamage = 4, + UnlistedTagDamage = -4 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Snapthorn = new SummonTag(ItemID.ThornWhip) + { + FlatTagDamage = 4, + UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage + }; + public static SummonTag SpinalTap = new SummonTag(ItemID.BoneWhip) + { + FlatTagDamage = 5, + UnlistedTagDamage = -7 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Firecracker = new SummonTag(ItemID.FireWhip) + { + MultiplicativeTagDamage = 1f, + TagCritDamage = -1f, + TagModifyHitEffects = FirecrackerModifyHit, + UnlistedMultiplicativeTagDamage = -1.75f, //Cancels out the vanilla firecracker tag damage + AutoDrawTooltip = false + }; + public static SummonTag CoolWhip = new SummonTag(ItemID.CoolWhip) + { + FlatTagDamage = 8, + UnlistedTagDamage = -6 //Negative value cancels out vanilla tag damage + }; + public static SummonTag Durendal = new SummonTag(ItemID.SwordWhip) + { + FlatTagDamage = 5, + TagCritChance = 0.05f, + UnlistedTagDamage = -9 //Negative value cancels out vanilla tag damage + }; + public static SummonTag MorningStar = new SummonTag(ItemID.MaceWhip) + { + TagCritChance = 0.13f, + UnlistedTagDamage = -8 //Negative value cancels out vanilla tag damage + }; + public static SummonTag DarkHarvest = new SummonTag(ItemID.ScytheWhip) + { + FlatTagDamage = 14, + UnlistedTagDamage = -10, //Negative value cancels out vanilla tag damage + //This has a unique on hit effect from vanilla. + }; + public static SummonTag Kaleidoscope = new SummonTag(ItemID.RainbowWhip) + { + FlatTagDamage = 10, + TagCritChance = 0.10f, + UnlistedTagDamage = -20 //Negative value cancels out vanilla tag damage + }; + #endregion + } +} diff --git a/Dusts/WaterSplash/BasaltGullyLavaSplash.cs b/Dusts/WaterSplash/BasaltGullyLavaSplash.cs new file mode 100644 index 0000000000..aa7ec173f8 --- /dev/null +++ b/Dusts/WaterSplash/BasaltGullyLavaSplash.cs @@ -0,0 +1,178 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics.PackedVector; +using System; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts.WaterSplash +{ + public class BasaltGullyLavaSplash : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.velocity *= 0.1f; + dust.velocity.Y = -0.5f; + } + + public override bool Update(Dust dust) + { + if (dust.scale > 10f) + { + dust.active = false; + } + Dust.lavaBubbles++; + dust.position += dust.velocity; + if (!dust.noGravity) + { + dust.velocity.Y += 0.1f; + } + if (dust.noGravity) + { + dust.scale += 0.03f; + if (dust.scale < 1f) + { + dust.velocity.Y += 0.075f; + } + dust.velocity.X *= 1.08f; + if (dust.velocity.X > 0f) + { + dust.rotation += 0.01f; + } + else + { + dust.rotation -= 0.01f; + } + float num109 = dust.scale * 0.6f; + if (num109 > 1f) + { + num109 = 1f; + } + Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f + 1f), num109 * (2.5f / 4), num109 * (1.3f / 4), num109 * (0.1f / 4)); + } + else + { + if (!Collision.WetCollision(new Vector2(dust.position.X, dust.position.Y - 8f), 4, 4)) + { + dust.scale = 0f; + } + else + { + dust.alpha += Main.rand.Next(2); + if (dust.alpha > 255) + { + dust.scale = 0f; + } + dust.velocity.Y = -0.5f; + dust.alpha++; + dust.scale -= 0.01f; + dust.velocity.Y = -0.2f; + dust.velocity.X += (float)Main.rand.Next(-10, 10) * 0.002f; + if ((double)dust.velocity.X < -0.25) + { + dust.velocity.X = -0.25f; + } + if ((double)dust.velocity.X > 0.25) + { + dust.velocity.X = 0.25f; + } + } + float num3 = dust.scale * 0.3f + 0.4f; + if (num3 > 1f) + { + num3 = 1f; + } + Lighting.AddLight((int)(dust.position.X / 16f), (int)(dust.position.Y / 16f), num3 * (2.5f / 4), num3 * (1.3f / 4), num3 * (0.1f / 4)); + } + dust.rotation += dust.velocity.X * 0.5f; + if (dust.fadeIn > 0f && dust.fadeIn < 100f) + { + dust.scale += 0.03f; + if (dust.scale > dust.fadeIn) + { + dust.fadeIn = 0f; + } + } + dust.scale -= 0.01f; + if (dust.noGravity) + { + dust.velocity *= 0.92f; + if (dust.fadeIn == 0f) + { + dust.scale -= 0.04f; + } + } + if (dust.position.Y > Main.screenPosition.Y + (float)Main.screenHeight) + { + dust.active = false; + } + float num17 = 0.1f; + if ((double)Dust.dCount == 0.5) + { + dust.scale -= 0.001f; + } + if ((double)Dust.dCount == 0.6) + { + dust.scale -= 0.0025f; + } + if ((double)Dust.dCount == 0.7) + { + dust.scale -= 0.005f; + } + if ((double)Dust.dCount == 0.8) + { + dust.scale -= 0.01f; + } + if ((double)Dust.dCount == 0.9) + { + dust.scale -= 0.02f; + } + if ((double)Dust.dCount == 0.5) + { + num17 = 0.11f; + } + if ((double)Dust.dCount == 0.6) + { + num17 = 0.13f; + } + if ((double)Dust.dCount == 0.7) + { + num17 = 0.16f; + } + if ((double)Dust.dCount == 0.8) + { + num17 = 0.22f; + } + if ((double)Dust.dCount == 0.9) + { + num17 = 0.25f; + } + if (dust.scale < num17) + { + dust.active = false; + } + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) + { + float num = (float)(255 - dust.alpha) / 255f; + int num4; + int num3; + int num2; + num = (num + 3f) / 4f; + num4 = (int)((int)lightColor.R * num); + num3 = (int)((int)lightColor.G * num); + num2 = (int)((int)lightColor.B * num); + int num6 = lightColor.A - dust.alpha; + if (num6 < 0) + { + num6 = 0; + } + if (num6 > 255) + { + num6 = 255; + } + return new Color(num4, num3, num2, num6); + } + } +} diff --git a/Dusts/WaterSplash/BasaltGullyLavaSplash.png b/Dusts/WaterSplash/BasaltGullyLavaSplash.png new file mode 100644 index 0000000000..6fc3a83f98 Binary files /dev/null and b/Dusts/WaterSplash/BasaltGullyLavaSplash.png differ diff --git a/Effects/ArsenalEffects.cs b/Effects/ArsenalEffects.cs index 41ecff817f..c0a21645a7 100644 --- a/Effects/ArsenalEffects.cs +++ b/Effects/ArsenalEffects.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Effects // Plasma public static int ArsenalPlasmaDust = ModContent.DustType(); - public static Color ArsenalPlasmaColor = Color.Lerp(Color.Green, Color.Chartreuse, 0.45f); + public static Color ArsenalPlasmaColor = new Color(154, 255, 0); // Laser public static int ArsenalLaserDust = ModContent.DustType(); public static Color ArsenalLaserColor = Color.Lerp(Color.Crimson, Color.Red, 0.45f); diff --git a/Effects/BasicTextureDistortionShader.fx b/Effects/BasicTextureDistortionShader.fx index 084d452391..a9e45abb3a 100644 --- a/Effects/BasicTextureDistortionShader.fx +++ b/Effects/BasicTextureDistortionShader.fx @@ -1,20 +1,14 @@ sampler baseTexture : register(s0); sampler distortionTexture : register(s1); -float time; -float distortionXSpeed; -float distortionYSpeed; -float distortionStrength; -float noiseScale; +float2 timeOffset; +float2 noiseScaleStrength; -float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR { - float2 distortedCoords = coords + float2(time * distortionXSpeed, time * distortionYSpeed); - distortedCoords *= noiseScale; - float distortion = tex2D(distortionTexture, distortedCoords).r; - - float4 returnColor = tex2D(baseTexture, coords + distortion * distortionStrength); - return returnColor * sampleColor.a; + float2 distortedCoords = coords * noiseScaleStrength.x + timeOffset; + float distortion = tex2D(distortionTexture, distortedCoords).r * noiseScaleStrength.y; + return tex2D(baseTexture, coords + distortion) * sampleColor.a; } technique Technique1 diff --git a/Effects/BasicTextureDistortionShader.xnb b/Effects/BasicTextureDistortionShader.xnb index 7d0177e650..b556cca62c 100644 Binary files a/Effects/BasicTextureDistortionShader.xnb and b/Effects/BasicTextureDistortionShader.xnb differ diff --git a/Effects/CalamityShaders.cs b/Effects/CalamityShaders.cs index 1b283d531c..285d9cc62f 100644 --- a/Effects/CalamityShaders.cs +++ b/Effects/CalamityShaders.cs @@ -19,9 +19,9 @@ namespace CalamityMod.Effects internal static Effect AstralFogShader; // - // All below shaders created by Dominic Karma + // All below shaders created by Lucille Karma // - #region Dominic's Shaders + #region Lucille's Shaders // The Dance of Light's Blinding Light internal static Effect DanceOfLightBlindingShader; @@ -50,7 +50,7 @@ namespace CalamityMod.Effects // Generic solid trail shader. Used by many things? internal static Effect FadingSolidTrailShader; - // Scarlet Devil main spear glowing trail. BEWARE: Is reused by many other items! + // Typical projectile javelin glowing trail. BEWARE: Is used by many items! internal static Effect ScarletDevilShader; // Yharon border flame pillar trail. @@ -92,7 +92,7 @@ namespace CalamityMod.Effects // Was previously used by Dom's Bladecrest Oathsword. Appears to govern the swing animation. internal static Effect LocalLinearTransformationShader; - // UNUSED -- Probably leftover from Dominic's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) + // UNUSED -- Probably leftover from Lucille's experiments with applying shaders to primitives (arbitrary GPU-rendered triangles) internal static Effect BasicPrimitiveShader; // Artemis Ohio Beam. Also used by get fixed boi Nuclear Terror's "G-FUEL BEAM" @@ -145,6 +145,12 @@ namespace CalamityMod.Effects // Used to render the results of Navier-Stokes fluid simulations. internal static Effect FluidShaders; + + // Used by projectiles fired by the Sylvestaff. + internal static Effect SylvestaffProjectileShader; + + // Used by the ribbons on the Sylvestaff. + internal static Effect SylvestaffRibbonShader; #endregion // @@ -216,15 +222,21 @@ namespace CalamityMod.Effects #region fryzahh's Shaders // A simple shader which distorts an image using a provided texture of choice. internal static Effect BasicTextureDistortionShader; + + // The underwater rays seen at the top of the Sunken Sea Mod Menu. + internal static Effect UnderwaterRaysShader; #endregion + internal static Asset SunkenSeaMenuLogoWater; + public override void PostSetupContent() { AssetRepository calAss = CalamityMod.Instance.Assets; // Shorthand to load shaders immediately. // Strings provided to LoadShader are the .xnb file paths. - Effect LoadShader(string path) => calAss.Request($"{ShaderPath}{path}", AssetRequestMode.ImmediateLoad).Value; + Effect LoadShader(string path) => LoadShaderAsset(path).Value; + Asset LoadShaderAsset(string path) => calAss.Request($"{ShaderPath}{path}", AssetRequestMode.ImmediateLoad); // // Loading and registering each individual compiled shader for use. @@ -234,7 +246,7 @@ namespace CalamityMod.Effects var astralPassReg = new AstralScreenShaderData(new Ref(AstralFogShader), "AstralPass").UseColor(0.18f, 0.08f, 0.24f); RegisterSceneFilter(astralPassReg, "Astral", EffectPriority.VeryHigh); - #region Loading Dominic's Shaders + #region Loading Lucille's Shaders DanceOfLightBlindingShader = LoadShader("LightBurstShader"); RegisterScreenShader(DanceOfLightBlindingShader, "BurstPass", "LightBurst"); @@ -357,6 +369,12 @@ namespace CalamityMod.Effects // This shader is not registered with the game but is invoked directly to render the results of fluid simulation. FluidShaders = LoadShader("FluidShaders"); + + SylvestaffProjectileShader = LoadShader("SylvestaffProjectileShader"); + RegisterMiscShader(SylvestaffProjectileShader, "TrailPass", "SylvestaffProjectile"); + + SylvestaffRibbonShader = LoadShader("SylvestaffRibbonShader"); + RegisterMiscShader(SylvestaffRibbonShader, "AutoloadPass", "SylvestaffRibbon"); #endregion #region Loading Iban's Shaders @@ -429,7 +447,12 @@ namespace CalamityMod.Effects #region Loading fryzahh's Shaders BasicTextureDistortionShader = LoadShader("BasicTextureDistortionShader"); RegisterMiscShader(BasicTextureDistortionShader, "DistortionPass", "BasicTextureDistortion"); + + UnderwaterRaysShader = LoadShader("UnderwaterRaysShader"); + RegisterMiscShader(UnderwaterRaysShader, "UnderwaterRayPass", "UnderwaterRays"); #endregion + + SunkenSeaMenuLogoWater = LoadShaderAsset("UI/SunkenSeaMenuLogoWater"); } // Shorthand to register a loaded shader in Terraria's graphics engine diff --git a/Effects/Dyes/InvisibleDyeShader.fx b/Effects/Dyes/InvisibleDyeShader.fx new file mode 100644 index 0000000000..e1b691da39 --- /dev/null +++ b/Effects/Dyes/InvisibleDyeShader.fx @@ -0,0 +1,33 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +float2 uTargetPosition; +float4 uLegacyArmorSourceRect; +float2 uLegacyArmorSheetSize; + +float4 PixelShaderFunction(float2 coords : TEXCOORD0) : COLOR0 +{ + float4 color = tex2D(uImage0, coords); + color.rgb *= 0; + color.a = 0; + return color; +} + +technique Technique1 +{ + pass DyePass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} \ No newline at end of file diff --git a/Effects/Dyes/InvisibleDyeShader.xnb b/Effects/Dyes/InvisibleDyeShader.xnb new file mode 100644 index 0000000000..738b0c2935 Binary files /dev/null and b/Effects/Dyes/InvisibleDyeShader.xnb differ diff --git a/Effects/SylvestaffProjectileShader.fx b/Effects/SylvestaffProjectileShader.fx new file mode 100644 index 0000000000..728a0f6a9a --- /dev/null +++ b/Effects/SylvestaffProjectileShader.fx @@ -0,0 +1,76 @@ +sampler uImage0 : register(s0); +sampler uImage1 : register(s1); +float3 uColor; +float3 uSecondaryColor; +float uOpacity; +float uSaturation; +float uRotation; +float uTime; +float4 uSourceRect; +float2 uWorldPosition; +float uDirection; +float3 uLightSource; +float2 uImageSize0; +float2 uImageSize1; +matrix uWorldViewProjection; +float4 uShaderSpecificData; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = input.Color; + float2 coords = input.TextureCoordinates; + + // Account for texture distortion artifacts. + coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5; + + float bump = sin(coords.y * 3.141); + + // Calculate the amount of additive glow for this pixel, using a combination of a scrolling texture and an extreme + // exponential squash of the prior 0-1-0 bump, creating a "center" to the glow and ensuring that the + // ray doesn't look like just a scrolling gradient. + float streakColor = tex2D(uImage1, coords + float2(uTime * -2.75, 0)); + float glow = streakColor.r + pow(bump, 20) * 0.4; + + // Determine opacity based on a weaker exponential squash of the bump in order to create faded horizontal edges. + float opacity = pow(bump, 5); + + // Apply glow. + opacity += glow * opacity; + + return color * opacity; +} + +technique Technique1 +{ + pass TrailPass + { + VertexShader = compile vs_2_0 VertexShaderFunction(); + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/SylvestaffProjectileShader.xnb b/Effects/SylvestaffProjectileShader.xnb new file mode 100644 index 0000000000..06bc3ffb44 Binary files /dev/null and b/Effects/SylvestaffProjectileShader.xnb differ diff --git a/Effects/SylvestaffRibbonShader.fx b/Effects/SylvestaffRibbonShader.fx new file mode 100644 index 0000000000..3474df6d49 --- /dev/null +++ b/Effects/SylvestaffRibbonShader.fx @@ -0,0 +1,89 @@ +sampler noiseTextureA : register(s1); + +float pixelationFactor; +float uSaturation; +float4 uShaderSpecificData; +matrix uWorldViewProjection; + +struct VertexShaderInput +{ + float4 Position : POSITION0; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +struct VertexShaderOutput +{ + float4 Position : SV_POSITION; + float4 Color : COLOR0; + float3 TextureCoordinates : TEXCOORD0; +}; + +VertexShaderOutput VertexShaderFunction(in VertexShaderInput input) +{ + VertexShaderOutput output = (VertexShaderOutput) 0; + float4 pos = mul(input.Position, uWorldViewProjection); + output.Position = pos; + + output.Color = input.Color; + output.TextureCoordinates = input.TextureCoordinates; + + return output; +} + +float QuadraticBump(float x) +{ + return x * (4 - x * 4); +} + +float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 +{ + float4 color = 1; + float2 coords = input.TextureCoordinates; + coords.y = (coords.y - 0.5) / input.TextureCoordinates.z + 0.5; + + float feelerColorStart = 0.61; + float colorSpacingFactor = 1.9; + float4 outlineColor = float4(91, 114, 119, 255) / 255; + + float erasePixelInterpolant = coords.x - 0.9 - distance(coords.y, 0.5) * 0.1; + + // Band 1: Outline color. + color = lerp(color, outlineColor, coords.x >= feelerColorStart); + + // Band 2: Pink. + float pinkStart = feelerColorStart + colorSpacingFactor * 0.01; + color = lerp(color, float4(221, 150, 179, 255) / 255, coords.x >= pinkStart); + + // Band 3: Outline color. + float outlineAStart = pinkStart + colorSpacingFactor * 0.04; + color = lerp(color, outlineColor, coords.x >= outlineAStart); + + // Band 4: Blue. + float blueStart = outlineAStart + colorSpacingFactor * 0.01; + color = lerp(color, float4(48, 117, 222, 255) / 255, coords.x >= blueStart); + + // Band 5: Baby blue. + float babyBlueStart = blueStart + colorSpacingFactor * 0.04; + color = lerp(color, float4(167, 222, 255, 255) / 255, coords.x >= babyBlueStart); + + // Add an outline to the ends of the feeler. + float horizontalDistanceFromCenter = distance(coords.y, 0.5); + color = lerp(color, outlineColor, horizontalDistanceFromCenter >= 0.3); + color = lerp(color, outlineColor, erasePixelInterpolant >= -0.02); + + float permittedDirection = sign(uSaturation); + float direction = sign(dot(input.Position.xy - uShaderSpecificData.xy, uShaderSpecificData.zw)); + erasePixelInterpolant *= direction == permittedDirection || coords.x < 0.5; + + return color * (erasePixelInterpolant < 0) * input.Color; +} + +technique Technique1 +{ + pass AutoloadPass + { + VertexShader = compile vs_3_0 VertexShaderFunction(); + PixelShader = compile ps_3_0 PixelShaderFunction(); + } +} diff --git a/Effects/SylvestaffRibbonShader.xnb b/Effects/SylvestaffRibbonShader.xnb new file mode 100644 index 0000000000..d6848767d4 Binary files /dev/null and b/Effects/SylvestaffRibbonShader.xnb differ diff --git a/Effects/UI/SunkenSeaMenuLogoWater.fxc b/Effects/UI/SunkenSeaMenuLogoWater.fxc new file mode 100644 index 0000000000..917617be13 Binary files /dev/null and b/Effects/UI/SunkenSeaMenuLogoWater.fxc differ diff --git a/Effects/UI/SunkenSeaMenuLogoWater.hlsl b/Effects/UI/SunkenSeaMenuLogoWater.hlsl new file mode 100644 index 0000000000..234d3e0f49 --- /dev/null +++ b/Effects/UI/SunkenSeaMenuLogoWater.hlsl @@ -0,0 +1,76 @@ +/* Originally written for NIGHTSHADE for use as the liquid shader in the orb + * health and mana UIs: + * https://github.com/gold-meridian/nightshade-mod/blob/df037a103cb25dac8d36622515b3793f2b10ac3f/src/Nightshade/Assets/Shaders/UI/OrbFluidFillShader.hlsl + * + * Originally authored by Blockaroz and adapted by Tomat. + */ + +#include "../pixelation.h" + +sampler uImage0 : register(s0); + +texture uTexture0; +sampler tex0 = sampler_state +{ + texture = ; + magfilter = POINT; + minfilter = POINT; + mipfilter = POINT; + AddressU = wrap; + AddressV = wrap; +}; + +texture uBubbleTexture; +sampler bubbleTex = sampler_state +{ + texture = ; + magfilter = POINT; + minfilter = POINT; + mipfilter = POINT; + AddressU = wrap; + AddressV = wrap; +}; + +float2 uImageSize; +float uTime; +float uFillAmount; +float4 uFillColor; +float4 uEdgeColor; +float4 uLineColor; +float uWaveStrength; +float uWaveOffset; +float uSubtract; + +float4 main(float2 uv : TEXCOORD0, float4 baseColor : COLOR0) : COLOR0 +{ + float4 image = tex2D(uImage0, uv); + + uv = normalize_with_pixelation(uv * uImageSize, 2, uImageSize); + float2 center = uv * 2 - 1; + float distFromCenter = length(center); + + float2 uvForNoise = uv * uImageSize / 128; + + float4 bubbles = tex2D(bubbleTex, uvForNoise + float2(uTime / 10, uTime / 6)); + float4 bubbles2 = tex2D(bubbleTex, uvForNoise + float2((bubbles.r - 0.5) * 0.5, uTime / 10)); + float4 noise = tex2D(tex0, uvForNoise + float2(uTime / 6 + (bubbles.r - 0.5) * 0.05, (bubbles2.r - 0.5) * 0.1)); + uv.y = lerp(uv.y, uv.y, 0.15); + + float fillAmount = 1.0f - uFillAmount; + float bumpLine = 0.2f * (smoothstep(0.9f, 1.0f, uFillAmount) - smoothstep(0.1f, 0.0f, uFillAmount)); + float height = uv.y + (sin(3.1415 * ((uv.x * uImageSize.x / 100 + uWaveOffset) * 1.5 - uTime)) + length(bubbles.rgb)) * uWaveStrength / uImageSize.y + bumpLine - (fillAmount + 2.0f / uImageSize.y); + float edgeGlow = pow(distFromCenter * 0.8 + (uv.y + height - 0.33f) * 0.2, (1 + length(noise.rgb)) * uSubtract) * (distFromCenter * 1.5 + 1 - length(noise.rgb)); + + float topCut = smoothstep(-1.5 / uImageSize.y, 0.5 / uImageSize.y, height); + float topLine = smoothstep(1.8 / uImageSize.y, 0, height) * 1.5 * sqrt(1 - distFromCenter) - (bubbles2 - bubbles) * (1 - height) * 0.2; + + return ((lerp(uFillColor - 0.3 * topCut * uSubtract, uEdgeColor * 0.9, clamp(edgeGlow * length(image.rgb) / 2, 0, 1.3)) + topLine * 2 * uLineColor) * topCut) * image; +} + +technique Technique1 +{ + pass WaterShader + { + PixelShader = compile ps_3_0 main(); + } +} \ No newline at end of file diff --git a/Effects/UnderwaterRaysShader.fx b/Effects/UnderwaterRaysShader.fx new file mode 100644 index 0000000000..652afbcca4 --- /dev/null +++ b/Effects/UnderwaterRaysShader.fx @@ -0,0 +1,48 @@ +sampler baseTexture : register(s0); + +float time; +float fadeOutMargin; +float overallOpacity; +float pixelationAmount; +float scrollSpeedX; +float scrollSpeedY; +float2 noiseScale; +float3 rayColor; + +float4 PixelShaderFunction(float4 sampleColor : COLOR0, float2 coords : TEXCOORD0) : COLOR0 +{ + // Pixelation. + coords = round(coords * pixelationAmount) / pixelationAmount; + + // Distort the coords into a sine wave. + coords.y += sin(coords.x + time * 0.25) * 0.05; + + // Get the correct scale for our two noise maps. + float2 scaledCoords = coords * noiseScale; + + // Calculate the offsets for each noise map. + float2 noiseOffset1 = float2(time * scrollSpeedX, time * scrollSpeedY); + float2 noiseOffset2 = float2(time * -scrollSpeedX, time * -scrollSpeedY); + + // Calculate the colors of the two noise maps. + float4 noiseTexture1 = tex2D(baseTexture, scaledCoords + noiseOffset1); + float4 noiseTexture2 = tex2D(baseTexture, scaledCoords + noiseOffset2); + + // Add the noise maps together to layer them over each other. + // Ensure to add them at 50% intensity to avoid making a super bright effect. + float combinedNoise = (noiseTexture1.r * 0.5) + (noiseTexture2.r * 0.5); + + // Fade out at a certain margin. + float opacity = (1 - (coords.y * 2 - fadeOutMargin)); + + return (float4(rayColor, 1) * combinedNoise * opacity) * overallOpacity; + +} + +technique Technique1 +{ + pass UnderwaterRayPass + { + PixelShader = compile ps_2_0 PixelShaderFunction(); + } +} diff --git a/Effects/UnderwaterRaysShader.xnb b/Effects/UnderwaterRaysShader.xnb new file mode 100644 index 0000000000..9faf1094f5 Binary files /dev/null and b/Effects/UnderwaterRaysShader.xnb differ diff --git a/Effects/pixelation.h b/Effects/pixelation.h new file mode 100644 index 0000000000..60dae6f5fc --- /dev/null +++ b/Effects/pixelation.h @@ -0,0 +1,40 @@ +#ifndef PIXELATION_HLSL +#define PIXELATION_HLSL + +/** + * Applies pixelation to the given coordinates based on a defined pixel size and + * outputs the normalized coordinates. + * + * @param coords The coordinates within the resolution space. + * @param pixel_size The size of each pixel block. + * @param resolution The resolution with which to normalize the coords by. + * @return The normalized, pixelated texture coordinates. + */ +float2 normalize_with_pixelation(float2 coords, float pixel_size, float2 resolution) +{ + return floor(coords / pixel_size) / (resolution / pixel_size); +} + +float2 pixelate(float2 coords, float pixel_size) +{ + return floor(coords / pixel_size) * pixel_size; +} + +/** + * Quantizes the input color to a given resolution. + * + * @param color The input color. + * @param color_resolution The resolution of quantization. + * @return The quantized color. + */ +float3 quantize_color(float3 color, float3 color_resolution) +{ + return floor(color * color_resolution) / (color_resolution - 1.0f); +} + +float4 quantize_color_with_alpha(float4 color, float4 color_resolution) +{ + return floor(color * color_resolution) / (color_resolution - 1.0f); +} + +#endif // PIXELATION_HLSL \ No newline at end of file diff --git a/Enums/SetBonusDoubleTapOptions.cs b/Enums/SetBonusDoubleTapOptions.cs new file mode 100644 index 0000000000..f71b0e4349 --- /dev/null +++ b/Enums/SetBonusDoubleTapOptions.cs @@ -0,0 +1,14 @@ +using Terraria.ModLoader.Config; + +namespace CalamityMod.Enums +{ + public enum SetBonusDoubleTapOptions + { + [LabelKey("$Mods.CalamityMod.Configs.CalamityClientConfig.SetBonusDoubleTap.Options.On")] + On, + [LabelKey("$Mods.CalamityMod.Configs.CalamityClientConfig.SetBonusDoubleTap.Options.Auto")] + Auto, + [LabelKey("$Mods.CalamityMod.Configs.CalamityClientConfig.SetBonusDoubleTap.Options.Off")] + Off + } +} diff --git a/Events/AcidRainEvent.cs b/Events/AcidRainEvent.cs index 5963ba605b..fbe6d72f3a 100644 --- a/Events/AcidRainEvent.cs +++ b/Events/AcidRainEvent.cs @@ -243,7 +243,6 @@ namespace CalamityMod.Events if (inNaturalSeaPosition && player.Calamity().ZoneSulphur) { // Makes rain pour at its maximum intensity (but only after an idiot meanders into the Sulphurous Sea) - // You'll never catch me, Fabs, Not when I shift into MAXIMUM OVERDRIVE!! HasStartedAcidicDownpour = true; CalamityNetcode.SyncWorld(); break; diff --git a/Events/BossRushEvent.cs b/Events/BossRushEvent.cs index d3bf603ee5..66689a2269 100644 --- a/Events/BossRushEvent.cs +++ b/Events/BossRushEvent.cs @@ -164,7 +164,7 @@ namespace CalamityMod.Events ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.ServantofCthulhu, ModContent.NPCType() }), + new Boss(NPCID.EyeofCthulhu, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.ServantofCthulhu }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { @@ -178,7 +178,7 @@ namespace CalamityMod.Events new Boss(NPCID.BrainofCthulhu, permittedNPCs: NPCID.Creeper), - new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType(), @@ -213,8 +213,7 @@ namespace CalamityMod.Events { NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Spazmatism); NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, NPCID.Retinazer); - NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, ModContent.NPCType()); - }, permittedNPCs: new int[] { NPCID.Retinazer, ModContent.NPCType() }), + }, permittedNPCs: new int[] { NPCID.Retinazer }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -222,7 +221,7 @@ namespace CalamityMod.Events new Boss(ModContent.NPCType(), TimeChangeContext.Day, permittedNPCs: ModContent.NPCType()), - new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { ModContent.NPCType(), NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser, NPCID.Probe }), + new Boss(NPCID.SkeletronPrime, TimeChangeContext.Night, permittedNPCs: new int[] { NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeVice, NPCID.PrimeLaser }), new Boss(ModContent.NPCType(), TimeChangeContext.Night, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), @@ -309,7 +308,7 @@ namespace CalamityMod.Events NPC.SpawnOnPlayer(ClosestPlayerToWorldCenter, type); }, permittedNPCs: new int[] { ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }), - new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType() }), + new Boss(ModContent.NPCType(), permittedNPCs: new int[] { ModContent.NPCType() }), new Boss(ModContent.NPCType(), TimeChangeContext.Day, type => { diff --git a/ExtraJumps/SulphurJump.cs b/ExtraJumps/SulphurJump.cs index eef2cbb6c1..db5dd0bd9f 100644 --- a/ExtraJumps/SulphurJump.cs +++ b/ExtraJumps/SulphurJump.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.Armor.Sulphurous; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; @@ -46,7 +47,7 @@ namespace CalamityMod.ExtraJumps if (modPlayer.sulphurBubbleCooldown <= 0) { var source = player.GetSource_Misc("0"); - int damage = (int)player.GetTotalDamage().ApplyTo(20); + int damage = (int)player.GetTotalDamage().ApplyTo(SulphurousHelmet.BubbleDamage); int bubble = Projectile.NewProjectile(source, new Vector2(player.position.X, player.position.Y + (player.gravDir == -1f ? 20 : -20)), Vector2.Zero, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 1f, 0f); if (bubble.WithinBounds(Main.maxProjectiles)) diff --git a/ExtraTextures/Bestiary/SlimeGod_Bestiary.png b/ExtraTextures/Bestiary/SlimeGod_Bestiary.png deleted file mode 100644 index dbe7056e82..0000000000 Binary files a/ExtraTextures/Bestiary/SlimeGod_Bestiary.png and /dev/null differ diff --git a/ExtraTextures/BloomCirclePinpoint.png b/ExtraTextures/BloomCirclePinpoint.png new file mode 100644 index 0000000000..49c2dcdb60 Binary files /dev/null and b/ExtraTextures/BloomCirclePinpoint.png differ diff --git a/ExtraTextures/ChadPrime.png b/ExtraTextures/ChadPrime.png deleted file mode 100644 index 3bbc5902b0..0000000000 Binary files a/ExtraTextures/ChadPrime.png and /dev/null differ diff --git a/ExtraTextures/ChadPrimeHeadGlow.png b/ExtraTextures/ChadPrimeHeadGlow.png deleted file mode 100644 index e8b25ba236..0000000000 Binary files a/ExtraTextures/ChadPrimeHeadGlow.png and /dev/null differ diff --git a/ExtraTextures/ChadPrime_Head_Boss.png b/ExtraTextures/ChadPrime_Head_Boss.png deleted file mode 100644 index 313edebc2c..0000000000 Binary files a/ExtraTextures/ChadPrime_Head_Boss.png and /dev/null differ diff --git a/ExtraTextures/ExtraTextureRefs.cs b/ExtraTextures/ExtraTextureRefs.cs index bc86cb89a7..a39bd99b7c 100644 --- a/ExtraTextures/ExtraTextureRefs.cs +++ b/ExtraTextures/ExtraTextureRefs.cs @@ -19,11 +19,6 @@ namespace CalamityMod.ExtraTextures public static Asset DestroyerHeadGlowmask; public static Asset DestroyerBodyGlowmask; public static Asset DestroyerTailGlowmask; - public static Asset ProbeGlowmask; - - // Master Rev+ Skeletron Prime - public static Asset ChadPrime; - public static Asset ChadPrimeEyeGlowmask; // WoF, These are not "exactly" the ExtraTextures. But public static Asset WallOfFleshEyeGlowmask; @@ -44,16 +39,6 @@ namespace CalamityMod.ExtraTextures public static Asset CircularSmearFire2; public static Asset CircularSmearFire3; - // Boss Heads - // I know it's not exactly a Texture2D but it belongs to ExtraTextures. - public static int BossHeadIndex_ChadPrime; - - public override void Load() - { - string chadPrimeIconPath = "CalamityMod/ExtraTextures/ChadPrime_Head_Boss"; - BossHeadIndex_ChadPrime = CalamityMod.Instance.AddBossHeadTexture(chadPrimeIconPath, -1); - } - // TODO: - Every other ExtraTextures Reference could be move in here public override void OnModLoad() @@ -62,11 +47,6 @@ namespace CalamityMod.ExtraTextures DestroyerBodyGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerBodyGlow", AssetRequestMode.AsyncLoad); DestroyerTailGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/DestroyerTailGlow", AssetRequestMode.AsyncLoad); - ProbeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/ProbeGlow", AssetRequestMode.AsyncLoad); - - ChadPrime = ModContent.Request("CalamityMod/ExtraTextures/ChadPrime", AssetRequestMode.AsyncLoad); - ChadPrimeEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/ChadPrimeHeadGlow", AssetRequestMode.AsyncLoad); - WallOfFleshEyeGlowmask = ModContent.Request("CalamityMod/ExtraTextures/VanillaBossGlowmasks/WallOfFleshEyeTelegraphGlow", AssetRequestMode.AsyncLoad); WallOfFleshDemonSickleTexture = ModContent.Request("CalamityMod/Projectiles/Melee/ForbiddenOathbladeProjectile", AssetRequestMode.AsyncLoad); diff --git a/ExtraTextures/SkeletronPrime2HeadGlow.png b/ExtraTextures/SkeletronPrime2HeadGlow.png deleted file mode 100644 index 7054e2945d..0000000000 Binary files a/ExtraTextures/SkeletronPrime2HeadGlow.png and /dev/null differ diff --git a/ExtraTextures/Trails/FabstaffStreak.png b/ExtraTextures/Trails/SylvestaffStreak.png similarity index 100% rename from ExtraTextures/Trails/FabstaffStreak.png rename to ExtraTextures/Trails/SylvestaffStreak.png diff --git a/ExtraTextures/UI/CrystalTextGlow.png b/ExtraTextures/UI/CrystalTextGlow.png new file mode 100644 index 0000000000..e4dd498b65 Binary files /dev/null and b/ExtraTextures/UI/CrystalTextGlow.png differ diff --git a/ExtraTextures/UI/CrystalTextSparkle.png b/ExtraTextures/UI/CrystalTextSparkle.png new file mode 100644 index 0000000000..7703b63a83 Binary files /dev/null and b/ExtraTextures/UI/CrystalTextSparkle.png differ diff --git a/ExtraTextures/UI/Glint.png b/ExtraTextures/UI/Glint.png new file mode 100644 index 0000000000..9d0ed2aebd Binary files /dev/null and b/ExtraTextures/UI/Glint.png differ diff --git a/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png b/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png deleted file mode 100644 index c0105e82e4..0000000000 Binary files a/ExtraTextures/VanillaBossGlowmasks/ProbeGlow.png and /dev/null differ diff --git a/Fonts/Flexure.xnb b/Fonts/Flexure.xnb new file mode 100644 index 0000000000..5aaf31cd8c Binary files /dev/null and b/Fonts/Flexure.xnb differ diff --git a/Fonts/FontAssetSystem.cs b/Fonts/FontAssetSystem.cs new file mode 100644 index 0000000000..ae8ef15410 --- /dev/null +++ b/Fonts/FontAssetSystem.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Projectiles.Boss; +using CalamityMod.UI.DraedonSummoning; +using ReLogic.Content; +using ReLogic.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Fonts +{ + public class FontAssetSystem : ModSystem + { + public static readonly Dictionary Fonts = new() { + { "MouseText", FontAssets.MouseText.Value }, + { "ItemStack", FontAssets.ItemStack.Value}, + { "DeathText", FontAssets.DeathText.Value }, + { "CombatText", FontAssets.CombatText[0].Value }, + { "CombatTextCrit", FontAssets.CombatText[1].Value } + }; + + public override void OnModLoad() + { + if (Main.dedServ) + return; + + AddFont("Wingdings", CalamityMod.Instance.Assets.Request("Fonts/Wingdings", AssetRequestMode.ImmediateLoad).Value); //Intentionally does not have a fallback due to it already having null checks where it is utilized to prevent them from appearing + AddFont("CodebreakerDialog", CalamityMod.Instance.Assets.Request("Fonts/CodebreakerDialog", AssetRequestMode.ImmediateLoad).Value, FontAssets.MouseText.Value); + AddFont("Impact", CalamityMod.Instance.Assets.Request("Fonts/Impact", AssetRequestMode.ImmediateLoad).Value, FontAssets.CombatText[1].Value); + AddFont("Flexure", CalamityMod.Instance.Assets.Request("Fonts/Flexure", AssetRequestMode.ImmediateLoad).Value, FontAssets.CombatText[1].Value); + } + + private static void AddFont(string key, DynamicSpriteFont font, DynamicSpriteFont fallback = null) + { + if (Environment.OSVersion.Platform == PlatformID.Win32NT) + Fonts.Add(key, font); + else + Fonts.Add(key, fallback); + } + } +} diff --git a/Fonts/Impact.xnb b/Fonts/Impact.xnb new file mode 100644 index 0000000000..862941c829 Binary files /dev/null and b/Fonts/Impact.xnb differ diff --git a/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs index 59631603b2..8a5ce7ae63 100644 --- a/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs +++ b/ForegroundDrawing/LoopingTextures/NuclearTorrentForeground.cs @@ -12,6 +12,14 @@ using Terraria.ModLoader; namespace CalamityMod.ForegroundDrawing.LoopingTextures { + public class NuclearTorrentPlayer : ModPlayer + { + public bool ShouldDisplayTorrentMonolith = false; + public override void ResetEffects() + { + ShouldDisplayTorrentMonolith = false; + } + } public class NuclearTorrentForeground : LoopingTextureForeground { public override Vector2 ParallaxDepth => new Vector2(1f, 1f); @@ -59,7 +67,9 @@ namespace CalamityMod.ForegroundDrawing.LoopingTextures Raindrops.Remove(drop); } - public override bool DoesThisShow() => NPC.CountNPCS(ModContent.NPCType()) > 0 && Main.LocalPlayer.Calamity().ZoneSulphur && !CalamityServerConfig.Instance.BossesStopWeather; + public bool ShouldDisplayDuringOldDuke() => NPC.CountNPCS(ModContent.NPCType()) > 0 && Main.LocalPlayer.Calamity().ZoneSulphur && !CalamityServerConfig.Instance.BossesStopWeather; + + public override bool DoesThisShow() => ShouldDisplayDuringOldDuke() || Main.LocalPlayer.GetModPlayer().ShouldDisplayTorrentMonolith; public override void Update() { diff --git a/Gores/BloodlettingServant1.png b/Gores/BloodlettingServant1.png deleted file mode 100644 index d7522171eb..0000000000 Binary files a/Gores/BloodlettingServant1.png and /dev/null differ diff --git a/Gores/BloodlettingServant2.png b/Gores/BloodlettingServant2.png deleted file mode 100644 index 391c59a4a7..0000000000 Binary files a/Gores/BloodlettingServant2.png and /dev/null differ diff --git a/Gores/BloodlettingServant3.png b/Gores/BloodlettingServant3.png deleted file mode 100644 index a4da81ae9f..0000000000 Binary files a/Gores/BloodlettingServant3.png and /dev/null differ diff --git a/Gores/BloodlettingServant4.png b/Gores/BloodlettingServant4.png deleted file mode 100644 index ddece78bac..0000000000 Binary files a/Gores/BloodlettingServant4.png and /dev/null differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png deleted file mode 100644 index 07f2e01333..0000000000 Binary files a/Gores/SkeletronPrimes_RevMaster/ChadPrime1.png and /dev/null differ diff --git a/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png b/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png deleted file mode 100644 index 303ac4ccde..0000000000 Binary files a/Gores/SkeletronPrimes_RevMaster/ChadPrime2.png and /dev/null differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png deleted file mode 100644 index 860fd8b8c2..0000000000 Binary files a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_1.png and /dev/null differ diff --git a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png b/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png deleted file mode 100644 index 613ee6e5e1..0000000000 Binary files a/Gores/SkeletronPrimes_RevMaster/SkeletronPrime2_2.png and /dev/null differ diff --git a/Gores/WaterDroplet/BasaltGullyLavaDroplet.cs b/Gores/WaterDroplet/BasaltGullyLavaDroplet.cs new file mode 100644 index 0000000000..d11e87ee5d --- /dev/null +++ b/Gores/WaterDroplet/BasaltGullyLavaDroplet.cs @@ -0,0 +1,11 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Gores.WaterDroplet +{ + public class BasaltGullyLavaDroplet : LiquidDropletGore + { + public override bool lavaDroplet => true; + + public override Vector3 lavaColor => new Vector3(2.5f, 1.3f, 0.1f); + } +} diff --git a/Gores/WaterDroplet/BasaltGullyLavaDroplet.png b/Gores/WaterDroplet/BasaltGullyLavaDroplet.png new file mode 100644 index 0000000000..fa76dba55c Binary files /dev/null and b/Gores/WaterDroplet/BasaltGullyLavaDroplet.png differ diff --git a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs index 7270d3e93a..14edbcb506 100644 --- a/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs +++ b/Graphics/Primitives/IPixelatedPrimitiveRenderer.cs @@ -15,6 +15,6 @@ namespace CalamityMod.Graphics.Primitives /// /// Render primitives that use pixelation here. /// - void RenderPixelatedPrimitives(SpriteBatch spriteBatch); + void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer); } } diff --git a/Graphics/Primitives/PixelationPrimitiveLayer.cs b/Graphics/Primitives/PixelationPrimitiveLayer.cs index 1ed0348bc8..4f05c51ef2 100644 --- a/Graphics/Primitives/PixelationPrimitiveLayer.cs +++ b/Graphics/Primitives/PixelationPrimitiveLayer.cs @@ -1,15 +1,17 @@ -using Microsoft.Xna.Framework.Graphics; +using System; namespace CalamityMod.Graphics.Primitives { /// /// Controls what layer the renders to. /// + [Flags] public enum PixelationPrimitiveLayer { - BeforeNPCs, - AfterNPCs, - BeforeProjectiles, - AfterProjectiles + BeforeNPCs = 1, + AfterNPCs = 2, + BeforeProjectiles = 4, + AfterProjectiles = 8, + AfterPlayers = 16 } } diff --git a/Graphics/Primitives/PrimitivePixelationSystem.cs b/Graphics/Primitives/PrimitivePixelationSystem.cs index 19d5fb1b5c..4d2bc635de 100644 --- a/Graphics/Primitives/PrimitivePixelationSystem.cs +++ b/Graphics/Primitives/PrimitivePixelationSystem.cs @@ -18,6 +18,8 @@ namespace CalamityMod.Graphics.Primitives private static ManagedRenderTarget PixelationTarget_AfterProjectiles; + private static ManagedRenderTarget PixelationTarget_AfterPlayers; + private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, width / 2, height / 2); /// @@ -36,11 +38,13 @@ namespace CalamityMod.Graphics.Primitives On_Main.CheckMonoliths += DrawToTargets; On_Main.DoDraw_DrawNPCsOverTiles += DrawTarget_NPCs; On_Main.DrawProjectiles += DrawTarget_Projectiles; + On_Main.DrawPlayers_AfterProjectiles += DrawTarget_Players; PixelationTarget_BeforeNPCs = new(true, CreatePixelTarget); PixelationTarget_AfterNPCs = new(true, CreatePixelTarget); PixelationTarget_BeforeProjectiles = new(true, CreatePixelTarget); PixelationTarget_AfterProjectiles = new(true, CreatePixelTarget); + PixelationTarget_AfterPlayers = new(true, CreatePixelTarget); } public override void Unload() @@ -63,6 +67,7 @@ namespace CalamityMod.Graphics.Primitives var afterNPCs = new List(); var beforeProjectiles = new List(); var afterProjectiles = new List(); + var afterPlayers = new List(); // Check every active projectile. foreach (Projectile projectile in Main.ActiveProjectiles) @@ -70,14 +75,14 @@ namespace CalamityMod.Graphics.Primitives // If the projectile is active, a mod projectile, and uses the interface, add it to the list of primitives to draw this frame. if (projectile.ModProjectile != null && projectile.ModProjectile is IPixelatedPrimitiveRenderer pixelPrimitiveProjectile) { - var listToUse = pixelPrimitiveProjectile.LayerToRenderTo switch - { - PixelationPrimitiveLayer.BeforeNPCs => beforeNPCs, - PixelationPrimitiveLayer.AfterNPCs => afterNPCs, - PixelationPrimitiveLayer.BeforeProjectiles => beforeProjectiles, - _ => afterProjectiles - }; - listToUse.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + beforeNPCs.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + afterNPCs.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + beforeProjectiles.Add(pixelPrimitiveProjectile); + if (pixelPrimitiveProjectile.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + afterPlayers.Add(pixelPrimitiveProjectile); } } @@ -87,23 +92,24 @@ namespace CalamityMod.Graphics.Primitives // If the NPC is active, a mod NPC, and uses the interface, add it to the list of primitives to draw this frame. if (npc.ModNPC != null && npc.ModNPC is IPixelatedPrimitiveRenderer pixelPrimitiveNPC) { - var listToUse = pixelPrimitiveNPC.LayerToRenderTo switch - { - PixelationPrimitiveLayer.BeforeNPCs => beforeNPCs, - PixelationPrimitiveLayer.AfterNPCs => afterNPCs, - PixelationPrimitiveLayer.BeforeProjectiles => beforeProjectiles, - _ => afterProjectiles - }; - listToUse.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeNPCs)) + beforeNPCs.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterNPCs)) + afterNPCs.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.BeforeProjectiles)) + beforeProjectiles.Add(pixelPrimitiveNPC); + if (pixelPrimitiveNPC.LayerToRenderTo.HasFlag(PixelationPrimitiveLayer.AfterPlayers)) + afterPlayers.Add(pixelPrimitiveNPC); } } CurrentlyRendering = true; - DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, beforeNPCs); - DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, afterNPCs); - DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, beforeProjectiles); - DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, afterProjectiles); + DrawPrimsToRenderTarget(PixelationTarget_BeforeNPCs, PixelationPrimitiveLayer.BeforeNPCs, beforeNPCs); + DrawPrimsToRenderTarget(PixelationTarget_AfterNPCs, PixelationPrimitiveLayer.AfterNPCs, afterNPCs); + DrawPrimsToRenderTarget(PixelationTarget_BeforeProjectiles, PixelationPrimitiveLayer.BeforeProjectiles, beforeProjectiles); + DrawPrimsToRenderTarget(PixelationTarget_AfterProjectiles, PixelationPrimitiveLayer.AfterProjectiles, afterProjectiles); + DrawPrimsToRenderTarget(PixelationTarget_AfterPlayers, PixelationPrimitiveLayer.AfterPlayers, afterPlayers); Main.instance.GraphicsDevice.SetRenderTarget(null); @@ -111,7 +117,7 @@ namespace CalamityMod.Graphics.Primitives orig(); } - private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, List pixelPrimitives) + private static void DrawPrimsToRenderTarget(RenderTarget2D renderTarget, PixelationPrimitiveLayer layer, List pixelPrimitives) { // Swap to the target regardless, in order to clear any leftover content from last frame. Not doing this results in the final frame lingering once it stops rendering. renderTarget.SwapTo(); @@ -121,7 +127,7 @@ namespace CalamityMod.Graphics.Primitives Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null); foreach (var pixelPrimitiveDrawer in pixelPrimitives) - pixelPrimitiveDrawer.RenderPixelatedPrimitives(Main.spriteBatch); + pixelPrimitiveDrawer.RenderPixelatedPrimitives(Main.spriteBatch, layer); Main.spriteBatch.End(); } @@ -143,6 +149,12 @@ namespace CalamityMod.Graphics.Primitives DrawTargetScaled(PixelationTarget_AfterProjectiles); } + private void DrawTarget_Players(On_Main.orig_DrawPlayers_AfterProjectiles orig, Main self) + { + orig(self); + DrawTargetScaled(PixelationTarget_AfterPlayers); + } + private static void DrawTargetScaled(ManagedRenderTarget target) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/ILEditing/BalancingILChanges.cs b/ILEditing/BalancingILChanges.cs index 5018cee4bb..f2abeedfea 100644 --- a/ILEditing/BalancingILChanges.cs +++ b/ILEditing/BalancingILChanges.cs @@ -1,6 +1,8 @@ using System; using CalamityMod.Balancing; using CalamityMod.Enums; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; using Terraria; @@ -79,17 +81,6 @@ namespace CalamityMod.ILEditing } cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, 0.5f); // Decrease to 0.5f. - - // CIT 22SEP2024: Removed the edit intended to decrease Frog Leg's jump speed boost, - // as it was not doing anything due to vanilla changing how Frog Leg's jump speed boost is applied. - - // Remove the jump height addition from the Werewolf buff (Moon Charm). - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(2))) - { - LogFailure("Jump Height Boost Fixes", "Could not locate Moon Charm jump height boost value."); - return; - } - cursor.Next.Operand = 0; } private const float VanillaBaseJumpSpeed = 5.01f; @@ -115,16 +106,12 @@ namespace CalamityMod.ILEditing private static void RunSpeedAdjustments(ILContext il) { var cursor = new ILCursor(il); - float asphaltTopSpeedMultiplier = 1.75f; // +75%. Vanilla is +250% + float asphaltTopSpeedMultiplier = 2.25f; // +125%. Vanilla is +250% float asphaltSlowdown = 1f; // Vanilla is 2f. This should actually make asphalt faster. - // Dunerider Boots multiply all run stats by 1.75f in vanilla - float duneRiderBootsMultiplier = 1.25f; // Change to 1.25f - // Multiplied by 0.6 on frozen slime, for +26% acceleration // Multiplied by 0.7 on ice, for +47% acceleration float iceSkateAcceleration = 2.1f; - float iceSkateTopSpeed = 1f; // no boost at all // // ASPHALT @@ -153,22 +140,6 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldc_R4, asphaltSlowdown); } - // - // DUNERIDER BOOTS + SAND BLOCKS - // - { - // Find the multiplier for Dunerider Boots on Sand Blocks. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.75f))) - { - LogFailure("Run Speed Adjustments", "Could not locate the Dunerdier Boots multiplier."); - return; - } - - // Massively reduce the increased speed of Dunerider Boots while on Sand Blocks. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, duneRiderBootsMultiplier); - } - // // ICE SKATES + FROZEN SLIME BLOCKS // @@ -183,17 +154,6 @@ namespace CalamityMod.ILEditing // Massively reduce the acceleration bonus of Ice Skates on Frozen Slime Blocks. cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, iceSkateAcceleration); - - // Find the top speed multiplier of Ice Skates on Frozen Slime Blocks. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f))) - { - LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Frozen Slime Block top speed multiplier."); - return; - } - - // Make Ice Skates give no top speed boost whatsoever on Frozen Slime Blocks. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, iceSkateTopSpeed); } // @@ -210,17 +170,6 @@ namespace CalamityMod.ILEditing // Massively reduce the acceleration bonus of Ice Skates on Ice Blocks. cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, iceSkateAcceleration); - - // Find the top speed multiplier of Ice Skates on Ice Blocks. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(1.25f))) - { - LogFailure("Run Speed Adjustments", "Could not locate Ice Skates + Ice Block top speed multiplier."); - return; - } - - // Make Ice Skates give no top speed boost whatsoever on Ice Blocks. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, iceSkateTopSpeed); } } @@ -241,18 +190,7 @@ namespace CalamityMod.ILEditing } cursor.Next.Operand = BalancingConstants.SoaringInsigniaRunAccelerationMultiplier; - // Second: Magiluminescence. Find the check for whether it's equipped for run speeds. - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("hasMagiluminescence"))) - { - LogFailure("Run Acceleration Nerfs", "Could not locate the Magiluminescence bool."); - return; - } - - // - // Don't actually do anything. Magiluminescence is not intended to be nerfed by Calamity. - // - - // Third: Shadow Armor. Find the check for whether it's equipped for run speeds. + // Second: Shadow Armor. Find the check for whether it's equipped for run speeds. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("shadowArmor"))) { LogFailure("Run Acceleration Nerfs", "Could not locate the Shadow Armor bool."); @@ -398,73 +336,15 @@ namespace CalamityMod.ILEditing orig(self, item); // Hard / Guarding / Armored / Warding give 0.25% / 0.5% / 0.75% / 1% DR if (item.prefix == PrefixID.Hard) - { - /* Prehardmode = 1 - * Hardmode = 2 - * Post-Moon Lord = 3 - * Post-DoG = 4 - */ - - if (DownedBossSystem.downedDoG) - self.statDefense += 3; - else if (NPC.downedMoonlord) - self.statDefense += 2; - else if (Main.hardMode) - self.statDefense += 1; - self.endurance += 0.0025f; - } if (item.prefix == PrefixID.Guarding) - { - /* Prehardmode = 2 - * Hardmode = 3 - * Post-Moon Lord = 4 - * Post-DoG = 5 - */ - - if (DownedBossSystem.downedDoG) - self.statDefense += 3; - else if (NPC.downedMoonlord) - self.statDefense += 2; - else if (Main.hardMode) - self.statDefense += 1; - self.endurance += 0.005f; - } if (item.prefix == PrefixID.Armored) - { - /* Prehardmode = 3 - * Hardmode = 4 - * Post-Moon Lord = 5 - * Post-DoG = 6 - */ - - if (DownedBossSystem.downedDoG) - self.statDefense += 3; - else if (NPC.downedMoonlord) - self.statDefense += 2; - else if (Main.hardMode) - self.statDefense += 1; - self.endurance += 0.0075f; - } if (item.prefix == PrefixID.Warding) - { - /* Prehardmode = 4 - * Hardmode = 5 - * Post-Moon Lord = 6 - * Post-DoG = 7 - */ - - if (DownedBossSystem.downedDoG) - self.statDefense += 3; - else if (NPC.downedMoonlord) - self.statDefense += 2; - else if (Main.hardMode) - self.statDefense += 1; self.endurance += 0.01f; - } + // Lucky prefix increases luck if (item.prefix == PrefixID.Lucky) self.Calamity().calamityBonusLuck += 0.05f; } @@ -501,7 +381,7 @@ namespace CalamityMod.ILEditing private static void VanillaBossResistChanges(ILContext il) { // This IL edit accomplishes two things: - // 1. Reduces Expert+ Eater of Worlds' resist to explosives from 80% to 60%. + // 1. Reduces Expert+ Eater of Worlds' resist to explosives from 80% to 66%. // 2. Effectively removes Lunatic Cultist's resistance to homing projectiles. var cursor = new ILCursor(il); @@ -514,17 +394,15 @@ namespace CalamityMod.ILEditing return; } } - if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchDiv())) + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR4(5f))) { LogFailure("Reduce EoW Grenade Resist", "Could not move to the resist factor."); return; } - // Remove the division instruction, then pop the 5 off the stack to destroy it. Replace it with loading a 0.4 and then multiplying by it. - cursor.Remove(); + // Pop the 5 off the stack, and replace it with a 3. cursor.EmitPop(); - cursor.EmitLdcR4(0.4f); - cursor.EmitMul(); + cursor.EmitLdcR4(3f); // Now, move to the Cultist resist which is right below it. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld(typeof(ProjectileID.Sets), "CultistIsResistantTo"))) @@ -563,30 +441,13 @@ namespace CalamityMod.ILEditing #region UpdateBuffs Balancing Changes private static void UpdateBuffsBalancingChanges(ILContext il) { - // This IL edit accomplishes four things: - // 1. Nerf Sharpening Station's armor penetration boost from 12 to 5. - // 2. Nerf Beetle Scale Mail's set bonus Beetle Might melee speed from 10% per stack to 5%. - // 3. Nerf Nebula armor's Damage and Life Boosters (Mana Boosters are not handled in this method). - // 4. Remove the ability for Feral Bite to randomly inflict debuffs. + // This IL edit accomplishes three things: + // 1. Nerf Beetle Scale Mail's set bonus Beetle Might melee speed from 10% per stack to 5%. + // 2. Nerf Nebula armor's Damage and Life Boosters (Mana Boosters are not handled in this method). + // 3. Remove the vanilla implementation of Feral Bite inflicting random debuffs. var cursor = new ILCursor(il); - // First, find the code which applies Sharpened's armor penetration buff. - if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.Sharpened))) - { - LogFailure("Sharpening Station Nerf", "Could not locate the Sharpened buff ID."); - return; - } - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(12f))) // The amount of armor penetration to grant. - { - LogFailure("Sharpening Station Nerf", "Could not locate the amount of armor penetration granted."); - return; - } - - // Replace the value entirely. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, BalancingConstants.SharpeningStationArmorPenetration); - - // Next, move to Beetle Scale Mail's melee speed boost from Beetle Might buff. + // First, move to Beetle Scale Mail's melee speed boost from Beetle Might buff. if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdcI4(BuffID.BeetleMight1))) { LogFailure("Beetle Scale Mail Nerf", "Could not locate the Beetle Might buff ID."); @@ -642,7 +503,7 @@ namespace CalamityMod.ILEditing // There are multiple branches pointing to this instruction, so it cannot be removed. Instead, swap its value directly. cursor.Next.Operand = BalancingConstants.NebulaDamagePerBooster; - // Finally, removing Feral Bite's debuffs. + // Finally, removing Feral Bite's vanilla debuff infliction. // Find the random debuff duration multiplier for the debuffs inflicted by Feral Bite. if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcR4(0.01f))) // The 0.01f random debuff duration multiplier. { @@ -651,14 +512,78 @@ namespace CalamityMod.ILEditing } // Remove and change to 0f, this makes the random debuffs from Feral Bite have 0 duration. + // Calamity reimplements a different version of this in CalamityGlobalBuff.Update cursor.Remove(); cursor.Emit(OpCodes.Ldc_R4, 0f); } #endregion - #region Vortex Booster Keeps Vortex Stealth When Dashing - private static void VortexBoosterKeepsVortexStealthWhenDashing(On_Player.orig_DashMovement orig, Player self) + #region SoC Buffs & Vortex Booster Keeping Stealth + private static void DashMovementEdits(On_Player.orig_DashMovement orig, Player self) { + //This is a modified version of Vanilla's Shield of Cthulhu dash collision checks + //This is done to be able to adjust values as needed. Here we change the iframe amount and recoil velocity + if (self.dash == 2 && self.eocDash > 0 && self.eocHit < 0) + { + Rectangle DashHitbox = new Rectangle((int)(self.position.X + self.velocity.X * 0.5 - 4.0), (int)(self.position.Y + self.velocity.Y * 0.5 - 4.0), self.width + 8, self.height + 8); + for (int i = 0; i < 200; i++) + { + NPC hitNPC = Main.npc[i]; + if (!hitNPC.active || hitNPC.dontTakeDamage || hitNPC.friendly || (hitNPC.aiStyle == 112 && !(hitNPC.ai[2] <= 1f)) || !self.CanNPCBeHitByPlayerOrPlayerProjectile(hitNPC)) + { + continue; + } + Rectangle npcHitbox = hitNPC.getRect(); + if (DashHitbox.Intersects(npcHitbox) && (hitNPC.noTileCollide || self.CanHit(hitNPC))) + { + float dmg = self.GetTotalDamage(DamageClass.Melee).ApplyTo(self.Calamity().copyrightInfringementShield ? 300f : 30f); + float kb = self.GetTotalKnockback(DamageClass.Melee).ApplyTo(self.Calamity().copyrightInfringementShield ? 12f : 9f); + bool crit = false; + if (Main.rand.Next(100) < self.GetTotalCritChance(DamageClass.Melee)) + { + crit = true; + } + int direction = self.direction; + if (self.velocity.X < 0f) + { + direction = -1; + } + if (self.velocity.X > 0f) + { + direction = 1; + } + self.eocHit = i; + if (self.whoAmI == Main.myPlayer) + { + self.ApplyDamageToNPC(hitNPC, (int)dmg, kb, direction, crit, DamageClass.Melee); + } + self.eocDash = 10; + self.dashDelay = BalancingConstants.OnShieldBonkCooldown; + self.velocity.X = -direction * 9; + self.velocity.Y = -4f; + self.GiveImmuneTimeForCollisionAttack(8); //This is normally 4 in vanilla + int heldDir = 0; + if (self.controlLeft) + heldDir--; + if (self.controlRight) + heldDir++; + int dirSum = Math.Abs(direction + heldDir); + switch (dirSum) + { + case 0: //Holding in direction of recoil + self.velocity.X *= 1.75f; + break; + case 1: //Neutral direction + self.velocity.X *= 1.5f; + break; + case 2: //Holding in direction of enemy + self.velocity.X *= 1.25f; + break; + } + } + } + } + // Allows for Vortex Booster to automatically re-engage Vortex armor's stealth after a delay when dashing bool vortexStealth = self.vortexStealthActive; orig(self); diff --git a/ILEditing/ILChangesLoading.cs b/ILEditing/ILChangesLoading.cs index fcf29214a6..25c3d2c67a 100644 --- a/ILEditing/ILChangesLoading.cs +++ b/ILEditing/ILChangesLoading.cs @@ -65,18 +65,19 @@ namespace CalamityMod.ILEditing // NPC behavior IL_Main.UpdateTime += PermitNighttimeTownNPCSpawning; On_Main.UpdateTime_SpawnTownNPCs += AlterTownNPCSpawnRate; - On_NPC.ShouldEmpressBeEnraged += AllowEmpressToEnrageInBossRush; - On_NPC.DoDeathEvents += PreventVanillaBossDeathsInBossRush; + IL_NPC.DoDeathEvents += PreventVanillaBossDeathsInBossRush; + On_NPC.NPCLoot += PreventDiabolistLootLogic; IL_Player.CollectTaxes += MakeTaxCollectorUseful; // Mechanics / features - On_NPC.ApplyTileCollision += AllowTriggeredFallthrough; + On_NPC.ApplyTileCollision += AllowFusionFeederToDigThroughSand; IL_Player.ApplyEquipFunctional += ScopesRequireVisibilityToZoom; IL_Player.Hurt_PlayerDeathReason_int_int_refHurtInfo_bool_bool_int_bool_float_float_float += DodgeMechanicAdjustments; On_Player.PutHallowedArmorSetBonusOnCooldown += AddHolyProtectionCooldown; IL_Player.DashMovement += FixAllDashMechanics; - On_Player.DashMovement += VortexBoosterKeepsVortexStealthWhenDashing; + On_Player.DashMovement += DashMovementEdits; On_Player.DoCommonDashHandle += ApplyDashKeybind; + On_Player.KeyDoubleTap += DisableDoubleTapOnConfig; IL_Player.GiveImmuneTimeForCollisionAttack += MakeShieldSlamIFramesConsistent; IL_Player.Update_NPCCollision += NerfShieldOfCthulhuBonkSafety; On_WorldGen.OpenDoor += OpenDoor_LabDoorOverride; @@ -84,16 +85,11 @@ namespace CalamityMod.ILEditing On_Item.AffixName += IncorporateEnchantmentInAffix; On_Projectile.NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float += IncorporateExtraProjectileVariables; On_Player.ApplyDamageToNPC += ApplyOldFashionedDamageToMiscHits; - // TODO -- This should be unnecessary. There is now a TML hook for platform collision for ModNPCs. - On_NPC.Collision_DecideFallThroughPlatforms += EnableCalamityBossPlatformCollision; IL_Wiring.HitWireSingle += AddTwinklersToStatue; On_Player.UpdateItemDye += FindCalamityItemDyeShader; On_AWorldListItem.GetDifficulty += GetDifficultyOverride; On_Item.GetShimmered += ShimmerEffectEdits; On_Player.Teleport += TPOverride; - On_NPC.SpawnBoss += TripletsSpawnTextOverride; - On_NPC.DoDeathEvents_BeforeLoot += PreventFoveanatorDefeatMessageIfNotKilledLast; - On_NPC.DoDeathEvents_CelebrateBossDeath += TripletsDefeatTextOverride; On_TileDrawing.DrawSingleTile += GlowMaskTileRender; On_Main.DoUpdate_HandleChat += SpawnPunchCard; On_Player.PlaceThing_CannonBall += AllowCannonJellyfishUse; @@ -101,7 +97,9 @@ namespace CalamityMod.ILEditing On_Player.IsItemSlotUnlockedAndUsable += MasterModeCelestialOnionCheck; // Mana Burn (Chaos Stone) and Chalice of the Blood God - IL_Player.ApplyLifeAndOrMana += ManaSicknessAndChaliceBufferHeal; + IL_Player.ApplyLifeAndOrMana += ChaliceBufferHeal; + On_Player.CheckMana_int_bool_bool += AllowNegativeCheckMana; + On_Player.CheckMana_Item_int_bool_bool += AllowNegativeCheckMana; //LavaStyles if (ExternalMods.biomeLava == null) @@ -177,7 +175,6 @@ namespace CalamityMod.ILEditing IL_Projectile.StatusPlayer += RemoveFrozenInflictionFromDeerclopsIceSpikes; // World generation - IL_WorldGen.Pyramid += ReplacePharaohSetInPyramids; IL_WorldGen.GrowLivingTree += BlockLivingTreesNearOcean; On_WorldGen.SmashAltar += PreventSmashAltarCode; IL_WorldGen.hardUpdateWorld += AdjustChlorophyteSpawnRate; @@ -192,6 +189,8 @@ namespace CalamityMod.ILEditing // Removal of vanilla stupidity IL_Player.StatusFromNPC += RemoveExpertBrainRandomDebuffs; + IL_NPC.VanillaHitEffect += PreventLavaSlimeLavaDrop; + IL_NPC.StrikeNPC_HitInfo_bool_bool += LetDetonatingBubblesTakeDamage; IL_Player.ItemCheck_EmitUseVisuals += MakeMagmaStoneFireGauntletDustToggleable; IL_Projectile.EmitEnchantmentVisualsAt += MakeMagmaStoneFireGauntletProjectileDustToggleable; IL_Sandstorm.HasSufficientWind += DecreaseSandstormWindSpeedRequirement; @@ -200,9 +199,10 @@ namespace CalamityMod.ILEditing On_NPC.SlimeRainSpawns += PreventBossSlimeRainSpawns; On_ShimmerTransforms.IsItemTransformLocked += AdjustShimmerRequirements; On_Projectile.AI_015_Flails += FlailsNoLongerAffectedByPlayerVelocity; + IL_Projectile.AI_061_FishingBobber += WhitelistVictideBobber; + On_Player.ItemCheck_CheckFishingBobbers += PreventVictideBobberFromJamming; IL_Projectile.CanExplodeTile += MakeMeteoriteExplodable; - IL_Main.UpdateWindyDayState += MakeWindyDayMusicPlayLessOften; IL_Main.UpdateTime_StartNight += BloodMoonsRequire200MaxLife; IL_WorldGen.AttemptFossilShattering += PreventFossilShattering; On_Player.GetPickaxeDamage += RemoveHellforgePickaxeRequirement; @@ -213,7 +213,7 @@ namespace CalamityMod.ILEditing On_Player.ItemCheck_CheckCanUse += RemoveUseLocks; On_Player.ItemCheck_UseEventItems += ApplyCelestialSigilChanges; IL_Main.DrawInfoAccs += RemoveDamageConditionFromRadar; - On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; + //On_ShopHelper.ApplyNpcRelationshipEffect += AllowMultipleLikedNPCs; On_Player.UpdateControlHolds += DelayGravity; On_PlayerInput.SetZoom_MouseInWorld += GravityMouse; diff --git a/ILEditing/MechanicILChanges.cs b/ILEditing/MechanicILChanges.cs index 70666e8415..c37d030846 100644 --- a/ILEditing/MechanicILChanges.cs +++ b/ILEditing/MechanicILChanges.cs @@ -6,6 +6,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.DataStructures; +using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.FluidSimulation; using CalamityMod.Items.Accessories; @@ -32,6 +33,7 @@ using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using CalamityMod.Waterfalls; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -79,7 +81,7 @@ namespace CalamityMod.ILEditing //private static readonly MethodInfo textureGetValueMethod = typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance); #region Punch Card Spawning Command - private static void SpawnPunchCard(Terraria.On_Main.orig_DoUpdate_HandleChat orig) + private static void SpawnPunchCard(On_Main.orig_DoUpdate_HandleChat orig) { // Any of these conditions should result in normal behaviour if (!Main.drawingPlayerChat || Main.CurrentInputTextTakerOverride != null || Main.editSign || PlayerInput.UsingGamepad) @@ -161,26 +163,7 @@ namespace CalamityMod.ILEditing // This will occur precisely when the player has no vanilla OR Calamity dash items equipped. cursor.Emit(OpCodes.Or); - // - // SHIELD OF CTHULHU - // - - // Move to Shield of Cthulhu's code by finding its function call for iframes. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCall("GiveImmuneTimeForCollisionAttack"))) - { - LogFailure("Vanilla Dash Fixes", "Could not locate function call for Shield of Cthulhu iframes."); - return; - } - - if (!cursor.TryGotoPrev(MoveType.AfterLabel, i => i.MatchLdcI4(30))) - { - LogFailure("Vanilla Dash Fixes", "Could not locate amount of frames of dash cooldown applied on impact with Shield of Cthulhu."); - return; - } - - // Remove the instruction and replace it with one which gives Calamity's (customizable) amount of dash cooldown. - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, BalancingConstants.OnShieldBonkCooldown); + // CIT 22JUL2025: Shield of Cthulhu bonk is reimplemented in a separate On edit; removed the change made to it via this IL edit. // // SOLAR FLARE ARMOR @@ -282,7 +265,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ldc_I4, 10 - BalancingConstants.ShieldOfCthulhuBonkNoCollideFrames); } - private static void ApplyDashKeybind(Terraria.On_Player.orig_DoCommonDashHandle orig, Player self, out int dir, out bool dashing, Player.DashStartAction dashStartAction) + private static void ApplyDashKeybind(On_Player.orig_DoCommonDashHandle orig, Player self, out int dir, out bool dashing, Player.DashStartAction dashStartAction) { // we feasting multiplayer bugs if (self.whoAmI != Main.myPlayer) @@ -331,50 +314,81 @@ namespace CalamityMod.ILEditing self.dashTime = 0; } } - #endregion - #region Allow Empress to Enrage in Boss Rush - private static bool AllowEmpressToEnrageInBossRush(Terraria.On_NPC.orig_ShouldEmpressBeEnraged orig) + private static void DisableDoubleTapOnConfig(On_Player.orig_KeyDoubleTap orig, Player self, int keyDir) { - if (BossRushEvent.BossRushActive) - return true; + if (self.whoAmI != Main.myPlayer) + { + orig(self, keyDir); + return; + } - return orig(); + if ((CalamityKeybinds.ArmorSetBonusHotKey.GetAssignedKeys().Count != 0 && CalamityClientConfig.Instance.SetBonusDoubleTap == SetBonusDoubleTapOptions.Auto) || CalamityClientConfig.Instance.SetBonusDoubleTap == SetBonusDoubleTapOptions.Off) + return; + + orig(self, keyDir); } #endregion #region Prevent Vanilla Bosses From Being Marked as Defeated in Boss Rush - private static void PreventVanillaBossDeathsInBossRush(On_NPC.orig_DoDeathEvents orig, NPC self, Player closestPlayer) + private static void PreventVanillaBossDeathsInBossRush(ILContext il) { - // Aside from setting the boss' downed bool, DoDeathEvents also handles the following tasks: - // Advancing Slime Rain, spawning Dungeon Spirits, advancing invasion kills, spawning Wall of Flesh's loot box, dropping boss potions and hearts, and sending the boss defeated message. - // The first three do not matter at all in Boss Rush. Wall of Flesh's loot box not spawning is also a positive, so that it doesn't clutter the Underworld. - // Dropping potions is worthless at this point, and Boss Rush is already a horribly balanced hellscape as is, so I'm not worried about hearts. - // As for the last one, well, if anyone actually notices that and cares about it, then I suppose we could make a more sophisticated IL edit. - if (BossRushEvent.BossRushActive) + // GOAL: Prevent vanilla boss defeated flags from getting set during Boss Rush. + // All of this is handled within a switch case directly in the DoDeathEvents function. + // Thus, the objective here is to add a branch past the entire switch case if it is Boss Rush. + var cursor = new ILCursor(il); + + // Move to the point right before the switch case. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("SpawnOnPlayer"))) + { + LogFailure("Prevent Vanilla Defeated Flags in Boss Rush", "Could not move to before the switch case."); return; + } - orig(self, closestPlayer); + // Define a branch label, load the Boss Rush check, and create the branch if it is true. + var label = il.DefineLabel(); + cursor.Emit(OpCodes.Ldsfld, typeof(BossRushEvent).GetField("BossRushActive")); + cursor.Emit(OpCodes.Brtrue, label); + + // Move to after the switch case to place the label. + for (int i = 0; i < 2; i++) + { + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCall("SpawnBoss"))) + { + LogFailure("Prevent Vanilla Defeated Flags in Boss Rush", "Could not move to after the switch case."); + return; + } + } + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdarg0())) + { + LogFailure("Prevent Vanilla Defeated Flags in Boss Rush", "Could not move to after the switch case."); + return; + } + cursor.MarkLabel(label); } - #endregion Prevent Vanilla Bosses From Being Marked as Defeated in Boss Rush + #endregion - #region Enabling of Triggered NPC Platform Fallthrough - // Why this isn't a mechanism provided by TML itself or vanilla itself is beyond me. - private static void AllowTriggeredFallthrough(Terraria.On_NPC.orig_ApplyTileCollision orig, NPC self, bool fall, Vector2 cPosition, int cWidth, int cHeight) + #region Enabling of Fusion Feeder Sand Digging + private static void AllowFusionFeederToDigThroughSand(On_NPC.orig_ApplyTileCollision orig, NPC self, bool fall, Vector2 cPosition, int cWidth, int cHeight) { if (self.active && self.type == ModContent.NPCType()) { self.velocity = Collision.AdvancedTileCollision(TileID.Sets.ForAdvancedCollision.ForSandshark, cPosition, self.velocity, cWidth, cHeight, fall, fall, 1); return; } - var isNpcValid = self.TryGetGlobalNPC(out CalamityGlobalNPC npc); //why the fuck this errors is anybody's guess, it absolutely shouldn't and yet it does - if (isNpcValid && self.active && npc.ShouldFallThroughPlatforms) - fall = true; - orig(self, fall, cPosition, cWidth, cHeight); } #endregion + #region Prevent Diabolists from Dropping Stuff in GFB Before Plantera + private static void PreventDiabolistLootLogic(On_NPC.orig_NPCLoot orig, NPC self) + { + if (self.type == NPCID.DiabolistWhite && Main.getGoodWorld && !NPC.downedPlantBoss) + return; + orig(self); + } + #endregion + #region Town NPC Spawning Improvements private static void PermitNighttimeTownNPCSpawning(ILContext il) { @@ -398,7 +412,7 @@ namespace CalamityMod.ILEditing cursor.Emit(OpCodes.Ret); } - private static void AlterTownNPCSpawnRate(Terraria.On_Main.orig_UpdateTime_SpawnTownNPCs orig) + private static void AlterTownNPCSpawnRate(On_Main.orig_UpdateTime_SpawnTownNPCs orig) { double oldWorldRate = Main.desiredWorldTilesUpdateRate; Main.desiredWorldTilesUpdateRate *= CalamityServerConfig.Instance.TownNPCSpawnRateMultiplier; @@ -483,7 +497,7 @@ namespace CalamityMod.ILEditing #endregion #region Custom Gate Door Logic - private static bool OpenDoor_LabDoorOverride(Terraria.On_WorldGen.orig_OpenDoor orig, int i, int j, int direction) + private static bool OpenDoor_LabDoorOverride(On_WorldGen.orig_OpenDoor orig, int i, int j, int direction) { Tile tile = Main.tile[i, j]; @@ -499,7 +513,7 @@ namespace CalamityMod.ILEditing return orig(i, j, direction); } - private static bool CloseDoor_LabDoorOverride(Terraria.On_WorldGen.orig_CloseDoor orig, int i, int j, bool forced) + private static bool CloseDoor_LabDoorOverride(On_WorldGen.orig_CloseDoor orig, int i, int j, bool forced) { Tile tile = Main.tile[i, j]; @@ -516,20 +530,8 @@ namespace CalamityMod.ILEditing } #endregion - #region Platform Collision Checks for Grounded Bosses - private static bool EnableCalamityBossPlatformCollision(Terraria.On_NPC.orig_Collision_DecideFallThroughPlatforms orig, NPC self) - { - if ((self.type == ModContent.NPCType() || self.type == ModContent.NPCType() || self.type == ModContent.NPCType() || - self.type == ModContent.NPCType() || self.type == ModContent.NPCType()) && - self.target >= 0 && Main.player[self.target].position.Y > self.position.Y + self.height) - return true; - - return orig(self); - } - #endregion - #region Incorporate Enchantments in Item Names - private static string IncorporateEnchantmentInAffix(Terraria.On_Item.orig_AffixName orig, Item self) + private static string IncorporateEnchantmentInAffix(On_Item.orig_AffixName orig, Item self) { string result = orig(self); @@ -545,7 +547,7 @@ namespace CalamityMod.ILEditing #endregion #region Apply Projectile Variables Upon Creation - private static int IncorporateExtraProjectileVariables(Terraria.On_Projectile.orig_NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float orig, IEntitySource spawnSource, float x, float y, float xSpeed, float ySpeed, int type, int damage, float knockback, int owner, float ai0, float ai1, float ai2) + private static int IncorporateExtraProjectileVariables(On_Projectile.orig_NewProjectile_IEntitySource_float_float_float_float_int_int_float_int_float_float_float orig, IEntitySource spawnSource, float x, float y, float xSpeed, float ySpeed, int type, int damage, float knockback, int owner, float ai0, float ai1, float ai2) { // This is unfortunately not something that can be done via SetDefaults since owner is set // after that method is called. Doing it directly when the projectile is spawned appears to be the only reasonable way. @@ -613,7 +615,7 @@ namespace CalamityMod.ILEditing #endregion #region Apply Old Fashioned Damage to Miscellanous Hits - private static void ApplyOldFashionedDamageToMiscHits(Terraria.On_Player.orig_ApplyDamageToNPC orig, Player self, NPC npc, int damage, float knockback, int direction, bool crit = false, DamageClass? damageType = null, bool damageVariation = false) + private static void ApplyOldFashionedDamageToMiscHits(On_Player.orig_ApplyDamageToNPC orig, Player self, NPC npc, int damage, float knockback, int direction, bool crit = false, DamageClass? damageType = null, bool damageVariation = false) { if (self.Calamity().oldFashioned) damage = (int)(damage * OldFashioned.DamageBoostMultiplier); @@ -622,7 +624,7 @@ namespace CalamityMod.ILEditing #endregion #region Chaos Stone and Chalice of the Blood God - private static void ManaSicknessAndChaliceBufferHeal(ILContext il) + private static void ChaliceBufferHeal(ILContext il) { ILCursor cursor = new ILCursor(il); @@ -670,36 +672,37 @@ namespace CalamityMod.ILEditing } } }); + } + #endregion - // - // The following section enables Mana Burn for Chaos Stone by conditionally replacing Mana Sickness. - // - - // Start by finding the vanilla code which applies Mana Sickness (buff ID 94). - if (!cursor.TryGotoNext(c => c.MatchLdcI4(BuffID.ManaSickness))) + #region Chaos Stone Mana Burn changes + private static bool AllowNegativeCheckMana(On_Player.orig_CheckMana_int_bool_bool orig,Player self, int amount, bool pay, bool blockQuickMana) { + if (self.Calamity().ChaosStone) { - LogFailure("Conditionally Replace Mana Sickness", "Could not locate the mana sickness buff ID."); - return; + if (pay) + self.statMana -= amount; + if (self.statMana < -self.statManaMax2) + self.statMana = -self.statManaMax2; + return true; } + return orig(self, amount, pay, blockQuickMana); + } - // Remove the constant buff ID. - cursor.Remove(); - - // Load the player onto the stack for use in the following delegate. - cursor.Emit(OpCodes.Ldarg_0); - - // Emit code which checks for the Chaos Stone. If equipped, the player gets Mana Burn instead of Mana Sickness. - cursor.EmitDelegate>(player => + private static bool AllowNegativeCheckMana(On_Player.orig_CheckMana_Item_int_bool_bool orig, Player self, Item item, int amount, bool pay, bool blockQuickMana) { + if (self.Calamity().ChaosStone) { - if (!player.active || !player.Calamity().ChaosStone) - return BuffID.ManaSickness; - return ModContent.BuffType(); - }); + if (pay) + self.statMana -= item.mana; + if (self.statMana < -self.statManaMax2) + self.statMana = -self.statManaMax2; + return true; + } + return orig(self, item, amount, pay, blockQuickMana); } #endregion #region Fire Cursor Effect for the Calamity Accessory - private static void UseCoolFireCursorEffect(Terraria.On_Main.orig_DrawCursor orig, Vector2 bonus, bool smart) + private static void UseCoolFireCursorEffect(On_Main.orig_DrawCursor orig, Vector2 bonus, bool smart) { Player player = Main.LocalPlayer; @@ -911,7 +914,7 @@ namespace CalamityMod.ILEditing #endregion #region General Particle Rendering - private static void DrawFusableParticles(Terraria.On_Main.orig_SortDrawCacheWorms orig, Main self) + private static void DrawFusableParticles(On_Main.orig_SortDrawCacheWorms orig, Main self) { DeathAshParticle.DrawAll(); @@ -921,7 +924,7 @@ namespace CalamityMod.ILEditing orig(self); } - private static void DrawForegroundParticles(Terraria.On_Main.orig_DrawInfernoRings orig, Main self) + private static void DrawForegroundParticles(On_Main.orig_DrawInfernoRings orig, Main self) { GeneralParticleHandler.DrawAllParticles(Main.spriteBatch); orig(self); @@ -1081,6 +1084,18 @@ namespace CalamityMod.ILEditing #region Lava Blocking private void BlockLavaDrawing(ILContext il) + { + if (ModLoader.HasMod("LiquidSlopesPatch")) + { + BlockLavaDrawing_LiquidSlopesPatch(il); + } + else + { + BlockLavaDrawing_Vanilla(il); + } + } + + private void BlockLavaDrawing_Vanilla(ILContext il) { //This edit to DrawNormalLiquids makes lavas in normal and white lighting draw with an alpha and with new textures //If the parameter for the waterstyle is more than the max waterstyles then its subtracted by the max water style count and thats the lava style ID @@ -1132,6 +1147,61 @@ namespace CalamityMod.ILEditing ); } + private void BlockLavaDrawing_LiquidSlopesPatch(ILContext il) + { + Assembly lspAsm = ModLoader.GetMod("LiquidSlopesPatch").Code; + Type liquidDrawCache = lspAsm.GetType("LiquidSlopesPatch.Common.RewrittenLiquidRenderer").GetNestedType("LiquidDrawCache"); + + //This edit to DrawNormalLiquids makes lavas in normal and white lighting draw with an alpha and with new textures + //If the parameter for the waterstyle is more than the max waterstyles then its subtracted by the max water style count and thats the lava style ID + ILCursor cursor = new ILCursor(il); + + //Continue if statement, basically + //if the liquid being drawn is lava and the water style is greater than the max water styles or if the liquid is water and less than the max water styles then the draw code is ran + //otherwise the loop/s are continued for the next liquid + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld(liquidDrawCache, "IsVisible"))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate the IsVisible boolean check"); + return; + } + cursor.EmitLdarg3(); + cursor.EmitLdloc2(); //Initiated Liquid Draw Cache (needed for the Type parameter) + cursor.EmitLdfld(liquidDrawCache.GetField("Type")); + cursor.EmitDelegate>((IsVisible, style, type) => IsVisible && ((type == 1 && style >= LavaRenderingSystem.Instance.WaterStyleMaxCount + 1) || (type != 1 && style <= LavaRenderingSystem.Instance.WaterStyleMaxCount))); + + //Lava alpha color, if the liquid drawn is lava, multiply num by the water alpha + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdloc(2), i => i.MatchLdfld(liquidDrawCache.GetField("Type")), i => i.MatchStloc(8))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate creation of the local variable num2 (the liquid type holder variable)"); + return; + } + cursor.EmitLdloc(8); + cursor.EmitLdloca(7); + cursor.EmitLdarg(4); + cursor.EmitDelegate((int num2, ref float num, float globalAlpha) => + { + if (num2 == LiquidID.Lava) + { + num *= globalAlpha; + } + }); + + //Conditionally replace the liquid texture whether the liquid is lava or water + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchCallvirt(typeof(Asset).GetMethod("get_Value", BindingFlags.Public | BindingFlags.Instance)))) + { + LogFailure("Liquid Renderer Drawing", "Could not locate the Texture2D array of liquids"); + return; + } + cursor.EmitLdarg3(); + cursor.EmitLdloc2(); //Initiated Liquid Draw Cache (needed for the Type parameter) + cursor.EmitLdfld(liquidDrawCache.GetField("Type")); + cursor.EmitDelegate>((initialTexture, style, type) => + (style >= LavaRenderingSystem.Instance.WaterStyleMaxCount + 1 && type == LiquidID.Lava) + ? LavaRenderingSystem.Textures.liquid[style - LavaRenderingSystem.Instance.WaterStyleMaxCount - 1].Value + : initialTexture + ); + } + private void BlockLavaDrawingForSlopes(On_TileDrawing.orig_DrawTile_LiquidBehindTile orig, TileDrawing self, bool solidLayer, bool inFrontOfPlayers, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY, Tile tileCache) { if (tileCache.LiquidType == LiquidID.Lava) @@ -1385,6 +1455,18 @@ namespace CalamityMod.ILEditing } private static void LiquidDrawColors(ILContext il) + { + if (ModLoader.HasMod("LiquidSlopesPatch")) + { + LiquidDrawColors_LiquidSlopesPatch(il); + } + else + { + LiquidDrawColors_Vanilla(il); + } + } + + private static void LiquidDrawColors_Vanilla(ILContext il) { ILCursor cursor = new ILCursor(il); if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdarg2(), c => c.MatchLdloc3(), c => c.MatchLdloc(4), c => c.MatchCall
("DrawTileInWater"))) @@ -1411,6 +1493,37 @@ namespace CalamityMod.ILEditing } }); } + + private static void LiquidDrawColors_LiquidSlopesPatch(ILContext il) + { + Assembly lspAsm = ModLoader.GetMod("LiquidSlopesPatch").Code; + Type liquidDrawCache = lspAsm.GetType("LiquidSlopesPatch.Common.RewrittenLiquidRenderer").GetNestedType("LiquidDrawCache"); + + ILCursor cursor = new ILCursor(il); + if (!cursor.TryGotoNext(MoveType.Before, c => c.MatchLdarg2(), c => c.MatchLdloc(out _), c => c.MatchLdloc(out _), c => c.MatchCall
("DrawTileInWater"))) + { + LogFailure("Liquid Draw Colors (LSP)", "Could not locate the liquid vertex colors for drawing"); + return; + } + + cursor.Emit(OpCodes.Ldloc, 9); + cursor.Emit(OpCodes.Ldloc, 10); + cursor.Emit(OpCodes.Ldloc_2); + cursor.Emit(OpCodes.Ldfld, liquidDrawCache.GetField("Type")); + cursor.Emit(OpCodes.Ldloca, 11); + + cursor.EmitDelegate((int x, int y, int liquidType, ref VertexColors initialColor) => + { + if (liquidType == LiquidID.Water) + { + CalamityWaterLoader.DrawColorSetup(x, y, Main.waterStyle, ref initialColor); + } + else if (liquidType == LiquidID.Lava && ExternalMods.biomeLava == null) + { + LavaStylesLoader.DrawColorSetup(x, y, LavaRenderingSystem.LavaStyle, ref initialColor); + } + }); + } private static void LiquidSlopeDrawColors(ILContext il) { @@ -1483,88 +1596,28 @@ namespace CalamityMod.ILEditing #endregion #region Statue Additions - /// - /// Change the following code sequence in Wiring.HitWireSingle - /// num8 = (int) Utils.SelectRandom(Main.rand, new short[2] - /// { - /// 355, - /// 358 - /// }); - /// - /// to - /// - /// var arr = new short[2] - /// { - /// 355, - /// 358 - /// }); - /// arr = arr.ToList().Add(id).ToArray(); - /// num8 = Utils.SelectRandom(Main.rand, arr); - /// - /// - /// private static void AddTwinklersToStatue(ILContext il) { - // obtain a cursor positioned before the first instruction of the method - // the cursor is used for navigating and modifying the il - var c = new ILCursor(il); + // Allow Twinklers to be spawned by the Firefly Statue. + var cursor = new ILCursor(il); - // the exact location for this hook is very complex to search for due to the hook instructions not being unique, and buried deep in control flow - // switch statements are sometimes compiled to if-else chains, and debug builds litter the code with no-ops and redundant locals - - // in general you want to search using structure and function rather than numerical constants which may change across different versions or compile settings - // using local variable indices is almost always a bad idea - - // we can search for - // switch (*) - // case 54: - // Utils.SelectRandom * - - // in general you'd want to look for a specific switch variable, or perhaps the containing switch (type) { case 105: - // but the generated IL is really variable and hard to match in this case - - // we'll just use the fact that there are no other switch statements with case 54, followed by a SelectRandom - - ILLabel[] targets = null; - while (c.TryGotoNext(i => i.MatchSwitch(out targets))) + // Move to the method which randomly selects an NPC for the Statue to spawn. This is the second call of the method in this function. + for (int i = 0; i < 2; i++) { - // some optimising compilers generate a sub so that all the switch cases start at 0 - // ldc.i4.s 51 - // sub - // switch - int offset = 0; - if (c.Prev.MatchSub() && c.Prev.Previous.MatchLdcI4(out offset)) + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchCall(typeof(Utils), nameof(Utils.SelectRandom)))) { - ; + LogFailure("Add Twinkler to Firefly Statue", "Could not move to the SelectRandom method."); + return; } - - // get the label for case 54: if it exists - int case54Index = 54 - offset; - if (case54Index < 0 || case54Index >= targets.Length || !(targets[case54Index] is ILLabel target)) - { - continue; - } - - // move the cursor to case 54: - c.GotoLabel(target); - // there's lots of extra checks we could add here to make sure we're at the right spot, such as not encountering any branching instructions - c.GotoNext(i => i.MatchCall(typeof(Utils), nameof(Utils.SelectRandom))); - - // goto next positions us before the instruction we searched for, so we can insert our array modifying code right here - c.EmitDelegate>(arr => - { - // resize the array and add our custom firefly - Array.Resize(ref arr, arr.Length + 1); - arr[arr.Length - 1] = (short)ModContent.NPCType(); - return arr; - }); - - // hook applied successfully - return; } - // couldn't find the right place to insert - throw new Exception("Hook location not found, switch(*) { case 54: ..."); + // Emit a delegate which resizes the array and adds Twinkler to it. + cursor.EmitDelegate>(arr => + { + Array.Resize(ref arr, arr.Length + 1); + arr[arr.Length - 1] = (short)ModContent.NPCType(); + return arr; + }); } #endregion @@ -1624,7 +1677,7 @@ namespace CalamityMod.ILEditing /// /// Determines if the custom grapple movement should take place or not. Useful for hooks that only do movement tricks in some cases /// - private static void CustomGrappleMovementCheck(Terraria.On_Player.orig_GrappleMovement orig, Player self) + private static void CustomGrappleMovementCheck(On_Player.orig_GrappleMovement orig, Player self) { WulfrumPackPlayer mp = self.GetModPlayer(); @@ -1637,7 +1690,7 @@ namespace CalamityMod.ILEditing /// /// This is called right before the game decides wether or not to update the players velocity based on "real" physics (aka not tongued or hooked or with a pulley) /// - private static void CustomGrapplePreDefaultMovement(Terraria.On_Player.orig_UpdatePettingAnimal orig, Player self) + private static void CustomGrapplePreDefaultMovement(On_Player.orig_UpdatePettingAnimal orig, Player self) { orig(self); @@ -1661,7 +1714,7 @@ namespace CalamityMod.ILEditing /// Used before the player steps up a half tile. If we don't do that, players that are grappled but don't use hook movement won't be able to go over tiles. /// The hook cache is reset in PreUpdateMovement ///
- private static void CustomGrapplePreStepUp(Terraria.On_Player.orig_SlopeDownMovement orig, Player self) + private static void CustomGrapplePreStepUp(On_Player.orig_SlopeDownMovement orig, Player self) { orig(self); @@ -1675,9 +1728,9 @@ namespace CalamityMod.ILEditing } /// - /// This is done to put the hook if it was cacehd during the frame instruction. + /// This is done to put the hook if it was cached during the frame instruction. /// - private static void CustomGrapplePostFrame(Terraria.On_Player.orig_PlayerFrame orig, Player self) + private static void CustomGrapplePostFrame(On_Player.orig_PlayerFrame orig, Player self) { orig(self); WulfrumPackPlayer mp = self.GetModPlayer(); @@ -1694,7 +1747,7 @@ namespace CalamityMod.ILEditing #region Find Calamity Item Dye Shader - internal static void FindCalamityItemDyeShader(Terraria.On_Player.orig_UpdateItemDye orig, Player self, bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem) + internal static void FindCalamityItemDyeShader(On_Player.orig_UpdateItemDye orig, Player self, bool isNotInVanitySlot, bool isSetToHidden, Item armorItem, Item dyeItem) { orig(self, isNotInVanitySlot, isSetToHidden, armorItem, dyeItem); if (armorItem.type == ModContent.ItemType()) @@ -1727,7 +1780,7 @@ namespace CalamityMod.ILEditing #endregion #region Custom world selection difficulties - internal static void GetDifficultyOverride(Terraria.GameContent.UI.Elements.On_AWorldListItem.orig_GetDifficulty orig, AWorldListItem self, out string expertText, out Color gameModeColor) + internal static void GetDifficultyOverride(On_AWorldListItem.orig_GetDifficulty orig, AWorldListItem self, out string expertText, out Color gameModeColor) { // Run the original code and pull out the original text and text color orig(self, out expertText, out gameModeColor); @@ -1762,29 +1815,10 @@ namespace CalamityMod.ILEditing #endregion #region Shimmer effect edits - public static void ShimmerEffectEdits(Terraria.On_Item.orig_GetShimmered orig, Item self) + public static void ShimmerEffectEdits(On_Item.orig_GetShimmered orig, Item self) { - // Don't keep the original stack amount when shimmering Cirrus' Vodka into Crystal Heart Vodka - if (self.type == ModContent.ItemType()) - { - self.SetDefaults(ModContent.ItemType()); - self.shimmered = true; - self.shimmerWet = true; - self.wet = true; - self.velocity *= 0.1f; - if (Main.netMode == 0) - { - Item.ShimmerEffect(self.Center); - } - else - { - NetMessage.SendData(146, -1, -1, null, 0, (int)self.Center.X, (int)self.Center.Y); - NetMessage.SendData(145, -1, -1, null, self.whoAmI, 1f); - } - AchievementsHelper.NotifyProgressionEvent(27); - } // Make Plagued Containment Bricks turn into Plagued Nanodroids if shimmered before defeating Golem - else if (self.type == ModContent.ItemType()) + if (self.type == ModContent.ItemType()) { if (NPC.downedGolemBoss) orig(self); @@ -1824,7 +1858,7 @@ namespace CalamityMod.ILEditing #region Block Abyss from Teleportation Potions - public static void TPOverride(Terraria.On_Player.orig_Teleport orig, Player self, Vector2 newPos, int Style = 0, int extraInfo = 0) + public static void TPOverride(On_Player.orig_Teleport orig, Player self, Vector2 newPos, int Style = 0, int extraInfo = 0) { // Grab the tile from where the potion wants to teleport Tile t = CalamityUtils.ParanoidTileRetrieval(newPos.ToTileCoordinates().X, newPos.ToTileCoordinates().Y); @@ -1832,7 +1866,7 @@ namespace CalamityMod.ILEditing if (Style == 2) { // Check if it's an Abyss wall - if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) + if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) { // If an Abyss wall is detected, try to find another teleportation location bool canSpawn = false; @@ -1861,74 +1895,13 @@ namespace CalamityMod.ILEditing // Potion of Return triggers Jared if used in the Abyss if (Style == 8) { - if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) + if (t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType() || t.WallType == ModContent.WallType()) self.AddBuff(BuffID.ChaosState, 2); } } } #endregion - #region Revengeance Master Mode Twins Shenanigans - public static void TripletsSpawnTextOverride(Terraria.On_NPC.orig_SpawnBoss orig, int x, int y, int type, int targetPlayerIndex) - { - if (CalamityWorld.death && type == NPCID.Retinazer) - { - int retinazerIndex = NPC.NewNPC(NPC.GetBossSpawnSource(targetPlayerIndex), x, y, type, 1); - if (retinazerIndex == 200) - { - return; - } - Main.npc[retinazerIndex].target = targetPlayerIndex; - Main.npc[retinazerIndex].timeLeft *= 20; - - if (Main.dedServ && retinazerIndex < 200) - { - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazerIndex); - } - - AchievementsHelper.CheckMechaMayhem(); - - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.TripletsBossText", new Color(175, 75, 255)); - return; - } - else - { - orig(x, y, type, targetPlayerIndex); - } - } - - public static void PreventFoveanatorDefeatMessageIfNotKilledLast(On_NPC.orig_DoDeathEvents_BeforeLoot orig, NPC self, Player closestPlayer) - { - if (CalamityWorld.death && self.type == ModContent.NPCType() && (NPC.AnyNPCs(NPCID.Spazmatism) || NPC.AnyNPCs(NPCID.Retinazer))) - { - self.value = 0f; - self.boss = false; - return; - } - else - { - orig(self, closestPlayer); - } - } - - public static void TripletsDefeatTextOverride(On_NPC.orig_DoDeathEvents_CelebrateBossDeath orig, NPC self, string typeName) - { - bool correctNPCType = self.type == NPCID.Retinazer || self.type == NPCID.Spazmatism || self.type == ModContent.NPCType(); - if (CalamityWorld.death && correctNPCType) - { - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue("Announcement.HasBeenDefeated_Plural", CalamityUtils.GetTextValue("Status.Boss.TripletsDefeatName")), 175, 75, 255); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasBeenDefeated_Plural", NetworkText.FromKey("Mods.CalamityMod.Status.Boss.TripletsDefeatName")), new Color(175, 75, 255)); - return; - } - else - { - orig(self, typeName); - } - } - #endregion - #region Optimized GlowMask Rendering on Tile private static void GlowMaskTileRender(On_TileDrawing.orig_DrawSingleTile orig, TileDrawing self, TileDrawInfo drawData, bool solidLayer, int waterStyleOverride, Vector2 screenPosition, Vector2 screenOffset, int tileX, int tileY) { @@ -1993,7 +1966,7 @@ namespace CalamityMod.ILEditing #endregion #region Allow Cannons to use jellyfish - public static void AllowCannonJellyfishUse(Terraria.On_Player.orig_PlaceThing_CannonBall orig, Player self) + public static void AllowCannonJellyfishUse(On_Player.orig_PlaceThing_CannonBall orig, Player self) { // Check if the player is holding a jelly if (self.HeldItem.type == ModContent.ItemType()) @@ -2104,7 +2077,7 @@ namespace CalamityMod.ILEditing #endregion #region Add Stohne to the Jungle - public static void AddStohne(Terraria.GameContent.Biomes.On_JunglePass.orig_GenerateFinishingTouches orig, JunglePass self, GenerationProgress progress, int oldX, int oldY) + public static void AddStohne(On_JunglePass.orig_GenerateFinishingTouches orig, JunglePass self, GenerationProgress progress, int oldX, int oldY) { int anchorX = oldX; int anchorY = oldY; @@ -2505,9 +2478,9 @@ namespace CalamityMod.ILEditing { colorType = (int)BabyGhostBell.JellyColor.Green; } - if (item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType()) { - colorType = (int)BabyGhostBell.JellyColor.Red; + colorType = (int)BabyGhostBell.JellyColor.Pink; } if (item.type == ModContent.ItemType()) { @@ -2648,7 +2621,7 @@ namespace CalamityMod.ILEditing #endregion #region Make Celestial Onion give the Master Mode slot - public static bool MasterModeCelestialOnionCheck(Terraria.On_Player.orig_IsItemSlotUnlockedAndUsable orig, Player self, int slot) + public static bool MasterModeCelestialOnionCheck(On_Player.orig_IsItemSlotUnlockedAndUsable orig, Player self, int slot) { if ((slot == 9 || slot == 19) && self.Calamity().extraAccessoryML && !Main.gameMenu) { diff --git a/ILEditing/VanillaStupidityFixingILChanges.cs b/ILEditing/VanillaStupidityFixingILChanges.cs index a7c1ac0020..cc0f5ccb85 100644 --- a/ILEditing/VanillaStupidityFixingILChanges.cs +++ b/ILEditing/VanillaStupidityFixingILChanges.cs @@ -8,7 +8,9 @@ using CalamityMod.Items.TreasureBags.MiscGrabBags; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Walls; +using CalamityMod.World; using Microsoft.Xna.Framework; using Mono.Cecil.Cil; using MonoMod.Cil; @@ -17,7 +19,7 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Drawing; -using Terraria.GameContent.Personalities; +using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; using Terraria.Graphics.Effects; @@ -153,7 +155,7 @@ namespace CalamityMod.ILEditing #endregion #region Prevention of Slime Rain Spawns When Near Bosses - private static void PreventBossSlimeRainSpawns(Terraria.On_NPC.orig_SlimeRainSpawns orig, int plr) + private static void PreventBossSlimeRainSpawns(On_NPC.orig_SlimeRainSpawns orig, int plr) { if (!Main.player[plr].Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) orig(plr); @@ -174,12 +176,66 @@ namespace CalamityMod.ILEditing } // Remove the Expert Mode check, and in its place put a check for the Zenith seed (Get fixed boi). - // Note from CIT: I originally removed these entirely; restoring it in GFB was Fabsol's idea. cursor.Emit(OpCodes.Pop); cursor.Emit(OpCodes.Ldsfld, typeof(Main).GetField("zenithWorld")); } #endregion + #region Prevent Lava Slime Dropping Lava + private static void PreventLavaSlimeLavaDrop(ILContext il) + { + // Disable Lava Slimes dropping lava if its respective config is enabled. + var cursor = new ILCursor(il); + + // Go to the check for Remix world. + if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld
("remixWorld"))) + { + LogFailure("Prevent Lava Slime Dropping Lava", "Could not find the check for Remix World."); + return; + } + + // Add an additional check for the config. + cursor.Remove(); + cursor.EmitDelegate>(() => CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes || Main.remixWorld); + } + #endregion + + #region Disable Detonating Bubble StrikeNPC Hardcoded Override + private static void LetDetonatingBubblesTakeDamage(ILContext il) + { + // In vanilla's StrikeNPC function, Detonating Bubbles have a hardcoded type check which sets the damage of the strike to 0. + // This IL edit disables that type check in Death Mode. + var cursor = new ILCursor(il); + + // Go to the point after the check for the Detonating Bubble NPC ID. + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdcR8(0.0))) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move after the NPC type check."); + return; + } + + // Define the label. + var label = il.DefineLabel(); + + // Add a branch if it is Death Mode. + cursor.Emit(OpCodes.Ldsfld, typeof(CalamityWorld).GetField("death")); + cursor.Emit(OpCodes.Brtrue, label); + + // Move to the point after Detonating Bubble changes are implemented to place the branch label. + if (!cursor.TryGotoNext(MoveType.After, i => i.MatchStfld("dontTakeDamage"))) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic."); + return; + } + if (!cursor.TryGotoNext(MoveType.AfterLabel, i => i.MatchLdarg0())) + { + LogFailure("Let Detonating Bubbles Take Damage in Death", "Could not move to after the Detonating Bubble logic."); + return; + } + cursor.MarkLabel(label); + } + #endregion + #region Make Meteorite Explodable private static void MakeMeteoriteExplodable(ILContext il) { @@ -204,34 +260,6 @@ namespace CalamityMod.ILEditing } #endregion - #region Make Windy Day Music Play Less Often - private static void MakeWindyDayMusicPlayLessOften(ILContext il) - { - // Make windy day theme only play when the wind speed is over 0.5f instead of 0.4f and make it stop when the wind dies down to below 0.44f instead of 0.34f. - var cursor = new ILCursor(il); - - FieldInfo _minWindField = typeof(Main).GetField("_minWind", BindingFlags.NonPublic | BindingFlags.Static); - - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld(_minWindField))) // The min wind speed check that stops the windy day theme when the wind dies down enough. - { - LogFailure("Make Windy Day Music Play Less Often", "Could not locate the _minWind variable."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 0.44f); // Change to 0.44f. - - FieldInfo _maxWindField = typeof(Main).GetField("_maxWind", BindingFlags.NonPublic | BindingFlags.Static); - - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdsfld(_maxWindField))) // The max wind speed check that causes the windy day theme to play. - { - LogFailure("Make Windy Day Music Play Less Often", "Could not locate the _maxWind variable."); - return; - } - cursor.Remove(); - cursor.Emit(OpCodes.Ldc_R4, 0.5f); // Change to 0.5f. - } - #endregion Make Windy Day Music Play Less Often - #region Change Blood Moon Max HP Requirements private static void BloodMoonsRequire200MaxLife(ILContext il) { @@ -271,13 +299,15 @@ namespace CalamityMod.ILEditing LogFailure("Prevent Fossil Shattering", "Could not locate the Desert Fossil Tile ID variable."); return; } + + // Remove this value and replace it with a large number that will never be a valid tile ID. cursor.Remove(); - cursor.Emit(OpCodes.Ldc_I4, TileID.PixelBox); // Change to Pixel Box because it cannot be obtained in-game without cheating. + cursor.Emit(OpCodes.Ldc_I4, 40000); } #endregion #region Remove Hellforge Pickaxe Requirement - private static int RemoveHellforgePickaxeRequirement(Terraria.On_Player.orig_GetPickaxeDamage orig, Player self, int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget) + private static int RemoveHellforgePickaxeRequirement(On_Player.orig_GetPickaxeDamage orig, Player self, int x, int y, int pickPower, int hitBufferIndex, Tile tileTarget) { if (tileTarget.TileType == TileID.Hellforge) pickPower = 65; @@ -295,9 +325,58 @@ namespace CalamityMod.ILEditing } #endregion - #region Fix Chlorophyte Crystal Attacking Where it Shouldn't - // TODO -- Finish this - #endregion Fix Chlorophyte Crystal Attacking Where it Shouldn't + #region Allow Victide Bobber to Exist + private static void WhitelistVictideBobber(ILContext il) + { + var cursor = new ILCursor(il); + + // Find the label which skips the "flag = true" that kills the projectile + ILLabel flagStorage = null; + if (!cursor.TryGotoNext(MoveType.After, x => x.MatchBeq(out flagStorage))) + { + LogFailure("Allow Victide Bobber to Exist", "Failed to properly navigate label to direct to"); + return; + } + + // Properly perform the skip if the projectile type is the Victide Bobber + cursor.Emit(OpCodes.Ldarg_0); + cursor.Emit(OpCodes.Ldfld, typeof(Projectile).GetField("type")); + cursor.Emit(OpCodes.Ldc_I4, ModContent.ProjectileType()); + cursor.Emit(OpCodes.Beq_S, flagStorage); + } + #endregion + + #region Prevent Victide Bobber from Jammming + private static bool PreventVictideBobberFromJamming(On_Player.orig_ItemCheck_CheckFishingBobbers orig, Player self, bool canUse) + { + // Run through the original stuff + canUse = orig(self, canUse); + + int bobberCount = 0; + foreach (Projectile proj in Main.ActiveProjectiles) + { + if (proj.active && proj.owner == self.whoAmI && proj.bobber) + { + bobberCount++; + if (proj.type == ModContent.ProjectileType()) + { + // Go back to casting if there's nothing loaded + if (proj.ai[1] == 0f) + proj.ai[0] = 0f; + + // Allow you to still use the fishing rod + canUse = true; + } + } + } + + // Unless.. you have a bobber already that's NOT Victide, then back to disabling + if (canUse && bobberCount > 1) + canUse = false; + + return canUse; + } + #endregion #region Prevent UFO Mount from Dismounting in Water private static void PreventUFODismountInWater(ILContext il) @@ -331,7 +410,7 @@ namespace CalamityMod.ILEditing #endregion Prevent UFO Mount from Dismounting in Water #region Color Blighted Gel - private static void ColorBlightedGel(Terraria.GameContent.ItemDropRules.On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex) + private static void ColorBlightedGel(On_CommonCode.orig_ModifyItemDropFromNPC orig, NPC npc, int itemIndex) { orig(npc, itemIndex); @@ -357,7 +436,7 @@ namespace CalamityMod.ILEditing #endregion Color Blighted Gel #region Improve Angler Quest Rewards - private static void ImproveAnglerRewards(Terraria.On_Player.orig_GetAnglerReward orig, Player self, NPC angler, int questItemType) + private static void ImproveAnglerRewards(On_Player.orig_GetAnglerReward orig, Player self, NPC angler, int questItemType) { orig(self, angler, questItemType); @@ -1046,7 +1125,7 @@ namespace CalamityMod.ILEditing var cursor = new ILCursor(il); if (!cursor.TryGotoNext(MoveType.After, i => i.MatchLdfld("magmaStone"))) // Flag for if Magma Stone is equipped. Fire Gauntlet also uses this. { - LogFailure("Make Magma Stone & Fire Gauntlet Dust Toggleable", "Could not locate the magma stone variable."); + LogFailure("Make Magma Stone & Fire Gauntlet Dust Toggleable", "Could not locate the Magma Stone variable."); return; } // Load the player itself onto the stack so that it becomes an argument for the following delegate. @@ -1091,7 +1170,7 @@ namespace CalamityMod.ILEditing } // Remove the instruction and replace with 1 (true). This effectively removes the requirement for defeating Plantera. - // The only requirements for summoning Golems with Power Cells are now: 1) Golem is not alive, and 2) The world is in Hardmode. + // The only requirements for summoning Golem with Power Cells are now: 1) Golem is not alive, and 2) The world is in Hardmode. cursor.EmitPop(); cursor.Emit(OpCodes.Ldc_I4_1); } @@ -1144,7 +1223,7 @@ namespace CalamityMod.ILEditing return; } - // branch is used for exit condition. So setting ble.s opcode to nop will remove the condition + // Branch is used for exit condition. So setting ble.s opcode to nop will remove the condition cursor.Prev.OpCode = OpCodes.Nop; // After that we pop NPC.damage and 0 from stack @@ -1153,14 +1232,17 @@ namespace CalamityMod.ILEditing } #endregion - #region Multiple NPC Happiness support for Cirrus - private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) + #region Multiple NPC Happiness support + // Currently unused as the one NPC who used it was removed. However it is very likely it'll be used again in the future, so this code is being kept. + /*private static void AllowMultipleLikedNPCs(On_ShopHelper.orig_ApplyNpcRelationshipEffect orig, ShopHelper self, int npcType, AffectionLevel affectionLevel) { FieldInfo npcTalkField = typeof(ShopHelper).GetField("_currentNPCBeingTalkedTo", BindingFlags.Instance | BindingFlags.NonPublic); NPC talkedNPC = (NPC)npcTalkField.GetValue(self); - // Allow Cirrus to have things to say about multiple NPCs with the same happiness level - if (talkedNPC.type == ModContent.NPCType()) + int npcTypee = 0; + + // Allow the given NPC to have things to say about multiple NPCs with the same happiness level + if (talkedNPC.type == npcTypee) { MethodInfo addReportField = typeof(ShopHelper).GetMethod("AddHappinessReportText", BindingFlags.Instance | BindingFlags.NonPublic); @@ -1182,10 +1264,10 @@ namespace CalamityMod.ILEditing { orig(self, npcType, affectionLevel); } - } + }*/ #endregion - #region Allow disabling gravity swap visual && allow gravity keybind + #region Allow Disabling Gravity Swap Visual and Allow Gravity Keybind private static void DelayGravity(On_Player.orig_UpdateControlHolds orig, Player Player) { var cplay = Player.Calamity(); diff --git a/ILEditing/WorldgenILChanges.cs b/ILEditing/WorldgenILChanges.cs index 419d4c19f9..002c434ca3 100644 --- a/ILEditing/WorldgenILChanges.cs +++ b/ILEditing/WorldgenILChanges.cs @@ -8,6 +8,7 @@ using MonoMod.Cil; using Terraria; using Terraria.GameContent.UI.States; using Terraria.ID; +using Terraria.IO; using Terraria.WorldBuilding; namespace CalamityMod.ILEditing @@ -33,28 +34,6 @@ namespace CalamityMod.ILEditing set; } - #region Replacement of Pharaoh Set in Pyramids - // Note: There is no need to replace the other Pharaoh piece, due to how the vanilla code works. - // The other Pharaoh vanity piece is added automatically if the mask is found in the chest. - private static void ReplacePharaohSetInPyramids(ILContext il) - { - var cursor = new ILCursor(il); - - // Find the instruction which loads in the item ID of the Pharaoh's Mask. - if (!cursor.TryGotoNext(MoveType.Before, i => i.MatchLdcI4(ItemID.PharaohsMask))) - { - LogFailure("Pharaoh Set Pyramid Replacement", "Could not locate the Pharaoh's Mask item ID."); - return; - } - - // Replace the Pharaoh's Mask with the Amber Hook. - // THIS INT CAST IS MANDATORY. DO NOT REMOVE IT. - // In TML's DLL, despite item IDs being shorts (16 bits), the hardcoded 848 here is a 32-bit integer literal. - // As such, it must be replaced with a 32-bit integer literal or the branches of the switch will misalign and the IL edit fails. - cursor.Next.Operand = (int)ItemID.AmberHook; - } - #endregion Replacement of Pharaoh Set in Pyramids - #region Fixing of Living Tree/Sulphurous Sea Interactions private static void BlockLivingTreesNearOcean(ILContext il) { @@ -66,7 +45,7 @@ namespace CalamityMod.ILEditing #endregion Fixing of Living Tree/Sulphurous Sea Interactions #region Removal of Hardmode Ore Generation from Evil Altars - private static void PreventSmashAltarCode(Terraria.On_WorldGen.orig_SmashAltar orig, int i, int j) + private static void PreventSmashAltarCode(On_WorldGen.orig_SmashAltar orig, int i, int j) { if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) return; @@ -135,10 +114,8 @@ namespace CalamityMod.ILEditing return; } - // Pop original value off. + // Pop original value off. Push '2' to the stack. c.Emit(OpCodes.Pop); - - // Push '2' to the stack. c.Emit(OpCodes.Ldc_I4_2); // OBJECTIVE 2 @@ -181,13 +158,11 @@ namespace CalamityMod.ILEditing // Emit our new string "Mods.CalamityMod.UI.SmallWorldWarning". c.Emit(OpCodes.Ldstr, "Mods.CalamityMod.UI.SmallWorldWarning"); - - } #endregion #region Clear temporary modded tiles - private static void ClearModdedTempTiles(Terraria.IO.On_WorldFile.orig_ClearTempTiles orig) + private static void ClearModdedTempTiles(On_WorldFile.orig_ClearTempTiles orig) { orig(); diff --git a/Items/Accessories/AbyssalDivingSuit.cs b/Items/Accessories/AbyssalDivingSuit.cs index 17b15c0aba..6f2c4936cf 100644 --- a/Items/Accessories/AbyssalDivingSuit.cs +++ b/Items/Accessories/AbyssalDivingSuit.cs @@ -1,30 +1,29 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class AbyssalDivingSuit : ModItem, ILocalizedModType + public class AbyssalDivingSuit : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public static double PlatesAllDamageReduction = 0.15D; public static double PlatesHitDecay = 0.03D; - public override void Load() - { - // All code below runs only if we're not loading on a server - if (!Main.dedServ) - { - // Add equip textures - EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Head}", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Body}", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, $"{Texture}_{EquipType.Legs}", EquipType.Legs, this); - } - } + public override string AssetPath => "CalamityMod/Items/Accessories/"; + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "AbyssalDivingSuit", null), + (EquipType.Body, "AbyssalDivingSuit", null), + (EquipType.Legs, "AbyssalDivingSuit", null), + (EquipType.Face, null, null), //results in setting this equip slot to -1 + ]; + + public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.NPCHit4, 10); public override void SetDefaults() { @@ -33,32 +32,9 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - - if (!Main.dedServ) - { - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.abyssalDivingSuit = true; - if (hideVisual) - modPlayer.abyssalDivingSuitHide = true; - } - - public override void UpdateVanity(Player player) - { - player.Calamity().abyssalDivingSuitHide = false; - player.Calamity().abyssalDivingSuitForce = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().abyssalDivingSuit = true; public override void AddRecipes() { diff --git a/Items/Accessories/AmalgamatedBrain.cs b/Items/Accessories/AmalgamatedBrain.cs index a823f93126..ac6c8b1a82 100644 --- a/Items/Accessories/AmalgamatedBrain.cs +++ b/Items/Accessories/AmalgamatedBrain.cs @@ -11,6 +11,9 @@ namespace CalamityMod.Items.Accessories public class AmalgamatedBrain : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(18); + public override void SetDefaults() { Item.width = 34; diff --git a/Items/Accessories/AmbrosialAmpoule.cs b/Items/Accessories/AmbrosialAmpoule.cs index a201961732..9036f66442 100644 --- a/Items/Accessories/AmbrosialAmpoule.cs +++ b/Items/Accessories/AmbrosialAmpoule.cs @@ -24,12 +24,13 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); player.statLifeMax2 += 50; + if (!player.HasBuff(BuffID.Honey)) + player.AddBuff(BuffID.Honey, 2); // bool left in for abyss light purposes and life regen effects modPlayer.aAmpoule = true; - // Inherits all effects of Honey Dew and Living Dew (except standing regen is not honey exclusive anymore) - modPlayer.alwaysHoneyRegen = true; + // Inherits all effects of Honey Dew and Living Dew modPlayer.honeyDewHalveDebuffs = true; modPlayer.livingDewHalveDebuffs = true; @@ -43,7 +44,7 @@ namespace CalamityMod.Items.Accessories var player = Main.LocalPlayer; if (player != null) { - list.FindAndReplace("[REGEN]", (player.Calamity().ambrosialAmpouleRegen + player.Calamity().alwaysHoneyRegenAmount).ToString("0.##")); + list.FindAndReplace("[REGEN]", player.Calamity().radiantOozeRegen.ToString("0.##")); } } diff --git a/Items/Accessories/AngelTreads.cs b/Items/Accessories/AngelTreads.cs index bf1b3b87a0..c75f44b7f4 100644 --- a/Items/Accessories/AngelTreads.cs +++ b/Items/Accessories/AngelTreads.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -10,6 +11,13 @@ namespace CalamityMod.Items.Accessories public class AngelTreads : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float RunningSpeed = 7.5f; // 6.75 from Lightning-Terraspark + public static float MoveSpeedBoost = 0.12f; + public static float FlightTimeBoost = 0.1f; + public static int LavaImmunityTime = 420; // Identical to Terraspark Boots and upgrades prior + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), FlightTimeBoost.ToPercent(), LavaImmunityTime.FramesToSeconds()); + public override void SetDefaults() { Item.width = 32; @@ -23,14 +31,14 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.angelTreads = true; - player.accRunSpeed = 7.5f; + player.accRunSpeed = RunningSpeed; player.rocketBoots = player.vanityRocketBoots = 3; - player.moveSpeed += 0.12f; + player.moveSpeed += MoveSpeedBoost; player.iceSkate = true; player.waterWalk = true; player.fireWalk = true; - player.lavaMax += 240; - player.buffImmune[BuffID.OnFire] = true; + player.lavaMax += LavaImmunityTime; + player.lavaRose = true; } public override void UpdateVanity(Player player) diff --git a/Items/Accessories/AquaticHeart.cs b/Items/Accessories/AquaticHeart.cs index 5c5f1de826..25c761394a 100644 --- a/Items/Accessories/AquaticHeart.cs +++ b/Items/Accessories/AquaticHeart.cs @@ -1,45 +1,30 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.Items.BaseItems; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [LegacyName("SirensHeart")] - public class AquaticHeart : ModItem, ILocalizedModType + public class AquaticHeart : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public static float WaterSpeedBoost = 0.15f; public static double IceShieldAllDamageReduction = 0.2D; - public override void Load() - { - // All code below runs only if we're not loading on a server - if (!Main.dedServ) - { - // Add equip textures - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/AquaticTrans_Legs", EquipType.Legs, this); - } - } + public override string AssetPath => "CalamityMod/Items/Accessories/"; + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "AquaticTrans", null), + (EquipType.Body, "AquaticTrans", null), + (EquipType.Legs, "AquaticTrans", null), + (EquipType.Face, null, null), //results in setting this equip slot to -1 + ]; - public override void SetStaticDefaults() - { - if (!Main.dedServ) - { - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } - } + public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.FemaleHit, 10); public override void SetDefaults() { @@ -50,19 +35,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.LightRed; } - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.aquaticHeart = true; - if (hideVisual) - modPlayer.aquaticHeartHide = true; - } - - public override void UpdateVanity(Player player) - { - player.Calamity().aquaticHeartHide = false; - player.Calamity().aquaticHeartForce = true; - } + public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().aquaticHeart = true; public override void ModifyTooltips(List tooltips) { diff --git a/Items/Accessories/AsgardianAegis.cs b/Items/Accessories/AsgardianAegis.cs index 6ada54ffe2..c8e65d2c08 100644 --- a/Items/Accessories/AsgardianAegis.cs +++ b/Items/Accessories/AsgardianAegis.cs @@ -13,7 +13,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -31,64 +31,17 @@ namespace CalamityMod.Items.Accessories Item.width = 60; Item.height = 54; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 12; + Item.defense = 6; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgardian Aegis ram dash modPlayer.DashID = AsgardianAegisDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Counterparts, similar debuffs to vanilla Ankh Shield debuffs, or upgrades thereof) - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Broken Armor - player.buffImmune[ModContent.BuffType()] = true; // Counterpart to Burning Blood - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Bleeding - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Venom] = true; // "Stronger" Poisoned - player.buffImmune[ModContent.BuffType()] = true; // "Stronger" Poisoned - player.buffImmune[BuffID.Webbed] = true; // "Stronger" Slow - player.buffImmune[BuffID.Blackout] = true; // "Stronger" Darkness - - // Additional debuff immunities (Everything from Ornate Shield + Asgard's Valor) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; - - // Additional debuff immunities (Everything from Elysian Aegis + thematic counterparts) - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - - // Immune to God Slayer Inferno itself - player.buffImmune[ModContent.BuffType()] = true; } public override void AddRecipes() diff --git a/Items/Accessories/AsgardsValor.cs b/Items/Accessories/AsgardsValor.cs index 5478959941..7ceab1566b 100644 --- a/Items/Accessories/AsgardsValor.cs +++ b/Items/Accessories/AsgardsValor.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class AsgardsValor : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class AsgardsValor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -26,49 +26,24 @@ namespace CalamityMod.Items.Accessories Item.height = 48; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 8; // we buff Ankh Shield to 8 + Item.defense = 4; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Asgard's Valor ram dash modPlayer.DashID = AsgardsValorDash.ID; player.dashType = 0; - - // Inherited Ankh Shield effects player.noKnockback = true; - player.fireWalk = true; - player.buffImmune[BuffID.Weak] = true; - player.buffImmune[BuffID.BrokenArmor] = true; - player.buffImmune[BuffID.Bleeding] = true; - player.buffImmune[BuffID.Poisoned] = true; - player.buffImmune[BuffID.Slow] = true; - player.buffImmune[BuffID.Confused] = true; - player.buffImmune[BuffID.Silenced] = true; - player.buffImmune[BuffID.Cursed] = true; - player.buffImmune[BuffID.Darkness] = true; - player.buffImmune[BuffID.WindPushed] = true; - player.buffImmune[BuffID.Stoned] = true; - - // Additional debuff immunities (Everything from Ornate Shield + fiery stuff) - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.AnkhShield). AddIngredient(). AddIngredient(). + AddIngredient(ItemID.HallowedBar, 5). AddTile(TileID.MythrilAnvil). Register(); } diff --git a/Items/Accessories/AuricSoulArtifact.cs b/Items/Accessories/AuricSoulArtifact.cs index 794f987a70..ae34ce45ab 100644 --- a/Items/Accessories/AuricSoulArtifact.cs +++ b/Items/Accessories/AuricSoulArtifact.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Accessories/Baroclaw.cs b/Items/Accessories/Baroclaw.cs index bbc971ac6a..579a0c61c4 100644 --- a/Items/Accessories/Baroclaw.cs +++ b/Items/Accessories/Baroclaw.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Items.Accessories public class Baroclaw : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int ThornsDamage => CalamityUtils.ScaleWithDifficulty(150); + public override void SetDefaults() { Item.width = 40; @@ -22,7 +25,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.baroclaw = true; - player.thorns += 2.5f; } public override void AddRecipes() { diff --git a/Items/Accessories/BlazingCore.cs b/Items/Accessories/BlazingCore.cs index c7e084615f..d77f390a86 100644 --- a/Items/Accessories/BlazingCore.cs +++ b/Items/Accessories/BlazingCore.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().blazingCore = true; + player.noKnockback = true; } public static void HandleStars(Player player) diff --git a/Items/Accessories/BloodflareCore.cs b/Items/Accessories/BloodflareCore.cs index 0cc9b6c92a..d045c257a9 100644 --- a/Items/Accessories/BloodflareCore.cs +++ b/Items/Accessories/BloodflareCore.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodflareCore = true; + player.noKnockback = true; } } } diff --git a/Items/Accessories/BloodstainedGlove.cs b/Items/Accessories/BloodstainedGlove.cs index 075af22adf..41d4f0b6a9 100644 --- a/Items/Accessories/BloodstainedGlove.cs +++ b/Items/Accessories/BloodstainedGlove.cs @@ -24,15 +24,5 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.bloodyGlove = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 2). - AddIngredient(6). - AddIngredient(ItemID.Vertebrae, 2). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Accessories/BloodyWormScarf.cs b/Items/Accessories/BloodyWormScarf.cs index 8399ef805a..23c4716747 100644 --- a/Items/Accessories/BloodyWormScarf.cs +++ b/Items/Accessories/BloodyWormScarf.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 42; - Item.defense = 7; + Item.defense = 3; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; diff --git a/Items/Accessories/BloodyWormTooth.cs b/Items/Accessories/BloodyWormTooth.cs index 4c6ef7f45c..aeb23ca680 100644 --- a/Items/Accessories/BloodyWormTooth.cs +++ b/Items/Accessories/BloodyWormTooth.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 12; Item.height = 15; - Item.defense = 7; + Item.defense = 3; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.accessory = true; @@ -30,7 +30,8 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddTile(TileID.TinkerersWorkbench). AddCondition(Condition.InGraveyard). - Register(); + Register() + .DisableDecraft(); } } } diff --git a/Items/Accessories/Calamity.cs b/Items/Accessories/Calamity.cs index 3499c1c552..e192f93b37 100644 --- a/Items/Accessories/Calamity.cs +++ b/Items/Accessories/Calamity.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 44; Item.height = 108; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.accessory = true; } diff --git a/Items/Accessories/ChaliceOfTheBloodGod.cs b/Items/Accessories/ChaliceOfTheBloodGod.cs index 9a72bf77c4..60bd140a45 100644 --- a/Items/Accessories/ChaliceOfTheBloodGod.cs +++ b/Items/Accessories/ChaliceOfTheBloodGod.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Accessories Item.width = Item.height = 32; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/CoinofDeceit.cs b/Items/Accessories/CoinofDeceit.cs index 694429bc96..1b9ac86cd6 100644 --- a/Items/Accessories/CoinofDeceit.cs +++ b/Items/Accessories/CoinofDeceit.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.Calamity().stealthStrike85Cost = true; + player.Calamity().stealthStrike90Cost = true; player.GetCritChance() += 6; } diff --git a/Items/Accessories/CorrosiveSpine.cs b/Items/Accessories/CorrosiveSpine.cs index f9bc1fde4a..21b17bf5f6 100644 --- a/Items/Accessories/CorrosiveSpine.cs +++ b/Items/Accessories/CorrosiveSpine.cs @@ -16,7 +16,6 @@ namespace CalamityMod.Items.Accessories Item.height = 46; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 4; Item.accessory = true; } @@ -25,6 +24,8 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.corrosiveSpine = true; player.moveSpeed += 0.05f; + modPlayer.WaterDebuffMultiplier += 0.25f; + modPlayer.SicknessDebuffMultiplier += 0.25f; } } } diff --git a/Items/Accessories/CounterScarf.cs b/Items/Accessories/CounterScarf.cs index 1f36cadfd2..e244c74806 100644 --- a/Items/Accessories/CounterScarf.cs +++ b/Items/Accessories/CounterScarf.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 38; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 20); // Sold by Clothier Item.rare = ItemRarityID.Orange; Item.accessory = true; } diff --git a/Items/Accessories/CrawCarapace.cs b/Items/Accessories/CrawCarapace.cs index fcb357da8a..63f99afc7e 100644 --- a/Items/Accessories/CrawCarapace.cs +++ b/Items/Accessories/CrawCarapace.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Accessories public class CrawCarapace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int ThornsDamage => CalamityUtils.ScaleWithDifficulty(20); + public override void SetDefaults() { Item.width = 28; @@ -21,7 +24,6 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.crawCarapace = true; - player.thorns += 0.25f; } } } diff --git a/Items/Accessories/CrownJewel.cs b/Items/Accessories/CrownJewel.cs index 1c85ffd2fe..9c4b4cfca5 100644 --- a/Items/Accessories/CrownJewel.cs +++ b/Items/Accessories/CrownJewel.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.defense = 4; + Item.defense = 1; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/CryoStone.cs b/Items/Accessories/CryoStone.cs index bf6e2deb08..687768b0c5 100644 --- a/Items/Accessories/CryoStone.cs +++ b/Items/Accessories/CryoStone.cs @@ -23,7 +23,11 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } - public override void UpdateAccessory(Player player, bool hideVisual) => player.Calamity().CryoStone = true; + public override void UpdateAccessory(Player player, bool hideVisual) + { + player.Calamity().CryoStone = true; + player.Calamity().ColdDebuffMultiplier += 0.5f; + } public override void UpdateVanity(Player player) => player.Calamity().CryoStoneVanity = true; } diff --git a/Items/Accessories/DarkSunRing.cs b/Items/Accessories/DarkSunRing.cs index 030506fa76..e86eea2a52 100644 --- a/Items/Accessories/DarkSunRing.cs +++ b/Items/Accessories/DarkSunRing.cs @@ -29,16 +29,17 @@ namespace CalamityMod.Items.Accessories Item.width = 42; Item.height = 60; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 10; + Item.defense = 4; Item.lifeRegen = 1; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.darkSunRing = true; + player.noKnockback = true; } public override void AddRecipes() diff --git a/Items/Accessories/DeadshotBrooch.cs b/Items/Accessories/DeadshotBrooch.cs index d017624cdf..16e3459913 100644 --- a/Items/Accessories/DeadshotBrooch.cs +++ b/Items/Accessories/DeadshotBrooch.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().deadshotBrooch = true; - player.Calamity().rangedAmmoCost *= 0.8f; + player.Calamity().ammoCost *= 0.8f; player.GetDamage() += 0.12f; player.GetCritChance() += 7; } diff --git a/Items/Accessories/DeificAmulet.cs b/Items/Accessories/DeificAmulet.cs index b79a6ea9c4..8ac8d4bb91 100644 --- a/Items/Accessories/DeificAmulet.cs +++ b/Items/Accessories/DeificAmulet.cs @@ -1,9 +1,14 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -12,6 +17,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static readonly int MaxBonusIFrames = 30; + public static int StarDamage => CalamityUtils.ScaleWithDifficulty(130); public override void SetDefaults() { @@ -22,20 +28,61 @@ namespace CalamityMod.Items.Accessories Item.accessory = true; } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.longInvince = true; modPlayer.dAmulet = true; + player.panic = panicNecklaceEnabled; } public override void AddRecipes() { CreateRecipe(). AddIngredient(ItemID.StarVeil). + AddIngredient(ItemID.SweetheartNecklace). AddIngredient(10). - AddIngredient(15). - AddTile(TileID.LunarCraftingStation). + AddTile(TileID.TinkerersWorkbench). Register(); } } diff --git a/Items/Accessories/DeificAmulet.png b/Items/Accessories/DeificAmulet.png index 5556bbee2d..8dc07eb339 100644 Binary files a/Items/Accessories/DeificAmulet.png and b/Items/Accessories/DeificAmulet.png differ diff --git a/Items/Accessories/DiamondOfTheDeep.cs b/Items/Accessories/DiamondOfTheDeep.cs index e9a835f0cc..189c8484ed 100644 --- a/Items/Accessories/DiamondOfTheDeep.cs +++ b/Items/Accessories/DiamondOfTheDeep.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.dOfTheDeep = true; modPlayer.dOfTheDeepVisual = !hideVisual; + modPlayer.WaterDebuffMultiplier += 0.75f; } public override void AddRecipes() diff --git a/Items/Accessories/DimensionalSoulArtifact.cs b/Items/Accessories/DimensionalSoulArtifact.cs index 434063f4be..426a874351 100644 --- a/Items/Accessories/DimensionalSoulArtifact.cs +++ b/Items/Accessories/DimensionalSoulArtifact.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 28; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } diff --git a/Items/Accessories/DraedonsHeart.cs b/Items/Accessories/DraedonsHeart.cs index abbe1e35a3..0177e7f04c 100644 --- a/Items/Accessories/DraedonsHeart.cs +++ b/Items/Accessories/DraedonsHeart.cs @@ -42,9 +42,9 @@ namespace CalamityMod.Items.Accessories Item.width = 52; Item.height = 68; Item.accessory = true; - Item.defense = 48; + Item.defense = 20; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -57,6 +57,7 @@ namespace CalamityMod.Items.Accessories modPlayer.adrenaline = 0f; modPlayer.draedonsHeart = true; + player.noKnockback = true; modPlayer.hadNanomachinesLastFrame = true; modPlayer.AdrenalineDuration = NanomachinesDuration; modPlayer.contactDamageReduction += ContactDamageReduction; diff --git a/Items/Accessories/DragonScales.cs b/Items/Accessories/DragonScales.cs index 766939ee78..fe3747079d 100644 --- a/Items/Accessories/DragonScales.cs +++ b/Items/Accessories/DragonScales.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 32; Item.height = 34; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(platinum: 15); // Sold by Bandit + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/EclipseMirror.cs b/Items/Accessories/EclipseMirror.cs index 056d43cdfc..ac0edf72ef 100644 --- a/Items/Accessories/EclipseMirror.cs +++ b/Items/Accessories/EclipseMirror.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.width = 30; Item.height = 46; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/ElementalGauntlet.cs b/Items/Accessories/ElementalGauntlet.cs index d28518d7fb..325a79a392 100644 --- a/Items/Accessories/ElementalGauntlet.cs +++ b/Items/Accessories/ElementalGauntlet.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.height = 38; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/WifeinaBottle.cs b/Items/Accessories/ElementalinaBottle.cs similarity index 86% rename from Items/Accessories/WifeinaBottle.cs rename to Items/Accessories/ElementalinaBottle.cs index 9a6e0d1919..464ab125f1 100644 --- a/Items/Accessories/WifeinaBottle.cs +++ b/Items/Accessories/ElementalinaBottle.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class WifeinaBottle : ModItem, ILocalizedModType + [LegacyName("WifeinaBottle")] + public class ElementalinaBottle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public const int ElementalDamage = 45; @@ -28,14 +29,14 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandWaifu = true; + modPlayer.sandElemental = true; SpawnElemental(player); } public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandWaifuVanity = true; + modPlayer.sandElementalVanity = true; SpawnElemental(player); } @@ -43,9 +44,9 @@ namespace CalamityMod.Items.Accessories { if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/WifeinaBottle.png b/Items/Accessories/ElementalinaBottle.png similarity index 100% rename from Items/Accessories/WifeinaBottle.png rename to Items/Accessories/ElementalinaBottle.png diff --git a/Items/Accessories/ElysianAegis.cs b/Items/Accessories/ElysianAegis.cs index 05e3ce7943..babe4c2a83 100644 --- a/Items/Accessories/ElysianAegis.cs +++ b/Items/Accessories/ElysianAegis.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { [AutoloadEquip(EquipType.Shield)] - public class ElysianAegis : ModItem, ILocalizedModType, IHoldShiftTooltipItem + public class ElysianAegis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public bool HasFlavorTooltip => true; @@ -29,30 +29,16 @@ namespace CalamityMod.Items.Accessories Item.height = 42; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); - Item.defense = 10; + Item.defense = 5; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - - // Elysian Aegis ram dash modPlayer.DashID = ElysianAegisDash.ID; player.dashType = 0; - - // Vaguely inherited Ankh Shield effects I guess player.noKnockback = true; - player.fireWalk = true; - - // Debuff immunities - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.OnFire3] = true; - player.buffImmune[BuffID.CursedInferno] = true; - player.buffImmune[BuffID.ShadowFlame] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/Accessories/EtherealExtorter.cs b/Items/Accessories/EtherealExtorter.cs index c963385ea8..98ee31e460 100644 --- a/Items/Accessories/EtherealExtorter.cs +++ b/Items/Accessories/EtherealExtorter.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories Item.width = 28; Item.height = 32; Item.accessory = true; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.value = Item.buyPrice(platinum: 1); // Sold by Bandit Item.rare = ItemRarityID.Yellow; } diff --git a/Items/Accessories/EtherealTalisman.cs b/Items/Accessories/EtherealTalisman.cs index 84cb1fa4bb..5199378c81 100644 --- a/Items/Accessories/EtherealTalisman.cs +++ b/Items/Accessories/EtherealTalisman.cs @@ -1,10 +1,15 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -17,21 +22,60 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); + } + #region Toggleable Mana Flower + + bool manaFlowerEnabled = true; + public override void ModifyTooltips(List tooltips) + { + if (!manaFlowerEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip3"); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + manaFlowerEnabled = !manaFlowerEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("manaFlower", manaFlowerEnabled); } + public override void LoadData(TagCompound tag) + { + manaFlowerEnabled = tag.GetBool("manaFlower"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(manaFlowerEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + manaFlowerEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, manaFlowerEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.eTalisman = true; player.manaMagnet = true; - if (!hideVisual) + if (manaFlowerEnabled) player.manaFlower = true; player.statManaMax2 += 150; player.GetDamage() += 0.15f; - player.manaCost *= 0.9f; + player.manaCost -= 0.1f; player.GetCritChance() += 5; } diff --git a/Items/Accessories/EyeoftheStorm.cs b/Items/Accessories/EyeoftheStorm.cs index d787a45479..f1d7335f2f 100644 --- a/Items/Accessories/EyeoftheStorm.cs +++ b/Items/Accessories/EyeoftheStorm.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cloudWaifu = true; + modPlayer.cloudElemental = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -55,12 +55,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.cloudWaifuVanity = true; + modPlayer.cloudElementalVanity = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/FilthyGlove.cs b/Items/Accessories/FilthyGlove.cs index 905d4c0ccb..35f2edb458 100644 --- a/Items/Accessories/FilthyGlove.cs +++ b/Items/Accessories/FilthyGlove.cs @@ -24,15 +24,5 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.filthyGlove = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 2). - AddIngredient(6). - AddIngredient(ItemID.RottenChunk, 2). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Accessories/FlameLickedShell.cs b/Items/Accessories/FlameLickedShell.cs index 4637cba6cc..4cf105a720 100644 --- a/Items/Accessories/FlameLickedShell.cs +++ b/Items/Accessories/FlameLickedShell.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.flameLickedShell = true; + player.noKnockback = true; } public static void handleParry(Player player) diff --git a/Items/Accessories/GiantShell.cs b/Items/Accessories/GiantShell.cs index 52297d4d96..fe575c6fd1 100644 --- a/Items/Accessories/GiantShell.cs +++ b/Items/Accessories/GiantShell.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 30; Item.height = 28; - Item.defense = 6; + Item.defense = 5; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.accessory = true; diff --git a/Items/Accessories/GiantTortoiseShell.cs b/Items/Accessories/GiantTortoiseShell.cs index 579d15d32f..9551ffbb81 100644 --- a/Items/Accessories/GiantTortoiseShell.cs +++ b/Items/Accessories/GiantTortoiseShell.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 46; Item.height = 30; - Item.defense = 15; + Item.defense = 10; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; Item.accessory = true; diff --git a/Items/Accessories/GloveofPrecision.cs b/Items/Accessories/GloveofPrecision.cs index 9cb6f21173..81a152d40d 100644 --- a/Items/Accessories/GloveofPrecision.cs +++ b/Items/Accessories/GloveofPrecision.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.gloveOfPrecision = true; player.GetDamage() += 0.10f; - player.GetCritChance() += 15; + player.GetCritChance() += 10; modPlayer.rogueVelocity += 0.15f; player.GetAttackSpeed() -= 0.15f; } diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 1bf8309fd9..a3c5b0b973 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Accessories public static float MoveSpeedBoost = 0.12f; public static float JumpSpeedBoost = 0.6f; // Both 12% so we only need just one in the tooltip public static int AuraLifetime = 1800; - public static int AuraRegenBoost = 6; + public static int AuraRegenBoost = 4; public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), AuraLifetime.FramesToSeconds(), AuraRegenBoost.ToRegenPerSecond()); public override void SetDefaults() diff --git a/Items/Accessories/HallowedRune.cs b/Items/Accessories/HallowedRune.cs index 360aa5df98..814c76a378 100644 --- a/Items/Accessories/HallowedRune.cs +++ b/Items/Accessories/HallowedRune.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 3; - public static int DefenseBoost = 8; + public static int DefenseBoost = 4; public static float DamageReductionBoost = 0.04f; public static float SummonDamageBoost = 0.1f; diff --git a/Items/Accessories/HeartoftheElements.cs b/Items/Accessories/HeartoftheElements.cs index 223d3dc0c0..c52939475a 100644 --- a/Items/Accessories/HeartoftheElements.cs +++ b/Items/Accessories/HeartoftheElements.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories public override bool CanEquipAccessory(Player player, int slot, bool modded) { CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.brimstoneWaifu || modPlayer.sandWaifu || modPlayer.sandBoobWaifu || modPlayer.cloudWaifu || modPlayer.sirenWaifu) + if (modPlayer.brimElemental || modPlayer.sandElemental || modPlayer.rareSandElemental || modPlayer.cloudElemental || modPlayer.waterElemental) { return false; } @@ -49,7 +49,7 @@ namespace CalamityMod.Items.Accessories Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, Main.DiscoR / 255f, Main.DiscoG / 255f, Main.DiscoB / 255f); CalamityPlayer modPlayer = player.Calamity(); - modPlayer.allWaifus = true; + modPlayer.allElementals = true; modPlayer.elementalHeart = true; int brimmy = ProjectileType(); @@ -113,7 +113,7 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.allWaifusVanity = true; + modPlayer.allElementalsVanity = true; // modPlayer.elementalHeart = true; int brimmy = ProjectileType(); @@ -178,8 +178,8 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(). + AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Accessories/HideofAstrumDeus.cs b/Items/Accessories/HideofAstrumDeus.cs index 45526da47c..cb4e4dba87 100644 --- a/Items/Accessories/HideofAstrumDeus.cs +++ b/Items/Accessories/HideofAstrumDeus.cs @@ -9,6 +9,10 @@ namespace CalamityMod.Items.Accessories public class HideofAstrumDeus : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int BlazeDamage => CalamityUtils.ScaleWithDifficulty(50); + public static int StarDamage => 75; + public override void SetDefaults() { Item.width = 26; @@ -24,7 +28,6 @@ namespace CalamityMod.Items.Accessories modPlayer.hideOfDeus = true; if (modPlayer.hideOfDeusMeleeBoostTimer > 0) player.GetDamage() += 0.3f; - player.thorns += 0.75f; } } } diff --git a/Items/Accessories/HoneyDew.cs b/Items/Accessories/HoneyDew.cs index 5411c27755..88e6b334ed 100644 --- a/Items/Accessories/HoneyDew.cs +++ b/Items/Accessories/HoneyDew.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 20; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - player.statLifeMax2 += 30; + player.statLifeMax2 += 10; + if (!player.HasBuff(BuffID.Honey)) + player.AddBuff(BuffID.Honey, 2); CalamityPlayer modPlayer = player.Calamity(); - modPlayer.alwaysHoneyRegen = true; - modPlayer.honeyTurboRegen = true; modPlayer.honeyDewHalveDebuffs = true; } diff --git a/Items/Accessories/HowlsHeart.cs b/Items/Accessories/HowlsHeart.cs index 8fdf7cac32..3ce9519e09 100644 --- a/Items/Accessories/HowlsHeart.cs +++ b/Items/Accessories/HowlsHeart.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories Item.height = 26; Item.accessory = true; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.value = Item.buyPrice(gold: 20); // Sold by Wizard Item.rare = ItemRarityID.LightRed; Item.Calamity().donorItem = true; } diff --git a/Items/Accessories/InfectedJewel.cs b/Items/Accessories/InfectedJewel.cs index c5c18c08f6..7746446c7f 100644 --- a/Items/Accessories/InfectedJewel.cs +++ b/Items/Accessories/InfectedJewel.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 26; Item.height = 26; - Item.defense = 6; + Item.defense = 4; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.accessory = true; diff --git a/Items/Accessories/InkBomb.cs b/Items/Accessories/InkBomb.cs index 6ed93531bb..5f7a6cad05 100644 --- a/Items/Accessories/InkBomb.cs +++ b/Items/Accessories/InkBomb.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Accessories public class InkBomb : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int InkDamage => CalamityUtils.ScaleWithDifficulty(16); + public override void SetDefaults() { Item.width = 22; @@ -21,6 +24,8 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.inkBomb = true; + modPlayer.stealthGenStandstill += 0.07f; + modPlayer.stealthGenMoving += 0.07f; } } } diff --git a/Items/Accessories/LivingDew.cs b/Items/Accessories/LivingDew.cs index bc76e4a498..ca84090d44 100644 --- a/Items/Accessories/LivingDew.cs +++ b/Items/Accessories/LivingDew.cs @@ -20,12 +20,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statLifeMax2 += 50; + player.statLifeMax2 += 25; + if (!player.HasBuff(BuffID.Honey)) + player.AddBuff(BuffID.Honey, 2); // Inherits all effects of Honey Dew CalamityPlayer modPlayer = player.Calamity(); - modPlayer.alwaysHoneyRegen = true; - modPlayer.honeyTurboRegen = true; modPlayer.honeyDewHalveDebuffs = true; modPlayer.livingDewHalveDebuffs = true; } diff --git a/Items/Accessories/MarniteRepulsionShield.cs b/Items/Accessories/MarniteRepulsionShield.cs index ca173561dc..1be7ad87e1 100644 --- a/Items/Accessories/MarniteRepulsionShield.cs +++ b/Items/Accessories/MarniteRepulsionShield.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Blue; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.accessory = true; - Item.defense = 4; + Item.defense = 3; } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index f37b4fbf5f..8d9774a8a0 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Items.Accessories { public class Nanotech : ModItem, ILocalizedModType { + //The stealth damage boost is handled in CalamityPlayer for some reason, maybe someone didn't want em to stack? public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() { @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.height = 46; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/NebulousCore.cs b/Items/Accessories/NebulousCore.cs index fe23201469..103e179a93 100644 --- a/Items/Accessories/NebulousCore.cs +++ b/Items/Accessories/NebulousCore.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Accessories Item.height = 14; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Accessories/Nucleogenesis.cs b/Items/Accessories/Nucleogenesis.cs index 229c3e33fe..1f3dfd4288 100644 --- a/Items/Accessories/Nucleogenesis.cs +++ b/Items/Accessories/Nucleogenesis.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories Item.height = 52; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/OccultSkullCrown.cs b/Items/Accessories/OccultSkullCrown.cs index 60b9a16ca6..d5d4f8a7f0 100644 --- a/Items/Accessories/OccultSkullCrown.cs +++ b/Items/Accessories/OccultSkullCrown.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Accessories Item.width = 82; Item.height = 62; Item.defense = 5; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; Item.SetRevExclusive(); diff --git a/Items/Accessories/OldDie.cs b/Items/Accessories/OldDie.cs index 96197e4a51..d2c8cc43f7 100644 --- a/Items/Accessories/OldDie.cs +++ b/Items/Accessories/OldDie.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Accessories Item.width = 24; Item.height = 26; Item.rare = ItemRarityID.Orange; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 20); // Sold by Bandit Item.accessory = true; } diff --git a/Items/Accessories/OldDukeScales.cs b/Items/Accessories/OldDukeScales.cs index 9e38022feb..0a7355d763 100644 --- a/Items/Accessories/OldDukeScales.cs +++ b/Items/Accessories/OldDukeScales.cs @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Accessories { OldDukeScalesPlayer modPlayer = player.GetModPlayer(); modPlayer.OldDukeScalesOn = true; + player.noKnockback = true; } } diff --git a/Items/Accessories/OrnateShield.cs b/Items/Accessories/OrnateShield.cs index 2b12a2aa69..30e331049d 100644 --- a/Items/Accessories/OrnateShield.cs +++ b/Items/Accessories/OrnateShield.cs @@ -20,21 +20,14 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 4; // This has a ram dash, it should give a bit less defense due to how good it is + Item.defense = 2; Item.accessory = true; } public override void UpdateAccessory(Player player, bool hideVisual) { - // Ornate Shield ram dash player.Calamity().DashID = OrnateShieldDash.ID; player.dashType = 0; - - // Cold debuff immunities (Do not fear, this accessory is post Cryogen!) - player.buffImmune[BuffID.Chilled] = true; - player.buffImmune[BuffID.Frozen] = true; - player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[BuffID.Frostburn2] = true; } public override void AddRecipes() diff --git a/Items/Accessories/PearlofEnthrallment.cs b/Items/Accessories/PearlofEnthrallment.cs index 53a38c6c5a..3743ab277b 100644 --- a/Items/Accessories/PearlofEnthrallment.cs +++ b/Items/Accessories/PearlofEnthrallment.cs @@ -37,13 +37,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sirenWaifu = true; + modPlayer.waterElemental = true; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -59,13 +59,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sirenWaifuVanity = true; + modPlayer.waterElementalVanity = true; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/PlanebreakersPouch.cs b/Items/Accessories/PlanebreakersPouch.cs index 20902eceda..045939782c 100644 --- a/Items/Accessories/PlanebreakersPouch.cs +++ b/Items/Accessories/PlanebreakersPouch.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories player.magicQuiver = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.deadshotBrooch = true; - modPlayer.rangedAmmoCost *= 0.8f; + modPlayer.ammoCost *= 0.8f; } public override void ModifyTooltips(List tooltips) => tooltips.IntegrateHotkey(CalamityKeybinds.AmmoCycleHotkey); diff --git a/Items/Accessories/ProfanedSoulCrystal.cs b/Items/Accessories/ProfanedSoulCrystal.cs index 546e685553..e1c0f21cfd 100644 --- a/Items/Accessories/ProfanedSoulCrystal.cs +++ b/Items/Accessories/ProfanedSoulCrystal.cs @@ -5,7 +5,11 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; using CalamityMod.DataStructures; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.Particles; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -14,16 +18,17 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { //Developer item, dedicatee: Mishiro Usui/Amber Sienna - public class ProfanedSoulCrystal : ModItem, ILocalizedModType, IDyeableShaderRenderer + public class ProfanedSoulCrystal : TransformationAccessory, ILocalizedModType, IDyeableShaderRenderer { public static string[] contributorNames = new[] { "IbanPlay", "Chen", "Nincity", "Amber", "Mishiro", "LordMetarex", "Memes" }; - public static int ShieldDurabilityMax = 125; + public static int ShieldDurabilityMax = 100; public new string LocalizationCategory => "Items.Accessories"; public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(5); @@ -31,6 +36,26 @@ namespace CalamityMod.Items.Accessories public const int maxMinionRequirement = 10; public const int maxPscAnimTime = 120; + public static SummonTag SummonTag = new() { MultiplicativeTagDamage = 0.2f, TagModifyHitEffects = ApplyTagModifyHit, AutoDrawTooltip = false }; + + public static void ApplyTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + if (Main.player[proj.owner].Calamity().pscState >= (int)ProfanedSoulCrystalState.Buffs) + { + var empowered = Main.player[proj.owner].Calamity().pscState == (int)ProfanedSoulCrystalState.Empowered; + //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier + //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes + modifiers.ScalingBonusDamage += (empowered ? 0.4f : SummonTag.MultiplicativeTagDamage) * tagDamageMult; + if (!Main.dedServ) + { + var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); + float power = Math.Min(npc.height / 100f, 3f); + var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); + var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); + GeneralParticleHandler.SpawnParticle(particle); + } + } + } // Interface stuff. public int OwnerPlayer { get; set; } @@ -81,7 +106,7 @@ namespace CalamityMod.Items.Accessories if (ignoreNoBuffs && (!DownedBossSystem.downedCalamitas || !DownedBossSystem.downedExoMechs || (player.maxMinions - player.slotsMinions) < maxMinionRequirement) || - player.Calamity().profanedCrystalForce || !player.HasBuff()) + player.Transformation().Type == ModContent.ItemType() || !player.HasBuff()) { return ProfanedSoulCrystalState.Vanity; //failsafe for vanity } @@ -155,28 +180,22 @@ namespace CalamityMod.Items.Accessories * Projectiles transformed are ONLY affected by alldamage and summon damage bonuses, likewise the weapon's base damage/usetime is NOT taken into account. * The on-hit effect for the whip is in globalnpc */ - public override void Load() + public override string AssetPath => "CalamityMod/Items/Accessories/"; + + public override (EquipType Type, string AssetName, string EquipName)[] EquipSlots => + [ + (EquipType.Head, "ProfanedSoulTrans", null), + (EquipType.Body, "ProfanedSoulTrans", null), + (EquipType.Legs, "ProfanedSoulTrans", null), + (EquipType.Wings, "ProfanedSoulTrans", null), + (EquipType.Head, "ProfanedSoulTransNight", "PscNightHead"), + (EquipType.Legs, "ProfanedSoulTransNight", "PscNightLegs"), + (EquipType.Wings, "ProfanedSoulTransNight", "PscNightWings"), + (EquipType.Face, null, null), //results in setting this equip slot to -1 + ]; + + public override void ArmorIDSets() { - if (Main.dedServ) - return; - - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHead", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransHeadNight", EquipType.Head, this, "PscNightHead"); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransBody", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransLegs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/ProfanedSoulTransLegsNight", EquipType.Legs, this, "PscNightLegs"); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Wings/ProfanedSoulTransWings", EquipType.Wings, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Wings/ProfanedSoulTransWingsNight", EquipType.Wings, this, "PscNightWings"); - } - - public override void SetStaticDefaults() - { - Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); - ItemID.Sets.AnimatesAsSoul[Type] = true; - - if (Main.dedServ) - return; - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; @@ -190,8 +209,20 @@ namespace CalamityMod.Items.Accessories ArmorIDs.Legs.Sets.OverridesLegs[equipSlotNightLegs] = true; } + public override (SoundStyle sound, int delay)? HurtSound(Player p) => (p.Calamity().pSoulShieldDurability > 0 ? ProfanedGuardianDefender.ShieldDeathSound : Providence.HurtSound, 20); + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(8, 4)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + + base.SetStaticDefaults(); + } + public override void SetDefaults() { + SummonTag.TagItem = Item.type; + SummonTag.TagTexture = TextureAssets.Item[Type]; Item.width = 50; Item.height = 50; Item.accessory = true; @@ -200,10 +231,7 @@ namespace CalamityMod.Items.Accessories Item.Calamity().devItem = true; } - public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) - { - return incomingItem.type != ModContent.ItemType(); - } + public override bool CanAccessoryBeEquippedWith(Item equippedItem, Item incomingItem, Player player) => incomingItem.type != ModContent.ItemType(); public override void ModifyTooltips(List tooltips) { @@ -235,12 +263,30 @@ namespace CalamityMod.Items.Accessories } } + public override bool CustomSetEquipType(Player player, EquipType type, Mod mod, string name) + { + switch (type) + { + case EquipType.Legs: + player.legs = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightLegs", type); + return true; + case EquipType.Head: + player.head = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightHead", type); + return true; + case EquipType.Wings: + player.wings = EquipLoader.GetEquipSlot(Mod, Main.dayTime ? "ProfanedSoulCrystal" : "PscNightWings", type); + return true; + } + return false; + } + public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.pSoulArtifact = true; modPlayer.profanedCrystal = true; + if (!modPlayer.profanedCrystalPrevious && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) { modPlayer.pSoulShieldDurability = 1; @@ -250,23 +296,15 @@ namespace CalamityMod.Items.Accessories if (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs) player.Calamity().profanedSoulRelicBuff = true; - modPlayer.profanedCrystalHide = hideVisual || modPlayer.profanedCrystalAnim > 0; modPlayer.pSoulShieldVisible = !hideVisual; DetermineTransformationEligibility(player); } - public override void UpdateVanity(Player player) - { - player.Calamity().profanedCrystalHide = false; - player.Calamity().profanedCrystalForce = true; - } - internal static void DetermineTransformationEligibility(Player player) { //short circuit immediately if profanedcrystalbuffs has already been set - - if (!player.Calamity().profanedCrystalBuffs && player.Calamity().profanedCrystalAnim == -1 && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= maxMinionRequirement && !player.Calamity().profanedCrystalForce && player.HasBuff()) + if (!player.Calamity().profanedCrystalBuffs && player.Calamity().profanedCrystalAnim == -1 && DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs && (player.maxMinions - player.slotsMinions) >= maxMinionRequirement && player.HasBuff()) { player.Calamity().profanedCrystalBuffs = true; player.Calamity().pscState = (int)GetPscStateFor(player); //update psc state, default is 0 which is the same as the int value of vanity @@ -510,6 +548,86 @@ namespace CalamityMod.Items.Accessories return false; } + public override void TransformFrameEffects(Player player) + { + bool enrage = player.Calamity().pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Enraged; + + if (profanedCrystalWingCounter.Value == 0) + { + int key = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(key == 3 ? 0 : key + 1, enrage ? 5 : 8); + } + + player.wingFrame = profanedCrystalWingCounter.Key; + profanedCrystalWingCounter = new KeyValuePair(profanedCrystalWingCounter.Key, profanedCrystalWingCounter.Value - 1); + player.armorEffectDrawOutlines = true; + if (player.Calamity().profanedCrystalBuffs) + { + player.armorEffectDrawShadow = true; + if (enrage) + { + player.armorEffectDrawOutlinesForbidden = true; + } + } + } + + public KeyValuePair profanedCrystalWingCounter = new KeyValuePair(1, 10); + public KeyValuePair profanedCrystalAnimCounter = new KeyValuePair(0, 10); + + private bool IsValidTransitionFrame(AnimationType currentAnim, AnimationType newAnim, int frame, int counter) //this exists so it doesn't loop through the entire walk/idle anim just to find one frame for switching. + { + bool result = newAnim != AnimationType.Jump && currentAnim != AnimationType.Jump; + if (currentAnim == AnimationType.Walk && newAnim == AnimationType.Idle) + { + result = counter <= 0 && (frame == 11 || frame == 15 || frame == 19); + } + else if (currentAnim == AnimationType.Idle && newAnim == AnimationType.Walk) + { + result = counter <= 0 && (frame == 2 || frame == 6); + } + return currentAnim != newAnim && result; //swapping to jumps should be instant, no need to check the counter here + } + + private int HandlePSCAnimationFrames(Player player, AnimationType newType) + { + int key = profanedCrystalAnimCounter.Key; //0-based indexing + int value = profanedCrystalAnimCounter.Value - 1; + AnimationType currentType = key < 8 ? AnimationType.Idle : key == 8 ? AnimationType.Jump : AnimationType.Walk; + + bool isInvalidTransFrame = !IsValidTransitionFrame(currentType, newType, key, value); //to make the transition between walk and idle frames less jarring and smoother + AnimationType type = isInvalidTransFrame ? newType : currentType; + int frameCount = type == AnimationType.Walk || (player.Calamity().profanedCrystal && player.statLife <= (int)(player.statLifeMax2 * 0.5)) ? 7 : 10; + int lowerRange = type == AnimationType.Idle ? 0 : type == AnimationType.Jump ? 8 : 9; + int upperRange = type == AnimationType.Idle ? 7 : type == AnimationType.Jump ? 8 : 22; + if (value <= 0 || !isInvalidTransFrame) + { + value = frameCount; + if (key >= lowerRange && key < upperRange) + key++; + else + key = lowerRange; + } + profanedCrystalAnimCounter = new KeyValuePair(key, value); + return profanedCrystalAnimCounter.Key; + } + + public override void TransformPostUpdate(Player player) + { + bool validEquipSlot = player.legs == EquipLoader.GetEquipSlot(Mod, "ProfanedSoulCrystal", EquipType.Legs) || + player.legs == EquipLoader.GetEquipSlot(Mod, "PscNightLegs", EquipType.Legs); + if (player.Transformation().Type == ModContent.ItemType() && validEquipSlot) + { + bool usingCarpet = player.carpetTime > 0 && player.controlJump; //doesn't make sense for carpet to use jump frame since you have solid ground + AnimationType animType = AnimationType.Walk; + if ((player.sliding || player.velocity.Y != 0 || player.mount.Active || (player.grappling[0] != -1 || !player.CheckSolidGround()) || player.GoingDownWithGrapple) && !usingCarpet) + animType = AnimationType.Jump; + else if (player.velocity.X == 0 || usingCarpet) + animType = AnimationType.Idle; + int frame = HandlePSCAnimationFrames(player, animType); + player.legFrame.Y = player.legFrame.Height * frame; + } + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/ProfanedSoulTransHeadNight.png b/Items/Accessories/ProfanedSoulTransNight_Head.png similarity index 100% rename from Items/Accessories/ProfanedSoulTransHeadNight.png rename to Items/Accessories/ProfanedSoulTransNight_Head.png diff --git a/Items/Accessories/ProfanedSoulTransLegsNight.png b/Items/Accessories/ProfanedSoulTransNight_Legs.png similarity index 100% rename from Items/Accessories/ProfanedSoulTransLegsNight.png rename to Items/Accessories/ProfanedSoulTransNight_Legs.png diff --git a/Items/Accessories/Wings/ProfanedSoulTransWingsNight.png b/Items/Accessories/ProfanedSoulTransNight_Wings.png similarity index 100% rename from Items/Accessories/Wings/ProfanedSoulTransWingsNight.png rename to Items/Accessories/ProfanedSoulTransNight_Wings.png diff --git a/Items/Accessories/ProfanedSoulTransBody.png b/Items/Accessories/ProfanedSoulTrans_Body.png similarity index 100% rename from Items/Accessories/ProfanedSoulTransBody.png rename to Items/Accessories/ProfanedSoulTrans_Body.png diff --git a/Items/Accessories/ProfanedSoulTransHead.png b/Items/Accessories/ProfanedSoulTrans_Head.png similarity index 100% rename from Items/Accessories/ProfanedSoulTransHead.png rename to Items/Accessories/ProfanedSoulTrans_Head.png diff --git a/Items/Accessories/ProfanedSoulTransLegs.png b/Items/Accessories/ProfanedSoulTrans_Legs.png similarity index 100% rename from Items/Accessories/ProfanedSoulTransLegs.png rename to Items/Accessories/ProfanedSoulTrans_Legs.png diff --git a/Items/Accessories/Wings/ProfanedSoulTransWings.png b/Items/Accessories/ProfanedSoulTrans_Wings.png similarity index 100% rename from Items/Accessories/Wings/ProfanedSoulTransWings.png rename to Items/Accessories/ProfanedSoulTrans_Wings.png diff --git a/Items/Accessories/Radiance.cs b/Items/Accessories/Radiance.cs index 355fd413a3..7fbffc9bb8 100644 --- a/Items/Accessories/Radiance.cs +++ b/Items/Accessories/Radiance.cs @@ -25,22 +25,23 @@ namespace CalamityMod.Items.Accessories { Item.width = 18; Item.height = 44; - Item.defense = 8; + Item.defense = 5; Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); player.statLifeMax2 += 70; + if (!player.HasBuff(BuffID.Honey)) + player.AddBuff(BuffID.Honey, 2); // Abyss light, debuff near-immunity, life regen effects, and massively enhances debuff halving modPlayer.purity = true; // Inherits effects from Honey Dew and Living Dew - modPlayer.alwaysHoneyRegen = true; modPlayer.honeyDewHalveDebuffs = true; modPlayer.livingDewHalveDebuffs = true; @@ -55,7 +56,7 @@ namespace CalamityMod.Items.Accessories var player = Main.LocalPlayer; if (player != null) { - list.FindAndReplace("[REGEN]", (player.Calamity().purityRegen + player.Calamity().alwaysHoneyRegenAmount).ToString("0.##")); + list.FindAndReplace("[REGEN]", player.Calamity().purityRegen.ToString("0.##")); list.FindAndReplace("[DEFENSE]", player.Calamity().jewelBonusDefense.ToString()); } } diff --git a/Items/Accessories/RampartofDeities.cs b/Items/Accessories/RampartofDeities.cs index 2ac41f439d..68bc76f46d 100644 --- a/Items/Accessories/RampartofDeities.cs +++ b/Items/Accessories/RampartofDeities.cs @@ -1,11 +1,17 @@ using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -13,16 +19,56 @@ namespace CalamityMod.Items.Accessories public class RampartofDeities : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() { Item.width = 64; Item.height = 62; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 12; + Item.defense = 8; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } + #region Toggleable Panic Necklace + + bool panicNecklaceEnabled = true; + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", panicNecklaceEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + panicNecklaceEnabled = !panicNecklaceEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("panic", panicNecklaceEnabled); + } + + public override void LoadData(TagCompound tag) + { + panicNecklaceEnabled = tag.GetBool("panic"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(panicNecklaceEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + panicNecklaceEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, panicNecklaceEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -31,6 +77,9 @@ namespace CalamityMod.Items.Accessories player.longInvince = true; modPlayer.dAmulet = true; + //Panic Necklace effect if enabled + player.panic = panicNecklaceEnabled; + // Large hit iframe effect taken from Seraph Tracers modPlayer.rampartOfDeities = true; diff --git a/Items/Accessories/WifeinaBottlewithBoobs.cs b/Items/Accessories/RareElementalinaBottle.cs similarity index 82% rename from Items/Accessories/WifeinaBottlewithBoobs.cs rename to Items/Accessories/RareElementalinaBottle.cs index 9c07ecc7ef..da23cea112 100644 --- a/Items/Accessories/WifeinaBottlewithBoobs.cs +++ b/Items/Accessories/RareElementalinaBottle.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class WifeinaBottlewithBoobs : ModItem, ILocalizedModType + [LegacyName("WifeinaBottlewithBoobs")] // Yes, that was the actual name. + public class RareElementalinaBottle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; @@ -38,12 +39,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandBoobWaifu = true; + modPlayer.rareSandElemental = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -59,12 +60,12 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.sandBoobWaifuVanity = true; + modPlayer.rareSandElementalVanity = true; if (player.whoAmI == Main.myPlayer) { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/WifeinaBottlewithBoobs.png b/Items/Accessories/RareElementalinaBottle.png similarity index 100% rename from Items/Accessories/WifeinaBottlewithBoobs.png rename to Items/Accessories/RareElementalinaBottle.png diff --git a/Items/Accessories/Regenator.cs b/Items/Accessories/Regenerator.cs similarity index 62% rename from Items/Accessories/Regenator.cs rename to Items/Accessories/Regenerator.cs index f8bdcbf180..8161d9d105 100644 --- a/Items/Accessories/Regenator.cs +++ b/Items/Accessories/Regenerator.cs @@ -1,17 +1,25 @@ -using CalamityMod.CalPlayer; +using System; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; using Terraria.Localization; -using System.Collections.Generic; -using System; +using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class Regenator : ModItem, ILocalizedModType + [LegacyName("Regenator")] + public class Regenerator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static float HealthRatioCap = 0.5f; + public static int FramesPerHeal = 8; + public static int RegenTimeBoost = 4; // on top of +1/s regular increment + public static float RegenToDamageRatio = 0.015f; // per regen point + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(HealthRatioCap.ToPercent(), (60 / (float)FramesPerHeal).Round()); + public override void SetDefaults() { Item.width = 34; @@ -24,14 +32,14 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.regenator = true; + modPlayer.regenerator = true; player.longInvince = true; // Gives better iframes because god help you if you end up getting hit twice } public override void ModifyTooltips(List list) { if (Main.LocalPlayer != null) - list.FindAndReplace("[DAMAGE]", (Main.LocalPlayer.Calamity().regenatorDamage).ToPercent()); + list.FindAndReplace("[DAMAGE]", (Main.LocalPlayer.Calamity().regeneratorDamage).ToPercent()); } } } diff --git a/Items/Accessories/Regenator.png b/Items/Accessories/Regenerator.png similarity index 100% rename from Items/Accessories/Regenator.png rename to Items/Accessories/Regenerator.png diff --git a/Items/Accessories/RoseStone.cs b/Items/Accessories/RoseStone.cs index e92c7f11de..02c781c7df 100644 --- a/Items/Accessories/RoseStone.cs +++ b/Items/Accessories/RoseStone.cs @@ -35,13 +35,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneWaifu = true; + modPlayer.brimElemental = true; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { @@ -58,13 +58,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateVanity(Player player) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.brimstoneWaifuVanity = true; + modPlayer.brimElementalVanity = true; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) + if (player.FindBuffIndex(ModContent.BuffType()) == -1) { - player.AddBuff(ModContent.BuffType(), 3600, true); + player.AddBuff(ModContent.BuffType(), 3600, true); } if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) { diff --git a/Items/Accessories/RottenBrain.cs b/Items/Accessories/RottenBrain.cs index 8f2dd3ad50..d48784a538 100644 --- a/Items/Accessories/RottenBrain.cs +++ b/Items/Accessories/RottenBrain.cs @@ -9,6 +9,9 @@ namespace CalamityMod.Items.Accessories public class RottenBrain : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(8); + public override void SetDefaults() { Item.width = 34; @@ -31,7 +34,8 @@ namespace CalamityMod.Items.Accessories AddIngredient(). AddTile(TileID.TinkerersWorkbench). AddCondition(Condition.InGraveyard). - Register(); + Register() + .DisableDecraft(); } } } diff --git a/Items/Accessories/RottenDogtooth.cs b/Items/Accessories/RottenDogtooth.cs index 7dad00cdc3..d38dba206d 100644 --- a/Items/Accessories/RottenDogtooth.cs +++ b/Items/Accessories/RottenDogtooth.cs @@ -8,7 +8,6 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; internal const int ArmorCrunchDebuffTime = 150; - internal const float StealthStrikeDamageMultiplier = 0.08f; public override void SetDefaults() { Item.width = 14; @@ -21,7 +20,6 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().rottenDogTooth = true; - player.Calamity().bonusStealthDamage += StealthStrikeDamageMultiplier; } } } diff --git a/Items/Accessories/RoverDrive.cs b/Items/Accessories/RoverDrive.cs index 1289b42d86..dd70db074e 100644 --- a/Items/Accessories/RoverDrive.cs +++ b/Items/Accessories/RoverDrive.cs @@ -11,6 +11,7 @@ using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -25,10 +26,9 @@ namespace CalamityMod.Items.Accessories public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; public static int ShieldDurabilityMax = 20; - public static int ShieldRechargeTime = CalamityUtils.SecondsToFrames(10); - - // While active, Rover Drive gives 10 defense - public static int ShieldDefenseBoost = 10; + public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(10); + public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(5); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ShieldDurabilityMax, ShieldRechargeDelay.FramesToSeconds(), TotalShieldRechargeTime.FramesToSeconds()); // Interface stuff. public int OwnerPlayer { get; set; } @@ -78,9 +78,6 @@ namespace CalamityMod.Items.Accessories modPlayer.roverDrive = true; modPlayer.roverDriveShieldVisible = !hideVisual; - - if (modPlayer.RoverDriveShieldDurability > 0) - player.statDefense += ShieldDefenseBoost; } // In vanity, provides a visual shield but no actual functionality diff --git a/Items/Accessories/RustyMedallion.cs b/Items/Accessories/RustyMedallion.cs deleted file mode 100644 index b7d0e8f3a1..0000000000 --- a/Items/Accessories/RustyMedallion.cs +++ /dev/null @@ -1,33 +0,0 @@ -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories -{ - public class RustyMedallion : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - public const int AcidDropBaseDamage = 9; - - // BAD Minishark! You will NOT become stupid sleeper agent item! - public const int AcidCreationCooldown = 25; - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 32; - Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.accessory = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.RustyMedallionDroplets = true; - player.buffImmune[ModContent.BuffType()] = true; - } - } -} diff --git a/Items/Accessories/RustyMedallion.png b/Items/Accessories/RustyMedallion.png deleted file mode 100644 index 398cd2132d..0000000000 Binary files a/Items/Accessories/RustyMedallion.png and /dev/null differ diff --git a/Items/Accessories/SandCloak.cs b/Items/Accessories/SandCloak.cs index d4188317bb..de7f1c2b4b 100644 --- a/Items/Accessories/SandCloak.cs +++ b/Items/Accessories/SandCloak.cs @@ -8,6 +8,9 @@ namespace CalamityMod.Items.Accessories public class SandCloak : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; + + public static int SandVeilDefenseBoost = 4; + public override void SetDefaults() { Item.width = 30; diff --git a/Items/Accessories/ScionsCurio.cs b/Items/Accessories/ScionsCurio.cs new file mode 100644 index 0000000000..8cad959d1f --- /dev/null +++ b/Items/Accessories/ScionsCurio.cs @@ -0,0 +1,36 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Items.Accessories +{ + public class ScionsCurio : ModItem, ILocalizedModType + { + public static int postHitDamage = 45; + public new string LocalizationCategory => "Items.Accessories"; + public override void SetDefaults() + { + Item.width = 32; + Item.height = 38; + Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.accessory = true; + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.scionsCurio = true; + modPlayer.scionsCurioVisuals = !hideVisual; + + if (player.ownedProjectileCounts[ProjectileType()] < 1 && !player.dead) + { + Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); + } + } + } +} diff --git a/Items/Accessories/ScionsCurio.png b/Items/Accessories/ScionsCurio.png new file mode 100644 index 0000000000..2cfb850e84 Binary files /dev/null and b/Items/Accessories/ScionsCurio.png differ diff --git a/Items/Accessories/SeaSpiritAmulet.cs b/Items/Accessories/SeaSpiritAmulet.cs index 74f6b94a0c..675fd8315f 100644 --- a/Items/Accessories/SeaSpiritAmulet.cs +++ b/Items/Accessories/SeaSpiritAmulet.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.sSpiritAmulet = true; modPlayer.sSpiritAmuletVisual = !hideVisual; + modPlayer.WaterDebuffMultiplier += 0.35f; } } } diff --git a/Items/Accessories/ShieldoftheHighRuler.cs b/Items/Accessories/ShieldoftheHighRuler.cs index e7e7fb50d7..1d7bc17922 100644 --- a/Items/Accessories/ShieldoftheHighRuler.cs +++ b/Items/Accessories/ShieldoftheHighRuler.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; - Item.defense = 6; + Item.defense = 4; Item.accessory = true; } diff --git a/Items/Accessories/ShieldoftheOcean.cs b/Items/Accessories/ShieldoftheOcean.cs index cacb484ead..9d8c0fadec 100644 --- a/Items/Accessories/ShieldoftheOcean.cs +++ b/Items/Accessories/ShieldoftheOcean.cs @@ -73,8 +73,10 @@ namespace CalamityMod.Items.Accessories continue; // Inflict Riptide on empowered parries. + //Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds if (empowered) - npc.AddBuff(ModContent.BuffType(), 300); + npc.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(15)); // If the NPC can be moved, violently shove them away. Make them susceptible to fall damage on empowered parries. // Otherwise, simply deal a large amount of damage to them if empowered. @@ -84,7 +86,7 @@ namespace CalamityMod.Items.Accessories Vector2 shoveVelocity = Utils.DirectionTo(player.Center, npc.Center) * (Main.zenithWorld ? 35f : 12.5f) - Vector2.UnitY * 6f; npc.MoveNPC(Vector2.Normalize(shoveVelocity), shoveVelocity.Length(), true); - int scaledFallDamage = ShoveFallBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + int scaledFallDamage = CalamityUtils.ScaleWithDifficulty(ShoveFallBaseDamage) * (Main.zenithWorld ? 10 : 1); if (empowered) npc.FlungNPC().ApplyCollisionDamage(npc, player, scaledFallDamage, shoveVelocity * 0.5f, 5f, true); else @@ -101,7 +103,7 @@ namespace CalamityMod.Items.Accessories { if (empowered) { - int scaledImmuneDamage = ImmuneToShoveBaseDamage * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1) * (Main.zenithWorld ? 10 : 1); + int scaledImmuneDamage = CalamityUtils.ScaleWithDifficulty(ImmuneToShoveBaseDamage) * (Main.zenithWorld ? 10 : 1); Projectile.NewProjectile(player.GetSource_FromThis(), npc.Center, Vector2.Zero, ModContent.ProjectileType(), scaledImmuneDamage, 0f, player.whoAmI, npc.whoAmI); } diff --git a/Items/Accessories/SigilofCalamitas.cs b/Items/Accessories/SigilofCalamitas.cs index eb3ff6f32b..94c5dd7487 100644 --- a/Items/Accessories/SigilofCalamitas.cs +++ b/Items/Accessories/SigilofCalamitas.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories player.manaMagnet = true; player.statManaMax2 += 100; player.GetDamage() += 0.15f; - player.manaCost *= 0.9f; + player.manaCost -= 0.1f; } public override void AddRecipes() diff --git a/Items/Accessories/SpiritGlyph.cs b/Items/Accessories/SpiritGlyph.cs index 2d1d84ad2f..4c5bd25543 100644 --- a/Items/Accessories/SpiritGlyph.cs +++ b/Items/Accessories/SpiritGlyph.cs @@ -11,8 +11,7 @@ namespace CalamityMod.Items.Accessories public new string LocalizationCategory => "Items.Accessories"; public static int RegenBoost = 2; - public static int DefenseBoost = 6; - public static float DamageReductionBoost = 0.03f; + public static int DefenseBoost = 4; public static float SummonDamageBoost = 0.1f; public override void SetDefaults() diff --git a/Items/Accessories/StatMeter.cs b/Items/Accessories/StatMeter.cs index 7bce076402..10edb5b418 100644 --- a/Items/Accessories/StatMeter.cs +++ b/Items/Accessories/StatMeter.cs @@ -153,13 +153,13 @@ namespace CalamityMod.Items.Accessories } } - // If ranged, or any direct subclass thereof, display ranged ammo consumption - if (dc == DamageClass.Ranged || dc.GetModifierInheritance(DamageClass.Ranged).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("RangedStats").Format(TwoPlaces(100f * player.GetRangedAmmoCostReduction())); + // If held item uses ammo, display ammo consumption + if (heldItem.useAmmo > 0) + stats2 += "\n" + this.GetLocalization("AmmoStats").Format(OnePlace(100f * player.GetAmmoCostReduction())); - // If magic, or any direct subclass thereof, display mana stats - if (dc == DamageClass.Magic || dc == DamageClass.MagicSummonHybrid || dc.GetModifierInheritance(DamageClass.Magic).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("MagicStats").Format(TwoPlaces(100f * player.manaCost), player.manaRegen); + // If held item uses mana, display mana stats + if (heldItem.mana > 0) + stats2 += "\n" + this.GetLocalization("ManaStats").Format(OnePlace(100f * player.manaCost), player.manaRegen); // If summon, or any direct subclass thereof, AND NOT A WHIP, display minion/sentry slots if (dc != DamageClass.SummonMeleeSpeed && (dc == DamageClass.Summon || dc.GetModifierInheritance(DamageClass.Summon).Equals(StatInheritanceData.Full))) @@ -168,7 +168,7 @@ namespace CalamityMod.Items.Accessories // If whip, show whip range float whipRange = player.whipRangeMultiplier - 1f; if (dc == DamageClass.SummonMeleeSpeed || dc.GetModifierInheritance(DamageClass.SummonMeleeSpeed).Equals(StatInheritanceData.Full)) - stats2 += "\n" + this.GetLocalization("WhipStats").Format(Sign(whipRange) + TwoPlaces(100f * whipRange)); + stats2 += "\n" + this.GetLocalization("WhipStats").Format(Sign(whipRange) + OnePlace(100f * whipRange)); // If throwing or rogue, display rogue stats. float rogueVelocity = modPlayer.rogueVelocity - 1f; @@ -178,7 +178,7 @@ namespace CalamityMod.Items.Accessories (int)(100f * modPlayer.rogueStealthMax), TwoPlaces(60f * player.GetStandingStealthRegen()), TwoPlaces(60f * player.GetMovingStealthRegen()), - Sign(rogueVelocity) + TwoPlaces(100f * rogueVelocity)); + Sign(rogueVelocity) + OnePlace(100f * rogueVelocity)); } // If tool, add tool range @@ -223,7 +223,6 @@ namespace CalamityMod.Items.Accessories // Detailed Abyss stats only render if the player is in the Abyss. string stats4 = "\n" + (!modPlayer.ZoneAbyss ? this.GetLocalizedValue("AbyssStatsHidden") : this.GetLocalization("AbyssStats").Format( player.GetCurrentAbyssLightLevel(), - TwoPlaces(modPlayer.abyssBreathLossStat), TwoPlaces(modPlayer.abyssBreathLossRateStat), modPlayer.abyssLifeLostAtZeroBreathStat, modPlayer.abyssDefenseLossStat)); diff --git a/Items/Accessories/StatisNinjaBelt.cs b/Items/Accessories/StatisNinjaBelt.cs index e42a2bbca1..b8f26b85fb 100644 --- a/Items/Accessories/StatisNinjaBelt.cs +++ b/Items/Accessories/StatisNinjaBelt.cs @@ -1,10 +1,14 @@ -using CalamityMod.CalPlayer.Dashes; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -25,6 +29,47 @@ namespace CalamityMod.Items.Accessories Item.rare = ItemRarityID.Purple; Item.accessory = true; } + #region Toggleable Tiger Gear + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + base.ModifyTooltips(tooltips); + } public override void UpdateAccessory(Player player, bool hideVisual) { @@ -35,7 +80,8 @@ namespace CalamityMod.Items.Accessories player.blackBelt = true; player.dashType = 0; player.Calamity().DashID = StatisNinjaBeltDash.ID; - player.spikedBoots = 2; + if (toggleEnabled) + player.spikedBoots = 2; player.accFlipper = true; player.Calamity().statisNinjaBelt = true; diff --git a/Items/Accessories/StatisVoidSash.cs b/Items/Accessories/StatisVoidSash.cs index 743bc9b28d..870570d09a 100644 --- a/Items/Accessories/StatisVoidSash.cs +++ b/Items/Accessories/StatisVoidSash.cs @@ -1,4 +1,6 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using CalamityMod.CalPlayer; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Materials; using CalamityMod.Rarities; @@ -11,6 +13,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories { @@ -33,9 +36,49 @@ namespace CalamityMod.Items.Accessories Item.height = 32; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); + } + #region Toggleable Tiger Gear + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion + public override void ModifyTooltips(List tooltips) + { + tooltips.FindAndReplace("[TOGGLE]", toggleEnabled ? this.GetLocalizedValue("ToggleEffect") : ""); + base.ModifyTooltips(tooltips); + } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); @@ -49,7 +92,8 @@ namespace CalamityMod.Items.Accessories player.blackBelt = true; modPlayer.DashID = StatisVoidSashDash.ID; player.dashType = 0; - player.spikedBoots = 2; + if (toggleEnabled) + player.spikedBoots = 2; player.accFlipper = true; player.Calamity().statisVoidSash = true; diff --git a/Items/Accessories/TheAbsorber.cs b/Items/Accessories/TheAbsorber.cs index 2b2e35e978..08416580fe 100644 --- a/Items/Accessories/TheAbsorber.cs +++ b/Items/Accessories/TheAbsorber.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Accessories public static float MoveSpeedBoost = 0.12f; public static float JumpSpeedBoost = 0.6f; // Both 12% so we only need just one in the tooltip - public static float ThornsBoost = 3.5f; + public static int ThornsDamage => CalamityUtils.ScaleWithDifficulty(200); public static int AuraLifetime = 1800; - public static int AuraRegenBoost = 6; + public static int AuraRegenBoost = 4; public static float AuraDamageBoost = 0.08f; public static float AuraDamageReductionBoost = 0.05f; public static float DamageTakenHealedPercent = 0.05f; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 24; - Item.defense = 10; + Item.defense = 6; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; Item.accessory = true; diff --git a/Items/Accessories/TheAmalgam.cs b/Items/Accessories/TheAmalgam.cs index d91883d50b..d8c8cc6475 100644 --- a/Items/Accessories/TheAmalgam.cs +++ b/Items/Accessories/TheAmalgam.cs @@ -16,6 +16,9 @@ namespace CalamityMod.Items.Accessories public class TheAmalgam : ModItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Accessories"; + + public static int NimbusDamage => CalamityUtils.ScaleWithDifficulty(200); + public override void SetStaticDefaults() { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(9, 6)); @@ -28,7 +31,7 @@ namespace CalamityMod.Items.Accessories Item.height = 34; Item.accessory = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -38,6 +41,11 @@ namespace CalamityMod.Items.Accessories modPlayer.amalgam = true; player.brainOfConfusionItem = Item; player.GetDamage() += 0.1f; + modPlayer.HeatDebuffMultiplier += 2f; + modPlayer.ColdDebuffMultiplier += 2f; + modPlayer.SicknessDebuffMultiplier += 2f; + modPlayer.WaterDebuffMultiplier += 2f; + modPlayer.ElectricDebuffMultiplier += 2f; } public override void AddRecipes() diff --git a/Items/Accessories/TheCamper.cs b/Items/Accessories/TheCamper.cs index b6f793c7e2..ff7b09897f 100644 --- a/Items/Accessories/TheCamper.cs +++ b/Items/Accessories/TheCamper.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Items.Accessories { if (npc.IsAnEnemy() && !npc.dontTakeDamage && Vector2.Distance(player.Center, npc.Center) <= range) { - int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(20, 41)); + int campingFireDamage = (int)player.GetBestClassDamage().ApplyTo(Main.rand.Next(100, 121)); Projectile.NewProjectile(source, npc.Center, Vector2.Zero, ModContent.ProjectileType(), campingFireDamage, 0f, player.whoAmI, npc.whoAmI); } } diff --git a/Items/Accessories/TheCommunity.cs b/Items/Accessories/TheCommunity.cs index 7aeffc057c..5d819c8cc9 100644 --- a/Items/Accessories/TheCommunity.cs +++ b/Items/Accessories/TheCommunity.cs @@ -109,6 +109,10 @@ namespace CalamityMod.Items.Accessories public override void ModifyTooltips(List list) { + var ThankYouTooltip = list.FirstOrDefault(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); + if (ThankYouTooltip != null) + ThankYouTooltip.OverrideColor = Main.DiscoColor; + float power = CalculatePower(); string statList = this.GetLocalization("StatsList").Format( (DamageMultiplier * power * 100).ToString("N1"), diff --git a/Items/Accessories/TheSponge.cs b/Items/Accessories/TheSponge.cs index b37ec798aa..de3d6a916f 100644 --- a/Items/Accessories/TheSponge.cs +++ b/Items/Accessories/TheSponge.cs @@ -15,6 +15,7 @@ using Terraria.DataStructures; using Terraria.GameContent; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories @@ -32,13 +33,11 @@ namespace CalamityMod.Items.Accessories public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/RoverDriveActivate") { Volume = 0.85f }; public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; - public static int ShieldDurabilityMax = 180; + public static int ShieldDurabilityMax = 120; + public static float ShieldActiveDamageReduction = 0.1f; public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(8); // Was 6, then was 9 public static int TotalShieldRechargeTime = CalamityUtils.SecondsToFrames(10); // Was 6 - - // While active, The Sponge gives 20 defense and 10% DR - public static int ShieldActiveDefense = 20; - public static float ShieldActiveDamageReduction = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(ShieldDurabilityMax, ShieldActiveDamageReduction.ToPercent(), ShieldRechargeDelay.FramesToSeconds(), TotalShieldRechargeTime.FramesToSeconds()); public int OwnerPlayer { get; set; } public float RenderDepth => IDyeableShaderRenderer.SpongeShieldDepth; @@ -80,20 +79,18 @@ namespace CalamityMod.Items.Accessories Item.height = 20; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.accessory = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); modPlayer.sponge = true; + player.noKnockback = true; modPlayer.spongeShieldVisible = !hideVisual; if (modPlayer.SpongeShieldDurability > 0) - { - player.statDefense += ShieldActiveDefense; player.endurance += ShieldActiveDamageReduction; - } } // In vanity, provides a visual shield but no actual functionality diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index 97daa1e8cb..da800d501b 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Items.Accessories CalamityPlayer modPlayer = player.Calamity(); modPlayer.toxicHeart = true; modPlayer.toxicHeartVisuals = !hideVisual; + modPlayer.SicknessDebuffMultiplier += 0.5f; } } } diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index d5d2f6e118..eb0800a9db 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -11,7 +11,6 @@ namespace CalamityMod.Items.Accessories { internal const int ArmorCrunchDebuffTime = 150; internal const int HeavyBleedingDebuffTime = 300; - internal const float StealthStrikeDamageMultiplier = 0.08f; public const float RaiderBonus = 15f; public bool ShowExtensionIndicator => false; @@ -36,7 +35,6 @@ namespace CalamityMod.Items.Accessories modPlayer.vampiricTalisman = true; modPlayer.raiderTalisman = true; modPlayer.rottenDogTooth = true; - player.Calamity().bonusStealthDamage += StealthStrikeDamageMultiplier; //get fixed boi funny if (Main.zenithWorld) diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs index ae04d03443..abcdf74751 100644 --- a/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs +++ b/Items/Accessories/Vanity/AbandonedWulfrumHelmet.cs @@ -1,8 +1,6 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; using Terraria; using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -20,35 +18,19 @@ namespace CalamityMod.Items.Accessories.Vanity [LegacyName("WulfrumHeadMelee")] [LegacyName("WulfrumHood")] [LegacyName("WulfrumHeadMagic")] - public class AbandonedWulfrumHelmet : ModItem, ILocalizedModType + public class AbandonedWulfrumHelmet : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet", EquipType.Head, name: "WulfrumOldSetHead"); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/AbandonedWulfrumHelmet_Legs", EquipType.Legs, this); - } - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "AbandonedWulfrumHelmetTrans", "WulfrumOldSetHead"), + (EquipType.Body, "AbandonedWulfrumHelmet", null), + (EquipType.Legs, "AbandonedWulfrumHelmet", null), + (EquipType.Face, null, null), //results in setting this equip slot to -1 + ]; + public override bool ShouldHideAccessories => true; - public override void SetStaticDefaults() - { - - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (SoundStyle sound, int delay)? HurtSound(Player p) => (SoundID.NPCHit4, 10); public override void SetDefaults() { @@ -62,7 +44,6 @@ namespace CalamityMod.Items.Accessories.Vanity public override void UpdateVanity(Player player) { - player.GetModPlayer().transformationActive = true; player.GetModPlayer().vanityEquipped = true; } @@ -70,7 +51,6 @@ namespace CalamityMod.Items.Accessories.Vanity { if (!hideVisual) { - player.GetModPlayer().transformationActive = true; player.GetModPlayer().vanityEquipped = true; } } @@ -79,53 +59,10 @@ namespace CalamityMod.Items.Accessories.Vanity public class WulfrumTransformationPlayer : ModPlayer { public bool vanityEquipped = false; - public bool transformationActive = false; - public bool forceHelmetOn = false; public override void ResetEffects() { vanityEquipped = false; - transformationActive = false; - forceHelmetOn = false; - } - - public override void FrameEffects() - { - if (forceHelmetOn || transformationActive) - { - Player.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); - Player.face = -1; - } - - if (transformationActive) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body); - - Player.HideAccessories(); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (forceHelmetOn || transformationActive) - { - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "WulfrumOldSetHead", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - drawInfo.drawPlayer.face = -1; - } - - if (transformationActive) - { - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "AbandonedWulfrumHelmet", EquipType.Body); - drawInfo.bodyGlowMask = -1; - - drawInfo.drawPlayer.HideAccessories(); - } } } } diff --git a/Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet.png b/Items/Accessories/Vanity/AbandonedWulfrumHelmetTrans_Head.png similarity index 100% rename from Items/Accessories/Vanity/AbandonedWulfrumHelmet_HeadSet.png rename to Items/Accessories/Vanity/AbandonedWulfrumHelmetTrans_Head.png diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.cs b/Items/Accessories/Vanity/CrystalHeartVodka.cs deleted file mode 100644 index 4067719941..0000000000 --- a/Items/Accessories/Vanity/CrystalHeartVodka.cs +++ /dev/null @@ -1,104 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Vanity -{ - public class CrystalHeartVodka : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Accessories"; - - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Legs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Fabsol_Back", EquipType.Back, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } - - public override void SetDefaults() - { - Item.width = 22; - Item.height = 30; - Item.accessory = true; - - // Same as Cirrus' Vodka, due to the obtainment method being shimmering Cirrus' Vodka. - Item.value = Item.sellPrice(silver: 30); - Item.rare = ItemRarityID.LightRed; - - Item.vanity = true; - Item.Calamity().devItem = true; - } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - player.GetModPlayer().vanityEquipped = true; - } - } - - public class CrystalHeartVodkaPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); - Player.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); - - //Player.HideAccessories(); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Back); - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "CrystalHeartVodka", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } - } -} diff --git a/Items/Accessories/Vanity/CrystalHeartVodka.png b/Items/Accessories/Vanity/CrystalHeartVodka.png deleted file mode 100644 index d0faf45977..0000000000 Binary files a/Items/Accessories/Vanity/CrystalHeartVodka.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Back.png b/Items/Accessories/Vanity/Fabsol_Back.png deleted file mode 100644 index 1563280bdc..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Back.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Body.png b/Items/Accessories/Vanity/Fabsol_Body.png deleted file mode 100644 index d98fdec79c..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Body.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Head.png b/Items/Accessories/Vanity/Fabsol_Head.png deleted file mode 100644 index bf96b48a95..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Head.png and /dev/null differ diff --git a/Items/Accessories/Vanity/Fabsol_Legs.png b/Items/Accessories/Vanity/Fabsol_Legs.png deleted file mode 100644 index 1156798b60..0000000000 Binary files a/Items/Accessories/Vanity/Fabsol_Legs.png and /dev/null differ diff --git a/Items/Accessories/Vanity/GhostBracelet.cs b/Items/Accessories/Vanity/GhostBracelet.cs index 18bb48b9c6..d1b42b67f9 100644 --- a/Items/Accessories/Vanity/GhostBracelet.cs +++ b/Items/Accessories/Vanity/GhostBracelet.cs @@ -1,38 +1,20 @@ -using Terraria; +using CalamityMod.Items.BaseItems; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { [LegacyName("RedBow")] - public class GhostBracelet : ModItem, ILocalizedModType + public class GhostBracelet : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Dandy_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Dandy", null), + (EquipType.Body, "Dandy", null), + (EquipType.Legs, "Dandy", null), + ]; public override void SetDefaults() { @@ -45,19 +27,6 @@ namespace CalamityMod.Items.Accessories.Vanity Item.Calamity().devItem = true; } - public override void UpdateVanity(Player player) - { - player.Calamity().ghostBracelet = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.Calamity().ghostBracelet = true; - } - } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Vanity/GoldenBomb.cs b/Items/Accessories/Vanity/GoldenBomb.cs index dca2e3d2a2..8bf02da708 100644 --- a/Items/Accessories/Vanity/GoldenBomb.cs +++ b/Items/Accessories/Vanity/GoldenBomb.cs @@ -1,39 +1,19 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; using Terraria; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class GoldenBomb : ModItem, ILocalizedModType + public class GoldenBomb : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mihaii_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Mihaii", null), + (EquipType.Body, "Mihaii", null), + (EquipType.Legs, "Mihaii", null), + ]; public override void SetDefaults() { @@ -45,53 +25,5 @@ namespace CalamityMod.Items.Accessories.Vanity Item.vanity = true; Item.Calamity().devItem = true; } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.GetModPlayer().vanityEquipped = true; - } - } - } - - public class GoldenBombPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "GoldenBomb", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } } } diff --git a/Items/Accessories/Vanity/HapuFruit.cs b/Items/Accessories/Vanity/HapuFruit.cs index 0461d330f8..97163ad111 100644 --- a/Items/Accessories/Vanity/HapuFruit.cs +++ b/Items/Accessories/Vanity/HapuFruit.cs @@ -1,43 +1,20 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class HapuFruit : ModItem, ILocalizedModType + public class HapuFruit : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Legs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Heart_Back", EquipType.Back, this); - } - } - - public override void SetStaticDefaults() - { - - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Heart", null), + (EquipType.Body, "Heart", null), + (EquipType.Legs, "Heart", null), + (EquipType.Back, "Heart", null) + ]; public override void SetDefaults() { @@ -49,56 +26,5 @@ namespace CalamityMod.Items.Accessories.Vanity Item.vanity = true; Item.Calamity().devItem = true; } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.GetModPlayer().vanityEquipped = true; - } - } - } - - public class HapuFruitPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back); - Player.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head); - - //Player.HideAccessories(); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Back); - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Body); - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "HapuFruit", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } } } diff --git a/Items/Accessories/Vanity/LucisSight.cs b/Items/Accessories/Vanity/LucisSight.cs new file mode 100644 index 0000000000..df711e8b14 --- /dev/null +++ b/Items/Accessories/Vanity/LucisSight.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.BaseItems; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Vanity +{ + public class LucisSight : TransformationAccessory, ILocalizedModType + { + public new string LocalizationCategory => "Items.Accessories"; + + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Face, "LucisSight", null), + ]; + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 18; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Accessories/Vanity/LucisSight.png b/Items/Accessories/Vanity/LucisSight.png new file mode 100644 index 0000000000..47aa49c9a1 Binary files /dev/null and b/Items/Accessories/Vanity/LucisSight.png differ diff --git a/Items/Accessories/Vanity/LucisSight_Face.png b/Items/Accessories/Vanity/LucisSight_Face.png new file mode 100644 index 0000000000..b56c28cf6e Binary files /dev/null and b/Items/Accessories/Vanity/LucisSight_Face.png differ diff --git a/Items/Accessories/Vanity/OracleHeadphones.cs b/Items/Accessories/Vanity/OracleHeadphones.cs index eb87fecceb..b75989ac4e 100644 --- a/Items/Accessories/Vanity/OracleHeadphones.cs +++ b/Items/Accessories/Vanity/OracleHeadphones.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -6,36 +7,16 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class OracleHeadphones : ModItem, ILocalizedModType + public class OracleHeadphones : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Legs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Mishiro_Back", EquipType.Back, this); - } - } - - public override void SetStaticDefaults() - { - - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Mishiro", null), + (EquipType.Body, "Mishiro", null), + (EquipType.Legs, "Mishiro", null), + (EquipType.Back, "Mishiro", null) + ]; public override void SetDefaults() { @@ -47,57 +28,5 @@ namespace CalamityMod.Items.Accessories.Vanity Item.vanity = true; Item.Calamity().devItem = true; } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.GetModPlayer().vanityEquipped = true; - } - } - } - - public class OracleHeadphonesPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back); - Player.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head); - - //Player.HideAccessories(); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.back = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Back); - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "OracleHeadphones", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } } } diff --git a/Items/Accessories/Vanity/Popo.cs b/Items/Accessories/Vanity/Popo.cs index 66fe6d0f3c..c5e43287af 100644 --- a/Items/Accessories/Vanity/Popo.cs +++ b/Items/Accessories/Vanity/Popo.cs @@ -1,61 +1,41 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.BaseItems; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class Popo : ModItem, ILocalizedModType + public class Popo : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/PopoNoseless_Head", EquipType.Head, name: "PopoNoseless"); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Popo_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Popo", null), + (EquipType.Head, "PopoNoseless", "PopoNoseless"), + (EquipType.Body, "Popo", null), + (EquipType.Legs, "Popo", null), + (EquipType.Face, null, null), //results in setting this equip slot to -1 + ]; public override void SetDefaults() { Item.width = 36; Item.height = 44; Item.accessory = true; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.value = Item.buyPrice(platinum: 5); // Sold by Archmage Item.rare = ItemRarityID.Pink; Item.Calamity().devItem = true; } - public override void UpdateVanity(Player player) + public override bool CustomSetEquipType(Player player, EquipType type, Mod mod, string name) { - player.Calamity().snowmanHide = false; - player.Calamity().snowmanForce = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - CalamityPlayer modPlayer = player.Calamity(); - modPlayer.snowman = true; - if (hideVisual) + if (type == EquipType.Head) { - modPlayer.snowmanHide = true; + player.head = EquipLoader.GetEquipSlot(Mod, player.Calamity().snowmanNoseless ? "PopoNoseless" : "Popo", EquipType.Head); + return true; } + return false; } } } diff --git a/Items/Accessories/Vanity/PunchCard.cs b/Items/Accessories/Vanity/PunchCard.cs index 40ac2b7d48..17f7cb92c1 100644 --- a/Items/Accessories/Vanity/PunchCard.cs +++ b/Items/Accessories/Vanity/PunchCard.cs @@ -1,45 +1,27 @@ -using CalamityMod.UI; +using CalamityMod.Items.BaseItems; +using CalamityMod.UI; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class PunchCard : ModItem, ILocalizedModType + public class PunchCard : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shayy_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Shayy", null), + (EquipType.Body, "Shayy", null), + (EquipType.Legs, "Shayy", null), + ]; public override void SetDefaults() { Item.width = 42; Item.height = 38; Item.accessory = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.value = Item.buyPrice(gold: 10); // Sold by Skeleton Merchant named "Sans Undertale" Item.rare = ItemRarityID.Purple; Item.vanity = true; Item.Calamity().devItem = true; @@ -53,18 +35,5 @@ namespace CalamityMod.Items.Accessories.Vanity PopupGUIManager.FlipActivityOfGUIWithType(typeof(PunchCardGUI)); return true; } - - public override void UpdateVanity(Player player) - { - player.Calamity().punchCard = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.Calamity().punchCard = true; - } - } } } diff --git a/Items/Accessories/Vanity/SharkyPlush.cs b/Items/Accessories/Vanity/SharkyPlush.cs index 521c319e7a..0edbbc3b6f 100644 --- a/Items/Accessories/Vanity/SharkyPlush.cs +++ b/Items/Accessories/Vanity/SharkyPlush.cs @@ -1,42 +1,20 @@ -using Microsoft.Xna.Framework; -using System; +using CalamityMod.Items.BaseItems; using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Renderers; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class SharkyPlush : ModItem, ILocalizedModType + public class SharkyPlush : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Shark_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Shark", null), + (EquipType.Body, "Shark", null), + (EquipType.Legs, "Shark", null), + ]; public override void SetDefaults() { @@ -48,53 +26,5 @@ namespace CalamityMod.Items.Accessories.Vanity Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } - - public override void UpdateVanity(Player player) - { - player.GetModPlayer().vanityEquipped = true; - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (!hideVisual) - { - player.GetModPlayer().vanityEquipped = true; - } - } - } - - public class SharkyPlushPlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "SharkyPlush", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } } } diff --git a/Items/Accessories/Vanity/Xyk_Body2.png b/Items/Accessories/Vanity/Xyk2_Body.png similarity index 100% rename from Items/Accessories/Vanity/Xyk_Body2.png rename to Items/Accessories/Vanity/Xyk2_Body.png diff --git a/Items/Accessories/Vanity/Xyk_Head2.png b/Items/Accessories/Vanity/Xyk2_Head.png similarity index 100% rename from Items/Accessories/Vanity/Xyk_Head2.png rename to Items/Accessories/Vanity/Xyk2_Head.png diff --git a/Items/Accessories/Vanity/Xyk_Legs2.png b/Items/Accessories/Vanity/Xyk2_Legs.png similarity index 100% rename from Items/Accessories/Vanity/Xyk_Legs2.png rename to Items/Accessories/Vanity/Xyk2_Legs.png diff --git a/Items/Accessories/Vanity/XyksBlessingBlue.cs b/Items/Accessories/Vanity/XyksBlessingBlue.cs index 7df7a6b928..703f134c42 100644 --- a/Items/Accessories/Vanity/XyksBlessingBlue.cs +++ b/Items/Accessories/Vanity/XyksBlessingBlue.cs @@ -1,4 +1,5 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -8,57 +9,35 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class XyksBlessingBlue : ModItem, ILocalizedModType + public class XyksBlessingBlue : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = false; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Xyk", null), + (EquipType.Body, "Xyk", null), + (EquipType.Legs, "Xyk", null), + (EquipType.Wings, null, null), //results in setting this equip slot to -1 + ]; public override void SetDefaults() { Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { - player.GetModPlayer().vanityEquipped = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.XykVisualsBlue = true; } @@ -67,46 +46,9 @@ namespace CalamityMod.Items.Accessories.Vanity { if (!hideVisual) { - player.GetModPlayer().vanityEquipped = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.XykVisualsBlue = true; } } } - - public class XyksBlessingBluePlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); - Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingBlue", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } - } } diff --git a/Items/Accessories/Vanity/XyksBlessingOrange.cs b/Items/Accessories/Vanity/XyksBlessingOrange.cs index 29f2d69f89..3afa978e68 100644 --- a/Items/Accessories/Vanity/XyksBlessingOrange.cs +++ b/Items/Accessories/Vanity/XyksBlessingOrange.cs @@ -1,64 +1,42 @@ using CalamityMod.CalPlayer; +using CalamityMod.Items.BaseItems; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories.Vanity { - public class XyksBlessingOrange : ModItem, ILocalizedModType + public class XyksBlessingOrange : TransformationAccessory, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Head2", EquipType.Head, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Body2", EquipType.Body, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Accessories/Vanity/Xyk_Legs2", EquipType.Legs, this); - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Projectiles/InvisibleProj", EquipType.Wings, this); - } - } - - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - - int equipSlotHead = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Head); - ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = true; - - int equipSlotBody = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = false; - ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; - - int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; - } + public override (EquipType, string, string)[] EquipSlots => + [ + (EquipType.Head, "Xyk2", null), + (EquipType.Body, "Xyk2", null), + (EquipType.Legs, "Xyk2", null), + (EquipType.Wings, null, null), //results in setting this equip slot to -1 + ]; public override void SetDefaults() { Item.width = 36; Item.height = 34; Item.accessory = true; - Item.consumable = true; Item.vanity = true; Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.Calamity().devItem = true; } public override bool CanRightClick() => true; - - public override void ModifyItemLoot(ItemLoot itemLoot) + public override void RightClick(Player player) { - itemLoot.Add(ModContent.ItemType()); + player.PutItemInInventoryFromItemUsage(ModContent.ItemType(), 1); } public override void UpdateVanity(Player player) { - player.GetModPlayer().vanityEquipped = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.XykVisualsOrange = true; } @@ -67,46 +45,9 @@ namespace CalamityMod.Items.Accessories.Vanity { if (!hideVisual) { - player.GetModPlayer().vanityEquipped = true; CalamityPlayer modPlayer = player.Calamity(); modPlayer.XykVisualsOrange = true; } } } - - public class XyksBlessingOrangePlayer : ModPlayer - { - public bool vanityEquipped = false; - - public override void ResetEffects() - { - vanityEquipped = false; - } - - public override void FrameEffects() - { - if (vanityEquipped) - { - Player.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); - Player.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); - Player.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); - Player.wings = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Wings); - } - } - - public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) - { - if (vanityEquipped) - { - drawInfo.drawPlayer.legs = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Legs); - drawInfo.legsGlowMask = -1; - drawInfo.legsOffset = Vector2.Zero; - drawInfo.drawPlayer.body = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Body); - drawInfo.bodyGlowMask = -1; - drawInfo.drawPlayer.head = EquipLoader.GetEquipSlot(Mod, "XyksBlessingOrange", EquipType.Head); - drawInfo.headGlowMask = -1; - drawInfo.helmetOffset = Vector2.Zero; - } - } - } } diff --git a/Items/Accessories/VeneratedLocket.cs b/Items/Accessories/VeneratedLocket.cs index 6be445c5ee..5af7c63a21 100644 --- a/Items/Accessories/VeneratedLocket.cs +++ b/Items/Accessories/VeneratedLocket.cs @@ -12,8 +12,8 @@ namespace CalamityMod.Items.Accessories { Item.width = 50; Item.height = 58; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(platinum: 10); // Sold by Bandit + Item.rare = ModContent.RarityType(); Item.accessory = true; } diff --git a/Items/Accessories/WarbanneroftheRighteous.cs b/Items/Accessories/WarbanneroftheRighteous.cs index cd6a16258e..04e2b9b36d 100644 --- a/Items/Accessories/WarbanneroftheRighteous.cs +++ b/Items/Accessories/WarbanneroftheRighteous.cs @@ -82,7 +82,7 @@ namespace CalamityMod.Items.Accessories float generousHitboxWidth = Math.Max(nPC.Hitbox.Width / 2f, nPC.Hitbox.Height / 2f) + 100; // Adds some room so max bonus isnt when you're ON the hitbox float intensity = Utils.Remap(Utils.Distance(player.Center, nPC.Center), MaxDistance + generousHitboxWidth, generousHitboxWidth, 1, 3, true); // We have to have this seperate from bonus, otherwise all effected enemies take damage based on the closest enemy - if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && nPC.CanBeChasedBy()) + if (Utils.Distance(nPC.Center, player.Center) < MaxDistance + generousHitboxWidth && (nPC.IsAnEnemy(true, true, false) || nPC.type == ModContent.NPCType()) && !nPC.dontTakeDamage) { float minDamageMult = 0.35f; int maxTargets = 25; diff --git a/Items/Accessories/Wings/BaseWings.cs b/Items/Accessories/Wings/BaseWings.cs index 7637d61087..7a58793775 100644 --- a/Items/Accessories/Wings/BaseWings.cs +++ b/Items/Accessories/Wings/BaseWings.cs @@ -2,7 +2,6 @@ using System.Linq; using System.Text; using CalamityMod.Balancing; -using Microsoft.Xna.Framework.Input; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -51,6 +50,7 @@ namespace CalamityMod.Items.Accessories.Wings public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) { + if (Item.wingSlot == -1) return; ascentWhenFalling = BonusAscentWhileFalling; ascentWhenRising = BonusAscentWhileRising; maxCanAscendMultiplier = RisingSpeedThreshold; @@ -68,7 +68,15 @@ namespace CalamityMod.Items.Accessories.Wings public override void ModifyTooltips(List list) { - WingStats stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; + if (Item.wingSlot == -1) return; + WingStats stats = new(); + if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersCelestial.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersElysian.wingSlot]; + else if (Item.type == ModContent.ItemType()) + stats = ArmorIDs.Wing.Sets.Stats[TracersSeraph.wingSlot]; + else stats = ArmorIDs.Wing.Sets.Stats[Item.wingSlot]; int time = stats.FlyTime; float run = stats.AccRunSpeedOverride; float rAcc = stats.AccRunAccelerationMult * 0.08f; @@ -80,7 +88,7 @@ namespace CalamityMod.Items.Accessories.Wings sb.Append('\n'); sb.Append(CalamityUtils.GetText($"Common.WingStats").Format(time.FramesToSeconds(), run.ToMph(), (MaxAscentSpeed * baseJumpSpeed).ToMph())); sb.Append('\n'); - if (Main.keyState.IsKeyDown(Keys.LeftShift)) + if (Main.keyState.PressingShift()) { sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), BaseAscent.ToMphps(), (BaseAscent + BonusAscentWhileRising).ToMphps(), (RisingSpeedThreshold * baseJumpSpeed).ToMph(), diff --git a/Items/Accessories/Wings/DrewsWings.cs b/Items/Accessories/Wings/DrewsWings.cs deleted file mode 100644 index fb3855fe8d..0000000000 --- a/Items/Accessories/Wings/DrewsWings.cs +++ /dev/null @@ -1,51 +0,0 @@ -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Accessories.Wings -{ - [AutoloadEquip(EquipType.Wings)] - public class DrewsWings : BaseWings - { - public override float BonusAscentWhileFalling => 1f; - public override float BonusAscentWhileRising => 0.17f; - public override float RisingSpeedThreshold => 1.2f; - public override float MaxAscentSpeed => 3.25f; - public override float BaseAscent => 0.15f; - - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(361, 11.5f, 2.9f); - - public override void SetDefaults() - { - base.SetDefaults(); - Item.width = 22; - Item.height = 20; - Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); - } - - public override void UpdateAccessory(Player player, bool hideVisual) - { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) - { - int dustXOffset = 4; - if (player.direction == 1) - { - dustXOffset = -40; - } - int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, DustID.GemDiamond, 0f, 0f, 100, default, 2.4f); - Main.dust[flightDust].noGravity = true; - Main.dust[flightDust].velocity *= 0.3f; - if (Main.rand.NextBool(10)) - { - Main.dust[flightDust].fadeIn = 2f; - } - Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); - } - } - } -} diff --git a/Items/Accessories/Wings/DrewsWings.png b/Items/Accessories/Wings/DrewsWings.png deleted file mode 100644 index bd8707e1c3..0000000000 Binary files a/Items/Accessories/Wings/DrewsWings.png and /dev/null differ diff --git a/Items/Accessories/Wings/DrewsWings_Wings.png b/Items/Accessories/Wings/DrewsWings_Wings.png deleted file mode 100644 index 131487a6d7..0000000000 Binary files a/Items/Accessories/Wings/DrewsWings_Wings.png and /dev/null differ diff --git a/Items/Accessories/Wings/MOAB.cs b/Items/Accessories/Wings/MOAB.cs index c52e62c867..05af56d6c3 100644 --- a/Items/Accessories/Wings/MOAB.cs +++ b/Items/Accessories/Wings/MOAB.cs @@ -1,10 +1,15 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using System.IO; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -17,7 +22,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(75, 6.5f, 1f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -27,10 +37,57 @@ namespace CalamityMod.Items.Accessories.Wings Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; } + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (toggleEnabled && player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) { player.rocketDelay2--; if (player.rocketDelay2 <= 0) @@ -95,7 +152,6 @@ namespace CalamityMod.Items.Accessories.Wings // Mirrors the +5% luck from Lucky Horseshoe (vanilla behavior). player.Calamity().calamityBonusLuck += 0.05f; } - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Accessories/Wings/MOAB.png b/Items/Accessories/Wings/MOAB.png index ecafba2594..742a5ede38 100644 Binary files a/Items/Accessories/Wings/MOAB.png and b/Items/Accessories/Wings/MOAB.png differ diff --git a/Items/Accessories/Wings/SilvaWings.cs b/Items/Accessories/Wings/SilvaWings.cs index fde8d8345e..8efb22fb23 100644 --- a/Items/Accessories/Wings/SilvaWings.cs +++ b/Items/Accessories/Wings/SilvaWings.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 22; Item.height = 20; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) diff --git a/Items/Accessories/Wings/TracersCelestial.cs b/Items/Accessories/Wings/TracersCelestial.cs index eb1ea60ce8..f6403a0ff2 100644 --- a/Items/Accessories/Wings/TracersCelestial.cs +++ b/Items/Accessories/Wings/TracersCelestial.cs @@ -1,4 +1,7 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -7,6 +10,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -20,20 +24,70 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.5f; public override float BaseAscent => 0.125f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + public static int wingSlot = 0; + + public override void SetStaticDefaults() { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(160, 9f, 2.6f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { base.SetDefaults(); Item.width = 36; - Item.height = 32; + Item.height = 40; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; } - + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -57,7 +111,13 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 4; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersCelestial = true; } @@ -73,18 +133,18 @@ namespace CalamityMod.Items.Accessories.Wings public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.9f, - drawOffset: new(1f, 0f) - ); + var tex = TextureAssets.Item[Type].Value; + frame = tex.Frame(2, 1, toggleEnabled ? 0 : 1); + spriteBatch.Draw(tex, position, frame, Color.White, 0, frame.Size() * 0.5f, Main.inventoryScale * 0.8f, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + + var tex = TextureAssets.Item[Type].Value; + var frame = tex.Frame(2, 1, toggleEnabled ? 0 : 1); + spriteBatch.Draw(tex, Item.Center - Main.screenPosition, frame, lightColor, rotation, frame.Size() * 0.5f, scale, SpriteEffects.None, 0); return false; } } diff --git a/Items/Accessories/Wings/TracersCelestial.png b/Items/Accessories/Wings/TracersCelestial.png index 11e351774f..ccb6df8508 100644 Binary files a/Items/Accessories/Wings/TracersCelestial.png and b/Items/Accessories/Wings/TracersCelestial.png differ diff --git a/Items/Accessories/Wings/TracersElysian.cs b/Items/Accessories/Wings/TracersElysian.cs index 918a418280..0126398f52 100644 --- a/Items/Accessories/Wings/TracersElysian.cs +++ b/Items/Accessories/Wings/TracersElysian.cs @@ -1,4 +1,7 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -10,6 +13,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,7 +27,12 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.7f; public override float BaseAscent => 0.135f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(220, 10f, 2.7f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { @@ -31,12 +40,57 @@ namespace CalamityMod.Items.Accessories.Wings Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } - + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -60,7 +114,14 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + player.socialShadowRocketBoots = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 1; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersElysian = true; } @@ -74,22 +135,5 @@ namespace CalamityMod.Items.Accessories.Wings AddTile(). Register(); } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.9f, - drawOffset: new(1f, 0f) - ); - return false; - } } } diff --git a/Items/Accessories/Wings/TracersElysian.png b/Items/Accessories/Wings/TracersElysian.png index 4bb21bbcbf..86bc3b4e8e 100644 Binary files a/Items/Accessories/Wings/TracersElysian.png and b/Items/Accessories/Wings/TracersElysian.png differ diff --git a/Items/Accessories/Wings/TracersSeraph.cs b/Items/Accessories/Wings/TracersSeraph.cs index 2c42494f78..a0c7d02e61 100644 --- a/Items/Accessories/Wings/TracersSeraph.cs +++ b/Items/Accessories/Wings/TracersSeraph.cs @@ -1,5 +1,9 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -10,6 +14,7 @@ using Terraria.GameContent; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Accessories.Wings { @@ -23,20 +28,71 @@ namespace CalamityMod.Items.Accessories.Wings public override float MaxAscentSpeed => 2.9f; public override float BaseAscent => 0.145f; - public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + public static int wingSlot = 0; + public override void SetStaticDefaults() + { + ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(250, 11f, 2.8f); + wingSlot = Item.wingSlot; + } public override void SetDefaults() { base.SetDefaults(); Item.width = 36; Item.height = 32; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } + #region Toggleable Wings + bool toggleEnabled + { + get { return Item.wingSlot != -1; } + set + { + if (value) + Item.wingSlot = wingSlot; + else + Item.wingSlot = -1; + } + } + public override void ModifyTooltips(List tooltips) + { + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip0"); + base.ModifyTooltips(tooltips); + } + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } + #endregion public override void UpdateAccessory(Player player, bool hideVisual) { - if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual && toggleEnabled) { int dustXOffset = 4; if (player.direction == 1) @@ -60,7 +116,13 @@ namespace CalamityMod.Items.Accessories.Wings player.fireWalk = true; player.lavaImmune = true; player.buffImmune[BuffID.OnFire] = true; - modPlayer.tracersDust = !hideVisual; + player.noFallDmg = true; + if (!toggleEnabled) //Both these effects just boost flight time, but we don't want Tracers to boost it's own flight time when functioning as wings. All other Angel Tread effects are covered above. + { + player.rocketBoots = player.vanityRocketBoots = 2; + modPlayer.angelTreads = true; + } + modPlayer.tracersDust = !hideVisual && toggleEnabled; modPlayer.tracersSeraph = true; // Grants immunity to Auric Rejection and other walk-on-block effects } @@ -68,27 +130,10 @@ namespace CalamityMod.Items.Accessories.Wings { CreateRecipe(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(5). AddTile(). Register(); } - - public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) - { - CalamityUtils.DrawInventoryCustomScale( - spriteBatch, - texture: TextureAssets.Item[Type].Value, - position, - frame, - drawColor, - itemColor, - origin, - scale, - wantedScale: 0.8f, - drawOffset: new(1f, 0f) - ); - return false; - } } } diff --git a/Items/Accessories/Wings/TracersSeraph.png b/Items/Accessories/Wings/TracersSeraph.png index 1608a8dc7c..3d36a37708 100644 Binary files a/Items/Accessories/Wings/TracersSeraph.png and b/Items/Accessories/Wings/TracersSeraph.png differ diff --git a/Items/Accessories/Wings/WingsofRebirth.cs b/Items/Accessories/Wings/WingsofRebirth.cs new file mode 100644 index 0000000000..8f372bc6ba --- /dev/null +++ b/Items/Accessories/Wings/WingsofRebirth.cs @@ -0,0 +1,92 @@ +using CalamityMod.Dusts; +using CalamityMod.Rarities; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Accessories.Wings +{ + // The equip sprite is actually blank as a custom draw layer is used to draw the real sprites without any base sprites conflicting + [LegacyName("DrewsWings")] + [AutoloadEquip(EquipType.Wings)] + public class WingsofRebirth : BaseWings + { + public override float BonusAscentWhileFalling => 1f; + public override float BonusAscentWhileRising => 0.17f; + public override float RisingSpeedThreshold => 1.2f; + public override float MaxAscentSpeed => 3.25f; + public override float BaseAscent => 0.15f; + + public override void SetStaticDefaults() => ArmorIDs.Wing.Sets.Stats[Item.wingSlot] = new WingStats(360, 11.5f, 2.9f); + + public override void SetDefaults() + { + base.SetDefaults(); + Item.width = 22; + Item.height = 20; + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); + } + + public override void UpdateAccessory(Player player, bool hideVisual) + { + if (player.controlJump && player.wingTime > 0f && player.jump == 0 && player.velocity.Y != 0f && !hideVisual) + { + int dustXOffset = 4; + if (player.direction == 1) + { + dustXOffset = -40; + } + int flightDust = Dust.NewDust(new Vector2(player.position.X + (float)(player.width / 2) + (float)dustXOffset, player.position.Y + (float)(player.height / 2) - 15f), 30, 30, (int)CalamityDusts.ProfanedFire, 0f, 0f, 100, default, 2.4f); + Main.dust[flightDust].noGravity = true; + Main.dust[flightDust].velocity *= 0.3f; + if (Main.rand.NextBool(10)) + { + Main.dust[flightDust].fadeIn = 2f; + } + Main.dust[flightDust].shader = GameShaders.Armor.GetSecondaryShader(player.cWings, player); + } + } + + public override bool WingUpdate(Player player, bool inUse) + { + if (player.controlJump && player.wingTime > 0 && player.velocity.Y != 0) + { + int frameRate = 5; // FPS + int maxFrames = 9; // Total frames + player.wingFrameCounter++; + // Start flight animation with frame 7 + if (player.wingFrame == 0) + { + player.wingFrame = 7; + } + // Reset frames + if (player.wingFrame >= maxFrames) + { + player.wingFrameCounter = 0; + player.wingFrame = 1; + } + // Animation + if (player.wingFrameCounter % frameRate == 0) + { + player.wingFrame++; + } + } + else + { + player.wingFrameCounter = 0; + player.wingFrame = 0; // On ground + if (player.velocity.Y != 0) + { + player.wingFrame = 2; // Falling + if (player.controlJump && player.velocity.Y > 0) + player.wingFrame = 1; // Gliding + } + } + return true; + } + } +} diff --git a/Items/Accessories/Wings/WingsofRebirth.png b/Items/Accessories/Wings/WingsofRebirth.png new file mode 100644 index 0000000000..ee575d23ab Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth.png differ diff --git a/Items/Accessories/Wings/WingsofRebirth_Wings.png b/Items/Accessories/Wings/WingsofRebirth_Wings.png new file mode 100644 index 0000000000..08ddcaa27a Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth_Wings.png differ diff --git a/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png b/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png new file mode 100644 index 0000000000..df66a0fb83 Binary files /dev/null and b/Items/Accessories/Wings/WingsofRebirth_Wings_Real.png differ diff --git a/Items/Accessories/WulfrumAcrobaticsPack.cs b/Items/Accessories/WulfrumAcrobaticsPack.cs index bfb2969f02..2395ba53fa 100644 --- a/Items/Accessories/WulfrumAcrobaticsPack.cs +++ b/Items/Accessories/WulfrumAcrobaticsPack.cs @@ -46,9 +46,9 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Chain, 2). - AddIngredient(6). + AddIngredient(5). AddIngredient(). + AddIngredient(ItemID.Chain, 2). AddTile(TileID.Anvils). Register(); } @@ -424,7 +424,10 @@ namespace CalamityMod.Items.Accessories bool playerCrossedSides = Math.Sign(Segments[SimulationResolution].oldPosition.X - Segments[0].position.X) != Math.Sign(Segments[SimulationResolution].position.X - Segments[0].position.X); float swingSpeed = (Segments[SimulationResolution].oldPosition - Segments[SimulationResolution].position).Length(); if (swingSpeed > 6f && playerCrossedSides) - SoundEngine.PlaySound(CommonCalamitySounds.LouderSwingWoosh with { Volume = CommonCalamitySounds.LouderSwingWoosh.Volume * (Math.Clamp((swingSpeed - 6f) / 12f, 0, 1)) }, Player.Center); + { + SoundStyle swing = new SoundStyle("CalamityMod/Sounds/Custom/LoudSwingWoosh") with { Volume = Math.Clamp((swingSpeed - 6f) / 12f, 0, 1) }; + SoundEngine.PlaySound(swing, Player.Center); + } } } @@ -624,7 +627,7 @@ namespace CalamityMod.Items.Accessories SoundEngine.PlaySound(WulfrumAcrobaticsPack.ReleaseSound, p.Center); p.Kill(); - + Player.grapCount = 0; } } diff --git a/Items/Accessories/YharimsGift.cs b/Items/Accessories/YharimsGift.cs index 83d180aa84..2d0096cb73 100644 --- a/Items/Accessories/YharimsGift.cs +++ b/Items/Accessories/YharimsGift.cs @@ -18,10 +18,10 @@ namespace CalamityMod.Items.Accessories { Item.width = 20; Item.height = 22; - Item.defense = 15; // Why did this give 30 defense? This thing really needs a rework lol + Item.defense = 12; // Why did this give 30 defense? This thing really needs a rework lol Item.accessory = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UpdateAccessory(Player player, bool hideVisual) @@ -29,6 +29,7 @@ namespace CalamityMod.Items.Accessories var source = player.GetSource_Accessory(Item); player.moveSpeed += 0.15f; player.GetDamage() += 0.15f; + player.noKnockback = true; if (!player.StandingStill()) { dragonTimer--; diff --git a/Items/AlicornonaStick.png b/Items/AlicornonaStick.png deleted file mode 100644 index b09e99c934..0000000000 Binary files a/Items/AlicornonaStick.png and /dev/null differ diff --git a/Items/Ammo/BloodRune.cs b/Items/Ammo/BloodRune.cs index e12165c861..e815c4d747 100644 --- a/Items/Ammo/BloodRune.cs +++ b/Items/Ammo/BloodRune.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 10f; Item.value = Item.buyPrice(gold: 1); // Sold by Archmage - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0f; diff --git a/Items/Ammo/GodSlayerSlug.cs b/Items/Ammo/GodSlayerSlug.cs index 8b25b3ab3b..7c2e134d17 100644 --- a/Items/Ammo/GodSlayerSlug.cs +++ b/Items/Ammo/GodSlayerSlug.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Ammo Item.consumable = true; Item.knockBack = 3f; Item.value = Item.sellPrice(copper: 28); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.ammo = ItemID.MusketBall; diff --git a/Items/Ammo/SproutingArrow.cs b/Items/Ammo/SproutingArrow.cs index d8006c98eb..5b6cf0d8c0 100644 --- a/Items/Ammo/SproutingArrow.cs +++ b/Items/Ammo/SproutingArrow.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Ammo { Item.width = 22; Item.height = 36; - Item.damage = 15; + Item.damage = 14; Item.DamageType = DamageClass.Ranged; Item.maxStack = Item.CommonMaxStack; Item.consumable = true; diff --git a/Items/Ammo/VanquisherArrow.cs b/Items/Ammo/VanquisherArrow.cs index ea06605ea6..e530952681 100644 --- a/Items/Ammo/VanquisherArrow.cs +++ b/Items/Ammo/VanquisherArrow.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Ammo Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.1f; Item.ammo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Armor/Aerospec/AerospecBreastplate.cs b/Items/Armor/Aerospec/AerospecBreastplate.cs index c4601b3ca1..97e9ae7fbd 100644 --- a/Items/Armor/Aerospec/AerospecBreastplate.cs +++ b/Items/Armor/Aerospec/AerospecBreastplate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec @@ -11,6 +12,15 @@ namespace CalamityMod.Items.Armor.Aerospec public new string LocalizationCategory => "Items.Armor.PreHardmode"; internal static string FeatherEntitySourceContext => "SetBonus_Calamity_Aerospec"; + public static float DamageBoost = 0.03f; + public static int CritBoost = 3; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); + + // Common Set Bonus + public static int SetBonusHurtDamageThreshold = 25; + public static int SetBonusFeatherDamage => CalamityUtils.ScaleWithDifficulty(15); + public static float SetBonusFallSpeed = 15f; + public override void SetDefaults() { Item.width = 18; @@ -22,8 +32,8 @@ namespace CalamityMod.Items.Armor.Aerospec public override void UpdateEquip(Player player) { - player.GetDamage() += 0.03f; - player.GetCritChance() += 3; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Aerospec/AerospecHat.cs b/Items/Armor/Aerospec/AerospecHat.cs deleted file mode 100644 index 5b81c6206c..0000000000 --- a/Items/Armor/Aerospec/AerospecHat.cs +++ /dev/null @@ -1,60 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Aerospec -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHat : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.defense = 3; //15 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.aeroSet = true; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.manaCost -= 0.08f; - player.GetCritChance() += 5; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - player.statManaMax2 += 30; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). - AddIngredient(ItemID.Feather). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Aerospec/AerospecHeadMagic.cs b/Items/Armor/Aerospec/AerospecHeadMagic.cs new file mode 100644 index 0000000000..d2a019c966 --- /dev/null +++ b/Items/Armor/Aerospec/AerospecHeadMagic.cs @@ -0,0 +1,66 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Aerospec +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("AerospecHat")] + public class AerospecHeadMagic : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int MaxManaBoost = 30; + public static float MagicDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, MagicDamageBoost.ToPercent()); + + // Set Bonus + public static float SetBonusManaCostReduction = 0.08f; + public static float SetBonusMoveSpeedBoost = 0.05f; + public static int SetBonusMagicCritBoost = 5; // NOTE: Tooltip shares this number with move speed % as they're equal + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.defense = 3; //15 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusManaCostReduction.ToPercent(), SetBonusMoveSpeedBoost.ToPercent(), AerospecBreastplate.SetBonusHurtDamageThreshold); + var modPlayer = player.Calamity(); + modPlayer.aeroSet = true; + player.noFallDmg = true; + player.moveSpeed += SetBonusMoveSpeedBoost; + player.manaCost -= SetBonusManaCostReduction; + player.GetCritChance() += SetBonusMagicCritBoost; + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += MagicDamageBoost; + player.statManaMax2 += MaxManaBoost; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(ItemID.Feather). + AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Aerospec/AerospecHat.png b/Items/Armor/Aerospec/AerospecHeadMagic.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHat.png rename to Items/Armor/Aerospec/AerospecHeadMagic.png diff --git a/Items/Armor/Aerospec/AerospecHat_Head.png b/Items/Armor/Aerospec/AerospecHeadMagic_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHat_Head.png rename to Items/Armor/Aerospec/AerospecHeadMagic_Head.png diff --git a/Items/Armor/Aerospec/AerospecHeadMelee.cs b/Items/Armor/Aerospec/AerospecHeadMelee.cs new file mode 100644 index 0000000000..c229ad325c --- /dev/null +++ b/Items/Armor/Aerospec/AerospecHeadMelee.cs @@ -0,0 +1,61 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Aerospec +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("AerospecHelm")] + public class AerospecHeadMelee : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float MeleeDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent()); + + // Set Bonus + public static float SetBonusMoveSpeedBoost = 0.05f; + public static int SetBonusMeleeCritBoost = 5; // NOTE: Tooltip shares this number with move speed % as they're equal + public static int SetBonusAggroBoost = 300; + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.defense = 7; //20 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; + + public override void UpdateArmorSet(Player player) + { + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMoveSpeedBoost.ToPercent(), AerospecBreastplate.SetBonusHurtDamageThreshold); + var modPlayer = player.Calamity(); + modPlayer.aeroSet = true; + player.noFallDmg = true; + player.moveSpeed += SetBonusMoveSpeedBoost; + player.GetCritChance() += SetBonusMeleeCritBoost; + player.aggro += SetBonusAggroBoost; + } + + public override void UpdateEquip(Player player) => player.GetDamage() += MeleeDamageBoost; + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.SunplateBlock, 3). + AddIngredient(ItemID.Feather). + AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Aerospec/AerospecHelm.png b/Items/Armor/Aerospec/AerospecHeadMelee.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelm.png rename to Items/Armor/Aerospec/AerospecHeadMelee.png diff --git a/Items/Armor/Aerospec/AerospecHelm_Head.png b/Items/Armor/Aerospec/AerospecHeadMelee_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelm_Head.png rename to Items/Armor/Aerospec/AerospecHeadMelee_Head.png diff --git a/Items/Armor/Aerospec/AerospecHood.cs b/Items/Armor/Aerospec/AerospecHeadRanged.cs similarity index 51% rename from Items/Armor/Aerospec/AerospecHood.cs rename to Items/Armor/Aerospec/AerospecHeadRanged.cs index 6b41319026..a4baae9a58 100644 --- a/Items/Armor/Aerospec/AerospecHood.cs +++ b/Items/Armor/Aerospec/AerospecHeadRanged.cs @@ -2,14 +2,24 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHood : ModItem, ILocalizedModType + [LegacyName("AerospecHood")] + public class AerospecHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RangedDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent()); + + // Set Bonus + public static float SetBonusMoveSpeedBoost = 0.05f; + public static int SetBonusRangedCritBoost = 5; // NOTE: Tooltip shares this number with move speed % as they're equal + public override void SetDefaults() { Item.width = 18; @@ -19,30 +29,21 @@ namespace CalamityMod.Items.Armor.Aerospec Item.defense = 5; //18 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMoveSpeedBoost.ToPercent(), AerospecBreastplate.SetBonusHurtDamageThreshold); var modPlayer = player.Calamity(); modPlayer.aeroSet = true; player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.GetCritChance() += 5; + player.moveSpeed += SetBonusMoveSpeedBoost; + player.GetCritChance() += SetBonusRangedCritBoost; } - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } + public override void UpdateEquip(Player player) => player.GetDamage() += RangedDamageBoost; public override void AddRecipes() { @@ -51,7 +52,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortAfterFirstRecipesOf(ModContent.ItemType()). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHood.png b/Items/Armor/Aerospec/AerospecHeadRanged.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHood.png rename to Items/Armor/Aerospec/AerospecHeadRanged.png diff --git a/Items/Armor/Aerospec/AerospecHood_Head.png b/Items/Armor/Aerospec/AerospecHeadRanged_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHood_Head.png rename to Items/Armor/Aerospec/AerospecHeadRanged_Head.png diff --git a/Items/Armor/Aerospec/AerospecHeadgear.cs b/Items/Armor/Aerospec/AerospecHeadRogue.cs similarity index 52% rename from Items/Armor/Aerospec/AerospecHeadgear.cs rename to Items/Armor/Aerospec/AerospecHeadRogue.cs index e4e6d096d3..2d563a31a1 100644 --- a/Items/Armor/Aerospec/AerospecHeadgear.cs +++ b/Items/Armor/Aerospec/AerospecHeadRogue.cs @@ -2,14 +2,26 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHeadgear : ModItem, ILocalizedModType + [LegacyName("AerospecHeadgear")] + public class AerospecHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RogueDamageBoost = 0.1f; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 0.8f; + public static float SetBonusMoveSpeedBoost = 0.05f; + public static int SetBonusRogueCritBoost = 5; // NOTE: Tooltip shares this number with move speed % as they're equal + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -25,32 +37,26 @@ namespace CalamityMod.Items.Armor.Aerospec Item.defense = 4; //17 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), SetBonusMoveSpeedBoost.ToPercent(), AerospecBreastplate.SetBonusHurtDamageThreshold); var modPlayer = player.Calamity(); modPlayer.aeroSet = true; - modPlayer.rogueStealthMax += 0.8f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.GetCritChance() += 5; + player.moveSpeed += SetBonusMoveSpeedBoost; + player.GetCritChance() += SetBonusRogueCritBoost; player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() @@ -60,7 +66,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortAfterFirstRecipesOf(ModContent.ItemType()). + SortAfterFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHeadgear.png b/Items/Armor/Aerospec/AerospecHeadRogue.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHeadgear.png rename to Items/Armor/Aerospec/AerospecHeadRogue.png diff --git a/Items/Armor/Aerospec/AerospecHeadgear_Head.png b/Items/Armor/Aerospec/AerospecHeadRogue_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHeadgear_Head.png rename to Items/Armor/Aerospec/AerospecHeadRogue_Head.png diff --git a/Items/Armor/Aerospec/AerospecHelmet.cs b/Items/Armor/Aerospec/AerospecHeadSummon.cs similarity index 66% rename from Items/Armor/Aerospec/AerospecHelmet.cs rename to Items/Armor/Aerospec/AerospecHeadSummon.cs index 2ab7b3fd09..4cfabb9185 100644 --- a/Items/Armor/Aerospec/AerospecHelmet.cs +++ b/Items/Armor/Aerospec/AerospecHeadSummon.cs @@ -5,14 +5,24 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec { [AutoloadEquip(EquipType.Head)] - public class AerospecHelmet : ModItem, ILocalizedModType + [LegacyName("AerospecHelmet")] + public class AerospecHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float SummonDamageBoost = 0.1f; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 1; + public static float SetBonusSummonDamageBoost = 0.11f; public static int ValkyrieDamage = 20; public override void SetDefaults() @@ -24,19 +34,13 @@ namespace CalamityMod.Items.Armor.Aerospec Item.defense = 2; //13 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), AerospecBreastplate.SetBonusHurtDamageThreshold); var modPlayer = player.Calamity(); modPlayer.valkyrie = true; modPlayer.aeroSet = true; @@ -57,14 +61,14 @@ namespace CalamityMod.Items.Armor.Aerospec Main.projectile[p].originalDamage = ValkyrieDamage; } } - player.GetDamage() += 0.11f; - player.maxMinions++; + player.GetDamage() += SetBonusSummonDamageBoost; + player.maxMinions += SetBonusMinionSlotBoost; } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.05f; - player.GetDamage() += 0.1f; + player.moveSpeed += MoveSpeedBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() @@ -74,7 +78,7 @@ namespace CalamityMod.Items.Armor.Aerospec AddIngredient(ItemID.SunplateBlock, 3). AddIngredient(ItemID.Feather). AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Aerospec/AerospecHelmet.png b/Items/Armor/Aerospec/AerospecHeadSummon.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelmet.png rename to Items/Armor/Aerospec/AerospecHeadSummon.png diff --git a/Items/Armor/Aerospec/AerospecHelmet_Head.png b/Items/Armor/Aerospec/AerospecHeadSummon_Head.png similarity index 100% rename from Items/Armor/Aerospec/AerospecHelmet_Head.png rename to Items/Armor/Aerospec/AerospecHeadSummon_Head.png diff --git a/Items/Armor/Aerospec/AerospecHelm.cs b/Items/Armor/Aerospec/AerospecHelm.cs deleted file mode 100644 index 0a8e39c35d..0000000000 --- a/Items/Armor/Aerospec/AerospecHelm.cs +++ /dev/null @@ -1,59 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Aerospec -{ - [AutoloadEquip(EquipType.Head)] - public class AerospecHelm : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - Item.defense = 7; //20 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.aeroSet = true; - player.noFallDmg = true; - player.moveSpeed += 0.05f; - player.GetCritChance() += 5; - player.aggro += 300; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(ItemID.SunplateBlock, 3). - AddIngredient(ItemID.Feather). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Aerospec/AerospecLeggings.cs b/Items/Armor/Aerospec/AerospecLeggings.cs index e28d5c8641..f035355c2f 100644 --- a/Items/Armor/Aerospec/AerospecLeggings.cs +++ b/Items/Armor/Aerospec/AerospecLeggings.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Aerospec @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Armor.Aerospec public class AerospecLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float MoveSpeedBoost = 0.12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -18,10 +23,7 @@ namespace CalamityMod.Items.Armor.Aerospec Item.defense = 6; } - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.12f; - } + public override void UpdateEquip(Player player) => player.moveSpeed += MoveSpeedBoost; public override void AddRecipes() { diff --git a/Items/Armor/Astral/AstralBreastplate.cs b/Items/Armor/Astral/AstralBreastplate.cs index 0efb6e01dc..84468763e7 100644 --- a/Items/Armor/Astral/AstralBreastplate.cs +++ b/Items/Armor/Astral/AstralBreastplate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Astral @@ -9,6 +10,12 @@ namespace CalamityMod.Items.Armor.Astral public class AstralBreastplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MaxManaBoost = 80; + public static float AmmoReduction = 0.75f; + public static float DamageBoost = 0.07f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -20,9 +27,10 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { - player.statLifeMax2 += 20; - player.statManaMax2 += 80; - player.GetDamage() += 0.07f; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.statManaMax2 += MaxManaBoost; + player.GetDamage() += DamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralHelm.cs b/Items/Armor/Astral/AstralHelm.cs index 35c40f89a9..0bb64452ac 100644 --- a/Items/Armor/Astral/AstralHelm.cs +++ b/Items/Armor/Astral/AstralHelm.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Astral @@ -10,6 +11,18 @@ namespace CalamityMod.Items.Armor.Astral public class AstralHelm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.05f; + public static int CritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 3; + public static float SetBonusDamageBoost = 0.1f; + public static int SetBonusCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public static int StarRainCooldown = CalamityUtils.SecondsToFrames(1); + public static int StarDamage = 120; + public override void SetDefaults() { Item.width = 18; @@ -31,20 +44,20 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusDamageBoost.ToPercent(), StarRainCooldown.FramesToSeconds()); var modPlayer = player.Calamity(); modPlayer.astralStarRain = true; modPlayer.omniscience = true; - player.GetDamage() += 0.1f; - player.maxMinions += 3; - player.GetCritChance() += 10; + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusDamageBoost; + player.GetCritChance() += SetBonusCritBoost; player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; - player.GetCritChance() += 10; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Astral/AstralLeggings.cs b/Items/Armor/Astral/AstralLeggings.cs index 3a717b7f0c..16c64551ce 100644 --- a/Items/Armor/Astral/AstralLeggings.cs +++ b/Items/Armor/Astral/AstralLeggings.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Astral @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Armor.Astral public class AstralLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.05f; + public static float MoveSpeedBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -20,8 +26,8 @@ namespace CalamityMod.Items.Armor.Astral public override void UpdateEquip(Player player) { - player.moveSpeed += 0.15f; - player.GetDamage() += 0.05f; + player.GetDamage() += DamageBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaBodyArmor.cs b/Items/Armor/Auric/AuricTeslaBodyArmor.cs index f3b1a5205e..9d5c5ff701 100644 --- a/Items/Armor/Auric/AuricTeslaBodyArmor.cs +++ b/Items/Armor/Auric/AuricTeslaBodyArmor.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Auric @@ -17,7 +18,6 @@ namespace CalamityMod.Items.Armor.Auric [AutoloadEquip(EquipType.Body)] public class AuricTeslaBodyArmor : ModItem, ILocalizedModType { - public static int setBonusTooltipNumber = 0; //Set this to zero so the first Shift pressed will increment it to 1. public static bool holdingShift = false; public static Color tooltipTarragonColor = new(194, 255, 194); @@ -25,6 +25,11 @@ namespace CalamityMod.Items.Armor.Auric public static Color tooltipSilvaColor = new(246, 255, 194); public static Color tooltipGodslayerColor = new(204, 194, 255); public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.16f; + public static int CritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + public override void Load() { // All code below runs only if we're not loading on a server @@ -40,17 +45,16 @@ namespace CalamityMod.Items.Armor.Auric Item.width = 38; Item.height = 34; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 48; - Item.rare = ModContent.RarityType(); + Item.defense = 44; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - player.statLifeMax2 += 100; - player.GetDamage() += 0.08f; - player.GetCritChance() += 5; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } + public override void ModifyTooltips(List tooltips) { //This just runs the ModifyTooltips for whatever helmet is equipped if a full auric set is equipped; but runs it on this item's tooltips. diff --git a/Items/Armor/Auric/AuricTeslaCuisses.cs b/Items/Armor/Auric/AuricTeslaCuisses.cs index 267e888e12..82d63d49bb 100644 --- a/Items/Armor/Auric/AuricTeslaCuisses.cs +++ b/Items/Armor/Auric/AuricTeslaCuisses.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.IO; using CalamityMod.Items.Armor.Bloodflare; using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Armor.Silva; @@ -6,9 +7,13 @@ using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; +using Terraria.ModLoader.IO; namespace CalamityMod.Items.Armor.Auric { @@ -16,22 +21,65 @@ namespace CalamityMod.Items.Armor.Auric public class AuricTeslaCuisses : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.12f; + public static int CritBoost = 10; + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.defense = 42; + Item.rare = ModContent.RarityType(); } + #region Toggleable Magic Carpet + + bool toggleEnabled = true; + + public override bool CanRightClick() => Main.keyState.PressingShift(); + public override void RightClick(Player player) + { + toggleEnabled = !toggleEnabled; + Item.NetStateChanged(); + } + public override bool ConsumeItem(Player player) => false; + public override void SaveData(TagCompound tag) + { + tag.Add("toggleEffect", toggleEnabled); + } + + public override void LoadData(TagCompound tag) + { + toggleEnabled = tag.GetBool("toggleEffect"); + } + + public override void NetSend(BinaryWriter writer) + { + writer.Write(toggleEnabled); + } + + public override void NetReceive(BinaryReader reader) + { + toggleEnabled = reader.ReadBoolean(); + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + CalamityUtils.DrawInventoryDot(spriteBatch, position, new Vector2(16, 16) * Main.inventoryScale, toggleEnabled); + } +#endregion public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; - player.carpet = true; - player.GetDamage() += 0.12f; - player.GetCritChance() += 5; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; + player.carpet = toggleEnabled; } + public override void ModifyTooltips(List tooltips) { //This just runs the ModifyTooltips for whatever helmet is equipped if a full auric set is equipped; but runs it on this item's tooltips. @@ -43,6 +91,9 @@ namespace CalamityMod.Items.Armor.Auric { Main.LocalPlayer.armor[0].ModItem.ModifyTooltips(tooltips); } + + if (!toggleEnabled) + tooltips.RemoveAll(x => x.Name == "Tooltip2"); } public override void AddRecipes() diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs b/Items/Armor/Auric/AuricTeslaHeadMagic.cs similarity index 60% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs rename to Items/Armor/Auric/AuricTeslaHeadMagic.cs index 0f8e4acdbb..7231f09ff0 100644 --- a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMagic.cs @@ -7,32 +7,37 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Bloodflare.BloodflareHeadMagic; +using static CalamityMod.Items.Armor.Silva.SilvaArmor; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaWireHemmedVisage : ModItem, ILocalizedModType + [LegacyName("AuricTeslaWireHemmedVisage")] + public class AuricTeslaHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MaxManaBoost = 100; + public static float ManaCostReduction = 0.2f; + public static float MagicDamageBoost = 0.22f; + public static int MagicCritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 24; //132 - Item.rare = ModContent.RarityType(); + Item.defense = 24; // 110 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { @@ -45,9 +50,7 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.silvaSet = true; modPlayer.silvaMage = true; modPlayer.auricSet = true; - player.thorns += 3f; - player.ignoreWater = true; - player.crimsonRegen = true; + player.crimsonRegen = true; // Inherited from Bloodflare } public override void ModifyTooltips(List tooltips) @@ -67,7 +70,10 @@ namespace CalamityMod.Items.Armor.Auric if (line.Name == "SetBonus") { Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipSilvaColor }; - line.Text = this.GetLocalizedValue($"SetBonus{setBonusTooltipNumber}"); + var LocalizedText = this.GetLocalization($"SetBonus{setBonusTooltipNumber}"); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(SetBonusRegenBoost.ToRegenPerSecond(), AccelerationBoost.ToPercent(), ReviveDuration.FramesToSeconds(), (ReviveCooldown / 60).FramesToSeconds()) + : setBonusTooltipNumber == 2 ? LocalizedText.Format(GhostBoltCooldown.FramesToSeconds(), BloodsplosionCooldown.FramesToSeconds()) + : LocalizedText.Format()); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } @@ -79,12 +85,10 @@ namespace CalamityMod.Items.Armor.Auric } public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - modPlayer.auricBoost = true; - player.manaCost *= 0.8f; - player.GetDamage() += 0.3f; - player.GetCritChance() += 20; - player.statManaMax2 += 100; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() @@ -95,7 +99,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage.png b/Items/Armor/Auric/AuricTeslaHeadMagic.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage.png rename to Items/Armor/Auric/AuricTeslaHeadMagic.png diff --git a/Items/Armor/Auric/AuricTeslaWireHemmedVisage_Head.png b/Items/Armor/Auric/AuricTeslaHeadMagic_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaWireHemmedVisage_Head.png rename to Items/Armor/Auric/AuricTeslaHeadMagic_Head.png diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs b/Items/Armor/Auric/AuricTeslaHeadMelee.cs similarity index 64% rename from Items/Armor/Auric/AuricTeslaRoyalHelm.cs rename to Items/Armor/Auric/AuricTeslaHeadMelee.cs index 9a66c641ab..33839d713e 100644 --- a/Items/Armor/Auric/AuricTeslaRoyalHelm.cs +++ b/Items/Armor/Auric/AuricTeslaHeadMelee.cs @@ -10,38 +10,43 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Bloodflare.BloodflareHeadMelee; +using static CalamityMod.Items.Armor.GodSlayer.GodSlayerHeadMelee; +using static CalamityMod.Items.Armor.Tarragon.TarragonHeadMelee; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] [LegacyName("AuricTeslaHelm")] - public class AuricTeslaRoyalHelm : ModItem, ILocalizedModType + [LegacyName("AuricTeslaRoyalHelm")] + public class AuricTeslaHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MeleeDamageBoost = 0.12f; + public static float MeleeSpeedBoost = 0.28f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 1200; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 54; //132 - Item.rare = ModContent.RarityType(); + Item.defense = 54; // 140 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); - player.GetAttackSpeed() += 0.28f; modPlayer.tarraSet = true; modPlayer.tarraMelee = true; modPlayer.bloodflareSet = true; @@ -50,10 +55,8 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayerDamage = true; modPlayer.auricSet = true; modPlayer.auricSetMelee = true; - player.thorns += 3f; - player.ignoreWater = true; - player.crimsonRegen = true; - player.aggro += 1200; + player.crimsonRegen = true; // Inherited from Bloodflare + player.aggro += SetBonusAggroBoost; if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) modPlayer.DeferredDashID = GodslayerArmorDash.ID; @@ -61,11 +64,10 @@ namespace CalamityMod.Items.Armor.Auric public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - modPlayer.auricBoost = true; - player.GetDamage() += 0.2f; - player.GetCritChance() += 10; + player.GetDamage() += MeleeDamageBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } + public override void ModifyTooltips(List tooltips) { ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; @@ -84,7 +86,9 @@ namespace CalamityMod.Items.Armor.Auric { Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); - line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format() : LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString())); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(SetBonusHurtDamageThreshold, CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodSlayerChestplate.DashCooldown.FramesToSeconds()) + : setBonusTooltipNumber == 2 ? LocalizedText.Format(HitsToActivateFrenzy, FrenzyDuration.FramesToSeconds(), FrenzyMeleeDamageBoost.ToPercent(), FrenzyContactDamageReduction.ToPercent(), FrenzyCooldown.FramesToSeconds()) + : LocalizedText.Format(TarraLifeRegenBoost.ToRegenPerSecond(), CalamityUtils.GetArmorSetBonusKey(), CloakDuration.FramesToSeconds(), CloakCooldown.FramesToSeconds())); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } @@ -103,7 +107,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm.png b/Items/Armor/Auric/AuricTeslaHeadMelee.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaRoyalHelm.png rename to Items/Armor/Auric/AuricTeslaHeadMelee.png diff --git a/Items/Armor/Auric/AuricTeslaRoyalHelm_Head.png b/Items/Armor/Auric/AuricTeslaHeadMelee_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaRoyalHelm_Head.png rename to Items/Armor/Auric/AuricTeslaHeadMelee_Head.png diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs b/Items/Armor/Auric/AuricTeslaHeadRanged.cs similarity index 67% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask.cs rename to Items/Armor/Auric/AuricTeslaHeadRanged.cs index 70979a5a03..fa54b263bd 100644 --- a/Items/Armor/Auric/AuricTeslaHoodedFacemask.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRanged.cs @@ -8,32 +8,36 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Bloodflare.BloodflareHeadRanged; +using static CalamityMod.Items.Armor.GodSlayer.GodSlayerHeadRanged; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaHoodedFacemask : ModItem, ILocalizedModType + [LegacyName("AuricTeslaHoodedFacemask")] + public class AuricTeslaHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RangedDamageBoost = 0.22f; + public static int RangedCritBoost = 20; + public static float AmmoReduction = 0.7f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 40; //132 - Item.rare = ModContent.RarityType(); + Item.defense = 39; // 125 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { @@ -46,9 +50,7 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; modPlayer.auricSet = true; - player.thorns += 3f; - player.ignoreWater = true; - player.crimsonRegen = true; + player.crimsonRegen = true; // Inherited from Bloodflare if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) modPlayer.DeferredDashID = GodslayerArmorDash.ID; @@ -57,10 +59,11 @@ namespace CalamityMod.Items.Armor.Auric public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - modPlayer.auricBoost = true; - player.GetDamage() += 0.3f; - player.GetCritChance() += 30; + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } + public override void ModifyTooltips(List tooltips) { ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; @@ -79,7 +82,9 @@ namespace CalamityMod.Items.Armor.Auric { Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); - line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString()) : LocalizedText.Format()); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(ShrapnelRoundCooldown.FramesToSeconds(), CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodSlayerChestplate.DashCooldown.FramesToSeconds()) + : setBonusTooltipNumber == 2 ? LocalizedText.Format(CalamityUtils.GetArmorSetBonusKey(), SoulCooldown.FramesToSeconds(), BloodBombCooldown.FramesToSeconds()) + : LocalizedText.Format()); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } @@ -98,7 +103,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask.png b/Items/Armor/Auric/AuricTeslaHeadRanged.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask.png rename to Items/Armor/Auric/AuricTeslaHeadRanged.png diff --git a/Items/Armor/Auric/AuricTeslaHoodedFacemask_Head.png b/Items/Armor/Auric/AuricTeslaHeadRanged_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaHoodedFacemask_Head.png rename to Items/Armor/Auric/AuricTeslaHeadRanged_Head.png diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs b/Items/Armor/Auric/AuricTeslaHeadRogue.cs similarity index 61% rename from Items/Armor/Auric/AuricTeslaPlumedHelm.cs rename to Items/Armor/Auric/AuricTeslaHeadRogue.cs index 9be81d8673..6e73e4e0cc 100644 --- a/Items/Armor/Auric/AuricTeslaPlumedHelm.cs +++ b/Items/Armor/Auric/AuricTeslaHeadRogue.cs @@ -8,36 +8,44 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Bloodflare.BloodflareHeadRogue; +using static CalamityMod.Items.Armor.GodSlayer.GodSlayerHeadRogue; +using static CalamityMod.Items.Armor.Tarragon.TarragonHeadRogue; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaPlumedHelm : ModItem, ILocalizedModType + [LegacyName("AuricTeslaPlumedHelm")] + public class AuricTeslaHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.17f; + public static int RogueCritBoost = 10; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.3f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 34; //132 - Item.rare = ModContent.RarityType(); + Item.defense = 34; // 120 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth()); var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; @@ -46,11 +54,9 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; modPlayer.auricSet = true; - modPlayer.rogueStealthMax += 1.3f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.thorns += 3f; - player.ignoreWater = true; - player.crimsonRegen = true; + player.crimsonRegen = true; // Inherited from Bloodflare if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) modPlayer.DeferredDashID = GodslayerArmorDash.ID; @@ -58,12 +64,11 @@ namespace CalamityMod.Items.Armor.Auric public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - modPlayer.auricBoost = true; - player.GetDamage() += 0.2f; - player.GetCritChance() += 20; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } + public override void ModifyTooltips(List tooltips) { ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; @@ -82,7 +87,9 @@ namespace CalamityMod.Items.Armor.Auric { Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipGodslayerColor }; var LocalizedText = CalamityUtils.GetTextFromModItem(Type, $"SetBonus{setBonusTooltipNumber}"); - line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodslayerArmorDash.GodslayerCooldown) : setBonusTooltipNumber == 2 ? LocalizedText.Format() : LocalizedText.Format(CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString())); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(RogueDamageBoostAtFullHealth.ToPercent(), SetBonusHurtDamageThreshold, CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(), GodSlayerChestplate.DashCooldown.FramesToSeconds()) + : setBonusTooltipNumber == 2 ? LocalizedText.Format(DefenseBoostAboveHealthThreshold, DefenseBoostHealthThreshold.ToPercent()) + : LocalizedText.Format(CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds(), RogueDamageBoostWhileDebuffed.ToPercent())); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm.png b/Items/Armor/Auric/AuricTeslaHeadRogue.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaPlumedHelm.png rename to Items/Armor/Auric/AuricTeslaHeadRogue.png diff --git a/Items/Armor/Auric/AuricTeslaPlumedHelm_Head.png b/Items/Armor/Auric/AuricTeslaHeadRogue_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaPlumedHelm_Head.png rename to Items/Armor/Auric/AuricTeslaHeadRogue_Head.png diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs b/Items/Armor/Auric/AuricTeslaHeadSummon.cs similarity index 58% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet.cs rename to Items/Armor/Auric/AuricTeslaHeadSummon.cs index cc8ea6a873..afe538c9a8 100644 --- a/Items/Armor/Auric/AuricTeslaSpaceHelmet.cs +++ b/Items/Armor/Auric/AuricTeslaHeadSummon.cs @@ -7,36 +7,44 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Bloodflare.BloodflareHeadSummon; +using static CalamityMod.Items.Armor.Silva.SilvaArmor; namespace CalamityMod.Items.Armor.Auric { [AutoloadEquip(EquipType.Head)] - public class AuricTeslaSpaceHelmet : ModItem, ILocalizedModType + [LegacyName("AuricTeslaSpaceHelmet")] + public class AuricTeslaHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MinionSlotBoost = 2; + public static float SummonDamageBoost = 0.32f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 4; + public static float SetBonusSummonDamageBoost = 0.55f; + public static int CrystalDamage = 500; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.defense = 12; //132 - Item.rare = ModContent.RarityType(); + Item.defense = 18; // 104 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent()); var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraSummon = true; @@ -46,19 +54,17 @@ namespace CalamityMod.Items.Armor.Auric modPlayer.silvaSummon = true; modPlayer.auricSet = true; modPlayer.WearingPostMLSummonerSet = true; - player.thorns += 3f; - player.ignoreWater = true; - player.crimsonRegen = true; - player.GetDamage() += 0.75f; - player.maxMinions += 6; + player.crimsonRegen = true; // Inherited from Bloodflare + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - modPlayer.auricBoost = true; - player.GetDamage() += 0.15f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } + public override void ModifyTooltips(List tooltips) { ref var holdingShift = ref AuricTeslaBodyArmor.holdingShift; @@ -76,7 +82,10 @@ namespace CalamityMod.Items.Armor.Auric if (line.Name == "SetBonus") { Color[] armorColors = { AuricTeslaBodyArmor.tooltipTarragonColor, AuricTeslaBodyArmor.tooltipBloodflareColor, AuricTeslaBodyArmor.tooltipSilvaColor }; - line.Text = this.GetLocalizedValue($"SetBonus{setBonusTooltipNumber}"); + var LocalizedText = this.GetLocalization($"SetBonus{setBonusTooltipNumber}"); + line.Text = (setBonusTooltipNumber == 3 ? LocalizedText.Format(SetBonusRegenBoost.ToRegenPerSecond(), AccelerationBoost.ToPercent(), ReviveDuration.FramesToSeconds(), (ReviveCooldown / 60).FramesToSeconds()) + : setBonusTooltipNumber == 2 ? LocalizedText.Format(DefenseBoostBelowHealthThreshold, DefenseBoostHealthThreshold.ToPercent()) + : LocalizedText.Format()); line.OverrideColor = armorColors[setBonusTooltipNumber - 1]; } } @@ -95,7 +104,7 @@ namespace CalamityMod.Items.Armor.Auric AddIngredient(). AddIngredient(12). AddTile(). - SortBeforeFirstRecipesOf(ModContent.ItemType()). + SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet.png b/Items/Armor/Auric/AuricTeslaHeadSummon.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet.png rename to Items/Armor/Auric/AuricTeslaHeadSummon.png diff --git a/Items/Armor/Auric/AuricTeslaSpaceHelmet_Head.png b/Items/Armor/Auric/AuricTeslaHeadSummon_Head.png similarity index 100% rename from Items/Armor/Auric/AuricTeslaSpaceHelmet_Head.png rename to Items/Armor/Auric/AuricTeslaHeadSummon_Head.png diff --git a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs index c1fee61ca3..5dcf752f3e 100644 --- a/Items/Armor/Bloodflare/BloodflareBodyArmor.cs +++ b/Items/Armor/Bloodflare/BloodflareBodyArmor.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -10,20 +11,24 @@ namespace CalamityMod.Items.Armor.Bloodflare public class BloodflareBodyArmor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.12f; + public static int CritBoost = 8; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 35; + Item.defense = 36; Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.statLifeMax2 += 40; - player.GetDamage() += 0.12f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareCuisses.cs b/Items/Armor/Bloodflare/BloodflareCuisses.cs index e604477feb..b037201ed0 100644 --- a/Items/Armor/Bloodflare/BloodflareCuisses.cs +++ b/Items/Armor/Bloodflare/BloodflareCuisses.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -10,20 +11,26 @@ namespace CalamityMod.Items.Armor.Bloodflare public class BloodflareCuisses : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.1f; + public static int CritBoost = 7; + public static float MoveSpeedBoost = 0.17f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 29; + Item.defense = 28; Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.17f; - player.GetDamage() += 0.1f; - player.GetCritChance() += 7; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs index 8a4569fc13..783c0285e0 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMagic.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMagic.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -12,40 +13,49 @@ namespace CalamityMod.Items.Armor.Bloodflare public class BloodflareHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MaxManaBoost = 100; + public static float ManaCostReduction = 0.17f; + public static float MagicDamageBoost = 0.2f; + public static int MagicCritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + + // Set Bonus + public static int GhostBoltCooldown = CalamityUtils.SecondsToFrames(1.67f); + public static double GhostBoltDamageRatio = 1.3D; + public static int GhostBoltonDamageSoftcap = 2600; + public static int BloodsplosionCooldown = CalamityUtils.SecondsToFrames(2); + public static double BloodsplosionDamageRatio = 0.5D; + public static int BloodsplosionDamageSoftcap = 250; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 22; //85 + Item.defense = 18; // 82 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareMage = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(GhostBoltCooldown.FramesToSeconds(), BloodsplosionCooldown.FramesToSeconds()); player.crimsonRegen = true; } public override void UpdateEquip(Player player) { - player.manaCost *= 0.83f; - player.GetDamage() += 0.2f; - player.GetCritChance() += 10; - player.statManaMax2 += 100; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs index a65be7a702..820ab011c6 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadMelee.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadMelee.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -12,40 +13,49 @@ namespace CalamityMod.Items.Armor.Bloodflare public class BloodflareHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MeleeDamageBoost = 0.1f; + public static int MeleeCritBoost = 5; + public static float MeleeSpeedBoost = 0.18f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeCritBoost, MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 900; + public static int HitsToActivateFrenzy = 15; + public static float FrenzyMeleeDamageBoost = 0.25f; + public static int FrenzyMeleeCritBoost = 25; // NOTE: Tooltip shares this number with damage % as they're equal + public static double FrenzyContactDamageReduction = 0.5D; + public static int FrenzyDuration = CalamityUtils.SecondsToFrames(5); + public static int FrenzyCooldown = CalamityUtils.SecondsToFrames(30); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 49; //85 + Item.defense = 44; // 108 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); - player.GetAttackSpeed() += 0.18f; modPlayer.bloodflareSet = true; modPlayer.bloodflareMelee = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.aggro += SetBonusAggroBoost; + player.setBonus = this.GetLocalization("SetBonus").Format(HitsToActivateFrenzy, FrenzyDuration.FramesToSeconds(), FrenzyMeleeDamageBoost.ToPercent(), FrenzyContactDamageReduction.ToPercent(), FrenzyCooldown.FramesToSeconds()); player.crimsonRegen = true; - player.aggro += 900; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 5; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs index b8a9e4f5ef..52693da3f5 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRanged.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRanged.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -15,39 +16,47 @@ namespace CalamityMod.Items.Armor.Bloodflare public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/BloodflareRangerActivation"); + public static float RangedDamageBoost = 0.1f; + public static float AmmoReduction = 0.75f; + public static int RangedCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static int SoulCooldown = CalamityUtils.SecondsToFrames(30); + public static int SoulDamage = 300; + public static int SoulAmount = 16; + public static int BloodBombCooldown = CalamityUtils.SecondsToFrames(2.5f); + public static double BloodBombDamageRatio = 0.8D; + public static int BloodBombDamageSoftcap = 120; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 34; //85 + Item.defense = 30; // 94 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareRanged = true; - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey) + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(CalamityUtils.GetArmorSetBonusKey(), SoulCooldown.FramesToSeconds(), BloodBombCooldown.FramesToSeconds()); player.crimsonRegen = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs index fbf4e7f488..9cfac4e338 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadRogue.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadRogue.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -12,41 +13,46 @@ namespace CalamityMod.Items.Armor.Bloodflare public class BloodflareHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.15f; + public static int RogueCritBoost = 10; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.2f; + public static int DefenseBoostAboveHealthThreshold = 30; + public static float DefenseBoostHealthThreshold = 0.8f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 28; //85 + Item.defense = 26; // 90 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.bloodflareSet = true; modPlayer.bloodflareThrowing = true; - modPlayer.rogueStealthMax += 1.2f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), DefenseBoostAboveHealthThreshold, DefenseBoostHealthThreshold.ToPercent()); player.crimsonRegen = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs index 20e647a2cb..41ec5c1295 100644 --- a/Items/Armor/Bloodflare/BloodflareHeadSummon.cs +++ b/Items/Armor/Bloodflare/BloodflareHeadSummon.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Bloodflare @@ -14,24 +15,30 @@ namespace CalamityMod.Items.Armor.Bloodflare public new string LocalizationCategory => "Items.Armor.PostMoonLord"; internal static string GhostMineEntitySourceContext => "SetBonus_Calamity_BloodflareSummon"; + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 2; + public static float SetBonusSummonDamageBoost = 0.3f; + public static int MineDamage = 3750; + public static int MineCooldown = 900; + public static int DefenseBoostBelowHealthThreshold = 20; + public static float DefenseBoostHealthThreshold = 0.5f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.defense = 16; //85 + Item.defense = 12; // 76 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; public override void UpdateArmorSet(Player player) { @@ -39,15 +46,16 @@ namespace CalamityMod.Items.Armor.Bloodflare modPlayer.bloodflareSet = true; modPlayer.bloodflareSummon = true; modPlayer.WearingPostMLSummonerSet = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), DefenseBoostBelowHealthThreshold, DefenseBoostHealthThreshold.ToPercent()); player.crimsonRegen = true; - player.GetDamage() += 0.5f; - player.maxMinions += 3; + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/Brimflame/BrimflameBoots.cs b/Items/Armor/Brimflame/BrimflameBoots.cs index e7b55aacd2..76732610d6 100644 --- a/Items/Armor/Brimflame/BrimflameBoots.cs +++ b/Items/Armor/Brimflame/BrimflameBoots.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Brimflame @@ -9,19 +10,24 @@ namespace CalamityMod.Items.Armor.Brimflame public class BrimflameBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MagicDamageBoost = 0.05f; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 15; + Item.defense = 13; } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.05f; - player.GetDamage() += 0.05f; + player.GetDamage() += MagicDamageBoost; + player.moveSpeed += MoveSpeedBoost; player.fireWalk = true; } diff --git a/Items/Armor/Brimflame/BrimflameCowl.cs b/Items/Armor/Brimflame/BrimflameCowl.cs new file mode 100644 index 0000000000..a2d44ea1d9 --- /dev/null +++ b/Items/Armor/Brimflame/BrimflameCowl.cs @@ -0,0 +1,79 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Brimflame +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("BrimflameScowl")] + public class BrimflameCowl : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Hardmode"; + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/BrimflameAbility"); + + public static int MaxManaBoost = 80; + public static float ManaCostReduction = 0.1f; + public static float MagicDamageBoost = 0.1f; + public static int MagicCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent()); + + // Set Bonus + public static float SetBonusMagicDamageBoost = 0.08f; + public static int SetBonusMagicCritBoost = 8; // NOTE: Tooltip shares this number with damage % as they're equal + public static float FrenzyMagicDamageBoost = 0.4f; + public static int FrenzyDuration = CalamityUtils.SecondsToFrames(10); + public static int FrenzyCooldown = CalamityUtils.SecondsToFrames(30); + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.rare = ItemRarityID.Lime; + Item.defense = 12; + } + + public override void UpdateEquip(Player player) + { + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.buffImmune[ModContent.BuffType()] = true; + player.buffImmune[BuffID.OnFire] = true; + player.buffImmune[BuffID.Frostburn] = true; + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadowSubtle = true; + + public override void UpdateArmorSet(Player player) + { + var modPlayer = player.Calamity(); + modPlayer.brimflameSet = true; + player.GetDamage() += SetBonusMagicDamageBoost; + player.GetCritChance() += SetBonusMagicCritBoost; + Color AbilityBriefColor = Color.Lerp(new Color(250, 202, 140), new Color(227, 79, 79), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMagicDamageBoost.ToPercent(), AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), FrenzyDuration.FramesToSeconds(), FrenzyMagicDamageBoost.ToPercent(), FrenzyCooldown.FramesToSeconds()); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(2). + AddTile(TileID.MythrilAnvil). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Brimflame/BrimflameScowl.png b/Items/Armor/Brimflame/BrimflameCowl.png similarity index 100% rename from Items/Armor/Brimflame/BrimflameScowl.png rename to Items/Armor/Brimflame/BrimflameCowl.png diff --git a/Items/Armor/Brimflame/BrimflameScowl_Head.png b/Items/Armor/Brimflame/BrimflameCowl_Head.png similarity index 100% rename from Items/Armor/Brimflame/BrimflameScowl_Head.png rename to Items/Armor/Brimflame/BrimflameCowl_Head.png diff --git a/Items/Armor/Brimflame/BrimflameRobes.cs b/Items/Armor/Brimflame/BrimflameRobes.cs index 8e2ba2b87b..e729bb80ae 100644 --- a/Items/Armor/Brimflame/BrimflameRobes.cs +++ b/Items/Armor/Brimflame/BrimflameRobes.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Brimflame @@ -9,9 +10,13 @@ namespace CalamityMod.Items.Armor.Brimflame public class BrimflameRobes : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MagicDamageBoost = 0.07f; + public static int MagicCritBoost = 7; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDamageBoost.ToPercent()); + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -27,13 +32,13 @@ namespace CalamityMod.Items.Armor.Brimflame Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 15; + Item.defense = 16; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Brimflame/BrimflameScowl.cs b/Items/Armor/Brimflame/BrimflameScowl.cs deleted file mode 100644 index 24be230104..0000000000 --- a/Items/Armor/Brimflame/BrimflameScowl.cs +++ /dev/null @@ -1,94 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.Cooldowns; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Brimflame -{ - [AutoloadEquip(EquipType.Head)] - public class BrimflameScowl : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.Hardmode"; - public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/AngelicAllianceActivation"); - - // TODO -- what the fuck is this? this is not how you implement a set bonus - private bool frenzy = false; - public static int CooldownLength = 1800; - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; - Item.defense = 11; - } - - private void UpdateFrenzy(Player player) - { - var modPlayer = player.Calamity(); - if (!frenzy) - { - if (modPlayer.brimflameFrenzy) - frenzy = true; - } - else - { - if (!modPlayer.brimflameFrenzy) - { - frenzy = false; - player.AddCooldown(BrimflameFrenzy.ID, CooldownLength); - } - } - - if (frenzy) - player.GetDamage() += 0.4f; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - player.statManaMax2 += 80; - player.manaCost *= 0.9f; - player.buffImmune[ModContent.BuffType()] = true; - player.buffImmune[BuffID.OnFire] = true; - player.buffImmune[BuffID.Frostburn] = true; - UpdateFrenzy(player); - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadowSubtle = true; - } - - public override void UpdateArmorSet(Player player) - { - var modPlayer = player.Calamity(); - modPlayer.brimflameSet = true; - player.GetDamage() += 0.15f; - player.GetCritChance() += 15; - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddIngredient(2). - AddTile(TileID.MythrilAnvil). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/CirrusDress.cs b/Items/Armor/CirrusDress.cs deleted file mode 100644 index 4436d3cea4..0000000000 --- a/Items/Armor/CirrusDress.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Rarities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor -{ - [AutoloadEquip(EquipType.Body)] - public class CirrusDress : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.Hardmode"; - /* How to obtain - * 1 - Have alcohol poisoning - * 2 - Visit the Stylist while Cirrus is alive in the world - * 3 - Open her shop to find the dress - */ - - public override void Load() - { - if (!Main.dedServ) - { - EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/CirrusDress_Legs", EquipType.Legs, this); - } - } - - public override void SetStaticDefaults() - { - - if (Main.dedServ) - return; - int equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); - ArmorIDs.Body.Sets.HidesHands[equipSlot] = true; - } - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().devItem = true; - Item.defense = 8; - } - - public override void UpdateEquip(Player player) - { - player.Calamity().cirrusDress = true; - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; - } - - public override void SetMatch(bool male, ref int equipSlot, ref bool robes) - { - robes = true; - equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); - } - } -} diff --git a/Items/Armor/CirrusDress.png b/Items/Armor/CirrusDress.png deleted file mode 100644 index 8bd29e2f48..0000000000 Binary files a/Items/Armor/CirrusDress.png and /dev/null differ diff --git a/Items/Armor/CirrusDress_Body.png b/Items/Armor/CirrusDress_Body.png deleted file mode 100644 index 779ae0e094..0000000000 Binary files a/Items/Armor/CirrusDress_Body.png and /dev/null differ diff --git a/Items/Armor/CirrusDress_Legs.png b/Items/Armor/CirrusDress_Legs.png deleted file mode 100644 index 42e4842b43..0000000000 Binary files a/Items/Armor/CirrusDress_Legs.png and /dev/null differ diff --git a/Items/Armor/Daedalus/DaedalusBreastplate.cs b/Items/Armor/Daedalus/DaedalusBreastplate.cs index 9b81c403db..fd2394ccd7 100644 --- a/Items/Armor/Daedalus/DaedalusBreastplate.cs +++ b/Items/Armor/Daedalus/DaedalusBreastplate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusBreastplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.08f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); + public override void Load() { if (Main.dedServ) @@ -23,14 +28,10 @@ namespace CalamityMod.Items.Armor.Daedalus Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 19; //41 + Item.defense = 19; } - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.03f; - player.GetCritChance() += 3; - } + public override void UpdateEquip(Player player) => player.GetDamage() += DamageBoost; public override void AddRecipes() { diff --git a/Items/Armor/Daedalus/DaedalusHeadMagic.cs b/Items/Armor/Daedalus/DaedalusHeadMagic.cs index 1601c041ce..ed72e565ef 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMagic.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMagic.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -11,19 +12,27 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MaxManaBoost = 80; + public static float ManaCostReduction = 0.1f; + public static float MagicDamageBoost = 0.13f; + public static int MagicCritBoost = 7; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + + // Set Bonus + public static int AbsorptionChanceDenominator = 10; + public static float DamageAbsorptionPercent = 0.5f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 5; //35 + Item.defense = 5; // 39 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -33,18 +42,17 @@ namespace CalamityMod.Items.Armor.Daedalus public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(AbsorptionChanceDenominator.GetChanceFromDenominator(), DamageAbsorptionPercent.ToPercent()); var modPlayer = player.Calamity(); modPlayer.daedalusAbsorb = true; - player.GetDamage() += 0.05f; } public override void UpdateEquip(Player player) { - player.manaCost *= 0.9f; - player.GetDamage() += 0.13f; - player.GetCritChance() += 7; - player.statManaMax2 += 60; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Daedalus/DaedalusHeadMelee.cs b/Items/Armor/Daedalus/DaedalusHeadMelee.cs index 1b63761a78..6649f2b7b0 100644 --- a/Items/Armor/Daedalus/DaedalusHeadMelee.cs +++ b/Items/Armor/Daedalus/DaedalusHeadMelee.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -11,19 +12,27 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MeleeDamageBoost = 0.1f; + public static int MeleeCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MeleeSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 500; + public static int ReflectCooldownMin = CalamityUtils.SecondsToFrames(20); + public static int ReflectCooldownMax = CalamityUtils.SecondsToFrames(90); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 21; //51 + Item.defense = 21; // 55 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -36,14 +45,14 @@ namespace CalamityMod.Items.Armor.Daedalus player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); modPlayer.daedalusReflect = true; - player.GetAttackSpeed() += 0.1f; - player.aggro += 500; + player.aggro += SetBonusAggroBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.15f; - player.GetCritChance() += 10; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Daedalus/DaedalusHeadRanged.cs b/Items/Armor/Daedalus/DaedalusHeadRanged.cs index bf2f380bd3..5874e283de 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRanged.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRanged.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -11,19 +12,25 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RangedDamageBoost = 0.13f; + public static int RangedCritBoost = 7; + public static float AmmoReduction = 0.8f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static int ShardDamage => CalamityUtils.ScaleWithDifficulty(30); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 9; //39 + Item.defense = 9; // 43 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -36,14 +43,14 @@ namespace CalamityMod.Items.Armor.Daedalus player.setBonus = this.GetLocalizedValue("SetBonus"); var modPlayer = player.Calamity(); modPlayer.daedalusShard = true; - player.GetDamage() += 0.05f; } public override void UpdateEquip(Player player) { - player.ammoCost80 = true; - player.GetDamage() += 0.13f; - player.GetCritChance() += 7; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Daedalus/DaedalusHeadRogue.cs b/Items/Armor/Daedalus/DaedalusHeadRogue.cs index b6324b20b7..67acd42f5e 100644 --- a/Items/Armor/Daedalus/DaedalusHeadRogue.cs +++ b/Items/Armor/Daedalus/DaedalusHeadRogue.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -11,19 +12,29 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.13f; + public static int RogueCritBoost = 5; + public static float RogueVelocityBoost = 0.15f; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, RogueVelocityBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.05f; + public static int ShardCountLimit = 15; + public static double ShardDamageRatio = 0.25D; + public static int ShardDamageSoftcap = 30; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 7; //37 + Item.defense = 7; // 41 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -33,20 +44,19 @@ namespace CalamityMod.Items.Armor.Daedalus public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth()); var modPlayer = player.Calamity(); modPlayer.daedalusSplit = true; - modPlayer.rogueStealthMax += 1.05f; - player.GetDamage() += 0.05f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.Calamity().rogueVelocity += 0.15f; - player.GetDamage() += 0.13f; - player.GetCritChance() += 7; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.Calamity().rogueVelocity += RogueVelocityBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Daedalus/DaedalusHeadSummon.cs b/Items/Armor/Daedalus/DaedalusHeadSummon.cs index a772d58d53..f3746414e8 100644 --- a/Items/Armor/Daedalus/DaedalusHeadSummon.cs +++ b/Items/Armor/Daedalus/DaedalusHeadSummon.cs @@ -6,6 +6,7 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -15,6 +16,14 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 1; + public static float SetBonusSummonDamageBoost = 0.1f; public static int CrystalDamage = 95; public override void SetDefaults() @@ -23,13 +32,10 @@ namespace CalamityMod.Items.Armor.Daedalus Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 3; //33 + Item.defense = 3; // 37 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -39,7 +45,7 @@ namespace CalamityMod.Items.Armor.Daedalus public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent()); var modPlayer = player.Calamity(); modPlayer.daedalusCrystal = true; if (player.whoAmI == Main.myPlayer) @@ -57,13 +63,14 @@ namespace CalamityMod.Items.Armor.Daedalus p.originalDamage = CrystalDamage; } } - player.GetDamage() += 0.2f; - player.maxMinions += 2; + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/Daedalus/DaedalusLeggings.cs b/Items/Armor/Daedalus/DaedalusLeggings.cs index 023629f0c4..0d45fae2e7 100644 --- a/Items/Armor/Daedalus/DaedalusLeggings.cs +++ b/Items/Armor/Daedalus/DaedalusLeggings.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Daedalus @@ -9,19 +10,24 @@ namespace CalamityMod.Items.Armor.Daedalus public class DaedalusLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int CritBoost = 8; + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.defense = 15; //41 + Item.defense = 15; } public override void UpdateEquip(Player player) { - player.GetCritChance() += 3; - player.moveSpeed += 0.1f; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Demonshade/DemonshadeBreastplate.cs b/Items/Armor/Demonshade/DemonshadeBreastplate.cs index dec634e4f4..f7ed18f5e7 100644 --- a/Items/Armor/Demonshade/DemonshadeBreastplate.cs +++ b/Items/Armor/Demonshade/DemonshadeBreastplate.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Demonshade @@ -14,6 +15,13 @@ namespace CalamityMod.Items.Armor.Demonshade public new string LocalizationCategory => "Items.Armor.PostMoonLord"; public string FrontArmTexture => "CalamityMod/Items/Armor/Demonshade/DemonshadeBreastplate_Arms"; + public static int MaxManaBoost = 200; + public static float AmmoReduction = 0.7f; + public static float DamageBoost = 0.15f; + public static int CritBoost = 15; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MeleeSpeedBoost = 0.25f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, DamageBoost.ToPercent(), MeleeSpeedBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -28,12 +36,11 @@ namespace CalamityMod.Items.Armor.Demonshade { var modPlayer = player.Calamity(); modPlayer.shadeRegen = true; - player.thorns += 100f; - player.statLifeMax2 += 200; - player.statManaMax2 += 200; - player.GetDamage() += 0.15f; - player.GetCritChance() += 15; - player.GetAttackSpeed() += 0.25f; + modPlayer.ammoCost *= AmmoReduction; + player.statManaMax2 += MaxManaBoost; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Demonshade/DemonshadeGreaves.cs b/Items/Armor/Demonshade/DemonshadeGreaves.cs index 013b25a960..3a10e1a186 100644 --- a/Items/Armor/Demonshade/DemonshadeGreaves.cs +++ b/Items/Armor/Demonshade/DemonshadeGreaves.cs @@ -11,6 +11,11 @@ namespace CalamityMod.Items.Armor.Demonshade public class DemonshadeGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + // Shadow Speed... (elusive) + public static float MoveSpeedBoost = 0.3f; + public static float AccelerationBoost = 0.5f; + public override void SetDefaults() { Item.width = 18; @@ -26,7 +31,7 @@ namespace CalamityMod.Items.Armor.Demonshade { var modPlayer = player.Calamity(); modPlayer.shadowSpeed = true; - player.moveSpeed += 0.3f; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Demonshade/DemonshadeHelm.cs b/Items/Armor/Demonshade/DemonshadeHelm.cs index 2e854e84d2..8a4ddf570a 100644 --- a/Items/Armor/Demonshade/DemonshadeHelm.cs +++ b/Items/Armor/Demonshade/DemonshadeHelm.cs @@ -9,6 +9,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Demonshade @@ -20,7 +21,18 @@ namespace CalamityMod.Items.Armor.Demonshade public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DemonshadeEnrage"); internal static string ShadowScytheEntitySourceContext => "SetBonus_Calamity_Demonshade"; + public static int MinionSlotBoost = 2; + public static float DamageBoost = 0.3f; + public static int CritBoost = 15; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, DamageBoost.ToPercent(), CritBoost); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 8; + public static float SetBonusSummonDamageBoost = 1f; public static int DevilDamage = 1000; + public static int BeamDamage => CalamityUtils.ScaleWithDifficulty(300); + public static int ScytheDamage => CalamityUtils.ScaleWithDifficulty(500); + public static int EnrageDuration = CalamityUtils.SecondsToFrames(10); public static float MultDamageBoost = 0.5f; public static double MultDamageTakenBoost = 0.25D; @@ -34,10 +46,7 @@ namespace CalamityMod.Items.Armor.Demonshade Item.Calamity().devItem = true; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -47,8 +56,7 @@ namespace CalamityMod.Items.Armor.Demonshade public override void UpdateArmorSet(Player player) { - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey, (1f + MultDamageBoost).Round(), (1D + MultDamageTakenBoost).Round()); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), CalamityUtils.GetArmorSetBonusKey(), EnrageDuration.FramesToSeconds(), (1f + MultDamageBoost).Round(), (1D + MultDamageTakenBoost).Round()); var modPlayer = player.Calamity(); modPlayer.dsSetBonus = true; modPlayer.wearingRogueArmor = true; @@ -69,14 +77,15 @@ namespace CalamityMod.Items.Armor.Demonshade devil.originalDamage = DevilDamage; } } - player.GetDamage() += 1f; - player.maxMinions += 10; + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.3f; - player.GetCritChance() += 15; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/DesertProwler/DesertProwlerSet.cs b/Items/Armor/DesertProwler/DesertProwlerSet.cs index 7d7bcd3c06..650289817d 100644 --- a/Items/Armor/DesertProwler/DesertProwlerSet.cs +++ b/Items/Armor/DesertProwler/DesertProwlerSet.cs @@ -27,12 +27,19 @@ namespace CalamityMod.Items.Armor.DesertProwler public static readonly SoundStyle SmokeBombEndSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerSmokeBombEnd"); public static readonly SoundStyle CDResetSound = new("CalamityMod/Sounds/Custom/AbilitySounds/DesertProwlerCDReset"); - public static int FlatDamageBonus = 1; - public static int SmokeCooldown = 25 * 60; - public static int SmokeDuration = 5 * 60; - public static int LightsOutReset = (int)(1.5f * 60); + public static int RogueCritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueCritBoost); + + // Set Bonus + public static float SetBonusRogueStealth = 0.5f; + public static float SmokeMoveSpeedMult = 1.5f; + public static float SmokeDefenseMult = 0.75f; + public static float SmokeAggroMult = 0.5f; + public static int SmokeCooldown = CalamityUtils.SecondsToFrames(25); + public static int SmokeDuration = CalamityUtils.SecondsToFrames(5); + public static int LightsOutReset = CalamityUtils.SecondsToFrames(2); public static int FreeCrit = 200; - public static int BonusDamageCap = 100; + public static int BonusDamageCap = 200; public static bool ShroudedInSmoke(Player player, out CooldownInstance cd) { @@ -41,32 +48,13 @@ namespace CalamityMod.Items.Armor.DesertProwler return (hasSmokebombCD && cd.timeLeft > SmokeCooldown); } - public override void Load() - { - Terraria.On_Player.KeyDoubleTap += ActivateSetBonus; - } - - private void ActivateSetBonus(Terraria.On_Player.orig_KeyDoubleTap orig, Player player, int keyDir) - { - if (keyDir == (Main.ReversedUpDownArmorSetBonuses ? 1 : 0) && HasArmorSet(player) && !player.mount.Active) - { - // The set bonus can only be activated if the player does not have the cooldown. - if (!player.Calamity().cooldowns.TryGetValue(SandsmokeBomb.ID, out CooldownInstance cd)) - { - player.AddCooldown(SandsmokeBomb.ID, SmokeCooldown + SmokeDuration); - } - } - - orig(player, keyDir); - } - public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; //6 + Item.defense = 2; // 9 } public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); @@ -78,8 +66,10 @@ namespace CalamityMod.Items.Armor.DesertProwler public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalization("SetBonus").Format(FlatDamageBonus); //More gets edited in elsewhere - player.GetDamage().Flat += FlatDamageBonus; + Color AbilityBriefColor = Color.Lerp(new Color(255, 229, 156), new Color(233, 225, 198), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), FreeCrit, BonusDamageCap, LightsOutReset.FramesToSeconds()); //More gets edited in elsewhere + player.Calamity().wearingRogueArmor = true; + player.Calamity().rogueStealthMax += SetBonusRogueStealth; DesertProwlerPlayer armorPlayer = player.GetModPlayer(); armorPlayer.desertProwlerSet = true; @@ -89,9 +79,9 @@ namespace CalamityMod.Items.Armor.DesertProwler if (cd.timeLeft == SmokeCooldown + SmokeDuration) armorPlayer.SetBonusStartEffect(); - player.moveSpeed *= 1.5f; + player.moveSpeed *= SmokeMoveSpeedMult; player.invis = true; - player.aggro = (int)(player.aggro * 0.5f); + player.aggro = (int)(player.aggro * SmokeAggroMult); player.noKnockback = true; for (int i = 0; i < 2; i++) @@ -155,37 +145,10 @@ namespace CalamityMod.Items.Armor.DesertProwler dhusvtt.fadeIn = 1f; Vector2 dustVelocity = dustDirection.RotatedBy(MathHelper.PiOver2) * 0.04f * dustDistance; dhusvtt.velocity = dustVelocity; - } } - public static void ModifySetTooltips(ModItem item, List tooltips) - { - if (HasArmorSet(Main.LocalPlayer)) - { - int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); - - if (setBonusIndex != -1) - { - string dir = Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"); - TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem("AbilityBrief").Format(dir)); - setBonus1.OverrideColor = Color.Lerp(new Color(255, 229, 156), new Color(233, 225, 198), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); - tooltips.Insert(setBonusIndex + 1, setBonus1); - - TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", CalamityUtils.GetTextFromModItem("AbilityDescription").Format(FreeCrit, BonusDamageCap, LightsOutReset / 60f)); - setBonus2.OverrideColor = new Color(204, 181, 72); - tooltips.Insert(setBonusIndex + 2, setBonus2); - } - } - } - - public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); - - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 4; - player.ammoCost80 = true; - } + public override void UpdateEquip(Player player) => player.GetCritChance() += RogueCritBoost; public override void AddRecipes() { @@ -203,6 +166,9 @@ namespace CalamityMod.Items.Armor.DesertProwler public new string LocalizationCategory => "Items.Armor.PreHardmode"; public string BulkTexture => "CalamityMod/Items/Armor/DesertProwler/DesertProwlerShirt_Bulk"; + public static float RogueDamageBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent()); + public override void SetStaticDefaults() { if (Main.dedServ) @@ -220,15 +186,10 @@ namespace CalamityMod.Items.Armor.DesertProwler Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 3; + Item.defense = 4; } - public override void ModifyTooltips(List tooltips) => DesertProwlerHat.ModifySetTooltips(this, tooltips); - - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 5; - } + public override void UpdateEquip(Player player) => player.GetDamage() += RogueDamageBoost; public override void AddRecipes() { @@ -245,19 +206,23 @@ namespace CalamityMod.Items.Armor.DesertProwler public class DesertProwlerPants : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int RogueCritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueCritBoost); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 2; + Item.defense = 3; } - public override void ModifyTooltips(List tooltips) => DesertProwlerHat.ModifySetTooltips(this, tooltips); + public override void UpdateEquip(Player player) { + player.GetCritChance() += RogueCritBoost; player.buffImmune[BuffID.WindPushed] = true; - player.moveSpeed += 0.1f; } public override void AddRecipes() @@ -272,9 +237,6 @@ namespace CalamityMod.Items.Armor.DesertProwler public class DesertProwlerPlayer : ModPlayer { - public static int BastionShootDamage = 10; - public static float BastionShootSpeed = 18f; - public static int BastionShootTime = 10; internal SlotId SmokeBombSoundSlot; public bool desertProwlerSet = false; @@ -381,7 +343,7 @@ namespace CalamityMod.Items.Armor.DesertProwler { if (projectile.damage > 0 && !Main.gameMenu) { - if (projectile.owner >= 0 && DesertProwlerHat.ShroudedInSmoke(Main.player[projectile.owner], out var cd) && projectile.DamageType.CountsAsClass(DamageClass.Ranged)) + if (projectile.owner >= 0 && DesertProwlerHat.ShroudedInSmoke(Main.player[projectile.owner], out var cd) && projectile.DamageType.CountsAsClass(RogueDamageClass.Instance)) { int critPool = DesertProwlerHat.FreeCrit; diff --git a/Items/Armor/Empyrean/EmpyreanCloak.cs b/Items/Armor/Empyrean/EmpyreanCloak.cs index bf80cf38b8..4d16ffe959 100644 --- a/Items/Armor/Empyrean/EmpyreanCloak.cs +++ b/Items/Armor/Empyrean/EmpyreanCloak.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Empyrean @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.Empyrean public class EmpyreanCloak : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.12f; + public static int RogueCritBoost = 8; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost); + public override void Load() { if (!Main.dedServ) @@ -21,7 +27,6 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -36,14 +41,13 @@ namespace CalamityMod.Items.Armor.Empyrean Item.height = 18; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.defense = 27; + Item.defense = 24; } public override void UpdateEquip(Player player) { - player.statLifeMax2 += 20; - player.GetCritChance() += 7; - player.GetDamage() += 0.07f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Empyrean/EmpyreanCuisses.cs b/Items/Armor/Empyrean/EmpyreanCuisses.cs index 9480df2faf..ff7916ea14 100644 --- a/Items/Armor/Empyrean/EmpyreanCuisses.cs +++ b/Items/Armor/Empyrean/EmpyreanCuisses.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Empyrean @@ -10,20 +11,26 @@ namespace CalamityMod.Items.Armor.Empyrean public class EmpyreanCuisses : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.08f; + public static int RogueCritBoost = 8; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MoveSpeedBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.defense = 24; + Item.defense = 20; } public override void UpdateEquip(Player player) { - player.GetCritChance() += 5; - player.GetDamage() += 0.05f; - player.moveSpeed += 0.15f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Empyrean/EmpyreanMask.cs b/Items/Armor/Empyrean/EmpyreanMask.cs index 87b20de371..1bc1475cd6 100644 --- a/Items/Armor/Empyrean/EmpyreanMask.cs +++ b/Items/Armor/Empyrean/EmpyreanMask.cs @@ -1,8 +1,9 @@ -using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Empyrean @@ -12,6 +13,20 @@ namespace CalamityMod.Items.Armor.Empyrean public class EmpyreanMask : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.12f; + public static int RogueCritBoost = 7; + public static float RogueVelocityBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, RogueVelocityBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.15f; + public static int WrathDuration = CalamityUtils.SecondsToFrames(3); + public static float PermanentWrathHealthRatio = 0.5f; + public static float WrathRogueDamageBoost = 0.1f; + public static int WrathRogueCritBoost = 5; + // There's 10 or so different magic numbers polluting CalamityPlayerOnHit for each projectile. I'm not adding it. - Iris + public override void Load() { if (!Main.dedServ) @@ -25,7 +40,6 @@ namespace CalamityMod.Items.Armor.Empyrean public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -45,13 +59,10 @@ namespace CalamityMod.Items.Armor.Empyrean Item.height = 18; Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.defense = 20; //71 + Item.defense = 16; // 60 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -65,20 +76,18 @@ namespace CalamityMod.Items.Armor.Empyrean { var modPlayer = player.Calamity(); modPlayer.xerocSet = true; - modPlayer.rogueStealthMax += 1.15f; - player.setBonus = this.GetLocalizedValue("SetBonus"); - if (player.statLife <= (int)(player.statLifeMax2 * 0.5)) + modPlayer.rogueStealthMax += SetBonusRogueStealth; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth()); + if (player.statLife <= (int)(player.statLifeMax2 * PermanentWrathHealthRatio)) player.AddBuff(ModContent.BuffType(), 2); - player.GetDamage() += 0.09f; - modPlayer.rogueVelocity += 0.09f; modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.11f; - player.GetCritChance() += 11; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.Calamity().rogueVelocity += RogueVelocityBoost; } public override void AddRecipes() diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs index 33257e3b8b..1727744f85 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBoots.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.FathomSwarmer @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public class FathomSwarmerBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float SummonDamageBoost = 0.08f; + public static float SubmergedMoveSpeedBoost = 0.4f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent(), SubmergedMoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -21,19 +27,16 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.GetDamage() += SummonDamageBoost; + if (player.Calamity().countsAsAnyWet) { - player.moveSpeed += 0.4f; + player.moveSpeed += SubmergedMoveSpeedBoost; } player.ignoreWater = true; if (player.wingTime <= 0) //ignore flippers while the player can fly player.accFlipper = true; } - - - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs index be0e044c58..66e7ff78d1 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerBreastplate.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.FathomSwarmer @@ -10,9 +11,13 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public class FathomSwarmerBreastplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -33,9 +38,8 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.endurance += 0.06f; - player.maxMinions += 1; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; player.Calamity().fathomSwarmerBreastplate = true; } diff --git a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs index 5902d4e52b..59516b2629 100644 --- a/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs +++ b/Items/Armor/FathomSwarmer/FathomSwarmerVisage.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.FathomSwarmer @@ -11,6 +12,18 @@ namespace CalamityMod.Items.Armor.FathomSwarmer public class FathomSwarmerVisage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.08f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 2; + public static float SetBonusSummonDamageBoost = 0.1f; + public static float SetBonusSubmergedSummonDamageBoost = 0.2f; + public static int SetBonusSubmergedDefenseBoost = 10; + public static int SetBonusSubmergedRegenBoost = 5; + public override void SetDefaults() { Item.width = 18; @@ -20,43 +33,37 @@ namespace CalamityMod.Items.Armor.FathomSwarmer Item.defense = 8; //41 +10 underwater } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void PreUpdateVanitySet(Player player) - { - player.Calamity().fathomSwarmerTail = true; - } + public override void PreUpdateVanitySet(Player player) => player.Calamity().fathomSwarmerTail = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), SetBonusSubmergedSummonDamageBoost.ToPercent(), SetBonusSubmergedDefenseBoost, SetBonusSubmergedRegenBoost.ToRegenPerSecond()); var modPlayer = player.Calamity(); modPlayer.fathomSwarmer = true; player.spikedBoots = 2; - player.maxMinions += 2; - player.GetDamage() += 0.1f; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; + if (modPlayer.countsAsAnyWet) { - player.GetDamage() += 0.2f; - player.statDefense += 10; - player.lifeRegen += 5; + player.GetDamage() += SetBonusSubmergedSummonDamageBoost; + player.statDefense += SetBonusSubmergedDefenseBoost; + player.lifeRegen += SetBonusSubmergedRegenBoost; } } public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - player.GetDamage() += 0.08f; - player.maxMinions += 1; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; if (player.breath <= player.breathMax + 2 && !modPlayer.ZoneAbyss) { player.breath = player.breathMax + 3; } modPlayer.fathomSwarmerVisage = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) + if (player.Calamity().countsAsAnyWet) { Lighting.AddLight((int)player.Center.X / 16, (int)player.Center.Y / 16, 0.3f, 0.9f, 1.35f); } diff --git a/Items/Armor/Fearmonger/FearmongerGreathelm.cs b/Items/Armor/Fearmonger/FearmongerGreathelm.cs index 180a8fbbbd..f4c2532956 100644 --- a/Items/Armor/Fearmonger/FearmongerGreathelm.cs +++ b/Items/Armor/Fearmonger/FearmongerGreathelm.cs @@ -5,6 +5,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Fearmonger @@ -13,45 +14,52 @@ namespace CalamityMod.Items.Armor.Fearmonger public class FearmongerGreathelm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MaxManaBoost = 60; + public static float ManaCostReduction = 0.1f; + public static float SummonDamageBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 2; + public static int RegenBoostDurationPerHit = CalamityUtils.SecondsToFrames(0.17f); + public static int RegenBoostDurationLimit = CalamityUtils.SecondsToFrames(1.5f); + public static int MinionRegenBoost = 5; + public static int MinionRegenTimeBoost = 4; + public static int MinionRegenTimeFloor = 900; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 38; // 132 total - Item.rare = ModContent.RarityType(); + Item.defense = 35; // 125 + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.statManaMax2 += 60; - player.GetDamage() += 0.1f; - player.manaCost *= 0.9f; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += SummonDamageBoost; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, MinionRegenBoost.ToRegenPerSecond()); - // This bool encompasses cross-class nerf immunity, colossal life regen on minion attack, and the holiday moon DR + // This bool encompasses cross-class nerf immunity and colossal life regen on minion attack // TODO -- Fearmonger life regen from minion attacks needs some sort of cool visual effect player.Calamity().fearmongerSet = true; // All-class armors count as rogue sets, but don't grant stealth bonuses player.Calamity().wearingRogueArmor = true; player.Calamity().WearingPostMLSummonerSet = true; - player.GetDamage() += 0.2f; - player.maxMinions += 2; + player.maxMinions += SetBonusMinionSlotBoost; int[] immuneDebuffs = { BuffID.OnFire, @@ -67,7 +75,6 @@ namespace CalamityMod.Items.Armor.Fearmonger ModContent.BuffType(), BuffID.Chilled, BuffID.Frozen, - ModContent.BuffType(), }; for (var i = 0; i < immuneDebuffs.Length; ++i) player.buffImmune[immuneDebuffs[i]] = true; diff --git a/Items/Armor/Fearmonger/FearmongerGreaves.cs b/Items/Armor/Fearmonger/FearmongerGreaves.cs index 027cf9af45..fa54151a89 100644 --- a/Items/Armor/Fearmonger/FearmongerGreaves.cs +++ b/Items/Armor/Fearmonger/FearmongerGreaves.cs @@ -3,6 +3,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Fearmonger @@ -11,21 +12,24 @@ namespace CalamityMod.Items.Armor.Fearmonger public class FearmongerGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.1f; + public static float MoveSpeedBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.defense = 42; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.06f; - player.GetKnockback() += 0.5f; - player.moveSpeed += 0.1f; - player.panic = true; + player.GetDamage() += DamageBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Fearmonger/FearmongerPlateMail.cs b/Items/Armor/Fearmonger/FearmongerPlateMail.cs index 5226b1d0d7..768d743c3e 100644 --- a/Items/Armor/Fearmonger/FearmongerPlateMail.cs +++ b/Items/Armor/Fearmonger/FearmongerPlateMail.cs @@ -3,6 +3,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Fearmonger @@ -11,21 +12,28 @@ namespace CalamityMod.Items.Armor.Fearmonger public class FearmongerPlateMail : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.1f; + public static int CritBoost = 5; + public static int MaxLifeBoost = 100; + public static float DamageReductionBoost = 0.08f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, MaxLifeBoost, DamageReductionBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 50; - Item.rare = ModContent.RarityType(); + Item.defense = 48; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.statLifeMax2 += 100; - player.endurance += 0.08f; - player.GetDamage() += 0.05f; - player.GetCritChance() += 5; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.statLifeMax2 += MaxLifeBoost; + player.endurance += DamageReductionBoost; } public override void AddRecipes() diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index f5566fca6f..b4e1b3c222 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -1,6 +1,11 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Summon.Whips; +using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -9,14 +14,50 @@ namespace CalamityMod.Items.Armor public class ForbiddenCirclet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; - public const int manaCost = 60; - public const int tornadoBaseDmg = 80; - public const float tornadoBaseKB = 1f; + + public static float SummonDamageBoost = 0.1f; + public static float RogueVelocityBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent(), RogueVelocityBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 0.4f; + public static int TagDuration = CalamityUtils.SecondsToFrames(10); + public static int StormManaCost = 60; + public static int StormCooldown = 45; + public static int StormDamage = 60; + public static float StormKB = 1f; + public static int EaterSpawnCount = 6; + public static int EaterSpawnCooldown = 15; + public static int EaterDamage = 40; + + public static SummonTag summonTag = new SummonTag() + { + //These tag damage fields determine the damage of the spawned eater. The resulting number from each is added together + //So, 0.5 multiplicative and 10 flat would make the damage be 50% of the spawning hit's damage, plus 10 more. + //If you want entirely flt, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. + MultiplicativeTagDamage = 0.25f, + FlatTagDamage = 5, + AllowsWhipStacking = true, + TagOnHit = tagOnHit, + TagModifyHitEffects = SummonTag.BlankTagModifyHit, + AutoDrawTooltip = false + }; + + public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone) + { + if (Main.rand.NextBool(5)) + { + int damage = (int)Main.player[projectile.owner].GetBestClassDamage().ApplyTo(damageDone * summonTag.MultiplicativeTagDamage) + summonTag.FlatTagDamage; + Projectile.NewProjectile(projectile.GetSource_OnHit(npc), npc.Center, Main.rand.NextVector2Circular(5f, 5f), ModContent.ProjectileType(), damage, 3, projectile.owner); + } + } public override void SetStaticDefaults() { if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; + summonTag.TagItem = Type; + CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(),summonTag); } public override void SetDefaults() @@ -30,10 +71,7 @@ namespace CalamityMod.Items.Armor Item.Calamity().donorItem = true; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ItemID.AncientBattleArmorShirt && legs.type == ItemID.AncientBattleArmorPants; - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemID.AncientBattleArmorShirt && legs.type == ItemID.AncientBattleArmorPants; public override void ArmorSetShadows(Player player) { @@ -43,19 +81,18 @@ namespace CalamityMod.Items.Armor public override void UpdateArmorSet(Player player) { - int stormMana = (int)(manaCost * player.manaCost); - string hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey, stormMana); + int stormMana = (int)(StormManaCost * player.manaCost); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), CalamityUtils.GetArmorSetBonusKey(), stormMana); CalamityPlayer modPlayer = player.Calamity(); modPlayer.forbiddenCirclet = true; - modPlayer.rogueStealthMax += 0.4f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.Calamity().rogueVelocity += 0.15f; + player.GetDamage() += SummonDamageBoost; + player.Calamity().rogueVelocity += RogueVelocityBoost; } public override void AddRecipes() diff --git a/Items/Armor/GemTech/GemTechBodyArmor.cs b/Items/Armor/GemTech/GemTechBodyArmor.cs index 7b76249015..c1ac53153c 100644 --- a/Items/Armor/GemTech/GemTechBodyArmor.cs +++ b/Items/Armor/GemTech/GemTechBodyArmor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 31; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GemTech/GemTechHeadgear.cs b/Items/Armor/GemTech/GemTechHeadgear.cs index b35d684234..0d1f29c072 100644 --- a/Items/Armor/GemTech/GemTechHeadgear.cs +++ b/Items/Armor/GemTech/GemTechHeadgear.cs @@ -8,7 +8,6 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using static Microsoft.Xna.Framework.Input.Keys; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Armor.GemTech @@ -29,6 +28,7 @@ namespace CalamityMod.Items.Armor.GemTech public const float MeleeSpeedBoost = 0.26f; public const int MaxFlechettes = 8; + public static float RangedAmmoReduction = 0.7f; public const float RangedDamageBoost = 0.5f; public const float RangedCritBoost = 0.16f; @@ -61,14 +61,12 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 32; Item.defense = 14; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ItemType() && legs.type == ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); + public static bool HasArmorSet(Player player) => player.armor[0].type == ItemType() && player.armor[1].type == ItemType() && player.armor[2].type == ItemType(); public override void UpdateArmorSet(Player player) @@ -80,7 +78,8 @@ namespace CalamityMod.Items.Armor.GemTech if (player.Calamity().GemTechState.IsYellowGemActive) player.GetAttackSpeed() += MeleeSpeedBoost; - player.setBonus = "Mucho Texto"; //Replaced below + Color AbilityBriefColor = Color.Lerp(Color.White, Main.DiscoColor, 0.3f); + player.setBonus = this.GetLocalization("AbilityBrief").Format(AbilityBriefColor.Hex3()); // Added below } public static void ModifySetTooltips(ModItem item, List tooltips) @@ -91,24 +90,22 @@ namespace CalamityMod.Items.Armor.GemTech if (setBonusIndex != -1) { - tooltips[setBonusIndex].Text = CalamityUtils.GetTextValueFromModItem("AbilityBrief"); - tooltips[setBonusIndex].OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.3f); - - if (!Main.keyState.IsKeyDown(LeftShift)) + if (!Main.keyState.PressingShift()) { + setBonusIndex++; TooltipLine briefDescription = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextValueFromModItem("AbilityDescription")); briefDescription.OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.5f); - tooltips.Insert(setBonusIndex + 1, briefDescription); + tooltips.Insert(setBonusIndex, briefDescription); - TooltipLine itemDisplay = new TooltipLine(item.Mod, "CalamityMod:ExpandedDisplay", CalamityUtils.GetTextValue("Misc.ShiftToExpand")); - itemDisplay.OverrideColor = new Color(190, 190, 190); - tooltips.Add(itemDisplay); + setBonusIndex++; + TooltipLine holdShiftIndicator = new TooltipLine(item.Mod, IHoldShiftTooltipItem.ExtensionIndicatorTooltipID, CalamityUtils.GetTextValue("Misc.ShiftToExpand")); + holdShiftIndicator.OverrideColor = IHoldShiftTooltipItem.DefaultExtensionIndicatorColor; + tooltips.Insert(setBonusIndex, holdShiftIndicator); } - else { setBonusIndex++; - TooltipLine largerDescription = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem("GeneralGemInfo").Format(GemBreakDamageLowerBound, GemDamage, GemRegenTime / 60)); + TooltipLine largerDescription = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem("GeneralGemInfo").Format(GemBreakDamageLowerBound, GemDamage, GemRegenTime.FramesToSeconds())); largerDescription.OverrideColor = Color.Lerp(Color.White, Main.DiscoColor, 0.5f); tooltips.Insert(setBonusIndex, largerDescription); @@ -138,15 +135,12 @@ namespace CalamityMod.Items.Armor.GemTech tooltips.Insert(setBonusIndex, purpleGemTooltip); setBonusIndex++; - string pinkLifeRegenString = (0.5f * BaseGemLifeRegenBoost).ToString("n1"); - TooltipLine pinkGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus7", CalamityUtils.GetTextFromModItem("PinkGemInfo").Format(BaseGemDefenseBoost, pinkLifeRegenString)); + TooltipLine pinkGemTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus7", CalamityUtils.GetTextFromModItem("PinkGemInfo").Format(BaseGemDefenseBoost, BaseGemLifeRegenBoost.ToRegenPerSecond())); pinkGemTooltip.OverrideColor = new Color(255, 115, 206); tooltips.Insert(setBonusIndex, pinkGemTooltip); setBonusIndex++; - string baseLifeRegenString = (0.5f * AllGemsWeaponUseLifeRegenBoost).ToString("n1"); - string multiclassLifeRegenString = (0.5f * AllGemsMultiWeaponUseLifeRegenBoost).ToString("n1"); - TooltipLine liferegenTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus8", CalamityUtils.GetTextFromModItem("GemBonusInfo").Format(baseLifeRegenString, AllGemsLifeRegenBoostTime / 60, multiclassLifeRegenString, AllGemsMultiWeaponLifeRegenBoostTime / 60f)); + TooltipLine liferegenTooltip = new TooltipLine(item.Mod, "CalamityMod:SetBonus8", CalamityUtils.GetTextFromModItem("GemBonusInfo").Format(AllGemsWeaponUseLifeRegenBoost.ToRegenPerSecond(), AllGemsLifeRegenBoostTime.FramesToSeconds(), AllGemsMultiWeaponUseLifeRegenBoost.ToRegenPerSecond(), AllGemsMultiWeaponLifeRegenBoostTime.FramesToSeconds())); liferegenTooltip.OverrideColor = new Color(230, 230, 230); tooltips.Insert(setBonusIndex, liferegenTooltip); } diff --git a/Items/Armor/GemTech/GemTechSchynbaulds.cs b/Items/Armor/GemTech/GemTechSchynbaulds.cs index cc5f3f3323..2d404dbd19 100644 --- a/Items/Armor/GemTech/GemTechSchynbaulds.cs +++ b/Items/Armor/GemTech/GemTechSchynbaulds.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Armor.GemTech Item.height = 26; Item.defense = 24; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Armor/GodSlayer/GodSlayerChestplate.cs b/Items/Armor/GodSlayer/GodSlayerChestplate.cs index cbf664f6a8..ee29234204 100644 --- a/Items/Armor/GodSlayer/GodSlayerChestplate.cs +++ b/Items/Armor/GodSlayer/GodSlayerChestplate.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GodSlayer @@ -11,24 +12,31 @@ namespace CalamityMod.Items.Armor.GodSlayer public class GodSlayerChestplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; - public const int DashIFrames = 12; + + public static float DamageBoost = 0.15f; + public static int CritBoost = 11; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + + // Common Set Bonus + public static int DashCooldown = CalamityUtils.SecondsToFrames(45); + public static int DashDamage = 3000; + public static float DashKnockback = 15f; + public static int DashIFrames = 12; + public static int DashGodSlayerInfernoDuration = CalamityUtils.SecondsToFrames(5); public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 41; - Item.rare = ModContent.RarityType(); + Item.defense = 40; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - player.thorns += 0.5f; - player.statLifeMax2 += 60; - player.GetDamage() += 0.11f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs index f03824f29d..210163dcc5 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadMelee.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GodSlayer @@ -13,35 +14,38 @@ namespace CalamityMod.Items.Armor.GodSlayer public class GodSlayerHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MeleeDamageBoost = 0.1f; + public static int MeleeCritBoost = 5; + public static float MeleeSpeedBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeCritBoost, MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 1000; + public static int SetBonusHurtDamageThreshold = 80; + public static int DartDamage => CalamityUtils.ScaleWithDifficulty(350); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 48; //96 - Item.rare = ModContent.RarityType(); + Item.defense = 50; // 120 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); - player.GetAttackSpeed() += 0.2f; modPlayer.godSlayer = true; modPlayer.godSlayerDamage = true; var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(hotkey, GodslayerArmorDash.GodslayerCooldown); - player.thorns += 2.5f; - player.aggro += 1000; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusHurtDamageThreshold, hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds()); + player.aggro += SetBonusAggroBoost; if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { @@ -52,8 +56,9 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.14f; - player.GetCritChance() += 7; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs index 0807eb0f7a..2ebf7198d3 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRanged.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GodSlayer @@ -13,24 +14,29 @@ namespace CalamityMod.Items.Armor.GodSlayer public class GodSlayerHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RangedDamageBoost = 0.1f; + public static int RangedCritBoost = 12; + public static float AmmoReduction = 0.7f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static int ShrapnelRoundCooldown = CalamityUtils.SecondsToFrames(2.5f); + public static double ShrapnelRoundDamageRatio = 1D; + public static int ShrapnelRoundDamageSoftcap = 800; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 35; //96 - Item.rare = ModContent.RarityType(); + Item.defense = 35; // 105 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { @@ -38,7 +44,7 @@ namespace CalamityMod.Items.Armor.GodSlayer modPlayer.godSlayer = true; modPlayer.godSlayerRanged = true; var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(hotkey, GodslayerArmorDash.GodslayerCooldown); + player.setBonus = this.GetLocalization("SetBonus").Format(ShrapnelRoundCooldown.FramesToSeconds(), hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds()); if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { @@ -49,8 +55,10 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.14f; - player.GetCritChance() += 14; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs index a83dde4503..66f2f30a73 100644 --- a/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs +++ b/Items/Armor/GodSlayer/GodSlayerHeadRogue.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GodSlayer @@ -13,34 +14,42 @@ namespace CalamityMod.Items.Armor.GodSlayer public class GodSlayerHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.1f; + public static int RogueCritBoost = 12; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.2f; + public static float RogueDamageBoostAtFullHealth = 0.1f; + public static int RogueCritBoostAtFullHealth = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public static float RogueVelocityBoostAtFullHealth = 0.1f; // NOTE: Tooltip shares this number with damage % as they're equal + public static int SetBonusHurtDamageThreshold = 80; + public static int ExtraIFrames = 30; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 29; //96 - Item.rare = ModContent.RarityType(); + Item.defense = 30; // 100 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.godSlayer = true; modPlayer.godSlayerThrowing = true; - modPlayer.rogueStealthMax += 1.2f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; var hotkey = CalamityKeybinds.GodSlayerDashHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(hotkey, GodslayerArmorDash.GodslayerCooldown); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), RogueDamageBoostAtFullHealth.ToPercent(), SetBonusHurtDamageThreshold, hotkey, GodSlayerChestplate.DashCooldown.FramesToSeconds()); if (modPlayer.godSlayerDashHotKeyPressed || (player.dashDelay != 0 && modPlayer.LastUsedDashID == GodslayerArmorDash.ID)) { @@ -51,9 +60,9 @@ namespace CalamityMod.Items.Armor.GodSlayer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.14f; - player.GetCritChance() += 14; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/GodSlayer/GodSlayerLeggings.cs b/Items/Armor/GodSlayer/GodSlayerLeggings.cs index 8e6b92d140..e5dade9642 100644 --- a/Items/Armor/GodSlayer/GodSlayerLeggings.cs +++ b/Items/Armor/GodSlayer/GodSlayerLeggings.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.GodSlayer @@ -10,20 +11,26 @@ namespace CalamityMod.Items.Armor.GodSlayer public class GodSlayerLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.11f; + public static int CritBoost = 11; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 35; - Item.rare = ModContent.RarityType(); + Item.defense = 30; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; - player.GetDamage() += 0.11f; - player.GetCritChance() += 11; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicArmor.cs b/Items/Armor/Hydrothermic/HydrothermicArmor.cs index b1801d6c38..6e4f64d76f 100644 --- a/Items/Armor/Hydrothermic/HydrothermicArmor.cs +++ b/Items/Armor/Hydrothermic/HydrothermicArmor.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -13,6 +14,16 @@ namespace CalamityMod.Items.Armor.Hydrothermic internal static string VanitySmokeEntitySourceContext => "SetBonus_Calamity_Hydrothermic_Vanity"; internal static string InfernoPotionEntitySourceContext => "SetBonus_Calamity_Hydrothermic_InfernoPotionBoost"; + public static float DamageBoost = 0.13f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); + + // Common Set Bonus + public static int BlazeDamage => CalamityUtils.ScaleWithDifficulty(115); + public static float InfernoHealthThreshold = 0.5f; + public static int InfernoHitRate = 30; + public static int InfernoDamage = 50; + public static float InfernoRange = 300f; + public override void SetDefaults() { Item.width = 18; @@ -24,9 +35,9 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateEquip(Player player) { - player.statLifeMax2 += 20; - player.GetDamage() += 0.08f; - player.GetCritChance() += 4; + player.GetDamage() += DamageBoost; + player.lavaImmune = true; + player.buffImmune[BuffID.OnFire] = true; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs index 6bf014726a..7737a0066c 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMagic.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -11,6 +12,20 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MaxManaBoost = 100; + public static float ManaCostReduction = 0.15f; + public static float MagicDamageBoost = 0.12f; + public static int MagicCritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + + // Set Bonus + public static double OrbDamageRatio = 0.6D; + public static float OrbDamageCooldownMult = 0.5f; + public static double OrbHealingRatio = 0.1D; + public static double OrbHealingRatioLossPerPierce = 0.05D; + public static float OrbHealingCooldownMult = 1.25f; + public override void SetDefaults() { Item.width = 18; @@ -20,10 +35,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Item.defense = 9; //45 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -33,21 +45,18 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(HydrothermicArmor.InfernoHealthThreshold.ToPercent()); var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaMage = true; - player.GetDamage() += 0.05f; - player.manaCost *= 0.85f; } public override void UpdateEquip(Player player) { - player.statManaMax2 += 100; - player.GetDamage() += 0.12f; - player.GetCritChance() += 10; - player.lavaImmune = true; - player.buffImmune[BuffID.OnFire] = true; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs index c72ee844af..e59b8099bf 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadMelee.cs @@ -2,16 +2,28 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic { [AutoloadEquip(EquipType.Head)] [LegacyName("AtaxiaHelm")] - public class HydrothermicHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MeleeDamageBoost = 0.12f; + public static int MeleeCritBoost = 10; + public static float MeleeSpeedBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeCritBoost, MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 700; + public static int GeyserCountLimit = 3; + public static double GeyserDamageRatio = 0.15D; + public static int GeyserDamageSoftcap = 45; + public override void SetDefaults() { Item.width = 18; @@ -21,10 +33,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Item.defense = 33; //67 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -34,22 +43,18 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(HydrothermicArmor.InfernoHealthThreshold.ToPercent()); var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaGeyser = true; - player.GetAttackSpeed() += 0.15f; - player.aggro += 700; + player.aggro += SetBonusAggroBoost; } public override void UpdateEquip(Player player) { - var modPlayer = player.Calamity(); - modPlayer.ataxiaFire = true; - player.GetDamage() += 0.17f; - player.GetCritChance() += 10; - player.lavaImmune = true; - player.buffImmune[BuffID.OnFire] = true; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs index 2a34472a13..929c234733 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRanged.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -11,6 +12,16 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RangedDamageBoost = 0.12f; + public static int RangedCritBoost = 10; + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static int FlareCooldown = CalamityUtils.SecondsToFrames(0.33f); + public static double FlareDamageRatio = 0.25D; + public override void SetDefaults() { Item.width = 18; @@ -20,10 +31,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Item.defense = 15; //53 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -33,20 +41,18 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(FlareCooldown.FramesToSeconds(), HydrothermicArmor.InfernoHealthThreshold.ToPercent()); var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaBolt = true; - player.GetDamage() += 0.05f; } public override void UpdateEquip(Player player) { - player.ammoCost75 = true; - player.GetDamage() += 0.12f; - player.GetCritChance() += 10; - player.lavaImmune = true; - player.buffImmune[BuffID.OnFire] = true; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs index 67b16fb6b9..e65569ad8d 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadRogue.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -11,6 +12,19 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.12f; + public static int RogueCritBoost = 10; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.1f; + public static int VolleyCooldown = CalamityUtils.SecondsToFrames(2); + public static int VolleyDamage = 50; // Damage + (projectile damage) * Damage Ratio + public static double VolleyDamageRatio = 0.15D; + public static int VolleyDamageSoftcap = 90; + public override void SetDefaults() { Item.width = 18; @@ -20,10 +34,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Item.defense = 12; //49 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -33,22 +44,19 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), VolleyCooldown.FramesToSeconds(), HydrothermicArmor.InfernoHealthThreshold.ToPercent()); var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.ataxiaVolley = true; - modPlayer.rogueStealthMax += 1.1f; - player.GetDamage() += 0.05f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; - player.GetCritChance() += 10; - player.moveSpeed += 0.05f; - player.lavaImmune = true; - player.buffImmune[BuffID.OnFire] = true; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs index 8b736ec857..b3114d43af 100644 --- a/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs +++ b/Items/Armor/Hydrothermic/HydrothermicHeadSummon.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -14,6 +15,14 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 1; + public static float SetBonusSummonDamageBoost = 0.25f; public static int VentDamage = 190; public override void SetDefaults() @@ -25,10 +34,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic Item.defense = 6; //40 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -38,7 +44,7 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), HydrothermicArmor.InfernoHealthThreshold.ToPercent()); var modPlayer = player.Calamity(); modPlayer.ataxiaBlaze = true; modPlayer.chaosSpirit = true; @@ -58,16 +64,14 @@ namespace CalamityMod.Items.Armor.Hydrothermic Main.projectile[p].originalDamage = VentDamage; } } - player.GetDamage() += 0.4f; - player.maxMinions += 2; + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; - player.GetKnockback() += 1.5f; - player.lavaImmune = true; - player.buffImmune[BuffID.OnFire] = true; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs index 7fc86d2269..2dcac69f9c 100644 --- a/Items/Armor/Hydrothermic/HydrothermicSubligar.cs +++ b/Items/Armor/Hydrothermic/HydrothermicSubligar.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Hydrothermic @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.Hydrothermic public class HydrothermicSubligar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int CritBoost = 9; + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -21,8 +27,8 @@ namespace CalamityMod.Items.Armor.Hydrothermic public override void UpdateEquip(Player player) { - player.GetCritChance() += 5; - player.moveSpeed += 0.1f; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/LunicCorps/LunicCorpsBoots.cs b/Items/Armor/LunicCorps/LunicCorpsBoots.cs index 6844341d52..f80fe1dbed 100644 --- a/Items/Armor/LunicCorps/LunicCorpsBoots.cs +++ b/Items/Armor/LunicCorps/LunicCorpsBoots.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.LunicCorps @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Armor.LunicCorps public class LunicCorpsBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int RangedCritBoost = 7; + public static float MoveSpeedAccelerationBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedCritBoost, MoveSpeedAccelerationBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -22,8 +28,8 @@ namespace CalamityMod.Items.Armor.LunicCorps public override void UpdateEquip(Player player) { player.Calamity().lunicCorpsLegs = true; - player.moveSpeed += 0.15f; - player.GetCritChance() += 5; + player.GetCritChance() += RangedCritBoost; + player.moveSpeed += MoveSpeedAccelerationBoost; } public override void AddRecipes() diff --git a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs index 8f3b9717c3..911258eb47 100644 --- a/Items/Armor/LunicCorps/LunicCorpsHelmet.cs +++ b/Items/Armor/LunicCorps/LunicCorpsHelmet.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.Audio; using Terraria.Graphics.Effects; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.LunicCorps @@ -25,8 +26,12 @@ namespace CalamityMod.Items.Armor.LunicCorps public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/RoverDriveActivate") { Volume = 0.85f }; public static readonly SoundStyle BreakSound = new("CalamityMod/Sounds/Custom/RoverDriveBreak") { Volume = 0.75f }; - public static int ShieldDurabilityMax = 50; + public static float NonArrowDamageBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(NonArrowDamageBoost.ToPercent()); + // Set Bonus + public static float SetBonusJumpSpeedBoost = 1f; + public static int ShieldDurabilityMax = 50; // The following two values taken directly from Halo 3: // https://www.halopedia.org/Energy_shielding#Gameplay public static int ShieldRechargeDelay = CalamityUtils.SecondsToFrames(5); @@ -72,29 +77,25 @@ namespace CalamityMod.Items.Armor.LunicCorps Item.Calamity().donorItem = true; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.lunicCorpsSet = true; + Color AbilityBriefColor = Color.Lerp(new Color(240, 207, 60), new Color(70, 205, 251), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); // The localization is formatted strangely, but attempting to put the {0} on its own line will leave a blank space if given an empty string string adrenTooltip = CalamityWorld.revenge ? "\n" + this.GetLocalizedValue("ShieldAdren") : ""; - player.setBonus = this.GetLocalization("SetBonus").Format(adrenTooltip); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusJumpSpeedBoost.ToJumpSpeedPercent(), AbilityBriefColor.Hex3(), ShieldDurabilityMax, adrenTooltip, ShieldRechargeDelay.FramesToSeconds(), TotalShieldRechargeTime.FramesToSeconds()); - player.bulletDamage += 0.15f; - player.specialistDamage += 0.15f; - - player.jumpSpeedBoost += 1f; + player.jumpSpeedBoost += SetBonusJumpSpeedBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.15f; + player.bulletDamage += NonArrowDamageBoost; + player.specialistDamage += NonArrowDamageBoost; player.nightVision = true; player.detectCreature = true; } diff --git a/Items/Armor/LunicCorps/LunicCorpsVest.cs b/Items/Armor/LunicCorps/LunicCorpsVest.cs index 0eabd12224..5ddd112b9f 100644 --- a/Items/Armor/LunicCorps/LunicCorpsVest.cs +++ b/Items/Armor/LunicCorps/LunicCorpsVest.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.LunicCorps @@ -10,6 +11,12 @@ namespace CalamityMod.Items.Armor.LunicCorps public class LunicCorpsVest : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RangedDamageBoost = 0.15f; + public static int RangedCritBoost = 15; // NOTE: Tooltip shares this number with damage % as they're equal + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), (1f - AmmoReduction).ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -22,8 +29,10 @@ namespace CalamityMod.Items.Armor.LunicCorps public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; - player.GetCritChance() += 15; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs index bc1b1eaadc..ed9c3cea1c 100644 --- a/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs +++ b/Items/Armor/MarniteArchitect/MarniteArchitectSet.cs @@ -16,6 +16,7 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.GameInput; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; using static Microsoft.Xna.Framework.Input.Keys; using static Terraria.ModLoader.ModContent; @@ -32,8 +33,13 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public static readonly SoundStyle LiftGoAwaySound = new("CalamityMod/Sounds/Item/MarniteLiftUnsummon"); public static readonly SoundStyle LiftHummSound = new("CalamityMod/Sounds/Item/MarniteLiftHumm") { IsLooped = true }; + public static int TileRangeBoost = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(TileRangeBoost); + + // Set Bonus public static float LiftRaiseSpeed = 2f; public static float MaxLiftHeight = 138f; + public static float LiftHeightOffset = 22f; // Height of the lift itself minus the foot offset; 138 + 22 = 160 (10 tiles) public override void Load() { @@ -55,7 +61,7 @@ namespace CalamityMod.Items.Armor.MarniteArchitect Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 1; + Item.defense = 4; } private void ActivateLift(Terraria.On_Player.orig_QuickMount orig, Player self) @@ -86,7 +92,8 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public override void UpdateArmorSet(Player player) { - player.setBonus = "Marnite Lift"; //Replaced below + Color AbilityBriefColor = Color.Lerp(new Color(255, 243, 161), new Color(137, 162, 255), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), (MaxLiftHeight + LiftHeightOffset).ToTiles()); player.GetModPlayer().setEquipped = true; } @@ -95,32 +102,11 @@ namespace CalamityMod.Items.Armor.MarniteArchitect //Tile range is a static variable did you know that? That's quite funny. I assume it's just because its not like other players would need to know about the players reach if (Main.myPlayer == player.whoAmI) { - Player.tileRangeX += 5; - Player.tileRangeY += 5; //Extendo grip also increases vertical tile range by one less than horizontal <-- This is silly lmao + Player.tileRangeX += TileRangeBoost; + Player.tileRangeY += TileRangeBoost; //Extendo grip also increases vertical tile range by one less than horizontal <-- This is silly lmao } } - public static void ModifySetTooltips(ModItem item, List tooltips) - { - if (HasArmorSet(Main.LocalPlayer)) - { - int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); - - if (setBonusIndex != -1) - { - tooltips[setBonusIndex].Text = CalamityUtils.GetTextValueFromModItem("AbilityBrief"); - tooltips[setBonusIndex].OverrideColor = Color.Lerp(new Color(255, 243, 161), new Color(137, 162, 255), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); - - TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextValueFromModItem("AbilityDescription")); - setBonus1.OverrideColor = new Color(145, 197, 239); - tooltips.Insert(setBonusIndex + 1, setBonus1); - } - - } - } - public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); - - public override void AddRecipes() { CreateRecipe(). @@ -136,6 +122,10 @@ namespace CalamityMod.Items.Armor.MarniteArchitect public class MarniteArchitectToga : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float PlacementSpeedBoost = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(PlacementSpeedBoost.ToPercent()); + public override void Load() { if (Main.dedServ) @@ -143,30 +133,21 @@ namespace CalamityMod.Items.Armor.MarniteArchitect EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/MarniteArchitect/MarniteArchitectToga_Legs", EquipType.Legs, this); } - public override void SetStaticDefaults() - { - if (Main.dedServ) - return; - } - public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 2; + Item.defense = 5; } public override void UpdateEquip(Player player) { - player.tileSpeed += 0.5f; - player.wallSpeed += 0.5f; + player.tileSpeed += PlacementSpeedBoost; + player.wallSpeed += PlacementSpeedBoost; } - public override void ModifyTooltips(List tooltips) => MarniteArchitectHeadgear.ModifySetTooltips(this, tooltips); - - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Armor/Mollusk/MolluskShelleggings.cs b/Items/Armor/Mollusk/MolluskShelleggings.cs index 607fdb87d5..1a2fc00f6a 100644 --- a/Items/Armor/Mollusk/MolluskShelleggings.cs +++ b/Items/Armor/Mollusk/MolluskShelleggings.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Mollusk @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.Mollusk public class MolluskShelleggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.06f; + public static int CritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + public override void SetDefaults() { Item.width = 22; @@ -21,8 +27,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateEquip(Player player) { - player.GetDamage() += 0.06f; - player.GetCritChance() += 4; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; player.Calamity().molluskLegs = true; } diff --git a/Items/Armor/Mollusk/MolluskShellmet.cs b/Items/Armor/Mollusk/MolluskShellmet.cs index 180be5c2c6..dca4eca8c8 100644 --- a/Items/Armor/Mollusk/MolluskShellmet.cs +++ b/Items/Armor/Mollusk/MolluskShellmet.cs @@ -7,6 +7,7 @@ using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Mollusk @@ -15,6 +16,13 @@ namespace CalamityMod.Items.Armor.Mollusk public class MolluskShellmet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.05f; + public static int CritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + + // Set Bonus + public static float SetBonusDR = 0.1f; public static int ShellfishDamage = 140; public override void SetDefaults() @@ -29,8 +37,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateEquip(Player player) { player.ignoreWater = true; - player.GetDamage() += 0.05f; - player.GetCritChance() += 4; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; player.Calamity().molluskHelmet = true; } @@ -41,8 +49,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); - player.endurance += 0.1f; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusDR.ToPercent()); + player.endurance += SetBonusDR; player.maxMinions += 4; // These are allocated for the Shellfish minions; there is no net change in minion slots. if (player.whoAmI == Main.myPlayer) { diff --git a/Items/Armor/Mollusk/MolluskShellplate.cs b/Items/Armor/Mollusk/MolluskShellplate.cs index 881bed8097..cd0470e9d7 100644 --- a/Items/Armor/Mollusk/MolluskShellplate.cs +++ b/Items/Armor/Mollusk/MolluskShellplate.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Placeables.SunkenSea; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Mollusk @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.Mollusk public class MolluskShellplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageBoost = 0.06f; + public static int CritBoost = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + public override void SetDefaults() { Item.width = 30; @@ -21,8 +27,8 @@ namespace CalamityMod.Items.Armor.Mollusk public override void UpdateEquip(Player player) { - player.GetDamage() += 0.06f; - player.GetCritChance() += 5; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; player.Calamity().molluskChest = true; } diff --git a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs index 0f02976040..c64855988e 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueChestplate.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.OmegaBlue @@ -12,6 +13,12 @@ namespace CalamityMod.Items.Armor.OmegaBlue public class OmegaBlueChestplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float AmmoReduction = 0.75f; + public static float DamageBoost = 0.18f; + public static int CritBoost = 12; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, (1f - AmmoReduction).ToPercent()); + public override void SetStaticDefaults() { if (Main.dedServ) @@ -35,8 +42,9 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void UpdateEquip(Player player) { var modPlayer = player.Calamity(); - player.GetDamage() += 0.12f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + modPlayer.ammoCost *= AmmoReduction; modPlayer.omegaBlueChestplate = true; modPlayer.noLifeRegen = true; } diff --git a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs index 9f284fee8e..85ae39c9fb 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueHelmet.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; @@ -7,6 +8,7 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.OmegaBlue @@ -19,6 +21,18 @@ namespace CalamityMod.Items.Armor.OmegaBlue public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/OmegaBlueAbility"); + public static float DamageBoost = 0.12f; + public static int CritBoost = 14; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 2; + public static int TentacleDamage = 350; + public static float MadnessDamageBoost = 0.1f; + public static int MadnessCritBoost = 10; + public static int MadnessDuration = CalamityUtils.SecondsToFrames(5); + public static int MadnessCooldown = CalamityUtils.SecondsToFrames(25); + public override void Load() { if (!Main.dedServ) @@ -48,14 +62,11 @@ namespace CalamityMod.Items.Armor.OmegaBlue { player.ignoreWater = true; - player.GetDamage() += 0.12f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -66,11 +77,11 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void UpdateArmorSet(Player player) { - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); + Color AbilityBriefColor = Color.Lerp(new Color(255, 229, 61), new Color(110, 173, 237), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), MadnessDuration.FramesToSeconds(), MadnessDamageBoost.ToPercent(), MadnessCooldown.FramesToSeconds()); var mp = player.Calamity(); - player.maxMinions += 2; + player.maxMinions += SetBonusMinionSlotBoost; mp.wearingRogueArmor = true; mp.omegaBlueSet = true; mp.WearingPostMLSummonerSet = true; diff --git a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs index 8c853d54f7..91f0b82463 100644 --- a/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs +++ b/Items/Armor/OmegaBlue/OmegaBlueTentacles.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.OmegaBlue @@ -12,6 +13,12 @@ namespace CalamityMod.Items.Armor.OmegaBlue public class OmegaBlueTentacles : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.16f; + public static int CritBoost = 12; + public static float MoveSpeedBoost = 0.12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, MoveSpeedBoost.ToPercent()); + public override void SetStaticDefaults() { if (Main.dedServ) @@ -33,9 +40,9 @@ namespace CalamityMod.Items.Armor.OmegaBlue public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; - player.GetCritChance() += 12; - player.moveSpeed += 0.12f; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/PlagueReaper/PlagueReaperMask.cs b/Items/Armor/PlagueReaper/PlagueReaperMask.cs index c483c15e15..d0567771bb 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperMask.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperMask.cs @@ -1,11 +1,12 @@ -using CalamityMod.CalPlayer; +using System; +using CalamityMod.CalPlayer; using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.PlagueReaper @@ -16,64 +17,56 @@ namespace CalamityMod.Items.Armor.PlagueReaper public new string LocalizationCategory => "Items.Armor.Hardmode"; public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/PlagueReaperAbility"); + public static float RangedDamageBoost = 0.1f; + public static int RangedCritBoost = 8; + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static float SetBonusFlightTimeBoost = 0.05f; + public static float SetBonusPlaguedRangedDamageMult = 1.1f; + public static float BlackoutRangedDamageBoost = 0.6f; + public static int BlackoutRangedCritBoost = 20; + public static int BlackoutDuration = CalamityUtils.SecondsToFrames(5); + public static int BlackoutCooldown = CalamityUtils.SecondsToFrames(25); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; - Item.defense = 11; + Item.defense = 11; // 44 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawOutlines = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawOutlines = true; public override void UpdateArmorSet(Player player) { - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); + Color AbilityBriefColor = Color.Lerp(new Color(79, 100, 95), new Color(109, 209, 130), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusFlightTimeBoost.ToPercent(), SetBonusPlaguedRangedDamageMult, AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), BlackoutRangedDamageBoost.ToPercent(), BlackoutRangedCritBoost, BlackoutDuration.FramesToSeconds(), BlackoutCooldown.FramesToSeconds()); var modPlayer = player.Calamity(); modPlayer.plagueReaper = true; - player.ammoCost75 = true; var hasPlagueBlackoutCD = modPlayer.cooldowns.TryGetValue(PlagueBlackout.ID, out var cd); - if (hasPlagueBlackoutCD && cd.timeLeft > 1500) + if (hasPlagueBlackoutCD && cd.timeLeft > BlackoutCooldown) { player.blind = true; player.headcovered = true; player.blackout = true; - player.GetDamage() += 0.6f; //60% ranged dmg and 20% crit - player.GetCritChance() += 20; - } - - if (player.whoAmI == Main.myPlayer) - { - var source = player.GetSource_Accessory(Item); - if (player.immune) - { - if (player.miscCounter % 10 == 0) - { - var damage = (int)player.GetTotalDamage().ApplyTo(40); - - var cinder = CalamityUtils.ProjectileRain(source, player.Center, 400f, 100f, 500f, 800f, 22f, ModContent.ProjectileType(), damage, 4f, player.whoAmI); - if (cinder.whoAmI.WithinBounds(Main.maxProjectiles)) - cinder.DamageType = DamageClass.Generic; - } - } + player.GetDamage() += BlackoutRangedDamageBoost; + player.GetCritChance() += BlackoutRangedCritBoost; } } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 8; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs index 72f7fb5256..5eab566b5e 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperStriders.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperStriders.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.PlagueReaper @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Armor.PlagueReaper public class PlagueReaperStriders : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int RangedCritBoost = 8; + public static float MoveSpeedBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedCritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -20,8 +26,8 @@ namespace CalamityMod.Items.Armor.PlagueReaper public override void UpdateEquip(Player player) { - player.GetCritChance() += 3; - player.moveSpeed += 0.15f; + player.GetCritChance() += RangedCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/PlagueReaper/PlagueReaperVest.cs b/Items/Armor/PlagueReaper/PlagueReaperVest.cs index 1016e203d4..c94900de0e 100644 --- a/Items/Armor/PlagueReaper/PlagueReaperVest.cs +++ b/Items/Armor/PlagueReaper/PlagueReaperVest.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.PlagueReaper @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Armor.PlagueReaper public class PlagueReaperVest : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RangedDamageBoost = 0.16f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -21,8 +26,7 @@ namespace CalamityMod.Items.Armor.PlagueReaper public override void UpdateEquip(Player player) { - player.GetDamage() += 0.15f; - player.GetCritChance() += 5; + player.GetDamage() += RangedDamageBoost; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs index dc7245ce1a..612d748fa8 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerCarapace.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Plaguebringer @@ -11,6 +12,11 @@ namespace CalamityMod.Items.Armor.Plaguebringer public class PlaguebringerCarapace : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + public override void SetStaticDefaults() { if (Main.dedServ) @@ -26,7 +32,7 @@ namespace CalamityMod.Items.Armor.Plaguebringer { Item.width = 18; Item.height = 18; - Item.defense = 17; + Item.defense = 13; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; @@ -35,7 +41,8 @@ namespace CalamityMod.Items.Armor.Plaguebringer public override void UpdateEquip(Player player) { player.Calamity().plaguebringerCarapace = true; - player.GetDamage() += 0.15f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; player.buffImmune[ModContent.BuffType()] = true; } diff --git a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs index 488bf88d8c..1ae9a366f0 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerPistons.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerPistons.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Plaguebringer @@ -9,11 +10,17 @@ namespace CalamityMod.Items.Armor.Plaguebringer public class PlaguebringerPistons : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.15f; + public static float MoveSpeedBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; - Item.defense = 8; + Item.defense = 10; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; @@ -21,8 +28,9 @@ namespace CalamityMod.Items.Armor.Plaguebringer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.15f; - player.moveSpeed += 0.15f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; + player.moveSpeed += MoveSpeedBoost; //Flower Boots code if (player.whoAmI == Main.myPlayer && player.velocity.Y == 0f && player.grappling[0] == -1) diff --git a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs index 92ed645a33..4a9c6dae23 100644 --- a/Items/Armor/Plaguebringer/PlaguebringerVisor.cs +++ b/Items/Armor/Plaguebringer/PlaguebringerVisor.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Plaguebringer @@ -13,14 +14,23 @@ namespace CalamityMod.Items.Armor.Plaguebringer public class PlaguebringerVisor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; - public const int PlagueDashIFrames = 12; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int PlagueDashDamage = 50; + public static float PlagueDashKnockback = 3f; + public static int PlagueDashIFrames = 12; public static int BeeMinionDamage = 25; + public static int BeePlagueDuration = CalamityUtils.SecondsToFrames(5); public override void SetDefaults() { Item.width = 18; Item.height = 18; - Item.defense = 7; // 32 total + Item.defense = 9; // 32 total Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; @@ -28,19 +38,13 @@ namespace CalamityMod.Items.Armor.Plaguebringer public override void UpdateEquip(Player player) { - player.GetDamage() += 0.15f; - player.statLifeMax2 += 20; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { @@ -49,7 +53,6 @@ namespace CalamityMod.Items.Armor.Plaguebringer player.Calamity().plaguebringerPatronSet = true; player.Calamity().DashID = PlaguebringerArmorDash.ID; player.dashType = 0; - player.maxMinions += 3; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_ItemUse(Item); diff --git a/Items/Armor/Prismatic/PrismaticGreaves.cs b/Items/Armor/Prismatic/PrismaticGreaves.cs index 2af82a1c33..8a6458fd51 100644 --- a/Items/Armor/Prismatic/PrismaticGreaves.cs +++ b/Items/Armor/Prismatic/PrismaticGreaves.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Prismatic @@ -11,6 +12,14 @@ namespace CalamityMod.Items.Armor.Prismatic public class PrismaticGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MagicDamageBoost = 0.1f; + public static int MagicCritBoost = 12; + public static float NonMagicDamageDecrease = 0.2f; + public static float FlightTimeBoost = 0.1f; + public static float JumpSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDamageBoost.ToPercent(), MagicCritBoost, NonMagicDamageDecrease.ToPercent(), FlightTimeBoost.ToPercent(), JumpSpeedBoost.ToJumpSpeedPercent()); + public override void SetDefaults() { Item.width = 18; @@ -25,11 +34,11 @@ namespace CalamityMod.Items.Armor.Prismatic public override void UpdateEquip(Player player) { player.Calamity().prismaticGreaves = true; - player.GetDamage() += 0.1f; - player.GetCritChance() += 12; - player.jumpSpeedBoost += 0.1f; - player.GetDamage() -= 0.2f; - player.GetDamage() += 0.2f; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; + player.jumpSpeedBoost += JumpSpeedBoost; + player.GetDamage() -= NonMagicDamageDecrease; + player.GetDamage() += NonMagicDamageDecrease; } public override void AddRecipes() diff --git a/Items/Armor/Prismatic/PrismaticHelmet.cs b/Items/Armor/Prismatic/PrismaticHelmet.cs index d21c375da9..0088ea45b8 100644 --- a/Items/Armor/Prismatic/PrismaticHelmet.cs +++ b/Items/Armor/Prismatic/PrismaticHelmet.cs @@ -1,8 +1,11 @@ -using CalamityMod.Items.Materials; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Rarities; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Prismatic @@ -12,21 +15,32 @@ namespace CalamityMod.Items.Armor.Prismatic { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; internal static string LaserEntitySourceContext => "SetBonus_Calamity_Prismatic"; + + public static int MaxManaBoost = 80; + public static float ManaCostReduction = 0.15f; + public static float MagicDamageBoost = 0.15f; + public static int MagicCritBoost = 12; + public static float NonMagicDamageDecrease = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost, NonMagicDamageDecrease.ToPercent()); + + // Set Bonus + public static int ManaRegenBonus = 8; + public static int LaserDamage = 30; + public static int LaserDuration = CalamityUtils.SecondsToFrames(5); + public static int LaserCooldown = CalamityUtils.SecondsToFrames(30); + public override void SetDefaults() { Item.width = 18; Item.height = 18; - Item.defense = 18; //71 + Item.defense = 18; // 72 Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,20 +51,20 @@ namespace CalamityMod.Items.Armor.Prismatic public override void UpdateArmorSet(Player player) { player.Calamity().prismaticSet = true; - player.statManaMax2 += 40; - player.manaCost *= 0.85f; - player.manaRegenBonus += 8; - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey); + player.manaRegenBonus += ManaRegenBonus; + Color AbilityBriefColor = Color.Lerp(new Color(255, 106, 246), new Color(148, 145, 243), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), LaserDuration.FramesToSeconds(), LaserCooldown.FramesToSeconds()); } public override void UpdateEquip(Player player) { player.Calamity().prismaticHelmet = true; - player.GetDamage() -= 0.2f; - player.GetDamage() += 0.2f; - player.GetDamage() += 0.18f; - player.GetCritChance() += 12; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; + player.GetDamage() -= NonMagicDamageDecrease; + player.GetDamage() += NonMagicDamageDecrease; } public override void AddRecipes() diff --git a/Items/Armor/Prismatic/PrismaticRegalia.cs b/Items/Armor/Prismatic/PrismaticRegalia.cs index 05f840849e..0df8c6ea13 100644 --- a/Items/Armor/Prismatic/PrismaticRegalia.cs +++ b/Items/Armor/Prismatic/PrismaticRegalia.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables.Ores; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Prismatic @@ -11,9 +12,16 @@ namespace CalamityMod.Items.Armor.Prismatic public class PrismaticRegalia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MagicDamageBoost = 0.15f; + public static int MagicCritBoost = 15; // NOTE: Tooltip shares this number with damage % as they're equal + public static float NonMagicDamageDecrease = 0.2f; + public static int RocketChanceDenominator = 20; + public static float RocketDamageRatio = 0.25f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MagicDamageBoost.ToPercent(), NonMagicDamageDecrease.ToPercent(), RocketChanceDenominator.GetChanceFromDenominator()); + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -37,12 +45,10 @@ namespace CalamityMod.Items.Armor.Prismatic public override void UpdateEquip(Player player) { player.Calamity().prismaticRegalia = true; - player.statLifeMax2 += 20; - player.statManaMax2 += 40; - player.GetDamage() += 0.12f; - player.GetCritChance() += 15; - player.GetDamage() -= 0.2f; - player.GetDamage() += 0.2f; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; + player.GetDamage() -= NonMagicDamageDecrease; + player.GetDamage() += NonMagicDamageDecrease; } public override void AddRecipes() diff --git a/Items/Armor/Reaver/ReaverCuisses.cs b/Items/Armor/Reaver/ReaverCuisses.cs index 56c540e454..f44835ab63 100644 --- a/Items/Armor/Reaver/ReaverCuisses.cs +++ b/Items/Armor/Reaver/ReaverCuisses.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Reaver @@ -9,20 +10,20 @@ namespace CalamityMod.Items.Armor.Reaver public class ReaverCuisses : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MoveSpeedBoost = 0.12f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 22; Item.height = 18; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 14; + Item.defense = 18; } - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 5; - player.moveSpeed += 0.12f; - } + public override void UpdateEquip(Player player) => player.moveSpeed += MoveSpeedBoost; public override void AddRecipes() { diff --git a/Items/Armor/Reaver/ReaverHeadExplore.cs b/Items/Armor/Reaver/ReaverHeadExplore.cs index 116c8e422e..7348b90212 100644 --- a/Items/Armor/Reaver/ReaverHeadExplore.cs +++ b/Items/Armor/Reaver/ReaverHeadExplore.cs @@ -5,6 +5,7 @@ using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Reaver @@ -14,19 +15,26 @@ namespace CalamityMod.Items.Armor.Reaver public class ReaverHeadExplore : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float MiningSpeedBoost = 0.2f; + public static float PlacementSpeedBoost = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MiningSpeedBoost.ToPercent(), PlacementSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroReduction = 400; + public static int SetBonusTileRangeBoost = 7; + public static int SetBonusGrabRangeBoost = 246; // (2.625 + 15.375 = 18 tiles) + public override void SetDefaults() { Item.width = 22; Item.height = 22; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 7; + Item.defense = 6; // 48 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -36,30 +44,24 @@ namespace CalamityMod.Items.Armor.Reaver public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusTileRangeBoost); var modPlayer = player.Calamity(); modPlayer.reaverExplore = true; modPlayer.wearingRogueArmor = true; player.findTreasure = true; - player.aggro -= 200; - if (player.IsUnderwater()) + player.aggro -= SetBonusAggroReduction; + if (player.Calamity().countsAsAnyWet) player.gills = true; + DelegateMethods.v3_1 = new Vector3(1f, 1f, 1f); + Utils.PlotTileLine(player.Center, player.Center + player.velocity * 6f, 20f, DelegateMethods.CastLightOpen); + Utils.PlotTileLine(player.Left, player.Right, 20f, DelegateMethods.CastLightOpen); + if (player.whoAmI == Main.myPlayer) { - var source = player.GetSource_ItemUse(Item); - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); - } - // These are static variables. Awesome - Player.tileRangeX += 7; - Player.tileRangeY += 7; + Player.tileRangeX += SetBonusTileRangeBoost; + Player.tileRangeY += SetBonusTileRangeBoost; } } @@ -67,9 +69,9 @@ namespace CalamityMod.Items.Armor.Reaver { player.ignoreWater = true; player.lavaImmune = true; - player.pickSpeed -= 0.2f; - player.tileSpeed += 0.5f; - player.wallSpeed += 0.5f; + player.pickSpeed -= MiningSpeedBoost; + player.tileSpeed += PlacementSpeedBoost; + player.wallSpeed += PlacementSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Reaver/ReaverHeadMobility.cs b/Items/Armor/Reaver/ReaverHeadMobility.cs index f6f861a712..46b0326b58 100644 --- a/Items/Armor/Reaver/ReaverHeadMobility.cs +++ b/Items/Armor/Reaver/ReaverHeadMobility.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Reaver @@ -11,20 +12,25 @@ namespace CalamityMod.Items.Armor.Reaver public class ReaverHeadMobility : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; - //Jump/Flight Boosts and Movement Speed Helm + + public static float MoveSpeedBoost = 0.15f; + public static float JumpSpeedBoost = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent(), JumpSpeedBoost.ToJumpSpeedPercent()); + + public static float SetBonusFlightBoost = 0.1f; + public static float SetBonusHookBoost = 0.5f; + public static int SetBonusDashDelayReductionInterval = 3; + public override void SetDefaults() { Item.width = 24; Item.height = 28; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 13; //46 + Item.defense = 13; // 55 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,17 +43,17 @@ namespace CalamityMod.Items.Armor.Reaver var modPlayer = player.Calamity(); modPlayer.reaverSpeed = true; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusFlightBoost.ToPercent(), SetBonusHookBoost.ToPercent(), (1 / (float)SetBonusDashDelayReductionInterval).ToPercent()); player.noFallDmg = true; player.autoJump = true; - if (player.miscCounter % 3 == 2 && player.dashDelay > 0) + if (player.miscCounter % SetBonusDashDelayReductionInterval == 1 && player.dashDelay > 0) player.dashDelay--; } public override void UpdateEquip(Player player) { - player.jumpSpeedBoost += 0.5f; - player.moveSpeed += 0.15f; + player.moveSpeed += MoveSpeedBoost; + player.jumpSpeedBoost += JumpSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Reaver/ReaverHeadTank.cs b/Items/Armor/Reaver/ReaverHeadTank.cs index 0aff26f2c8..2048aa9684 100644 --- a/Items/Armor/Reaver/ReaverHeadTank.cs +++ b/Items/Armor/Reaver/ReaverHeadTank.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Reaver @@ -13,23 +14,28 @@ namespace CalamityMod.Items.Armor.Reaver public new string LocalizationCategory => "Items.Armor.Hardmode"; internal static string HealOrbEntitySourceContext => "SetBonus_Calamity_ReaverTank"; + public static int MaxLifeBoost = 50; + public static int RegenBoost = 8; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxLifeBoost, RegenBoost.ToRegenPerSecond()); + + // Set Bonus + public static int SetBonusAggroBoost = 600; + public static float SetBonusDebuffDamageReduction = 0.2f; + public static float SetBonusMobilityReduction = 0.3f; + public static int ReaverRageDuration = CalamityUtils.SecondsToFrames(5); public static int ReaverRageDefenseBoost = 5; public static float ReaverRageDamageBoost = 0.1f; - //Defense and DR Helm public override void SetDefaults() { Item.width = 28; Item.height = 30; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 30; //63 => 73 w/ set bonus (+5 w/ Reaver Rage) + Item.defense = 28; // 70 (75 with Reaver Rage) } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -40,22 +46,17 @@ namespace CalamityMod.Items.Armor.Reaver public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); - player.thorns += 0.33f; - player.moveSpeed -= 0.3f; - player.statDefense += 10; - player.lifeRegen += 3; - player.aggro += 600; + player.moveSpeed -= SetBonusMobilityReduction; + player.aggro += SetBonusAggroBoost; modPlayer.reaverDefense = true; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusDebuffDamageReduction.ToPercent(), SetBonusMobilityReduction.ToPercent(), ReaverRageDuration.FramesToSeconds()); } public override void UpdateEquip(Player player) { - player.GetDamage() -= 0.3f; - player.endurance += 0.15f; - player.Calamity().reaverRegen = true; - player.statLifeMax2 += 50; + player.statLifeMax2 += MaxLifeBoost; + player.lifeRegen += RegenBoost; } public override void AddRecipes() diff --git a/Items/Armor/Reaver/ReaverScaleMail.cs b/Items/Armor/Reaver/ReaverScaleMail.cs index 4b4f5a5f6d..90cba4743e 100644 --- a/Items/Armor/Reaver/ReaverScaleMail.cs +++ b/Items/Armor/Reaver/ReaverScaleMail.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Reaver @@ -9,9 +10,12 @@ namespace CalamityMod.Items.Armor.Reaver public class ReaverScaleMail : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float DamageReductionBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageReductionBoost.ToPercent()); + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -27,15 +31,10 @@ namespace CalamityMod.Items.Armor.Reaver Item.height = 22; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.defense = 19; + Item.defense = 24; } - public override void UpdateEquip(Player player) - { - player.statLifeMax2 += 20; - player.GetDamage() += 0.09f; - player.GetCritChance() += 4; - } + public override void UpdateEquip(Player player) => player.endurance += DamageReductionBoost; public override void AddRecipes() { diff --git a/Items/Armor/Silva/SilvaArmor.cs b/Items/Armor/Silva/SilvaArmor.cs index c9ae9d2ca9..603d51812f 100644 --- a/Items/Armor/Silva/SilvaArmor.cs +++ b/Items/Armor/Silva/SilvaArmor.cs @@ -3,7 +3,9 @@ using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; +using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Silva @@ -12,20 +14,32 @@ namespace CalamityMod.Items.Armor.Silva public class SilvaArmor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaActivation"); + public static readonly SoundStyle DispelSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaDispel"); + + public static float DamageBoost = 0.15f; + public static int CritBoost = 11; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost); + + // Common Set Bonus + public static int SetBonusRegenBoost = 6; + public static float AccelerationBoost = 0.05f; + public static int ReviveDuration = CalamityUtils.SecondsToFrames(5); + public static int ReviveCooldown = CalamityUtils.SecondsToFrames(5 * 60); + public override void SetDefaults() { Item.width = 24; Item.height = 24; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 44; - Item.rare = ModContent.RarityType(); + Item.defense = 38; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.statLifeMax2 += 80; - player.GetDamage() += 0.11f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Silva/SilvaHeadMagic.cs b/Items/Armor/Silva/SilvaHeadMagic.cs index 468d54a814..7373acd566 100644 --- a/Items/Armor/Silva/SilvaHeadMagic.cs +++ b/Items/Armor/Silva/SilvaHeadMagic.cs @@ -1,11 +1,13 @@ -using CalamityMod.CalPlayer; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Silva.SilvaArmor; namespace CalamityMod.Items.Armor.Silva { @@ -14,39 +16,46 @@ namespace CalamityMod.Items.Armor.Silva public class SilvaHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MaxManaBoost = 100; + public static float ManaCostReduction = 0.19f; + public static float MagicDamageBoost = 0.18f; + public static int MagicCritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + + // Set Bonus + public static int BurstCooldown = CalamityUtils.SecondsToFrames(5); + public static int BurstDamage = 800; // Damage + (projectile damage) * Damage Ratio + public static double BurstDamageRatio = 0.6D; + public static int BurstDamageSoftcap = 1400; + public override void SetDefaults() { Item.width = 24; Item.height = 22; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 21; //110 - Item.rare = ModContent.RarityType(); + Item.defense = 24; // 90 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.silvaSet = true; modPlayer.silvaMage = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRegenBoost.ToRegenPerSecond(), AccelerationBoost.ToPercent(), ReviveDuration.FramesToSeconds(), (ReviveCooldown / 60).FramesToSeconds()); } public override void UpdateEquip(Player player) { - player.manaCost *= 0.81f; - player.GetDamage() += 0.23f; - player.GetCritChance() += 13; - player.statManaMax2 += 100; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Silva/SilvaHeadSummon.cs b/Items/Armor/Silva/SilvaHeadSummon.cs index d6d3c29800..28e23828d6 100644 --- a/Items/Armor/Silva/SilvaHeadSummon.cs +++ b/Items/Armor/Silva/SilvaHeadSummon.cs @@ -7,9 +7,10 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; -using Terraria.Audio; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; +using static CalamityMod.Items.Armor.Silva.SilvaArmor; namespace CalamityMod.Items.Armor.Silva { @@ -19,27 +20,28 @@ namespace CalamityMod.Items.Armor.Silva { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; internal static string SilvaCrystalEntitySourceContext => "SetBonus_Calamity_SilvaSummon"; - public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaActivation"); - public static readonly SoundStyle DispelSound = new("CalamityMod/Sounds/Custom/AbilitySounds/SilvaDispel"); + + public static int MinionSlotBoost = 2; + public static float SummonDamageBoost = 0.3f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 3; + public static float SetBonusSummonDamageBoost = 0.4f; + public static int CrystalDamage = 380; public override void SetDefaults() { Item.width = 28; Item.height = 24; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 13; //110 - Item.rare = ModContent.RarityType(); + Item.defense = 18; // 84 + Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { @@ -47,12 +49,16 @@ namespace CalamityMod.Items.Armor.Silva modPlayer.silvaSet = true; modPlayer.silvaSummon = true; modPlayer.WearingPostMLSummonerSet = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - player.GetDamage() += 0.65f; - player.maxMinions += 5; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent(), SetBonusRegenBoost.ToRegenPerSecond(), AccelerationBoost.ToPercent(), ReviveDuration.FramesToSeconds(), (ReviveCooldown / 60).FramesToSeconds()); + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } - public override void UpdateEquip(Player player) => player.GetDamage() += 0.1f; + public override void UpdateEquip(Player player) + { + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; + } public override void AddRecipes() { diff --git a/Items/Armor/Silva/SilvaLeggings.cs b/Items/Armor/Silva/SilvaLeggings.cs index 2ee193c596..78a51c76c9 100644 --- a/Items/Armor/Silva/SilvaLeggings.cs +++ b/Items/Armor/Silva/SilvaLeggings.cs @@ -4,6 +4,7 @@ using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Silva @@ -12,20 +13,26 @@ namespace CalamityMod.Items.Armor.Silva public class SilvaLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.11f; + public static int CritBoost = 11; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 22; Item.height = 18; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.defense = 39; - Item.rare = ModContent.RarityType(); + Item.defense = 28; + Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; - player.GetDamage() += 0.11f; - player.GetCritChance() += 11; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index c9cc263a73..eb8c2b383c 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.SnowRuffian @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Armor.SnowRuffian public class SnowRuffianChestplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int RangedCritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedCritBoost); + public override void Load() { if (Main.dedServ) @@ -19,7 +24,6 @@ namespace CalamityMod.Items.Armor.SnowRuffian public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -35,18 +39,16 @@ namespace CalamityMod.Items.Armor.SnowRuffian Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 4; //9 + Item.defense = 5; //12 } - public override void UpdateEquip(Player player) - { - player.GetCritChance() += 3; - } + public override void UpdateEquip(Player player) => player.GetCritChance() += RangedCritBoost; public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 60). + AddIngredient(ItemID.BorealWood, 20). + AddIngredient(ItemID.Silk, 6). AddIngredient(ItemID.FlinxFur, 2). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs index 5e4137d56e..8c1bbf66ac 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs @@ -1,5 +1,6 @@ using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.SnowRuffian @@ -8,24 +9,26 @@ namespace CalamityMod.Items.Armor.SnowRuffian public class SnowRuffianGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int RangedCritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedCritBoost); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 3; //9 + Item.defense = 4; //12 } - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.05f; - } + public override void UpdateEquip(Player player) => player.GetCritChance() += RangedCritBoost; public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 40). + AddIngredient(ItemID.BorealWood, 15). + AddIngredient(ItemID.Silk, 5). AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). Register(); diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index c05014c4cb..7a54d2afea 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -1,6 +1,7 @@ using CalamityMod.CalPlayer; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.SnowRuffian @@ -9,8 +10,13 @@ namespace CalamityMod.Items.Armor.SnowRuffian public class SnowRuffianMask : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; - private bool shouldBoost = false; + public static int RangedCritBoost = 4; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedCritBoost); + + // Set Bonus + public static float GlideFallSpeedMult = 0.9f; + public static int SetBonusFrostburnDuration = CalamityUtils.SecondsToFrames(3); public override void Load() { @@ -26,70 +32,33 @@ namespace CalamityMod.Items.Armor.SnowRuffian Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; - Item.defense = 2; //9 + Item.defense = 3; // 12 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.snowRuffianSet = true; - modPlayer.rogueStealthMax += 0.5f; - player.setBonus = this.GetLocalizedValue("SetBonus"); - player.GetDamage() += 0.05f; - player.Calamity().wearingRogueArmor = true; - - if (player.controlJump) - { - player.noFallDmg = true; - player.UpdateJumpHeight(); - if (shouldBoost && !player.mount.Active) - { - player.velocity.X *= 1.1f; - shouldBoost = false; - } - - } - else if (!shouldBoost && player.velocity.Y == 0) - { - shouldBoost = true; - } + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusFrostburnDuration.FramesToSeconds()); } - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.02f; - } + public override void UpdateEquip(Player player) => player.GetCritChance() += RangedCritBoost; public override void AddRecipes() { CreateRecipe(). - AddRecipeGroup("AnySnowBlock", 20). + AddIngredient(ItemID.BorealWood, 10). + AddIngredient(ItemID.Silk, 4). AddIngredient(ItemID.FlinxFur). AddTile(TileID.Anvils). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } } + public class SnowRuffianWings : EquipTexture { - public override void VerticalWingSpeeds(Player player, ref float ascentWhenFalling, ref float ascentWhenRising, ref float maxCanAscendMultiplier, ref float maxAscentMultiplier, ref float constantAscend) - { - ascentWhenFalling = 0.5f; - ascentWhenRising = 0f; - maxCanAscendMultiplier = 0f; - maxAscentMultiplier = 0f; - constantAscend = 0f; - } - - public override void HorizontalWingSpeeds(Player player, ref float speed, ref float acceleration) - { - speed = 2f; - acceleration *= 1.25f; - } } } diff --git a/Items/Armor/Statigel/StatigelArmor.cs b/Items/Armor/Statigel/StatigelArmor.cs index 0ff1c28e1f..bb2ce6cdf8 100644 --- a/Items/Armor/Statigel/StatigelArmor.cs +++ b/Items/Armor/Statigel/StatigelArmor.cs @@ -2,6 +2,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -10,9 +11,16 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelArmor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int CritBoost = 5; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost); + + // Common Set Bonus + public static float SetBonusJumpSpeedBoost = 0.6f; + public static float SetBonusJumpHeightPercentBoost = 0.3334f; + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -31,14 +39,14 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 10; } - public override void UpdateEquip(Player player) => player.GetCritChance() += 5; + public override void UpdateEquip(Player player) => player.GetCritChance() += CritBoost; public override void AddRecipes() { CreateRecipe(). AddIngredient(12). AddIngredient(12). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Armor/Statigel/StatigelGreaves.cs b/Items/Armor/Statigel/StatigelGreaves.cs index ce2b1d9665..26d9f5f81b 100644 --- a/Items/Armor/Statigel/StatigelGreaves.cs +++ b/Items/Armor/Statigel/StatigelGreaves.cs @@ -2,6 +2,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float DamageBoost = 0.05f; + public static float MoveSpeedBoost = 0.05f; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -21,8 +27,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateEquip(Player player) { - player.GetDamage() += 0.05f; - player.moveSpeed += 0.05f; + player.GetDamage() += DamageBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() @@ -30,7 +36,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(7). AddIngredient(7). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Armor/Statigel/StatigelHeadMagic.cs b/Items/Armor/Statigel/StatigelHeadMagic.cs index e4c60df6fc..51097e8f85 100644 --- a/Items/Armor/Statigel/StatigelHeadMagic.cs +++ b/Items/Armor/Statigel/StatigelHeadMagic.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -12,6 +13,13 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int MaxManaBoost = 40; + public static float ManaCostReduction = 0.1f; + public static float MagicDamageBoost = 0.1f; + public static int MagicCritBoost = 7; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + public override void SetDefaults() { Item.width = 18; @@ -21,27 +29,24 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 5; //22 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.GetJumpState().Enable(); - Player.jumpHeight += 5; - player.jumpSpeedBoost += 0.6f; + Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); + player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 7; - player.manaCost *= 0.9f; - player.statManaMax2 += 40; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; + player.manaCost -= ManaCostReduction; + player.statManaMax2 += MaxManaBoost; } public override void AddRecipes() @@ -49,7 +54,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(5). AddIngredient(5). - AddTile(). + AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadMelee.cs b/Items/Armor/Statigel/StatigelHeadMelee.cs index 078d4805df..3671a6bdab 100644 --- a/Items/Armor/Statigel/StatigelHeadMelee.cs +++ b/Items/Armor/Statigel/StatigelHeadMelee.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -12,6 +13,15 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float MeleeDamageBoost = 0.1f; + public static float MeleeSpeedBoost = 0.1f; // NOTE: Tooltip shares this number with damage % as they're equal + public static int MeleeCritBoost = 7; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeCritBoost); + + // Set Bonus + public static int SetBonusAggroBoost = 400; + public override void SetDefaults() { Item.width = 18; @@ -21,27 +31,24 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 9; //27 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.GetJumpState().Enable(); - Player.jumpHeight += 5; - player.jumpSpeedBoost += 0.6f; - player.aggro += 400; + Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); + player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; + player.aggro += SetBonusAggroBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 7; - player.GetAttackSpeed() += 0.1f; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() @@ -49,7 +56,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(5). AddIngredient(5). - AddTile(). + AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadRanged.cs b/Items/Armor/Statigel/StatigelHeadRanged.cs index 25820004c8..17294e9b1d 100644 --- a/Items/Armor/Statigel/StatigelHeadRanged.cs +++ b/Items/Armor/Statigel/StatigelHeadRanged.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -12,6 +13,11 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RangedDamageBoost = 0.1f; + public static int RangedCritBoost = 7; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost); + public override void SetDefaults() { Item.width = 18; @@ -21,25 +27,22 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 7; //25 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = CalamityUtils.GetTextFromModItem("CommonSetBonus").Format(StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.GetJumpState().Enable(); - Player.jumpHeight += 5; - player.jumpSpeedBoost += 0.6f; + Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); + player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 7; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() @@ -47,7 +50,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(5). AddIngredient(5). - AddTile(). + AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadRogue.cs b/Items/Armor/Statigel/StatigelHeadRogue.cs index fab0c20533..bddb78f285 100644 --- a/Items/Armor/Statigel/StatigelHeadRogue.cs +++ b/Items/Armor/Statigel/StatigelHeadRogue.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -12,6 +13,15 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RogueDamageBoost = 0.1f; + public static int RogueCritBoost = 7; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 0.9f; + public override void SetDefaults() { Item.width = 18; @@ -21,28 +31,25 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 6; //23 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); modPlayer.statigelSet = true; player.GetJumpState().Enable(); - modPlayer.rogueStealthMax += 0.9f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - Player.jumpHeight += 5; - player.jumpSpeedBoost += 0.6f; + Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); + player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 7; - player.moveSpeed += 0.05f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() @@ -50,7 +57,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(5). AddIngredient(5). - AddTile(). + AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Statigel/StatigelHeadSummon.cs b/Items/Armor/Statigel/StatigelHeadSummon.cs index 44b9d4b2f4..19f3eea4ff 100644 --- a/Items/Armor/Statigel/StatigelHeadSummon.cs +++ b/Items/Armor/Statigel/StatigelHeadSummon.cs @@ -7,6 +7,7 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Statigel @@ -16,6 +17,13 @@ namespace CalamityMod.Items.Armor.Statigel public class StatigelHeadSummon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static float SetBonusSummonDamageBoost = 0.15f; public static int SlimeDamage = 18; public override void SetDefaults() @@ -27,22 +35,18 @@ namespace CalamityMod.Items.Armor.Statigel Item.defense = 4; //20 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusSummonDamageBoost.ToPercent(), StatigelArmor.SetBonusJumpSpeedBoost.ToJumpSpeedPercent()); var modPlayer = player.Calamity(); modPlayer.statigelSet = true; modPlayer.slimeGod = true; player.GetJumpState().Enable(); - Player.jumpHeight += 5; - player.jumpSpeedBoost += 0.6f; - player.GetDamage() += 0.18f; - player.maxMinions++; + Player.jumpHeight += (int)(StatigelArmor.SetBonusJumpHeightPercentBoost * 15); + player.jumpSpeedBoost += StatigelArmor.SetBonusJumpSpeedBoost; + player.GetDamage() += SetBonusSummonDamageBoost; if (player.whoAmI == Main.myPlayer) { var source = player.GetSource_Accessory(Item); @@ -66,7 +70,8 @@ namespace CalamityMod.Items.Armor.Statigel public override void UpdateEquip(Player player) { - player.GetKnockback() += 1.5f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() @@ -74,7 +79,7 @@ namespace CalamityMod.Items.Armor.Statigel CreateRecipe(). AddIngredient(5). AddIngredient(5). - AddTile(). + AddTile(TileID.Solidifier). SortBeforeFirstRecipesOf(ModContent.ItemType()). Register(); } diff --git a/Items/Armor/Sulphurous/SulphurousBreastplate.cs b/Items/Armor/Sulphurous/SulphurousBreastplate.cs index bf6118be31..e28b61c5e4 100644 --- a/Items/Armor/Sulphurous/SulphurousBreastplate.cs +++ b/Items/Armor/Sulphurous/SulphurousBreastplate.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Sulphurous @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Armor.Sulphurous public class SulphurousBreastplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RogueDamageBoost = 0.06f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 24; @@ -20,11 +25,7 @@ namespace CalamityMod.Items.Armor.Sulphurous Item.rare = ItemRarityID.Green; } - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.06f; - player.GetCritChance() += 4; - } + public override void UpdateEquip(Player player) => player.GetDamage() += RogueDamageBoost; public override void AddRecipes() { diff --git a/Items/Armor/Sulphurous/SulphurousHelmet.cs b/Items/Armor/Sulphurous/SulphurousHelmet.cs index 2f3b5b0f9f..d61781b6ea 100644 --- a/Items/Armor/Sulphurous/SulphurousHelmet.cs +++ b/Items/Armor/Sulphurous/SulphurousHelmet.cs @@ -1,9 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.ExtraJumps; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Sulphurous @@ -13,6 +14,15 @@ namespace CalamityMod.Items.Armor.Sulphurous public class SulphurousHelmet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int RogueCritBoost = 6; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueCritBoost); + + // Set Bonus + public static int SetBonusPoisonDuration = CalamityUtils.SecondsToFrames(1); + public static float SetBonusRogueStealth = 0.65f; + public static int BubbleDamage = 20; + public override void SetDefaults() { Item.width = 26; @@ -29,20 +39,18 @@ namespace CalamityMod.Items.Armor.Sulphurous public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), SetBonusPoisonDuration.FramesToSeconds()); var modPlayer = player.Calamity(); modPlayer.sulphurSet = true; player.GetJumpState().Enable(); - modPlayer.rogueStealthMax += 0.65f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.ignoreWater = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.04f; - player.GetCritChance() += 2; - if (player.IsUnderwater()) + player.GetCritChance() += RogueCritBoost; + if (player.Calamity().countsAsAnyWet) player.gills = true; } diff --git a/Items/Armor/Sulphurous/SulphurousLeggings.cs b/Items/Armor/Sulphurous/SulphurousLeggings.cs index ada7ef2a1b..b9ed660705 100644 --- a/Items/Armor/Sulphurous/SulphurousLeggings.cs +++ b/Items/Armor/Sulphurous/SulphurousLeggings.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Sulphurous @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Armor.Sulphurous public class SulphurousLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float RogueDamageBoost = 0.04f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 22; @@ -20,10 +25,7 @@ namespace CalamityMod.Items.Armor.Sulphurous Item.rare = ItemRarityID.Green; } - public override void UpdateEquip(Player player) - { - player.moveSpeed += Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 0.35f : 0.1f; - } + public override void UpdateEquip(Player player) => player.GetDamage() += RogueDamageBoost; public override void AddRecipes() { diff --git a/Items/Armor/Tarragon/TarragonBreastplate.cs b/Items/Armor/Tarragon/TarragonBreastplate.cs index e8f74b9a7e..f51bbea2a2 100644 --- a/Items/Armor/Tarragon/TarragonBreastplate.cs +++ b/Items/Armor/Tarragon/TarragonBreastplate.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -10,21 +11,28 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonBreastplate : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.12f; + public static int CritBoost = 8; + public static int RegenBoost = 4; + public static float DamageReductionBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), CritBoost, RegenBoost.ToRegenPerSecond(), DamageReductionBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; - Item.lifeRegen = 3; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 40; + Item.defense = 36; Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.statLifeMax2 += 40; - player.GetDamage() += 0.1f; - player.GetCritChance() += 5; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.lifeRegen += RegenBoost; + player.endurance += DamageReductionBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadMagic.cs b/Items/Armor/Tarragon/TarragonHeadMagic.cs index 1faa537056..28a39ba3ec 100644 --- a/Items/Armor/Tarragon/TarragonHeadMagic.cs +++ b/Items/Armor/Tarragon/TarragonHeadMagic.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -12,19 +13,27 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonHeadMagic : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static int MaxManaBoost = 100; + public static float ManaCostReduction = 0.15f; + public static float MagicDamageBoost = 0.15f; + public static int MagicCritBoost = 10; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MaxManaBoost, ManaCostReduction.ToPercent(), MagicDamageBoost.ToPercent(), MagicCritBoost); + + // Set Bonus + public static int CritsToSpawnLeaves = 5; + public static float LeafDamageRatio = 0.2f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 15; // 90 + Item.defense = 16; // 76 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,16 +46,15 @@ namespace CalamityMod.Items.Armor.Tarragon var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMage = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalizedValue("SetBonus"); } public override void UpdateEquip(Player player) { - player.manaCost *= 0.85f; - player.GetDamage() += 0.15f; - player.GetCritChance() += 10; - player.endurance += 0.1f; - player.statManaMax2 += 100; + player.statManaMax2 += MaxManaBoost; + player.manaCost -= ManaCostReduction; + player.GetDamage() += MagicDamageBoost; + player.GetCritChance() += MagicCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadMelee.cs b/Items/Armor/Tarragon/TarragonHeadMelee.cs index c8b34346d0..21a19642ee 100644 --- a/Items/Armor/Tarragon/TarragonHeadMelee.cs +++ b/Items/Armor/Tarragon/TarragonHeadMelee.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -12,19 +13,30 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonHeadMelee : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float MeleeDamageBoost = 0.1f; + public static int MeleeCritBoost = 5; + public static float MeleeSpeedBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MeleeDamageBoost.ToPercent(), MeleeCritBoost, MeleeSpeedBoost.ToPercent()); + + // Set Bonus + public static int SetBonusAggroBoost = 800; + public static int TarraLifeDuration = CalamityUtils.SecondsToFrames(5); + public static int TarraLifeRegenBoost = 3; + public static double CloakContactDamageReduction = 0.5D; + public static int CloakDuration = CalamityUtils.SecondsToFrames(10); + public static int CloakCooldown = CalamityUtils.SecondsToFrames(30); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 42; // 117 + Item.defense = 40; // 100 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,17 +49,15 @@ namespace CalamityMod.Items.Armor.Tarragon var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraMelee = true; - player.GetAttackSpeed() += 0.15f; - player.aggro += 800; - var hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey) + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.aggro += SetBonusAggroBoost; + player.setBonus = this.GetLocalization("SetBonus").Format(TarraLifeRegenBoost.ToRegenPerSecond(), CalamityUtils.GetArmorSetBonusKey(), CloakDuration.FramesToSeconds(), CloakCooldown.FramesToSeconds()); } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.12f; - player.GetCritChance() += 7; - player.endurance += 0.1f; + player.GetDamage() += MeleeDamageBoost; + player.GetCritChance() += MeleeCritBoost; + player.GetAttackSpeed() += MeleeSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRanged.cs b/Items/Armor/Tarragon/TarragonHeadRanged.cs index 7bc1135d98..1245b69731 100644 --- a/Items/Armor/Tarragon/TarragonHeadRanged.cs +++ b/Items/Armor/Tarragon/TarragonHeadRanged.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -12,19 +13,29 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonHeadRanged : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RangedDamageBoost = 0.1f; + public static int RangedCritBoost = 7; + public static float AmmoReduction = 0.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RangedDamageBoost.ToPercent(), RangedCritBoost, (1f - AmmoReduction).ToPercent()); + + // Set Bonus + public static int OnHitEffectCooldown = CalamityUtils.SecondsToFrames(1); + public static float LeafDamageRatio = 0.25f; + public static int LeafDamageSoftcap = 150; + public static float EnergyDamageRatio = 0.33f; + public static int EnergyDamageSoftcap = 200; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 27; // 102 + Item.defense = 28; // 88 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,14 +48,15 @@ namespace CalamityMod.Items.Armor.Tarragon var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraRanged = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalizedValue("SetBonus"); } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; - player.endurance += 0.1f; + var modPlayer = player.Calamity(); + modPlayer.ammoCost *= AmmoReduction; + player.GetDamage() += RangedDamageBoost; + player.GetCritChance() += RangedCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadRogue.cs b/Items/Armor/Tarragon/TarragonHeadRogue.cs index 31fe1ed587..3345d79518 100644 --- a/Items/Armor/Tarragon/TarragonHeadRogue.cs +++ b/Items/Armor/Tarragon/TarragonHeadRogue.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -12,19 +13,29 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonHeadRogue : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float RogueDamageBoost = 0.1f; + public static int RogueCritBoost = 7; + public static float MoveSpeedBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.15f; + public static int CritsToActivateImmunity = 50; + public static int ImmunityDuration = CalamityUtils.SecondsToFrames(2.5f); + public static int ImmunityCooldown = CalamityUtils.SecondsToFrames(25); + public static float RogueDamageBoostWhileDebuffed = 0.1f; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 20; // 95 + Item.defense = 24; // 84 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -37,17 +48,16 @@ namespace CalamityMod.Items.Armor.Tarragon var modPlayer = player.Calamity(); modPlayer.tarraSet = true; modPlayer.tarraThrowing = true; - modPlayer.rogueStealthMax += 1.15f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), CritsToActivateImmunity, ImmunityDuration.FramesToSeconds(), ImmunityCooldown.FramesToSeconds(), RogueDamageBoostWhileDebuffed.ToPercent()); } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; - player.moveSpeed += 0.05f; - player.endurance += 0.1f; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonHeadSummon.cs b/Items/Armor/Tarragon/TarragonHeadSummon.cs index b850eaea52..6b03f69d18 100644 --- a/Items/Armor/Tarragon/TarragonHeadSummon.cs +++ b/Items/Armor/Tarragon/TarragonHeadSummon.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -14,19 +15,25 @@ namespace CalamityMod.Items.Armor.Tarragon public new string LocalizationCategory => "Items.Armor.PostMoonLord"; internal static string LifeAuraEntitySourceContext => "SetBonus_Calamity_Tarragon"; + public static int MinionSlotBoost = 1; + public static float SummonDamageBoost = 0.25f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost, SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int SetBonusMinionSlotBoost = 2; + public static float SetBonusSummonDamageBoost = 0.3f; + public static int AuraDamage = 120; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 10; // 85 + Item.defense = 10; // 70 Item.rare = ModContent.RarityType(); } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void ArmorSetShadows(Player player) { @@ -40,15 +47,15 @@ namespace CalamityMod.Items.Armor.Tarragon modPlayer.tarraSet = true; modPlayer.tarraSummon = true; modPlayer.WearingPostMLSummonerSet = true; - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - player.GetDamage() += 0.5f; - player.maxMinions += 3; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusMinionSlotBoost, SetBonusSummonDamageBoost.ToPercent()); + player.maxMinions += SetBonusMinionSlotBoost; + player.GetDamage() += SetBonusSummonDamageBoost; } public override void UpdateEquip(Player player) { - player.endurance += 0.1f; - player.GetDamage() += 0.05f; + player.maxMinions += MinionSlotBoost; + player.GetDamage() += SummonDamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/Tarragon/TarragonLeggings.cs b/Items/Armor/Tarragon/TarragonLeggings.cs index fa0a9d0a61..0b9a6fad3c 100644 --- a/Items/Armor/Tarragon/TarragonLeggings.cs +++ b/Items/Armor/Tarragon/TarragonLeggings.cs @@ -2,6 +2,7 @@ using CalamityMod.Rarities; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Tarragon @@ -10,20 +11,26 @@ namespace CalamityMod.Items.Armor.Tarragon public class TarragonLeggings : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PostMoonLord"; + + public static float DamageBoost = 0.08f; + public static int CritBoost = 8; // NOTE: Tooltip shares this number with damage % as they're equal + public static float MoveSpeedBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(DamageBoost.ToPercent(), MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.defense = 35; + Item.defense = 24; Item.rare = ModContent.RarityType(); } public override void UpdateEquip(Player player) { - player.moveSpeed += 0.1f; - player.GetDamage() += 0.08f; - player.GetCritChance() += 8; + player.GetDamage() += DamageBoost; + player.GetCritChance() += CritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/TitanHeart/TitanHeartBoots.cs b/Items/Armor/TitanHeart/TitanHeartBoots.cs index ae7ef7e9f4..ee6ce3d15d 100644 --- a/Items/Armor/TitanHeart/TitanHeartBoots.cs +++ b/Items/Armor/TitanHeart/TitanHeartBoots.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.TitanHeart @@ -10,21 +11,20 @@ namespace CalamityMod.Items.Armor.TitanHeart public class TitanHeartBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.07f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.defense = 14; + Item.defense = 10; } - public override void UpdateEquip(Player player) - { - player.Calamity().titanHeartBoots = true; - player.Calamity().rogueVelocity += 0.1f; - player.GetDamage() += 0.04f; - } + public override void UpdateEquip(Player player) => player.GetDamage() += RogueDamageBoost; public override void AddRecipes() { diff --git a/Items/Armor/TitanHeart/TitanHeartMantle.cs b/Items/Armor/TitanHeart/TitanHeartMantle.cs index fbd3c17cd5..8c6546226e 100644 --- a/Items/Armor/TitanHeart/TitanHeartMantle.cs +++ b/Items/Armor/TitanHeart/TitanHeartMantle.cs @@ -1,7 +1,8 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.TitanHeart @@ -10,9 +11,13 @@ namespace CalamityMod.Items.Armor.TitanHeart public class TitanHeartMantle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.1f; + public static float RogueKnockbackBoost = 0.5f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueKnockbackBoost.ToPercent()); + public override void SetStaticDefaults() { - if (Main.dedServ) return; @@ -28,13 +33,13 @@ namespace CalamityMod.Items.Armor.TitanHeart Item.height = 18; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.defense = 17; + Item.defense = 14; } public override void UpdateEquip(Player player) { player.Calamity().titanHeartMantle = true; - player.GetDamage() += 0.05f; + player.GetDamage() += RogueDamageBoost; } public override void AddRecipes() diff --git a/Items/Armor/TitanHeart/TitanHeartMask.cs b/Items/Armor/TitanHeart/TitanHeartMask.cs index 03b99c9fa4..9c19cf421c 100644 --- a/Items/Armor/TitanHeart/TitanHeartMask.cs +++ b/Items/Armor/TitanHeart/TitanHeartMask.cs @@ -1,8 +1,9 @@ using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.TitanHeart @@ -11,27 +12,34 @@ namespace CalamityMod.Items.Armor.TitanHeart public class TitanHeartMask : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.07f; + public static float RogueVelocityBoost = 0.1f; + public static int OnHitDebuffDuration = CalamityUtils.SecondsToFrames(2); + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueVelocityBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1f; + public static float StealthStrikeKnockbackMult = 2f; + public static int ExplosionDamage = 40; + public override void SetDefaults() { Item.width = 18; Item.height = 18; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; - Item.defense = 12; //43 + Item.defense = 8; // 32 } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); public override void UpdateArmorSet(Player player) { - player.setBonus = this.GetLocalizedValue("SetBonus"); + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth(), StealthStrikeKnockbackMult); var modPlayer = player.Calamity(); modPlayer.titanHeartSet = true; - player.GetDamage() += 0.10f; - modPlayer.rogueStealthMax += 1f; + modPlayer.rogueStealthMax += SetBonusRogueStealth; modPlayer.wearingRogueArmor = true; player.noKnockback = true; } @@ -40,7 +48,8 @@ namespace CalamityMod.Items.Armor.TitanHeart { var modPlayer = player.Calamity(); modPlayer.titanHeartMask = true; - player.GetDamage() += 0.05f; + player.GetDamage() += RogueDamageBoost; + modPlayer.rogueVelocity += RogueVelocityBoost; } public override void AddRecipes() diff --git a/Items/Armor/Umbraphile/UmbraphileBoots.cs b/Items/Armor/Umbraphile/UmbraphileBoots.cs index e48dd4b34e..859cb449dc 100644 --- a/Items/Armor/Umbraphile/UmbraphileBoots.cs +++ b/Items/Armor/Umbraphile/UmbraphileBoots.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Umbraphile @@ -9,6 +10,12 @@ namespace CalamityMod.Items.Armor.Umbraphile public class UmbraphileBoots : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.09f; + public static int RogueCritBoost = 6; + public static float MoveSpeedBoost = 0.2f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueCritBoost, MoveSpeedBoost.ToPercent()); + public override void SetDefaults() { Item.width = 22; @@ -20,9 +27,9 @@ namespace CalamityMod.Items.Armor.Umbraphile public override void UpdateEquip(Player player) { - player.moveSpeed += 0.2f; - player.GetDamage() += 0.09f; - player.GetCritChance() += 6; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Umbraphile/UmbraphileHood.cs b/Items/Armor/Umbraphile/UmbraphileHood.cs index 0c5da98a99..ee5322384f 100644 --- a/Items/Armor/Umbraphile/UmbraphileHood.cs +++ b/Items/Armor/Umbraphile/UmbraphileHood.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Umbraphile @@ -10,6 +11,16 @@ namespace CalamityMod.Items.Armor.Umbraphile public class UmbraphileHood : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.08f; + public static float RogueVelocityBoost = 0.1f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent(), RogueVelocityBoost.ToPercent()); + + // Set Bonus + public static float SetBonusRogueStealth = 1.1f; + public static double ExplosionDamageRatio = 0.2D; + public static int ExplosionDamageSoftcap = 50; + public override void SetDefaults() { Item.width = 22; @@ -19,29 +30,23 @@ namespace CalamityMod.Items.Armor.Umbraphile Item.defense = 10; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; public override void UpdateArmorSet(Player player) { var modPlayer = player.Calamity(); modPlayer.umbraphileSet = true; - modPlayer.rogueStealthMax += 1.1f; - player.setBonus = this.GetLocalizedValue("SetBonus"); + modPlayer.rogueStealthMax += SetBonusRogueStealth; + player.setBonus = this.GetLocalization("SetBonus").Format(SetBonusRogueStealth.ToStealth()); player.Calamity().wearingRogueArmor = true; } public override void UpdateEquip(Player player) { - player.GetDamage() += 0.08f; - player.Calamity().rogueVelocity += 0.1f; + player.GetDamage() += RogueDamageBoost; + player.Calamity().rogueVelocity += RogueVelocityBoost; } public override void AddRecipes() diff --git a/Items/Armor/Umbraphile/UmbraphileRegalia.cs b/Items/Armor/Umbraphile/UmbraphileRegalia.cs index f281752294..46a9661e5e 100644 --- a/Items/Armor/Umbraphile/UmbraphileRegalia.cs +++ b/Items/Armor/Umbraphile/UmbraphileRegalia.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Umbraphile @@ -9,6 +10,11 @@ namespace CalamityMod.Items.Armor.Umbraphile public class UmbraphileRegalia : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Hardmode"; + + public static float RogueDamageBoost = 0.1f; + public static int RogueCritBoost = 10; // NOTE: Tooltip shares this number with damage % as they're equal + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RogueDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 38; @@ -20,8 +26,8 @@ namespace CalamityMod.Items.Armor.Umbraphile public override void UpdateEquip(Player player) { - player.GetDamage() += 0.1f; - player.GetCritChance() += 10; + player.GetDamage() += RogueDamageBoost; + player.GetCritChance() += RogueCritBoost; } public override void AddRecipes() diff --git a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs index 448662c671..114cf3b989 100644 --- a/Items/Armor/Vanity/AncientGodSlayerChestplate.cs +++ b/Items/Armor/Vanity/AncientGodSlayerChestplate.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 12); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/AncientGodSlayerHelm.cs b/Items/Armor/Vanity/AncientGodSlayerHelm.cs index 04f3f01831..d1f4295763 100644 --- a/Items/Armor/Vanity/AncientGodSlayerHelm.cs +++ b/Items/Armor/Vanity/AncientGodSlayerHelm.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 15); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool IsArmorSet(Item head, Item body, Item legs) diff --git a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs index 58956bdeed..f36ed19d5a 100644 --- a/Items/Armor/Vanity/AncientGodSlayerLeggings.cs +++ b/Items/Armor/Vanity/AncientGodSlayerLeggings.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Armor.Vanity Item.height = 20; Item.vanity = true; Item.value = Item.sellPrice(gold: 9); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.cs b/Items/Armor/Vanity/BrimstoneElementalMask.cs similarity index 85% rename from Items/Armor/Vanity/BrimstoneWaifuMask.cs rename to Items/Armor/Vanity/BrimstoneElementalMask.cs index f71c4a3de6..5fd09e0622 100644 --- a/Items/Armor/Vanity/BrimstoneWaifuMask.cs +++ b/Items/Armor/Vanity/BrimstoneElementalMask.cs @@ -5,7 +5,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity { [AutoloadEquip(EquipType.Head)] - public class BrimstoneWaifuMask : ModItem, ILocalizedModType + [LegacyName("BrimstoneWaifuMask")] + public class BrimstoneElementalMask : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.Vanity"; public override void SetStaticDefaults() diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask.png b/Items/Armor/Vanity/BrimstoneElementalMask.png similarity index 100% rename from Items/Armor/Vanity/BrimstoneWaifuMask.png rename to Items/Armor/Vanity/BrimstoneElementalMask.png diff --git a/Items/Armor/Vanity/BrimstoneWaifuMask_Head.png b/Items/Armor/Vanity/BrimstoneElementalMask_Head.png similarity index 100% rename from Items/Armor/Vanity/BrimstoneWaifuMask_Head.png rename to Items/Armor/Vanity/BrimstoneElementalMask_Head.png diff --git a/Items/Armor/Vanity/GodSlayerHornedHelm.cs b/Items/Armor/Vanity/GodSlayerHornedHelm.cs index 0a003faafb..8c0eed2305 100644 --- a/Items/Armor/Vanity/GodSlayerHornedHelm.cs +++ b/Items/Armor/Vanity/GodSlayerHornedHelm.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Rarities; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity @@ -14,18 +15,12 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 18; Item.height = 18; Item.vanity = true; - Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(gold: 10); // Sold by Clothier + Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; } } diff --git a/Items/Armor/Vanity/GodSlayerVisage.cs b/Items/Armor/Vanity/GodSlayerVisage.cs index 1c42f8c041..2f7e24be7f 100644 --- a/Items/Armor/Vanity/GodSlayerVisage.cs +++ b/Items/Armor/Vanity/GodSlayerVisage.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Rarities; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Vanity @@ -14,18 +15,12 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 18; Item.height = 18; Item.vanity = true; - Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(gold: 10); // Sold by Clothier + Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; } } diff --git a/Items/Armor/Vanity/LucisBoots.cs b/Items/Armor/Vanity/LucisBoots.cs new file mode 100644 index 0000000000..da9ce01a0c --- /dev/null +++ b/Items/Armor/Vanity/LucisBoots.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Legs)] + public class LucisBoots : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Armor/Vanity/LucisBoots.png b/Items/Armor/Vanity/LucisBoots.png new file mode 100644 index 0000000000..2b91e15ca4 Binary files /dev/null and b/Items/Armor/Vanity/LucisBoots.png differ diff --git a/Items/Armor/Vanity/LucisBoots_Legs.png b/Items/Armor/Vanity/LucisBoots_Legs.png new file mode 100644 index 0000000000..cb73585b17 Binary files /dev/null and b/Items/Armor/Vanity/LucisBoots_Legs.png differ diff --git a/Items/Armor/Vanity/LucisHairstyle.cs b/Items/Armor/Vanity/LucisHairstyle.cs new file mode 100644 index 0000000000..6af1251c18 --- /dev/null +++ b/Items/Armor/Vanity/LucisHairstyle.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + public class LucisHairstyle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 28; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; // Donor: xAqult (Sprites made by Gote) + } + } +} diff --git a/Items/Armor/Vanity/LucisHairstyle.png b/Items/Armor/Vanity/LucisHairstyle.png new file mode 100644 index 0000000000..5808d53012 Binary files /dev/null and b/Items/Armor/Vanity/LucisHairstyle.png differ diff --git a/Items/Armor/Vanity/LucisHairstyle_Head.png b/Items/Armor/Vanity/LucisHairstyle_Head.png new file mode 100644 index 0000000000..682ad154ba Binary files /dev/null and b/Items/Armor/Vanity/LucisHairstyle_Head.png differ diff --git a/Items/Armor/Vanity/LucisMilitaryUniform.cs b/Items/Armor/Vanity/LucisMilitaryUniform.cs new file mode 100644 index 0000000000..c2fde13007 --- /dev/null +++ b/Items/Armor/Vanity/LucisMilitaryUniform.cs @@ -0,0 +1,22 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Body)] + public class LucisMilitaryUniform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + + public override void SetDefaults() + { + Item.width = 26; + Item.height = 20; + Item.value = Item.buyPrice(gold: 10); // Sold by Steampunker + Item.rare = ItemRarityID.Pink; + Item.vanity = true; + Item.Calamity().donorItem = true; + } + } +} diff --git a/Items/Armor/Vanity/LucisMilitaryUniform.png b/Items/Armor/Vanity/LucisMilitaryUniform.png new file mode 100644 index 0000000000..d8017d98d0 Binary files /dev/null and b/Items/Armor/Vanity/LucisMilitaryUniform.png differ diff --git a/Items/Armor/Vanity/LucisMilitaryUniform_Body.png b/Items/Armor/Vanity/LucisMilitaryUniform_Body.png new file mode 100644 index 0000000000..dcdee4ba2a Binary files /dev/null and b/Items/Armor/Vanity/LucisMilitaryUniform_Body.png differ diff --git a/Items/Armor/Vanity/SilvaHelm.cs b/Items/Armor/Vanity/SilvaHelm.cs index b5875fd67e..45d38e664e 100644 --- a/Items/Armor/Vanity/SilvaHelm.cs +++ b/Items/Armor/Vanity/SilvaHelm.cs @@ -15,18 +15,12 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 24; Item.height = 20; Item.vanity = true; - Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(gold: 10); // Sold by Clothier + Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; } } diff --git a/Items/Armor/Vanity/SilvaHornedHelm.cs b/Items/Armor/Vanity/SilvaHornedHelm.cs index 7440f939ce..fa01598ee5 100644 --- a/Items/Armor/Vanity/SilvaHornedHelm.cs +++ b/Items/Armor/Vanity/SilvaHornedHelm.cs @@ -15,18 +15,12 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 26; Item.height = 24; Item.vanity = true; - Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(gold: 10); // Sold by Clothier + Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; } } diff --git a/Items/Armor/Vanity/SilvaMask.cs b/Items/Armor/Vanity/SilvaMask.cs index ad4ec9902f..bfe18a6dfd 100644 --- a/Items/Armor/Vanity/SilvaMask.cs +++ b/Items/Armor/Vanity/SilvaMask.cs @@ -15,18 +15,12 @@ namespace CalamityMod.Items.Armor.Vanity Item.width = 24; Item.height = 26; Item.vanity = true; - Item.value = Item.buyPrice(gold: 8); // Sold by Clothier - Item.rare = ModContent.RarityType(); + Item.value = Item.buyPrice(gold: 10); // Sold by Clothier + Item.rare = ItemRarityID.Blue; } - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - public override void ArmorSetShadows(Player player) - { - player.armorEffectDrawShadow = true; - } + public override void ArmorSetShadows(Player player) => player.armorEffectDrawShadow = true; } } diff --git a/Items/Armor/Vanity/VictideCoralTurban.cs b/Items/Armor/Vanity/VictideCoralTurban.cs new file mode 100644 index 0000000000..319b72db0b --- /dev/null +++ b/Items/Armor/Vanity/VictideCoralTurban.cs @@ -0,0 +1,23 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideVisage", "VictideHeadRanged")] + public class VictideCoralTurban : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.vanity = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Armor/Victide/VictideHeadRanged.png b/Items/Armor/Vanity/VictideCoralTurban.png similarity index 100% rename from Items/Armor/Victide/VictideHeadRanged.png rename to Items/Armor/Vanity/VictideCoralTurban.png diff --git a/Items/Armor/Victide/VictideHeadRanged_Head.png b/Items/Armor/Vanity/VictideCoralTurban_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadRanged_Head.png rename to Items/Armor/Vanity/VictideCoralTurban_Head.png diff --git a/Items/Armor/Vanity/VictideShellmet.cs b/Items/Armor/Vanity/VictideShellmet.cs new file mode 100644 index 0000000000..86460c0dca --- /dev/null +++ b/Items/Armor/Vanity/VictideShellmet.cs @@ -0,0 +1,23 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Vanity +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHelm", "VictideHeadMelee")] + public class VictideShellmet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Armor.Vanity"; + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.vanity = true; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + } + } +} diff --git a/Items/Armor/Victide/VictideHeadMelee.png b/Items/Armor/Vanity/VictideShellmet.png similarity index 100% rename from Items/Armor/Victide/VictideHeadMelee.png rename to Items/Armor/Vanity/VictideShellmet.png diff --git a/Items/Armor/Victide/VictideHeadMelee_Head.png b/Items/Armor/Vanity/VictideShellmet_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadMelee_Head.png rename to Items/Armor/Vanity/VictideShellmet_Head.png diff --git a/Items/Armor/Victide/VictideBreastplate.cs b/Items/Armor/Victide/VictideBreastplate.cs index 43e1c6649b..5e39ddee61 100644 --- a/Items/Armor/Victide/VictideBreastplate.cs +++ b/Items/Armor/Victide/VictideBreastplate.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Victide @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Armor.Victide public new string LocalizationCategory => "Items.Armor.PreHardmode"; public string BulkTexture => "CalamityMod/Items/Armor/Victide/VictideBreastplate_Bulk"; + public static int RegenBoost = 2; + + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond()); + public override void Load() { if (!Main.dedServ) @@ -22,7 +27,6 @@ namespace CalamityMod.Items.Armor.Victide public override void SetStaticDefaults() { - if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Body); @@ -37,18 +41,12 @@ namespace CalamityMod.Items.Armor.Victide Item.height = 18; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.defense = 5; //9 + Item.defense = 5; } public override void UpdateEquip(Player player) { - player.endurance += 0.05f; - player.GetCritChance() += 5; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.statDefense += 5; - player.endurance += 0.1f; - } + player.lifeRegen += RegenBoost; } public override void AddRecipes() diff --git a/Items/Armor/Victide/VictideGreaves.cs b/Items/Armor/Victide/VictideGreaves.cs index 6e96d6af32..dd8c3b9b22 100644 --- a/Items/Armor/Victide/VictideGreaves.cs +++ b/Items/Armor/Victide/VictideGreaves.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor.Victide @@ -10,9 +11,13 @@ namespace CalamityMod.Items.Armor.Victide public class VictideGreaves : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float MoveSpeedBoost = 0.1f; + + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedBoost.ToPercent()); + public override void SetStaticDefaults() { - if (!Main.dedServ) { var equipSlot = EquipLoader.GetEquipSlot(Mod, Name, EquipType.Legs); @@ -26,12 +31,12 @@ namespace CalamityMod.Items.Armor.Victide Item.height = 18; Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; - Item.defense = 4; //9 + Item.defense = 4; } public override void UpdateEquip(Player player) { - player.moveSpeed += Collision.DrownCollision(player.position, player.width, player.height, player.gravDir) ? 0.3f : 0.08f; + player.moveSpeed += MoveSpeedBoost; } public override void AddRecipes() diff --git a/Items/Armor/Victide/VictideHeadBarrier.cs b/Items/Armor/Victide/VictideHeadBarrier.cs new file mode 100644 index 0000000000..5da260e68e --- /dev/null +++ b/Items/Armor/Victide/VictideHeadBarrier.cs @@ -0,0 +1,77 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideMask", "VictideHeadMagic")] + public class VictideHeadBarrier : ModItem, ILocalizedModType // Defense/Mobility set + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int RegenBoost = 2; + public static float RunAccelerationMult = 1.75f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RegenBoost.ToRegenPerSecond(), RunAccelerationMult.Round()); + + // Set Bonus + public static int BarrierCooldown = CalamityUtils.SecondsToFrames(8); + public static int BarrierDefenseBoost = 5; + public static float BarrierDamageAbsorptionPercent = 0.1f; + public static int BarrierFramesPerHeal = 15; + public static int BarrierDamage = 50; + public static float BarrierExplosionKB = 8f; + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 6; // 15 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void UpdateArmorSet(Player player) + { + Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), BarrierDefenseBoost, BarrierDamageAbsorptionPercent.ToPercent(), CalamityUtils.GetArmorSetBonusKey(), BarrierCooldown.FramesToSeconds()); + player.Calamity().victideBarrierSet = true; + + if (!player.HasCooldown(WardingWave.ID)) + { + player.statDefense += BarrierDefenseBoost; + + if (player.whoAmI == Main.myPlayer && player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + // Damage will be set once explosion goes off + var source = player.GetSource_ItemUse(Item); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + } + + public override void UpdateEquip(Player player) + { + player.lifeRegen += RegenBoost; + player.Calamity().victideBarrierHead = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadMagic.png b/Items/Armor/Victide/VictideHeadBarrier.png similarity index 100% rename from Items/Armor/Victide/VictideHeadMagic.png rename to Items/Armor/Victide/VictideHeadBarrier.png diff --git a/Items/Armor/Victide/VictideHeadMagic_Head.png b/Items/Armor/Victide/VictideHeadBarrier_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadMagic_Head.png rename to Items/Armor/Victide/VictideHeadBarrier_Head.png diff --git a/Items/Armor/Victide/VictideHeadBurrow.cs b/Items/Armor/Victide/VictideHeadBurrow.cs new file mode 100644 index 0000000000..8eaf0ed7be --- /dev/null +++ b/Items/Armor/Victide/VictideHeadBurrow.cs @@ -0,0 +1,64 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHeadgear", "VictideHeadRogue")] + public class VictideHeadBurrow : ModItem, ILocalizedModType // Mobility/Utility set + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float MoveSpeedAccelerationBoost = 0.15f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MoveSpeedAccelerationBoost.ToPercent()); + + // Set Bonus + public static float BaseBurrowSpeed = 9f; // 46 mph + public static float SubmergedBurrowSpeed = 12f; // 61 mph + public static float BaseAcceleration = 0.4f; // For reference, base player running acceleration is 0.08 + public static int BurrowDuration = CalamityUtils.SecondsToFrames(7); + public static int BurrowCooldown = CalamityUtils.SecondsToFrames(30); + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 5; // 14 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void UpdateArmorSet(Player player) + { + Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), BurrowDuration.FramesToSeconds(), BurrowCooldown.FramesToSeconds()); + player.Calamity().victideBurrowSet = true; + player.ignoreWater = true; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().victideBurrowHead = true; + player.moveSpeed += MoveSpeedAccelerationBoost; + if (player.IsUnderwater()) + player.gills = true; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadRogue.png b/Items/Armor/Victide/VictideHeadBurrow.png similarity index 100% rename from Items/Armor/Victide/VictideHeadRogue.png rename to Items/Armor/Victide/VictideHeadBurrow.png diff --git a/Items/Armor/Victide/VictideHeadRogue_Head.png b/Items/Armor/Victide/VictideHeadBurrow_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadRogue_Head.png rename to Items/Armor/Victide/VictideHeadBurrow_Head.png diff --git a/Items/Armor/Victide/VictideHeadMagic.cs b/Items/Armor/Victide/VictideHeadMagic.cs deleted file mode 100644 index 87d322f52f..0000000000 --- a/Items/Armor/Victide/VictideHeadMagic.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideMask")] - public class VictideHeadMagic : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 2; //9 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.GetDamage() += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadMelee.cs b/Items/Armor/Victide/VictideHeadMelee.cs deleted file mode 100644 index 9c97518add..0000000000 --- a/Items/Armor/Victide/VictideHeadMelee.cs +++ /dev/null @@ -1,56 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHelm")] - public class VictideHeadMelee : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 4; //11 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.GetDamage() += 0.1f; - player.lifeRegen += 3; - } - player.aggro += 200; - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadRanged.cs b/Items/Armor/Victide/VictideHeadRanged.cs deleted file mode 100644 index 068abd2914..0000000000 --- a/Items/Armor/Victide/VictideHeadRanged.cs +++ /dev/null @@ -1,55 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideVisage")] - public class VictideHeadRanged : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 3; //10 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.victideSet = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.GetDamage() += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadRogue.cs b/Items/Armor/Victide/VictideHeadRogue.cs deleted file mode 100644 index 1ebfa59ea6..0000000000 --- a/Items/Armor/Victide/VictideHeadRogue.cs +++ /dev/null @@ -1,57 +0,0 @@ -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHeadgear")] - public class VictideHeadRogue : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 3; //10 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.victideSet = true; - modPlayer.rogueStealthMax += 0.6f; - modPlayer.wearingRogueArmor = true; - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.GetDamage() += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.05f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Victide/VictideHeadSnail.cs b/Items/Armor/Victide/VictideHeadSnail.cs new file mode 100644 index 0000000000..7b4de4234d --- /dev/null +++ b/Items/Armor/Victide/VictideHeadSnail.cs @@ -0,0 +1,73 @@ +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Armor.Victide +{ + [AutoloadEquip(EquipType.Head)] + [LegacyName("VictideHelmet", "VictideHeadSummon")] + public class VictideHeadSnail : ModItem, ILocalizedModType // Utility/Fishing set + { + public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int FishingPowerBoost = 5; + public static int AggroReduction = 200; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(FishingPowerBoost); + + // Set Bonus + public static int SetBonusGrabRangeBoost = 102; // (2.625 + 6.375 = 9 tiles) + + public override void SetDefaults() + { + Item.width = 18; + Item.height = 18; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; + Item.defense = 1; // 10 + } + + public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); + + public override void UpdateArmorSet(Player player) + { + Color AbilityBriefColor = Color.Lerp(new Color(97, 200, 255), new Color(255, 170, 204), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3()); + player.Calamity().victideSnailSet = true; + if (player.whoAmI == Main.myPlayer) + { + if (player.FindBuffIndex(ModContent.BuffType()) == -1) + { + player.AddBuff(ModContent.BuffType(), 3600, true); + } + if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) + { + var source = player.GetSource_ItemUse(Item); + Vector2 position = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; + Projectile.NewProjectile(source, position, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + } + } + } + + public override void UpdateEquip(Player player) + { + player.fishingSkill += FishingPowerBoost; + player.aggro -= AggroReduction; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddTile(TileID.Anvils). + SortBeforeFirstRecipesOf(ModContent.ItemType()). + Register(); + } + } +} diff --git a/Items/Armor/Victide/VictideHeadSummon.png b/Items/Armor/Victide/VictideHeadSnail.png similarity index 100% rename from Items/Armor/Victide/VictideHeadSummon.png rename to Items/Armor/Victide/VictideHeadSnail.png diff --git a/Items/Armor/Victide/VictideHeadSummon_Head.png b/Items/Armor/Victide/VictideHeadSnail_Head.png similarity index 100% rename from Items/Armor/Victide/VictideHeadSummon_Head.png rename to Items/Armor/Victide/VictideHeadSnail_Head.png diff --git a/Items/Armor/Victide/VictideHeadSummon.cs b/Items/Armor/Victide/VictideHeadSummon.cs deleted file mode 100644 index 3d2d7683ce..0000000000 --- a/Items/Armor/Victide/VictideHeadSummon.cs +++ /dev/null @@ -1,79 +0,0 @@ -using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.Projectiles.Summon; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Armor.Victide -{ - [AutoloadEquip(EquipType.Head)] - [LegacyName("VictideHelmet")] - public class VictideHeadSummon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Armor.PreHardmode"; - public static int SnailDamage = 7; - - public override void SetDefaults() - { - Item.width = 18; - Item.height = 18; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.defense = 1; //8 - } - - public override bool IsArmorSet(Item head, Item body, Item legs) - { - return body.type == ModContent.ItemType() && legs.type == ModContent.ItemType(); - } - - public override void UpdateArmorSet(Player player) - { - player.setBonus = this.GetLocalizedValue("SetBonus") + "\n" + CalamityUtils.GetTextValueFromModItem("CommonSetBonus"); - var modPlayer = player.Calamity(); - modPlayer.victideSet = true; - modPlayer.victideSummoner = true; - player.maxMinions++; - if (player.whoAmI == Main.myPlayer) - { - if (player.FindBuffIndex(ModContent.BuffType()) == -1) - { - player.AddBuff(ModContent.BuffType(), 3600, true); - } - var source = player.GetSource_ItemUse(Item); - if (player.ownedProjectileCounts[ModContent.ProjectileType()] < 1) - { - int minionDamage = (int)player.GetTotalDamage().ApplyTo(SnailDamage); - - var p = Projectile.NewProjectile(source, player.Center, -Vector2.UnitY, ModContent.ProjectileType(), minionDamage, 0f, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = SnailDamage; - } - } - player.ignoreWater = true; - if (Collision.DrownCollision(player.position, player.width, player.height, player.gravDir)) - { - player.GetDamage() += 0.1f; - player.lifeRegen += 3; - } - } - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(3). - AddTile(TileID.Anvils). - SortBeforeFirstRecipesOf(ModContent.ItemType()). - Register(); - } - } -} diff --git a/Items/Armor/Wulfrum/WulfrumSet.cs b/Items/Armor/Wulfrum/WulfrumSet.cs index 69987f14d2..f27d55f4a1 100644 --- a/Items/Armor/Wulfrum/WulfrumSet.cs +++ b/Items/Armor/Wulfrum/WulfrumSet.cs @@ -11,7 +11,6 @@ using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using static Microsoft.Xna.Framework.Input.Keys; using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Armor.Wulfrum @@ -36,11 +35,16 @@ namespace CalamityMod.Items.Armor.Wulfrum public static readonly SoundStyle SetBreakSound = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreak"); public static readonly SoundStyle SetBreakSoundSafe = new("CalamityMod/Sounds/Custom/AbilitySounds/WulfrumBastionBreakSafely"); - public static int MinionSlotBoost = 1; - public static int BastionBuildTime = (int)(0.55f * 60); - public static int BastionTime = 30 * 60; - public static int TimeLostPerHit = 2 * 60; - public static int BastionCooldown = 20 * 60; + public static float SummonDamageBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent()); + + // Set Bonus + public static int BastionDefenseBoost = 12; + public static float BastionDRBoost = 0.1f; + public static int BastionBuildTime = CalamityUtils.SecondsToFrames(0.55f); + public static int BastionTime = CalamityUtils.SecondsToFrames(30); + public static int TimeLostPerHit = CalamityUtils.SecondsToFrames(2); + public static int BastionCooldown = CalamityUtils.SecondsToFrames(20); internal static Item DummyCannon = new Item(); //Used for the attack swap. Basically we force the player to hold a fake item. @@ -58,8 +62,7 @@ namespace CalamityMod.Items.Armor.Wulfrum EquipLoader.AddEquipTexture(Mod, "CalamityMod/Items/Armor/Wulfrum/WulfrumHat_FemaleHead", EquipType.Head, name: "WulfrumHatFemale"); } - Terraria.On_Player.KeyDoubleTap += ActivateSetBonus; - Terraria.On_Main.DrawPendingMouseText += SpoofMouseItem; + On_Main.DrawPendingMouseText += SpoofMouseItem; } public override void Unload() @@ -68,42 +71,15 @@ namespace CalamityMod.Items.Armor.Wulfrum DummyCannon = null; } - private void ActivateSetBonus(Terraria.On_Player.orig_KeyDoubleTap orig, Player player, int keyDir) - { - if (keyDir == (Main.ReversedUpDownArmorSetBonuses ? 1 : 0) && HasArmorSet(player) && !player.mount.Active) - { - //Only activate if no cooldown & available scrap. - if (player.Calamity().cooldowns.TryGetValue(WulfrumBastion.ID, out CooldownInstance cd)) - { - if (cd.timeLeft > BastionCooldown && cd.timeLeft < BastionCooldown + BastionTime - 60 * 3) - { - cd.timeLeft = BastionCooldown + 1; - player.Calamity().SyncCooldownDictionary(false); - } - } - - else if (player.HasItem(ItemType())) - { - player.ConsumeItem(ItemType()); - //I Thiiiinnnk there's no need to add mp syncing packets since cooldowns get auto synced right. - player.AddCooldown(WulfrumBastion.ID, BastionCooldown + BastionTime); - //Though do i need to sync that or is the player inventory auto synced? - DummyCannon.SetDefaults(ItemType()); - } - } - - orig(player, keyDir); - } - //Replaces the tooltip of the armor set with the fusion cannon if the player holds shift - private void SpoofMouseItem(Terraria.On_Main.orig_DrawPendingMouseText orig) + private void SpoofMouseItem(On_Main.orig_DrawPendingMouseText orig) { var player = Main.LocalPlayer; if (DummyCannon.IsAir && !Main.gameMenu) DummyCannon.SetDefaults(ItemType()); - if (IsPartOfSet(Main.HoverItem) && HasArmorSet(player) && Main.keyState.IsKeyDown(LeftShift)) + if (IsPartOfSet(Main.HoverItem) && HasArmorSet(player) && Main.keyState.PressingShift()) { Main.HoverItem = DummyCannon.Clone(); Main.hoverItemName = DummyCannon.Name; @@ -118,6 +94,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.height = 18; Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; + Item.defense = 1; } public override bool IsArmorSet(Item head, Item body, Item legs) => body.type == ItemType() && legs.type == ItemType(); @@ -133,8 +110,9 @@ namespace CalamityMod.Items.Armor.Wulfrum armorPlayer.wulfrumSet = true; - player.setBonus = this.GetLocalization("SetBonus").Format(MinionSlotBoost); //The cooler part of the set bonus happens in modifytooltips because i can't recolor it otherwise. Madge - player.maxMinions += MinionSlotBoost; + Color AbilityBriefColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * MathF.Sin(Main.GlobalTimeWrappedHourly * 3f)); + player.setBonus = this.GetLocalization("SetBonus").Format(AbilityBriefColor.Hex3(), CalamityUtils.GetArmorSetBonusKey(), BastionTime.FramesToSeconds(), TimeLostPerHit.FramesToSeconds()); + if (PowerModeEngaged(player, out var cd)) { if (cd.timeLeft == BastionCooldown + BastionTime) @@ -143,12 +121,13 @@ namespace CalamityMod.Items.Armor.Wulfrum } //Stats - player.statDefense += 13; - player.endurance += 0.05f; //10% Dr in total with the chestplate + player.statDefense += BastionDefenseBoost; + player.endurance += BastionDRBoost; - //Can't account for previous fullbody transformations but at this point, whatever. + //Can't account for previous fullbody transformations but at this point, whatever + bool transformed = player.Transformation().Type == ItemType(); Item headItem = player.armor[10].type != ItemID.None ? player.armor[10] : player.armor[0]; - bool hatVisible = !transformationPlayer.transformationActive && headItem.type == ItemType(); + bool hatVisible = !transformed && headItem.type == ItemType(); //Spawn the hat if (cd.timeLeft == BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f) && hatVisible) @@ -159,11 +138,9 @@ namespace CalamityMod.Items.Armor.Wulfrum //Visuals if (cd.timeLeft < BastionCooldown + BastionTime - BastionBuildTime) - player.GetModPlayer().transformationActive = true; - else if (cd.timeLeft <= BastionCooldown + BastionTime - (int)(BastionBuildTime * 0.9f)) - player.GetModPlayer().forceHelmetOn = true; + player.Transformation().Type = ItemType(); - //Swapping the arm. + //Swapping the arm if (DummyCannon.IsAir) DummyCannon.SetDefaults(ItemType()); @@ -176,7 +153,7 @@ namespace CalamityMod.Items.Armor.Wulfrum Main.mouseItem = DummyCannon; } - //Slot 58 is the "fake" slot thats used for the item the player is holding in their mouse. + //Slot 58 is the "fake" slot thats used for the item the player is holding in their mouse player.inventory[58] = DummyCannon; player.selectedItem = 58; } @@ -188,6 +165,9 @@ namespace CalamityMod.Items.Armor.Wulfrum Main.mouseItem = new Item(); DummyCannon.TurnToAir(); + + if (player.Transformation().Type == ItemType() && player.Transformation().currentTransformation.IsForced) + player.Transformation().currentTransformation.IsForced = false; } } @@ -195,8 +175,8 @@ namespace CalamityMod.Items.Armor.Wulfrum { SoundEngine.PlaySound(SetActivationSound); - //Do'nt do the effect ifthe player is already using the wulfrum vanity lol. - bool transformedAlready = player.GetModPlayer().transformationActive; + //Don't do the effect if the player is already using the wulfrum vanity lol + bool transformedAlready = player.Transformation().Type == ItemType(); if (!transformedAlready) { @@ -221,41 +201,7 @@ namespace CalamityMod.Items.Armor.Wulfrum GeneralParticleHandler.SpawnParticle(gun); } - public static void ModifySetTooltips(ModItem item, List tooltips) - { - if (HasArmorSet(Main.LocalPlayer)) - { - int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); - - if (setBonusIndex != -1) - { - string dir = Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"); - TooltipLine setBonus1 = new TooltipLine(item.Mod, "CalamityMod:SetBonus1", CalamityUtils.GetTextFromModItem("AbilityBrief").Format(dir)); - setBonus1.OverrideColor = Color.Lerp(new Color(194, 255, 67), new Color(112, 244, 244), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f)); - tooltips.Insert(setBonusIndex + 1, setBonus1); - - int AmmoItem = ItemType(); - string AmmoDisplay = $"[i:{AmmoItem}] {CalamityUtils.GetItemName(AmmoItem)}"; - TooltipLine setBonus2 = new TooltipLine(item.Mod, "CalamityMod:SetBonus2", CalamityUtils.GetTextFromModItem("AbilityDescription").Format(AmmoDisplay)); - setBonus2.OverrideColor = new Color(110, 192, 93); - tooltips.Insert(setBonusIndex + 2, setBonus2); - - if (!Main.keyState.IsKeyDown(LeftShift)) - { - TooltipLine itemDisplay = new TooltipLine(item.Mod, "CalamityMod:ArmorItemDisplay", CalamityUtils.GetTextValueFromModItem("ShiftToExpand")); - itemDisplay.OverrideColor = new Color(190, 190, 190); - tooltips.Add(itemDisplay); - } - } - - } - } - public override void ModifyTooltips(List tooltips) => ModifySetTooltips(this, tooltips); - - public override void UpdateEquip(Player player) - { - player.GetDamage() += 0.1f; - } + public override void UpdateEquip(Player player) => player.GetDamage() += SummonDamageBoost; public override void AddRecipes() { @@ -272,6 +218,10 @@ namespace CalamityMod.Items.Armor.Wulfrum public class WulfrumJacket : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static int MinionSlotBoost = 1; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(MinionSlotBoost); + public override void SetStaticDefaults() { if (!Main.dedServ) @@ -291,14 +241,12 @@ namespace CalamityMod.Items.Armor.Wulfrum Item.defense = 2; } - public override void ModifyTooltips(List tooltips) => WulfrumHat.ModifySetTooltips(this, tooltips); - - public override void UpdateEquip(Player player) => player.endurance += 0.05f; + public override void UpdateEquip(Player player) => player.maxMinions += MinionSlotBoost; public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). + AddIngredient(10). AddIngredient(). AddTile(TileID.Anvils). Register(); @@ -310,6 +258,10 @@ namespace CalamityMod.Items.Armor.Wulfrum public class WulfrumOveralls : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Armor.PreHardmode"; + + public static float SummonDamageBoost = 0.05f; + public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(SummonDamageBoost.ToPercent()); + public override void SetDefaults() { Item.width = 18; @@ -324,11 +276,8 @@ namespace CalamityMod.Items.Armor.Wulfrum ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlot] = true; } } - public override void ModifyTooltips(List tooltips) => WulfrumHat.ModifySetTooltips(this, tooltips); - public override void UpdateEquip(Player player) - { - player.moveSpeed += 0.05f; - } + + public override void UpdateEquip(Player player) => player.GetDamage() += SummonDamageBoost; public override void AddRecipes() { @@ -343,10 +292,6 @@ namespace CalamityMod.Items.Armor.Wulfrum public class WulfrumArmorPlayer : ModPlayer { - public static int BastionShootDamage = 10; - public static float BastionShootSpeed = 18f; - public static int BastionShootTime = 10; - public bool wulfrumSet = false; public override void ResetEffects() @@ -365,7 +310,7 @@ namespace CalamityMod.Items.Armor.Wulfrum { SetBonusEndEffect(true); if (!Player.GetModPlayer().vanityEquipped) - Player.GetModPlayer().transformationActive = false; + Player.Transformation().currentTransformation = null; } } diff --git a/Items/BaseItems/TransformationAccessory.cs b/Items/BaseItems/TransformationAccessory.cs new file mode 100644 index 0000000000..f929462815 --- /dev/null +++ b/Items/BaseItems/TransformationAccessory.cs @@ -0,0 +1,289 @@ +using Terraria.DataStructures; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using System.Linq; +using System; +using Microsoft.Xna.Framework; +using Terraria.Audio; + +namespace CalamityMod.Items.BaseItems +{ + public abstract class TransformationAccessory : ModItem + { + public bool IsForced = false; + + public virtual string AssetPath => "CalamityMod/Items/Accessories/Vanity/"; + + public virtual (EquipType Type, string AssetName, string EquipName)[] EquipSlots => []; + + public virtual float Priority => 1; + + public virtual Func ShouldTransform => (player) => true; + + public virtual bool ShouldHideAccessories => false; + + public virtual (SoundStyle sound, int delay)? HurtSound(Player p) => null; + + public virtual void ModifyDrawInfo(ref PlayerDrawSet drawInfo) { } + + public virtual void ArmorIDSets() + { + if (EquipSlots.Any(s => s.Type == EquipType.Head)) + { + string name = EquipSlots.First(s => s.Type == EquipType.Head).EquipName; + int equipSlotHead = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Head); + ArmorIDs.Head.Sets.DrawHead[equipSlotHead] = false; + } + + if (EquipSlots.Any(s => s.Type == EquipType.Body)) + { + string name = EquipSlots.First(s => s.Type == EquipType.Body).EquipName; + int equipSlotBody = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Body); + ArmorIDs.Body.Sets.HidesTopSkin[equipSlotBody] = true; + ArmorIDs.Body.Sets.HidesArms[equipSlotBody] = true; + } + + if (EquipSlots.Any(s => s.Type == EquipType.Legs)) + { + string name = EquipSlots.First(s => s.Type == EquipType.Legs).EquipName; + int equipSlotLegs = EquipLoader.GetEquipSlot(Mod, name ?? Name, EquipType.Legs); + ArmorIDs.Legs.Sets.HidesBottomSkin[equipSlotLegs] = true; + } + } + + public virtual bool CustomSetEquipType(Player player, EquipType type, Mod mod, string name) => false; + + public virtual void TransformFrameEffects(Player player) { } + + public virtual void TransformPostUpdate(Player player) { } + + public override void Load() + { + if (Main.netMode != NetmodeID.Server) + { + foreach (var v in EquipSlots) + { + if (v.AssetName == null) + continue; + EquipLoader.AddEquipTexture(Mod, AssetPath + v.AssetName + "_" + v.Type.ToString(), v.Type, this, v.EquipName); + } + } + } + + public override void SetStaticDefaults() + { + if (Main.netMode == NetmodeID.Server) + return; + + ArmorIDSets(); + } + } + + public class TransformationPlayer : ModPlayer + { + public override void Load() + { + On_Player.ResetVisibleAccessories += ResetTransformation; + On_Player.UpdateVisibleAccessory += SetTransformationItem; + } + + internal TransformationAccessory currentTransformation = null; + int previousHighest = -1; + int currentHighest = -1; + + public int Type + { + get => currentTransformation == null ? -1 : currentTransformation.Type; + + set + { + ModItem item = ModContent.GetModItem(value); + if (item != null && item is TransformationAccessory trans) + { + currentTransformation = trans; + currentTransformation.IsForced = true; + } + else + currentTransformation = null; + } + } + + private void ResetTransformation(On_Player.orig_ResetVisibleAccessories orig, Player self) + { + orig(self); + + Reset(self); + } + + private void Reset(Player p) + { + previousHighest = currentHighest; + currentHighest = -1; + + if (p.Transformation().currentTransformation != null && !p.Transformation().currentTransformation.IsForced) + p.Transformation().currentTransformation = null; + } + + private void SetTransformationItem(On_Player.orig_UpdateVisibleAccessory orig, Player self, int itemSlot, Item item, bool modded) + { + orig(self, itemSlot, item, modded); + + if (self.Transformation().currentTransformation == null || !self.Transformation().currentTransformation.IsForced) + { + if (item.ModItem is TransformationAccessory transformation && transformation.ShouldTransform.Invoke(self) && (currentTransformation == null || transformation.Priority >= currentTransformation.Priority)) + self.Transformation().currentTransformation = transformation; + } + + if (currentHighest < itemSlot) + currentHighest = itemSlot; + + if (self.Transformation().currentTransformation != null && itemSlot == previousHighest) // last item slot, can set equip slots to our transformation if one is equipped + { + TransformationAccessory trans = self.Transformation().currentTransformation; + bool[] list = new bool[15]; + foreach (var (Type, AssetName, EquipName) in trans.EquipSlots) + { + string name = AssetName == null ? null : EquipName ?? trans.Name; + if (!trans.CustomSetEquipType(self, Type, Mod, name) && !list[(int)Type]) + { + SetEquipSlot(self, Type, Mod, name); + list[(int)Type] = true; + } + } + if (trans.ShouldHideAccessories) + self.HideAccessories(); + } + } + + public override void UpdateAutopause() + { + if (currentTransformation != null) + { + if (!currentTransformation.CustomSetEquipType(Player, EquipType.Head, Mod, currentTransformation.Name)) + { + var (Type, AssetName, EquipName) = currentTransformation.EquipSlots.First(v => v.Type == EquipType.Head); + string name = (EquipName == null && AssetName == null) ? null : EquipName ?? currentTransformation.Name; + SetEquipSlot(Player, EquipType.Head, Mod, name); + } + } + + Reset(Player); + } + + public override void ModifyDrawInfo(ref PlayerDrawSet drawInfo) + { + if (currentTransformation != null) + { + currentTransformation.ModifyDrawInfo(ref drawInfo); + + if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Head)) + { + drawInfo.headGlowMask = -1; + drawInfo.helmetOffset = Vector2.Zero; + } + + if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Body)) + { + drawInfo.bodyGlowMask = -1; + } + + if (currentTransformation.EquipSlots.Any(s => s.Type == EquipType.Legs)) + { + drawInfo.legsGlowMask = -1; + drawInfo.legsOffset = Vector2.Zero; + } + } + } + + public override void FrameEffects() + { + if (currentTransformation != null) + { + currentTransformation.TransformFrameEffects(Player); + + if (currentTransformation.ShouldHideAccessories) + Player.HideAccessories(); + } + } + + public override void PostUpdate() + { + currentTransformation?.TransformPostUpdate(Player); + } + + public static void SetEquipSlot(Player player, EquipType type, Mod mod, string name) + { + switch (type) + { + case EquipType.Head: + player.head = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Body: + player.body = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Legs: + player.legs = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.HandsOn: + player.handon = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.HandsOff: + player.handoff = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Back: + player.back = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Front: + player.front = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Shoes: + player.shoe = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Waist: + player.waist = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Wings: + player.wings = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Shield: + player.shield = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Neck: + player.neck = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Face: + player.face = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Balloon: + player.balloon = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + case EquipType.Beard: + player.beard = name == null ? -1 : EquipLoader.GetEquipSlot(mod, name, type); + break; + } + } + + public static int GetEquipSlot(Player player, EquipType type) => type switch + { + EquipType.Head => player.head, + EquipType.Body => player.body, + EquipType.Legs => player.legs, + EquipType.HandsOn => player.handon, + EquipType.HandsOff => player.handoff, + EquipType.Back => player.back, + EquipType.Front => player.front, + EquipType.Shoes => player.shoe, + EquipType.Waist => player.waist, + EquipType.Wings => player.wings, + EquipType.Shield => player.shield, + EquipType.Neck => player.neck, + EquipType.Face => player.face, + EquipType.Balloon => player.balloon, + EquipType.Beard => player.beard, + _ => -1, + }; + + public static EquipTexture GetEquipTexture(Player p, EquipType type) => EquipLoader.GetEquipTexture(type, GetEquipSlot(p, type)); + } +} diff --git a/Items/BrimstoneLocus.cs b/Items/BrimstoneLocus.cs index cb7ab3a98b..5572578b6c 100644 --- a/Items/BrimstoneLocus.cs +++ b/Items/BrimstoneLocus.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items { Item.width = 20; Item.height = 20; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = 0; } diff --git a/Items/CalamityGlobalItem.cs b/Items/CalamityGlobalItem.cs index a0575aa0dc..655834a6a5 100644 --- a/Items/CalamityGlobalItem.cs +++ b/Items/CalamityGlobalItem.cs @@ -8,6 +8,13 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Armor.Bloodflare; +using CalamityMod.Items.Armor.GodSlayer; +using CalamityMod.Items.Armor.Hydrothermic; +using CalamityMod.Items.Armor.Prismatic; +using CalamityMod.Items.Armor.Reaver; +using CalamityMod.Items.Armor.Tarragon; +using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.VanillaArmorChanges; @@ -18,6 +25,7 @@ using CalamityMod.NPCs.Other; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Packets; using CalamityMod.Particles; +using CalamityMod.Projectiles.Healing; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; @@ -41,6 +49,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.IO; using Terraria.Utilities; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items { @@ -122,11 +131,6 @@ namespace CalamityMod.Items ///
public bool devItem = false; /// - /// If true, this item can fire projectiles with point-blank damage.
- /// Also adds a tooltip line to the bottom of the item's tooltip. - ///
- public bool canFirePointBlankShots = false; - /// /// If set to a value greater than 1, applies a multiplier to the item's grab range.
/// Used by coin items spawned from hitting ricoshot coins. ///
@@ -169,7 +173,6 @@ namespace CalamityMod.Items myClone.revengeanceItem = revengeanceItem; myClone.donorItem = donorItem; myClone.devItem = devItem; - myClone.canFirePointBlankShots = canFirePointBlankShots; myClone.grabRangeMultiplier = grabRangeMultiplier; return myClone; @@ -237,6 +240,10 @@ namespace CalamityMod.Items if (item.accessory) CannotBeEnchanted = true; + // Music boxes are pre-boss and sold from the Merchant, so they should now use the blue rarity. + if (item.type == ItemID.MusicBox || item.createTile == TileID.MusicBoxes || ItemID.Sets.ShimmerTransformToItem[item.type] == ItemID.MusicBox) + item.rare = ItemRarityID.Blue; + // Modified Pearlwood items are now Light Red. if (item.type == ItemID.PearlwoodBow || item.type == ItemID.PearlwoodHammer || item.type == ItemID.PearlwoodSword) item.rare = ItemRarityID.LightRed; @@ -255,7 +262,7 @@ namespace CalamityMod.Items // Zenith rarity if (item.type == ItemID.Zenith) - item.rare = ModContent.RarityType(); + item.rare = RarityType(); // Make most expert items no longer expert because they drop in all modes now. switch (item.type) @@ -338,9 +345,9 @@ namespace CalamityMod.Items if (Main.myPlayer == player.whoAmI && player.Calamity().cursedSummonsEnchant) { - if (NPC.CountNPCS(ModContent.NPCType()) < 2) + if (NPC.CountNPCS(NPCType()) < 2) { - CalamityNetcode.NewNPC_ClientSide(mouse, ModContent.NPCType(), player); + CalamityNetcode.NewNPC_ClientSide(mouse, NPCType(), player); SoundEngine.PlaySound(SoundID.DD2_DarkMageSummonSkeleton, mouse); } } @@ -351,7 +358,7 @@ namespace CalamityMod.Items // // Traitorous has been reworked to be a guaranteed effect below 25% mana, which removes all your remaining mana bool belowManaThreshold = player.statMana < player.statManaMax2 * 0.25f; - bool traitorousAlreadyInPlay = player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + bool traitorousAlreadyInPlay = player.ownedProjectileCounts[ProjectileType()] > 0; if (Main.myPlayer == player.whoAmI && player.Calamity().manaMonsterEnchant && !traitorousAlreadyInPlay && belowManaThreshold) { // Calculate how much damage to deal based on how much mana was consumed @@ -361,7 +368,7 @@ namespace CalamityMod.Items // Spawn the Mana Monster Vector2 shootVelocity = player.SafeDirectionTo(mouse, -Vector2.UnitY).RotatedByRandom(0.07f) * Main.rand.NextFloat(4f, 5f); - Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ModContent.ProjectileType(), monsterDamage, 0f, player.whoAmI); + Projectile.NewProjectile(source, player.Center + shootVelocity, shootVelocity, ProjectileType(), monsterDamage, 0f, player.whoAmI); // Set the player's mana to zero. player.statMana = 0; @@ -374,10 +381,8 @@ namespace CalamityMod.Items modPlayer.canFireBloodflareMageProjectile = false; if (player.whoAmI == Main.myPlayer) { - // Bloodflare Mage Bolt: 130%, soft cap starts at 2000 base damage - int bloodflareBoltDamage = CalamityUtils.DamageSoftCap(damage * 1.3, 2600); - - Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType(), bloodflareBoltDamage, 1f, player.whoAmI); + int bloodflareBoltDamage = CalamityUtils.DamageSoftCap(damage * BloodflareHeadMagic.GhostBoltDamageRatio, BloodflareHeadMagic.GhostBoltonDamageSoftcap); + Projectile.NewProjectile(playerSource, position, velocity, ProjectileType(), bloodflareBoltDamage, 1f, player.whoAmI); } } } @@ -388,22 +393,19 @@ namespace CalamityMod.Items modPlayer.canFireBloodflareRangedProjectile = false; if (player.whoAmI == Main.myPlayer) { - // Bloodflare Ranged Bloodsplosion: 80%, soft cap starts at 150 base damage - // This is intentionally extremely low because this effect can be grossly overpowered with sniper rifles and the like. - int bloodsplosionDamage = CalamityUtils.DamageSoftCap(damage * 0.8, 120); - - Projectile.NewProjectile(playerSource, position, velocity, ModContent.ProjectileType(), bloodsplosionDamage, 2f, player.whoAmI); + int bloodsplosionDamage = CalamityUtils.DamageSoftCap(damage * BloodflareHeadRanged.BloodBombDamageRatio, BloodflareHeadRanged.BloodBombDamageSoftcap); + Projectile.NewProjectile(playerSource, position, velocity, ProjectileType(), bloodsplosionDamage, 2f, player.whoAmI); } } } if (modPlayer.tarraMage && !item.channel) { - if (modPlayer.tarraCrits >= 5 && player.whoAmI == Main.myPlayer) + if (modPlayer.tarraCrits >= TarragonHeadMagic.CritsToSpawnLeaves && player.whoAmI == Main.myPlayer) { modPlayer.tarraCrits = 0; // Tarragon Mage Leaves: (8-10) x 20%, soft cap starts at 200 base damage int leafAmt = 8 + Main.rand.Next(3); // 8, 9, or 10 - int leafDamage = (int)(damage * 0.2f); + int leafDamage = (int)(damage * TarragonHeadMagic.LeafDamageRatio); for (int l = 0; l < leafAmt; l++) { @@ -427,8 +429,8 @@ namespace CalamityMod.Items modPlayer.canFireAtaxiaRangedProjectile = false; if (player.whoAmI == Main.myPlayer) { - int ataxiaFlareDamage = (int)(damage * 0.25f); - Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), ataxiaFlareDamage, 2f, player.whoAmI); + int ataxiaFlareDamage = (int)(damage * HydrothermicHeadRanged.FlareDamageRatio); + Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ProjectileType(), ataxiaFlareDamage, 2f, player.whoAmI); } } } @@ -439,10 +441,8 @@ namespace CalamityMod.Items modPlayer.canFireGodSlayerRangedProjectile = false; if (player.whoAmI == Main.myPlayer) { - // God Slayer Ranged Shrapnel: 100%, soft cap starts at 800 base damage - int shrapnelRoundDamage = CalamityUtils.DamageSoftCap(damage, 800); - - Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), shrapnelRoundDamage, 2f, player.whoAmI); + int shrapnelRoundDamage = CalamityUtils.DamageSoftCap(damage * GodSlayerHeadRanged.ShrapnelRoundDamageRatio, GodSlayerHeadRanged.ShrapnelRoundDamageSoftcap); + Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ProjectileType(), shrapnelRoundDamage, 2f, player.whoAmI); } } } @@ -451,10 +451,8 @@ namespace CalamityMod.Items if (item.CountsAsClass() && !item.channel) { modPlayer.canFireAtaxiaRogueProjectile = false; - int flareID = ModContent.ProjectileType(); - - // Hydrothermic Rogue Flares: 6 x (50 + 15%), soft cap starts at 90 base damage - int flareDamage = CalamityUtils.DamageSoftCap(50 + damage * 0.15, 90); + int flareID = ProjectileType(); + int flareDamage = CalamityUtils.DamageSoftCap(HydrothermicHeadRogue.VolleyDamage + damage * HydrothermicHeadRogue.VolleyDamageRatio, HydrothermicHeadRogue.VolleyDamageSoftcap); if (player.whoAmI == Main.myPlayer) { @@ -467,24 +465,9 @@ namespace CalamityMod.Items } } } - if (modPlayer.victideSet) - { - if ((item.CountsAsClass() || item.CountsAsClass() || item.CountsAsClass() || - item.CountsAsClass() || item.CountsAsClass()) && - Main.rand.NextBool(10) && !item.channel) - { - if (player.whoAmI == Main.myPlayer) - { - // Victide All-class Seashells: 200%, soft cap starts at 46 base damage - int seashellDamage = CalamityUtils.DamageSoftCap(damage * 2, 46); - - Projectile.NewProjectile(playerSource, position, velocity * 1.25f, ModContent.ProjectileType(), seashellDamage, 1f, player.whoAmI); - } - } - } if (modPlayer.prismaticRegalia) { - if (item.CountsAsClass() && Main.rand.NextBool(20) && !item.channel) + if (item.CountsAsClass() && Main.rand.NextBool(PrismaticRegalia.RocketChanceDenominator) && !item.channel) { if (player.whoAmI == Main.myPlayer) { @@ -493,7 +476,7 @@ namespace CalamityMod.Items if (i != 0) { Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); - int rocket = Projectile.NewProjectile(playerSource, position, perturbedSpeed, ModContent.ProjectileType(), (int)(damage * 0.25), 2f, player.whoAmI, 0, 12f); + int rocket = Projectile.NewProjectile(playerSource, position, perturbedSpeed, ProjectileType(), (int)(damage * PrismaticRegalia.RocketDamageRatio), 2f, player.whoAmI, 0, 12f); //First extra value is rocket type which I just used 0 to get the default, second is the velocity I went with my gut feeling and got quite close to Scorpio's velocity with Rockets I if (rocket.WithinBounds(Main.maxProjectiles)) Main.projectile[rocket].DamageType = DamageClass.Generic; @@ -583,13 +566,10 @@ namespace CalamityMod.Items tag.Add("charge", Charge); tag.Add("enchantmentID", AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); tag.Add("DischargeEnchantExhaustion", DischargeEnchantExhaustion); - tag.Add("canFirePointBlankShots", canFirePointBlankShots); } public override void LoadData(Item item, TagCompound tag) { - canFirePointBlankShots = tag.GetBool("canFirePointBlankShots"); - // Changed charge from int to float. If an old charge int is present, load that instead. if (tag.ContainsKey("Charge")) Charge = tag.GetInt("Charge"); @@ -608,11 +588,6 @@ namespace CalamityMod.Items public override void NetSend(Item item, BinaryWriter writer) { - BitsByte flags = new BitsByte(); - flags[0] = canFirePointBlankShots; - // rip, no other flags. what a byte. - - writer.Write(flags); writer.Write(Charge); writer.Write(AppliedEnchantment.HasValue ? AppliedEnchantment.Value.ID : 0); writer.Write(DischargeEnchantExhaustion); @@ -620,9 +595,6 @@ namespace CalamityMod.Items public override void NetReceive(Item item, BinaryReader reader) { - BitsByte flags = reader.ReadByte(); - canFirePointBlankShots = flags[0]; - Charge = reader.ReadSingle(); Enchantment? savedEnchantment = EnchantmentManager.FindByID(reader.ReadInt32()); @@ -643,7 +615,7 @@ namespace CalamityMod.Items // Prevent Mana Stars from being picked up while wielding Ion Blaster or Apoctosis Array if (item.type == ItemID.Star || item.type == ItemID.SoulCake || item.type == ItemID.SugarPlum) { - if (player.ActiveItem().type == ModContent.ItemType() || player.ActiveItem().type == ModContent.ItemType()) + if (player.ActiveItem().type == ItemType() || player.ActiveItem().type == ItemType()) return false; } return base.CanPickup(item, player); @@ -666,9 +638,14 @@ namespace CalamityMod.Items // Clear Evil Smasher buffs if not holding Evil Smasher if (player.Calamity().evilSmasherBoost > 0) { - if (item.type != ModContent.ItemType()) + if (item.type != ItemType()) player.Calamity().evilSmasherBoost = 0; } + + if (player.Calamity().ChaosStone && item.mana == 0 && !player.ItemTimeIsZero) + { + player.manaRegenDelay = player.maxRegenDelay; + } } public override bool? UseItem(Item item, Player player) @@ -677,27 +654,46 @@ namespace CalamityMod.Items if (Main.zenithWorld && item.type == ItemID.RodOfHarmony) { - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(NPCType())) { //one hour of NOU when using rod of harmony while LORDE is alive - player.AddBuff(ModContent.BuffType(), 3600 * 60); + player.AddBuff(BuffType(), 3600 * 60); } } // Give 1 minute of Mushy buff when consuming Mushrooms with Fungal Symbiote equipped. if (item.type == ItemID.Mushroom && player.Calamity().fungalSymbiote) - player.AddBuff(ModContent.BuffType(), 3600); + player.AddBuff(BuffType(), 3600); - // Trigger Bloom Stone's heal over time from healing items - if (item.healLife > 0 && modPlayer.bloomStone) + // Healing item interactions + if (item.healLife > 0) { - // Temporarily disable Bloom Stone so that GetHealLife doesn't return 0 - modPlayer.bloomStone = false; - modPlayer.bloomStoneTotalHeal = player.GetHealLife(item); - modPlayer.bloomStone = true; + // Jelly aura spawning + // This runs twice per use for whatever reason so we need a stopping player variable + if (player.whoAmI == Main.myPlayer && !modPlayer.spawnedJellyAura) + { + if (modPlayer.absorber) + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI); + else if (modPlayer.GrandGelatin) + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI); + else + { + if (modPlayer.cleansingjelly) + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI); + if (modPlayer.lifejelly) + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI); + } + modPlayer.spawnedJellyAura = true; + } - modPlayer.bloomStoneHealInc = modPlayer.bloomStoneTotalHeal / 15; - modPlayer.bloomStoneHealTimer = (int)Math.Ceiling(modPlayer.bloomStoneTotalHeal / (double)modPlayer.bloomStoneHealInc) * 40; + // Trigger Bloom Stone's heal over time from healing items + if (modPlayer.bloomStone) + { + // Temporarily disable Bloom Stone so that GetHealLife doesn't return 0 + modPlayer.bloomStone = false; + modPlayer.bloomStoneTotalHeal = modPlayer.bloomStoneHealPool = player.GetHealLife(item); + modPlayer.bloomStone = true; + } } // Staff/Axe of Regrowth growing Calamity grass @@ -706,22 +702,21 @@ namespace CalamityMod.Items Tile tile = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY); Tile tileAbove = Framing.GetTileSafely(Player.tileTargetX, Player.tileTargetY - 1); - if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + if (tile.HasTile && !tileAbove.HasTile && tileAbove.LiquidAmount == 0 && tile.TileType == TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) { - Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)TileType(); SoundEngine.PlaySound(SoundID.Dig, player.Center); return true; } - else if (tile.HasTile && tile.TileType == ModContent.TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) + else if (tile.HasTile && tile.TileType == TileType() && player.IsInTileInteractionRange(Player.tileTargetX, Player.tileTargetY, TileReachCheckSettings.Simple)) { - Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)ModContent.TileType(); + Main.tile[Player.tileTargetX, Player.tileTargetY].TileType = (ushort)TileType(); SoundEngine.PlaySound(SoundID.Dig, player.Center); return true; } } - return base.UseItem(item, player); } @@ -731,42 +726,7 @@ namespace CalamityMod.Items { return false; } - if (player.ActiveItem().type == ModContent.ItemType()) - { - bool hasBlades = false; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI && p.localAI[1] == 0f) - { - hasBlades = true; - break; - } - } - if (hasBlades) - { - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.ModProjectile is IgneousBlade) - { - if (p.ModProjectile().Firing) - continue; - } - if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI && p.localAI[1] == 0f) - { - p.rotation = MathHelper.PiOver2 + MathHelper.PiOver4; - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - p.velocity = p.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 22f; - p.rotation += p.velocity.ToRotation(); - p.ai[0] = 180f; - p.ModProjectile().Firing = true; - p.tileCollide = true; - p.netUpdate = true; - } - } - } - return false; - } - if (player.ActiveItem().type == ModContent.ItemType() && player.ownedProjectileCounts[ModContent.ProjectileType()] == 0) + if (player.ActiveItem().type == ItemType() && player.ownedProjectileCounts[ProjectileType()] == 0) { foreach (Projectile p in Main.ActiveProjectiles) { @@ -781,13 +741,13 @@ namespace CalamityMod.Items } return false; } - if (player.ActiveItem().type == ModContent.ItemType()) + if (player.ActiveItem().type == ItemType()) { bool canContinue = true; int count = 0; foreach (Projectile p in Main.ActiveProjectiles) { - if (p.type == ModContent.ProjectileType() && p.owner == player.whoAmI) + if (p.type == ProjectileType() && p.owner == player.whoAmI) { if (p.ai[1] > 1f) { @@ -817,7 +777,7 @@ namespace CalamityMod.Items if (Main.projectile.Length == Main.maxProjectiles) break; int GlacialEmbraceDamage = (int)player.GetTotalDamage().ApplyTo(80); - int projj = Projectile.NewProjectile(source, mouse, Vector2.Zero, ModContent.ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); + int projj = Projectile.NewProjectile(source, mouse, Vector2.Zero, ProjectileType(), GlacialEmbraceDamage, 1f, player.whoAmI, angle, 2f); Main.projectile[projj].originalDamage = 80; angle += angleVariance; @@ -844,7 +804,11 @@ namespace CalamityMod.Items if (PopupGUIManager.AnyGUIsActive) return false; - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0 && + // Can't use anything while burrowing + if (player.ownedProjectileCounts[ProjectileType()] > 0) + return false; + + if (player.ownedProjectileCounts[ProjectileType()] > 0 && (item.damage > 0 || item.ammo != AmmoID.None)) { return false; // Don't use weapons if you're charging with a spear @@ -856,7 +820,7 @@ namespace CalamityMod.Items return base.CanUseItem(item, player); // Conversion for Andromeda - if (player.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + if (player.ownedProjectileCounts[ProjectileType()] > 0) { if (item.type == ItemID.WireKite) return false; @@ -912,7 +876,7 @@ namespace CalamityMod.Items // Handle general use-item effects for the Gem Tech Armor. player.Calamity().GemTechState.OnItemUseEffects(item); - if (item.type == ItemID.MonkStaffT1 || AutoreusableSpearsList.Includes(item.type)) + if (item.type == ItemID.MonkStaffT1 || CalamityItemSets.AutoreusableSpear[item.type]) { return player.ownedProjectileCounts[item.shoot] <= 0; } @@ -996,7 +960,6 @@ namespace CalamityMod.Items // 10% charge = 83% damage // 0% charge = 41.33% damage // - // Fabsol - I changed this formula because it was bad and confusing, and I had promised to do so a while ago. internal float ChargeDamageFormula() { float x = MathHelper.Clamp(ChargeRatio, 0f, 1f); @@ -1026,7 +989,7 @@ namespace CalamityMod.Items target.Calamity().hyperiusDamage -= damage; // Spawn overflow hit - Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, player.whoAmI, target.whoAmI); + Projectile overflow = Projectile.NewProjectileDirect(target.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(damage * HyperiusBullet.overflowEfficency), 0, player.whoAmI, target.whoAmI); overflow.DamageType = item.DamageType; overflow.ArmorPenetration = item.ArmorPenetration; // Takes the armor pen from what did the hit @@ -1142,7 +1105,7 @@ namespace CalamityMod.Items player.endurance -= 0.12f; // Solar Flare armor dash overrides modded dashes by default - if (player.solarShields > 0) + if (player.solarShields > 0 || player.wingsLogic == (int)VanillaWingID.WingsSolar) modPlayer.DashID = string.Empty; } } @@ -1225,6 +1188,11 @@ namespace CalamityMod.Items player.GetCritChance() -= 15; break; + case ItemID.ShroomiteBreastplate: + player.GetDamage() -= 0.05f; + player.GetCritChance() -= 5; + break; + case ItemID.SquireAltHead: player.GetDamage() += 0.05f; player.GetDamage() += 0.05f; @@ -1276,10 +1244,6 @@ namespace CalamityMod.Items { CalamityPlayer modPlayer = player.Calamity(); - // Obsidian Skull and its upgrades make you immune to On Fire! - if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaWaders || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose || item.type == ItemID.AnkhShield) - player.buffImmune[BuffID.OnFire] = true; - // Ankh Shield Mighty Wind immunity. if (item.type == ItemID.AnkhShield) player.buffImmune[BuffID.WindPushed] = true; @@ -1299,17 +1263,6 @@ namespace CalamityMod.Items player.buffImmune[BuffID.OnFire] = true; } - // Reduced Nightwither and Holy Flames damage. - if (item.type == ItemID.MoonStone) - modPlayer.reducedNightwitherDamage = true; - if (item.type == ItemID.SunStone) - modPlayer.reducedDaybrokenDamage = true; - if (item.type == ItemID.CelestialStone || item.type == ItemID.CelestialShell) - { - modPlayer.reducedDaybrokenDamage = true; - modPlayer.reducedNightwitherDamage = true; - } - if (item.type == ItemID.FairyBoots) modPlayer.fairyBoots = true; @@ -1428,9 +1381,6 @@ namespace CalamityMod.Items player.GetAttackSpeed() -= 0.1f; } - if (item.type == ItemID.TerrasparkBoots) - player.buffImmune[BuffID.OnFire] = true; - if (item.type == ItemID.GravityGlobe) { player.GetJumpState().Enable(); @@ -1469,7 +1419,7 @@ namespace CalamityMod.Items { Vector2 ornamentPos = player.Center + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(105f)) * Main.rand.NextFloat(-512f, -320f); - int p = Projectile.NewProjectile(source, ornamentPos, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + int p = Projectile.NewProjectile(source, ornamentPos, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) modPlayer.wingProjectileCooldown = 90; } @@ -1485,7 +1435,7 @@ namespace CalamityMod.Items { Vector2 fairyDustVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.08f, 0.2f); - int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + int p = Projectile.NewProjectile(source, player.Center, fairyDustVel, ProjectileType(), 0, 0f, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) modPlayer.wingProjectileCooldown = 8; } @@ -1498,9 +1448,6 @@ namespace CalamityMod.Items if (item.type == ItemID.FleshKnuckles || item.type == ItemID.BerserkerGlove || item.type == ItemID.HeroShield) modPlayer.fleshKnuckles = true; - if (item.type == ItemID.WormScarf) - player.endurance -= 0.03f; - if (item.type == ItemID.RoyalGel) modPlayer.royalGel = true; @@ -1520,7 +1467,7 @@ namespace CalamityMod.Items float flightSpeedMult = 1f + (modPlayer.soaring ? SoaringPotion.FlightBoost : 0f) + - (modPlayer.reaverSpeed ? 0.1f : 0f) + + (modPlayer.reaverSpeed ? ReaverHeadMobility.SetBonusFlightBoost : 0f) + moveSpeedBoost; float flightAccMult = 1f + moveSpeedBoost; @@ -1570,10 +1517,11 @@ namespace CalamityMod.Items if (grabRangeMultiplier > 1f) grabRange = (int)(grabRangeMultiplier * grabRange); - // Then, if wearing the appropriate Reaver armor, add 246 flat item grab range. (2.625 + 15.375 = 18 tiles) - // For reference, Treasure Magnet adds 150 (2.625 + 9.375 = 12 tiles) + // Then, apply flat grab range boosts. if (player.Calamity().reaverExplore) - grabRange += 246; + grabRange += ReaverHeadExplore.SetBonusGrabRangeBoost; + if (player.Calamity().victideSnailSet) + grabRange += VictideHeadSnail.SetBonusGrabRangeBoost; // Nebula boosters have greater pickup range while using Nebula Mantle. if (player.wingsLogic == (int)VanillaWingID.WingsNebula && ItemID.Sets.NebulaPickup[item.type]) @@ -1582,7 +1530,7 @@ namespace CalamityMod.Items #endregion #region Ammo - public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().rangedAmmoCost; + public override bool CanConsumeAmmo(Item weapon, Item ammo, Player player) => Main.rand.NextFloat() <= player.Calamity().ammoCost; public static bool HasEnoughAmmo(Player player, Item item, int ammoConsumed) { @@ -1655,7 +1603,7 @@ namespace CalamityMod.Items dontConsumeAmmo = true; if (player.ammoCost75 && Main.rand.NextBool(4)) dontConsumeAmmo = true; - if (Main.rand.NextFloat() > player.Calamity().rangedAmmoCost) + if (Main.rand.NextFloat() > player.Calamity().ammoCost) dontConsumeAmmo = true; if (!dontConsumeAmmo && itemAmmo.consumable) @@ -1673,7 +1621,7 @@ namespace CalamityMod.Items #region PostUpdate public override void PostUpdate(Item item) { - if (ItemsForcedInsideWorldList.Includes(item.type)) + if (CalamityItemSets.ItemForcedInsideWorld[item.type]) CalamityUtils.ForceItemIntoWorld(item); } #endregion @@ -1692,12 +1640,12 @@ namespace CalamityMod.Items Texture2D itemTexture = TextureAssets.Item[item.type].Value; Rectangle itemFrame = (Main.itemAnimations[item.type] == null) ? itemTexture.Frame() : Main.itemAnimations[item.type].GetFrame(itemTexture); - if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ModContent.ItemType())) + if (!EnchantmentManager.ItemUpgradeRelationship.ContainsKey(item.type) || !Main.LocalPlayer.InventoryHas(ItemType())) return true; // Draw all particles. float currentPower = 0f; - int calamitasNPCIndex = NPC.FindFirstNPC(ModContent.NPCType()); + int calamitasNPCIndex = NPC.FindFirstNPC(NPCType()); if (calamitasNPCIndex != -1) currentPower = Utils.GetLerpValue(11750f, 1000f, Main.LocalPlayer.Distance(Main.npc[calamitasNPCIndex].Center), true); @@ -1722,7 +1670,7 @@ namespace CalamityMod.Items // This was moved out of an On edit in the DraedonsForge item for Magic Storage compatibility. Player p = Main.LocalPlayer; if (cachedForgeID < 0) - cachedForgeID = ModContent.TileType(); + cachedForgeID = TileType(); if (context is RecipeItemCreationContext && p.adjTile[cachedForgeID]) p.Calamity().HasCraftedDraedonsForge = true; } @@ -1761,7 +1709,7 @@ namespace CalamityMod.Items { storedPrefix = -1; // Bandit steals 20% of the total price of the reforge if she's around. - if (NPC.AnyNPCs(ModContent.NPCType())) + if (NPC.AnyNPCs(NPCType())) { // Calculate the item's reforge cost. int value = item.value; @@ -1789,11 +1737,11 @@ namespace CalamityMod.Items private static readonly int Rarity0BuyPrice = Item.buyPrice(0, 0, 50, 0); private static readonly int Rarity1BuyPrice = Item.buyPrice(0, 1, 0, 0); private static readonly int Rarity2BuyPrice = Item.buyPrice(0, 2, 0, 0); - private static readonly int Rarity3BuyPrice = Item.buyPrice(0, 4, 0, 0); - private static readonly int Rarity4BuyPrice = Item.buyPrice(0, 12, 0, 0); - private static readonly int Rarity5BuyPrice = Item.buyPrice(0, 24, 0, 0); - private static readonly int Rarity6BuyPrice = Item.buyPrice(0, 36, 0, 0); - private static readonly int Rarity7BuyPrice = Item.buyPrice(0, 48, 0, 0); + private static readonly int Rarity3BuyPrice = Item.buyPrice(0, 5, 0, 0); + private static readonly int Rarity4BuyPrice = Item.buyPrice(0, 10, 0, 0); + private static readonly int Rarity5BuyPrice = Item.buyPrice(0, 20, 0, 0); + private static readonly int Rarity6BuyPrice = Item.buyPrice(0, 35, 0, 0); + private static readonly int Rarity7BuyPrice = Item.buyPrice(0, 45, 0, 0); private static readonly int Rarity8BuyPrice = Item.buyPrice(0, 60, 0, 0); private static readonly int Rarity9BuyPrice = Item.buyPrice(0, 80, 0, 0); private static readonly int Rarity10BuyPrice = Item.buyPrice(1, 0, 0, 0); // Highest raw rarity used by vanilla items (ML drops) @@ -1863,17 +1811,17 @@ namespace CalamityMod.Items return RarityBuyPriceArray[rarity]; // Calamity rarities aren't guaranteed to have the monotonic IDs, so they're handled directly. - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityTurquoiseBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityPureGreenBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityDarkBlueBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityVioletBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityHotPinkBuyPrice; - if (rarity == ModContent.RarityType()) + if (rarity == RarityType()) return RarityCalamityRedBuyPrice; // Return 0 if it's not a progression based or other mod's rarity diff --git a/Items/CalamityGlobalItemLoot.cs b/Items/CalamityGlobalItemLoot.cs index bdf23947ce..3c2271b110 100644 --- a/Items/CalamityGlobalItemLoot.cs +++ b/Items/CalamityGlobalItemLoot.cs @@ -31,17 +31,17 @@ namespace CalamityMod.Items { #region Boss Treasure Bags case ItemID.KingSlimeBossBag: - loot.DefineConditionalDropSet(DropHelper.NotRemix).Add(ItemID.Katana, 3); // 33% Katana - loot.DefineConditionalDropSet(DropHelper.Remix).Add(ItemID.Keybrand, 3); // 33% Keybrand in Remix + loot.DefineConditionalDropSet(DropHelper.NotRemix).Add(ItemID.Katana, DropHelper.BagWeaponDropRateInt); // 33% Katana + loot.DefineConditionalDropSet(DropHelper.Remix).Add(ItemID.Keybrand, DropHelper.BagWeaponDropRateInt); // 33% Keybrand in Remix - loot.Add(new CommonDrop(ModContent.ItemType(), 10)); // 10% Crown Jewel + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); // 33% Crown Jewel loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; case ItemID.EyeOfCthulhuBossBag: - loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateInt); // 33% Deathstare Rod - loot.Add(ModContent.ItemType(), 10); // 10% Teardrop Cleaver + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); // 33% Deathstare Rod + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); // 33% Teardrop Cleaver loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -51,8 +51,8 @@ namespace CalamityMod.Items // We don't care. case ItemID.EaterOfWorldsBossBag: var eowRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); - eowRevLCR.Add(ItemID.DemoniteOre, 1, 90, 135); // 100% 90-135 Demonite Ore - eowRevLCR.Add(ItemID.ShadowScale, 1, 35, 55); // 100% 35-55 Shadow Scale + eowRevLCR.Add(ItemID.DemoniteOre, 1, 70, 90); // 100% 70-90 Demonite Ore + eowRevLCR.Add(ItemID.ShadowScale, 1, 20, 30); // 100% 20-30 Shadow Scale loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -62,11 +62,9 @@ namespace CalamityMod.Items // This can theoretically be exploited by killing the boss on Expert, then turning on Rev to open the bags. // We don't care. case ItemID.BrainOfCthulhuBossBag: - // BoC drops less partial loot than EoW - // However, sell price is overall higher despite the lower yield var bocRevLCR = loot.DefineConditionalDropSet(DropHelper.If(() => CalamityWorld.revenge)); - bocRevLCR.Add(ItemID.CrimtaneOre, 1, 80, 120); // 100% 80-120 Crimtane Ore - bocRevLCR.Add(ItemID.TissueSample, 1, 25, 40); // 100% 25-40 Tissue Sample + bocRevLCR.Add(ItemID.CrimtaneOre, 1, 70, 90); // 100% 70-90 Crimtane Ore + bocRevLCR.Add(ItemID.TissueSample, 1, 20, 30); // 100% 20-30 Tissue Sample loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; @@ -95,7 +93,7 @@ namespace CalamityMod.Items ModContent.ItemType(), }; loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, queenBeeWeapons)); - loot.Add(ModContent.ItemType(), 10); // 10% The Bee + loot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); // 33% The Bee loot.Add(ItemID.Stinger, 1, 8, 12); // 100% 8-12 Stinger loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -107,6 +105,7 @@ namespace CalamityMod.Items int[] wofWeapons = new int[] { ItemID.BreakerBlade, + ModContent.ItemType(), ItemID.ClockworkAssaultRifle, ModContent.ItemType(), ItemID.LaserRifle, @@ -115,7 +114,6 @@ namespace CalamityMod.Items ModContent.ItemType() }; loot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, wofWeapons)); - loot.Add(ModContent.ItemType(), 10); // 10% Carnage int[] emblems = new int[] { @@ -147,7 +145,6 @@ namespace CalamityMod.Items case ItemID.TwinsBossBag: loot.Remove(FindHallowedBars(loot)); loot.AddIf(DropHelper.HallowedBarsCondition, ItemID.HallowedBar, 1, 20, 35); - loot.Add(ModContent.ItemType(), 10); // 10% Arbalest loot.AddRevBagAccessories(); loot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); break; diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index bbe4afbd13..6fbc26e8de 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -4,7 +4,9 @@ using System.Linq; using System.Text; using CalamityMod.Balancing; using CalamityMod.CustomRecipes; +using CalamityMod.DataStructures; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Demonshade; using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Tools; @@ -15,10 +17,10 @@ using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.Prefixes; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using Microsoft.Xna.Framework.Input; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -143,17 +145,10 @@ namespace CalamityMod.Items // Modify all vanilla tooltips before appending mod mechanics (if any). ModifyVanillaTooltips(item, tooltips); - // Adds "Does extra damage to enemies shot at point-blank range" to weapons capable of it. - if (canFirePointBlankShots) - { - LocalizedText lineText = CalamityUtils.GetText("Misc.PointBlank"); - TooltipLine line = new TooltipLine(Mod, "CalamityMod:PointBlankTooltip", lineText.Value); - tooltips.Insert(++lastTooltipIndex, line); - } - // If an item has an enchantment, show its prefix in the first tooltip line and append its description to the tooltip list. EnchantmentTooltips(item, tooltips); + WhipAutomaticTooltips(item, tooltips, ref lastTooltipIndex); // In GFB, replace all instances of "rogue" with "rouge". string[] rogueKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRogueUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRogueLowercase") }; string[] rougeKey = new string[] { CalamityUtils.GetTextValue($"Misc.GFBRougeUppercase"), CalamityUtils.GetTextValue($"Misc.GFBRougeLowercase") }; @@ -185,7 +180,7 @@ namespace CalamityMod.Items // Original code lifted from Iban's extended armor tooltips. if (item.ModItem is IHoldShiftTooltipItem holdShiftItem) { - bool holdingShift = Main.keyState.IsKeyDown(Keys.LeftShift); + bool holdingShift = Main.keyState.PressingShift(); // If holding SHIFT, actually display the extended tooltip. if (holdingShift && firstTooltipIndex != -1) @@ -286,14 +281,12 @@ namespace CalamityMod.Items #region Rarity Coloration private static void ApplyRarityColor(Item item, TooltipLine nameLine) { - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = Color.Lerp(Color.Red, Color.White, (float)Math.Sin(Main.GlobalTimeWrappedHourly) / 2f + 0.5f); - if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) + if (item.type == ModContent.ItemType() || item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); // Developer items - if (item.type == ModContent.ItemType()) - nameLine.OverrideColor = new Color(Main.DiscoR, 100, 255); + if (item.type == ModContent.ItemType()) + nameLine.OverrideColor = new Color(249, 197, 255); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = new Color(0, 0, 255); if (item.type == ModContent.ItemType()) @@ -302,6 +295,8 @@ namespace CalamityMod.Items nameLine.OverrideColor = new Color(0.34f, 0.34f + 0.66f * Main.DiscoG / 255f, 0.34f + 0.5f * Main.DiscoG / 255f); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); + if (item.type == ModContent.ItemType()) + nameLine.OverrideColor = ShatteredCommunity.GetRarityColor(); if (item.type == ModContent.ItemType()) nameLine.OverrideColor = CalamityUtils.ColorSwap(new Color(132, 37, 147), new Color(0, 255, 0), 5f); //alternates purple and neon green if (item.type == ModContent.ItemType()) @@ -411,6 +406,47 @@ namespace CalamityMod.Items } #endregion + #region Whip Tooltips + private void WhipAutomaticTooltips(Item item, IList tooltips, ref int lastTooltipIndex) + { + // Multiplicative tag changes + string FlatTagTooltip(int dmg) => (CalamityUtils.GetText($"Common.SummonTagDamageFlat").Format(dmg.ToString())); + string MultTagTooltip(float mult) => (CalamityUtils.GetText($"Common.SummonTagDamageMult").Format((mult + 1).ToString("0.##"))); + string CritTagTooltip(float crit) => (CalamityUtils.GetText($"Common.SummonTagCrit").Format((crit * 100).ToString("0.#"))); + + Dictionary TagByItem = new(); + foreach (SummonTag tag1 in CalamityBuffSets.SummonTagDebuff.Values) + { + if (tag1.TagItem > -1) TagByItem.Add(tag1.TagItem, tag1); + } + if (TagByItem.TryGetValue(item.type, out SummonTag tag)) + { + if (!tag.AutoDrawTooltip) return; + var modPlayer = Main.LocalPlayer.Calamity(); + if (tag.FlatTagDamage != 0) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:FlatSummonTag", FlatTagTooltip(tag.FlatTagDamage)); + tooltips.Insert(++lastTooltipIndex, line); + } + if (!modPlayer.forceSummonTagCrit && (tag.MultiplicativeTagDamage != 0 || (modPlayer.forceSummonTagMultiplicative && tag.TagCritChance != 0))) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:MultiplicativeSummonTag", MultTagTooltip(tag.MultiplicativeTagDamage + (modPlayer.forceSummonTagMultiplicative ? tag.TagCritChance : 0))); + tooltips.Insert(++lastTooltipIndex, line); + } + if (!modPlayer.forceSummonTagMultiplicative && (tag.TagCritChance != 0 || (modPlayer.forceSummonTagCrit && tag.MultiplicativeTagDamage != 0))) + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:CritSummonTag", CritTagTooltip(tag.TagCritChance + (modPlayer.forceSummonTagCrit ? tag.MultiplicativeTagDamage : 0))); + tooltips.Insert(++lastTooltipIndex, line); + } + if (modPlayer.forceSummonTagMultiplicative && modPlayer.forceSummonTagCrit) //when both tag and crit are forced, swaps between the two + { + TooltipLine line = new TooltipLine(Mod, "CalamityMod:CritSummonTag", ((int)(Main.GlobalTimeWrappedHourly / 5) % 2 == 0 ? CritTagTooltip(tag.MultiplicativeTagDamage + tag.TagCritChance) : MultTagTooltip(tag.MultiplicativeTagDamage + tag.TagCritChance))); + tooltips.Insert(++lastTooltipIndex, line); + } + } + } + #endregion + #region Vanilla Item Tooltip Modification private static void ModifyVanillaTooltips(Item item, IList tooltips) { @@ -493,10 +529,6 @@ namespace CalamityMod.Items // Numerous random tooltip edits which don't fit into another category #region Various Tooltip Edits - // Lilies of Finality 512 edit - if (item.type == ModContent.ItemType()) - EditTooltipByName("Damage", (line) => line.Text = LiliesOfFinality.TheNumber + Language.GetTextValue("LegacyTooltip.53")); - // Apparently 612 is a homestuck reference if (item.type == ModContent.ItemType()) EditTooltipByName("AxePower", (line) => line.Text = line.Text.Replace("610%", "612%")); @@ -532,18 +564,10 @@ namespace CalamityMod.Items if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && (item.type == ItemID.Pwnhammer || item.type == ItemID.Hammush)) EditTooltipByNum(0, (line) => line.Text += AddedTooltip("Pwnhammer")); - // Warmth Potion reduces debuff durations - if (item.type == ItemID.WarmthPotion) - EditTooltipByNum(0, (line) => line.Text += AddedTooltip("WarmthPotion")); - // Nerfed Archery Potion tooltip if (item.type == ItemID.ArcheryPotion) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ArcheryPotion")); - // Buffed Ironskin Potion tooltip - if (item.type == ItemID.IronskinPotion) - EditTooltipByNum(0, (line) => line.Text = GetEditedTooltip("IronskinPotion").Format(CalamityUtils.GetScalingDefense(-1))); - // Nerfed Swiftness Potion tooltip if (item.type == ItemID.SwiftnessPotion) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); @@ -581,6 +605,10 @@ namespace CalamityMod.Items // "Buffed" Step Stool if (item.type == ItemID.PortableStool) EditTooltipByNum(0, (line) => line.Text += AddedTooltip("PortableStool")); + + // Replace the double tap line if double tap dash is overridden + if ((item.type == ItemID.EoCShield || item.type == ItemID.Tabi) && CalamityKeybinds.DashHotkey.GetAssignedKeys().Count != 0) + EditTooltipByNum(1, (line) => line.Text = CalamityUtils.GetText("Vanilla.DashKey").Format(CalamityKeybinds.DashHotkey.TooltipHotkeyString())); #endregion // For boss summon item clarity @@ -636,8 +664,33 @@ namespace CalamityMod.Items EditTooltipByNum(0, (line) => line.Text = CalamityUtils.GetText("Vanilla.DodgeInfo").Format(BalancingConstants.BrainDodgeCooldownMin / 60, BalancingConstants.BrainDodgeCooldownMax / 60)); #endregion - // Weapon changes - #region Weapon changes + // Whip tag is dynamically generated for all whips based on the SummonTagDebuffDict, so we'll remove the vanilla tag tootlips. + #region Whip Tag removal + // Additive tag changes + if (item.type == ItemID.BlandWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.ThornWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.BoneWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.CoolWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.SwordWhip) + EditTooltipByNum(0, (line) => line.Text = string.Empty); + if (item.type == ItemID.MaceWhip) + { + EditTooltipByNum(0, (line) => line.Text = string.Empty); + EditTooltipByNum(1, (line) => line.Text = string.Empty); + } + if (item.type == ItemID.RainbowWhip) + { + EditTooltipByNum(0, (line) => line.Text = string.Empty); + EditTooltipByNum(1, (line) => line.Text = string.Empty); + } + #endregion + + // Other weapon changes + #region Other weapon changes // Aerial Bane is no longer the real bane of aerial enemies (50% dmg bonus removed) if (item.type == ItemID.DD2BetsyBow) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("DD2BetsyBow")); @@ -722,18 +775,11 @@ namespace CalamityMod.Items if (item.type == ItemID.HandOfCreation) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); - // Frozen Turtle Shell rebalance. - if (item.type == ItemID.FrozenTurtleShell) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("25%", "15%")); - - if (item.type == ItemID.FrozenShield) - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("25%", "15%")); - // Ale and Sake rebalance and Alcohol Poisoning. if (item.type == ItemID.Ale || item.type == ItemID.Sake) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("AleSake")); - //Flame Waker Boots buff. + // Flame Waker Boots buff. if (item.type == ItemID.FlameWakerBoots) EditTooltipByNum(0, (line) => line.Text = EditedTooltip("FlameWakerBoots")); @@ -745,27 +791,15 @@ namespace CalamityMod.Items if (item.type == ItemID.FairyBoots) EditTooltipByNum(2, (line) => line.Text += AddedTooltip("FairyBoots")); - // Reduced Nightwither and Daybroken damage, and melee speed removal. + // Melee speed removal. if (item.type == ItemID.MoonStone) - { - EditTooltipByNum(2, (line) => line.Text += AddedTooltip("MoonStone")); EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SunMoonStones")); - } if (item.type == ItemID.SunStone) - { - EditTooltipByNum(2, (line) => line.Text += AddedTooltip("SunStone")); EditTooltipByNum(1, (line) => line.Text = EditedTooltip("SunMoonStones")); - } if (item.type == ItemID.CelestialStone) - { - EditTooltipByNum(2, (line) => line.Text += AddedTooltip("CelestialStone")); EditTooltipByNum(0, (line) => line.Text = EditedTooltip("CelestialStoneShell")); - } if (item.type == ItemID.CelestialShell) - { - EditTooltipByNum(4, (line) => line.Text += AddedTooltip("CelestialStone")); EditTooltipByNum(2, (line) => line.Text = EditedTooltip("CelestialStoneShell")); - } // Mana Flower tinker buffs. if (item.type == ItemID.MagnetFlower) @@ -837,7 +871,7 @@ namespace CalamityMod.Items // Magic Power Potion nerf if (item.type == ItemID.MagicPowerPotion) - EditTooltipByNum(0, (line) => line.Text = EditedTooltip("MagicPowerPotion")); + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("20%", "10%")); // Featherfall Potion being stupid broken with Aero Stone if (item.type == ItemID.FeatherfallPotion) @@ -870,10 +904,6 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("15%", "9%")); } - // Worm Scarf only gives 14% DR instead of 17% - if (item.type == ItemID.WormScarf) - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("17%", "14%")); - // Feral Claws line melee speed and true melee damage changes if (item.type == ItemID.FeralClaws) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("12%", "10%")); @@ -899,21 +929,6 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = EditedTooltip("FireGauntlet2") + AddedTooltip("TitanGloveLine")); } - // On Fire! debuff immunities - if (item.type == ItemID.ObsidianSkull || item.type == ItemID.ObsidianSkullRose || item.type == ItemID.MoltenCharm) - EditTooltipByNum(0, (line) => line.Text = EditedTooltip("ObsidianSkullLine")); - - if (item.type == ItemID.ObsidianHorseshoe || item.type == ItemID.ObsidianShield || item.type == ItemID.ObsidianWaterWalkingBoots || item.type == ItemID.LavaSkull || item.type == ItemID.MoltenSkullRose) - EditTooltipByNum(1, (line) => line.Text = EditedTooltip("ObsidianSkullLine")); - - if (item.type == ItemID.LavaWaders) - EditTooltipByNum(1, (line) => line.Text = EditedTooltip("LavaWaders")); - - if (item.type == ItemID.TerrasparkBoots) - EditTooltipByNum(3, (line) => line.Text = EditedTooltip("LavaWaders")); - - // Ozzatron 23NOV2023: Removed tooltip edits for Magma Skull and Molten Skull Rose, as they were invalid after vanilla tooltip changes. - // Yoyo Glove/Bag apply a 0.5x damage multiplier on the second yoyo if (item.type == ItemID.YoyoBag || item.type == ItemID.YoYoGlove) EditTooltipByNum(0, (line) => line.Text += AddedTooltip("YoyoGlove")); @@ -923,63 +938,15 @@ namespace CalamityMod.Items EditTooltipByNum(1, (line) => line.Text = EditedTooltip("Gi")); #endregion - // Pre-Hardmode ore armor tooltip edits - #region Pre-Hardmode Ore Armor - // Copper - if (item.type == ItemID.CopperHelmet) - AddTooltip("CopperHelmet"); - if (item.type == ItemID.CopperChainmail) - AddTooltip("CopperChainmail"); - if (item.type == ItemID.CopperGreaves) - AddTooltip("CopperGreaves"); - - // Tin - if (item.type == ItemID.TinHelmet) - AddTooltip("TinHelmet"); - if (item.type == ItemID.TinChainmail) - AddTooltip("TinChainmail"); - if (item.type == ItemID.TinGreaves) - AddTooltip("TinGreaves"); - - // Iron - if (item.type == ItemID.IronHelmet || item.type == ItemID.AncientIronHelmet || item.type == ItemID.IronChainmail || item.type == ItemID.IronGreaves) - AddTooltip("IronPieces"); - - // Lead - if (item.type == ItemID.LeadHelmet || item.type == ItemID.LeadChainmail || item.type == ItemID.LeadGreaves) - AddTooltip("LeadPieces"); - - // Silver - if (item.type == ItemID.SilverHelmet) - AddTooltip("SilverHelmet"); - if (item.type == ItemID.SilverChainmail) - AddTooltip("SilverChainmail"); - if (item.type == ItemID.SilverGreaves) - AddTooltip("SilverGreaves"); - - // Tungsten - if (item.type == ItemID.TungstenHelmet) - AddTooltip("TungstenHelmet"); - if (item.type == ItemID.TungstenChainmail) - AddTooltip("TungstenChainmail"); - if (item.type == ItemID.TungstenGreaves) - AddTooltip("TungstenGreaves"); - - // Gold - if (item.type == ItemID.GoldHelmet || item.type == ItemID.AncientGoldHelmet) - AddTooltip("GoldHelmet"); - if (item.type == ItemID.GoldChainmail) - AddTooltip("GoldChainmail"); - if (item.type == ItemID.GoldGreaves) - AddTooltip("GoldGreaves"); - - // Platinum - if (item.type == ItemID.PlatinumHelmet) - AddTooltip("PlatinumHelmet"); - if (item.type == ItemID.PlatinumChainmail) - AddTooltip("PlatinumChainmail"); - if (item.type == ItemID.PlatinumGreaves) - AddTooltip("PlatinumGreaves"); + // Pre-Hardmode armor tooltip edits + #region Pre-Hardmode Armor + // Gladiator + if (item.type == ItemID.GladiatorHelmet) + EditTooltipByName("Defense", (line) => line.Text += "\n" + CalamityUtils.GetText("Common.RogueDamage").Format(GladiatorArmorSetChange.HelmetRogueDamageBoostPercent)); + if (item.type == ItemID.GladiatorBreastplate) + EditTooltipByName("Defense", (line) => line.Text += "\n" + CalamityUtils.GetText("Common.RogueCrit").Format(GladiatorArmorSetChange.ChestplateRogueCritBoostPercent)); + if (item.type == ItemID.GladiatorLeggings) + EditTooltipByName("Defense", (line) => line.Text += "\n" + CalamityUtils.GetText("Common.RogueVelocity").Format(GladiatorArmorSetChange.LeggingRogueVelocityBoostPercent)); // Jungle if (item.type == ItemID.JungleHat || item.type == ItemID.AncientCobaltHelmet) @@ -1008,7 +975,7 @@ namespace CalamityMod.Items #endregion // Hardmode armor tooltip edits - #region Hardmode Ore Armor + #region Hardmode Armor // Cobalt if (item.type == ItemID.CobaltHat) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("40", $"{CobaltArmorSetChange.MaxManaBoost + 40}")); @@ -1035,6 +1002,10 @@ namespace CalamityMod.Items if (item.type == ItemID.TitaniumMask) EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("9%", "14%")); + // Shroomite + if (item.type == ItemID.ShroomiteBreastplate) + EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("13%", "8%")); + // Solar Flare if (item.type == ItemID.SolarFlareHelmet) EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("26%", "20%")); @@ -1121,10 +1092,8 @@ namespace CalamityMod.Items // Non-consumable boss summon items #region Vanilla Boss Summon Non-consumable Tooltips - if (item.type == ItemID.SlimeCrown || item.type == ItemID.SuspiciousLookingEye || item.type == ItemID.BloodMoonStarter || item.type == ItemID.GoblinBattleStandard || - item.type == ItemID.WormFood || item.type == ItemID.BloodySpine || item.type == ItemID.Abeemination || item.type == ItemID.DeerThing || item.type == ItemID.QueenSlimeCrystal || - item.type == ItemID.PirateMap || item.type == ItemID.SnowGlobe || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || - item.type == ItemID.NaughtyPresent || item.type == ItemID.PumpkinMoonMedallion || item.type == ItemID.SolarTablet || item.type == ItemID.SolarTablet || item.type == ItemID.CelestialSigil) + if (item.type == ItemID.SlimeCrown || item.type == ItemID.SuspiciousLookingEye || item.type == ItemID.WormFood || item.type == ItemID.BloodySpine || item.type == ItemID.Abeemination || item.type == ItemID.DeerThing + || item.type == ItemID.QueenSlimeCrystal || item.type == ItemID.MechanicalEye || item.type == ItemID.MechanicalWorm || item.type == ItemID.MechanicalSkull || item.type == ItemID.CelestialSigil) EditTooltipByNum(0, (line) => line.Text += "\n" + CalamityUtils.GetTextValue("Common.NotConsumable")); #endregion @@ -1148,18 +1117,14 @@ namespace CalamityMod.Items EditTooltipByName("SetBonus", (line) => VanillaArmorChangeManager.ApplySetBonusTooltipChanges(item, ref line.Text)); - // Gladiator - if (item.type == ItemID.GladiatorHelmet) - EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueDamage").Format(GladiatorArmorSetChange.HelmetRogueDamageBoostPercent)); - if (item.type == ItemID.GladiatorBreastplate) - EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueCrit").Format(GladiatorArmorSetChange.ChestplateRogueCritBoostPercent)); - if (item.type == ItemID.GladiatorLeggings) - EditTooltipByName("Defense", (line) => line.Text += "\n" +CalamityUtils.GetText("Common.RogueVelocity").Format(GladiatorArmorSetChange.LeggingRogueVelocityBoostPercent)); - // Forbidden (UNLESS you are wearing the Circlet, which is Summon/Rogue and does not get this line) if ((item.type == ItemID.AncientBattleArmorHat || item.type == ItemID.AncientBattleArmorShirt || item.type == ItemID.AncientBattleArmorPants) && !Main.LocalPlayer.Calamity().forbiddenCirclet) - EditTooltipByName("SetBonus", (line) => line.Text = CalamityUtils.GetText($"Vanilla.Armor.SetBonus.Forbidden").Format(Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN"))); + EditTooltipByName("SetBonus", (line) => line.Text = CalamityUtils.GetText($"Vanilla.Armor.SetBonus.Forbidden").Format(CalamityUtils.GetArmorSetBonusKey())); + + // Vortex (hotkey spoof) + if (item.type == ItemID.VortexHelmet || item.type == ItemID.VortexBreastplate || item.type == ItemID.VortexLeggings) + EditTooltipByName("SetBonus", (line) => line.Text = CalamityUtils.GetText($"Vanilla.Armor.SetBonus.Vortex").Format(CalamityUtils.GetArmorSetBonusKey())); #endregion // Provide the full stats of every vanilla yoyo @@ -1232,7 +1197,7 @@ namespace CalamityMod.Items sb.Append('\n'); sb.Append(CalamityUtils.GetText($"Common.WingStats").Format(time.FramesToSeconds(), run.ToMph(), (tMax * baseJumpSpeed).ToMph())); sb.Append('\n'); - if (Main.keyState.IsKeyDown(Keys.LeftShift)) + if (Main.keyState.PressingShift()) { sb.Append(CalamityUtils.GetText($"Common.WingStatsAcceleration").Format(rAcc.ToMphps(), asc.ToMphps(), (asc + rise).ToMphps(), (rMax * baseJumpSpeed).ToMph(), (asc + fall).ToMphps())); if (hover) @@ -1491,20 +1456,16 @@ namespace CalamityMod.Items switch (item.prefix) { case PrefixID.Hard: - EditTooltipByName("PrefixAccDefense", - (line) => line.Text = line.Text.Replace("1", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.25f)); + EditTooltipByName("PrefixAccDefense", (line) => line.Text += DRString(0.25f)); return; case PrefixID.Guarding: - EditTooltipByName("PrefixAccDefense", - (line) => line.Text = line.Text.Replace("2", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.5f)); + EditTooltipByName("PrefixAccDefense", (line) => line.Text += DRString(0.5f)); return; case PrefixID.Armored: - EditTooltipByName("PrefixAccDefense", - (line) => line.Text = line.Text.Replace("3", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(0.75f)); + EditTooltipByName("PrefixAccDefense", (line) => line.Text += DRString(0.75f)); return; case PrefixID.Warding: - EditTooltipByName("PrefixAccDefense", - (line) => line.Text = line.Text.Replace("4", CalamityUtils.GetScalingDefense(item.prefix).ToString()) + DRString(1f)); + EditTooltipByName("PrefixAccDefense", (line) => line.Text += DRString(1f)); return; case PrefixID.Lucky: EditTooltipByName("PrefixAccCritChance", (line) => line.Text += AddedTooltip("LuckyPrefix")); @@ -1568,6 +1529,128 @@ namespace CalamityMod.Items #region Enchanted Rarity Text Drawing public override bool PreDrawTooltipLine(Item item, DrawableTooltipLine line, ref int yOffset) { + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + Color.DodgerBlue, + Color.Cyan, + Color.RoyalBlue + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/BloomRing").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float sine2 = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (5) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * -23 * squareSine * sine2 + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, square.Size() * 0.5f, (1.2f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), 0, texture.Size() * 0.5f, (0.65f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 6; + List eColors = new List() + { + new Color(248, 117, 52), + Color.Gold, + Color.Orange + }; + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (3.5f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + int length = line.Text.Length; + for (int i = 0; i < 8; i++) + { + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 23 + Vector2.UnitX * (i % 2 == 0 ? -10 * i : 10 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(0.3f - 0.02f * i, 1 + 0.35f * i) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + for (int i = 0; i < 10; i++) + { + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * (0 + i * 0.8f) / MathHelper.Pi); + float squareSine = (float)Math.Sin(i * 2.5f / MathHelper.Pi); + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * (60 + i * 2)) % 120)), 5)); + Vector2 weirdPos = Vector2.UnitX * 53 * i * (Utils.GetLerpValue(20, 0, i, true)) + Vector2.UnitY * 23 * squareSine + Vector2.UnitY * 5.5f * sine + new Vector2(5, 10); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(square, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2 + MathHelper.PiOver4, square.Size() * 0.5f, (1 - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + for (int t = 0; t < 3; t++) + Main.EntitySpriteDraw(texture2, basePosition + weirdPos, null, drawColor * (1 - 0.03f * i), clockSine * MathHelper.PiOver2, texture2.Size() * 0.5f, (0.6f - 0.07f * t) * new Vector2(1, 1) * (0.25f * ((float)Math.Pow(Utils.GetLerpValue(11, 0, i, true), 3) + 0.2f)), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } // Special enchantment line color. if (line.Name == "ItemName" && line.Mod == "Terraria" && item.IsEnchanted()) { @@ -1594,6 +1677,64 @@ namespace CalamityMod.Items return false; } + + if (line.Name == "ItemName" && line.Mod == "Terraria" && item.type == ModContent.ItemType()) + { + Color rarityColor = Color.White; + Vector2 basePosition = new Vector2(line.X, line.Y); + + float rate = Main.GlobalTimeWrappedHourly * 29; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color usedColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + + + float sine = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 / MathHelper.Pi); + sine = (float)Math.Pow(MathHelper.Lerp(sine, 0, 0.35f), 5); + Vector2 backScale = line.BaseScale; + Color backColor = usedColor; + Vector2 shake = Main.rand.NextVector2Circular(15, 15) * sine; + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, null, Main.UIScaleMatrix); + + int draws = 20; + for (int i = 0; i < draws; i++) + { + shake = Main.rand.NextVector2Circular(15, 15) * sine; + Vector2 backPosition = basePosition + (MathHelper.TwoPi * i / 20f).ToRotationVector2() * (5 + 0.5f * sine); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake * 4 + backPosition, backColor, line.Rotation, line.Origin, backScale, line.MaxWidth, line.Spread); + } + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = basePosition; + Color drawColor = backColor; + Vector2 rotationPoint = texture.Size() * 0.5f; + for (int i = 0; i < 6; i++) + { + int length = line.Text.Length; + Main.EntitySpriteDraw(texture, basePosition + Vector2.UnitX * length * 4 + Vector2.UnitY * 10 + Vector2.UnitX * (i % 2 == 0 ? -7 * i : 7 * i), null, drawColor, (MathHelper.PiOver2), rotationPoint, new Vector2(1 - 0.05f * i * (1 + 0.2f * -sine), 1 + 0.75f * i * (1 + 0.2f * sine) * 1f) * 0.3f * Main.rand.NextFloat(0.9f, 1f), SpriteEffects.None); + } + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, Main.UIScaleMatrix); + + // Draw the front text as usual. + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, line.Font, line.Text, shake + basePosition, rarityColor, line.Rotation, line.Origin, line.BaseScale, line.MaxWidth, line.Spread); + + return false; + } return true; } #endregion diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index 89826e8e40..f85e30be92 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -6,7 +6,9 @@ using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Items.Weapons.Typeless; +using CalamityMod.Physics; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -26,12 +28,13 @@ namespace CalamityMod.Items internal static void LoadTweaks() { - // Various shorthands for items which receive very simple changes, such as setting one flag. + // Various shorthands for items which receive very simple changes, or are repeated multiple times. IItemTweak[] trueMelee = Do(TrueMelee); IItemTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed); - IItemTweak[] pointBlank = Do(PointBlank); IItemTweak[] autoReuse = Do(AutoReuse); IItemTweak[] nonConsumableBossSummon = Do(MaxStack(1), NotConsumable, UseTimeExact(10)); + IItemTweak[] phaseblade = Do(AutoReuse, UseTurn, DamageExact(36)); + IItemTweak[] phasesaber = Do(DamageExact(132)); // SORTING NOTES: // 1. Sort tweaks by categories first, then sort by the internal name in alphabetical order. Navigate through categories and names using the search function. @@ -41,7 +44,7 @@ namespace CalamityMod.Items { #region CATEGORY 1: Weapon Balancing { ItemID.AdamantiteGlaive, Do(AutoReuse, TrueMelee, DamageExact(69), UseExact(7), ShootSpeedExact(18f)) }, - { ItemID.AdamantiteRepeater, Do(PointBlank, UseExact(14)) }, + { ItemID.AdamantiteRepeater, Do(UseExact(14)) }, { ItemID.AdamantiteSword, Do(UseTurn, DamageExact(75), UseExact(7)) }, { ItemID.AmberStaff, Do(UseTimeExact(15), UseAnimationExact(45), ReuseDelayExact(15)) }, { ItemID.AmethystStaff, Do(ManaExact(2)) }, @@ -54,33 +57,34 @@ namespace CalamityMod.Items { ItemID.BeeGun, Do(DamageExact(11), ManaExact(4)) }, { ItemID.BeeKeeper, Do(UseTurn, DamageExact(32)) }, { ItemID.Beenade, Do(DamageExact(11), UseTimeExact(22), ShootSpeedExact(10f)) }, - { ItemID.BeesKnees, Do(PointBlank, DamageExact(21), UseExact(38)) }, + { ItemID.BeesKnees, Do(DamageExact(21), UseExact(38)) }, { ItemID.Bladetongue, Do(UseTurn, UseRatio(0.8f), DamageExact(120)) }, { ItemID.BlizzardStaff, Do(DamageExact(41), ManaExact(7)) }, { ItemID.BloodyMachete, Do(AutoReuse, DamageExact(24)) }, - { ItemID.Blowgun, Do(PointBlank, DamageExact(40), ShootSpeedExact(15f)) }, - { ItemID.BluePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.BluePhasesaber, Do(DamageExact(132)) }, + { ItemID.Blowgun, Do(DamageExact(40), ShootSpeedExact(15f)) }, + { ItemID.BluePhaseblade, phaseblade }, + { ItemID.BluePhasesaber, phasesaber }, { ItemID.BoneSword, Do(AutoReuse, UseTurn, DamageExact(25)) }, { ItemID.BookofSkulls, Do(DamageExact(27), ManaExact(13), ShootSpeedExact(5.5f)) }, { ItemID.BookStaff, Do(ManaExact(14)) }, // Tome of Infinite Wisdom - { ItemID.Boomstick, Do(PointBlank, DamageExact(11)) }, + { ItemID.Boomstick, Do(DamageExact(11)) }, { ItemID.BreakerBlade, Do(AutoReuse, UseTurn, DamageExact(140)) }, - { ItemID.CandyCornRifle, Do(PointBlank, DamageExact(66)) }, + { ItemID.CandyCornRifle, Do(DamageExact(66)) }, { ItemID.Cascade, Do(AutoReuse, DamageExact(31)) }, { ItemID.ChainGuillotines, Do(DamageExact(100)) }, - { ItemID.ChainGun, Do(PointBlank, DamageExact(35)) }, + { ItemID.ChainGun, Do(DamageExact(35)) }, { ItemID.ChainKnife, Do(AutoReuse, DamageRatio(1.34f)) }, // Uses ratios due to remix seed { ItemID.ChlorophyteClaymore, Do(UseMeleeSpeed, DamageExact(180), UseExact(45), ShootSpeedExact(22f)) }, { ItemID.ChlorophytePartisan, Do(AutoReuse, UseMeleeSpeed, DamageExact(98)) }, { ItemID.ChlorophyteSaber, Do(UseMeleeSpeed, DamageExact(92), UseExact(10)) }, { ItemID.ChristmasTreeSword, Do(AutoReuse, UseTurn, UseMeleeSpeed, DamageExact(80), UseExact(30)) }, { ItemID.ClingerStaff, Do(DamageExact(63)) }, - { ItemID.ClockworkAssaultRifle, Do(PointBlank, DamageExact(21)) }, + { ItemID.ClockworkAssaultRifle, Do(DamageExact(21)) }, { ItemID.CobaltNaginata, Do(AutoReuse, TrueMelee, DamageExact(55), UseExact(9), ShootSpeedExact(12f)) }, - { ItemID.CobaltRepeater, Do(PointBlank, UseExact(18)) }, + { ItemID.CobaltRepeater, Do(UseExact(18)) }, { ItemID.CobaltSword, Do(UseTurn, DamageExact(60), UseExact(9)) }, { ItemID.Code2, Do(AutoReuse, DamageExact(43)) }, + { ItemID.CoinGun, Do(UseExact(12)) }, { ItemID.CorruptYoyo, Do(AutoReuse, DamageExact(20)) }, // Malaise { ItemID.CrimsonYoyo, Do(AutoReuse, DamageExact(20)) }, // Artery { ItemID.CrystalBullet, Do(DamageExact(6)) }, @@ -93,14 +97,15 @@ namespace CalamityMod.Items { ItemID.DaedalusStormbow, Do(DamageExact(30)) }, { ItemID.DaoofPow, Do(DamageExact(85)) }, { ItemID.DarkLance, Do(AutoReuse, TrueMelee, DamageExact(40)) }, - { ItemID.DartRifle, Do(PointBlank, DamageExact(58)) }, + { ItemID.DartRifle, Do(DamageExact(58)) }, { ItemID.DayBreak, Do(DamageExact(125), UseExact(20)) }, { ItemID.DD2BetsyBow, Do(DamageExact(42)) }, // Aerial Bane's ridiculous multiplier is removed, so this compensates for that { ItemID.DD2SquireBetsySword, Do(UseMeleeSpeed, DamageExact(150)) }, // Flying Dragon { ItemID.DD2SquireDemonSword, Do(DamageExact(110), UseExact(25)) }, // Brand of the Inferno - { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(82), ShootSpeedExact(15f)) }, - { ItemID.DemonBow, Do(PointBlank, DamageExact(12), AutoReuse) }, - { ItemID.DemonScythe, Do(AutoReuse, DamageExact(33)) }, + { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20), DamageExact(50)) }, + { ItemID.DeathSickle, Do(UseMeleeSpeed, DamageExact(70), ShootSpeedExact(15f)) }, + { ItemID.DemonBow, Do(DamageExact(12), AutoReuse) }, + { ItemID.DemonScythe, Do(AutoReuse, DamageExact(28)) }, { ItemID.DyeTradersScimitar, Do(AutoReuse, UseTurn, DamageExact(24)) }, // Exotic Scimitar { ItemID.ElectrosphereLauncher, Do(DamageExact(44)) }, { ItemID.ElfMelter, Do(ShootSpeedDelta(+5f)) }, @@ -109,12 +114,11 @@ namespace CalamityMod.Items { ItemID.EnchantedBoomerang, Do(DamageExact(24)) }, { ItemID.EnchantedSword, Do(UseMeleeSpeed, DamageExact(30), ShootSpeedExact(15f)) }, { ItemID.EndlessMusketPouch, Do(DamageExact(8)) }, - { ItemID.Excalibur, Do(TrueMelee, DamageExact(220), UseExact(24)) }, + { ItemID.Excalibur, Do(TrueMelee, DamageExact(205), UseExact(24)) }, { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration - { ItemID.Flairon, Do(DamageExact(65)) }, - { ItemID.Flamarang, Do(DamageExact(40)) }, + { ItemID.Flamarang, Do(DamageExact(37)) }, { ItemID.Flamelash, Do(DamageExact(40)) }, { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, { ItemID.FlowerofFire, Do(AutoReuse, ManaExact(7), UseRatio(0.88f), DamageRatio(0.7f)) }, // Uses ratios due to remix seed @@ -122,18 +126,16 @@ namespace CalamityMod.Items { ItemID.FlyingKnife, Do(DamageExact(53)) }, { ItemID.Frostbrand, Do(UseMeleeSpeed, DamageExact(88)) }, { ItemID.FrostStaff, Do(DamageExact(160), UseExact(37), ShootSpeedExact(20f)) }, // has 1 extra update - { ItemID.Gatligator, Do(PointBlank, UseExact(6)) }, - { ItemID.GoldCoin, Do(DamageExact(75)) }, // For Coin Gun + { ItemID.Gatligator, Do(UseExact(6)) }, { ItemID.GoldShortsword, Do(AutoReuse, TrueMelee, DamageExact(17)) }, { ItemID.GolemFist, Do(DamageExact(150)) }, { ItemID.Gradient, Do(AutoReuse, DamageExact(39)) }, - { ItemID.GreenPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.GreenPhasesaber, Do(DamageExact(132)) }, - { ItemID.GrenadeLauncher, Do(DamageExact(112)) }, - { ItemID.Gungnir, Do(AutoReuse, TrueMelee, DamageExact(144), ShootSpeedExact(7f)) }, - { ItemID.HallowedRepeater, Do(PointBlank, UseExact(12)) }, - { ItemID.Handgun, Do(PointBlank, UseExact(20)) }, - { ItemID.HellwingBow, Do(PointBlank, DamageExact(16)) }, + { ItemID.GreenPhaseblade, phaseblade }, + { ItemID.GreenPhasesaber, phasesaber }, + { ItemID.GrenadeLauncher, Do(DamageExact(105)) }, + { ItemID.Gungnir, Do(AutoReuse, TrueMelee, DamageExact(132), ShootSpeedExact(7f)) }, + { ItemID.HallowedRepeater, Do(UseExact(12)) }, + { ItemID.Handgun, Do(UseExact(20)) }, { ItemID.HighVelocityBullet, Do(DamageExact(13)) }, { ItemID.HiveFive, Do(AutoReuse, DamageExact(27)) }, { ItemID.HornetStaff, Do(AutoReuse, DamageExact(18), UseExact(30)) }, @@ -144,30 +146,30 @@ namespace CalamityMod.Items { ItemID.IchorArrow, Do(DamageExact(13)) }, { ItemID.IchorBullet, Do(DamageExact(11)) }, { ItemID.ImpStaff, Do(AutoReuse, UseExact(30), DamageExact(25)) }, - { ItemID.InfernoFork, Do(DamageExact(99), ShootSpeedExact(11)) }, + { ItemID.InfernoFork, Do(DamageExact(83), ShootSpeedExact(11)) }, { ItemID.InfluxWaver, Do(UseMeleeSpeed, DamageExact(80), UseExact(25)) }, { ItemID.IronShortsword, Do(AutoReuse, TrueMelee, DamageExact(10)) }, { ItemID.Keybrand, Do(UseTurn) }, - { ItemID.Kraken, Do(AutoReuse, DamageExact(85)) }, + { ItemID.Kraken, Do(AutoReuse, DamageExact(65)) }, { ItemID.KOCannon, Do(DamageRatio(2.65f)) }, // Uses ratios due to remix seed { ItemID.LaserMachinegun, Do(DamageExact(49)) }, { ItemID.LaserRifle, Do(DamageExact(46), UseExact(10), ManaExact(4)) }, { ItemID.LastPrism, Do(DamageExact(57), ManaExact(10)) }, { ItemID.LeadShortsword, Do(AutoReuse, TrueMelee, DamageExact(11)) }, - { ItemID.LightDisc, Do(DamageExact(98), ShootSpeedExact(18)) }, + { ItemID.LeafBlower, Do(DamageExact(61)) }, + { ItemID.LightDisc, Do(DamageExact(80), ShootSpeedExact(18)) }, { ItemID.LunarFlareBook, Do(DamageExact(120)) }, { ItemID.MagicalHarp, Do(DamageExact(50), ShootSpeedExact(12f)) }, { ItemID.MagicDagger, Do(DamageRatio(1.8f), UseRatio(1.88f), ShootSpeedExact(30)) }, // Uses ratios due to remix seed { ItemID.MagicMissile, Do(DamageExact(23), ManaExact(10), UseAnimationExact(20), UseTimeExact(10)) }, - { ItemID.MagnetSphere, Do(DamageExact(52)) }, - { ItemID.Marrow, Do(PointBlank, DamageExact(69)) }, + { ItemID.Marrow, Do(DamageExact(69)) }, { ItemID.MedusaHead, Do(ManaExact(6), DamageExact(48)) }, { ItemID.Meowmere, Do(UseMeleeSpeed, DamageExact(240)) }, { ItemID.MeteorStaff, Do(DamageExact(58), ManaExact(7), ShootSpeedExact(13f)) }, { ItemID.MiniNukeI, Do(DamageExact(90)) }, { ItemID.MiniNukeII, Do(DamageExact(90)) }, - { ItemID.Minishark, Do(PointBlank, DamageExact(4)) }, - { ItemID.MoltenFury, Do(PointBlank, UseExact(29), AutoReuse) }, + { ItemID.Minishark, Do(DamageExact(4)) }, + { ItemID.MoltenFury, Do(UseExact(28), AutoReuse) }, { ItemID.MonkStaffT1, Do(TrueMeleeNoSpeed, DamageExact(83)) }, // Sleepy Octopod { ItemID.MonkStaffT2, Do(AutoReuse, TrueMelee, DamageExact(90)) }, // Ghastly Glaive { ItemID.MonkStaffT3, Do(DamageExact(225)) }, // Sky Dragon's Fury @@ -175,156 +177,133 @@ namespace CalamityMod.Items { ItemID.MoonlordTurretStaff, Do(DamageExact(50), UseExact(15)) }, // Lunar Portal Staff { ItemID.Muramasa, Do(CritDelta(+10)) }, { ItemID.MushroomSpear, Do(AutoReuse, TrueMelee, UseRatio(0.8f), DamageExact(100)) }, - { ItemID.Musket, Do(PointBlank, DamageExact(22)) }, + { ItemID.Musket, Do(DamageExact(22)) }, { ItemID.MythrilHalberd, Do(AutoReuse, TrueMelee, DamageExact(65), UseExact(8), ShootSpeedExact(15f)) }, - { ItemID.MythrilRepeater, Do(PointBlank, UseExact(16)) }, + { ItemID.MythrilRepeater, Do(UseExact(16)) }, { ItemID.MythrilSword, Do(UseTurn, DamageExact(70), UseExact(8)) }, - { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(70)) }, + { ItemID.NailGun, Do(DamageExact(77)) }, + { ItemID.NettleBurst, Do(ManaExact(10), DamageExact(65)) }, { ItemID.NightsEdge, Do(TrueMelee, DamageExact(45)) }, { ItemID.NorthPole, Do(AutoReuse, UseMeleeSpeed) }, - { ItemID.OrangePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.OrangePhasesaber, Do(DamageExact(132)) }, + { ItemID.OrangePhaseblade, phaseblade }, + { ItemID.OrangePhasesaber, phasesaber }, { ItemID.OrichalcumHalberd, Do(AutoReuse, TrueMelee, DamageExact(128), ShootSpeedExact(6f)) }, - { ItemID.OrichalcumRepeater, Do(PointBlank, DamageExact(48)) }, + { ItemID.OrichalcumRepeater, Do(DamageExact(48)) }, { ItemID.OrichalcumSword, Do(UseTurn, DamageExact(175)) }, - { ItemID.PainterPaintballGun, Do(PointBlank, DamageExact(8)) }, - { ItemID.PaladinsHammer, Do(DamageExact(100), ShootSpeedExact(23)) }, + { ItemID.PaladinsHammer, Do(DamageExact(95), ShootSpeedExact(28)) }, { ItemID.PalladiumPike, Do(AutoReuse, TrueMelee, DamageExact(120), ShootSpeedExact(5.4f)) }, - { ItemID.PalladiumRepeater, Do(PointBlank, DamageExact(45)) }, + { ItemID.PalladiumRepeater, Do(DamageExact(45)) }, { ItemID.PalladiumSword, Do(UseTurn, DamageExact(150)) }, - { ItemID.PearlwoodBow, Do(AutoReuse, PointBlank, DamageExact(32)) }, + { ItemID.PearlwoodBow, Do(AutoReuse, DamageExact(32)) }, { ItemID.PearlwoodSword, Do(UseTurn, DamageExact(45)) }, { ItemID.PewMaticHorn, Do(DamageExact(25), ShootSpeedExact(15)) }, - { ItemID.Phantasm, Do(PointBlank, DamageExact(48)) }, - { ItemID.PhoenixBlaster, Do(AutoReuse, PointBlank, UseExact(20)) }, - { ItemID.PiranhaGun, Do(DamageExact(48)) }, - { ItemID.PlatinumBow, Do(PointBlank, DamageExact(12)) }, - { ItemID.PlatinumCoin, Do(DamageExact(150)) }, // For Coin Gun + { ItemID.Phantasm, Do(DamageExact(48)) }, + { ItemID.PhoenixBlaster, Do(AutoReuse, UseExact(20)) }, + { ItemID.PlatinumBow, Do(DamageExact(12)) }, { ItemID.PlatinumShortsword, Do(AutoReuse, TrueMelee, DamageExact(18)) }, { ItemID.PoisonStaff, Do(DamageExact(57)) }, { ItemID.PossessedHatchet, Do(DamageExact(135)) }, - { ItemID.PrincessWeapon, Do(DamageExact(90)) }, // Resonance Scepter + { ItemID.PrincessWeapon, Do(DamageExact(80)) }, // Resonance Scepter { ItemID.PsychoKnife, Do(UseTurn, UseExact(11), DamageExact(200)) }, { ItemID.PurpleClubberfish, Do(UseTurn, KnockbackExact(10f)) }, - { ItemID.PurplePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.PurplePhasesaber, Do(DamageExact(132)) }, - { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(70)) }, - { ItemID.QuadBarrelShotgun, Do(PointBlank, DamageExact(11)) }, + { ItemID.PurplePhaseblade, phaseblade }, + { ItemID.PurplePhasesaber, phasesaber }, + { ItemID.PygmyStaff, Do(AutoReuse, UseExact(20), DamageExact(63)) }, { ItemID.RainbowGun, Do(DamageExact(60), ManaExact(40)) }, { ItemID.RainbowRod, Do(DamageExact(40), ManaExact(13), KnockbackExact(8f)) }, { ItemID.Rally, Do(AutoReuse, DamageExact(18)) }, { ItemID.RavenStaff, Do(AutoReuse, UseExact(20), DamageExact(36)) }, { ItemID.RazorbladeTyphoon, Do(DamageExact(103)) }, { ItemID.Razorpine, Do(DamageExact(40)) }, - { ItemID.RedPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.RedPhasesaber, Do(DamageExact(132)) }, - { ItemID.RedRyder, Do(PointBlank, DamageExact(24)) }, + { ItemID.RedPhaseblade, phaseblade }, + { ItemID.RedPhasesaber, phasesaber }, + { ItemID.RedRyder, Do(DamageExact(24)) }, { ItemID.RedsYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats - { ItemID.RocketLauncher, Do(DamageExact(70)) }, - { ItemID.Sandgun, Do(PointBlank, DamageExact(22), UseExact(20)) }, + { ItemID.RocketLauncher, Do(DamageExact(60), ShootSpeedExact(9)) }, + { ItemID.Sandgun, Do(DamageExact(22), UseExact(20)) }, { ItemID.SapphireStaff, Do(DamageExact(25)) }, - { ItemID.Seedler, Do(UseMeleeSpeed, DamageExact(75), ShootSpeedDelta(+4f)) }, + { ItemID.ScourgeoftheCorruptor, Do(DamageExact(63)) }, + { ItemID.Seedler, Do(UseMeleeSpeed, DamageExact(45), ShootSpeedExact(16)) }, { ItemID.ShadowbeamStaff, Do(DamageExact(100)) }, - { ItemID.ShadowFlameBow, Do(PointBlank, DamageExact(55)) }, + { ItemID.ShadowFlameBow, Do(DamageExact(55)) }, { ItemID.ShadowFlameHexDoll, Do(DamageExact(40), ShootSpeedExact(30)) }, { ItemID.ShadowFlameKnife, Do(DamageExact(50)) }, { ItemID.SharpTears, Do(DamageExact(49)) }, // Blood Thorn - { ItemID.Shotgun, Do(PointBlank, DamageExact(36), AutoReuse) }, + { ItemID.Shotgun, Do(DamageExact(36), AutoReuse) }, { ItemID.Shroomerang, Do(ShootSpeedExact(11)) }, { ItemID.SilverBullet, Do(DamageExact(8)) }, { ItemID.SilverShortsword, Do(AutoReuse, TrueMelee, DamageExact(14)) }, { ItemID.SkyFracture, Do(DamageExact(54), ShootSpeedExact(30f)) }, { ItemID.SlapHand, Do(UseTurn, DamageExact(120)) }, { ItemID.Smolstar, Do(DamageExact(9), AutoReuse, UseExact(25)) }, // Blade Staff - { ItemID.SniperRifle, Do(PointBlank, DamageExact(215)) }, + { ItemID.SniperRifle, Do(DamageExact(200), UseExact(40)) }, { ItemID.SolarEruption, Do(DamageExact(122)) }, { ItemID.SoulDrain, Do(DamageExact(38)) }, // Life Drain - { ItemID.SpaceGun, Do(DamageExact(25)) }, + { ItemID.SpaceGun, Do(DamageExact(23)) }, { ItemID.Spear, Do(AutoReuse, TrueMelee, DamageExact(14)) }, - { ItemID.SpectreStaff, Do(DamageExact(78)) }, + { ItemID.SpectreStaff, Do(DamageExact(72)) }, { ItemID.SpiritFlame, Do(UseExact(20), ManaExact(11), ShootSpeedExact(2f)) }, { ItemID.StaffofEarth, Do(DamageExact(150)) }, - { ItemID.StarCannon, Do(DamageExact(25)) }, + { ItemID.StarCannon, Do(DamageExact(25), UseExact(15)) }, { ItemID.StardustDragonStaff, Do(AutoReuse, DamageExact(20), UseExact(19)) }, { ItemID.StormTigerStaff, Do(AutoReuse, DamageExact(49), UseExact(20)) }, // Desert Tiger Staff { ItemID.StylistKilLaKillScissorsIWish, Do(AutoReuse, UseTurn, DamageExact(21)) }, // Stylish Scissors { ItemID.Stynger, Do(DamageExact(75)) }, + { ItemID.SuperStarCannon, Do(DamageExact(55)) }, { ItemID.Swordfish, Do(AutoReuse, TrueMelee, DamageExact(24)) }, - { ItemID.TacticalShotgun, Do(PointBlank, DamageExact(41)) }, + { ItemID.TacticalShotgun, Do(DamageExact(34)) }, { ItemID.TaxCollectorsStickOfDoom, Do(AutoReuse, UseTurn, UseRatio(0.8f), DamageExact(70)) }, // Classy Cane - { ItemID.TendonBow, Do(PointBlank, DamageExact(17), AutoReuse) }, - { ItemID.TerraBlade, Do(DamageExact(92)) }, + { ItemID.TendonBow, Do(DamageExact(17), AutoReuse) }, + { ItemID.TerraBlade, Do(DamageExact(95)) }, { ItemID.Terragrim, Do(TrueMeleeNoSpeed, DamageExact(13)) }, // Vanilla damage 190. After fixing iframes so yoyo and shots can hit simultaneously, // Terrarian is extremely overpowered and requires a heavy nerf. { ItemID.Terrarian, Do(AutoReuse, DamageExact(90)) }, - { ItemID.TheEyeOfCthulhu, Do(AutoReuse, DamageExact(90)) }, + { ItemID.TheEyeOfCthulhu, Do(AutoReuse, DamageExact(80)) }, { ItemID.TheMeatball, Do(DamageExact(24)) }, { ItemID.TheRottedFork, Do(AutoReuse, TrueMelee, DamageExact(20)) }, - { ItemID.TheUndertaker, Do(PointBlank, AutoReuse, DamageExact(15)) }, + { ItemID.TheUndertaker, Do(AutoReuse, DamageExact(15)) }, { ItemID.ThunderSpear, Do(AutoReuse, UseMeleeSpeed) }, // Storm Spear { ItemID.ThunderStaff, Do(DamageExact(18)) }, //Thunder Zapper - { ItemID.TitaniumRepeater, Do(PointBlank, DamageExact(52)) }, + { ItemID.TitaniumRepeater, Do(DamageExact(52)) }, { ItemID.TitaniumSword, Do(UseTurn, DamageExact(192)) }, { ItemID.TitaniumTrident, Do(AutoReuse, TrueMelee, DamageExact(144), ShootSpeedExact(6.5f)) }, { ItemID.TopazStaff, Do(ManaExact(2)) }, + { ItemID.ToxicFlask, Do(DamageExact(62), UseExact(33), ManaExact(20)) }, { ItemID.Toxikarp, Do(UseExact(9)) }, { ItemID.Trident, Do(AutoReuse, TrueMelee, DamageExact(20)) }, { ItemID.Trimarang, Do(DamageExact(24)) }, { ItemID.TrueExcalibur, Do(TrueMelee, DamageExact(112)) }, { ItemID.TrueNightsEdge, Do(DamageExact(105)) }, - { ItemID.Tsunami, Do(PointBlank, DamageExact(45)) }, + { ItemID.Tsunami, Do(DamageExact(45)) }, { ItemID.TungstenBullet, Do(DamageExact(8)) }, { ItemID.TungstenShortsword, Do(AutoReuse, TrueMelee, DamageExact(15)) }, { ItemID.UnholyArrow, Do(DamageExact(11)) }, { ItemID.UnholyTrident, Do(ManaRatio(0.78f), DamageRatio(0.91f)) }, // Uses ratios due to remix seed - { ItemID.Uzi, Do(PointBlank, UseExact(8)) }, + { ItemID.Uzi, Do(UseExact(8)) }, { ItemID.VampireKnives, Do(DamageExact(38)) }, { ItemID.ValkyrieYoyo, Do(AutoReuse, DamageExact(48)) }, // Red's Throw and Valkyrie Yoyo have the same stats - { ItemID.VenomStaff, Do(DamageExact(55)) }, - { ItemID.VenusMagnum, Do(PointBlank, DamageExact(65)) }, - { ItemID.WaspGun, Do(UseExact(11), DamageExact(58)) }, + { ItemID.VenomStaff, Do(UseExact(27)) }, + { ItemID.WaspGun, Do(DamageExact(44)) }, { ItemID.WaterBolt, Do(DamageExact(23)) }, - { ItemID.WhitePhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.WhitePhasesaber, Do(DamageExact(132)) }, + { ItemID.WhitePhaseblade, phaseblade }, + { ItemID.WhitePhasesaber, phasesaber }, { ItemID.WoodenBoomerang, Do(DamageExact(16), Value(Item.sellPrice(copper: 20))) }, { ItemID.Yelets, Do(AutoReuse, DamageExact(53)) }, - { ItemID.YellowPhaseblade, Do(AutoReuse, UseTurn, DamageExact(48)) }, - { ItemID.YellowPhasesaber, Do(DamageExact(132)) }, + { ItemID.YellowPhaseblade, phaseblade }, + { ItemID.YellowPhasesaber, phasesaber }, { ItemID.Zenith, Do(DamageExact(210)) }, { ItemID.ZombieArm, Do(AutoReuse, UseTurn, KnockbackExact(12f)) }, #endregion #region CATEGORY 2: Defense Balancing - { ItemID.AncientHallowedGreaves, Do(DefenseDelta(+2)) }, - { ItemID.AncientHallowedPlateMail, Do(DefenseDelta(+3)) }, - { ItemID.AnkhShield, Do(DefenseDelta(+4)) }, // 8 total - { ItemID.CobaltShield, Do(DefenseDelta(+3)) }, // 4 total - { ItemID.EoCShield, Do(DefenseDelta(+1)) }, // Shield of Cthulhu - { ItemID.FrozenShield, Do(DefenseDelta(+4)) }, // 10 total (plus the Frozen Turtle Shell DR effect) - { ItemID.FrozenTurtleShell, Do(DefenseExact(6)) }, - { ItemID.HallowedGreaves, Do(DefenseDelta(+2)) }, - { ItemID.HallowedPlateMail, Do(DefenseDelta(+3)) }, - { ItemID.HeroShield, Do(DefenseDelta(+5)) }, // 15 total (plus increased max life) - { ItemID.LavaSkull, Do(DefenseExact(4)) }, // Magma Skull - { ItemID.MoltenCharm, Do(DefenseExact(4)) }, //Magma Charm - { ItemID.MoltenSkullRose, Do(DefenseExact(8)) }, - { ItemID.ObsidianShield, Do(DefenseDelta(+4)) }, // 6 total - { ItemID.ObsidianSkull, Do(DefenseDelta(+1)) }, // 2 total - { ItemID.ObsidianSkullRose, Do(DefenseExact(4)) }, - { ItemID.OrichalcumBreastplate, Do(DefenseDelta(+3)) }, - { ItemID.OrichalcumHeadgear, Do(DefenseDelta(+2)) }, - { ItemID.OrichalcumHelmet, Do(DefenseDelta(+3)) }, - { ItemID.OrichalcumLeggings, Do(DefenseDelta(+4)) }, - { ItemID.OrichalcumMask, Do(DefenseDelta(+3)) }, - { ItemID.PaladinsShield, Do(DefenseDelta(+2)) }, // 8 total - { ItemID.PalladiumBreastplate, Do(DefenseDelta(+3)) }, - { ItemID.PalladiumHeadgear, Do(DefenseDelta(+2)) }, - { ItemID.PalladiumHelmet, Do(DefenseDelta(+3)) }, - { ItemID.PalladiumMask, Do(DefenseDelta(+1)) }, - { ItemID.PalladiumLeggings, Do(DefenseDelta(+3)) }, - { ItemID.Shackle, Do(DefenseDelta(+2)) }, // 3 total - { ItemID.SquireAltHead, Do(DefenseDelta(-2)) }, + { ItemID.LavaSkull, Do(DefenseExact(3)) }, // Magma Skull + { ItemID.MoltenCharm, Do(DefenseExact(3)) }, //Magma Charm + { ItemID.MoltenSkullRose, Do(DefenseExact(4)) }, + { ItemID.ObsidianSkull, Do(DefenseExact(2)) }, + { ItemID.ObsidianSkullRose, Do(DefenseExact(3)) }, + { ItemID.Shackle, Do(DefenseExact(3)) }, + { ItemID.SquireAltHead, Do(DefenseDelta(-2)) }, // Valhalla Knight set { ItemID.SquireAltPants, Do(DefenseDelta(-3)) }, { ItemID.SquireAltShirt, Do(DefenseDelta(-3)) }, { ItemID.SquireGreatHelm, Do(DefenseDelta(-1)) }, @@ -333,107 +312,100 @@ namespace CalamityMod.Items #endregion #region CATEGORY 3: Tool Balancing - { ItemID.AcornAxe, Do(AxePower(125)) }, // Axe of Regrowth - { ItemID.AdamantiteChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), UseTimeExact(4), TileBoostExact(+0), DamageExact(75)) }, - { ItemID.AdamantiteDrill, Do(TrueMeleeNoSpeed, PickPower(180), UseTimeExact(4), TileBoostExact(+1), DamageExact(32)) }, - { ItemID.AdamantitePickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, + { ItemID.AcornAxe, Do(AxePower(100)) }, // Axe of Regrowth + { ItemID.AdamantiteChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), TileBoostExact(+0), DamageExact(75)) }, + { ItemID.AdamantiteDrill, Do(TrueMeleeNoSpeed, TileBoostExact(+1), DamageExact(32)) }, + { ItemID.AdamantitePickaxe, Do(TileBoostExact(+1)) }, { ItemID.AdamantiteWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, - { ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) }, - { ItemID.BonePickaxe, Do(PickPower(55), UseTimeExact(6)) }, - { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, AxePower(150), UseTimeExact(3), TileBoostExact(+0)) }, + { ItemID.BloodLustCluster, Do(AxePower(100), UseTimeExact(13)) }, + { ItemID.BonePickaxe, Do(UseTimeExact(6)) }, + { ItemID.BorealWoodHammer, Do(HammerPower(25), UseTimeExact(11)) }, + { ItemID.ButchersChainsaw, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+0)) }, { ItemID.CactusPickaxe, Do(PickPower(34), UseTimeExact(9)) }, - { ItemID.CnadyCanePickaxe, Do(PickPower(55), UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe - { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), TileBoostExact(+0), DamageExact(112)) }, - { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, PickPower(200), UseTimeExact(4), TileBoostExact(+2), DamageExact(43)) }, - { ItemID.ChlorophyteGreataxe, Do(AxePower(165), UseTimeExact(7), TileBoostExact(+2)) }, - { ItemID.ChlorophyteJackhammer, Do(TrueMeleeNoSpeed, HammerPower(90), UseTimeExact(5), TileBoostExact(+0)) }, - { ItemID.ChlorophytePickaxe, Do(PickPower(200), UseTimeExact(7), TileBoostExact(+2)) }, - { ItemID.ChlorophyteWarhammer, Do(HammerPower(90), UseTimeExact(8), TileBoostExact(+2)) }, - { ItemID.CobaltChainsaw, Do(TrueMeleeNoSpeed, AxePower(70), UseTimeExact(4), TileBoostExact(-1), DamageExact(51)) }, + { ItemID.CnadyCanePickaxe, Do(UseTimeExact(9), TileBoostExact(+1)) }, // Candy Cane Pickaxe + { ItemID.ChlorophyteChainsaw, Do(TrueMeleeNoSpeed, AxePower(120), UseTimeExact(3), DamageExact(112)) }, + { ItemID.ChlorophyteDrill, Do(TrueMeleeNoSpeed, TileBoostExact(+2), DamageExact(43)) }, + { ItemID.ChlorophyteGreataxe, Do(AxePower(165), TileBoostExact(+2)) }, + { ItemID.ChlorophyteJackhammer, Do(TrueMeleeNoSpeed, UseTimeExact(5)) }, + { ItemID.ChlorophytePickaxe, Do(TileBoostExact(+2)) }, + { ItemID.ChlorophyteWarhammer, Do(UseTimeExact(8), TileBoostExact(+2)) }, + { ItemID.CobaltChainsaw, Do(TrueMeleeNoSpeed, UseTimeExact(4), DamageExact(51)) }, { ItemID.CobaltDrill, Do(TrueMeleeNoSpeed, PickPower(130), UseTimeExact(5), DamageExact(21)) }, { ItemID.CobaltPickaxe, Do(PickPower(130), UseTimeExact(9)) }, - { ItemID.CobaltWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) }, + { ItemID.CobaltWaraxe, Do(AxePower(125), UseTimeExact(12)) }, { ItemID.CopperAxe, Do(AxePower(50), UseTimeExact(16), TileBoostExact(+0)) }, - { ItemID.CopperHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, - { ItemID.CopperPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.DeathbringerPickaxe, Do(PickPower(70), UseTimeExact(10)) }, - { ItemID.Drax, Do(TrueMeleeNoSpeed, PickPower(200), AxePower(110), UseTimeExact(4), TileBoostExact(+1), DamageExact(80)) }, - { ItemID.EbonwoodHammer, Do(HammerPower(25), UseTimeExact(9), TileBoostExact(+0)) }, - { ItemID.FleshGrinder, Do(HammerPower(70), UseTimeExact(13), TileBoostExact(+0)) }, - { ItemID.GoldAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.GoldHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, - { ItemID.GoldPickaxe, Do(PickPower(55), UseTimeExact(9)) }, - { ItemID.Hammush, Do(HammerPower(85), UseTimeExact(10), TileBoostExact(+1)) }, - { ItemID.IronAxe, Do(AxePower(60), UseTimeExact(15), TileBoostExact(+0)) }, - { ItemID.IronHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.IronPickaxe, Do(PickPower(40), UseTimeExact(8)) }, + { ItemID.CopperHammer, Do(UseTimeExact(12), TileBoostExact(+0)) }, + { ItemID.CopperPickaxe, Do(UseTimeExact(10), TileBoostExact(+0)) }, + { ItemID.DeathbringerPickaxe, Do(UseTimeExact(10)) }, + { ItemID.Drax, Do(TrueMeleeNoSpeed, TileBoostExact(+1), DamageExact(80)) }, + { ItemID.EbonwoodHammer, Do(HammerPower(25), UseTimeExact(9)) }, + { ItemID.FleshGrinder, Do(HammerPower(70), UseTimeExact(13)) }, + { ItemID.GoldAxe, Do(AxePower(80), UseTimeExact(14)) }, + { ItemID.GoldHammer, Do(HammerPower(60), UseTimeExact(9)) }, + { ItemID.GoldPickaxe, Do(UseTimeExact(9)) }, + { ItemID.Hammush, Do(UseTimeExact(10), TileBoostExact(+1)) }, + { ItemID.IronAxe, Do(AxePower(60), UseTimeExact(15)) }, + { ItemID.IronHammer, Do(HammerPower(45), UseTimeExact(11)) }, + { ItemID.IronPickaxe, Do(UseTimeExact(8)) }, { ItemID.LaserDrill, Do(PickPower(220), AxePower(120), UseTimeExact(4), DamageExact(54)) }, - { ItemID.LeadAxe, Do(AxePower(60), UseTimeExact(15), TileBoostExact(+0)) }, - { ItemID.LeadHammer, Do(HammerPower(45), UseTimeExact(11), TileBoostExact(+0)) }, + { ItemID.LeadAxe, Do(AxePower(60), UseTimeExact(15)) }, + { ItemID.LeadHammer, Do(HammerPower(45), UseTimeExact(11)) }, { ItemID.LeadPickaxe, Do(PickPower(40), UseTimeExact(8)) }, - { ItemID.LucyTheAxe, Do(AxePower(150), UseExact(13), TileBoostExact(+1)) }, - { ItemID.LunarHamaxeNebula, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, - { ItemID.LunarHamaxeSolar, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, - { ItemID.LunarHamaxeStardust, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, - { ItemID.LunarHamaxeVortex, Do(HammerPower(100), AxePower(175), UseTimeExact(5), TileBoostExact(+4)) }, - { ItemID.MeteorHamaxe, Do(HammerPower(70), AxePower(100), UseTimeExact(16), TileBoostExact(+0)) }, - { ItemID.MoltenHamaxe, Do(HammerPower(75), AxePower(125), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.MoltenPickaxe, Do(PickPower(100), UseTimeExact(10)) }, - { ItemID.MythrilChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), TileBoostExact(-1), DamageExact(63)) }, + { ItemID.LucyTheAxe, Do(UseExact(13), TileBoostExact(+1)) }, + { ItemID.LunarHamaxeNebula, Do(AxePower(175), UseTimeExact(5)) }, + { ItemID.LunarHamaxeSolar, Do(AxePower(175), UseTimeExact(5)) }, + { ItemID.LunarHamaxeStardust, Do(AxePower(175), UseTimeExact(5)) }, + { ItemID.LunarHamaxeVortex, Do(AxePower(175), UseTimeExact(5)) }, + { ItemID.MeteorHamaxe, Do(HammerPower(70)) }, + { ItemID.MoltenHamaxe, Do(HammerPower(75), AxePower(125)) }, + { ItemID.MoltenPickaxe, Do(UseTimeExact(10)) }, + { ItemID.MythrilChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), DamageExact(63)) }, { ItemID.MythrilDrill, Do(TrueMeleeNoSpeed, PickPower(160), UseTimeExact(4), DamageExact(26)) }, { ItemID.MythrilPickaxe, Do(PickPower(160), UseTimeExact(8)) }, - { ItemID.MythrilWaraxe, Do(AxePower(140), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.NebulaDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, - { ItemID.NebulaPickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, + { ItemID.MythrilWaraxe, Do(AxePower(140), UseTimeExact(11)) }, + { ItemID.NebulaDrill, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, { ItemID.NightmarePickaxe, Do(PickPower(66), UseTimeExact(9)) }, - { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), TileBoostExact(-1), DamageExact(63)) }, + { ItemID.OrichalcumChainsaw, Do(TrueMeleeNoSpeed, AxePower(80), UseTimeExact(4), DamageExact(63)) }, { ItemID.OrichalcumDrill, Do(TrueMeleeNoSpeed, PickPower(160), UseTimeExact(4), DamageExact(26)) }, { ItemID.OrichalcumPickaxe, Do(PickPower(160), UseTimeExact(8)) }, - { ItemID.OrichalcumWaraxe, Do(AxePower(140), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.PalladiumChainsaw, Do(TrueMeleeNoSpeed, AxePower(70), UseTimeExact(4), TileBoostExact(-1), DamageExact(51)) }, - { ItemID.PalladiumDrill, Do(TrueMeleeNoSpeed, PickPower(130), UseTimeExact(5), DamageExact(21)) }, - { ItemID.PalladiumPickaxe, Do(PickPower(130), UseTimeExact(9)) }, - { ItemID.PalladiumWaraxe, Do(AxePower(125), UseTimeExact(12), TileBoostExact(+0)) }, - { ItemID.PalmWoodHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, - { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageExact(36), TileBoostExact(+0)) }, - { ItemID.PickaxeAxe, Do(PickPower(200), AxePower(110), UseTimeExact(7), TileBoostExact(+1)) }, - { ItemID.Picksaw, Do(PickPower(210), AxePower(125), UseTimeExact(6), TileBoostExact(+1)) }, - { ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9), TileBoostExact(+0)) }, + { ItemID.OrichalcumWaraxe, Do(AxePower(140), UseTimeExact(11)) }, + { ItemID.PalladiumChainsaw, Do(TrueMeleeNoSpeed, AxePower(70), UseTimeExact(4), DamageExact(51)) }, + { ItemID.PalladiumDrill, Do(TrueMeleeNoSpeed, UseTimeExact(5), DamageExact(21)) }, + { ItemID.PalladiumPickaxe, Do(UseTimeExact(9)) }, + { ItemID.PalladiumWaraxe, Do(AxePower(125)) }, + { ItemID.PalmWoodHammer, Do(HammerPower(25), UseTimeExact(11)) }, + { ItemID.PearlwoodHammer, Do(HammerPower(25), UseTimeExact(4), UseAnimationExact(20), DamageExact(36)) }, + { ItemID.PickaxeAxe, Do(TileBoostExact(+1)) }, + { ItemID.PlatinumAxe, Do(AxePower(80), UseTimeExact(14)) }, + { ItemID.PlatinumHammer, Do(HammerPower(60), UseTimeExact(9)) }, { ItemID.PlatinumPickaxe, Do(PickPower(55), UseTimeExact(9)) }, - { ItemID.Pwnhammer, Do(HammerPower(80), UseTimeExact(11), TileBoostExact(+1)) }, + { ItemID.Pwnhammer, Do(UseTimeExact(11), TileBoostExact(+1)) }, { ItemID.ReaverShark, Do(PickPower(65), UseTimeExact(16)) }, - { ItemID.RichMahoganyHammer, Do(HammerPower(25), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.Rockfish, Do(HammerPower(50), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.SawtoothShark, Do(TrueMeleeNoSpeed, AxePower(45), UseTimeExact(4), TileBoostExact(-1)) }, - { ItemID.ShadewoodHammer, Do(HammerPower(25), UseTimeExact(9), TileBoostExact(+0)) }, - { ItemID.ShroomiteDiggingClaw, Do(PickPower(200), AxePower(125), UseTimeExact(4), TileBoostExact(-1)) }, - { ItemID.SilverAxe, Do(AxePower(70), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.SilverHammer, Do(HammerPower(55), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.SilverPickaxe, Do(PickPower(50), UseTimeExact(11)) }, - { ItemID.SolarFlareDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, - { ItemID.SolarFlarePickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, - { ItemID.SpectreHamaxe, Do(HammerPower(90), AxePower(170), TileBoostExact(+4)) }, - { ItemID.SpectrePickaxe, Do(PickPower(200), TileBoostExact(+4)) }, - { ItemID.StardustDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, - { ItemID.StardustPickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, - { ItemID.TheAxe, Do(HammerPower(100), AxePower(175), UseTimeExact(7), TileBoostExact(+1)) }, - { ItemID.TheBreaker, Do(HammerPower(70), UseTimeExact(13), TileBoostExact(+0)) }, - { ItemID.TinAxe, Do(AxePower(50), UseTimeExact(16), TileBoostExact(+0)) }, - { ItemID.TinHammer, Do(HammerPower(35), UseTimeExact(12), TileBoostExact(+0)) }, - { ItemID.TinPickaxe, Do(PickPower(35), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.TitaniumChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), UseTimeExact(4), TileBoostExact(+0), DamageExact(75)) }, - { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, PickPower(180), UseTimeExact(4), TileBoostExact(+1), DamageExact(32)) }, + { ItemID.RichMahoganyHammer, Do(HammerPower(25), UseTimeExact(10)) }, + { ItemID.Rockfish, Do(HammerPower(50), UseTimeExact(10)) }, + { ItemID.SawtoothShark, Do(TrueMeleeNoSpeed, AxePower(45)) }, + { ItemID.ShadewoodHammer, Do(HammerPower(25), UseTimeExact(9)) }, + { ItemID.SilverAxe, Do(AxePower(70), UseTimeExact(14)) }, + { ItemID.SilverHammer, Do(HammerPower(55), UseTimeExact(10)) }, + { ItemID.SilverPickaxe, Do(PickPower(50)) }, + { ItemID.SolarFlareDrill, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, + { ItemID.SpectreHamaxe, Do(AxePower(170), TileBoostExact(+4)) }, + { ItemID.SpectrePickaxe, Do(TileBoostExact(+4)) }, + { ItemID.StardustDrill, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, + { ItemID.TheBreaker, Do(HammerPower(70), UseTimeExact(13)) }, + { ItemID.TinAxe, Do(AxePower(50), UseTimeExact(16)) }, + { ItemID.TinHammer, Do(HammerPower(35), UseTimeExact(12)) }, + { ItemID.TinPickaxe, Do(UseTimeExact(10)) }, + { ItemID.TitaniumChainsaw, Do(TrueMeleeNoSpeed, AxePower(90), TileBoostExact(+0), DamageExact(75)) }, + { ItemID.TitaniumDrill, Do(TrueMeleeNoSpeed, PickPower(180), TileBoostExact(+1), DamageExact(32)) }, { ItemID.TitaniumPickaxe, Do(PickPower(180), UseTimeExact(8), TileBoostExact(+1)) }, { ItemID.TitaniumWaraxe, Do(AxePower(160), UseTimeExact(10), TileBoostExact(+1)) }, - { ItemID.TungstenAxe, Do(AxePower(70), UseTimeExact(14), TileBoostExact(+0)) }, - { ItemID.TungstenHammer, Do(HammerPower(55), UseTimeExact(10), TileBoostExact(+0)) }, - { ItemID.TungstenPickaxe, Do(PickPower(50), UseTimeExact(11)) }, - { ItemID.VortexDrill, Do(TrueMeleeNoSpeed, PickPower(225), UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, - { ItemID.VortexPickaxe, Do(PickPower(225), UseTimeExact(6), TileBoostExact(+4)) }, - { ItemID.WarAxeoftheNight, Do(AxePower(100), UseTimeExact(13), TileBoostExact(+0)) }, - { ItemID.WoodenHammer, Do(HammerPower(25), UseTimeExact(11), TileBoostExact(+0)) }, + { ItemID.TungstenAxe, Do(AxePower(70), UseTimeExact(14)) }, + { ItemID.TungstenHammer, Do(HammerPower(55), UseTimeExact(10)) }, + { ItemID.TungstenPickaxe, Do(UseTimeExact(11)) }, + { ItemID.VortexDrill, Do(TrueMeleeNoSpeed, UseTimeExact(3), TileBoostExact(+4), DamageExact(95)) }, + { ItemID.WarAxeoftheNight, Do(AxePower(100), UseTimeExact(13)) }, + { ItemID.WoodenHammer, Do(UseTimeExact(11), TileBoostExact(+0)) }, #endregion #region CATEGORY 4: True Melee support @@ -454,40 +426,7 @@ namespace CalamityMod.Items { ItemID.VortexChainsaw, trueMeleeNoSpeed }, #endregion - #region CATEGORY 5: Point Blank support - { ItemID.Blowpipe, pointBlank }, - { ItemID.BorealWoodBow, pointBlank }, - { ItemID.ChlorophyteShotbow, pointBlank }, - { ItemID.CopperBow, pointBlank }, - { ItemID.DartPistol, pointBlank }, - { ItemID.DD2PhoenixBow, pointBlank }, // Phantom Phoenix - { ItemID.EbonwoodBow, pointBlank }, - { ItemID.FairyQueenRangedItem, pointBlank }, //Eventide - { ItemID.FlintlockPistol, pointBlank }, - { ItemID.FlareGun, Do(PointBlank, Value(Item.sellPrice(silver: 10))) }, - { ItemID.GoldBow, pointBlank }, - { ItemID.Harpoon, pointBlank }, - { ItemID.IceBow, pointBlank }, - { ItemID.IronBow, pointBlank }, - { ItemID.LeadBow, pointBlank }, - { ItemID.Megashark, pointBlank }, - { ItemID.OnyxBlaster, pointBlank }, - { ItemID.PalmWoodBow, pointBlank }, - { ItemID.PulseBow, pointBlank }, - { ItemID.Revolver, Do(PointBlank, AutoReuse) }, - { ItemID.RichMahoganyBow, pointBlank }, - { ItemID.SDMG, pointBlank }, - { ItemID.ShadewoodBow, pointBlank }, - { ItemID.SilverBow, pointBlank }, - { ItemID.SnowballCannon, pointBlank }, - { ItemID.StakeLauncher, pointBlank }, - { ItemID.TinBow, pointBlank }, - { ItemID.TungstenBow, pointBlank }, - { ItemID.VortexBeater, pointBlank }, - { ItemID.WoodenBow, pointBlank }, - #endregion - - #region CATEGORY 6: Summoner Quality of Life + #region CATEGORY 5: Summoner Quality of Life { ItemID.AbigailsFlower, autoReuse }, { ItemID.BabyBirdStaff, Do(AutoReuse, UseExact(35)) }, // Finch Staff { ItemID.BlandWhip, autoReuse }, // Leather Whip @@ -505,7 +444,6 @@ namespace CalamityMod.Items { ItemID.DD2LightningAuraT1Popper, autoReuse }, // Lightning Aura Tier 1 { ItemID.DD2LightningAuraT2Popper, Do(AutoReuse, UseExact(25)) }, // Lightning Aura Tier 2 { ItemID.DD2LightningAuraT3Popper, Do(AutoReuse, UseExact(20)) }, // Lightning Aura Tier 3 - { ItemID.DeadlySphereStaff, Do(AutoReuse, UseExact(20)) }, { ItemID.FireWhip, autoReuse }, // Firecracker { ItemID.FlinxStaff, Do(AutoReuse, UseExact(35)) }, { ItemID.MaceWhip, autoReuse }, // Morning Star @@ -527,7 +465,7 @@ namespace CalamityMod.Items { ItemID.XenoStaff, Do(AutoReuse, UseExact(20)) }, #endregion - #region CATEGORY 7: Other Quality of Life (AutoReuse / UseTurn) + #region CATEGORY 6: Other Quality of Life (AutoReuse / UseTurn) { ItemID.Amarok, autoReuse }, { ItemID.BatBat, autoReuse }, { ItemID.BladeofGrass, Do(AutoReuse, UseTurn) }, @@ -554,6 +492,7 @@ namespace CalamityMod.Items { ItemID.PaperAirplaneA, autoReuse }, { ItemID.PaperAirplaneB, autoReuse }, // White Paper Airplane { ItemID.PlatinumBroadsword, Do(AutoReuse, UseTurn) }, + { ItemID.Revolver, autoReuse }, { ItemID.RichMahoganySword, Do(AutoReuse, UseTurn) }, { ItemID.ShadewoodSword, Do(AutoReuse, UseTurn) }, { ItemID.SilverBroadsword, Do(AutoReuse, UseTurn) }, @@ -573,51 +512,33 @@ namespace CalamityMod.Items { ItemID.ZapinatorOrange, autoReuse }, #endregion - #region CATEGORY 8: Non-consumable Quality of Life + #region CATEGORY 7: Summoning Item Quality of Life { ItemID.Abeemination, nonConsumableBossSummon }, - { ItemID.BloodMoonStarter, nonConsumableBossSummon }, // Bloody Tear + { ItemID.BloodMoonStarter, Do(UseTimeExact(10))}, // Bloody Tear { ItemID.BloodySpine, nonConsumableBossSummon }, { ItemID.CelestialSigil, nonConsumableBossSummon }, { ItemID.DeerThing, nonConsumableBossSummon }, - { ItemID.GoblinBattleStandard, nonConsumableBossSummon }, + { ItemID.GoblinBattleStandard, Do(UseTimeExact(10)) }, { ItemID.MechanicalEye, nonConsumableBossSummon }, { ItemID.MechanicalSkull, nonConsumableBossSummon }, { ItemID.MechanicalWorm, nonConsumableBossSummon }, { ItemID.MechdusaSummon, nonConsumableBossSummon }, // Ocram's Razor - { ItemID.NaughtyPresent, nonConsumableBossSummon }, - { ItemID.PirateMap, nonConsumableBossSummon }, - { ItemID.PumpkinMoonMedallion, nonConsumableBossSummon }, + { ItemID.NaughtyPresent, Do(UseTimeExact(10)) }, + { ItemID.PirateMap, Do(UseTimeExact(10)) }, + { ItemID.PumpkinMoonMedallion, Do(UseTimeExact(10)) }, { ItemID.QueenSlimeCrystal, nonConsumableBossSummon }, // Gelatin Crystal { ItemID.SlimeCrown, nonConsumableBossSummon }, - { ItemID.SnowGlobe, nonConsumableBossSummon }, - { ItemID.SolarTablet, nonConsumableBossSummon }, + { ItemID.SnowGlobe, Do(UseTimeExact(10)) }, + { ItemID.SolarTablet, Do(UseTimeExact(10)) }, { ItemID.SuspiciousLookingEye, nonConsumableBossSummon }, { ItemID.WormFood, nonConsumableBossSummon }, #endregion - #region CATEGORY 9: Sell Prices - { ItemID.Apple, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Apricot, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Banana, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.BlackCurrant, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.BloodOrange, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Cherry, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Coconut, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Dragonfruit, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Elderberry, Do(Value(Item.sellPrice(copper: 40))) }, + #region CATEGORY 8: Sell Prices { ItemID.EncumberingStone, Do(Worthless) }, + { ItemID.FlareGun, Do(Value(Item.sellPrice(silver: 10))) }, { ItemID.GlowingMushroom, Do(Worthless) }, - { ItemID.Grapefruit, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Lemon, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Mango, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.Mushroom, Do(Worthless) }, - { ItemID.Peach, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Pineapple, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Plum, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Pomegranate, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Rambutan, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.SpicyPepper, Do(Value(Item.sellPrice(copper: 40))) }, - { ItemID.Starfruit, Do(Value(Item.sellPrice(copper: 40))) }, { ItemID.PortableStool, Do(Value(Item.sellPrice(copper: 20))) }, // Step Stool { ItemID.UncumberingStone, Do(Worthless) }, { ItemID.ViciousMushroom, Do(Worthless) }, @@ -1043,15 +964,6 @@ namespace CalamityMod.Items internal static IItemTweak PickPower(int p) => new PickPowerRule(p); #endregion - #region Point Blank - internal class PointBlankRule : IItemTweak - { - public bool AppliesTo(Item it) => true; - public void ApplyTweak(Item it) => it.Calamity().canFirePointBlankShots = true; - } - internal static IItemTweak PointBlank => new PointBlankRule(); - #endregion - #region Scale (True Melee) internal class ScaleDeltaRule : IItemTweak { @@ -1404,15 +1316,14 @@ namespace CalamityMod.Items var shimmerTransmute = ItemID.Sets.ShimmerTransformToItem; // Note: Making Luminite Ore -> Astral Ore makes Deus almost completely skippable with no (recipe-related) downsides. - + // Adding Cryonic Ore to the shimmer chain has the same issue. shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ItemID.LunarOre; shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.LunarOre]; - shimmerTransmute[ModContent.ItemType()] = ModContent.ItemType(); - shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.ChlorophyteOre]; + shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.ChlorophyteOre]; shimmerTransmute[ModContent.ItemType()] = shimmerTransmute[ItemID.CobaltOre]; //shimmerTransmute[ItemID.LunarOre] = ModContent.ItemType(); @@ -1441,6 +1352,81 @@ namespace CalamityMod.Items //Calamity Permanent Upgrades shimmerTransmute[ItemID.FrogLeg] = ModContent.ItemType(); + + + // -- Vanilla Boss Shimmer Drop Cycles -- + // These cycles follow the order of: Melee Weapons A to Z -> Ranged Weapons A to Z -> Magic Weapons A to Z -> Summon Weapons A to Z -> Rogue Weapons A to Z (Based off of their in-game names) + // Note that only a select amount of vanilla bosses have an array of equally-likely weapon drops, so the amount of drop pools affected may seem odd at first glance. + + // Queen Bee + shimmerTransmute[ItemID.BeeKeeper] = ItemID.BeesKnees; + shimmerTransmute[ItemID.BeesKnees] = ItemID.BeeGun; + shimmerTransmute[ItemID.BeeGun] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.BeeKeeper; + + // Deerclops + shimmerTransmute[ItemID.LucyTheAxe] = ItemID.PewMaticHorn; + shimmerTransmute[ItemID.PewMaticHorn] = ItemID.WeatherPain; + shimmerTransmute[ItemID.WeatherPain] = ItemID.HoundiusShootius; + shimmerTransmute[ItemID.HoundiusShootius] = ItemID.LucyTheAxe; + + // Wall of Flesh + shimmerTransmute[ItemID.BreakerBlade] = ItemID.ClockworkAssaultRifle; + shimmerTransmute[ItemID.ClockworkAssaultRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.LaserRifle; + shimmerTransmute[ItemID.LaserRifle] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FireWhip; + shimmerTransmute[ItemID.FireWhip] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.BreakerBlade; + + // Plantera + shimmerTransmute[ItemID.FlowerPow] = ItemID.Seedler; + shimmerTransmute[ItemID.Seedler] = ItemID.GrenadeLauncher; + shimmerTransmute[ItemID.GrenadeLauncher] = ItemID.VenusMagnum; + shimmerTransmute[ItemID.VenusMagnum] = ItemID.LeafBlower; + shimmerTransmute[ItemID.LeafBlower] = ItemID.NettleBurst; + shimmerTransmute[ItemID.NettleBurst] = ItemID.WaspGun; + shimmerTransmute[ItemID.WaspGun] = ItemID.FlowerPow; + + // Golem + shimmerTransmute[ItemID.EyeoftheGolem] = ItemID.SunStone; + shimmerTransmute[ItemID.SunStone] = ItemID.GolemFist; + shimmerTransmute[ItemID.GolemFist] = ItemID.PossessedHatchet; + shimmerTransmute[ItemID.PossessedHatchet] = ItemID.Stynger; + shimmerTransmute[ItemID.Stynger] = ItemID.HeatRay; + shimmerTransmute[ItemID.HeatRay] = ItemID.StaffofEarth; + shimmerTransmute[ItemID.StaffofEarth] = ItemID.EyeoftheGolem; + + // Duke Fishron + shimmerTransmute[ItemID.FishronWings] = ItemID.Flairon; + shimmerTransmute[ItemID.Flairon] = ItemID.Tsunami; + shimmerTransmute[ItemID.Tsunami] = ItemID.BubbleGun; + shimmerTransmute[ItemID.BubbleGun] = ItemID.RazorbladeTyphoon; + shimmerTransmute[ItemID.RazorbladeTyphoon] = ItemID.TempestStaff; + shimmerTransmute[ItemID.TempestStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.FishronWings; + + // Empress of Light (Yes these are actually the IDs) + shimmerTransmute[ItemID.RainbowWings] = ItemID.PiercingStarlight; + shimmerTransmute[ItemID.PiercingStarlight] = ItemID.FairyQueenRangedItem; + shimmerTransmute[ItemID.FairyQueenRangedItem] = ItemID.FairyQueenMagicItem; + shimmerTransmute[ItemID.FairyQueenMagicItem] = ItemID.SparkleGuitar; + shimmerTransmute[ItemID.SparkleGuitar] = ItemID.RainbowWhip; + shimmerTransmute[ItemID.RainbowWhip] = ItemID.EmpressBlade; + shimmerTransmute[ItemID.EmpressBlade] = ItemID.RainbowWings; + + // Moon Lord + shimmerTransmute[ItemID.Meowmere] = ItemID.StarWrath; + shimmerTransmute[ItemID.StarWrath] = ItemID.Terrarian; + shimmerTransmute[ItemID.Terrarian] = ItemID.Celeb2; + shimmerTransmute[ItemID.Celeb2] = ItemID.SDMG; + shimmerTransmute[ItemID.SDMG] = ItemID.LastPrism; + shimmerTransmute[ItemID.LastPrism] = ItemID.LunarFlareBook; + shimmerTransmute[ItemID.LunarFlareBook] = ItemID.MoonlordTurretStaff; + shimmerTransmute[ItemID.MoonlordTurretStaff] = ItemID.RainbowCrystalStaff; + shimmerTransmute[ItemID.RainbowCrystalStaff] = ModContent.ItemType(); + shimmerTransmute[ModContent.ItemType()] = ItemID.Meowmere; + } #endregion } diff --git a/Items/AlicornonaStick.cs b/Items/ColdheartIcicle.cs similarity index 87% rename from Items/AlicornonaStick.cs rename to Items/ColdheartIcicle.cs index 1a0dda3f93..8ddd344abd 100644 --- a/Items/AlicornonaStick.cs +++ b/Items/ColdheartIcicle.cs @@ -5,12 +5,12 @@ using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items { - public class AlicornonaStick : ModItem, ILocalizedModType + [LegacyName("AlicornonaStick")] + public class ColdheartIcicle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; public override void SetDefaults() @@ -22,6 +22,17 @@ namespace CalamityMod.Items Item.rare = ModContent.RarityType(); } + public override void HoldStyle(Player player, Rectangle heldItemFrame) + { + player.itemRotation = player.direction == -1 ? -MathHelper.PiOver4 : MathHelper.PiOver4; + player.itemLocation = player.GetBackHandPosition(Player.CompositeArmStretchAmount.Full, player.direction * MathHelper.PiOver4) + Vector2.UnitX * player.direction * 14; + } + + public override void HoldItemFrame(Player player) + { + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, -player.direction * MathHelper.PiOver4); + } + public override void HoldItem(Player player) { int offset = player.direction == 1 ? 5 : -Item.width - 5; diff --git a/Items/ColdheartIcicle.png b/Items/ColdheartIcicle.png new file mode 100644 index 0000000000..a8efd6e769 Binary files /dev/null and b/Items/ColdheartIcicle.png differ diff --git a/Items/Critters/BabyGhostBellGoldItem.png b/Items/Critters/BabyGhostBellGoldItem.png index a62694c074..8108a2f5c5 100644 Binary files a/Items/Critters/BabyGhostBellGoldItem.png and b/Items/Critters/BabyGhostBellGoldItem.png differ diff --git a/Items/Critters/BabyGhostBellGreenItem.png b/Items/Critters/BabyGhostBellGreenItem.png index b4309e1033..a2266ddb83 100644 Binary files a/Items/Critters/BabyGhostBellGreenItem.png and b/Items/Critters/BabyGhostBellGreenItem.png differ diff --git a/Items/Critters/BabyGhostBellItem.png b/Items/Critters/BabyGhostBellItem.png index df7b9dc7ef..da84e29584 100644 Binary files a/Items/Critters/BabyGhostBellItem.png and b/Items/Critters/BabyGhostBellItem.png differ diff --git a/Items/Critters/BabyGhostBellRedItem.cs b/Items/Critters/BabyGhostBellPinkItem.cs similarity index 89% rename from Items/Critters/BabyGhostBellRedItem.cs rename to Items/Critters/BabyGhostBellPinkItem.cs index 5614894572..c7e026fb6f 100644 --- a/Items/Critters/BabyGhostBellRedItem.cs +++ b/Items/Critters/BabyGhostBellPinkItem.cs @@ -5,7 +5,7 @@ using Terraria.ID; namespace CalamityMod.Items.Critters { - public class BabyGhostBellRedItem : ModItem, ILocalizedModType + public class BabyGhostBellPinkItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; public override void SetStaticDefaults() diff --git a/Items/Critters/BabyGhostBellPinkItem.png b/Items/Critters/BabyGhostBellPinkItem.png new file mode 100644 index 0000000000..5fdd7c08b8 Binary files /dev/null and b/Items/Critters/BabyGhostBellPinkItem.png differ diff --git a/Items/Critters/BabyGhostBellRadiantItem.png b/Items/Critters/BabyGhostBellRadiantItem.png index 1f6c79cebc..856633e38a 100644 Binary files a/Items/Critters/BabyGhostBellRadiantItem.png and b/Items/Critters/BabyGhostBellRadiantItem.png differ diff --git a/Items/Critters/BabyGhostBellRedItem.png b/Items/Critters/BabyGhostBellRedItem.png deleted file mode 100644 index 9b414d1ab7..0000000000 Binary files a/Items/Critters/BabyGhostBellRedItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodBlackItem.png b/Items/Critters/PearlpodBlackItem.png index e12ceb5a8a..892ff72678 100644 Binary files a/Items/Critters/PearlpodBlackItem.png and b/Items/Critters/PearlpodBlackItem.png differ diff --git a/Items/Critters/PearlpodGoldItem.png b/Items/Critters/PearlpodGoldItem.png deleted file mode 100644 index b4813c7bd3..0000000000 Binary files a/Items/Critters/PearlpodGoldItem.png and /dev/null differ diff --git a/Items/Critters/PearlpodItem.png b/Items/Critters/PearlpodItem.png index abddeb22ff..bd60b5c6ad 100644 Binary files a/Items/Critters/PearlpodItem.png and b/Items/Critters/PearlpodItem.png differ diff --git a/Items/Critters/PearlpodPinkItem.png b/Items/Critters/PearlpodPinkItem.png index 20bf35cddd..c65355ec5e 100644 Binary files a/Items/Critters/PearlpodPinkItem.png and b/Items/Critters/PearlpodPinkItem.png differ diff --git a/Items/Critters/PearlpodGoldItem.cs b/Items/Critters/SeaFloatyItem.cs similarity index 59% rename from Items/Critters/PearlpodGoldItem.cs rename to Items/Critters/SeaFloatyItem.cs index fb84d69a99..bf7fd80139 100644 --- a/Items/Critters/PearlpodGoldItem.cs +++ b/Items/Critters/SeaFloatyItem.cs @@ -1,11 +1,12 @@ using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Packets; using Terraria; -using Terraria.ModLoader; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Critters { - public class PearlpodGoldItem : ModItem, ILocalizedModType + public class SeaFloatyItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Misc"; public override void SetStaticDefaults() @@ -15,9 +16,8 @@ namespace CalamityMod.Items.Critters public override void SetDefaults() { - Item.DefaultToCapturedCritter(ModContent.NPCType()); - Item.bait = 50; - Item.value = Item.sellPrice(gold: 10); + Item.DefaultToCapturedCritter(ModContent.NPCType()); + Item.value = Item.sellPrice(gold: 3); // These things are actually painful to catch, they can get a 300% value boost Item.rare = ItemRarityID.Green; } } diff --git a/Items/Critters/SeaFloatyItem.png b/Items/Critters/SeaFloatyItem.png new file mode 100644 index 0000000000..83dc6f5920 Binary files /dev/null and b/Items/Critters/SeaFloatyItem.png differ diff --git a/Items/DisgustingMeat.cs b/Items/DisgustingMeat.cs new file mode 100644 index 0000000000..9a635b1bec --- /dev/null +++ b/Items/DisgustingMeat.cs @@ -0,0 +1,95 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.PermanentBoosters; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items +{ + public class DisgustingMeat : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Misc"; + + public override void SetDefaults() + { + Item.DefaultToFood(32, 30, 0, 0); + Item.value = 0; + Item.UseSound = SoundID.NPCDeath13; + Item.maxStack = 1; + Item.consumable = false; + } + + public override bool AltFunctionUse(Player player) => true; + public override bool? UseItem(Player player) + { + if (player.ItemTimeIsZero) + { + var calPlayer = player.Calamity(); + if (player.altFunctionUse == 2) + { + TryDropBoosterItem(player, ref calPlayer.rageBoostOne, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.rageBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.rageBoostThree, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostOne, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostTwo, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.adrenalineBoostThree, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.nimbleBounderBoost, ModContent.ItemType()); + } + else + { + if (calPlayer.sTangerine || calPlayer.mFruit || calPlayer.tCloudberry || calPlayer.sStrawberry) + { + TryDropBoosterItem(player, ref calPlayer.sTangerine, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.mFruit, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.tCloudberry, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.sStrawberry, ModContent.ItemType()); + } + else + { + for (int i = 0; i < player.ConsumedLifeFruit; i++) + { + int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeFruit); + Main.item[drop].noGrabDelay = 100; + } + player.ConsumedLifeFruit = 0; + for (int j = 0; j < player.ConsumedLifeCrystals; j++) + { + int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.LifeCrystal); + Main.item[drop].noGrabDelay = 100; + } + player.ConsumedLifeCrystals = 0; + } + + if (calPlayer.cShard || calPlayer.eCore || calPlayer.pHeart) + { + TryDropBoosterItem(player, ref calPlayer.cShard, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.eCore, ModContent.ItemType()); + TryDropBoosterItem(player, ref calPlayer.pHeart, ModContent.ItemType()); + } + else + { + for (int k = 0; k < player.ConsumedManaCrystals; k++) + { + int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, ItemID.ManaCrystal); + Main.item[drop].noGrabDelay = 100; + } + player.ConsumedManaCrystals = 0; + } + } + return true; + } + + return null; + } + + private static void TryDropBoosterItem(Player player, ref bool condition, int itemType) + { + if (condition) + { + condition = false; + int drop = Item.NewItem(player.GetSource_DropAsItem(), player.Hitbox, itemType); + Main.item[drop].noGrabDelay = 100; + } + } + } +} diff --git a/Items/DisgustingMeat.png b/Items/DisgustingMeat.png new file mode 100644 index 0000000000..6d743191e2 Binary files /dev/null and b/Items/DisgustingMeat.png differ diff --git a/Items/DraedonMisc/AuricQuantumCoolingCell.cs b/Items/DraedonMisc/AuricQuantumCoolingCell.cs index fd51d616ec..4e12c8de55 100644 --- a/Items/DraedonMisc/AuricQuantumCoolingCell.cs +++ b/Items/DraedonMisc/AuricQuantumCoolingCell.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.DraedonMisc Item.consumable = true; Item.useStyle = ItemUseStyleID.Swing; Item.useAnimation = Item.useTime = 15; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 5, true); diff --git a/Items/DraedonMisc/EncryptedSchematicJungle.cs b/Items/DraedonMisc/EncryptedSchematicJungle.cs index 21ea505af7..0f3fb5688e 100644 --- a/Items/DraedonMisc/EncryptedSchematicJungle.cs +++ b/Items/DraedonMisc/EncryptedSchematicJungle.cs @@ -64,7 +64,7 @@ namespace CalamityMod.Items.DraedonMisc rangedDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 2, rangedDisplay); - int mageItem = ModContent.ItemType(); + int mageItem = ModContent.ItemType(); TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{mageItem}] {CalamityUtils.GetItemName(mageItem)}"); mageDisplay.OverrideColor = new Color(255, 64, 31); list.Insert(insertIndex + 3, mageDisplay); diff --git a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs index fb7e5cccf1..c5d36826ae 100644 --- a/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs +++ b/Items/DraedonMisc/EncryptedSchematicPlanetoid.cs @@ -59,12 +59,12 @@ namespace CalamityMod.Items.DraedonMisc meleeDisplay.OverrideColor = new Color(31, 242, 245); list.Insert(insertIndex + 1, meleeDisplay); - int rangedItem = ModContent.ItemType(); + int rangedItem = ModContent.ItemType(); TooltipLine rangedDisplay = new TooltipLine(this.Mod, "CalamityMod:RangedDisplay", $"[i:{rangedItem}] {CalamityUtils.GetItemName(rangedItem)}"); rangedDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 2, rangedDisplay); - int mageItem = ModContent.ItemType(); + int mageItem = ModContent.ItemType(); TooltipLine mageDisplay = new TooltipLine(this.Mod, "CalamityMod:MageDisplay", $"[i:{mageItem}] {CalamityUtils.GetItemName(mageItem)}"); mageDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 3, mageDisplay); diff --git a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs index 59ffdfced2..105dd1799c 100644 --- a/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs +++ b/Items/DraedonMisc/EncryptedSchematicSunkenSea.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Items.DraedonMisc int insertIndex = list.FindIndex(x => x.Name == "Tooltip2" && x.Mod == "Terraria"); if (insertIndex != -1) { - int meleeItem = ModContent.ItemType(); + int meleeItem = ModContent.ItemType(); TooltipLine meleeDisplay = new TooltipLine(this.Mod, "CalamityMod:MeleeDisplay", $"[i:{meleeItem}] {CalamityUtils.GetItemName(meleeItem)}"); meleeDisplay.OverrideColor = new Color(236, 255, 31); list.Insert(insertIndex + 1, meleeDisplay); @@ -76,7 +76,7 @@ namespace CalamityMod.Items.DraedonMisc mageDisplay.OverrideColor = new Color(201, 41, 255); list.Insert(insertIndex + 3, mageDisplay); - int summonItem = ModContent.ItemType(); + int summonItem = ModContent.ItemType(); TooltipLine summonDisplay = new TooltipLine(this.Mod, "CalamityMod:SummonDisplay", $"[i:{summonItem}] {CalamityUtils.GetItemName(summonItem)}"); summonDisplay.OverrideColor = new Color(149, 243, 43); list.Insert(insertIndex + 4, summonDisplay); diff --git a/Items/Dyes/AuricDye.cs b/Items/Dyes/AuricDye.cs index f328847496..9fda84daff 100644 --- a/Items/Dyes/AuricDye.cs +++ b/Items/Dyes/AuricDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/BlueCosmicFlameDye.cs b/Items/Dyes/BlueCosmicFlameDye.cs index a322c53232..3b43b85ee2 100644 --- a/Items/Dyes/BlueCosmicFlameDye.cs +++ b/Items/Dyes/BlueCosmicFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/CalamitousDye.cs b/Items/Dyes/CalamitousDye.cs index 01312c1b6d..0fd524c8ac 100644 --- a/Items/Dyes/CalamitousDye.cs +++ b/Items/Dyes/CalamitousDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/CosmiliteDye.cs b/Items/Dyes/CosmiliteDye.cs index c881cde6b3..c5cf8deda6 100644 --- a/Items/Dyes/CosmiliteDye.cs +++ b/Items/Dyes/CosmiliteDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/DragonSoulDye.cs b/Items/Dyes/DragonSoulDye.cs index 036526c584..efe65180e4 100644 --- a/Items/Dyes/DragonSoulDye.cs +++ b/Items/Dyes/DragonSoulDye.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/EndothermicDye.cs b/Items/Dyes/EndothermicDye.cs index 169a151228..27c04a71bf 100644 --- a/Items/Dyes/EndothermicDye.cs +++ b/Items/Dyes/EndothermicDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/ExoDye.cs b/Items/Dyes/ExoDye.cs index ec2b61ece3..2852aa4ce0 100644 --- a/Items/Dyes/ExoDye.cs +++ b/Items/Dyes/ExoDye.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 2, silver: 50); } diff --git a/Items/Dyes/HairDye/AdrenalineHairDye.cs b/Items/Dyes/HairDye/AdrenalineHairDye.cs index 3e4b4da9c3..7b780b8e3c 100644 --- a/Items/Dyes/HairDye/AdrenalineHairDye.cs +++ b/Items/Dyes/HairDye/AdrenalineHairDye.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Dyes.HairDye Item.consumable = true; Item.maxStack = Item.CommonMaxStack; - Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.value = Item.buyPrice(gold: 5); // Sold by Stylist Item.rare = ItemRarityID.Green; } } diff --git a/Items/Dyes/HairDye/RageHairDye.cs b/Items/Dyes/HairDye/RageHairDye.cs index 54df4cc38b..4266039761 100644 --- a/Items/Dyes/HairDye/RageHairDye.cs +++ b/Items/Dyes/HairDye/RageHairDye.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Dyes.HairDye Item.consumable = true; Item.maxStack = Item.CommonMaxStack; - Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.value = Item.buyPrice(gold: 5); // Sold by Stylist Item.rare = ItemRarityID.Green; } } diff --git a/Items/Dyes/HairDye/WingTimeHairDye.cs b/Items/Dyes/HairDye/WingTimeHairDye.cs index 272b2b41f0..45f444b2bd 100644 --- a/Items/Dyes/HairDye/WingTimeHairDye.cs +++ b/Items/Dyes/HairDye/WingTimeHairDye.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Dyes.HairDye Item.consumable = true; Item.maxStack = Item.CommonMaxStack; - Item.value = Item.buyPrice(gold: 7, silver: 50); // Sold by Stylist + Item.value = Item.buyPrice(gold: 5); // Sold by Stylist Item.rare = ItemRarityID.Green; } } diff --git a/Items/Dyes/InvisibleDye.cs b/Items/Dyes/InvisibleDye.cs new file mode 100644 index 0000000000..af27456e67 --- /dev/null +++ b/Items/Dyes/InvisibleDye.cs @@ -0,0 +1,78 @@ +using Microsoft.Xna.Framework.Graphics; +using Mono.Cecil.Cil; +using MonoMod.Cil; +using Terraria; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Dyes +{ + public class InvisibleDye : BaseDye + { + public override ArmorShaderData ShaderDataToBind => new ArmorShaderData(Mod.Assets.Request("Effects/Dyes/InvisibleDyeShader"), "DyePass"); + + public override void SafeSetStaticDefaults() + { + Item.ResearchUnlockCount = 3; + } + + public override void SafeSetDefaults() + { + Item.rare = ItemRarityID.Blue; + Item.value = Item.sellPrice(silver: 20); + } + + #region On Edit Hell To Actually Make Player Body Not Draw + public override void Load() + { + On_PlayerDrawLayers.DrawPlayer_21_Head += StopHeadDrawing; + On_PlayerDrawLayers.DrawPlayer_12_Skin += StopBodyAndLegDrawing; + On_PlayerDrawLayers.DrawPlayer_13_Leggings += StopLegClothesDrawing; + On_PlayerDrawLayers.DrawPlayer_17_Torso += StopBodyClothesDrawing; + On_PlayerDrawLayers.DrawPlayer_12_SkinComposite_BackArmShirt += StopCompositeArmDrawing; + On_PlayerDrawLayers.DrawPlayer_28_ArmOverItem += StopBackArmAndUndershirtDrawing; + } + + private static void StopHeadDrawing(On_PlayerDrawLayers.orig_DrawPlayer_21_Head orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cHead == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + return; + orig(ref drawInfo); + } + private static void StopBodyAndLegDrawing(On_PlayerDrawLayers.orig_DrawPlayer_12_Skin orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cBody == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + drawInfo.hidesTopSkin = true; + if (drawInfo.drawPlayer.cLegs == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + drawInfo.hidesBottomSkin = true; + orig(ref drawInfo); + } + private static void StopLegClothesDrawing(On_PlayerDrawLayers.orig_DrawPlayer_13_Leggings orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cLegs == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + return; + orig(ref drawInfo); + } + private static void StopBodyClothesDrawing(On_PlayerDrawLayers.orig_DrawPlayer_17_Torso orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cBody == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + return; + orig(ref drawInfo); + } + private static void StopCompositeArmDrawing(On_PlayerDrawLayers.orig_DrawPlayer_12_SkinComposite_BackArmShirt orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cBody == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + return; + orig(ref drawInfo); + } + private static void StopBackArmAndUndershirtDrawing(On_PlayerDrawLayers.orig_DrawPlayer_28_ArmOverItem orig, ref PlayerDrawSet drawInfo) + { + if (drawInfo.drawPlayer.cBody == GameShaders.Armor.GetShaderIdFromItemId(ModContent.ItemType())) + return; + orig(ref drawInfo); + } + #endregion + } +} diff --git a/Items/Dyes/InvisibleDye.png b/Items/Dyes/InvisibleDye.png new file mode 100644 index 0000000000..debd5eea5c Binary files /dev/null and b/Items/Dyes/InvisibleDye.png differ diff --git a/Items/Dyes/NightmareDye.cs b/Items/Dyes/NightmareDye.cs index 7687519061..058f3df1ff 100644 --- a/Items/Dyes/NightmareDye.cs +++ b/Items/Dyes/NightmareDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/PinkCosmicFlameDye.cs b/Items/Dyes/PinkCosmicFlameDye.cs index 0c89581f22..fc0e577827 100644 --- a/Items/Dyes/PinkCosmicFlameDye.cs +++ b/Items/Dyes/PinkCosmicFlameDye.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Dyes/SwirlingCosmicFlameDye.cs b/Items/Dyes/SwirlingCosmicFlameDye.cs index 1fcab18fea..afc9fb83a2 100644 --- a/Items/Dyes/SwirlingCosmicFlameDye.cs +++ b/Items/Dyes/SwirlingCosmicFlameDye.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Dyes public override void SafeSetDefaults() { - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = Item.sellPrice(gold: 1, silver: 50); } diff --git a/Items/Fishing/AstralCatches/UrsaSergeant.cs b/Items/Fishing/AstralCatches/UrsaSergeant.cs index 343875047f..96808d3399 100644 --- a/Items/Fishing/AstralCatches/UrsaSergeant.cs +++ b/Items/Fishing/AstralCatches/UrsaSergeant.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Items.Fishing.AstralCatches { Item.width = 36; Item.height = 26; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.accessory = true; } diff --git a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs index 9f73c7efe0..07e7f4cb50 100644 --- a/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs +++ b/Items/Fishing/BrimstoneCragCatches/Bloodfin.cs @@ -11,11 +11,11 @@ namespace CalamityMod.Items.Fishing.BrimstoneCragCatches { public new string LocalizationCategory => "Items.Fishing"; - public static int RegenBoost = 5; - public static int RegenTimeBoost = 10; + public static int RegenBoost = 4; + public static int RegenTimeBoost = 4; public static int DebuffedRegenBoost = 10; // Does not stack with above - public static int DebuffedRegenTimeFloor = 1800; + public static int DebuffedRegenTimeFloor = 900; public static double ExtraRegenHealthThreshold = 0.75D; public static int FramesForExtraRegen = 30; diff --git a/Items/Fishing/FishingRods/EarlyBloomRod.cs b/Items/Fishing/FishingRods/EarlyBloomRod.cs index ea7cbacd81..276056f757 100644 --- a/Items/Fishing/FishingRods/EarlyBloomRod.cs +++ b/Items/Fishing/FishingRods/EarlyBloomRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -25,11 +26,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.EarlyBloomRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/FeralDoubleRod.cs b/Items/Fishing/FishingRods/FeralDoubleRod.cs index cf8ad0dc8e..d57ea7d818 100644 --- a/Items/Fishing/FishingRods/FeralDoubleRod.cs +++ b/Items/Fishing/FishingRods/FeralDoubleRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,31 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; + Item.fishingPole = 40 +(int)((1f + (player.statLifeMax2 - player.statLife) * 0.25f)); + + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.FeralDoubleRod; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Fishing/FishingRods/HeronRod.cs b/Items/Fishing/FishingRods/HeronRod.cs index 2e15e436bf..de061ab965 100644 --- a/Items/Fishing/FishingRods/HeronRod.cs +++ b/Items/Fishing/FishingRods/HeronRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.HeronRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/NavyFishingRod.cs b/Items/Fishing/FishingRods/NavyFishingRod.cs index 686b065a72..3aec86c486 100644 --- a/Items/Fishing/FishingRods/NavyFishingRod.cs +++ b/Items/Fishing/FishingRods/NavyFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; @@ -24,6 +25,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.NavyFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/RiftReeler.cs b/Items/Fishing/FishingRods/RiftReeler.cs index 4de6da68e1..f8f84d98f1 100644 --- a/Items/Fishing/FishingRods/RiftReeler.cs +++ b/Items/Fishing/FishingRods/RiftReeler.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -30,13 +31,35 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + Item.accessory = true; + } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.RiftReeler; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < Main.rand.Next(3, 6); i++) //3 to 5 bobbers + for (int i = 0; i < 4; i++) //4 bobbers { - Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(18f)), type, 0, 0f, player.whoAmI, ai2: Main.rand.Next(2)); + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(MathHelper.ToRadians(45f)), type, 10, 1f, player.whoAmI, ai2: Main.rand.Next(2)); } return false; } @@ -47,7 +70,7 @@ namespace CalamityMod.Items.Fishing.FishingRods if (bobber.ai[2] == 0f) lineColor = new Color(255, 165, 0, 100); else - lineColor = new Color(0, 206, 209, 100); + lineColor = new Color(200, 206, 209, 100); } public override void AddRecipes() diff --git a/Items/Fishing/FishingRods/SlurperPole.cs b/Items/Fishing/FishingRods/SlurperPole.cs index cac04d7307..5f853c3c89 100644 --- a/Items/Fishing/FishingRods/SlurperPole.cs +++ b/Items/Fishing/FishingRods/SlurperPole.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Typeless; +using CalamityMod.CalPlayer; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -27,6 +28,29 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.SlurperPole; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/TheDevourerofCods.cs b/Items/Fishing/FishingRods/TheDevourerofCods.cs index c05b8bb2ec..bbbc0ba65a 100644 --- a/Items/Fishing/FishingRods/TheDevourerofCods.cs +++ b/Items/Fishing/FishingRods/TheDevourerofCods.cs @@ -1,4 +1,9 @@ -using CalamityMod.Items.Materials; +using System.Collections.Generic; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Fishing.AstralCatches; +using CalamityMod.Items.Fishing.BrimstoneCragCatches; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -12,6 +17,24 @@ namespace CalamityMod.Items.Fishing.FishingRods { public class TheDevourerofCods : ModItem, ILocalizedModType { + public static List FishToEat = new List() + { + ItemID.Bass, + ItemID.AtlanticCod, + ItemID.Flounder, + ItemID.NeonTetra, + ItemID.RedSnapper, + ItemID.RockLobster, + ItemID.Salmon, + ItemID.Shrimp, + ItemID.Trout, + ItemID.Tuna, + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; public new string LocalizationCategory => "Items.Fishing"; public override void SetStaticDefaults() { @@ -30,14 +53,33 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); + Item.accessory = true; } + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } public override void HoldItem(Player player) { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; player.accFishingLine = true; } + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.TheDevourerOfCods; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 10; i++) diff --git a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs index 74ef5cc142..7781598667 100644 --- a/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs +++ b/Items/Fishing/FishingRods/VerstaltiteFishingRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,30 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + player.accFishingLine = true; + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.VerstaltiteFishingRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) diff --git a/Items/Fishing/FishingRods/WulfrumRod.cs b/Items/Fishing/FishingRods/WulfrumRod.cs index d7309b4449..237c0fbe50 100644 --- a/Items/Fishing/FishingRods/WulfrumRod.cs +++ b/Items/Fishing/FishingRods/WulfrumRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -23,18 +24,41 @@ namespace CalamityMod.Items.Fishing.FishingRods Item.shootSpeed = 10f; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.accessory = true; + } + + public override bool AllowPrefix(int pre) + { + if (pre == 0) + return true; + return false; + } + + public override bool CanReforge() + { + return false; + } + public override void HoldItem(Player player) + { + if (player.Calamity().SelectedFishingMinigame == CalamityPlayer.FishingMinigames.None) + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; + } + + public override void UpdateEquip(Player player) + { + player.Calamity().SelectedFishingMinigame = CalamityPlayer.FishingMinigames.WulfrumRod; } public override void ModifyFishingLine(Projectile bobber, ref Vector2 lineOriginOffset, ref Color lineColor) { lineOriginOffset = new Vector2(35f, -27f); - lineColor = new Color(200, 200, 200, 100); + lineColor = Color.Lerp(Color.GreenYellow, Color.DeepSkyBlue, Main.player[bobber.owner].Calamity().consecutiveCaughtFish / 5f); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs index 8aa67f0bd6..8cc50d26bd 100644 --- a/Items/Fishing/SulphurCatches/HydrothermalCrate.cs +++ b/Items/Fishing/SulphurCatches/HydrothermalCrate.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() )); // Ancient Treasure Chest Loot @ 100%; Individually 10% diff --git a/Items/Fishing/SulphurCatches/SulphurousCrate.cs b/Items/Fishing/SulphurCatches/SulphurousCrate.cs index 692e01abdb..91a129cab5 100644 --- a/Items/Fishing/SulphurCatches/SulphurousCrate.cs +++ b/Items/Fishing/SulphurCatches/SulphurousCrate.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Fishing.SulphurCatches ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType() + ModContent.ItemType() )); itemLoot.AddBiomeCrateLootRules(false); diff --git a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs index 308fe9e4d2..53b7ba2c8b 100644 --- a/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/EutrophicCrate.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), - ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) })); itemLoot.AddBiomeCrateLootRules(false); diff --git a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs index 57b33bb787..d6cffdeb00 100644 --- a/Items/Fishing/SunkenSeaCatches/PrismCrate.cs +++ b/Items/Fishing/SunkenSeaCatches/PrismCrate.cs @@ -1,4 +1,4 @@ -using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.GameContent.ItemDropRules; using Terraria.ID; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Fishing.SunkenSeaCatches { ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50), - ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) + ItemDropRule.NotScalingWithLuck(ModContent.ItemType(), 1, 20, 50) })); itemLoot.AddBiomeCrateLootRules(); diff --git a/Items/IHoldShiftTooltipItem.cs b/Items/IHoldShiftTooltipItem.cs index 8ef0a22b79..28938b7a60 100644 --- a/Items/IHoldShiftTooltipItem.cs +++ b/Items/IHoldShiftTooltipItem.cs @@ -2,7 +2,7 @@ namespace CalamityMod.Items { - // This interface is used on items where you can hold Left SHIFT for an expanded tooltip. + // This interface is used on items where you can hold SHIFT for an expanded tooltip. // All actual implementation of this behavior is done in CalamityGlobalItemTooltip. public interface IHoldShiftTooltipItem { @@ -52,7 +52,7 @@ namespace CalamityMod.Items #endregion /// - /// Whether holding Left SHIFT for the tooltip extension hides the normal tooltip. Typically this is false. + /// Whether holding SHIFT for the tooltip extension hides the normal tooltip. Typically this is false. /// public virtual bool HidesNormalTooltip => false; diff --git a/Items/LoreItems/LoreCalamitas.cs b/Items/LoreItems/LoreCalamitas.cs index d6631d6b8c..eefec1d3e2 100644 --- a/Items/LoreItems/LoreCalamitas.cs +++ b/Items/LoreItems/LoreCalamitas.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreCynosure.cs b/Items/LoreItems/LoreCynosure.cs index a3bcad0756..2e916362f6 100644 --- a/Items/LoreItems/LoreCynosure.cs +++ b/Items/LoreItems/LoreCynosure.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreDevourerofGods.cs b/Items/LoreItems/LoreDevourerofGods.cs index 04ca63eed8..360f4c90bb 100644 --- a/Items/LoreItems/LoreDevourerofGods.cs +++ b/Items/LoreItems/LoreDevourerofGods.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/LoreItems/LoreExoMechs.cs b/Items/LoreItems/LoreExoMechs.cs index caeab5e015..15b8c0e3c5 100644 --- a/Items/LoreItems/LoreExoMechs.cs +++ b/Items/LoreItems/LoreExoMechs.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } diff --git a/Items/LoreItems/LoreYharon.cs b/Items/LoreItems/LoreYharon.cs index 274e3a1d2c..25e5910e76 100644 --- a/Items/LoreItems/LoreYharon.cs +++ b/Items/LoreItems/LoreYharon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.LoreItems Item.width = 20; Item.height = 20; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Materials/AscendantSpiritEssence.cs b/Items/Materials/AscendantSpiritEssence.cs index de3467dd4f..4a4e6c3f24 100644 --- a/Items/Materials/AscendantSpiritEssence.cs +++ b/Items/Materials/AscendantSpiritEssence.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 54; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 6); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { diff --git a/Items/Materials/AshesofAnnihilation.cs b/Items/Materials/AshesofAnnihilation.cs index 5b3565422d..38efcdd53a 100644 --- a/Items/Materials/AshesofAnnihilation.cs +++ b/Items/Materials/AshesofAnnihilation.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Materials Item.height = 56; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 6, silver: 66, copper: 66); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawPulsingAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/AuricBar.cs b/Items/Materials/AuricBar.cs index fd301108ee..9f69b8caf7 100644 --- a/Items/Materials/AuricBar.cs +++ b/Items/Materials/AuricBar.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Materials ItemID.Sets.SortingPriorityMaterials[Type] = 120; ItemID.Sets.AnimatesAsSoul[Type] = true; ItemID.Sets.ItemNoGravity[Type] = true; - Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 12)); + Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 4)); } public override void Unload() @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Materials { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 7); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Materials/AuricBar.png b/Items/Materials/AuricBar.png index 3f6b3f271a..80a05befba 100644 Binary files a/Items/Materials/AuricBar.png and b/Items/Materials/AuricBar.png differ diff --git a/Items/Materials/AuricBar_Glow.png b/Items/Materials/AuricBar_Glow.png index d80546d13a..fb946adc28 100644 Binary files a/Items/Materials/AuricBar_Glow.png and b/Items/Materials/AuricBar_Glow.png differ diff --git a/Items/Materials/BloodOrb.cs b/Items/Materials/BloodOrb.cs index 35716b0f34..d5daec913e 100644 --- a/Items/Materials/BloodOrb.cs +++ b/Items/Materials/BloodOrb.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Materials Item.height = 28; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(copper: 40); - Item.rare = ItemRarityID.Blue; + Item.rare = ItemRarityID.Green; } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/BloodSample.cs b/Items/Materials/BloodSample.cs deleted file mode 100644 index 5576926d81..0000000000 --- a/Items/Materials/BloodSample.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - public class BloodSample : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 68; // Sturdy Fossil - ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); - } - - public override void SetDefaults() - { - Item.width = 26; - Item.height = 34; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 2); - Item.rare = ItemRarityID.Orange; - - Item.MakeUsableWithChlorophyteExtractinator(); - } - } -} diff --git a/Items/Materials/BloodSample.png b/Items/Materials/BloodSample.png deleted file mode 100644 index 421a652516..0000000000 Binary files a/Items/Materials/BloodSample.png and /dev/null differ diff --git a/Items/Materials/CosmiliteBar.cs b/Items/Materials/CosmiliteBar.cs index d402b78f8e..b76d623ee8 100644 --- a/Items/Materials/CosmiliteBar.cs +++ b/Items/Materials/CosmiliteBar.cs @@ -22,8 +22,8 @@ namespace CalamityMod.Items.Materials public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 3); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 2); + Item.rare = ModContent.RarityType(); } public override void Update(ref float gravity, ref float maxFallSpeed) diff --git a/Items/Materials/DarksunFragment.cs b/Items/Materials/DarksunFragment.cs index 902ceb0fa1..b0b48fd1d6 100644 --- a/Items/Materials/DarksunFragment.cs +++ b/Items/Materials/DarksunFragment.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 32; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 60); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/EndothermicEnergy.cs b/Items/Materials/EndothermicEnergy.cs index 27a69c8c20..955f818970 100644 --- a/Items/Materials/EndothermicEnergy.cs +++ b/Items/Materials/EndothermicEnergy.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 38; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/ExoPrism.cs b/Items/Materials/ExoPrism.cs index 732cae5900..5b8c11ad99 100644 --- a/Items/Materials/ExoPrism.cs +++ b/Items/Materials/ExoPrism.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Materials Item.height = 52; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 7); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, float baseScale) { diff --git a/Items/Materials/MiracleMatter.cs b/Items/Materials/MiracleMatter.cs index 18963320e2..4f7392b898 100644 --- a/Items/Materials/MiracleMatter.cs +++ b/Items/Materials/MiracleMatter.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Materials Item.height = 80; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(platinum: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public void DrawBackAfterimage(SpriteBatch spriteBatch, Vector2 baseDrawPosition, Rectangle frame, Vector2 origin, float baseScale) diff --git a/Items/Materials/NightmareFuel.cs b/Items/Materials/NightmareFuel.cs index 01c020e757..883a1541a4 100644 --- a/Items/Materials/NightmareFuel.cs +++ b/Items/Materials/NightmareFuel.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 36; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(silver: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) diff --git a/Items/Materials/RottenMatter.cs b/Items/Materials/RottenMatter.cs deleted file mode 100644 index bd79bb3508..0000000000 --- a/Items/Materials/RottenMatter.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Materials -{ - [LegacyName("TrueShadowScale")] - public class RottenMatter : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Materials"; - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 25; - ItemID.Sets.SortingPriorityMaterials[Type] = 65; // Crimtane Ore - ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ModContent.ItemType(), 1); - } - - public override void SetDefaults() - { - Item.width = 28; - Item.height = 32; - Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 2); - Item.rare = ItemRarityID.Orange; - - Item.MakeUsableWithChlorophyteExtractinator(); - } - } -} diff --git a/Items/Materials/RottenMatter.png b/Items/Materials/RottenMatter.png deleted file mode 100644 index b3b9fb798f..0000000000 Binary files a/Items/Materials/RottenMatter.png and /dev/null differ diff --git a/Items/Materials/SeaRemains.cs b/Items/Materials/SeaRemains.cs index ff70b1ad9f..9fda545da4 100644 --- a/Items/Materials/SeaRemains.cs +++ b/Items/Materials/SeaRemains.cs @@ -1,4 +1,5 @@ -using Terraria; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -19,16 +20,15 @@ namespace CalamityMod.Items.Materials Item.width = 30; Item.height = 24; Item.maxStack = Item.CommonMaxStack; - Item.value = Item.sellPrice(silver: 36); + Item.value = Item.sellPrice(silver: 6); Item.rare = ItemRarityID.Green; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(2). - AddIngredient(ItemID.Coral, 2). - AddIngredient(ItemID.Starfish, 2). - AddIngredient(ItemID.Seashell, 2). + AddIngredient(1). + //AddIngredient(2). + AddIngredient(3). AddTile(TileID.Furnaces). Register(); } diff --git a/Items/Materials/SuspiciousScrap.cs b/Items/Materials/SuspiciousScrap.cs index ad7cf40862..b9b934e9e7 100644 --- a/Items/Materials/SuspiciousScrap.cs +++ b/Items/Materials/SuspiciousScrap.cs @@ -1,7 +1,7 @@ using CalamityMod.Rarities; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.GameContent; using Terraria.ID; @@ -25,11 +25,16 @@ namespace CalamityMod.Items.Materials Item.value = Item.sellPrice(copper: 4); Item.rare = ModContent.RarityType(); } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D tex = TextureAssets.Item[Type].Value; Vector2 positionDisplace = new Vector2(32, 32) * scale; - Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); + Rectangle variant = new Rectangle( + WorldGen.SavedOreTiers.Copper == TileID.Copper ? 32 : 0, + WorldGen.SavedOreTiers.Iron == TileID.Iron ? 32 : 0, + 30, 30 + ); spriteBatch.Draw(tex, position + positionDisplace, variant, drawColor, 0f, origin, scale * 2f, 0f, 0f); return false; } @@ -37,7 +42,11 @@ namespace CalamityMod.Items.Materials public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) { Texture2D tex = TextureAssets.Item[Type].Value; - Rectangle variant = new Rectangle(CalamityWorld.OreTypes[0] == TileID.Tin ? 0 : 32, CalamityWorld.OreTypes[1] == TileID.Lead ? 0 : 32, 30, 30); + Rectangle variant = new Rectangle( + WorldGen.SavedOreTiers.Copper == TileID.Copper ? 32 : 0, + WorldGen.SavedOreTiers.Iron == TileID.Iron ? 32 : 0, + 30, 30 + ); Vector2 positionDisplace = new Vector2(16, 16) * scale; spriteBatch.Draw(tex, Item.position + positionDisplace - Main.screenPosition, variant, lightColor, rotation, variant.Size() / 2f, scale, 0f, 0f); diff --git a/Items/Materials/WillOWisp.cs b/Items/Materials/WillOWisp.cs new file mode 100644 index 0000000000..0ac1f354dc --- /dev/null +++ b/Items/Materials/WillOWisp.cs @@ -0,0 +1,87 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Wulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.IO; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Items.Materials +{ + public class WillOWisp : ModItem, ILocalizedModType + { + public int textureVariant = 0; + + public static Asset altTexture = null; + public new string LocalizationCategory => "Items.Materials"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 25; + ItemID.Sets.SortingPriorityMaterials[Type] = 60; // Meteorite + } + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 26; + Item.maxStack = Item.CommonMaxStack; + Item.value = Item.sellPrice(silver: 1); + Item.rare = ItemRarityID.Green; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + var tex = textureVariant == 0 ? TextureAssets.Item[Type] : CalamityUtils.GetTextureEfficient(ref altTexture, "CalamityMod/Items/Materials/WillOWisp2"); + float rotationAmount = 0.25f; + float rotationSpeedMult = 0.033f; + spriteBatch.Draw(tex.Value, Item.Center - Main.screenPosition, null, lightColor, rotation + (rotationAmount * (float)Math.Sin(Item.whoAmI + Main.timeForVisualEffects * rotationSpeedMult)), tex.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (textureVariant == 0) + return true; + else + { + var tex = CalamityUtils.GetTextureEfficient(ref altTexture, "CalamityMod/Items/Materials/WillOWisp2"); + spriteBatch.Draw(tex.Value, position, null, drawColor, 0, tex.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + } + public override void OnSpawn(IEntitySource source) + { + textureVariant = Main.rand.NextBool().ToInt(); + } + public override void Update(ref float gravity, ref float maxFallSpeed) + { + + if (Collision.SolidCollision(Item.position, Item.width, Item.height + CalamityUtils.TilesToPixels(3), true)) + gravity *= 0.2f; + maxFallSpeed *= 0.1f; + if (Collision.SolidCollision(Item.position, Item.width, Item.height + CalamityUtils.TilesToPixels(2), true)) + gravity *= -1; + Item.velocity.X /= 0.95f; + Item.velocity.X *= 0.975f; + if (Main.rand.NextBool(10)) + { + var d = Dust.NewDustDirect(Item.position, Item.width, Item.height, DustID.Obsidian, newColor: Color.Red, Scale: 0.9f); + d.velocity *= 1f; + d.noGravity = true; + } + } + } +} diff --git a/Items/Materials/WillOWisp.png b/Items/Materials/WillOWisp.png new file mode 100644 index 0000000000..1c20a1c44b Binary files /dev/null and b/Items/Materials/WillOWisp.png differ diff --git a/Items/Materials/WillOWisp2.png b/Items/Materials/WillOWisp2.png new file mode 100644 index 0000000000..678e703357 Binary files /dev/null and b/Items/Materials/WillOWisp2.png differ diff --git a/Items/Materials/WulfrumMetalScrap.cs b/Items/Materials/WulfrumMetalScrap.cs index b2140ca6ec..1f1031014f 100644 --- a/Items/Materials/WulfrumMetalScrap.cs +++ b/Items/Materials/WulfrumMetalScrap.cs @@ -1,11 +1,15 @@ using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Wulfrum; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.IO; using static CalamityMod.CalamityUtils; namespace CalamityMod.Items.Materials @@ -15,6 +19,10 @@ namespace CalamityMod.Items.Materials { public new string LocalizationCategory => "Items.Materials"; + public int textureVariant = 0; + + public static Asset altTexture = null; + public override void SetStaticDefaults() { Item.ResearchUnlockCount = 25; @@ -35,10 +43,34 @@ namespace CalamityMod.Items.Materials itemGroup = ContentSamples.CreativeHelper.ItemGroup.Material; } + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + if (textureVariant == 0) + return true; + else + { + spriteBatch.Draw(altTexture.Value, Item.Center - Main.screenPosition, null, lightColor, rotation, altTexture.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + if (textureVariant == 0) + return true; + else + { + spriteBatch.Draw(altTexture.Value, position, null, drawColor, 0, altTexture.Size() / 2, scale, SpriteEffects.None, 0); + return false; + } + } + public override void OnSpawn(IEntitySource source) { if (source is EntitySource_Loot) { + textureVariant = Main.rand.NextBool().ToInt(); + if (Main.rand.NextBool()) return; @@ -67,7 +99,11 @@ namespace CalamityMod.Items.Materials } } - public override void Load() => Terraria.On_Item.CanFillEmptyAmmoSlot += AvoidDefaultingToAmmoSlot; + public override void Load() + { + Terraria.On_Item.CanFillEmptyAmmoSlot += AvoidDefaultingToAmmoSlot; + altTexture = ModContent.Request(Texture + "2"); + } private bool AvoidDefaultingToAmmoSlot(Terraria.On_Item.orig_CanFillEmptyAmmoSlot orig, Item self) { diff --git a/Items/Materials/WulfrumMetalScrap.png b/Items/Materials/WulfrumMetalScrap.png index 384f3c9372..b5718218e9 100644 Binary files a/Items/Materials/WulfrumMetalScrap.png and b/Items/Materials/WulfrumMetalScrap.png differ diff --git a/Items/Materials/WulfrumMetalScrap2.png b/Items/Materials/WulfrumMetalScrap2.png new file mode 100644 index 0000000000..91c1805f0d Binary files /dev/null and b/Items/Materials/WulfrumMetalScrap2.png differ diff --git a/Items/Materials/YharonSoulFragment.cs b/Items/Materials/YharonSoulFragment.cs index 542fe37019..f6e256e3c5 100644 --- a/Items/Materials/YharonSoulFragment.cs +++ b/Items/Materials/YharonSoulFragment.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Materials Item.height = 14; Item.maxStack = Item.CommonMaxStack; Item.value = Item.sellPrice(gold: 5); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/MomentumCapacitor.cs b/Items/MomentumCapacitor.cs index b5bf27973e..0cc3a4abc8 100644 --- a/Items/MomentumCapacitor.cs +++ b/Items/MomentumCapacitor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items { Item.width = 28; Item.height = 32; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.value = Item.buyPrice(gold: 50); // Sold by Bandit Item.rare = ItemRarityID.Pink; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/Mounts/AlicornMount.cs b/Items/Mounts/AlicornMount.cs deleted file mode 100644 index 195d4ab52a..0000000000 --- a/Items/Mounts/AlicornMount.cs +++ /dev/null @@ -1,152 +0,0 @@ -using CalamityMod.Buffs.Mounts; -using CalamityMod.CalPlayer; -using CalamityMod.NPCs.TownNPCs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Mounts -{ - public class AlicornMount : ModMount - { - public override void SetStaticDefaults() - { - MountData.spawnDust = 234; - MountData.spawnDustNoGravity = true; - MountData.buff = ModContent.BuffType(); - - // Horizontal movement - MountData.runSpeed = 5.6f; - MountData.dashSpeed = 17.6f; - MountData.swimSpeed = 4f; - MountData.acceleration = 0.4f; - - // Vertical movement - MountData.fallDamage = 0f; - MountData.fatigueMax = int.MaxValue; - MountData.flightTimeMax = int.MaxValue; - MountData.jumpSpeed = 9.21f; - - // Frames and offsets - MountData.totalFrames = 15; - MountData.heightBoost = 34; - int baseYOffset = 30; - int[] array = new int[MountData.totalFrames]; - for (int l = 0; l < array.Length; l++) - array[l] = baseYOffset; - - array[1] = array[3] = array[5] = array[7] = array[12] = baseYOffset - 2; - MountData.playerYOffsets = array; - MountData.playerHeadOffset = 36; - MountData.bodyFrame = 3; - MountData.xOffset = -4; - MountData.yOffset = 6; - MountData.standingFrameCount = 1; - MountData.standingFrameDelay = 12; - MountData.standingFrameStart = 0; - MountData.runningFrameCount = 8; - MountData.runningFrameDelay = 42; - MountData.runningFrameStart = 1; - MountData.flyingFrameCount = 6; - MountData.flyingFrameDelay = 4; - MountData.flyingFrameStart = 9; - MountData.inAirFrameCount = 1; - MountData.inAirFrameDelay = 12; - MountData.inAirFrameStart = 10; - MountData.idleFrameCount = 1; - MountData.idleFrameDelay = 12; - MountData.idleFrameStart = 5; - MountData.idleFrameLoop = true; - MountData.swimFrameCount = MountData.inAirFrameCount; - MountData.swimFrameDelay = MountData.inAirFrameDelay; - MountData.swimFrameStart = MountData.inAirFrameStart; - if (!Main.dedServ) - { - MountData.frontTextureExtra = ModContent.Request("CalamityMod/Items/Mounts/AlicornMountExtra"); - MountData.textureWidth = MountData.backTexture.Width(); - MountData.textureHeight = MountData.backTexture.Height(); - } - } - - public override void SetMount(Player player, ref bool skipDust) - { - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.type == ModContent.NPCType()) - { - npc.active = false; - npc.netUpdate = true; - break; - } - } - } - - public override void Dismount(Player player, ref bool skipDust) - { - bool anyPlayerOnFabMount = false; - foreach (Player player2 in Main.ActivePlayers) - { - // The player that is dismounting is technically not on the mount anymore. - if (player2.Calamity().fab && player2.whoAmI != player.whoAmI) - { - anyPlayerOnFabMount = true; - break; - } - } - - // Spawn Cirrus if no other players are on the Alicorn mount. - if (!anyPlayerOnFabMount) - { - if (!NPC.AnyNPCs(ModContent.NPCType())) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_TownSpawn(), (int)player.Center.X, (int)player.Center.Y, ModContent.NPCType()); - } - } - } - - public override void UpdateEffects(Player player) - { - CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.cirrusVodka) - player.GetDamage() += 0.1f; - - if (player.velocity.Length() > 9f) - { - int rand = Main.rand.Next(2); - bool momo = false; - if (rand == 1) - { - momo = true; - } - Color meme; - if (momo) - { - meme = new Color(255, 68, 242); - } - else - { - meme = new Color(25, 105, 255); - } - Rectangle rect = player.getRect(); - int dust = Dust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, DustID.BoneTorch, 0, 0, 0, meme); - Main.dust[dust].noGravity = true; - } - - if (player.velocity.Y != 0f) - { - if (player.mount.PlayerOffset == 28) - { - if (!player.flapSound) - SoundEngine.PlaySound(SoundID.Item32, player.Center); - player.flapSound = true; - } - else - player.flapSound = false; - } - } - } -} diff --git a/Items/Mounts/AlicornMountExtra.png b/Items/Mounts/AlicornMountExtra.png deleted file mode 100644 index b544a94ba8..0000000000 Binary files a/Items/Mounts/AlicornMountExtra.png and /dev/null differ diff --git a/Items/Mounts/AlicornMount_Back.png b/Items/Mounts/AlicornMount_Back.png deleted file mode 100644 index fcb20c4308..0000000000 Binary files a/Items/Mounts/AlicornMount_Back.png and /dev/null differ diff --git a/Items/Mounts/AlicornMount_Front.png b/Items/Mounts/AlicornMount_Front.png deleted file mode 100644 index 821fd8bbfc..0000000000 Binary files a/Items/Mounts/AlicornMount_Front.png and /dev/null differ diff --git a/Items/Mounts/Brimrose.cs b/Items/Mounts/Brimrose.cs index ce4728ef24..0368904f0e 100644 --- a/Items/Mounts/Brimrose.cs +++ b/Items/Mounts/Brimrose.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Mounts Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item3; Item.noMelee = true; - Item.mountType = ModContent.MountType(); + Item.mountType = ModContent.MountType(); Item.value = Item.sellPrice(gold: 5); Item.rare = ItemRarityID.Yellow; diff --git a/Items/Mounts/PhuppersChair.cs b/Items/Mounts/BrimroseChair.cs similarity index 98% rename from Items/Mounts/PhuppersChair.cs rename to Items/Mounts/BrimroseChair.cs index ba514b1f01..ad201606b0 100644 --- a/Items/Mounts/PhuppersChair.cs +++ b/Items/Mounts/BrimroseChair.cs @@ -6,7 +6,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Mounts { - public class PhuppersChair : ModMount + public class BrimroseChair : ModMount { public override void SetStaticDefaults() { diff --git a/Items/Mounts/PhuppersChair_Back.png b/Items/Mounts/BrimroseChair_Back.png similarity index 100% rename from Items/Mounts/PhuppersChair_Back.png rename to Items/Mounts/BrimroseChair_Back.png diff --git a/Items/Mounts/PhuppersChair_Front.png b/Items/Mounts/BrimroseChair_Front.png similarity index 100% rename from Items/Mounts/PhuppersChair_Front.png rename to Items/Mounts/BrimroseChair_Front.png diff --git a/Items/Mounts/Minecarts/TheCartofGods.cs b/Items/Mounts/Minecarts/TheCartofGods.cs index ae22235184..28178c0b3f 100644 --- a/Items/Mounts/Minecarts/TheCartofGods.cs +++ b/Items/Mounts/Minecarts/TheCartofGods.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Mounts.Minecarts Item.mountType = ModContent.MountType(); Item.value = Item.sellPrice(gold: 30); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Mounts/OnyxExcavator.cs b/Items/Mounts/OnyxExcavator.cs index 402c49a00d..41bb443dd8 100644 --- a/Items/Mounts/OnyxExcavator.cs +++ b/Items/Mounts/OnyxExcavator.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Items.Mounts MountData.buff = ModContent.BuffType(); // Horizontal movement - MountData.runSpeed = 5.5f; + MountData.runSpeed = 4.5f; MountData.swimSpeed = 0.5f; - MountData.acceleration = 0.2f; + MountData.acceleration = 0.1f; // Vertical movement MountData.fallDamage = 0f; diff --git a/Items/Mounts/PrincessSpiritinaBottle.cs b/Items/Mounts/PrincessSpiritinaBottle.cs deleted file mode 100644 index 26dec65edd..0000000000 --- a/Items/Mounts/PrincessSpiritinaBottle.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Mounts -{ - [LegacyName("Fabsol")] - public class PrincessSpiritinaBottle : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Mounts"; - public override void SetDefaults() - { - Item.width = 16; - Item.height = 16; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Swing; - Item.UseSound = SoundID.Item3; - Item.noMelee = true; - Item.mountType = ModContent.MountType(); - - Item.value = Item.sellPrice(gold: 5); - Item.rare = ItemRarityID.Yellow; - Item.Calamity().devItem = true; - } - } -} diff --git a/Items/Mounts/PrincessSpiritinaBottle.png b/Items/Mounts/PrincessSpiritinaBottle.png deleted file mode 100644 index 485a6245d0..0000000000 Binary files a/Items/Mounts/PrincessSpiritinaBottle.png and /dev/null differ diff --git a/Items/PermanentBoosters/MiracleFruit.cs b/Items/PermanentBoosters/MiracleFruit.cs index 974b0cbc05..ce2efc22de 100644 --- a/Items/PermanentBoosters/MiracleFruit.cs +++ b/Items/PermanentBoosters/MiracleFruit.cs @@ -70,7 +70,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LifeFruit, 5). + AddIngredient(ItemID.LifeFruit). AddIngredient(5). AddIngredient(12). AddTile(TileID.MythrilAnvil). diff --git a/Items/PermanentBoosters/SacredStrawberry.cs b/Items/PermanentBoosters/SacredStrawberry.cs index d6e040021e..94cb0bf4ed 100644 --- a/Items/PermanentBoosters/SacredStrawberry.cs +++ b/Items/PermanentBoosters/SacredStrawberry.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.PermanentBoosters Item.UseSound = UseSound; Item.useStyle = ItemUseStyleID.HoldUp; Item.value = Item.sellPrice(gold: 48); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ConsumedLifeFruit == Player.LifeFruitMax; @@ -73,7 +73,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LifeFruit, 5). + AddIngredient(ItemID.LifeFruit). AddIngredient(5). AddIngredient(). AddTile(). diff --git a/Items/PermanentBoosters/SanguineTangerine.cs b/Items/PermanentBoosters/SanguineTangerine.cs index 1348fda9fe..7fa60d5666 100644 --- a/Items/PermanentBoosters/SanguineTangerine.cs +++ b/Items/PermanentBoosters/SanguineTangerine.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LifeFruit, 5). + AddIngredient(ItemID.LifeFruit). AddIngredient(10). AddIngredient(ItemID.SoulofFright, 5). AddIngredient(ItemID.SoulofMight, 5). diff --git a/Items/PermanentBoosters/TaintedCloudberry.cs b/Items/PermanentBoosters/TaintedCloudberry.cs index 56fc3b45ac..f78a25b857 100644 --- a/Items/PermanentBoosters/TaintedCloudberry.cs +++ b/Items/PermanentBoosters/TaintedCloudberry.cs @@ -72,7 +72,7 @@ namespace CalamityMod.Items.PermanentBoosters public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.LifeFruit, 5). + AddIngredient(ItemID.LifeFruit). AddIngredient(10). AddIngredient(8). AddTile(TileID.MythrilAnvil). diff --git a/Items/Pets/BrimstoneJewel.cs b/Items/Pets/BrimstoneJewel.cs index 0156aab59e..a35a259e70 100644 --- a/Items/Pets/BrimstoneJewel.cs +++ b/Items/Pets/BrimstoneJewel.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/CosmicPlushie.cs b/Items/Pets/CosmicPlushie.cs index 8de7642381..67f8e4a4c2 100644 --- a/Items/Pets/CosmicPlushie.cs +++ b/Items/Pets/CosmicPlushie.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Pets Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.UseSound = SoundID.Meowmere; Item.value = Item.sellPrice(gold: 7); // Terry reference - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/ForgottenDragonEgg.cs b/Items/Pets/ForgottenDragonEgg.cs index ef80bee193..4d37be5ff7 100644 --- a/Items/Pets/ForgottenDragonEgg.cs +++ b/Items/Pets/ForgottenDragonEgg.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Pets/FoxDrive.cs b/Items/Pets/FoxDrive.cs index bdd6efc790..b09ca81710 100644 --- a/Items/Pets/FoxDrive.cs +++ b/Items/Pets/FoxDrive.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Pets Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.expert = true; Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/Levi.cs b/Items/Pets/Levi.cs index 567418d2f4..14cf954d0e 100644 --- a/Items/Pets/Levi.cs +++ b/Items/Pets/Levi.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; } diff --git a/Items/Pets/McNuggets.cs b/Items/Pets/McNuggets.cs index 9ec90e2e81..44a0907073 100644 --- a/Items/Pets/McNuggets.cs +++ b/Items/Pets/McNuggets.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Pets { Item.DefaultToVanitypet(ModContent.ProjectileType(), ModContent.BuffType()); Item.value = Item.sellPrice(gold: 20); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void UseStyle(Player player, Rectangle heldItemFrame) diff --git a/Items/Placeables/Abyss/SulphurousSand.cs b/Items/Placeables/Abyss/SulphurousSand.cs index e2b44467ba..59087ec75f 100644 --- a/Items/Placeables/Abyss/SulphurousSand.cs +++ b/Items/Placeables/Abyss/SulphurousSand.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Items.Placeables.Abyss Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } public override void SetDefaults() diff --git a/Items/Placeables/Astral/AstralSand.cs b/Items/Placeables/Astral/AstralSand.cs index 1ddc465fb5..a7e732363b 100644 --- a/Items/Placeables/Astral/AstralSand.cs +++ b/Items/Placeables/Astral/AstralSand.cs @@ -13,8 +13,7 @@ namespace CalamityMod.Items.Placeables.Astral Item.ResearchUnlockCount = 100; ItemTrader.ChlorophyteExtractinator.AddOption_OneWay(Type, 1, ItemID.SandBlock, 1); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } public override void SetDefaults() diff --git a/Items/Placeables/Astral/CelestialRemains.cs b/Items/Placeables/Astral/CelestialRemains.cs index 5c5a398db9..1ac5969a51 100644 --- a/Items/Placeables/Astral/CelestialRemains.cs +++ b/Items/Placeables/Astral/CelestialRemains.cs @@ -108,32 +108,32 @@ namespace CalamityMod.Items.Placeables.Astral resultType = ItemID.Amber; resultStack = Main.rand.Next(1, 21); } - else if (val < 81.78f) + else if (val < 81.78f && Main.hardMode) { resultType = ItemID.PalladiumOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 83.03f) + else if (val < 83.03f && Main.hardMode) { resultType = ItemID.CobaltOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 85.03f) + else if (val < 85.03f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 87.03f) + else if (val < 87.03f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 88.78f) + else if (val < 88.78f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 89.53f) + else if (val < 89.53f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); diff --git a/Items/Placeables/Astral/NovaeSlag.cs b/Items/Placeables/Astral/NovaeSlag.cs index b78942be81..116e17712e 100644 --- a/Items/Placeables/Astral/NovaeSlag.cs +++ b/Items/Placeables/Astral/NovaeSlag.cs @@ -97,32 +97,32 @@ namespace CalamityMod.Items.Placeables.Astral resultType = ItemID.Amber; resultStack = Main.rand.Next(1, 21); } - else if (val < 78.78f) + else if (val < 78.78f && Main.hardMode) { resultType = ItemID.PalladiumOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 81.03f) + else if (val < 81.03f && Main.hardMode) { resultType = ItemID.CobaltOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 83.03f) + else if (val < 83.03f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : ItemID.MythrilOre : ItemID.MythrilOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 85.03f) + else if (val < 85.03f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : ItemID.OrichalcumOre : ItemID.OrichalcumOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 86.78f) + else if (val < 86.78f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.CobaltOre : !twoMechsDowned ? ItemID.MythrilOre : ItemID.AdamantiteOre : ItemID.AdamantiteOre; resultStack = Main.rand.Next(1, 17); } - else if (val < 88.53f) + else if (val < 88.53f && Main.hardMode) { resultType = CalamityServerConfig.Instance.EarlyHardmodeProgressionRework ? !NPC.downedMechBossAny ? ItemID.PalladiumOre : !twoMechsDowned ? ItemID.OrichalcumOre : ItemID.TitaniumOre : ItemID.TitaniumOre; resultStack = Main.rand.Next(1, 17); diff --git a/Items/Placeables/Furniture/CirrusCouch.cs b/Items/Placeables/Furniture/CirrusCouch.cs deleted file mode 100644 index c2b66c79ed..0000000000 --- a/Items/Placeables/Furniture/CirrusCouch.cs +++ /dev/null @@ -1,18 +0,0 @@ -using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.Furniture -{ - public class CirrusCouch : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Placeables"; - public override void SetDefaults() - { - Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 2, silver: 50); - } - } -} diff --git a/Items/Placeables/Furniture/CirrusCouch.png b/Items/Placeables/Furniture/CirrusCouch.png deleted file mode 100644 index 3d0e1a4ba3..0000000000 Binary files a/Items/Placeables/Furniture/CirrusCouch.png and /dev/null differ diff --git a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs index f1afd84641..02e98bce76 100644 --- a/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/AltarOfTheAccursedItem.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 40); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs index 585d31e782..55da90cc1e 100644 --- a/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs +++ b/Items/Placeables/Furniture/CraftingStations/CosmicAnvilItem.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 60); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 50); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs index b7a9a85f65..6c812e8cfd 100644 --- a/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs +++ b/Items/Placeables/Furniture/CraftingStations/DraedonsForge.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(platinum: 4); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs index fccabfaca5..7082ae07af 100644 --- a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs +++ b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.cs @@ -4,7 +4,6 @@ using CalamityMod.Tiles.Furniture.DevPaintings; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using static Microsoft.Xna.Framework.Input.Keys; namespace CalamityMod.Items.Placeables.Furniture.DevPaintings { @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public override void ModifyTooltips(List tooltips) { - if (!Main.keyState.IsKeyDown(LeftShift)) + if (!Main.keyState.PressingShift()) return; string tooltip = ""; @@ -51,13 +50,13 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings public static IList devList = new List() { - "Fabsol, the mod's founder and owner", // Fabsol gets a line to himself "Altix", - "Angel", "apotofkoolaid", "AquaSG", "Atalya", "Ben-TK", + "Big E", + "CDMusic", "Cei", "CongratsIsTrash", "Cooper", @@ -65,16 +64,15 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "CrabBar", "Dandy", "Dia", + "Done", "dozezoze", "Eddie Spaghetti", - "enamoured", "ENNWAY", "Flowaria", "Fluffy", "fryzahh", "HaguriHat", "Heart Plus Up!", - "Hugekraken", "LordMetarex", "Memes", "Mercutio 'Merkalto' Takle", @@ -88,10 +86,12 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Raesh", "Sagittariod", "Shade", - "SharZz", "Shayy", "Spider Prov", "StipulateVenus", + "Sunny", + "Tobias", + "Tomat", "Triangle", "TYESKI (Universe)", "Uncle Danny", @@ -111,7 +111,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Blockaroz", "Boffin", "Bravioli", - "CDMusic", "Chetto", "Chill Dude", "Cobalion", @@ -119,7 +118,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "DarkTiny", "Demik", "DM Dokuro", - "Done", "Doog", "drh", "dwshin", @@ -127,6 +125,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Earth", "EchoDuck", "Ein", + "enamoured", "Enreden", "Epsilon", "Fargowilta", @@ -137,6 +136,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Graydee", "Grox the Great", "Hectique", + "Hugekraken", "Huggles", "Ian-1KV", "IbanPlay", @@ -153,6 +153,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Lompl Allimath", "Lucille Karma", "MarieArk", + "Mihaii", "Minecat", "Mrrp", "Nao", @@ -166,7 +167,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Phantasmal Deathray", "Phupperbat", "Pinkie Poss", - "pixlgray", "Poly", "Popo", "President Waluigi", @@ -176,6 +176,7 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "Runefield", "Sargassum", "sentri", + "SharZz", "Shucks", "Silver-Lord of Ash", "SixteenInMono", @@ -190,7 +191,6 @@ namespace CalamityMod.Items.Placeables.Furniture.DevPaintings "ThousandFields", "TikiWiki", "Tinymanx", - "Tomat", "Trivaxy", "Uberransy", "Vaikyia", diff --git a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png index 87e86d9bcb..157df9cb45 100644 Binary files a/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png and b/Items/Placeables/Furniture/DevPaintings/ThankYouPainting.png differ diff --git a/Items/Placeables/Furniture/Monoliths/AstralProjector.cs b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs index 7029bff471..b36d59a964 100644 --- a/Items/Placeables/Furniture/Monoliths/AstralProjector.cs +++ b/Items/Placeables/Furniture/Monoliths/AstralProjector.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using CalamityMod.Tiles.Furniture.Monoliths; using Terraria; using Terraria.ID; diff --git a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs index 62d4f385a0..6637a54478 100644 --- a/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/BlueDistortedMonolith.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 45); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 30); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs index ece5bf1f44..8ebb0de7b9 100644 --- a/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs +++ b/Items/Placeables/Furniture/Monoliths/DraconicIncense.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 75); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs index f06a7b6e33..71c984ba02 100644 --- a/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs +++ b/Items/Placeables/Furniture/Monoliths/ExoObelisk.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs new file mode 100644 index 0000000000..4d3d7874cd --- /dev/null +++ b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.cs @@ -0,0 +1,35 @@ +using CalamityMod.ForegroundDrawing.LoopingTextures; +using CalamityMod.Tiles.Furniture.Monoliths; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.Furniture.Monoliths +{ + public class OldDukeMonolith : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.buyPrice(gold: 25); // Sold by Archmage + Item.rare = ItemRarityID.Pink; + Item.accessory = true; + Item.vanity = true; + } + + public override void UpdateEquip(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + public override void UpdateVanity(Player player) + { + if (player.whoAmI == Main.myPlayer) + { + player.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + } +} diff --git a/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png new file mode 100644 index 0000000000..8d4672a17e Binary files /dev/null and b/Items/Placeables/Furniture/Monoliths/OldDukeMonolith.png differ diff --git a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs index c5b5d93424..204e9ce38c 100644 --- a/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs +++ b/Items/Placeables/Furniture/Monoliths/PurpleDistortedMonolith.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Placeables.Furniture.Monoliths public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(gold: 45); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(gold: 30); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/Furniture/ResilientCandle.cs b/Items/Placeables/Furniture/ResilientCandle.cs index 49ee32a22d..0bb9adab8a 100644 --- a/Items/Placeables/Furniture/ResilientCandle.cs +++ b/Items/Placeables/Furniture/ResilientCandle.cs @@ -16,8 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 20); + Item.value = Item.buyPrice(gold: 25); // Sold by Wizard Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Furniture/SpitefulCandle.cs b/Items/Placeables/Furniture/SpitefulCandle.cs index 8f8eee2c9a..1c6cf59f01 100644 --- a/Items/Placeables/Furniture/SpitefulCandle.cs +++ b/Items/Placeables/Furniture/SpitefulCandle.cs @@ -16,8 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 20); + Item.value = Item.buyPrice(gold: 25); // Sold by Wizard Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Furniture/ThaumaticChair.cs b/Items/Placeables/Furniture/ThaumaticChair.cs index c5934ebc44..32e3c9a452 100644 --- a/Items/Placeables/Furniture/ThaumaticChair.cs +++ b/Items/Placeables/Furniture/ThaumaticChair.cs @@ -5,7 +5,7 @@ using CalamityMod.Items.Placeables.FurnitureAncient; using CalamityMod.Items.Placeables.FurnitureAshen; using CalamityMod.Items.Placeables.FurnitureBotanic; using CalamityMod.Items.Placeables.FurnitureCosmilite; -using CalamityMod.Items.Placeables.FurnitureEutrophic; +using CalamityMod.Items.Placeables.FurnitureNavystone; using CalamityMod.Items.Placeables.FurnitureExo; using CalamityMod.Items.Placeables.FurnitureMarnite; using CalamityMod.Items.Placeables.FurnitureMonolith; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Placeables.Furniture { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 10); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Placeables.Furniture AddIngredient(). AddIngredient(). AddIngredient(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Placeables/Furniture/VigorousCandle.cs b/Items/Placeables/Furniture/VigorousCandle.cs index 8d8408d64d..e203002839 100644 --- a/Items/Placeables/Furniture/VigorousCandle.cs +++ b/Items/Placeables/Furniture/VigorousCandle.cs @@ -16,8 +16,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 20); + Item.value = Item.buyPrice(gold: 25); // Sold by Wizard Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Furniture/VoidTorch.cs b/Items/Placeables/Furniture/VoidTorch.cs index 8f1d5467ba..e759ca8304 100644 --- a/Items/Placeables/Furniture/VoidTorch.cs +++ b/Items/Placeables/Furniture/VoidTorch.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.Furniture { + [LegacyName("AbyssTorch")] public class VoidTorch : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 7edb2ebd30..834e56cb4d 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -18,8 +18,7 @@ namespace CalamityMod.Items.Placeables.Furniture public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 20); + Item.value = Item.buyPrice(gold: 25); // Sold by Wizard Item.rare = ItemRarityID.Pink; } } diff --git a/Items/Placeables/Furniture/WulfrumLureItem.cs b/Items/Placeables/Furniture/WulfrumLureItem.cs index 4d0318c02b..8f62916f19 100644 --- a/Items/Placeables/Furniture/WulfrumLureItem.cs +++ b/Items/Placeables/Furniture/WulfrumLureItem.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Placeables.Furniture { CreateRecipe(). AddIngredient(5). - AddIngredient(). + AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Placeables/Furniture/ZenithThrone.cs b/Items/Placeables/Furniture/ZenithThrone.cs index 4f09cfeb9d..cd98471793 100644 --- a/Items/Placeables/Furniture/ZenithThrone.cs +++ b/Items/Placeables/Furniture/ZenithThrone.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Placeables.Furniture { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 10); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Placeables/Abyss/Acidwood.cs b/Items/Placeables/FurnitureAcidwood/Acidwood.cs similarity index 92% rename from Items/Placeables/Abyss/Acidwood.cs rename to Items/Placeables/FurnitureAcidwood/Acidwood.cs index 629a1cdfe9..64399f45f5 100644 --- a/Items/Placeables/Abyss/Acidwood.cs +++ b/Items/Placeables/FurnitureAcidwood/Acidwood.cs @@ -3,8 +3,9 @@ using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Abyss; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Tiles.FurnitureAcidwood; -namespace CalamityMod.Items.Placeables.Abyss +namespace CalamityMod.Items.Placeables.FurnitureAcidwood { public class Acidwood : ModItem, ILocalizedModType { diff --git a/Items/Placeables/Abyss/Acidwood.png b/Items/Placeables/FurnitureAcidwood/Acidwood.png similarity index 100% rename from Items/Placeables/Abyss/Acidwood.png rename to Items/Placeables/FurnitureAcidwood/Acidwood.png diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs b/Items/Placeables/FurnitureAncient/AncientAltar.cs similarity index 66% rename from Items/Placeables/Furniture/CraftingStations/AncientAltar.cs rename to Items/Placeables/FurnitureAncient/AncientAltar.cs index 5af066ec73..0a34f22f7e 100644 --- a/Items/Placeables/Furniture/CraftingStations/AncientAltar.cs +++ b/Items/Placeables/FurnitureAncient/AncientAltar.cs @@ -4,28 +4,23 @@ using CalamityMod.Items.Placeables.Ores; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureAncient { public class AncientAltar : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 2); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(10). AddIngredient(5). - AddTile(TileID.Anvils). + AddTile(ModContent.TileType()). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/AncientAltar.png b/Items/Placeables/FurnitureAncient/AncientAltar.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/AncientAltar.png rename to Items/Placeables/FurnitureAncient/AncientAltar.png diff --git a/Items/Placeables/FurnitureAncient/AncientBasin.cs b/Items/Placeables/FurnitureAncient/AncientBasin.cs index 13ce692fbb..ec7caa55c0 100644 --- a/Items/Placeables/FurnitureAncient/AncientBasin.cs +++ b/Items/Placeables/FurnitureAncient/AncientBasin.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(10). AddIngredient(5). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientBathtub.cs b/Items/Placeables/FurnitureAncient/AncientBathtub.cs index 6e4f0a4bf1..c95fa1da0e 100644 --- a/Items/Placeables/FurnitureAncient/AncientBathtub.cs +++ b/Items/Placeables/FurnitureAncient/AncientBathtub.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientBed.cs b/Items/Placeables/FurnitureAncient/AncientBed.cs index 09a2cc6c59..91b7f8f97f 100644 --- a/Items/Placeables/FurnitureAncient/AncientBed.cs +++ b/Items/Placeables/FurnitureAncient/AncientBed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientBookcase.cs b/Items/Placeables/FurnitureAncient/AncientBookcase.cs index ff4c9d256c..f68aa1ae4e 100644 --- a/Items/Placeables/FurnitureAncient/AncientBookcase.cs +++ b/Items/Placeables/FurnitureAncient/AncientBookcase.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientChair.cs b/Items/Placeables/FurnitureAncient/AncientChair.cs index 2d72d10df0..69328c6969 100644 --- a/Items/Placeables/FurnitureAncient/AncientChair.cs +++ b/Items/Placeables/FurnitureAncient/AncientChair.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientChandelier.cs b/Items/Placeables/FurnitureAncient/AncientChandelier.cs index 8868fe6ff2..3c603f551d 100644 --- a/Items/Placeables/FurnitureAncient/AncientChandelier.cs +++ b/Items/Placeables/FurnitureAncient/AncientChandelier.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientDoor.cs b/Items/Placeables/FurnitureAncient/AncientDoor.cs index 6182a586f9..0ae58a1326 100644 --- a/Items/Placeables/FurnitureAncient/AncientDoor.cs +++ b/Items/Placeables/FurnitureAncient/AncientDoor.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientDresser.cs b/Items/Placeables/FurnitureAncient/AncientDresser.cs index 7724410586..62b6fc0f83 100644 --- a/Items/Placeables/FurnitureAncient/AncientDresser.cs +++ b/Items/Placeables/FurnitureAncient/AncientDresser.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientLamp.cs b/Items/Placeables/FurnitureAncient/AncientLamp.cs index ae71b05abc..9f61fda5fe 100644 --- a/Items/Placeables/FurnitureAncient/AncientLamp.cs +++ b/Items/Placeables/FurnitureAncient/AncientLamp.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientLantern.cs b/Items/Placeables/FurnitureAncient/AncientLantern.cs index 6dc360c7b1..74bcc5acfc 100644 --- a/Items/Placeables/FurnitureAncient/AncientLantern.cs +++ b/Items/Placeables/FurnitureAncient/AncientLantern.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientMonolith.cs b/Items/Placeables/FurnitureAncient/AncientMonolith.cs index afa334c193..992edc8224 100644 --- a/Items/Placeables/FurnitureAncient/AncientMonolith.cs +++ b/Items/Placeables/FurnitureAncient/AncientMonolith.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs index 8b31f31ee6..24651e8b78 100644 --- a/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs +++ b/Items/Placeables/FurnitureAncient/AncientPipeOrgan.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientSink.cs b/Items/Placeables/FurnitureAncient/AncientSink.cs index 5c80b977c8..11d515986b 100644 --- a/Items/Placeables/FurnitureAncient/AncientSink.cs +++ b/Items/Placeables/FurnitureAncient/AncientSink.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.LavaBucket). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientSofa.cs b/Items/Placeables/FurnitureAncient/AncientSofa.cs index 3b3465f326..2cef2b30a7 100644 --- a/Items/Placeables/FurnitureAncient/AncientSofa.cs +++ b/Items/Placeables/FurnitureAncient/AncientSofa.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientTable.cs b/Items/Placeables/FurnitureAncient/AncientTable.cs index 84a5e49443..d8ec7df3dc 100644 --- a/Items/Placeables/FurnitureAncient/AncientTable.cs +++ b/Items/Placeables/FurnitureAncient/AncientTable.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs index feec1ee3dd..88f5dab85d 100644 --- a/Items/Placeables/FurnitureAncient/AncientWorkBench.cs +++ b/Items/Placeables/FurnitureAncient/AncientWorkBench.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAncient { CreateRecipe(). AddIngredient(10). - AddTile(). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureAuric/AuricToilet.cs b/Items/Placeables/FurnitureAuric/AuricToilet.cs index 9e2c3ef59f..c283d801d8 100644 --- a/Items/Placeables/FurnitureAuric/AuricToilet.cs +++ b/Items/Placeables/FurnitureAuric/AuricToilet.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureAuric { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 40); - Item.rare = ModContent.RarityType(); // Most special shitter gets most preferential treatment + Item.rare = ModContent.RarityType(); // Most special shitter gets most preferential treatment } public override void AddRecipes() diff --git a/Items/Placeables/FurnitureBasalt/BasaltSlab.cs b/Items/Placeables/FurnitureBasalt/BasaltSlab.cs new file mode 100644 index 0000000000..c8f4ee7ad8 --- /dev/null +++ b/Items/Placeables/FurnitureBasalt/BasaltSlab.cs @@ -0,0 +1,31 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureBasalt +{ + public class BasaltSlab : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(1). + AddTile(TileID.WorkBenches). + DisableDecraft(). + Register(); + } + + } +} diff --git a/Items/Placeables/FurnitureBasalt/BasaltSlab.png b/Items/Placeables/FurnitureBasalt/BasaltSlab.png new file mode 100644 index 0000000000..a40c5e3054 Binary files /dev/null and b/Items/Placeables/FurnitureBasalt/BasaltSlab.png differ diff --git a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs index 60c180e58a..5af97d2f14 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBathtub.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBed.cs b/Items/Placeables/FurnitureBotanic/BotanicBed.cs index 1acb0c3b02..6ca307fc30 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBed.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBench.cs b/Items/Placeables/FurnitureBotanic/BotanicBench.cs index 466cedef84..a4624d0dd3 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBench.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs index b648886bd6..90a4f6c43c 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicBookcase.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs index 0e6140697e..cd646f304d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandelabra.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs index 00abbcf2e1..b785331349 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicCandle.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicCandle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChair.cs b/Items/Placeables/FurnitureBotanic/BotanicChair.cs index b09dc4e440..d58cad346b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChair.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChair.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs index 136936f5d5..3fbb85558b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChandelier.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicChest.cs b/Items/Placeables/FurnitureBotanic/BotanicChest.cs index ea8c94157f..316f34fcc0 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicChest.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicChest.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicClock.cs b/Items/Placeables/FurnitureBotanic/BotanicClock.cs index 8687c3d0d0..b18deb8e2d 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicClock.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicClock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs index 2994122832..89e7e883c0 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDoor.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDoor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs index bae1342b7f..f924debd78 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicDresser.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicDresser.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs index e1721c14f0..91a283b051 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLamp.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs index 016f715296..81fe09456b 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicLantern.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicLantern.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs index bcb626d113..8f6496ee73 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicPiano.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPiano.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs similarity index 62% rename from Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs rename to Items/Placeables/FurnitureBotanic/BotanicPlanter.cs index bdaac5f684..c06b0e6e63 100644 --- a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicPlanter.cs @@ -1,28 +1,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureBotanic { public class BotanicPlanter : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 2); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.JungleSpores, 5). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png b/Items/Placeables/FurnitureBotanic/BotanicPlanter.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/BotanicPlanter.png rename to Items/Placeables/FurnitureBotanic/BotanicPlanter.png diff --git a/Items/Placeables/FurnitureBotanic/BotanicSink.cs b/Items/Placeables/FurnitureBotanic/BotanicSink.cs index 7b2d93382e..f7780421f6 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicSink.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicSink.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.HoneyBucket). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicTable.cs b/Items/Placeables/FurnitureBotanic/BotanicTable.cs index 72801307f6..a407f157fc 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicTable.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicTable.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs index 677b7876fc..6992bc754a 100644 --- a/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs +++ b/Items/Placeables/FurnitureBotanic/BotanicWorkBench.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureBotanic { CreateRecipe(). AddIngredient(10). - AddTile(). + AddTile(TileID.LivingLoom). Register(); } } diff --git a/Items/Placeables/SunkenSea/Driftwood.cs b/Items/Placeables/FurnitureDriftwood/Driftwood.cs similarity index 87% rename from Items/Placeables/SunkenSea/Driftwood.cs rename to Items/Placeables/FurnitureDriftwood/Driftwood.cs index d870b66fb5..0c707086a7 100644 --- a/Items/Placeables/SunkenSea/Driftwood.cs +++ b/Items/Placeables/FurnitureDriftwood/Driftwood.cs @@ -1,7 +1,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.SunkenSea +namespace CalamityMod.Items.Placeables.FurnitureDriftwood { public class Driftwood : ModItem, ILocalizedModType { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { diff --git a/Items/Placeables/SunkenSea/Driftwood.png b/Items/Placeables/FurnitureDriftwood/Driftwood.png similarity index 100% rename from Items/Placeables/SunkenSea/Driftwood.png rename to Items/Placeables/FurnitureDriftwood/Driftwood.png diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.cs new file mode 100644 index 0000000000..2db737545a --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.FurnitureDriftwood; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodBaroqueCello : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(ItemID.Silk, 4). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.png b/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.png new file mode 100644 index 0000000000..d212716b57 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodBaroqueCello.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.cs new file mode 100644 index 0000000000..42217ec36b --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodBathtub : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(14). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.png b/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.png new file mode 100644 index 0000000000..73c7b19ed4 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodBathtub.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBed.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodBed.cs new file mode 100644 index 0000000000..7f41e9909e --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodBed.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodBed : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(ItemID.Silk, 5). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBed.png b/Items/Placeables/FurnitureDriftwood/DriftwoodBed.png new file mode 100644 index 0000000000..39ef943058 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodBed.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.cs new file mode 100644 index 0000000000..0ceb8e9e25 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodBookcase : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(20). + AddIngredient(ItemID.Book, 10). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.png b/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.png new file mode 100644 index 0000000000..8014290409 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodBookcase.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.cs new file mode 100644 index 0000000000..c979a742d2 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodCandelabra : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.Torch, 3). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.png b/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.png new file mode 100644 index 0000000000..cf0798c369 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodCandelabra.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.cs new file mode 100644 index 0000000000..5d64ff15af --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodCandle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.png b/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.png new file mode 100644 index 0000000000..4bb35c5f2a Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodCandle.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChair.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodChair.cs new file mode 100644 index 0000000000..324b392b8d --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodChair.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodChair : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChair.png b/Items/Placeables/FurnitureDriftwood/DriftwoodChair.png new file mode 100644 index 0000000000..ec6e9bd9ee Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodChair.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.cs new file mode 100644 index 0000000000..67264739f7 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodChandelier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch, 4). + AddIngredient(ItemID.Chain). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.png b/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.png new file mode 100644 index 0000000000..59ca9bc75a Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodChandelier.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChest.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodChest.cs new file mode 100644 index 0000000000..09371eb58f --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodChest.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodChest : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddRecipeGroup("IronBar", 2). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodChest.png b/Items/Placeables/FurnitureDriftwood/DriftwoodChest.png new file mode 100644 index 0000000000..1d0b01e9f3 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodChest.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.cs new file mode 100644 index 0000000000..24a13ffa5d --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.FurnitureDriftwood; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodDoor : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.png b/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.png new file mode 100644 index 0000000000..ed03fbc288 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodDoor.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.cs new file mode 100644 index 0000000000..c0e4945091 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodDresser : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(16). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.png b/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.png new file mode 100644 index 0000000000..0e10813c48 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodDresser.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.cs new file mode 100644 index 0000000000..eb7ef97722 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodLamp : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Torch). + AddIngredient(3). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.png b/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.png new file mode 100644 index 0000000000..fdcf21b3c4 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodLamp.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.cs new file mode 100644 index 0000000000..bc42935b65 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodLantern : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.Torch). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.png b/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.png new file mode 100644 index 0000000000..952adc2cf2 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodLantern.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.cs new file mode 100644 index 0000000000..bebc858e99 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodPlatform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.png b/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.png new file mode 100644 index 0000000000..1bd785cc73 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodPlatform.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSink.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodSink.cs new file mode 100644 index 0000000000..4dd848f719 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodSink.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodSink : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.WaterBucket). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSink.png b/Items/Placeables/FurnitureDriftwood/DriftwoodSink.png new file mode 100644 index 0000000000..2ff5b161f6 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodSink.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.cs new file mode 100644 index 0000000000..f15523527f --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodSofa : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.Silk, 2). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.png b/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.png new file mode 100644 index 0000000000..77730724c1 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodSofa.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.cs new file mode 100644 index 0000000000..5de21becdc --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodSundial : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddRecipeGroup("IronBar", 3). + AddIngredient(ItemID.Glass, 6). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.png b/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.png new file mode 100644 index 0000000000..959cb779c9 Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodSundial.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodTable.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodTable.cs new file mode 100644 index 0000000000..49890c4505 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodTable.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodTable : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodTable.png b/Items/Placeables/FurnitureDriftwood/DriftwoodTable.png new file mode 100644 index 0000000000..a6db8a185b Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodTable.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.cs new file mode 100644 index 0000000000..5b5863386e --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodToilet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.png b/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.png new file mode 100644 index 0000000000..65321ca8fb Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodToilet.png differ diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.cs b/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.cs new file mode 100644 index 0000000000..d93e4a0817 --- /dev/null +++ b/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.cs @@ -0,0 +1,24 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureDriftwood +{ + public class DriftwoodWorkBench : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.png b/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.png new file mode 100644 index 0000000000..e8125c908e Binary files /dev/null and b/Items/Placeables/FurnitureDriftwood/DriftwoodWorkBench.png differ diff --git a/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs b/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs index c74ae9cd78..ca19d16f17 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBathtub.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite { CreateRecipe(). AddIngredient(4). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteBed.cs b/Items/Placeables/FurnitureMarnite/MarniteBed.cs index 75e39a9129..76bb5b7a42 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBed.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Silk, 5). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs b/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs index d86b858582..3ba23a6beb 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteBookcase.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Book, 10). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs b/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs index a7d2ebea32..2597db9c86 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteChandelier.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch, 4). - AddTile(TileID.WorkBenches). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteClock.cs b/Items/Placeables/FurnitureMarnite/MarniteClock.cs index 2a65849521..d2e93221e6 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteClock.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteClock.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite AddIngredient(4). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteDresser.cs b/Items/Placeables/FurnitureMarnite/MarniteDresser.cs index 7eee4ef299..eab9197ea6 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteDresser.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteDresser.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite { CreateRecipe(). AddIngredient(4). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs b/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs index d4e8f381f4..ad53340e47 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteOrgan.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite AddIngredient(1). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteSofa.cs b/Items/Placeables/FurnitureMarnite/MarniteSofa.cs index f754aaf8a8..999add1972 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteSofa.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteSofa.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Silk, 2). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteToilet.cs b/Items/Placeables/FurnitureMarnite/MarniteToilet.cs index 9d91fac578..02d6a94e66 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteToilet.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteToilet.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite { CreateRecipe(). AddIngredient(6). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs b/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs index 631e7ede23..fbe3a96370 100644 --- a/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs +++ b/Items/Placeables/FurnitureMarnite/MarniteWorkBench.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite { CreateRecipe(). AddIngredient(4). - AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs b/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs index 156984f82d..385e5b8f69 100644 --- a/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs +++ b/Items/Placeables/FurnitureMarnite/PolishedMarniteBlock.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMarnite public override void AddRecipes() { - CreateRecipe(). + CreateRecipe(4). AddIngredient(ItemID.Marble, 2). AddIngredient(ItemID.Granite, 2). AddRecipeGroup(RecipeSystem.AnyGoldOre, 1). diff --git a/Items/Placeables/Astral/AstralMonolith.cs b/Items/Placeables/FurnitureMonolith/AstralMonolith.cs similarity index 86% rename from Items/Placeables/Astral/AstralMonolith.cs rename to Items/Placeables/FurnitureMonolith/AstralMonolith.cs index df2a693ba4..58f088114a 100644 --- a/Items/Placeables/Astral/AstralMonolith.cs +++ b/Items/Placeables/FurnitureMonolith/AstralMonolith.cs @@ -1,9 +1,9 @@ -using CalamityMod.Items.Placeables.FurnitureMonolith; +using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Astral +namespace CalamityMod.Items.Placeables.FurnitureMonolith { public class AstralMonolith : ModItem, ILocalizedModType { @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Placeables.Astral ItemID.Sets.ShimmerTransformToItem[Type] = ItemID.Wood; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) { diff --git a/Items/Placeables/Astral/AstralMonolith.png b/Items/Placeables/FurnitureMonolith/AstralMonolith.png similarity index 100% rename from Items/Placeables/Astral/AstralMonolith.png rename to Items/Placeables/FurnitureMonolith/AstralMonolith.png diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs b/Items/Placeables/FurnitureMonolith/MonolithAmalgam.cs similarity index 63% rename from Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs rename to Items/Placeables/FurnitureMonolith/MonolithAmalgam.cs index 1f3116f9b6..daa3809586 100644 --- a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithAmalgam.cs @@ -2,7 +2,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureMonolith { [LegacyName("MonolithCrafting")] public class MonolithAmalgam : ModItem, ILocalizedModType @@ -10,20 +10,15 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 2); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(20). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.png b/Items/Placeables/FurnitureMonolith/MonolithAmalgam.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/MonolithAmalgam.png rename to Items/Placeables/FurnitureMonolith/MonolithAmalgam.png diff --git a/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs b/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs index 180e480867..4b8b1ddb7a 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBathtub.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithBed.cs b/Items/Placeables/FurnitureMonolith/MonolithBed.cs index 1d333de777..11a5b1b15a 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBed.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBed.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithBench.cs b/Items/Placeables/FurnitureMonolith/MonolithBench.cs index 8498b4de74..a0c78194b3 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBench.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs index c2c7c915d8..3f1c9b7a85 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithBookcase.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs index 70090c243b..873725f333 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithCandelabra.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithCandle.cs b/Items/Placeables/FurnitureMonolith/MonolithCandle.cs index f76318e634..3f829512f1 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithCandle.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithCandle.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithChair.cs b/Items/Placeables/FurnitureMonolith/MonolithChair.cs index 25bd448184..d786a4ab6f 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChair.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChair.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs index e3a72a15c7..71dbcc7ccf 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChandelier.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithChest.cs b/Items/Placeables/FurnitureMonolith/MonolithChest.cs index 6192e86422..6b44623b5b 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithChest.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithChest.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithClock.cs b/Items/Placeables/FurnitureMonolith/MonolithClock.cs index 8878384da9..a45174c2c7 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithClock.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithClock.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs index 0f01131333..08cdd65ea1 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDoor.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDoor.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs index 1c1d788560..f77e09789d 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithDresser.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithDresser.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs index 2b9635cdad..d315b40511 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLamp.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLamp.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs index 63692653c1..5c0685f57f 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithLantern.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithLantern.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs index 2c6238a177..91af9b49fe 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithPiano.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithPiano.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithSink.cs b/Items/Placeables/FurnitureMonolith/MonolithSink.cs index 65f6164663..a6f2f4b910 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithSink.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithSink.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithTable.cs b/Items/Placeables/FurnitureMonolith/MonolithTable.cs index af80d2f04d..8aa8eab032 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithTable.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithTable.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs index 7aab4573e8..a63ece403f 100644 --- a/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs +++ b/Items/Placeables/FurnitureMonolith/MonolithWorkBench.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Items.Placeables.FurnitureMonolith { CreateRecipe(). AddIngredient(10). - AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs new file mode 100644 index 0000000000..f513a1a114 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBathtub")] + public class AncientNavystoneBathtub : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(14). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicBathtub.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs new file mode 100644 index 0000000000..066f41bce1 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBed")] + public class AncientNavystoneBed : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(ItemID.Silk, 5). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicBed.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs new file mode 100644 index 0000000000..1070db8bd9 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBench")] + public class AncientNavystoneBench : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicBench.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs new file mode 100644 index 0000000000..6433472084 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBookcase")] + public class AncientNavystoneBookcase : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(20). + AddIngredient(ItemID.Book, 10). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicBookcase.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs new file mode 100644 index 0000000000..186efab3fc --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicCandelabra")] + public class AncientNavystoneCandelabra : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 3); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.Torch, 3). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs new file mode 100644 index 0000000000..a403118f45 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicCandle")] + public class AncientNavystoneCandle : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicCandle.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs new file mode 100644 index 0000000000..d560526fbf --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChair")] + public class AncientNavystoneChair : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicChair.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs new file mode 100644 index 0000000000..c68d8a9923 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChandelier")] + public class AncientNavystoneChandelier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch, 4). + AddIngredient(ItemID.Chain). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicChandelier.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs new file mode 100644 index 0000000000..b2dd187125 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChest")] + public class AncientNavystoneChest : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddRecipeGroup("IronBar", 2). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicChest.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs new file mode 100644 index 0000000000..a3877aca24 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicClock")] + public class AncientNavystoneClock : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddRecipeGroup("IronBar", 3). + AddIngredient(ItemID.Glass, 6). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicClock.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoor.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoor.cs new file mode 100644 index 0000000000..ed3d9c9052 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoor.cs @@ -0,0 +1,29 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using CalamityMod.Tiles.FurnitureNavystone; +using CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicDoor")] + public class AncientNavystoneDoor : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoor.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicDoor.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoor.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs new file mode 100644 index 0000000000..d24b1ec83c --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicDresser")] + public class AncientNavystoneDresser : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(16). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicDresser.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs new file mode 100644 index 0000000000..32ffdfabe8 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicLamp")] + public class AncientNavystoneLamp : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(3). + AddIngredient(ItemID.Torch). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicLamp.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs new file mode 100644 index 0000000000..4a5de1d91b --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicLantern")] + public class AncientNavystoneLantern : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.Torch). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicLantern.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs new file mode 100644 index 0000000000..baf2ee4181 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs @@ -0,0 +1,28 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicPiano")] + public class AncientNavystonePiano : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(ItemID.Bone, 4). + AddIngredient(ItemID.Book). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicPiano.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs new file mode 100644 index 0000000000..5508dbcad0 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicPlatform")] + public class AncientNavystonePlatform : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + public override void AddRecipes() + { + CreateRecipe(2). + AddIngredient(). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicPlatform.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs new file mode 100644 index 0000000000..142c3deb30 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicSink")] + public class AncientNavystoneSink : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.WaterBucket). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicSink.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs new file mode 100644 index 0000000000..0ec2790536 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicTable")] + public class AncientNavystoneTable : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.WorkBenches). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicTable.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.png diff --git a/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs new file mode 100644 index 0000000000..622b46f7c0 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicWorkBench")] + public class AncientNavystoneWorkBench : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.png diff --git a/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs similarity index 78% rename from Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs index 5fe203a28e..ef6ec61025 100644 --- a/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.cs +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs @@ -2,7 +2,7 @@ using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone { public class AncientSmoothNavystone : ModItem, ILocalizedModType { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic Item.ResearchUnlockCount = 100; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); /*public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/AncientSmoothNavystone.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.png diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs similarity index 66% rename from Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs index b403fe488c..bb40af0be1 100644 --- a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone { [LegacyName("EutrophicCrafting")] public class EutrophicShelf : ModItem, ILocalizedModType @@ -12,23 +12,18 @@ namespace CalamityMod.Items.Placeables.Furniture.CraftingStations public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 50); // This is too easy to craft to sell for 2 gold } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(10). AddIngredient(5). AddIngredient(5). AddIngredient(3). - AddTile(TileID.WorkBenches). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png b/Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/EutrophicShelf.png rename to Items/Placeables/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.png diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs b/Items/Placeables/FurnitureNavystone/NavystoneBathtub.cs similarity index 68% rename from Items/Placeables/FurnitureEutrophic/EutrophicTable.cs rename to Items/Placeables/FurnitureNavystone/NavystoneBathtub.cs index e615b230a4..3bea3df35d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicTable.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneBathtub.cs @@ -4,22 +4,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicTable : ModItem, ILocalizedModType + public class NavystoneBathtub : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddTile(). + AddIngredient(14). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneBathtub.png b/Items/Placeables/FurnitureNavystone/NavystoneBathtub.png new file mode 100644 index 0000000000..d096c1edb4 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneBathtub.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs b/Items/Placeables/FurnitureNavystone/NavystoneBed.cs similarity index 70% rename from Items/Placeables/FurnitureEutrophic/EutrophicBed.cs rename to Items/Placeables/FurnitureNavystone/NavystoneBed.cs index dd9074f28f..0331f11379 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBed.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneBed.cs @@ -3,23 +3,23 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicBed : ModItem, ILocalizedModType + public class NavystoneBed : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 4); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneBed.png b/Items/Placeables/FurnitureNavystone/NavystoneBed.png new file mode 100644 index 0000000000..6336a84e7d Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneBed.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs b/Items/Placeables/FurnitureNavystone/NavystoneBookcase.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs rename to Items/Placeables/FurnitureNavystone/NavystoneBookcase.cs index 6ad2fb84a5..c15d2e9602 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneBookcase.cs @@ -3,23 +3,23 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicBookcase : ModItem, ILocalizedModType + public class NavystoneBookcase : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(20). + AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneBookcase.png b/Items/Placeables/FurnitureNavystone/NavystoneBookcase.png new file mode 100644 index 0000000000..29cde351e8 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneBookcase.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs b/Items/Placeables/FurnitureNavystone/NavystoneCandelabra.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs rename to Items/Placeables/FurnitureNavystone/NavystoneCandelabra.cs index 8351687fae..0d7400ce54 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneCandelabra.cs @@ -4,23 +4,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicCandelabra : ModItem, ILocalizedModType + public class NavystoneCandelabra : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 3); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneCandelabra.png b/Items/Placeables/FurnitureNavystone/NavystoneCandelabra.png new file mode 100644 index 0000000000..f238bbc491 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneCandelabra.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs b/Items/Placeables/FurnitureNavystone/NavystoneCandle.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs rename to Items/Placeables/FurnitureNavystone/NavystoneCandle.cs index e159fc7cfc..7dfdee5c2b 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicCandle.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneCandle.cs @@ -4,23 +4,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicCandle : ModItem, ILocalizedModType + public class NavystoneCandle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneCandle.png b/Items/Placeables/FurnitureNavystone/NavystoneCandle.png new file mode 100644 index 0000000000..3bbac4d65c Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneCandle.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs b/Items/Placeables/FurnitureNavystone/NavystoneChair.cs similarity index 68% rename from Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs rename to Items/Placeables/FurnitureNavystone/NavystoneChair.cs index 74c10dc6db..6ed1c890cb 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneChair.cs @@ -4,22 +4,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicWorkBench : ModItem, ILocalizedModType + public class NavystoneChair : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). - AddTile(). + AddIngredient(4). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneChair.png b/Items/Placeables/FurnitureNavystone/NavystoneChair.png new file mode 100644 index 0000000000..bfb86147f9 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneChair.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs b/Items/Placeables/FurnitureNavystone/NavystoneChandelier.cs similarity index 71% rename from Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs rename to Items/Placeables/FurnitureNavystone/NavystoneChandelier.cs index ab029ab282..4c3527eea0 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneChandelier.cs @@ -4,24 +4,24 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicChandelier : ModItem, ILocalizedModType + public class NavystoneChandelier : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.Anvils). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneChandelier.png b/Items/Placeables/FurnitureNavystone/NavystoneChandelier.png new file mode 100644 index 0000000000..e62c1e7c0e Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneChandelier.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs b/Items/Placeables/FurnitureNavystone/NavystoneChest.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicChest.cs rename to Items/Placeables/FurnitureNavystone/NavystoneChest.cs index eb9f034571..5473c4adfd 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChest.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneChest.cs @@ -4,23 +4,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicChest : ModItem, ILocalizedModType + public class NavystoneChest : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneChest.png b/Items/Placeables/FurnitureNavystone/NavystoneChest.png new file mode 100644 index 0000000000..3628fc230d Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneChest.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs b/Items/Placeables/FurnitureNavystone/NavystoneClock.cs similarity index 71% rename from Items/Placeables/FurnitureEutrophic/EutrophicClock.cs rename to Items/Placeables/FurnitureNavystone/NavystoneClock.cs index 30bc7622c0..b2e6d917db 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicClock.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneClock.cs @@ -4,24 +4,24 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicClock : ModItem, ILocalizedModType + public class NavystoneClock : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(10). + AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneClock.png b/Items/Placeables/FurnitureNavystone/NavystoneClock.png new file mode 100644 index 0000000000..ccd6909fe6 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneClock.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs b/Items/Placeables/FurnitureNavystone/NavystoneDoor.cs similarity index 58% rename from Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs rename to Items/Placeables/FurnitureNavystone/NavystoneDoor.cs index 12b9a49e24..33bd862c0a 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDoor.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneDoor.cs @@ -1,26 +1,26 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Tiles.Furniture.CraftingStations; -using CalamityMod.Tiles.FurnitureEutrophic; +using CalamityMod.Tiles.FurnitureNavystone; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicDoor : ModItem, ILocalizedModType + public class NavystoneDoor : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 40); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). - AddTile(). + AddIngredient(6). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneDoor.png b/Items/Placeables/FurnitureNavystone/NavystoneDoor.png new file mode 100644 index 0000000000..3aeeedfb40 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneDoor.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs b/Items/Placeables/FurnitureNavystone/NavystoneDresser.cs similarity index 68% rename from Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs rename to Items/Placeables/FurnitureNavystone/NavystoneDresser.cs index cc508f17c8..da81b3c8ef 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicDresser.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneDresser.cs @@ -4,22 +4,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicDresser : ModItem, ILocalizedModType + public class NavystoneDresser : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(16). - AddTile(). + AddIngredient(16). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneDresser.png b/Items/Placeables/FurnitureNavystone/NavystoneDresser.png new file mode 100644 index 0000000000..24ed7def97 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneDresser.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs b/Items/Placeables/FurnitureNavystone/NavystoneLamp.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs rename to Items/Placeables/FurnitureNavystone/NavystoneLamp.cs index 7b366fb21a..0377f93cc4 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLamp.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneLamp.cs @@ -4,23 +4,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicLamp : ModItem, ILocalizedModType + public class NavystoneLamp : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 1); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(3). + AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneLamp.png b/Items/Placeables/FurnitureNavystone/NavystoneLamp.png new file mode 100644 index 0000000000..a058c3e769 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneLamp.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs b/Items/Placeables/FurnitureNavystone/NavystoneLantern.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs rename to Items/Placeables/FurnitureNavystone/NavystoneLantern.cs index 04a0ff5d2c..f7db6dde5d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicLantern.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneLantern.cs @@ -4,23 +4,23 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicLantern : ModItem, ILocalizedModType + public class NavystoneLantern : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneLantern.png b/Items/Placeables/FurnitureNavystone/NavystoneLantern.png new file mode 100644 index 0000000000..a88ffc2099 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneLantern.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs b/Items/Placeables/FurnitureNavystone/NavystoneLyre.cs similarity index 71% rename from Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs rename to Items/Placeables/FurnitureNavystone/NavystoneLyre.cs index 40ef588135..fcc0a58f28 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPiano.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneLyre.cs @@ -3,24 +3,24 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicPiano : ModItem, ILocalizedModType + public class NavystoneLyre : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(15). + AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneLyre.png b/Items/Placeables/FurnitureNavystone/NavystoneLyre.png new file mode 100644 index 0000000000..1dc721d732 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneLyre.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs b/Items/Placeables/FurnitureNavystone/NavystonePlatform.cs similarity index 69% rename from Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs rename to Items/Placeables/FurnitureNavystone/NavystonePlatform.cs index f1ccad62a8..c603d7bbd0 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Items/Placeables/FurnitureNavystone/NavystonePlatform.cs @@ -3,9 +3,9 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicPlatform : ModItem, ILocalizedModType + public class NavystonePlatform : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() @@ -13,12 +13,12 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic Item.ResearchUnlockCount = 200; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { CreateRecipe(2). - AddIngredient(). + AddIngredient(). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystonePlatform.png b/Items/Placeables/FurnitureNavystone/NavystonePlatform.png new file mode 100644 index 0000000000..926737cb55 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystonePlatform.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs b/Items/Placeables/FurnitureNavystone/NavystoneSink.cs similarity index 70% rename from Items/Placeables/FurnitureEutrophic/EutrophicSink.cs rename to Items/Placeables/FurnitureNavystone/NavystoneSink.cs index 9eab014730..eea8e0073d 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicSink.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneSink.cs @@ -3,23 +3,23 @@ using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicSink : ModItem, ILocalizedModType + public class NavystoneSink : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(6). + AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneSink.png b/Items/Placeables/FurnitureNavystone/NavystoneSink.png new file mode 100644 index 0000000000..dc2dbdd522 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneSink.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs b/Items/Placeables/FurnitureNavystone/NavystoneTable.cs similarity index 68% rename from Items/Placeables/FurnitureEutrophic/EutrophicBench.cs rename to Items/Placeables/FurnitureNavystone/NavystoneTable.cs index 20f4da4428..009034c1dd 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBench.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneTable.cs @@ -4,22 +4,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicBench : ModItem, ILocalizedModType + public class NavystoneTable : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). - AddTile(). + AddIngredient(8). + AddTile(TileID.WorkBenches). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneTable.png b/Items/Placeables/FurnitureNavystone/NavystoneTable.png new file mode 100644 index 0000000000..4dd36e89c9 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneTable.png differ diff --git a/Items/Placeables/FurnitureNavystone/NavystoneToilet.cs b/Items/Placeables/FurnitureNavystone/NavystoneToilet.cs new file mode 100644 index 0000000000..2a06c94973 --- /dev/null +++ b/Items/Placeables/FurnitureNavystone/NavystoneToilet.cs @@ -0,0 +1,26 @@ +using CalamityMod.Tiles.FurnitureNavystone; +using CalamityMod.Tiles.SunkenSea; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureNavystone +{ + public class NavystoneToilet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddTile(TileID.Sawmill). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureNavystone/NavystoneToilet.png b/Items/Placeables/FurnitureNavystone/NavystoneToilet.png new file mode 100644 index 0000000000..1ab7abf58e Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneToilet.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs b/Items/Placeables/FurnitureNavystone/NavystoneTriclinium.cs similarity index 67% rename from Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs rename to Items/Placeables/FurnitureNavystone/NavystoneTriclinium.cs index 657e022d09..ce3b0b199f 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneTriclinium.cs @@ -4,22 +4,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicBathtub : ModItem, ILocalizedModType + public class NavystoneTriclinium : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 60); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(14). - AddTile(). + AddIngredient(8). + AddTile(TileID.Sawmill). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneTriclinium.png b/Items/Placeables/FurnitureNavystone/NavystoneTriclinium.png new file mode 100644 index 0000000000..b760662708 Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneTriclinium.png differ diff --git a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs b/Items/Placeables/FurnitureNavystone/NavystoneWorkBench.cs similarity index 68% rename from Items/Placeables/FurnitureEutrophic/EutrophicChair.cs rename to Items/Placeables/FurnitureNavystone/NavystoneWorkBench.cs index 6d0b102069..4979e521b3 100644 --- a/Items/Placeables/FurnitureEutrophic/EutrophicChair.cs +++ b/Items/Placeables/FurnitureNavystone/NavystoneWorkBench.cs @@ -4,22 +4,21 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { - public class EutrophicChair : ModItem, ILocalizedModType + public class NavystoneWorkBench : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(copper: 30); } public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). - AddTile(). + AddIngredient(10). Register(); } } diff --git a/Items/Placeables/FurnitureNavystone/NavystoneWorkBench.png b/Items/Placeables/FurnitureNavystone/NavystoneWorkBench.png new file mode 100644 index 0000000000..6e12e7b36a Binary files /dev/null and b/Items/Placeables/FurnitureNavystone/NavystoneWorkBench.png differ diff --git a/Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs b/Items/Placeables/FurnitureNavystone/PolishedNavystoneBrick.cs similarity index 75% rename from Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs rename to Items/Placeables/FurnitureNavystone/PolishedNavystoneBrick.cs index e0aa52e928..e78073a46b 100644 --- a/Items/Placeables/SunkenSea/PolishedNavystoneBrick.cs +++ b/Items/Placeables/FurnitureNavystone/PolishedNavystoneBrick.cs @@ -1,7 +1,8 @@ using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Placeables.SunkenSea; -namespace CalamityMod.Items.Placeables.SunkenSea +namespace CalamityMod.Items.Placeables.FurnitureNavystone { public class PolishedNavystoneBrick : ModItem, ILocalizedModType { @@ -11,7 +12,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ResearchUnlockCount = 100; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/SunkenSea/PolishedNavystoneBrick.png b/Items/Placeables/FurnitureNavystone/PolishedNavystoneBrick.png similarity index 100% rename from Items/Placeables/SunkenSea/PolishedNavystoneBrick.png rename to Items/Placeables/FurnitureNavystone/PolishedNavystoneBrick.png diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs b/Items/Placeables/FurnitureNavystone/SmoothNavystone.cs similarity index 82% rename from Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs rename to Items/Placeables/FurnitureNavystone/SmoothNavystone.cs index 19a4f66101..737345d1a8 100644 --- a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.cs +++ b/Items/Placeables/FurnitureNavystone/SmoothNavystone.cs @@ -1,9 +1,10 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Placeables.Walls; +using CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.FurnitureEutrophic +namespace CalamityMod.Items.Placeables.FurnitureNavystone { public class SmoothNavystone : ModItem, ILocalizedModType { @@ -14,7 +15,7 @@ namespace CalamityMod.Items.Placeables.FurnitureEutrophic ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/FurnitureEutrophic/SmoothNavystone.png b/Items/Placeables/FurnitureNavystone/SmoothNavystone.png similarity index 100% rename from Items/Placeables/FurnitureEutrophic/SmoothNavystone.png rename to Items/Placeables/FurnitureNavystone/SmoothNavystone.png diff --git a/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.cs b/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.cs new file mode 100644 index 0000000000..31ae7192a0 --- /dev/null +++ b/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Walls; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureRunestone +{ + public class RunestoneTerracotta : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 200; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + //public override void AddRecipes() + //{ + // CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + //} + + } +} diff --git a/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.png b/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.png new file mode 100644 index 0000000000..32329b4f68 Binary files /dev/null and b/Items/Placeables/FurnitureRunestone/RunestoneTerracotta.png differ diff --git a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs index 5e31836e98..48187c6da2 100644 --- a/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs +++ b/Items/Placeables/FurnitureSacrilegious/MonolithOfTheAccursed.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSacrilegious { Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.accessory = true; Item.vanity = true; } diff --git a/Items/Placeables/FurnitureShellstone/ShellTrimBrick.cs b/Items/Placeables/FurnitureShellstone/ShellTrimBrick.cs new file mode 100644 index 0000000000..b891c8dce0 --- /dev/null +++ b/Items/Placeables/FurnitureShellstone/ShellTrimBrick.cs @@ -0,0 +1,30 @@ +using CalamityMod.Items.Placeables.Walls; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Items.Placeables.SunkenSea; +namespace CalamityMod.Items.Placeables.FurnitureShellstone +{ + public class ShellTrimBrick : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + //public override void AddRecipes() + //{ + // CreateRecipe(). + // AddIngredient(). + // AddTile(TileID.HeavyWorkBench). + // Register(); + // CreateRecipe(). + // AddIngredient(4). + // AddTile(TileID.WorkBenches). + // DisableDecraft(). + // Register(); + //} + } +} diff --git a/Items/Placeables/FurnitureShellstone/ShellTrimBrick.png b/Items/Placeables/FurnitureShellstone/ShellTrimBrick.png new file mode 100644 index 0000000000..532dc11562 Binary files /dev/null and b/Items/Placeables/FurnitureShellstone/ShellTrimBrick.png differ diff --git a/Items/Placeables/SunkenSea/ShellstoneSlab.cs b/Items/Placeables/FurnitureShellstone/ShellstoneSlab.cs similarity index 81% rename from Items/Placeables/SunkenSea/ShellstoneSlab.cs rename to Items/Placeables/FurnitureShellstone/ShellstoneSlab.cs index 2e3be721f4..294482fc1d 100644 --- a/Items/Placeables/SunkenSea/ShellstoneSlab.cs +++ b/Items/Placeables/FurnitureShellstone/ShellstoneSlab.cs @@ -1,8 +1,8 @@ using CalamityMod.Items.Placeables.Walls; using Terraria.ID; using Terraria.ModLoader; - -namespace CalamityMod.Items.Placeables.SunkenSea +using CalamityMod.Items.Placeables.SunkenSea; +namespace CalamityMod.Items.Placeables.FurnitureShellstone { public class ShellstoneSlab : ModItem, ILocalizedModType { @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ResearchUnlockCount = 100; } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); public override void AddRecipes() { diff --git a/Items/Placeables/SunkenSea/ShellstoneSlab.png b/Items/Placeables/FurnitureShellstone/ShellstoneSlab.png similarity index 100% rename from Items/Placeables/SunkenSea/ShellstoneSlab.png rename to Items/Placeables/FurnitureShellstone/ShellstoneSlab.png diff --git a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs b/Items/Placeables/FurnitureSilva/SilvaBasin.cs similarity index 56% rename from Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs rename to Items/Placeables/FurnitureSilva/SilvaBasin.cs index 38cd253bdc..73033cc0da 100644 --- a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBasin.cs @@ -3,29 +3,24 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureSilva { - [LegacyName("SilvaBasin")] - public class EffulgentManipulator : ModItem, ILocalizedModType + [LegacyName("EffulgentManipulator")] + public class SilvaBasin : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 2); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(10). AddRecipeGroup("AnyGoldBar", 5). - AddTile(TileID.MythrilAnvil). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.png b/Items/Placeables/FurnitureSilva/SilvaBasin.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/EffulgentManipulator.png rename to Items/Placeables/FurnitureSilva/SilvaBasin.png diff --git a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs index 1334cde423..6491d8e879 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBathtub.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBathtub.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBed.cs b/Items/Placeables/FurnitureSilva/SilvaBed.cs index 3d0c73f109..00230ac8b1 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBed.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBench.cs b/Items/Placeables/FurnitureSilva/SilvaBench.cs index 333fed0272..afff559458 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBench.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs index f036b18c6e..c240d76956 100644 --- a/Items/Placeables/FurnitureSilva/SilvaBookcase.cs +++ b/Items/Placeables/FurnitureSilva/SilvaBookcase.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs index 92ae20f92e..9305522a77 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandelabra.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaCandle.cs b/Items/Placeables/FurnitureSilva/SilvaCandle.cs index b5bedb72c0..ea0f420147 100644 --- a/Items/Placeables/FurnitureSilva/SilvaCandle.cs +++ b/Items/Placeables/FurnitureSilva/SilvaCandle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChair.cs b/Items/Placeables/FurnitureSilva/SilvaChair.cs index 276ece5d5b..0199580bd9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChair.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChair.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs index a10990fdd0..68578c6cd4 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChandelier.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChandelier.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaChest.cs b/Items/Placeables/FurnitureSilva/SilvaChest.cs index dc123f5db8..ad89ca7ca9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaChest.cs +++ b/Items/Placeables/FurnitureSilva/SilvaChest.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaClock.cs b/Items/Placeables/FurnitureSilva/SilvaClock.cs index f4afb5cf0e..009882961a 100644 --- a/Items/Placeables/FurnitureSilva/SilvaClock.cs +++ b/Items/Placeables/FurnitureSilva/SilvaClock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDoor.cs b/Items/Placeables/FurnitureSilva/SilvaDoor.cs index 703348131f..7239023ff4 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDoor.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDoor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaDresser.cs b/Items/Placeables/FurnitureSilva/SilvaDresser.cs index 7f149b01f1..e23238bb9e 100644 --- a/Items/Placeables/FurnitureSilva/SilvaDresser.cs +++ b/Items/Placeables/FurnitureSilva/SilvaDresser.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLamp.cs b/Items/Placeables/FurnitureSilva/SilvaLamp.cs index 336d5e4d8e..1c344ab103 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLamp.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaLantern.cs b/Items/Placeables/FurnitureSilva/SilvaLantern.cs index bcd188b58c..a2f716f2e9 100644 --- a/Items/Placeables/FurnitureSilva/SilvaLantern.cs +++ b/Items/Placeables/FurnitureSilva/SilvaLantern.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaPiano.cs b/Items/Placeables/FurnitureSilva/SilvaPiano.cs index 619ac5cdc8..19c0df3650 100644 --- a/Items/Placeables/FurnitureSilva/SilvaPiano.cs +++ b/Items/Placeables/FurnitureSilva/SilvaPiano.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaSink.cs b/Items/Placeables/FurnitureSilva/SilvaSink.cs index 56e6f60507..dd76733ba0 100644 --- a/Items/Placeables/FurnitureSilva/SilvaSink.cs +++ b/Items/Placeables/FurnitureSilva/SilvaSink.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaTable.cs b/Items/Placeables/FurnitureSilva/SilvaTable.cs index 8b0175b74c..16cdb6305c 100644 --- a/Items/Placeables/FurnitureSilva/SilvaTable.cs +++ b/Items/Placeables/FurnitureSilva/SilvaTable.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs index 4311048e5d..c9494cc42b 100644 --- a/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs +++ b/Items/Placeables/FurnitureSilva/SilvaWorkBench.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureSilva { CreateRecipe(). AddIngredient(10). - AddTile(). + AddTile(TileID.GlassKiln). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs similarity index 54% rename from Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs rename to Items/Placeables/FurnitureStatigel/StaticRefiner.cs index 105adef50b..cd4fdb2820 100644 --- a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.cs +++ b/Items/Placeables/FurnitureStatigel/StaticRefiner.cs @@ -2,28 +2,22 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureStatigel { public class StaticRefiner : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(gold: 2); } - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.Solidifier). - AddIngredient(5). - AddTile(TileID.Anvils). + AddIngredient(10). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/StaticRefiner.png b/Items/Placeables/FurnitureStatigel/StaticRefiner.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/StaticRefiner.png rename to Items/Placeables/FurnitureStatigel/StaticRefiner.png diff --git a/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs b/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs index 3f7fc58b21..dd9ee9988c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBathtub.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBed.cs b/Items/Placeables/FurnitureStatigel/StatigelBed.cs index cafa39bbcf..694148e826 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBed.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs index d28fcccc64..db4e3aa915 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBlock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBlock.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(25). AddIngredient(). - AddTile(). + AddTile(TileID.Solidifier). Register(); CreateRecipe(). AddIngredient(2). diff --git a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs index 148c98fbc4..35aaf72798 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelBookcase.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs index 4cab592c8a..69323827ba 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandelabra.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs index 2b615e086a..01c803ce2b 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelCandle.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelCandle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChair.cs b/Items/Placeables/FurnitureStatigel/StatigelChair.cs index 5a67a9131a..5ac443729f 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChair.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChair.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs index 08014dcb98..65bebcb6af 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChandelier.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelChest.cs b/Items/Placeables/FurnitureStatigel/StatigelChest.cs index 751521bc2a..14f8706915 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelChest.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelChest.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelClock.cs b/Items/Placeables/FurnitureStatigel/StatigelClock.cs index a3ad4e7f12..ae974e9446 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelClock.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelClock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs index 583efa5451..6de286fc7d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDoor.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDoor.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs index 59b759b84c..0084913f3c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelDresser.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelDresser.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs index 01f6b7453c..ac7a37385d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLamp.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs index 8eea59ba86..572a4959fb 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelLantern.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelLantern.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs index 05b1cd26fd..3d3eee379c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelPiano.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelPiano.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSink.cs b/Items/Placeables/FurnitureStatigel/StatigelSink.cs index 4f62ce1aca..bdb43753e5 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSink.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSink.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs index 15e53c4ebc..3ba339302c 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelSofa.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelSofa.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelTable.cs b/Items/Placeables/FurnitureStatigel/StatigelTable.cs index db940dd1d7..2f7980c52d 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelTable.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelTable.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs b/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs index e284ee43ed..0f45927793 100644 --- a/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs +++ b/Items/Placeables/FurnitureStatigel/StatigelWorkBench.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStatigel { CreateRecipe(). AddIngredient(10). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBathtub.cs b/Items/Placeables/FurnitureStratus/StratusBathtub.cs index ff810e5010..db3b5797b5 100644 --- a/Items/Placeables/FurnitureStratus/StratusBathtub.cs +++ b/Items/Placeables/FurnitureStratus/StratusBathtub.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(14). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBed.cs b/Items/Placeables/FurnitureStratus/StratusBed.cs index 65c93798ec..3a23cd3b1e 100644 --- a/Items/Placeables/FurnitureStratus/StratusBed.cs +++ b/Items/Placeables/FurnitureStratus/StratusBed.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBookcase.cs b/Items/Placeables/FurnitureStratus/StratusBookcase.cs index ac1226a1f8..63064b76b9 100644 --- a/Items/Placeables/FurnitureStratus/StratusBookcase.cs +++ b/Items/Placeables/FurnitureStratus/StratusBookcase.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusBricks.cs b/Items/Placeables/FurnitureStratus/StratusBricks.cs index 36f87a04c9..64080d7e9c 100644 --- a/Items/Placeables/FurnitureStratus/StratusBricks.cs +++ b/Items/Placeables/FurnitureStratus/StratusBricks.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(3). AddIngredient(). AddIngredient(). - AddTile(TileID.AdamantiteForge). + AddTile(). Register(); CreateRecipe(). AddIngredient(4). diff --git a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs index 63228f55f2..29b342236a 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandelabra.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandelabra.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusCandle.cs b/Items/Placeables/FurnitureStratus/StratusCandle.cs index f8dd4f71ea..6a60ac11de 100644 --- a/Items/Placeables/FurnitureStratus/StratusCandle.cs +++ b/Items/Placeables/FurnitureStratus/StratusCandle.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChair.cs b/Items/Placeables/FurnitureStratus/StratusChair.cs index 8a6ff76d53..bc41ac8a37 100644 --- a/Items/Placeables/FurnitureStratus/StratusChair.cs +++ b/Items/Placeables/FurnitureStratus/StratusChair.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(4). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChandelier.cs b/Items/Placeables/FurnitureStratus/StratusChandelier.cs index 5f21142e57..bd8fb08464 100644 --- a/Items/Placeables/FurnitureStratus/StratusChandelier.cs +++ b/Items/Placeables/FurnitureStratus/StratusChandelier.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(TileID.Anvils). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusChest.cs b/Items/Placeables/FurnitureStratus/StratusChest.cs index 753df53dec..aa4f89e08c 100644 --- a/Items/Placeables/FurnitureStratus/StratusChest.cs +++ b/Items/Placeables/FurnitureStratus/StratusChest.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(8). AddRecipeGroup("IronBar", 2). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusClock.cs b/Items/Placeables/FurnitureStratus/StratusClock.cs index 01b94235d7..c36dd0c39c 100644 --- a/Items/Placeables/FurnitureStratus/StratusClock.cs +++ b/Items/Placeables/FurnitureStratus/StratusClock.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusDoor.cs b/Items/Placeables/FurnitureStratus/StratusDoor.cs index 9182e72e40..c7b39082f0 100644 --- a/Items/Placeables/FurnitureStratus/StratusDoor.cs +++ b/Items/Placeables/FurnitureStratus/StratusDoor.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(6). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusDresser.cs b/Items/Placeables/FurnitureStratus/StratusDresser.cs index 12e18ed01a..a05a61a315 100644 --- a/Items/Placeables/FurnitureStratus/StratusDresser.cs +++ b/Items/Placeables/FurnitureStratus/StratusDresser.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(16). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusLamp.cs b/Items/Placeables/FurnitureStratus/StratusLamp.cs index 3d1e1f2488..2b778c19b0 100644 --- a/Items/Placeables/FurnitureStratus/StratusLamp.cs +++ b/Items/Placeables/FurnitureStratus/StratusLamp.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusLantern.cs b/Items/Placeables/FurnitureStratus/StratusLantern.cs index 050ea27365..0943f5f6ee 100644 --- a/Items/Placeables/FurnitureStratus/StratusLantern.cs +++ b/Items/Placeables/FurnitureStratus/StratusLantern.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusPiano.cs b/Items/Placeables/FurnitureStratus/StratusPiano.cs index 8d305c2cc2..2985284bac 100644 --- a/Items/Placeables/FurnitureStratus/StratusPiano.cs +++ b/Items/Placeables/FurnitureStratus/StratusPiano.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusSink.cs b/Items/Placeables/FurnitureStratus/StratusSink.cs index 82c625509b..b1f842dd38 100644 --- a/Items/Placeables/FurnitureStratus/StratusSink.cs +++ b/Items/Placeables/FurnitureStratus/StratusSink.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusSofa.cs b/Items/Placeables/FurnitureStratus/StratusSofa.cs index 705a35948b..703293629e 100644 --- a/Items/Placeables/FurnitureStratus/StratusSofa.cs +++ b/Items/Placeables/FurnitureStratus/StratusSofa.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(TileID.Sawmill). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusTable.cs b/Items/Placeables/FurnitureStratus/StratusTable.cs index 3e21e4e5b8..de3a38bc05 100644 --- a/Items/Placeables/FurnitureStratus/StratusTable.cs +++ b/Items/Placeables/FurnitureStratus/StratusTable.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(8). - AddTile(TileID.WorkBenches). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs index 69f1b33b25..9d2cc08edc 100644 --- a/Items/Placeables/FurnitureStratus/StratusWorkBench.cs +++ b/Items/Placeables/FurnitureStratus/StratusWorkBench.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureStratus { CreateRecipe(). AddIngredient(10). + AddTile(). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs index cfa4f34b81..3a7b5af97b 100644 --- a/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs +++ b/Items/Placeables/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddIngredient(). AddIngredient(). - AddTile(TileID.Anvils). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs new file mode 100644 index 0000000000..0dbb5c4e03 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumBathtub : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(14). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png new file mode 100644 index 0000000000..c8ab44889a Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs new file mode 100644 index 0000000000..024e48867a --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumBookcase : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(20). + AddIngredient(ItemID.Book, 10). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png new file mode 100644 index 0000000000..57cf58bd96 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs new file mode 100644 index 0000000000..f2c71f63e8 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChair : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png new file mode 100644 index 0000000000..649e6f9e82 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs new file mode 100644 index 0000000000..394de25e31 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs @@ -0,0 +1,27 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChandelier : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch, 4). + AddIngredient(ItemID.Chain). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png new file mode 100644 index 0000000000..94b71006d0 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs new file mode 100644 index 0000000000..1372897fd8 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChest : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddRecipeGroup("IronBar", 2). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png new file mode 100644 index 0000000000..44df951fe5 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png new file mode 100644 index 0000000000..7cb80254aa Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs new file mode 100644 index 0000000000..a0558ff07b --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDeskLight : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddIngredient(ItemID.Torch). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png new file mode 100644 index 0000000000..fad6a339c0 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.cs new file mode 100644 index 0000000000..1c491693b5 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDoor : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 40); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.png new file mode 100644 index 0000000000..dd4f7de09c Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoor.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs new file mode 100644 index 0000000000..ae67c2dac8 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDresser : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(16). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png new file mode 100644 index 0000000000..b0f8cc58c4 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs new file mode 100644 index 0000000000..b27d2c8cbb --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs @@ -0,0 +1,25 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumJukebox : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png new file mode 100644 index 0000000000..672db05d5a Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs new file mode 100644 index 0000000000..64738b8544 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumLamp : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 1); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Torch). + AddIngredient(3). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png new file mode 100644 index 0000000000..a19882f1b3 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs new file mode 100644 index 0000000000..46fbde76df --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumLantern : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.Torch). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png new file mode 100644 index 0000000000..8e530f9b95 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs new file mode 100644 index 0000000000..128827dbab --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSink : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(6). + AddIngredient(ItemID.WaterBucket). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png new file mode 100644 index 0000000000..c96f440a2b Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs new file mode 100644 index 0000000000..66403bdb55 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSleepingPod : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(silver: 4); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(ItemID.Silk, 5). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png new file mode 100644 index 0000000000..b438294241 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs new file mode 100644 index 0000000000..79eb99b99c --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSofa : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(ItemID.Silk, 2). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png new file mode 100644 index 0000000000..c848b79b7c Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs new file mode 100644 index 0000000000..c00b901567 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs @@ -0,0 +1,25 @@ + +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumTable : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 60); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(8). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png new file mode 100644 index 0000000000..b24d120326 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs new file mode 100644 index 0000000000..9ced6a0dd8 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs @@ -0,0 +1,26 @@ + +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumToilet : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(4). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png new file mode 100644 index 0000000000..5483bcf85a Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png differ diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs new file mode 100644 index 0000000000..c4ba7c3a04 --- /dev/null +++ b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs @@ -0,0 +1,26 @@ +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumWorkBench : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.value = Item.sellPrice(copper: 30); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddTile(TileID.HeavyWorkBench). + Register(); + } + } +} diff --git a/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png new file mode 100644 index 0000000000..b066974f66 Binary files /dev/null and b/Items/Placeables/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png differ diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs index 45519cd146..009f33382c 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBathtub.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(14). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs index dba6f46033..44f940e7b5 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBed.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(15). AddIngredient(ItemID.Silk, 5). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs index 183ac5df10..a0c1dd023f 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumBookcase.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(20). AddIngredient(ItemID.Book, 10). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs index 6f0a7e44f5..ab250a0424 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandelabra.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Torch, 3). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs index be884f8399..dd749adeb3 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumCandle.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(4). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs index 87ee331186..5a39d707eb 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChair.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(4). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs index d023bcca90..7c8a34cdd1 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChandelier.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(4). AddIngredient(ItemID.Torch, 4). AddIngredient(ItemID.Chain). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs index 16228bfe97..7bbd7662a1 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumChest.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(10). AddRecipeGroup("IronBar", 2). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs index fd29ef50dc..d5c9fcfce0 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumClock.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(10). AddRecipeGroup("IronBar", 3). AddIngredient(ItemID.Glass, 6). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs index e18969357f..cb2d32e226 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumDresser.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(16). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLabstationItem.cs similarity index 64% rename from Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs rename to Items/Placeables/FurnitureWulfrum/WulfrumLabstationItem.cs index 5f1ebc1011..8a3fc90abe 100644 --- a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLabstationItem.cs @@ -2,27 +2,21 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Items.Placeables.Furniture.CraftingStations +namespace CalamityMod.Items.Placeables.FurnitureWulfrum { public class WulfrumLabstationItem : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetDefaults() { - Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.DefaultToPlaceableTile(ModContent.TileType()); Item.value = Item.sellPrice(silver: 1); // This is REALLY too easy to craft to sell for 2 gold } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = ContentSamples.CreativeHelper.ItemGroup.CraftingObjects; - } - public override void AddRecipes() { CreateRecipe(). AddIngredient(20). - AddTile(TileID.Anvils). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.png b/Items/Placeables/FurnitureWulfrum/WulfrumLabstationItem.png similarity index 100% rename from Items/Placeables/Furniture/CraftingStations/WulfrumLabstationItem.png rename to Items/Placeables/FurnitureWulfrum/WulfrumLabstationItem.png diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs index b271efdb91..2a4d4f41ad 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLamp.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(3). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs index 72ebb8ebc3..ee4af86b88 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumLantern.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.Torch). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs index 1000898784..4130a6902f 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumPiano.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(15). AddIngredient(ItemID.Bone, 4). AddIngredient(ItemID.Book). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs index 5cff22aca0..8209196161 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSink.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(6). AddIngredient(ItemID.WaterBucket). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs index bc87369619..bf4c0e14fe 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumSofa.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum CreateRecipe(). AddIngredient(5). AddIngredient(ItemID.Silk, 2). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs index 9f4ca75337..125629aa6b 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumTable.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(8). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs index bb8189d1d8..9aa0a43fec 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumToilet.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(6). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs index 50db216abe..1148e3da9e 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum AddIngredient(). AddIngredient(). AddIngredient(). - AddTile(TileID.Anvils). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs b/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs index a4b4e96e4a..4a914037c9 100644 --- a/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs +++ b/Items/Placeables/FurnitureWulfrum/WulfrumWorkBench.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Placeables.FurnitureWulfrum { CreateRecipe(). AddIngredient(10). - AddTile(). + AddTile(TileID.HeavyWorkBench). Register(); } } diff --git a/Items/Placeables/Ores/AuricOre.cs b/Items/Placeables/Ores/AuricOre.cs index e4d55a7f3f..0d313efc82 100644 --- a/Items/Placeables/Ores/AuricOre.cs +++ b/Items/Placeables/Ores/AuricOre.cs @@ -18,13 +18,13 @@ namespace CalamityMod.Items.Placeables.Ores public override void SetDefaults() { Item.DefaultToPlaceableTile(ModContent.TileType()); - Item.value = Item.sellPrice(silver: 50); - Item.rare = ModContent.RarityType(); + Item.value = Item.sellPrice(silver: 60); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() { - CreateRecipe(30). + CreateRecipe(10). AddIngredient(). AddCondition(Condition.NearShimmer). Register(); diff --git a/Items/Placeables/SunkenSea/AridSoil.cs b/Items/Placeables/SunkenSea/AridSoil.cs new file mode 100644 index 0000000000..7979aeda66 --- /dev/null +++ b/Items/Placeables/SunkenSea/AridSoil.cs @@ -0,0 +1,18 @@ +using CalamityMod.Tiles.SunkenSea; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.SunkenSea +{ + public class AridSoil : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 100; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + } +} diff --git a/Items/Placeables/SunkenSea/AridSoil.png b/Items/Placeables/SunkenSea/AridSoil.png new file mode 100644 index 0000000000..040ca55e28 Binary files /dev/null and b/Items/Placeables/SunkenSea/AridSoil.png differ diff --git a/Items/Placeables/SunkenSea/Dunesand.cs b/Items/Placeables/SunkenSea/Dunesand.cs index af03dbc96c..495107affc 100644 --- a/Items/Placeables/SunkenSea/Dunesand.cs +++ b/Items/Placeables/SunkenSea/Dunesand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -11,8 +12,16 @@ namespace CalamityMod.Items.Placeables.SunkenSea { Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + + //+5 flat damage + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/SunkenSea/EutrophicSand.cs b/Items/Placeables/SunkenSea/EutrophicSand.cs index 903c1b2618..a198e8970c 100644 --- a/Items/Placeables/SunkenSea/EutrophicSand.cs +++ b/Items/Placeables/SunkenSea/EutrophicSand.cs @@ -14,8 +14,8 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ResearchUnlockCount = 100; ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); - // +5 flat damage, equal to other sand variants - ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 5); + // -5 flat damage + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(),-5); } public override void SetDefaults() @@ -24,14 +24,5 @@ namespace CalamityMod.Items.Placeables.SunkenSea Item.ammo = AmmoID.Sand; Item.notAmmo = true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(4). - AddTile(TileID.WorkBenches). - DisableDecraft(). - Register(); - } } } diff --git a/Items/Placeables/SunkenSea/Navystone.cs b/Items/Placeables/SunkenSea/Navystone.cs index 247e14cc42..42b3e5b407 100644 --- a/Items/Placeables/SunkenSea/Navystone.cs +++ b/Items/Placeables/SunkenSea/Navystone.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureEutrophic; +using CalamityMod.Items.Placeables.FurnitureNavystone; using CalamityMod.Items.Placeables.Walls; using CalamityMod.Tiles.Furniture.CraftingStations; using Terraria.ID; @@ -19,13 +19,13 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void AddRecipes() { CreateRecipe(). - AddIngredient(4). + AddIngredient(4). AddTile(TileID.WorkBenches). DisableDecraft(). Register(); CreateRecipe(). - AddIngredient(2). + AddIngredient(2). DisableDecraft(). Register(); } diff --git a/Items/Placeables/SunkenSea/PolypSand.cs b/Items/Placeables/SunkenSea/PolypSand.cs index 50c699626f..cc20b3828f 100644 --- a/Items/Placeables/SunkenSea/PolypSand.cs +++ b/Items/Placeables/SunkenSea/PolypSand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -9,8 +10,15 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/SunkenSea/VolcanicSand.cs b/Items/Placeables/SunkenSea/VolcanicSand.cs index 277f746966..c7003f7cb6 100644 --- a/Items/Placeables/SunkenSea/VolcanicSand.cs +++ b/Items/Placeables/SunkenSea/VolcanicSand.cs @@ -1,4 +1,5 @@ -using Terraria.ID; +using CalamityMod.Projectiles.Typeless; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Placeables.SunkenSea @@ -9,8 +10,14 @@ namespace CalamityMod.Items.Placeables.SunkenSea public override void SetStaticDefaults() { Item.ResearchUnlockCount = 100; + ItemID.Sets.SandgunAmmoProjectileData[Type] = new(ModContent.ProjectileType(), 0); } - public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + public override void SetDefaults() + { + Item.DefaultToPlaceableTile(ModContent.TileType()); + Item.ammo = AmmoID.Sand; + Item.notAmmo = true; + } } } diff --git a/Items/Placeables/Underworld/Dreadstone.cs b/Items/Placeables/Underworld/Dreadstone.cs new file mode 100644 index 0000000000..1927f25e75 --- /dev/null +++ b/Items/Placeables/Underworld/Dreadstone.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Placeables.Underworld +{ + public class Dreadstone : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Placeables"; + public override void SetStaticDefaults() => Item.ResearchUnlockCount = 100; + public override void SetDefaults() => Item.DefaultToPlaceableTile(ModContent.TileType()); + + } +} diff --git a/Items/Placeables/Underworld/Dreadstone.png b/Items/Placeables/Underworld/Dreadstone.png new file mode 100644 index 0000000000..3ad756b5e3 Binary files /dev/null and b/Items/Placeables/Underworld/Dreadstone.png differ diff --git a/Items/Placeables/Walls/AbyssGravelWallItem.cs b/Items/Placeables/Walls/AbyssGravelWallItem.cs index 943045e744..ab1cb9705c 100644 --- a/Items/Placeables/Walls/AbyssGravelWallItem.cs +++ b/Items/Placeables/Walls/AbyssGravelWallItem.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AcidwoodWallItem.cs b/Items/Placeables/Walls/AcidwoodWallItem.cs index 51968f9e81..4d6d6f3b77 100644 --- a/Items/Placeables/Walls/AcidwoodWallItem.cs +++ b/Items/Placeables/Walls/AcidwoodWallItem.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/NavystoneWallSafe.cs b/Items/Placeables/Walls/AncientSmoothNavystoneWall .cs similarity index 63% rename from Items/Placeables/Walls/NavystoneWallSafe.cs rename to Items/Placeables/Walls/AncientSmoothNavystoneWall .cs index 7dd6ce6ca0..1e314cc02e 100644 --- a/Items/Placeables/Walls/NavystoneWallSafe.cs +++ b/Items/Placeables/Walls/AncientSmoothNavystoneWall .cs @@ -1,24 +1,23 @@ -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; namespace CalamityMod.Items.Placeables.Walls { - public class NavystoneWallSafe : ModItem, ILocalizedModType + public class AncientSmoothNavystoneWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { CreateRecipe(4). - AddIngredient(). + AddIngredient(). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Walls/AncientSmoothNavystoneWall.png b/Items/Placeables/Walls/AncientSmoothNavystoneWall.png new file mode 100644 index 0000000000..d867a30eb6 Binary files /dev/null and b/Items/Placeables/Walls/AncientSmoothNavystoneWall.png differ diff --git a/Items/Placeables/Walls/AstralDirtWall.cs b/Items/Placeables/Walls/AstralDirtWall.cs index 92f04ca230..70ec1c3246 100644 --- a/Items/Placeables/Walls/AstralDirtWall.cs +++ b/Items/Placeables/Walls/AstralDirtWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralGrassWall.cs b/Items/Placeables/Walls/AstralGrassWall.cs index 4b733618b7..abb874af44 100644 --- a/Items/Placeables/Walls/AstralGrassWall.cs +++ b/Items/Placeables/Walls/AstralGrassWall.cs @@ -12,6 +12,6 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/AstralIceWall.cs b/Items/Placeables/Walls/AstralIceWall.cs index c97435081c..10f38bc8d5 100644 --- a/Items/Placeables/Walls/AstralIceWall.cs +++ b/Items/Placeables/Walls/AstralIceWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralMonolithWall.cs b/Items/Placeables/Walls/AstralMonolithWall.cs index 0066082c69..a82474c496 100644 --- a/Items/Placeables/Walls/AstralMonolithWall.cs +++ b/Items/Placeables/Walls/AstralMonolithWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/AstralSandstoneWall.cs b/Items/Placeables/Walls/AstralSandstoneWall.cs index aba828d058..43a2277c27 100644 --- a/Items/Placeables/Walls/AstralSandstoneWall.cs +++ b/Items/Placeables/Walls/AstralSandstoneWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralSnowWall.cs b/Items/Placeables/Walls/AstralSnowWall.cs index ad137271ff..8771a360bf 100644 --- a/Items/Placeables/Walls/AstralSnowWall.cs +++ b/Items/Placeables/Walls/AstralSnowWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/AstralStoneWall.cs b/Items/Placeables/Walls/AstralStoneWall.cs index 25f2ec002e..07b8f957dd 100644 --- a/Items/Placeables/Walls/AstralStoneWall.cs +++ b/Items/Placeables/Walls/AstralStoneWall.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/DriftwoodWall.cs b/Items/Placeables/Walls/DriftwoodWall.cs index 6f4217b604..dad7d4bf22 100644 --- a/Items/Placeables/Walls/DriftwoodWall.cs +++ b/Items/Placeables/Walls/DriftwoodWall.cs @@ -1,7 +1,7 @@ using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/EutrophicSandWall.png b/Items/Placeables/Walls/EutrophicSandWall.png deleted file mode 100644 index 04e425d8b5..0000000000 Binary files a/Items/Placeables/Walls/EutrophicSandWall.png and /dev/null differ diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.png b/Items/Placeables/Walls/EutrophicSandWallSafe.png deleted file mode 100644 index 04e425d8b5..0000000000 Binary files a/Items/Placeables/Walls/EutrophicSandWallSafe.png and /dev/null differ diff --git a/Items/Placeables/Walls/HardenedAstralSandWall.cs b/Items/Placeables/Walls/HardenedAstralSandWall.cs index 23e5cebc10..5740900953 100644 --- a/Items/Placeables/Walls/HardenedAstralSandWall.cs +++ b/Items/Placeables/Walls/HardenedAstralSandWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/NavystoneWall.cs b/Items/Placeables/Walls/NavystoneWall.cs index 86d37219d1..b486ddeba7 100644 --- a/Items/Placeables/Walls/NavystoneWall.cs +++ b/Items/Placeables/Walls/NavystoneWall.cs @@ -1,18 +1,28 @@ -using Terraria.ID; +using CalamityMod.Items.Placeables.SunkenSea; +using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; namespace CalamityMod.Items.Placeables.Walls { + [LegacyName("NavystoneWallSafe")] public class NavystoneWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; - ItemID.Sets.DrawUnsafeIndicator[Type] = true; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + + public override void AddRecipes() + { + CreateRecipe(4). + AddIngredient(). + AddTile(TileID.WorkBenches). + Register(); + } } } diff --git a/Items/Placeables/Walls/EutrophicSandWallSafe.cs b/Items/Placeables/Walls/ShellTrimBrickWall.cs similarity index 55% rename from Items/Placeables/Walls/EutrophicSandWallSafe.cs rename to Items/Placeables/Walls/ShellTrimBrickWall.cs index d1558ba3c6..d319d780ea 100644 --- a/Items/Placeables/Walls/EutrophicSandWallSafe.cs +++ b/Items/Placeables/Walls/ShellTrimBrickWall.cs @@ -1,25 +1,24 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using Terraria.ID; -using Terraria.ModLoader; +using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; +using Terraria.ID; +using CalamityMod.Items.Placeables.FurnitureShellstone; namespace CalamityMod.Items.Placeables.Walls { - public class EutrophicSandWallSafe : ModItem, ILocalizedModType + public class ShellTrimBrickWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); - public override void AddRecipes() + public override void AddRecipes() { CreateRecipe(4). - AddIngredient(). + AddIngredient(). AddTile(TileID.WorkBenches). Register(); } diff --git a/Items/Placeables/Walls/ShellTrimBrickWall.png b/Items/Placeables/Walls/ShellTrimBrickWall.png new file mode 100644 index 0000000000..6659b189f6 Binary files /dev/null and b/Items/Placeables/Walls/ShellTrimBrickWall.png differ diff --git a/Items/Placeables/Walls/ShellstoneSlabWall.cs b/Items/Placeables/Walls/ShellstoneSlabWall.cs index 71a1f34779..556af95bbd 100644 --- a/Items/Placeables/Walls/ShellstoneSlabWall.cs +++ b/Items/Placeables/Walls/ShellstoneSlabWall.cs @@ -1,7 +1,7 @@ using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; using Terraria.ID; -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureShellstone; namespace CalamityMod.Items.Placeables.Walls { diff --git a/Items/Placeables/Walls/SmoothNavystoneWall.cs b/Items/Placeables/Walls/SmoothNavystoneWall.cs index a2104c8b5c..11667b7dc1 100644 --- a/Items/Placeables/Walls/SmoothNavystoneWall.cs +++ b/Items/Placeables/Walls/SmoothNavystoneWall.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.FurnitureEutrophic; +using CalamityMod.Items.Placeables.FurnitureNavystone; using Terraria.ID; using Terraria.ModLoader; using WallTiles = CalamityMod.Walls; diff --git a/Items/Placeables/Walls/SmoothNavystoneWall.png b/Items/Placeables/Walls/SmoothNavystoneWall.png index d867a30eb6..d58aa5330c 100644 Binary files a/Items/Placeables/Walls/SmoothNavystoneWall.png and b/Items/Placeables/Walls/SmoothNavystoneWall.png differ diff --git a/Items/Placeables/Walls/SulphurousSandWall.cs b/Items/Placeables/Walls/SulphurousSandWall.cs index a975584667..526057ed0c 100644 --- a/Items/Placeables/Walls/SulphurousSandWall.cs +++ b/Items/Placeables/Walls/SulphurousSandWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousSandstoneWall.cs b/Items/Placeables/Walls/SulphurousSandstoneWall.cs index 994455af66..fdcf4a4b3a 100644 --- a/Items/Placeables/Walls/SulphurousSandstoneWall.cs +++ b/Items/Placeables/Walls/SulphurousSandstoneWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/SulphurousShaleWall.cs b/Items/Placeables/Walls/SulphurousShaleWall.cs index 2801be9e26..d245987b63 100644 --- a/Items/Placeables/Walls/SulphurousShaleWall.cs +++ b/Items/Placeables/Walls/SulphurousShaleWall.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Placeables.Walls Item.ResearchUnlockCount = 400; } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); public override void AddRecipes() { diff --git a/Items/Placeables/Walls/EutrophicSandWall.cs b/Items/Placeables/Walls/UnsafeNavystoneWall.cs similarity index 63% rename from Items/Placeables/Walls/EutrophicSandWall.cs rename to Items/Placeables/Walls/UnsafeNavystoneWall.cs index f7e9ef7d62..484b95edda 100644 --- a/Items/Placeables/Walls/EutrophicSandWall.cs +++ b/Items/Placeables/Walls/UnsafeNavystoneWall.cs @@ -1,19 +1,19 @@ using Terraria.ID; using Terraria.ModLoader; -using WallTiles = CalamityMod.Walls; - +using WallTiles = CalamityMod.Walls.UnsafeWalls; +using CalamityMod.Items.Placeables.Walls; namespace CalamityMod.Items.Placeables.Walls { - public class EutrophicSandWall : ModItem, ILocalizedModType + public class UnsafeNavystoneWall : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Placeables"; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 400; ItemID.Sets.DrawUnsafeIndicator[Type] = true; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); + public override void SetDefaults() => Item.DefaultToPlaceableWall(ModContent.WallType()); } } diff --git a/Items/Placeables/Walls/NavystoneWallSafe.png b/Items/Placeables/Walls/UnsafeNavystoneWall.png similarity index 100% rename from Items/Placeables/Walls/NavystoneWallSafe.png rename to Items/Placeables/Walls/UnsafeNavystoneWall.png diff --git a/Items/Potions/Alcohol/BloodyMary.cs b/Items/Potions/Alcohol/BloodyMary.cs index b9a40e4147..3a59eb34c0 100644 --- a/Items/Potions/Alcohol/BloodyMary.cs +++ b/Items/Potions/Alcohol/BloodyMary.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/CaribbeanRum.cs b/Items/Potions/Alcohol/CaribbeanRum.cs index 2d0df11fd0..df99ce342a 100644 --- a/Items/Potions/Alcohol/CaribbeanRum.cs +++ b/Items/Potions/Alcohol/CaribbeanRum.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/CinnamonRoll.cs b/Items/Potions/Alcohol/CinnamonRoll.cs index ada553d5dc..1fa9e4c36f 100644 --- a/Items/Potions/Alcohol/CinnamonRoll.cs +++ b/Items/Potions/Alcohol/CinnamonRoll.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,9 +33,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Everclear.cs b/Items/Potions/Alcohol/Everclear.cs index 1a79a28375..5b8801d87e 100644 --- a/Items/Potions/Alcohol/Everclear.cs +++ b/Items/Potions/Alcohol/Everclear.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,28 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(1), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.Glass, 10). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.Glass, 5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/EvergreenGin.cs b/Items/Potions/Alcohol/EvergreenGin.cs index e3ac50f3ee..50a3593439 100644 --- a/Items/Potions/Alcohol/EvergreenGin.cs +++ b/Items/Potions/Alcohol/EvergreenGin.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Fireball.cs b/Items/Potions/Alcohol/Fireball.cs index c5c3326bdb..8b8aac8cfc 100644 --- a/Items/Potions/Alcohol/Fireball.cs +++ b/Items/Potions/Alcohol/Fireball.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +29,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(16, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.LivingFireBlock). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/GrapeBeer.cs b/Items/Potions/Alcohol/GrapeBeer.cs index 5a6ecfe28c..3326c62a28 100644 --- a/Items/Potions/Alcohol/GrapeBeer.cs +++ b/Items/Potions/Alcohol/GrapeBeer.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,7 +29,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(12, 28, 100); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 3); Item.rare = ItemRarityID.LightRed; } @@ -37,5 +38,23 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } + + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(ItemID.Bottle, 10). + AddIngredient(ItemID.Grapes). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Margarita.cs b/Items/Potions/Alcohol/Margarita.cs index fef39cfa86..dc85eaba0f 100644 --- a/Items/Potions/Alcohol/Margarita.cs +++ b/Items/Potions/Alcohol/Margarita.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,7 +31,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(28, 40, 200); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } @@ -39,5 +40,21 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(BuffType, CalamityUtils.MinutesToFrames(MinuteDuration)); } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Moonshine.cs b/Items/Potions/Alcohol/Moonshine.cs index bbe98be132..023184739f 100644 --- a/Items/Potions/Alcohol/Moonshine.cs +++ b/Items/Potions/Alcohol/Moonshine.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(24, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/MoscowMule.cs b/Items/Potions/Alcohol/MoscowMule.cs index e3de1158d0..ab298437e2 100644 --- a/Items/Potions/Alcohol/MoscowMule.cs +++ b/Items/Potions/Alcohol/MoscowMule.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -31,9 +33,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(32, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/OddMushroom.cs b/Items/Potions/Alcohol/OddMushroom.cs index 39c9dc8190..0c8166cea2 100644 --- a/Items/Potions/Alcohol/OddMushroom.cs +++ b/Items/Potions/Alcohol/OddMushroom.cs @@ -25,8 +25,8 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(38, 50, ModContent.BuffType(), CalamityUtils.MinutesToFrames(60)); - // Cirrus overcharges: 10% sell value instead of 20% - Item.value = Item.sellPrice(gold: 10); + + Item.value = Item.buyPrice(gold: 5); // Sold by Truffle Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/Alcohol/OldFashioned.cs b/Items/Potions/Alcohol/OldFashioned.cs index 8240710765..f0a99febe6 100644 --- a/Items/Potions/Alcohol/OldFashioned.cs +++ b/Items/Potions/Alcohol/OldFashioned.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +29,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(30, 38, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 60); Item.rare = ItemRarityID.Lime; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(ItemID.Ectoplasm). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(ItemID.Ectoplasm). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/OldFashioned.png b/Items/Potions/Alcohol/OldFashioned.png index fddbd65368..c46adf86ba 100644 Binary files a/Items/Potions/Alcohol/OldFashioned.png and b/Items/Potions/Alcohol/OldFashioned.png differ diff --git a/Items/Potions/Alcohol/CirrusVodka.cs b/Items/Potions/Alcohol/PurpleHaze.cs similarity index 83% rename from Items/Potions/Alcohol/CirrusVodka.cs rename to Items/Potions/Alcohol/PurpleHaze.cs index 4b59118bae..16b2e0d0ab 100644 --- a/Items/Potions/Alcohol/CirrusVodka.cs +++ b/Items/Potions/Alcohol/PurpleHaze.cs @@ -10,7 +10,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions.Alcohol { [LegacyName("FabsolsVodka")] - public class CirrusVodka : ModItem, ILocalizedModType + public class PurpleHaze : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; @@ -21,7 +21,6 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetStaticDefaults() { Item.ResearchUnlockCount = 20; - ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); ItemID.Sets.DrinkParticleColors[Type] = new Color[3] { new Color(239, 123, 202), new Color(187, 56, 158), @@ -31,8 +30,8 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { - Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.DefaultToFood(30, 42, ModContent.BuffType(), CalamityUtils.MinutesToFrames(15), true); + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/Alcohol/CirrusVodka.png b/Items/Potions/Alcohol/PurpleHaze.png similarity index 100% rename from Items/Potions/Alcohol/CirrusVodka.png rename to Items/Potions/Alcohol/PurpleHaze.png diff --git a/Items/Potions/Alcohol/RedWine.cs b/Items/Potions/Alcohol/RedWine.cs index df301e6121..be7ea64e52 100644 --- a/Items/Potions/Alcohol/RedWine.cs +++ b/Items/Potions/Alcohol/RedWine.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,7 +30,7 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToHealingPotion(14, 48, HealValue); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } @@ -43,5 +44,22 @@ namespace CalamityMod.Items.Potions.Alcohol { player.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(SecondDuration)); } + public override void AddRecipes() + { + CreateRecipe(10). + AddIngredient(ItemID.Bottle, 10). + AddIngredient(ItemID.Grapes). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Rum.cs b/Items/Potions/Alcohol/Rum.cs index ec9ac8cb46..157feb9e2b 100644 --- a/Items/Potions/Alcohol/Rum.cs +++ b/Items/Potions/Alcohol/Rum.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -29,9 +30,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(24, 26, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Screwdriver.cs b/Items/Potions/Alcohol/Screwdriver.cs index 7324ec7709..84111eb272 100644 --- a/Items/Potions/Alcohol/Screwdriver.cs +++ b/Items/Potions/Alcohol/Screwdriver.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,9 +30,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/StarBeamRye.cs b/Items/Potions/Alcohol/StarBeamRye.cs index a2db1c7ac3..70c37e28a6 100644 --- a/Items/Potions/Alcohol/StarBeamRye.cs +++ b/Items/Potions/Alcohol/StarBeamRye.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -32,9 +33,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(20, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 80); Item.rare = ItemRarityID.Lime; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Tequila.cs b/Items/Potions/Alcohol/Tequila.cs index c423400e0a..a458e21c69 100644 --- a/Items/Potions/Alcohol/Tequila.cs +++ b/Items/Potions/Alcohol/Tequila.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(16, 34, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/TequilaSunrise.cs b/Items/Potions/Alcohol/TequilaSunrise.cs index 3a65d32387..21f4125b1e 100644 --- a/Items/Potions/Alcohol/TequilaSunrise.cs +++ b/Items/Potions/Alcohol/TequilaSunrise.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +32,26 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(22, 28, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(gold: 1); Item.rare = ItemRarityID.Yellow; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Vodka.cs b/Items/Potions/Alcohol/Vodka.cs index b1b0ef79ca..81f53c8799 100644 --- a/Items/Potions/Alcohol/Vodka.cs +++ b/Items/Potions/Alcohol/Vodka.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +32,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(14, 36, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/Whiskey.cs b/Items/Potions/Alcohol/Whiskey.cs index eed0d9f389..103f21d3be 100644 --- a/Items/Potions/Alcohol/Whiskey.cs +++ b/Items/Potions/Alcohol/Whiskey.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -30,9 +31,25 @@ namespace CalamityMod.Items.Potions.Alcohol public override void SetDefaults() { Item.DefaultToFood(18, 32, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 30); Item.rare = ItemRarityID.LightRed; } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(5). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Alcohol/WhiteWine.cs b/Items/Potions/Alcohol/WhiteWine.cs index 7e5249978d..396bc4b338 100644 --- a/Items/Potions/Alcohol/WhiteWine.cs +++ b/Items/Potions/Alcohol/WhiteWine.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Alcohol; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameInput; @@ -32,7 +34,7 @@ namespace CalamityMod.Items.Potions.Alcohol { Item.DefaultToFood(14, 44, ModContent.BuffType(), CalamityUtils.MinutesToFrames(5), true); Item.healMana = 300; - // Cirrus overcharges: 10% sell value instead of 20% + Item.value = Item.sellPrice(silver: 40); Item.rare = ItemRarityID.LightPurple; } @@ -54,5 +56,21 @@ namespace CalamityMod.Items.Potions.Alcohol } player.AddBuff(Item.buffType, Item.buffTime); } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.Ale). + AddIngredient(3). + AddTile(TileID.Kegs). + Register(); + + CreateRecipe(). + AddIngredient(ItemID.BottledWater). + AddIngredient(5). + AddIngredient(). + AddTile(TileID.AlchemyTable). + Register() + .DisableDecraft(); + } } } diff --git a/Items/Potions/Fabsoup.cs b/Items/Potions/LavaChickenBroth.cs similarity index 92% rename from Items/Potions/Fabsoup.cs rename to Items/Potions/LavaChickenBroth.cs index 91e98d12c6..edc633381e 100644 --- a/Items/Potions/Fabsoup.cs +++ b/Items/Potions/LavaChickenBroth.cs @@ -8,7 +8,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Potions { - public class Fabsoup : ModItem, ILocalizedModType + [LegacyName("Fabsoup")] + public class LavaChickenBroth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/SoupConsumption"); @@ -36,7 +37,7 @@ namespace CalamityMod.Items.Potions public override void UseItemFrame(Player player) { - int time = CalamityUtils.MinutesToFrames(33); + int time = CalamityUtils.MinutesToFrames(25) + CalamityUtils.SecondsToFrames(25); if (player.itemAnimation == 180) { player.AddBuff(BuffID.WellFed3, time); diff --git a/Items/Potions/Fabsoup.png b/Items/Potions/LavaChickenBroth.png similarity index 100% rename from Items/Potions/Fabsoup.png rename to Items/Potions/LavaChickenBroth.png diff --git a/Items/Potions/OmegaHealingPotion.cs b/Items/Potions/OmegaHealingPotion.cs index a4e28baa46..e145c6d146 100644 --- a/Items/Potions/OmegaHealingPotion.cs +++ b/Items/Potions/OmegaHealingPotion.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Potions { Item.DefaultToHealingPotion(24, 32, 300); Item.value = Item.sellPrice(gold: 1); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/Potions/SoaringPotion.cs b/Items/Potions/SoaringPotion.cs index 91606786c4..0404bafdb8 100644 --- a/Items/Potions/SoaringPotion.cs +++ b/Items/Potions/SoaringPotion.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Potions public override void SetDefaults() { - Item.DefaultToFood(30, 30, ModContent.BuffType(), CalamityUtils.MinutesToFrames(6), true); + Item.DefaultToFood(30, 30, ModContent.BuffType(), CalamityUtils.MinutesToFrames(8), true); Item.value = Item.sellPrice(silver: 2); Item.rare = ItemRarityID.LightRed; } diff --git a/Items/Potions/SupremeHealingPotion.cs b/Items/Potions/SupremeHealingPotion.cs index 8d2d5d7d74..a6be404eb4 100644 --- a/Items/Potions/SupremeHealingPotion.cs +++ b/Items/Potions/SupremeHealingPotion.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Potions { Item.DefaultToHealingPotion(26, 38, 250); Item.value = Item.sellPrice(silver: 60); - Item.rare = ItemRarityID.Purple; + Item.rare = ModContent.RarityType(); } public override void AddRecipes() diff --git a/Items/SummonItems/BloodyWormFood.cs b/Items/SummonItems/BloodyWormFood.cs index 590d5c5b4b..b5dd639393 100644 --- a/Items/SummonItems/BloodyWormFood.cs +++ b/Items/SummonItems/BloodyWormFood.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe() .AddIngredient(ItemID.CrimtaneBar, 3) - .AddIngredient(7) + .AddIngredient(7) .AddIngredient(ItemID.Vertebrae, 13) .AddTile(TileID.DemonAltar) .AddDecraftCondition(CalamityConditions.DownedPerforator) diff --git a/Items/SummonItems/CeremonialUrn.cs b/Items/SummonItems/CeremonialUrn.cs index b3dcdb5e58..d0e5bfa47e 100644 --- a/Items/SummonItems/CeremonialUrn.cs +++ b/Items/SummonItems/CeremonialUrn.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.SummonItems { Item.width = 34; Item.height = 54; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SummonItems/DeathWhistle.cs b/Items/SummonItems/DeathWhistle.cs index 7fa4d05df6..4fe11d26ce 100644 --- a/Items/SummonItems/DeathWhistle.cs +++ b/Items/SummonItems/DeathWhistle.cs @@ -54,13 +54,6 @@ namespace CalamityMod.Items.SummonItems AddIngredient(ItemID.LihzahrdBrick, 25). AddTile(TileID.DemonAltar). Register(); - - - CreateRecipe(). - AddIngredient(ItemID.LunarTabletFragment, 15). - AddIngredient(ItemID.LihzahrdBrick, 25). - AddTile(TileID.LihzahrdAltar). - Register(); } } } diff --git a/Items/SummonItems/DecapoditaSprout.cs b/Items/SummonItems/DecapoditaSprout.cs index 23ada1d63c..5011a26b64 100644 --- a/Items/SummonItems/DecapoditaSprout.cs +++ b/Items/SummonItems/DecapoditaSprout.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneGlowshroom && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return player.ZoneGlowshroom && (player.position.Y / 16f) > Main.worldSurface && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/ExoticPheromones.cs b/Items/SummonItems/ExoticPheromones.cs index 995118804c..6c6504bc90 100644 --- a/Items/SummonItems/ExoticPheromones.cs +++ b/Items/SummonItems/ExoticPheromones.cs @@ -34,12 +34,12 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return player.ZoneJungle && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) { - CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); + CalamityUtils.SpawnBossUsingItem(player, SoundID.Roar); return true; } diff --git a/Items/SummonItems/EyeofDesolation.cs b/Items/SummonItems/EyeofDesolation.cs index 8168d6aae7..185af601f1 100644 --- a/Items/SummonItems/EyeofDesolation.cs +++ b/Items/SummonItems/EyeofDesolation.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Items.SummonItems public override bool CanUseItem(Player player) { - return !Main.IsItDay() && !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; + return !NPC.AnyNPCs(ModContent.NPCType()) && !BossRushEvent.BossRushActive; } public override bool? UseItem(Player player) diff --git a/Items/SummonItems/Invasion/CausticTear.cs b/Items/SummonItems/Invasion/CausticTear.cs index 75deb7d52b..0663d7c312 100644 --- a/Items/SummonItems/Invasion/CausticTear.cs +++ b/Items/SummonItems/Invasion/CausticTear.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public new string LocalizationCategory => "Items.SummonItems"; public override void SetStaticDefaults() { + Item.ResearchUnlockCount = 3; ItemID.Sets.SortingPriorityBossSpawns[Type] = 4; // Goblin Battle Standard } @@ -18,12 +19,11 @@ namespace CalamityMod.Items.SummonItems.Invasion { Item.width = 16; Item.height = 28; - Item.maxStack = 1; - Item.rare = ItemRarityID.Green; - Item.useAnimation = 10; - Item.useTime = 10; + Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; - Item.consumable = false; + Item.rare = ItemRarityID.Green; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -51,7 +51,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public override void AddRecipes() { CreateRecipe(). - AddIngredient(5). + AddIngredient(). AddCondition(Condition.NearWater). Register(); } diff --git a/Items/SummonItems/Invasion/MartianDistressRemote.cs b/Items/SummonItems/Invasion/MartianDistressRemote.cs index 880a169570..73140ce6ff 100644 --- a/Items/SummonItems/Invasion/MartianDistressRemote.cs +++ b/Items/SummonItems/Invasion/MartianDistressRemote.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Items.SummonItems.Invasion public int frame = 0; public override void SetStaticDefaults() { + Item.ResearchUnlockCount = 3; ItemID.Sets.SortingPriorityBossSpawns[Type] = 17; // Solar Tablet (1 above Lihzahrd Power Cell) } @@ -22,13 +23,13 @@ namespace CalamityMod.Items.SummonItems.Invasion { Item.width = 26; Item.height = 52; - Item.maxStack = 1; - Item.rare = ItemRarityID.Yellow; - Item.useAnimation = 10; - Item.useTime = 10; - Item.useStyle = ItemUseStyleID.HoldUp; - Item.consumable = false; + Item.consumable = true; + Item.maxStack = Item.CommonMaxStack; + Item.useAnimation = Item.useTime = 10; Item.UseSound = SoundID.Zombie67; + Item.useStyle = ItemUseStyleID.HoldUp; + Item.value = Item.buyPrice(gold: 50); // Sold by Cyborg + Item.rare = ItemRarityID.Yellow; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SummonItems/NO.cs b/Items/SummonItems/NO.cs index 6578012f85..b51b1d575d 100644 --- a/Items/SummonItems/NO.cs +++ b/Items/SummonItems/NO.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.SummonItems public override void SetDefaults() { Item.width = Item.height = 32; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.useAnimation = 10; Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; diff --git a/Items/SummonItems/NaiadsWarhorn.cs b/Items/SummonItems/NaiadsWarhorn.cs index ff3e494d4f..cfc28464db 100644 --- a/Items/SummonItems/NaiadsWarhorn.cs +++ b/Items/SummonItems/NaiadsWarhorn.cs @@ -1,7 +1,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; using CalamityMod.NPCs.Leviathan; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; diff --git a/Items/SummonItems/Teratoma.cs b/Items/SummonItems/Teratoma.cs index fabb86b0a4..9e09b791ae 100644 --- a/Items/SummonItems/Teratoma.cs +++ b/Items/SummonItems/Teratoma.cs @@ -46,7 +46,7 @@ namespace CalamityMod.Items.SummonItems { CreateRecipe(). AddIngredient(ItemID.DemoniteBar, 3). - AddIngredient(7). + AddIngredient(7). AddIngredient(ItemID.RottenChunk, 13). AddTile(TileID.DemonAltar). AddDecraftCondition(CalamityConditions.DownedHiveMind). diff --git a/Items/SummonItems/YharonEgg.cs b/Items/SummonItems/YharonEgg.cs index 2a91bbe100..3bfa7a76c3 100644 --- a/Items/SummonItems/YharonEgg.cs +++ b/Items/SummonItems/YharonEgg.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.SummonItems Item.useTime = 10; Item.useStyle = ItemUseStyleID.HoldUp; Item.consumable = false; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/SuperDummy.cs b/Items/SuperDummy.cs index c6055399d2..47958aa978 100644 --- a/Items/SuperDummy.cs +++ b/Items/SuperDummy.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Items } } } - else if (player.whoAmI == Main.myPlayer) + else if (player.whoAmI == Main.myPlayer && NPC.CountNPCS(ModContent.NPCType()) < 50) { int x = (int)Main.MouseWorld.X - 9; int y = (int)Main.MouseWorld.Y - 20; diff --git a/Items/Tools/AcidwoodHammer.cs b/Items/Tools/AcidwoodHammer.cs index 78f5eeb610..31653ac752 100644 --- a/Items/Tools/AcidwoodHammer.cs +++ b/Items/Tools/AcidwoodHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Tools/ClimateChange/Bakidon.cs b/Items/Tools/ClimateChange/Bakidon.cs new file mode 100644 index 0000000000..5372e4491e --- /dev/null +++ b/Items/Tools/ClimateChange/Bakidon.cs @@ -0,0 +1,87 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Items.Materials; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.Creative; +using Terraria.GameContent.NetModules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.Net; + +namespace CalamityMod.Items.Tools.ClimateChange +{ + [LegacyName("Moonlight")] + public class Bakidon : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Tools"; + + public static int FreezeTime => CalamityUtils.MinutesToFrames(10); + public static float RechargeMultiplier => 1; + + public override void SetDefaults() + { + Item.width = 20; + Item.height = 20; + Item.rare = ItemRarityID.LightRed; + Item.useAnimation = 9; + Item.useTime = 9; + Item.autoReuse = false; // Explicitly not autofire, since it can be used quickly now + Item.useStyle = ItemUseStyleID.HoldUp; + Item.UseSound = SoundID.Item60; + Item.consumable = false; + } + + public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) + { + itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; + } + + public override bool? UseItem(Player player) + { + player.Calamity().WeakTimeFreezeInUse = !player.Calamity().WeakTimeFreezeInUse; + if (Main.netMode != NetmodeID.Server && player == Main.LocalPlayer) + { + var power = CreativePowerManager.Instance.GetPower(); + NetPacket packet = NetCreativePowersModule.PreparePacket(power.PowerId, 1); + packet.Writer.Write(player.Calamity().WeakTimeFreezeInUse); + NetManager.Instance.SendToServerOrLoopback(packet); + } + return true; + } + + public override void PostDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + var cplayer = Main.LocalPlayer.Calamity(); + float fill = 1 - cplayer.WeakTimeFreezeUseTimer / (float)(FreezeTime / RechargeMultiplier); + if (fill >= 1) + return; + + float barScale = 1.1f; + + var barBG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; + var barFG = ModContent.Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; + + Vector2 barOrigin = barBG.Size() * 0.5f; + float yOffset = 7.5f; + Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); + Rectangle frameCrop = new Rectangle(0, 0, (int)((fill) * barFG.Width), barFG.Height); + Color colorBG = Color.DarkViolet * 0.5f; + Color colorFG = Color.Lerp(Color.Orange, Color.Green, fill); + + spriteBatch.Draw(barBG, drawPos, null, colorBG, 0f, barOrigin, scale * barScale, 0f, 0f); + spriteBatch.Draw(barFG, drawPos, frameCrop, colorFG, 0f, barOrigin, scale * barScale, 0f, 0f); + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.FallenStar, 10). + AddIngredient(ItemID.SoulofLight, 7). + AddIngredient(ItemID.SoulofNight, 7). + AddIngredient(5). + AddTile(TileID.DemonAltar). + Register(); + } + } +} diff --git a/Items/Tools/ClimateChange/Bakidon.png b/Items/Tools/ClimateChange/Bakidon.png new file mode 100644 index 0000000000..e48b63f744 Binary files /dev/null and b/Items/Tools/ClimateChange/Bakidon.png differ diff --git a/Items/Tools/ClimateChange/Cosmolight.cs b/Items/Tools/ClimateChange/Cosmolight.cs index b380c4f384..4f65a2ecb2 100644 --- a/Items/Tools/ClimateChange/Cosmolight.cs +++ b/Items/Tools/ClimateChange/Cosmolight.cs @@ -1,18 +1,20 @@ -using CalamityMod.CalPlayer; +using System.Linq; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Ores; +using CalamityMod.World; using Terraria; +using Terraria.GameContent.Creative; +using Terraria.GameContent.NetModules; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Net; namespace CalamityMod.Items.Tools.ClimateChange { public class Cosmolight : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Tools"; - // Hardcoded times set by the vanilla Journey Mode buttons. - // These are "halfway through day" and "halfway through night" respectively. - private const int NoonCutoff = 27000; - private const int MidnightCutoff = 16200; public override void SetDefaults() { @@ -21,10 +23,11 @@ namespace CalamityMod.Items.Tools.ClimateChange Item.rare = ItemRarityID.LightRed; Item.useAnimation = 9; Item.useTime = 9; - Item.autoReuse = false; // Explicitly not autofire, since it can be used quickly now + Item.autoReuse = false; Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = SoundID.Item60; Item.consumable = false; + Item.channel = true; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) @@ -32,42 +35,51 @@ namespace CalamityMod.Items.Tools.ClimateChange itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ToolsOther; } - public override bool CanUseItem(Player player) => !CalamityPlayer.areThereAnyDamnBosses; + public override bool AltFunctionUse(Player player) + { + return true; + } public override bool? UseItem(Player player) { - //Only SinglePlayer or DedServ should change time to prevent unwanted race condition - if (Main.netMode == NetmodeID.MultiplayerClient) - return true; - - // Early Morning -> Noon - if (Main.dayTime && Main.time < NoonCutoff) - Main.SkipToTime(NoonCutoff, true); - - // Afternoon -> Dusk - else if (Main.dayTime) - Main.SkipToTime(0, false); - - // Early Night -> Midnight - else if (!Main.dayTime && Main.time < MidnightCutoff) - Main.SkipToTime(MidnightCutoff, false); - - // Late Night -> Dawn - else if (!Main.dayTime) - Main.SkipToTime(0, true); - + if (Main.netMode != NetmodeID.Server && player == Main.LocalPlayer && (player.altFunctionUse == 2 || (CreativePowerManager.Instance.GetPower().Enabled))) + { + var power = CreativePowerManager.Instance.GetPower(); + NetPacket packet = NetCreativePowersModule.PreparePacket(power.PowerId, 1); + packet.Writer.Write(!power.Enabled); + NetManager.Instance.SendToServerOrLoopback(packet); + } return true; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.FallenStar, 10). - AddIngredient(ItemID.SoulofLight, 7). - AddIngredient(ItemID.SoulofNight, 7). - AddIngredient(5). - AddTile(TileID.Anvils). + AddIngredient(). + AddIngredient(ItemID.Sundial). + AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 15). + AddTile(TileID.DemonAltar). + Register(); + + CreateRecipe(). + AddIngredient(). + AddIngredient(ItemID.Moondial). + AddIngredient(3). + AddIngredient(ItemID.FragmentSolar, 15). + AddTile(TileID.DemonAltar). Register(); } } + + public class CosmolightTimeRateChange : ModSystem + { + public override void ModifyTimeRate(ref double timeRate, ref double tileUpdateRate, ref double eventUpdateRate) + { + if (Main.player.Any(x => x.active && x.channel && x.altFunctionUse != 2 && x.HeldItem.type == ModContent.ItemType())) + { + timeRate *= 120; + } + } + } } diff --git a/Items/Tools/DriftwoodHammer.cs b/Items/Tools/DriftwoodHammer.cs index 2a1917c2e2..caf2f47cb7 100644 --- a/Items/Tools/DriftwoodHammer.cs +++ b/Items/Tools/DriftwoodHammer.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/FellerofEvergreens.cs b/Items/Tools/FellerofEvergreens.cs index 4d95f705b3..ed226d2ac1 100644 --- a/Items/Tools/FellerofEvergreens.cs +++ b/Items/Tools/FellerofEvergreens.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Tools { CreateRecipe(). AddRecipeGroup("AnySilverBar", 18). - AddRecipeGroup("Wood", 18). + AddIngredient(ItemID.RichMahogany, 18). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/Gelpick.cs b/Items/Tools/Gelpick.cs index 6b7fe5b12e..4146b16c6d 100644 --- a/Items/Tools/Gelpick.cs +++ b/Items/Tools/Gelpick.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Tools CreateRecipe(). AddIngredient(12). AddIngredient(12). - AddTile(). + AddTile(TileID.Solidifier). Register(); } diff --git a/Items/Tools/MonolithHammer.cs b/Items/Tools/MonolithHammer.cs index 4c30aa8ccb..0280dc5695 100644 --- a/Items/Tools/MonolithHammer.cs +++ b/Items/Tools/MonolithHammer.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Tools/WulfrumDiggingTurtle.cs b/Items/Tools/WulfrumDiggingTurtle.cs index 76181d9eeb..828c7d88a9 100644 --- a/Items/Tools/WulfrumDiggingTurtle.cs +++ b/Items/Tools/WulfrumDiggingTurtle.cs @@ -76,9 +76,9 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { - CreateRecipe(3). - AddIngredient(ItemID.Gel, 5). //Gel is a default combustible item to fuel the motors of the lil guys + CreateRecipe(15). AddIngredient(3). + AddIngredient(). Register(); } } diff --git a/Items/Tools/WulfrumDrill.cs b/Items/Tools/WulfrumDrill.cs index 0d829fad72..99ac145eee 100644 --- a/Items/Tools/WulfrumDrill.cs +++ b/Items/Tools/WulfrumDrill.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Tools public override void AddRecipes() { CreateRecipe(). - AddIngredient(8). + AddIngredient(5). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Tools/WulfrumTreasurePinger.cs b/Items/Tools/WulfrumTreasurePinger.cs index 165d179cd3..504ab951c3 100644 --- a/Items/Tools/WulfrumTreasurePinger.cs +++ b/Items/Tools/WulfrumTreasurePinger.cs @@ -281,7 +281,7 @@ namespace CalamityMod.Items.Tools { //Intentionally craftable anywhere. CreateRecipe(). - AddIngredient(6). + AddIngredient(5). Register() .DisableDecraft(); } diff --git a/Items/TreasureBags/BrimstoneWaifuBag.cs b/Items/TreasureBags/BrimstoneElementalBag.cs similarity index 94% rename from Items/TreasureBags/BrimstoneWaifuBag.cs rename to Items/TreasureBags/BrimstoneElementalBag.cs index 4b68c1a252..b56c93b350 100644 --- a/Items/TreasureBags/BrimstoneWaifuBag.cs +++ b/Items/TreasureBags/BrimstoneElementalBag.cs @@ -19,7 +19,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.TreasureBags { - public class BrimstoneWaifuBag : ModItem, ILocalizedModType + [LegacyName("BrimstoneWaifuBag")] + public class BrimstoneElementalBag : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.TreasureBags"; public override void SetStaticDefaults() @@ -80,7 +81,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.AddRevBagAccessories(); // Vanity - itemLoot.Add(ModContent.ItemType(), 7); + itemLoot.Add(ModContent.ItemType(), 7); itemLoot.Add(ModContent.ItemType(), ThankYouPainting.DropInt); itemLoot.AddIf(() => CalamityWorld.revenge, ModContent.ItemType()); } diff --git a/Items/TreasureBags/BrimstoneWaifuBag.png b/Items/TreasureBags/BrimstoneElementalBag.png similarity index 100% rename from Items/TreasureBags/BrimstoneWaifuBag.png rename to Items/TreasureBags/BrimstoneElementalBag.png diff --git a/Items/TreasureBags/CalamitasCloneBag.cs b/Items/TreasureBags/CalamitasCloneBag.cs index 08b9c7558d..492019a90b 100644 --- a/Items/TreasureBags/CalamitasCloneBag.cs +++ b/Items/TreasureBags/CalamitasCloneBag.cs @@ -72,8 +72,8 @@ namespace CalamityMod.Items.TreasureBags // Equipment itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); + itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); itemLoot.Add(ModContent.ItemType()); - itemLoot.Add(ModContent.ItemType(), 10); itemLoot.AddRevBagAccessories(); // Vanity diff --git a/Items/TreasureBags/DevourerofGodsBag.cs b/Items/TreasureBags/DevourerofGodsBag.cs index 3a2e4aefee..b4cd2b50d9 100644 --- a/Items/TreasureBags/DevourerofGodsBag.cs +++ b/Items/TreasureBags/DevourerofGodsBag.cs @@ -84,7 +84,6 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType() })); itemLoot.Add(ModContent.ItemType(), 10); - itemLoot.Add(ModContent.ItemType(), 10); // Equipment itemLoot.Add(ModContent.ItemType()); diff --git a/Items/TreasureBags/DragonfollyBag.cs b/Items/TreasureBags/DragonfollyBag.cs index bdbc785757..8a516b2381 100644 --- a/Items/TreasureBags/DragonfollyBag.cs +++ b/Items/TreasureBags/DragonfollyBag.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Items.TreasureBags public override void ModifyItemLoot(ItemLoot itemLoot) { // Money - itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); + itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials itemLoot.Add(ModContent.ItemType(), 1, 30, 35); @@ -69,7 +69,6 @@ namespace CalamityMod.Items.TreasureBags ModContent.ItemType(), ModContent.ItemType() })); - itemLoot.Add(ModContent.ItemType(), 10); // Equipment itemLoot.Add(ModContent.ItemType(), DropHelper.BagWeaponDropRateFraction); diff --git a/Items/TreasureBags/HiveMindBag.cs b/Items/TreasureBags/HiveMindBag.cs index 22c3df8060..bff6d42bfc 100644 --- a/Items/TreasureBags/HiveMindBag.cs +++ b/Items/TreasureBags/HiveMindBag.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 30, 40); itemLoot.Add(ItemID.DemoniteBar, 1, 15, 20); itemLoot.Add(ItemID.RottenChunk, 1, 15, 20); itemLoot.AddIf(() => Main.hardMode, ItemID.CursedFlame, 1, 25, 30); diff --git a/Items/TreasureBags/MiscGrabBags/StarterBag.cs b/Items/TreasureBags/MiscGrabBags/StarterBag.cs index 0398fbda0c..e121905f8a 100644 --- a/Items/TreasureBags/MiscGrabBags/StarterBag.cs +++ b/Items/TreasureBags/MiscGrabBags/StarterBag.cs @@ -49,19 +49,15 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags // Tools and Utility Items tin.Add(ItemID.TinHammer); tin.OnFailedConditions(new CommonDrop(ItemID.CopperHammer, 1)); - itemLoot.Add(ItemID.Bomb, 1, 10, 10); itemLoot.Add(ItemID.Rope, 1, 50, 50); // Potions LeadingConditionRule multiplayer = itemLoot.DefineConditionalDropSet(() => Main.netMode == NetmodeID.MultiplayerClient); - itemLoot.Add(ItemID.MiningPotion, 1, 3, 3); - itemLoot.Add(ItemID.SpelunkerPotion, 1, 3, 3); itemLoot.Add(ItemID.RecallPotion, 1, 3, 3); multiplayer.Add(ItemID.WormholePotion, 1, 3, 3); // Tiles itemLoot.Add(ItemID.Torch, 1, 25, 25); - itemLoot.Add(ItemID.Chest, 1, 3, 3); // Calamity title theme music box (if music mod is enabled) Mod musicMod = ExternalMods.musicMod; @@ -146,16 +142,6 @@ namespace CalamityMod.Items.TreasureBags.MiscGrabBags } itemLoot.AddIf(getsOracleHeadphones, ModContent.ItemType()); - - // Fabsol dev item - // Name specific: "Fabsol" or "Cirrus" - static bool getsCrystalHeartVodka(DropAttemptInfo info) - { - string playerName = info.player.name; - return playerName is "Fabsol" or "Cirrus"; - } - - itemLoot.AddIf(getsCrystalHeartVodka, ModContent.ItemType()); } } } diff --git a/Items/TreasureBags/PerforatorBag.cs b/Items/TreasureBags/PerforatorBag.cs index cec78d95d9..d1a2b58520 100644 --- a/Items/TreasureBags/PerforatorBag.cs +++ b/Items/TreasureBags/PerforatorBag.cs @@ -60,7 +60,6 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ItemDropRule.CoinsBasedOnNPCValue(ModContent.NPCType())); // Materials - itemLoot.Add(ModContent.ItemType(), 1, 30, 40); itemLoot.Add(ItemID.CrimtaneBar, 1, 15, 20); itemLoot.Add(ItemID.Vertebrae, 1, 15, 20); itemLoot.AddIf(() => Main.hardMode, ItemID.Ichor, 1, 25, 30); diff --git a/Items/TreasureBags/PlaguebringerGoliathBag.cs b/Items/TreasureBags/PlaguebringerGoliathBag.cs index 45f42511a1..c4f16b5b5c 100644 --- a/Items/TreasureBags/PlaguebringerGoliathBag.cs +++ b/Items/TreasureBags/PlaguebringerGoliathBag.cs @@ -67,8 +67,8 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(DropHelper.CalamityStyle(DropHelper.BagWeaponDropRateFraction, new int[] { ModContent.ItemType(), - ModContent.ItemType(), ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), diff --git a/Items/TreasureBags/YharonBag.cs b/Items/TreasureBags/YharonBag.cs index 5af40c3c7c..60ec10a868 100644 --- a/Items/TreasureBags/YharonBag.cs +++ b/Items/TreasureBags/YharonBag.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Items.TreasureBags itemLoot.Add(ModContent.ItemType(), 10); // Equipment - itemLoot.Add(ModContent.ItemType()); + itemLoot.Add(ModContent.ItemType()); itemLoot.Add(ModContent.ItemType()); itemLoot.AddRevBagAccessories(); diff --git a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs index 97b89059ef..43c6867f92 100644 --- a/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs +++ b/Items/VanillaArmorChanges/AdamantiteArmorSetChange.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Adamantite"; public const int MaxManaBoost = 20; - public const int DefenseBoostMax = 15; + public const int DefenseBoostMax = 10; public const int TimeUntilDecayBeginsAfterAttacking = 60; public const int TimeUntilBoostCompletelyDecays = 210; diff --git a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs b/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs deleted file mode 100644 index 478e6ceca6..0000000000 --- a/Items/VanillaArmorChanges/ChlorophyteArmorSetChange.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Terraria.ID; - -namespace CalamityMod.Items.VanillaArmorChanges -{ - public class ChlorophyteArmorSetChange : VanillaArmorChange - { - public override int? HeadPieceID => ItemID.ChlorophyteHeadgear; - - public override int? BodyPieceID => ItemID.ChlorophytePlateMail; - - public override int? LegPieceID => ItemID.ChlorophyteGreaves; - - public override int[] AlternativeHeadPieceIDs => new int[] { ItemID.ChlorophyteMask, ItemID.ChlorophyteHelmet }; - - public override string ArmorSetName => "Chlorophyte"; - - public const int AmountToHealPerPulse = 5; - - public const int PulseReleaseRate = 300; - - public const int DelayBetweenHeals = 270; - - public const int BaseDamageToEnemies = 250; - - public override void UpdateSetBonusText(ref string setBonusText) - { - setBonusText = $"{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(PulseReleaseRate / 60f, BaseDamageToEnemies, AmountToHealPerPulse, DelayBetweenHeals / 60f)}"; - } - } -} diff --git a/Items/VanillaArmorChanges/CopperArmorSetChange.cs b/Items/VanillaArmorChanges/CopperArmorSetChange.cs index fbf35b1549..6f4d3ea46a 100644 --- a/Items/VanillaArmorChanges/CopperArmorSetChange.cs +++ b/Items/VanillaArmorChanges/CopperArmorSetChange.cs @@ -1,5 +1,4 @@ -using System.Text; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,20 +14,11 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Copper"; - public const float HeadDamage = 0.05f; - public const float ChestCrit = 3f; - public const float LegsMoveSpeed = 0.05f; public const float SetBonusFlatDamage = 2.0f; - public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; - - public override void ApplyBodyPieceEffect(Player player) => player.GetCritChance() += ChestCrit; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; - public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SetBonusFlatDamage.ToString("N0"))}"; } public override void ApplyArmorSetBonus(Player player) diff --git a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs index 94f7ed96f4..2226f8afe5 100644 --- a/Items/VanillaArmorChanges/EskimoArmorSetChange.cs +++ b/Items/VanillaArmorChanges/EskimoArmorSetChange.cs @@ -30,9 +30,9 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { player.Calamity().eskimoSet = true; + player.Calamity().ColdDebuffMultiplier += 0.25f; player.buffImmune[BuffID.Frostburn] = true; - player.buffImmune[ModContent.BuffType()] = true; } } } diff --git a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs index d1ebc8a41b..93c2886fbf 100644 --- a/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GladiatorArmorSetChange.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.VanillaArmorChanges player.Calamity().wearingRogueArmor = true; player.GetDamage() += 0.05f; player.Calamity().rogueVelocity += 0.1f; - player.statDefense += 3; } } } diff --git a/Items/VanillaArmorChanges/GoldArmorSetChange.cs b/Items/VanillaArmorChanges/GoldArmorSetChange.cs index fbb7771b69..9b34eb9fc9 100644 --- a/Items/VanillaArmorChanges/GoldArmorSetChange.cs +++ b/Items/VanillaArmorChanges/GoldArmorSetChange.cs @@ -17,23 +17,14 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Gold"; - public const float HeadDamage = 0.05f; - public const float ChestDR = 0.05f; - public const float LegsMoveSpeed = 0.1f; public const float GoldDropChanceFromEnemies = 0.02f; public const int GoldFromBosses = 3; - public const float SetBonusCritPerGoldCoin = 0.1f; // 10 gold coins = +1% crit chance - public const float MaximumCritBonus = 7f; - - public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; - - public override void ApplyBodyPieceEffect(Player player) => player.endurance += ChestDR; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; + public const float SetBonusCritPerGoldCoin = 0.2f; // 5 gold coins = +1% crit chance + public const float MaximumCritBonus = 5f; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(GoldDropChanceFromEnemies.ToPercent(), GoldFromBosses, SetBonusCritPerGoldCoin, MaximumCritBonus)}"; } public override void ApplyArmorSetBonus(Player player) diff --git a/Items/VanillaArmorChanges/IronArmorSetChange.cs b/Items/VanillaArmorChanges/IronArmorSetChange.cs index ea739abcf5..3906498ffb 100644 --- a/Items/VanillaArmorChanges/IronArmorSetChange.cs +++ b/Items/VanillaArmorChanges/IronArmorSetChange.cs @@ -1,6 +1,6 @@ -using System.Text; -using Terraria; +using Terraria; using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.VanillaArmorChanges { @@ -16,25 +16,16 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Iron"; - public const float ArmorPieceDR = 0.03f; - public const float SetBonusDR = 0.06f; - public const int SetBonusLifeRegen = 2; - - public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; - - public override void ApplyBodyPieceEffect(Player player) => player.endurance += ArmorPieceDR; - - public override void ApplyLegPieceEffect(Player player) => player.endurance += ArmorPieceDR; + public const float KnockbackMultiplier = 1.5f; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(KnockbackMultiplier)}"; } public override void ApplyArmorSetBonus(Player player) { - player.endurance += SetBonusDR; - player.lifeRegen += SetBonusLifeRegen; + player.GetKnockback() *= KnockbackMultiplier; } } } diff --git a/Items/VanillaArmorChanges/LeadArmorSetChange.cs b/Items/VanillaArmorChanges/LeadArmorSetChange.cs index 4fc7541f41..07dfe7c7e6 100644 --- a/Items/VanillaArmorChanges/LeadArmorSetChange.cs +++ b/Items/VanillaArmorChanges/LeadArmorSetChange.cs @@ -13,16 +13,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Lead"; - public const float ArmorPieceDR = 0.02f; - public const float SetBonusDR = 0.04f; - public const int SetBonusLifeRegen = 1; - - public override void ApplyHeadPieceEffect(Player player) => player.endurance += ArmorPieceDR; - - public override void ApplyBodyPieceEffect(Player player) => player.endurance += ArmorPieceDR; - - public override void ApplyLegPieceEffect(Player player) => player.endurance += ArmorPieceDR; - public override void UpdateSetBonusText(ref string setBonusText) { setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; @@ -30,8 +20,6 @@ namespace CalamityMod.Items.VanillaArmorChanges public override void ApplyArmorSetBonus(Player player) { - player.endurance += SetBonusDR; - player.lifeRegen += SetBonusLifeRegen; player.noKnockback = true; } } diff --git a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs index 18fee450a0..ace816e610 100644 --- a/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs +++ b/Items/VanillaArmorChanges/PlatinumArmorSetChange.cs @@ -1,7 +1,5 @@ -using System; -using Terraria; +using Terraria; using Terraria.ID; -using Terraria.ModLoader; namespace CalamityMod.Items.VanillaArmorChanges { @@ -15,34 +13,16 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Platinum"; - public const float HeadDamage = 0.06f; - public const float ChestCrit = 3f; - public const float LegsMoveSpeed = 0.1f; - public const float SetBonusDamagePerDefense = 0.1f; // 10 defense = +1% damage, this gets divided by 100 - public const int SetBonusDefenseCap = 50; - - public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; - - public override void ApplyBodyPieceEffect(Player player) => player.GetCritChance() += ChestCrit; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; + public const float SetBonusDR = 0.1f; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SetBonusDR.ToPercent())}"; } public override void ApplyArmorSetBonus(Player player) { - // 07MAY2024: Ozzatron: Platinum armor doesn't count its own defense for its set bonus - // CIT 1MAR2025: Platinum armor should not count its set bonus defense here, because it hasn't been applied yet - int defenseBesidesThisArmor = player.statDefense - (5 + 6 + 5); - if (defenseBesidesThisArmor <= 0) - return; - - if (defenseBesidesThisArmor > SetBonusDefenseCap) - defenseBesidesThisArmor = SetBonusDefenseCap; - player.GetDamage() += (float)Math.Floor(defenseBesidesThisArmor * SetBonusDamagePerDefense) * 0.01f; + player.endurance += SetBonusDR; } } } diff --git a/Items/VanillaArmorChanges/SilverArmorSetChange.cs b/Items/VanillaArmorChanges/SilverArmorSetChange.cs index 9c9bc580e9..05372ca492 100644 --- a/Items/VanillaArmorChanges/SilverArmorSetChange.cs +++ b/Items/VanillaArmorChanges/SilverArmorSetChange.cs @@ -16,29 +16,17 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Silver"; - public const float HeadCrit = 5f; - public const int ChestLifeRegen = 2; - public const float LegsMoveSpeed = 0.08f; - public const int SetBonusLifeRegen = 1; - public const double SetBonusMinimumDamageToHeal = 20.0; public const int SetBonusHealTime = 120; public const int SetBonusHealAmount = 10; - public override void ApplyHeadPieceEffect(Player player) => player.GetCritChance() += HeadCrit; - - public override void ApplyBodyPieceEffect(Player player) => player.lifeRegen += ChestLifeRegen; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; - public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SetBonusHealTime.FramesToSeconds(), SetBonusMinimumDamageToHeal.ToString("N0"), SetBonusHealAmount)}"; } public override void ApplyArmorSetBonus(Player player) { - player.lifeRegen += SetBonusLifeRegen; player.Calamity().silverMedkit = true; } diff --git a/Items/VanillaArmorChanges/TinArmorSetChange.cs b/Items/VanillaArmorChanges/TinArmorSetChange.cs index 12a2c7f88e..a46b8b9f21 100644 --- a/Items/VanillaArmorChanges/TinArmorSetChange.cs +++ b/Items/VanillaArmorChanges/TinArmorSetChange.cs @@ -1,5 +1,4 @@ -using System.Text; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -15,25 +14,16 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Tin"; - public const float HeadCrit = 4f; - public const int ChestLifeRegen = 1; - public const float LegsMoveSpeed = 0.05f; - public const float SetBonusArmorPen = 5.0f; - - public override void ApplyHeadPieceEffect(Player player) => player.GetCritChance() += HeadCrit; - - public override void ApplyBodyPieceEffect(Player player) => player.lifeRegen += ChestLifeRegen; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; + public const float SetBonusCrit = 10f; public override void UpdateSetBonusText(ref string setBonusText) { - setBonusText += $"\n{CalamityUtils.GetTextValue($"Vanilla.Armor.SetBonus.{ArmorSetName}")}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(SetBonusCrit)}"; } public override void ApplyArmorSetBonus(Player player) { - player.GetArmorPenetration() += SetBonusArmorPen; + player.GetCritChance() += SetBonusCrit; } } } diff --git a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs index 50c4be4121..fc4a333b7e 100644 --- a/Items/VanillaArmorChanges/TungstenArmorSetChange.cs +++ b/Items/VanillaArmorChanges/TungstenArmorSetChange.cs @@ -1,6 +1,4 @@ -using System.Text; -using Microsoft.Xna.Framework; -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -16,37 +14,16 @@ namespace CalamityMod.Items.VanillaArmorChanges public override string ArmorSetName => "Tungsten"; - public const float HeadDamage = 0.07f; - public const int ChestLifeRegen = 1; - public const float LegsMoveSpeed = 0.08f; - public const float KnockbackMultiplier = 1.33f; - public const float MaxKnockbackCritConversion = 10f; - - public override void ApplyHeadPieceEffect(Player player) => player.GetDamage() += HeadDamage; - - public override void ApplyBodyPieceEffect(Player player) => player.lifeRegen += ChestLifeRegen; - - public override void ApplyLegPieceEffect(Player player) => player.moveSpeed += LegsMoveSpeed; + public const float HookBoost = 0.5f; public override void UpdateSetBonusText(ref string setBonusText) { - Player player = Main.LocalPlayer; - float kb = player.GetWeaponKnockback(player.ActiveItem()); - float bonus = MathHelper.Clamp(kb, 0f, MaxKnockbackCritConversion); - - string bonusText = bonus.ToString("n2"); - string kbText = kb.ToString("n2"); - setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(bonusText, kbText)}"; + setBonusText += $"\n{CalamityUtils.GetText($"Vanilla.Armor.SetBonus.{ArmorSetName}").Format(HookBoost.ToPercent())}"; } public override void ApplyArmorSetBonus(Player player) { - // Apply the 33% knockback boost first, so it applies to the following crit boost - player.GetKnockback() *= KnockbackMultiplier; - - // Give the player crit chance equal to the (now boosted) knockback of their held weapon. - float kbToUse = player.GetWeaponKnockback(player.ActiveItem()); - player.GetCritChance() += MathHelper.Clamp(kbToUse, 0f, MaxKnockbackCritConversion); + player.Calamity().tungstenArmorHookBoost = true; } } } diff --git a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs similarity index 69% rename from Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs rename to Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs index 15fda0cf58..8ab0339f1c 100644 --- a/Items/Weapons/DraedonsArsenal/StarSwallowerContainmentUnit.cs +++ b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.cs @@ -6,23 +6,29 @@ using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.DraedonsArsenal; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { - public class StarSwallowerContainmentUnit : ModItem, ILocalizedModType + public class AqueousHunterDrone : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/ShrimpFire"); + public static readonly SoundStyle Hit = new("CalamityMod/Sounds/Item/ShrimpMissileHit"); + public static readonly SoundStyle Sound1 = new("CalamityMod/Sounds/Item/ShrimpSound1"); + public static readonly SoundStyle Sound2 = new("CalamityMod/Sounds/Item/ShrimpSound2"); + public static readonly SoundStyle Surprise = new("CalamityMod/Sounds/Item/ShrimpSurprise"); public override void SetDefaults() { CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 18; - Item.height = 28; + Item.width = 34; + Item.height = 32; Item.shootSpeed = 10f; - Item.damage = 24; + Item.damage = 30; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.HoldUp; @@ -30,33 +36,25 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 2.25f; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item15; Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.8f; - modItem.ChargePerAltUse = 0f; } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).HasTile) { - int p = Projectile.NewProjectile(source, mouse, Vector2.Zero, type, damage, knockback, player.whoAmI); + int p = Projectile.NewProjectile(source, new Vector2(mouse.X, player.Center.Y - 600), Vector2.Zero, type, damage, knockback, player.whoAmI); + Main.projectile[p].localAI[2] = player.ownedProjectileCounts[Item.shoot]; if (Main.projectile.IndexInRange(p)) Main.projectile[p].originalDamage = Item.damage; } return false; } - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png new file mode 100644 index 0000000000..4c5c16cd38 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDrone.png differ diff --git a/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png new file mode 100644 index 0000000000..b069a6dde7 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AqueousHunterDroneGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/Auger.cs b/Items/Weapons/DraedonsArsenal/Auger.cs new file mode 100644 index 0000000000..6f20e1189a --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/Auger.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + public class Auger : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetDefaults() + { + Item.width = 26; + Item.height = 26; + Item.damage = 68; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useTime = Item.useAnimation = 12; + Item.knockBack = 12f; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/AugerGlow").Value); + } + public override bool MeleePrefix() => true; + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float swordType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + swordType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, swordType); + + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(5). + AddIngredient(7). + AddIngredient(4). + AddIngredient(7). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(1, out Func condition), condition). + AddTile(TileID.Anvils). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/Auger.png b/Items/Weapons/DraedonsArsenal/Auger.png new file mode 100644 index 0000000000..deb4092662 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/Auger.png differ diff --git a/Items/Weapons/DraedonsArsenal/AugerGlow.png b/Items/Weapons/DraedonsArsenal/AugerGlow.png new file mode 100644 index 0000000000..5c8a5771a1 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/AugerGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/CountermeasureMitt.cs b/Items/Weapons/DraedonsArsenal/CountermeasureMitt.cs new file mode 100644 index 0000000000..f364289272 --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/CountermeasureMitt.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + [LegacyName("GatlingLaser")] + public class CountermeasureMitt : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetDefaults() + { + CalamityGlobalItem modItem = Item.Calamity(); + + Item.width = 54; + Item.height = 56; + Item.DamageType = DamageClass.Magic; + Item.mana = 3; + Item.damage = 45; + Item.knockBack = 4f; + Item.useAnimation = Item.useTime = 11; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 24f; + } + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/CountermeasureMittGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(15). + AddIngredient(15). + AddIngredient(5). + AddIngredient(10). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/CountermeasureMitt.png b/Items/Weapons/DraedonsArsenal/CountermeasureMitt.png new file mode 100644 index 0000000000..ea23481c15 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/CountermeasureMitt.png differ diff --git a/Items/Weapons/DraedonsArsenal/CountermeasureMittGlow.png b/Items/Weapons/DraedonsArsenal/CountermeasureMittGlow.png new file mode 100644 index 0000000000..3c119c3088 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/CountermeasureMittGlow.png differ diff --git a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs b/Items/Weapons/DraedonsArsenal/GatlingLaser.cs deleted file mode 100644 index 17fb58acf7..0000000000 --- a/Items/Weapons/DraedonsArsenal/GatlingLaser.cs +++ /dev/null @@ -1,74 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.DraedonsArsenal; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class GatlingLaser : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/GatlingLaserFireStart"); - public static readonly SoundStyle FireLoopSound = new("CalamityMod/Sounds/Item/GatlingLaserFireLoop"); - public static readonly SoundStyle FireEndSound = new("CalamityMod/Sounds/Item/GatlingLaserFireEnd"); - - - // This is the amount of charge consumed every time the holdout projectile fires a laser. - public const float HoldoutChargeUse = 0.0075f; - - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 43; - Item.height = 24; - Item.DamageType = DamageClass.Magic; - Item.damage = 43; - Item.knockBack = 1f; - Item.useTime = 2; - Item.useAnimation = 2; - Item.noUseGraphic = true; - Item.autoReuse = false; - Item.channel = true; - Item.mana = 4; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = FireSound; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 24f; - - modItem.UsesCharge = true; - modItem.MaxCharge = 135f; - modItem.ChargePerUse = 0f; // This weapon is a holdout. Charge is consumed by the holdout projectile. - } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 3); - - public override Vector2? HoldoutOffset() => new Vector2(-20, 0); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(15). - AddIngredient(15). - AddIngredient(5). - AddIngredient(10). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(3, out Func condition), condition). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.cs b/Items/Weapons/DraedonsArsenal/GaussDagger.cs deleted file mode 100644 index e8e51a0954..0000000000 --- a/Items/Weapons/DraedonsArsenal/GaussDagger.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Projectiles.DraedonsArsenal; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class GaussDagger : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 26; - Item.height = 26; - Item.damage = 25; - Item.DamageType = DamageClass.Melee; - Item.useTime = 24; - Item.useAnimation = 24; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.knockBack = 7f; - - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; - Item.rare = ItemRarityID.Orange; - - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - - modItem.UsesCharge = true; - modItem.MaxCharge = 50f; - modItem.ChargePerUse = 0.05f; - } - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 1); - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (target.Calamity().GaussFluxTimer == 0) - { - target.Calamity().GaussFluxTimer = 50; - if (player.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(player.GetSource_ItemUse(Item), target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, 0f, player.whoAmI, 0f, target.whoAmI); - } - } - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(5). - AddIngredient(7). - AddIngredient(4). - AddIngredient(7). - AddTile(TileID.Anvils). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/GaussDagger.png b/Items/Weapons/DraedonsArsenal/GaussDagger.png deleted file mode 100644 index 77ac1dfc11..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/GaussDagger.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.cs b/Items/Weapons/DraedonsArsenal/GaussPistol.cs deleted file mode 100644 index 445df79e74..0000000000 --- a/Items/Weapons/DraedonsArsenal/GaussPistol.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CustomRecipes; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Sounds; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.DraedonsArsenal -{ - public class GaussPistol : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; - public override void SetDefaults() - { - CalamityGlobalItem modItem = Item.Calamity(); - - Item.width = 40; - Item.height = 22; - Item.DamageType = DamageClass.Magic; - Item.mana = 6; - Item.damage = 150; - Item.knockBack = 11f; - Item.useAnimation = Item.useTime = 20; - Item.autoReuse = true; - - Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = CommonCalamitySounds.GaussWeaponFire; - Item.noMelee = true; - - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 14f; - - modItem.MaxCharge = 85f; - modItem.UsesCharge = true; - modItem.ChargePerUse = 0.05f; - } - - public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(12). - AddIngredient(8). - AddRecipeGroup("AnyMythrilBar", 10). - AddIngredient(ItemID.SoulofMight, 20). - AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/DraedonsArsenal/GaussPistol.png b/Items/Weapons/DraedonsArsenal/GaussPistol.png deleted file mode 100644 index d68e739419..0000000000 Binary files a/Items/Weapons/DraedonsArsenal/GaussPistol.png and /dev/null differ diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs b/Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs similarity index 92% rename from Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs rename to Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs index a260077562..50f7d1ee74 100644 --- a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.cs +++ b/Items/Weapons/DraedonsArsenal/HolofibreImmolator.cs @@ -14,7 +14,7 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.DraedonsArsenal { [LegacyName("MatterModulator")] - public class HolofiberImmolator : ModItem, ILocalizedModType + public class HolofibreImmolator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; public static readonly SoundStyle PlasmaSound = new("CalamityMod/Sounds/Item/PlasmaSmall"); @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -48,11 +48,11 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow").Value); + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofibreImmolatorGlow").Value); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, 1); holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); return false; } diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolator.png b/Items/Weapons/DraedonsArsenal/HolofibreImmolator.png similarity index 100% rename from Items/Weapons/DraedonsArsenal/HolofiberImmolator.png rename to Items/Weapons/DraedonsArsenal/HolofibreImmolator.png diff --git a/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png b/Items/Weapons/DraedonsArsenal/HolofibreImmolatorGlow.png similarity index 100% rename from Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow.png rename to Items/Weapons/DraedonsArsenal/HolofibreImmolatorGlow.png diff --git a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs index d177e4d0b0..b3ebf087f6 100644 --- a/Items/Weapons/DraedonsArsenal/Phaseslayer.cs +++ b/Items/Weapons/DraedonsArsenal/Phaseslayer.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs index 1a3f98583d..97d941da05 100644 --- a/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs +++ b/Items/Weapons/DraedonsArsenal/PlasmaGrenade.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 22; Item.height = 28; - Item.damage = 950; + Item.damage = 860; Item.noMelee = true; Item.noUseGraphic = true; Item.consumable = false; @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; @@ -45,10 +45,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.UsesCharge = true; modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.25f; + modItem.ChargePerUse = 0.2f; } - public override float StealthDamageMultiplier => 0.90f; public override float StealthVelocityMultiplier => 1.2f; public override float StealthKnockbackMultiplier => 1.5f; diff --git a/Items/Weapons/DraedonsArsenal/PoleWarper.cs b/Items/Weapons/DraedonsArsenal/PoleWarper.cs index 5c2902b993..20059b8056 100644 --- a/Items/Weapons/DraedonsArsenal/PoleWarper.cs +++ b/Items/Weapons/DraedonsArsenal/PoleWarper.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 38; Item.height = 24; Item.shootSpeed = 10f; - Item.damage = 310; + Item.damage = 207; Item.mana = 12; Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item15; Item.autoReuse = true; @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal modItem.UsesCharge = true; modItem.MaxCharge = 250f; - modItem.ChargePerUse = 1.25f; + modItem.ChargePerUse = 1f; modItem.ChargePerAltUse = 0f; } diff --git a/Items/Weapons/DraedonsArsenal/PulsePistol.cs b/Items/Weapons/DraedonsArsenal/PulsePistol.cs index afd9ba1dd8..955d04c411 100644 --- a/Items/Weapons/DraedonsArsenal/PulsePistol.cs +++ b/Items/Weapons/DraedonsArsenal/PulsePistol.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 8.2f; + Item.shootSpeed = 8f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/DraedonsArsenal/PulseRifle.cs b/Items/Weapons/DraedonsArsenal/PulseRifle.cs index 0f0ad89be9..c094d022d0 100644 --- a/Items/Weapons/DraedonsArsenal/PulseRifle.cs +++ b/Items/Weapons/DraedonsArsenal/PulseRifle.cs @@ -23,12 +23,10 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal public override void SetDefaults() { - CalamityGlobalItem modItem = Item.Calamity(); - Item.width = 100; Item.height = 32; Item.DamageType = DamageClass.Ranged; - Item.damage = 720; + Item.damage = 530; Item.useAnimation = Item.useTime = 55; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); @@ -40,7 +38,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs index 1388f7623a..97c516d6de 100644 --- a/Items/Weapons/DraedonsArsenal/TeslaCannon.cs +++ b/Items/Weapons/DraedonsArsenal/TeslaCannon.cs @@ -26,10 +26,9 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 78; Item.height = 28; Item.DamageType = DamageClass.Magic; - Item.damage = 1220; + Item.damage = 1200; Item.knockBack = 10f; - Item.useTime = 90; - Item.useAnimation = 90; + Item.useTime = Item.useAnimation = 90; Item.autoReuse = true; Item.mana = 60; @@ -38,14 +37,14 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; modItem.UsesCharge = true; modItem.MaxCharge = 250f; - modItem.ChargePerUse = 0.75f; + modItem.ChargePerUse = 0.7f; } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) diff --git a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs index 475c24e69e..951f3372b0 100644 --- a/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs +++ b/Items/Weapons/DraedonsArsenal/TheAnomalysNanogun.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.width = 102; Item.height = 44; - Item.damage = 1675; + Item.damage = 1600; Item.knockBack = 4.5f; Item.useAnimation = Item.useTime = AnomalysNanogunHoldout.PlasmaFireTimer; Item.shootSpeed = 5f; @@ -40,7 +40,7 @@ namespace CalamityMod.Items.Weapons.DraedonsArsenal Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); modItem.donorItem = true; modItem.UsesCharge = true; diff --git a/Items/Weapons/DraedonsArsenal/Vulcan.cs b/Items/Weapons/DraedonsArsenal/Vulcan.cs new file mode 100644 index 0000000000..5c7a7f9f4f --- /dev/null +++ b/Items/Weapons/DraedonsArsenal/Vulcan.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using CalamityMod.CustomRecipes; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.DraedonsArsenal; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.DraedonsArsenal +{ + [LegacyName("GaussPistol")] + public class Vulcan : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.DraedonsArsenal"; + public override void SetDefaults() + { + Item.width = 28; + Item.height = 34; + Item.DamageType = DamageClass.Magic; + Item.mana = 11; + Item.damage = 40; + Item.knockBack = 11f; + Item.useAnimation = Item.useTime = 11; + Item.autoReuse = true; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; + + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 14f; + } + + public override void ModifyTooltips(List tooltips) => CalamityGlobalItem.InsertKnowledgeTooltip(tooltips, 2); + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) => true; + public override void HoldItem(Player player) + { + if (Main.myPlayer == player.whoAmI) + player.Calamity().rightClickListener = true; + player.Calamity().mouseWorldListener = true; + } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/VulcanGlow").Value); + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + float gunType = 0; + if (player.Calamity().mouseRight && player.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && player.Calamity().arsenalCooldown <= 0) + gunType = 5; + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, gunType); + + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + return false; + } + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(12). + AddIngredient(8). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.SoulofMight, 20). + AddCondition(ArsenalTierGatedRecipe.ConstructRecipeCondition(2, out Func condition), condition). + AddTile(TileID.MythrilAnvil). + Register(); + } + } +} diff --git a/Items/Weapons/DraedonsArsenal/Vulcan.png b/Items/Weapons/DraedonsArsenal/Vulcan.png new file mode 100644 index 0000000000..975227e30f Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/Vulcan.png differ diff --git a/Items/Weapons/DraedonsArsenal/VulcanGlow.png b/Items/Weapons/DraedonsArsenal/VulcanGlow.png new file mode 100644 index 0000000000..8a4e160b58 Binary files /dev/null and b/Items/Weapons/DraedonsArsenal/VulcanGlow.png differ diff --git a/Items/Weapons/Magic/AbyssalTome.cs b/Items/Weapons/Magic/AbyssalTome.cs index 12edcf818c..005898e5f7 100644 --- a/Items/Weapons/Magic/AbyssalTome.cs +++ b/Items/Weapons/Magic/AbyssalTome.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.SlimeGod; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs.SlimeGod; using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Magic public class AbyssalTome : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/AcidGun.cs b/Items/Weapons/Magic/AcidGun.cs index 1332539641..002238f231 100644 --- a/Items/Weapons/Magic/AcidGun.cs +++ b/Items/Weapons/Magic/AcidGun.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -63,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(35). - AddIngredient(10). + AddIngredient(15). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/AetherfluxCannon.cs b/Items/Weapons/Magic/AetherfluxCannon.cs index 77be95907f..7223d35dbe 100644 --- a/Items/Weapons/Magic/AetherfluxCannon.cs +++ b/Items/Weapons/Magic/AetherfluxCannon.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Magic/AlulaAustralis.cs b/Items/Weapons/Magic/AlulaAustralis.cs index 7211108bdf..a4f9a3b733 100644 --- a/Items/Weapons/Magic/AlulaAustralis.cs +++ b/Items/Weapons/Magic/AlulaAustralis.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -12,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/AnahitasArpeggio.cs b/Items/Weapons/Magic/AnahitasArpeggio.cs index 154e914af3..12687cad69 100644 --- a/Items/Weapons/Magic/AnahitasArpeggio.cs +++ b/Items/Weapons/Magic/AnahitasArpeggio.cs @@ -1,5 +1,7 @@ using System.Collections.Generic; using System.Linq; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -19,12 +21,15 @@ namespace CalamityMod.Items.Weapons.Magic public static readonly SoundStyle CapSound = new("CalamityMod/Sounds/Item/HarpLV6"); public static readonly SoundStyle EndSound = new("CalamityMod/Sounds/Item/HarpEnd"); public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/HarpNoteHit"); - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 56; Item.height = 50; - Item.damage = 127; + Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.useTime = 22; @@ -58,8 +63,8 @@ namespace CalamityMod.Items.Weapons.Magic if (nonReleasedMusicNotes >= musicNoteCap) { - Main.musicPitch = -0.5f; - SoundEngine.PlaySound(CapSound with { Volume = 0.8f }, player.Center); + if (!Main.zenithWorld) + SoundEngine.PlaySound(CapSound with { Volume = 0.8f }, player.Center); return false; } else diff --git a/Items/Weapons/Magic/ArcticBearPaw.cs b/Items/Weapons/Magic/ArcticBearPaw.cs index 467f1d0c4b..66ea5e090c 100644 --- a/Items/Weapons/Magic/ArcticBearPaw.cs +++ b/Items/Weapons/Magic/ArcticBearPaw.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 24; - Item.damage = 90; + Item.damage = 80; Item.DamageType = DamageClass.Magic; Item.mana = 18; Item.useTime = 28; diff --git a/Items/Weapons/Magic/AstralachneaStaff.cs b/Items/Weapons/Magic/AstralachneaStaff.cs index 8ffa9448aa..27113d25e3 100644 --- a/Items/Weapons/Magic/AstralachneaStaff.cs +++ b/Items/Weapons/Magic/AstralachneaStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 52; Item.height = 52; - Item.damage = 50; + Item.damage = 55; Item.DamageType = DamageClass.Magic; Item.mana = 19; Item.useTime = 21; @@ -39,38 +39,18 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - int i = Main.myPlayer; - float fangSpeed = Item.shootSpeed; float mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - int spikeAmount = 4; - if (Main.rand.NextBool(3)) - { - spikeAmount++; - } - if (Main.rand.NextBool(4)) - { - spikeAmount++; - } - if (Main.rand.NextBool(5)) - { - spikeAmount += 2; - } + + int spikeAmount = Main.rand.Next(3, 4+1); for (int j = 0; j < spikeAmount; j++) { - float fangSpawnX = mouseXDist; - float fangSpawnY = mouseYDist; - float offsetDampener = 0.05f * (float)j; - fangSpawnX += (float)Main.rand.Next(-400, 400) * offsetDampener; - fangSpawnY += (float)Main.rand.Next(-400, 400) * offsetDampener; - float fangDistance = (float)Math.Sqrt((double)(fangSpawnX * fangSpawnX + fangSpawnY * fangSpawnY)); - fangDistance = fangSpeed / fangDistance; - fangSpawnX *= fangDistance; - fangSpawnY *= fangDistance; - float x2 = realPlayerPos.X; - float y2 = realPlayerPos.Y; - Projectile.NewProjectile(source, x2, y2, fangSpawnX, fangSpawnY, ModContent.ProjectileType(), damage, knockback, i, 0f, 0f); + Vector2 fangSpawn = new Vector2(mouseXDist, mouseYDist); + fangSpawn.X += Main.rand.NextFloat(-20f, 20f) * j; + fangSpawn.Y += Main.rand.NextFloat(-20f, 20f) * j; + fangSpawn = fangSpawn.SafeNormalize(Vector2.UnitX) * Item.shootSpeed; + + Projectile.NewProjectile(source, realPlayerPos, fangSpawn, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 0f); } return false; } diff --git a/Items/Weapons/Magic/Atlantis.cs b/Items/Weapons/Magic/Atlantis.cs index ffa9afe85a..9a3d1edf4d 100644 --- a/Items/Weapons/Magic/Atlantis.cs +++ b/Items/Weapons/Magic/Atlantis.cs @@ -7,6 +7,7 @@ using CalamityMod.Particles; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Items.Weapons.Summon; namespace CalamityMod.Items.Weapons.Magic { @@ -16,13 +17,14 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { Item.width = 28; Item.height = 30; - Item.damage = 88; + Item.damage = 81; Item.DamageType = DamageClass.Magic; Item.mana = 12; Item.useTime = 25; diff --git a/Items/Weapons/Magic/BloodBath.cs b/Items/Weapons/Magic/BloodBath.cs index 5bdcb4e06f..b5e7b46e52 100644 --- a/Items/Weapons/Magic/BloodBath.cs +++ b/Items/Weapons/Magic/BloodBath.cs @@ -1,5 +1,7 @@ using System; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -90,15 +93,5 @@ namespace CalamityMod.Items.Weapons.Magic } return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 3). - AddIngredient(9). - AddIngredient(ItemID.Vertebrae, 3). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Magic/DeathValleyDuster.cs b/Items/Weapons/Magic/DeathValleyDuster.cs index 1067e27f81..78a54eeab3 100644 --- a/Items/Weapons/Magic/DeathValleyDuster.cs +++ b/Items/Weapons/Magic/DeathValleyDuster.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 159; + Item.damage = 130; Item.DamageType = DamageClass.Magic; Item.mana = 38; Item.useTime = 50; @@ -33,6 +33,8 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 12) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 5f; bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); diff --git a/Items/Weapons/Magic/DeathhailStaff.cs b/Items/Weapons/Magic/DeathhailStaff.cs index 36dd27dd3b..d63e6f57c0 100644 --- a/Items/Weapons/Magic/DeathhailStaff.cs +++ b/Items/Weapons/Magic/DeathhailStaff.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -16,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() { Item.width = 80; @@ -31,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 4f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item12; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/DivineRetribution.cs b/Items/Weapons/Magic/DivineRetribution.cs deleted file mode 100644 index c45ed84228..0000000000 --- a/Items/Weapons/Magic/DivineRetribution.cs +++ /dev/null @@ -1,68 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class DivineRetribution : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 66; - Item.height = 88; - Item.damage = 48; - Item.DamageType = DamageClass.Magic; - Item.mana = 15; - Item.useTime = 12; - Item.useAnimation = 12; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 3.5f; - - Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; - - Item.UseSound = SoundID.Item73; - Item.autoReuse = true; - Item.shootSpeed = 25f; - Item.shoot = ModContent.ProjectileType(); - } - - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - // 5 projectiles total - Vector2 mouse = player.ClampedMouseWorld(); - for (int i = -2; i < 3; i++) - { - Vector2 newPos = new Vector2(mouse.X + Main.rand.NextFloat(8f, 64f) * i, player.MountedCenter.Y + Main.rand.NextFloat(640f, 800f)); - Vector2 newVel = (mouse + Main.rand.NextVector2CircularEdge(4f, 4f) - newPos).SafeNormalize(Vector2.Zero) * velocity.Length() * Main.rand.NextFloat(1f, 1.25f); - float velScale = 1f + Main.rand.NextFloat(0.02f, 0.08f) * i; - Projectile.NewProjectile(source, newPos, newVel, type, damage, knockback, player.whoAmI, velScale); - } - return false; - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(8). - AddIngredient(10). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/DivineRetribution.png b/Items/Weapons/Magic/DivineRetribution.png deleted file mode 100644 index 4a5c496127..0000000000 Binary files a/Items/Weapons/Magic/DivineRetribution.png and /dev/null differ diff --git a/Items/Weapons/Magic/Downpour.cs b/Items/Weapons/Magic/Downpour.cs index 0bede5d021..65e5e80756 100644 --- a/Items/Weapons/Magic/Downpour.cs +++ b/Items/Weapons/Magic/Downpour.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/EldritchTome.cs b/Items/Weapons/Magic/EldritchTome.cs index 3021f53ee0..993e63b377 100644 --- a/Items/Weapons/Magic/EldritchTome.cs +++ b/Items/Weapons/Magic/EldritchTome.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class EldritchTome : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/EvergladeSpray.cs b/Items/Weapons/Magic/EvergladeSpray.cs index d073842bf8..4f43c5ad4f 100644 --- a/Items/Weapons/Magic/EvergladeSpray.cs +++ b/Items/Weapons/Magic/EvergladeSpray.cs @@ -13,14 +13,14 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 34; Item.height = 30; - Item.damage = 28; + Item.damage = 65; Item.DamageType = DamageClass.Magic; - Item.mana = 8; + Item.mana = 7; Item.useTime = 6; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 4.5f; + Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item13; diff --git a/Items/Weapons/Magic/Fabstaff.cs b/Items/Weapons/Magic/Fabstaff.cs deleted file mode 100644 index cde4852367..0000000000 --- a/Items/Weapons/Magic/Fabstaff.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Magic -{ - public class Fabstaff : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Magic"; - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 84; - Item.height = 84; - Item.damage = 140; - Item.DamageType = DamageClass.Magic; - Item.mana = 35; - Item.useAnimation = Item.useTime = 20; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 5f; - - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().devItem = true; - - Item.UseSound = SoundID.Item60; - Item.autoReuse = true; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13.5f; - } - - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.RainbowRod). - AddIngredient(5). - AddIngredient(10). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Magic/Fabstaff.png b/Items/Weapons/Magic/Fabstaff.png deleted file mode 100644 index 6658464065..0000000000 Binary files a/Items/Weapons/Magic/Fabstaff.png and /dev/null differ diff --git a/Items/Weapons/Magic/FaceMelter.cs b/Items/Weapons/Magic/FaceMelter.cs index 1148903310..bff3fc20e7 100644 --- a/Items/Weapons/Magic/FaceMelter.cs +++ b/Items/Weapons/Magic/FaceMelter.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 56; Item.height = 50; - Item.damage = 165; + Item.damage = 130; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useTime = 5; @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/FatesReveal.cs b/Items/Weapons/Magic/FatesReveal.cs index 26f28c4056..7a692a38c4 100644 --- a/Items/Weapons/Magic/FatesReveal.cs +++ b/Items/Weapons/Magic/FatesReveal.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/FlareBolt.cs b/Items/Weapons/Magic/FlareBolt.cs index 3168b9b7ef..2dfac6fc97 100644 --- a/Items/Weapons/Magic/FlareBolt.cs +++ b/Items/Weapons/Magic/FlareBolt.cs @@ -57,9 +57,8 @@ namespace CalamityMod.Items.Weapons.Magic public override void AddRecipes() { CreateRecipe(). - AddIngredient(ItemID.HellstoneBar, 6). - AddIngredient(ItemID.Obsidian, 9). - AddIngredient(ItemID.Fireblossom, 2). + AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.Fireblossom, 5). AddIngredient(ItemID.Ruby). AddTile(TileID.Bookcases). Register(); diff --git a/Items/Weapons/Magic/GhastlyVisage.cs b/Items/Weapons/Magic/GhastlyVisage.cs index 086b54ccde..05bf23161e 100644 --- a/Items/Weapons/Magic/GhastlyVisage.cs +++ b/Items/Weapons/Magic/GhastlyVisage.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class GhastlyVisage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Magic/GloriousEnd.cs b/Items/Weapons/Magic/GloriousEnd.cs index fcf8c4aeb8..fa31df187f 100644 --- a/Items/Weapons/Magic/GloriousEnd.cs +++ b/Items/Weapons/Magic/GloriousEnd.cs @@ -1,4 +1,5 @@ using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Summon; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -30,6 +31,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.Calamity().donorItem = true; } + public override bool? CanAutoReuseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] > 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; diff --git a/Items/Weapons/Magic/GruesomeEminence.cs b/Items/Weapons/Magic/GruesomeEminence.cs index e4a64b95a0..2e56c3fd15 100644 --- a/Items/Weapons/Magic/GruesomeEminence.cs +++ b/Items/Weapons/Magic/GruesomeEminence.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/HadalUrn.cs b/Items/Weapons/Magic/HadalUrn.cs index 1a30b38322..22c98c5b65 100644 --- a/Items/Weapons/Magic/HadalUrn.cs +++ b/Items/Weapons/Magic/HadalUrn.cs @@ -21,8 +21,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 37; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 16; - Item.useAnimation = 16; + Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; diff --git a/Items/Weapons/Magic/HeliumFlash.cs b/Items/Weapons/Magic/HeliumFlash.cs index 4344a34749..2d293f49c8 100644 --- a/Items/Weapons/Magic/HeliumFlash.cs +++ b/Items/Weapons/Magic/HeliumFlash.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; diff --git a/Items/Weapons/Magic/HellwingStaff.cs b/Items/Weapons/Magic/HellwingStaff.cs index 4e98d6301c..964464d8d0 100644 --- a/Items/Weapons/Magic/HellwingStaff.cs +++ b/Items/Weapons/Magic/HellwingStaff.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 70; Item.height = 60; - Item.damage = 22; + Item.damage = 21; Item.DamageType = DamageClass.Magic; Item.mana = 18; Item.useTime = 30; @@ -39,48 +39,18 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float projSpeed = velocity.Length(); - Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = (float)Main.mouseX + Main.screenPosition.X + realPlayerPos.X; - float mouseYDist = (float)Main.mouseY + Main.screenPosition.Y + realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.mouseY + realPlayerPos.Y; - } - float mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) - { - mouseXDist = (float)player.direction; - mouseYDist = 0f; - mouseDistance = projSpeed; - } - else - { - mouseDistance = projSpeed / mouseDistance; - } - for (int i = 0; i < 4; i++) { - realPlayerPos = new Vector2(player.position.X + (float)player.width * 0.5f + (float)(Main.rand.Next(201) * -(float)player.direction) + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y); - realPlayerPos.X = (realPlayerPos.X + player.Center.X) / 2f + (float)Main.rand.Next(-200, 201); - realPlayerPos.Y -= (float)(100 * i); - mouseXDist = (float)Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - mouseYDist = (float)Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (mouseYDist < 0f) - { - mouseYDist *= -1f; - } - if (mouseYDist < 20f) - { - mouseYDist = 20f; - } - mouseDistance = (float)Math.Sqrt((double)(mouseXDist * mouseXDist + mouseYDist * mouseYDist)); - mouseDistance = projSpeed / mouseDistance; - mouseXDist *= mouseDistance; - mouseYDist *= mouseDistance; - float speedX4 = mouseXDist + (float)Main.rand.Next(-40, 41) * 0.02f; - float speedY5 = mouseYDist + (float)Main.rand.Next(-40, 41) * 0.02f; - Projectile.NewProjectile(source, realPlayerPos.X, realPlayerPos.Y, speedX4, speedY5, type, damage, knockback, player.whoAmI); + Vector2 realPlayerPos = new Vector2((player.MountedCenter.X + Main.mouseX + Main.screenPosition.X - player.position.X + player.Center.X) / 2f, player.MountedCenter.Y - (100f * i)); + + Vector2 mouseDist = new Vector2(Main.mouseX + Main.screenPosition.X - realPlayerPos.X, Math.Abs(Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y)); + if (mouseDist.Y < 20f) + mouseDist.Y = 20f; + mouseDist = mouseDist.SafeNormalize(Vector2.UnitX) * velocity.Length(); + mouseDist.X += Main.rand.NextFloat(-0.4f, 0.4f); + mouseDist.Y += Main.rand.NextFloat(-0.4f, 0.4f); + + Projectile.NewProjectile(source, realPlayerPos, mouseDist, type, damage, knockback, player.whoAmI); } return false; } @@ -89,7 +59,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.AshWood, 7). + AddIngredient(ItemID.AshWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/Hematemesis.cs b/Items/Weapons/Magic/Hematemesis.cs index 5ccbd20082..8071e3633f 100644 --- a/Items/Weapons/Magic/Hematemesis.cs +++ b/Items/Weapons/Magic/Hematemesis.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/Heresy.cs b/Items/Weapons/Magic/Heresy.cs index 2349832e9d..55230bb5f9 100644 --- a/Items/Weapons/Magic/Heresy.cs +++ b/Items/Weapons/Magic/Heresy.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Terraria; using Terraria.DataStructures; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic { Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(6, 6)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -36,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Magic/HyphaeRod.cs b/Items/Weapons/Magic/HyphaeRod.cs index dc7b12a637..e0052dbee8 100644 --- a/Items/Weapons/Magic/HyphaeRod.cs +++ b/Items/Weapons/Magic/HyphaeRod.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/IceBarrage.cs b/Items/Weapons/Magic/IceBarrage.cs index 90f046f193..6b23620bef 100644 --- a/Items/Weapons/Magic/IceBarrage.cs +++ b/Items/Weapons/Magic/IceBarrage.cs @@ -28,10 +28,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = CastSound; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.damage = 2300; + Item.damage = 2250; Item.knockBack = 6f; Item.useAnimation = Item.useTime = 300; Item.reuseDelay = 60; diff --git a/Items/Weapons/Magic/Keelhaul.cs b/Items/Weapons/Magic/Keelhaul.cs index 5929c99224..770e8029e4 100644 --- a/Items/Weapons/Magic/Keelhaul.cs +++ b/Items/Weapons/Magic/Keelhaul.cs @@ -12,11 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic Item.width = 42; Item.height = 42; Item.damage = 55; - Item.mana = 50; + Item.mana = 40; Item.DamageType = DamageClass.Magic; Item.noMelee = true; - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = Item.useAnimation = 30; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 2f; diff --git a/Items/Weapons/Magic/LashesofChaos.cs b/Items/Weapons/Magic/LashesofChaos.cs index e993083d8c..e3e1f630a4 100644 --- a/Items/Weapons/Magic/LashesofChaos.cs +++ b/Items/Weapons/Magic/LashesofChaos.cs @@ -1,4 +1,6 @@ using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Particles; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; @@ -16,7 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic public int FiringMode = 0; // 0 = hellfireballs, 1 = hellblasts public int ProjectilesFired = 0; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/LightGodsBrilliance.cs b/Items/Weapons/Magic/LightGodsBrilliance.cs index d43e562b13..46c1df127f 100644 --- a/Items/Weapons/Magic/LightGodsBrilliance.cs +++ b/Items/Weapons/Magic/LightGodsBrilliance.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Magic Item.damage = 111; Item.DamageType = DamageClass.Magic; Item.mana = 6; - Item.useAnimation = Item.useTime = 4; + Item.useAnimation = Item.useTime = 6; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item9; Item.autoReuse = true; diff --git a/Items/Weapons/Magic/ManaRose.cs b/Items/Weapons/Magic/ManaRose.cs index be441ecf19..26d4da54d5 100644 --- a/Items/Weapons/Magic/ManaRose.cs +++ b/Items/Weapons/Magic/ManaRose.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.25f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/NebulousCataclysm.cs b/Items/Weapons/Magic/NebulousCataclysm.cs index 9ba21a61be..00b99ac405 100644 --- a/Items/Weapons/Magic/NebulousCataclysm.cs +++ b/Items/Weapons/Magic/NebulousCataclysm.cs @@ -18,11 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 120; Item.height = 124; - Item.damage = 510; + Item.damage = 530; Item.DamageType = DamageClass.Magic; - Item.mana = 60; - Item.useTime = 30; - Item.useAnimation = 30; + Item.mana = 70; + Item.useTime = Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = null; Item.noMelee = true; @@ -30,16 +29,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 3f; + Item.shootSpeed = 5f; } public override void OnConsumeMana(Player player, int manaConsumed) => player.statMana += manaConsumed; - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Magic/Omicron.cs b/Items/Weapons/Magic/Omicron.cs index 5b920b4c1a..aea9835886 100644 --- a/Items/Weapons/Magic/Omicron.cs +++ b/Items/Weapons/Magic/Omicron.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 122; Item.height = 54; - Item.damage = 82; + Item.damage = 80; Item.DamageType = DamageClass.Magic; - Item.mana = 8; + Item.mana = 10; Item.useAnimation = Item.useTime = 4; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.ownedProjectileCounts[ModContent.ProjectileType()] < 2; diff --git a/Items/Weapons/Magic/ParasiticSceptor.cs b/Items/Weapons/Magic/ParasiticSceptor.cs index 3713f53c6e..ecae376a81 100644 --- a/Items/Weapons/Magic/ParasiticSceptor.cs +++ b/Items/Weapons/Magic/ParasiticSceptor.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -96,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(15). - AddIngredient(18). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/PhoenixFlameBarrage.cs b/Items/Weapons/Magic/PhoenixFlameBarrage.cs index 1921f78eeb..118911fbaf 100644 --- a/Items/Weapons/Magic/PhoenixFlameBarrage.cs +++ b/Items/Weapons/Magic/PhoenixFlameBarrage.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -15,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -30,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.knockBack = 3.5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item20; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/Photosynthesis.cs b/Items/Weapons/Magic/Photosynthesis.cs index dc4e32d222..47d1882e66 100644 --- a/Items/Weapons/Magic/Photosynthesis.cs +++ b/Items/Weapons/Magic/Photosynthesis.cs @@ -22,11 +22,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 78; Item.height = 78; - Item.damage = 60; + Item.damage = 74; Item.DamageType = DamageClass.Magic; Item.mana = 10; - Item.useTime = 24; - Item.useAnimation = 24; + Item.useTime = Item.useAnimation = 21; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4f; diff --git a/Items/Weapons/Magic/PlagueStaff.cs b/Items/Weapons/Magic/PlagueStaff.cs index c9cd97def5..eacb05e87f 100644 --- a/Items/Weapons/Magic/PlagueStaff.cs +++ b/Items/Weapons/Magic/PlagueStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/PlasmaRod.cs b/Items/Weapons/Magic/PlasmaRod.cs index 904896c5ae..92bdf798c3 100644 --- a/Items/Weapons/Magic/PlasmaRod.cs +++ b/Items/Weapons/Magic/PlasmaRod.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.5f; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/PrimordialAncient.cs b/Items/Weapons/Magic/PrimordialAncient.cs index adcc961a6c..016e0e5e2a 100644 --- a/Items/Weapons/Magic/PrimordialAncient.cs +++ b/Items/Weapons/Magic/PrimordialAncient.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 40; Item.height = 56; - Item.damage = 3900; + Item.damage = 4350; Item.DamageType = DamageClass.Magic; - Item.mana = 85; + Item.mana = 95; Item.useTime = 78; Item.useAnimation = 78; Item.useStyle = ItemUseStyleID.Shoot; @@ -37,10 +37,13 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 16) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 7f; + bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); for (int i = -2; i <= 2; i++) { diff --git a/Items/Weapons/Magic/PrimordialEarth.cs b/Items/Weapons/Magic/PrimordialEarth.cs index bfe7b3b5d2..f0f2663dd6 100644 --- a/Items/Weapons/Magic/PrimordialEarth.cs +++ b/Items/Weapons/Magic/PrimordialEarth.cs @@ -21,11 +21,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 42; - Item.damage = 300; + Item.damage = 205; Item.DamageType = DamageClass.Magic; Item.mana = 48; - Item.useTime = 68; - Item.useAnimation = 68; + Item.useTime = Item.useAnimation = 68; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 10; @@ -38,10 +37,14 @@ namespace CalamityMod.Items.Weapons.Magic } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.velocity.Length() <= 14) + player.velocity += -velocity.SafeNormalize(Vector2.UnitX) * 6f; + + Vector2 staticSpeed = Utils.DirectionTo(player.Center, player.Calamity().mouseWorld) * Utils.Distance(player.Center, player.ClampedMouseWorld()) * 0.008f; bool MaxMana = player.statMana >= (player.statManaMax2 - ((int)(Item.mana * player.manaCost))) && !player.HasBuff(BuffID.ManaSickness); float rotation = 0.4f; - Projectile.NewProjectile(source, position, velocity.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f); - Projectile.NewProjectile(source, position, velocity.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); + Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(-rotation), type, damage / 2, knockback, player.whoAmI, 0f, 1f, MaxMana ? 1f : 0f); + Projectile.NewProjectile(source, position, staticSpeed.RotatedBy(rotation), type, damage / 2, knockback, player.whoAmI, 0f, 0f, MaxMana ? 1f : 0f); return false; } diff --git a/Items/Weapons/Magic/PurgeGuzzler.cs b/Items/Weapons/Magic/PurgeGuzzler.cs index b39487c4e9..9675c27234 100644 --- a/Items/Weapons/Magic/PurgeGuzzler.cs +++ b/Items/Weapons/Magic/PurgeGuzzler.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Sounds; using Microsoft.Xna.Framework; @@ -13,7 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; private const float Spread = 0.025f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Magic/Rancor.cs b/Items/Weapons/Magic/Rancor.cs index f69ac44ac2..c18625be66 100644 --- a/Items/Weapons/Magic/Rancor.cs +++ b/Items/Weapons/Magic/Rancor.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void SetStaticDefaults() diff --git a/Items/Weapons/Magic/RougeSlash.cs b/Items/Weapons/Magic/RougeSlash.cs index e9975d1d74..06930e2bf0 100644 --- a/Items/Weapons/Magic/RougeSlash.cs +++ b/Items/Weapons/Magic/RougeSlash.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class RougeSlash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.mana = 30; diff --git a/Items/Weapons/Magic/SHPC.cs b/Items/Weapons/Magic/SHPC.cs index a4eff61271..563b1c809a 100644 --- a/Items/Weapons/Magic/SHPC.cs +++ b/Items/Weapons/Magic/SHPC.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 124; Item.height = 52; - Item.damage = 110; + Item.damage = 97; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useAnimation = Item.useTime = 60; diff --git a/Items/Weapons/Magic/SandstreamScepter.cs b/Items/Weapons/Magic/SandstreamScepter.cs index 2478aed15c..d80b24a5a6 100644 --- a/Items/Weapons/Magic/SandstreamScepter.cs +++ b/Items/Weapons/Magic/SandstreamScepter.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -14,6 +15,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Magic/SeethingDischarge.cs b/Items/Weapons/Magic/SeethingDischarge.cs index 63aeac78ab..2d8ec34175 100644 --- a/Items/Weapons/Magic/SeethingDischarge.cs +++ b/Items/Weapons/Magic/SeethingDischarge.cs @@ -1,4 +1,6 @@ -using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.Projectiles.Magic; using CalamityMod.Sounds; using Microsoft.Xna.Framework; @@ -14,6 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; public int DartTimer = 0; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Magic/ShaderainStaff.cs b/Items/Weapons/Magic/ShaderainStaff.cs index cb4d8ccff9..fe4378f2ec 100644 --- a/Items/Weapons/Magic/ShaderainStaff.cs +++ b/Items/Weapons/Magic/ShaderainStaff.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Summon; using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public class ShaderainStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + #region Other stats // Stats for the shaderain. @@ -26,10 +28,10 @@ namespace CalamityMod.Items.Weapons.Magic public const float DeaccelerationStrenght = 0.95f; // A number lower than 1, non-including 1, changing it very slightly will have drastic results. #endregion - public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -77,15 +79,5 @@ namespace CalamityMod.Items.Weapons.Magic return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 3). - AddIngredient(9). - AddIngredient(ItemID.RottenChunk, 3). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Magic/ShadowboltStaff.cs b/Items/Weapons/Magic/ShadowboltStaff.cs index c3c932f9a3..7ba0f2ac67 100644 --- a/Items/Weapons/Magic/ShadowboltStaff.cs +++ b/Items/Weapons/Magic/ShadowboltStaff.cs @@ -20,16 +20,17 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 58; Item.height = 56; - Item.damage = 205; + Item.damage = 285; Item.DamageType = DamageClass.Magic; - Item.mana = 10; - Item.useTime = 12; - Item.useAnimation = 12; + Item.mana = 15; + Item.useTime = 8; + Item.useAnimation = 24; + Item.reuseDelay = 30; + Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.UseSound = SoundID.Item72; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; diff --git a/Items/Weapons/Magic/ShiftingSands.cs b/Items/Weapons/Magic/ShiftingSands.cs index 6c97761796..d0fa9deba3 100644 --- a/Items/Weapons/Magic/ShiftingSands.cs +++ b/Items/Weapons/Magic/ShiftingSands.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetDefaults() { Item.width = Item.height = 58; - Item.damage = 76; + Item.damage = 81; Item.knockBack = 5f; Item.useAnimation = Item.useTime = 30; Item.mana = 20; diff --git a/Items/Weapons/Magic/SkyGlaze.cs b/Items/Weapons/Magic/SkyGlaze.cs index a9bc168915..cc5d6061da 100644 --- a/Items/Weapons/Magic/SkyGlaze.cs +++ b/Items/Weapons/Magic/SkyGlaze.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item102; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Magic/SnowstormStaff.cs b/Items/Weapons/Magic/SnowstormStaff.cs index 4d4c8e00f5..39c0f133b2 100644 --- a/Items/Weapons/Magic/SnowstormStaff.cs +++ b/Items/Weapons/Magic/SnowstormStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Magic; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Magic public class SnowstormStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Magic/SoulPiercer.cs b/Items/Weapons/Magic/SoulPiercer.cs index c7c48d362a..52b15901ca 100644 --- a/Items/Weapons/Magic/SoulPiercer.cs +++ b/Items/Weapons/Magic/SoulPiercer.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 64; Item.height = 64; - Item.damage = 310; + Item.damage = 235; Item.DamageType = DamageClass.Magic; Item.mana = 19; Item.useAnimation = Item.useTime = 25; @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index f699464be8..349ac20155 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using Microsoft.Xna.Framework; using System; using Terraria; @@ -14,7 +16,10 @@ namespace CalamityMod.Items.Weapons.Magic public new string LocalizationCategory => "Items.Weapons.Magic"; internal const float ShootSpeed = 28f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 38; diff --git a/Items/Weapons/Magic/SubsumingVortex.cs b/Items/Weapons/Magic/SubsumingVortex.cs index 84db87a52f..cea133c69b 100644 --- a/Items/Weapons/Magic/SubsumingVortex.cs +++ b/Items/Weapons/Magic/SubsumingVortex.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item84; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.noMelee = true; Item.channel = true; diff --git a/Items/Weapons/Magic/Sylvestaff.cs b/Items/Weapons/Magic/Sylvestaff.cs new file mode 100644 index 0000000000..f34f2af785 --- /dev/null +++ b/Items/Weapons/Magic/Sylvestaff.cs @@ -0,0 +1,121 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Weapons.Magic +{ + [LegacyName("Fabstaff")] + public class Sylvestaff : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Magic"; + + /// + /// The amount by which the staff recoils after firing. + /// + public static float StaffRecoilForce => 0.04f; + + /// + /// The rate at which rays from the staff can release bolts. + /// + public static int RayBoltShootRate => CalamityUtils.SecondsToFrames(0.0667f); + + /// + /// The distance range that targets need to be within relative to a ray's evaluation points in order to shoot bolts. + /// + public static float RayBoltTargetingRange => 272f; + + /// + /// The turn speed interpolant that dictates how fast or slow the staff can move to aim towards the mouse. + /// + public static float TurnSpeedInterpolant => 0.276f; + + /// + /// The sound played when Sylvestaff rays are fired. + /// + public static readonly SoundStyle FireSound = new SoundStyle("CalamityMod/Sounds/Item/SylvestaffFire", 3) with { MaxInstances = 5 }; + + /// + /// The sound played when Sylvestaff rays bounce off of tiles. + /// + public static readonly SoundStyle BounceSound = new SoundStyle("CalamityMod/Sounds/Item/SylvestaffProjectileBounce", 3) with { MaxInstances = 5 }; + + public override string Texture + { + get + { + if (WorldGen.SavedOreTiers.Gold == TileID.Gold || Main.gameMenu) + return "CalamityMod/Items/Weapons/Magic/SylvestaffGold"; + + return "CalamityMod/Items/Weapons/Magic/SylvestaffPlatinum"; + } + } + + public override void SetStaticDefaults() + { + Item.staff[Item.type] = true; + } + + public override void SetDefaults() + { + Item.width = 84; + Item.height = 84; + Item.damage = 125; + Item.DamageType = DamageClass.Magic; + Item.mana = 50; + Item.useTime = 20; + Item.useAnimation = 20; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.channel = true; + Item.noUseGraphic = true; + Item.knockBack = 5f; + + Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; + Item.rare = ModContent.RarityType(); + Item.Calamity().devItem = true; + + Item.autoReuse = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 13.5f; + } + + public override void ModifyManaCost(Player player, ref float reduce, ref float mult) + { + if (player.ownedProjectileCounts[Item.shoot] <= 0) + mult *= 0; + } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(ItemID.RainbowRod). + AddIngredient(ItemID.GenderChangePotion). + AddRecipeGroup("AnyGoldBar", 5). + AddIngredient(10). + AddIngredient(5). + AddTile(). + Register(); + } + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + Texture2D texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, scale, SpriteEffects.None, 0); + return false; + } + + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + Texture2D texture = ModContent.Request(Texture).Value; + spriteBatch.Draw(texture, Item.position - Main.screenPosition, null, lightColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0); + return false; + } + } +} diff --git a/Items/Weapons/Magic/SylvestaffGold.png b/Items/Weapons/Magic/SylvestaffGold.png new file mode 100644 index 0000000000..2cd1d31e38 Binary files /dev/null and b/Items/Weapons/Magic/SylvestaffGold.png differ diff --git a/Items/Weapons/Magic/SylvestaffPlatinum.png b/Items/Weapons/Magic/SylvestaffPlatinum.png new file mode 100644 index 0000000000..c611c58ea1 Binary files /dev/null and b/Items/Weapons/Magic/SylvestaffPlatinum.png differ diff --git a/Items/Weapons/Magic/TearsofHeaven.cs b/Items/Weapons/Magic/TearsofHeaven.cs index 6e31eef359..babeb02a00 100644 --- a/Items/Weapons/Magic/TearsofHeaven.cs +++ b/Items/Weapons/Magic/TearsofHeaven.cs @@ -18,11 +18,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 38; Item.height = 48; - Item.damage = 45; + Item.damage = 43; Item.DamageType = DamageClass.Magic; - Item.mana = 18; - Item.useTime = 20; - Item.useAnimation = 20; + Item.mana = 15; + Item.useTime = Item.useAnimation = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5.5f; @@ -38,9 +37,9 @@ namespace CalamityMod.Items.Weapons.Magic { for (int index = 0; index < 2; ++index) { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); + float SpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f); + Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI); } return false; } diff --git a/Items/Weapons/Magic/TheCauldron.cs b/Items/Weapons/Magic/TheCauldron.cs index d3b57adcb1..065b00b449 100644 --- a/Items/Weapons/Magic/TheCauldron.cs +++ b/Items/Weapons/Magic/TheCauldron.cs @@ -25,12 +25,11 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 46; Item.height = 46; - Item.damage = 59; + Item.damage = 56; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = 60; - Item.useTime = 60; + Item.useTime = Item.useAnimation = 60; Item.knockBack = 8f; Item.mana = 18; Item.UseSound = SoundID.DD2_MonkStaffSwing; diff --git a/Items/Weapons/Magic/TheWand.cs b/Items/Weapons/Magic/TheWand.cs index cb2dcf2656..4a02a8674c 100644 --- a/Items/Weapons/Magic/TheWand.cs +++ b/Items/Weapons/Magic/TheWand.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Magic/UndinesRetribution.cs b/Items/Weapons/Magic/UndinesRetribution.cs index 1ffeebf364..3b0c0a2a62 100644 --- a/Items/Weapons/Magic/UndinesRetribution.cs +++ b/Items/Weapons/Magic/UndinesRetribution.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 64; Item.height = 64; - Item.damage = 46; + Item.damage = 44; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.useTime = 18; diff --git a/Items/Weapons/Magic/ValkyrieRay.cs b/Items/Weapons/Magic/ValkyrieRay.cs index 9c8c4765fe..5174f80dbc 100644 --- a/Items/Weapons/Magic/ValkyrieRay.cs +++ b/Items/Weapons/Magic/ValkyrieRay.cs @@ -10,11 +10,11 @@ namespace CalamityMod.Items.Weapons.Magic public class ValkyrieRay : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - // The base use time of the weapon is 47: 28 charge frames + 19 cooldown frames. + // The base use time of the weapon is 28: 18 charge frames + 10 cooldown frames. // The rate at which it progresses through its charge and discharge cycle is dynamically sped up by reforges. // This math is handled in its holdout projectile, ValkyrieRayStaff. - public const int ChargeFrames = 28; - public const int CooldownFrames = 19; + public const int ChargeFrames = 18; + public const int CooldownFrames = 10; public const float GemDistance = 18f; public static readonly Color LightColor = new Color(235, 40, 121); @@ -27,14 +27,14 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 54; Item.height = 52; - Item.damage = 53; + Item.damage = 115; Item.knockBack = 8.5f; Item.DamageType = DamageClass.Magic; - Item.mana = 26; + Item.mana = 17; Item.useTime = ChargeFrames + CooldownFrames; Item.useAnimation = ChargeFrames + CooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; - Item.UseSound = SoundID.NPCDeath7; + Item.UseSound = SoundID.NPCDeath7 with { Volume = 0.7f }; Item.useTurn = false; Item.noMelee = true; Item.noUseGraphic = true; @@ -45,6 +45,8 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; } + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 11; + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Magic/Vehemence.cs b/Items/Weapons/Magic/Vehemence.cs index 00f8970db7..a33d1a3aca 100644 --- a/Items/Weapons/Magic/Vehemence.cs +++ b/Items/Weapons/Magic/Vehemence.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -17,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Magic public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -37,7 +40,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16.5f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Magic/VitriolicViper.cs b/Items/Weapons/Magic/VitriolicViper.cs index 681c2e9007..a931b51f65 100644 --- a/Items/Weapons/Magic/VitriolicViper.cs +++ b/Items/Weapons/Magic/VitriolicViper.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,7 +12,10 @@ namespace CalamityMod.Items.Weapons.Magic public class VitriolicViper : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Magic/VividClarity.cs b/Items/Weapons/Magic/VividClarity.cs index 5aabf36d9d..b4ea614361 100644 --- a/Items/Weapons/Magic/VividClarity.cs +++ b/Items/Weapons/Magic/VividClarity.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo projSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/VoidVortex.cs b/Items/Weapons/Magic/VoidVortex.cs index abd18f69a4..8c0e9cfa2a 100644 --- a/Items/Weapons/Magic/VoidVortex.cs +++ b/Items/Weapons/Magic/VoidVortex.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/VoltaicClimax.cs b/Items/Weapons/Magic/VoltaicClimax.cs index 5cd70a1c53..2f20bd1f80 100644 --- a/Items/Weapons/Magic/VoltaicClimax.cs +++ b/Items/Weapons/Magic/VoltaicClimax.cs @@ -24,11 +24,10 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 78; Item.height = 78; - Item.damage = 235; + Item.damage = 215; Item.DamageType = DamageClass.Magic; Item.mana = 32; - Item.useTime = 29; - Item.useAnimation = 29; + Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -37,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Magic/Volterion.cs b/Items/Weapons/Magic/Volterion.cs index 5579403159..10636642ae 100644 --- a/Items/Weapons/Magic/Volterion.cs +++ b/Items/Weapons/Magic/Volterion.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Magic; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Magic public class Volterion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Magic"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 220; diff --git a/Items/Weapons/Magic/WintersFury.cs b/Items/Weapons/Magic/WintersFury.cs index 73d7bf6a5e..6e35c1d79c 100644 --- a/Items/Weapons/Magic/WintersFury.cs +++ b/Items/Weapons/Magic/WintersFury.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 36; Item.height = 40; - Item.damage = 70; + Item.damage = 65; Item.DamageType = DamageClass.Magic; Item.mana = 7; Item.useTime = 12; @@ -32,16 +32,14 @@ namespace CalamityMod.Items.Weapons.Magic Item.UseSound = SoundID.Item9; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 15f; + Item.shootSpeed = 16f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (!Main.rand.NextBool(4)) { - Vector2 speed = velocity.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-15, 16))); - speed.Normalize(); - speed *= 15f; + Vector2 speed = velocity.RotatedByRandom(MathHelper.Pi / 12f); speed.Y -= Math.Abs(speed.X) * 0.2f; int p = Projectile.NewProjectile(source, position, speed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) @@ -52,8 +50,8 @@ namespace CalamityMod.Items.Weapons.Magic SoundEngine.PlaySound(SoundID.Item1, position); Projectile.NewProjectile(source, position.X, position.Y, velocity.X * 1.2f, velocity.Y * 1.2f, ModContent.ProjectileType(), damage, knockback * 2f, player.whoAmI); } - velocity.X += Main.rand.Next(-40, 41) * 0.05f; - velocity.Y += Main.rand.Next(-40, 41) * 0.05f; + velocity.X += Main.rand.NextFloat(-2f, 2f); + velocity.Y += Main.rand.NextFloat(-2f, 2f); return true; } } diff --git a/Items/Weapons/Magic/WulfrumProsthesis.cs b/Items/Weapons/Magic/WulfrumProsthesis.cs index 08f1946933..1028f4af5a 100644 --- a/Items/Weapons/Magic/WulfrumProsthesis.cs +++ b/Items/Weapons/Magic/WulfrumProsthesis.cs @@ -145,7 +145,6 @@ namespace CalamityMod.Items.Weapons.Magic { CreateRecipe(). AddIngredient(10). - AddIngredient(). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Magic/YharimsCrystal.cs b/Items/Weapons/Magic/YharimsCrystal.cs index 79f6ee338e..b5939f4622 100644 --- a/Items/Weapons/Magic/YharimsCrystal.cs +++ b/Items/Weapons/Magic/YharimsCrystal.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Magic Item.channel = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Melee/AbsoluteZero.cs b/Items/Weapons/Melee/AbsoluteZero.cs index de9f7969e6..1b9615ad9c 100644 --- a/Items/Weapons/Melee/AbsoluteZero.cs +++ b/Items/Weapons/Melee/AbsoluteZero.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { target.AddBuff(BuffID.Frostburn2, 300); - target.AddBuff(ModContent.BuffType(), 60); var source = player.GetSource_ItemUse(Item); int p = Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), Item.damage, 12f, player.whoAmI); Main.projectile[p].Kill(); diff --git a/Items/Weapons/Melee/AbyssBlade.cs b/Items/Weapons/Melee/AbyssBlade.cs index 71525139dd..83ea8d665e 100644 --- a/Items/Weapons/Melee/AbyssBlade.cs +++ b/Items/Weapons/Melee/AbyssBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 74; Item.height = 74; - Item.damage = 140; + Item.damage = 123; Item.knockBack = 7.5f; Item.useTime = 65; Item.useAnimation = 65; diff --git a/Items/Weapons/Melee/AcidwoodSword.cs b/Items/Weapons/Melee/AcidwoodSword.cs index e66fd94976..518cd066c9 100644 --- a/Items/Weapons/Melee/AcidwoodSword.cs +++ b/Items/Weapons/Melee/AcidwoodSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; using Terraria.ModLoader; diff --git a/Items/Weapons/Melee/AnarchyBlade.cs b/Items/Weapons/Melee/AnarchyBlade.cs index deda0bf7d1..93f04e9e1d 100644 --- a/Items/Weapons/Melee/AnarchyBlade.cs +++ b/Items/Weapons/Melee/AnarchyBlade.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 114; Item.height = 122; - Item.damage = 150; + Item.damage = 120; Item.DamageType = DamageClass.Melee; Item.useAnimation = 19; Item.useTime = 19; diff --git a/Items/Weapons/Melee/Aorta.cs b/Items/Weapons/Melee/Aorta.cs index 6552a7ee34..b6092caa54 100644 --- a/Items/Weapons/Melee/Aorta.cs +++ b/Items/Weapons/Melee/Aorta.cs @@ -1,4 +1,6 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; @@ -21,6 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -46,15 +49,5 @@ namespace CalamityMod.Items.Weapons.Melee Item.rare = ItemRarityID.Orange; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 3). - AddIngredient(9). - AddIngredient(ItemID.Vertebrae, 3). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 905ec0cf9c..695c21e84c 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee public static float MaxThrowReach = 760; public static float SnapDamageMultiplier = 1.2f; //Extra damage from making the scissors snap - public static float MaxCharge = 15f; // Maximum charge value AKA how much charge you get from a parry + public static float MaxCharge = 16f; // Maximum charge value AKA how much charge you get from a parry public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float chainDamageMultiplier = 0.1f; public static float SnapBoltsDamageMultiplier = 0.1f; @@ -90,7 +90,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 28f; - Item.rare = RarityType(); + Item.rare = RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults @@ -235,7 +235,7 @@ namespace CalamityMod.Items.Weapons.Melee var barBG = Request("CalamityMod/UI/MiscTextures/GenericBarBack").Value; var barFG = Request("CalamityMod/UI/MiscTextures/GenericBarFront").Value; - float barScale = 3f; + float barScale = 4f; Vector2 barOrigin = barBG.Size() * 0.5f; float yOffset = 50f; Vector2 drawPos = position + Vector2.UnitY * scale * (frame.Height - yOffset); diff --git a/Items/Weapons/Melee/Ataraxia.cs b/Items/Weapons/Melee/Ataraxia.cs index 62bc330370..49cf9686b6 100644 --- a/Items/Weapons/Melee/Ataraxia.cs +++ b/Items/Weapons/Melee/Ataraxia.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Avalanche.cs b/Items/Weapons/Melee/Avalanche.cs index af32ff182b..745a1360a0 100644 --- a/Items/Weapons/Melee/Avalanche.cs +++ b/Items/Weapons/Melee/Avalanche.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Avalanche : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Melee/BansheeHook.cs b/Items/Weapons/Melee/BansheeHook.cs index 0c788bd3ff..311a9d72ff 100644 --- a/Items/Weapons/Melee/BansheeHook.cs +++ b/Items/Weapons/Melee/BansheeHook.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/Basher.cs b/Items/Weapons/Melee/Basher.cs index e050f25e6f..1a7398acf0 100644 --- a/Items/Weapons/Melee/Basher.cs +++ b/Items/Weapons/Melee/Basher.cs @@ -2,6 +2,7 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -35,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(15). AddIngredient(12). AddTile(TileID.Anvils). Register(); diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs index e88d676e19..ab15acffd1 100644 --- a/Items/Weapons/Melee/BladecrestOathsword.cs +++ b/Items/Weapons/Melee/BladecrestOathsword.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 56; Item.height = 56; - Item.damage = 50; + Item.damage = 42; Item.knockBack = 3f; Item.useTime = 53; Item.useAnimation = 53; diff --git a/Items/Weapons/Melee/BlightedCleaver.cs b/Items/Weapons/Melee/BlightedCleaver.cs index cf51e42102..5b1abeecab 100644 --- a/Items/Weapons/Melee/BlightedCleaver.cs +++ b/Items/Weapons/Melee/BlightedCleaver.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 88; Item.height = 88; - Item.damage = 92; + Item.damage = 90; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 28; Item.useStyle = ItemUseStyleID.Swing; @@ -74,14 +74,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - player.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 240); target.AddBuff(BuffID.OnFire3, 240); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - player.AddBuff(ModContent.BuffType(), 180); target.AddBuff(BuffID.Venom, 240); target.AddBuff(BuffID.OnFire3, 240); } diff --git a/Items/Weapons/Melee/BotanicPiercer.cs b/Items/Weapons/Melee/BotanicPiercer.cs index 25f5f5eb42..1d67b9f7ff 100644 --- a/Items/Weapons/Melee/BotanicPiercer.cs +++ b/Items/Weapons/Melee/BotanicPiercer.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 112; Item.height = 112; - Item.damage = 88; + Item.damage = 110; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/Brimlance.cs b/Items/Weapons/Melee/Brimlance.cs index 891c17c57e..46913bec43 100644 --- a/Items/Weapons/Melee/Brimlance.cs +++ b/Items/Weapons/Melee/Brimlance.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,8 +12,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } - public override void SetDefaults() { Item.width = 56; diff --git a/Items/Weapons/Melee/Brimlash.cs b/Items/Weapons/Melee/Brimlash.cs index 2107039480..39a841fea3 100644 --- a/Items/Weapons/Melee/Brimlash.cs +++ b/Items/Weapons/Melee/Brimlash.cs @@ -15,10 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 72; - Item.damage = 70; + Item.damage = 60; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 30; - Item.useTime = 30; + Item.useTime = Item.useAnimation = 30; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index 2da5be69b2..02a837769c 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -324,8 +324,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddRecipeGroup("AnyWoodenSword"). - AddIngredient(ItemType(), 5). - AddIngredient(ItemID.HellstoneBar, 5). + AddIngredient(ItemType(), 10). + AddIngredient(ItemID.HellstoneBar, 10). AddIngredient(ItemID.DirtBlock, 50). AddIngredient(ItemID.StoneBlock, 50). AddTile(TileID.Anvils). diff --git a/Items/Weapons/Melee/BurningRevelation.cs b/Items/Weapons/Melee/BurningRevelation.cs index c0bdd8753b..8d4f9d133a 100644 --- a/Items/Weapons/Melee/BurningRevelation.cs +++ b/Items/Weapons/Melee/BurningRevelation.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -24,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/CelestialClaymore.cs b/Items/Weapons/Melee/CelestialClaymore.cs index be2b5e936f..e3274de9e0 100644 --- a/Items/Weapons/Melee/CelestialClaymore.cs +++ b/Items/Weapons/Melee/CelestialClaymore.cs @@ -24,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5.25f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 0.1f; } diff --git a/Items/Weapons/Melee/CosmicDischarge.cs b/Items/Weapons/Melee/CosmicDischarge.cs index f27421e8d2..b9a87ab485 100644 --- a/Items/Weapons/Melee/CosmicDischarge.cs +++ b/Items/Weapons/Melee/CosmicDischarge.cs @@ -15,14 +15,13 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 50; Item.height = 52; - Item.damage = 400; + Item.damage = 450; Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; Item.autoReuse = true; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.useAnimation = 15; - Item.useTime = 15; + Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 0.5f; Item.UseSound = SoundID.Item122; @@ -30,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Melee/CosmicShiv.cs b/Items/Weapons/Melee/CosmicShiv.cs index e8e5ba8113..b910c11097 100644 --- a/Items/Weapons/Melee/CosmicShiv.cs +++ b/Items/Weapons/Melee/CosmicShiv.cs @@ -20,15 +20,15 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 270; + Item.damage = 155; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 40; + Item.useAnimation = Item.useTime = 30; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.4f; Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; // revertusernamechange on Discord (Yatagarasu) } @@ -43,4 +43,4 @@ namespace CalamityMod.Items.Weapons.Melee Register(); } } -} \ No newline at end of file +} diff --git a/Items/Weapons/Melee/DefiledGreatsword.cs b/Items/Weapons/Melee/DefiledGreatsword.cs index b5f9b9150a..306271d675 100644 --- a/Items/Weapons/Melee/DefiledGreatsword.cs +++ b/Items/Weapons/Melee/DefiledGreatsword.cs @@ -119,14 +119,12 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - player.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Venom, 360); target.AddBuff(BuffID.OnFire3, 360); } public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) { - player.AddBuff(ModContent.BuffType(), 300); target.AddBuff(BuffID.Venom, 360); target.AddBuff(BuffID.OnFire3, 360); } diff --git a/Items/Weapons/Melee/DepthCrusher.cs b/Items/Weapons/Melee/DepthCrusher.cs index 86f994eb02..06a4a2dca9 100644 --- a/Items/Weapons/Melee/DepthCrusher.cs +++ b/Items/Weapons/Melee/DepthCrusher.cs @@ -30,8 +30,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = null; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; } } } diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index 6d1c3063e9..9c6b075d7c 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -26,7 +26,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 118; Item.height = 118; - Item.damage = 400; + Item.damage = 333; + Item.crit = 41; Item.useAnimation = Item.useTime = 45; Item.useStyle = ItemUseStyleID.Shoot; @@ -41,10 +42,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.channel = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool MeleePrefix() => true; - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 41; public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !player.Calamity().mouseRight; public override void HoldItem(Player player) { @@ -76,7 +76,7 @@ namespace CalamityMod.Items.Weapons.Melee } if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) { - Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 15, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 30x damage. + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 15, Item.knockBack, player.whoAmI, 0, throwCount); //This used to be 30x damage. } } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Melee/DragonPow.cs b/Items/Weapons/Melee/DragonPow.cs index 9b2ca8504b..d1e27ec1d4 100644 --- a/Items/Weapons/Melee/DragonPow.cs +++ b/Items/Weapons/Melee/DragonPow.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.channel = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/DragonRage.cs b/Items/Weapons/Melee/DragonRage.cs index dc5f9e1f86..8358f4fdaf 100644 --- a/Items/Weapons/Melee/DragonRage.cs +++ b/Items/Weapons/Melee/DragonRage.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +9,10 @@ namespace CalamityMod.Items.Weapons.Melee public class DragonRage : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 128; @@ -26,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.DD2_SkyDragonsFurySwing; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } } } diff --git a/Items/Weapons/Melee/DriftwoodSword.cs b/Items/Weapons/Melee/DriftwoodSword.cs index 92ea5b1ac9..dfa2d06a56 100644 --- a/Items/Weapons/Melee/DriftwoodSword.cs +++ b/Items/Weapons/Melee/DriftwoodSword.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; diff --git a/Items/Weapons/Melee/EssenceFlayer.cs b/Items/Weapons/Melee/EssenceFlayer.cs index 790801310d..7d6a21fa2c 100644 --- a/Items/Weapons/Melee/EssenceFlayer.cs +++ b/Items/Weapons/Melee/EssenceFlayer.cs @@ -19,11 +19,10 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 78; - Item.damage = 225; + Item.damage = 220; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 19; + Item.useTime = Item.useAnimation = 19; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 19; Item.useTurn = true; Item.knockBack = 8f; Item.UseSound = SoundID.Item71; @@ -31,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 21f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/Excelsus.cs b/Items/Weapons/Melee/Excelsus.cs index 8c5022575a..28f35fe250 100644 --- a/Items/Weapons/Melee/Excelsus.cs +++ b/Items/Weapons/Melee/Excelsus.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,21 +13,24 @@ namespace CalamityMod.Items.Weapons.Melee public class Excelsus : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 78; Item.height = 94; - Item.damage = 250; + Item.damage = 206; Item.DamageType = DamageClass.Melee; - Item.useAnimation = 15; + Item.useTime = Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 15; Item.useTurn = true; Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; } @@ -58,17 +62,5 @@ namespace CalamityMod.Items.Weapons.Melee } return false; } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, player.whoAmI); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, player.whoAmI); - } } } diff --git a/Items/Weapons/Melee/Exoblade.cs b/Items/Weapons/Melee/Exoblade.cs index e13b50b5e5..177303a7cd 100644 --- a/Items/Weapons/Melee/Exoblade.cs +++ b/Items/Weapons/Melee/Exoblade.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.shoot = ProjectileType(); Item.shootSpeed = 9f; - Item.rare = RarityType(); + Item.rare = RarityType(); } public override bool CanShoot(Player player) diff --git a/Items/Weapons/Melee/Floodtide.cs b/Items/Weapons/Melee/Floodtide.cs index 67930b7773..515e863bfd 100644 --- a/Items/Weapons/Melee/Floodtide.cs +++ b/Items/Weapons/Melee/Floodtide.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 80; Item.height = 92; - Item.damage = 91; + Item.damage = 85; Item.DamageType = DamageClass.Melee; - Item.useTime = 21; - Item.useAnimation = 21; + Item.useTime = Item.useAnimation = 24; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; diff --git a/Items/Weapons/Melee/GaelsGreatsword.cs b/Items/Weapons/Melee/GaelsGreatsword.cs index 4d78166bc2..eeeb006558 100644 --- a/Items/Weapons/Melee/GaelsGreatsword.cs +++ b/Items/Weapons/Melee/GaelsGreatsword.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GalactusBlade.cs b/Items/Weapons/Melee/GalactusBlade.cs index 93ba5d4a87..1e376464e4 100644 --- a/Items/Weapons/Melee/GalactusBlade.cs +++ b/Items/Weapons/Melee/GalactusBlade.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 144; Item.height = 146; - Item.damage = 828; + Item.damage = 185; Item.DamageType = DamageClass.Melee; Item.useAnimation = 27; Item.useStyle = ItemUseStyleID.Swing; @@ -40,8 +40,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item105; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; - Item.rare = ModContent.RarityType(); - Item.shoot = ModContent.ProjectileType(); + Item.rare = RarityType(); + Item.shoot = ProjectileType(); Item.shootSpeed = 13f; Item.scale = 0.75f; } @@ -99,7 +99,7 @@ namespace CalamityMod.Items.Weapons.Melee { Vector2 clampedMouse = player.ClampedMouseWorld(); Vector2 spawnSpot = new Vector2(clampedMouse.X, player.Center.Y) + new Vector2(Main.rand.NextFloat(-850, 850), Main.rand.NextFloat(-750, -1250)); - Projectile comet = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), spawnSpot, Utils.DirectionTo(spawnSpot, player.Calamity().mouseWorld + Main.rand.NextVector2Circular(50, 50)) * Item.shootSpeed, Item.shoot, Item.damage / 3, Item.knockBack, player.whoAmI); + Projectile comet = Projectile.NewProjectileDirect(player.GetSource_ItemUse(Item), spawnSpot, Utils.DirectionTo(spawnSpot, player.Calamity().mouseWorld + Main.rand.NextVector2Circular(50, 50)) * Item.shootSpeed, Item.shoot, Item.damage, Item.knockBack, player.whoAmI); comet.extraUpdates = Main.rand.Next(2, 3 + 1); } spawnProj = false; diff --git a/Items/Weapons/Melee/GalaxySmasher.cs b/Items/Weapons/Melee/GalaxySmasher.cs index 4181e6db0e..eba0964390 100644 --- a/Items/Weapons/Melee/GalaxySmasher.cs +++ b/Items/Weapons/Melee/GalaxySmasher.cs @@ -21,10 +21,9 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 86; Item.height = 72; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 1300; + Item.damage = 1180; Item.knockBack = 14f; - Item.useAnimation = 48; - Item.useTime = 48; + Item.useTime = Item.useAnimation = 48; Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; @@ -32,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/GeliticBlade.cs b/Items/Weapons/Melee/GeliticBlade.cs index 7fd0f6babb..6c6c677157 100644 --- a/Items/Weapons/Melee/GeliticBlade.cs +++ b/Items/Weapons/Melee/GeliticBlade.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Melee/GildedProboscis.cs b/Items/Weapons/Melee/GildedProboscis.cs index e278081d7e..c51ec4f628 100644 --- a/Items/Weapons/Melee/GildedProboscis.cs +++ b/Items/Weapons/Melee/GildedProboscis.cs @@ -1,39 +1,49 @@ -using CalamityMod.Projectiles.Melee.Spears; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Spears; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class GildedProboscis : ModItem, ILocalizedModType + public class GildedProboscis : BaseSwordHoldoutItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + + public override int ProjectileType => ModContent.ProjectileType(); + public override void SetStaticDefaults() { - ItemID.Sets.Spears[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + base.SetStaticDefaults(); } public override void SetDefaults() { Item.width = 66; Item.height = 66; - Item.damage = 315; + Item.damage = 4000; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.noMelee = true; - Item.useTurn = true; - Item.noUseGraphic = true; - Item.useAnimation = 19; + Item.useAnimation = Item.useTime = 65; Item.useStyle = ItemUseStyleID.Shoot; - Item.useTime = 19; - Item.knockBack = 8.75f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 15f; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; - Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; + Item.channel = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + base.SetDefaults(); } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override bool AltFunctionUse(Player player) + { + return true; + } } } diff --git a/Items/Weapons/Melee/GreatswordofJudgement.cs b/Items/Weapons/Melee/GreatswordofJudgement.cs index 19486833cb..5b0b5fb1a8 100644 --- a/Items/Weapons/Melee/GreatswordofJudgement.cs +++ b/Items/Weapons/Melee/GreatswordofJudgement.cs @@ -1,85 +1,144 @@ -using CalamityMod.Dusts; +using System; +using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Terraria; using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { public class GreatswordofJudgement : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private float swingRoatation = 0; - private int time = 0; - private Color mainColor; - private int swordDirection; - private int useTime = 20; - private int opacityAdjust = 0; - private float smearOpacity = 0; + public int time = 0; + public Vector2 bladeHitboxPos; + public float bladeRotation = 0; + public int bladeDirection = 0; + public float completion = 0; + public bool canHit => (completion >= 0.35f && completion <= 0.8f); + public int swingCount = 0; + public bool spawnProj = true; + public bool playSound = true; + + public Color clr = Color.MediumOrchid; + public override void SetDefaults() { Item.width = 78; Item.height = 78; - Item.damage = 155; + Item.damage = 240; Item.DamageType = DamageClass.Melee; Item.useStyle = ItemUseStyleID.Swing; - Item.useAnimation = Item.useTime = useTime; + Item.useAnimation = Item.useTime = 20; Item.useTurn = true; Item.knockBack = 7f; - Item.UseSound = SoundID.Item60; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5f; + Item.shootSpeed = 5.5f; + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + return false; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - float scale = 1.1f; + // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC + float scale = 8f; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; - hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); + } + public override bool? CanHitNPC(Player player, NPC target) + { + Vector2 mPos = player.Calamity().mouseWorld; + Vector2 shootDir = player.Center.DirectionTo(mPos); + float _ = float.NaN; + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 145, Item.width * 3f, ref _); + return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) { - swordDirection = player.direction; + swingCount++; time = 0; - swingRoatation = 0; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - opacityAdjust = 0; - smearOpacity = 0; + bladeDirection = player.direction; + bladeHitboxPos = player.Center; + bladeRotation = 0; + spawnProj = true; + playSound = true; + int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); + float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1); + + clr = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; } public override void MeleeEffects(Player player, Rectangle hitbox) { - opacityAdjust++; - if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) - smearOpacity += 0.1f; - else if (smearOpacity > 0) - smearOpacity -= 0.2f; + Vector2 mPos = player.Calamity().mouseWorld; + completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee)))); + int dir = -Math.Sign(player.Center.X - mPos.X); + + float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1); + float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1); + float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1); + float cutoff = 0.2f; + float cutoff2 = 0.95f; + + Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed; + + if (completion <= cutoff) + { + float lerp = Utils.GetLerpValue(0, cutoff, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + else + { + if (playSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center); + playSound = false; + } + if (completion >= 0.65f && spawnProj) + { + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + + Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.6f, clr, new Vector2(1f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(swipe); + + SoundEngine.PlaySound(SoundID.Item60, player.Center); + spawnProj = false; + } + float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + + float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + + player.itemLocation = player.Center; + player.direction = dir; time++; - swingRoatation += swordDirection == 1 ? 0.13f : -0.13f; - - float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; - if (swordDirection != player.direction) + } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + { + int beamDamage = player.CalcIntDamage(Item.damage * 0.4f); + Vector2 mouseClamped = player.ClampedMouseWorld(); + SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f) }, player.Center); + for (int i = 0; i < 2; i++) { - swingRoatation *= -1; - swordDirection = player.direction; - } - Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(1.95f, 2.2f), new Vector2(1, 1), 2, true, false, true, player.direction); - GeneralParticleHandler.SpawnParticle(Smear); - - if (Main.rand.NextBool(3)) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f); - Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); - dust.scale = Main.rand.NextFloat(0.4f, 0.55f); - dust.velocity = dustVel * 0.55f; - dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - dust.noGravity = true; + Vector2 vel = player.Center.DirectionFrom(target.Center).RotatedByRandom(0.7f) * Main.rand.NextFloat(18, 20); + Projectile.NewProjectile(player.GetSource_ItemUse(Item), player.Center, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI, 0, (i == 0 ? -1 : 1), 1); } } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) @@ -90,6 +149,8 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(ItemID.LunarBar, 7). + AddIngredient(). + AddIngredient(5). AddTile(TileID.LunarCraftingStation). Register(); } diff --git a/Items/Weapons/Melee/Greentide.cs b/Items/Weapons/Melee/Greentide.cs index ce68ea8fc9..877ec86454 100644 --- a/Items/Weapons/Melee/Greentide.cs +++ b/Items/Weapons/Melee/Greentide.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -20,16 +22,19 @@ namespace CalamityMod.Items.Weapons.Melee internal const int TotalRows = 2; - internal const int TotalTeeth = 4; + internal const int TotalTeeth = 3; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 62; Item.height = 62; - Item.damage = 97; + Item.damage = 81; Item.DamageType = DamageClass.Melee; - Item.useTime = 27; - Item.useAnimation = 27; + Item.useTime = Item.useAnimation = 30; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; @@ -46,17 +51,19 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - for (int i = 0; i < 2; ++i) + for (int i = -2; i <= 2; i++) { - Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(-0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.5f), knockback / 3, player.whoAmI, 1f, 0f); + if (i == 0) + { + Projectile strongTooth = Projectile.NewProjectileDirect(source, position, velocity * 1.2f, type, damage, knockback, player.whoAmI, 2f, 0f); + strongTooth.penetrate = -1; + strongTooth.timeLeft = 150; + } + else + { + Projectile.NewProjectile(source, position, velocity.RotatedBy(0.1f * i).RotatedByRandom(0.06f) * (1 - (Math.Abs(i) - 1) * 0.3f), type, (int)(damage * 0.5f), knockback / 3, player.whoAmI, 1f, 0f); + } } - for (int i = 0; i < 2; ++i) - { - Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedBy(0.1f * (i + 1)).RotatedByRandom(0.06f) * (1 - i * 0.3f), type, (int)(damage * 0.5f), knockback / 3, player.whoAmI, 1f, 0f); - } - Projectile strongTooth = Projectile.NewProjectileDirect(source, position, velocity * 1.2f, type, (int)(damage), knockback, player.whoAmI, 2f, 0f); - strongTooth.penetrate = -1; - strongTooth.timeLeft = 150; return false; } @@ -81,20 +88,16 @@ namespace CalamityMod.Items.Weapons.Melee int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.1f)); float teethKnockback = Item.knockBack * 0.2f; - bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; - float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; int centralProjectile = TotalTeeth / 2; - int otherCentralProjectile = centralProjectile - 1; float teethXVelocityReduction = 0.9f; float minVelocityAdjustment = 0.8f; float maxVelocityAdjustment = 1f; - float velocityAdjustment = minVelocityAdjustment; for (int i = 0; i < TotalRows; i++) { bool topTeeth = i == 0; for (int j = 0; j < TotalTeeth; j++) { - velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + float velocityAdjustment = j == centralProjectile ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs(j + 0.5f - centralProjectile) / (float)centralProjectile); if (topTeeth) { position.X += MathHelper.Lerp(-HalvedTeethSpread * 0.3f, HalvedTeethSpread * 0.3f, j / (float)(TotalTeeth - 1)); @@ -131,22 +134,18 @@ namespace CalamityMod.Items.Weapons.Melee Vector2 secondVelocity = (destination - secondPosition).SafeNormalize(Vector2.UnitY) * ShootSpeed; Vector2 secondCachedVelocity = secondVelocity; - int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.5)); + int teethDamage = player.CalcIntDamage((int)(Item.damage * 0.1f)); float teethKnockback = Item.knockBack * 0.2f; - bool evenNumberOfProjectiles = TotalTeeth % 2 == 0; - float amountToAdd = evenNumberOfProjectiles ? 0.5f : 0f; int centralProjectile = TotalTeeth / 2; - int otherCentralProjectile = centralProjectile - 1; float teethXVelocityReduction = 0.9f; float minVelocityAdjustment = 0.8f; float maxVelocityAdjustment = 1f; - float velocityAdjustment = minVelocityAdjustment; for (int i = 0; i < TotalRows; i++) { bool topTeeth = i == 0; for (int j = 0; j < TotalTeeth; j++) { - velocityAdjustment = ((j == centralProjectile || j == otherCentralProjectile) && evenNumberOfProjectiles) ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs((j + amountToAdd) - centralProjectile) / (float)centralProjectile); + float velocityAdjustment = j == centralProjectile ? minVelocityAdjustment : MathHelper.Lerp(minVelocityAdjustment, maxVelocityAdjustment, Math.Abs(j + 0.5f - centralProjectile) / (float)centralProjectile); if (topTeeth) { position.X += MathHelper.Lerp(-HalvedTeethSpread, HalvedTeethSpread, j / (float)(TotalTeeth - 1)); @@ -173,7 +172,7 @@ namespace CalamityMod.Items.Weapons.Melee { Vector2 dustVel = Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.9f, 1.5f); if (Main.rand.NextBool(3)) - Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, 102, dustVel.X, dustVel.Y); + Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.Water_Desert, dustVel.X, dustVel.Y); } } } diff --git a/Items/Weapons/Melee/HellionFlowerSpear.cs b/Items/Weapons/Melee/HellionFlowerSpear.cs index d89110439a..94a013896c 100644 --- a/Items/Weapons/Melee/HellionFlowerSpear.cs +++ b/Items/Weapons/Melee/HellionFlowerSpear.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 64; Item.height = 64; - Item.damage = 135; + Item.damage = 85; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; diff --git a/Items/Weapons/Melee/Hellkite.cs b/Items/Weapons/Melee/Hellkite.cs index e3954b3dff..5cb216baa4 100644 --- a/Items/Weapons/Melee/Hellkite.cs +++ b/Items/Weapons/Melee/Hellkite.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 124; Item.height = 124; - Item.damage = 795; + Item.damage = 760; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 71; Item.useTurn = true; diff --git a/Items/Weapons/Melee/HolyCollider.cs b/Items/Weapons/Melee/HolyCollider.cs index 8829a63b1c..88240d2b8e 100644 --- a/Items/Weapons/Melee/HolyCollider.cs +++ b/Items/Weapons/Melee/HolyCollider.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.BaseItems; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -14,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee public class HolyCollider : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 114; diff --git a/Items/Weapons/Melee/InsidiousImpaler.cs b/Items/Weapons/Melee/InsidiousImpaler.cs index 61e02ad1f3..e481325e65 100644 --- a/Items/Weapons/Melee/InsidiousImpaler.cs +++ b/Items/Weapons/Melee/InsidiousImpaler.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Spears; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -12,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class InsidiousImpaler : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 66; diff --git a/Items/Weapons/Melee/IridescentExcalibur.cs b/Items/Weapons/Melee/IridescentExcalibur.cs deleted file mode 100644 index 76c749add9..0000000000 --- a/Items/Weapons/Melee/IridescentExcalibur.cs +++ /dev/null @@ -1,193 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Rarities; -using CalamityMod.Tiles.Furniture.CraftingStations; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.DataStructures; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Melee -{ - [LegacyName("ElementalExcalibur")] - public class IridescentExcalibur : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Melee"; - - private int MaxBeamTypes = 12; - - private int BeamType = 0; - - private const int Alpha = 100; - - private const float ShootSpeed = 16f; - - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } - - public override void SetDefaults() - { - Item.width = 112; - Item.height = 112; - Item.damage = 3000; - Item.useAnimation = Item.useTime = 15; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; - Item.DamageType = DamageClass.Melee; - Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; - Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = ShootSpeed; - Item.rare = ModContent.RarityType(); - Item.shootsEveryUse = true; - } - - public override void UseStyle(Player player, Rectangle heldItemFrame) - { - player.itemLocation += new Vector2(-12f * player.direction, 2f * player.gravDir).RotatedBy(player.itemRotation); - } - - public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) - { - Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/IridescentExcaliburGlow").Value); - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; - - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) - { - if (player.altFunctionUse == 2) - { - float adjustedItemScale = player.GetAdjustedItemScale(Item); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - Projectile.NewProjectile(source, player.MountedCenter, new Vector2(player.direction, 0f), ModContent.ProjectileType(), 0, knockback, player.whoAmI, (float)player.direction * player.gravDir, player.itemAnimationMax, adjustedItemScale); - NetMessage.SendData(MessageID.PlayerControls, -1, -1, null, player.whoAmI); - } - else - { - int proj = Projectile.NewProjectile(source, position, velocity, type, (int)Math.Round(damage * 0.5), knockback * 0.5f, player.whoAmI, (float)BeamType); - if (BeamType == 7) - Main.projectile[proj].penetrate = 3; - - BeamType++; - if (BeamType >= MaxBeamTypes) - BeamType = 0; - } - - return false; - } - - public override bool AltFunctionUse(Player player) => true; - - public override bool? UseItem(Player player) - { - Item.noMelee = player.altFunctionUse == 2; - return base.UseItem(player); - } - - public override void ModifyHitNPC(Player player, NPC target, ref NPC.HitModifiers modifiers) - { - if (player.altFunctionUse == 2) - modifiers.SourceDamage *= 2; - } - - public override void ModifyHitPvp(Player player, Player target, ref Player.HurtModifiers modifiers) - { - if (player.altFunctionUse == 2) - modifiers.SourceDamage *= 2; - } - - public override void MeleeEffects(Player player, Rectangle hitbox) - { - if (Main.rand.NextBool()) - { - Color rainbowColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); - Color color = Color.White; - int dustChoice = player.altFunctionUse == 2 ? Main.rand.Next(12) : BeamType; - switch (dustChoice) - { - case 0: // Red - color = new Color(255, 0, 0, Alpha); - break; - case 1: // Orange - color = new Color(255, 128, 0, Alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, Alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, Alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, Alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, Alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, Alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, Alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, Alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, Alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, Alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, Alpha); - break; - default: - break; - } - - Dust rainbow = Main.dust[Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.RainbowMk2)]; - rainbow.velocity *= 0f; - rainbow.color = Color.Lerp(rainbowColor, color, (float)Math.Sqrt((MathF.Cos(Main.GlobalTimeWrappedHourly / 60f) + 1f) * 0.5f)); - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1.2f, 1.6f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - } - } - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.TrueExcalibur). - AddIngredient(). - AddIngredient(3). - AddIngredient(15). - AddTile(). - Register(); - } - } -} diff --git a/Items/Weapons/Melee/IridescentExcalibur.png b/Items/Weapons/Melee/IridescentExcalibur.png deleted file mode 100644 index 5ff82d5ac7..0000000000 Binary files a/Items/Weapons/Melee/IridescentExcalibur.png and /dev/null differ diff --git a/Items/Weapons/Melee/IridescentExcaliburGlow.png b/Items/Weapons/Melee/IridescentExcaliburGlow.png deleted file mode 100644 index e122aef76b..0000000000 Binary files a/Items/Weapons/Melee/IridescentExcaliburGlow.png and /dev/null differ diff --git a/Items/Weapons/Melee/Lacerator.cs b/Items/Weapons/Melee/Lacerator.cs index a23c35ba04..187f17e51e 100644 --- a/Items/Weapons/Melee/Lacerator.cs +++ b/Items/Weapons/Melee/Lacerator.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 26; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 152; + Item.damage = 115; Item.knockBack = 7f; Item.useTime = 20; Item.useAnimation = 20; diff --git a/Items/Weapons/Melee/LifehuntScythe.cs b/Items/Weapons/Melee/LifehuntScythe.cs index 488dc49969..eea043bf64 100644 --- a/Items/Weapons/Melee/LifehuntScythe.cs +++ b/Items/Weapons/Melee/LifehuntScythe.cs @@ -38,25 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.CursedTorch); } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - int heal = 5; - player.lifeSteal -= heal; - player.HealPlayer(heal); - } - - public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo) - { - if (player.moonLeech || player.lifeSteal <= 0f) - return; - - int heal = 5; - player.lifeSteal -= heal; - player.HealPlayer(heal); - } + public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) => player.DoLifestealDirect(target, 5, 0.5f); public override void AddRecipes() { diff --git a/Items/Weapons/Melee/Lucrecia.cs b/Items/Weapons/Melee/Lucrecia.cs index e9a0937621..b42c097c68 100644 --- a/Items/Weapons/Melee/Lucrecia.cs +++ b/Items/Weapons/Melee/Lucrecia.cs @@ -1,41 +1,68 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Materials; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Lucrecia : ModItem, ILocalizedModType + public class Lucrecia : BaseSwordHoldoutItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public static int MaxEnergy = 100; + + public override int ProjectileType => ModContent.ProjectileType(); + public override void SetDefaults() { Item.width = 54; Item.height = 54; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Rapier; - Item.damage = 90; + Item.useStyle = ItemUseStyleID.Shoot; + Item.damage = 170; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 30; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 4.2f; + Item.useAnimation = Item.useTime = 34; + Item.shootSpeed = 10f; Item.knockBack = 8.25f; - Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; + + Item.autoReuse = true; + Item.channel = true; + // Item.noMelee = true; + // Item.noUseGraphic = true; + base.SetDefaults(); + } - public override bool MeleePrefix() => true; + public override bool AltFunctionUse(Player player) + { + return true; + } + + + public override void HoldItem(Player player) + { + if (player.Calamity().cooldowns.TryGetValue(LucreciaEnergy.ID, out var cooldown)) + { + cooldown.timeLeft = player.Calamity().lucreciaEnergy; + } + else + { + player.AddCooldown(LucreciaEnergy.ID, 0); + } + } + + // public override bool MeleePrefix() => true; public override void AddRecipes() { CreateRecipe(). AddIngredient(5). - AddIngredient(). + AddIngredient(ItemID.FallenStar, 10). AddIngredient(ItemID.SoulofLight, 5). AddIngredient(ItemID.SoulofNight, 5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Melee/MantisClaws.cs b/Items/Weapons/Melee/MantisClaws.cs index e088461822..828860755b 100644 --- a/Items/Weapons/Melee/MantisClaws.cs +++ b/Items/Weapons/Melee/MantisClaws.cs @@ -1,17 +1,8 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; +using CalamityMod.Items.BaseItems; +using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; -using CalamityMod.Items.BaseItems; using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using CalamityMod.Balancing; -using Terraria.Audio; -using CalamityMod.Projectiles.Melee; -using System; -using CalamityMod.Particles; namespace CalamityMod.Items.Weapons.Melee { @@ -20,10 +11,9 @@ namespace CalamityMod.Items.Weapons.Melee public new string LocalizationCategory => "Items.Weapons.Melee"; public override void SetDefaults() { - base.SetDefaults(); Item.width = 26; Item.height = 20; - Item.damage = 111; + Item.damage = 75; Item.DamageType = DamageClass.Melee; Item.useAnimation = Item.useTime = 25; Item.knockBack = 0.25f; diff --git a/Items/Weapons/Melee/MirrorBlade.cs b/Items/Weapons/Melee/MirrorBlade.cs index beda17aa01..684601d2fa 100644 --- a/Items/Weapons/Melee/MirrorBlade.cs +++ b/Items/Weapons/Melee/MirrorBlade.cs @@ -1,47 +1,146 @@ -using CalamityMod.Projectiles.Melee; +using System; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Mono.Cecil; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; +using Terraria.Localization; +using Terraria.Audio; +using CalamityMod.Items.Weapons.Summon; using Terraria.ModLoader; +using static System.Net.Mime.MediaTypeNames; namespace CalamityMod.Items.Weapons.Melee { - public class MirrorBlade : ModItem, ILocalizedModType + public class MirrorBlade : BaseSwordHoldoutItem, ILocalizedModType, IHoldShiftTooltipItem { public new string LocalizationCategory => "Items.Weapons.Melee"; - private int baseDamage = 100; + public bool HasFlavorTooltip => true; + public override int ProjectileType => ModContent.ProjectileType(); + internal const float SlashProjectileDamageMultiplier = 0.5f; + internal const int SlashProjectileLimit = 4; + internal const int SlashCreationRate = 18; + + public int reflectTimer = 0; + + public override void SetStaticDefaults() + { + Main.RegisterItemAnimation(Item.type, new DrawAnimationVertical(5, 5)); + ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + base.SetStaticDefaults(); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { - Item.width = 72; - Item.height = 72; - Item.damage = baseDamage; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 12; - Item.useTime = 12; + Item.width = 114; + Item.height = 128; + Item.damage = 550; + Item.DamageType = TrueMeleeDamageClass.Instance; + Item.useAnimation = 40; + Item.useTime = 40; Item.useTurn = true; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 7f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.shootSpeed = 9f; Item.shoot = ModContent.ProjectileType(); + base.SetDefaults(); } - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + public override bool CanUseItem(Player player) { - int conDamage = target.damage + baseDamage; - if (conDamage < baseDamage) + return base.CanUseItem(player); + } + + public override void UpdateInventory(Player player) + { + if (reflectTimer > 0) { - conDamage = baseDamage; + if (reflectTimer <= 50) + { + + float coneLength = 80f; + float maximumAngle = 0.8f; + float coneRotation = player.DirectionTo(Main.MouseWorld).ToRotation(); + var shardCount = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == player.whoAmI && (proj.ModProjectile as MirrorBlast).isShard) + { + shardCount++; + } + } + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.hostile && proj.damage > 0 && proj.Hitbox.IntersectsConeSlowMoreAccurate(player.Center, coneLength, coneRotation, maximumAngle)) + { + if (shardCount > 0) + { + SoundEngine.PlaySound(SeekingScorcher.LightShatterSound, player.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastDeath,player.Center); + } + if (shardCount >= 10) + { + player.SetImmuneTimeForAllTypes(player.longInvince ? 60 : 30); + } + proj.Calamity().multiplicativeDR += shardCount / 10f; + proj.Calamity().multiplicativeDRTimer = 60; + foreach (var proj2 in Main.projectile) + { + if (proj2.active && proj2.type == ModContent.ProjectileType() && proj2.owner == player.whoAmI && (proj2.ModProjectile as MirrorBlast).isShard) + { + proj2.damage = (int)(proj2.damage * (shardCount >= 10 ? 3f : 2f)); + (proj2.ModProjectile as MirrorBlast).shardShield = 0; + (proj2.ModProjectile as MirrorBlast).shardNum = 11; + proj2.netUpdate = true; + } + } + reflectTimer = 0; + return; + } + } + } + reflectTimer--; } - if (conDamage > 400) + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + if (player.altFunctionUse == 2) { - conDamage = 400; + bool alreadyReflecting = reflectTimer > 0; + bool hasShard = false; + reflectTimer = 60; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == player.whoAmI && (proj.ModProjectile as MirrorBlast).isShard) + { + (proj.ModProjectile as MirrorBlast).shardShield = 60; + proj.netUpdate = true; + hasShard = true; + } + } + + if (!alreadyReflecting && hasShard) + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalSpawnEnemy,player.Center); + return false; } - Item.damage = conDamage; + return base.Shoot(player, source, position, velocity, type, damage, knockback); + } + + + public override bool AltFunctionUse(Player player) + { + return true; } } } diff --git a/Items/Weapons/Melee/MirrorBlade.png b/Items/Weapons/Melee/MirrorBlade.png index 5247456d75..3af0672f28 100644 Binary files a/Items/Weapons/Melee/MirrorBlade.png and b/Items/Weapons/Melee/MirrorBlade.png differ diff --git a/Items/Weapons/Melee/MonolithSword.cs b/Items/Weapons/Melee/MonolithSword.cs index 79100057a1..911473b62a 100644 --- a/Items/Weapons/Melee/MonolithSword.cs +++ b/Items/Weapons/Melee/MonolithSword.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; diff --git a/Items/Weapons/Melee/Murasama.cs b/Items/Weapons/Melee/Murasama.cs index aec2123d1a..b7a00a61d5 100644 --- a/Items/Weapons/Melee/Murasama.cs +++ b/Items/Weapons/Melee/Murasama.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 90; Item.height = 134; - Item.damage = 2222; + Item.damage = 2001; Item.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Melee/MycelialClaws.cs b/Items/Weapons/Melee/MycelialClaws.cs index d8ed6d9a09..b8da26e630 100644 --- a/Items/Weapons/Melee/MycelialClaws.cs +++ b/Items/Weapons/Melee/MycelialClaws.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -9,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Melee public class MycelialClaws : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 22; diff --git a/Items/Weapons/Melee/Nadir.cs b/Items/Weapons/Melee/Nadir.cs index 4ba4e5d206..e8edf14bad 100644 --- a/Items/Weapons/Melee/Nadir.cs +++ b/Items/Weapons/Melee/Nadir.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Melee/Nebulash.cs b/Items/Weapons/Melee/Nebulash.cs index b6c96a6a50..4858d975ea 100644 --- a/Items/Weapons/Melee/Nebulash.cs +++ b/Items/Weapons/Melee/Nebulash.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,11 +12,15 @@ namespace CalamityMod.Items.Weapons.Melee public class Nebulash : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 16; Item.height = 16; - Item.damage = 60; + Item.damage = 85; Item.rare = ItemRarityID.Lime; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Melee/Oblivion.cs b/Items/Weapons/Melee/Oblivion.cs index 33ee8074d6..f836bb4d0b 100644 --- a/Items/Weapons/Melee/Oblivion.cs +++ b/Items/Weapons/Melee/Oblivion.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -20,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -27,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 28; Item.height = 38; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 55; + Item.damage = 50; Item.knockBack = 4f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/OldLordClaymore.cs b/Items/Weapons/Melee/OldLordClaymore.cs index 6a835e742a..82d8b08a91 100644 --- a/Items/Weapons/Melee/OldLordClaymore.cs +++ b/Items/Weapons/Melee/OldLordClaymore.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Projectiles.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,9 +15,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { - Item.width = 70; - Item.height = 70; - Item.damage = 195; + Item.width = 76; + Item.height = 76; + Item.damage = 144; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = Item.useTime = 90; // Yes it's actually supposed to be this slow @@ -31,6 +33,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; } + public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) + { + Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymoreGlow").Value); + } public override bool MeleePrefix() => true; public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 11; } diff --git a/Items/Weapons/Melee/OldLordClaymore.png b/Items/Weapons/Melee/OldLordClaymore.png index 9326b47f1e..3ac3266613 100644 Binary files a/Items/Weapons/Melee/OldLordClaymore.png and b/Items/Weapons/Melee/OldLordClaymore.png differ diff --git a/Items/Weapons/Melee/OldLordClaymoreGlow.png b/Items/Weapons/Melee/OldLordClaymoreGlow.png new file mode 100644 index 0000000000..1dc3c129f5 Binary files /dev/null and b/Items/Weapons/Melee/OldLordClaymoreGlow.png differ diff --git a/Items/Weapons/Melee/Orderbringer.cs b/Items/Weapons/Melee/Orderbringer.cs index 4672492beb..657b17ab47 100644 --- a/Items/Weapons/Melee/Orderbringer.cs +++ b/Items/Weapons/Melee/Orderbringer.cs @@ -1,131 +1,195 @@ -using CalamityMod.Items.Materials; +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; -using Terraria.Audio; -using Terraria.ID; using Microsoft.Xna.Framework; -using Terraria.ModLoader; -using CalamityMod.Particles; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; -using Basic.Reference.Assemblies; -using System; -using Mono.Cecil; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("GreatswordofBlah")] + [LegacyName("IridescentExcalibur")] public class Orderbringer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - private float swingRoatation = 0; - private int time = 0; - private Color mainColor; - private int swordDirection; - private int useTime = 18; - private int opacityAdjust = 0; - private float smearOpacity = 0; + public int time = 0; + public Vector2 bladeHitboxPos; + public float bladeRotation = 0; + public int bladeDirection = 0; + public float completion = 0; + public bool canHit => (completion >= 0.35f && completion <= 0.8f); + public int swingCount = 0; + public bool spawnProj = true; + public bool playSound = true; public override void SetDefaults() { - Item.width = Item.height = 108; - Item.damage = 445; + Item.width = Item.height = 112; + Item.damage = 840; Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = useTime; + Item.useAnimation = Item.useTime = 16; Item.useStyle = ItemUseStyleID.Swing; Item.useTurn = true; Item.knockBack = 8f; - Item.UseSound = SoundID.Item60; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityVioletBuyPrice; + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f); - - for (int i = 0; i < 4; i++) - { - Vector2 vel = (velocity * 2.5f).RotatedByRandom(0.6f); - Projectile.NewProjectile(source, player.ClampedMouseWorld() - (velocity * 40) + Main.rand.NextVector2Circular(130, 130), vel * Main.rand.NextFloat(0.8f, 1.2f), ModContent.ProjectileType(), (int)(damage * 0.1f), knockback * 0.2f, player.whoAmI, 0, 0, 1); - } return false; } public override void UseItemHitbox(Player player, ref Rectangle hitbox, ref bool noHitbox) { - float scale = 1.2f; + // Basically just insures the enemy is always able to be hit if they're in range, the actual collision check is done in CanHitNPC + float scale = 8f; Vector2 newSize = new Point(hitbox.Width, hitbox.Height).ToVector2() * scale; - hitbox = new Rectangle(hitbox.X - (int)((newSize.X - hitbox.Width) / 2f), hitbox.Y - (int)((newSize.Y - hitbox.Height) / 2f), (int)newSize.X, (int)newSize.Y); + hitbox = new Rectangle((int)(bladeHitboxPos.X - newSize.X / 2f), (int)(bladeHitboxPos.Y - newSize.Y / 2f), (int)newSize.X, (int)newSize.Y); + } + public override bool? CanHitNPC(Player player, NPC target) + { + Vector2 mPos = player.Calamity().mouseWorld; + Vector2 shootDir = player.Center.DirectionTo(mPos); + float _ = float.NaN; + bool hitCheck = Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), player.Center - shootDir * 30, player.Center + shootDir * 245, Item.width * 3f, ref _); + return ((canHit && hitCheck) ? null : false); } public override void UseAnimation(Player player) { - swordDirection = player.direction; + swingCount++; time = 0; - swingRoatation = 0; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - opacityAdjust = 0; - smearOpacity = 0; + bladeDirection = player.direction; + bladeHitboxPos = player.Center; + bladeRotation = 0; + spawnProj = true; + playSound = true; + int dir = -Math.Sign(player.Center.X - player.Calamity().mouseWorld.X); + float startRot = MathHelper.ToRadians(-90) * dir * (swingCount % 2 == 0 ? 1 : -1); } public override void MeleeEffects(Player player, Rectangle hitbox) { - opacityAdjust++; - if (opacityAdjust >= 5 && opacityAdjust <= 15 && smearOpacity < 0.9f) - smearOpacity += 0.1f; - else if (smearOpacity > 0) - smearOpacity -= 0.2f; + Vector2 mPos = player.Calamity().mouseWorld; + completion = (float)((float)time / ((float)(Item.useAnimation / player.GetAttackSpeed(DamageClass.Melee)))); + int dir = -Math.Sign(player.Center.X - mPos.X); + + float startRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? 1 : -1); + float endRot = MathHelper.ToRadians(-110) * dir * (swingCount % 2 == 0 ? -1 : 1); + float minRot = MathHelper.ToRadians(-150) * dir * (swingCount % 2 == 0 ? 1 : -1); + float cutoff = 0.2f; + float cutoff2 = 0.95f; + + Vector2 shootDir = player.Center.DirectionTo(mPos) * Item.shootSpeed; + + if (completion <= cutoff) + { + float lerp = Utils.GetLerpValue(0, cutoff, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(startRot, minRot, CalamityUtils.EaseInOutExp(lerp, 4f, 4f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + else + { + if (playSound) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swing with { Pitch = Main.rand.NextFloat(0.1f, 0.3f), Volume = 1f }, player.Center); + playSound = false; + } + if (completion >= 0.65f && spawnProj) + { + Projectile.NewProjectile(player.GetSource_FromThis(), player.Center, shootDir, Item.shoot, Item.damage, Item.knockBack, player.whoAmI, 0f); + + for (int i = 0; i < 4; i++) + { + float rot = Main.rand.NextFloat(0.5f, 0.65f) * (Main.rand.NextBool() ? 1 : -1); + Vector2 vel = (shootDir * 2.5f).RotatedByRandom(0.6f); + Projectile.NewProjectile(player.GetSource_FromThis(), player.ClampedMouseWorld() - (shootDir * 40) + Main.rand.NextVector2Circular(130, 130), vel.RotatedBy(rot) * Main.rand.NextFloat(0.9f, 1.2f), ModContent.ProjectileType(), (int)(Item.damage * 0.12f), (int)(Item.knockBack * 0.2f), player.whoAmI, 0, rot, 1); + } + + Particle swipe = new CustomSpark(player.Center - shootDir * 5, shootDir.RotatedBy(0.4f * (dir * (swingCount % 2 == 0 ? 1 : -1))) * 2.5f, "CalamityMod/Particles/VerticalSmearLarge", false, (int)(14 / player.GetAttackSpeed(DamageClass.Melee)), 0.8f, player.Calamity().lightRGB, new Vector2(1f, 1f), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(swipe); + + SoundEngine.PlaySound(SoundID.Item60, player.Center); + spawnProj = false; + } + float lerp = Utils.GetLerpValue(cutoff, cutoff2, completion, true); + player.itemRotation = player.Center.DirectionTo(mPos).ToRotation() + MathHelper.Lerp(minRot, endRot, CalamityUtils.EaseInOutExp(lerp, 6f, 2f)); + player.itemRotation += (MathHelper.Pi) * (dir == 1 ? 0 : 1) + MathHelper.PiOver4 * dir; + } + + float extraRot = (dir == 1 ? -MathHelper.PiOver4 : MathHelper.ToRadians(225)); + bladeHitboxPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 240; + Vector2 tipPos = player.Center + (player.itemRotation + extraRot).ToRotationVector2() * 180; + + player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + player.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, player.itemRotation + MathHelper.ToRadians(-130) * dir); + + player.itemLocation = player.Center; + player.direction = dir; time++; - swingRoatation += swordDirection == 1 ? 0.17f : -0.17f; - - float Rot = (swordDirection == -1 ? 1.8f : -1.8f) + swingRoatation; - if (swordDirection != player.direction) - { - swingRoatation *= -1; - swordDirection = player.direction; - } - Particle Smear = new SemiCircularSmearFade(player.Center, Vector2.Zero, mainColor * smearOpacity, Rot, Main.rand.NextFloat(2.8f, 3.2f), new Vector2(1, 1), 2, true, false, true, player.direction); - GeneralParticleHandler.SpawnParticle(Smear); - - if (Main.rand.NextBool()) - { - Vector2 dustVel = new Vector2(5 * swordDirection, -5).RotatedByRandom(1.55f) * Main.rand.NextFloat(0.7f, 1.3f) * 2; - Dust dust = Dust.NewDustPerfect(player.Center + dustVel * 9, 278); - dust.scale = Main.rand.NextFloat(0.5f, 0.75f); - dust.velocity = dustVel * 0.55f; - dust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - dust.noGravity = true; - } } public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { - int beamDamage = player.CalcIntDamage(Item.damage * 0.5f); + int beamDamage = player.CalcIntDamage(Item.damage * 0.4f); Vector2 mouseClamped = player.ClampedMouseWorld(); + SoundEngine.PlaySound(SoundID.Item84 with { Volume = 1f, Pitch = Main.rand.NextFloat(0.5f, 0.7f)}, player.Center); for (int i = 0; i < 2; i++) { Vector2 targetPos = Main.MouseWorld; NPC target2 = Main.MouseWorld.ClosestNPCAt(650); if (target2 != null) - targetPos = target2.Center + target2.velocity * 14; + targetPos = target2.Center; Vector2 spawnPos = mouseClamped + new Vector2(Main.rand.NextFloat(-300, 300), -900); Vector2 vel = (targetPos - spawnPos).SafeNormalize(Vector2.UnitY) * 10; Projectile.NewProjectile(player.GetSource_ItemUse(Item), spawnPos, vel, ModContent.ProjectileType(), beamDamage, 0, player.whoAmI); } } + public override void ModifyTooltips(List list) + { + Player Owner = Main.LocalPlayer; + if (Owner is null) + return; + + float rate = Main.GlobalTimeWrappedHourly * 7; + List eColors = new List() + { + Color.PaleVioletRed, + Color.Coral, + Color.Khaki, + Color.PaleGreen, + Color.Turquoise, + Color.Violet + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + Color finalColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f); + TooltipLine line = list.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Tooltip2"); + if (line != null) + line.OverrideColor = Color.Lerp(finalColor, Color.White, 0.3f); + } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) { Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request("CalamityMod/Items/Weapons/Melee/OrderbringerGlow").Value); } - public override void AddRecipes() { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(20). + AddIngredient(5). + AddIngredient(5). AddTile(). Register(); } diff --git a/Items/Weapons/Melee/Orderbringer.png b/Items/Weapons/Melee/Orderbringer.png index ade13f44bf..5ff82d5ac7 100644 Binary files a/Items/Weapons/Melee/Orderbringer.png and b/Items/Weapons/Melee/Orderbringer.png differ diff --git a/Items/Weapons/Melee/OrderbringerGlow.png b/Items/Weapons/Melee/OrderbringerGlow.png index 8c6448103a..e122aef76b 100644 Binary files a/Items/Weapons/Melee/OrderbringerGlow.png and b/Items/Weapons/Melee/OrderbringerGlow.png differ diff --git a/Items/Weapons/Melee/Azathoth.cs b/Items/Weapons/Melee/Ozzathoth.cs similarity index 92% rename from Items/Weapons/Melee/Azathoth.cs rename to Items/Weapons/Melee/Ozzathoth.cs index 2dd12c9fb4..78255997e8 100644 --- a/Items/Weapons/Melee/Azathoth.cs +++ b/Items/Weapons/Melee/Ozzathoth.cs @@ -9,7 +9,8 @@ using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Melee { - public class Azathoth : ModItem, ILocalizedModType + [LegacyName("Azathoth")] + public class Ozzathoth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; @@ -41,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.noUseGraphic = true; Item.noMelee = true; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Azathoth.png b/Items/Weapons/Melee/Ozzathoth.png similarity index 100% rename from Items/Weapons/Melee/Azathoth.png rename to Items/Weapons/Melee/Ozzathoth.png diff --git a/Items/Weapons/Melee/PerfectDark.cs b/Items/Weapons/Melee/PerfectDark.cs index 666b744d04..73949cbb30 100644 --- a/Items/Weapons/Melee/PerfectDark.cs +++ b/Items/Weapons/Melee/PerfectDark.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class PerfectDark : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 50; @@ -37,14 +43,5 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 300); } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 5). - AddIngredient(15). - AddIngredient(ItemID.RottenChunk, 5). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Melee/PhotonRipper.cs b/Items/Weapons/Melee/PhotonRipper.cs index 067ee83e3b..8faaf618d0 100644 --- a/Items/Weapons/Melee/PhotonRipper.cs +++ b/Items/Weapons/Melee/PhotonRipper.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Melee/PrismaticBreaker.cs b/Items/Weapons/Melee/PrismaticBreaker.cs index cf8f7e9eba..72aaab14ce 100644 --- a/Items/Weapons/Melee/PrismaticBreaker.cs +++ b/Items/Weapons/Melee/PrismaticBreaker.cs @@ -17,34 +17,13 @@ namespace CalamityMod.Items.Weapons.Melee public class PrismaticBreaker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - internal static readonly Color[] colors = new Color[] - { - new Color(255, 0, 0, 50), //Red - new Color(255, 128, 0, 50), //Orange - new Color(255, 255, 0, 50), //Yellow - new Color(128, 255, 0, 50), //Lime - new Color(0, 255, 0, 50), //Green - new Color(0, 255, 128, 50), //Turquoise - new Color(0, 255, 255, 50), //Cyan - new Color(0, 128, 255, 50), //Light Blue - new Color(0, 0, 255, 50), //Blue - new Color(128, 0, 255, 50), //Purple - new Color(255, 0, 255, 50), //Fuschia - new Color(255, 0, 128, 50) //Hot Pink - }; - - public override void SetStaticDefaults() - { - Item.staff[Type] = true; - - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } + public override void SetStaticDefaults() => Item.staff[Type] = true; public override void SetDefaults() { Item.width = 50; Item.height = 50; - Item.damage = 490; + Item.damage = 425; Item.useStyle = ItemUseStyleID.Shoot; Item.useAnimation = Item.useTime = 13; Item.reuseDelay = 30; @@ -56,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/Pwnagehammer.cs b/Items/Weapons/Melee/Pwnagehammer.cs index 4c0510417d..0b0e47fa19 100644 --- a/Items/Weapons/Melee/Pwnagehammer.cs +++ b/Items/Weapons/Melee/Pwnagehammer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 66; Item.height = 66; - Item.damage = 210; + Item.damage = 150; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; diff --git a/Items/Weapons/Melee/Quagmire.cs b/Items/Weapons/Melee/Quagmire.cs index 93827b8f25..0d405a1c87 100644 --- a/Items/Weapons/Melee/Quagmire.cs +++ b/Items/Weapons/Melee/Quagmire.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 30; Item.height = 36; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 52; + Item.damage = 54; Item.knockBack = 3.5f; Item.useTime = 22; Item.useAnimation = 22; diff --git a/Items/Weapons/Melee/SaharaSlicers.cs b/Items/Weapons/Melee/SaharaSlicers.cs index 40549fec04..4a6023a941 100644 --- a/Items/Weapons/Melee/SaharaSlicers.cs +++ b/Items/Weapons/Melee/SaharaSlicers.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Melee.Shortswords; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; @@ -18,6 +19,8 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { diff --git a/Items/Weapons/Melee/SausageMaker.cs b/Items/Weapons/Melee/SausageMaker.cs index d43d86bd7f..6fbf590a5c 100644 --- a/Items/Weapons/Melee/SausageMaker.cs +++ b/Items/Weapons/Melee/SausageMaker.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee.Spears; using Terraria; using Terraria.ID; @@ -12,6 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { ItemID.Sets.Spears[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -36,15 +38,5 @@ namespace CalamityMod.Items.Weapons.Melee } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 4). - AddIngredient(12). - AddIngredient(ItemID.Vertebrae, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Melee/ScourgeoftheCosmos.cs b/Items/Weapons/Melee/ScourgeoftheCosmos.cs index 3eaaa817b5..a94b2dfeaa 100644 --- a/Items/Weapons/Melee/ScourgeoftheCosmos.cs +++ b/Items/Weapons/Melee/ScourgeoftheCosmos.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 64; - Item.damage = 478; + Item.damage = 380; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noMelee = true; Item.noUseGraphic = true; @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item109; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; } diff --git a/Items/Weapons/Melee/SeekingScorcher.cs b/Items/Weapons/Melee/SeekingScorcher.cs index b84e6481c7..f3fb9c7c19 100644 --- a/Items/Weapons/Melee/SeekingScorcher.cs +++ b/Items/Weapons/Melee/SeekingScorcher.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 86; Item.height = 64; - Item.damage = 718; + Item.damage = 1100; Item.DamageType = DamageClass.MeleeNoSpeed; Item.useAnimation = Item.useTime = 55; Item.knockBack = 8.5f; diff --git a/Items/Weapons/Melee/SkytideDragoon.cs b/Items/Weapons/Melee/SkytideDragoon.cs index eb4c791c2c..a406565bb4 100644 --- a/Items/Weapons/Melee/SkytideDragoon.cs +++ b/Items/Weapons/Melee/SkytideDragoon.cs @@ -1,5 +1,7 @@ using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -13,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SkytideDragoon : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 86; diff --git a/Items/Weapons/Melee/SmokingComet.cs b/Items/Weapons/Melee/SmokingComet.cs index 8fe6c66857..2373e4d3c0 100644 --- a/Items/Weapons/Melee/SmokingComet.cs +++ b/Items/Weapons/Melee/SmokingComet.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 36; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 21; + Item.damage = 17; Item.knockBack = 1.5f; Item.useTime = 25; Item.useAnimation = 25; diff --git a/Items/Weapons/Melee/SpineOfThanatos.cs b/Items/Weapons/Melee/SpineOfThanatos.cs index 6b9de5cab9..aeeb946f60 100644 --- a/Items/Weapons/Melee/SpineOfThanatos.cs +++ b/Items/Weapons/Melee/SpineOfThanatos.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = Item.height = 28; Item.damage = 128; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; Item.channel = true; diff --git a/Items/Weapons/Melee/StellarStriker.cs b/Items/Weapons/Melee/StellarStriker.cs index f8c25997b1..56fad47d94 100644 --- a/Items/Weapons/Melee/StellarStriker.cs +++ b/Items/Weapons/Melee/StellarStriker.cs @@ -17,9 +17,8 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 118; - Item.damage = 98; + Item.damage = 143; Item.DamageType = TrueMeleeDamageClass.Instance; - Item.useAnimation = Item.useTime = 33; Item.useTurn = true; diff --git a/Items/Weapons/Melee/StreamGouge.cs b/Items/Weapons/Melee/StreamGouge.cs index 7358ae671f..759d565a3d 100644 --- a/Items/Weapons/Melee/StreamGouge.cs +++ b/Items/Weapons/Melee/StreamGouge.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 100; Item.height = 100; - Item.damage = 500; + Item.damage = 470; Item.DamageType = DamageClass.Melee; Item.noMelee = true; Item.useTurn = true; @@ -38,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Melee/SubmarineShocker.cs b/Items/Weapons/Melee/SubmarineShocker.cs index 3ec096138d..757cb2ce38 100644 --- a/Items/Weapons/Melee/SubmarineShocker.cs +++ b/Items/Weapons/Melee/SubmarineShocker.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Shortswords; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Shortswords; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Melee public class SubmarineShocker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Melee/Swordsplosion.cs b/Items/Weapons/Melee/Swordsplosion.cs index ad10265c3a..be38aa1993 100644 --- a/Items/Weapons/Melee/Swordsplosion.cs +++ b/Items/Weapons/Melee/Swordsplosion.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -95,5 +96,14 @@ namespace CalamityMod.Items.Weapons.Melee Main.dust[swingDust].noGravity = true; } } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(10). + AddIngredient(15). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Melee/TaintedBlade.cs b/Items/Weapons/Melee/TaintedBlade.cs index 82b65ddff0..d48de63d99 100644 --- a/Items/Weapons/Melee/TaintedBlade.cs +++ b/Items/Weapons/Melee/TaintedBlade.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 46; Item.height = 46; - Item.damage = 60; + Item.damage = 48; Item.DamageType = DamageClass.Melee; Item.useTurn = true; Item.useAnimation = 27; @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; } public override void MeleeEffects(Player player, Rectangle hitbox) diff --git a/Items/Weapons/Melee/TerrorBlade.cs b/Items/Weapons/Melee/TerrorBlade.cs index 4d786f1baf..3f04aeed65 100644 --- a/Items/Weapons/Melee/TerrorBlade.cs +++ b/Items/Weapons/Melee/TerrorBlade.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -13,7 +15,10 @@ namespace CalamityMod.Items.Weapons.Melee { public new string LocalizationCategory => "Items.Weapons.Melee"; internal const float TerrorBlastMultiplier = 0.3f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 88; diff --git a/Items/Weapons/Melee/TheBurningSky.cs b/Items/Weapons/Melee/TheBurningSky.cs index a4e26ae751..743506420f 100644 --- a/Items/Weapons/Melee/TheBurningSky.cs +++ b/Items/Weapons/Melee/TheBurningSky.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -17,9 +19,9 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetStaticDefaults() { - // Visually a sword, but with no true melee capability. The Burning Sky is held out like a staff. Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -42,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 14f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Melee/TheGodsGambit.cs b/Items/Weapons/Melee/TheGodsGambit.cs index d17e980aa4..7b188bfdf3 100644 --- a/Items/Weapons/Melee/TheGodsGambit.cs +++ b/Items/Weapons/Melee/TheGodsGambit.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Items.Weapons.Melee CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Melee/TheMicrowave.cs b/Items/Weapons/Melee/TheMicrowave.cs index 21be661ebd..d89a786352 100644 --- a/Items/Weapons/Melee/TheMicrowave.cs +++ b/Items/Weapons/Melee/TheMicrowave.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee.Yoyos; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee.Yoyos; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -22,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() diff --git a/Items/Weapons/Melee/TheMutilator.cs b/Items/Weapons/Melee/TheMutilator.cs index f1b8d996c2..e00105a1a8 100644 --- a/Items/Weapons/Melee/TheMutilator.cs +++ b/Items/Weapons/Melee/TheMutilator.cs @@ -26,12 +26,11 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 90; Item.height = 90; Item.damage = 1005; - Item.DamageType = DamageClass.Melee; + Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 30; Item.knockBack = 8f; - Item.UseSound = SoundID.Item1; Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; diff --git a/Items/Weapons/Melee/TheObliterator.cs b/Items/Weapons/Melee/TheObliterator.cs index 61674ef152..7033254faf 100644 --- a/Items/Weapons/Melee/TheObliterator.cs +++ b/Items/Weapons/Melee/TheObliterator.cs @@ -1,4 +1,7 @@ using System.Collections.Generic; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee.Yoyos; using CalamityMod.Rarities; using Terraria; @@ -21,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Melee ItemID.Sets.Yoyo[Type] = true; ItemID.Sets.GamepadExtraRange[Type] = 15; ItemID.Sets.GamepadSmartQuickReach[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -28,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.width = 42; Item.height = 40; Item.DamageType = DamageClass.MeleeNoSpeed; - Item.damage = 222; + Item.damage = 200; Item.knockBack = 7.5f; Item.useTime = 20; Item.useAnimation = 20; @@ -44,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void ModifyTooltips(List list) => list.FindAndReplace("[GFB]", this.GetLocalizedValue(Main.zenithWorld ? "TooltipGFB" : "TooltipNormal")); } diff --git a/Items/Weapons/Melee/TheOracle.cs b/Items/Weapons/Melee/TheOracle.cs index 7bf5027c5c..8b0ed24ce0 100644 --- a/Items/Weapons/Melee/TheOracle.cs +++ b/Items/Weapons/Melee/TheOracle.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.shootSpeed = 16f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs index c24a749c40..4ca93ea57a 100644 --- a/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs +++ b/Items/Weapons/Melee/TriactisTruePaladinianMageHammerofMight.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 168; Item.height = 168; - Item.damage = 5000; + Item.damage = 2000; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 36; + Item.useAnimation = Item.useTime = 40; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 14f; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index bce0c1ee8b..965503a687 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee public float Charge = 0f; public static float chargeDamageMultiplier = 1.25f; //Extra damage from charge public static float beamDamageMultiplier = 1f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied - public static float glassStarDamageMultiplier = 0.6f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) + public static float glassStarDamageMultiplier = 1f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) public override void ModifyTooltips(List tooltips) { @@ -43,7 +43,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void SetDefaults() { Item.width = Item.height = 72; - Item.damage = 194; + Item.damage = 130; Item.DamageType = DamageClass.MeleeNoSpeed; Item.noUseGraphic = true; Item.noMelee = true; @@ -103,7 +103,6 @@ namespace CalamityMod.Items.Weapons.Melee Projectile.NewProjectile(source, player.Center - Shift, velocity.RotatedBy(-MathHelper.PiOver4 * 0.3f), ProjectileType(), (int)(damage * glassStarDamageMultiplier), knockback, player.whoAmI, Charge > 0 ? 1 : 0); } - Charge--; if (Charge < 0) Charge = 0; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 2dbd3efbd9..36b0850ef5 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Melee #region stats public static int BaseDamage = 115; - public static int DefaultAttunement_BaseDamage = 100; + public static int DefaultAttunement_BaseDamage = 90; public static int DefaultAttunement_SigilTime = 900; public static int DefaultAttunement_BeamTime = 90; public static float DefaultAttunement_LungeDamageMult = 2f; @@ -48,27 +48,27 @@ namespace CalamityMod.Items.Weapons.Melee public static float EvilAttunement_SlashDamageBoost = 3f; public static int EvilAttunement_SlashIFrames = 60; - public static int ColdAttunement_BaseDamage = 150; + public static int ColdAttunement_BaseDamage = 140; public static float ColdAttunement_ThirdSwingBoost = 1.25f; public static float ColdAttunement_MistDamageReduction = 0.11f; - public static int HotAttunement_BaseDamage = 135; + public static int HotAttunement_BaseDamage = 126; public static int HotAttunement_PlayerShredIFrames = 8; public static float HotAttunement_ShotDamageBoost = 4.5f; public static int HotAttunement_LocalIFrames = 24; //Be warned its got one extra update so all the iframes should be divided in 2 public static float HotAttunement_ShredDecayRate = 0.65f; //How much charge is lost per frame. - public static int TropicalAttunement_BaseDamage = 150; + public static int TropicalAttunement_BaseDamage = 132; public static float TropicalAttunement_ChainDamageReduction = 0.6f; public static float TropicalAttunement_VineDamageReduction = 0.3f; public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.5f; //It also crits, so be mindful of that public static int TropicalAttunement_LocalIFrames = 60; //Be warned its got 2 extra updates so all the iframes should be divided in 3 - public static int HolyAttunement_BaseDamage = 66; - public static float HolyAttunement_BaseSwingDamageMult = 0.75f; - public static float HolyAttunement_FullSwingDamageMult = 1.5f; - public static float HolyAttunement_ThrowDamageBoost = 3.8f; - public static int HolyAttunement_LocalIFrames = 16; //Be warned its got 1 extra update yadda yadda + public static int HolyAttunement_BaseDamage = 84; + public static float HolyAttunement_BaseSwingDamageMult = 0.5f; + public static float HolyAttunement_FullSwingDamageMult = 1f; + public static float HolyAttunement_ThrowDamageBoost = 3f; + public static int HolyAttunement_LocalIFrames = 20; //Be warned its got 1 extra update yadda yadda public static float HolyAttunement_MonolithDamage = 0.5f; #endregion diff --git a/Items/Weapons/Melee/TyphonsGreed.cs b/Items/Weapons/Melee/TyphonsGreed.cs index e2d8e61327..40517717a8 100644 --- a/Items/Weapons/Melee/TyphonsGreed.cs +++ b/Items/Weapons/Melee/TyphonsGreed.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 16; Item.height = 16; - Item.damage = 62; + Item.damage = 60; Item.DamageType = DamageClass.Melee; Item.useTime = 30; Item.useAnimation = 30; diff --git a/Items/Weapons/Melee/UltimusCleaver.cs b/Items/Weapons/Melee/UltimusCleaver.cs index f9128f195b..a4e97d574d 100644 --- a/Items/Weapons/Melee/UltimusCleaver.cs +++ b/Items/Weapons/Melee/UltimusCleaver.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -12,7 +14,10 @@ namespace CalamityMod.Items.Weapons.Melee public class UltimusCleaver : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 72; @@ -36,51 +41,34 @@ namespace CalamityMod.Items.Weapons.Melee public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire3, 360); + SoundEngine.PlaySound(SoundID.Item14, target.Center); int onHitDamage = player.CalcIntDamage(Item.damage); Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI); blast.DamageType = Item.DamageType; - float firstDustScale = 1.7f; - float secondDustScale = 0.8f; - float thirdDustScale = 2f; - Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2(); + + Vector2 dustRotation = (target.rotation - MathHelper.PiOver2).ToRotationVector2(); Vector2 dustVelocity = dustRotation * target.velocity.Length(); - SoundEngine.PlaySound(SoundID.Item14, target.Center); - int increment; - for (int i = 0; i < 40; i = increment + 1) + for (int i = 0; i < 40; i++) { - int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 200, default, firstDustScale); - Dust dust = Main.dust[swingDust]; - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 3f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 100, default, secondDustScale); - dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f; - dust.velocity.Y -= 6f; - dust.velocity *= 2f; - dust.noGravity = true; - dust.fadeIn = 1f; - dust.color = Color.Crimson * 0.5f; - dust.velocity += dustVelocity * Main.rand.NextFloat(); - increment = i; + Vector2 mainDustPos = target.Center + Main.rand.NextVector2Circular(target.width / 2, target.width / 2); + Dust swingDust = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 18f, 200, Scale: 1.7f); + swingDust.noGravity = true; + + Dust swingDust2 = Dust.NewDustPerfect(mainDustPos, DustID.InfernoFork, dustVelocity * Main.rand.NextFloat() - Vector2.UnitY * 12f, 100, Color.Crimson * 0.5f, 0.8f); + swingDust2.noGravity = true; + swingDust2.fadeIn = 1f; } - for (int j = 0; j < 20; j = increment + 1) + for (int j = 0; j < 20; j++) { - int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.InfernoFork, 0f, 0f, 0, default, thirdDustScale); - Dust dust = Main.dust[swingDust2]; - dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f; - dust.noGravity = true; - dust.velocity.Y -= 6f; - dust.velocity *= 0.5f; - dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()); - increment = j; + Vector2 dustPos = target.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(target.velocity.ToRotation()) * (target.width / 3f); + Dust moreDust = Dust.NewDustPerfect(dustPos, DustID.InfernoFork, dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat()) - Vector2.UnitY * 3f, Scale: 2f); + moreDust.noGravity = true; } } public override void MeleeEffects(Player player, Rectangle hitbox) { - if (player.whoAmI == Main.myPlayer) + if (player.whoAmI == Main.myPlayer && !player.Calamity().bladeArmEnchant) { if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1) || player.itemAnimation == (int)(player.itemAnimationMax * 0.3) || @@ -88,65 +76,48 @@ namespace CalamityMod.Items.Weapons.Melee player.itemAnimation == (int)(player.itemAnimationMax * 0.7) || player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - float sparkYVel = 0f; float sparkXVel = 0f; - float sparkYSpawn = 0f; + float sparkYVel = 0f; float sparkXSpawn = 0f; + float sparkYSpawn = 0f; + if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) { - sparkYVel = -7f; + sparkYVel = -10.5f; + if (player.direction == -1) + sparkXSpawn = -8f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) { - sparkYVel = -6f; - sparkXVel = 2f; + sparkYVel = -9f; + sparkXVel = 3f; + sparkXSpawn = player.direction == -1 ? 20f : 26f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.5)) { - sparkYVel = -4f; - sparkXVel = 4f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) - { - sparkYVel = -2f; + sparkYVel = -6f; sparkXVel = 6f; } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) - { - sparkXVel = 7f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) - { - sparkXSpawn = 26f; - } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.3)) { - sparkXSpawn -= 4f; - sparkYSpawn -= 20f; + sparkXVel = 9f; + sparkYVel = -3f; + sparkXSpawn = -4f; + sparkYSpawn = -20f; } if (player.itemAnimation == (int)(player.itemAnimationMax * 0.1)) { - sparkYSpawn += 6f; + sparkXVel = 10.5f; + sparkYSpawn = 6f; } - if (player.direction == -1) - { - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.9)) - { - sparkXSpawn -= 8f; - } - if (player.itemAnimation == (int)(player.itemAnimationMax * 0.7)) - { - sparkXSpawn -= 6f; - } - } - sparkYVel *= 1.5f; - sparkXVel *= 1.5f; - sparkXSpawn *= (float)player.direction; + + sparkXVel *= player.direction; + sparkYVel *= player.gravDir; + sparkXSpawn *= player.direction; sparkYSpawn *= player.gravDir; var source = player.GetSource_ItemUse(Item); int damage = (int)player.GetTotalDamage().ApplyTo(Item.damage * 0.1f); - Projectile.NewProjectile(source, (float)(hitbox.X + hitbox.Width / 2) + sparkXSpawn, (float)(hitbox.Y + hitbox.Height / 2) + sparkYSpawn, - (float)player.direction * sparkXVel, sparkYVel * player.gravDir, ModContent.ProjectileType(), damage, 0f, player.whoAmI, 0f, 0f); + Projectile.NewProjectile(source, hitbox.X + hitbox.Width / 2 + sparkXSpawn, hitbox.Y + hitbox.Height / 2 + sparkYSpawn, sparkXVel, sparkYVel, ModContent.ProjectileType(), damage, 0f, player.whoAmI); } } } diff --git a/Items/Weapons/Melee/VeinBurster.cs b/Items/Weapons/Melee/VeinBurster.cs index c8d2f1f9d7..e23cc6bb6b 100644 --- a/Items/Weapons/Melee/VeinBurster.cs +++ b/Items/Weapons/Melee/VeinBurster.cs @@ -1,5 +1,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Melee; using Terraria; using Terraria.ID; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class VeinBurster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 52; @@ -37,14 +43,5 @@ namespace CalamityMod.Items.Weapons.Melee { target.AddBuff(ModContent.BuffType(), 300); } - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 5). - AddIngredient(15). - AddIngredient(ItemID.Vertebrae, 5). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Melee/Violence.cs b/Items/Weapons/Melee/Violence.cs index 1d0ded5ccb..70362f76b4 100644 --- a/Items/Weapons/Melee/Violence.cs +++ b/Items/Weapons/Melee/Violence.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Melee; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Violence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 142; @@ -26,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Melee Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.channel = true; diff --git a/Items/Weapons/Melee/Virulence.cs b/Items/Weapons/Melee/Virulence.cs index 97f4b5a5ac..b9320c46fd 100644 --- a/Items/Weapons/Melee/Virulence.cs +++ b/Items/Weapons/Melee/Virulence.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Melee public class Virulence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 74; diff --git a/Items/Weapons/Melee/WulfrumScrewdriver.cs b/Items/Weapons/Melee/WulfrumScrewdriver.cs index 74a3d5142f..2fc8fc039a 100644 --- a/Items/Weapons/Melee/WulfrumScrewdriver.cs +++ b/Items/Weapons/Melee/WulfrumScrewdriver.cs @@ -85,8 +85,7 @@ namespace CalamityMod.Items.Weapons.Melee public override void AddRecipes() { CreateRecipe(). - AddIngredient(12). - AddIngredient(). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Melee/YateveoBloom.cs b/Items/Weapons/Melee/YateveoBloom.cs index 0cb321f18f..9a88f1eec0 100644 --- a/Items/Weapons/Melee/YateveoBloom.cs +++ b/Items/Weapons/Melee/YateveoBloom.cs @@ -38,8 +38,8 @@ namespace CalamityMod.Items.Weapons.Melee Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/AcesHigh.cs b/Items/Weapons/Ranged/AcesHigh.cs index 02b9c4d72b..d7eb0ca17d 100644 --- a/Items/Weapons/Ranged/AcesHigh.cs +++ b/Items/Weapons/Ranged/AcesHigh.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 6f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.UseSound = SoundID.Item36; diff --git a/Items/Weapons/Ranged/AcidwoodBow.cs b/Items/Weapons/Ranged/AcidwoodBow.cs index 37af5aa1ea..a2cd8b7c50 100644 --- a/Items/Weapons/Ranged/AcidwoodBow.cs +++ b/Items/Weapons/Ranged/AcidwoodBow.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -26,7 +26,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 6.6f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override void AddRecipes() diff --git a/Items/Weapons/Ranged/Alluvion.cs b/Items/Weapons/Ranged/Alluvion.cs index 43927c6267..a7a96fec75 100644 --- a/Items/Weapons/Ranged/Alluvion.cs +++ b/Items/Weapons/Ranged/Alluvion.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 90; - Item.damage = 91; + Item.damage = 96; Item.DamageType = DamageClass.Ranged; Item.useTime = 15; Item.useAnimation = 30; @@ -31,8 +31,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -69,12 +68,9 @@ namespace CalamityMod.Items.Weapons.Ranged newType = ModContent.ProjectileType(); break; } - int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 2.3f), knockback, player.whoAmI); + int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 1.35f), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].arrow = true; Main.projectile[proj].extraUpdates += 1; - } } else { diff --git a/Items/Weapons/Ranged/AngelicShotgun.cs b/Items/Weapons/Ranged/AngelicShotgun.cs index 3f2a2b21ce..6fbb3fa2e2 100644 --- a/Items/Weapons/Ranged/AngelicShotgun.cs +++ b/Items/Weapons/Ranged/AngelicShotgun.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Animosity.cs b/Items/Weapons/Ranged/Animosity.cs index 3ca149441e..8c11300b71 100644 --- a/Items/Weapons/Ranged/Animosity.cs +++ b/Items/Weapons/Ranged/Animosity.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles; using CalamityMod.Projectiles.Magic; using CalamityMod.Projectiles.Ranged; @@ -23,20 +25,20 @@ namespace CalamityMod.Items.Weapons.Ranged public float SniperVelocityMult = 2f; public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() => ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 70; Item.height = 18; - Item.damage = 46; + Item.damage = 39; Item.DamageType = DamageClass.Ranged; - Item.width = 70; - Item.height = 18; Item.scale = 0.85f; - Item.useTime = 30; + Item.useTime = Item.useAnimation = 33; Item.reuseDelay = 10; - Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2f; @@ -48,12 +50,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 6.5f; Item.useAmmo = AmmoID.Bullet; Item.crit = 8; - Item.Calamity().canFirePointBlankShots = true; } public override void UpdateInventory(Player player) { - //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun full of hate, returns Animosity otherwise + //ITS MY REWORK SO I CAN PUT A REFERENCE: Shotgun Full of Hate, returns Animosity otherwise if (Main.zenithWorld) Item.SetNameOverride(this.GetLocalizedValue("GFBName")); } @@ -65,15 +66,8 @@ namespace CalamityMod.Items.Weapons.Ranged //Distortion wind do whisper one truth... } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + public override bool AltFunctionUse(Player player) => true; public override float UseSpeedMultiplier(Player player) { @@ -180,7 +174,7 @@ namespace CalamityMod.Items.Weapons.Ranged if (!Main.dedServ) { string goreType = Main.rand.NextBool() ? "EmptyAnimosityShell" : "EmptyAnimosityShell2"; - Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type); + Gore.NewGore(source, position, velocity.RotatedBy(2f * -player.direction) * Main.rand.NextFloat(0.6f, 0.7f), Mod.Find(goreType).Type, 0.75f); } return false; } diff --git a/Items/Weapons/Ranged/AntiMaterielRifle.cs b/Items/Weapons/Ranged/AntiMaterielRifle.cs index f777603609..8ed530291d 100644 --- a/Items/Weapons/Ranged/AntiMaterielRifle.cs +++ b/Items/Weapons/Ranged/AntiMaterielRifle.cs @@ -18,10 +18,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 154; Item.height = 40; - Item.damage = 1860; + Item.damage = 1818; Item.DamageType = DamageClass.Ranged; - Item.useTime = 60; - Item.useAnimation = 60; + Item.useTime = Item.useAnimation = 60; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 9.5f; @@ -31,8 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() => new Vector2(-30, 0); diff --git a/Items/Weapons/Ranged/AquashardShotgun.cs b/Items/Weapons/Ranged/AquashardShotgun.cs index c388ec1d2e..e2a590fafb 100644 --- a/Items/Weapons/Ranged/AquashardShotgun.cs +++ b/Items/Weapons/Ranged/AquashardShotgun.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 30f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/Arbalest.cs b/Items/Weapons/Ranged/Arbalest.cs index 3ee4b56f48..bacb49e7ed 100644 --- a/Items/Weapons/Ranged/Arbalest.cs +++ b/Items/Weapons/Ranged/Arbalest.cs @@ -33,12 +33,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { SoundEngine.PlaySound(SoundID.Item5, player.Center); @@ -70,5 +66,15 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddRecipeGroup("AnyMythrilBar", 10). + AddIngredient(ItemID.Cog, 15). + AddIngredient(ItemID.SoulofSight, 10). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Ranged/ArcNovaDiffuser.cs b/Items/Weapons/Ranged/ArcNovaDiffuser.cs index 737ffe8a93..489bc4baea 100644 --- a/Items/Weapons/Ranged/ArcNovaDiffuser.cs +++ b/Items/Weapons/Ranged/ArcNovaDiffuser.cs @@ -46,7 +46,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = false; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 52ae3be18f..041243c5bd 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, -5); diff --git a/Items/Weapons/Ranged/Arietes41.cs b/Items/Weapons/Ranged/Arietes41.cs index d1de224282..e711d0b85b 100644 --- a/Items/Weapons/Ranged/Arietes41.cs +++ b/Items/Weapons/Ranged/Arietes41.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.width = 56; Item.height = 30; Item.scale = 0.85f; - Item.damage = 95; + Item.damage = 77; Item.DamageType = DamageClass.Ranged; Item.useTime = 13; Item.useAnimation = 13; @@ -34,12 +34,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 13f; Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { float itemRotation = player.compositeFrontArm.rotation + MathHelper.PiOver2 * player.gravDir; - Vector2 itemPosition = player.MountedCenter + itemRotation.ToRotationVector2() * 7f; // Shock bullet @@ -51,8 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged GeneralParticleHandler.SpawnParticle(spark); } Projectile shockShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) + velocity * 1.65f, velocity, type, damage, knockback, player.whoAmI); - CalamityGlobalProjectile cgp = shockShot.Calamity(); - cgp.shockBullet = true; + shockShot.Calamity().shockBullet = true; } // Life bullet if (swapType) @@ -63,8 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged GeneralParticleHandler.SpawnParticle(spark); } Projectile lifeShot = Projectile.NewProjectileDirect(source, itemPosition + velocity.RotatedBy(-0.6 * player.direction) - velocity * 0.65f, velocity, type, damage, knockback, player.whoAmI); - CalamityGlobalProjectile cgp = lifeShot.Calamity(); - cgp.lifeBullet = true; + lifeShot.Calamity().lifeBullet = true; } swapType = !swapType; diff --git a/Items/Weapons/Ranged/AstralBlaster.cs b/Items/Weapons/Ranged/AstralBlaster.cs index 621e409326..e6c0803a7a 100644 --- a/Items/Weapons/Ranged/AstralBlaster.cs +++ b/Items/Weapons/Ranged/AstralBlaster.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/AstrealDefeat.cs b/Items/Weapons/Ranged/AstrealDefeat.cs index 0c957b8304..931763931f 100644 --- a/Items/Weapons/Ranged/AstrealDefeat.cs +++ b/Items/Weapons/Ranged/AstrealDefeat.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -48,6 +47,13 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 67) + return true; + return false; + } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Auralis.cs b/Items/Weapons/Ranged/Auralis.cs index 8de3d051de..23985319f3 100644 --- a/Items/Weapons/Ranged/Auralis.cs +++ b/Items/Weapons/Ranged/Auralis.cs @@ -2,10 +2,10 @@ using CalamityMod.Items.Potions; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; -using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -33,11 +33,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.UseSound = CommonCalamitySounds.PlasmaBlastSound; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/PlasmaBlast"); Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override void ModifyWeaponDamage(Player player, ref StatModifier damage) diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index ffb8e030fb..168753fe67 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Ranged public class AuroraBlazer : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 68; Item.height = 36; - Item.damage = 89; + Item.damage = 69; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 30; diff --git a/Items/Weapons/Ranged/Barinade.cs b/Items/Weapons/Ranged/Barinade.cs index aae8b9e920..acd1cd5aa3 100644 --- a/Items/Weapons/Ranged/Barinade.cs +++ b/Items/Weapons/Ranged/Barinade.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,11 @@ namespace CalamityMod.Items.Weapons.Ranged public class Barinade : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 52; @@ -28,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(0, 4); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Barinautical.cs b/Items/Weapons/Ranged/Barinautical.cs index 12d468c942..a3b381d0b9 100644 --- a/Items/Weapons/Ranged/Barinautical.cs +++ b/Items/Weapons/Ranged/Barinautical.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Barinautical : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 30; @@ -30,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/BladedgeRailbow.cs b/Items/Weapons/Ranged/BladedgeRailbow.cs index 5b3983dd1b..65eb24364c 100644 --- a/Items/Weapons/Ranged/BladedgeRailbow.cs +++ b/Items/Weapons/Ranged/BladedgeRailbow.cs @@ -99,8 +99,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 24; Item.damage = 30; Item.DamageType = DamageClass.Ranged; - Item.useTime = 29; - Item.useAnimation = 29; + Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 3.5f; @@ -111,25 +110,20 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 14f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { for (int i = 0; i < 4; i++) { - float SpeedX = velocity.X + (float)Main.rand.Next(-60, 61) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-60, 61) * 0.05f; + float SpeedX = velocity.X + Main.rand.NextFloat(-3f, 3f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-3f, 3f); int index = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); Main.projectile[index].noDropItem = true; } Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float PiOver10 = MathHelper.Pi * 0.1f; Vector2 arrowVel = velocity; arrowVel.Normalize(); arrowVel *= 10f; @@ -138,12 +132,10 @@ namespace CalamityMod.Items.Weapons.Ranged int numArrows = Main.zenithWorld ? 4 : 2; for (int i = 0; i < numArrows; i++) { - float arrowOffset = (float)i - 1f / 2f; - Vector2 offsetSpawn = arrowVel.RotatedBy((double)(PiOver10 * arrowOffset), default); + float arrowOffset = i - 0.5f; + Vector2 offsetSpawn = arrowVel.RotatedBy(MathHelper.Pi * 0.1f * arrowOffset); if (!arrowHitsTiles) - { offsetSpawn -= arrowVel; - } int projType; if (Main.zenithWorld) @@ -151,12 +143,15 @@ namespace CalamityMod.Items.Weapons.Ranged else projType = ProjectileID.Leaf; - int projectile = Projectile.NewProjectile(source, realPlayerPos.X + offsetSpawn.X, realPlayerPos.Y + offsetSpawn.Y, velocity.X, velocity.Y, projType, damage, 0f, player.whoAmI); + int projectile = Projectile.NewProjectile(source, realPlayerPos.X + offsetSpawn.X, realPlayerPos.Y + offsetSpawn.Y, velocity.X, velocity.Y, projType, (int)(damage * 0.7f), 0f, player.whoAmI); // Now for the special conditions to fix stuff... - if (projectile.WithinBounds(Main.maxProjectiles) && (projType == ProjectileID.Leaf || projType == ModContent.ProjectileType())) - Main.projectile[projectile].DamageType = DamageClass.Ranged; - if (projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType()) - Main.projectile[projectile].velocity /= 2; + if (projectile.WithinBounds(Main.maxProjectiles)) + { + if (projType == ProjectileID.Leaf || projType == ModContent.ProjectileType()) + Main.projectile[projectile].DamageType = DamageClass.Ranged; + if (projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType() || projType == ModContent.ProjectileType()) + Main.projectile[projectile].velocity /= 2; + } } return false; } diff --git a/Items/Weapons/Ranged/BlightSpewer.cs b/Items/Weapons/Ranged/BlightSpewer.cs index 50e3df7a73..c9696beced 100644 --- a/Items/Weapons/Ranged/BlightSpewer.cs +++ b/Items/Weapons/Ranged/BlightSpewer.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -42,5 +44,15 @@ namespace CalamityMod.Items.Weapons.Ranged { return new Vector2(-10, 0); } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(5). + AddIngredient(10). + AddTile(TileID.MythrilAnvil). + Register(); + } } } diff --git a/Items/Weapons/Ranged/BlissfulBombardier.cs b/Items/Weapons/Ranged/BlissfulBombardier.cs index 4f76ab7311..b429d4cd86 100644 --- a/Items/Weapons/Ranged/BlissfulBombardier.cs +++ b/Items/Weapons/Ranged/BlissfulBombardier.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -14,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class BlissfulBombardier : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 88; diff --git a/Items/Weapons/Ranged/BloodBoiler.cs b/Items/Weapons/Ranged/BloodBoiler.cs index 3067ec1c17..35eabb4e58 100644 --- a/Items/Weapons/Ranged/BloodBoiler.cs +++ b/Items/Weapons/Ranged/BloodBoiler.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 60; Item.height = 30; - Item.damage = 135; + Item.damage = 120; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 25; diff --git a/Items/Weapons/Ranged/BlossomFlux.cs b/Items/Weapons/Ranged/BlossomFlux.cs index 8fc15e31b1..68d69d3396 100644 --- a/Items/Weapons/Ranged/BlossomFlux.cs +++ b/Items/Weapons/Ranged/BlossomFlux.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 38; Item.height = 68; - Item.damage = 20; + Item.damage = 18; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 16; @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; - Item.Calamity().canFirePointBlankShots = true; } public override bool AltFunctionUse(Player player) @@ -72,5 +71,12 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + + public override bool CanConsumeAmmo(Item ammo, Player player) + { + if (Main.rand.Next(0, 100) < 50) + return true; + return false; + } } } diff --git a/Items/Weapons/Ranged/BrimstoneFury.cs b/Items/Weapons/Ranged/BrimstoneFury.cs index 634cb0cef9..c4d586c689 100644 --- a/Items/Weapons/Ranged/BrimstoneFury.cs +++ b/Items/Weapons/Ranged/BrimstoneFury.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 13f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/BulletFilledShotgun.cs b/Items/Weapons/Ranged/BulletFilledShotgun.cs index 4bee81bf6d..35ca568391 100644 --- a/Items/Weapons/Ranged/BulletFilledShotgun.cs +++ b/Items/Weapons/Ranged/BulletFilledShotgun.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = Item.useTime = 75; Item.knockBack = 0.25f; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 9f; + Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Bullet; Item.UseSound = SoundID.Item38; @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.rare = ItemRarityID.Orange; Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-7, 0); @@ -47,7 +46,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { type = Item.shoot; - int bulletAmt = 30; + position += player.itemRotation.ToRotationVector2() * player.direction * 48f; + int bulletAmt = 40; for (int i = 0; i < bulletAmt; i++) { float newSpeedX = velocity.X + Main.rand.NextFloat(-15f, 15f); diff --git a/Items/Weapons/Ranged/Buzzkill.cs b/Items/Weapons/Ranged/Buzzkill.cs index b5a9e54ea7..cfeef85b6b 100644 --- a/Items/Weapons/Ranged/Buzzkill.cs +++ b/Items/Weapons/Ranged/Buzzkill.cs @@ -26,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAnimation = 30; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 1f; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; Item.noMelee = true; Item.noUseGraphic = true; Item.DamageType = DamageClass.Ranged; @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/ChickenCannon.cs b/Items/Weapons/Ranged/ChickenCannon.cs index 1382b7b071..1832cea17c 100644 --- a/Items/Weapons/Ranged/ChickenCannon.cs +++ b/Items/Weapons/Ranged/ChickenCannon.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -12,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class ChickenCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 126; @@ -23,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1.5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); // No use sound is intentional Item.autoReuse = true; Item.shootSpeed = 14.5f; diff --git a/Items/Weapons/Ranged/ClamorRifle.cs b/Items/Weapons/Ranged/ClamorRifle.cs index b51d12896b..83d1c7daac 100644 --- a/Items/Weapons/Ranged/ClamorRifle.cs +++ b/Items/Weapons/Ranged/ClamorRifle.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/CleansingBlaze.cs b/Items/Weapons/Ranged/CleansingBlaze.cs index 5e0af0c3f6..80a3ed689c 100644 --- a/Items/Weapons/Ranged/CleansingBlaze.cs +++ b/Items/Weapons/Ranged/CleansingBlaze.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 104; Item.height = 62; - Item.damage = 290; + Item.damage = 275; Item.DamageType = DamageClass.Ranged; Item.useTime = 3; Item.useAnimation = 24; @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 11f; Item.useAmmo = AmmoID.Gel; Item.consumeAmmoOnFirstShotOnly = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) => Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request(Texture + "Glow").Value); diff --git a/Items/Weapons/Ranged/Condemnation.cs b/Items/Weapons/Ranged/Condemnation.cs index 96d14370c5..4588b6b709 100644 --- a/Items/Weapons/Ranged/Condemnation.cs +++ b/Items/Weapons/Ranged/Condemnation.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -16,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() @@ -30,12 +33,11 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-50f, 0f); diff --git a/Items/Weapons/Ranged/ConferenceCall.cs b/Items/Weapons/Ranged/ConferenceCall.cs index a673f01eb8..550f6e4e1c 100644 --- a/Items/Weapons/Ranged/ConferenceCall.cs +++ b/Items/Weapons/Ranged/ConferenceCall.cs @@ -44,7 +44,6 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int bulletAmt = 4; for (int index = 0; index < bulletAmt; ++index) { @@ -87,10 +86,12 @@ namespace CalamityMod.Items.Weapons.Ranged targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); targetPosition.Y -= 100 * j; - Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[j]].Center - targetPosition) * Item.shootSpeed; + // Create a dummy projectile to grab the number of max updates the bullet has for predictive aim use + Projectile dummy = new Projectile(); + dummy.SetDefaults(type); + Vector2 extraBulletVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(targetPosition, Main.npc[targets[j]], Item.shootSpeed, dummy.MaxUpdates); int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } @@ -107,10 +108,12 @@ namespace CalamityMod.Items.Weapons.Ranged targetPosition.X = (targetPosition.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); targetPosition.Y -= 100 * randomTarget; - Vector2 extraBulletVel = Vector2.Normalize(Main.npc[targets[randomTarget]].Center - targetPosition) * Item.shootSpeed; + // Create a dummy projectile to grab the number of max updates the bullet has for predictive aim use + Projectile dummy = new Projectile(); + dummy.SetDefaults(type); + Vector2 extraBulletVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(targetPosition, Main.npc[targets[randomTarget]], Item.shootSpeed, dummy.MaxUpdates); int proj = Projectile.NewProjectile(source, targetPosition, extraBulletVel, type, extraBulletDamage, knockback, player.whoAmI); - Main.projectile[proj].extraUpdates += 14; Main.projectile[proj].tileCollide = false; Main.projectile[proj].timeLeft /= 2; } diff --git a/Items/Weapons/Ranged/Contagion.cs b/Items/Weapons/Ranged/Contagion.cs index c878c4894e..1f941bd2dc 100644 --- a/Items/Weapons/Ranged/Contagion.cs +++ b/Items/Weapons/Ranged/Contagion.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/ContinentalGreatbow.cs b/Items/Weapons/Ranged/ContinentalGreatbow.cs index 6e63b9f837..e82feae262 100644 --- a/Items/Weapons/Ranged/ContinentalGreatbow.cs +++ b/Items/Weapons/Ranged/ContinentalGreatbow.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 18; Item.height = 36; - Item.damage = 34; + Item.damage = 38; Item.DamageType = DamageClass.Ranged; Item.useTime = 24; Item.useAnimation = 24; @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 17f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/CorinthPrime.cs b/Items/Weapons/Ranged/CorinthPrime.cs index 77b516c7f8..abc000862a 100644 --- a/Items/Weapons/Ranged/CorinthPrime.cs +++ b/Items/Weapons/Ranged/CorinthPrime.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 5); diff --git a/Items/Weapons/Ranged/CorrodedCaustibow.cs b/Items/Weapons/Ranged/CorrodedCaustibow.cs index 8a79b82295..2c4d7fcd6e 100644 --- a/Items/Weapons/Ranged/CorrodedCaustibow.cs +++ b/Items/Weapons/Ranged/CorrodedCaustibow.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/CrackshotColt.cs b/Items/Weapons/Ranged/CrackshotColt.cs index 964b561572..6d80394bf6 100644 --- a/Items/Weapons/Ranged/CrackshotColt.cs +++ b/Items/Weapons/Ranged/CrackshotColt.cs @@ -26,14 +26,13 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.25f; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; - Item.rare = ItemRarityID.Blue; + Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Green; Item.UseSound = ShootSound; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; Item.shootSpeed = 14f; - Item.Calamity().canFirePointBlankShots = true; } // This item has a right click. diff --git a/Items/Weapons/Ranged/DaemonsFlame.cs b/Items/Weapons/Ranged/DaemonsFlame.cs index 6a3667da12..ab347b043c 100644 --- a/Items/Weapons/Ranged/DaemonsFlame.cs +++ b/Items/Weapons/Ranged/DaemonsFlame.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,6 +14,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class DaemonsFlame : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 62; @@ -33,7 +39,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/DarkechoGreatbow.cs b/Items/Weapons/Ranged/DarkechoGreatbow.cs index 960f51a999..7516999dd8 100644 --- a/Items/Weapons/Ranged/DarkechoGreatbow.cs +++ b/Items/Weapons/Ranged/DarkechoGreatbow.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Deathwind.cs b/Items/Weapons/Ranged/Deathwind.cs index 3bdb517214..99603e8425 100644 --- a/Items/Weapons/Ranged/Deathwind.cs +++ b/Items/Weapons/Ranged/Deathwind.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,25 +14,27 @@ namespace CalamityMod.Items.Weapons.Ranged public class Deathwind : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 40; Item.height = 82; - Item.damage = 154; + Item.damage = 125; Item.DamageType = DamageClass.Ranged; - Item.useTime = 14; - Item.useAnimation = 14; + Item.useTime = Item.useAnimation = 14; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item5; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) @@ -46,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Ranged float SpeedY = velocity.Y + Main.rand.Next(-20, 21) * 0.05f; if (CalamityUtils.CheckWoodenAmmo(type, player)) { - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 2), knockback, player.whoAmI); + Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), (int)(damage * 1.5f), knockback, player.whoAmI); } else { diff --git a/Items/Weapons/Ranged/DeepcoreGK2.cs b/Items/Weapons/Ranged/DeepcoreGK2.cs index cd98650a7f..d5266a1a8c 100644 --- a/Items/Weapons/Ranged/DeepcoreGK2.cs +++ b/Items/Weapons/Ranged/DeepcoreGK2.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 0); diff --git a/Items/Weapons/Ranged/DodusHandcannon.cs b/Items/Weapons/Ranged/DodusHandcannon.cs deleted file mode 100644 index 5e7c814098..0000000000 --- a/Items/Weapons/Ranged/DodusHandcannon.cs +++ /dev/null @@ -1,58 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Rarities; -using CalamityMod.Sounds; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Ranged -{ - public class DodusHandcannon : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetDefaults() - { - Item.width = 62; - Item.height = 34; - Item.damage = 1020; - Item.DamageType = DamageClass.Ranged; - Item.useTime = 30; - Item.useAnimation = 30; - Item.autoReuse = true; - Item.useStyle = ItemUseStyleID.Shoot; - Item.noMelee = true; - Item.knockBack = 6f; - - // Reduce volume to 30% so it stops destroying people's ears. - Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound with { Volume = 0.3f }; - - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; - Item.useAmmo = AmmoID.Bullet; - - Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; - Item.rare = ModContent.RarityType(); - Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - type = Item.shoot; - } - - public override Vector2? HoldoutOffset() => new Vector2(-17, 5); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(). - AddIngredient(ItemID.LunarBar, 15). - AddIngredient(5). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Ranged/DodusHandcannon.png b/Items/Weapons/Ranged/DodusHandcannon.png deleted file mode 100644 index d78a7a37f7..0000000000 Binary files a/Items/Weapons/Ranged/DodusHandcannon.png and /dev/null differ diff --git a/Items/Weapons/Ranged/DragonsBreath.cs b/Items/Weapons/Ranged/DragonsBreath.cs index df0e1a9c79..34eab37a86 100644 --- a/Items/Weapons/Ranged/DragonsBreath.cs +++ b/Items/Weapons/Ranged/DragonsBreath.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -21,7 +23,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle WeldingShoot = new("CalamityMod/Sounds/Item/WeldingShoot") { Volume = 0.45f }; public int Counter = 0; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 124; @@ -42,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 3.5f; Item.useAmmo = AmmoID.Gel; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; diff --git a/Items/Weapons/Ranged/Drataliornus.cs b/Items/Weapons/Ranged/Drataliornus.cs index 45496b42b1..8367b13cea 100644 --- a/Items/Weapons/Ranged/Drataliornus.cs +++ b/Items/Weapons/Ranged/Drataliornus.cs @@ -42,7 +42,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useTurn = false; Item.useAmmo = AmmoID.Arrow; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool AltFunctionUse(Player player) diff --git a/Items/Weapons/Ranged/DriftwoodBow.cs b/Items/Weapons/Ranged/DriftwoodBow.cs index 66322c7e39..ca84ae4483 100644 --- a/Items/Weapons/Ranged/DriftwoodBow.cs +++ b/Items/Weapons/Ranged/DriftwoodBow.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 6.6f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) diff --git a/Items/Weapons/Ranged/EternalBlizzard.cs b/Items/Weapons/Ranged/EternalBlizzard.cs index 988223ece0..6fa526b7e7 100644 --- a/Items/Weapons/Ranged/EternalBlizzard.cs +++ b/Items/Weapons/Ranged/EternalBlizzard.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Eviscerator.cs b/Items/Weapons/Ranged/Eviscerator.cs index 6a6d5e6b82..420161a8c4 100644 --- a/Items/Weapons/Ranged/Eviscerator.cs +++ b/Items/Weapons/Ranged/Eviscerator.cs @@ -1,4 +1,6 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Eviscerator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 58; @@ -29,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults @@ -46,15 +51,5 @@ namespace CalamityMod.Items.Weapons.Ranged return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 4). - AddIngredient(12). - AddIngredient(ItemID.Vertebrae, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Ranged/FetidEmesis.cs b/Items/Weapons/Ranged/FetidEmesis.cs index 6027e5535d..12c1023bb0 100644 --- a/Items/Weapons/Ranged/FetidEmesis.cs +++ b/Items/Weapons/Ranged/FetidEmesis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class FetidEmesis : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 76; diff --git a/Items/Weapons/Ranged/FirestormCannon.cs b/Items/Weapons/Ranged/FirestormCannon.cs index 51ecdc5739..1a7daf469b 100644 --- a/Items/Weapons/Ranged/FirestormCannon.cs +++ b/Items/Weapons/Ranged/FirestormCannon.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -9,10 +10,13 @@ namespace CalamityMod.Items.Weapons.Ranged public class FirestormCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public override void SetStaticDefaults() - { - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; - } + + // This is intentionally stored on the item instead of the holdout to prevent swapping items to instantly reset the heat + // This could be theoretically exploited using multiple items, but the heat dissipates fast enough that I can't really care + public int BuiltUpHeat = 0; + public const int OverheatLevel = 480; + public const int OverheatCooldown = 180; + public const int OverheatDamage = 20; public override void SetDefaults() { @@ -20,71 +24,41 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 28; Item.damage = 14; Item.DamageType = DamageClass.Ranged; - Item.useTime = 12; - Item.useAnimation = 12; + Item.useTime = Item.useAnimation = 11; + Item.knockBack = 1.5f; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; - Item.rare = ItemRarityID.Green; - Item.UseSound = SoundID.Item11; + Item.channel = true; + Item.noUseGraphic = true; Item.autoReuse = true; - Item.shoot = ProjectileID.Flare; + + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 5.5f; Item.useAmmo = AmmoID.Flare; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.Next(100) >= 70; - - public override bool AltFunctionUse(Player player) => true; - - public override float UseSpeedMultiplier(Player player) + public override void HoldItem(Player player) { - if (player.altFunctionUse == 2) - return 1 / 3f; - return 1f; + player.Calamity().rightClickListener = true; + // Heat decrements if: + // The holdout exists, the player is not firing, the player is not in overheat, and there is heat in the weapon + if (player.ownedProjectileCounts[Item.shoot] > 0 && !Main.mouseLeft && player.Calamity().flareGunOverheat == 0 && BuiltUpHeat > 0) + { + BuiltUpHeat -= player.miscCounter % 2 == 0 ? 3 : 2; + if (BuiltUpHeat < 0) + BuiltUpHeat = 0; + } } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && !player.Calamity().mouseRight; + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; // Spawning the holdout cannot consume ammo public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse == 2) - { - velocity *= 2f; - int flareAmt = Main.rand.Next(4, 6); - for (int index = 0; index < flareAmt; ++index) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-50, 51) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-50, 51) * 0.05f; - int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - if (flare.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[flare].penetrate = 1; - Main.projectile[flare].timeLeft = 600; - Main.projectile[flare].DamageType = DamageClass.Ranged; - } - } - return false; - } - else - { - int flareAmt = Main.rand.Next(1, 3); - for (int index = 0; index < flareAmt; ++index) - { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - if (flare.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[flare].DamageType = DamageClass.Ranged; - Main.projectile[flare].timeLeft = 200; - Main.projectile[flare].penetrate = 3; - } - } - return false; - } + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + return false; } public override void AddRecipes() @@ -92,6 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(ItemID.FlareGun). AddIngredient(ItemID.HellstoneBar, 10). + AddIngredient(ItemID.IllegalGunParts). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/FlakKraken.cs b/Items/Weapons/Ranged/FlakKraken.cs index 868f04b376..76ccecc30f 100644 --- a/Items/Weapons/Ranged/FlakKraken.cs +++ b/Items/Weapons/Ranged/FlakKraken.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 152; Item.height = 58; - Item.damage = 124; + Item.damage = 78; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = OriginalUseTime; Item.knockBack = 0.25f; diff --git a/Items/Weapons/Ranged/FlarewingBow.cs b/Items/Weapons/Ranged/FlarewingBow.cs index a1f6d32d26..b5320a069d 100644 --- a/Items/Weapons/Ranged/FlarewingBow.cs +++ b/Items/Weapons/Ranged/FlarewingBow.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/FlurrystormCannon.cs b/Items/Weapons/Ranged/FlurrystormCannon.cs index fb1b12d224..18fe6f9193 100644 --- a/Items/Weapons/Ranged/FlurrystormCannon.cs +++ b/Items/Weapons/Ranged/FlurrystormCannon.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Snowball; Item.shootSpeed = 18f; - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/FrostbiteBlaster.cs b/Items/Weapons/Ranged/FrostbiteBlaster.cs index 38f5f1dca7..9712968aa5 100644 --- a/Items/Weapons/Ranged/FrostbiteBlaster.cs +++ b/Items/Weapons/Ranged/FrostbiteBlaster.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.shoot = ProjectileID.Blizzard; Item.shootSpeed = 9f; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-14, 0); diff --git a/Items/Weapons/Ranged/Fungicide.cs b/Items/Weapons/Ranged/Fungicide.cs index 830466446c..9515420395 100644 --- a/Items/Weapons/Ranged/Fungicide.cs +++ b/Items/Weapons/Ranged/Fungicide.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,11 +11,15 @@ namespace CalamityMod.Items.Weapons.Ranged public class Fungicide : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 40; Item.height = 26; - Item.damage = 20; + Item.damage = 19; Item.DamageType = DamageClass.Ranged; Item.useTime = 22; Item.useAnimation = 22; @@ -28,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Galeforce.cs b/Items/Weapons/Ranged/Galeforce.cs index 0f943388fb..e6d5027ac3 100644 --- a/Items/Weapons/Ranged/Galeforce.cs +++ b/Items/Weapons/Ranged/Galeforce.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/GoldenEagle.cs b/Items/Weapons/Ranged/GoldenEagle.cs index 87e94b5a7c..c0611fc259 100644 --- a/Items/Weapons/Ranged/GoldenEagle.cs +++ b/Items/Weapons/Ranged/GoldenEagle.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -10,7 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; private const float Spread = 0.0425f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 46; @@ -29,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/Goobow.cs b/Items/Weapons/Ranged/Goobow.cs index 6b51c5ba4b..dd909d62fe 100644 --- a/Items/Weapons/Ranged/Goobow.cs +++ b/Items/Weapons/Ranged/Goobow.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -62,7 +61,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Ranged/GunkShot.cs b/Items/Weapons/Ranged/GunkShot.cs index 175b7691be..b63a4cacdc 100644 --- a/Items/Weapons/Ranged/GunkShot.cs +++ b/Items/Weapons/Ranged/GunkShot.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 5f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -54,7 +53,7 @@ namespace CalamityMod.Items.Weapons.Ranged CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Ranged/HalibutCannon.cs b/Items/Weapons/Ranged/HalibutCannon.cs index 7dc5bc4243..61983896f5 100644 --- a/Items/Weapons/Ranged/HalibutCannon.cs +++ b/Items/Weapons/Ranged/HalibutCannon.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-15, 0); diff --git a/Items/Weapons/Ranged/HavocsBreath.cs b/Items/Weapons/Ranged/HavocsBreath.cs index fa23d2cd9b..9ca4a9a5a4 100644 --- a/Items/Weapons/Ranged/HavocsBreath.cs +++ b/Items/Weapons/Ranged/HavocsBreath.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 26; - Item.damage = 74; + Item.damage = 62; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 35; diff --git a/Items/Weapons/Ranged/HeavenlyGale.cs b/Items/Weapons/Ranged/HeavenlyGale.cs index 3c3643b112..428804c436 100644 --- a/Items/Weapons/Ranged/HeavenlyGale.cs +++ b/Items/Weapons/Ranged/HeavenlyGale.cs @@ -53,9 +53,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; Item.useTurn = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.Calamity().canFirePointBlankShots = true; } // Shoot via the projectile only diff --git a/Items/Weapons/Ranged/Hellborn.cs b/Items/Weapons/Ranged/Hellborn.cs index c259c226ab..1d82cba55f 100644 --- a/Items/Weapons/Ranged/Hellborn.cs +++ b/Items/Weapons/Ranged/Hellborn.cs @@ -1,6 +1,7 @@ using System.Linq; using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/Helstorm.cs b/Items/Weapons/Ranged/Helstorm.cs index dfb6c5bb78..759c3af8c5 100644 --- a/Items/Weapons/Ranged/Helstorm.cs +++ b/Items/Weapons/Ranged/Helstorm.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 11.5f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/HoarfrostBow.cs b/Items/Weapons/Ranged/HoarfrostBow.cs index 6dcc2a5750..03947cc5eb 100644 --- a/Items/Weapons/Ranged/HoarfrostBow.cs +++ b/Items/Weapons/Ranged/HoarfrostBow.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class HoarfrostBow : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; @@ -29,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Hydra.cs b/Items/Weapons/Ranged/Hydra.cs index 521f677b7a..67c5b3927c 100644 --- a/Items/Weapons/Ranged/Hydra.cs +++ b/Items/Weapons/Ranged/Hydra.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; //Editable stats: - public const int BulletsPerShot = 4; + public const int BulletsPerShot = 3; public const float ShotSpread = 10f; //in degrees public const int TimeToSpawnHead = 3; //in seconds public const int MaximumHeadCount = 3; @@ -47,7 +47,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = null; //does so in Shoot - Item.Calamity().canFirePointBlankShots = true; } public override bool CanConsumeAmmo(Item ammo, Player player) => player.altFunctionUse == 2 ? false : true; @@ -97,7 +96,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { Vector2 shootDirection = velocity.SafeNormalize(Vector2.Zero); - for (int i = 0; i < 4; i++) + for (int i = 0; i < BulletsPerShot; i++) { int CurrentHeadCount = player.ownedProjectileCounts[HeadID]; //Exponentially louder the more heads, slightly diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index a636a0b041..8fa44cc137 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 95; + Item.damage = 75; Item.DamageType = DamageClass.Ranged; Item.useTime = 1; Item.useAnimation = 4; @@ -33,28 +33,20 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 1f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item31; Item.autoReuse = true; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 6f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } - - public override bool AltFunctionUse(Player player) - { - return true; - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); + public override bool AltFunctionUse(Player player) => true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int shotType = (player.altFunctionUse == 2 ? type : ModContent.ProjectileType()); + int shotType = player.altFunctionUse == 2 ? type : ModContent.ProjectileType(); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction position = position + (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.UnitX) * 65; @@ -62,10 +54,11 @@ namespace CalamityMod.Items.Weapons.Ranged SineCounter++; if (SineCounter % 4 == 0) { - Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); - Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 1f); + for (int i = -1; i <= 1; i += 2) + { + Vector2 helixVel = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(i * sine)); + Projectile.NewProjectile(source, position, helixVel, shotType, damage, knockback, player.whoAmI, 0, 0, player.altFunctionUse != 2 ? 1 : 0); + } } else if (player.altFunctionUse != 2) { @@ -74,12 +67,14 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } + public override bool CanConsumeAmmo(Item ammo, Player player) { - if (Main.rand.Next(0, 100) > 80 && SineCounter % 4 == 0) + if (Main.rand.Next(0, 100) < 20 && SineCounter % 4 == 0) return true; return false; } + public override void AddRecipes() { CreateRecipe(). diff --git a/Items/Weapons/Ranged/Karasawa.cs b/Items/Weapons/Ranged/Karasawa.cs index cbcef379cc..0bc52e0523 100644 --- a/Items/Weapons/Ranged/Karasawa.cs +++ b/Items/Weapons/Ranged/Karasawa.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/Kingsbane.cs b/Items/Weapons/Ranged/Kingsbane.cs index 9a942794f6..234809a4de 100644 --- a/Items/Weapons/Ranged/Kingsbane.cs +++ b/Items/Weapons/Ranged/Kingsbane.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() > 0.95f && player.ownedProjectileCounts[Item.shoot] > 0; diff --git a/Items/Weapons/Ranged/Leviatitan.cs b/Items/Weapons/Ranged/Leviatitan.cs index 61010b9c37..50f41fa042 100644 --- a/Items/Weapons/Ranged/Leviatitan.cs +++ b/Items/Weapons/Ranged/Leviatitan.cs @@ -1,5 +1,7 @@ using System; using System.Diagnostics.Metrics; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; using Microsoft.Build.Tasks; @@ -21,13 +23,14 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetStaticDefaults() { ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { Item.width = 82; Item.height = 28; - Item.damage = 121; + Item.damage = 89; Item.DamageType = DamageClass.Ranged; Item.useTime = Item.useAnimation = 18; //Try not to change this if you can help it. Item.noMelee = true; @@ -40,7 +43,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 13f; Item.useStyle = ItemUseStyleID.Shoot; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); @@ -58,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Reposition to the gun's tip. Calculated seperately due to the two different shot styles. + // Reposition to the gun's tip. Calculated separately due to the two different shot styles. Vector2 boulderPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); Vector2 shotPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -6f : 3f)).RotatedBy(velocity.ToRotation()); diff --git a/Items/Weapons/Ranged/LunarianBow.cs b/Items/Weapons/Ranged/LunarianBow.cs index ea46bd671f..c4cbe5856e 100644 --- a/Items/Weapons/Ranged/LunarianBow.cs +++ b/Items/Weapons/Ranged/LunarianBow.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/M1Garand.cs b/Items/Weapons/Ranged/M1Garand.cs new file mode 100644 index 0000000000..ff034f96b2 --- /dev/null +++ b/Items/Weapons/Ranged/M1Garand.cs @@ -0,0 +1,62 @@ +using CalamityMod.Projectiles.Ranged; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.DataStructures; +using static Terraria.ModLoader.ModContent; +using CalamityMod.Cooldowns; + +namespace CalamityMod.Items.Weapons.Ranged +{ + public class M1Garand : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetDefaults() + { + Item.width = 102; + Item.height = 22; + Item.damage = 75; + Item.DamageType = DamageClass.Ranged; + + Item.useTime = 40; + Item.useAnimation = 40; + Item.useStyle = ItemUseStyleID.Shoot; + Item.noMelee = true; + Item.knockBack = 2f; + Item.autoReuse = false; // Because holdout + Item.channel = true; // Because holdout + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 12f; + Item.useAmmo = AmmoID.Bullet; + Item.noUseGraphic = true; + + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.rare = ItemRarityID.Orange; + } + + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; + public override void HoldItem(Player player) + { + if (player.Calamity().cooldowns.TryGetValue(M1GarandShots.ID, out var cooldown)) + { + cooldown.timeLeft = 8 - player.Calamity().garandShots; + } + else + { + player.AddCooldown(M1GarandShots.ID, 8); + } + } + + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), damage, knockback, player.whoAmI); + + // Seting its velocity like this is what aims to the mouse + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); + + return false; + } + } +} diff --git a/Items/Weapons/Ranged/M1Garand.png b/Items/Weapons/Ranged/M1Garand.png new file mode 100644 index 0000000000..a0b47c6f6d Binary files /dev/null and b/Items/Weapons/Ranged/M1Garand.png differ diff --git a/Items/Weapons/Ranged/MagnaCannon.cs b/Items/Weapons/Ranged/MagnaCannon.cs index d31343d31b..0ec26d25e0 100644 --- a/Items/Weapons/Ranged/MagnaCannon.cs +++ b/Items/Weapons/Ranged/MagnaCannon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged public static readonly SoundStyle Fire = new("CalamityMod/Sounds/Item/MagnaCannonShot") { PitchVariance = 0.3f, Volume = 0.4f }; public static int AftershotCooldownFrames = 30; - public static int FullChargeFrames = 138; //126 frames is durration of charge sound + public static int FullChargeFrames = 138; //126 frames is duration of charge sound public new string LocalizationCategory => "Items.Weapons.Ranged"; @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 34; - Item.damage = 30; + Item.damage = 25; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = false; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/MagnomalyCannon.cs b/Items/Weapons/Ranged/MagnomalyCannon.cs index c329d10c8c..0dfb90b621 100644 --- a/Items/Weapons/Ranged/MagnomalyCannon.cs +++ b/Items/Weapons/Ranged/MagnomalyCannon.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Rocket; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Malevolence.cs b/Items/Weapons/Ranged/Malevolence.cs index 0645679232..e37f4b5964 100644 --- a/Items/Weapons/Ranged/Malevolence.cs +++ b/Items/Weapons/Ranged/Malevolence.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Malevolence : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 36; @@ -29,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -49,15 +53,5 @@ namespace CalamityMod.Items.Weapons.Ranged } return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.BeesKnees). - AddIngredient(5). - AddIngredient(10). - AddTile(TileID.MythrilAnvil). - Register(); - } } } diff --git a/Items/Weapons/Ranged/MarksmanBow.cs b/Items/Weapons/Ranged/MarksmanBow.cs index 155944b311..04583dd290 100644 --- a/Items/Weapons/Ranged/MarksmanBow.cs +++ b/Items/Weapons/Ranged/MarksmanBow.cs @@ -13,10 +13,12 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 36; Item.height = 110; - Item.damage = 35; + Item.damage = 39; Item.DamageType = DamageClass.Ranged; - Item.useTime = 18; - Item.useAnimation = 18; + Item.useTime = 5; + Item.useAnimation = 15; + Item.useLimitPerAnimation = 3; + Item.reuseDelay = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 6f; @@ -29,11 +31,10 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 20; + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 10; public override Vector2? HoldoutOffset() => new Vector2(-4, 0); @@ -43,20 +44,16 @@ namespace CalamityMod.Items.Weapons.Ranged if (CalamityUtils.CheckWoodenAmmo(type, player)) type = ProjectileID.JestersArrow; - for (int i = 0; i < 3; i++) + float SpeedX = velocity.X + Main.rand.NextFloat(-0.5f, 0.5f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-0.5f, 0.5f); + int arrow = Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI); + Main.projectile[arrow].noDropItem = true; + if (type == ProjectileID.JestersArrow) { - int randomExtraUpdates = Main.rand.Next(3); - float SpeedX = velocity.X + Main.rand.NextFloat(-10f, 10f) * 0.05f; - float SpeedY = velocity.Y + Main.rand.NextFloat(-10f, 10f) * 0.05f; - int arrow = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - Main.projectile[arrow].noDropItem = true; - Main.projectile[arrow].extraUpdates += randomExtraUpdates; //0 to 2 extra updates - if (type == ProjectileID.JestersArrow) - { - Main.projectile[arrow].localNPCHitCooldown = 10 * (randomExtraUpdates + 1); - Main.projectile[arrow].usesLocalNPCImmunity = true; - Main.projectile[arrow].tileCollide = false; - } + Main.projectile[arrow].localNPCHitCooldown = 12 * Main.projectile[arrow].MaxUpdates; + Main.projectile[arrow].usesLocalNPCImmunity = true; + Main.projectile[arrow].usesIDStaticNPCImmunity = false; + Main.projectile[arrow].tileCollide = false; } return false; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 5f22951eac..deaea9191e 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 72; Item.height = 32; - Item.damage = 41; + Item.damage = 29; Item.DamageType = DamageClass.Ranged; Item.useTime = 6; Item.useAnimation = 6; @@ -33,7 +33,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -42,11 +41,11 @@ namespace CalamityMod.Items.Weapons.Ranged { // Reposition to the gun's tip + add some inaccuracy Vector2 newPos = position + new Vector2(64f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); - Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(3f)); // Fire either the bullet or the water jet, depending on cadence. int projectileToFire = fireWater ? Item.shoot : type; - Projectile.NewProjectile(source, newPos, newVel, projectileToFire, (int)(damage * 0.8f), knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); // Always fires a close range water blast. // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. diff --git a/Items/Weapons/Ranged/MidasPrime.cs b/Items/Weapons/Ranged/MidasPrime.cs index 80ec7fb0ed..ee3a74f18d 100644 --- a/Items/Weapons/Ranged/MidasPrime.cs +++ b/Items/Weapons/Ranged/MidasPrime.cs @@ -43,7 +43,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; Item.shootSpeed = 14f; - Item.Calamity().canFirePointBlankShots = true; } // This item has a right click. diff --git a/Items/Weapons/Ranged/MonolithBow.cs b/Items/Weapons/Ranged/MonolithBow.cs index fa8b2ea872..be48baab00 100644 --- a/Items/Weapons/Ranged/MonolithBow.cs +++ b/Items/Weapons/Ranged/MonolithBow.cs @@ -1,5 +1,5 @@ using CalamityMod.Dusts; -using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureMonolith; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Arrow; Item.consumeAmmoOnFirstShotOnly = true; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/Monsoon.cs b/Items/Weapons/Ranged/Monsoon.cs index 803457a30d..2404be7c1b 100644 --- a/Items/Weapons/Ranged/Monsoon.cs +++ b/Items/Weapons/Ranged/Monsoon.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.WoodenArrowFriendly; Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo spawnSource, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -67,10 +66,7 @@ namespace CalamityMod.Items.Weapons.Ranged } int proj = Projectile.NewProjectile(spawnSource, source.X + offset.X, source.Y + offset.Y, velocity.X, velocity.Y, newType, (int)(damage * 1.1), knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].arrow = true; Main.projectile[proj].extraUpdates += 1; - } } else { diff --git a/Items/Weapons/Ranged/NettlevineGreatbow.cs b/Items/Weapons/Ranged/NettlevineGreatbow.cs index 683f4a03bd..486f5f7cf7 100644 --- a/Items/Weapons/Ranged/NettlevineGreatbow.cs +++ b/Items/Weapons/Ranged/NettlevineGreatbow.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/NitroExpressRifle.cs b/Items/Weapons/Ranged/NitroExpressRifle.cs index 021467e500..e4515a024e 100644 --- a/Items/Weapons/Ranged/NitroExpressRifle.cs +++ b/Items/Weapons/Ranged/NitroExpressRifle.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; Item.rare = ItemRarityID.LightRed; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 8); @@ -80,30 +79,6 @@ namespace CalamityMod.Items.Weapons.Ranged Vector2 itemSize = new Vector2(Item.width, Item.height); Vector2 itemOrigin = new Vector2(-5, 6); - - //Sniper's horizontal recoil; can be a bit subtle but it is noticeable - if (player.altFunctionUse == 2) - { - //Recoil: - int anim = 0; - for (int r = 0; r < Item.useAnimation; ++r) - { - if (anim == 10 && r < Item.useAnimation / 2) //animates every 10 frames so that the player notices a recoil because this happens way too fast - { - itemPosition.X -= player.direction * 0.025f; - itemPosition.Y -= player.direction * 0.025f; - anim = 0; - } - else if (anim == 10 && r > Item.useAnimation / 2) - { - itemPosition.X += player.direction * 0.025f; - itemPosition.Y += player.direction * 0.025f; - anim = 0; - } - ++anim; - } - } - CalamityUtils.CleanHoldStyle(player, itemRotation, itemPosition, itemSize, itemOrigin); base.UseStyle(player, heldItemFrame); } @@ -116,7 +91,7 @@ namespace CalamityMod.Items.Weapons.Ranged float animProgress = 1 - player.itemTime / (float)player.itemTimeMax; float rotation = (player.Center - player.Calamity().mouseWorld).ToRotation() * player.gravDir + MathHelper.PiOver2; if (animProgress < 0.5) - rotation += (player.altFunctionUse == 2 ? -1f : -0.45f) * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; + rotation += -0.45f * (float)Math.Pow((0.5f - animProgress) / 0.5f, 2) * player.direction; player.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, rotation); //must be here otherwise it will vibrate diff --git a/Items/Weapons/Ranged/Norfleet.cs b/Items/Weapons/Ranged/Norfleet.cs index ab4a0922b6..5e1b8da3e9 100644 --- a/Items/Weapons/Ranged/Norfleet.cs +++ b/Items/Weapons/Ranged/Norfleet.cs @@ -1,9 +1,9 @@ -using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; +using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -13,7 +13,6 @@ namespace CalamityMod.Items.Weapons.Ranged public class Norfleet : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public int loadedShots = 3; public override void SetStaticDefaults() { @@ -23,55 +22,46 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 140; Item.height = 42; - Item.damage = 7777; + Item.damage = 5678; + Item.DamageType = DamageClass.Ranged; + Item.crit = 16; + Item.useTime = Item.useAnimation = 70; Item.knockBack = 15f; Item.shootSpeed = 30f; + Item.useStyle = ItemUseStyleID.Shoot; - Item.useAnimation = 70; - Item.useTime = 70; Item.UseSound = null; Item.shoot = ModContent.ProjectileType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; - Item.DamageType = DamageClass.Ranged; Item.channel = true; Item.autoReuse = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - // Makes the rotation of the mouse around the player sync in multiplayer. public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Funny punishment for trying to cheeese with Norfleet - bool cheater = (player.Calamity().NorfleetCounter >= 3 && player.Calamity().NorfleetCounter < 1000); - if (player.Calamity().NorfleetCounter >= 1000) - loadedShots = 1; - - if (cheater) - { - SoundStyle fire = new("CalamityMod/Sounds/Item/NuhUhUh"); - SoundEngine.PlaySound(fire, player.Center); - } - - Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0, (cheater ? 1000 : 0), loadedShots); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - - player.Calamity().NorfleetCounter++; - loadedShots--; - - if (loadedShots <= 0) - { - loadedShots = 3; - } return false; } + + public override void AddRecipes() + { + CreateRecipe(). + AddIngredient(). + AddIngredient(8). + AddIngredient(20). + AddTile(). + Register(); + } } } diff --git a/Items/Weapons/Ranged/OnyxChainBlaster.cs b/Items/Weapons/Ranged/OnyxChainBlaster.cs index e0ec40a167..d1a3d83b57 100644 --- a/Items/Weapons/Ranged/OnyxChainBlaster.cs +++ b/Items/Weapons/Ranged/OnyxChainBlaster.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.BlackBolt; Item.shootSpeed = 24f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() @@ -38,8 +37,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { // Fire the Onyx Shard that is characteristic of the Onyx Blaster - // The shard deals 250% damage and double knockback - int shardDamage = (int)(2.5f * damage); + // The shard deals 200% damage and double knockback + int shardDamage = 2 * damage; float shardKB = 2f * knockback; Vector2 offset = new Vector2(Main.rand.Next(-25, 26) * 0.05f, Main.rand.Next(-25, 26) * 0.05f); Projectile shard = Projectile.NewProjectileDirect(source, position, velocity + offset, ProjectileID.BlackBolt, shardDamage, shardKB, player.whoAmI); diff --git a/Items/Weapons/Ranged/Onyxia.cs b/Items/Weapons/Ranged/Onyxia.cs index 9acf97013b..f3beca5561 100644 --- a/Items/Weapons/Ranged/Onyxia.cs +++ b/Items/Weapons/Ranged/Onyxia.cs @@ -18,20 +18,19 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 84; Item.height = 34; - Item.damage = 100; + Item.damage = 90; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 4.5f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item36; Item.autoReuse = true; Item.shoot = ProjectileID.BlackBolt; Item.shootSpeed = 28f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/OpalStriker.cs b/Items/Weapons/Ranged/OpalStriker.cs index e2abf396ac..74b412be00 100644 --- a/Items/Weapons/Ranged/OpalStriker.cs +++ b/Items/Weapons/Ranged/OpalStriker.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 48; Item.height = 24; - Item.damage = 33; + Item.damage = 30; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = AftershotCooldownFrames; Item.useStyle = ItemUseStyleID.Shoot; @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; - Item.Calamity().canFirePointBlankShots = true; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/OverloadedBlaster.cs b/Items/Weapons/Ranged/OverloadedBlaster.cs index 509277d994..94f3c69f60 100644 --- a/Items/Weapons/Ranged/OverloadedBlaster.cs +++ b/Items/Weapons/Ranged/OverloadedBlaster.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class OverloadedBlaster : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Ranged/P90.cs b/Items/Weapons/Ranged/P90.cs index 6a810bba8d..5d24b598cf 100644 --- a/Items/Weapons/Ranged/P90.cs +++ b/Items/Weapons/Ranged/P90.cs @@ -24,20 +24,16 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 1.5f; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; + Item.value = Item.buyPrice(gold: 35); // Sold by Arms Dealer Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item11 with { Volume = 0.6f }; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-14, -1); - } + public override Vector2? HoldoutOffset() => new Vector2(-14, -1); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Ranged/PearlGod.cs b/Items/Weapons/Ranged/PearlGod.cs index 60f8d757f1..6e3a075207 100644 --- a/Items/Weapons/Ranged/PearlGod.cs +++ b/Items/Weapons/Ranged/PearlGod.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 14f; Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/PestilentDefiler.cs b/Items/Weapons/Ranged/PestilentDefiler.cs index f8eebf70e4..93e90c6d72 100644 --- a/Items/Weapons/Ranged/PestilentDefiler.cs +++ b/Items/Weapons/Ranged/PestilentDefiler.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/Photoviscerator.cs b/Items/Weapons/Ranged/Photoviscerator.cs index 1b25904346..068fee8ded 100644 --- a/Items/Weapons/Ranged/Photoviscerator.cs +++ b/Items/Weapons/Ranged/Photoviscerator.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.noUseGraphic = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Ranged/PlagueTaintedSMG.cs b/Items/Weapons/Ranged/PlagueTaintedSMG.cs index c5c81448e0..92c9b28190 100644 --- a/Items/Weapons/Ranged/PlagueTaintedSMG.cs +++ b/Items/Weapons/Ranged/PlagueTaintedSMG.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.useAmmo = AmmoID.Bullet; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-20, 5); diff --git a/Items/Weapons/Ranged/PolarisParrotfish.cs b/Items/Weapons/Ranged/PolarisParrotfish.cs index 66574816ed..30c238e1cd 100644 --- a/Items/Weapons/Ranged/PolarisParrotfish.cs +++ b/Items/Weapons/Ranged/PolarisParrotfish.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void SetDefaults() { - Item.width = 38; + Item.width = 36; Item.height = 34; Item.damage = 35; Item.DamageType = DamageClass.Ranged; diff --git a/Items/Weapons/Ranged/PolarisParrotfish.png b/Items/Weapons/Ranged/PolarisParrotfish.png index 66364fdc29..3a625316ae 100644 Binary files a/Items/Weapons/Ranged/PolarisParrotfish.png and b/Items/Weapons/Ranged/PolarisParrotfish.png differ diff --git a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs index baefda8bf8..7a1cc73742 100644 --- a/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs +++ b/Items/Weapons/Ranged/PridefulHuntersPlanarRipper.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-12, -6); diff --git a/Items/Weapons/Ranged/PristineFury.cs b/Items/Weapons/Ranged/PristineFury.cs index 73019a111a..2e438e997a 100644 --- a/Items/Weapons/Ranged/PristineFury.cs +++ b/Items/Weapons/Ranged/PristineFury.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override float UseTimeMultiplier(Player player) => player.altFunctionUse == 2 ? 0.5f : 1f; public override void HoldItem(Player player) { - int max = player.Calamity().furyFuelMax; + int max = CalamityPlayer.FuryFuelMax; if (player.Calamity().cooldowns.TryGetValue(FuryFuel.ID, out var cooldown)) { cooldown.timeLeft = max - player.Calamity().furyFuel; diff --git a/Items/Weapons/Ranged/Pumpler.cs b/Items/Weapons/Ranged/Pumpler.cs index 36aeaafe38..b5625dec07 100644 --- a/Items/Weapons/Ranged/Pumpler.cs +++ b/Items/Weapons/Ranged/Pumpler.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 11f; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-30f, 0f); diff --git a/Items/Weapons/Ranged/RealmRavager.cs b/Items/Weapons/Ranged/RealmRavager.cs index baaed6a188..6846184c84 100644 --- a/Items/Weapons/Ranged/RealmRavager.cs +++ b/Items/Weapons/Ranged/RealmRavager.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class RealmRavager : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 76; @@ -28,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 30f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/Riftburst.cs b/Items/Weapons/Ranged/Riftburst.cs index bb67b81471..ba72722721 100644 --- a/Items/Weapons/Ranged/Riftburst.cs +++ b/Items/Weapons/Ranged/Riftburst.cs @@ -19,9 +19,8 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 48; Item.height = 82; - Item.damage = 122; - Item.useTime = 12; - Item.useAnimation = 12; + Item.damage = 91; + Item.useTime = Item.useAnimation = 12; Item.useStyle = ItemUseStyleID.Shoot; Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; @@ -34,8 +33,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; diff --git a/Items/Weapons/Ranged/RubicoPrime.cs b/Items/Weapons/Ranged/RubicoPrime.cs index 2042afd288..ed48b70019 100644 --- a/Items/Weapons/Ranged/RubicoPrime.cs +++ b/Items/Weapons/Ranged/RubicoPrime.cs @@ -42,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/SDFMG.cs b/Items/Weapons/Ranged/SDFMG.cs index 797b938ae8..0d7273664d 100644 --- a/Items/Weapons/Ranged/SDFMG.cs +++ b/Items/Weapons/Ranged/SDFMG.cs @@ -14,14 +14,15 @@ namespace CalamityMod.Items.Weapons.Ranged public class SDFMG : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + private int ShotCounter = 0; public override void SetDefaults() { Item.width = 74; Item.height = 34; - Item.damage = 115; + Item.damage = 118; Item.DamageType = DamageClass.Ranged; - Item.useTime = 2; - Item.useAnimation = 2; + Item.useTime = Item.useAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 2.75f; @@ -31,21 +32,21 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.rare = ModContent.RarityType(); - Item.Calamity().canFirePointBlankShots = true; + Item.rare = ModContent.RarityType(); } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 15; - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + Main.rand.Next(-5, 6) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-5, 6) * 0.05f; - if (Main.rand.NextBool(5)) + float SpeedX = velocity.X + Main.rand.NextFloat(-0.25f, 0.25f); + float SpeedY = velocity.Y + Main.rand.NextFloat(-0.25f, 0.25f); + ShotCounter++; + if (ShotCounter >= 7) { + ShotCounter = 0; Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, knockback, player.whoAmI); } Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/Sandblaster.cs b/Items/Weapons/Ranged/Sandblaster.cs index 71bec5ad7c..34396470c2 100644 --- a/Items/Weapons/Ranged/Sandblaster.cs +++ b/Items/Weapons/Ranged/Sandblaster.cs @@ -16,10 +16,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 62; Item.height = 26; - Item.damage = 80; + Item.damage = 70; Item.DamageType = DamageClass.Ranged; - Item.useTime = 15; - Item.useAnimation = 15; + Item.useTime = Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; @@ -30,13 +29,9 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Sand; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool CanConsumeAmmo(Item ammo, Player player) { diff --git a/Items/Weapons/Ranged/ScorchedEarth.cs b/Items/Weapons/Ranged/ScorchedEarth.cs index 57a93203f4..878d0c7068 100644 --- a/Items/Weapons/Ranged/ScorchedEarth.cs +++ b/Items/Weapons/Ranged/ScorchedEarth.cs @@ -8,61 +8,62 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Ranged { public class ScorchedEarth : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; - public static readonly SoundStyle ShootSound = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3); + public static readonly SoundStyle RocketShoot = new("CalamityMod/Sounds/Item/ScorpioShot") { Volume = 0.45f }; - private int counter = 0; + public static int OriginalUseTime = 60; + public static int TimeBetweenBursts = 10; + public static int ProjectilesPerBurst = 4; public override void SetDefaults() { - Item.width = 104; - Item.height = 44; Item.damage = 500; Item.DamageType = DamageClass.Ranged; - Item.useTime = 8; - Item.useAnimation = 32; // 4 shots in just over half a second - Item.reuseDelay = 60; // 1 second recharge - Item.useLimitPerAnimation = 4; - Item.useStyle = ItemUseStyleID.Shoot; + Item.useAnimation = Item.useTime = OriginalUseTime; + Item.shoot = ProjectileType(); + Item.shootSpeed = 15f; + Item.knockBack = 6.5f; + + Item.width = 104; + Item.height = 44; Item.noMelee = true; - Item.knockBack = 8.7f; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); - Item.autoReuse = true; - Item.shootSpeed = 12.6f; - Item.shoot = ModContent.ProjectileType(); + Item.channel = true; + Item.noUseGraphic = true; Item.useAmmo = AmmoID.Rocket; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.rare = ModContent.RarityType(); + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = new SoundStyle("CalamityMod/Sounds/Item/DudFire") with { Volume = .4f, Pitch = -.9f, PitchVariance = 0.1f }; Item.Calamity().donorItem = true; } - // Consume two ammo per fire - public override bool CanConsumeAmmo(Item ammo, Player player) => counter % 2 == 0; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] == 0; - public override Vector2? HoldoutOffset() => new Vector2(-30, 0); + // Spawning the holdout won't consume ammo. + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] != 0; + + // Makes the rotation of the mouse around the player sync in multiplayer. + public override void HoldItem(Player player) => player.Calamity().mouseRotationListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile holdout = Projectile.NewProjectileDirect(source, player.MountedCenter, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, -30); - if (counter == 0) - { - SoundEngine.PlaySound(ShootSound, position); - } + // We set the rotation to the direction to the mouse so the first frame doesn't appear bugged out. + holdout.velocity = (player.Calamity().mouseWorld - player.MountedCenter).SafeNormalize(Vector2.Zero); - counter++; - if (counter == 4) - counter = 0; return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddRecipeGroup("AnyAdamantiteBar", 15). AddIngredient(10). AddIngredient(ItemID.FragmentSolar, 50). diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 39ca453361..60d2fadde4 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-10, 0); diff --git a/Items/Weapons/Ranged/SepticSkewer.cs b/Items/Weapons/Ranged/SepticSkewer.cs index ab572d256f..4227b9cd41 100644 --- a/Items/Weapons/Ranged/SepticSkewer.cs +++ b/Items/Weapons/Ranged/SepticSkewer.cs @@ -9,6 +9,8 @@ using System; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Boss; using Terraria.Audio; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Magic; namespace CalamityMod.Items.Weapons.Ranged { @@ -20,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ItemID.Sets.IsRangedSpecialistWeapon[Type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/Shadethrower.cs b/Items/Weapons/Ranged/Shadethrower.cs index 24ffb6e7cb..7abe62d724 100644 --- a/Items/Weapons/Ranged/Shadethrower.cs +++ b/Items/Weapons/Ranged/Shadethrower.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Magic; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Ranged public class Shadethrower : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 76; @@ -32,15 +37,5 @@ namespace CalamityMod.Items.Weapons.Ranged } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 4). - AddIngredient(12). - AddIngredient(ItemID.RottenChunk, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Ranged/Shellshooter.cs b/Items/Weapons/Ranged/Shellshooter.cs index 45d07acc99..e39b9b4e76 100644 --- a/Items/Weapons/Ranged/Shellshooter.cs +++ b/Items/Weapons/Ranged/Shellshooter.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 2.5f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index a31575ec1d..3eef641cf6 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 5f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); diff --git a/Items/Weapons/Ranged/Shroomer.cs b/Items/Weapons/Ranged/Shroomer.cs index 4d103f929b..2b619ab787 100644 --- a/Items/Weapons/Ranged/Shroomer.cs +++ b/Items/Weapons/Ranged/Shroomer.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/SlagMagnum.cs b/Items/Weapons/Ranged/SlagMagnum.cs index e3a71d7dfb..6c3656b312 100644 --- a/Items/Weapons/Ranged/SlagMagnum.cs +++ b/Items/Weapons/Ranged/SlagMagnum.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/SomaPrime.cs b/Items/Weapons/Ranged/SomaPrime.cs index fb63f652a9..228cff54b3 100644 --- a/Items/Weapons/Ranged/SomaPrime.cs +++ b/Items/Weapons/Ranged/SomaPrime.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/SpectralstormCannon.cs b/Items/Weapons/Ranged/SpectralstormCannon.cs index fc161fa028..b52a0d3939 100644 --- a/Items/Weapons/Ranged/SpectralstormCannon.cs +++ b/Items/Weapons/Ranged/SpectralstormCannon.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,56 +11,53 @@ namespace CalamityMod.Items.Weapons.Ranged public class SpectralstormCannon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Ranged"; + + // This is intentionally stored on the item instead of the holdout to prevent swapping items to instantly reset the heat + // This could be theoretically exploited using multiple items, but the heat dissipates fast enough that I can't really care + public int BuiltUpHeat = 0; + public const int OverheatLevel = 540; + public const int OverheatCooldown = 160; + public const int OverheatDamage = 50; + public override void SetDefaults() { Item.width = 66; Item.height = 26; - Item.damage = 48; + Item.damage = 82; Item.DamageType = DamageClass.Ranged; - Item.useTime = 4; - Item.useAnimation = 12; + Item.useTime = Item.useAnimation = 11; + Item.knockBack = 1.5f; + Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; - Item.knockBack = 1.5f; + Item.channel = true; + Item.noUseGraphic = true; + Item.autoReuse = true; + Item.value = CalamityGlobalItem.RarityRedBuyPrice; Item.rare = ItemRarityID.Red; - Item.UseSound = SoundID.Item11; - Item.autoReuse = true; - Item.shoot = ProjectileID.Flare; - Item.shootSpeed = 9.5f; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Flare; - Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() => new Vector2(-10, 0); - - public override bool CanConsumeAmmo(Item ammo, Player player) + public override void HoldItem(Player player) { - if (Main.rand.Next(0, 100) < 70) - return false; - return true; + player.Calamity().rightClickListener = true; + // Heat decrements if: + // The holdout exists, the player is not firing, the player is not in overheat, and there is heat in the weapon + if (player.ownedProjectileCounts[Item.shoot] > 0 && !Main.mouseLeft && player.Calamity().flareGunOverheat == 0 && BuiltUpHeat > 0) + { + BuiltUpHeat -= 3; + if (BuiltUpHeat < 0) + BuiltUpHeat = 0; + } } - + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && !player.Calamity().mouseRight; + public override bool CanConsumeAmmo(Item ammo, Player player) => player.ownedProjectileCounts[Item.shoot] > 0; // Spawning the holdout cannot consume ammo public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float SpeedX = velocity.X + (float)Main.rand.Next(-40, 41) * 0.05f; - float SpeedY = velocity.Y + (float)Main.rand.Next(-40, 41) * 0.05f; - int flare = Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, type, damage, knockback, player.whoAmI); - if (flare.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[flare].timeLeft = 200; - Main.projectile[flare].DamageType = DamageClass.Ranged; - } - - float SpeedX2 = velocity.X + (float)Main.rand.Next(-20, 21) * 0.05f; - float SpeedY2 = velocity.Y + (float)Main.rand.Next(-20, 21) * 0.05f; - int soul = Projectile.NewProjectile(source, position.X, position.Y, SpeedX2, SpeedY2, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 2f, 0f); - if (soul.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[soul].timeLeft = 600; - Main.projectile[soul].DamageType = DamageClass.Ranged; - Main.projectile[soul].frame = Main.rand.Next(4); - } + Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/SpeedBlaster.cs b/Items/Weapons/Ranged/SpeedBlaster.cs index 91eb648f97..7992b482e5 100644 --- a/Items/Weapons/Ranged/SpeedBlaster.cs +++ b/Items/Weapons/Ranged/SpeedBlaster.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.shootSpeed = 20f; Item.shoot = ModContent.ProjectileType(); - Item.Calamity().canFirePointBlankShots = true; } public override bool AltFunctionUse(Player player) => true; public override bool CanUseItem(Player player) diff --git a/Items/Weapons/Ranged/StarSputter.cs b/Items/Weapons/Ranged/StarSputter.cs index f8c21806ff..6bd01f58d0 100644 --- a/Items/Weapons/Ranged/StarSputter.cs +++ b/Items/Weapons/Ranged/StarSputter.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,7 +13,10 @@ namespace CalamityMod.Items.Weapons.Ranged { public new string LocalizationCategory => "Items.Weapons.Ranged"; private int counter = 0; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 80; diff --git a/Items/Weapons/Ranged/Starmada.cs b/Items/Weapons/Ranged/Starmada.cs index 20425ca0c6..fd88973360 100644 --- a/Items/Weapons/Ranged/Starmada.cs +++ b/Items/Weapons/Ranged/Starmada.cs @@ -1,6 +1,7 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; using Microsoft.Xna.Framework; @@ -19,37 +20,43 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 122; Item.height = 50; - Item.damage = 135; - Item.knockBack = 15f; - Item.shootSpeed = 16f; - Item.useStyle = ItemUseStyleID.Shoot; - Item.useAnimation = Item.useTime = 27; - Item.UseSound = SoundID.Item92; - Item.shoot = ModContent.ProjectileType(); - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.noMelee = true; - Item.noUseGraphic = true; + Item.damage = 150; Item.DamageType = DamageClass.Ranged; - Item.channel = true; - Item.useTurn = false; - Item.useAmmo = AmmoID.FallenStar; + Item.useAnimation = Item.useTime = 15; + Item.knockBack = 15f; + Item.useStyle = ItemUseStyleID.Shoot; + Item.UseSound = SoundID.Item92; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.noMelee = true; + Item.shoot = ModContent.ProjectileType(); + Item.shootSpeed = 16f; + Item.useAmmo = AmmoID.FallenStar; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; - - // Spawning the holdout cannot consume ammo - public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool(3) && player.ownedProjectileCounts[Item.shoot] > 0; - - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextBool(3); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), 0, 0f, player.whoAmI); + for (int i = 0; i < 5; i++) + { + int starType = Utils.SelectRandom(Main.rand, + [ + ModContent.ProjectileType(), + ModContent.ProjectileType(), + ProjectileID.StarCannonStar, + ProjectileID.Starfury + ]); + int star = Projectile.NewProjectile(source, position + Main.rand.NextVector2Circular(21f, 21f), velocity * Main.rand.NextFloat(0.8f, 1.2f), starType, damage, knockback, player.whoAmI); + if (star.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[star].penetrate = 1; + Main.projectile[star].timeLeft = 300; + Main.projectile[star].DamageType = DamageClass.Ranged; + Main.projectile[star].netUpdate = true; + } + } return false; } diff --git a/Items/Weapons/Ranged/Starmageddon.cs b/Items/Weapons/Ranged/Starmageddon.cs index a2c2cd6707..941526a75c 100644 --- a/Items/Weapons/Ranged/Starmageddon.cs +++ b/Items/Weapons/Ranged/Starmageddon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 166; Item.height = 62; - Item.damage = 100; + Item.damage = 138; Item.knockBack = 4f; Item.shootSpeed = 16f; Item.useStyle = ItemUseStyleID.Shoot; @@ -39,7 +39,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.useTurn = false; Item.autoReuse = true; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/StellarCannon.cs b/Items/Weapons/Ranged/StellarCannon.cs index 376629dbca..7445e3628f 100644 --- a/Items/Weapons/Ranged/StellarCannon.cs +++ b/Items/Weapons/Ranged/StellarCannon.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 50; Item.height = 30; - Item.damage = 182; + Item.damage = 180; Item.DamageType = DamageClass.Ranged; Item.useTime = 40; Item.useAnimation = 40; diff --git a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs index 45a7d7984d..027e1acbab 100644 --- a/Items/Weapons/Ranged/SuperradiantSlaughterer.cs +++ b/Items/Weapons/Ranged/SuperradiantSlaughterer.cs @@ -1,4 +1,5 @@ -using CalamityMod.Cooldowns; +using CalamityMod.CalPlayer.Dashes; +using CalamityMod.Cooldowns; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Ranged; @@ -21,9 +22,12 @@ namespace CalamityMod.Items.Weapons.Ranged public new string LocalizationCategory => "Items.Weapons.Ranged"; public const float ShootSpeed = 24f; - public const int DashCooldown = 360; + public bool hasDashed = false; + public int rightClickDelay = 0; + public static int doubleRightFrameWindow = 23; + public override void ModifyTooltips(List tooltips) { if (tooltips == null) @@ -55,10 +59,10 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 84; Item.height = 46; - Item.damage = 127; + Item.damage = 97; Item.DamageType = DamageClass.Ranged; - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = 10; + Item.useAnimation = 10; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.noUseGraphic = true; @@ -69,19 +73,12 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = ShootSpeed; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 21; public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) - { - if (player.altFunctionUse == 2 && player.HasCooldown(SuperradiantSawBoost.ID)) - return false; - else - return player.ownedProjectileCounts[Item.shoot] <= 0; - } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override void HoldItem(Player player) { @@ -91,6 +88,11 @@ namespace CalamityMod.Items.Weapons.Ranged player.Calamity().mouseWorldListener = true; player.Calamity().rightClickListener = true; + if (rightClickDelay > 0) + rightClickDelay--; + if (!player.HasCooldown(SuperradiantSawBoost.ID)) + hasDashed = false; + // Right-click channeling if (player.Calamity().mouseRight && CanUseItem(player) && !Main.mapFullscreen && !Main.blockMouse && !player.HasCooldown(SuperradiantSawBoost.ID)) { @@ -108,9 +110,24 @@ namespace CalamityMod.Items.Weapons.Ranged public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // The holdout will initially double up when right clicking otherwise + // Handles allowing the dash if (player.altFunctionUse == 2) + { + bool doubleRightClick = rightClickDelay > 0 && !hasDashed; + bool canDash = doubleRightClick && player.Calamity().DashID != SuperradiantSawDash.ID; + + // If you hit the right-click window, dash + if (canDash) + { + hasDashed = true; + player.Calamity().sBlasterDashActivated = true; + } + + // Set the double right-click frames + rightClickDelay = doubleRightFrameWindow; + // The holdout will initially double up when right clicking otherwise return false; + } // The holdout deals 2x base damage. Projectile.NewProjectile(source, position, velocity, Item.shoot, damage * 2, knockback, player.whoAmI); diff --git a/Items/Weapons/Ranged/SurgeDriver.cs b/Items/Weapons/Ranged/SurgeDriver.cs index a344d60962..702c3531da 100644 --- a/Items/Weapons/Ranged/SurgeDriver.cs +++ b/Items/Weapons/Ranged/SurgeDriver.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.channel = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; diff --git a/Items/Weapons/Ranged/Svantechnical.cs b/Items/Weapons/Ranged/Svantechnical.cs index 2261b93f72..8815647088 100644 --- a/Items/Weapons/Ranged/Svantechnical.cs +++ b/Items/Weapons/Ranged/Svantechnical.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 6f; Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-5, 0); @@ -62,12 +61,12 @@ namespace CalamityMod.Items.Weapons.Ranged SineCounter++; if (SineCounter % 4 == 0) { - Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); - Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); - Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2)); - int shot1 = Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 2f); - int shot2 = Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 4f); - int shot3 = Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, 3f); + Vector2 helixVel1 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine)); + Vector2 helixVel2 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(-sine)); + Vector2 helixVel3 = (velocity * Main.rand.NextFloat(0.9f, 1.1f)).RotatedBy(MathHelper.ToRadians(sine2)); + Projectile.NewProjectile(source, position.X, position.Y, helixVel1.X, helixVel1.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 2f : 0); + Projectile.NewProjectile(source, position.X, position.Y, helixVel2.X, helixVel2.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 4f : 0); + Projectile.NewProjectile(source, position.X, position.Y, helixVel3.X, helixVel3.Y, shotType, damage, knockback, player.whoAmI, 0f, 0, player.altFunctionUse != 2 ? 3f : 0); } else if (player.altFunctionUse != 2) { diff --git a/Items/Weapons/Ranged/TelluricGlare.cs b/Items/Weapons/Ranged/TelluricGlare.cs index 08adaa405d..56277e2258 100644 --- a/Items/Weapons/Ranged/TelluricGlare.cs +++ b/Items/Weapons/Ranged/TelluricGlare.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,6 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Main.RegisterItemAnimation(Type, new DrawAnimationVertical(3, 5)); ItemID.Sets.AnimatesAsSoul[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { @@ -42,7 +45,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 18f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-14f, 0f); public override bool CanConsumeAmmo(Item ammo, Player player) => Main.rand.NextFloat() < 0.25f; diff --git a/Items/Weapons/Ranged/TheBallista.cs b/Items/Weapons/Ranged/TheBallista.cs index f6219b4d3e..17cf943732 100644 --- a/Items/Weapons/Ranged/TheBallista.cs +++ b/Items/Weapons/Ranged/TheBallista.cs @@ -14,10 +14,9 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 40; Item.height = 70; - Item.damage = 108; + Item.damage = 88; Item.DamageType = DamageClass.Ranged; - Item.useTime = 22; - Item.useAnimation = 22; + Item.useTime = Item.useAnimation = 28; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 8f; @@ -28,7 +27,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/TheHive.cs b/Items/Weapons/Ranged/TheHive.cs index a5365bc034..cc2a7042ba 100644 --- a/Items/Weapons/Ranged/TheHive.cs +++ b/Items/Weapons/Ranged/TheHive.cs @@ -16,7 +16,10 @@ namespace CalamityMod.Items.Weapons.Ranged public static float MaxCharge = 90f; public static int OriginalUseTime = 34; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.damage = 92; diff --git a/Items/Weapons/Ranged/TheJailor.cs b/Items/Weapons/Ranged/TheJailor.cs index 79bdaba8f6..11e6a60c75 100644 --- a/Items/Weapons/Ranged/TheJailor.cs +++ b/Items/Weapons/Ranged/TheJailor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.knockBack = 8f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Ranged/TheMaelstrom.cs b/Items/Weapons/Ranged/TheMaelstrom.cs index 5a2e736fee..d84ae38408 100644 --- a/Items/Weapons/Ranged/TheMaelstrom.cs +++ b/Items/Weapons/Ranged/TheMaelstrom.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/ThePack.cs b/Items/Weapons/Ranged/ThePack.cs index 3ada4994ca..9bafa9238f 100644 --- a/Items/Weapons/Ranged/ThePack.cs +++ b/Items/Weapons/Ranged/ThePack.cs @@ -19,8 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.height = 46; Item.damage = 1000; Item.DamageType = DamageClass.Ranged; - Item.useTime = 52; - Item.useAnimation = 52; + Item.useTime = Item.useAnimation = 53; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 7.5f; @@ -31,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.useAmmo = AmmoID.Rocket; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; } diff --git a/Items/Weapons/Ranged/TheStorm.cs b/Items/Weapons/Ranged/TheStorm.cs index 62013d29ee..531499c4e2 100644 --- a/Items/Weapons/Ranged/TheStorm.cs +++ b/Items/Weapons/Ranged/TheStorm.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -18,6 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged { ItemID.Sets.AnimatesAsSoul[Type] = true; Main.RegisterItemAnimation(Type, new DrawAnimationVertical(5, 9)); + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { diff --git a/Items/Weapons/Ranged/ThermoclineBlaster.cs b/Items/Weapons/Ranged/ThermoclineBlaster.cs index cb2a56540f..f71a133430 100644 --- a/Items/Weapons/Ranged/ThermoclineBlaster.cs +++ b/Items/Weapons/Ranged/ThermoclineBlaster.cs @@ -36,7 +36,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 12f; Item.shoot = ProjectileID.PurificationPowder; Item.useAmmo = AmmoID.Bullet; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Ranged/TitaniumRailgun.cs b/Items/Weapons/Ranged/TitaniumRailgun.cs index 34ad55a974..ce97852a7d 100644 --- a/Items/Weapons/Ranged/TitaniumRailgun.cs +++ b/Items/Weapons/Ranged/TitaniumRailgun.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shootSpeed = 16f; } - public override Vector2? HoldoutOffset() => new Vector2(-5, 4); + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Ranged/TitaniumRailgun.png b/Items/Weapons/Ranged/TitaniumRailgun.png index 869227b094..1122b96be4 100644 Binary files a/Items/Weapons/Ranged/TitaniumRailgun.png and b/Items/Weapons/Ranged/TitaniumRailgun.png differ diff --git a/Items/Weapons/Ranged/Toxibow.cs b/Items/Weapons/Ranged/Toxibow.cs index 51ad67d868..66c1fe65b0 100644 --- a/Items/Weapons/Ranged/Toxibow.cs +++ b/Items/Weapons/Ranged/Toxibow.cs @@ -1,5 +1,6 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; using Terraria; @@ -29,7 +30,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 15f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) @@ -45,8 +45,8 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(). - AddIngredient(15). + AddIngredient(15). + AddIngredient(12). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Ranged/TyrannysEnd.cs b/Items/Weapons/Ranged/TyrannysEnd.cs index 74344b0764..86672a1208 100644 --- a/Items/Weapons/Ranged/TyrannysEnd.cs +++ b/Items/Weapons/Ranged/TyrannysEnd.cs @@ -31,9 +31,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.noMelee = true; Item.UseSound = CommonCalamitySounds.LargeWeaponFireSound; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } // Terraria seems to really dislike high crit values in SetDefaults diff --git a/Items/Weapons/Ranged/Ultima.cs b/Items/Weapons/Ranged/Ultima.cs index ced1680bb9..7f00ee3db8 100644 --- a/Items/Weapons/Ranged/Ultima.cs +++ b/Items/Weapons/Ranged/Ultima.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 44; Item.height = 58; - Item.damage = 150; + Item.damage = 115; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 8; Item.useStyle = ItemUseStyleID.Shoot; @@ -35,9 +35,8 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Ranged/UniversalGenesis.cs b/Items/Weapons/Ranged/UniversalGenesis.cs index d26c0be45e..86d1b1acd3 100644 --- a/Items/Weapons/Ranged/UniversalGenesis.cs +++ b/Items/Weapons/Ranged/UniversalGenesis.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 158; Item.height = 60; - Item.damage = 192; + Item.damage = 180; Item.DamageType = DamageClass.Ranged; Item.useAnimation = Item.useTime = 26; Item.knockBack = 6.5f; @@ -27,15 +27,13 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ProjectileID.Bullet; Item.shootSpeed = 20f; Item.autoReuse = true; - Item.Calamity().canFirePointBlankShots = true; Item.noMelee = true; Item.UseSound = SoundID.Item38; Item.useStyle = ItemUseStyleID.Shoot; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.Calamity().donorItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() => new Vector2(-50f, -8f); @@ -57,33 +55,23 @@ namespace CalamityMod.Items.Weapons.Ranged // Stars from above float speed = Item.shootSpeed; - Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); - int starAmt = 6; - int starDmg = (int)(damage * 0.4); + int starAmt = 5; + int starDmg = (int)(damage * 0.5f); for (int i = 0; i < starAmt; i++) { - spawnPos = new Vector2(player.Center.X + (Main.rand.Next(201) * -(float)player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); + Vector2 spawnPos = new Vector2(player.Center.X + (Main.rand.Next(201) * -player.direction) + (Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f); spawnPos.X = (spawnPos.X + player.Center.X) / 2f + Main.rand.Next(-200, 201); spawnPos.Y -= 100 + i; - float xDist = Main.mouseX + Main.screenPosition.X - spawnPos.X; - float yDist = Main.mouseY + Main.screenPosition.Y - spawnPos.Y; - if (yDist < 0f) - { - yDist *= -1f; - } - if (yDist < 20f) - { - yDist = 20f; - } - float travelDist = (float)Math.Sqrt(xDist * xDist + yDist * yDist); - travelDist = speed / travelDist; - xDist *= travelDist; - yDist *= travelDist; - float xVel = xDist + Main.rand.NextFloat(-0.6f, 0.6f); - float yVel = yDist + Main.rand.NextFloat(-0.6f, 0.6f); - int star = Projectile.NewProjectile(source, spawnPos.X, spawnPos.Y, xVel, yVel, ModContent.ProjectileType(), starDmg, knockback, player.whoAmI, i, 1f); + + Vector2 vel = new Vector2(Main.mouseX + Main.screenPosition.X - spawnPos.X, MathF.Abs(Main.mouseY + Main.screenPosition.Y - spawnPos.Y)); + if (vel.Y < 20f) + vel.Y = 20f; + vel = vel.SafeNormalize(Vector2.UnitY) * speed; + vel.X += Main.rand.NextFloat(-0.6f, 0.6f); + vel.Y += Main.rand.NextFloat(-0.6f, 0.6f); + + int star = Projectile.NewProjectile(source, spawnPos, vel, ModContent.ProjectileType(), starDmg, knockback, player.whoAmI, i, 1f); Main.projectile[star].extraUpdates = 2; - Main.projectile[star].localNPCHitCooldown = 30; } return false; } diff --git a/Items/Weapons/Ranged/VernalBolter.cs b/Items/Weapons/Ranged/VernalBolter.cs index fca73e5091..f105614251 100644 --- a/Items/Weapons/Ranged/VernalBolter.cs +++ b/Items/Weapons/Ranged/VernalBolter.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 94; - Item.damage = 48; + Item.damage = 35; Item.DamageType = DamageClass.Ranged; Item.useTime = 20; Item.useAnimation = 20; @@ -31,7 +31,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.useAmmo = AmmoID.Arrow; - Item.Calamity().canFirePointBlankShots = true; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Ranged/Voidragon.cs b/Items/Weapons/Ranged/Voidragon.cs index 2cd4c67f92..b02785a578 100644 --- a/Items/Weapons/Ranged/Voidragon.cs +++ b/Items/Weapons/Ranged/Voidragon.cs @@ -41,7 +41,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); Item.Calamity().devItem = true; - Item.Calamity().canFirePointBlankShots = true; } public override Vector2? HoldoutOffset() diff --git a/Items/Weapons/Ranged/WildfireBloom.cs b/Items/Weapons/Ranged/WildfireBloom.cs index ce9ab240c8..0934adb580 100644 --- a/Items/Weapons/Ranged/WildfireBloom.cs +++ b/Items/Weapons/Ranged/WildfireBloom.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 114; Item.height = 58; - Item.damage = 78; + Item.damage = 62; Item.DamageType = DamageClass.Ranged; Item.useTime = WildfireUseTime; Item.useAnimation = WildfireUseTime; diff --git a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs index 5b74101f5d..1ba16b3a15 100644 --- a/Items/Weapons/Ranged/WulfrumBlunderbuss.cs +++ b/Items/Weapons/Ranged/WulfrumBlunderbuss.cs @@ -53,7 +53,6 @@ namespace CalamityMod.Items.Weapons.Ranged Item.autoReuse = false; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; - Item.Calamity().canFirePointBlankShots = true; } public override void HoldItem(Player player) @@ -185,7 +184,7 @@ namespace CalamityMod.Items.Weapons.Ranged public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/Apoctolith.cs b/Items/Weapons/Rogue/Apoctolith.cs index aa889bdab6..ea514d1562 100644 --- a/Items/Weapons/Rogue/Apoctolith.cs +++ b/Items/Weapons/Rogue/Apoctolith.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 66; Item.height = 64; - Item.damage = 238; + Item.damage = 185; Item.shootSpeed = 18f; Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 26; diff --git a/Items/Weapons/Rogue/AuroradicalThrow.cs b/Items/Weapons/Rogue/AuroradicalThrow.cs index 04409f3752..95aae5cd59 100644 --- a/Items/Weapons/Rogue/AuroradicalThrow.cs +++ b/Items/Weapons/Rogue/AuroradicalThrow.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class AuroradicalThrow : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 34; diff --git a/Items/Weapons/Rogue/BallisticPoisonBomb.cs b/Items/Weapons/Rogue/BallisticPoisonBomb.cs index a5adb023be..f35c9df13b 100644 --- a/Items/Weapons/Rogue/BallisticPoisonBomb.cs +++ b/Items/Weapons/Rogue/BallisticPoisonBomb.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 38; - Item.damage = 72; + Item.damage = 57; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 26; diff --git a/Items/Weapons/Rogue/BlazingStar.cs b/Items/Weapons/Rogue/BlazingStar.cs index 5f608b05d3..cd545b0e47 100644 --- a/Items/Weapons/Rogue/BlazingStar.cs +++ b/Items/Weapons/Rogue/BlazingStar.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 1; Item.damage = 75; Item.DamageType = RogueDamageClass.Instance; + Item.autoReuse = true; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 15; diff --git a/Items/Weapons/Rogue/BouncingEyeball.cs b/Items/Weapons/Rogue/BouncingEyeball.cs index 0da66baf7a..1d99ee20b9 100644 --- a/Items/Weapons/Rogue/BouncingEyeball.cs +++ b/Items/Weapons/Rogue/BouncingEyeball.cs @@ -9,9 +9,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class BouncingEyeball : RogueWeapon { - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Item.width = 26; @@ -21,8 +18,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 23; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3.5f; - Item.rare = ItemRarityID.Green; - Item.value = CalamityGlobalItem.RarityGreenBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/CelestialReaper.cs b/Items/Weapons/Rogue/CelestialReaper.cs index 946d0cf61e..5ca003824f 100644 --- a/Items/Weapons/Rogue/CelestialReaper.cs +++ b/Items/Weapons/Rogue/CelestialReaper.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CelestialReaper : RogueWeapon { - public override void SetDefaults() { Item.width = 66; @@ -24,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item71; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; + Item.value = Item.buyPrice(platinum: 3); // Sold by Bandit Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 20f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/Celestus.cs b/Items/Weapons/Rogue/Celestus.cs index 113f7e24a7..2af3d2b3dc 100644 --- a/Items/Weapons/Rogue/Celestus.cs +++ b/Items/Weapons/Rogue/Celestus.cs @@ -29,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item1; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; Item.autoReuse = true; Item.noMelee = true; diff --git a/Items/Weapons/Rogue/Cinquedea.cs b/Items/Weapons/Rogue/Cinquedea.cs index 888ab52af2..9ef1e82297 100644 --- a/Items/Weapons/Rogue/Cinquedea.cs +++ b/Items/Weapons/Rogue/Cinquedea.cs @@ -9,7 +9,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Cinquedea : RogueWeapon { - public override void SetDefaults() { Item.width = 32; @@ -26,7 +25,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 10); // Sold by Bandit Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/CosmicKunai.cs b/Items/Weapons/Rogue/CosmicKunai.cs index 39a5b4a75d..378cee23de 100644 --- a/Items/Weapons/Rogue/CosmicKunai.cs +++ b/Items/Weapons/Rogue/CosmicKunai.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class CosmicKunai : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Weapons/Rogue/CraniumSmasher.cs b/Items/Weapons/Rogue/CraniumSmasher.cs index 5ef882b4c0..7c33cb6419 100644 --- a/Items/Weapons/Rogue/CraniumSmasher.cs +++ b/Items/Weapons/Rogue/CraniumSmasher.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class CraniumSmasher : RogueWeapon { private bool throwExplosive = false; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Rogue/CrushsawCrasher.cs b/Items/Weapons/Rogue/CrushsawCrasher.cs index 611d050155..a82b2e5f37 100644 --- a/Items/Weapons/Rogue/CrushsawCrasher.cs +++ b/Items/Weapons/Rogue/CrushsawCrasher.cs @@ -17,7 +17,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 38; Item.height = 22; - Item.damage = 81; + Item.damage = 57; Item.useAnimation = 18; Item.useStyle = ItemUseStyleID.Swing; Item.useTime = 18; @@ -31,20 +31,19 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.7f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike { int spread = 3; - for (int i = 0; i < 5; i++) + for (int i = 0; i < 6; i++) { Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-3, 4), velocity.Y + Main.rand.Next(-3, 4)).RotatedBy(MathHelper.ToRadians(spread)); int proj = Projectile.NewProjectile(source, position, perturbedspeed, type, damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].penetrate = 1; } spread -= Main.rand.Next(1, 4); } diff --git a/Items/Weapons/Rogue/Crystalline.cs b/Items/Weapons/Rogue/Crystalline.cs index 74260456a7..83add7844f 100644 --- a/Items/Weapons/Rogue/Crystalline.cs +++ b/Items/Weapons/Rogue/Crystalline.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthDamageMultiplier => 3f; + public override float StealthDamageMultiplier => 1.7f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/DeepWounder.cs b/Items/Weapons/Rogue/DeepWounder.cs index 4bb20aae43..7cbfc94525 100644 --- a/Items/Weapons/Rogue/DeepWounder.cs +++ b/Items/Weapons/Rogue/DeepWounder.cs @@ -13,12 +13,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 58; Item.height = 52; - Item.damage = 136; + Item.damage = 132; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 23; + Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 23; Item.knockBack = 3f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; @@ -36,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue { if (player.Calamity().StealthStrikeAvailable()) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); if (p.WithinBounds(Main.maxProjectiles)) Main.projectile[p].Calamity().stealthStrike = true; return false; diff --git a/Items/Weapons/Rogue/DefectiveSphere.cs b/Items/Weapons/Rogue/DefectiveSphere.cs index d9a4719ab1..2fc9f55986 100644 --- a/Items/Weapons/Rogue/DefectiveSphere.cs +++ b/Items/Weapons/Rogue/DefectiveSphere.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 42; Item.height = 44; - Item.damage = 116; + Item.damage = 85; Item.knockBack = 5f; Item.useAnimation = 13; Item.useTime = 13; @@ -37,22 +37,9 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool CanUseItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) - { - return true; - } - else if ((player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) >= 5) - { - return false; - } - else - { - return true; - } + return player.Calamity().StealthStrikeAvailable() || (player.ownedProjectileCounts[Item.shoot] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()] + player.ownedProjectileCounts[ProjectileType()]) <= 4; } - public override float StealthDamageMultiplier => 0.9f; - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) { type = Utils.SelectRandom(Main.rand, new int[] @@ -72,13 +59,13 @@ namespace CalamityMod.Items.Weapons.Rogue { // This is done to allow looping when creating projectiles, instead of having to create many projectile/velocity variables all at once, // which this shoot code used to do. - int[] projectilesToShoot = new int[] - { + int[] projectilesToShoot = + [ ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType() - }; + ]; foreach (int projectileType in projectilesToShoot) { diff --git a/Items/Weapons/Rogue/DuststormInABottle.cs b/Items/Weapons/Rogue/DuststormInABottle.cs index cb31651c19..c2fcaf1af4 100644 --- a/Items/Weapons/Rogue/DuststormInABottle.cs +++ b/Items/Weapons/Rogue/DuststormInABottle.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 24; - Item.damage = 74; + Item.damage = 65; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; @@ -30,18 +30,16 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public static float StealthDmgMult = 0.6f; //So I can edit it directly via DragonLens instead of having to do math with CalTestHelpers - public override float StealthDamageMultiplier => StealthDmgMult; + public override float StealthDamageMultiplier => 0.6f; public static int CloudLifetime = 200; public static float DustRadius = 11f; - public static int StealthIframes = 9; //Cloud hitbox size manipulation public static float MaxSize = 3.2f; public static float MaxSizeStealth = 3.6f; public static float GrowthRate = 0.025f; - public static float StealthGrowhRate = 0.035f; + public static float StealthGrowthRate = 0.035f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/DynamicPursuer.cs b/Items/Weapons/Rogue/DynamicPursuer.cs index 7bce69a725..7154af929f 100644 --- a/Items/Weapons/Rogue/DynamicPursuer.cs +++ b/Items/Weapons/Rogue/DynamicPursuer.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.noMelee = true; Item.noUseGraphic = true; diff --git a/Items/Weapons/Rogue/EclipsesFall.cs b/Items/Weapons/Rogue/EclipsesFall.cs index 66e11cf25d..3718a981cf 100644 --- a/Items/Weapons/Rogue/EclipsesFall.cs +++ b/Items/Weapons/Rogue/EclipsesFall.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.height = 88; Item.damage = 500; Item.knockBack = 3.5f; - Item.useAnimation = Item.useTime = 22; + Item.useAnimation = Item.useTime = 24; Item.autoReuse = true; Item.DamageType = RogueDamageClass.Instance; Item.shootSpeed = 15f; @@ -30,7 +30,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/EnchantedAxe.cs b/Items/Weapons/Rogue/EnchantedAxe.cs index 187a61f645..266a1b1862 100644 --- a/Items/Weapons/Rogue/EnchantedAxe.cs +++ b/Items/Weapons/Rogue/EnchantedAxe.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.maxStack = 1; - Item.value = 1000; Item.rare = ItemRarityID.Orange; Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/Eradicator.cs b/Items/Weapons/Rogue/Eradicator.cs index 7d6589d230..bf74a45769 100644 --- a/Items/Weapons/Rogue/Eradicator.cs +++ b/Items/Weapons/Rogue/Eradicator.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,28 +13,30 @@ namespace CalamityMod.Items.Weapons.Rogue public class Eradicator : RogueWeapon { public static float Speed = 10.5f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 62; Item.height = 58; - Item.damage = 620; + Item.damage = 540; + Item.DamageType = RogueDamageClass.Instance; + Item.useTime = Item.useAnimation = 24; + Item.knockBack = 7f; Item.noMelee = true; Item.noUseGraphic = true; Item.autoReuse = true; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 33; - Item.useAnimation = 33; - Item.knockBack = 7f; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.6f; + public override float StealthDamageMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/ExecutionersBlade.cs b/Items/Weapons/Rogue/ExecutionersBlade.cs index 1692e04126..72d6da8198 100644 --- a/Items/Weapons/Rogue/ExecutionersBlade.cs +++ b/Items/Weapons/Rogue/ExecutionersBlade.cs @@ -17,12 +17,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 64; Item.height = 64; - Item.damage = 195; + Item.damage = 165; Item.noMelee = true; Item.noUseGraphic = true; Item.useTime = 3; Item.useAnimation = 9; - Item.reuseDelay = 1; Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6.75f; @@ -32,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 24f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Items/Weapons/Rogue/Exorcism.cs b/Items/Weapons/Rogue/Exorcism.cs index 4742e420dc..4f412f2c09 100644 --- a/Items/Weapons/Rogue/Exorcism.cs +++ b/Items/Weapons/Rogue/Exorcism.cs @@ -13,17 +13,17 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 109; Item.height = 128; - Item.damage = 285; + Item.damage = 192; Item.noMelee = true; Item.noUseGraphic = true; - // Due to the amazing sound engine, having more than one of these on screen will cause audio bugs! - // Therefore this thing has to be absurdly slow (Not that I've ever complained about that before) - Item.useAnimation = Item.useTime = 115; + // Due to the amazing sound engine, having multiple crosses embedded in enemies cuts off the sound + // Therefore this thing has to be very slow (Not that I've ever complained about that before) + Item.useAnimation = Item.useTime = 96; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 12f; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityPinkBuyPrice; - Item.rare = ItemRarityID.Pink; + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; + Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/FantasyTalisman.cs b/Items/Weapons/Rogue/FantasyTalisman.cs index aad9aeb1d9..8b7f5a9494 100644 --- a/Items/Weapons/Rogue/FantasyTalisman.cs +++ b/Items/Weapons/Rogue/FantasyTalisman.cs @@ -14,11 +14,10 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 30; Item.height = 30; - Item.damage = 52; + Item.damage = 45; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 25; - Item.useTime = 25; + Item.useTime = Item.useAnimation = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6f; Item.UseSound = SoundID.Item1; @@ -29,28 +28,18 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 18f; Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.7f; + public override float StealthDamageMultiplier => 0.75f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (!player.Calamity().StealthStrikeAvailable()) + for (int i = -1; i <= 1; i++) { - for (int i = -1; i <= 1; i++) - { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 6f)); - Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); - } + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * (player.Calamity().StealthStrikeAvailable() ? 5f : 6f))); + int shootCard = player.Calamity().StealthStrikeAvailable() ? ModContent.ProjectileType() : type; + int card = Projectile.NewProjectile(source, position, perturbedSpeed, shootCard, damage, knockback, player.whoAmI); + if (card.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) + Main.projectile[card].Calamity().stealthStrike = true; } - else if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - for (int i = -1; i <= 1; i++) - { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i * 5f)); - int stealth = Projectile.NewProjectile(source, position, perturbedSpeed, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - } - } - return true; + return false; } public override void AddRecipes() diff --git a/Items/Weapons/Rogue/FrostcrushValari.cs b/Items/Weapons/Rogue/FrostcrushValari.cs index 43953e042c..b8342c3b62 100644 --- a/Items/Weapons/Rogue/FrostcrushValari.cs +++ b/Items/Weapons/Rogue/FrostcrushValari.cs @@ -18,9 +18,9 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 46; - Item.damage = 89; + Item.damage = 81; Item.DamageType = RogueDamageClass.Instance; - Item.useTime = Item.useAnimation = 17; + Item.useTime = Item.useAnimation = 19; Item.knockBack = 12; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; @@ -37,9 +37,6 @@ namespace CalamityMod.Items.Weapons.Rogue // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 0.9f; - public override float StealthKnockbackMultiplier => 0.3333f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -48,7 +45,7 @@ namespace CalamityMod.Items.Weapons.Rogue if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].Calamity().stealthStrike = true; - Main.projectile[proj].penetrate = 5; + Main.projectile[proj].penetrate = 4; } return false; } diff --git a/Items/Weapons/Rogue/FrostyFlare.cs b/Items/Weapons/Rogue/FrostyFlare.cs index 1226639a46..acf40a72cb 100644 --- a/Items/Weapons/Rogue/FrostyFlare.cs +++ b/Items/Weapons/Rogue/FrostyFlare.cs @@ -9,16 +9,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class FrostyFlare : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = 10; Item.height = 22; - Item.damage = 32; + Item.damage = 37; Item.noUseGraphic = true; Item.noMelee = true; Item.useAnimation = Item.useTime = 13; @@ -27,12 +22,10 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.knockBack = 2f; - Item.value = Item.buyPrice(0, 0, 8, 0); + Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 22f; - Item.maxStack = Item.CommonMaxStack; - Item.consumable = true; Item.DamageType = RogueDamageClass.Instance; } diff --git a/Items/Weapons/Rogue/GacruxianMollusk.cs b/Items/Weapons/Rogue/GacruxianMollusk.cs index eefd917f1f..8ea216e1a8 100644 --- a/Items/Weapons/Rogue/GacruxianMollusk.cs +++ b/Items/Weapons/Rogue/GacruxianMollusk.cs @@ -28,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noUseGraphic = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = Speed; - Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; - Item.rare = ItemRarityID.LightRed; + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; + Item.rare = ItemRarityID.Pink; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/GelDart.cs b/Items/Weapons/Rogue/GelDart.cs index c01f1fb608..53b4185afa 100644 --- a/Items/Weapons/Rogue/GelDart.cs +++ b/Items/Weapons/Rogue/GelDart.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Items.Weapons.Rogue CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Rogue/GhoulishGouger.cs b/Items/Weapons/Rogue/GhoulishGouger.cs index e3b26d6f38..86dce8ed23 100644 --- a/Items/Weapons/Rogue/GhoulishGouger.cs +++ b/Items/Weapons/Rogue/GhoulishGouger.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class GhoulishGouger : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 74; diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index b76b2ab6d9..d303ab8633 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue public class Glaive : RogueWeapon { //These 2 are used on the Projectile AI and thus remain here - public static float Speed = 10f; - public static float StealthSpeedMult = 1.8f; + public static float Speed = 13f; + public static float StealthSpeedMult = 1.3f; public override void SetDefaults() { @@ -25,33 +25,27 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = 15; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 3; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 10); // Sold by Bandit Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.shootSpeed = 10; + Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthVelocityMultiplier => StealthSpeedMult; + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float ai1 = 0f; - if (player.Calamity().StealthStrikeAvailable()) - { - ai1 = 1f; - } - - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, -1f); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) + { Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 4; + } return false; } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; } } diff --git a/Items/Weapons/Rogue/GodsParanoia.cs b/Items/Weapons/Rogue/GodsParanoia.cs index 617ddddddc..4e80bce431 100644 --- a/Items/Weapons/Rogue/GodsParanoia.cs +++ b/Items/Weapons/Rogue/GodsParanoia.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 20; Item.height = 20; - Item.damage = 210; + Item.damage = 163; Item.DamageType = RogueDamageClass.Instance; Item.noMelee = true; Item.noUseGraphic = true; @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/HeavenfallenStardisk.cs b/Items/Weapons/Rogue/HeavenfallenStardisk.cs index 92de798ec1..81315aedd6 100644 --- a/Items/Weapons/Rogue/HeavenfallenStardisk.cs +++ b/Items/Weapons/Rogue/HeavenfallenStardisk.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 44; Item.height = 48; - Item.damage = 165; + Item.damage = 160; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 40; @@ -21,8 +21,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 8f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLimeBuyPrice; - Item.rare = ItemRarityID.Lime; + Item.value = CalamityGlobalItem.RarityYellowBuyPrice; + Item.rare = ItemRarityID.Yellow; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = RogueDamageClass.Instance; @@ -32,26 +32,10 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - { - int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int spread = 15; - for (int i = 0; i < 2; i++) - { - Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-8, 8), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); - Projectile.NewProjectile(source, position, perturbedspeed.Length() * -Vector2.UnitY, type, (int)(damage * 0.3), knockback, player.whoAmI); - if (proj.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); - } - spread -= Main.rand.Next(5, 8); - } - } - return false; - } + int proj = Projectile.NewProjectile(source, position, velocity.Length() * -Vector2.UnitY, type, damage, knockback, player.whoAmI); + if (proj.WithinBounds(Main.maxProjectiles)) + Main.projectile[proj].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + return false; } } } diff --git a/Items/Weapons/Rogue/Hypothermia.cs b/Items/Weapons/Rogue/Hypothermia.cs index c219d0b749..31043a2f4e 100644 --- a/Items/Weapons/Rogue/Hypothermia.cs +++ b/Items/Weapons/Rogue/Hypothermia.cs @@ -19,31 +19,29 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 46; Item.height = 32; + Item.damage = 148; + Item.DamageType = RogueDamageClass.Instance; + Item.useTime = 4; + Item.useAnimation = 12; + Item.reuseDelay = 1; + Item.useLimitPerAnimation = 3; + Item.knockBack = 3f; + Item.autoReuse = true; Item.noUseGraphic = true; Item.noMelee = true; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item7; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - - Item.damage = 200; - Item.useTime = 3; - Item.useAnimation = 21; - Item.reuseDelay = 1; - Item.useLimitPerAnimation = 7; - Item.knockBack = 3f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 8f; - Item.rare = ModContent.RarityType(); - Item.DamageType = RogueDamageClass.Instance; + Item.rare = ModContent.RarityType(); + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } // Terraria seems to really dislike high crit values in SetDefaults public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - public override float StealthDamageMultiplier => 1.1f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) @@ -66,10 +64,9 @@ namespace CalamityMod.Items.Weapons.Rogue for (int i = 0; i < projAmt; ++i) { - float SpeedX = velocity.X + Main.rand.NextFloat(-2f, 2f); - float SpeedY = velocity.Y + Main.rand.NextFloat(-2f, 2f); + Vector2 shardVel = velocity.RotatedByRandom(MathHelper.Pi / 30f) * Main.rand.NextFloat(0.9f, 1.1f); int texID = Main.rand.Next(4); - Projectile.NewProjectile(source, position, new Vector2(SpeedX, SpeedY), type, damage, knockback, player.whoAmI, texID, 0f); + Projectile.NewProjectile(source, position, shardVel, type, damage, knockback, player.whoAmI, texID); } return false; diff --git a/Items/Weapons/Rogue/IceStar.cs b/Items/Weapons/Rogue/IceStar.cs index d7cf231cb7..9d025acef4 100644 --- a/Items/Weapons/Rogue/IceStar.cs +++ b/Items/Weapons/Rogue/IceStar.cs @@ -9,11 +9,6 @@ namespace CalamityMod.Items.Weapons.Rogue { public class IceStar : RogueWeapon { - public override void SetStaticDefaults() - { - Item.ResearchUnlockCount = 99; - } - public override void SetDefaults() { Item.width = Item.height = 66; @@ -26,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 2.5f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = Item.buyPrice(0, 0, 5, 0); + Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 14f; diff --git a/Items/Weapons/Rogue/Icebreaker.cs b/Items/Weapons/Rogue/Icebreaker.cs index 2e7bee34db..c0074f74c9 100644 --- a/Items/Weapons/Rogue/Icebreaker.cs +++ b/Items/Weapons/Rogue/Icebreaker.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Icebreaker : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 60; diff --git a/Items/Weapons/Rogue/InfernalKris.cs b/Items/Weapons/Rogue/InfernalKris.cs index eacb33e1bc..a253fb640c 100644 --- a/Items/Weapons/Rogue/InfernalKris.cs +++ b/Items/Weapons/Rogue/InfernalKris.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 38; - Item.damage = 23; + Item.damage = 21; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 18; @@ -35,7 +35,10 @@ namespace CalamityMod.Items.Weapons.Rogue { int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); if (p.WithinBounds(Main.maxProjectiles)) + { Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 1; + } return false; } return true; @@ -45,7 +48,7 @@ namespace CalamityMod.Items.Weapons.Rogue { CreateRecipe(). AddIngredient(ItemID.HellstoneBar, 10). - AddIngredient(ItemID.Obsidian, 9). + AddIngredient(ItemID.AshWood, 10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Rogue/InfestedClawmerang.cs b/Items/Weapons/Rogue/InfestedClawmerang.cs index 829c59c962..347338642b 100644 --- a/Items/Weapons/Rogue/InfestedClawmerang.cs +++ b/Items/Weapons/Rogue/InfestedClawmerang.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("Shroomerang")] public class InfestedClawmerang : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 26; diff --git a/Items/Weapons/Rogue/KelvinCatalyst.cs b/Items/Weapons/Rogue/KelvinCatalyst.cs index dc3bf49211..cfcd7844f7 100644 --- a/Items/Weapons/Rogue/KelvinCatalyst.cs +++ b/Items/Weapons/Rogue/KelvinCatalyst.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(100). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(). diff --git a/Items/Weapons/Rogue/LeonidProgenitor.cs b/Items/Weapons/Rogue/LeonidProgenitor.cs index 7918e2eded..26a17019bd 100644 --- a/Items/Weapons/Rogue/LeonidProgenitor.cs +++ b/Items/Weapons/Rogue/LeonidProgenitor.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 48; - Item.damage = 64; + Item.damage = 57; Item.DamageType = RogueDamageClass.Instance; Item.knockBack = 3f; Item.useAnimation = Item.useTime = 15; @@ -38,9 +38,9 @@ namespace CalamityMod.Items.Weapons.Rogue Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; } + public override float StealthDamageMultiplier => 1.25f; public override bool AltFunctionUse(Player player) => true; - public override bool CanUseItem(Player player) { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) @@ -56,35 +56,23 @@ namespace CalamityMod.Items.Weapons.Rogue return base.CanUseItem(player); } - public override float UseSpeedMultiplier(Player player) - { - if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) - return 1f; - return 0.8f; - } - - public override float StealthDamageMultiplier => 1.25f; - - public override void ModifyStatsExtra(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) - { - if (!player.Calamity().StealthStrikeAvailable() && player.altFunctionUse == 2) - damage = (int)(damage * 0.5f); - } - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable() || player.altFunctionUse != 2) { int bomb = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (bomb.WithinBounds(Main.maxProjectiles)) - Main.projectile[bomb].Calamity().stealthStrike = player.Calamity().StealthStrikeAvailable(); + if (bomb.WithinBounds(Main.maxProjectiles) && player.Calamity().StealthStrikeAvailable()) + { + Main.projectile[bomb].Calamity().stealthStrike = true; + Main.projectile[bomb].extraUpdates = 1; + } return false; } else { - for (float i = -2.5f; i < 3f; ++i) + for (int i = 0; i < 2; i++) { - Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians(i)); + Vector2 perturbedSpeed = velocity.RotatedBy(MathHelper.ToRadians((i - 0.5f) * 2)); Projectile.NewProjectile(source, position, perturbedSpeed, type, damage, knockback, player.whoAmI); } } diff --git a/Items/Weapons/Rogue/LeviathanTeeth.cs b/Items/Weapons/Rogue/LeviathanTeeth.cs index adc05255a4..fb6f34714a 100644 --- a/Items/Weapons/Rogue/LeviathanTeeth.cs +++ b/Items/Weapons/Rogue/LeviathanTeeth.cs @@ -9,11 +9,15 @@ namespace CalamityMod.Items.Weapons.Rogue { public class LeviathanTeeth : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 36; Item.height = 38; - Item.damage = 44; + Item.damage = 43; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 9; @@ -21,35 +25,24 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.maxStack = 1; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 5.5f; + Item.shootSpeed = 7.5f; Item.DamageType = RogueDamageClass.Instance; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - bool stealthStrike = false; - if (player.Calamity().StealthStrikeAvailable()) - stealthStrike = true; - for (int i = 0; i < 2; i++) { - if (stealthStrike) - { - Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity * 1.5f, type, damage, knockback * 12, player.whoAmI); - tooth.Calamity().stealthStrike = true; - tooth.timeLeft = 140; - tooth.ai[1] = 4; - return false; // This makes it not fire 2 with the for loop, thanks Angel lol - } - else - { - Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.7f, 1f), type, damage, knockback, player.whoAmI); - tooth.ai[1] = Main.rand.Next(1, 3 + 1); - } + Projectile tooth = Projectile.NewProjectileDirect(source, position, velocity.SafeNormalize(Vector2.UnitX), ModContent.ProjectileType(), damage, 0, player.whoAmI, 0, 0); + tooth.Calamity().stealthStrike = true; + } + else + { + for (int i = 0; i < 2; i++) + Projectile.NewProjectile(source, position, velocity.RotatedByRandom(0.05f + i * 0.15f) * Main.rand.NextFloat(0.8f, 1f), type, damage, knockback, player.whoAmI, 0f, Main.rand.Next(1, 3+1)); } return false; } diff --git a/Items/Weapons/Rogue/MeteorFist.cs b/Items/Weapons/Rogue/MeteorFist.cs index 3fe824bcf6..514769e61b 100644 --- a/Items/Weapons/Rogue/MeteorFist.cs +++ b/Items/Weapons/Rogue/MeteorFist.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 22; Item.height = 28; - Item.damage = 37; + Item.damage = 31; Item.DamageType = RogueDamageClass.Instance; - Item.useAnimation = Item.useTime = 28; + Item.useAnimation = Item.useTime = 25; Item.knockBack = 5.75f; Item.shootSpeed = 4f; @@ -31,8 +31,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); } - public override float StealthDamageMultiplier => 1.15f; - public override void HoldItem(Player player) => player.Calamity().mouseWorldListener = true; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/MoltenAmputator.cs b/Items/Weapons/Rogue/MoltenAmputator.cs index 6b61c1d864..ef1ddd4839 100644 --- a/Items/Weapons/Rogue/MoltenAmputator.cs +++ b/Items/Weapons/Rogue/MoltenAmputator.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -14,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class MoltenAmputator : RogueWeapon { public float speed = 16; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 92; diff --git a/Items/Weapons/Rogue/Mycoroot.cs b/Items/Weapons/Rogue/Mycoroot.cs index 7adee86c42..0975e41c26 100644 --- a/Items/Weapons/Rogue/Mycoroot.cs +++ b/Items/Weapons/Rogue/Mycoroot.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Mycoroot : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 32; @@ -17,8 +22,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.damage = 12; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 5; - Item.useAnimation = 5; + Item.useTime = 6; + Item.useAnimation = 6; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 1.5f; Item.UseSound = SoundID.Item1; @@ -36,12 +41,9 @@ namespace CalamityMod.Items.Weapons.Rogue if (player.Calamity().StealthStrikeAvailable() && player.ownedProjectileCounts[ModContent.ProjectileType()] < 20 && stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].Calamity().stealthStrike = true; - int projAmt = Main.rand.Next(7, 11); - for (int i = 0; i < projAmt; i++) + for (int i = 0; i < 8; i++) { - int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), (int)(damage * 0.5f), knockback, player.whoAmI); - if (spore.WithinBounds(Main.maxProjectiles)) - Main.projectile[spore].ai[1] = 1f; + int spore = Projectile.NewProjectile(source, player.Center, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); } foreach (Player other in Main.ActivePlayers) { diff --git a/Items/Weapons/Rogue/Penumbra.cs b/Items/Weapons/Rogue/Penumbra.cs index e933be5740..bf62bd5875 100644 --- a/Items/Weapons/Rogue/Penumbra.cs +++ b/Items/Weapons/Rogue/Penumbra.cs @@ -24,42 +24,38 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item103; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.damage = 830; - Item.useAnimation = 40; - Item.useTime = 40; + Item.damage = 725; + Item.crit = 16; + Item.useTime = Item.useAnimation = 35; Item.knockBack = 8f; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 9f; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.DamageType = RogueDamageClass.Instance; } - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 16; - - public override float StealthDamageMultiplier => 0.85f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.Calamity().StealthStrikeAvailable()) { Vector2 realPlayerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float mouseXDist = Main.mouseX + Main.screenPosition.X - realPlayerPos.X; - float mouseYDist = Main.mouseY + Main.screenPosition.Y - realPlayerPos.Y; - if (player.gravDir == -1f) - { - mouseYDist = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - realPlayerPos.Y; - } + float mouseXDist = Main.screenPosition.X + Main.mouseX - realPlayerPos.X; + float mouseYDist = Main.screenPosition.Y + (player.gravDir == -1 ? Main.screenHeight - Main.mouseY : Main.mouseY) - realPlayerPos.Y; if ((float.IsNaN(mouseXDist) && float.IsNaN(mouseYDist)) || (mouseXDist == 0f && mouseYDist == 0f)) { mouseXDist = player.direction; mouseYDist = 0f; } realPlayerPos += new Vector2(mouseXDist, mouseYDist); - int proj = Projectile.NewProjectile(source, realPlayerPos, new Vector2(0f, -0.5f), ModContent.ProjectileType(), damage, knockback, player.whoAmI, 0f, 1f); + int proj = Projectile.NewProjectile(source, realPlayerPos, -Vector2.UnitY * 0.25f, ModContent.ProjectileType(), damage, knockback, player.whoAmI); if (proj.WithinBounds(Main.maxProjectiles)) + { Main.projectile[proj].Calamity().stealthStrike = true; + Main.projectile[proj].timeLeft = 450; + } return false; } return true; diff --git a/Items/Weapons/Rogue/PhantasmalRuin.cs b/Items/Weapons/Rogue/PhantasmalRuin.cs index c00e7059f6..59195398eb 100644 --- a/Items/Weapons/Rogue/PhantasmalRuin.cs +++ b/Items/Weapons/Rogue/PhantasmalRuin.cs @@ -16,13 +16,12 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 108; Item.height = 114; - Item.damage = 152; + Item.damage = 140; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = 30; - Item.useAnimation = 30; + Item.useTime = Item.useAnimation = 30; Item.autoReuse = true; Item.shootSpeed = 12f; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Rogue/ProfanedPartisan.cs b/Items/Weapons/Rogue/ProfanedPartisan.cs index 51b0207b43..9c04347e38 100644 --- a/Items/Weapons/Rogue/ProfanedPartisan.cs +++ b/Items/Weapons/Rogue/ProfanedPartisan.cs @@ -13,8 +13,8 @@ namespace CalamityMod.Items.Weapons.Rogue { public override void SetDefaults() { - Item.width = 56; - Item.height = 56; + Item.width = 68; + Item.height = 68; Item.damage = 222; Item.knockBack = 8f; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Rogue/ProfanedPartisan.png b/Items/Weapons/Rogue/ProfanedPartisan.png index defd077056..24b45d1ccc 100644 Binary files a/Items/Weapons/Rogue/ProfanedPartisan.png and b/Items/Weapons/Rogue/ProfanedPartisan.png differ diff --git a/Items/Weapons/Rogue/RefractionRotor.cs b/Items/Weapons/Rogue/RefractionRotor.cs index 4d9491c548..6004817676 100644 --- a/Items/Weapons/Rogue/RefractionRotor.cs +++ b/Items/Weapons/Rogue/RefractionRotor.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override float StealthDamageMultiplier => 0.3f; diff --git a/Items/Weapons/Rogue/RegulusRiot.cs b/Items/Weapons/Rogue/RegulusRiot.cs index 02c40309ce..9aa73883e5 100644 --- a/Items/Weapons/Rogue/RegulusRiot.cs +++ b/Items/Weapons/Rogue/RegulusRiot.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RegulusRiot : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 28; diff --git a/Items/Weapons/Rogue/RotBall.cs b/Items/Weapons/Rogue/RotBall.cs index 374b63d451..64b31ae366 100644 --- a/Items/Weapons/Rogue/RotBall.cs +++ b/Items/Weapons/Rogue/RotBall.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class RotBall : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 30; @@ -46,15 +51,5 @@ namespace CalamityMod.Items.Weapons.Rogue } return true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 4). - AddIngredient(12). - AddIngredient(ItemID.RottenChunk, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Rogue/Sacrifice.cs b/Items/Weapons/Rogue/Sacrifice.cs index d13814e54e..763489019b 100644 --- a/Items/Weapons/Rogue/Sacrifice.cs +++ b/Items/Weapons/Rogue/Sacrifice.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Sacrifice : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 68; @@ -26,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityVioletBuyPrice; } diff --git a/Items/Weapons/Rogue/ScourgeoftheDesert.cs b/Items/Weapons/Rogue/ScourgeoftheDesert.cs index 3686253aea..5b26a0f0e6 100644 --- a/Items/Weapons/Rogue/ScourgeoftheDesert.cs +++ b/Items/Weapons/Rogue/ScourgeoftheDesert.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +11,11 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ScourgeoftheDesert : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } + public override void SetDefaults() { Item.width = 112; diff --git a/Items/Weapons/Rogue/ScourgeoftheSeas.cs b/Items/Weapons/Rogue/ScourgeoftheSeas.cs index 73754f4fb0..2bdbb91d65 100644 --- a/Items/Weapons/Rogue/ScourgeoftheSeas.cs +++ b/Items/Weapons/Rogue/ScourgeoftheSeas.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ScourgeoftheSeas : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 64; diff --git a/Items/Weapons/Rogue/SearedPan.cs b/Items/Weapons/Rogue/SearedPan.cs index b7cc902959..5ccd6b6204 100644 --- a/Items/Weapons/Rogue/SearedPan.cs +++ b/Items/Weapons/Rogue/SearedPan.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 15f; Item.Calamity().donorItem = true; diff --git a/Items/Weapons/Rogue/Seraphim.cs b/Items/Weapons/Rogue/Seraphim.cs index 70f1b3c210..c55b583ae2 100644 --- a/Items/Weapons/Rogue/Seraphim.cs +++ b/Items/Weapons/Rogue/Seraphim.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = SeraphimProjectile.InitialSpeed; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/SlickCane.cs b/Items/Weapons/Rogue/SlickCane.cs index 66108a171d..60f192551e 100644 --- a/Items/Weapons/Rogue/SlickCane.cs +++ b/Items/Weapons/Rogue/SlickCane.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 6f; Item.UseSound = SoundID.DD2_GhastlyGlaivePierce; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; + Item.value = Item.buyPrice(gold: 35); // Sold by Bandit Item.rare = ItemRarityID.Orange; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; diff --git a/Items/Weapons/Rogue/SludgeSplotch.cs b/Items/Weapons/Rogue/SludgeSplotch.cs index d3f9b71e46..e90b104126 100644 --- a/Items/Weapons/Rogue/SludgeSplotch.cs +++ b/Items/Weapons/Rogue/SludgeSplotch.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 30; - Item.damage = 41; + Item.damage = 30; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 18; diff --git a/Items/Weapons/Rogue/SpearofDestiny.cs b/Items/Weapons/Rogue/SpearofDestiny.cs index e99ea4e662..c1f007aef6 100644 --- a/Items/Weapons/Rogue/SpearofDestiny.cs +++ b/Items/Weapons/Rogue/SpearofDestiny.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 52; Item.height = 52; - Item.damage = 75; + Item.damage = 70; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = Item.useTime = 41; diff --git a/Items/Weapons/Rogue/StellarKnife.cs b/Items/Weapons/Rogue/StellarKnife.cs index b8f8e6eb71..abe77f582a 100644 --- a/Items/Weapons/Rogue/StellarKnife.cs +++ b/Items/Weapons/Rogue/StellarKnife.cs @@ -15,12 +15,11 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 34; - Item.damage = 82; + Item.damage = 69; Item.noMelee = true; Item.noUseGraphic = true; - Item.useAnimation = 9; + Item.useTime = Item.useAnimation = 9; Item.useStyle = ItemUseStyleID.Swing; - Item.useTime = 9; Item.knockBack = 4f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index d6bef9b091..73e4551819 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override float StealthDamageMultiplier => 0.7f; diff --git a/Items/Weapons/Rogue/TerrorTalons.cs b/Items/Weapons/Rogue/TerrorTalons.cs index 72246ccf3b..c70d0fd3bc 100644 --- a/Items/Weapons/Rogue/TerrorTalons.cs +++ b/Items/Weapons/Rogue/TerrorTalons.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 40; Item.height = 24; - Item.damage = 50; + Item.damage = 47; Item.noMelee = true; Item.noUseGraphic = true; Item.useStyle = ItemUseStyleID.Swing; @@ -23,8 +23,8 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 3f; Item.UseSound = SoundID.Item39; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; - Item.rare = ItemRarityID.LightPurple; + Item.value = CalamityGlobalItem.RarityLimeBuyPrice; + Item.rare = ItemRarityID.Lime; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 12f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/TheAtomSplitter.cs b/Items/Weapons/Rogue/TheAtomSplitter.cs index 10cbf7a310..7372b085b7 100644 --- a/Items/Weapons/Rogue/TheAtomSplitter.cs +++ b/Items/Weapons/Rogue/TheAtomSplitter.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.noMelee = true; Item.noUseGraphic = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Rogue/TheFinalDawn.cs b/Items/Weapons/Rogue/TheFinalDawn.cs index beb247c99c..2500dc9318 100644 --- a/Items/Weapons/Rogue/TheFinalDawn.cs +++ b/Items/Weapons/Rogue/TheFinalDawn.cs @@ -12,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue public class TheFinalDawn : RogueWeapon { public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/FinalDawnSlash"); + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 78; @@ -24,7 +28,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 4; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.Calamity().donorItem = true; Item.autoReuse = false; diff --git a/Items/Weapons/Rogue/TheSyringe.cs b/Items/Weapons/Rogue/TheSyringe.cs index 0275281647..d367bb675f 100644 --- a/Items/Weapons/Rogue/TheSyringe.cs +++ b/Items/Weapons/Rogue/TheSyringe.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,7 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public static float Knockback = 5f; public static float Speed = 15f; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 14; diff --git a/Items/Weapons/Rogue/ThrowingBrick.cs b/Items/Weapons/Rogue/ThrowingBrick.cs index a34ec66c13..d290fbacab 100644 --- a/Items/Weapons/Rogue/ThrowingBrick.cs +++ b/Items/Weapons/Rogue/ThrowingBrick.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 5f; - Item.value = Item.sellPrice(0, 0, 0, 4); + Item.value = Item.sellPrice(copper: 4); Item.rare = ItemRarityID.White; Item.maxStack = Item.CommonMaxStack; Item.UseSound = SoundID.Item1; diff --git a/Items/Weapons/Rogue/ToothBall.cs b/Items/Weapons/Rogue/ToothBall.cs index 686a7719a8..3a7602e4bb 100644 --- a/Items/Weapons/Rogue/ToothBall.cs +++ b/Items/Weapons/Rogue/ToothBall.cs @@ -1,4 +1,5 @@ using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToothBall : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 30; @@ -46,15 +51,5 @@ namespace CalamityMod.Items.Weapons.Rogue } return true; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 4). - AddIngredient(12). - AddIngredient(ItemID.Vertebrae, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Rogue/TotalityBreakers.cs b/Items/Weapons/Rogue/TotalityBreakers.cs index d531ffe9ce..f606cd97b4 100644 --- a/Items/Weapons/Rogue/TotalityBreakers.cs +++ b/Items/Weapons/Rogue/TotalityBreakers.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 32; Item.height = 42; - Item.damage = 50; + Item.damage = 64; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 28; diff --git a/Items/Weapons/Rogue/ToxicantTwister.cs b/Items/Weapons/Rogue/ToxicantTwister.cs index df12311f53..653b69f403 100644 --- a/Items/Weapons/Rogue/ToxicantTwister.cs +++ b/Items/Weapons/Rogue/ToxicantTwister.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Rogue { public class ToxicantTwister : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 42; diff --git a/Items/Weapons/Rogue/Whitewater.cs b/Items/Weapons/Rogue/Whitewater.cs index b8831ffa01..7bdce47561 100644 --- a/Items/Weapons/Rogue/Whitewater.cs +++ b/Items/Weapons/Rogue/Whitewater.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,14 +12,18 @@ namespace CalamityMod.Items.Weapons.Rogue public class Whitewater : RogueWeapon { public bool splitDirection = false; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 36; Item.height = 40; - Item.damage = 120; + Item.damage = 80; Item.noMelee = true; Item.noUseGraphic = true; - Item.useTime = Item.useAnimation = 42; + Item.useTime = Item.useAnimation = 34; Item.useStyle = ItemUseStyleID.Swing; Item.knockBack = 6.5f; Item.UseSound = SoundID.Item106 with { Volume = 0.7f }; @@ -30,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; } - public override float StealthDamageMultiplier => 0.85f; + public override float StealthDamageMultiplier => 0.9f; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Rogue/Wrathwing.cs b/Items/Weapons/Rogue/Wrathwing.cs index 1e974a818b..dbfb608a2e 100644 --- a/Items/Weapons/Rogue/Wrathwing.cs +++ b/Items/Weapons/Rogue/Wrathwing.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Rogue; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Rogue; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Rogue [LegacyName("ProfanedTrident")] public class Wrathwing : RogueWeapon { + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 152; @@ -24,7 +29,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.autoReuse = true; Item.UseSound = SoundID.Item1; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 28f; Item.DamageType = RogueDamageClass.Instance; diff --git a/Items/Weapons/Rogue/WulfrumKnife.cs b/Items/Weapons/Rogue/WulfrumKnife.cs index 57a97d0e19..3a3f689635 100644 --- a/Items/Weapons/Rogue/WulfrumKnife.cs +++ b/Items/Weapons/Rogue/WulfrumKnife.cs @@ -7,6 +7,7 @@ using Terraria.Audio; using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Utilities; namespace CalamityMod.Items.Weapons.Rogue { @@ -37,7 +38,7 @@ namespace CalamityMod.Items.Weapons.Rogue Item.knockBack = 1f; Item.UseSound = Throw3Sound; Item.autoReuse = true; - Item.value = Item.sellPrice(0, 0, 0, 5); + Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 4f; @@ -50,13 +51,28 @@ namespace CalamityMod.Items.Weapons.Rogue stealthStrikeStarted = false; Item.UseSound = Throw3Sound; - - if (Item.stack == 2) - Item.UseSound = Throw2Sound; - if (Item.stack == 1) - Item.UseSound = Throw1Sound; } + public override void HoldItem(Player player) + { + if (player.controlUseTile && !player.mouseInterface && !player.ItemAnimationActive) + { + if (Main.rand.NextBool(7)) + { + Particle streak = new ManaDrainStreak(player, Main.rand.NextFloat(0.2f, 0.5f), Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(170f, 670f), Main.rand.NextFloat(30f, 44f), Color.GreenYellow, Color.DeepSkyBlue, Main.rand.Next(15, 30)); + GeneralParticleHandler.SpawnParticle(streak); + } + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType() && item.owner == player.whoAmI && item.ai[0] > 0) + { + item.ai[0] = -1; + } + } + } + } + public override bool AltFunctionUse(Player player) => false; + public override float StealthDamageMultiplier => 1.5f; public override bool AdditionalStealthCheck() => stealthStrikeStarted; @@ -71,6 +87,17 @@ namespace CalamityMod.Items.Weapons.Rogue public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + if (player.altFunctionUse == 2) + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType() && item.owner == player.whoAmI && item.ai[0] > 0) + { + item.ai[0] = -1; + } + } + return false; + } if (player.Calamity().StealthStrikeAvailable() || stealthStrikeStarted) { stealthStrikeStarted = true; @@ -91,7 +118,7 @@ namespace CalamityMod.Items.Weapons.Rogue public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/AbandonedSlimeStaff.cs b/Items/Weapons/Summon/AbandonedSlimeStaff.cs index f29d97c52a..45fe58a160 100644 --- a/Items/Weapons/Summon/AbandonedSlimeStaff.cs +++ b/Items/Weapons/Summon/AbandonedSlimeStaff.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,8 +26,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 56; Item.knockBack = 3f; Item.useAnimation = Item.useTime = 20; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; @@ -48,21 +49,16 @@ namespace CalamityMod.Items.Weapons.Summon slimeSlots = (int)(player.maxMinions - minionCount); } - public override bool CanUseItem(Player player) - { - return slimeSlots >= 1; - } + public override bool CanUseItem(Player player) => slimeSlots >= 1; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); float damageMult = ((float)Math.Log(slimeSlots, 8f)) + 1f; - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int slime = Projectile.NewProjectile(source, position, velocity, type, (int)(damage * damageMult), knockback, player.whoAmI); - Main.projectile[slime].originalDamage = (int)(Item.damage * damageMult); - Main.projectile[slime].minionSlots = slimeSlots; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, (int)(damage * damageMult), knockback, player.whoAmI); + minion.originalDamage = (int)(Item.damage * damageMult); + minion.minionSlots = slimeSlots; return false; } } diff --git a/Items/Weapons/Summon/AmphibiansGuitar.cs b/Items/Weapons/Summon/AmphibiansGuitar.cs index 1957f73d79..a385e088b1 100644 --- a/Items/Weapons/Summon/AmphibiansGuitar.cs +++ b/Items/Weapons/Summon/AmphibiansGuitar.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 200; + Item.damage = 54; Item.DamageType = DamageClass.Summon; Item.shoot = ModContent.ProjectileType(); diff --git a/Items/Weapons/Summon/AncientIceChunk.cs b/Items/Weapons/Summon/AncientIceChunk.cs index 00bfcf39ee..3e00d8eb98 100644 --- a/Items/Weapons/Summon/AncientIceChunk.cs +++ b/Items/Weapons/Summon/AncientIceChunk.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -35,6 +36,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 25; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -50,7 +52,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(1f, 1f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/AresExoskeleton.cs b/Items/Weapons/Summon/AresExoskeleton.cs index 5b822be2c0..3af96062b3 100644 --- a/Items/Weapons/Summon/AresExoskeleton.cs +++ b/Items/Weapons/Summon/AresExoskeleton.cs @@ -78,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item117; Item.shoot = ModContent.ProjectileType(); @@ -86,6 +86,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; } + public override bool? CanAutoReuseItem(Player player) => false; + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frameI, Color drawColor, Color itemColor, Vector2 origin, float scale) { Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/Summon/AresExoskeleton").Value; diff --git a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs index 0706ca78d9..f2a0c22d88 100644 --- a/Items/Weapons/Summon/AtlasMunitionsBeacon.cs +++ b/Items/Weapons/Summon/AtlasMunitionsBeacon.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 10f; Item.noUseGraphic = true; Item.DamageType = DamageClass.Summon; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.sentry = true; } diff --git a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs index 44890bd7ff..542ee216fd 100644 --- a/Items/Weapons/Summon/BelladonnaSpiritStaff.cs +++ b/Items/Weapons/Summon/BelladonnaSpiritStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -32,22 +33,23 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 35; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.Item44; - Item.rare = ItemRarityID.Blue; - Item.value = CalamityGlobalItem.RarityBlueBuyPrice; + Item.rare = ItemRarityID.Orange; + Item.value = CalamityGlobalItem.RarityOrangeBuyPrice; Item.noMelee = true; Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int belladonna = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(belladonna)) - Main.projectile[belladonna].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/BlackHawkRemote.cs b/Items/Weapons/Summon/BlackHawkRemote.cs index 330d2f3e95..aff29efd63 100644 --- a/Items/Weapons/Summon/BlackHawkRemote.cs +++ b/Items/Weapons/Summon/BlackHawkRemote.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 6f; // Affects bullet speed Item.DamageType = DamageClass.Summon; @@ -31,15 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - if (player.whoAmI == Main.myPlayer) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/BorealisBomber.cs b/Items/Weapons/Summon/BorealisBomber.cs index d3fdc3a340..4de6655254 100644 --- a/Items/Weapons/Summon/BorealisBomber.cs +++ b/Items/Weapons/Summon/BorealisBomber.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,15 +14,16 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetStaticDefaults() { Item.staff[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { Item.width = 48; Item.height = 56; - Item.damage = 35; + Item.damage = 34; Item.mana = 10; - Item.useAnimation = Item.useTime = 19; + Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; Item.knockBack = 5f; diff --git a/Items/Weapons/Summon/BrittleStarStaff.cs b/Items/Weapons/Summon/BrittleStarStaff.cs index a69c43a5a0..b6c15f5dd2 100644 --- a/Items/Weapons/Summon/BrittleStarStaff.cs +++ b/Items/Weapons/Summon/BrittleStarStaff.cs @@ -1,4 +1,7 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; using Terraria; @@ -28,7 +31,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item44 with { Pitch = 0.5f }; Item.autoReuse = true; - Item.shootSpeed = 5; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -36,18 +39,16 @@ namespace CalamityMod.Items.Weapons.Summon { Item.staff[Type] = true; ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { if (player.altFunctionUse != 2) { Item.noUseGraphic = false; - position = player.ClampedMouseWorld(); - velocity = Vector2.Zero; int SummonNumber = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, SummonNumber); + minion.originalDamage = Item.damage; } if (player.altFunctionUse == 2) { diff --git a/Items/Weapons/Summon/CadaverousCarrion.cs b/Items/Weapons/Summon/CadaverousCarrion.cs index e2ff231070..db5db6b8fb 100644 --- a/Items/Weapons/Summon/CadaverousCarrion.cs +++ b/Items/Weapons/Summon/CadaverousCarrion.cs @@ -11,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CadaverousCarrion : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 54; diff --git a/Items/Weapons/Summon/CalamarisLament.cs b/Items/Weapons/Summon/CalamarisLament.cs index 8123714305..8aefe8f92c 100644 --- a/Items/Weapons/Summon/CalamarisLament.cs +++ b/Items/Weapons/Summon/CalamarisLament.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Buffs.Summon; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -45,6 +46,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 1f; // This does nothing, it's just here so it's able to act like a staff. @@ -59,7 +61,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CausticStaff.cs b/Items/Weapons/Summon/CausticStaff.cs index 88a22bfafb..87a955b692 100644 --- a/Items/Weapons/Summon/CausticStaff.cs +++ b/Items/Weapons/Summon/CausticStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 15; Item.useStyle = ItemUseStyleID.Swing; - Item.shootSpeed = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.UseSound = SoundID.Item77; Item.useAnimation = Item.useTime = 25; @@ -34,12 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CinderBlossomStaff.cs b/Items/Weapons/Summon/CinderBlossomStaff.cs index f048621794..335309e1eb 100644 --- a/Items/Weapons/Summon/CinderBlossomStaff.cs +++ b/Items/Weapons/Summon/CinderBlossomStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 16; Item.knockBack = 2f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 30; @@ -32,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CindersOfLament.cs b/Items/Weapons/Summon/CindersOfLament.cs index 6d7d05659f..ebaba97f0c 100644 --- a/Items/Weapons/Summon/CindersOfLament.cs +++ b/Items/Weapons/Summon/CindersOfLament.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) diff --git a/Items/Weapons/Summon/CorroslimeStaff.cs b/Items/Weapons/Summon/CorroslimeStaff.cs index bdaf95d306..edd2f9d35f 100644 --- a/Items/Weapons/Summon/CorroslimeStaff.cs +++ b/Items/Weapons/Summon/CorroslimeStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CorroslimeStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 52; @@ -24,22 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/CorvidHarbringerStaff.cs b/Items/Weapons/Summon/CorvidHarbringerStaff.cs index 781e063250..0926ff4cc5 100644 --- a/Items/Weapons/Summon/CorvidHarbringerStaff.cs +++ b/Items/Weapons/Summon/CorvidHarbringerStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -17,30 +18,28 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 54; Item.height = 52; + Item.damage = 99; + Item.DamageType = DamageClass.Summon; + Item.useAnimation = Item.useTime = 10; + Item.mana = 10; + Item.knockBack = 2f; + Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.DD2_BetsyFlyingCircleAttack; - Item.DamageType = DamageClass.Summon; - Item.mana = 10; - Item.damage = 114; - Item.knockBack = 2f; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CosmicImmaterializer.cs b/Items/Weapons/Summon/CosmicImmaterializer.cs index d555808fda..2a311d9066 100644 --- a/Items/Weapons/Summon/CosmicImmaterializer.cs +++ b/Items/Weapons/Summon/CosmicImmaterializer.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Summon; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -27,25 +28,25 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.useAnimation = Item.useTime = 10; Item.knockBack = 0.25f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.UseSound = SoundID.Item60; Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 10; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/CosmicViperEngine.cs b/Items/Weapons/Summon/CosmicViperEngine.cs index ce0fd4f2de..21fc2f864d 100644 --- a/Items/Weapons/Summon/CosmicViperEngine.cs +++ b/Items/Weapons/Summon/CosmicViperEngine.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; @@ -19,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 46; Item.height = 28; - Item.damage = 321; + Item.damage = 255; Item.mana = 10; Item.useAnimation = Item.useTime = 9; Item.useStyle = ItemUseStyleID.HoldUp; @@ -27,47 +28,29 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 6f; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; // Affects bullet speed Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - float speed = Item.shootSpeed; - Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); - float xPos = (float)Main.mouseX + Main.screenPosition.X - spawnPos.X; - float yPos = (float)Main.mouseY + Main.screenPosition.Y - spawnPos.Y; - if (player.gravDir == -1f) - { - yPos = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - spawnPos.Y; - } - Vector2 vel = new Vector2(xPos, yPos); - float dist = vel.Length(); - if ((float.IsNaN(vel.X) && float.IsNaN(vel.Y)) || (vel.X == 0f && vel.Y == 0f)) - { - vel.X = (float)player.direction; - vel.Y = 0f; - dist = speed; - } - else - { - dist = speed / dist; - } - vel.X *= dist; - vel.Y *= dist; - spawnPos.X = (float)Main.mouseX + Main.screenPosition.X; - spawnPos.Y = (float)Main.mouseY + Main.screenPosition.Y; - vel = vel.RotatedBy(MathHelper.PiOver2, default); - int p = Projectile.NewProjectile(source, spawnPos + vel, vel, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + + float speed = Item.shootSpeed; + Vector2 spawnPos = player.RotatedRelativePoint(player.MountedCenter, true); + float xPos = Main.screenPosition.X + Main.mouseX - spawnPos.X; + float yPos = Main.screenPosition.Y + (player.gravDir == -1 ? Main.screenHeight - Main.mouseY : Main.mouseY) - spawnPos.Y; + Vector2 vel = new Vector2(xPos, yPos).SafeNormalize(Vector2.UnitX * player.direction) * speed; + + spawnPos = player.ClampedMouseWorld(); + vel = vel.RotatedBy(MathHelper.PiOver2); + var minion = Projectile.NewProjectileDirect(source, spawnPos + vel, vel, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/Cosmilamp.cs b/Items/Weapons/Summon/Cosmilamp.cs index e1a878b754..3a6cd6413e 100644 --- a/Items/Weapons/Summon/Cosmilamp.cs +++ b/Items/Weapons/Summon/Cosmilamp.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -19,7 +21,11 @@ namespace CalamityMod.Items.Weapons.Summon public const float LanternSummonCost = 2f; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { @@ -35,8 +41,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -44,26 +50,22 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - // Reset the timer for all lamps, to re-align the formation. - foreach (Projectile pro in Main.ActiveProjectiles) - { - if (pro.type == type && pro.owner == player.whoAmI) - { - pro.ModProjectile().Timer = 0f; - pro.netUpdate = true; - } - } + player.AddBuff(Item.buffType, 2); - int existingLamps = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) + // Reset the timer for all lamps, to re-align the formation. + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ai[0] = existingLamps; + pro.ModProjectile().Timer = 0f; + pro.netUpdate = true; } } + + int existingLamps = player.ownedProjectileCounts[type]; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + minion.ai[0] = existingLamps; return false; } } diff --git a/Items/Weapons/Summon/CrimslimeStaff.cs b/Items/Weapons/Summon/CrimslimeStaff.cs index 24fa2614c3..467eaf14e4 100644 --- a/Items/Weapons/Summon/CrimslimeStaff.cs +++ b/Items/Weapons/Summon/CrimslimeStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class CrimslimeStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 52; @@ -24,22 +30,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/CryogenicStaff.cs b/Items/Weapons/Summon/CryogenicStaff.cs index 8408855e68..56285668c0 100644 --- a/Items/Weapons/Summon/CryogenicStaff.cs +++ b/Items/Weapons/Summon/CryogenicStaff.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 82; Item.height = 84; - Item.damage = 50; + Item.damage = 30; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; diff --git a/Items/Weapons/Summon/DaedalusGolemStaff.cs b/Items/Weapons/Summon/DaedalusGolemStaff.cs index ec0b92d270..9f0761011b 100644 --- a/Items/Weapons/Summon/DaedalusGolemStaff.cs +++ b/Items/Weapons/Summon/DaedalusGolemStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,10 +12,6 @@ namespace CalamityMod.Items.Weapons.Summon public class DaedalusGolemStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() - { - // Funny Hollow Knight reference. - } public override void SetDefaults() { @@ -27,8 +24,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 3f; Item.UseSound = SoundID.Item67; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityPinkBuyPrice; @@ -36,13 +33,13 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); Vector2 mouse = player.ClampedMouseWorld(); Point mouseTileCoords = mouse.ToTileCoordinates(); if (!CalamityUtils.ParanoidTileRetrieval(mouseTileCoords.X, mouseTileCoords.Y).IsTileSolidGround()) { - int p = Projectile.NewProjectile(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, mouse, Vector2.UnitY * 4f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/DankStaff.cs b/Items/Weapons/Summon/DankStaff.cs index 9f99226039..f996dae50c 100644 --- a/Items/Weapons/Summon/DankStaff.cs +++ b/Items/Weapons/Summon/DankStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class DankStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 58; @@ -25,33 +30,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.DemoniteBar, 4). - AddIngredient(12). - AddIngredient(ItemID.RottenChunk, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 477f451751..b36a388f5b 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -13,6 +15,10 @@ namespace CalamityMod.Items.Weapons.Summon public class DazzlingStabberStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 56; @@ -22,12 +28,12 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.DD2_DarkMageHealImpact; Item.DamageType = DamageClass.Summon; Item.mana = 10; - Item.damage = 127; + Item.damage = 43; Item.knockBack = 2f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 15; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 13f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); @@ -38,14 +44,12 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + player.AddBuff(Item.buffType, 2); + + for (int i = 0; i < 3; i++) { - for (int i = 0; i < 3; i++) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + minion.originalDamage = Item.damage; } float angleMax = MathHelper.ToRadians(360f); if (CalamityUtils.CountOwnedProjectiles(type, player.whoAmI) == 1) diff --git a/Items/Weapons/Summon/DeathstareRod.cs b/Items/Weapons/Summon/DeathstareRod.cs index 8bd0029774..0eaba9f552 100644 --- a/Items/Weapons/Summon/DeathstareRod.cs +++ b/Items/Weapons/Summon/DeathstareRod.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -22,17 +23,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityGreenBuyPrice; Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.NPCHit8; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DeepseaStaff.cs b/Items/Weapons/Summon/DeepseaStaff.cs index b68a90c690..f65d3f9ae6 100644 --- a/Items/Weapons/Summon/DeepseaStaff.cs +++ b/Items/Weapons/Summon/DeepseaStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class DeepseaStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 44; @@ -23,20 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity = Vector2.Zero; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/DormantBrimseeker.cs b/Items/Weapons/Summon/DormantBrimseeker.cs index 1dbc591245..52a09aff36 100644 --- a/Items/Weapons/Summon/DormantBrimseeker.cs +++ b/Items/Weapons/Summon/DormantBrimseeker.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +11,10 @@ namespace CalamityMod.Items.Weapons.Summon public class DormantBrimseeker : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 32; diff --git a/Items/Weapons/Summon/DragonbloodDisgorger.cs b/Items/Weapons/Summon/DragonbloodDisgorger.cs index c27c8fb840..b2429d03fa 100644 --- a/Items/Weapons/Summon/DragonbloodDisgorger.cs +++ b/Items/Weapons/Summon/DragonbloodDisgorger.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -28,16 +29,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_SkeletonDeath; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/DreadmineStaff.cs b/Items/Weapons/Summon/DreadmineStaff.cs index e26467a1f2..672105c7df 100644 --- a/Items/Weapons/Summon/DreadmineStaff.cs +++ b/Items/Weapons/Summon/DreadmineStaff.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 44; Item.height = 44; - Item.damage = 60; + Item.damage = 40; Item.mana = 10; Item.useAnimation = Item.useTime = 25; Item.useStyle = ItemUseStyleID.Swing; diff --git a/Items/Weapons/Summon/EnchantedConch.cs b/Items/Weapons/Summon/EnchantedConch.cs index 768ffed01d..c5d5a015f9 100644 --- a/Items/Weapons/Summon/EnchantedConch.cs +++ b/Items/Weapons/Summon/EnchantedConch.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -18,6 +19,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 26; Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -33,7 +35,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/EndoHydraStaff.cs b/Items/Weapons/Summon/EndoHydraStaff.cs index 3b64d117d0..2d28fe5010 100644 --- a/Items/Weapons/Summon/EndoHydraStaff.cs +++ b/Items/Weapons/Summon/EndoHydraStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -17,59 +18,57 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 58; Item.height = 60; + Item.damage = 190; + Item.DamageType = DamageClass.Summon; + Item.useAnimation = Item.useTime = 10; + Item.mana = 10; + Item.knockBack = 3f; + Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.UseSound = SoundID.Item60; - Item.DamageType = DamageClass.Summon; - Item.mana = 10; - Item.damage = 232; - Item.knockBack = 3f; Item.autoReuse = true; - Item.useAnimation = Item.useTime = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + player.AddBuff(Item.buffType, 2); + + bool bodyExists = false; + int bodyIndex = -1; + foreach (Projectile p in Main.ActiveProjectiles) { - bool bodyExists = false; - int bodyIndex = -1; - foreach (Projectile p in Main.ActiveProjectiles) + if (p.type == type && p.owner == player.whoAmI) { - if (p.type == type && p.owner == player.whoAmI) - { - bodyIndex = p.whoAmI; - bodyExists = true; - break; - } + bodyIndex = p.whoAmI; + bodyExists = true; + break; } - if (bodyExists) + } + if (bodyExists) + { + var head = Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + head.originalDamage = Item.damage; + } + else + { + bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + if (Main.projectile.IndexInRange(bodyIndex)) + Main.projectile[bodyIndex].originalDamage = Item.damage; + var head = Projectile.NewProjectileDirect(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); + head.originalDamage = Item.damage; + for (int i = 0; i < 72; i++) { - int p = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } - else - { - bodyIndex = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - int head = Projectile.NewProjectile(source, player.Center, Main.rand.NextVector2Unit(), ModContent.ProjectileType(), damage, knockback, player.whoAmI, bodyIndex); - if (Main.projectile.IndexInRange(bodyIndex)) - Main.projectile[bodyIndex].originalDamage = Item.damage; - if (Main.projectile.IndexInRange(head)) - Main.projectile[head].originalDamage = Item.damage; - for (int i = 0; i < 72; i++) - { - Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); - dust.velocity = (MathHelper.TwoPi * Vector2.Dot((i / 72f * MathHelper.TwoPi).ToRotationVector2(), player.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(i / 72f * -MathHelper.TwoPi))).ToRotationVector2(); - dust.velocity = dust.velocity.RotatedBy(i / 36f * MathHelper.TwoPi) * 8f; - dust.noGravity = true; - dust.scale = 1.9f; - } + Dust dust = Dust.NewDustPerfect(Main.projectile[bodyIndex].Center, 113); + dust.velocity = (MathHelper.TwoPi * Vector2.Dot((i / 72f * MathHelper.TwoPi).ToRotationVector2(), player.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(i / 72f * -MathHelper.TwoPi))).ToRotationVector2(); + dust.velocity = dust.velocity.RotatedBy(i / 36f * MathHelper.TwoPi) * 8f; + dust.noGravity = true; + dust.scale = 1.9f; } } return false; diff --git a/Items/Weapons/Summon/Endogenesis.cs b/Items/Weapons/Summon/Endogenesis.cs index 97942a9175..a9a41e73d4 100644 --- a/Items/Weapons/Summon/Endogenesis.cs +++ b/Items/Weapons/Summon/Endogenesis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -33,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityHotPinkBuyPrice; Item.rare = ModContent.RarityType(); @@ -45,21 +46,19 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + CalamityUtils.KillShootProjectileMany(player, new int[] { - CalamityUtils.KillShootProjectileMany(player, new int[] - { - type, - ModContent.ProjectileType(), - ModContent.ProjectileType() - }); + type, + ModContent.ProjectileType(), + ModContent.ProjectileType() + }); - SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); + player.AddBuff(Item.buffType, 2); + SummonEndoCooper(source, AttackMode, player.ClampedMouseWorld(), damage, Item.damage, knockback, player, out _, out _); - AttackMode++; - if (AttackMode > 3) - AttackMode = 0; - } + AttackMode++; + if (AttackMode > 3) + AttackMode = 0; return false; } diff --git a/Items/Weapons/Summon/EntropysVigil.cs b/Items/Weapons/Summon/EntropysVigil.cs index 676648fcab..6b74919eb6 100644 --- a/Items/Weapons/Summon/EntropysVigil.cs +++ b/Items/Weapons/Summon/EntropysVigil.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -16,14 +18,16 @@ namespace CalamityMod.Items.Weapons.Summon { Item.staff[Type] = true; ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); } public override void SetDefaults() { Item.width = 52; Item.height = 52; - Item.damage = 47; + Item.damage = 42; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 2f; @@ -42,6 +46,8 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); + Vector2 mouse = player.ClampedMouseWorld(); float randomAngleOffset = Main.rand.NextFloat(MathHelper.TwoPi); for (int i = 0; i < 3; i++) @@ -52,15 +58,18 @@ namespace CalamityMod.Items.Weapons.Summon switch (i) { case 0: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; case 1: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; case 2: - Projectile.NewProjectile(source, mouse, spawnVelocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + type = ModContent.ProjectileType(); break; } + + var minion = Projectile.NewProjectileDirect(source, mouse, spawnVelocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; diff --git a/Items/Weapons/Summon/EtherealSubjugator.cs b/Items/Weapons/Summon/EtherealSubjugator.cs index e1103cbc49..66dbca0b57 100644 --- a/Items/Weapons/Summon/EtherealSubjugator.cs +++ b/Items/Weapons/Summon/EtherealSubjugator.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -12,13 +14,17 @@ namespace CalamityMod.Items.Weapons.Summon public class EtherealSubjugator : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 66; Item.height = 70; Item.damage = 200; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -38,7 +44,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/EyeOfNight.cs b/Items/Weapons/Summon/EyeOfNight.cs index 4dae0ecdb7..829421eadb 100644 --- a/Items/Weapons/Summon/EyeOfNight.cs +++ b/Items/Weapons/Summon/EyeOfNight.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,19 +26,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.NPCHit1; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.UnitY * -3f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/FlamsteedRing.cs b/Items/Weapons/Summon/FlamsteedRing.cs index 9f7230b417..c9078ba8ce 100644 --- a/Items/Weapons/Summon/FlamsteedRing.cs +++ b/Items/Weapons/Summon/FlamsteedRing.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.Calamity().CannotBeEnchanted = true; } + public override bool? CanAutoReuseItem(Player player) => false; + public static bool SpaceForLargeMech(Player player, bool visuals = true) { bool sufficientSpace = true; diff --git a/Items/Weapons/Summon/FlarebatStaff.cs b/Items/Weapons/Summon/FlarebatStaff.cs index f94955710b..91f6eb0365 100644 --- a/Items/Weapons/Summon/FlarebatStaff.cs +++ b/Items/Weapons/Summon/FlarebatStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -13,8 +14,9 @@ namespace CalamityMod.Items.Weapons.Summon public override void SetDefaults() { - Item.damage = 18; + Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -31,7 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/FleshOfInfidelity.cs b/Items/Weapons/Summon/FleshOfInfidelity.cs index a7f73e84fa..638e048448 100644 --- a/Items/Weapons/Summon/FleshOfInfidelity.cs +++ b/Items/Weapons/Summon/FleshOfInfidelity.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,13 +12,17 @@ namespace CalamityMod.Items.Weapons.Summon public class FleshOfInfidelity : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 42; Item.height = 42; Item.damage = 20; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -33,18 +38,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.UnitY * -1f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.CrimtaneBar, 4). - AddIngredient(12). - AddIngredient(ItemID.Vertebrae, 4). - AddTile(TileID.DemonAltar). - Register(); - } } } diff --git a/Items/Weapons/Summon/FlowersOfMortality.cs b/Items/Weapons/Summon/FlowersOfMortality.cs index ee43914ad1..247ab82b77 100644 --- a/Items/Weapons/Summon/FlowersOfMortality.cs +++ b/Items/Weapons/Summon/FlowersOfMortality.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -28,6 +29,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPurpleBuyPrice; Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; } @@ -36,6 +38,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 5; i++) { diff --git a/Items/Weapons/Summon/ForgottenApexWand.cs b/Items/Weapons/Summon/ForgottenApexWand.cs index 4fb966f134..ba73a0b486 100644 --- a/Items/Weapons/Summon/ForgottenApexWand.cs +++ b/Items/Weapons/Summon/ForgottenApexWand.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,21 +27,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 28; Item.useAnimation = Item.useTime = 25; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 12f; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - Vector2 vector2 = player.RotatedRelativePoint(player.MountedCenter, true); - vector2.X = Main.mouseX + Main.screenPosition.X; - vector2.Y = Main.mouseY + Main.screenPosition.Y; - int p = Projectile.NewProjectile(source, vector2, Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/FrostBlossomStaff.cs b/Items/Weapons/Summon/FrostBlossomStaff.cs index 852b6cd188..026da729b3 100644 --- a/Items/Weapons/Summon/FrostBlossomStaff.cs +++ b/Items/Weapons/Summon/FrostBlossomStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,17 +24,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item28; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } public override void AddRecipes() diff --git a/Items/Weapons/Summon/FrostbatStaff.cs b/Items/Weapons/Summon/FrostbatStaff.cs index ade55ae2aa..a8148b1e5b 100644 --- a/Items/Weapons/Summon/FrostbatStaff.cs +++ b/Items/Weapons/Summon/FrostbatStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -15,6 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.damage = 22; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -31,7 +33,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/FuelCellBundle.cs b/Items/Weapons/Summon/FuelCellBundle.cs index 6e0f725d93..7fdcddc557 100644 --- a/Items/Weapons/Summon/FuelCellBundle.cs +++ b/Items/Weapons/Summon/FuelCellBundle.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -9,6 +10,10 @@ namespace CalamityMod.Items.Weapons.Summon public class FuelCellBundle : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 32; diff --git a/Items/Weapons/Summon/GammaHeart.cs b/Items/Weapons/Summon/GammaHeart.cs index 6ab12f05c7..b563bb8704 100644 --- a/Items/Weapons/Summon/GammaHeart.cs +++ b/Items/Weapons/Summon/GammaHeart.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -24,20 +25,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 3f; Item.autoReuse = true; Item.useAnimation = Item.useTime = 14; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/GastricBelcherStaff.cs b/Items/Weapons/Summon/GastricBelcherStaff.cs index 4d2796f9cd..7e7233f8cf 100644 --- a/Items/Weapons/Summon/GastricBelcherStaff.cs +++ b/Items/Weapons/Summon/GastricBelcherStaff.cs @@ -1,4 +1,6 @@ using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,11 +13,15 @@ namespace CalamityMod.Items.Weapons.Summon public class GastricBelcherStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 66; Item.height = 70; - Item.damage = 60; + Item.damage = 50; Item.mana = 10; Item.useAnimation = Item.useTime = 20; Item.useStyle = ItemUseStyleID.Swing; @@ -24,44 +30,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLimeBuyPrice; Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item76; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.autoReuse = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - Vector2 playerPos = player.RotatedRelativePoint(player.MountedCenter, true); - float directionX = Main.mouseX + Main.screenPosition.X - playerPos.X; - float directionY = Main.mouseY + Main.screenPosition.Y - playerPos.Y; - if (player.gravDir == -1f) - { - directionY = Main.screenPosition.Y + Main.screenHeight - Main.mouseY - playerPos.Y; - } - Vector2 spinningpoint = new Vector2(directionX, directionY); - float dist = spinningpoint.Length(); - if ((float.IsNaN(spinningpoint.X) && float.IsNaN(spinningpoint.Y)) || (spinningpoint.X == 0f && spinningpoint.Y == 0f)) - { - spinningpoint.X = player.direction; - spinningpoint.Y = 0f; - dist = Item.shootSpeed; - } - else - { - dist = Item.shootSpeed / dist; - } - spinningpoint.X *= dist; - spinningpoint.Y *= dist; - playerPos.X = Main.mouseX + Main.screenPosition.X; - playerPos.Y = Main.mouseY + Main.screenPosition.Y; - spinningpoint = spinningpoint.RotatedBy(Math.PI / 2D, default); - int p = Projectile.NewProjectile(source, playerPos + spinningpoint, spinningpoint, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(5f, 5f), type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/GlacialEmbrace.cs b/Items/Weapons/Summon/GlacialEmbrace.cs index 00fc0f2f75..7f2827b342 100644 --- a/Items/Weapons/Summon/GlacialEmbrace.cs +++ b/Items/Weapons/Summon/GlacialEmbrace.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4.5f; Item.UseSound = SoundID.Item30; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; @@ -44,11 +45,10 @@ namespace CalamityMod.Items.Weapons.Summon } if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) { - player.AddBuff(ModContent.BuffType(), 120, true); + player.AddBuff(Item.buffType, 2); position = player.ClampedMouseWorld(); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; int pointyThingCount = 0; foreach (Projectile pro in Main.ActiveProjectiles) { diff --git a/Items/Weapons/Summon/HauntedScroll.cs b/Items/Weapons/Summon/HauntedScroll.cs index 5ac5707364..001eafa166 100644 --- a/Items/Weapons/Summon/HauntedScroll.cs +++ b/Items/Weapons/Summon/HauntedScroll.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -30,23 +31,17 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.LightRed; Item.UseSound = SoundID.Item60; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 30f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 30f); + minion.originalDamage = Item.damage; + //projectile.ai[1] is attack cooldown. Setting it here prevents immediate attacks return false; } diff --git a/Items/Weapons/Summon/HerringStaff.cs b/Items/Weapons/Summon/HerringStaff.cs index 33f8bd5fbe..045c7353c3 100644 --- a/Items/Weapons/Summon/HerringStaff.cs +++ b/Items/Weapons/Summon/HerringStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,6 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1.25f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 30; Item.DamageType = DamageClass.Summon; @@ -30,12 +32,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/HivePod.cs b/Items/Weapons/Summon/HivePod.cs index 8fdf65c7a8..5013bfe4c7 100644 --- a/Items/Weapons/Summon/HivePod.cs +++ b/Items/Weapons/Summon/HivePod.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 46; Item.height = 50; - Item.damage = 125; + Item.damage = 75; Item.mana = 10; Item.DamageType = DamageClass.Summon; Item.sentry = true; diff --git a/Items/Weapons/Summon/IgneousExaltation.cs b/Items/Weapons/Summon/IgneousExaltation.cs index 1fb197c03a..447a6bf36e 100644 --- a/Items/Weapons/Summon/IgneousExaltation.cs +++ b/Items/Weapons/Summon/IgneousExaltation.cs @@ -1,8 +1,12 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,7 +14,28 @@ namespace CalamityMod.Items.Weapons.Summon { public class IgneousExaltation : ModItem, ILocalizedModType { + public static int ChargeDuration = 30; + public static int ChargeCooldown = 120; public new string LocalizationCategory => "Items.Weapons.Summon"; + private static Texture2D BladeOutline = null; + public static Texture2D GetBladeOutlineTex() + { + if (BladeOutline == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Summon/IgneousBlade").Value; + BladeOutline = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[BladeOutline.Width * BladeOutline.Height]; + var ColorArray = new Color[BladeOutline.Width * BladeOutline.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + BladeOutline.SetData(ColorArray); + } + return BladeOutline; + } public override void SetStaticDefaults() { Item.staff[Type] = true; @@ -30,67 +55,92 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item71; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } + + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } + + public override bool ConsumeItem(Player player) => false; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float totalMinionSlots = 0f; - foreach (Projectile pro in Main.ActiveProjectiles) + float totalSlots = 0f; + foreach (Projectile p in Main.ActiveProjectiles) { - if (pro.minion && pro.owner == player.whoAmI) + if (p.minion && p.owner == player.whoAmI) { - totalMinionSlots += pro.minionSlots; + totalSlots += p.minionSlots; } } - if (player.altFunctionUse != 2 && totalMinionSlots < player.maxMinions) + if (totalSlots >= player.maxMinions) { - position = player.ClampedMouseWorld(); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - int swordCount = 0; + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI && pro.ai[1] >= 0 && pro.ai[0] == 0) + { + pro.ModProjectile().CurrentState = IgneousBlade.AIState.TransitionToLaunch; + pro.netUpdate = true; + } + } + } + else + { + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; + + int bladeIndex = 0; foreach (Projectile pro in Main.ActiveProjectiles) { if (pro.type == type && pro.owner == player.whoAmI) { - if ((pro.ModProjectile as IgneousBlade).Firing) - continue; - swordCount++; - for (int j = 0; j < 22; j++) - { - Dust dust = Dust.NewDustDirect(pro.position, pro.width, pro.height, DustID.Torch); - dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); - dust.noGravity = true; - } - } - } - float angleVariance = MathHelper.TwoPi / swordCount; - float angle = 0f; - foreach (Projectile pro in Main.ActiveProjectiles) - { - if (pro.type == type && pro.owner == player.whoAmI && pro.localAI[1] == 0f) - { - if ((pro.ModProjectile as IgneousBlade).Firing) - continue; - pro.ai[0] = angle; - angle += angleVariance; - for (int j = 0; j < 22; j++) - { - Dust dust = Dust.NewDustDirect(pro.position, pro.width, pro.height, DustID.Torch); - dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); - dust.noGravity = true; - } + pro.ModProjectile().BladeIndex = bladeIndex++; + pro.ModProjectile().AITimer = -ChargeCooldown; + pro.ModProjectile().DistanceTimer = -IgneousExaltation.ChargeCooldown; + pro.ModProjectile().CurrentState = IgneousBlade.AIState.CircleOwner; + pro.netUpdate = true; } } } return false; } + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + var tex = TextureAssets.Item[Type].Value; + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.75f, + spriteEffects: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None, + rotation: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? MathHelper.PiOver2 : 0 + ); + return false; + } public override void AddRecipes() { CreateRecipe(). + AddIngredient(). AddIngredient(10). AddIngredient(5). AddTile(TileID.MythrilAnvil). diff --git a/Items/Weapons/Summon/InfectedRemote.cs b/Items/Weapons/Summon/InfectedRemote.cs index afde753a8f..7410951304 100644 --- a/Items/Weapons/Summon/InfectedRemote.cs +++ b/Items/Weapons/Summon/InfectedRemote.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -32,7 +34,11 @@ namespace CalamityMod.Items.Weapons.Summon public const float EnemyTargetingRange = 1300f; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { @@ -45,8 +51,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 5f; Item.UseSound = SoundID.Item15; //phaseblade sound effect + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityYellowBuyPrice; @@ -58,11 +64,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/KingofConstellationsTenryu.cs b/Items/Weapons/Summon/KingofConstellationsTenryu.cs index f8c677a7a7..e25f41c11f 100644 --- a/Items/Weapons/Summon/KingofConstellationsTenryu.cs +++ b/Items/Weapons/Summon/KingofConstellationsTenryu.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 10; Item.damage = 187; Item.useStyle = ItemUseStyleID.HoldUp; - Item.shootSpeed = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.UseSound = Flare.FlareSound; Item.useAnimation = Item.useTime = 25; @@ -38,10 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.autoReuse = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-20, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-20, 0); public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0 && player.maxMinions >= 4; @@ -49,20 +47,23 @@ namespace CalamityMod.Items.Weapons.Summon { Vector2 spawnPos = new Vector2(player.position.X - 200, player.position.Y - 200); Vector2 spawnPos2 = new Vector2(player.position.X + 200, player.position.Y - 200); - SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos2, player, source, damage, knockback); - SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos, player, source, damage, knockback); + player.AddBuff(Item.buffType, 2); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos2, player, source, damage, Item.damage, knockback); + SpawnDragon(ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), spawnPos, player, source, damage, Item.damage, knockback); return false; } - public static void SpawnDragon(int head, int body, int tail, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, float knockback) + public static void SpawnDragon(int headType, int bodyType, int tailType, Vector2 spawnPos, Player player, EntitySource_ItemUse_WithAmmo source, int damage, int originalDamage, float knockback) { // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile.NewProjectile(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, head, damage, knockback, player.whoAmI); - // okay but seriously why are you multiplying zero by three - Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, tail, damage, knockback, player.whoAmI); + var head = Projectile.NewProjectileDirect(source, spawnPos, player.DirectionTo(Main.MouseWorld) * 3, headType, damage, knockback, player.whoAmI); + head.originalDamage = originalDamage; + var tail = Projectile.NewProjectileDirect(source, spawnPos, Vector2.Zero, tailType, damage, knockback, player.whoAmI); + tail.originalDamage = originalDamage; for (var i = 0; i < 20; i++) { - Projectile.NewProjectile(source, spawnPos, Vector2.Zero * 3, body, damage, knockback, player.whoAmI); + var body = Projectile.NewProjectileDirect(source, spawnPos, Vector2.Zero, bodyType, damage, knockback, player.whoAmI); + body.originalDamage = originalDamage; } } diff --git a/Items/Weapons/Summon/LegionofCelestia.cs b/Items/Weapons/Summon/LegionofCelestia.cs index 4e49f639e6..4978eebfd0 100644 --- a/Items/Weapons/Summon/LegionofCelestia.cs +++ b/Items/Weapons/Summon/LegionofCelestia.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -28,8 +29,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Purple; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; } public override void UseStyle(Player player, Rectangle heldItemFrame) @@ -39,15 +40,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/LiliesOfFinality.cs b/Items/Weapons/Summon/LiliesOfFinality.cs index 6f30839132..8c78d3b917 100644 --- a/Items/Weapons/Summon/LiliesOfFinality.cs +++ b/Items/Weapons/Summon/LiliesOfFinality.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -32,17 +33,15 @@ namespace CalamityMod.Items.Weapons.Summon public static int Ariane_AoESize = 1050; public static float Ariane_AoEDMGMultiplier = 0.4f; - // Do not change this number, ever. - Fabsol - public const int TheNumber = 512; - #endregion public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 2f; public override void SetDefaults() { - Item.damage = TheNumber; + Item.damage = 512; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ProjectileType(); Item.knockBack = 5f; @@ -52,7 +51,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.noMelee = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = RarityType(); + Item.rare = RarityType(); Item.useStyle = ItemUseStyleID.HoldUp; Item.UseSound = new("CalamityMod/Sounds/Item/LiliesOfFinalitySummonSpawn"); } @@ -61,9 +60,12 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); Vector2 mouse = player.ClampedMouseWorld(); - Projectile.NewProjectile(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); - Projectile.NewProjectile(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + var elster = Projectile.NewProjectileDirect(source, mouse, new Vector2(-1f, -1f) * 3f, type, damage, knockback, player.whoAmI); + elster.originalDamage = Item.damage; + var ariane = Projectile.NewProjectileDirect(source, mouse, new Vector2(1f, -1f) * 3f, ProjectileType(), damage, knockback, player.whoAmI); + ariane.originalDamage = Item.damage; if (Main.dedServ) return false; diff --git a/Items/Weapons/Summon/Metastasis.cs b/Items/Weapons/Summon/Metastasis.cs index ce288d7a8b..51fa3ef810 100644 --- a/Items/Weapons/Summon/Metastasis.cs +++ b/Items/Weapons/Summon/Metastasis.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -29,10 +30,10 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.DD2_BetsySummon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,9 +41,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), -Vector2.UnitY * 5f, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/MidnightSunBeacon.cs b/Items/Weapons/Summon/MidnightSunBeacon.cs index 431dfd4d0f..f1ee79c0fc 100644 --- a/Items/Weapons/Summon/MidnightSunBeacon.cs +++ b/Items/Weapons/Summon/MidnightSunBeacon.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { diff --git a/Items/Weapons/Summon/MirrorofKalandra.cs b/Items/Weapons/Summon/MirrorofKalandra.cs index 038c64ae12..bdf70f8296 100644 --- a/Items/Weapons/Summon/MirrorofKalandra.cs +++ b/Items/Weapons/Summon/MirrorofKalandra.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon.MirrorofKalandraMinions; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -20,19 +21,19 @@ namespace CalamityMod.Items.Weapons.Summon public static float Axe_MinRamSpeed = 30f; public static float Axe_MaxRamSpeed = 50f; - public static int Axe_IFrames = 15; + public static int Axe_IFrames = 20; public static float Axe_SpinSpeed = 25f; // In degrees per frame. public static float Purple_MinRamSpeed = 40f; public static float Purple_MaxRamSpeed = 60f; - public static int Purple_IFrames = 23; - public static float Purple_BlastDMGModifier = 2.25f; + public static int Purple_IFrames = 28; + public static float Purple_BlastDMGModifier = 2f; public static float Purple_BlastFireRate = 240f; // In frames. public static int Purple_BlastSize = 300; public static int Purple_BlastChargeTime = 10; public static float Purple_SpinSpeed = 25f; // In degrees per frame. - public static int Scimitar_IFrames = 36; // Note that the effective iframes are half of this number, since the weapon is given an extra update while attacking. + public static int Scimitar_IFrames = 40; // Note that the effective iframes are half of this number, since the weapon is given an extra update while attacking. public static int Wind_BowChargeTime = 5; // Therefore, the higher the time, the slower the fire rate will be, and viceversa. public static float Wind_ArrowSpeed = 5f; @@ -49,10 +50,11 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 58; Item.height = 50; - Item.damage = 317; + Item.damage = 256; Item.useAnimation = Item.useTime = 30; Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.autoReuse = true; @@ -61,7 +63,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Shoot; Item.UseSound = SoundID.Item4; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; } @@ -71,6 +73,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); if (player.ownedProjectileCounts[ModContent.ProjectileType()] == 1) { type = ModContent.ProjectileType(); @@ -82,9 +85,9 @@ namespace CalamityMod.Items.Weapons.Summon type = ModContent.ProjectileType(); } - int minion = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(minion)) - Main.projectile[minion].rotation = -MathHelper.PiOver2; + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.rotation = -MathHelper.PiOver2; + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/MutatedTruffle.cs b/Items/Weapons/Summon/MutatedTruffle.cs index 145cc7d099..5b577b75d8 100644 --- a/Items/Weapons/Summon/MutatedTruffle.cs +++ b/Items/Weapons/Summon/MutatedTruffle.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -29,7 +31,11 @@ namespace CalamityMod.Items.Weapons.Summon #endregion - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { @@ -37,6 +43,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 26; Item.damage = 275; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 5f; @@ -49,12 +56,15 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPureGreenBuyPrice; } + // Only one can be summoned. + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 1 && player.maxMinions >= 3; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Only one can be summoned. - if (player.ownedProjectileCounts[type] < 1 && player.maxMinions >= 3) - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); - + player.AddBuff(Item.buffType, 2); + CalamityUtils.KillShootProjectiles(true, type, player); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/Perdition.cs b/Items/Weapons/Summon/Perdition.cs index 9db7a9910e..338f86fb93 100644 --- a/Items/Weapons/Summon/Perdition.cs +++ b/Items/Weapons/Summon/Perdition.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -13,14 +14,19 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 56; Item.damage = 375; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); + Item.sentry = true; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1. @@ -28,24 +34,20 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_EtherianPortalOpen; } + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 1; + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - if (player.ownedProjectileCounts[type] < 1) - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - } - else - { - // Play some demonic noises prior to a target being selected. - SoundEngine.PlaySound(SoundID.Zombie93, player.Center); - SoundEngine.PlaySound(SoundID.Item119, player.Center); - } + player.AddBuff(Item.buffType, 2); + CalamityUtils.KillShootProjectiles(true, type, player); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + player.UpdateMaxTurrets(); return false; } } diff --git a/Items/Weapons/Summon/PlantationStaff.cs b/Items/Weapons/Summon/PlantationStaff.cs index f7ab0903ef..b967ef9731 100644 --- a/Items/Weapons/Summon/PlantationStaff.cs +++ b/Items/Weapons/Summon/PlantationStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -41,6 +42,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.height = 50; Item.damage = 58; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 1f; @@ -57,7 +59,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/PuffShroom.cs b/Items/Weapons/Summon/PuffShroom.cs index b1e933d4d3..d12ee0ac1e 100644 --- a/Items/Weapons/Summon/PuffShroom.cs +++ b/Items/Weapons/Summon/PuffShroom.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -10,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class PuffShroom : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 32; @@ -24,19 +30,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item42; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int puffGuy = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(puffGuy)) - Main.projectile[puffGuy].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/ResurrectionButterfly.cs b/Items/Weapons/Summon/ResurrectionButterfly.cs index 98ff76631a..d99b51f0a3 100644 --- a/Items/Weapons/Summon/ResurrectionButterfly.cs +++ b/Items/Weapons/Summon/ResurrectionButterfly.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -29,22 +30,21 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); Vector2 clampedMouse = player.ClampedMouseWorld(); - Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * Item.shootSpeed; + Vector2 mouseDirection = Vector2.Normalize(clampedMouse - player.Center) * 10f; - int p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - p = Projectile.NewProjectile(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var pink = Projectile.NewProjectileDirect(source, clampedMouse, mouseDirection.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + pink.originalDamage = Item.damage; + var purple = Projectile.NewProjectileDirect(source, clampedMouse, mouseDirection.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), damage, knockback, Main.myPlayer, 0f, 0f); + purple.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SandSharknadoStaff.cs b/Items/Weapons/Summon/SandSharknadoStaff.cs index 5254fbb849..beba2cc6f2 100644 --- a/Items/Weapons/Summon/SandSharknadoStaff.cs +++ b/Items/Weapons/Summon/SandSharknadoStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,22 +12,18 @@ namespace CalamityMod.Items.Weapons.Summon public class SandSharknadoStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - #region Other stats for easy modification - public const float ProjSpeed = 30f; - public const float FireSpeed = 50f; // In frames. 60 frames = 1 second. - #endregion - public override void SetDefaults() { Item.width = 48; Item.height = 56; - Item.damage = 94; + Item.damage = 71; Item.knockBack = 2f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; @@ -40,12 +37,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int sandnado = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(sandnado)) - Main.projectile[sandnado].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SarosPossession.cs b/Items/Weapons/Summon/SarosPossession.cs index cb7411cbcc..0e143371a0 100644 --- a/Items/Weapons/Summon/SarosPossession.cs +++ b/Items/Weapons/Summon/SarosPossession.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -23,12 +24,13 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; Item.UseSound = SoundID.DD2_BetsyFlameBreath; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; Item.noMelee = true; } @@ -37,10 +39,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/ScabRipper.cs b/Items/Weapons/Summon/ScabRipper.cs index 74d18a268c..2bee629707 100644 --- a/Items/Weapons/Summon/ScabRipper.cs +++ b/Items/Weapons/Summon/ScabRipper.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,7 +18,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 66; Item.height = 70; - Item.damage = 16; + Item.damage = 15; Item.mana = 10; Item.useAnimation = Item.useTime = 30; Item.useStyle = ItemUseStyleID.Shoot; @@ -27,6 +28,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = SoundID.Item83; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; @@ -36,15 +38,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs index 8168f5fff6..6ec21393a9 100644 --- a/Items/Weapons/Summon/SeashineHilt.cs +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; @@ -38,6 +39,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.shootSpeed = 12f; Item.mana = 10; Item.rare = ItemRarityID.Green; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); } public override bool AltFunctionUse(Player player) => true; @@ -90,11 +92,11 @@ namespace CalamityMod.Items.Weapons.Summon } else // Toss out the summon { + player.AddBuff(Item.buffType, 2); SoundEngine.PlaySound(SoundID.Item1, player.Center); - int pr = Projectile.NewProjectile(source, player.Center, velocity, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(pr)) - Main.projectile[pr].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, player.Center, velocity, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; float angleMax = MathHelper.ToRadians(360f); if (CalamityUtils.CountProjectiles(type) == 1) diff --git a/Items/Weapons/Summon/ShellfishStaff.cs b/Items/Weapons/Summon/ShellfishStaff.cs index acfa24fee7..01c8c17b73 100644 --- a/Items/Weapons/Summon/ShellfishStaff.cs +++ b/Items/Weapons/Summon/ShellfishStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,19 +28,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/Sirius.cs b/Items/Weapons/Summon/Sirius.cs index 4c39a7837c..305abfe88a 100644 --- a/Items/Weapons/Summon/Sirius.cs +++ b/Items/Weapons/Summon/Sirius.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useAnimation = Item.useTime = 10; Item.mana = 10; Item.knockBack = 10f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; Item.useStyle = ItemUseStyleID.Swing; @@ -36,10 +38,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/SlimePuppetStaff.cs b/Items/Weapons/Summon/SlimePuppetStaff.cs index 96f57f7c7c..aaae400ae7 100644 --- a/Items/Weapons/Summon/SlimePuppetStaff.cs +++ b/Items/Weapons/Summon/SlimePuppetStaff.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Items.Weapons.Summon CreateRecipe(). AddIngredient(18). AddIngredient(18). - AddTile(). + AddTile(TileID.Solidifier). Register(); } } diff --git a/Items/Weapons/Summon/SpikecragStaff.cs b/Items/Weapons/Summon/SpikecragStaff.cs index d9eb1fdafa..78b856a010 100644 --- a/Items/Weapons/Summon/SpikecragStaff.cs +++ b/Items/Weapons/Summon/SpikecragStaff.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +12,10 @@ namespace CalamityMod.Items.Weapons.Summon public class SpikecragStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 50; diff --git a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs index 9bd042de78..607bbbe62d 100644 --- a/Items/Weapons/Summon/StaffOfNecrosteocytes.cs +++ b/Items/Weapons/Summon/StaffOfNecrosteocytes.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -24,22 +25,19 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Point mouseTileCoords = position.ToTileCoordinates(); + player.AddBuff(Item.buffType, 2); + Point mouseTileCoords = player.ClampedMouseWorld().ToTileCoordinates(); if (WorldGen.SolidTile(mouseTileCoords.X, mouseTileCoords.Y)) return false; - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/StaffoftheMechworm.cs b/Items/Weapons/Summon/StaffoftheMechworm.cs index d6bee5eefe..83e6d27796 100644 --- a/Items/Weapons/Summon/StaffoftheMechworm.cs +++ b/Items/Weapons/Summon/StaffoftheMechworm.cs @@ -1,4 +1,6 @@ using System.Linq; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -12,22 +14,26 @@ namespace CalamityMod.Items.Weapons.Summon public class StaffoftheMechworm : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 68; Item.height = 68; - Item.damage = 100; + Item.damage = 110; Item.mana = 10; Item.useAnimation = Item.useTime = 10; // 9 because of useStyle 1 Item.useStyle = ItemUseStyleID.Swing; Item.noMelee = true; Item.knockBack = 2f; Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item113; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -99,6 +105,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); int head = -1; int tail = -1; foreach (Projectile p in Main.ActiveProjectiles) diff --git a/Items/Weapons/Summon/StarspawnHelixStaff.cs b/Items/Weapons/Summon/StarspawnHelixStaff.cs index 333bdf5ce4..48701eb7dc 100644 --- a/Items/Weapons/Summon/StarspawnHelixStaff.cs +++ b/Items/Weapons/Summon/StarspawnHelixStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class StarspawnHelixStaff : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = 54; @@ -19,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 1.25f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useAnimation = Item.useTime = 20; Item.DamageType = DamageClass.Summon; @@ -32,24 +39,19 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ModProjectile().ProbeIndex = player.ownedProjectileCounts[type]; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; + minion.ModProjectile().ProbeIndex = player.ownedProjectileCounts[type]; - int bladeIndex = 0; - foreach (Projectile pro in Main.ActiveProjectiles) + int bladeIndex = 0; + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI) { - if (pro.type == type && pro.owner == player.whoAmI) - { - pro.ModProjectile().ProbeIndex = bladeIndex++; - pro.ModProjectile().AITimer = 0f; - pro.netUpdate = true; - } + pro.ModProjectile().ProbeIndex = bladeIndex++; + pro.ModProjectile().AITimer = 0f; + pro.netUpdate = true; } } diff --git a/Items/Weapons/Summon/StellarTorusStaff.cs b/Items/Weapons/Summon/StellarTorusStaff.cs index 23e2df9b9d..05344b0db5 100644 --- a/Items/Weapons/Summon/StellarTorusStaff.cs +++ b/Items/Weapons/Summon/StellarTorusStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -29,6 +30,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.useAnimation = Item.useTime = 20; Item.knockBack = 4f; Item.mana = 10; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.noMelee = true; @@ -43,11 +45,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int minion = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); - - if (Main.projectile.IndexInRange(minion)) - Main.projectile[minion].originalDamage = Item.OriginalDamage; - + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, knockback, player.whoAmI); + minion.originalDamage = Item.OriginalDamage; return false; } diff --git a/Items/Weapons/Summon/StormjawStaff.cs b/Items/Weapons/Summon/StormjawStaff.cs index 53c47e8b77..2780625a88 100644 --- a/Items/Weapons/Summon/StormjawStaff.cs +++ b/Items/Weapons/Summon/StormjawStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.Buffs.Summon; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,19 +26,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Green; Item.UseSound = Stormlion.DeathSound; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Summon/SunSpiritStaff.cs b/Items/Weapons/Summon/SunSpiritStaff.cs index fa04a52417..61403820f0 100644 --- a/Items/Weapons/Summon/SunSpiritStaff.cs +++ b/Items/Weapons/Summon/SunSpiritStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -24,6 +25,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityBlueBuyPrice; Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -32,10 +34,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TacticalPlagueEngine.cs b/Items/Weapons/Summon/TacticalPlagueEngine.cs index 2a672d25f5..bbdbb624a9 100644 --- a/Items/Weapons/Summon/TacticalPlagueEngine.cs +++ b/Items/Weapons/Summon/TacticalPlagueEngine.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -27,18 +28,16 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item14; Item.autoReuse = true; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 7f; // Affects bullet speed } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TemporalUmbrella.cs b/Items/Weapons/Summon/TemporalUmbrella.cs index 592dea16b1..04b56eee01 100644 --- a/Items/Weapons/Summon/TemporalUmbrella.cs +++ b/Items/Weapons/Summon/TemporalUmbrella.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Rarities; using CalamityMod.Tiles.Furniture.CraftingStations; @@ -26,7 +27,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.mana = 99; Item.useAnimation = Item.useTime = 10; Item.DamageType = DamageClass.Summon; - Item.shootSpeed = 0f; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.useStyle = ItemUseStyleID.Swing; @@ -41,10 +42,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectileMany(player, type, ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType(), ModContent.ProjectileType()); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs index dcf2926b9a..c3879ce76f 100644 --- a/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs +++ b/Items/Weapons/Summon/TundraFlameBlossomsStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -23,6 +24,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityPinkBuyPrice; Item.rare = ItemRarityID.Pink; Item.UseSound = SoundID.Item46; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -31,6 +33,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 3; i++) { diff --git a/Items/Weapons/Summon/VengefulSunStaff.cs b/Items/Weapons/Summon/VengefulSunStaff.cs index fc5250bf6d..6a6e9735c3 100644 --- a/Items/Weapons/Summon/VengefulSunStaff.cs +++ b/Items/Weapons/Summon/VengefulSunStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -25,6 +26,7 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityLightPurpleBuyPrice; Item.rare = ItemRarityID.LightPurple; Item.UseSound = SoundID.Item44; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.DamageType = DamageClass.Summon; } @@ -33,10 +35,10 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(true, type, player); - int p = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + var minion = Projectile.NewProjectileDirect(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/Vigilance.cs b/Items/Weapons/Summon/Vigilance.cs index a1bb127949..bd8f7d453a 100644 --- a/Items/Weapons/Summon/Vigilance.cs +++ b/Items/Weapons/Summon/Vigilance.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +13,10 @@ namespace CalamityMod.Items.Weapons.Summon public class Vigilance : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; + public override void SetStaticDefaults() + { + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { Item.width = Item.height = 32; @@ -22,27 +28,22 @@ namespace CalamityMod.Items.Weapons.Summon Item.knockBack = 4f; Item.UseSound = SoundID.DD2_BetsySummon; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + if (player.maxMinions - player.slotsMinions >= 1f) { - if (player.maxMinions - player.slotsMinions >= 1f) - { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].ai[0] = player.ownedProjectileCounts[type]; - Main.projectile[p].originalDamage = Item.damage; - } - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.ai[0] = player.ownedProjectileCounts[type]; + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/VileFeeder.cs b/Items/Weapons/Summon/VileFeeder.cs index e584d973f4..9f7e9472ac 100644 --- a/Items/Weapons/Summon/VileFeeder.cs +++ b/Items/Weapons/Summon/VileFeeder.cs @@ -1,4 +1,5 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -17,8 +18,9 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 40; Item.height = 36; - Item.damage = 14; + Item.damage = 15; Item.DamageType = DamageClass.Summon; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.knockBack = 0.5f; @@ -37,7 +39,9 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - Projectile.NewProjectile(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Main.rand.NextVector2CircularEdge(5f, 5f), type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } diff --git a/Items/Weapons/Summon/ViralSprout.cs b/Items/Weapons/Summon/ViralSprout.cs index 967ce92bd5..a3cb6ee511 100644 --- a/Items/Weapons/Summon/ViralSprout.cs +++ b/Items/Weapons/Summon/ViralSprout.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -15,7 +16,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 48; Item.height = 56; - Item.damage = 30; + Item.damage = 24; Item.mana = 10; Item.useAnimation = Item.useTime = 19; Item.useStyle = ItemUseStyleID.HoldUp; @@ -25,29 +26,26 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item44; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + + int minionCount = 0; + foreach (Projectile pro in Main.ActiveProjectiles) { - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; + if (pro.type != type || pro.owner != player.whoAmI) + continue; - int minionCount = 0; - foreach (Projectile pro in Main.ActiveProjectiles) - { - if (pro.type != type || pro.owner != player.whoAmI) - continue; - - pro.localAI[0] = minionCount; - pro.netUpdate = true; - minionCount++; - } + pro.localAI[0] = minionCount; + pro.netUpdate = true; + minionCount++; } return false; } diff --git a/Items/Weapons/Summon/ViridVanguard.cs b/Items/Weapons/Summon/ViridVanguard.cs index affd241fee..d66862a277 100644 --- a/Items/Weapons/Summon/ViridVanguard.cs +++ b/Items/Weapons/Summon/ViridVanguard.cs @@ -1,9 +1,14 @@ -using CalamityMod.Items.Materials; +using System.IO; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; +using CalamityMod.Packets; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Items.Weapons.Summon @@ -11,21 +16,58 @@ namespace CalamityMod.Items.Weapons.Summon public class ViridVanguard : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Summon"; - public const int HorizontalSlashChargeTime = 14; - public const float HorizontalSlashSpeed = 44f; + #region AI-Related Balancing Properties - public const int VerticalSlashChargeTime = 32; + public static float IdleCirclingSpeed => 0.0375f; + public static float AxeCirclingSpeedMultiplier => 3f; + public static float ActiveAttackCirclingSpeedMultiplier => 10f; - public const float VerticalSlashSpeed = 45f; + //The next three are the amount of times the sword does each attack before moving to the next one + public static int HorizontalSlashAmount => 7; + public static int VerticalPierceAmount => 5; + public static int StabAmount => 6; + /// + /// How long the player must wait after an active ends to start the next one + /// + public static int ActiveAttackCooldown => 300; + public static int ActiveAttackStartup => 90; + public static int ActiveAttackEndlag => 30; + /// + /// How many slashes each vanguard will do during the active + /// + public static int ActiveAttackSlashCount => 4; + #endregion + #region Damage Balancing Properties - public const float VerticalTeleportOffset = 850f; - public const int PierceChargeAttackCycleTime = 44; + //Sage Poison's damage is kept in the Sage Poison file + public static float ActiveAttackSlashDmgMult => 5f; - public const float MaxTargetingDistance = 1550f; + //Note: the following two only apply when not using the active attack + public static float AxeDmgMult => 1.25f; + public static float SwordDmgMult => 1f; + #endregion - public const int ChargesPerAttackCycle = 7; + private static Texture2D BladeOutline = null; + public static Texture2D GetBladeOutlineTex() + { + if (BladeOutline == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Summon/ViridVanguardBlade").Value; + BladeOutline = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[BladeOutline.Width * BladeOutline.Height]; + var ColorArray = new Color[BladeOutline.Width * BladeOutline.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + BladeOutline.SetData(ColorArray); + } + return BladeOutline; + } public override void SetStaticDefaults() { @@ -36,7 +78,7 @@ namespace CalamityMod.Items.Weapons.Summon { Item.width = 26; Item.height = 36; - Item.damage = 73; + Item.damage = 60; Item.DamageType = DamageClass.Summon; Item.mana = 10; Item.useAnimation = Item.useTime = 14; @@ -47,20 +89,69 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Red; Item.UseSound = SoundID.Item71; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); Item.rare = ModContent.RarityType(); } + public override bool CanRightClick() + { + if (!Main.keyState.PressingShift()) + return false; + return true; + } + public override void RightClick(Player player) + { + Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections = !Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections; + if (Main.netMode != NetmodeID.SinglePlayer) + ExaltationDirectionSyncPacket.Send(Main.LocalPlayer.Calamity()); + } + + public override bool ConsumeItem(Player player) => false; + + public override bool PreDrawInInventory(SpriteBatch spriteBatch, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale) + { + var tex = TextureAssets.Item[Type].Value; + CalamityUtils.DrawInventoryCustomScale( + spriteBatch, + tex, + position, + frame, + drawColor, + itemColor, + origin, + scale, + wantedScale: 0.9f, + spriteEffects: Main.LocalPlayer.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None + ); + return false; + } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) + float totalSlots = 0f; + foreach (Projectile p in Main.ActiveProjectiles) { - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(p)) + if (p.minion && p.owner == player.whoAmI) { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; + totalSlots += p.minionSlots; } + } + if (totalSlots >= player.maxMinions) + { + foreach (Projectile pro in Main.ActiveProjectiles) + { + if (pro.type == type && pro.owner == player.whoAmI && pro.ModProjectile().ActiveTimer == 0) + { + pro.ModProjectile().BeginSuperEpicPhotonRipperZenithKnockoffAttack(); + } + } + } + else + { + player.AddBuff(Item.buffType, 2); + + var minion = Projectile.NewProjectileDirect(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.ModProjectile().BladeIndex = player.ownedProjectileCounts[type]; int bladeIndex = 0; foreach (Projectile pro in Main.ActiveProjectiles) @@ -68,20 +159,23 @@ namespace CalamityMod.Items.Weapons.Summon if (pro.type == type && pro.owner == player.whoAmI) { pro.ModProjectile().BladeIndex = bladeIndex++; + pro.ModProjectile().ActiveTimer = ViridVanguard.ActiveAttackCooldown; pro.ModProjectile().AITimer = 0f; pro.netUpdate = true; } } } - return false; } public override void AddRecipes() { CreateRecipe(). + AddIngredient(). + AddIngredient(). AddIngredient(15). AddTile(TileID.MythrilAnvil). Register(); } } + } diff --git a/Items/Weapons/Summon/VoidConcentrationStaff.cs b/Items/Weapons/Summon/VoidConcentrationStaff.cs index 332e3bc54d..e9263db742 100644 --- a/Items/Weapons/Summon/VoidConcentrationStaff.cs +++ b/Items/Weapons/Summon/VoidConcentrationStaff.cs @@ -1,4 +1,6 @@ using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using Microsoft.Xna.Framework; @@ -13,7 +15,11 @@ namespace CalamityMod.Items.Weapons.Summon { public new string LocalizationCategory => "Items.Weapons.Summon"; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 3f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { @@ -27,8 +33,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.damage = 105; Item.knockBack = 4f; Item.useAnimation = Item.useTime = 15; // 14 because of useStyle 1 + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; Item.rare = ModContent.RarityType(); } @@ -44,10 +50,9 @@ namespace CalamityMod.Items.Weapons.Summon { if (player.altFunctionUse != 2) { - int p = Projectile.NewProjectile(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - Main.projectile[p].originalDamage = Item.damage; - player.AddBuff(ModContent.BuffType(), 120); + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.Center, Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; } return false; } diff --git a/Items/Weapons/Summon/WarloksMoonFist.cs b/Items/Weapons/Summon/WarloksMoonFist.cs index edc2b0338b..b06e055294 100644 --- a/Items/Weapons/Summon/WarloksMoonFist.cs +++ b/Items/Weapons/Summon/WarloksMoonFist.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Ores; using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; @@ -35,24 +36,19 @@ namespace CalamityMod.Items.Weapons.Summon Item.UseSound = SoundID.Item104; Item.autoReuse = true; Item.noUseGraphic = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; Item.Calamity().donorItem = true; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - int existingFists = player.ownedProjectileCounts[type]; - int p = Projectile.NewProjectile(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(p)) - { - Main.projectile[p].originalDamage = Item.damage; - Main.projectile[p].ai[0] = existingFists; - } - } + player.AddBuff(Item.buffType, 2); + int existingFists = player.ownedProjectileCounts[type]; + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; + minion.ai[0] = existingFists; return false; } diff --git a/Items/Weapons/Summon/WitherBlossomsStaff.cs b/Items/Weapons/Summon/WitherBlossomsStaff.cs index e4ff0d39fd..4bd1b77d8d 100644 --- a/Items/Weapons/Summon/WitherBlossomsStaff.cs +++ b/Items/Weapons/Summon/WitherBlossomsStaff.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Materials; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; using Terraria; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.value = CalamityGlobalItem.RarityYellowBuyPrice; Item.rare = ItemRarityID.Yellow; Item.UseSound = SoundID.Item46; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -36,6 +37,7 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + player.AddBuff(Item.buffType, 2); CalamityUtils.KillShootProjectiles(false, type, player); for (int i = 0; i < 4; i++) { diff --git a/Items/Weapons/Summon/WulfrumController.cs b/Items/Weapons/Summon/WulfrumController.cs index 8aae13745f..4c3c3541a9 100644 --- a/Items/Weapons/Summon/WulfrumController.cs +++ b/Items/Weapons/Summon/WulfrumController.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.Summon; using CalamityMod.Items.Materials; using CalamityMod.Projectiles.Summon; using Microsoft.Xna.Framework; @@ -27,8 +28,8 @@ namespace CalamityMod.Items.Weapons.Summon Item.rare = ItemRarityID.Blue; Item.UseSound = SoundID.Item15; //phaseblade sound effect Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } @@ -40,22 +41,16 @@ namespace CalamityMod.Items.Weapons.Summon public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - velocity.X = 0; - velocity.Y = 0; - int droid = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, 1f); - if (Main.projectile.IndexInRange(droid)) - Main.projectile[droid].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0f, 1f); + minion.originalDamage = Item.damage; return false; } public override void AddRecipes() { CreateRecipe(). - AddIngredient(9). + AddIngredient(10). AddTile(TileID.Anvils). Register(); } diff --git a/Items/Weapons/Summon/YharonsKindleStaff.cs b/Items/Weapons/Summon/YharonsKindleStaff.cs index dc09c1c246..724f7a5e09 100644 --- a/Items/Weapons/Summon/YharonsKindleStaff.cs +++ b/Items/Weapons/Summon/YharonsKindleStaff.cs @@ -1,4 +1,6 @@ -using CalamityMod.Projectiles.Summon; +using CalamityMod.Buffs.Summon; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.Summon; using CalamityMod.Rarities; using CalamityMod.Sounds; using Microsoft.Xna.Framework; @@ -15,7 +17,11 @@ namespace CalamityMod.Items.Weapons.Summon public new string LocalizationCategory => "Items.Weapons.Summon"; public const float ReboundRamDamageFactor = 2f; - public override void SetStaticDefaults() => ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + public override void SetStaticDefaults() + { + ItemID.Sets.StaffMinionSlotsRequired[Type] = 5f; + ItemID.Sets.ShimmerTransformToItem[Type] = ModContent.ItemType(); + } public override void SetDefaults() { @@ -28,23 +34,19 @@ namespace CalamityMod.Items.Weapons.Summon Item.noMelee = true; Item.knockBack = 7f; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.rare = ModContent.RarityType(); + Item.rare = ModContent.RarityType(); Item.UseSound = CommonCalamitySounds.FlareSound; Item.autoReuse = true; + Item.buffType = ModContent.BuffType(); Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 10f; Item.DamageType = DamageClass.Summon; } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - if (player.altFunctionUse != 2) - { - position = player.ClampedMouseWorld(); - int dragon = Projectile.NewProjectile(source, position, Vector2.Zero, type, damage, knockback, player.whoAmI); - if (Main.projectile.IndexInRange(dragon)) - Main.projectile[dragon].originalDamage = Item.damage; - } + player.AddBuff(Item.buffType, 2); + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI); + minion.originalDamage = Item.damage; return false; } } diff --git a/Items/Weapons/Typeless/LunicEye.cs b/Items/Weapons/Typeless/LunicEye.cs index 872d2e4d6a..bfc0f7aa08 100644 --- a/Items/Weapons/Typeless/LunicEye.cs +++ b/Items/Weapons/Typeless/LunicEye.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Items.Weapons.Typeless { public new string LocalizationCategory => "Items.Weapons.Typeless"; - public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/LunicShot", 2) { PitchVariance = 0.1f }; + public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Item/LunicShot", 2) { Volume = 0.8f, PitchVariance = 0.1f }; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Item/LunicImpact") { PitchVariance = 0.1f }; public override void SetDefaults() diff --git a/Items/Weapons/Typeless/Skynamite.cs b/Items/Weapons/Typeless/Skynamite.cs index 4b58acd186..9addfab877 100644 --- a/Items/Weapons/Typeless/Skynamite.cs +++ b/Items/Weapons/Typeless/Skynamite.cs @@ -34,8 +34,8 @@ namespace CalamityMod.Items.Weapons.Typeless Item.noMelee = true; Item.noUseGraphic = true; Item.UseSound = SoundID.Item1; - Item.value = CalamityGlobalItem.RarityOrangeBuyPrice / 10; // Crafted 10 at a time - Item.rare = ItemRarityID.Orange; + Item.value = Item.sellPrice(silver: 4); // Identical to Dynamite + Item.rare = ItemRarityID.Blue; } public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) diff --git a/Items/Weapons/Typeless/StarStruckWater.cs b/Items/Weapons/Typeless/StarStruckWater.cs index 13499cb0f5..b2e8980739 100644 --- a/Items/Weapons/Typeless/StarStruckWater.cs +++ b/Items/Weapons/Typeless/StarStruckWater.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Weapons.Typeless Item.useTime = 15; Item.noUseGraphic = true; Item.noMelee = true; - Item.value = 200; + Item.value = Item.sellPrice(copper: 40); // Identical to Holy Water } public override void AddRecipes() diff --git a/Items/Weapons/Typeless/YanmeisKnife.cs b/Items/Weapons/Typeless/YanmeisKnife.cs deleted file mode 100644 index 9aa8579d24..0000000000 --- a/Items/Weapons/Typeless/YanmeisKnife.cs +++ /dev/null @@ -1,76 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Items.Weapons.Typeless -{ - public class YanmeisKnife : ModItem, ILocalizedModType - { - public new string LocalizationCategory => "Items.Weapons.Typeless"; - public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/Item/YanmeiKnifeHit"); - public static readonly SoundStyle ExpireSound = new("CalamityMod/Sounds/Custom/YanmeiKnifeExpire"); - - public static int DebuffDuration = 600; - public static int DebuffDoT = 250; - public static float DebuffDamageReductionMult = 0.8f; - public static float DebuffNPCSpeedCap = 16f; - - public static int BoostDuration = 600; - public static float RunSpeedBoost = 0.15f; - public static float RunAccelerationBoost = 0.15f; - public static float DamageBoost = 0.15f; // All 15% so we only need just one in the tooltip -- Same for the respective buff - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(RunSpeedBoost.ToPercent(), BoostDuration.FramesToSeconds()); - - public override void SetDefaults() - { - Item.width = 48; - Item.height = 44; - Item.damage = 8; - Item.noMelee = true; - Item.noUseGraphic = true; - Item.useAnimation = Item.useTime = 32; - Item.useStyle = ItemUseStyleID.Shoot; - Item.knockBack = 4.5f; - Item.autoReuse = false; - Item.value = CalamityGlobalItem.RarityYellowBuyPrice; - Item.rare = ItemRarityID.Yellow; - Item.Calamity().donorItem = true; - Item.UseSound = SoundID.Item71; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 24f; - } - - public override void ModifyResearchSorting(ref ContentSamples.CreativeHelper.ItemGroup itemGroup) - { - itemGroup = (ContentSamples.CreativeHelper.ItemGroup)CalamityResearchSorting.ClasslessWeapon; - } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; - - public override bool CanUseItem(Player player) - { - if (player.Calamity().KameiBladeUseDelay > 0) - return false; - return base.CanUseItem(player); - } - - public override void ModifyShootStats(Player player, ref Vector2 position, ref Vector2 velocity, ref int type, ref int damage, ref float knockback) => player.Calamity().KameiBladeUseDelay = 180; - - public override void AddRecipes() - { - CreateRecipe(). - AddIngredient(ItemID.PsychoKnife). - AddIngredient(ItemID.Obsidian, 10). - AddRecipeGroup("IronBar", 20). - AddIngredient(50). - AddTile(TileID.MythrilAnvil). - Register(); - } - } -} diff --git a/Items/Weapons/Typeless/YanmeisKnife.png b/Items/Weapons/Typeless/YanmeisKnife.png deleted file mode 100644 index b7f214f8f4..0000000000 Binary files a/Items/Weapons/Typeless/YanmeisKnife.png and /dev/null differ diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index a694250087..bb971a8498 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -138,7 +138,7 @@ PhoenixAttunement: { Swing the sword around you, accelerating over time The swirling nebula constantly emits homing cosmic bolts Release to hurl the sword toward the cursor alongside 6 gigantic cosmic bolts - The hurled sword erupts into a blazing flame pillar on enemy hits + The hurled sword erupts into a blazing tornado on enemy hits ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson index 44fffe4fd3..21b32dc38b 100644 --- a/Localization/en-US/Mods.CalamityMod.Bestiary.hjson +++ b/Localization/en-US/Mods.CalamityMod.Bestiary.hjson @@ -86,7 +86,7 @@ MantisShrimp: Though a variety of answers are given when one asks adventurers ab OverloadedSoldier: A body given life again, overflowing with the souls of warriors that perished during the Crusade who were unable to find peace. Their ravenous hunger for battle has been reignited due to sensing godly essences in the land once more. PerennialSlime: These slimes have seized a small amount of the Goddess of Life's essence. Despite her reimprisonment in the deepest depths of the Abyss, the tendrils of her influence now stretch far into the world beyond. PhantomSpirit: The spirits within the Dungeon only vaguely recall their lives, and yet there is one thing each and all clearly remember, that drives them to chaos: the man responsible for locking them in these cursed walls, and his overwhelming power– power that they have been reminded of, due to one ever growing in strength roaming their halls. -Piggy: These little swines waddle their little legs across these lands with little purpose, but they are happy with just that. Yet, little is known about how their little stomach carries a not-so-little amount of coins. +Piggy: These little swines waddle their little legs across these lands with little purpose, but they are happy with just that. Yet, little is known about how their little stomach carries a not-so-little amount of fat and muscle. ProfanedEnergyBody: Those most devout to Her travel the world, being planted into societies and acting as spies and assassins. Among their duties is constructing shrines in Her honor infused with Her divine power, that She might bless pagans blinded by darkness with visions of Her new age of light. Rimehound: These hounds were bred and trained to survive in the tundra's hostile conditions by Yharim's forces, so that they may act as scouts. Most were simply abandoned by their masters out of either necessity or choice, and were resigned to roam forever without purpose. Rotdog: Fast and furious, these hounds prowl the night, hunting prey with their razor sharp teeth. They are similar in nature to the demon eyes, both being spawned from the same vile mire, yet these creatures are tailored made to end those who have proven themselves a threat to it. @@ -126,6 +126,7 @@ GiantClam: Pearls are formed from ambient mana combining with natural limestone HauntedChum: During the Witch's razing of Ilmeris' seas, many of the largest fish that had never known fear in their lives were foolish enough to fight back. Even in death they remain consumed by rage, attacking those who draw near, despite being as ruined as the sea itself. Jellyghoul: The spirits of some Ilmerians were so consumed by grief and despair that, over time, their identity and memories faded away. These souls are now confined in the blank form of phantom jellyfishes, doomed to forever haunt the Timeless Shores. KelpieSeadragon: Kelpie Seadragons enjoy hiding in the scarlet kelp fronds of the Polyp Forest, where they can observe their surroundings without being noticed. Don’t underestimate them, as their silly-looking faces can shoot highly poisonous pellets! +LazarusLampfish: No less than living fossils, Lazarus Lampfish were long thought to be extinct. Their species survived for millions of years in the secluded depths of the Ilmeran Sea, using bright flashes of light emitted from their “lamp” to great defensive effect. Leerslug: Named for their unsightly snapping teeth, the Leerslug uses the rather cruel reproduction method of laying their eggs within the skin of Searslugs. Once their lethargic and shaky host is no longer needed, they violently erupt out and bite another Searslug, continuing the cycle. LostShoal: Shoals of spectral fish swim through the damp air of the Sunken shoreline, fully ignorant of their ominous demeanor and the horrible fate that befell them. Pearlpod: Residing in the utmost depths of the Sunken Sea, these docile crustaceans consume Lantern Kelp and organic remains to survive. When curled up, their nacreous hide makes them almost identical to pearls and impervious to attacks. @@ -142,6 +143,7 @@ SeaMinnow: Large schools of Sea Minnows were one of the most beautiful things on Searslug: A distant cousin of the Slugbuns which can withstand the extreme heat of molten basalt. Their skin is scalding to the touch, a side effect of their adaptations to the many lava dips needed to squirm around the regions it lives in. Sharkoon: The bulbous Sharkoon wanders the reefs on the outskirts of the Sunken Sea. It retaliates against threats through the unusual method of exploding a sac on its body that stores highly reactive chemicals, fleeing in the confusion caused by its shockwave. Slugbun: The name of these cute sea dwellers is actually a misnomer given to them by outside visitors of the sea kingdom, who often sold them as exotic pets. In fact, their "bunny ear" appendages are actually their antennae taking on the appearance of the various sea prisms scattered throughout their home. +Steampod: These distant relatives of the Pearlpods possess a powerful environmental adaptation. Their ability to eject steam propels themselves through the air as a deadly pneumatic boulder that packs quite a punch. Stormlion: Some Ilmerian survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. StormlionSentry: Some Ilmeran survivors claim that enough magical lightning surged through the sea during its final days that there existed not a single drop of water without levin coursing through it. Even now, electricity remains buried in the sands, with several antlion species having learned to channel the former kingdom's power. //Town NPCs @@ -149,7 +151,6 @@ AndroombaFriendly: Reverse-engineered Androombas that have been retrofitted to s Archmage: One of the world's foremost experts on magical theory, he is renowned for his skill with the arcane arts. In his days when he traveled with Yharim's entourage, he acted as the Godseeker's advisor, due to both his status and his distaste for actively participating in battle. Bandit: The bandit may have a bad habit of looting battlefields and taking what isn't theirs, but their actions are mostly motivated by their hatred of the obscenely rich who haven't truly earned the wealth they possess. Their methods are somewhat shady, but can always be relied upon to get a job done. BrimstoneWitch: Recruited to Yharim's forces late into the war, her magic overflows with such power that she is largely incapable of casting normal spells. Yet despite her great power, Calamitas prefers not to use it, as it takes a heavy toll on her psyche. -Cirrus: A princess from an unknown land. She drinks constantly in a vain attempt to escape the memories of her past, but is practically immune to alcohol. She makes a business of selling her mixtures, alcoholic and alchemic alike. SeaKing: The seventeenth ruler of the constitutional monarchy of Ilmeris since the tribes of the Ilmeran Sea unified, under the Electric Goddess, Otonilou, and the elusive God of the Seas. Alas, one cannot be a ruler without subjects, and while he remains respected by those who opposed Godseeker Yharim, his kingdom is no more. //Boss Minions Brimling: Extensions of the Brimstone Elemental herself, and part of her very being. Both she and her Brimlings are of a single mind, so she naturally cares for them just as she cares for herself. When heavily wounded, they withdraw into a cocoon to protect themselves from further harm. diff --git a/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson b/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson index 1887130660..8e6b15daba 100644 --- a/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson +++ b/Localization/en-US/Mods.CalamityMod.BossChecklistIntegration.hjson @@ -20,7 +20,7 @@ AquaticScourge: { } AstrumAureus: { - SpawnInfo: Use an [i:CalamityMod/AstralChunk] at night in the Astral Infection. + SpawnInfo: Use an [i:CalamityMod/AstralChunk] in the Astral Infection. DespawnMessage: "[c/FFD700:Aureus has neutralized all threats. Resume prior reconnaissance.]" } @@ -47,7 +47,7 @@ Calamitas: { } CalamitasClone: { - SpawnInfo: Use an [i:CalamityMod/EyeofDesolation] at night. + SpawnInfo: Use an [i:CalamityMod/EyeofDesolation]. DespawnMessage: "[c/FFA500:The clone spits a bit of blood in disgust and vanishes.]" } @@ -58,7 +58,7 @@ CeaselessVoid: { } Crabulon: { - SpawnInfo: Use a [i:CalamityMod/DecapoditaSprout] in a Glowing Mushroom biome. + SpawnInfo: Use a [i:CalamityMod/DecapoditaSprout] in an underground Glowing Mushroom biome. DespawnMessage: "[c/6495ED:The monstrous mycelial crab shuffles away…]" } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index bd82b8169e..5920e13c94 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -19,9 +19,9 @@ CinnamonRollBuff: { Description: Mana regen rate and fire debuff damage increased, defense reduced } -CirrusVodkaBuff: { - DisplayName: Fab - Description: You feel fabulous +PurpleHazeBuff: { + DisplayName: Purple Haze + Description: Damage and invulnerability frames increased, defense reduced } EverclearBuff: { @@ -287,10 +287,6 @@ WeakBrimstoneFlames: { } // Mounts -AlicornBuff: { - DisplayName: Alicorn - Description: You beat DoG while drunk, you are truly fabulous! -} AndromedaBuff: { DisplayName: Andromeda @@ -483,11 +479,6 @@ RadiatorBuff: { Description: Radioactive but adorable } -ReaverOrbBuff: { - DisplayName: Reaver Orb - Description: The reaver orb will light your way -} - SparksBuff: { DisplayName: Sparks Description: Eats butterflies @@ -509,22 +500,22 @@ ChaosCandleBuff: { Description: Spawn rates around the candle are boosted! } -CirrusBlueCandleBuff: { +BlueCandleBuff: { DisplayName: Limber Description: The floating flame seems to uplift your very spirit } -CirrusPinkCandleBuff: { +PinkCandleBuff: { DisplayName: Vigor Description: The brilliant light suffuses you with hope } -CirrusPurpleCandleBuff: { +PurpleCandleBuff: { DisplayName: Resilience Description: Neither rain nor wind can snuff your undying flame } -CirrusYellowCandleBuff: { +YellowCandleBuff: { DisplayName: Spite Description: The hateful, flickering glow fuels your ire } @@ -562,7 +553,7 @@ AstralInjectionBuff: { BaguetteBuff: { DisplayName: Baguette - Description: "[c/B00BA5:'If only I knew...' ~Cirrus]" + Description: Goes well with Red Wine } BloodfinBoost: { @@ -679,7 +670,7 @@ AeolianEarthBuff: { Description: ''' You are strengthened by primordial powers - Damage reduction increased by {0}%, damage increased by {1}% + Damage reduction increased by {0}%, damage increased by {1}%, and massively buffed mana regen ''' } @@ -734,11 +725,6 @@ BrimflameFrenzyBuff: { Description: Dark magic empowers your attacks at the cost of your life } -BrutalCarnage: { - DisplayName: Brutal Carnage - Description: "{0}% increased melee damage" -} - ChiBuff: { DisplayName: Chi Description: You are more resilient @@ -764,11 +750,6 @@ DivineBless: { Description: Increased health regen and minions inflict Banishing Fire } -EmpyreanRage: { - DisplayName: Empyrean Rage - Description: Rage of the cosmos -} - EmpyreanWrath: { DisplayName: Empyrean Wrath Description: Wrath of the cosmos @@ -814,11 +795,6 @@ IceShieldBuff: { Description: Absorbs {0}% damage from the next hit you take, then shatters } -KamiBuff: { - DisplayName: Kami Injection - Description: "{0}% increased max movement speed, acceleration and damage" -} - Mushy: { DisplayName: Mushy Description: Increased defense by {0} and life regen by {1} HP/s @@ -899,7 +875,7 @@ SandsWindBuff: { Description: ''' You are strengthened by the powers of sand - Defense increased by {0}, damage increased by {1}% + Defense increased by {0}, damage increased by {1}%, and greatly buffed mana regen ''' } @@ -910,7 +886,7 @@ SilvaRevival: { SpiritDefense: { DisplayName: Spirit Defense - Description: Defense increased by {0} and damage reduction increased by {1}% + Description: Defense increased by {0} } SpiritPower: { @@ -1027,11 +1003,6 @@ Irradiated: { Description: Your skin is burning off } -KamiFlu: { - DisplayName: Kami Flu - Description: Defenseless and dying -} - MarkedforDeath: { DisplayName: Marked for Death Description: Damage reduction reduced @@ -1102,6 +1073,11 @@ AquaticStar: { Description: The aquatic star will protect you } +AqueousHunterDroneBuff: { + DisplayName: Aqueous Hunter Drone Buff + Description: Unfortunately incapable of producing fried rice +} + AstralProbeBuff: { DisplayName: Astral Probe Description: The astral probe will protect you @@ -1137,7 +1113,7 @@ BrimseekerBuff: { Description: Does it want something from you? } -BrimstoneWaifu: { +BrimstoneElemental: { DisplayName: Brimstone Elemental Description: The Brimstone Elemental will protect you } @@ -1162,16 +1138,11 @@ CinderBlossomBuff: { Description: A hot, searing flower is floating uncomfortably close to you } -CloudyWaifu: { +CloudElemental: { DisplayName: Cloud Elemental Description: The Cloud Elemental will protect you } -GlacialEmbraceBuff: { - DisplayName: Glacial Embrace - Description: The magic of the ancient ice castle will aid you -} - Corroslime: { DisplayName: Corroslime Description: The corroslime will protect you @@ -1227,11 +1198,6 @@ DemonshadeSetDevilBuff: { Description: The red devil will protect you } -LegionofCelestiaBuff: { - DisplayName: Celestial Axe - Description: If only it was this good at chopping trees... -} - EndoCooperBuff: { DisplayName: Endo Cooper Description: The ascened Cooper will protect you @@ -1302,6 +1268,11 @@ GastricAberrationBuff: { Description: The aquatic aberration will protect you } +GlacialEmbraceBuff: { + DisplayName: Glacial Embrace + Description: The magic of the ancient ice castle will aid you +} + HauntedDishesBuff: { DisplayName: Haunted Dishes Description: The haunted dishes will protect you @@ -1352,6 +1323,11 @@ KingofConstellationsBuff: { Description: The celestial dragons will protect you } +LegionofCelestiaBuff: { + DisplayName: Celestial Axe + Description: If only it was this good at chopping trees... +} + LiliesOfFinalityBuff: { DisplayName: Finality Description: Remember our promise @@ -1443,6 +1419,11 @@ PuffWarriorBuff: { Description: It confidently and excitedly protects you } +RareSandElemental: { + DisplayName: Rare Sand Elemental + Description: The Sand Elemental will heal you +} + ResurrectionButterflyBuff: { DisplayName: Resurrection Butterfly Description: Sleep beneath the Cherry Blossoms, Red-White Butterfly @@ -1458,12 +1439,7 @@ Sandnado: { Description: The sandnado will protect you } -SandyHealingWaifu: { - DisplayName: Rare Sand Elemental - Description: The Sand Elemental will heal you -} - -SandyWaifu: { +SandElemental: { DisplayName: Sand Elemental Description: The Sand Elemental will protect you } @@ -1578,7 +1554,7 @@ VoidConcentrationBuff: { Description: The infinite void yearns for more... } -WaterWaifu: { +WaterElemental: { DisplayName: Anahita Description: Anahita will protect you } @@ -1614,3 +1590,8 @@ PopoNoselessBuff: { DisplayName: Noseless Popo Description: Your nose has been stolen! } + +ForbiddenStealthSummonTagBuff: { + DisplayName: Forbidden Stealth Summon Tag Buff + Description: If you're seeing this, something went horribly wrong +} diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index c083073773..4956034623 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -1,3 +1,19 @@ +// Plain stat boosts +RogueDamage: "{0}% increased rogue damage" +RogueCrit: "{0}% increased rogue critical strike chance" +RogueDamageCrit: "{0}% increased rogue damage and critical strike chance" +RogueVelocity: "{0}% increased rogue velocity" +RogueStealth: +{0} maximum stealth +// Armor Set Bonus key states +BothArmorSetBonusKeys: Press {0} or Double tap {1} +NoArmorSetBonusKey: Press the Armor Set Bonus key +ArmorSetBonusKey: Press {0} +DoubleTapDown: Double tap {0} +// Miscellaneous stats/info +AggroBoost: Enemies are more likely to target you +AggroReduction: Enemies are less likely to target you +AmmoUseReduction: "{0}% chance to save ammo" +KnockbackImmunity: Grants immunity to knockback AbyssLightLevel1: Provides a small amount of light in the abyss AbyssLightLevel2: Provides a moderate amount of light in the abyss AbyssLightLevel3: Provides a large amount of light in the abyss @@ -8,9 +24,9 @@ AlcoholWarning: Drinking more than 3 different alcohols might not end well with ArmorPenetration: Ignores {0} points of enemy Defense CanMineUelibloom: Can mine Uelibloom Ore NotConsumable: Not consumable -RogueDamage: "{0}% increased rogue damage" -RogueCrit: "{0}% increased rogue critical strike chance" -RogueVelocity: "{0}% increased rogue velocity" +SummonTagDamageFlat: "{0} summon tag damage" +SummonTagDamageMult: "{0}x summon tag damage" +SummonTagCrit: "{0}% summon tag critical strike chance" DodgeInformation: ''' Attacks that deal less than 5% of your max life in damage will not be dodged diff --git a/Localization/en-US/Mods.CalamityMod.Condition.hjson b/Localization/en-US/Mods.CalamityMod.Condition.hjson index 99fdd6fa50..d99892c2dd 100644 --- a/Localization/en-US/Mods.CalamityMod.Condition.hjson +++ b/Localization/en-US/Mods.CalamityMod.Condition.hjson @@ -47,12 +47,11 @@ Drops: { Drops if Providence was defeated only with the [i:CalamityMod/ProfanedSoulArtifact] Profaned Soul Artifact {$Bestiary_ItemDropConditions.IsExpert} ''' - TrasherKill: Drops if fed to a Trasher } // Other conditions -PotionConfig: While the Town NPC Potion Selling configuration option is enabled HasFlareGun: While holding a Flare Gun upgrade +LacewingBestiary: When at least 40% of the Bestiary has been completed HasRogueArmor: While wearing rogue armor HasWings: While wearing wings InAstral: In the Astral Infection @@ -61,10 +60,3 @@ InSulph: In the Sulphurous Sea InSunken: In the Sunken Sea InRev: In Revengeance Mode InRevOrMM: In Revengeance Mode or in Master Mode -AlcoholPoison: While inflicted with Alcohol Poisoning -PostCal: After defeating Calamitas Clone -PostAureus: After defeating Astrum Aureus -PostPolter: After defeating Polterghast -PostOD: After defeating the Old Duke -PostDoG: After defeating the Devourer of Gods -PostYharon: After defeating Yharon diff --git a/Localization/en-US/Mods.CalamityMod.Configs.hjson b/Localization/en-US/Mods.CalamityMod.Configs.hjson index e1ae0e199d..7814bc313a 100644 --- a/Localization/en-US/Mods.CalamityMod.Configs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Configs.hjson @@ -6,8 +6,12 @@ CalamityClientConfig: { Graphics: Graphics Changes UI: UI Changes MeterPositions: Meter Positions - MusicEvents: In-Game Music Events - Multithreading: Multi-Threading + MusicToggles: Music Toggles + } + + AbyssLayer3Alt: { + Label: "[i:CalamityModMusic/AbyssLayer3AltMusicBox] Abyss Layer 3 Alt" + Tooltip: Plays Calamity Mod OST - "R'lyehian Depths", while in the Thermal Vents layer of the Abyss. } AdrenalineMeterPosX: { @@ -46,15 +50,6 @@ CalamityClientConfig: { ''' } - CalamityArmorSetBonusDoubleTap: { - Label: "[i:CalamityMod/DesertProwlerHat] Calamity Armor Set Bonuses Can Use Vanilla Hotkey" - Tooltip: - ''' - Allows Calamity armor set bonuses to be triggered by the vanilla double-tap DOWN hotkey (or UP depending on your settings). - Also allows vanilla armor set bonuses to be triggered by Calamity's armor set bonus hotkey. - ''' - } - ChargeMeter: { Label: "[i:CalamityMod/DraedonPowerCell] Display Charge Meter" Tooltip: @@ -132,14 +127,14 @@ CalamityClientConfig: { Label: "[i:CalamityMod/BallAndChain] Enable Fast Falling" Tooltip: ''' - When enabled, you can hold the DOWN key while in the air to accelerate downwards faster. + When enabled, you can hold the {$Key.DOWN} key while in the air to accelerate downwards faster. This config does not increase your maximum falling speed, just how quickly you accelerate to it. Calamity is balanced around this setting being enabled. ''' } FlightBar: { - Label: "[i:CalamityMod/DrewsWings] Display Flight Bar" + Label: "[i:AngelWings] Display Flight Bar" Tooltip: ''' Enables the Flight Bar UI, which shows the player's remaining wing flight time. @@ -166,19 +161,15 @@ CalamityClientConfig: { ''' } - Interlude1: { - Label: "[i:CalamityModMusic/Interlude1MusicBox] Interlude 1" - Tooltip: Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. - } - - Interlude2: { - Label: "[i:CalamityModMusic/Interlude2MusicBox] Interlude 2" - Tooltip: Plays Calamity Mod OST - "Storms before the catastrophes", after the Moon Lord has been defeated. - } - - Interlude3: { - Label: "[i:CalamityModMusic/Interlude3MusicBox] Interlude 3" - Tooltip: Plays Calamity Mod OST - "Catastrophes before the calamity", after Yharon has been defeated. + Interludes: { + Label: "[i:CalamityModMusic/Interlude1MusicBox] Interludes" + Tooltip: + ''' + Enables the playing of three interlude tracks in-game: + Plays Calamity Mod OST - "Silence before the storms", after Calamitas Clone has been defeated. + Plays Calamity Mod OST - "Storms before the catastrophes", after the Moon Lord has been defeated. + Plays Calamity Mod OST - "Catastrophes before the calamity", after Yharon has been defeated. + ''' } MeterPosLock: { @@ -249,6 +240,21 @@ CalamityClientConfig: { ''' } + SetBonusDoubleTap: { + Label: "[i:VortexHelmet] Allow Double Tap for Armor Set Bonuses" + Tooltip: + ''' + Allows all armor set bonuses to be triggered by the vanilla double-tap {$Key.DOWN} hotkey (or {$Key.UP} depending on your settings). + Set to Auto to automatically turn off double-tap as long as Calamity's {$Keybinds.ArmorSetBonus.DisplayName} hotkey is bound. + ''' + + Options: { + On: Always On + Auto: Auto + Off: Always Off + } + } + ShopNewAlert: { Label: "[i:GoldChest] New Shop Inventory Alerts" Tooltip: Adds an icon that appears over Town NPCs when they have new items in their shops. @@ -322,10 +328,10 @@ CalamityClientConfig: { Label: "[i:TrifoldMap] Enable Stutter Fix" Tooltip: ''' - When enabled, upon entering a world, the entire world will be loaded at once. - This config causes Terraria to stop responding while the world is being loaded, do NOT close the game while this is occurring. - Once the game starts responding again, you will enter the world and be able to play without random stutters. - This config option is only recommended for players who can't stand random stutters while playing. + When enabled, upon entering a world, the entire world will be loaded at once. + This config causes Terraria to stop responding while the world is being loaded, do NOT close the game while this is occurring. + Once the game starts responding again, you will enter the world and be able to play without random stutters. + This config option is only recommended for players who can't stand random stutters while playing. ''' } @@ -351,9 +357,18 @@ CalamityClientConfig: { Label: "[i:CalamityMod/SeaRemains] Sunken Sea Background Distortion" Tooltip: ''' - Whether or not the Sunken Sea's custom backgrounds should have an additional distortion shader applied to them to give the - illusion of underwater distortion. - [c/FF232C:Note that this will ONLY work if your "Wave Quality" setting is turned off.] + Whether or not the Sunken Sea's custom backgrounds should have an additional distortion shader applied to them. + This will give the illusion of underwater distortion. + [c/FF232C:Note that this will ONLY work if your "Wave Quality" setting is turned off.] + ''' + } + + TextEffects: { + Label: "[i:LeinforsAccessory] Extra Text Effects" + Tooltip: + ''' + When enabled, certain Calamity rarities will display extra visual effects within item names. + Disable if reduced visual clutter is desired. ''' } @@ -375,21 +390,6 @@ CalamityClientConfig: { Label: "[i:Book] Wiki Status Message" Tooltip: Enable or disable the status message promoting the Official Calamity Wiki that plays on world entry. } - - MultiThreadingType: { - Label: Sunken Sea Multi-Threading Option - Tooltip: - ''' - Option 0 will disable worldgen multi-threading. - Option 1 will enable ReLogic's multi-threading. - Option 2 will enable custom multi-threading. - ''' - } - - SunkenSeaMultiThreading: { - Label: Sunken Sea Multi Threading - Tooltip: "" - } } CalamityServerConfig: { @@ -514,7 +514,7 @@ CalamityServerConfig: { RemoveLavaDropsFromLavaSlimes: { Label: "[i:LavaWaders] Remove Lava Drops From Lava Slimes" - Tooltip: When enabled, Lava Slimes will be replaced with a new Lava Slime that no longer drops lava. + Tooltip: When enabled, Lava Slimes will be prevented from dropping lava in Expert Mode. } RemoveReforgeRNG: { @@ -553,3 +553,5 @@ CalamityServerConfig: { ''' } } + +SetBonusDoubleTapOptions.Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.GameTips.hjson b/Localization/en-US/Mods.CalamityMod.GameTips.hjson index 9d69d69161..d847050349 100644 --- a/Localization/en-US/Mods.CalamityMod.GameTips.hjson +++ b/Localization/en-US/Mods.CalamityMod.GameTips.hjson @@ -4,13 +4,11 @@ PlanetoidTip: You can find Planetoids high up in Space! AbyssTip: The Abyss can be found deep below the Sulphurous Sea. Be sure to have proper diving gear when exploring it. BanditTip: The Bandit won't steal from the poor. If you want to see them, you will need a lot of money to pique their attention. RefundTip: If you've been reforging a lot with the Goblin Tinkerer, it might pay off to give the Bandit a visit. -DrunkPrincessTip: The Drunk Princess is great to party with. If you carry her favorite vodka, she might move in. SeaKingTip: The Sea King used to like clams. He changed his mind when he got eaten by one. AmidiasBlessingTip: The Sea King can provide a bubble to aid with breathing underwater to any who ask for help. ArchmageTip: The Archmage can be freed if you manage to destroy the cell he was imprisoned in. BrimstoneWitchTip: The Brimstone Witch can enchant your items to grant them new powers. TitanHeartTip: Titan Hearts can be used as an offering at a Beacon found in the Astral Infection. -NightProvTip: Summoning the Profaned Goddess under the light of the moon massively empowers her strength and endurance. DayEoLTip: Summoning the fae monarch under the light of day will start a vicious and persistent battle. BossEnemyTip: Killing the most harmless of enemies can awaken the wrath of a much stronger monster. Slay them at your own risk! RoDAbyssTip: Use the Rod of Discord in the Abyss at your own risk. The light left behind may attract the attention of unwanted foes. @@ -22,7 +20,6 @@ FactoryChargingTip: Power Cell Factories and Charging Stations can be looted fro StealthTip: Wearing any rogue class armor lets you build stealth! SummonNerfTip: Holding a non-summoner weapon reduces the damage of your minions. DefenseDamageTip: Certain attacks will chip away at your defense, but it will quickly regenerate afterward. -PointBlankTip: Ranged weapons fired at point blank will do a lot more damage. RevengeanceTip: Need a challenge beyond Expert Mode? Try Revengeance Mode! BloodOrbTip: Blood Orbs collected during the Blood Moon can craft almost any potion. KeybindsTip: Modded controls can be bound in Settings. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson index 1d3d11350b..b4429b069f 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.Wings.hjson @@ -8,15 +8,6 @@ AureateBooster: { ''' } -DrewsWings: { - DisplayName: Drew's Wings - Tooltip: - ''' - {$CommonItemTooltip.FlightAndSlowfall} - 'Absolutely Fabulous' - ''' -} - ElysianWings: { DisplayName: Elysian Wings Tooltip: @@ -31,7 +22,7 @@ ExodusWings: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - Grants permanent Empyrean Wrath and Empyrean Rage while wearing the Empyrean armor + Grants permanent Empyrean Wrath while wearing the Empyrean armor Pulsing with an alien heartbeat ''' } @@ -62,6 +53,7 @@ MOAB: { {$CommonItemTooltip.FlightAndSlowfall} 32% increased jump speed and allows auto-jump Grants the player cloud, blizzard, and sandstorm mid-air jumps + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:Jetpack] [c/aaaaaa:jetpack] 'The Mother Of All Balloons' ''' } @@ -112,9 +104,10 @@ TracersCelestial: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 24% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + 24% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Ludicrous speed!' ''' } @@ -124,9 +117,10 @@ TracersElysian: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 36% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire and lava + 36% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Ludicrous speed!' ''' } @@ -136,9 +130,19 @@ TracersSeraph: { Tooltip: ''' {$CommonItemTooltip.FlightAndSlowfall} - 50% increased running acceleration and greater mobility on ice - Provides the ability to walk on water, honey, and lava - Grants immunity to fire, lava, and harmful block effects + 50% increased running acceleration + Provides the effects of [i:CalamityMod/AngelTreads] Angel Treads + Provides immunity to lava and damaging tiles, including [i:CalamityMod/AuricOre] Auric Ore + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:AngelWings] [c/aaaaaa:wings] 'Taking speed EVEN FURTHER BEYOND!' ''' } + +WingsofRebirth: { + DisplayName: Wings of Rebirth + Tooltip: + ''' + {$CommonItemTooltip.FlightAndSlowfall} + 'Resplendent to the very end' + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 4fff7eafb6..2e82e9d3e5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -29,9 +29,8 @@ AbyssalDivingSuit: { The suit's armored plates increase damage reduction by 15% Wearing this suit grants 15% damage reduction for hits under 50 damage The suit can absorb up to 3 hits over 50 damage, and will take 3 minutes to regenerate - Reduces the damage caused by drowning in the abyss, and removes the bleed effect in the upper layers Grants the ability to swim, extends underwater breathing, emits light underwater, and improves mobility on ice - Provides a moderate amount of light and reduces breath loss in the abyss + Provides a moderate amount of light, reduces breath loss, and reduces damage caused by drowning in the abyss Abyss creatures are less likely to see you, mitigates the abyss' defense reduction, and lets you sink faster in liquids Grants immunity to the sulphurous waters and Crush Depth's increased breath loss Grants resistance to the increased breath loss caused by Hadopelagic Pressure @@ -66,7 +65,7 @@ AeroStone: { Affliction: { DisplayName: Affliction - Tooltip: Gives all teammates +0.5 HP/s life regen, +10% max life, 7% damage reduction, 13 defense and 10% increased damage + Tooltip: Gives all teammates +0.5 HP/s life regen, +10% max life, 7% damage reduction, 9 defense and 10% increased damage } AlchemicalFlask: { @@ -107,7 +106,7 @@ AmbrosialAmpoule: { ''' +50 max life Grants +2 to +5 HP/s life regen based on missing health - Standing still grants +1.5 HP/s life regen and +1 HP/s life regen when inflicted with a damage debuff + Grants the Honey buff Current boost: +[REGEN] HP/s Fire and sickness debuff durations are halved You emit yellow light if visibility is enabled @@ -152,10 +151,11 @@ AngelTreads: { DisplayName: Angel Treads Tooltip: ''' - 36% increased running acceleration - Increased flight time and grants rocket flight - Provides water walking and extra mobility on ice - Grants immunity to On Fire! and temporary immunity to lava + Allows flight, super fast running, and extra mobility on ice + {0}% increased movement speed and {1}% increased flight time + Provides the ability to walk on water, honey & lava + Grants immunity to fire blocks and {2} seconds of immunity to lava + Reduces damage from touching lava 'Extreme speed!' ''' } @@ -229,15 +229,7 @@ AsgardianAegis: { ''' Allows the ability to dash, empowered by a cosmic inferno This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Burning, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Acid Venom, Sulphuric Poisoning, Slow, Confused, - Silenced, Cursed, Darkness, Webbed, Mighty Wind, Stoned, Armor Crunch, Blackout, - Brain Rot, Burning Blood, Heavy Bleeding, Laceration, Cursed Inferno, Brimstone Flames, - Shadowflame, Daybroken, Nightwither, Holy Flames, Voidfrost, God Slayer Inferno + Grants immunity to knockback ''' } @@ -247,13 +239,7 @@ AsgardsValor: { ''' Allows the ability to ram dash This dash can ram through enemies without taking damage - Grants immunity to knockback and fire blocks, as well as multiple debuffs - ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Chilled, Frozen, Frostburn, Frostbite, Weak, - Broken Armor, Bleeding, Poisoned, Slow, Confused, Silenced, Cursed, - Darkness, Mighty Wind, Stoned, Brimstone Flames, Burning + Grants immunity to knockback ''' } @@ -289,7 +275,7 @@ BatholithBangle: { Tooltip: ''' Magic enemy hits create a powerful granite flash that always critically strikes - This effect has a 10 second cooldown, but is halved if the flash kills an enemy + This effect has a 10 second cooldown Visual and audio effects are reduced if visibility is disabled [c/0189D7:'The solid granite radiates energy throughout your body'] ''' @@ -310,6 +296,7 @@ BlazingCore: { DisplayName: Blazing Core Tooltip: ''' + Grants immunity to knockback The searing core of the Profaned Goddess Pressing [KEY] will activate a parry, encasing you in luminous profaned crystal Being hit shortly after encasement will shatter the crystal @@ -324,6 +311,7 @@ BloodflareCore: { DisplayName: Bloodflare Core Tooltip: ''' + Grants immunity to knockback Recovering defense damage heals you, each defense recovered gives 1 HP Taking damage converts at least half of your total defense in defense damage ''' @@ -341,7 +329,7 @@ BloodPact: { BloodstainedGlove: { DisplayName: Bloodstained Glove - Tooltip: Stealth strikes have +8 armor penetration and heal for 2 HP + Tooltip: Stealth strikes have +8 armor penetration and heal for 5 HP } BloodyWormScarf: { @@ -360,8 +348,8 @@ BloomStone: { ''' Healing Potions are 50% more effective, but provide their healing over time Grappling hooks retract and pull the player 50% faster, and grow a flower at hookpoints - Touching a flower makes it burst into pollen which gives a temporary 6% damage reduction boost - The damage reduction boost increases to 12% while receiving healing over time + Touching a flower makes it burst into pollen which gives a temporary boost to potion healing over time + Potion healing slows drastically when at full health 'One of the ancient relics' ''' } @@ -413,10 +401,13 @@ ChaosStone: { DisplayName: Chaos Stone Tooltip: ''' - Mana Sickness from drinking mana potions is replaced by Mana Burn - Mana Burn deals damage over time relative to the intensity of the debuff - This debuff does not reduce your magic damage - 'One of the ancient relics' + Disables automatic potion consumption + Items that consume mana can be used even without the required mana amount + Mana usage can overflow into negative mana, causing you to receive [Mana Burn] + The lower your mana, the more intense the manafire burns + Attacks while you have [Mana Burn] inflict [Mana Burn] on enemies + Every 50 negative mana increases [Mana Burn] by 1% of the attack's damage + Negative Mana is capped at your maximum mana amount ''' } @@ -433,7 +424,7 @@ CoinofDeceit: { DisplayName: Coin of Deceit Tooltip: ''' - Stealth strikes only expend 85% of your max stealth + Stealth strikes only expend 90% of your max stealth 6% increased rogue crit chance ''' } @@ -492,7 +483,6 @@ CrownJewel: { ''' +1 HP/s life regen You gain an additional +1.5 HP/s life regen while afflicted with any debuff - Massively boosts natural life regen while afflicted with any debuff ''' } @@ -544,6 +534,7 @@ DarkSunRing: { DisplayName: Dark Sun Ring Tooltip: ''' + Grants immunity to knockback 12% increased damage +0.5 HP/s life regen and +2 max minions Increased minion knockback @@ -552,8 +543,8 @@ DarkSunRing: { HoldShiftTooltip: ''' During the day, grants +2 HP/s life regen - During the night, grants +20 defense - During an eclipse, grants +1 HP/s life regen and +10 defense + During the night, grants +16 defense + During an eclipse, grants +1 HP/s life regen and +8 defense ''' FlavorTooltip: "'Contains the power of the dark sun'" } @@ -582,10 +573,13 @@ DeificAmulet: { DisplayName: Deific Amulet Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when hurt, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] ''' + ToggleEffect: "and increases movement speed " } DepthCharm: { @@ -593,11 +587,26 @@ DepthCharm: { Tooltip: ''' Reduces the damage caused by drowning in the abyss - Removes the bleed effect caused by the upper layers of the abyss Removes the increased breath loss of Crush Depth ''' } +DiamondOfTheDeep: { + DisplayName: Diamond of the Deep + Tooltip: + ''' + Multiplies all water debuff damage by 1.6x + Slowly accrue up to three different abyssal spirits + Dash to disperse the spirits and have them attack enemies + When dispersed [c/CB7AD7:below 50% life], the spirits support you instead + The spirits appear in order and have different effects based on color: + [c/3CB371: Explodes on impact and inflicts Crush Depth] / [c/CB7AD7:Heals for 8 HP] + [c/FF4500: Pierces enemies and inflicts Hellfire] / [c/CB7AD7:Increases defense by 10 temporarily] + [c/1E90FF: Hits multiple times and inflicts Hadopelagic Pressure] / [c/CB7AD7:Heals 5% of max HP] + Spirits are transparent and silent when visibility is toggled off + ''' +} + DimensionalSoulArtifact: { DisplayName: Dimensional Soul Artifact Tooltip: @@ -612,6 +621,7 @@ DraedonsHeart: { Tooltip: ''' {0}% reduced contact damage from enemies + Grants immunity to knockback [NANODESC] With full Nanomachines, press [KEY] to heal {1} health over {2} {^2:second;seconds} While healing, you take [DR]% less damage @@ -684,7 +694,7 @@ ElectriciansGlove: { DisplayName: Electrician's Glove Tooltip: ''' - Stealth strikes summon sparks on enemy hits and heal you for 2 HP + Stealth strikes summon sparks on enemy hits and heal you for 10 HP Stealth strikes also have +8 armor penetration and deal 8% more damage ''' } @@ -702,20 +712,20 @@ ElementalGauntlet: { ''' } +ElementalinaBottle: { + DisplayName: Elemental in a Bottle + Tooltip: Summons a sand elemental to fight for you +} + ElysianAegis: { DisplayName: Elysian Aegis Tooltip: ''' Allows the ability to dash, empowered by holy fire This dash can ram through enemies without taking damage - Grants immunity to knockback, fire blocks, as well as multiple debuffs + Grants immunity to knockback + 'Blessed by the Profaned Flame' ''' - HoldShiftTooltip: - ''' - On Fire!, Hellfire, Cursed Inferno, Shadowflame, Daybroken, - Holy Flames, Brimstone Flames, Burning - ''' - FlavorTooltip: "'Blessed by the Profaned Flame'" } EnchantedPearl: { @@ -744,7 +754,8 @@ EtherealTalisman: { 15% increased magic damage, 5% increased magic critical strike chance +150 max mana and 10% decreased mana usage Increases pickup range for mana stars - You automatically use mana potions when needed if visibility is on + You automatically use mana potions when needed + [c/aaaaaa:Shift- in your inventory to toggle] [i:ManaFlower] [c/aaaaaa:Mana Flower's effect] ''' } @@ -781,6 +792,7 @@ FlameLickedShell: { DisplayName: Flame-Licked Shell Tooltip: ''' + Grants immunity to knockback Pressing [KEY] will activate a parry, encasing you in rocks Being hit shortly after encasement will implode the rocks Upon implosion, a ring of brimstone hellfire is launched outwards and you receive 90% DR for that hit @@ -814,7 +826,7 @@ FrostFlare: { All attacks and projectiles inflict Frostbite Grants immunity to Frostburn, Chilled and Frozen Being above 50% life grants 10% increased damage - Being below 50% life grants 20 defense and 15% increased max movement speed and acceleration + Being below 50% life grants 15 defense and 15% increased max movement speed and acceleration Grants resistance against cold attacks ''' } @@ -833,7 +845,7 @@ FungalSymbiote: { Tooltip: ''' You grow mushrooms on the grass beneath you - Consuming mushrooms provides the Mushy buff, granting 8 defense and +1 HP/s life regen + Consuming mushrooms provides the Mushy buff, granting 5 defense and +1 HP/s life regen 10% increased damage while you have the Mushy buff ''' } @@ -879,7 +891,11 @@ GladiatorsLocket: { GloveOfPrecision: { DisplayName: Glove of Precision - Tooltip: Decreases rogue attack speed by 15%, but increases damage by 10%, crit by 15% and velocity by 15% + Tooltip: + ''' + Decreases rogue attack speed by 15% + Increases rogue damage and critical strike chance by 10%, and velocity by 15% + ''' } GloveOfRecklessness: { @@ -912,7 +928,7 @@ HallowedRune: { HoldShiftTooltip: ''' [c/8ce0ff: Hallowed Power] [c/ccf1ff: grants 10% increased summon damage and rains stars on enemies] - [c/d08aff: Hallowed Defense] [c/eed4ff: grants 8 defense and 4% damage reduction] + [c/d08aff: Hallowed Defense] [c/eed4ff: grants 4 defense and 4% damage reduction] [c/ff8cb5: Hallowed Regen] [c/ffccde: grants +1.5 HP/s life regen] ''' } @@ -940,10 +956,9 @@ HideofAstrumDeus: { DisplayName: Hide of Astrum Deus Tooltip: ''' - Taking damage or inflicting true melee strikes drops an immense amount of astral stars from the sky - Taking damage temporarily increases true melee damage by 30% + True melee strikes drops astral stars from the sky + Releases an explosion and temporarily increases true melee damage by 30% when damaged Boost duration scales with the amount of damage you took, up to 10 seconds - Attackers take damage and are inflicted with Astral Infection Nullifies the Astral Infection debuff ''' } @@ -952,9 +967,8 @@ HoneyDew: { DisplayName: Honey Dew Tooltip: ''' - +30 max life - Grants +1 HP/s life regen, and +1 HP/s life regen when inflicted with a damaging debuff - Standing still in Honey grants +1.5 HP/s life regen + +10 max life + Grants the Honey buff Sickness debuff durations are halved ''' } @@ -983,10 +997,9 @@ InfectedJewel: { Tooltip: ''' Passively grants +1 HP/s life regen - Grants 16 defense and +2 HP/s life regen while afflicted with any debuff - Massively boosts natural life regen while afflicted with any debuff + Grants 12 defense and +2 HP/s life regen while afflicted with any debuff Granted defense fades away quickly when not afflicted with any debuffs - Each debuff beyond the first grants 5 additional defense + Each debuff beyond the first grants 4 additional defense Nullifies the Astral Infection debuff 'A beautiful gemstone tarnished by spaceborne rot' ''' @@ -996,8 +1009,9 @@ InkBomb: { DisplayName: Ink Bomb Tooltip: ''' - Throws several ink bombs when hit that explode into ink - Gain a lot of stealth and confuse enemies when struck + Stealth generates 7% faster + Throws several ink bombs when hit that explode into ink and confuse enemies + Gain a lot of stealth when struck This effect has a 20 second cooldown before it can occur again ''' } @@ -1007,8 +1021,8 @@ InterstellarStompers: { Tooltip: ''' 6% increased movement speed, 20% increased jump speed, and negates fall damage - Hold DOWN to increase your maximum fall speed - Hold [KEY] for 0.5 seconds while midair to charge up a superspeed slam + Hold {$Key.DOWN} to increase your maximum fall speed + Pressing [KEY] while midair charges up a superspeed slam over 0.33 seconds While falling, you ram through enemies and don't take contact damage Once you hit the ground, you create an explosion at your feet The explosion scales in both damage and size the longer you slam for @@ -1020,7 +1034,7 @@ IronBoots: { DisplayName: Iron Boots Tooltip: ''' - Hold DOWN to increase your maximum fall speed, even in water + Hold {$Key.DOWN} to increase your maximum fall speed, even in water Upon hitting the ground, a shockwave is created at your feet The shockwave scales in both damage and size the longer you fall for Negates fall damage @@ -1073,29 +1087,12 @@ LivingDew: { DisplayName: Living Dew Tooltip: ''' - +50 max life - Grants +1 HP/s life regen and an additional 1 HP/s life regen when inflicted with a damaging debuff - Standing still in Honey grants +1.5 HP/s life regen + +25 max life + Grants the Honey buff Fire and sickness debuff durations are halved ''' } -DiamondOfTheDeep: { - DisplayName: Diamond of the Deep - Tooltip: - ''' - Multiplies all water debuff damage by 1.75x - Slowly accrue up to three different abyssal spirits - Dash to disperse the spirits and have them attack enemies - When dispersed [c/CB7AD7:below 50% life], the spirits support you instead - The spirits appear in order and have different effects based on color: - [c/3CB371: Explodes on impact and inflicts Crush Depth] / [c/CB7AD7:Heals for 8 HP] - [c/FF4500: Pierces enemies and inflicts Hellfire] / [c/CB7AD7:Increases defense by 15 temporarily] - [c/1E90FF: Hits multiple times and inflicts Hadopelagic Pressure] / [c/CB7AD7:Heals 5% of max HP] - Spirits are transparent and silent when visibility is toggled off - ''' -} - LuxorsGift: { DisplayName: Luxor's Gift Tooltip: @@ -1111,10 +1108,12 @@ ManaPolarizer: { DisplayName: Mana Polarizer Tooltip: ''' - Increases max mana by 50 and magic damage by 6% - -1.5 HP/s life regen if mana is above 50% of its maximum + Increases max mana by 50 + Provides life regeneration and magic damage that scales based on how much mana you have + Lower mana means more life regeneration, but less magic damage + These scale from -2 to 2 HP/sec, and 5% to 15% damage + The provided regeneration is halved when under Mana Sickness Magic projectiles steal enemy life while holding a magic weapon - The more mana you have, the more you heal ''' } @@ -1244,6 +1243,7 @@ OldDukeScales: { DisplayName: Old Duke's Scales Tooltip: ''' + Grants immunity to knockback 10% increased damage reduction, max movement speed, and acceleration 25% increased dash velocity and length Adds a stamina tracker to the cooldown rack @@ -1266,7 +1266,6 @@ OrnateShield: { ''' Allows the ability to dash This dash can ram through enemies without taking damage - Grants immunity to Chilled, Frostburn, Frostbite, and Frozen ''' } @@ -1379,7 +1378,7 @@ ProtolithBangle: { Tooltip: ''' Ranged enemy hits create a marble flash that always critically strikes and can hit multiple enemies - This effect has a 7 second cooldown, but is halved if the flash kills the first enemy it hits + This effect has a 7 second cooldown Visual and audio effects are reduced if visibility is disabled [c/C5B965:'The cold marble against your wrist puts your mind at ease'] ''' @@ -1412,9 +1411,9 @@ Radiance: { [c/CDF69C:Grants +2 to +5 HP/s life regen based on missing health] [c/CDF69C:Recover an additional 6 HP/s while inflicted with a debuff] [c/CDF69C:This eventually slows to 1.33 HP/s when debuffed for an extended time period] - [c/CDF69C:Standing still provides +2 HP/s life regen and faster natural regen recovery] - [c/CDF69C:+20 defense and faster natural regen recovery while afflicted with any debuff] - [c/CDF69C:Each additional debuff grants 8 defense, which slowly decays while not debuffed] + [c/CDF69C:Grants the Honey buff] + [c/CDF69C:Grants 15 defense while afflicted with any debuff] + [c/CDF69C:Each additional debuff grants 5 defense, which slowly decays while not debuffed] [c/CDF69C:Weak damaging debuffs are harmless and halves the duration of most other debuffs] ''' } @@ -1423,7 +1422,7 @@ RadiantOoze: { DisplayName: Radiant Ooze Tooltip: ''' - Grants +2 to +6 HP/s life regen based on missing health + Grants +2 to +5 HP/s life regen based on missing health Current boost: +[REGEN] HP/s You emit yellow light if visibility is enabled ''' @@ -1438,13 +1437,25 @@ RampartofDeities: { DisplayName: Rampart of Deities Tooltip: ''' - Causes stars to fall and increases length of invincibility after taking damage - Grants bonus invincibility frames based on your missing health + Releases a burst of homing stars [TOGGLE]after taking damage + Increases the length of invincibility from various sources + Grants bonus invincibility frames when struck, based on your missing health This effect scales from 10 frames at full HP to 40 frames at 25% or less HP Being struck for over 200 damage grants 30 additional invincibility frames Grants immunity to knockback - Puts a shell around the owner when below 50% life that reduces damage taken + Puts a shell around the owner when below 50% life that reduces damage by 25% Absorbs 25% of damage done to players on your team when above 25% life + [c/aaaaaa:Shift- this item in your inventory to toggle] [i:PanicNecklace] [c/aaaaaa:Panic Necklace's effect] + ''' + ToggleEffect: "and increases movement speed " +} + +RareElementalinaBottle: { + DisplayName: Rare Elemental in a Bottle + Tooltip: + ''' + Summons a sand elemental to heal you + ;D ''' } @@ -1458,13 +1469,13 @@ ReaperToothNecklace: { ''' } -Regenator: { - DisplayName: Regenator +Regenerator: { + DisplayName: Regenerator Tooltip: ''' - Your health cannot exceed 50% of its maximum + Your health cannot exceed {0}% of its maximum Increases length of invincibility after taking damage - Provides powerful special life regen to heal you for 8.5 HP/s + Provides powerful special life regen to heal you for {1} HP/s All normal life regen is negated and converted into damage Current damage boost: [DAMAGE]% ''' @@ -1499,9 +1510,9 @@ RoverDrive: { DisplayName: Rover Drive Tooltip: ''' - Gain a barrier with 20 health, which grants 10 defense while active + Gain a barrier with {0} health [ADREN] - If depleted, the barrier's health regenerates after not receiving damage for 10 seconds + The barrier will regenerate {1} seconds after being hit, taking {2} seconds to completely regenerate Getting hit resets the timer Can also be scrapped at an extractinator ''' @@ -1517,22 +1528,13 @@ RuinMedallion: { ''' } -RustyMedallion: { - DisplayName: Rusty Medallion - Tooltip: - ''' - Causes most ranged weapons to release acid droplets from the sky - Grants immunity to Irradiated - ''' -} - SandCloak: { DisplayName: Sand Cloak Tooltip: ''' Dashing creates a large protective sand veil which damages enemies inside it The sand veil lasts 15 seconds, but dissipates early if you dash again - The veil slowly follows you, and any player inside it gains 10 defense and 1.75x acceleration + The veil slowly follows you, and any player inside it gains 4 defense and 1.75x acceleration After dissipating, the sand veil has a 15 second cooldown before it can be used again ''' } @@ -1546,11 +1548,22 @@ SandSharkToothNecklace: { ''' } +ScionsCurio: { + DisplayName: Scions Curio + Tooltip: + ''' + Ranged hits increase the effectiveness of the Irradiated debuff + Irradiated damage over time scales off of your ranged damage and crit chance + On kill, enemies burst, spreading Irradiated + Taking damage causes the curio to explode in retaliation + ''' +} + ScuttlersJewel: { DisplayName: Scuttler's Jewel Tooltip: ''' - Stealth strike projectiles spawn a jewel spike when destroyed + Stealth strike projectiles spawn a jewel spike on hit or when destroyed Can also be broken down at an extractinator ''' } @@ -1644,8 +1657,9 @@ SlagsplitterPauldron: { DisplayName: Slagsplitter Pauldron Tooltip: ''' - You gain 10% damage reduction while dashing, and enemies are inflicted with Armor Crunch - Your dashes are empowered by fire, shredding enemies near you with violent explosions + Your dashes become empowered by flame, erupting on contact with enemies + Grants immunity to knockback and 10% damage reduction while dashing + Enemies hit by your dashes have their armor crushed Visual effects are reduced if visibility is disabled ''' } @@ -1673,7 +1687,7 @@ SpiritGlyph: { HoldShiftTooltip: ''' [c/8ce0ff: Spirit Power] [c/ccf1ff:grants 10% increased summon damage] - [c/d08aff: Spirit Defense] [c/eed4ff:grants 6 defense and 3% damage reduction] + [c/d08aff: Spirit Defense] [c/eed4ff:grants 4 defense] [c/ff8cb5: Spirit Regen] [c/ffccde:grants +1 HP/s life regeneration] ''' } @@ -1722,12 +1736,13 @@ StatisNinjaBelt: { DisplayName: Statis' Ninja Belt Tooltip: ''' - Provides a high-speed dash that scales with your movement speed + Provides a high-speed dash 10% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage Increases movement acceleration and deceleration by 1.6x - Grants the ability to swim, climb walls, and dodge attacks - Consecutive dashes in the same direction reduce dash speed + Grants the ability to swim[TOGGLE] and dodge attacks + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' + ToggleEffect: ", climb walls," HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1735,13 +1750,14 @@ StatisVoidSash: { DisplayName: Statis' Void Sash Tooltip: ''' - Provides a high-speed dash that scales with your movement speed + Provides a high-speed dash 20% increased movement speed, 32% increased jump speed, allows auto-jump, and negates fall damage Increases movement acceleration and deceleration by 1.85x - Grants the ability to swim, climb walls, and dodge attacks + Grants the ability to swim[TOGGLE] and dodge attacks Visual effects are reduced if visibility is disabled - Consecutive dashes in the same direction reduce dash speed + [c/aaaaaa:Shift- this item in your inventory to toggle the] [i:ClimbingClaws] [c/aaaaaa:Climbing Claws] ''' + ToggleEffect: ", climb walls," HoldShiftTooltip: "{$Common.DodgeInformation}" } @@ -1785,8 +1801,8 @@ StatMeter: { AttackSpeed: Attack Speed: {0}% WhipMeleeInheritance: " [{0}% from melee]" // Class stats - RangedStats: Ammo Consumption Chance: {0} - MagicStats: Mana Usage: {0}% | Mana Regen: {1} + AmmoStats: Ammo Consumption Chance: {0}% + ManaStats: Mana Usage: {0}% | Mana Regen: {1} SummonStats: Minion Slots: {0} | Sentry Slots: {1} WhipStats: Whip Range: {0}% RogueStats: @@ -1811,9 +1827,9 @@ StatMeter: { AbyssStats: ''' Abyss Light Strength: {0} - Breath Lost Per Tick: {1} | Breath Loss Rate: {2} - Life Lost Per Tick at Zero Breath: {3} - Defense Lost From Pressure: {4} + Breath Loss Rate: {1} + Life Lost Per Tick at Zero Breath: {2} + Defense Lost From Pressure: {3} ''' AbyssStatsHidden: Abyss stats are only displayed while in the Abyss } @@ -1865,7 +1881,7 @@ TheAmalgam: { Tooltip: ''' 10% increased damage - All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3.5x + All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3x Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds @@ -1891,7 +1907,7 @@ TheCamper: { DisplayName: The Camper Tooltip: ''' - You deal 90% less damage unless stationary + You deal 50% less damage unless stationary Standing still grants buffs depending on held item, and creates a damaging aura around you While moving, you regenerate health as if standing still {$Common.AbyssLightLevel1} @@ -1905,7 +1921,7 @@ TheCommunity: { ''' [STATS] 'The heart of (most of) the Terraria community' - [c/B00BA5:Thank you to all of my supporters who made this mod a reality!] + Thank you to all of our supporters who made this mod a reality! ''' StatsList: ''' @@ -1941,10 +1957,11 @@ TheSponge: { DisplayName: The Sponge Tooltip: ''' - Gain a barrier with 180 health - The barrier grants 20 defense and 10% damage reduction while active + Grants immunity to knockback + Gain a barrier with {0} health + The barrier grants {1}% damage reduction while active [ADREN] - The barrier will regenerate 8 seconds after being hit, taking 10 seconds to completely regenerate + The barrier will regenerate {2} seconds after being hit, taking {3} seconds to completely regenerate Getting hit resets the timer ''' ShieldAdren: Halved Adrenaline loss if all damage is absorbed @@ -1988,7 +2005,7 @@ TrinketofChi: { ''' Increases damage reduction by 8% if you avoid taking damage for 10 seconds This buff expires on hit - +1 HP/s life regen for teammates + +1 HP/s life regen for you and your teammates ''' } @@ -2069,20 +2086,6 @@ WarbanneroftheRighteous: { ''' } -WifeinaBottle: { - DisplayName: Elemental in a Bottle - Tooltip: Summons a sand elemental to fight for you -} - -WifeinaBottlewithBoobs: { - DisplayName: Rare Elemental in a Bottle - Tooltip: - ''' - Summons a sand elemental to heal you - ;D - ''' -} - WulfrumAcrobaticsPack: { DisplayName: Wulfrum Acrobatics Pack Tooltip: @@ -2091,9 +2094,9 @@ WulfrumAcrobaticsPack: { This slingshot's stats scale with your equipped hook If the hook has special effects, the slingshot also benefits from them The slingshot allows for advanced rope-swinging physics - Hold UP or DOWN to retract or extend the slingshot's rope + Hold {$Key.UP} or {$Key.DOWN} to retract or extend the slingshot's rope Automatically grapples nearby walls if a lethal fall is detected - This safety feature won't activate if DOWN is held + This safety feature won't activate if {$Key.DOWN} is held 8% increased movement speed ''' } @@ -2113,6 +2116,7 @@ YharimsGift: { DisplayName: Yharim's Gift Tooltip: ''' + Grants immunity to knockback Flaming meteors rain down after getting hit Volatile dragon dust trails behind you Increases damage and movement speed by 15% @@ -2133,11 +2137,6 @@ AbandonedWulfrumHelmet: { ''' } -CrystalHeartVodka: { - DisplayName: Crystal Heart Vodka - Tooltip: "'Tastes like strawberry cream liqueur (and estrogen)'" -} - GhostBracelet: { DisplayName: Ghost Bracelet Tooltip: Wow.... It looks at me with its hollow eyes full of curiosity @@ -2153,6 +2152,11 @@ HapuFruit: { Tooltip: "'A fruit that calms your nerves (may have unintended side effects)'" } +LucisSight: { + DisplayName: Luci's Sight + Tooltip: "'Fashionable glasses? In Earthia's current economy?!'" +} + OracleHeadphones: { DisplayName: Oracle Headphones Tooltip: "'Hey game's over!'" @@ -2195,7 +2199,7 @@ XyksBlessingBlue: { DisplayName: Xyk's Blessing (Blue) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'It's simply too much to turn back now; passion and time have long since stained it. [c/5f8ae1:Have I always been so selfish?'] @@ -2206,7 +2210,7 @@ XyksBlessingOrange: { DisplayName: Xyk's Blessing (Orange) Tooltip: ''' - Applies visual effects to your dashes and deaths + Applies visual effects to your dashes, wings, and deaths to transform 'Even so, the march of time waits for none. Recall that feeling of fulfillment, and show it to the world. [c/E1B65F:Prove that it was never a waste.'] diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 08fb1ba71e..6f12eb6c9d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -2,21 +2,22 @@ AstralBreastplate: { DisplayName: Astral Breastplate Tooltip: ''' - 7% increased damage - +80 max mana and +20 max life + {$CommonItemTooltip.IncreasesMaxManaBy} + {$CommonItemTooltip.PercentIncreasedDamage@1} + {$Common.AmmoUseReduction@2} ''' } AstralHelm: { DisplayName: Astral Helm - Tooltip: 5% increased damage and 10% increased critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" SetBonus: ''' - +3 max minions - 10% increased damage and critical strike chance + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedDamageCritChance@1} Detects nearby creatures, enemy projectiles, danger sources, and treasure Whenever you crit an enemy, a barrage of stars will rain down - This effect has a 1 second cooldown before it can trigger again + This effect has a {2} {^2:second;seconds} cooldown before it can trigger again ''' } @@ -24,8 +25,8 @@ AstralLeggings: { DisplayName: Astral Leggings Tooltip: ''' - 5% increased damage - 15% increased movement speed + {$CommonItemTooltip.PercentIncreasedDamage} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -33,79 +34,59 @@ BrimflameBoots: { DisplayName: Brimflame Boots Tooltip: ''' - 5% increased magic damage - 5% increased movement speed + {$CommonItemTooltip.PercentIncreasedMagicDamage} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} + ''' +} + +BrimflameCowl: { + DisplayName: Brimflame Cowl + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamageCritChance@2} + Immunity to On Fire!, Brimstone Flames and Frostburn + ''' + SetBonus: + ''' + {$CommonItemTooltip.PercentIncreasedMagicDamageCritChance} + [c/{1}:Brimflame Frenzy - {2} for {3} {^3:second;seconds} of {$CommonItemTooltip.PercentIncreasedMagicDamage@4}] + [c/FF9173:However, this inflicts rapid life loss and disables mana regeneration and mana potions] + [c/FF9173:This effect can be toggled off and has a cooldown of {5} {^5:second;seconds}] ''' } BrimflameRobes: { DisplayName: Brimflame Robes - Tooltip: 5% increased magic damage and critical strike chance -} - -BrimflameScowl: { - DisplayName: Brimflame Cowl - Tooltip: - ''' - 5% increased magic damage and critical strike chance - Increases maximum mana by 80 and reduces mana usage by 10% - Immunity to On Fire!, Brimstone Flames and Frostburn - ''' - SetBonus: - ''' - Grants an additional 15% increased magic damage and critical strike chance - Press {0} to trigger a brimflame frenzy effect - While under this effect, you get an additional 40% increase to magic damage - However, this inflicts rapid life loss and disables mana regeneration and mana potions - This can be toggled off, however, brimflame frenzy has a 30 second cooldown - ''' -} - -CirrusDress: { - DisplayName: Cirrus' Dress - Tooltip: - ''' - 5% increased magic damage and critical strike chance - 20% decreased movement speed and increases maximum fall speed to 61 mph - Allows for drinking 5 alcohols before your liver is poisoned - [c/B00BA5:'Here, this should help you drink a lot more than usual!'] - 'You feel thick...' - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedMagicDamageCritChance}" } DaedalusBreastplate: { DisplayName: Daedalus Breastplate - Tooltip: 3% increased damage and critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage}" } DaedalusHeadMagic: { DisplayName: Daedalus Hood Tooltip: ''' - 13% increased magic damage and 7% increased magic critical strike chance - 10% reduced mana usage and +60 max mana - ''' - SetBonus: - ''' - 5% increased magic damage - You have a 10% chance to absorb physical attacks and projectiles when hit - If you absorb an attack you are healed for 1/2 of that attack's damage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} ''' + SetBonus: You have a {0}% chance to heal back {1}% of taken damage } DaedalusHeadMelee: { DisplayName: Daedalus Helm Tooltip: ''' - 15% increased melee damage - 10% increased melee critical strike chance + {$CommonItemTooltip.PercentIncreasedMeleeDamageCritChance} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@1} ''' SetBonus: ''' - 10% increased melee speed - Enemies are more likely to target you - You reflect projectiles back at enemies - Reflected projectiles deal 50% less damage to you + {$Common.AggroBoost} + You reflect projectiles back at enemies, negating their damage {$Common.ReflectInformation} ''' } @@ -114,37 +95,37 @@ DaedalusHeadRanged: { DisplayName: Daedalus Headgear Tooltip: ''' - 13% increased ranged damage and 7% increased ranged critical strike chance - Reduces ammo usage by 20% - ''' - SetBonus: - ''' - 5% increased ranged damage - Getting hit causes you to emit a blast of crystal shards + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} ''' + SetBonus: Getting hit causes you to emit a blast of crystal shards } DaedalusHeadRogue: { DisplayName: Daedalus Facemask Tooltip: ''' - 13% increased rogue damage and 7% increased rogue critical strike chance - 15% increased rogue velocity and 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$Common.RogueVelocity@2} and {$CommonItemTooltip.PercentIncreasedMovementSpeed@3} ''' SetBonus: ''' - 5% increased rogue damage - +105 maximum stealth + {$Common.RogueStealth} Rogue projectiles throw out crystal shards as they travel ''' } DaedalusHeadSummon: { DisplayName: Daedalus Mask - Tooltip: 5% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - 20% increased summon damage and +2 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} A daedalus crystal floats above you to protect you ''' } @@ -153,8 +134,8 @@ DaedalusLeggings: { DisplayName: Daedalus Leggings Tooltip: ''' - 3% increased critical strike chance - 10% increased movement speed + {$CommonItemTooltip.PercentIncreasedCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -162,9 +143,9 @@ FathomSwarmerBoots: { DisplayName: Fathom Swarmer Greaves Tooltip: ''' - 8% increased summon damage + {$CommonItemTooltip.PercentIncreasedSummonDamage} Grants the ability to swim - Movement speed increased by 40% while submerged in liquid + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} while submerged in liquid ''' } @@ -172,9 +153,8 @@ FathomSwarmerBreastplate: { DisplayName: Fathom Swarmer Breastplate Tooltip: ''' - 6% increased damage reduction - Increases your max number of minions by 1 - 10% increased summon damage + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Reduces defense loss within the Abyss ''' } @@ -183,29 +163,30 @@ FathomSwarmerVisage: { DisplayName: Fathom Swarmer Visage Tooltip: ''' - Increases your max number of minions by 1 - 8% increased summon damage + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Provides breathing and light underwater ''' SetBonus: ''' - 10% increased summon damage and +2 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Grants the ability to climb walls - 20% increased summon damage, +10 defense and +2.5 HP/s life regen while underwater + {$CommonItemTooltip.PercentIncreasedSummonDamage@2}, +{3} defense and +{4} HP/s life regen while underwater Provides a moderate amount of light and moderately reduces breath loss in the abyss ''' } ForbiddenCirclet: { DisplayName: Forbidden Circlet - Tooltip: 10% increased summon damage and 15% increased rogue velocity + Tooltip: "{$CommonItemTooltip.PercentIncreasedSummonDamage} and {$Common.RogueVelocity@1}" SetBonus: ''' - +40 maximum stealth - Press {0} to call an ancient storm to the cursor location - The ancient storm costs {1} mana and benefits from both summon and rogue bonuses - Rogue stealth strikes spawn homing eaters on enemy hits - Rogue and summon attacks will scale off of the stat with a higher boost + {$Common.RogueStealth} + {1} to call an ancient storm to the cursor location + The ancient storm costs {2} mana and benefits from both summon and rogue bonuses + Rogue stealth strikes will tag enemies, causing summons to spawn homing eaters on hit + Using summon weapons no longer reset your stealth Minions no longer deal less damage while wielding rogue weapons ''' } @@ -214,12 +195,12 @@ HydrothermicArmor: { DisplayName: Hydrothermic Armor Tooltip: ''' - +20 max life - 8% increased damage and 4% increased critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} + Grants immunity to fire and lava ''' CommonSetBonus: ''' - Inferno effect when below 50% life + Inferno effect when below {0}% life You emit a blazing explosion when you are hit ''' } @@ -228,13 +209,13 @@ HydrothermicHeadMagic: { DisplayName: Hydrothermic Mask Tooltip: ''' - 12% increased magic damage, +100 max mana, and 10% increased magic critical strike chance - Grants immunity to fire and lava + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} ''' SetBonus: ''' - 5% increased magic damage and 15% reduced mana usage Magic attacks summon damaging and healing flare orbs on hit + {$HydrothermicArmor.CommonSetBonus} ''' } @@ -242,15 +223,14 @@ HydrothermicHeadMelee: { DisplayName: Hydrothermic Helm Tooltip: ''' - 17% increased melee damage and 10% increased melee critical strike chance - Melee attacks and melee projectiles inflict on fire - Grants immunity to fire and lava + {$CommonItemTooltip.PercentIncreasedMeleeDamage} and {$CommonItemTooltip.PercentIncreasedMeleeCritChance@1} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} ''' SetBonus: ''' - 15% increased melee speed - Enemies are more likely to target you + {$Common.AggroBoost} Melee attacks and projectiles cause chaos flames to erupt on enemy hits + {$HydrothermicArmor.CommonSetBonus} ''' } @@ -258,14 +238,13 @@ HydrothermicHeadRanged: { DisplayName: Hydrothermic Headgear Tooltip: ''' - 12% increased ranged damage and 10% increased ranged critical strike chance - Reduces ammo usage by 25% - Grants immunity to fire and lava + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} ''' SetBonus: ''' - 5% increased ranged damage - You fire a homing chaos flare when using ranged weapons every 0.33 seconds + You fire a homing chaos flare when using ranged weapons every {0} seconds + {$HydrothermicArmor.CommonSetBonus@1} ''' } @@ -273,15 +252,14 @@ HydrothermicHeadRogue: { DisplayName: Hydrothermic Hood Tooltip: ''' - 12% increased rogue damage and 10% increased rogue critical strike chance - 5% increased movement speed - Grants immunity to fire and lava + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' SetBonus: ''' - 5% increased rogue damage - +110 maximum stealth - Rogue weapons unleash a volley of homing chaos flames around the player every 2 seconds + {$Common.RogueStealth} + Rogue weapons unleash a volley of homing chaos flames around the player every {1} seconds + {$HydrothermicArmor.CommonSetBonus@2} ''' } @@ -289,13 +267,15 @@ HydrothermicHeadSummon: { DisplayName: Hydrothermic Helmet Tooltip: ''' - 5% increased summon damage and increased minion knockback - Grants immunity to fire and lava + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} ''' SetBonus: ''' - 40% increased summon damage and +2 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Summons a hydrothermic vent to protect you + {$HydrothermicArmor.CommonSetBonus@2} ''' } @@ -303,8 +283,8 @@ HydrothermicSubligar: { DisplayName: Hydrothermic Subligar Tooltip: ''' - 5% increased critical strike chance - 10% increased movement speed + {$CommonItemTooltip.PercentIncreasedCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -312,9 +292,8 @@ LunicCorpsBoots: { DisplayName: Lunic Corps Boots Tooltip: ''' - 15% increased movement speed - 5% increased ranged critical strike chance - 10% increased max movement speed and acceleration + {$CommonItemTooltip.PercentIncreasedRangedCritChance} + {1}% increased movement speed and acceleration ''' } @@ -322,30 +301,27 @@ LunicCorpsHelmet: { DisplayName: Lunic Corps Helmet Tooltip: ''' - 15% increased ranged damage - Night vision and creature detect + Increases non-bow damage by {0}% + Improves vision and shows the location of enemies ''' SetBonus: ''' - 'Finish the fight' - Projects a bubble shield that absorbs up to 50 damage {0} - The shield starts recharging 5 seconds after being hit - Recharging from zero to full charge takes 2 seconds - Being hit again while recharging restarts the charge timer - 15% increased bullet damage - 15% increased specialist ranged damage - These are launchers, dartguns, or anything else that doesn't shoot arrows/bullets - 20% increased jump speed + {0}% increased jump speed + [c/{1}:MJOLNIR Shield - Projects a bubble shield that absorbs up to {2} damage]{3} + [c/52CBDE:The shield starts recharging {4} {^4:second;seconds} after being hit] + [c/52CBDE:Recharging from zero to full charge takes {5} {^5:second;seconds}] + [c/52CBDE:Being hit again while recharging restarts the charge timer] + [c/9EA67F:'Finish the fight'] ''' - ShieldAdren: Halves Adrenaline lost on hit if the shield fully absorbs the hit + ShieldAdren: "[c/52CBDE:Halves Adrenaline lost on hit if the shield fully absorbs the hit]" } LunicCorpsVest: { DisplayName: Lunic Corps Vest Tooltip: ''' - 5% increased ranged damage - 15% increased ranged critical strike chance + {$CommonItemTooltip.PercentIncreasedRangedDamageCritChance} + {$Common.AmmoUseReduction@1} ''' } @@ -353,7 +329,7 @@ MolluskShelleggings: { DisplayName: Mollusk Shelleggings Tooltip: ''' - 6% increased damage and 4% increased critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} Your horizontal movement is slowed ''' } @@ -362,14 +338,14 @@ MolluskShellmet: { DisplayName: Mollusk Shellmet Tooltip: ''' - 5% increased damage and 4% increased critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} You can move freely through liquids Your horizontal movement is slowed ''' SetBonus: ''' + {0}% increased damage reduction Two shellfishes aid you in combat - 10% increased damage reduction ''' } @@ -377,7 +353,7 @@ MolluskShellplate: { DisplayName: Mollusk Shellplate Tooltip: ''' - 6% increased damage and 5% increased critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} Your horizontal movement is slowed ''' } @@ -386,9 +362,9 @@ PlaguebringerCarapace: { DisplayName: Plaguebringer Carapace Tooltip: ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Grants immunity to the Plague - 15% increased summon damage - Friendly bees inflict the plague ''' } @@ -396,8 +372,9 @@ PlaguebringerPistons: { DisplayName: Plaguebringer Pistons Tooltip: ''' - 15% increased summon damage and 15% increased movement speed - You grow flowers on the grass beneath you, chance to grow very random dye plants on grassless dirt + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} and {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} + Flowers grow on the grass you walk on, and dye plants rarely grow on grassless dirt you walk on ''' } @@ -405,27 +382,31 @@ PlaguebringerVisor: { DisplayName: Plaguebringer Visor Tooltip: ''' - 15% increased summon damage - +20 max life + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} ''' SetBonus: ''' Grants a plague dash which can slam through enemies without taking damage Summons a lil' plaguebringer which swarms your foes with little bees - +3 max minions + Friendly bees inflict the plague ''' } PlagueReaperMask: { DisplayName: Plague Reaper Mask - Tooltip: 10% increased ranged damage and 8% increased ranged critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: ''' - 25% reduced ammo usage and 5% increased flight time - Enemies receive 10% more damage from ranged projectiles when afflicted by the Plague - Getting hit causes plague cinders to rain from above - Press {0} to blind yourself for 5 seconds but massively boost your ranged damage - This has a 25 second cooldown. + {0}% increased flight time + Enemies afflicted by the Plague take {1}x damage from ranged projectiles + [c/{2}:Plague Blackout - {3} to greatly empower your damage but completely blind yourself] + [c/009418:{$CommonItemTooltip.PercentIncreasedRangedDamage@4} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@5} while blacked out] + [c/009418:This effect lasts {6} {^6:second;seconds} and has a cooldown of {7} {^7:second;seconds}] ''' } @@ -433,8 +414,8 @@ PlagueReaperStriders: { DisplayName: Plague Reaper Striders Tooltip: ''' - 3% increased ranged critical strike chance - 15% increased movement speed + {$CommonItemTooltip.PercentIncreasedRangedCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -442,102 +423,85 @@ PlagueReaperVest: { DisplayName: Plague Reaper Vest Tooltip: ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} Grants immunity to the Plague - 15% increased ranged damage and 5% increased ranged critical strike chance ''' } ReaverCuisses: { DisplayName: Reaver Cuisses - Tooltip: - ''' - 5% increased critical strike chance - 12% increased movement speed - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedMovementSpeed}" } ReaverHeadExplore: { DisplayName: Reaver Headgear Tooltip: ''' - 20% increased mining speed - 50% increased block & wall placement speed + {0}% increased mining speed + {1}% increased block & wall placement speed Grants immunity to lava and can move freely through liquids ''' SetBonus: ''' - Summons an orb which highlights nearby treasure and provides light - Grants underwater breathing and reduced enemy aggression + Emits light and shows the location of treasure and ore + {$Common.AggroReduction} and grants underwater breathing These have a moderate effect while in the Abyss - Increased block placement & tool range by 7 + Increased block placement & tool range by {0} Increases pickup range for items ''' } ReaverHeadMobility: { DisplayName: Reaver Visage - Tooltip: 10% increased jump speed and 15% increased movement speed + Tooltip: "{$CommonItemTooltip.PercentIncreasedMovementSpeed} and {1}% increased jump speed" SetBonus: ''' Grants immunity to fall damage and allows constant jumping - 10% increased flight time and horizontal wing speed - Hooks fly out and retract 50% faster - Reduces the cooldown of dashes + {0}% increased flight time and horizontal wing speed + Grappling hooks retract and pull the player {1}% faster + Reduces the cooldown of dashes by {2}% ''' } ReaverHeadTank: { DisplayName: Reaver Helm - Tooltip: - ''' - 15% increased damage reduction but 30% decreased damage - +50 max life - Restores 1 HP every second, this applies separately from life regen - ''' + Tooltip: +{0} max life and +{1} HP/s life regen SetBonus: ''' - +10 defense and +1.5 HP/s life regen - Enemies are more likely to target you - Reduces the life regen lost from damage over time debuffs by 20% - All attacks steal life and speed up the rate of life regen - 30% decreased movement speed and flight time - Enemy damage is reflected and summons a thorn spike - Reaver Rage activates when you are damaged + {$Common.AggroBoost} + Reduces the life regen lost from damage over time debuffs by {0}% + {1}% decreased movement speed and flight time + Grants Reaver Rage for {2} {^2:second;seconds} after taking damage ''' } ReaverScaleMail: { DisplayName: Reaver Scale Mail - Tooltip: - ''' - 9% increased damage and 4% increased critical strike chance - +20 max life - ''' + Tooltip: "{0}% increased damage reduction" } TitanHeartBoots: { DisplayName: Titan Heart Boots - Tooltip: 4% increased rogue damage, 10% increased rogue velocity, and 5% increased rogue knockback + Tooltip: "{$Common.RogueDamage}" } TitanHeartMantle: { DisplayName: Titan Heart Mantle - Tooltip: 5% boosted rogue damage and knockback + Tooltip: "{$Common.RogueDamage} and {1}% increased rogue knockback" } TitanHeartMask: { DisplayName: Titan Heart Mask Tooltip: ''' - 5% increased rogue damage and knockback + {$Common.RogueDamage} and {$Common.RogueVelocity@1} Rogue weapons inflict the Astral Infection debuff ''' SetBonus: ''' - 10% increased rogue damage and 20% increased rogue knockback - +100 maximum stealth - Stealth strikes deal double knockback and cause an astral explosion - Grants immunity to knockback + {$Common.RogueStealth} + Stealth strikes deal {1}x knockback and cause an astral explosion + {$Common.KnockbackImmunity} ''' } @@ -545,17 +509,17 @@ UmbraphileBoots: { DisplayName: Umbraphile Boots Tooltip: ''' - 9% increased rogue damage and 6% increased rogue crit - 20% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' } UmbraphileHood: { DisplayName: Umbraphile Hood - Tooltip: 8% increased rogue damage and 10% increased rogue velocity + Tooltip: "{$Common.RogueDamage} and {$Common.RogueVelocity@1}" SetBonus: ''' - +110 maximum stealth + {$Common.RogueStealth} Rogue weapons have a chance to create explosions on hit Stealth strikes always create an explosion ''' @@ -563,5 +527,5 @@ UmbraphileHood: { UmbraphileRegalia: { DisplayName: Umbraphile Regalia - Tooltip: 10% increased rogue damage and 10% increased rogue crit + Tooltip: "{$Common.RogueDamageCrit}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson index acf38e0bb2..35b2d0b788 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PostMoonLord.hjson @@ -1,183 +1,171 @@ AuricTeslaBodyArmor: { DisplayName: Auric Tesla Body Armor - Tooltip: - ''' - +100 max life - 8% increased damage and 5% increased critical strike chance - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" } AuricTeslaCuisses: { DisplayName: Auric Tesla Cuisses Tooltip: ''' - 10% increased movement speed - 12% increased damage and 5% increased critical strike chance - Magic carpet effect + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} + Provides a magical flying carpet + [c/aaaaaa:Shift- in your inventory to toggle] [i:FlyingCarpet] [c/aaaaaa:Flying Carpet's effect] ''' } -AuricTeslaHoodedFacemask: { +AuricTeslaHeadRanged: { DisplayName: Auric Tesla Hooded Facemask - Tooltip: 30% increased ranged damage and critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: ''' Ranged Tarragon, Bloodflare and God Slayer armor effects - Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + Hold Shift to view these set bonus details and press Shift repeatedly to cycle through them ''' SetBonus1: ''' Inherited Tarragon Set Bonus: {$TarragonHeadRanged.SetBonusEffect} - {$TarragonBreastplate.CommonSetBonus} ''' SetBonus2: ''' Inherited Bloodflare Set Bonus: {$BloodflareHeadRanged.SetBonusEffect} - {$BloodflareBodyArmor.CommonSetBonus} ''' SetBonus3: ''' Inherited God Slayer Set Bonus: {$GodSlayerHeadRanged.SetBonusEffect} - {$GodSlayerChestplate.CommonSetBonus} ''' } -AuricTeslaPlumedHelm: { +AuricTeslaHeadRogue: { DisplayName: Auric Tesla Plumed Helm Tooltip: ''' - 20% increased rogue damage and critical strike chance - 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' SetBonus: ''' - +130 maximum stealth + {$Common.RogueStealth} Rogue Tarragon, Bloodflare and God Slayer armor effects - Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + Hold Shift to view these set bonus details and press Shift repeatedly to cycle through them ''' SetBonus1: ''' Inherited Tarragon Set Bonus: {$TarragonHeadRogue.SetBonusEffect} - {$TarragonBreastplate.CommonSetBonus} ''' SetBonus2: ''' Inherited Bloodflare Set Bonus: {$BloodflareHeadRogue.SetBonusEffect} - {$BloodflareBodyArmor.CommonSetBonus} ''' SetBonus3: ''' Inherited God Slayer Set Bonus: {$GodSlayerHeadRogue.SetBonusEffect} - {$GodSlayerChestplate.CommonSetBonus} ''' } -AuricTeslaRoyalHelm: { +AuricTeslaHeadMelee: { DisplayName: Auric Tesla Royal Helm Tooltip: ''' - 20% increased melee damage - 10% increased melee critical strike chance + {$CommonItemTooltip.PercentIncreasedMeleeDamage} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@1} ''' SetBonus: ''' - Enemies are more likely to target you - 28% increased melee speed + {$Common.AggroBoost} Melee Tarragon, Bloodflare and God Slayer effects - Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + Hold Shift to view these set bonus details and press Shift repeatedly to cycle through them ''' SetBonus1: ''' Inherited Tarragon Set Bonus: {$TarragonHeadMelee.SetBonusEffect} - {$TarragonBreastplate.CommonSetBonus} ''' SetBonus2: ''' Inherited Bloodflare Set Bonus: {$BloodflareHeadMelee.SetBonusEffect} - {$BloodflareBodyArmor.CommonSetBonus} ''' SetBonus3: ''' Inherited God Slayer Set Bonus: {$GodSlayerHeadMelee.SetBonusEffect} - {$GodSlayerChestplate.CommonSetBonus} ''' } -AuricTeslaSpaceHelmet: { +AuricTeslaHeadSummon: { DisplayName: Auric Tesla Space Helmet - Tooltip: 15% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - Max run speed and acceleration boosted by 5% - +6 max minions and 75% increased summon damage + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Summoner Tarragon, Bloodflare and Silva armor effects - Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + Hold Shift to view these set bonus details and press Shift repeatedly to cycle through them ''' SetBonus1: ''' Inherited Tarragon Set Bonus: {$TarragonHeadSummon.SetBonusEffect} - {$TarragonBreastplate.CommonSetBonus} ''' SetBonus2: ''' Inherited Bloodflare Set Bonus: {$BloodflareHeadSummon.SetBonusEffect} - {$BloodflareBodyArmor.CommonSetBonus} ''' SetBonus3: ''' Inherited Silva Set Bonus: {$SilvaHeadSummon.SetBonusEffect} - {$SilvaArmor.CommonSetBonus} ''' } -AuricTeslaWireHemmedVisage: { +AuricTeslaHeadMagic: { DisplayName: Auric Tesla Wire-Hemmed Visage - Tooltip: 30% increased magic damage, 20% increased magic critical strike chance, +100 max mana and 20% reduced mana usage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} + ''' SetBonus: ''' - Max run speed and acceleration boosted by 5% Magic Tarragon, Bloodflare and Silva armor effects - Hold SHIFT to view these set bonus details and Press SHIFT repeatedly to cycle through them + Hold Shift to view these set bonus details and press Shift repeatedly to cycle through them ''' SetBonus1: ''' Inherited Tarragon Set Bonus: {$TarragonHeadMagic.SetBonusEffect} - {$TarragonBreastplate.CommonSetBonus} ''' SetBonus2: ''' Inherited Bloodflare Set Bonus: {$BloodflareHeadMagic.SetBonusEffect} - {$BloodflareBodyArmor.CommonSetBonus} ''' SetBonus3: ''' Inherited Silva Set Bonus: {$SilvaHeadMagic.SetBonusEffect} - {$SilvaArmor.CommonSetBonus} ''' } BloodflareBodyArmor: { DisplayName: Bloodflare Body Armor - Tooltip: - ''' - 12% increased damage and 8% increased critical strike chance - +40 max life - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" CommonSetBonus: ''' Greatly increased life regen, equivalent to Crimson armor @@ -188,47 +176,64 @@ BloodflareBodyArmor: { BloodflareCuisses: { DisplayName: Bloodflare Cuisses - Tooltip: 17% increased movement speed, 10% increased damage and 7% increased critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} + ''' } BloodflareHeadMagic: { DisplayName: Bloodflare Hydra Hood - Tooltip: 20% increased magic damage, 10% increased magic critical strike chance, +100 max mana and 17% reduced mana usage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} + ''' SetBonus: "{$BloodflareHeadMagic.SetBonusEffect}" SetBonusEffect: ''' - Magic weapons fire ghostly bolts every 1.67 seconds - Magic critical strikes cause blood explosions every 2 seconds + Magic weapons fire ghostly bolts every {0} seconds + Magic critical strikes cause blood explosions every {1} seconds + {$BloodflareBodyArmor.CommonSetBonus} ''' } BloodflareHeadMelee: { DisplayName: Bloodflare Ram Mask - Tooltip: 10% increased melee damage and 5% increased melee critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedMeleeDamage} and {$CommonItemTooltip.PercentIncreasedMeleeCritChance@1} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} + ''' SetBonus: ''' - 18% increased melee speed - Enemies are more likely to target you + {$Common.AggroBoost} {$BloodflareHeadMelee.SetBonusEffect} ''' SetBonusEffect: ''' - True melee strikes will heal you - After striking an enemy 15 times with true melee you will enter a blood frenzy for 5 seconds - During this you will gain 25% increased melee damage, critical strike chance, and contact damage is halved - This effect has a 30 second cooldown + After striking an enemy {0} times with true melee you will enter a blood frenzy for {1} seconds + During this you will gain {2}% increased melee damage, critical strike chance, and {3}% reduced contact damage + This effect has a {4} second cooldown + {$BloodflareBodyArmor.CommonSetBonus} ''' } BloodflareHeadRanged: { DisplayName: Bloodflare Horned Helm - Tooltip: 10% increased ranged damage and critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamageCritChance} + {$Common.AmmoUseReduction@1} + ''' SetBonus: "{$BloodflareHeadRanged.SetBonusEffect}" SetBonusEffect: ''' - Press {0} to unleash the lost souls of polterghast to destroy your enemies - This effect has a 30 second cooldown - Ranged weapons fire bloodsplosion orbs every 2.5 seconds + {0} to unleash the lost souls of polterghast to destroy your enemies + This effect has a {1} second cooldown + Ranged weapons fire bloodsplosion orbs every {2} seconds + {$BloodflareBodyArmor.CommonSetBonus} ''' } @@ -236,35 +241,41 @@ BloodflareHeadRogue: { DisplayName: Bloodflare Imp Mask Tooltip: ''' - 10% increased rogue damage and critical strike chance - 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' SetBonus: ''' - +120 maximum stealth - {$BloodflareHeadRogue.SetBonusEffect} + {$Common.RogueStealth} + {$BloodflareHeadRogue.SetBonusEffect@1} ''' SetBonusEffect: ''' - Being over 80% life boosts your defense by 30 and rogue crit by 5% - Being below 80% life boosts your rogue damage by 10% - Rogue critical strikes heal you + Grants {0} defense when above {1}% life + Rogue critical strikes burst into blood orbs + Picking up these blood orbs reduces the duration of [Potion Sickness] + {$BloodflareBodyArmor.CommonSetBonus} ''' } BloodflareHeadSummon: { DisplayName: Bloodflare Wyvern Helm - Tooltip: 5% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - 50% increased summon damage and +3 max minions - {$BloodflareHeadSummon.SetBonusEffect} + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + {$BloodflareHeadSummon.SetBonusEffect@2} ''' SetBonusEffect: ''' Summons polterghast mines to circle you - At 90% life and above you gain 10% increased summon damage - At 50% life and below you gain 20 defense and +1 HP/s life regen + Grants {0} defense when below {1}% life + {$BloodflareBodyArmor.CommonSetBonus} ''' } @@ -272,9 +283,10 @@ DemonshadeBreastplate: { DisplayName: Demonshade Breastplate Tooltip: ''' - 25% increased melee speed, 15% increased damage and critical strike chance - Enemies take ungodly damage when they touch you - Increased max life and mana by 200 + {$CommonItemTooltip.IncreasesMaxManaBy} + {$CommonItemTooltip.PercentIncreasedDamageCritChance@1} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} + {$Common.AmmoUseReduction@3} Standing still absorbs shadows to grant exponentially accelerating life regen ''' } @@ -286,33 +298,33 @@ DemonshadeGreaves: { DemonshadeHelm: { DisplayName: Demonshade Helm - Tooltip: 30% increased damage and 15% increased critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedDamage@1} and {$CommonItemTooltip.PercentIncreasedCritChance@2} + ''' SetBonus: ''' - 100% increased summon damage and +10 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Shadowbeams and demon scythes will fire down when you are hit A friendly red devil follows you around - Press {0} to enrage nearby enemies with a dark magic spell for 10 seconds - This makes them take {1}x total damage, but they will deal {2}x damage to you + {2} to enrage nearby enemies with a dark magic spell for {3} seconds + This makes them take {4}x total damage, but they will deal {5}x damage to you ''' } EmpyreanCloak: { DisplayName: Empyrean Cloak - Tooltip: - ''' - Armor of the cosmos - +20 max life - 7% increased rogue damage and critical strike chance - ''' + Tooltip: "{$Common.RogueDamage} and {$Common.RogueCrit@1}" } EmpyreanCuisses: { DisplayName: Empyrean Cuisses Tooltip: ''' - 5% increased rogue damage and critical strike chance - 15% increased movement speed + {$Common.RogueDamageCrit} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -320,15 +332,14 @@ EmpyreanMask: { DisplayName: Empyrean Mask Tooltip: ''' - 11% increased rogue damage and critical strike chance - 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$Common.RogueVelocity@2} ''' SetBonus: ''' - 9% increased rogue damage and velocity - +115 maximum stealth + {$Common.RogueStealth} Rogue projectiles have special effects on enemy hits - Imbued with cosmic wrath and rage when you are damaged + Imbued with cosmic wrath when you are damaged ''' } @@ -336,18 +347,16 @@ FearmongerGreathelm: { DisplayName: Fearmonger Greathelm Tooltip: ''' + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedSummonDamage@2} Pure terror radiates from your eyes - +60 max mana and 10% reduced mana usage - 10% increased summon damage ''' SetBonus: ''' - 20% increased summon damage and +2 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} Minions no longer deal less damage while wielding non-summoner weapons Immunity to all but the strongest forms of frost and flame - Minion attacks grant +3.5 HP/s life regen and massively accelerate life regen - 15% increased damage reduction during the Pumpkin and Frost Moons - This extra damage reduction ignores the soft cap + Minion attacks grant +{1} HP/s life regen and massively accelerate life regen ''' } @@ -355,10 +364,8 @@ FearmongerGreaves: { DisplayName: Fearmonger Greaves Tooltip: ''' - 6% increased damage - 50% increased minion knockback - 10% increased movement speed - Taking damage increases your movement speed by 40% for 4 seconds + {$CommonItemTooltip.PercentIncreasedDamage} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -366,8 +373,8 @@ FearmongerPlateMail: { DisplayName: Fearmonger Plate Mail Tooltip: ''' - +100 max life and 8% increased damage reduction - 5% increased damage and critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + +{2} max life and {3}% increased damage reduction ''' } @@ -379,7 +386,7 @@ GemTechBodyArmor: { GemTechHeadgear: { DisplayName: Gem Tech Headgear Tooltip: "'The Devil said: Revel in your victory; You've earned your damning. Pack your things and leave.'" - AbilityBrief: Power Gems - Six gem fragments idly orbit you; one for each class, and a base gem + AbilityBrief: "[c/{0}:Power Gems - Six gem fragments idly orbit you; one for each class, and a base gem]" AbilityDescription: ''' Each active gem provides a bonus for its respective class, while the defensive gem grants defensive boosts @@ -389,18 +396,18 @@ GemTechHeadgear: { ''' GeneralGemInfo: ''' - A gem is lost when you take more than {0} damage in a single hit. + A gem is lost when you take more than {0} damage in a single hit The type of gem lost is the same as the class of the most recently used weapon If said gem has already been lost, the base gem is lost instead When a gem is lost, it breaks off and homes towards the nearest enemy or boss, if one is present, dealing a base of {1} damage Gems have a {2} second delay before they appear again ''' - RedGemInfo: "[i:Ruby] The red gem grants {0} maximum stealth, increased rogue stats, and makes stealth only consumable by rogue weapons" - YellowGemInfo: "[i:Topaz] The yellow gem provides increased melee stats and makes melee attacks release shards on hit with a cooldown. This cooldown is shorter for true melee attacks" - GreenGemInfo: "[i:Emerald] The green gem provides increased ranged stats and causes flechettes to fly swiftly towards targets when they are damaged by a ranged projectile" - BlueGemInfo: "[i:Sapphire] The blue gem grants {0} extra maximum minions, increased summon damage, and negates the summon damage penalty while wielding non-summoner weapons" - PurpleGemInfo: "[i:Amethyst] The violet gem grants {0} extra maximum mana, increased magic stats, and makes mana rapidly regenerate when holding a non-magic weapon" - PinkGemInfo: "[i:Diamond] The pink base gem grants {0} extra defense, extra damage reduction, increased movement speed, jump speed, and +{1} HP/s life regen" + RedGemInfo: "[i:CalamityMod/GemTechRedGem] The red gem grants {0} maximum stealth, increased rogue stats, and makes stealth only consumable by rogue weapons" + YellowGemInfo: "[i:CalamityMod/GemTechYellowGem] The yellow gem provides increased melee stats and makes melee attacks release shards on hit with a cooldown. This cooldown is shorter for true melee attacks" + GreenGemInfo: "[i:CalamityMod/GemTechGreenGem] The green gem provides increased ranged stats and causes flechettes to fly swiftly towards targets when they are damaged by a ranged projectile" + BlueGemInfo: "[i:CalamityMod/GemTechBlueGem] The blue gem grants {0} maximum minions, increased summon damage, and negates the summon damage penalty while wielding non-summoner weapons" + PurpleGemInfo: "[i:CalamityMod/GemTechPurpleGem] The violet gem grants {0} maximum mana, increased magic stats, and makes mana rapidly regenerate when holding a non-magic weapon" + PinkGemInfo: "[i:CalamityMod/GemTechPinkGem] The pink base gem grants {0} defense, increased damage reduction, movement speed, jump speed, and +{1} HP/s life regen" GemBonusInfo: ''' When all gems exist simultaneously, hitting a target with any weapon grants you +{0} HP/s life regen for {1} seconds @@ -415,17 +422,12 @@ GemTechSchynbaulds: { GodSlayerChestplate: { DisplayName: God Slayer Chestplate - Tooltip: - ''' - +60 max life - Enemies take damage when they hit you - 11% increased damage and 8% increased critical strike chance - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" CommonSetBonus: ''' - Pressing {0} allows you to dash towards your cursor for 2.5 seconds + Press {0} to dash towards your cursor for 2 seconds Enemies you dash through take massive damage - During the dash you are immune to most debuffs + During the dash you are immune to damage and most debuffs The dash has a {1} second cooldown ''' } @@ -434,45 +436,53 @@ GodSlayerHeadMelee: { DisplayName: God Slayer Horned Greathelm Tooltip: ''' - 14% increased melee damage - 7% increased melee critical strike chance + {$CommonItemTooltip.PercentIncreasedMeleeDamage} and {$CommonItemTooltip.PercentIncreasedMeleeCritChance@1} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} ''' SetBonus: ''' - 20% increased melee speed - Enemies are more likely to target you + {$Common.AggroBoost} {$GodSlayerHeadMelee.SetBonusEffect} ''' SetBonusEffect: ''' - Taking over 80 damage in one hit will cause you to release a swarm of high-damage god killer darts - Enemies take a lot of damage when they hit you + Releases a swarm of god killer darts when taking over {0} damage in one hit + {$GodSlayerChestplate.CommonSetBonus@1} ''' } GodSlayerHeadRanged: { DisplayName: God Slayer Helmet - Tooltip: 14% increased ranged damage and critical strike chance + Tooltip: + ''' + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} + ''' SetBonus: "{$GodSlayerHeadRanged.SetBonusEffect}" - SetBonusEffect: You fire a god killer shrapnel round while firing ranged weapons every 2.5 seconds + SetBonusEffect: + ''' + Ranged weapons fire a god killer shrapnel round every {0} seconds + {$GodSlayerChestplate.CommonSetBonus@1} + ''' } GodSlayerHeadRogue: { DisplayName: God Slayer Mask Tooltip: ''' - 14% increased rogue damage and critical strike chance - 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' SetBonus: ''' - +120 maximum stealth - {$GodSlayerHeadRogue.SetBonusEffect} + {$Common.RogueStealth} + {$GodSlayerHeadRogue.SetBonusEffect@1} ''' SetBonusEffect: ''' - While at full HP all of your rogue stats are boosted by 10% - If you take over 80 damage in one hit you will be given extra immunity frames + {0}% increased rogue damage, critical strike chance, and velocity when at full health + Increased length of invincibility when taking over {1} damage in one hit + {$GodSlayerChestplate.CommonSetBonus@2} ''' } @@ -480,8 +490,8 @@ GodSlayerLeggings: { DisplayName: God Slayer Leggings Tooltip: ''' - 10% increased movement speed - 11% increased damage and critical strike chance + {$CommonItemTooltip.PercentIncreasedDamageCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -489,7 +499,8 @@ OmegaBlueChestplate: { DisplayName: Omega Blue Chestplate Tooltip: ''' - 12% increased damage and 8% increased critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + {$Common.AmmoUseReduction@2} Your attacks inflict Hadopelagic Pressure No positive life regen ''' @@ -499,17 +510,17 @@ OmegaBlueHelmet: { DisplayName: Omega Blue Helmet Tooltip: ''' + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} You can move freely through liquids - 12% increased damage and 8% increased critical strike chance ''' SetBonus: ''' - 10% increased damage and critical strike chance and +2 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} Short-ranged tentacles heal you by sucking enemy life - Press {0} to activate abyssal madness for 5 seconds - Abyssal madness increases damage and critical strike chance by 10% - It also increases tentacle aggression and range, and allows them to critically strike - This effect has a 25 second cooldown + [c/{1}:Abyssal Madness - {2} to go berserk for {3} seconds] + [c/99ABFF:While active, tentacles attack with greater range and aggression, and always critically strike] + [c/99ABFF:This also grants {$CommonItemTooltip.PercentIncreasedDamageCritChance@4}] + [c/99ABFF:This effect has a {5} second cooldown] ''' } @@ -517,8 +528,8 @@ OmegaBlueTentacles: { DisplayName: Omega Blue Tentacles Tooltip: ''' - 12% increased movement speed - 12% increased damage and critical strike chance + {$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' } @@ -526,9 +537,9 @@ PrismaticGreaves: { DisplayName: Prismatic Greaves Tooltip: ''' - 10% increased magic damage and 12% increased magic crit - 20% decreased non-magic damage - 10% increased flight time and 2% increased jump speed + {$CommonItemTooltip.PercentIncreasedMagicDamage} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@1} + {2}% decreased non-magic damage + {3}% increased flight time and {4}% increased jump speed ''' } @@ -536,17 +547,17 @@ PrismaticHelmet: { DisplayName: Prismatic Helmet Tooltip: ''' - 18% increased magic damage and 12% increased magic crit - 20% decreased non-magic damage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} + {4}% decreased non-magic damage Enemies with less than 500 max health deal no contact damage This does not occur while a boss is alive ''' SetBonus: ''' - +40 max mana and 15% reduced mana cost Increased mana regeneration rate - Press {0} to unleash a barrage of death lasers at the cursor for the next 5 seconds - This has a 30 second cooldown + [c/{0}:Prismatic Barrage - {1} to unleash a laser barrage at the cursor for {2} seconds] + [c/67F4FB:This has a {3} second cooldown] ''' } @@ -554,26 +565,21 @@ PrismaticRegalia: { DisplayName: Prismatic Regalia Tooltip: ''' - 12% increased magic damage and 15% increased magic crit - 20% decreased non-magic damage - +20 max life and +40 max mana - Magic attacks occasionally fire a pair of homing rockets + {$CommonItemTooltip.PercentIncreasedMagicDamageCritChance} + {1}% decreased non-magic damage + Magic attacks have a {2}% chance to fire a pair of homing rockets ''' } SilvaArmor: { DisplayName: Silva Armor - Tooltip: - ''' - +80 max life - 11% increased damage and 8% increased critical strike chance - ''' + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamage} and {$CommonItemTooltip.PercentIncreasedCritChance@1}" CommonSetBonus: ''' - All projectiles spawn healing leaf orbs on enemy hits - Max run speed and acceleration boosted by 5% - Taking fatal damage will revive you and make you invulnerable to all damage for 5 seconds - This effect has a 5 minute cooldown, which does not decrement if any bosses or events are active + +{0} HP/s life regen + {1}% increased max run speed and acceleration + Taking fatal damage will revive you and make you invulnerable to all damage for {2} seconds + This effect has a {3} minute cooldown, which does not decrement if any bosses or events are active ''' } @@ -581,30 +587,43 @@ SilvaHeadMagic: { DisplayName: Silva Masked Cap Tooltip: ''' - 23% increased magic damage and 13% increased magic critical strike chance - +100 max mana and 19% reduced mana usage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} ''' SetBonus: "{$SilvaHeadMagic.SetBonusEffect}" - SetBonusEffect: Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy + SetBonusEffect: + ''' + Magic projectiles which cannot pierce will occasionally set off potent blasts of nature energy + {$SilvaArmor.CommonSetBonus} + ''' } SilvaHeadSummon: { DisplayName: Silva Horned Hood - Tooltip: 10% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - 65% increased summon damage and +5 max minions - {$SilvaHeadSummon.SetBonusEffect} + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + {$SilvaHeadSummon.SetBonusEffect@2} + ''' + SetBonusEffect: + ''' + Summons an ancient leaf prism to blast your enemies with life energy + {$SilvaArmor.CommonSetBonus} ''' - SetBonusEffect: Summons an ancient leaf prism to blast your enemies with life energy } SilvaLeggings: { DisplayName: Silva Leggings Tooltip: ''' - 10% increased movement speed - 11% increased damage and critical strike chance + {$CommonItemTooltip.PercentIncreasedDamageCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } @@ -612,12 +631,11 @@ TarragonBreastplate: { DisplayName: Tarragon Breastplate Tooltip: ''' - 10% increased damage and 5% increased critical strike chance - +1.5 HP/s life regen and +40 max life + {0}% increased damage and {1}% increased critical strike chance + +{2} HP/s life regen and {3}% increased damage reduction ''' CommonSetBonus: ''' - Reduces enemy spawn rates Increased heart pickup range Enemies have a chance to drop extra hearts on death ''' @@ -627,15 +645,14 @@ TarragonHeadMagic: { DisplayName: Tarragon Mask Tooltip: ''' - 15% increased magic damage and 10% increased magic critical strike chance - 10% increased damage reduction, +100 max mana, and 15% reduced mana usage + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} ''' SetBonus: "{$TarragonHeadMagic.SetBonusEffect}" SetBonusEffect: ''' On every 5th critical strike you will fire a leaf storm - Magic projectiles heal you on enemy hits - Amount healed is based on projectile damage + {$TarragonBreastplate.CommonSetBonus} ''' } @@ -643,20 +660,20 @@ TarragonHeadMelee: { DisplayName: Tarragon Helm Tooltip: ''' - 12% increased melee damage and 7% increased melee critical strike chance - 10% increased damage reduction + {$CommonItemTooltip.PercentIncreasedMeleeDamage} and {$CommonItemTooltip.PercentIncreasedMeleeCritChance@1} + {$CommonItemTooltip.PercentIncreasedMeleeSpeed@2} ''' SetBonus: ''' - 15% increased melee speed - Enemies are more likely to target you + {$Common.AggroBoost} {$TarragonHeadMelee.SetBonusEffect} ''' SetBonusEffect: ''' - Taking damage gives the Tarra Life buff, which grants +1.5 HP/s life regen - Press {0} to cloak yourself in life energy that heavily reduces enemy contact damage for 10 seconds - This has a 30 second cooldown + Taking damage gives the Tarra Life buff, which grants +{0} HP/s life regen + {1} to cloak yourself in life energy that heavily reduces enemy contact damage for {2} seconds + This has a {3} second cooldown + {$TarragonBreastplate.CommonSetBonus} ''' } @@ -664,49 +681,63 @@ TarragonHeadRanged: { DisplayName: Tarragon Visage Tooltip: ''' - 10% increased ranged damage and critical strike chance - 10% increased damage reduction + {$CommonItemTooltip.PercentIncreasedRangedDamage} and {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} + {$Common.AmmoUseReduction@2} ''' SetBonus: "{$TarragonHeadRanged.SetBonusEffect}" - SetBonusEffect: Ranged projectiles split into homing life energy and leaves on death + SetBonusEffect: + ''' + Ranged projectiles spawn homing life energy and leaves on enemy hits + {$TarragonBreastplate.CommonSetBonus} + ''' } TarragonHeadRogue: { DisplayName: Tarragon Helmet Tooltip: ''' - 10% increased rogue damage and critical strike chance - 10% increased damage reduction and 5% increased movement speed + {$Common.RogueDamage} and {$Common.RogueCrit@1} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} ''' SetBonus: ''' - +115 maximum stealth - {$TarragonHeadRogue.SetBonusEffect} + {$Common.RogueStealth} + {$TarragonHeadRogue.SetBonusEffect@1} ''' SetBonusEffect: ''' - After every 50 rogue critical hits you will gain 2.5 seconds of damage immunity - This effect has a cooldown of 25 seconds - While under the effects of a debuff you gain 10% increased rogue damage + After every {0} rogue critical hits you will gain {1} seconds of damage immunity + This effect has a cooldown of {2} seconds + While under the effects of a debuff you gain {3}% increased rogue damage + {$TarragonBreastplate.CommonSetBonus} ''' } TarragonHeadSummon: { DisplayName: Tarragon Horned Helm - Tooltip: 10% increased damage reduction and 5% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - 50% increased summon damage and +3 max minions + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} {$TarragonHeadSummon.SetBonusEffect} ''' - SetBonusEffect: Summons a life aura around you that damages nearby enemies + SetBonusEffect: + ''' + Summons a life aura around you that damages nearby enemies + {$TarragonBreastplate.CommonSetBonus} + ''' } TarragonLeggings: { DisplayName: Tarragon Leggings Tooltip: ''' - 10% increased movement speed - 8% increased damage and critical strike chance + {$CommonItemTooltip.PercentIncreasedDamageCritChance} + {$CommonItemTooltip.PercentIncreasedMovementSpeed@1} ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson index 3095f99502..21188dd4b7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.PreHardmode.hjson @@ -1,147 +1,162 @@ AerospecBreastplate: { DisplayName: Aerospec Breastplate - Tooltip: 3% increased damage and critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedDamageCritChance}" CommonSetBonus: ''' - Taking over 25 damage in one hit will cause a spread of homing feathers to fall + Taking over {0} damage in one hit will cause a spread of homing feathers to fall Allows you to fall more quickly and disables fall damage ''' } -AerospecHat: { +AerospecHeadMagic: { DisplayName: Aerospec Hat - Tooltip: 10% increased magic damage and +30 max mana + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxManaBy} + {$CommonItemTooltip.PercentIncreasedMagicDamage@1} + ''' SetBonus: ''' - 8% reduced mana cost - 5% increased movement speed and magic critical strike chance + {$CommonItemTooltip.PercentReducedManaCost} + {1}% increased movement speed and magic critical strike chance + {$AerospecBreastplate.CommonSetBonus@2} ''' } -AerospecHeadgear: { +AerospecHeadRogue: { DisplayName: Aerospec Headgear - Tooltip: 10% increased rogue damage and 5% increased movement speed + Tooltip: "{$Common.RogueDamage} and {$CommonItemTooltip.PercentIncreasedMovementSpeed@1}" SetBonus: ''' - 5% increased movement speed and rogue critical strike chance - +80 maximum stealth + {$Common.RogueStealth} + {1}% increased movement speed and rogue critical strike chance + {$AerospecBreastplate.CommonSetBonus@2} ''' } -AerospecHelm: { +AerospecHeadMelee: { DisplayName: Aerospec Helm - Tooltip: 10% increased melee damage + Tooltip: "{$CommonItemTooltip.PercentIncreasedMeleeDamage}" SetBonus: ''' - 5% increased movement speed and melee critical strike chance - Enemies are more likely to target you + {0}% increased movement speed and melee critical strike chance + {$Common.AggroBoost} + {$AerospecBreastplate.CommonSetBonus@1} ''' } -AerospecHelmet: { +AerospecHeadSummon: { DisplayName: Aerospec Helmet - Tooltip: 10% increased summon damage and 5% increased movement speed + Tooltip: "{$CommonItemTooltip.PercentIncreasedSummonDamage} and {$CommonItemTooltip.PercentIncreasedMovementSpeed@1}" SetBonus: ''' - 11% increased summon damage and +1 max minion + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} Summons a valkyrie to protect you + {$AerospecBreastplate.CommonSetBonus@2} ''' } -AerospecHood: { +AerospecHeadRanged: { DisplayName: Aerospec Hood - Tooltip: 10% increased ranged damage - SetBonus: 5% increased movement speed and ranged critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedDamage}" + SetBonus: + ''' + {0}% increased movement speed and ranged critical strike chance + {$AerospecBreastplate.CommonSetBonus@1} + ''' } AerospecLeggings: { DisplayName: Aerospec Leggings - Tooltip: 12% increased movement speed + Tooltip: "{$CommonItemTooltip.PercentIncreasedMovementSpeed}" } DesertProwlerHat: { DisplayName: Desert Prowler Hat - Tooltip: 4% increased ranged critical strike chance and 20% chance to not consume ammo - SetBonus: Ranged attacks deal an extra {0} flat damage - AbilityBrief: Sandsmoke Bomb - Double tap {0} to shroud yourself in a small cloud of sand - AbilityDescription: + Tooltip: "{$Common.RogueCrit}" + SetBonus: ''' - While the sand cloud is active, gain increased mobility but heavily reduced defense - Using a ranged weapon instantly dispels the sand cloak, but guarantees a supercrit for {0}% damage - The super crit applies only as long as the resulting hit wouldn't exceed {1} damage - Landing the killing blow on an enemy with this shot shortens the ability's cooldown to {2} seconds + {$Common.RogueStealth} + [c/{1}:Sandsmoke Bomb - {2} to shroud yourself in a small cloud of sand] + [c/CCB648:While the sand cloud is active, gain increased mobility but heavily reduced defense] + [c/CCB648:Using a rogue weapon instantly dispels the sand cloak, but guarantees a supercrit for {3}% damage] + [c/CCB648:The supercrit applies only as long as the resulting hit wouldn't exceed {4} damage] + [c/CCB648:Landing the killing blow on an enemy with this shot shortens the ability's cooldown to {5} {^5:second;seconds}] ''' } DesertProwlerPants: { DisplayName: Desert Prowler Pants - Tooltip: 10% increased movement speed and immunity to the Mighty Wind debuff + Tooltip: + ''' + {$Common.RogueCrit} + Grants immunity to {$BuffName.WindPushed} + ''' } DesertProwlerShirt: { DisplayName: Desert Prowler Shirt - Tooltip: 5% increased ranged critical strike chance + Tooltip: "{$Common.RogueDamage}" } MarniteArchitectHeadgear: { DisplayName: Marnite Architect Headgear - Tooltip: Increases block placement & tool range by 5 - AbilityBrief: Marnite Lift - You can summon a lift under your feet to reach higher up - AbilityDescription: + Tooltip: Increases block placement & tool range by {0} + SetBonus: ''' - The lift gets summoned when the mount hotkey gets pressed [c/D4C870:without any mounts equipped] - Using the Up and Down keys can change the lift's height + [c/{0}:Marnite Lift - You can summon a lift under your feet to reach higher up] + [c/91C5EF:The lift gets summoned when the mount hotkey gets pressed] [c/D4C870:without any mounts equipped] + [c/91C5EF:Press {$Key.UP} and {$Key.DOWN} to change the lift's height, reaching up to {1} tiles above ground] ''' } MarniteArchitectToga: { DisplayName: Marnite Architect Toga - Tooltip: Increases block & wall placement speed by 50% + Tooltip: Increases block & wall placement speed by {0}% } SnowRuffianChestplate: { DisplayName: Snow Ruffian Chestplate - Tooltip: 3% increased rogue critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedCritChance}" } SnowRuffianGreaves: { DisplayName: Snow Ruffian Greaves - Tooltip: 5% increased movement speed + Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedCritChance}" } SnowRuffianMask: { DisplayName: Snow Ruffian Mask - Tooltip: 2% increased rogue damage + Tooltip: "{$CommonItemTooltip.PercentIncreasedRangedCritChance}" SetBonus: ''' - 5% increased rogue damage - +50 maximum stealth You can glide to negate fall damage + Ranged critical strikes frostburn enemies for {0} {^0:second;seconds} ''' } StatigelArmor: { DisplayName: Statigel Armor - Tooltip: 5% increased critical strike chance + Tooltip: "{$CommonItemTooltip.PercentIncreasedCritChance}" CommonSetBonus: ''' - When you take over 100 damage in one hit you become immune to damage for an extended period of time Grants an extra jump and increased jump height - 12% increased jump speed + {0}% increased jump speed ''' } StatigelGreaves: { DisplayName: Statigel Greaves - Tooltip: 5% increased damage and movement speed + Tooltip: "{0}% increased damage and movement speed" } StatigelHeadMagic: { DisplayName: Statigel Cap Tooltip: ''' - 10% increased magic damage and 10% reduced mana cost - 7% increased magic critical strike chance and +40 max mana + {$CommonItemTooltip.IncreasesMaxManaBy} and {$CommonItemTooltip.PercentReducedManaCost@1} + {$CommonItemTooltip.PercentIncreasedMagicDamage@2} and {$CommonItemTooltip.PercentIncreasedMagicCritChance@3} ''' } @@ -149,18 +164,22 @@ StatigelHeadMelee: { DisplayName: Statigel Helm Tooltip: ''' - 10% increased melee damage and melee speed - 7% increased melee critical strike chance + {0}% increased melee damage and melee speed + {$CommonItemTooltip.PercentIncreasedMeleeCritChance@1} + ''' + SetBonus: + ''' + {$Common.AggroBoost} + {$StatigelArmor.CommonSetBonus} ''' - SetBonus: Enemies are more likely to target you } StatigelHeadRanged: { DisplayName: Statigel Headgear Tooltip: ''' - 10% increased ranged damage - 7% increased ranged critical strike chance + {$CommonItemTooltip.PercentIncreasedRangedDamage} + {$CommonItemTooltip.PercentIncreasedRangedCritChance@1} ''' } @@ -168,117 +187,113 @@ StatigelHeadRogue: { DisplayName: Statigel Mask Tooltip: ''' - 10% increased rogue damage - 7% increased rogue critical strike chance and 5% increased movement speed + {$Common.RogueDamage} + {$Common.RogueCrit@1} and {$CommonItemTooltip.PercentIncreasedMovementSpeed@2} + ''' + SetBonus: + ''' + {$Common.RogueStealth} + {$StatigelArmor.CommonSetBonus@1} ''' - SetBonus: +90 maximum stealth } StatigelHeadSummon: { DisplayName: Statigel Hood - Tooltip: Increased minion knockback + Tooltip: + ''' + {$CommonItemTooltip.IncreasesMaxMinionsBy} + {$CommonItemTooltip.PercentIncreasedSummonDamage@1} + ''' SetBonus: ''' - 18% increased summon damage and +1 max minion + {$CommonItemTooltip.PercentIncreasedSummonDamage} Summons a mini paladin to fight for you, the type depends on what world evil you have + {$StatigelArmor.CommonSetBonus@1} ''' } SulphurousBreastplate: { DisplayName: Sulphurous Breastplate - Tooltip: 6% increased rogue damage and 4% increased rogue critical strike chance + Tooltip: "{$Common.RogueDamage}" } SulphurousHelmet: { DisplayName: Sulphurous Helmet Tooltip: ''' - 4% increased rogue damage - 2% increased rogue critical strike chance + {$Common.RogueCrit} Grants underwater breathing ''' SetBonus: ''' - +65 maximum stealth - Attacking and being attacked by enemies inflicts poison + {$Common.RogueStealth} + Attacking and being attacked by enemies inflicts poison for {1} {^1:second;seconds} Grants an additional jump that summons a sulphurous bubble - Provides increased underwater mobility and reduces the severity of the sulphuric waters + Reduces the severity of the sulphuric waters ''' } SulphurousLeggings: { DisplayName: Sulphurous Leggings - Tooltip: - ''' - Movement speed increased by 10% - Movement speed increased an additional 25% while submerged in liquid - ''' + Tooltip: "{$Common.RogueDamage}" } VictideBreastplate: { DisplayName: Victide Breastplate - Tooltip: - ''' - 5% increased damage reduction and critical strike chance - +5 defense and 10% increased damage reduction while submerged in liquid - ''' - CommonSetBonus: - ''' - When using any weapon you have a 10% chance to throw a returning seashell projectile - This seashell does true damage and does not benefit from any damage class - Provides increased underwater mobility and slightly reduces breath loss in the abyss - ''' + Tooltip: +{0} HP/s life regen } VictideGreaves: { DisplayName: Victide Greaves + Tooltip: "{$CommonItemTooltip.PercentIncreasedMovementSpeed}" +} + +VictideHeadBarrier: { + DisplayName: Victide Hermit Helmet Tooltip: ''' - Movement speed increased by 8% - Movement speed increased by 30% while submerged in liquid + +{0} HP/s life regen + Increases movement acceleration and deceleration by {1}x ''' -} - -VictideHeadMagic: { - DisplayName: Victide Hermit Helmet - Tooltip: 5% increased magic damage - SetBonus: +1.5 HP/s life regen and 10% increased magic damage while submerged in liquid -} - -VictideHeadMelee: { - DisplayName: Victide Shellmet - Tooltip: 5% increased melee damage SetBonus: ''' - Enemies are more likely to target you - +1.5 HP/s life regen and 10% increased melee damage while submerged in liquid + [c/{0}:Warding Wave - Forms a tidal barrier which can be exploded to launch you] + [c/A2D6FF:The barrier grants {1} defense and gradually heals back {2}% of taken damage] + [c/A2D6FF:{3} to disperse it for {4} {^4:second;seconds} and propel you in the direction of the cursor] + [c/A2D6FF:The resulting dash can slam through and damage enemies] ''' } -VictideHeadRanged: { - DisplayName: Victide Coral Turban - Tooltip: 5% increased ranged damage - SetBonus: +1.5 HP/s life regen and 10% increased ranged damage while submerged in liquid -} - -VictideHeadRogue: { +VictideHeadBurrow: { DisplayName: Victide Headcrab - Tooltip: 5% increased rogue damage + Tooltip: + ''' + {0}% increased movement speed and acceleration + Grants underwater breathing and slightly reduces breath loss in the abyss + ''' SetBonus: ''' - +60 maximum stealth - +1.5 HP/s life regen and 10% increased rogue damage while submerged in liquid + Allows quick travel in water + [c/{0}:Bubbly Burrow - {1} to transform into an agile water spirit for a short time] + [c/A2D6FF:The spirit can be controlled through movement keys and can traverse through tiles] + [c/A2D6FF:While in spirit form, you are impervious to most damage but unable to use items] + [c/A2D6FF:This effect lasts {2} {^2:second;seconds} and has a cooldown of {3} {^3:second;seconds}] ''' } -VictideHeadSummon: { +VictideHeadSnail: { DisplayName: Victide Mask - Tooltip: 10% increased summon damage + Tooltip: + ''' + {$CommonItemTooltip.IncreasesFishingPowerBy} + {$Common.AggroReduction} + ''' SetBonus: ''' - +1 max minion - Summons a sea snail to protect you - +1.5 HP/s life regen and 10% increased summon damage while submerged in liquid + Increases pickup range for items + [c/{0}:Helper Angler - Summons a sea snail to fish alongside you] + [c/A2D6FF:It automatically casts and reels as you are standing still and fishing] + [c/A2D6FF:Equipped fishing abilities and stats are inherited from its owner] ''' } @@ -296,25 +311,24 @@ WulfrumHat: { DisplayName: Wulfrum Hat & Goggles Tooltip: ''' - 10% increased summon damage + {$CommonItemTooltip.PercentIncreasedSummonDamage} Comes equipped with hair extensions ''' - SetBonus: +1 max minion - AbilityBrief: Wulfrum Bastion - Double tap {0} while dismounted to equip wulfrum power armor - AbilityDescription: + SetBonus: ''' - While the armor is active, you can only use the integrated fusion cannon, but your defensive stats are increased - Calling down the armor consumes one piece of {0}, and the armor will lose durability faster when hit + [c/{0}:Wulfrum Bastion - {1} to equip a power armor, costing one] [i:CalamityMod/WulfrumMetalScrap] [c/{0}:{$Items.Materials.WulfrumMetalScrap.DisplayName}] + [c/6EC05D:While active, you can only use the integrated fusion cannon, but your defensive stats are increased] + [c/6EC05D:The armor lasts up to {2} {^2:second;seconds}, but each hit loses {3} {^3:second;seconds} of duration] + [c/BEBEBE:Hold Shift to see the stats of the fusion cannon] ''' - ShiftToExpand: Hold SHIFT to see the stats of the fusion cannon } WulfrumJacket: { DisplayName: Wulfrum Jacket - Tooltip: 5% increased damage reduction + Tooltip: "{$CommonItemTooltip.IncreasesMaxMinionsBy}" } WulfrumOveralls: { DisplayName: Wulfrum Overalls - Tooltip: Movement speed increased by 5% + Tooltip: "{$CommonItemTooltip.PercentIncreasedSummonDamage}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson index 7ac8dddb6c..2c7fff7f7e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Vanity.hjson @@ -58,7 +58,7 @@ AstrumDeusMask: { Tooltip: "" } -BrimstoneWaifuMask: { +BrimstoneElementalMask: { DisplayName: Brimstone Elemental Mask Tooltip: "" } @@ -128,6 +128,21 @@ LeviathanMask: { Tooltip: "" } +LucisBoots: { + DisplayName: Luci's Boots + Tooltip: "'One small step a time, you can do this.'" +} + +LucisHairstyle: { + DisplayName: Luci's Hairstyle + Tooltip: "'Hero of Light, Luci Skyshot.'" +} + +LucisMilitaryUniform: { + DisplayName: Luci's Military Uniform + Tooltip: "'Bearing the iconic Liberation Army insignia of freedom.'" +} + OldDukeMask: { DisplayName: Old Duke Mask Tooltip: "" @@ -253,6 +268,16 @@ TheGrandGarment: { Tooltip: Part of The High-Flying Finery } +VictideCoralTurban: { + DisplayName: Victide Coral Turban + Tooltip: "" +} + +VictideShellmet: { + DisplayName: Victide Shellmet + Tooltip: "" +} + YharonMask: { DisplayName: Yharon Mask Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Debug.hjson b/Localization/en-US/Mods.CalamityMod.Items.Debug.hjson new file mode 100644 index 0000000000..3e4013eca5 --- /dev/null +++ b/Localization/en-US/Mods.CalamityMod.Items.Debug.hjson @@ -0,0 +1,4 @@ +DialogueDisplayDebugItem: { + DisplayName: Dialogue Display Debug Item + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson index 5ccba37d5d..9b45147d45 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Dyes.hjson @@ -123,6 +123,11 @@ WingTimeHairDye: { Tooltip: "" } +InvisibleDye: { + DisplayName: Invisible Dye + Tooltip: "" +} + LivingShardDye: { DisplayName: Living Shard Dye Tooltip: "" diff --git a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson index 4cdeb69161..075b4cea5c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Fishing.hjson @@ -102,7 +102,7 @@ DragoonDrizzlefish: { ''' Fires an assortment of hellfire and brimstone fireballs Sometimes fires a larger splitting fireball - Right click to feed the little boy some tasty gel + to feed the little boy some tasty gel 'He is a hungry boy' ''' } @@ -282,6 +282,7 @@ EarlyBloomRod: { Tooltip: ''' Fires six lines at once. Line never snaps + Equip this as an accessory to disable fishing minigames 'The early bird catches the fish' ''' } @@ -291,7 +292,12 @@ FeralDoubleRod: { Tooltip: ''' Fires two lines at once - Just as you have tamed the jungle monster, you can now tame the fish in the sea + Gains fishing power the more life you have lost + Provides a fishing minigame + Press to drain life + Draining life speeds up catches + Bobbers can hook onto enemies, dealing damage when life is drained + Equip this as an accessory to use this minigame for other rods ''' } @@ -300,8 +306,12 @@ HeronRod: { Tooltip: ''' Increases fishing power by {0}x when in space - 'A silent head and beak lanced down and plucked it out by the head, - and the beak swallowed the little fish while its tail waved frantically.' + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rings appear over time above the water's surface + Touching a ring hooks an item onto the bobber + Bobbers will automatically reel in hooked items upon landing back in the water + Equip this as an accessory to use this minigame for other rods ''' } @@ -309,9 +319,11 @@ NavyFishingRod: { DisplayName: Navy Fishing Rod Tooltip: ''' - While held, slowly electrifies nearby enemies - 'The sea is a city. - Just below are highways, boulevards, streets and roundabouts bustling with submarine traffic.' + Fires bobbers that inflict Static Discharge on nearby enemies + Provides a fishing minigame + The bobber will float at your height underwater, allowing underwater fishing + Move in the indicated direction while fishing to catch items + Equip this as an accessory to use this minigame for other rods ''' } @@ -319,10 +331,13 @@ RiftReeler: { DisplayName: Rift Reeler Tooltip: ''' - Fires three to five lines at once + Fires four lines at once Can fish in lava - 'The battlefield is a scene of constant chaos. - The winner will be the one who controls that chaos, both the pole and the fish.' + Provides a fishing minigame + Moving while fishing instead moves your bobbers + Rifts appear over time in liquids, containing an item + When bobbers touch a rift, they automatically reel in the item within + Equip this as an accessory to use this minigame for other rods ''' } @@ -331,6 +346,7 @@ SlurperPole: { Tooltip: ''' Can fish in lava + Equip this as an accessory to disable fishing minigames 'It is the burning lava of the soul that has a furnace within--a very volcano of grief and sorrow.' ''' } @@ -340,6 +356,11 @@ TheDevourerofCods: { Tooltip: ''' Fires ten lines at once. Line never snaps and can fish from lava + Provides a fishing minigame + Hooked items stay hooked forever + Common fish are automatically consumed while fishing + Consuming fish allows a bobber to hook a new item and feeds the user + Equip this as an accessory to use this minigame for other rods 'The devourer was once just an Eater of Shoals' ''' } @@ -349,13 +370,22 @@ VerstaltiteFishingRod: { Tooltip: ''' Increases fishing power by {0}x when in the tundra + Equip this as an accessory to disable fishing minigames The ancient alloy's prismatic qualities are perfect for attracting fish ''' } WulfrumRod: { DisplayName: Wulfrum Fishing Pole - Tooltip: "'This barely works, but it's better than nothing...'" + Tooltip: + ''' + Can fish up Wulfrum Metal Scrap and Wulfrum Energy Cores + Provides a fishing minigame + Move in the indicated direction while fishing to catch items + The rod empowers the longer you go without a mistake, speeding it up + Equip this as an accessory to use this minigame for other rods + 'This barely works, but it's better than nothing...' + ''' } // Bait diff --git a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson index eeb8cd9033..e5e5499fae 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Lore.hjson @@ -1,7 +1,7 @@ ShortTooltip: ''' [c/E3AF40:Whispers from on high dance in your ears...] - [c/BEBEBE:Press "Left Shift" to listen closer] + [c/BEBEBE:Hold Shift to listen closer] ''' LoreAbyss: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson index 5856fdccf4..ba2ebe56aa 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Materials.hjson @@ -53,11 +53,6 @@ BloodOrb: { Tooltip: "" } -BloodSample: { - DisplayName: Blood Sample - Tooltip: "" -} - Bloodstone: { DisplayName: Bloodstone Tooltip: "" @@ -247,11 +242,6 @@ ReaperTooth: { Tooltip: Sharp enough to cut diamonds } -RottenMatter: { - DisplayName: Rotten Matter - Tooltip: "" -} - RuinousSoul: { DisplayName: Ruinous Soul Tooltip: A shard of the distant past @@ -336,3 +326,8 @@ AnodizedWulfrumMetal: { DisplayName: Anodized Wulfrum Metal Tooltip: "" } + +WillOWisp: { + DisplayName: Will O Wisp + Tooltip: "" +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson index cef111bb8e..dde7b09dae 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Misc.hjson @@ -48,8 +48,8 @@ BabyGhostBellRadiantItem: { Tooltip: "" } -BabyGhostBellRedItem: { - DisplayName: Red Baby Ghost Bell +BabyGhostBellPinkItem: { + DisplayName: Pink Baby Ghost Bell Tooltip: "" } @@ -83,11 +83,6 @@ PearlpodItem: { Tooltip: "" } -PearlpodGoldItem: { - DisplayName: "{$NPCs.PearlpodGold.DisplayName}" - Tooltip: "" -} - PearlpodPinkItem: { DisplayName: Pink Pearlpod Tooltip: "" @@ -168,6 +163,11 @@ RepairUnitItem: { Tooltip: "" } +SeaFloatyItem: { + DisplayName: "{$NPCs.SeaFloaty.DisplayName}" + Tooltip: "" +} + SeaMinnowItem: { DisplayName: "{$NPCs.SeaMinnow.DisplayName}" Tooltip: "" @@ -383,19 +383,14 @@ VoodooDemonVoodooDoll: { ExhumeShortTooltip: ''' [c/C61B40:'Ah, are you curious what I saw within this item?'] - [c/BABABA:Press "Left Shift" to listen] + [c/BABABA:Hold Shift to listen] ''' LegendaryShortTooltip: ''' [c/FF6F00:Tales of legends past radiate around you...] - [c/BABABA:Press "Left Shift" to listen closer] + [c/BABABA:Hold Shift to listen closer] ''' -AlicornonaStick: { - DisplayName: Alicorn on a Stick - Tooltip: "'Congratulations, you're winner! Here's my head on a stick.'" -} - BallAndChain: { DisplayName: Ball and Chain Tooltip: @@ -415,6 +410,22 @@ BrimstoneLocus: { ''' } +ColdheartIcicle: { + DisplayName: Coldheart Icicle + Tooltip: "'N(ice) work'" +} + +DisgustingMeat: { + DisplayName: Disgusting Meat + Tooltip: + ''' + Debug item, spawn and use to remove permanent upgrades + will remove health and mana upgrades, use with no Calamity upgrades to remove vanilla upgrades + will remove rage and adrenaline upgrades, plus other miscellaneous boosters + Removed boosters will be vomited out of you as items + ''' +} + MomentumCapacitor: { DisplayName: Momentum Capacitor GFBName: Burden Breaker @@ -503,6 +514,7 @@ SuperDummy: { Creates a super dummy Regenerates 1 million life per second Will not die when taking damage over time from debuffs - Right click to kill all super dummies + to kill all super dummies + Can only spawn 50 super dummies at once ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson index 609f6d8a11..28ecd49ad7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Mounts.hjson @@ -32,7 +32,7 @@ GazeOfCrysthamyr: { Tooltip: ''' Summons a rideable shadow dragon mount - Hold Up to ascend faster + Hold {$Key.UP} to ascend faster ''' } @@ -53,15 +53,6 @@ OnyxExcavatorKey: { ''' } -PrincessSpiritinaBottle: { - DisplayName: Princess Spirit in a Bottle - Tooltip: - ''' - Summons the spirit of Cirrus, the Drunk Princess, in her alicorn form - Mounting will transform Cirrus, dismounting transforms her back - ''' -} - SuspiciousLookingJellyBean: { DisplayName: Suspicious Looking Jelly Bean Tooltip: JELLY BEAN diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index afef9d3c6a..746f0693ae 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -82,6 +82,7 @@ PlaguebringerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueChargerBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PlagueshellBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" PrismBackBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +ProbesnoutBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ProfanedEnergyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" RadiatorBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ReaperSharkBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -96,6 +97,7 @@ ScryllarBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaFloatyBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaMinnowBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SeaSerpentBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" +SharkoonBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShockstormShuttleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" ShroombleBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" SightseerColliderBanner.DisplayName: "{$Items.Placeables.FormattedBannerName}" @@ -499,7 +501,7 @@ CalamityCanvas2023: { to make the focus follow the cursor, again to set it Arrow keys can also be used to manually adjust the focus point The scroll wheel zooms the focus in and out - Hold SHIFT to hide the UI without closing it + Hold Shift to hide the UI without closing it 'Embrace chaos' ''' } @@ -512,16 +514,11 @@ CalamityCanvas2024: { to make the focus follow the cursor, again to set it Arrow keys can also be used to manually adjust the focus point The scroll wheel zooms the focus in and out - Hold SHIFT to hide the UI without closing it + Hold Shift to hide the UI without closing it 'Embrace havoc' ''' } -CirrusCouch: { - DisplayName: Cirrus Couch - Tooltip: This shouldn't exist... -} - AquaticScourgeRelic: { DisplayName: Aquatic Scourge Relic Tooltip: A glimpse into what could have been... @@ -709,21 +706,11 @@ AltarOfTheAccursedItem: { ''' } -AncientAltar: { - DisplayName: Ancient Altar - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - AshenAltar: { DisplayName: Ashen Altar Tooltip: "{$CommonItemTooltip.SpecialCrafting}" } -BotanicPlanter: { - DisplayName: Botanic Planter - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - CosmicAnvilItem: { DisplayName: Cosmic Anvil Tooltip: @@ -742,21 +729,6 @@ DraedonsForge: { ''' } -EffulgentManipulator: { - DisplayName: Effulgent Manipulator - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - -EutrophicShelf: { - DisplayName: Eutrophic Shelf - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - -MonolithAmalgam: { - DisplayName: Monolith Amalgam - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - PlagueInfuser: { DisplayName: Plague Infuser Tooltip: "{$CommonItemTooltip.SpecialCrafting}" @@ -767,21 +739,11 @@ ProfanedCrucible: { Tooltip: "{$CommonItemTooltip.SpecialCrafting}" } -StaticRefiner: { - DisplayName: Static Refiner - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - VoidCondenser: { DisplayName: Void Condenser Tooltip: "{$CommonItemTooltip.SpecialCrafting}" } -WulfrumLabstationItem: { - DisplayName: Wulfrum Labstation - Tooltip: "{$CommonItemTooltip.SpecialCrafting}" -} - CrimsonEffigy: { DisplayName: Crimson Effigy Tooltip: @@ -798,7 +760,7 @@ ThankYouPainting: { ''' Thanks to the entire team, everyone who supported, and those who all play the mod and keep it alive! The confines of this painting is not enough to fit the entire team - Hold SHIFT to see a list of past and current developers + Hold Shift to see a list of past and current developers ''' } @@ -897,6 +859,11 @@ KelpTorch: { Tooltip: Can be placed in water } +OldDukeMonolith: { + DisplayName: Elden Diorama + Tooltip: "" +} + OtonilouStatue: { DisplayName: Otonilou Memorial Tooltip: "" @@ -938,7 +905,7 @@ ResilientCandle: { ''' when placed to make defense block {0}% more damage ({1}% in Classic, {2}% in Expert, and {3}% in Master) - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'Neither rain nor wind can snuff its undying flame' ''' } @@ -959,7 +926,7 @@ SpitefulCandle: { ''' when placed to deal {0}x damage to all enemies The extra {1}x damage bypasses enemy defense and damage reduction - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'Its hateful glow flickers with ire' ''' } @@ -1199,8 +1166,8 @@ VigorousCandle: { Tooltip: ''' when placed to regenerate {0}% of your maximum health per second - This regeneration is at full power even while moving and bypasses Revengeance Mode caps - This cannot be stacked with other Cirrus Candle buffs + This regeneration is at full power even while moving + This cannot be stacked with other Candle buffs 'Its brilliant light suffuses those nearby with hope' ''' } @@ -1210,7 +1177,7 @@ WeightlessCandle: { Tooltip: ''' when placed to gain {0}% increased movement speed, wing time and acceleration - This cannot be stacked with other Cirrus Candle buffs + This cannot be stacked with other Candle buffs 'The floating flame seems to uplift your very spirit' ''' } @@ -1424,6 +1391,11 @@ AcidwoodWorkBench: { Tooltip: "" } +AncientAltar: { + DisplayName: Ancient Altar + Tooltip: "" +} + AncientBasin: { DisplayName: Ancient Basin Tooltip: "" @@ -1763,6 +1735,11 @@ BotanicPiano: { Tooltip: "" } +BotanicPlanter: { + DisplayName: Botanic Planter + Tooltip: "" +} + BotanicPlatform: { DisplayName: Botanic Platform Tooltip: "" @@ -1893,103 +1870,308 @@ CosmiliteWorkBench: { Tooltip: "" } +DriftwoodBaroqueCello: { + DisplayName: Driftwood Baroque Cello + Tooltip: "" +} + +DriftwoodBathtub: { + DisplayName: Driftwood Bathtub + Tooltip: "" +} + +DriftwoodBed: { + DisplayName: Driftwood Bed + Tooltip: "" +} + +DriftwoodBookcase: { + DisplayName: Driftwood Bookcase + Tooltip: "" +} + +DriftwoodCandelabra: { + DisplayName: Driftwood Candelabra + Tooltip: "" +} + +DriftwoodCandle: { + DisplayName: Driftwood Candle + Tooltip: "" +} + +DriftwoodChair: { + DisplayName: Driftwood Chair + Tooltip: "" +} + +DriftwoodChandelier: { + DisplayName: Driftwood Chandelier + Tooltip: "" +} + +DriftwoodChest: { + DisplayName: Driftwood Chest + Tooltip: "" +} + +DriftwoodDoor: { + DisplayName: Driftwood Door + Tooltip: "" +} + +DriftwoodDresser: { + DisplayName: Driftwood Dresser + Tooltip: "" +} + +DriftwoodLamp: { + DisplayName: Driftwood Lamp + Tooltip: "" +} + +DriftwoodLantern: { + DisplayName: Driftwood Lantern + Tooltip: "" +} + +DriftwoodPlatform: { + DisplayName: Driftwood Platform + Tooltip: "" +} + +DriftwoodSink: { + DisplayName: Driftwood Sink + Tooltip: Counts as a water source +} + +DriftwoodSofa: { + DisplayName: Driftwood Sofa + Tooltip: "" +} + +DriftwoodSundial: { + DisplayName: Driftwood Sundial + Tooltip: "" +} + +DriftwoodTable: { + DisplayName: Driftwood Table + Tooltip: "" +} + +DriftwoodToilet: { + DisplayName: Driftwood Toilet + Tooltip: "" +} + +DriftwoodWorkBench: { + DisplayName: Driftwood Work Bench + Tooltip: "" +} + +AncientNavystoneBathtub: { + DisplayName: Ancient Navystone Bathtub + Tooltip: "" +} + +AncientNavystoneBed: { + DisplayName: Ancient Navystone Bed + Tooltip: "" +} + +AncientNavystoneBench: { + DisplayName: Ancient Navystone Bench + Tooltip: "" +} + +AncientNavystoneBookcase: { + DisplayName: Ancient Navystone Bookcase + Tooltip: "" +} + +AncientNavystoneCandelabra: { + DisplayName: Ancient Navystone Candelabra + Tooltip: "" +} + +AncientNavystoneCandle: { + DisplayName: Ancient Navystone Candle + Tooltip: "" +} + +AncientNavystoneChair: { + DisplayName: Ancient Navystone Chair + Tooltip: "" +} + +AncientNavystoneChandelier: { + DisplayName: Ancient Navystone Chandelier + Tooltip: "" +} + +AncientNavystoneChest: { + DisplayName: Ancient Navystone Chest + Tooltip: "" +} + +AncientNavystoneClock: { + DisplayName: Ancient Navystone Clock + Tooltip: "" +} + +AncientNavystoneDoor: { + DisplayName: Ancient Navystone Door + Tooltip: "" +} + +AncientNavystoneDresser: { + DisplayName: Ancient Navystone Dresser + Tooltip: "" +} + +AncientNavystoneLamp: { + DisplayName: Ancient Navystone Lamp + Tooltip: "" +} + +AncientNavystoneLantern: { + DisplayName: Ancient Navystone Lantern + Tooltip: "" +} + +AncientNavystonePiano: { + DisplayName: Ancient Navystone Piano + Tooltip: "" +} + +AncientNavystonePlatform: { + DisplayName: Ancient Navystone Platform + Tooltip: "" +} + +AncientNavystoneSink: { + DisplayName: Ancient Navystone Sink + Tooltip: Counts as a water source +} + +AncientNavystoneTable: { + DisplayName: Ancient Navystone Table + Tooltip: "" +} + +AncientNavystoneWorkBench: { + DisplayName: Ancient Navystone Work Bench + Tooltip: "" +} + AncientSmoothNavystone: { DisplayName: Ancient Smooth Navystone Tooltip: "" } -EutrophicBathtub: { - DisplayName: Eutrophic Bathtub +EutrophicShelf: { + DisplayName: Eutrophic Shelf Tooltip: "" } -EutrophicBed: { - DisplayName: Eutrophic Bed +NavystoneBathtub: { + DisplayName: Navystone Bathtub Tooltip: "" } -EutrophicBench: { - DisplayName: Eutrophic Bench +NavystoneBed: { + DisplayName: Navystone Bed Tooltip: "" } -EutrophicBookcase: { - DisplayName: Eutrophic Bookcase +NavystoneBookcase: { + DisplayName: Navystone Bookcase Tooltip: "" } -EutrophicCandelabra: { - DisplayName: Eutrophic Candelabra +NavystoneCandelabra: { + DisplayName: Navystone Candelabra Tooltip: "" } -EutrophicCandle: { - DisplayName: Eutrophic Candle +NavystoneCandle: { + DisplayName: Navystone Candle Tooltip: "" } -EutrophicChair: { - DisplayName: Eutrophic Chair +NavystoneChair: { + DisplayName: Navystone Chair Tooltip: "" } -EutrophicChandelier: { - DisplayName: Eutrophic Chandelier +NavystoneChandelier: { + DisplayName: Navystone Chandelier Tooltip: "" } -EutrophicChest: { - DisplayName: Eutrophic Chest +NavystoneChest: { + DisplayName: Navystone Chest Tooltip: "" } -EutrophicClock: { - DisplayName: Eutrophic Clock +NavystoneClock: { + DisplayName: Navystone Clock Tooltip: "" } -EutrophicDoor: { - DisplayName: Eutrophic Door +NavystoneDoor: { + DisplayName: Navystone Door Tooltip: "" } -EutrophicDresser: { - DisplayName: Eutrophic Dresser +NavystoneDresser: { + DisplayName: Navystone Dresser Tooltip: "" } -EutrophicLamp: { - DisplayName: Eutrophic Lamp +NavystoneLamp: { + DisplayName: Navystone Lamp Tooltip: "" } -EutrophicLantern: { - DisplayName: Eutrophic Lantern +NavystoneLantern: { + DisplayName: Navystone Lantern Tooltip: "" } -EutrophicPiano: { - DisplayName: Eutrophic Piano +NavystoneLyre: { + DisplayName: Navystone Lyre Tooltip: "" } -EutrophicPlatform: { - DisplayName: Eutrophic Platform +NavystonePlatform: { + DisplayName: Navystone Platform Tooltip: "" } -EutrophicSink: { - DisplayName: Eutrophic Sink +NavystoneSink: { + DisplayName: Navystone Sink Tooltip: Counts as a water source } -EutrophicTable: { - DisplayName: Eutrophic Table +NavystoneTable: { + DisplayName: Navystone Table Tooltip: "" } -EutrophicWorkBench: { - DisplayName: Eutrophic Work Bench +NavystoneToilet: { + DisplayName: Navystone Toilet + Tooltip: "" +} + +NavystoneTriclinium: { + DisplayName: Navystone Triclinium + Tooltip: "" +} + +NavystoneWorkBench: { + DisplayName: Navystone Work Bench Tooltip: "" } @@ -2253,6 +2435,11 @@ PolishedMarniteWall: { Tooltip: "" } +MonolithAmalgam: { + DisplayName: Monolith Amalgam + Tooltip: "" +} + MonolithBathtub: { DisplayName: Monolith Bathtub Tooltip: "" @@ -2797,6 +2984,11 @@ SacrilegiousWorkBench: { Tooltip: "" } +SilvaBasin: { + DisplayName: Silva Basin + Tooltip: "" +} + SilvaBathtub: { DisplayName: Silva Bathtub Tooltip: "" @@ -2897,6 +3089,11 @@ SilvaWorkBench: { Tooltip: "" } +StaticRefiner: { + DisplayName: Static Refiner + Tooltip: "" +} + StatigelBathtub: { DisplayName: Statigel Bathtub Tooltip: "" @@ -3207,6 +3404,16 @@ VoidWorkBench: { Tooltip: "" } +ChargedWulfrumEnergyBarrier: { + DisplayName: Charged Wulfrum Energy Barrier + Tooltip: "" +} + +ChargedWulfrumWallMountedBulb: { + DisplayName: Charged Wulfrum Wall Mounted Bulb + Tooltip: "" +} + WulfrumBathtub: { DisplayName: Wulfrum Bathtub Tooltip: "" @@ -3252,6 +3459,16 @@ WulfrumDresser: { Tooltip: "" } +WulfrumEnergyBarrier: { + DisplayName: Wulfrum Energy Barrier + Tooltip: "" +} + +WulfrumLabstationItem: { + DisplayName: Wulfrum Labstation + Tooltip: "" +} + WulfrumLamp: { DisplayName: Wulfrum Lamp Tooltip: "" @@ -3262,19 +3479,39 @@ WulfrumLantern: { Tooltip: "" } +WulfrumPanels: { + DisplayName: Wulfrum Panels + Tooltip: "" +} + WulfrumPiano: { DisplayName: Wulfrum Piano Tooltip: "" } +WulfrumPlatform: { + DisplayName: Wulfrum Platform + Tooltip: "" +} + WulfrumPlating: { DisplayName: Wulfrum Plating Tooltip: "" } +WulfrumSheets: { + DisplayName: Wulfrum Sheets + Tooltip: "" +} + +WulfrumSiding: { + DisplayName: Wulfrum Siding + Tooltip: "" +} + WulfrumSink: { DisplayName: Wulfrum Sink - Tooltip: "" + Tooltip: Counts as a water source } WulfrumSofa: { @@ -3292,11 +3529,121 @@ WulfrumToilet: { Tooltip: "" } +WulfrumWallMountedBulb: { + DisplayName: Wulfrum Wall Mounted Bulb + Tooltip: "" +} + WulfrumWorkBench: { DisplayName: Wulfrum Work Bench Tooltip: "" } +AnodizedWulfrumBathtub: { + DisplayName: Anodized Wulfrum Bathtub + Tooltip: "" +} + +AnodizedWulfrumBookcase: { + DisplayName: Anodized Wulfrum Bookcase + Tooltip: "" +} + +AnodizedWulfrumChair: { + DisplayName: Anodized Wulfrum Chair + Tooltip: "" +} + +AnodizedWulfrumChandelier: { + DisplayName: Anodized Wulfrum Chandelier + Tooltip: "" +} + +AnodizedWulfrumChest: { + DisplayName: Anodized Wulfrum Chest + Tooltip: "" +} + +AnodizedWulfrumDeskLight: { + DisplayName: Anodized Wulfrum Desk Light + Tooltip: "" +} + +AnodizedWulfrumDoor: { + DisplayName: Anodized Wulfrum Door + Tooltip: "" +} + +AnodizedWulfrumDresser: { + DisplayName: Anodized Wulfrum Dresser + Tooltip: "" +} + +AnodizedWulfrumJukebox: { + DisplayName: Anodized Wulfrum Jukebox + Tooltip: "" +} + +AnodizedWulfrumLamp: { + DisplayName: Anodized Wulfrum Lamp + Tooltip: "" +} + +AnodizedWulfrumLantern: { + DisplayName: Anodized Wulfrum Lantern + Tooltip: "" +} + +AnodizedWulfrumPanels: { + DisplayName: Anodized Wulfrum Panels + Tooltip: "" +} + +AnodizedWulfrumPlatform: { + DisplayName: Anodized Wulfrum Platform + Tooltip: "" +} + +AnodizedWulfrumSink: { + DisplayName: Anodized Wulfrum Sink + Tooltip: Counts as a water source +} + +AnodizedWulfrumSleepingPod: { + DisplayName: Anodized Wulfrum Sleeping Pod + Tooltip: "" +} + +AnodizedWulfrumSofa: { + DisplayName: Anodized Wulfrum Sofa + Tooltip: "" +} + +AnodizedWulfrumTable: { + DisplayName: Anodized Wulfrum Table + Tooltip: "" +} + +AnodizedWulfrumTrim: { + DisplayName: Anodized Wulfrum Trim + Tooltip: "" +} + +AnodizedWulfrumToilet: { + DisplayName: Anodized Wulfrum Toilet + Tooltip: "" +} + +AnodizedWulfrumWorkBench: { + DisplayName: Anodized Wulfrum Work Bench + Tooltip: "" +} + +RoundedAnodizedWulfrumPanels: { + DisplayName: Rounded Anodized Wulfrum Panels + Tooltip: "" +} + HardenedAstralSand: { DisplayName: Hardened Astral Sand Tooltip: "" @@ -3516,6 +3863,11 @@ Driftwood: { Tooltip: "" } +Dunesand: { + DisplayName: Dunesand + Tooltip: "" +} + Navystone: { DisplayName: Navystone Tooltip: "" @@ -3596,6 +3948,11 @@ PolypSand: { Tooltip: "" } +TableCoralLeft: { + DisplayName: Table Coral + Tooltip: "" +} + VolcanicSand: { DisplayName: Volcanic Sand Tooltip: "" @@ -3603,6 +3960,11 @@ VolcanicSand: { // End of Sunken Sea +Dreadstone: { + DisplayName: Dreadstone + Tooltip: "" +} + UelibloomBrick: { DisplayName: Uelibloom Brick Tooltip: "" @@ -3633,6 +3995,11 @@ AerialiteBrickWall: { Tooltip: "" } +AncientSmoothNavystoneWall: { + DisplayName: Ancient Smooth Navystone Wall + Tooltip: "" +} + AshenSlabWall: { DisplayName: Ashen Slab Wall Tooltip: "" @@ -3752,6 +4119,16 @@ RustedPlatingWall: { // End of Draedon +AnodizedWulfrumTrimWall: { + DisplayName: Anodized Wulfrum Trim Wall + Tooltip: "" +} + +ChargedWulfrumEnergyBarrierWall: { + DisplayName: Charged Wulfrum Energy Barrier Wall + Tooltip: "" +} + DriftwoodWall: { DisplayName: Driftwood Wall Tooltip: "" @@ -3762,13 +4139,8 @@ ElumplateWall: { Tooltip: "" } -EutrophicSandWall: { - DisplayName: Unsafe Eutrophic Sand Wall - Tooltip: "" -} - -EutrophicSandWallSafe: { - DisplayName: Eutrophic Sand Wall +EutrophicGlassWall: { + DisplayName: Eutrophic Glass Wall Tooltip: "" } @@ -3802,17 +4174,17 @@ HavocplateWall: { Tooltip: "" } +LimestoneWall: { + DisplayName: Limestone Wall + Tooltip: "" +} + NavyplateWall: { DisplayName: Navyplate Wall Tooltip: "" } NavystoneWall: { - DisplayName: Unsafe Navystone Wall - Tooltip: "" -} - -NavystoneWallSafe: { DisplayName: Navystone Wall Tooltip: "" } @@ -3867,6 +4239,16 @@ PyreMantleWall: { Tooltip: "" } +RoundedAnodizedWulfrumPanelWall: { + DisplayName: Rounded Anodized Wulfrum Panel Wall + Tooltip: "" +} + +RunestoneWall: { + DisplayName: Runestone Wall + Tooltip: "" +} + RunicProfanedBrickWall: { DisplayName: Runic Profaned Brick Wall Tooltip: "" @@ -3957,11 +4339,41 @@ VoidstoneWall: { Tooltip: "" } +WulfrumComplexPanelWall: { + DisplayName: Wulfrum Complex Panel Wall + Tooltip: "" +} + +WulfrumEnergyBarrierWall: { + DisplayName: Wulfrum Energy Barrier Wall + Tooltip: "" +} + +WulfrumPanelWall: { + DisplayName: Wulfrum Panel Wall + Tooltip: "" +} + +WulfrumPillar: { + DisplayName: Wulfrum Pillar + Tooltip: "" +} + WulfrumPlatingWall: { DisplayName: Wulfrum Plating Wall Tooltip: "" } +WulfrumSheetWall: { + DisplayName: Wulfrum Sheet Wall + Tooltip: "" +} + +WulfrumSidingWall: { + DisplayName: Wulfrum Siding Wall + Tooltip: "" +} + FireTurret: { DisplayName: Fire Turret Tooltip: @@ -4202,130 +4614,32 @@ MiniAgedFloodlightItem: { Tooltip: "" } -ProbesnoutBanner.DisplayName: Probesnout Banner -SharkoonBanner.DisplayName: Sharkoon Banner - -LimestoneWall: { - DisplayName: Limestone Wall +AridSoil: { + DisplayName: Arid Soil Tooltip: "" } -RunestoneWall: { - DisplayName: Runestone Wall +RunestoneTerracotta: { + DisplayName: Runestone Terracotta Tooltip: "" } -WulfrumEnergyBarrier: { - DisplayName: Wulfrum Energy Barrier +ShellTrimBrick: { + DisplayName: Shell Trim Brick Tooltip: "" } -WulfrumPanels: { - DisplayName: Wulfrum Panels +ShellTrimBrickWall: { + DisplayName: Shell Trim Brick Wall Tooltip: "" } -ChargedWulfrumEnergyBarrier: { - DisplayName: Charged Wulfrum Energy Barrier +BasaltSlab: { + DisplayName: Basalt Slab Tooltip: "" } -WulfrumEnergyBarrierWall: { - DisplayName: Wulfrum Energy Barrier Wall - Tooltip: "" -} - -ChargedWulfrumEnergyBarrierWall: { - DisplayName: Charged Wulfrum Energy Barrier Wall - Tooltip: "" -} - -WulfrumPlatform: { - DisplayName: Wulfrum Platform - Tooltip: "" -} - -WulfrumSheets: { - DisplayName: Wulfrum Sheets - Tooltip: "" -} - -WulfrumSiding: { - DisplayName: Wulfrum Siding - Tooltip: "" -} - -WulfrumPillar: { - DisplayName: Wulfrum Pillar - Tooltip: "" -} - -WulfrumComplexPanelWall: { - DisplayName: Wulfrum Complex Panel Wall - Tooltip: "" -} - -AnodizedWulfrumPlatform: { - DisplayName: Anodized Wulfrum Platform - Tooltip: "" -} - -AnodizedWulfrumTrim: { - DisplayName: Anodized Wulfrum Trim - Tooltip: "" -} - -RoundedAnodizedWulfrumPanels: { - DisplayName: Rounded Anodized Wulfrum Panels - Tooltip: "" -} - -AnodizedWulfrumTrimWall: { - DisplayName: Anodized Wulfrum Trim Wall - Tooltip: "" -} - -RoundedAnodizedWulfrumPanelWall: { - DisplayName: Rounded Anodized Wulfrum Panel Wall - Tooltip: "" -} - -AnodizedWulfrumPanels: { - DisplayName: Anodized Wulfrum Panels - Tooltip: "" -} - -WulfrumPanelWall: { - DisplayName: Wulfrum Panel Wall - Tooltip: "" -} - -ChargedWulfrumWallMountedBulb: { - DisplayName: Mods.CalamityMod.Items.Placeables.ChargedWulfrumWallMountedBulb.DisplayName - Tooltip: "" -} - -WulfrumWallMountedBulb: { - DisplayName: Mods.CalamityMod.Items.Placeables.WulfrumWallMountedBulb.DisplayName - Tooltip: "" -} - -WulfrumSheetWall: { - DisplayName: Wulfrum Sheet Wall - Tooltip: "" -} - -WulfrumSidingWall: { - DisplayName: Wulfrum Siding Wall - Tooltip: "" -} - -Dunesand: { - DisplayName: Dunesand - Tooltip: "" -} - -EutrophicGlassWall: { - DisplayName: Eutrophic Glass Wall +UnsafeNavystoneWall: { + DisplayName: Unsafe Navystone Wall Tooltip: "" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 051ecad1a8..52367ac720 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -60,15 +60,6 @@ DeliciousMeat: { ''' } -Fabsoup: { - DisplayName: Pot of Pain - Tooltip: - ''' - {$CommonItemTooltip.MajorStats} - 'hrngh, soup' - ''' -} - FlaskOfBrimstone: { DisplayName: Flask of Brimstone Tooltip: Melee, Whip, and Rogue attacks inflict {$Buffs.BrimstoneFlames.DisplayName} @@ -99,6 +90,15 @@ HadalStew: { ''' } +LavaChickenBroth: { + DisplayName: Lava Chicken Broth + Tooltip: + ''' + {$CommonItemTooltip.MajorStats} + 'It's tasty as hell' + ''' +} + OmegaHealingPotion: { DisplayName: Omega Healing Potion Tooltip: "" @@ -158,7 +158,7 @@ ZergPotion: { Tooltip: Vastly increases enemy spawn rate } -// Drunk Princess Shop Items +// Very normal Keg crafts BloodyMary: { DisplayName: Bloody Mary Tooltip: @@ -166,7 +166,6 @@ BloodyMary: { {0}% increased damage and movement speed during a Blood Moon Reduces life regen by {1} HP/s and defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Extra spicy... and bloody!'] ''' } @@ -177,7 +176,6 @@ CaribbeanRum: { Increases life regen by {0} HP/s, movement speed by {1}% Makes you floaty and reduces defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Why is the rum gone?'] ''' } @@ -188,18 +186,16 @@ CinnamonRoll: { Multiplies all fire-based debuff damage by {0}x and increases mana regeneration Reduces defense by {1}% {$Common.AlcoholWarning} - [c/B00BA5:'A great-tasting cinnamon whiskey with a touch of cream soda.'] ''' } -CirrusVodka: { - DisplayName: Cirrus' Vodka +PurpleHaze: { + DisplayName: purpleHaze Tooltip: ''' {0}% increased damage, but lowers defense by {1}% Increases immune time after being struck {$Common.AlcoholWarning} - This magical liquor is highly sought by those with a refined palate ''' } @@ -211,7 +207,6 @@ Everclear: { Reduces life regen by {1} HP/s and defense by {2}% Counts as 2 alcohols for {$Buffs.AlcoholPoisoning.DisplayName} {$Common.AlcoholWarning} - [c/B00BA5:'This is the most potent booze I have, be careful with it.'] ''' } @@ -222,7 +217,6 @@ EvergreenGin: { Multiplies all sickness and water-related debuff damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'It tastes like a Christmas tree, if you can imagine that.'] ''' } @@ -233,7 +227,6 @@ Fireball: { Multiplies all fire-based debuff damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'A great-tasting cinnamon whiskey.'] ''' } @@ -243,7 +236,6 @@ GrapeBeer: { ''' Reduces defense by {0}% for {1} seconds {$Common.AlcoholWarning} - [c/B00BA5:'This crap is abhorrent, but you might like it.'] ''' } @@ -254,7 +246,6 @@ Margarita: { Halves the duration of most harmful debuffs Reduces defense by {0}% and life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'One of the best drinks ever created, enjoy it while it lasts.'] {$CommonItemTooltip.MinuteDuration@2} ''' } @@ -266,7 +257,6 @@ Moonshine: { Increases defense by {0} and damage reduction by {1}% Reduces life regen by {2} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'This stuff is pretty strong, but I'm sure you can handle it.'] ''' } @@ -277,7 +267,6 @@ MoscowMule: { Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'I once heard the copper mug can be toxic and I told 'em, 'listen, dummy, I'm already poisoning myself!''] ''' } @@ -299,7 +288,6 @@ OldFashioned: { Multiplies most non-weapon, non-debuff damage by {0}x Multiplies all weapon damage by {1}x {$Common.AlcoholWarning} - [c/B00BA5:'An old favorite of mine.'] ''' } @@ -309,7 +297,6 @@ RedWine: { ''' Reduces life regen by {0} HP/s for {1} seconds {$Common.AlcoholWarning} - [c/B00BA5:'Too dry for my taste.'] ''' } @@ -320,7 +307,6 @@ Rum: { Increases life regen by {0} HP/s and movement speed by {1}% Reduces defense by {2}% {$Common.AlcoholWarning} - [c/B00BA5:'Sweet and potent, just how I like it.'] ''' } @@ -331,7 +317,6 @@ Screwdriver: { Multiplies piercing projectile damage by {0}x Reduces life regen by {1} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Do you have a screw loose?'] ''' } @@ -343,7 +328,6 @@ StarBeamRye: { and reduces mana usage by {2}% Reduces defense by {3}% and life regen by {4} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Made from some stuff I found near the Astral Meteor crash site. Don't worry, it's safe, trust me...'] ''' } @@ -354,7 +338,6 @@ Tequila: { Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'Great for mixing up daytime drinks.'] ''' } @@ -365,7 +348,6 @@ TequilaSunrise: { Increases knockback by {0}%, crit chance by {1}% and defense by {2} during daytime Reduces life regen by {3} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'The greatest daytime drink I've ever had.'] ''' } @@ -376,7 +358,6 @@ Vodka: { Increases damage by {0}% and critical strike chance by {1}% Reduces life regen by {2} HP/s and defense by {3}% {$Common.AlcoholWarning} - [c/B00BA5:'The number one alcohol for creating great mixed drinks.'] ''' } @@ -387,7 +368,6 @@ Whiskey: { Increases damage by {0}%, knockback by {1}% and critical strike chance by {2}% Reduces defense by {3}% {$Common.AlcoholWarning} - [c/B00BA5:'The burning sensation makes it tastier.'] ''' } @@ -398,7 +378,6 @@ WhiteWine: { Increases magic damage by {0}% Reduces defense by {1}% and life regen by {2} HP/s {$Common.AlcoholWarning} - [c/B00BA5:'I drank a full barrel of this stuff once in one night, I couldn't remember who I was the next day.'] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson index ad00243c80..3b2b45c9a7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.SummonItems.hjson @@ -14,7 +14,6 @@ AstralChunk: { Tooltip: ''' Summons Astrum Aureus when used in the Astral Infection - Enrages during the day while outside the Astral Infection {$Common.NotConsumable} 'The Infection's fortress has found another target.' ''' @@ -34,7 +33,7 @@ BloodyWormFood: { Tooltip: ''' Summons the Perforator Hive when used in the Crimson - Enrages outside the Underground Crimson + Despawns outside the Crimson {$Common.NotConsumable} 'Do not play with your food, they won't play with theirs.' ''' @@ -42,11 +41,7 @@ BloodyWormFood: { CausticTear: { DisplayName: Caustic Tear - Tooltip: - ''' - Causes an acidic downpour in the Sulphurous Sea - {$Common.NotConsumable} - ''' + Tooltip: Causes an acidic downpour in the Sulphurous Sea } CeremonialUrn: { @@ -86,7 +81,6 @@ CryoKey: { Tooltip: ''' [SPAWN] - Enrages outside the tundra {$Common.NotConsumable} 'A key for a glacial prison.' ''' @@ -108,8 +102,7 @@ DecapoditaSprout: { DisplayName: Decapodita Sprout Tooltip: ''' - Summons Crabulon when used in the Mushroom biome - Enrages outside the Underground Mushroom biome + Summons Crabulon when used in the Underground Mushroom biome {$Common.NotConsumable} 'Bristling with the spores of a unique, parasitic strain.' ''' @@ -152,8 +145,7 @@ EyeofDesolation: { // The GFB tag generates a new line below when placed at the end of a line Tooltip: ''' - Summons the Calamitas Clone when used during nighttime[GFB] - Enrages during the day + Summons the Calamitas Clone[GFB] {$Common.NotConsumable} 'She is here.' ''' @@ -184,7 +176,7 @@ MarkofProvidence: { SpawnVoid: ''' Summons the Ceaseless Void - Enrages on the surface + Despawns on the surface ''' SpawnSignus: Summons Signus, Envoy of the Devourer SpawnWeaver: Summons the Storm Weaver @@ -192,11 +184,7 @@ MarkofProvidence: { MartianDistressRemote: { DisplayName: Martian Distress Remote - Tooltip: - ''' - Summons the Martian Madness - {$Common.NotConsumable} - ''' + Tooltip: Summons the Martian Madness } NecroplasmicBeacon: { @@ -204,6 +192,7 @@ NecroplasmicBeacon: { Tooltip: ''' Summons Polterghast when used in the Dungeon + Despawns on the surface {$Common.NotConsumable} 'The wails of the spirits disturbed something far more terrifying.' ''' @@ -280,7 +269,6 @@ Starcore: { Tooltip: ''' Summons Astrum Deus at the Astral Beacon, but is not consumed - Enrages during the day 'May the stars guide your way' ''' } @@ -290,7 +278,7 @@ Teratoma: { Tooltip: ''' Summons the Hive Mind when used in the Corruption - Enrages outside the Underground Corruption + Despawns outside the Corruption {$Common.NotConsumable} 'An exquisitely hideous tumor for those diseased in the head.' ''' diff --git a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson index 7b35e3cf51..c558c21085 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Tools.hjson @@ -52,6 +52,17 @@ AxeofPurity: { ''' } +Bakidon: { + DisplayName: Bakidon + Tooltip: + ''' + A lost artifact said to pin the heavens in place + to freeze the passage of day and night temporarily + This does not work during celestial anomalies + The time freeze recharges while not in use + ''' +} + BeastialPickaxe: { DisplayName: Beastial Pickaxe Tooltip: "" @@ -80,8 +91,10 @@ Cosmolight: { DisplayName: Cosmolight Tooltip: ''' - Advances time immediately to the next dawn, noon, dusk or midnight - Does not work while a boss is alive + A lost artifact freshly rekindled by exposure to raw cosmic energies + Hold to drastically accelerate the passage of day and night + to freeze the passage of day and night indefinitely + The time freeze lasts forever and works during celestial anomalies ''' } @@ -111,7 +124,7 @@ DriftwoodPickaxe: { FellerofEvergreens: { DisplayName: Feller of Evergreens - Tooltip: "" + Tooltip: Occasionally drops extra fruits from shaking trees } Gelpick: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson index 4dab8cfc05..fc0cf2f1ac 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.TreasureBags.hjson @@ -14,7 +14,7 @@ AstrumDeusBag: { Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } -BrimstoneWaifuBag: { +BrimstoneElementalBag: { DisplayName: Treasure Bag (Brimstone Elemental) Tooltip: "{$CommonItemTooltip.RightClickToOpen}" } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson index 9c176472a5..d0cbc0922e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.DraedonsArsenal.hjson @@ -10,6 +10,42 @@ AerialTracker: { ''' } +AqueousHunterDrone: { + DisplayName: P-PMA: Aqueous Hunter Drone + Tooltip: + ''' + Summons a shrimp drone that fires bursts of homing plasma missiles + while holding any summon weapon to command the shrimp to launch a vertical missile barrage + Vertical missiles aim towards your cursor and leave a lingering blast if they hit solid ground + Each shrimp uses 4 minion slots + [c/1FBFF:'When pursuing the adherents of Gods, Yharim believed no stone should be left unturned.] + [c/1FBFF:Weaponry for underwater contingencies was an unusually heavy focus, but no models ever saw deployment.'] + ''' +} + +Auger: { + DisplayName: P-GSS: Auger + Tooltip: + ''' + A wrist-mounted device which emits a magnetic energy blade + to create a brief magnetic pull at your cursor and amplify your next slash + [c/1FFBFF:'Initially manufactured to serrate and separate chunks of raw material for transport.] + [c/1FFBFF:Keeping both hands free without compromising on power made it exceptionally ergonomic.'] + ''' +} + +CountermeasureMitt: { + DisplayName: B-LSR: Countermeasure Mitt + Tooltip: + ''' + A precision welding glove with laser emitters in each fingertip + to focus all emitters into a short range palm blast that always critically strikes + Palm blasts have a cooldown which is significantly shorter if they miss + [c/1FFBFF:'Most battalions prefer to either spread attacks widely, or focus on a singular target.] + [c/1FFBFF:This glove caters to both, though it will never bridge the gap between their strategies.'] + ''' +} + GalvanizingGlaive: { DisplayName: Galvanizing Glaive Tooltip: @@ -21,15 +57,6 @@ GalvanizingGlaive: { ''' } -GatlingLaser: { - DisplayName: Gatling Laser - Tooltip: - ''' - Fires a rapid barrage of accelerated lasers to annihilate foes - [c/1FFBFF:'Developed to be used primarily by Yharim's fleet and base defense force.'] - ''' -} - GaussDagger: { DisplayName: Gauss Dagger Tooltip: @@ -39,18 +66,8 @@ GaussDagger: { ''' } -GaussPistol: { - DisplayName: Gauss Pistol - Tooltip: - ''' - Fires a devastating high-velocity blast with extreme knockback - [c/1FFBFF:'Though this arcane pistol may seem mundane, it is deceivingly powerful.] - [c/1FFBFF:One of the many advantages of magical firearms is that size does not equal power.'] - ''' -} - -HolofiberImmolator: { - DisplayName: R-PMA: Holofiber Immolator +HolofibreImmolator: { + DisplayName: R-PMA: Holofibre Immolator Tooltip: ''' Fires three gravity-affected plasma drops which dissolve through foes @@ -219,16 +236,6 @@ SnakeEyes: { ''' } -StarSwallowerContainmentUnit: { - DisplayName: Star Swallower Containment Unit - Tooltip: - ''' - Summons a biomechanical frog that vomits plasma onto enemies - [c/1FFBFF:'These simplistic creatures were mechanized to autonomously transport plasma.] - [c/1FFBFF:They are vastly more servicable than their mundane organic counterparts.'] - ''' -} - SystemBane: { DisplayName: System Bane Tooltip: @@ -265,3 +272,16 @@ WavePounder: { Stealth strikes emit absurdly powerful shockwaves ''' } + +Vulcan: { + DisplayName: R-GSS: Vulcan + Tooltip: + ''' + A mana-fueled Gatling cannon that fires in bursts + Press to launch a magnetic harpoon which attracts your shots + Launching a harpoon makes burst fire mode last longer + When a harpoon expires, all magnetized shots launch at nearby enemies with increased damage + [c/1FFBFF:'Originally a ceiling mounted mining beam, the removal of its battery reduced its heft only marginally.] + [c/1FFBFF:It saw little use and many complaints from the battlemage corps.'] + ''' +} diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index 8886653a5d..4657a9d5e5 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -38,7 +38,8 @@ AnahitasArpeggio: { TooltipNormal: ''' Holding casts up to 6 treble clefs that orbit the player - Releasing causes the treble clefs to fade away, then converge at the cursor + Releasing causes the treble clefs to converge at the cursor + After converging, treble clefs seek your cursor ''' TooltipGFB: ''' @@ -246,15 +247,10 @@ DeathValleyDuster: { ''' Casts an enchanted blast of sand that passes through enemies and tiles Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the Sand's Wind Buff - The Sand's Wind Buff increases your defense by 10 and damage by 12% + The Sand's Wind Buff increases your defense by 10, damage by 12%, and greatly buffs mana regen ''' } -DivineRetribution: { - DisplayName: Divine Retribution - Tooltip: Mage is superior to rogue; look, we got a donor weapon to prove it! -} - Downpour: { DisplayName: Downpour Tooltip: @@ -313,11 +309,6 @@ EvergladeSpray: { Tooltip: Fires a stream of burning green ichor } -Fabstaff: { - DisplayName: Fabstaff - Tooltip: Casts a bouncing beam that splits when enemies are near it -} - FaceMelter: { DisplayName: Face Melter Tooltip: @@ -498,7 +489,8 @@ Keelhaul: { DisplayName: Keelhaul Tooltip: ''' - Summons a geyser upon hitting an enemy + Summons a lingering geyser upon hitting an enemy + Only one geyser can exist at a time 'Crumple 'em like paper' ''' } @@ -664,7 +656,7 @@ PrimordialAncient: { ''' Casts five primordial sand blasts that converge at your cursor after a moment and create a giant explosion Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.AeolianEarthBuff.DisplayName} buff - The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}% and damage by {1}% + The {$Buffs.AeolianEarthBuff.DisplayName} buff increases your damage reduction by {0}%, damage by {1}%, and massively buffs mana regen ''' } @@ -674,7 +666,7 @@ PrimordialEarth: { ''' Casts two enchanted blasts of sand that coverge with each other and explode Casting this spell at max mana while without mana sickness will cause it to give you and any player it hits the {$Buffs.SandsWindBuff.DisplayName} buff - The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0} and damage by {1}% + The {$Buffs.SandsWindBuff.DisplayName} buff increases your defense by {0}, damage by {1}%, and greatly buffs mana regen ''' } @@ -794,7 +786,7 @@ SHPC: { Orbs emit seeking souls and lingering pickup souls after collapse Orbs have varying effects depending on Soul type used {0} - Press Right Click to use the machine as a vacuum, pulling in lingering souls + Press to use the machine as a vacuum, pulling in lingering souls Once released, a torrent of soul lasers is discharged scaling with the number of souls pulled in ''' // These are the soul effect descriptions, the number is the item ID of the soul @@ -861,6 +853,15 @@ SubsumingVortex: { ''' } +Sylvestaff: { + DisplayName: Sylvestaff + Tooltip: + ''' + Casts a bouncing beam that splits when enemies are near it + 'Also known as the Karma Staff!' + ''' +} + TacticiansTrumpCard: { DisplayName: Tactician's Trump Card Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index 2cd6bca01a..b1ec177391 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -84,7 +84,7 @@ ArkoftheCosmos: { to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability You can also parry projectiles to make them deal 160 less damage for a short period - Parrying will empower the next 15 swings of the sword + Parrying will empower the next 16 swings of the sword ''' BlastInfo: Double with charges available to cause a Big Rip in spacetime and consume all charges } @@ -135,16 +135,6 @@ Avalanche: { ''' } -Azathoth: { - DisplayName: Azathoth - Tooltip: - ''' - {$Common.YoyoStatsInfinite} - Fires cosmic orbs that blast nearby enemies with lasers - 'Destroy the universe in the blink of an eye' - ''' -} - BalefulHarvester: { DisplayName: Baleful Harvester Tooltip: @@ -195,12 +185,7 @@ BladecrestOathsword: { BlightedCleaver: { DisplayName: Blighted Cleaver - Tooltip: - ''' - Fires homing blazing blades - Gives the player the Brutal Carnage buff on enemy hits - This buff increases melee damage by 20% - ''' + Tooltip: Fires homing blazing blades } Bonebreaker: { @@ -344,12 +329,7 @@ DeathsAscension: { DefiledGreatsword: { DisplayName: Defiled Greatsword - Tooltip: - ''' - Fires blazing, hyper, and sunlight blades - Gives the player the Brutal Carnage buff on enemy hits - This buff increases melee damage by 20% - ''' + Tooltip: Fires blazing, hyper, and sunlight blades } DepthCrusher: { @@ -508,11 +488,7 @@ ExaltedOathblade: { Excelsus: { DisplayName: Excelsus - Tooltip: - ''' - Fires a spread of spinning blades - Summons laser fountains on hit - ''' + Tooltip: Fires a spread of spinning blades } Exoblade: { @@ -664,7 +640,14 @@ GeliticBlade: { GildedProboscis: { DisplayName: Gilded Proboscis - Tooltip: Heals the player on hit + Tooltip: + ''' + Steals life proportional to the damage dealt to foes + to charge up a precise thrust + The thrust begins weak, but becomes more powerful the longer it's held + to dash forward with a mighty upstrike + The distance you dash depends on if you are moving with or against the dash + ''' } GoldplumeSpear: { @@ -705,7 +688,11 @@ GrandGuardian: { GreatswordofJudgement: { DisplayName: Greatsword of Judgement - Tooltip: Fires a piercing energy wave that releases homing stars as it flies + Tooltip: + ''' + Fires a piercing energy wave that releases homing stars as it flies + Hits with the blade summon two stronger stars from behind you + ''' } Greentide: { @@ -778,22 +765,16 @@ InsidiousImpaler: { ''' } -IridescentExcalibur: { - DisplayName: Iridescent Excalibur - Tooltip: - ''' - True melee strikes freeze enemies - Fires rainbow beams that change their behavior based on their color - Press for true melee - ''' -} - Lacerator: { DisplayName: Lacerator Tooltip: ''' {$Common.YoyoStatsInfinite} - Accelerates natural life regeneration on hits with the yoyo + Striking enemies conjures a bloody saw to shred them + The saw does more damage the more often the yoyo hits, and fades away when not striking enemies + Enemies touching the edge of the sawblade get blood orbs torn out of them + Picking up these blood orbs reduces the duration of [Potion Sickness] + The direction of the saw's spin depends on which direction you originally threw the yoyo [GFB] ''' TooltipNormal: Someone thought this was a viable weapon against DoG at one point lol @@ -819,8 +800,10 @@ Lucrecia: { DisplayName: Lucrecia Tooltip: ''' - Fires a DNA chain - Finesse + [c/9370db:Fires a spiraling darklight shard when swung] + [c/837ce4:Hits with the blade itself build energy] + [c/7489ee:Energy is lost over time but briefly stops depleting after reaching its maximum] + [c/6495f7:Press with maximum energy to fire a double helix comet] ''' } @@ -848,9 +831,17 @@ MirrorBlade: { DisplayName: Mirror Blade Tooltip: ''' - The amount of contact damage an enemy does is added to this weapons' damage - You must hit an enemy with the blade to trigger this effect + Striking an enemy or a hostile projectile summons up to 10 orbiting mirror shards + Any shards above 10 instead seek out enemies + Holding coalesces the orbiting mirror shards into a shield ''' + HoldShiftTooltip: + ''' + [c/aab7f1:Each shard reduces the damage of a projectile that hit the shield by 10%] + [c/aab7f1:The shield shatters after one projectile, launching the shards at enemies with increased damage] + [c/aab7f1:With all 10 shards, you gain a brief period of invulnerability when shattering the shield] + ''' + FlavorTooltip: "[c/7b6d8d:'A blade taken from your own reflection within the Ceaseless Void']" } MonolithSword: { @@ -922,7 +913,7 @@ OldLordClaymore: { HoldShiftTooltip: ''' [c/df4420:A gift to outstanding Demons, a replica of the sword used by the greatest of all Demon Lords.] - [c/df4420:The prosperity he brought to their kind is unmatched even now that they alone rule the Undeworld.] + [c/df4420:The prosperity he brought to their kind is unmatched even now that they alone rule the Underworld.] ''' } @@ -956,12 +947,21 @@ Orderbringer: { Tooltip: ''' Fires piercing energy waves and summons four homing stars near your cursor - Energy waves deal more damage with each consecutive hit Hits with the blade summon two beams from the sky 'No matter where you may be you are never alone' ''' } +Ozzathoth: { + DisplayName: Ozzathoth + Tooltip: + ''' + {$Common.YoyoStatsInfinite} + Fires cosmic orbs that blast nearby enemies with lasers + 'Destroy the universe in the blink of an eye' + ''' +} + Pandemic: { DisplayName: Pandemic Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson index 7eb72efa6d..848a34535d 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Ranged.hjson @@ -126,7 +126,11 @@ AstralBlaster: { AstrealDefeat: { DisplayName: Astreal Defeat - Tooltip: All arrows are converted to Astreal Arrows that emit flames as they travel + Tooltip: + ''' + All arrows are converted to Astreal Arrows that emit flames as they travel + 33% chance to save ammo + ''' } Auralis: { @@ -210,6 +214,7 @@ BlossomFlux: { ''' Fires a stream of leaves Press to fire a spore orb that explodes into a cloud of spore gas + 50% chance to save ammo ''' LegendaryText: ''' @@ -232,6 +237,7 @@ BulletFilledShotgun: { Tooltip: ''' Fires a massive spread of bouncing bullets + Bullets attempt to bounce towards enemies after bouncing twice Consumes five bullets per-use 'Aim? What's that?' ''' @@ -281,7 +287,7 @@ ClockworkBow: { DisplayName: Clockwork Bow Tooltip: ''' - Hold left click to load up to six precision bolts + Hold to load up to six precision bolts The more precision bolts are loaded, the harder they hit ''' } @@ -397,15 +403,6 @@ DeepcoreGK2: { ''' } -DodusHandcannon: { - DisplayName: Dodu's Handcannon - Tooltip: - ''' - Fires high explosive peanut shells, literally - 'The power of the nut rests in your hands' - ''' -} - DragonsBreath: { DisplayName: Dragon's Breath Tooltip: @@ -461,9 +458,11 @@ FirestormCannon: { DisplayName: Firestorm Cannon Tooltip: ''' - Releases a constant stream of weaponized flares - Press to fire a condensed spread of flares + Fires a rapid barrage of flares that builds up a searing heat in the weapon + Firing for too long overheats the weapon, leaving it unusable for a short period + Press to put away the weapon, which preserves its heat 70% chance to save ammo + 'What could go wrong?' ''' } @@ -565,7 +564,7 @@ HalleysInferno: { Press to zoom out Uses gel for ammo 50% chance to save ammo - 'Halley came sooner than expected' + 'Halley arrived sooner than expected' ''' } @@ -641,6 +640,7 @@ Infinity: { ''' Fires a twin stream of energy bolts that split Press to fire a barrage of normal bullets + 80% chance to save ammo 'They say infinity is neverending, yet you hold it in your hands' ''' } @@ -682,6 +682,17 @@ LunarianBow: { ''' } +M1Garand: { + DisplayName: M1 Garand + Tooltip: + ''' + Shots fired only inherit the damage of the bullet used + Fires 8 bullets before ejecting the rifle's cartridge + Bullets which ricochet off coins can ricochet off cartridges too + 'Mind your thumb' + ''' +} + MagnaCannon: { DisplayName: Magna Cannon Tooltip: @@ -944,7 +955,7 @@ PolarisParrotfish: { ''' Rapidly fires an array of colorful star shots Firing speed increases the closer you are to an enemy - Right click to give the little girl some attention + to give the little girl some attention 'She is a happy girl' ''' } @@ -1039,8 +1050,9 @@ ScorchedEarth: { DisplayName: Scorched Earth Tooltip: ''' - Fires a burst of four fuel-air rockets which explode into cluster bombs - Each burst consumes two rockets each + Fires a burst of four heat seeking missiles that rapidly accelerate after a short delay + All rockets explode into napalm cluster bombs on impact + 50% chance to save ammo 'Burns your targets to a fine crisp' ''' } @@ -1121,6 +1133,7 @@ Shredder: { ''' Fires a barrage of energy bolts that split and bounce Press to fire a barrage of normal bullets instead + 60% chance to save ammo 'The myth, the legend, the weapon that drops more frames than any other' ''' } @@ -1162,8 +1175,13 @@ SpectralstormCannon: { DisplayName: Spectralstorm Cannon Tooltip: ''' - Fires a storm of lost souls and flares + Fires a barrage of spectral flares that builds up a searing heat in the weapon + While cooling down, heat-seeking phantoms are continuously released + Firing for too long overheats the weapon, leaving it unusable for a short period + However, triggering overheat releases a powerful burst of souls and resets heat + Press to put away the weapon, which preserves its heat 70% chance to save ammo + 'Ectoplasmic blast rated visor mandatory' ''' } @@ -1248,17 +1266,14 @@ SuperradiantSlaughterer: { MainInfo: ''' Hold to rev up an elemental buzzsaw that deals close-range damage - Release to fire the buzzsaw to pierce through and lacerate foes - Fired buzzsaws bounce off tiles and return to the player after winding down - When returning, the saws release extra homing bolts depending on the number of enemy and tile hits - Revving up the saws increases their damage and allows them to pierce more enemies + Release to fire the buzzsaw which bounces off tiles, releasing homing bolts when returning depending on hits + Revving up the saw increases its damage and allows it to pierce more enemies ''' AltInfo: ''' - Press to eject a lingering buzzsaw towards the cursor that fires homing bolts - Using this ability rapidly propels you in the direction you are moving - This ability has a {0} second cooldown - During this cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning + Press to eject a lingering buzzsaw towards the cursor on a {0} second cooldown + Double to rapidly propel yourself in the direction you are moving + During the cooldown, buzzsaws home to the cursor and constantly release homing bolts while returning ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7274743e98..ba1421818e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -195,7 +195,7 @@ CrushsawCrasher: { Tooltip: ''' Throws bouncing axes - Stealth strikes throw five at once + Stealth strikes throw six at once ''' GFBFirstWords: ''' @@ -276,8 +276,8 @@ DeepWounder: { DisplayName: Deep Wounder Tooltip: ''' - Throws an abyssal hatchet that inflicts Armor Crunch and Crush Depth to the enemies it hits - Stealth strikes cause the hatchet to stick to struck enemies, causing Heavy Bleeding and spawning a burst of water projectiles + Throws an abyssal hatchet that inflicts Heavy Bleeding and Crush Depth to the enemies it hits + Stealth strikes cause the hatchet to stick to struck enemies, releasing a barrage of water projectiles Water projectiles launch at the closest enemy after a brief delay ''' } @@ -407,7 +407,7 @@ Exorcism: { ''' Throws a gigantic hallowed cross to the heavens, which will fall at your cursor a moment later Enemies hit as it falls are impaled and repeatedly seared with holy light - Upon experation a cross shaped explosion is created + Upon expiration a cross shaped explosion is created Stealth strikes twirl and throw the cross, ending in a stronger explosion at your cursor ''' } @@ -449,7 +449,6 @@ FrostcrushValari: { ''' Fires a long ranged frosty boomerang that chips off homing icicles on hit Stealth strikes throw a boomerang which follows the cursor - This boomerang creates a freezing blast and chips off homing icicles on every hit ''' } @@ -458,7 +457,7 @@ FrostyFlare: { Tooltip: ''' Throw a flare that sticks to enemies and rains a hailstorm on them - Stealth strikes trail snowflakes and summon phantom copies instead of ice shards + Stealth strikes summon phantom copies instead of ice shards 'Do not insert in flare gun' ''' } @@ -504,8 +503,8 @@ Glaive: { DisplayName: Glaive Tooltip: ''' - Tosses up to 3 sharp returning glaives - Stealth strikes are super fast and pierce infinitely + Tosses a very fast and sharp returning glaive + Stealth strikes are faster and can ricochet between enemies, or stick into a single enemy ''' } @@ -556,7 +555,7 @@ HeavenfallenStardisk: { ''' Throws a stardisk upwards which then launches itself towards your mouse cursor Explodes into a star of astral bolts on hit - Stealth strikes throw three disks that rain astral energy bolts from the sky + Stealth strikes rain astral energy bolts from the sky ''' } @@ -600,8 +599,8 @@ InfernalKris: { DisplayName: Infernal Kris Tooltip: ''' - Throws a burning dagger that starts spinning after travelling a short distance, inflicting additional damage while spinning - Stealth strikes cause the dagger to be engulfed in flames, exploding on contact with walls and enemies + Rapidly throws burning daggers + Stealth strikes engulf the dagger in flames, exploding when hitting walls and enemies ''' } @@ -677,7 +676,7 @@ LeviathanTeeth: { ''' Rapidly throws a spread of teeth that stick into enemies After sticking to an enemy, the teeth will gouge through them and shoot out the other side - Stealth strikes throw a single piercing tooth that creates a jawline of teeth to maul your foes + Stealth strikes create a clamping jaw of teeth to maul your foes ''' } @@ -1392,7 +1391,8 @@ WulfrumKnife: { DisplayName: Wulfrum Knife Tooltip: ''' - Fires wulfrum knives in bursts of 3 + Fires wulfrum knives in bursts of 3 that stick in enemies Stealth strikes make the knife fly further and hit several times at once + to magnetize all stuck knives back to you, restoring stealth ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson index d38a529169..14e7f20ec7 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Summon.hjson @@ -51,7 +51,7 @@ AtlasMunitionsBeacon: { [c/F27049:If an enemy is in close proximity, it will enter Overdrive] [c/F27049:When in Overdrive the cannon uses its full power to bring down any foe] [c/F27049:While in Overdrive, the cannon will build up heat, eventually overheating] - [c/69F0DC:Press right click while holding this item to pick up the cannon and use it yourself] + [c/69F0DC:Press while holding this item to pick up the cannon and use it yourself] [c/69F0DC:When held, the cannon will always be in Overdrive] [c/69F0DC:If the cannon overheats while you hold it, you will be forced to drop it] [c/9AA4AE:Pressing allows you to drop it manually] @@ -91,7 +91,7 @@ BrittleStarStaff: { ''' Summons a small brittle starfish that will dash through enemies until it shatters Starfish will quickly regenerate after shattering - Holding right click will swap starfish between dashing and circling you + Holding will swap starfish between dashing and circling you When the starfish are circling, each one provides you with 4 defense ''' } @@ -364,7 +364,7 @@ FlamsteedRing: { Tooltip: ''' Summons a colossal controllable mech - Right click to display the mech's control panel + to display the mech's control panel The panel has 3 configurations, selected using the brackets on the edges of the UI Each bracket powers 2 out of 3 possible functions, represented by the circular icons The bottom left icon miniaturizes the mech to the size of a player, but weakens its weapons @@ -435,7 +435,7 @@ GlacialEmbrace: { For each minion slot used, you will gain an additional orbiting shield spike These spikes accelerate rapidly towards a nearby enemy to inflict heavy damage They take some time to regenerate after launching themselves at the target, however - On right click, summons a duplicate ring around the targeted enemy, which slowly converges before exploding + On , summons a duplicate ring around the targeted enemy, which slowly converges before exploding ''' } @@ -485,7 +485,9 @@ IgneousExaltation: { Tooltip: ''' Summons an Igneous blade that orbits around you - Right click to launch all blades towards the cursor + When your minion slots are full, again to launch all blades towards the cursor + This ability has a two-second cooldown that requires holding this item + Shift- this item in your inventory to change the rotation direction ''' } @@ -591,7 +593,7 @@ Perdition: { ''' {$CommonItemTooltip.Sentry} Summons a beacon at the position of the mouse - When a target is manually selected via right click it releases torrents of souls from below onto the target + When a target is manually selected via it releases torrents of souls from below onto the target Requires one sentry slot to summon, and only one beacon may exist at a time ''' } @@ -662,7 +664,7 @@ SarosPossession: { Summons a radiant aura that gives absolute control of light itself The aura will annihilate enemies with orbs of radiance There can only be one aura at a time - Requires 8 minion slots + Requires 6 minion slots ''' } @@ -855,7 +857,16 @@ ViralSprout: { ViridVanguard: { DisplayName: Virid Vanguard - Tooltip: Summons a circular formation of blades that slice nearby enemies to pieces + Tooltip: + ''' + Alternates between summoning axes and swords, both laced with a powerful poison + Axes orbit the player, dealing high damage at a close range + Swords chase down enemies with extreme precision, tearing them to shreds + All weapons inflict Sage Poison, which becomes more powerful the more weapons are summoned + When all minion slots are full, again to spin up a flurry of slashes aimed at your cursor + This ability has a five-second cooldown that requires holding this item + Shift- this item in your inventory to change the rotation direction + ''' } VoidConcentrationStaff: { @@ -866,7 +877,7 @@ VoidConcentrationStaff: { Minion damage is increased by 5% while the aura is active Requires three minion slots to use There can only be one aura at a time - Right click to launch a black hole that grows in size + to launch a black hole that grows in size ''' } @@ -893,7 +904,7 @@ WulfrumController: { Tooltip: ''' Summons a wulfrum droid to fight for you - Hold right click while holding the remote to switch all of your drones into supercharge mode + Hold while holding the remote to switch all of your drones between regular and supercharge mode Supercharged droids will stop attacking and focus wulfrum energy onto you Supercharged droids provide +0.5 HP/s life regen and 3 defense per droid Can also be used to heal other players by keeping your mouse cursor close enough to them diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson index 5af63cdf49..e7cde29eeb 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Typeless.hjson @@ -69,15 +69,3 @@ StarStruckWater: { DisplayName: Star Struck Water Tooltip: Spreads the Astral Infection to some blocks } - -YanmeisKnife: { - DisplayName: Yanmei's Knife - Tooltip: - ''' - Enemies you hit are crippled - Hits will also give you {0}% increased movement speed and damage for {1} seconds - 'A knife from an unknown world - An owner whose heart is pure and free of taint - A heart of iron and valor' - ''' -} diff --git a/Localization/en-US/Mods.CalamityMod.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Misc.hjson index 95cd1221f7..9e19bfe3cc 100644 --- a/Localization/en-US/Mods.CalamityMod.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Misc.hjson @@ -3,14 +3,11 @@ RecipeGroup: { HardmodeAnvil: "{$LegacyMisc.37} Hardmode Anvil" HardmodeForge: "{$LegacyMisc.37} Hardmode Forge" - AnyLargeGem: "{$LegacyMisc.37} Large Gem" AnyFood: "{$LegacyMisc.37} Food Item" AnyEvilBar: "{$LegacyMisc.37} Evil Bar" - AnyEvilPowder: "{$LegacyMisc.37} Evil Powder" Boss2Material: Shadow Scale or Tissue Sample CursedFlameIchor: Cursed Flame or Ichor AnyEvilWater: "{$LegacyMisc.37} Evil Water" - AnyEvilFlask: "{$LegacyMisc.37} Evil Flask" AnyEvilBlock: "{$LegacyMisc.37} Evil Block" AnyGoodBlock: "{$LegacyMisc.37} Good Block" LunarPickaxe: "{$LegacyMisc.37} Lunar Pickaxe" @@ -43,7 +40,7 @@ Tier3KnowledgeTooltip: The Jungle schematic must be deciphered first Tier4KnowledgeTooltip: The Underworld schematic must be deciphered first Tier5KnowledgeTooltip: The Ice biome schematic must be deciphered first // Other CombatText uses and Item Messages -ShiftToExpand: Hold SHIFT to see an expanded description +ShiftToExpand: Hold Shift to see an expanded description LearnedSchematic: You learned how to create new things! CragmawVibeCheck: Vibe check. AutocannonHot: OUCH! HOT! @@ -80,8 +77,47 @@ Empress1: A fine day for mana consumption. Empress2: That's quite enough mana... Empress3: OH GREAT HEAVENS! Empress4: A -// Point Blank -PointBlank: Does extra damage to enemies shot at point-blank range +SwineSecret0: Hey +SwineSecret1: You know, swine like us tend to keep our secrets. +SwineSecret2: I once drank a gallon of molten pig iron. +SwineSecret3: Pay me 10 Ozzacoins and I'll hack in some Miracle Matter for ya, c'mon trust me! +SwineSecret4: I've heard tales of a palace somewhere... +SwineSecret5: Swine. +SwineSecret6: There once was a duke who was old, he sat on a throne made of gold, he ate up a treat, gave his kids spoiled meat, and sang tales of great swine never told. +SwineSecret7: WAIT WAIT A GOLDEN CRITTER JUST SPAWNE- aww you missed it... +SwineSecret8: Fishrons? Who calls them that? +SwineSecret9: Why the hell is everything always blowing up?! You're gonna start a fire you know, and I'm not a fan of flames! +SwineSecret10: HELP ME +SwineSecret11: Saying that someone 'eats babies' is stereotypically evil, but I'm a good guy and I eat babies! I mean surely it's not THAT bad. People who don't eat babies are just wusses. +SwineSecret12: Phalostion ale bonei wha treaites gon bardo galan ale gorve frus frum galibon! +SwineSecret13: My soul is made of jade, it's unbreakable! Just like the palace. You should go there sometime. +SwineSecret14: CAAAAAAARRRRLLLL! You must finish your work Carl. +SwineSecret15: Before gods quarreled or stars wept, it was the Old Duke's hunger that tore the first wound in the deep. +SwineSecret16: When the Third Moon drowned, the Old Duke wept salt into the jade chalice, and the coral gates first bled. +SwineSecret17: The Old Duke's hunger was not for flesh, but for the silence between tides that he called the Eel Hour. +SwineSecret18: The jade palace does not sink, it re-aligns beneath the fins of royal shame. +SwineSecret19: The duke never died. He just changed tides. +SwineSecret20: The Old Duke struck the reefclock thrice, and time drowned in brine-glass. Since then, no hour has been true. +SwineSecret21: There were once seven Duke-Born. then there were six, then there were five, then there were four, then there were three, then there were two, then there was one... +SwineSecret22: No one built the jade palace, the world simply uncoiled its seventh spine. +SwineSecret23: When the true fishron arises, the glorious jade palace shall rise once more from the sea and the ocean will kneel. +SwineSecret24: What mortals call the Old Duke is a mere echo of the pristine swine, the sovereign who ruled the sulphuric seas. +SwineSecret25: Gods speak in radiance. But the Old Duke? He chewed on their syllables and spat out storms. +SwineSecret26: Those who enter the Old Duke's stomach will learn what it means to be truly erased from samsara. +SwineSecret27: The great jade swine once whispered into Polterghast's ear, and that is why the moon forgot its face. +SwineSecret28: They say the Old Duke had no lungs. That's wrong, he had five. +SwineSecret29: The palace still sinks. It has not stopped sinking since the first sin. +SwineSecret30: The village people saw the fishron trade his draconic roar for silence. It was louder this way. +SwineSecret31: @everyone Please do not announce to the sever when you are going to fight Old Duke. This has been a recurring issue... +SwineSecret32: No, I have never played Undertale. +SwineSecret33: These sprites look like they were drawn by a four-year-old with the talents of Pablo Picasso in his prime. Which is what I would have said if I liked the sprites. Which I do. Not. +SwineSecret34: Who are you dressed as... your OC? That's cringe. +SwineSecret35: Watch out for Polymorphine, that stuff sucks. Trust me I know. +SwineSecret36: Many say to keep the greatest swine secret on the down low. I disagree, We cannot shh it. +SwineSecret37: Let me know when it's 7 PM, I've got to tweak something before some poor soul falls off of it! +SwineSecret38: Thank Xeroc I don't have any of that 'Pathfinding' garbage, whatever the hell that is. +SwineSecret39: If you think the Sulphur Sea smells bad, just wait til' you're near a nohitter! +SwineSecret40: Did you know there's 40 of these damn things? // Charge Charge: Current Charge: {0}% //GFB Rogue Keys diff --git a/Localization/en-US/Mods.CalamityMod.NPCs.hjson b/Localization/en-US/Mods.CalamityMod.NPCs.hjson index 906f6e26e7..96f1f31200 100644 --- a/Localization/en-US/Mods.CalamityMod.NPCs.hjson +++ b/Localization/en-US/Mods.CalamityMod.NPCs.hjson @@ -147,7 +147,6 @@ AeroSlime.DisplayName: Aero Slime ArmoredDiggerHead.DisplayName: Armored Digger MechanizedSerpent: Mechanized Serpent AuroraSpirit.DisplayName: Aurora Spirit -BloodlettingServant.DisplayName: Bloodletting Servant BloomSlime.DisplayName: Bloom Slime Bohldohr.DisplayName: Bohldohr BucketZombie.DisplayName: "{$NPCName.Zombie}" @@ -168,7 +167,6 @@ CryoSlime.DisplayName: Cryo Slime EbonianBlightSlime.DisplayName: Ebonian Blight Slime Eidolist.DisplayName: Eidolist FearlessGoldfishWarrior.DisplayName: Fearless Goldfish Warrior -Foveanator.DisplayName: Foveanator Frogfish.DisplayName: Frogfish Horse.DisplayName: Earth Elemental IceClasper.DisplayName: Ice Clasper @@ -189,12 +187,6 @@ Rotdog.DisplayName: Rotdog ScornEater.DisplayName: Scorn Eater ShockstormShuttle.DisplayName: Shockstorm Shuttle Shroomble.DisplayName: Shroomble -SkeletronOmega.DisplayName: Skeletron Omega -OmegaSaw.DisplayName: Omega Saw -OmegaLaser.DisplayName: Omega Laser -SkeletronPrime2.DisplayName: Skeletron Alpha -AlphaVice.DisplayName: Alpha Vice -AlphaCannon.DisplayName: Alpha Cannon Stormlion.DisplayName: Stormlion StormlionSentry.DisplayName: Stormlion Sentry Sunskater.DisplayName: Sunskater @@ -285,10 +277,10 @@ GoldPrismaticGuppy: Gold Prismatic Guppy HauntedChum.DisplayName: Haunted Chum Jellyghoul.DisplayName: Jellyghoul KelpieSeadragon.DisplayName: Kelpie Seadragon +LazarusLampfish.DisplayName: Lazarus Lampfish Leerslug.DisplayName: Leerslug LostShoal.DisplayName: Lost Shoal PearlpodBlack.DisplayName: Pearlpod -PearlpodGold.DisplayName: Gold Pearlpod PearlpodPink.DisplayName: Pearlpod PearlpodWhite.DisplayName: Pearlpod PodobooKoi.DisplayName: Podoboo Koi @@ -300,7 +292,6 @@ ProbesnoutGold.DisplayName: Gold Probesnout PrismaticGuppy.DisplayName: Prismatic Guppy RadiantBabyGhostBell: Radiant Baby Ghost Bell RadiantPolypPanasea: Radiant Polyp Panasea -RadiantPolyperil: Radiant Polyperil RadiantPrismaticGuppy: Radiant Prismatic Guppy RadiantSlugbun: Radiant Slugbun SandProwler.DisplayName: Sand Prowler @@ -312,11 +303,12 @@ SeaMinnowGold.DisplayName: Gold Sea Minnow Searslug.DisplayName: Searslug Sharkoon.DisplayName: Sharkoon Slugbun.DisplayName: Slugbun +Steampod.DisplayName: Steampod BrimstoneHeart.DisplayName: Brimstone Heart SepulcherHead.DisplayName: Sepulcher SoulSeekerSupreme.DisplayName: Soul Seeker SupremeCalamitas.DisplayName: Supreme Witch, Calamitas -SupremeCirrus: Supreme Alchemist, Cirrus +SupremePermafrost: Supreme Ultramage, Permafrost SupremeCataclysm.DisplayName: Cataclysm SupremeCatastrophe.DisplayName: Catastrophe Yharon.DisplayName: Yharon, Dragon of Rebirth @@ -403,7 +395,6 @@ Bandit: { Night1: Hm, the stars are too bright tonight. Makes sneaking around a little more difficult. Night2: You think those stars that fall occasionally would make good throwing weapons? BrimstoneWitch: Hey, hey, has {0} seriously moved in here with us? Why??? - DrunkPrincess: I learned never to steal {0}'s drinks. She doesn't appreciate me right now, so I'll go back to hiding. Merchant: Don't tell {0}, but I took some of his stuff and replaced it with Angel Statues. NurseArmsDealer: Don't tell {0} that I was responsible for {1}'s injuries. NamedLaura: The nice thing about maps is I can track anything that has fallen. @@ -462,12 +453,13 @@ BrimstoneWitch: { BloodMoon2: I can't work with nights like these. The stars seem to have shrunk away in fear. Night1: These undead are horrific, I can't stand to look at them. How could anyone be satisfied with such amateur work? Night2: I don't think it's a stretch to say that astrology is utter nonsense... but it was a hobby of mine once. - DrunkPrincess: I wonder if {0} ever feels cold given how revealing her dress is. Perhaps she should cover up a bit more. SeaKing: I cannot understand the Sea King. He does not seem to want me dead. That amount of compassion I just can't understand. Party: If another person asks me if I can dance or not, I will light their hat on fire. } EnchantButton: Enchant + DonorButton: Donors + DonorShoutout: Hey {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23} and {24}. You guys are good people. TownNPCMood: { Content: I can't complain, really. @@ -486,118 +478,6 @@ BrimstoneWitch: { } } -Cirrus: { - DisplayName: Drunk Princess - Census.SpawnCondition: Have {$Items.Potions.CirrusVodka.DisplayName} [i:CalamityMod/CirrusVodka] in your inventory in Hardmode or defeat Calamitas Clone/Plantera - Name.Cirrus: Cirrus - - Chat: { - BossAlive: Why are you talking to me right now? Shouldn't you be bumbling about and dying for my amusement? - BossAliveAlt: You must be joking! Get back out there and FINISH THE FIGHT! - Homeless1: I could smell my vodka from MILES away! - Homeless2: Have any spare rooms available? Preferably candle-lit with a hefty supply of booze? - BloodMoon1: I'm gonna make some Bloody Marys to relax, celery included. Want one? - BloodMoon2: If you're too lazy to craft potions normally, try Blood Orbs. Blood is fuel, dumbass. - BloodMoon3: I'm trying to not be bitchy tonight, but it's hard when everyone else won't shut up. - BloodMoonSlap1: Sorry, I have no moral compass at the moment. - BloodMoonSlap2: I could slap you... but you've done more for me than most. What do you need? - Normal1: What do you want this time? I have an appointment to get my nails done in 5 minutes, make it quick. - Normal1Alt: Whaddya need? I have candles and alcohols galore! - Normal2: Maybe you should drink something that turns you into a magical flying unicorn, so you can be just like me. - Normal2Alt: Sometimes, I think about returning to nature for a while, to escape from all of this chaos. - Normal3: Deals so good I'll [$$!$] myself! ...Sorry, I may have just had a minor stroke! - Normal3Alt: I've been thinking more about the future lately. I can't say I'm not worried, but I'll be trying my best to make it better. - Normal4: Did anyone ever tell you that large assets cause back pain? Well, they were right. - Normal4Alt: Do you have any idea how much extra money I make so {0} can afford her super-fancy hair products? Heh, the back pain is worth it. - Archmage: "{0} can share a drink with me any time! ...Or maybe not, I'm not sure his old heart could take it." - BrimstoneWitch: The abuse {0} endured is something I can scarcely comprehend. I'd offer her a drink, but I don't think she'd enjoy it. - Tavernkeep1: My booze will always be better than {0}'s, and nobody can convince me otherwise. - Tavernkeep2: Tell {0} to stop calling me. He's not wanted. - Tavernkeep3: I've had to tell baldie where my eyes are so many times that I've lost count. - Stylist1: Ever since {0} moved in I haven't been drinking as much... a strange, but not unwelcome, feeling. - Stylist1Alt: I've stopped drinking almost entirely, thanks to {0} and... you. Thank you, for making this world a safer place. - Stylist2: You can't stop me from trying to move in with {0}. - Stylist2Alt: If you have {0} and I housed in one of those so-called 'NPC prisons'... we WILL find you, and we WILL bring the scissors... - Stylist3: I love it when {0}'s hands get sticky from all that... wax. - Stylist3Alt: "{0} and I will be building wax figures tonight. And no, there's nothing weird about that." - Day1: I'm literally balls drunk off my sass right now, what do you want? - Day1Alt: A nice day for a walk in the woods, don't you think? Anyway, what do you need? - Day2: I'm either laughing because I'm drunk or because I've lost my mind, probably both. - Day2Alt: Some people ask me whether it's 'unicorn', 'pegacorn', 'alicorn', 'pegasus'... whatever, all of them suit me. - Day3: When I'm drunk I'm way happier... at least until the talking worms start to appear. - Day3Alt: Did you know that certain worms can speak? Neither did I, until I flew to outer space. - Day4: I should go fishing... while drunk, and jump into the ocean to spare myself {0}'s annoying naivety... - Day4Alt: I may be a 'hater' and a 'gatekeeper', but I'm also Dionysus' favorite princess, and the most fabulous girl in the world. - DayStylist1: "{0} helped me accept my past. It's been tough, but I think I'm on the right path now." - DayStylist2: Might go out for a jog later with {0}. Nice day for it. - DayDrunk1: I drink to forget... What am I trying to forget, you might ask? Well, the point is to FORGET, not RECALL, isn't it? - DayDrunk2: What a great day! Might just drink so much that I get poisoned again. - Night1: A perfect night to light some candles, drink some wine, and relax. - Night2: Here's a challenge, take a shot for every time you've had to use the wiki. Oh wait, you'd die. - Night2Alt: There's more to life than challenge, y'know. Be sure to sit back and treat yourself once in a while. - Night3: You lost or something? I don't mind company, but I'd rather be left alone at night. - Night3Alt: I do love gazing at the stars. You could join me, if you like. - Night4: Are you sure you're 21? ...Alright, fine, but don't tell anyone I sold you these. - NightStylist: I should watch some movies with {0} tonight. You could come too, but only if you bring snacks. - Party: You'll always find me at parties where booze is involved... well, you'll always find BOOZE where I'M involved! - PartyAlt: Y'know... this is fun and all, but I can't wait for the festivities to be over. - AcidRain: I'm melting! Put a stop to this inclement weather before it ruins my hair! - Martians: You should probably deal with those 'ayy lmaos' before doing anything else, but whatever. - CryogenDefeated: God, I can't wait to smash some ice again! ...For drinks, of course. - LeviathanDefeated: How could you murder such a beautiful creature!? ...The blue one, not the obese cucumber. - MoonLordDefeated: Ever wondered why the Moon Lord needed so many tentacles? Uhm... on second thought, I won't answer that. - PolterghastDefeated: I saw a ghost down by the old train tracks back at my homeland once, flailing wildly at the lily pads... frightening times those were. - DoGDefeated: I hear it's amazing when the famous Devourer of Gods out in flap-jaw space, with the tuning fork, does a raw blink on Hara-kiri rock. I need scissors! 61! - HasChibii: The hell is that? Looks like something I'd carry around if I was 5 years old. - HasChibiiAlt: I won't judge you for having that creature in tow... but keep it the hell away from me. - HasAnahitaTrans: Nice scales... Is it hot in here, or is it just me? - HasVodka: Do you like my vodka? I created it by mixing fairy dust, crystallized cave sweat, and other magical crap. - HasAlicorn1: So... you found my special bottle. Hope you enjoy it, I know I will. - HasAlicorn2: Be sure to dismount me once in a while, I get tired. And besides, I can't rip you off-I mean, offer you excellent deals you won't find anywhere else, if you're riding me 24/7. - HasAlicorn3: Before you ask, no, I do NOT have a heart on my butt while in human form. Don't question my transformation preferences! - NewOutfit: It's so refreshing to finally wear something else. I still love my dress, of course, but it's not exactly ideal for exercising. - } - - // Death Count stuffs - DeathCountButton: Death Count + Donors - DeathCount: You have failed {0} {^0:time;times}. - Death10000: Congratulations! You are now, officially, the biggest loser in Terraria's history! - Death5000: I'm not sure what to say this time... perhaps, that you're bad and should feel bad? - Death2500: I could dodge better than you even if I was blackout drunk. - Death1000: It is said that the average Terrarian has a lifespan of 2 minutes or less... well, not really, but I feel like you'd be part of that statistic. - Death500: Your inability to avoid dying to even the most basic of attacks is astonishing to me. - Death250: I admire your tenacity. Keep it up, your enemies are racking up quite the kill count! - Death100: Consider lowering the difficulty. If you found that statement irritating, good. - DonorShoutout: Hey {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18}, {19}, {20}, {21}, {22}, {23} and {24}! You're all pretty good! - - TownNPCMood: { - Content: It's 5 o'clock somewhere. - NoHome: I need a place to crash! My drinks MUST be properly cooled before they can be served! - LoveSpace: Finally, some peace and quiet. Large quantities of people tend to piss me off. - FarFromHome: Don't get me wrong, I'm used to running away from home, but this is a little ridiculous. - DislikeCrowded: If one more person tells me 'it's happy hour somewhere', I'm going to snap! - HateCrowded: No amount of alcohol can drown out the noise these people make! - LoveBiome: Other unicorns? I never thought I'd see the day... this place is incredible! - LikeBiome: Ah, a soothing breeze and a gorgeous view; a great way to calm some of my more 'unpleasant' patrons. - DislikeBiome: This dry air and heat isn't good for my hair, or my drinks. - HateBiome: You think I can fix this place with a magical friendship rainbow? That's not how it works, so get me out of here already! - LoveNPC_Stylist: "{NPCName} works wonders for my hair... among other things, hehe." - LoveNPC_BestiaryGirl: "{NPCName} is so fluffy and squishy! She also says my alicorn form is 'mega rad'." - LikeNPC_DyeTrader: I tried inviting {NPCName} over for drinks a while back, but he didn't seem interested... oh well, his loss. - LikeNPC_PartyGirl: "{NPCName} would make for a great bartender some day. She really knows how to liven the mood!" - DislikeNPC_DD2Bartender: "{NPCName} is so bald. The sheen reflecting off his dome could legit blind someone, like, oh my god." - DislikeNPC_TaxCollector: "{NPCName} had best keep his distance... he wouldn't want to wake up one morning with a pipe bomb in his mailbox." - HateNPC_GoblinTinkerer: "{NPCName} was so terrible that I had to FORCE him to stop ripping off his customers... why would you house me next to him!?" - HateNPC_Angler: "{NPCName} never stops blabbering about his inane fishing quests. Get me away from him before I punt him into the sulphurous sea!" - LikeNPC_Princess: You think I'd dislike {NPCName} because we're too different? Quite the contrary, there's a lot we like to talk about, over non-alcoholic drinks, of course. - Princess_LovesNPC: "{NPCName} has some fascinating stories to tell, I've learned quite a lot from her already." - HateNPC: I hate {NPCName}. - DislikeNPC: I dislike {NPCName}. - LikeNPC: I like {NPCName}. - LoveNPC: I love {NPCName}. - } -} - SeaKing: { DisplayName: Sea King Census.SpawnCondition: Defeat a Giant Clam after defeating the Desert Scourge @@ -613,10 +493,8 @@ SeaKing: { Night1: There lurk horrifying creatures beyond the light of our homes. You should take care. Night2: My eyes are not well suited to bright lights after so many years of darkness. The peace of the night is welcome. Night3: Oh, me? I do not sleep, it is part of my nature. - Angler1: Meet me at {0}'s house at night. We will throw him to the Trashers. - Angler2: Not sure how {0} has not been roasted and digested by now, hanging around the sulphuric seas for so long. Perhaps it got to his head. + Angler: Not sure how {0} has not been roasted and digested by now, hanging around the sulphuric seas for so long. Perhaps it got to his head. BrimstoneWitch: I must admit, the Witch's presence is unsettling to me. But so many years have passed, and she too has suffered much. - DrunkPrincess: Rumor has it {0} drinks to forget her troubled past. PartyGirl: "{0} asked if my nose could be used as a vuvuzela. What is a vuvuzela?" BloodMoon1: Since ancient times people have said that deities cause celestial events. Which one then, is the cause for these? BloodMoon2: I've never been keen on these nights. Such violence. @@ -682,3 +560,7 @@ SeaKing: { Princess_LovesNPC: "{NPCName} always smiles when I'm nearby, I like being around him just for that!" } } + +WildBumblebirb.DisplayName: Wild Bumblebirb +DraconicSwarmer.DisplayName: Draconic Swarmer +Dragonfolly.DisplayName: Dragonfolly diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson index f4629f8829..d633004aa0 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Boss.hjson @@ -36,11 +36,6 @@ BrimstoneTargetRay.DisplayName: Brimstone Target Ray BrimstoneWave.DisplayName: Brimstone Flame Skull BrokenApolloLens.DisplayName: Lens BrokenArtemisLens.DisplayName: Lens -CirrusBlast.DisplayName: Cirrus Mushroom Blast -CirrusBlaster.DisplayName: Cirrus Mushroom -CirrusPhotonRipperPrismTooth.DisplayName: Cirrus Photon Ripper Tooth -CirrusPhotonRipperProjectile.DisplayName: Cirrus Photon Ripper -CirrusVolatileVodkaBottle.DisplayName: Volatile Vodka Bottle CrimulanSpike.DisplayName: Crimulan Spike CursedFire.DisplayName: Eye Fire DarkEnergyBall.DisplayName: Dark Energy @@ -68,10 +63,9 @@ FlareBomb.DisplayName: Flare Bomb FlareDust.DisplayName: Flare Dust FlareDust2.DisplayName: Flare Bomb Flarenado.DisplayName: Flarenado -FoveanatorEnergyBomb.DisplayName: Nebulous Energy Bomb -FoveanatorLaser.DisplayName: Nebulous Laser -FoveanatorFlamethrower.DisplayName: Nebulous Flames FrostMist.DisplayName: Frost Mist +GolemInfernoBolt.DisplayName: Golem Fire Bolt +GolemInfernoBlast.DisplayName: Golem Fire Blast GooglyEye.DisplayName: Googly Eye GreatSandBlast.DisplayName: Great Sand Blast HellfireExplosion.DisplayName: Brimstone Hellfire Explosion @@ -111,6 +105,11 @@ OldDukeToothBallSpike.DisplayName: Spike OldDukeVortex.DisplayName: Sulphurous Vortex OverlyDramaticDukeSummoner.DisplayName: Old Duke Summoner PeanutRocket.DisplayName: High Explosive Peanut Shell +PermafrostAbsoluteZeroProjectile.DisplayName: Absolute Ultra Zero +PermafrostBlast.DisplayName: Permafrost's Gigablast +PermafrostBlaster.DisplayName: Blaster of Unlimited Air Conditioning +PermafrostColdheartIcicle.DisplayName: Coldheart Icicle +PermafrostMeat.DisplayName: Cool Meat PhantomBlast.DisplayName: Phantom Blast PhantomBlast2.DisplayName: Potent Phantom Blast PhantomGhostShot.DisplayName: Potent Phantom Spirit Shot @@ -130,6 +129,7 @@ QueenBeenadeBee.DisplayName: Queen Beenade Bee RavagerBlast.DisplayName: Ravaging Laser RavagerBlaster.DisplayName: Ravager Blaster RavagerFlame.DisplayName: Blue Flame +RavagerNuke.DisplayName: Homing Nuke RedLightning.DisplayName: Red Lightning RedLightningFeather.DisplayName: Lightning Feather SandBlast.DisplayName: Sand Blast @@ -140,7 +140,6 @@ SCalBrimstoneFireblast.DisplayName: Brimstone Fireblast SCalBrimstoneGigablast.DisplayName: Brimstone Gigablast SCalRitualDrama.DisplayName: Calamitous Ritual Drama HomingLaserDart.DisplayName: Homing Dart -ScavengerNuke.DisplayName: Homing Nuke ShadeNimbusHostile.DisplayName: Shade Nimbus ShaderainHostile.DisplayName: Shade Rain ShadowflameFireball.DisplayName: Shadowflame Fireball diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson index 1dc8f2232b..3fc915185b 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Enemy.hjson @@ -1,3 +1,4 @@ +AnglerFlash.DisplayName: Angler Flash AstralMeteorProj.DisplayName: Astral Meteor BelchingCoralSpike.DisplayName: Spike CarrionPus.DisplayName: Carrion Pus @@ -17,6 +18,7 @@ FlameBurstHostile.DisplayName: Burst GammaAcid.DisplayName: Acid GammaBeam.DisplayName: Gamma Ray GammaRayBurst.DisplayName: G-FUEL BEAM +GhostBellShock.DisplayName: Electrical Field HorsPoisonBlast.DisplayName: Poisonous Spit HorsWaterBlast.DisplayName: Water IceClasperEnemyProjectile.DisplayName: Ice Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson index 211c3eb65d..e8077f1f00 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Healing.hjson @@ -1,5 +1,6 @@ AbsorberAura.DisplayName: Absorber Aura AltTransfusionTrail.DisplayName: Alt Transfusion Trail +BloodstoneHealOrb.DisplayName: Bloodstone Heal Orb BlueJellyAura.DisplayName: Blue Jelly Aura BurntSiennaProj.DisplayName: Sienna CactusHealOrb.DisplayName: Heal @@ -10,13 +11,9 @@ FungalHeal.DisplayName: Heal GladiatorHealOrb.DisplayName: Heal GreenJellyAura.DisplayName: Green Jelly Aura HydrothermicHealOrb.DisplayName: Hydrothermic Rejuvenation -IridescentExcaliburHeal.DisplayName: Iridescent Excalibur Heal ManaPolarizerHealOrb.DisplayName: Mana Polarizer Heal Orb PhantomicHeart.DisplayName: Phantomic Heart PinkJellyAura.DisplayName: Pink Jelly Aura -ReaverHealOrb.DisplayName: Reaver Heal Orb RoyalHeal.DisplayName: Heal ShinobiHealOrb.DisplayName: Blue Healing Orb -SilvaOrb.DisplayName: Silva Orb TransfusionTrail.DisplayName: Heal -BloodstoneHealOrb.DisplayName: Bloodstone Heal Orb diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson index 26d561887b..16d495a2de 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Magic.hjson @@ -53,7 +53,6 @@ DarkSparkBeam.DisplayName: Dark Spark Beam DarkSparkPrism.DisplayName: Dark Crystal DeathhailBeam.DisplayName: Deathhail DeathValleyDusterProjectile.DisplayName: Death Valley Duster -DivineRetributionSpear.DisplayName: Divine Retribution EelDrop.DisplayName: Acid Eel Drop EidolicWailSoundwave.DisplayName: Eidolic Wail EldritchTentacle.DisplayName: Eldritch Tentacle @@ -67,8 +66,6 @@ EventHorizonStar.DisplayName: Event Horizon Star EvergladeSprayProjectile.DisplayName: Everglade Spray ExoVortex.DisplayName: Subsuming Vortex ExoVortex2.DisplayName: Subsuming Vortex -FabBolt.DisplayName: Fab Bolt -FabRay.DisplayName: Fab Ray FatesRevealFlame.DisplayName: Fate's Reveal FireImplosion.DisplayName: Swirling Backdraft FlareBoltProjectile.DisplayName: Flare Bolt @@ -217,6 +214,8 @@ SpiritDust.DisplayName: Spirit Dust Starblast.DisplayName: Star StardustElementalBeam.DisplayName: Stardust Beam StickyFeather.DisplayName: Feather +SylvBolt.DisplayName: Sylv Bolt +SylvRay.DisplayName: Sylv Ray TacticiansElectricBoom.DisplayName: Electric Explosion TacticiansTrumpCardProj.DisplayName: Trump Beam TearsofHeavenProjectile.DisplayName: Tears of Heaven diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 29e9cdd627..ce21c9c89f 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -147,6 +147,7 @@ GrandGuardianBoom.DisplayName: Cosmic Burst GreenWater.DisplayName: Greentide Tooth GrovetendersEntanglingVines.DisplayName: Entangling Growth GrovetendersTouch.DisplayName: Grovetender's Touch +GildedProboscisProj.DisplayName: Gilded Proboscis HeavensMight.DisplayName: Heaven's Might HeavensMonolith.DisplayName: Heaven's Monolith HellionSpike.DisplayName: Hellion Spike @@ -154,24 +155,28 @@ HolyColliderHolyFire.DisplayName: Holy Collider Fire IceBombFriendly.DisplayName: Ice Bomb IllustriousKnife.DisplayName: Illustrious Knife InsidiousHarpoon.DisplayName: Insidious Harpoon -IridescentExcaliburSlash.DisplayName: Iridescent Excalibur Slash -IridescentExcaliburSlash2.DisplayName: Iridescent Excalibur Slash -IridescentExcaliburSlash3.DisplayName: Iridescent Excalibur Slash JudgementProj.DisplayName: JUDGEMENT LamentationsOfTheChained.DisplayName: Lamentations of the Chained -LaserFountain.DisplayName: Laser Fountain LifeScythe.DisplayName: Lifehunt Scythe LightBeam.DisplayName: Light Beam LightningThing.DisplayName: Lightning +LucreciaProj.DisplayName: Lucrecia +LucreciaDNATrailCreator.DisplayName: Lucrecia DNA +LucreciaDoubleHelix.DisplayName: Lucrecia Helix Comet +LucreciaSmallProjectile.DisplayName: Lucrecia LuxorsGiftMelee.DisplayName: Luxor's Melee MantisClawHoldout.DisplayName: Mantis Claw MantisClawJet.DisplayName: Mantis Claw Jet MantisClawSlash.DisplayName: Mantis Claw Slash MicrowaveAura.DisplayName: Microwave Radiation -MirrorBlast.DisplayName: Mirror Blade +MirrorBlast.DisplayName: Mirror Blast +MirrorBladeProjectile.DisplayName: Mirror Blade +MirrorBladeSlash.DisplayName: Mirror Blade Slash +MirrorBladeSlashCreator.DisplayName: Mirror Blade Slash Creator MonstrousKnife.DisplayName: Monstrous Knife MourningSkull.DisplayName: Mourning Skull MourningstarFlail.DisplayName: Mourningstar +MutilatorSwordProj.DisplayName: The Mutilator Nebudust.DisplayName: Nebulash Dust NebulashFlail.DisplayName: Nebulash NebulaShot.DisplayName: Nebula Shot @@ -237,6 +242,7 @@ StarburstBeam.DisplayName: Star Shiv StarburstSHIV.DisplayName: SHIV StarnightBeam.DisplayName: Starnight Beam StarofJudgement.DisplayName: Star of Judgement +StarofOrder.DisplayName: Star of Order StellarContemptBlast.DisplayName: Stellar Blast StellarContemptEcho.DisplayName: Echoes of Contempt StellarContemptHammer.DisplayName: Stellar Contempt @@ -304,4 +310,3 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard -MutilatorSwordProj.DisplayName: The Mutilator diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson index a72179f460..da430c0950 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Misc.hjson @@ -8,7 +8,11 @@ AnomalysNanogunHoldout.DisplayName: The Anomaly's Nanogun AnomalysNanogunMPFBBoom.DisplayName: MPFB Explosion AnomalysNanogunMPFBDevastator.DisplayName: MPFB Devastator AnomalysNanogunPlasmaBeam.DisplayName: Plasma Beam -GatlingLaserShot.DisplayName: Gatling Laser +AqueousHunterDroneSummon.DisplayName: Plasma Shrimp +AugerHoldout.DisplayName: P-GSS Auger +AugerSlash.DisplayName: Auger Slash +AugerPull.DisplayName: Auger Pull +CountermeasurePalmBlast.DisplayName: Palm Blast GaussEnergy.DisplayName: Gauss Energy GaussFlux.DisplayName: Gauss Flux GaussPistolShot.DisplayName: Gauss Shot @@ -37,6 +41,7 @@ PulseRifleShot.DisplayName: Pulse Bolt PulseTurret.DisplayName: Pulse Turret PulseTurretShot.DisplayName: Pulse Bolt ShortCircuitHook.DisplayName: Short Circuit Hook +ShrimpPlasmaMissile.DisplayName: Plasma Shrimp Missile SnakeEyesSummon.DisplayName: Snake Eyes SnakeEyesProjectile.DisplayName: Inescapable Bolt StarSwallowerAcid.DisplayName: Acid @@ -46,10 +51,13 @@ SystemBaneProjectile.DisplayName: System Bane TeslaCannonShot.DisplayName: Tesla Beam UnstableMatter.DisplayName: Unstable Matter VoltageStream.DisplayName: Voltage Stream +VulcanProjectile.DisplayName: Vulcan Shot +VulcanSpear.DisplayName: Vulcanite Lance WavePounderBoom.DisplayName: Explosion WavePounderProjectile.DisplayName: Wave Pounder // Environmental AcidDrop.DisplayName: Acid +BarrelCactusProjectile.DisplayName: Barrel Cactus BrimstoneGeyser.DisplayName: Smoke GeyserTelegraph.DisplayName: Geyser HotSteam.DisplayName: Steam diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson index f1b18a5670..c399a3778c 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Ranged.hjson @@ -99,7 +99,6 @@ GodSlayerSlugProj.DisplayName: God Slayer Slug HalleysComet.DisplayName: Halley's Comet HandheldTankShell.DisplayName: Tank Shell HeavenlyGaleProj.DisplayName: Heavenly Gale -HighExplosivePeanutShell.DisplayName: High Explosive Peanut Shell HiveMissile.DisplayName: Hive Missile HiveNuke.DisplayName: Hive Nuke HolyFireBulletProj.DisplayName: Holy Fire Bullet @@ -176,7 +175,6 @@ RicoshotCoin.DisplayName: Ricoshot Coin RocketFire.DisplayName: Fire RubberMortarRoundProj.DisplayName: Rubber Mortar SandblasterBullet.DisplayName: Sandstorm -ScorchedEarthBlast.DisplayName: Earth Scorcher ScorchedEarthClusterBomb.DisplayName: Cluster Bomb ScorchedEarthRocket.DisplayName: Rocket ScorpioRocket.DisplayName: Nano Missile @@ -207,6 +205,7 @@ SicknessRound2.DisplayName: Round SlagRound.DisplayName: Slag Round SlimeBolt.DisplayName: Slime Bolt SparkSpreaderFire.DisplayName: Sparked Flames +SpectralFlare.DisplayName: Spectral Flare SpeedBlasterShot.DisplayName: Splatter Shot SporeBomb.DisplayName: Spore Bomb SproutingArrowMain.DisplayName: Sprouting Arrow @@ -262,3 +261,5 @@ LeviatitanMeteor.DisplayName: Leviatitan Meteor LeviatitanExplosion.DisplayName: Leviatitan Explosion SulphuricDrop.DisplayName: Sulphuric Drop AcidRocket.DisplayName: Acid Rocket +M1GarandBulletCasing.DisplayName: M1 Garand Bullet Casing +M1GarandEmptyClip.DisplayName: M1 Garand Empty Clip diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index 5328e2d17b..dff876c6d5 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -38,7 +38,6 @@ CelestialReaperProjectile.DisplayName: Celestial Reaper CelestusMiniScythe.DisplayName: Celestus CelestusProj.DisplayName: Celestus CinquedeaProj.DisplayName: Cinquedea -CircletMark.DisplayName: Tornado Mark CircletTornado.DisplayName: Tornado CobaltEnergy.DisplayName: Cobalt Energy CobaltKunaiProjectile.DisplayName: Cobalt Kunai @@ -158,6 +157,7 @@ LeonidCometSmall.DisplayName: Leonid Comet LeonidProgenitorBombshell.DisplayName: Leonid Bombshell LeonidStar.DisplayName: Leonid Star LeviathanTooth.DisplayName: Leviathan Tooth +LeviathanToothStealth.DisplayName: Leviathan Jaw LionfishProj.DisplayName: Lionfish LostSoulFriendly.DisplayName: Lost Soul LuminousShard.DisplayName: Stardust Shard diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson index a785c71812..94c47e68d7 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Summon.hjson @@ -59,7 +59,7 @@ CausticStaffSummon.DisplayName: Caustic Dragon CelestialAxeMinion.DisplayName: Celestial Axe Cinder.DisplayName: Cinder CinderBlossom.DisplayName: Cinder Blossom -CloudElementalMinion.DisplayName: Cloudy Waifu +CloudElementalMinion.DisplayName: Cloud Elemental CnidarianJellyfishOnTheString.DisplayName: Cnidarian CnidarianSpark.DisplayName: Cnidarian Spark CorroslimeMinion.DisplayName: Corroslime @@ -307,9 +307,7 @@ MagicUmbrella.DisplayName: Cyan Umbrella UniverseSplitterField.DisplayName: Field UniverseSplitterHugeBeam.DisplayName: Universe Splitter Ray UniverseSplitterSmallBeam.DisplayName: Universe Splitter Ray -UrchinSpike.DisplayName: Urchin Spike Valkyrie.DisplayName: Valkyrie -VictideSeaSnail.DisplayName: Sea Snail VileFeederProjectile.DisplayName: Eater of Souls Mini VileFeederSummon.DisplayName: Baby Eater ViridVanguardBlade.DisplayName: Vanguard Blade diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index ec59c3406c..b9c79438a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -31,7 +31,6 @@ BossRushEndEffectThing.DisplayName: Boss Rush End Effect Thing BossRushFailureEffectThing.DisplayName: Boss Rush Failure Effect Thing BossRushTierAnimation.DisplayName: Boss Rush Tier Animation ChaoticGeyser.DisplayName: Chaotic Geyser -ChlorophyteLifePulse.DisplayName: Life Pulse ChronoClock.DisplayName: Chrono Clock ClaretCannonProj.DisplayName: Claret Round CoralBubble.DisplayName: Bubble @@ -110,7 +109,6 @@ ProtolithBangleProjectile.DisplayName: Marble Shatter PscTransformAnimation.DisplayName: Psc Transform Animation PscTransformRocks.DisplayName: Psc Transform Rocks PuddleSplash.DisplayName: Puddle Splash -ReaverOrb.DisplayName: Reaver Orb ReaverThornBase.DisplayName: Thorn RedLabSeeker.DisplayName: Seeking Mechanism RelicGuard.DisplayName: Relic Guard @@ -146,6 +144,10 @@ TransformerAura.DisplayName: Transformer Aura TransformerBlob.DisplayName: Transformer Shard UrsaSlash.DisplayName: Ursa Slash VerstaltiteBobber.DisplayName: Verstaltite Bobber +VictideBarrier.DisplayName: Tidal Barrier +VictideBobber.DisplayName: Snail Bobber +VictideSeaSnail.DisplayName: Sea Snail +VictideSpirit.DisplayName: Bubbly Spirit VoidFieldGenerator.DisplayName: Void Field Generator WarbannerDamage.DisplayName: The Unmatched Power of the Sun WarbannerLight.DisplayName: Warbanner Light @@ -155,9 +157,19 @@ WulfrumBobber.DisplayName: Wulfrum Bobber WulfrumDiggingTurtleProjectile.DisplayName: Digging Turtle WulfrumHook.DisplayName: Wulfrum Slingshot WulfrumLureSignal.DisplayName: Signal -YanmeisKnifeSlash.DisplayName: Yanmei's Knife YellowLabSeeker.DisplayName: Seeking Mechanism VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation XykWings.DisplayName: Xyk Wings BatholithBangleProjectile.DisplayName: Batholith Bangle Projectile +ScionsCurioMini.DisplayName: Scions Curio Mini +BlackPearlFalling.DisplayName: Black Pearl Falling +DunesandBallFalling.DisplayName: Dunesand Ball Falling +EutrophicSandBallFalling.DisplayName: Eutrophic Sand Ball Falling +PinkPearlFalling.DisplayName: Pink Pearl Falling +PolypSandBallFalling.DisplayName: Polyp Sand Ball Falling +VolcanicSandBallFalling.DisplayName: Volcanic Sand Ball Falling +WhitePearlFalling.DisplayName: White Pearl Falling +DuneSandBallGun.DisplayName: Dunesandball +PolypSandBallGun.DisplayName: Polyp Sandball +VolcanicSandBallGun.DisplayName: Volcanic Sandball diff --git a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson index 05300a04a6..5b5cae9452 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Boss.hjson @@ -3,9 +3,6 @@ SlimeGodRun: The Slime God flees to fight another day... // Cryogen CryogenBossText: Cryogen is derping out! PyrogenBossText: Pyrogen is derping out! -// Triplets -TripletsBossText: The Triplets have awoken! -TripletsDefeatName: The Triplets // Calamitas Clone CalamitasBossText: You underestimate my power... CalamitasBossText2: Rise again, my siblings. @@ -16,8 +13,6 @@ SandSharkText2: An enormous apex predator approaches... // Plaguebringer Goliath PlagueBossText: PLAGUE NUKE BARRAGE ARMED, PREPARING FOR LAUNCH!!! PlagueBossText2: MISSILES LAUNCHED, TARGETING ROUTINE INITIATED!!! -// Astrum Deus -DeusAltarRejectNightText: The god of the stars rejects your offering. The ritual can only be performed at night. // Providence ProfanedBossText: Holy flames burn away at your wings... // Polterghast @@ -105,20 +100,20 @@ SCalDesparationText1Rematch: A terrific display, I concede this match to you. SCalDesparationText2Rematch: No doubt you will face enemies stronger than I. SCalDesparationText3Rematch: I trust you will not make the same mistakes he did. SCalDesparationText4Rematch: I can't imagine what your future holds now. -// Cirrus (GFB) -CirrusSummonText: Are you prepared for a task most Sisyphean? -CirrusBirbSwarmText: Those hearts are a bit too edgy. How about a swarm of birbs instead? -CirrusBH2Text: Feelin' thirsty? I can fix that! -CirrusBH3Text: Check out this cool toy I found! -CirrusDoGText: I told you the talking worms were real! But you didn't believe me! -CirrusPhase2Text: Time for a transformation! -CirrusBH4Text: It's HAGE time! -CirrusHallowBossSpamText: I have more friends than you could possibly imagine! -CirrusBH5Text: Hah! You're good, but I'm better! -CirrusSecondBirbSwarmText: Time for another swarm! -CirrusNonchalantText: I'm getting tired... -CirrusBruhText: Just kidding! Time for my special attack! -CirrusGiveUpText: Meh, whatever, I'm a bit tired of this. +// Permafrost (GFB) +PermafrostSummonText: Are you prepared for a task most Sisyphean? +PermafrostBirbSwarmText: Those hearts were a bit too brutal for my taste. How about some lovely birds instead? +PermafrostBH2Text: Getting tired from the battle, adventurer? Hungry? How does some Delicious Meat sound? +PermafrostBH3Text: Suprised at how I am holding my own again you? I did train Calamitas, after all! +PermafrostDoGText: The serpent!? How!? What is HE doing here!? Is he here to torment me further!? Kill it, adventurer! +PermafrostPhase2Text: Ha! I suppose I can no longer be "chill" about this duel! Get it? +PermafrostBH4Text: Need a break? Can you not even keep up with an old man? +PermafrostHallowBossSpamText: You truly have grown strong! Thankfully, I and Calamitas reconstructed this to assist me. +PermafrostBH5Text: Why, it has been quite long since I have had an excuse to use these magics! +PermafrostSecondBirbSwarmText: I must say, those birds earlier were rather cute! Do some more not sound nice? +PermafrostNonchalantText: I must say, I am not the mage I used to be. This is starting to tire my old body... +PermafrostBruhText: Ha! Just kidding! Watch what happens when I cast a spell I know! +PermafrostGiveUpText: Gah, I think I pulled a muscle! Ah, well. I seems that I must concede. Well fought! // April Fools AprilFools: The LORDE is approaching... AprilFoolsGFB: La Ruga is approaching... diff --git a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson index 472bb07020..693d421595 100644 --- a/Localization/en-US/Mods.CalamityMod.Status.Death.hjson +++ b/Localization/en-US/Mods.CalamityMod.Status.Death.hjson @@ -46,8 +46,6 @@ ChaliceOfTheBloodGod18: "{0} was reduced to a dry husk by the Chalice of the Blo ChaliceOfTheBloodGodClose: "{0} almost made it. Almost." ChaliceOfTheBloodGodUnequip: "{0} violated their pact with the Blood God." ChibiiDoggo: "{0} couldn't stand the sharp objects." -CirrusSlap1: "{0} was slapped too hard." -CirrusSlap2: "{0} forked around and found out." CorpusAvertor: "{0} became the Blood God's sacrifice." CrushDepth1: "{0} was crushed by the pressure." CrushDepth2: "{0}'s lungs collapsed." @@ -63,6 +61,7 @@ Dragonfire4: This was a fight {0} could not win. ElementalMix1: "{0} was reduced to technicolor confetti." ElementalMix2: "{0} was blasted apart by a harmonized elemental onslaught." ElementalMix3: "{0} was overwhelmed by elemental turbulence." +FlareGunOverheat: "{0}'s gun was simply too hot to handle." GodSlayerInferno1: "{0} imploded into nothingness." GodSlayerInferno2: "{0}'s body slipped into oblivion." GodSlayerInferno3: "{0} ceased being a part of our universe." diff --git a/Localization/en-US/Mods.CalamityMod.Tiles.hjson b/Localization/en-US/Mods.CalamityMod.Tiles.hjson index 32316202fc..a88b068345 100644 --- a/Localization/en-US/Mods.CalamityMod.Tiles.hjson +++ b/Localization/en-US/Mods.CalamityMod.Tiles.hjson @@ -9,6 +9,8 @@ PirateCrate: Abandoned Crate // Basic Calamity Furniture Basin: Basin LavaFountain: Lava Fountain +BaroqueCello: Baroque Cello +Jukebox: Jukebox PipeOrgan: Pipe Organ Sconce: Sconce // Draedon Lab Furniture diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 0691f76312..a8074892b0 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -1,7 +1,8 @@ -SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" +SmallWorldWarning: "[c/FF0000:SMALL WORLDS NOT SUPPORTED BY CALAMITY]" // Main Menu Name MainMenu: Calamity Style MainMenuClassic: Calamity Style - Classic +MainMenuSunken: Calamity Style - Sunken // Main UI Elements Adrenaline: Adrenaline Nanomachines: Nanomachines @@ -11,13 +12,13 @@ Charge: Current Charge DefenseDamage: Defense Damage SulphurousWater: Sulphuric Poisoning Stealth: Stealth -StealthShiftText: Hold SHIFT for more information on Rogue stealth +StealthShiftText: Hold Shift for more information on Rogue stealth StealthInfoText: ''' Rogue stealth builds while not attacking and slower while moving Once you have built max stealth, you will be able to perform a Stealth Strike Rogue stealth only reduces when you attack, it does not reduce while moving - The higher your rogue stealth the higher your rogue damage and crit + The higher your rogue stealth the higher your rogue damage Having more stealth regeneration slightly decreases the damage bonus from stealth This is offset by you being able to use stealth strikes far more often ''' @@ -26,15 +27,31 @@ DifficultyStatusText: "{0} is {1}." ModeAppend: "{0} Mode" Active: Active NotActive: Not active -DifficultyShiftText: "[c/737373:Hold the 'Shift' key for more information]" +DifficultyShiftText: "[c/737373:Hold Shift for more information]" CurrentlySelected: Currently Selected : {0} DifficultyClickText: "[c/919191:Click to select a difficulty mode]" ExpertDifficultyLock: "[c/919191:Higher difficulty modes can only be toggled in Expert Mode or above]" ChangingTheRules: "[c/919191:You cannot change the rules now!]" -NoDifficulty: None -NoDifficultyInfo: The classic Terraria experience, with no Calamity difficulty changes +DifficultySwitch: Difficulty changed from [c/{0}:{1}] to [c/{2}:{3}]. +ClassicInfo: Your Adventure Begins... A far more relaxed Terraria experience +ExpertShortInfo: "[c/FFBA75:Fortune & Glory, Kid. For those looking for a more difficult vanilla experience]" +ExpertExpandedInfo: + ''' + [c/A87A07:Most bosses gain new attacks and more difficult attack patterns] + [c/A87A07:Most enemies have twice as much health, deal twice as much damage and receive 10% less knockback] + [c/A87A07:Certain enemies have new attacks, can inflict new debuffs or have a higher chance of inflicting debuffs they already had] + [c/A87A07:Enemies drop more loot, as well as having higher chances] + [c/A87A07:Players drop more of their coins on death] + ''' +MasterShortInfo: "[c/1CFFAA:Game over man, game over! A tougher step up in stats from Expert Mode]" +MasterExpandedInfo: + ''' + [c/029C6D:Most enemies have even more health and knockback resistance added on from Expert Mode] + [c/029C6D:Bosses have new exclusive vanity rewards] + [c/029C6D:Players drop ALL their coins on death] + [c/029C6D:Players gain an additional accessory slot at the start of the game] + ''' Revengeance: Revengeance -RevengeanceEnabled: Revengeance Mode is enabled RevengeanceShortInfo: "[c/F54254:The intended Calamity experience! Can only be enabled in Expert Mode!]" RevengeanceExpandedInfo: ''' @@ -46,21 +63,17 @@ RevengeanceExpandedInfo: [c/B55362:Bosses have new AI mechanics, new phases, and will drop Master Mode loot. Enemies spawn more frequently] [c/F7342A:This mode is more difficult than Expert. Be sure to prepare for the challenge] ''' -RevengeanceActivate: Revengeance is active. -RevengeanceDeactivate: Revengeance is not active. Death: Death -DeathLegend: Death+Legend -DeathEnabled: Death Mode is enabled -DeathShortInfo: "[c/C82DF7:A far more difficult challenge than Revengeance Mode! Can only be enabled in Master Mode!]" +DeathShortInfo: "[c/E066F7:A far more difficult challenge than Revengeance Mode! Can only be enabled in Master Mode!]" DeathExpandedInfo: ''' - [c/B834E0:All foes will pose a much larger threat with highly aggressive AIs and increased damage] + [c/B834E0:All foes will pose a much larger threat with highly aggressive AIs] [c/B834E0:Bosses have substantially harder AI changes. Enemies are even more numerous and can easily overwhelm you] [c/B834E0:Debuffs are especially lethal and the Abyss is significantly more dangerous] [c/E945FF:Vigilance and tenacity are crucial to survival] ''' -DeathActivate: Death is active; enjoy the fun. -DeathDeactivate: Death is not active; not fun enough for you? +// Legendary (FTW + Master) + Death Mode +Malice: Malice // Calamity Health Bar ExoTwinsNameNormal: XS-01 Artemis and XS-03 Apollo ExoTwinsNameHekate: Eyes of XB-∞ Hekate @@ -85,6 +98,8 @@ Cooldowns: { BloodflareFrenzy: Blood Frenzy Cooldown BloodflareRangedSet: Bloodflare Soul Cooldown BrimflameFrenzy: Brimflame Frenzy Cooldown + BubblyBurrowActive: Bubbly Burrow + BubblyBurrowCooldown: Bubbly Burrow Cooldown ChaosState: Teleportation Cooldown DivineBless: Divine Bless Cooldown DivingPlatesBreaking: Abyssal Diving Suit Plates Durability @@ -104,6 +119,8 @@ Cooldowns: { KillModeCooldown: Kill Mode Cooldown LifeSteal: Life Steal Cooldown LionHeartShield: Energy Shell Cooldown + LucreciaEnergy: Lucrecia Energy + M1GarandShots: Chambered Rounds MasterChefShieldDurability: MJOLNIR Shield Level MasterChefShieldRecharge: MJOLNIR Shield Recharge NebulousCore: Nebulous Core Cooldown @@ -116,7 +133,7 @@ Cooldowns: { PrismaticLaser: Prismatic Laser Barrage Cooldown ProfanedSoulShieldDurability: Profaned Soul Shield Durability ProfanedSoulShieldRecharge: Profaned Soul Shield Recharge - RaiderBoost: Extra Critical Chance + RaidersBoost: Extra Critical Strike Chance RelicOfResilienceCooldown: Relic of Resilience Cooldown RogueBooster: Rogue Booster Cooldown SandCloak: Sand Cloak Cooldown @@ -132,6 +149,7 @@ Cooldowns: { TarragonImmunity: Tarragon Immunity Cooldown UniverseSplitter: Universe Splitter Cooldown WarbanneroftheRighteousBuff: Warbanner Strength + WardingWave: Warding Wave Cooldown WulfrumBastionActive: Power Armor Durability WulfrumBastionCooldown: Wulfrum Bastion Cooldown WulfrumRoverDriveDurability: Protective Matrix Durability @@ -147,7 +165,7 @@ Evoke: Evoke Exit: Exit Communicate: Communicate ConfirmationText: Are you sure? -UpgradesRequired: Encryption unsolveable: Upgrades required. +UpgradesRequired: Encryption unsolvable: Upgrades required. ThanatosIcon: Thanatos, a serpentine terror with impervious armor and innumerable laser turrets. AresIcon: Ares, a heavyweight, diabolical monstrosity with four Exo superweapons. ArtemisApolloIcon: Artemis and Apollo, a pair of extremely persistent automatons with unstable energy reserves. @@ -206,13 +224,13 @@ Communication: { Inquiry: Your Origins Response: ''' - My first memories are that of awakening in a distant laboratory on the date of 11.19.1227, well over six centuries ago. Surrounded by nothing but a vast taiga, I was accompanied by only one other thing: a dead organic.\n + My first memories are that of awakening in a distant laboratory on the date of 1227-11-19, well over six centuries ago. Surrounded by nothing but a vast taiga, I was accompanied by only one other thing: a dead organic.\n Presumably, I was created by what I assume to be the laboratory's former inhabitant, though I am unsure how they accomplished such a feat. From what I gathered, they were quite the prestigious inventor, not unlike I. Several gadgets assumedly of their own making were attached to their body, and the equipment in the lab was more advanced than any I found elsewhere in the world.\n I have no recollection of events prior to my activation, but from the start, I knew what my goal was: creation and scientific advancement. Many years were spent optimizing and building upon both the laboratory and myself to assure constant progress.\n - At the date of 7.30.1385, expansion of the laboratory became impractical. Thus, I chose to instead expand my horizons. I sent hundreds of remotely-piloted scoutbots to thoroughly survey the continent, ignorant of the attention such an endeavor would draw when not properly prepared.\n + At the date of 1385-07-30, expansion of the laboratory became impractical. Thus, I chose to instead expand my horizons. I sent hundreds of remotely-piloted scoutbots to thoroughly survey the continent, ignorant of the attention such an endeavor would draw when not properly prepared.\n In the following years, legends and rumors began to spread in nearby cities. Many spoke of encounters with roaming creatures made not of flesh and blood, but steel and oil. Scholars attempted to study my machines. Some explorers even followed my creations back to one of my several recon bodies.\n @@ -224,7 +242,7 @@ Communication: { Inquiry: Role in the Crusade Response: ''' - While the Crusade is widely considered to have begun on the date of 6.19.1781 with Yharon's rebirth, I took no part in it until 4.23.1803. Upon joining, I was chosen to lead the science and engineering divisions. While I was given freedom over which projects I chose and how I pursued them, it was expected that anything I made would be beneficial to the war effort.\n + While the Crusade is widely considered to have begun on the date of 1781-06-19 with Yharon's rebirth, I took no part in it until 1803-04-23. Upon joining, I was chosen to lead the science and engineering divisions. While I was given freedom over which projects I chose and how I pursued them, it was expected that anything I made would be beneficial to the war effort.\n Boosting the efficiency of mining operations was my first major contribution to Yharim's campaign, being essential to any further development. I learned how to mass produce the first generation of Excavators to expand mining operations outside of Azafure, and then used similar mass-producible technology to create arms and armaments that far outclassed our enemies'. Many simply dubbed this equipment "The Arsenal".\n @@ -514,7 +532,7 @@ Exhumed: { Indignant: { DisplayName: Indignant - Description: Summons demons that harm you but drop healing items on death on item usage. + Description: Summons demons that harm you but drop healing orbs on death on item usage. } Aflame: { @@ -591,10 +609,12 @@ Lecherous: { Disenchant: Disenchant // Worldgen Tasks BetterUnderworld: Creating a smoother Underworld +BetterShimmer: Placing shimmer in a sane location UnderworldStructures: Remnants of an Azafurian and Demonic war UnderworldPillars: Constructing Underworld pillars UnderworldTreesAndGrass: Growing Underworld flora UnderworldGeyserTraps: Adding an Underworld minefield +ShimmerShrine: Excavating an ancient shimmer well EvilIslandCorrupt: Adding a putrid floating island EvilIslandCrimson: Adding a grotesque floating island AstralChest: Placing an astral chest @@ -637,8 +657,8 @@ SulphurSea2: Irradiating one of the oceans Roxcalibur: I wanna rock AuricLandMines: Setting god killing traps // Hold Shift tooltip default -HoldShiftTooltipExtensionIndicator: Hold "Left Shift" for more -HoldShiftTooltipReplacementIndicator: Hold "Left Shift" for details +HoldShiftTooltipExtensionIndicator: Hold Shift for more +HoldShiftTooltipReplacementIndicator: Hold Shift for details // Dev and Donor Items DevItemTooltip: - Dev Item - DonorItemTooltip: - Donor Item - diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson index 718270c4af..3ea54b5b73 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.Armor.hjson @@ -10,15 +10,6 @@ SetBonus: { Melee: 15% increased melee speed and 20% increased movement speed } - Chlorophyte: - ''' - Summons a powerful leaf crystal to shoot pulses of life every {0} seconds - The pulses do a base damage of {1} to enemies within its range - The pulses also provide a {2} health boost to you and all players on your team - Players healed by pulses cannot be healed by another pulse until {3} seconds have passed - Both the health boost and the damage scale based on your strongest class - ''' - Cobalt: { $parentVal: ''' @@ -28,7 +19,7 @@ SetBonus: { Melee: 10% increased melee damage } - Copper: Increases all damage by 2 + Copper: Increases all damage by {0} Crimson: ''' Greatly increased natural life regen @@ -39,7 +30,7 @@ SetBonus: { ''' Multiplies all cold-based debuff damage by 1.25x Cold enemies will deal reduced contact damage to the player - Provides immunity to the Chilled, Frozen, Frostburn and Glacial State debuffs + Provides immunity to the Chilled, Frozen, and Frostburn debuffs ''' Rain: ''' @@ -49,7 +40,7 @@ SetBonus: { ''' Forbidden: ''' - {$LegacyTooltip.48} {$ArmorSetBonus.Forbidden} + {$LegacyTooltip.48} {0} to call an ancient storm to the cursor location Minions no longer deal less damage while wielding magic weapons ''' Frost: @@ -60,27 +51,18 @@ SetBonus: { ''' Gladiator: ''' - +3 defense +60 maximum stealth 5% increased rogue damage and 10% increased velocity ''' Gold: ''' - All enemies have a 2% chance to drop 1 gold; bosses killed drop 3 gold - You gain 1% critical strike chance for every 10 gold in your inventory, capped at 7% - ''' - Iron: - ''' - Increases damage reduction by 6% - +1 HP/s life regen + All enemies have a {0}% chance to drop 1 extra gold + All bosses drop {1} extra gold + You gain {2}% critical strike chance for every gold in your inventory, capped at {3}% ''' + Iron: Multiplies all player-inflicted knockback by {0}x Jungle: 10% reduced mana costs - Lead: - ''' - Increases damage reduction by 4% - +0.5 HP/s life regen - Grants immunity to knockback - ''' + Lead: Grants immunity to knockback Meteor: All magic guns cost 33% mana Mining: Mining ore will sometimes have additional yield Molten: @@ -126,28 +108,20 @@ SetBonus: { Grants +2 HP/s life regeneration after striking an enemy This life regeneration bypasses negative life regeneration ''' - PlatinumChainmail: 3% increased critical strike chance - Platinum: - ''' - Every 10 extra defense gives you 1% increased damage - The 20 defense from the Platinum Armor itself does not contribute to this effect - Bonus damage caps at 50 extra defense - ''' + Platinum: Increases damage reduction by {0}% Silver: ''' - +0.5 HP/s life regen - Two seconds after getting hit for 20 or more damage, you heal for 10 + {0} seconds after getting hit for {1} or more damage, you heal for {2} Getting hit again resets the timer, delaying the heal ''' - Tin: Increases armor penetration by 5 - Tungsten: - ''' - Increases your critical strike chance by 100% of the knockback of your held weapon - This effect caps at Insane knockback, which gives 10% increased critical strike chance - Increases all knockback by 33%, this counts for the above boost - Current bonus: {0}% critical strike chance from {1} knockback - ''' + Tin: "{0}% increased critical strike chance" + Tungsten: Grappling hooks pull and retract {0}% faster MagicHat: Increases maximum mana by 40 + Vortex: + ''' + {$LegacyTooltip.48} {0} to toggle stealth, + increasing ranged ability and reducing chance for enemies to target you but slowing movement speed + ''' Wizard: 4% increased magic critical strike chance CrystalAssassin: ''' diff --git a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson index b037db0068..eea5f703ae 100644 --- a/Localization/en-US/Mods.CalamityMod.Vanilla.hjson +++ b/Localization/en-US/Mods.CalamityMod.Vanilla.hjson @@ -1,3 +1,4 @@ +DashKey: Press {0} while facing a direction DodgeInfo: ''' Grants the ability to dodge attacks @@ -14,7 +15,7 @@ AddedTooltip: { Enrages outside the Ocean ''' SlimeGun: Slimed enemies take more damage from fire-based debuffs - FleshKnucklesLine: Max life increased by 45 + FleshKnucklesLine: Max life increased by 25 RodofDiscord: Teleportation is disabled while Chaos State is active Pwnhammer: ''' @@ -27,7 +28,6 @@ AddedTooltip: { This grants +1.5 HP/s life regen and accelerates natural life regen Life drain stacks based on the number of enemies being hit ''' - WarmthPotion: Greatly reduces the duration of Chilled, Frozen, and Glacial State HandWarmer: Provides a regeneration boost while wearing the Snow armor GoldenFishingRod: Its fishing line will never break // Step Stool @@ -46,12 +46,9 @@ AddedTooltip: { FairyBoots: ''' Fairies can spawn at any time on the surface and spawn far more frequently - Nearby fairies grant +2 HP/s life regen, 10 defense and 10% movement speed + Nearby fairies grant +2 HP/s life regen, 6 defense and 10% movement speed Fairies are immune to damage and will no longer flee ''' - MoonStone: Reduces the damage of the Nightwither debuff - SunStone: Reduces the damage of the Daybroken debuff - CelestialStone: Reduces the damage of the Nightwither and Daybroken debuffs ArcaneFlower: 5% increased magic damage RifleScope: The scope effect can be toggled with visibility FeatherfallPotion: Disables all airborne flight recovery @@ -59,29 +56,6 @@ AddedTooltip: { YoyoGlove: Secondary yoyos will do 50% less damage DefensePrefix: +{0}% damage reduction LuckyPrefix: +0.05 luck - /* - Armor - */ - CopperHelmet: 5% increased damage - CopperChainmail: 3% increased critical strike chance - CopperGreaves: 5% increased movement speed - TinHelmet: 3% increased critical strike chance - TinChainmail: +0.5 HP/s life regen - TinGreaves: 5% increased movement speed - IronPieces: Increases damage reduction by 3% - LeadPieces: Increases damage reduction by 2% - SilverHelmet: 5% increased critical strike chance - SilverChainmail: +1 HP/s life regen - SilverGreaves: 8% increased movement speed - TungstenHelmet: 7% increased damage - TungstenChainmail: +0.5 HP/s life regen - TungstenGreaves: 8% increased movement speed - GoldHelmet: 5% increased damage - GoldChainmail: Increases damage reduction by 5% - GoldGreaves: 10% increased movement speed - PlatinumHelmet: 6% increased damage - PlatinumChainmail: 3% increased critical strike chance - PlatinumGreaves: 10% increased movement speed CrimsonBreastplate: +1 HP/s life regen CrimsonOtherPieces: +0.5 HP/s life regen Picksaw: Can mine Scoria Ore located in the Abyss @@ -99,7 +73,7 @@ EditedTooltip: { BloodySpine: ''' Summons the Brain of Cthulhu when used in the Crimson - Enrages outside the Underground Crimson + Despawns outside the Crimson ''' ClothierVoodooDoll: ''' @@ -118,31 +92,19 @@ EditedTooltip: { Summons the Golem when used at the Lihzahrd Altar Enrages outside the Jungle Temple ''' - MechanicalEye: - ''' - Summons The Twins when used during nighttime - Enrages during the day - ''' + MechanicalEye: Summons The Twins when used during nighttime MechanicalSkull: ''' Summons Skeletron Prime when used during nighttime Enrages during the day ''' - MechanicalWorm: - ''' - Summons The Destroyer when used during nighttime - Enrages during the day - ''' + MechanicalWorm: Summons The Destroyer when used during nighttime QueenSlimeCrystal: Summons Queen Slime when used in the Hallow - SuspiciousLookingEye: - ''' - Summons the Eye of Cthulhu when used during nighttime - Enrages during the day - ''' + SuspiciousLookingEye: Summons the Eye of Cthulhu when used during nighttime WormFood: ''' Summons the Eater of Worlds when used in the Corruption - Enrages outside the Underground Corruption + Despawns outside the Corruption ''' MasterExclusive: Master or Revengeance // Sparkle Slime Balloon @@ -170,7 +132,6 @@ EditedTooltip: { // Arcane Crystal AegisCrystal: Permanently boosts natural life regeneration ArcheryPotion: 20% increased arrow speed and 5% increased arrow damage - IronskinPotion: Increase defense by {0} // Aerial Bane DD2BetsyBow: Shoots a tight spread of 6 splitting arrows AleSake: @@ -198,13 +159,12 @@ EditedTooltip: { // Soaring Insignia EmpressFlightBooster1: Increases wing flight time by 33% EmpressFlightBooster2: Increases movement and jump speed by 10% and acceleration by 1.25x - RifleScope1: Increase view range for guns (Right click to zoom out) + RifleScope1: Increase view range for guns ( to zoom out) RifleScope2: The scope effect can be toggled with visibility SniperScope: 12% increased ranged critical strike chance MagicQuiver: Increases arrow damage by 5% and greatly increases arrow speed MoltenQuiver1: Increases arrow damage by 7% and greatly increases arrow speed MoltenQuiver2: Lights wooden arrows ablaze and all arrows inflict Hellfire - MagicPowerPotion: 10% increased magic damage MagicHat: 6% increased magic critical strike chance PowerGlove: 10% increased melee speed, does not stack with downgrades BerserkerGlove: 10% increased true melee damage @@ -219,8 +179,6 @@ EditedTooltip: { 14% increased melee damage 14% increased melee speed, does not stack with downgrades ''' - ObsidianSkullLine: Grants immunity to the Burning and On Fire! debuffs - LavaWaders: Grants immunity to the Burning and On Fire! debuffs, and 7 seconds of immunity to lava Gi: 10% increased movement and jump speed GoldPickaxe: Can mine Demonite, Crimtane, Meteorite, Sea Prisms, and Sea Prism Crystals FlaskofCursedFlames: Melee, Whip, and Rogue attacks inflict enemies with cursed flames @@ -284,8 +242,8 @@ EditedTooltip: { Provides 32% increased jump speed and increased fall speed Provides a gravitational boost jump, which recharges whenever gravity is flipped Slightly improves wingless air movement speed - Press UP to change gravity - Press DOWN to fall faster + Press {$Key.UP} to change gravity + Press {$Key.DOWN} to fall faster ''' } @@ -294,8 +252,7 @@ BuffDescription: { Banner: You have increased damage and defense against the following: BeetleMight: Melee damage and speed increase by {0}% and {1}% respectively ChaosState: Rod of Discord teleports are disabled - LeafCrystal: Emits powerful life pulses at nearby enemies - WarmthExtra: Reduced durations of Chilled, Frozen, and Glacial State + Rabies: Decreased life regen, Causes status effects WeaponImbueConfetti: All attacks cause confetti to appear WeaponImbueCursedFlames: Melee, Whip, and Rogue attacks inflict enemies with cursed flames WeaponImbueFire: Melee, Whip, and Rogue attacks set enemies on fire @@ -339,7 +296,6 @@ DemolitionistChat: { DryadChat: { DarksunEclipse: There's a dark solar energy emanating from the moths that appear during this time. What's up with moths getting stronger as you do too? Hardmode: That starborne illness sits upon this land like a blister. Do even more vile forces of corruption exist in worlds beyond? - DrunkPrincessShroom: "{0} put me up to this." Mushroom: I'm not here for any reason! Just picking up mushrooms for uh, later use. SulphurSea: My Goddess is resting deep below this sea. If you may excuse me, I wish to pay my respects to her alone. } @@ -377,7 +333,6 @@ MechanicChat: { MoonLordDefeated: What do you mean your traps aren't making the cut? Don't look at me! Eclipse: Um... should my nightlight be on? AcidRain: Maybe I should've waterproofed my gadgets... They're starting to corrode. - DrunkPrincess: Well, I like {0}, but I, ah... I have my eyes on someone else. } MerchantChat: { @@ -407,7 +362,6 @@ PainterChat: { } PartyGirlChat: { - DrunkPrincess: I have a feeling we're going to have absolutely fantastic parties with {0} around! Eclipse1: I think my light display is turning into an accidental bug zapper. At least the monsters are enjoying it. Eclipse2: Ooh! I love parties where everyone wears a scary costume! } @@ -415,7 +369,6 @@ PartyGirlChat: { PirateChat: { PreLeviathan: Aye, I've heard of a mythical creature in the oceans, singing with an alluring voice. Careful when yer fishin out there. WetScourgeDefeated: I have to thank ye again for takin' care of that sea serpent. Or was that another one... - DrunkPrincess: Twenty-nine bottles of beer on the wall... SeaKing: I remember legends about that {0}. He ain't quite how the stories make him out to be though. Ocean: Now this is a scene that I can admire any time! I feel like something is watching me though. SulphurSea1: It ain't much of a sight, but there's still life living in these waters. @@ -442,18 +395,12 @@ SteampunkerChat: { StylistChat: { Hardmode: Please don't catch space lice. Or {0} lice. Or just lice in general. - DrunkPrincess1: "{0} is always trying to brighten my mood... even though, deep down, I know she's sad..." - DrunkPrincess2: Sometimes I catch {0} sneaking up from behind me. - DrunkPrincess3: "{0} has been smiling more often lately, even without alcohol. I think I can thank you for that, at least somewhat." ProfanedSoulCrystal1: They look so cute and yet, I can feel their immense power just by being near them. What are you? ProfanedSoulCrystal2: I hate to break it to you, but you don't have hair to cut or style, hun. ProfanedDonuts: Aww, they're so cute, do they have names? } -TavernkeepChat: { - FullMoon: Care for a little Moonshine? - DrunkPrincess: Sheesh, {0} is a little cruel, isn't she? I never claimed to be an expert on anything but ale! -} +TavernkeepChat.FullMoon: Care for a little Moonshine? TaxCollectorChat: { DoGDefeated: Devourer of what, you said? Devourer of Funds, if its payroll is anything to go by! @@ -463,12 +410,7 @@ TaxCollectorChat: { Has100Plat: BAH! Doesn't seem like I'll ever be able to quarrel with the debts of the town again! } -TravellingMerchantChat.DrunkPrincessMerchant: Tell {0} I'll take up her offer and meet with her at the back of {1}'s house. - -TruffleChat: { - Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. - DrunkPrincess: Sometimes, {0} just looks at me funny and I'm not sure how I feel about that. -} +TruffleChat.Normal: I don't feel very safe; I think there's pigs following me around and it frightens me. WitchDoctorChat: { BloodMoon: This is as good a time as any to pick up the best ingredients for potions. diff --git a/MainMenu/CalamityMainMenu_Sunken.cs b/MainMenu/CalamityMainMenu_Sunken.cs new file mode 100644 index 0000000000..1883b6b6c7 --- /dev/null +++ b/MainMenu/CalamityMainMenu_Sunken.cs @@ -0,0 +1,429 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using CalamityMod.Effects; +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.MainMenu.SunkenFishBoid; + +namespace CalamityMod.MainMenu +{ + public class CalamityMainMenu_Sunken : ModMenu + { + public class Bubble + { + public int Time; + public int Lifetime; + public int IdentityIndex; + public float Scale; + public float StoredScale; + public float Rotation; + public float RotationSpeed; + public float Depth; + public Color DrawColor; + public Vector2 Velocity; + public Vector2 Center; + + public Asset BubbleTexture; + + public Bubble(int lifetime, int identity, float depth, float storedScale, Color color, Vector2 startingPosition, Vector2 startingVelocity) + { + Lifetime = lifetime; + IdentityIndex = identity; + Depth = depth; + StoredScale = storedScale; + DrawColor = color; + Center = startingPosition; + Velocity = startingVelocity; + + Rotation = Main.rand.NextFloat(MathF.Tau); + RotationSpeed = Main.rand.NextFloat(0.01f, 0.04f) * Main.rand.NextBool().ToDirectionInt(); + BubbleTexture = ModContent.Request("CalamityMod/Particles/Bubble"); + } + + public void Update() + { + // Sway from side to side. + Velocity.X = MathHelper.Lerp(-1f, 1f, CalamityUtils.SineBumpEasing((Time / 60f), 1)); + Scale = MathHelper.Lerp(StoredScale, 0f, Time / (float)Lifetime); + + // Rotate. + Rotation += RotationSpeed * MathHelper.TwoPi * 0.1f; + + Time++; + Center += Velocity; + } + + public void Draw(SpriteBatch spriteBatch) + { + Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); + Vector2 parallaxedPosition = Center * depthFactor; + var scaleByDepth = Scale * Utils.Remap(Depth, 1, 5, 1f, 0.4f, true); + spriteBatch.Draw(BubbleTexture.Value, parallaxedPosition, null, DrawColor, Rotation, BubbleTexture.Value.Size() * 0.5f, scaleByDepth, 0, 0f); + } + } + + public static List Bubbles { get; private set; } = []; + + public static List Fishes { get; private set; } = []; + + public static Asset LogoWater => ModContent.Request("CalamityMod/MainMenu/LogoSunken_Water"); + + public static Asset LogoWaterFill => ModContent.Request("CalamityMod/MainMenu/LogoSunken_Water_Fill"); + + public static Asset Perlin => ModContent.Request("CalamityMod/MainMenu/Perlin"); + + public static Asset WorleyInverted => ModContent.Request("CalamityMod/MainMenu/WorleyInverted"); + + private static RenderTarget2D logoWaterFillTarget; + private static RenderTarget2D logoTarget; + + public int MaxBoids = 120; + + public float remixLogoRotation = 0f; + + /// + /// The global save data key which dictates whether or not the player is opening the Sunken Sea Overhaul update for the first time. + /// + public const string FirstTimeOpeningSunkenSeaOverhaulKey = "HasOpenedTheSunkenSeaOverhaulForTheFirstTime"; + + public override string DisplayName => CalamityUtils.GetTextValue("UI.MainMenuSunken"); + + public override Asset Logo => ModContent.Request("CalamityMod/MainMenu/LogoSunken"); + + public override Asset SunTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override Asset MoonTexture => ModContent.Request("CalamityMod/Backgrounds/BlankPixel"); + + public override int Music => CalamityMod.Instance.GetMusicFromMusicMod("SunkenSea") ?? MusicID.OceanNight; + + public override ModSurfaceBackgroundStyle MenuBackgroundStyle => ModContent.GetInstance(); + + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + if (!Main.dedServ) + { + LogoWaterFill.Wait(); + Logo.Wait(); + + Main.QueueMainThreadAction(() => + { + logoWaterFillTarget = new RenderTarget2D(Main.instance.GraphicsDevice, LogoWaterFill.Width(), LogoWaterFill.Height()); + logoTarget = new RenderTarget2D(Main.instance.GraphicsDevice, Logo.Width(), Logo.Height()); + }); + } + } + + public static void ForceMenuStyle() + { + // Forcefully open this ModMenu if it's the player's first time opening the Sunken Sea Overhaul update. + if (GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) + return; + + FieldInfo menusInfo = typeof(MenuLoader).GetField("menus", BindingFlags.Static | BindingFlags.NonPublic); + List modMenus = (List)menusInfo.GetValue(null); + + var sunkenMenu = ModContent.GetInstance(); + if (modMenus.Contains(sunkenMenu)) + { + FieldInfo lastSelectedMenuInfo = typeof(MenuLoader).GetField("LastSelectedModMenu", BindingFlags.Static | BindingFlags.NonPublic); + int sunkenSeaMenuIndex = modMenus.IndexOf(sunkenMenu); + lastSelectedMenuInfo.SetValue(null, modMenus[sunkenSeaMenuIndex].FullName); + } + } + + public override void Update(bool isOnTitleScreen) + { + if (!GlobalSaveDataSystem.IsKeyAlreadySaved(FirstTimeOpeningSunkenSeaOverhaulKey)) + GlobalSaveDataSystem.SaveKey(FirstTimeOpeningSunkenSeaOverhaulKey); + } + + public override bool PreDrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + DrawLogoWaterShader(spriteBatch); + + // Draw the main background for the menu. + DrawMenuBackground(spriteBatch); + + // Draw the fish boids passively swimming around the menu. + DrawFishes(spriteBatch); + + // Draw the bubbles rising from the bottom of the screen. + DrawBubbles(spriteBatch); + + // Draw the light rays at the top of the screen. + DrawLightRays(spriteBatch); + + // Draw the logo. + DrawLogo(spriteBatch, ref logoDrawCenter, ref logoRotation, ref logoScale, ref drawColor); + + return false; + } + + private static void DrawLogoWaterShader(SpriteBatch sb) + { + sb.End(); + + Main.instance.GraphicsDevice.SetRenderTarget(logoWaterFillTarget); + Main.instance.GraphicsDevice.Clear(Color.Transparent); + + sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Matrix.Identity); + + var fillShader = CalamityShaders.SunkenSeaMenuLogoWater.Value; + fillShader.Parameters["uImageSize"]?.SetValue(LogoWaterFill.Size()); + fillShader.Parameters["uTexture0"]?.SetValue(WorleyInverted.Value); + fillShader.Parameters["uBubbleTexture"]?.SetValue(Perlin.Value); + //fillShader.Parameters["uFillAmount"]?.SetValue(0.75f + (MathF.Sin(Main.GlobalTimeWrappedHourly) / 2f) * 0.25f); + fillShader.Parameters["uFillAmount"]?.SetValue(0.75f); + fillShader.Parameters["uWaveStrength"]?.SetValue(2.5f); + fillShader.Parameters["uWaveOffset"]?.SetValue(0.6f); + fillShader.Parameters["uSubtract"]?.SetValue(0.4f); + fillShader.Parameters["uTime"]?.SetValue(Main.GlobalTimeWrappedHourly); + fillShader.Parameters["uFillColor"]?.SetValue(new Color(67, 187, 204, 255 / 2).ToVector4() * 0.7f); + fillShader.Parameters["uEdgeColor"]?.SetValue(new Color(16, 99, 112, 255 / 2).ToVector4() * 0.7f); + fillShader.Parameters["uLineColor"]?.SetValue(new Color(179, 255, 255, 255 / 2).ToVector4() * 0.7f); + fillShader.CurrentTechnique.Passes[0].Apply(); + + sb.Draw(LogoWaterFill.Value, Vector2.Zero, Color.White); + + sb.End(); + + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + + Main.instance.GraphicsDevice.SetRenderTarget(logoTarget); + Main.instance.GraphicsDevice.Clear(Color.Transparent); + sb.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Matrix.Identity); + + sb.Draw(logoWaterFillTarget, new Vector2(406, 48), Color.White); + + sb.End(); + Main.instance.GraphicsDevice.SetRenderTarget(null); + sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix); + } + + private void DrawMenuBackground(SpriteBatch spriteBatch) + { + Texture2D backgroundTexture = ModContent.Request("CalamityMod/MainMenu/SunkenMenuBackground").Value; + + // Calculate the draw position offset and scale in the event that someone is using a non-16:9 monitor + Vector2 drawOffset = Vector2.Zero; + float xScale = (float)Main.screenWidth / backgroundTexture.Width; + float yScale = (float)Main.screenHeight / backgroundTexture.Height; + float scale = xScale; + + // if someone's monitor isn't in wacky dimensions, no calculations need to be performed at all + if (xScale != yScale) + { + // If someone's monitor is tall, it needs to be shifted to the left so that it's still centered on screen + // Additionally the Y scale is used so that it still covers the entire screen + if (yScale > xScale) + { + scale = yScale; + drawOffset.X -= (backgroundTexture.Width * scale - Main.screenWidth) * 0.5f; + } + else + // The opposite is true if someone's monitor is widescreen + drawOffset.Y -= (backgroundTexture.Height * scale - Main.screenHeight) * 0.5f; + } + + // Distort the background slightly to make it appear as if it's properly underwater. + MiscShaderData distortionShader = GameShaders.Misc["CalamityMod:BasicTextureDistortion"]; + Asset distortionTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Swirls"); + + spriteBatch.End(); // BLESS THIS. + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + + const float distortionXSpeed = -0.012f; + const float distortionYSpeed = 0.015f; + const float noiseScale = 0.75f; + const float noiseStrength = 0.02f; + Vector2 timeOffset = new Vector2(distortionXSpeed, distortionYSpeed) * Main.GlobalTimeWrappedHourly * noiseScale; + Vector2 noiseScaleStrength = new Vector2(noiseScale, noiseStrength); + distortionShader.Shader.Parameters["timeOffset"].SetValue(timeOffset); + distortionShader.Shader.Parameters["noiseScaleStrength"].SetValue(noiseScaleStrength); + distortionShader.SetShaderTexture(distortionTexture); + distortionShader.Apply(); + + spriteBatch.Draw(backgroundTexture, drawOffset, null, Color.White, 0f, Vector2.Zero, scale, SpriteEffects.None, 0f); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawLightRays(SpriteBatch spriteBatch) + { + // Draw rays shining down from the top of the screen. + MiscShaderData underwaterRaysShader = GameShaders.Misc["CalamityMod:UnderwaterRays"]; + Asset underwaterRayTexture = ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/Pebbles"); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointWrap, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + + underwaterRaysShader.Shader.Parameters["time"].SetValue(Main.GlobalTimeWrappedHourly); + underwaterRaysShader.Shader.Parameters["fadeOutMargin"].SetValue(0.58f); + underwaterRaysShader.Shader.Parameters["overallOpacity"].SetValue(1f); + underwaterRaysShader.Shader.Parameters["pixelationAmount"].SetValue(Main.screenWidth * 0.5f); + underwaterRaysShader.Shader.Parameters["scrollSpeedX"].SetValue(0.013f); + underwaterRaysShader.Shader.Parameters["scrollSpeedY"].SetValue(0.006f); + underwaterRaysShader.Shader.Parameters["noiseScale"].SetValue(new Vector2(1.25f, 0.25f)); + underwaterRaysShader.Shader.Parameters["rayColor"].SetValue(Color.LightSkyBlue.ToVector3()); + underwaterRaysShader.Apply(); + + spriteBatch.Draw(underwaterRayTexture.Value, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); + + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawLogo(SpriteBatch spriteBatch, ref Vector2 logoDrawCenter, ref float logoRotation, ref float logoScale, ref Color drawColor) + { + // Set the logo draw color to be white and the time to be noon + // This is because there is not a day/night cycle in this menu, and changing colors would look bad + drawColor = Color.White; + Main.time = 27000; + Main.dayTime = true; + + // Adjust rotation based on secret seeds; only Drunk world and Remix touch this, with GFB leeching off those two + // Standard rotation is none; Drunk world makes it spin out, so it can use the vanilla rotation due to disappearing + // Remix makes it flip upside down, and in GFB it will spin forever + if (WorldGen.remixWorldGen) + { + remixLogoRotation += MathHelper.Pi / 50f; + if (remixLogoRotation >= MathHelper.Pi && !WorldGen.everythingWorldGen) + remixLogoRotation = MathHelper.Pi; + } + else + remixLogoRotation = 0f; + float rotationSecretSeedAdjusted = WorldGen.remixWorldGen ? remixLogoRotation : WorldGen.drunkWorldGen ? logoRotation : 0f; + + // Draw the logo using a different spritebatch blending setting so it doesn't have a horrible yellow glow + Vector2 drawPos = new Vector2(Main.screenWidth / 2f, 100f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + spriteBatch.Draw(logoTarget, drawPos, null, drawColor, rotationSecretSeedAdjusted, logoTarget.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(Logo.Value, drawPos, null, drawColor, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.Draw(LogoWater.Value, drawPos, null, new Color(255, 255, 255, 0.5f) * 0.7f, rotationSecretSeedAdjusted, Logo.Value.Size() * 0.5f, WorldGen.drunkWorldGen ? logoScale : 1f, SpriteEffects.None, 0f); + spriteBatch.End(); + spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.UIScaleMatrix); + } + + private void DrawBubbles(SpriteBatch spriteBatch) + { + // Randomly add bubbles. + for (int i = 0; i < 3; i++) + { + if (Main.rand.NextBool(4)) + { + int lifetime = Main.rand.NextBool(5) ? Main.rand.Next(400, 500) : Main.rand.Next(200, 250); + float depth = Main.rand.NextFloat(1f, 5f); + float scale = Main.rand.NextFloat(0.2f, 0.8f); + Vector2 startingPosition = new Vector2(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f), Main.screenHeight * 1.05f) * depth; + Vector2 startingVelocity = -Vector2.UnitY.RotatedBy(Main.rand.NextFloat(-0.4f, 0.4f)) * 6f; + Color bubbleColor = Color.Lerp(SelectBubbleColor(), Color.White, 0.6f); + + Bubbles.Add(new Bubble(lifetime, Bubbles.Count, depth, scale, bubbleColor, startingPosition, startingVelocity)); + } + } + + // Update all bubbles. + for (int i = 0; i < Bubbles.Count; i++) + { + Bubbles[i].Update(); + + Bubbles[i].DrawColor.A = 180; + if (Bubbles[i].IdentityIndex % 13 == 12) + Bubbles[i].Scale *= 0.5f; + } + + // Clear away all dead bubbles. + Bubbles.RemoveAll(c => c.Time >= c.Lifetime); + + // Draw bubbles. + var bubblesByDepth = Bubbles.OrderByDescending(b => b.Depth).ToList(); + foreach (Bubble bubble in bubblesByDepth) + bubble.Draw(spriteBatch); + } + + /// + /// Selects a random color for the bubbles which rise from the bottom of the screen. + /// + private static Color SelectBubbleColor() + => Color.Lerp(Color.Lerp(Color.MediumSlateBlue, Color.DarkBlue, 0.3f), Color.Lerp(Color.MediumTurquoise, Color.PaleTurquoise, Main.rand.NextFloat()), Main.rand.NextFloat()); + + private void DrawFishes(SpriteBatch spriteBatch) + { + // Generate random fishes. + if (Main.rand.NextBool(14) && Fishes.Count < MaxBoids) + { + int schoolCount = Main.rand.Next(2, 9); + for (int i = 0; i < schoolCount; i++) + { + int depth = Main.rand.Next(1, 4); + int lifetime = Main.rand.Next(1200, 1800); + float scale = Main.rand.NextFloat(0.8f, 1.2f); + Vector2 spawnPosition = new(Main.screenWidth * Main.rand.NextFloat(-0.1f, 1.1f) * depth, Main.screenHeight * Main.rand.NextFloat(-0.1f, 1.1f) * depth); + SunkenFishBoid fish = new(spawnPosition, scale, depth); + Fishes.Add(fish); + } + } + + // Remove fish when they are offscreen. + Rectangle outOfBoundsRectangle = new(-50, -50, Main.screenWidth + 100, Main.screenHeight + 100); + Fishes.RemoveAll(f => + { + Vector2 depthFactor = new(1f / f.Depth, 1.1f / f.Depth); + Vector2 parallaxedPosition = f.Position * depthFactor; + return !outOfBoundsRectangle.Contains((int)parallaxedPosition.X, (int)parallaxedPosition.Y); + }); + + // Update all fish. + for (int i = 0; i < Fishes.Count; i++) + { + // Alpha Sea Minnows and Prismatic Guppies can spawn in schools. + bool canSpawnSchool = Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow || Fishes[i].IsAPrismaticGuppy; + if (canSpawnSchool && !Fishes[i].HasSpawnedSchool) + { + int fishCount = Main.rand.Next(3, 8); + for (int fishes = 0; fishes < fishCount; fishes++) + { + Vector2 spawnPosition = Fishes[i].Position + Main.rand.NextVector2Circular(50f, 50f) * Fishes[i].Depth; + float scale = Main.rand.NextFloat(0.8f, 1.2f); + FishType typeToSpawn = Fishes[i].IsAPrismaticGuppy ? (FishType)Main.rand.Next(3, 6) : FishType.SeaMinnow; + + SunkenFishBoid schoolingFish = new(spawnPosition, scale, Fishes[i].Depth, typeToSpawn) + { + HasSpawnedSchool = true + }; + + if (Fishes[i].SelectedFishType == FishType.AlphaSeaMinnow) + { + Fishes[i].SeaMinnowSchoolMembers.Add(schoolingFish); + schoolingFish.SeaMinnowSchoolMembers.Add(schoolingFish); + schoolingFish.SeaMinnowSchoolMembers.Add(Fishes[i]); + } + + Fishes.Add(schoolingFish); + } + + Fishes[i].HasSpawnedSchool = true; + } + + Fishes[i].Update(); + } + + // Draw all fish in an order based on their depth. + var fishesByDepth = Fishes.OrderByDescending(f => f.Depth).ToList(); + foreach (SunkenFishBoid fish in fishesByDepth) + fish.Draw(spriteBatch); + } + } +} diff --git a/MainMenu/LogoSunken.png b/MainMenu/LogoSunken.png new file mode 100644 index 0000000000..29f8b05cc2 Binary files /dev/null and b/MainMenu/LogoSunken.png differ diff --git a/MainMenu/LogoSunken_Water.png b/MainMenu/LogoSunken_Water.png new file mode 100644 index 0000000000..12c60ac53f Binary files /dev/null and b/MainMenu/LogoSunken_Water.png differ diff --git a/MainMenu/LogoSunken_Water_Fill.png b/MainMenu/LogoSunken_Water_Fill.png new file mode 100644 index 0000000000..e3a57cf193 Binary files /dev/null and b/MainMenu/LogoSunken_Water_Fill.png differ diff --git a/MainMenu/Perlin.png b/MainMenu/Perlin.png new file mode 100644 index 0000000000..45b02c6b29 Binary files /dev/null and b/MainMenu/Perlin.png differ diff --git a/MainMenu/SunkenFishBoid.cs b/MainMenu/SunkenFishBoid.cs new file mode 100644 index 0000000000..1dd3cfa715 --- /dev/null +++ b/MainMenu/SunkenFishBoid.cs @@ -0,0 +1,349 @@ +using System; +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ModLoader; +using Terraria.Utilities; + +namespace CalamityMod.MainMenu +{ + public class SunkenFishBoid + { + // -- GENERAL VARIABLES FOR DEFINING GENERAL BEHAVIOR AND FUNCTIONALITY FOR THE FISH ENTITIES -- + + public enum FishType + { + SeaMinnow, + AlphaSeaMinnow, + PolypPanasea, + PrismaticGuppy1, + PrismaticGuppy2, + PrismaticGuppy3, + } + + public string[] SeaMinnowTextureNames = + [ + "SeaMinnow", + "AlphaSeaMinnow", + ]; + + public string[] PolypPanaseaTextureNames = + [ + "PolypPanasea", + "PolypPanaseaGreen", + "PolypPanaseaPurple", + "PolypPanaseaRadiant", + "PolypPanaseaTurquoise", + "PolypPanaseaGreenCoated", + "PolypPanaseaPurpleCoated", + "PolypPanaseaRadiantCoated", + "PolypPanaseaRedCoated", + "PolypPanaseaTurquoiseCoated", + ]; + + public string[] PrismaticGuppyTextureNames_1 = + [ + "PrismaticGuppy", + "PrismaticGuppyGreen", + "PrismaticGuppyPink", + "PrismaticGuppyRadiant", + ]; + + public string[] PrismaticGuppyTextureNames_2 = + [ + "PrismaticGuppy2", + "PrismaticGuppyGreen2", + "PrismaticGuppyPink2", + "PrismaticGuppyRadiant2", + ]; + + public string[] PrismaticGuppyTextureNames_3 = + [ + "PrismaticGuppy3", + "PrismaticGuppyGreen3", + "PrismaticGuppyPink3", + "PrismaticGuppyRadiant3", + ]; + + public int Time; + + public int Depth; + + public int CurrentFrame; + + public int MaxFrames; + + public int FrameSpeed; + + public Vector2 Position; + + public Vector2 Velocity; + + public Vector2 StretchFactor; + + public float Scale; + + public float StoredScale; + + public float Rotation; + + public float Opacity; + + public float PassiveMovementTimer; + + public Vector2 PassiveMovementVector; + + public float PassiveMovementSpeed; + + public float MaxSpeed_Default = 3f; + + public float MaxSpeed_SwimAwayFromCursor = 4.25f; + + public FishType SelectedFishType; + + public FishType? FishTypeOverride; + + public WeightedRandom RandomFishType = new(); + + public int FishTextureIndex = -1; + + public bool Initialized = false; + + public bool HasSpawnedSchool = false; + + public List SeaMinnowSchoolMembers = []; + + public Asset FishTexture; + + // -- BOID ALOGORITHM SPECIFIC VARIABLES -- + + // 19MAY2025: fryzahh: + // Coefficients to control how strongly each of the Boid Algos affect the movement of each boid. + // Higher values will lead to sharper flocking AI, but movement might be a little choppier. + // Please beware of this if you ever change these values. + public float CohesionCoefficient = 0.075f; + + public float AlignmentCoefficient = 0.12f; + + public float SeparationCoefficient = 0.03f; + + public float MaxRadiusFromOtherFish = 125f; + + public float MaxDetectionRadius = 200f; + + /// + /// Whether or not this fish boid is any of the Prismatic Guppy variants. Used for allowing Prismatic Guppies to school with each other. + /// + public bool IsAPrismaticGuppy => SelectedFishType == FishType.PrismaticGuppy1 || SelectedFishType == FishType.PrismaticGuppy2 || SelectedFishType == FishType.PrismaticGuppy3; + + /// + /// Whether or not this fish boid is any one of the Sea Minnow variants. Used for allowing Sea Minnows to school with Alphas properly. + /// + public bool IsASeaMinnow => SelectedFishType == FishType.SeaMinnow || SelectedFishType == FishType.AlphaSeaMinnow; + + public SunkenFishBoid(Vector2 position, float scale, int depth, FishType? fishTypeOverride = null) + { + Position = position; + StoredScale = scale; + Depth = depth; + FishTypeOverride = fishTypeOverride; + + FrameSpeed = Main.rand.Next(6, 11); + StretchFactor = Vector2.One; + RandomFishType.Add(FishType.AlphaSeaMinnow, 0.7f); + RandomFishType.Add(FishType.PolypPanasea, 0.6f); + RandomFishType.Add(FishType.PrismaticGuppy1, 0.1f); + RandomFishType.Add(FishType.PrismaticGuppy2, 0.1f); + RandomFishType.Add(FishType.PrismaticGuppy3, 0.1f); + } + + public void Update() + { + if (!Initialized) + { + // Select the appropriate fish type. + SelectedFishType = FishTypeOverride ?? RandomFishType; + + // Select the correct texture index for the different types of fish textures. + if (SelectedFishType == FishType.SeaMinnow) + FishTextureIndex = 0; + if (SelectedFishType == FishType.AlphaSeaMinnow) + FishTextureIndex = 1; + if (SelectedFishType == FishType.PolypPanasea) + FishTextureIndex = Main.rand.Next(PolypPanaseaTextureNames.Length); + if (IsAPrismaticGuppy) + FishTextureIndex = Main.rand.Next(PrismaticGuppyTextureNames_1.Length); + + // Select the correct amount of animation frames each texture has based on the fish type. + if (IsASeaMinnow) + MaxFrames = 8; + if (SelectedFishType == FishType.PolypPanasea) + MaxFrames = 6; + if (SelectedFishType == FishType.PrismaticGuppy1) + MaxFrames = 6; + if (SelectedFishType == FishType.PrismaticGuppy2) + MaxFrames = 4; + if (SelectedFishType == FishType.PrismaticGuppy3) + MaxFrames = 5; + + CurrentFrame = Main.rand.Next(MaxFrames); + FishTexture = GetCorrectFishTexture(); + Initialized = true; + } + + if (!Initialized) + return; + + if (Scale < StoredScale) + { + Scale = MathHelper.Clamp(Scale + 0.05f, 0f, StoredScale); + Opacity = MathHelper.Clamp(Opacity + 0.05f, 0f, 1f); + } + + // Perform all Boids Behavior. + DoBoidsBehavior(); + + // Move and swim around idly. + PassiveMovementTimer--; + if (PassiveMovementTimer <= 0f) + { + PassiveMovementSpeed = Main.rand.NextFloat(0.25f, MaxSpeed_Default); + PassiveMovementVector.X = Main.rand.NextFloat(-100f, 101f); + PassiveMovementVector.Y = Main.rand.NextFloat(-100f, 101f); + PassiveMovementTimer = Main.rand.Next(120, 180); + } + + var moveSpeed = PassiveMovementSpeed / PassiveMovementVector.Length(); + Velocity = Vector2.Lerp(Velocity, PassiveMovementVector * moveSpeed, 0.01f); + + // Make fishes closest to the screen swim away from the mouse cursor if it's nearby. + var distanceFromCursor = Vector2.Distance(Position, Main.MouseScreen); + var shouldSwimAway = distanceFromCursor < 100f && Depth <= 1; + if (shouldSwimAway) + { + var distanceInterpolant = Utils.GetLerpValue(175f, 0f, distanceFromCursor, true); + Velocity += Position.DirectionTo(Main.MouseScreen).SafeNormalize(Vector2.UnitY) * distanceInterpolant * -0.46f; + + // Stretch a little while swimming away from danger for additional silliness :D + float stretch = MathHelper.Clamp(Velocity.Length() / MaxSpeed_SwimAwayFromCursor * 0.1f, 1f, 1.65f); + Vector2 stretchedVector = new(Scale * stretch, Scale - Scale * stretch * 0.3f); + StretchFactor = Vector2.Lerp(StretchFactor, stretchedVector, 0.15f); + } + else + { + if (Velocity.Length() > MaxSpeed_Default) + Velocity *= 0.7f; + StretchFactor = Vector2.Lerp(StretchFactor, Vector2.One, 0.15f); + } + + Velocity = Velocity.ClampMagnitude(0.25f, MaxSpeed_SwimAwayFromCursor); + Position += Velocity; + + Rotation = Velocity.ToRotation(); + if (Time % FrameSpeed == 0) + CurrentFrame = (CurrentFrame + 1) % MaxFrames; + + Time++; + } + + public void DoBoidsBehavior() + { + // Polyp Panaseas do not travel in schools. + if (SelectedFishType == FishType.PolypPanasea) + return; + + var cohesion = Vector2.Zero; + var alignment = Vector2.Zero; + var separation = Vector2.Zero; + var totalSchoolMembers = 0; + + var detetctionRadiusSquared = MathF.Pow(MaxDetectionRadius, 2f); + var separationDistanceSquared = MathF.Pow(MaxRadiusFromOtherFish, 2f); + var allOtherFishes = CalamityMainMenu_Sunken.Fishes; + + // Alpha Sea Minnows spawn a school of Sea Minnows manually and stick with it. + if (IsASeaMinnow && SeaMinnowSchoolMembers.Count > 0) + { + foreach (var minnow in SeaMinnowSchoolMembers) + { + var distance = Vector2.DistanceSquared(Position, minnow.Position); + var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); + separation += (Position - minnow.Position) * separationFactor * 0.7f; + + cohesion += minnow.Position; + alignment += minnow.Velocity; + totalSchoolMembers++; + } + } + else + { + foreach (var other in allOtherFishes) + { + // Only school with other fishes that are nearby, of the same type and within the same depth. + var isPrismaticGuppy = IsAPrismaticGuppy && other.IsAPrismaticGuppy; + var schoolByFishType = isPrismaticGuppy || SelectedFishType == other.SelectedFishType; + + var distance = Vector2.DistanceSquared(Position, other.Position); + if (distance < detetctionRadiusSquared && other != this && schoolByFishType && other.Depth == Depth) + { + var separationFactor = Utils.GetLerpValue(separationDistanceSquared, 0f, distance, true); + separation += (Position - other.Position) * separationFactor * 0.7f; + + cohesion += other.Position; + alignment += other.Velocity; + totalSchoolMembers++; + } + } + } + + if (totalSchoolMembers == 0) + return; + + // Add all boids algorithm factors into the velocity. + cohesion /= totalSchoolMembers; + var schoolCenterInterpolant = Utils.GetLerpValue(0f, 80f, Position.Distance(cohesion), true); + Velocity += (cohesion - Position).SafeNormalize(-Vector2.UnitY) * schoolCenterInterpolant * CohesionCoefficient; + + alignment /= totalSchoolMembers; + Velocity += Velocity.ToRotation().AngleLerp(alignment.ToRotation(), 0.06f).ToRotationVector2() * Velocity.Length() * AlignmentCoefficient; + + separation /= totalSchoolMembers; + Velocity += separation.SafeNormalize(-Vector2.UnitY) * SeparationCoefficient; + } + + public void Draw(SpriteBatch spriteBatch) + { + if (!Initialized) + return; + + Vector2 depthFactor = new(1f / Depth, 1.1f / Depth); + Vector2 parallaxedPosition = Position * depthFactor; + + var frame = FishTexture.Frame(1, MaxFrames, 0, CurrentFrame); + var origin = frame.Size() * 0.5f; + + var scaleByDepth = Scale / Depth; + var drawRotaton = Rotation + MathHelper.Pi; + var colorByDepth = Color.Lerp(Color.White, Color.Black, Utils.Remap(Depth, 1, 4, 0f, 0.8f, true)); + + var effects = Velocity.X > 0f ? SpriteEffects.FlipVertically : SpriteEffects.None; + spriteBatch.Draw(FishTexture.Value, parallaxedPosition, frame, colorByDepth * Opacity, drawRotaton, origin, StretchFactor * scaleByDepth, effects, 0f); + } + + private Asset GetCorrectFishTexture() + { + var sunkenSeaPath = "CalamityMod/NPCs/SunkenSea/"; + var returnTexture = SelectedFishType switch + { + FishType.PolypPanasea => ModContent.Request(sunkenSeaPath + PolypPanaseaTextureNames[FishTextureIndex]), + FishType.PrismaticGuppy1 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_1[FishTextureIndex]), + FishType.PrismaticGuppy2 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_2[FishTextureIndex]), + FishType.PrismaticGuppy3 => ModContent.Request(sunkenSeaPath + PrismaticGuppyTextureNames_3[FishTextureIndex]), + _ => ModContent.Request(sunkenSeaPath + SeaMinnowTextureNames[FishTextureIndex]), + }; + return returnTexture; + } + } +} diff --git a/MainMenu/SunkenMenuBackground.png b/MainMenu/SunkenMenuBackground.png new file mode 100644 index 0000000000..6df4caab99 Binary files /dev/null and b/MainMenu/SunkenMenuBackground.png differ diff --git a/MainMenu/WorleyInverted.png b/MainMenu/WorleyInverted.png new file mode 100644 index 0000000000..48b63f46aa Binary files /dev/null and b/MainMenu/WorleyInverted.png differ diff --git a/ModSupport/ExternalMods.cs b/ModSupport/ExternalMods.cs index 7518e201c1..f69d8d110d 100644 --- a/ModSupport/ExternalMods.cs +++ b/ModSupport/ExternalMods.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Terraria.ID; -using Terraria.ModLoader; +using Terraria.ModLoader; namespace CalamityMod { @@ -31,6 +25,7 @@ namespace CalamityMod internal static Mod magicStorage = null; internal static Mod overhaul = null; internal static Mod redemption = null; + internal static Mod remnants = null; internal static Mod soa = null; internal static Mod subworldLibrary = null; internal static Mod summonersAssociation = null; @@ -67,6 +62,8 @@ namespace CalamityMod ModLoader.TryGetMod("TerrariaOverhaul", out overhaul); redemption = null; ModLoader.TryGetMod("Redemption", out redemption); + remnants = null; + ModLoader.TryGetMod("Remnants", out remnants); soa = null; ModLoader.TryGetMod("SacredTools", out soa); subworldLibrary = null; @@ -97,6 +94,7 @@ namespace CalamityMod magicStorage = null; overhaul = null; redemption = null; + remnants = null; soa = null; subworldLibrary = null; summonersAssociation = null; diff --git a/ModSupport/ModCalls.cs b/ModSupport/ModCalls.cs index bce9cbdf27..9d2985bac3 100644 --- a/ModSupport/ModCalls.cs +++ b/ModSupport/ModCalls.cs @@ -671,12 +671,6 @@ namespace CalamityMod p.Calamity().externalAbyssLight += add; } - public static void AddBreathLossMult(Player p, float add) - { - if (p != null) - p.Calamity().externalBreathLossMultBoost += add; - } - public static void AddBreathTick(Player p, float add) { if (p != null) @@ -872,86 +866,48 @@ namespace CalamityMod public static bool DisableAllDodges(bool disable) => Main.LocalPlayer.Calamity().disableAllDodges = disable; #endregion - #region Can Fire Point Blank Shots - /// - /// Gets whether the given item can fire point blank shots. - /// - /// The item which is being checked. - /// Whether the item can fire point blank shots. - public static bool CanFirePointBlank(Item it) - { - if (it is null || it.Calamity() is null) - return false; - CalamityGlobalItem cgi = it.Calamity(); - return cgi.canFirePointBlankShots; - } - - /// - /// Sets whether the given item can fire point blank shots. - /// - /// The item whose point blank capabilities is being toggled. - /// The value to apply. - /// Whether the item can fire point blank shots. - public static bool SetFirePointBlank(Item it, bool enabled) - { - if (it is null || it.Calamity() is null) - return false; - CalamityGlobalItem cgi = it.Calamity(); - cgi.canFirePointBlankShots = enabled; - return cgi.canFirePointBlankShots; - } - - // Set a projectile's point blank duration - public static void SetPointBlankDuration(Projectile projectile, int duration) - { - if (projectile != null) - projectile.Calamity().pointBlankShotDuration = duration; - } - - // Gets a projectile's current point blank duration - public static int GetPointBlankDuration(Projectile projectile) => projectile?.Calamity()?.pointBlankShotDuration ?? 0; - #endregion - #region Amalgam Potion Buff List public static bool SetAmalgamBuffList(int type, bool shouldBeListed) { - if (shouldBeListed && !AmalgamBuffList.Includes(type)) + if (shouldBeListed && !CalamityBuffSets.BuffedByAmalgam[type]) { - AmalgamBuffList.List.Add(type); + CalamityBuffSets.BuffedByAmalgam[type] = true; return true; } else if (!shouldBeListed) { - return AmalgamBuffList.List.Remove(type); + CalamityBuffSets.BuffedByAmalgam[type] = false; + return false; } return false; } public static bool SetPersistentBuffList(int type, bool isPersistent) { - if (isPersistent && !PersistentBuffList.Includes(type)) + if (isPersistent && !CalamityBuffSets.IsPersistentBuff[type]) { - PersistentBuffList.List.Add(type); + CalamityBuffSets.IsPersistentBuff[type] = true; return true; } else if (!isPersistent) { - return PersistentBuffList.List.Remove(type); + CalamityBuffSets.IsPersistentBuff[type] = false; + return false; } return false; } - public static bool IsOnAmalgamBuffList(int type) => AmalgamBuffList.Includes(type); - public static bool IsOnPersistentBuffList(int type) => PersistentBuffList.Includes(type); + public static bool IsOnAmalgamBuffList(int type) => CalamityBuffSets.BuffedByAmalgam[type]; + public static bool IsOnPersistentBuffList(int type) => CalamityBuffSets.IsPersistentBuff[type]; #endregion #region Venerated Locket Bans public static bool AddToVeneratedLocketBanlist(int type) { - if (!VeneratedLocketBanList.Includes(type)) + if (!CalamityItemSets.DisablesVeneratedLocketEffect[type]) { - VeneratedLocketBanList.List.Add(type); + CalamityItemSets.DisablesVeneratedLocketEffect[type] = true; return true; } return false; @@ -961,35 +917,37 @@ namespace CalamityMod #region Summoner Cross Class Nerf Disabling public static bool SetSummonerNerfDisabledByMinion(int type, bool disableNerf) { - if (disableNerf && !DisabledSummonerNerfMinionList.Includes(type)) + if (disableNerf && !CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type]) { - DisabledSummonerNerfMinionList.List.Add(type); + CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type] = true; return true; } else if (!disableNerf) { - return DisabledSummonerNerfMinionList.List.Remove(type); + CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type] = false; + return false; } return false; } public static bool SetSummonerNerfDisabledByItem(int type, bool disableNerf) { - if (disableNerf && !DisabledSummonerNerfItemList.Includes(type)) + if (disableNerf && !CalamityItemSets.ItemWhichDisablesSummonerNerf[type]) { - DisabledSummonerNerfItemList.List.Add(type); + CalamityItemSets.ItemWhichDisablesSummonerNerf[type] = true; return true; } else if (!disableNerf) { - return DisabledSummonerNerfItemList.List.Remove(type); + CalamityItemSets.ItemWhichDisablesSummonerNerf[type] = false; + return false; } return false; } - public static bool GetSummonerNerfDisabledByMinion(int type) => DisabledSummonerNerfMinionList.Includes(type); - public static bool GetSummonerNerfDisabledByItem(int type) => DisabledSummonerNerfItemList.Includes(type); + public static bool GetSummonerNerfDisabledByMinion(int type) => CalamityProjectileSets.MinionWhichIgnoresSummonerNerf[type]; + public static bool GetSummonerNerfDisabledByItem(int type) => CalamityItemSets.ItemWhichDisablesSummonerNerf[type]; #endregion #region Debuff Display support @@ -1077,9 +1035,9 @@ namespace CalamityMod //This is to add minions to the hp scaling config public static bool AddToHPScaling(int type) { - if (!BossHPScalingList.List.Contains(type)) + if (!CalamityNPCSets.ScalesHealthLikeBoss[type]) { - BossHPScalingList.List.Add(type); + CalamityNPCSets.ScalesHealthLikeBoss[type] = true; return true; } return false; @@ -1271,21 +1229,6 @@ namespace CalamityMod AddAbyssLightStrength(castPlayer(args[1]), light); return null; - case "BreathMult": - case "BreathLossMult": - case "AddBreathMult": - case "AddBreathLossMult": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Player object (or int index of a Player) and breath loss mult change as a float."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify breath loss mult change as a float."); - if (!(args[2] is float breathLossMult)) - return new ArgumentException("ERROR: The second argument to \"AddBreathLossMult\" must be a float."); - if (!isValidPlayerArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"AddBreathLossMult\" must be a Player or an int."); - AddBreathLossMult(castPlayer(args[1]), breathLossMult); - return null; - case "BreathTick": case "AbyssBreathTick": case "AddBreathTick": @@ -1908,55 +1851,6 @@ namespace CalamityMod return GetShouldCloseBossHealthBar(castNPC(args[1])); } - case "CanFirePointBlank": - case "CanFirePointBlankShots": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify an Item object (or int index of an Item in the Main.item array)."); ; - if (!isValidItemArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"CanFirePointBlank\" must be an Item or an int."); - return CanFirePointBlank(castItem(args[1])); - - case "SetFirePointBlank": - case "SetFirePointBlankShots": - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both an Item object (or int index of an Item in the Main.item array) and a bool."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify whether the item can fire point blank as a bool."); - if (!(args[2] is bool firePointBlank)) - return new ArgumentException("ERROR: The second argument to \"SetFirePointBlank\" must be a bool."); - if (!isValidItemArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetFirePointBlank\" must be an Item or an int."); - return SetFirePointBlank(castItem(args[1]), firePointBlank); - - - case "GetPointBlankDuration": - case "GetProjectilePointBlank": - case "GetProjectilePointBlankDuration": - { - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify a Projectile."); - if (!isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"GetPointBlankDuration\" must be a Projectile."); - return GetPointBlankDuration(castProjectile(args[1])); - } - - case "SetPointBlankDuration": - case "SetProjectilePointBlank": - case "SetProjectilePointBlankDuration": - { - if (args.Length < 2) - return new ArgumentNullException("ERROR: Must specify both a Projectile and point blank duration as an int."); - if (args.Length < 3) - return new ArgumentNullException("ERROR: Must specify the point blank duration as an int."); - if (!(args[2] is int pbDuration)) - return new ArgumentException("ERROR: The second argument to \"SetPointBlankDuration\" must be an int."); - if (!isValidProjectileArg(args[1])) - return new ArgumentException("ERROR: The first argument to \"SetPointBlankDuration\" must be a Projectile."); - - SetPointBlankDuration(castProjectile(args[1]), pbDuration); - return null; - } - case "NoDodges": case "DodgesDisabled": case "GetDodgesDisabled": diff --git a/ModSupport/WeakReferenceSupport.cs b/ModSupport/WeakReferenceSupport.cs index e5aaf5bc23..93d249ce38 100644 --- a/ModSupport/WeakReferenceSupport.cs +++ b/ModSupport/WeakReferenceSupport.cs @@ -2,14 +2,11 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Summon; -using CalamityMod.Cooldowns; using CalamityMod.Events; using CalamityMod.Items; -using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; -using CalamityMod.Items.PermanentBoosters; using CalamityMod.Items.Pets; using CalamityMod.Items.Placeables.Furniture.BossRelics; using CalamityMod.Items.Placeables.Furniture.DevPaintings; @@ -17,16 +14,12 @@ using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.SummonItems; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; using CalamityMod.NPCs.AcidRain; using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.Astral; using CalamityMod.NPCs.AstrumAureus; using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; using CalamityMod.NPCs.Bumblebirb; using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.CeaselessVoid; @@ -57,12 +50,10 @@ using CalamityMod.NPCs.SunkenSea; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.TownNPCs; using CalamityMod.NPCs.Yharon; -using CalamityMod.Particles; using CalamityMod.Projectiles.DraedonsArsenal; using CalamityMod.Projectiles.Summon; using CalamityMod.Projectiles.Summon.Umbrella; using CalamityMod.Systems; -using CalamityMod.UI; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -460,9 +451,11 @@ namespace CalamityMod string entryName = "HiveMind"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); + Func IsCorruption = () => !WorldGen.crimson || Main.drunkWorld; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedHiveMind, type, new Dictionary() { + ["availability"] = IsCorruption, ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), ["spawnItems"] = ItemType(), @@ -476,9 +469,11 @@ namespace CalamityMod string entryName = "Perforators"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); int type = NPCType(); + Func IsCrimson = () => WorldGen.crimson || Main.drunkWorld; List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedPerforators, type, new Dictionary() { + ["availability"] = IsCrimson, ["displayName"] = GetDisplayName(entryName), ["spawnInfo"] = GetSpawnInfo(entryName), ["despawnMessage"] = GetDespawnMessage(entryName), @@ -563,8 +558,8 @@ namespace CalamityMod { string entryName = "BrimstoneElemental"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); - int type = NPCType(); - List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; + int type = NPCType(); + List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedBrimstoneElemental, type, new Dictionary() { ["spawnInfo"] = GetSpawnInfo(entryName), @@ -741,7 +736,7 @@ namespace CalamityMod { string entryName = "Dragonfolly"; BossChecklistProgressionValues.TryGetValue(entryName, out float order); - int type = NPCType(); + int type = NPCType(); List collection = new List() { ItemType(), ItemType(), ItemType(), ItemType(), ItemType() }; AddBoss(bossChecklist, calamity, entryName, order, DownedDragonfolly, type, new Dictionary() { @@ -1172,7 +1167,7 @@ namespace CalamityMod RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); - RegisterSummon(ItemType(), BuffType(), ProjectileType()); + RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); RegisterSummon(ItemType(), BuffType(), ProjectileType()); @@ -1340,8 +1335,8 @@ namespace CalamityMod return tagData.ContainsKey("RevengeanceMode") && tagData.GetBool("RevengeanceMode") && !(tagData.ContainsKey("DeathMode") && tagData.GetBool("DeathMode")); }; - RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.DeathEnabled", deathEnabled, 50); - RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.RevengeanceEnabled", revengeanceEnabled, 50); + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Death", "Mods.CalamityMod.UI.Death", deathEnabled, 50); + RegisterWorldInfoIcon(luminance, "CalamityMod/UI/ModeIndicator/ModeIndicator_Rev", "Mods.CalamityMod.UI.Revengeance", revengeanceEnabled, 50); } #endregion } diff --git a/NPCs/Abyss/BabyCannonballJellyfish.cs b/NPCs/Abyss/BabyCannonballJellyfish.cs index 43e00656d4..2383bb5224 100644 --- a/NPCs/Abyss/BabyCannonballJellyfish.cs +++ b/NPCs/Abyss/BabyCannonballJellyfish.cs @@ -53,10 +53,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Bloatfish.cs b/NPCs/Abyss/Bloatfish.cs index 002ff2ebce..56f82e1529 100644 --- a/NPCs/Abyss/Bloatfish.cs +++ b/NPCs/Abyss/Bloatfish.cs @@ -28,10 +28,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 74; NPC.height = 94; NPC.defense = 100; - NPC.lifeMax = 9000; + NPC.lifeMax = 7200; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.value = Item.buyPrice(silver: 30); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.9f; @@ -42,10 +42,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/BobbitWormHead.cs b/NPCs/Abyss/BobbitWormHead.cs index b9218ec8df..682b2f106e 100644 --- a/NPCs/Abyss/BobbitWormHead.cs +++ b/NPCs/Abyss/BobbitWormHead.cs @@ -31,18 +31,16 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { NPC.lavaImmune = true; - NPC.Calamity().canBreakPlayerDefense = true; NPC.aiStyle = -1; NPC.damage = 150; NPC.width = 80; NPC.height = 40; NPC.defense = 50; - NPC.DR_NERD(0.25f); - NPC.lifeMax = 7500; + NPC.lifeMax = 6000; NPC.knockBackResist = 0f; AIType = -1; NPC.noGravity = true; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(silver: 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; @@ -52,10 +50,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/BoxJellyfish.cs b/NPCs/Abyss/BoxJellyfish.cs index fb20344f3a..255c805081 100644 --- a/NPCs/Abyss/BoxJellyfish.cs +++ b/NPCs/Abyss/BoxJellyfish.cs @@ -29,12 +29,12 @@ namespace CalamityMod.NPCs.Abyss NPC.damage = 44; NPC.width = 30; NPC.height = 33; - NPC.defense = 5; - NPC.lifeMax = 115; + NPC.defense = 8; + NPC.lifeMax = 100; NPC.alpha = 20; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -44,10 +44,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/CannonballJellyfish.cs b/NPCs/Abyss/CannonballJellyfish.cs index ce1ea981bd..831ac54719 100644 --- a/NPCs/Abyss/CannonballJellyfish.cs +++ b/NPCs/Abyss/CannonballJellyfish.cs @@ -42,10 +42,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 54; NPC.height = 76; NPC.defense = 0; - NPC.lifeMax = 500; + NPC.lifeMax = 400; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -55,10 +55,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/ChaoticPuffer.cs b/NPCs/Abyss/ChaoticPuffer.cs index a050ec9730..68bb4d3709 100644 --- a/NPCs/Abyss/ChaoticPuffer.cs +++ b/NPCs/Abyss/ChaoticPuffer.cs @@ -41,11 +41,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 78; NPC.height = 78; NPC.defense = 50; - NPC.lifeMax = 7000; + NPC.lifeMax = 5600; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.value = Item.buyPrice(silver: 30); NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; diff --git a/NPCs/Abyss/ColossalSquid.cs b/NPCs/Abyss/ColossalSquid.cs index 2b7e4564fa..7ae65a5c09 100644 --- a/NPCs/Abyss/ColossalSquid.cs +++ b/NPCs/Abyss/ColossalSquid.cs @@ -38,13 +38,12 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 180; NPC.height = 180; NPC.defense = 50; - NPC.DR_NERD(0.05f); NPC.lifeMax = 130000; // Previously 220,000 NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; NPC.timeLeft = NPC.activeTime * 30; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(gold: 25); NPC.HitSound = SoundID.NPCHit20; NPC.DeathSound = SoundID.NPCDeath23; NPC.rarity = 2; @@ -56,10 +55,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToWater = false; NPC.Calamity().canBreakPlayerDefense = true; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Cuttlefish.cs b/NPCs/Abyss/Cuttlefish.cs index 3dde3202c5..149a80cc69 100644 --- a/NPCs/Abyss/Cuttlefish.cs +++ b/NPCs/Abyss/Cuttlefish.cs @@ -36,11 +36,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 58; NPC.height = 30; NPC.defense = 8; - NPC.lifeMax = 140; + NPC.lifeMax = 160; NPC.aiStyle = -1; AIType = -1; NPC.alpha = 150; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath28; NPC.knockBackResist = 0.3f; @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/DevilFish.cs b/NPCs/Abyss/DevilFish.cs index ab478d5acd..0688935939 100644 --- a/NPCs/Abyss/DevilFish.cs +++ b/NPCs/Abyss/DevilFish.cs @@ -46,15 +46,14 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.lavaImmune = true; - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 90; NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 500; + NPC.lifeMax = 800; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -65,10 +64,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -109,7 +104,7 @@ namespace CalamityMod.NPCs.Abyss { brokenMask = true; NPC.HitSound = SoundID.NPCHit1; - NPC.defense = 15; + NPC.defense = 25; if (!Main.dedServ) { for (int i = 1; i < 4; i++) diff --git a/NPCs/Abyss/DevilFishAlt.cs b/NPCs/Abyss/DevilFishAlt.cs index f1be9b6e3a..1c3be97b1f 100644 --- a/NPCs/Abyss/DevilFishAlt.cs +++ b/NPCs/Abyss/DevilFishAlt.cs @@ -36,15 +36,14 @@ namespace CalamityMod.NPCs.Abyss { NPC.noGravity = true; NPC.lavaImmune = true; - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 90; NPC.width = 136; NPC.height = 62; NPC.defense = 999999; - NPC.lifeMax = 500; + NPC.lifeMax = 800; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -55,10 +54,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -91,7 +86,7 @@ namespace CalamityMod.NPCs.Abyss { brokenMask = true; NPC.HitSound = SoundID.NPCHit1; - NPC.defense = 15; + NPC.defense = 25; if (!Main.dedServ) { for (int i = 1; i < 4; i++) diff --git a/NPCs/Abyss/EidolonWyrmBody.cs b/NPCs/Abyss/EidolonWyrmBody.cs index 02450d05e6..46268d84d5 100644 --- a/NPCs/Abyss/EidolonWyrmBody.cs +++ b/NPCs/Abyss/EidolonWyrmBody.cs @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/EidolonWyrmBodyAlt.cs b/NPCs/Abyss/EidolonWyrmBodyAlt.cs index bb6bcfa664..d63b9dd8ff 100644 --- a/NPCs/Abyss/EidolonWyrmBodyAlt.cs +++ b/NPCs/Abyss/EidolonWyrmBodyAlt.cs @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/EidolonWyrmHead.cs b/NPCs/Abyss/EidolonWyrmHead.cs index 3ad3252016..b2baa46d7f 100644 --- a/NPCs/Abyss/EidolonWyrmHead.cs +++ b/NPCs/Abyss/EidolonWyrmHead.cs @@ -59,12 +59,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 126; //36 NPC.height = 76; //20 NPC.defense = 70; - NPC.DR_NERD(0.15f); NPC.lifeMax = 160000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(gold: 25); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -79,10 +78,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/EidolonWyrmTail.cs b/NPCs/Abyss/EidolonWyrmTail.cs index dba229a146..2b126c6a68 100644 --- a/NPCs/Abyss/EidolonWyrmTail.cs +++ b/NPCs/Abyss/EidolonWyrmTail.cs @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.Abyss NPC.dontCountMe = true; NPC.dontTakeDamage = true; NPC.chaseable = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GiantSquid.cs b/NPCs/Abyss/GiantSquid.cs index 3a5ae03dcf..6dc686e1a9 100644 --- a/NPCs/Abyss/GiantSquid.cs +++ b/NPCs/Abyss/GiantSquid.cs @@ -2,6 +2,8 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Accessories; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.World; @@ -42,7 +44,7 @@ namespace CalamityMod.NPCs.Abyss NPC.lifeMax = 1000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; @@ -52,10 +54,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -258,6 +256,7 @@ namespace CalamityMod.NPCs.Abyss { var postLevi = npcLoot.DefineConditionalDropSet(DropHelper.PostLevi()); npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Blindfold, 100, 50)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 5)); postLevi.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 2, 4, 3, 6)); } diff --git a/NPCs/Abyss/GulperEelBody.cs b/NPCs/Abyss/GulperEelBody.cs index d8366f56db..959a7d3fd5 100644 --- a/NPCs/Abyss/GulperEelBody.cs +++ b/NPCs/Abyss/GulperEelBody.cs @@ -50,10 +50,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GulperEelBodyAlt.cs b/NPCs/Abyss/GulperEelBodyAlt.cs index 8ffd9061fa..c09437ce55 100644 --- a/NPCs/Abyss/GulperEelBodyAlt.cs +++ b/NPCs/Abyss/GulperEelBodyAlt.cs @@ -50,10 +50,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/GulperEelHead.cs b/NPCs/Abyss/GulperEelHead.cs index 5c3bad9db5..b3db09830a 100644 --- a/NPCs/Abyss/GulperEelHead.cs +++ b/NPCs/Abyss/GulperEelHead.cs @@ -47,7 +47,6 @@ namespace CalamityMod.NPCs.Abyss public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 135; NPC.width = 40; //36 NPC.height = 84; //20 @@ -56,7 +55,7 @@ namespace CalamityMod.NPCs.Abyss NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 1, 0, 0); + NPC.value = Item.buyPrice(gold: 1); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -70,10 +69,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/GulperEelTail.cs b/NPCs/Abyss/GulperEelTail.cs index faae8d5302..0e4baffc0c 100644 --- a/NPCs/Abyss/GulperEelTail.cs +++ b/NPCs/Abyss/GulperEelTail.cs @@ -50,10 +50,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/Laserfish.cs b/NPCs/Abyss/Laserfish.cs index e15e91f222..086c106472 100644 --- a/NPCs/Abyss/Laserfish.cs +++ b/NPCs/Abyss/Laserfish.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -34,11 +34,11 @@ namespace CalamityMod.NPCs.Abyss NPC.damage = 0; // 0 contact damage, laser damage is handled in the general swimming AI NPC.width = 58; NPC.height = 32; - NPC.defense = 15; + NPC.defense = 20; NPC.lifeMax = 600; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit51; NPC.DeathSound = SoundID.NPCDeath26; NPC.knockBackResist = 0.65f; @@ -50,10 +50,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/LuminousCorvina.cs b/NPCs/Abyss/LuminousCorvina.cs index 6b95e594c6..3e130f4f9e 100644 --- a/NPCs/Abyss/LuminousCorvina.cs +++ b/NPCs/Abyss/LuminousCorvina.cs @@ -44,11 +44,11 @@ namespace CalamityMod.NPCs.Abyss NPC.damage = 10; NPC.width = 68; NPC.height = 58; - NPC.defense = 12; - NPC.lifeMax = 1000; + NPC.defense = 18; + NPC.lifeMax = 800; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -59,10 +59,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index 5147891755..a8082e8719 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -46,12 +46,12 @@ namespace CalamityMod.NPCs.Abyss NPC.damage = 100; NPC.width = 78; NPC.height = 170; - NPC.defense = 10; - NPC.lifeMax = 7500; + NPC.defense = 30; + NPC.lifeMax = 6000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.value = Item.buyPrice(silver: 25); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -61,10 +61,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/MorayEel.cs b/NPCs/Abyss/MorayEel.cs index 69c7dc7c72..030fa2cfde 100644 --- a/NPCs/Abyss/MorayEel.cs +++ b/NPCs/Abyss/MorayEel.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -34,10 +34,10 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 136; NPC.height = 40; NPC.defense = 8; - NPC.lifeMax = 450; + NPC.lifeMax = 360; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.75f; @@ -49,10 +49,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/OarfishBody.cs b/NPCs/Abyss/OarfishBody.cs index b110c6b019..e87f136a82 100644 --- a/NPCs/Abyss/OarfishBody.cs +++ b/NPCs/Abyss/OarfishBody.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 16; //28 NPC.height = 16; //28 NPC.defense = 20; - NPC.lifeMax = 5000; + NPC.lifeMax = 4000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; @@ -41,10 +41,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/OarfishHead.cs b/NPCs/Abyss/OarfishHead.cs index 9d36a1bf4c..fec514fc15 100644 --- a/NPCs/Abyss/OarfishHead.cs +++ b/NPCs/Abyss/OarfishHead.cs @@ -43,11 +43,11 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 59; NPC.height = 38; NPC.defense = 10; - NPC.lifeMax = 5000; + NPC.lifeMax = 4000; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -61,10 +61,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/OarfishTail.cs b/NPCs/Abyss/OarfishTail.cs index e18c3657b6..f4d57a3847 100644 --- a/NPCs/Abyss/OarfishTail.cs +++ b/NPCs/Abyss/OarfishTail.cs @@ -22,7 +22,7 @@ namespace CalamityMod.NPCs.Abyss NPC.width = 14; //28 NPC.height = 16; //28 NPC.defense = 30; - NPC.lifeMax = 5000; + NPC.lifeMax = 4000; NPC.aiStyle = -1; //new AIType = -1; //new NPC.knockBackResist = 0f; @@ -41,10 +41,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) diff --git a/NPCs/Abyss/ReaperShark.cs b/NPCs/Abyss/ReaperShark.cs index 6fb205d54a..c210ea3271 100644 --- a/NPCs/Abyss/ReaperShark.cs +++ b/NPCs/Abyss/ReaperShark.cs @@ -55,7 +55,7 @@ namespace CalamityMod.NPCs.Abyss NPC.aiStyle = -1; AIType = -1; NPC.timeLeft = NPC.activeTime * 30; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(gold: 25); NPC.HitSound = SoundID.NPCHit56; NPC.DeathSound = SoundID.NPCDeath60; NPC.knockBackResist = 0f; @@ -70,10 +70,6 @@ namespace CalamityMod.NPCs.Abyss if (Main.zenithWorld) // legg NPC.height = (int)(NPC.height * 1.5f); - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -650,7 +646,7 @@ namespace CalamityMod.NPCs.Abyss { Vector2 direction = shorkCenter - player.Center; direction.Normalize(); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, direction * 10f, ProjectileID.DemonSickle, NPC.damage / 2, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, direction * 10f, ProjectileID.DemonSickle, 80, 0f, Main.myPlayer); } } } diff --git a/NPCs/Abyss/SlabCrab.cs b/NPCs/Abyss/SlabCrab.cs index b85836d81a..99d5a112fe 100644 --- a/NPCs/Abyss/SlabCrab.cs +++ b/NPCs/Abyss/SlabCrab.cs @@ -55,12 +55,12 @@ namespace CalamityMod.NPCs.Abyss NPC.height = 30; NPC.damage = BaseAttack; - NPC.lifeMax = 375; + NPC.lifeMax = 300; NPC.aiStyle = AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; @@ -77,10 +77,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToWater = false; NPC.GravityIgnoresLiquid = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/ToxicMinnow.cs b/NPCs/Abyss/ToxicMinnow.cs index 3fbf5c0ef8..00bc39d0ec 100644 --- a/NPCs/Abyss/ToxicMinnow.cs +++ b/NPCs/Abyss/ToxicMinnow.cs @@ -3,7 +3,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Abyss NPC.lifeMax = 300; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; @@ -58,10 +58,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Abyss/Viperfish.cs b/NPCs/Abyss/Viperfish.cs index 2fed796aaa..9a0f137dd9 100644 --- a/NPCs/Abyss/Viperfish.cs +++ b/NPCs/Abyss/Viperfish.cs @@ -4,7 +4,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -46,7 +46,7 @@ namespace CalamityMod.NPCs.Abyss NPC.lifeMax = 400; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.85f; @@ -58,10 +58,6 @@ namespace CalamityMod.NPCs.Abyss NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/AcidEel.cs b/NPCs/AcidRain/AcidEel.cs index feba4c4c47..e14f4b2d3c 100644 --- a/NPCs/AcidRain/AcidEel.cs +++ b/NPCs/AcidRain/AcidEel.cs @@ -59,7 +59,6 @@ namespace CalamityMod.NPCs.AcidRain if (DownedBossSystem.downedPolterghast) { - NPC.DR_NERD(0.05f); NPC.damage = 100; NPC.lifeMax = 2000; NPC.defense = 20; @@ -71,7 +70,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.lifeMax = 180; } - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.aiStyle = -1; AIType = -1; NPC.lavaImmune = false; @@ -85,10 +84,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -103,9 +98,6 @@ namespace CalamityMod.NPCs.AcidRain { NPC.TargetClosest(false); - // Fall through platforms. - NPC.Calamity().ShouldFallThroughPlatforms = true; - // Play a slither sound from time to time. if (Main.rand.NextBool(480)) SoundEngine.PlaySound(SoundID.Zombie32, NPC.Center); @@ -169,6 +161,8 @@ namespace CalamityMod.NPCs.AcidRain NPC.velocity.X = (NPC.velocity.X * 24f + NPC.direction * swimSpeed) / 25f; } + public override bool? CanFallThroughPlatforms() => true; + public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 2, 1, 3); diff --git a/NPCs/AcidRain/CragmawMire.cs b/NPCs/AcidRain/CragmawMire.cs index 376a638d63..612dec6211 100644 --- a/NPCs/AcidRain/CragmawMire.cs +++ b/NPCs/AcidRain/CragmawMire.cs @@ -76,7 +76,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 66; NPC.lifeMax = 4000; NPC.defense = 25; - NPC.value = Item.buyPrice(0, 2, 0, 0); + NPC.value = Item.buyPrice(gold: 2); if (DownedBossSystem.downedPolterghast) { diff --git a/NPCs/AcidRain/FlakCrab.cs b/NPCs/AcidRain/FlakCrab.cs index c9505ec7fe..a2f6a64262 100644 --- a/NPCs/AcidRain/FlakCrab.cs +++ b/NPCs/AcidRain/FlakCrab.cs @@ -43,11 +43,10 @@ namespace CalamityMod.NPCs.AcidRain if (DownedBossSystem.downedPolterghast) { NPC.lifeMax = 4200; - NPC.DR_NERD(0.2f); } NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; @@ -60,10 +59,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/GammaSlime.cs b/NPCs/AcidRain/GammaSlime.cs index a901b64e48..c3bae2cc77 100644 --- a/NPCs/AcidRain/GammaSlime.cs +++ b/NPCs/AcidRain/GammaSlime.cs @@ -43,14 +43,13 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 110; NPC.lifeMax = 5000; - NPC.DR_NERD(0.15f); NPC.defense = 25; NPC.aiStyle = AIType = -1; NPC.knockBackResist = 0f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -64,10 +63,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/IrradiatedSlime.cs b/NPCs/AcidRain/IrradiatedSlime.cs index 4a47bcbc42..eee58ef4a5 100644 --- a/NPCs/AcidRain/IrradiatedSlime.cs +++ b/NPCs/AcidRain/IrradiatedSlime.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; AIType = NPCID.ToxicSludge; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -52,10 +52,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Mauler.cs b/NPCs/AcidRain/Mauler.cs index 0ab66f14c6..51ed39b3da 100644 --- a/NPCs/AcidRain/Mauler.cs +++ b/NPCs/AcidRain/Mauler.cs @@ -67,6 +67,10 @@ namespace CalamityMod.NPCs.AcidRain } } + public static int DropletDamage = 55; // 220 + public static int BubbleDamage = 55; // 220 + public static int GFBDeathBombDamage = 100; // 400 + public override void SetDefaults() { NPC.noGravity = true; @@ -74,11 +78,10 @@ namespace CalamityMod.NPCs.AcidRain NPC.width = 180; NPC.height = 90; NPC.defense = 50; - NPC.DR_NERD(0.05f); NPC.lifeMax = 90000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 20, 0, 0); + NPC.value = Item.buyPrice(gold: 20); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath60; NPC.knockBackResist = 0f; @@ -194,12 +197,11 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { int bubbleShootType = ModContent.ProjectileType(); - int bubbleDamage = NPC.GetProjectileDamage(bubbleShootType); Vector2 baseBubbleShootVelocity = NPC.SafeDirectionTo(mouthPosition) * 13.5f; for (int i = 0; i < bubblesPerBurst; i++) { Vector2 bubbleShootVelocity = baseBubbleShootVelocity + Main.rand.NextVector2Circular(4f, 4f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, bubbleShootVelocity, bubbleShootType, bubbleDamage, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), mouthPosition, bubbleShootVelocity, bubbleShootType, BubbleDamage, 0f); } // Get launched back after firing. This only happens if in water and there's no obstacles behind. @@ -290,10 +292,9 @@ namespace CalamityMod.NPCs.AcidRain if (Main.netMode != NetmodeID.MultiplayerClient) { int acidShootType = ModContent.ProjectileType(); - int acidDamage = NPC.GetProjectileDamage(acidShootType); Vector2 acidSpawnPosition = NPC.Center + Main.rand.NextVector2Circular(30f, 10f).RotatedBy(NPC.rotation); Vector2 acidShootVelocity = -Vector2.UnitY.RotatedByRandom(0.33f) * Main.rand.NextFloat(8f, 10.5f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), acidSpawnPosition, acidShootVelocity, acidShootType, acidDamage, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), acidSpawnPosition, acidShootVelocity, acidShootType, DropletDamage, 0f); NPC.netUpdate = true; } } @@ -496,15 +497,14 @@ namespace CalamityMod.NPCs.AcidRain double deltaAngleBoom = spreadBoom / 8f; double offsetAngleBoom; int iBoom; - int damageBoom = Main.masterMode ? 127 : Main.expertMode ? 150 : 200; for (iBoom = 0; iBoom < 25; iBoom++) { int projectileType = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; if (Main.netMode != NetmodeID.MultiplayerClient) { - int boom1 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - int boom2 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + int boom1 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * 6f), (float)(Math.Cos(offsetAngleBoom) * 6f), projectileType, GFBDeathBombDamage, 0f, Main.myPlayer, 0f, 0f); + int boom2 = Projectile.NewProjectile(NPC.GetSource_Death(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * 6f), (float)(-Math.Cos(offsetAngleBoom) * 6f), projectileType, GFBDeathBombDamage, 0f, Main.myPlayer, 0f, 0f); } } for (int i = 0; i < 25; i++) diff --git a/NPCs/AcidRain/NuclearTerror.cs b/NPCs/AcidRain/NuclearTerror.cs index 95dcf1abeb..60e00cc3cf 100644 --- a/NPCs/AcidRain/NuclearTerror.cs +++ b/NPCs/AcidRain/NuclearTerror.cs @@ -113,8 +113,7 @@ namespace CalamityMod.NPCs.AcidRain NPC.defense = 50; NPC.damage = 135; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 20, 0, 0); - NPC.DR_NERD(0.3f); + NPC.value = Item.buyPrice(gold: 20); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; diff --git a/NPCs/AcidRain/NuclearToad.cs b/NPCs/AcidRain/NuclearToad.cs index 5f50419754..5e97dd2d05 100644 --- a/NPCs/AcidRain/NuclearToad.cs +++ b/NPCs/AcidRain/NuclearToad.cs @@ -77,7 +77,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.7f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -90,10 +90,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Orthocera.cs b/NPCs/AcidRain/Orthocera.cs index ef3fd1d1f3..13eaba493e 100644 --- a/NPCs/AcidRain/Orthocera.cs +++ b/NPCs/AcidRain/Orthocera.cs @@ -47,18 +47,16 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 45; NPC.lifeMax = 280; NPC.defense = 15; - NPC.DR_NERD(0.075f); if (DownedBossSystem.downedPolterghast) { NPC.damage = 120; NPC.lifeMax = 3850; NPC.defense = 35; - NPC.DR_NERD(0.15f); } NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -71,10 +69,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Radiator.cs b/NPCs/AcidRain/Radiator.cs index 2aaa69c5f4..54e09b8fbb 100644 --- a/NPCs/AcidRain/Radiator.cs +++ b/NPCs/AcidRain/Radiator.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -58,10 +58,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/Skyfin.cs b/NPCs/AcidRain/Skyfin.cs index a1cf912c4f..5b8f9fe270 100644 --- a/NPCs/AcidRain/Skyfin.cs +++ b/NPCs/AcidRain/Skyfin.cs @@ -45,16 +45,14 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 88; NPC.lifeMax = 3025; NPC.defense = 18; - NPC.DR_NERD(0.05f); } else if (DownedBossSystem.downedAquaticScourge) { NPC.damage = 38; NPC.lifeMax = 220; - NPC.DR_NERD(0.05f); } - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = true; @@ -67,10 +65,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AcidRain/SulphurousSkater.cs b/NPCs/AcidRain/SulphurousSkater.cs index 759e49aa4e..51a9914263 100644 --- a/NPCs/AcidRain/SulphurousSkater.cs +++ b/NPCs/AcidRain/SulphurousSkater.cs @@ -58,7 +58,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -73,10 +73,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) => writer.Write(Flying); @@ -103,7 +99,6 @@ namespace CalamityMod.NPCs.AcidRain public void JumpToDestination() { NPC.knockBackResist = 0.8f; - NPC.DR_NERD(0.35f); NPC.noGravity = false; Projectile closestBubble = SearchForNearestBubble(out float distanceToBubbele); @@ -161,7 +156,6 @@ namespace CalamityMod.NPCs.AcidRain public void DoFlyMovement() { NPC.knockBackResist = 0.5f; - NPC.DR_NERD(0f); float flySpeed = DownedBossSystem.downedPolterghast ? 17f : 14f; float flyInertia = DownedBossSystem.downedPolterghast ? 20f : 24.5f; diff --git a/NPCs/AcidRain/Trilobite.cs b/NPCs/AcidRain/Trilobite.cs index f85ec39507..4aea2a0687 100644 --- a/NPCs/AcidRain/Trilobite.cs +++ b/NPCs/AcidRain/Trilobite.cs @@ -39,7 +39,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.damage = 45; NPC.lifeMax = 300; NPC.defense = 15; - NPC.DR_NERD(0.25f); if (DownedBossSystem.downedPolterghast) { @@ -49,7 +48,7 @@ namespace CalamityMod.NPCs.AcidRain } NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(0, 0, 4, 0); + NPC.value = Item.buyPrice(silver: 4); NPC.lavaImmune = false; NPC.noGravity = true; NPC.noTileCollide = false; @@ -62,10 +61,6 @@ namespace CalamityMod.NPCs.AcidRain NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AquaticScourge/AquaticScourgeBody.cs b/NPCs/AquaticScourge/AquaticScourgeBody.cs index b0db3298e4..b9f91cbcc0 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBody.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBody.cs @@ -1,15 +1,19 @@ using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.AquaticScourge { @@ -23,10 +27,12 @@ namespace CalamityMod.NPCs.AquaticScourge this.HideFromBestiary(); } + public static int ToothDamage = 25; // 100 + public override void SetDefaults() { + NPC.damage = 52; // 104 NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); NPC.width = 32; NPC.height = 32; NPC.defense = 20; @@ -36,8 +42,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -47,9 +51,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.dontCountMe = true; NPC.chaseable = false; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -63,9 +65,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -89,7 +88,231 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.zenithWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + NPC.damage = NPC.defDamage; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f; + float enrageScale = 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Fire teeth + if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) + { + NPC.localAI[0] += 1f; + float shootProjectile = 300; + float timer = NPC.ai[0] + 15f; + float divisor = timer + shootProjectile; + + if (NPC.localAI[0] % divisor == 0f && (NPC.ai[0] % 3f == 0f || getFuckedAI || !death)) + { + NPC.TargetClosest(); + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + SoundEngine.PlaySound(SoundID.Item17, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float toothVelocity = death ? 9f : 8f; + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + float accelerate = phase4 ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, ToothDamage, 0f, Main.myPlayer, accelerate, 0f); + } + + NPC.netUpdate = true; + } + } + } + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (CalamityNPCTypeSets.AquaticScourge.Contains(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = Main.getGoodWorld ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -139,7 +362,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs index ae65703e57..2bcd18a1d5 100644 --- a/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs +++ b/NPCs/AquaticScourge/AquaticScourgeBodyAlt.cs @@ -1,11 +1,15 @@ -using System.IO; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -25,7 +29,8 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 48; // 96 + NPC.Calamity().canBreakPlayerDefense = true; NPC.width = 32; NPC.height = 32; NPC.defense = 15; @@ -35,8 +40,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -46,9 +49,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.dontCountMe = true; NPC.chaseable = false; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -62,9 +63,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -88,7 +86,202 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.zenithWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + NPC.damage = NPC.defDamage; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f; + float enrageScale = 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (CalamityNPCTypeSets.AquaticScourge.Contains(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = Main.getGoodWorld ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -138,7 +331,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AquaticScourge/AquaticScourgeHead.cs b/NPCs/AquaticScourge/AquaticScourgeHead.cs index 4acad4c1dc..f7277274af 100644 --- a/NPCs/AquaticScourge/AquaticScourgeHead.cs +++ b/NPCs/AquaticScourge/AquaticScourgeHead.cs @@ -1,5 +1,6 @@ using System.IO; using CalamityMod.BiomeManagers; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -16,13 +17,13 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Abyss; using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.NPCs.TownNPCs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -30,6 +31,7 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Systems.Collections; namespace CalamityMod.NPCs.AquaticScourge { @@ -52,9 +54,12 @@ namespace CalamityMod.NPCs.AquaticScourge NPCID.Sets.MPAllowedEnemies[Type] = true; } + public static int MistDamage = 23; // 92 + public static int CloudDamage = 26; // 104; applies to both Sand and Toxic + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 85; // 170 NPC.Calamity().canBreakPlayerDefense = true; NPC.width = 90; NPC.height = 90; @@ -63,10 +68,8 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.aiStyle = -1; AIType = -1; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax *= 2; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 16, 0, 0); + NPC.value = Item.buyPrice(gold: 12); NPC.behindTiles = true; NPC.chaseable = false; NPC.noGravity = true; @@ -75,9 +78,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -92,9 +93,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -131,7 +129,447 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, true); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + bool getFuckedAI = Main.zenithWorld; + CalamityGlobalNPC.aquaticScourge = NPC.whoAmI; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.zenithWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + NPC.damage = NPC.defDamage; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.boss = true; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + // Enrage + if (notOcean && !player.Calamity().ZoneSulphur && !BossRushEvent.BossRushActive) + { + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + } + else + NPC.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = NPC.localAI[2] <= 0f; + + float enrageScale = 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 2f; + } + + // Circular movement + float colorFadeTimeAfterSpiral = 90f; + float spiralGateValue = 480f; + bool doSpiral = false; + if (calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) + { + doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; + if (Vector2.Distance(NPC.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) + calamityGlobalNPC.newAI[3] += 1f; + + if (doSpiral) + { + NPC.localAI[3] = colorFadeTimeAfterSpiral; + + // Vomit acid mist + float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); + if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float mistVelocity = death ? 10f : 8f; + Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, MistDamage, 0f, Main.myPlayer); + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; + } + } + + // Vomit circular spreads of acid clouds while in phase 3 + float toxicCloudBarfDivisor = death ? 30f : 40f; + if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); + float radians = MathHelper.TwoPi / totalProjectiles; + float cloudVelocity = 1f + enrageScale; + Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, CloudDamage, 0f, Main.myPlayer); + } + } + } + + // Velocity boost + if (calamityGlobalNPC.newAI[3] == spiralGateValue) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= 24f; + } + + // Spin velocity + float velocity = (float)(MathHelper.Pi * 2D) / 120f; + // In GFB, contracts the radius as the fight progresses + if (getFuckedAI) + velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; + NPC.velocity = NPC.velocity.RotatedBy(-(double)velocity * NPC.localAI[1]); + // Speed up even more in GFB for more radius + if (getFuckedAI && NPC.velocity.Length() <= 32f) + NPC.velocity *= 1.1f; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + + // Reset and charge at target + // Don't reset in GFB + if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) + { + calamityGlobalNPC.newAI[3] = 0f; + NPC.TargetClosest(); + } + } + else + { + if (!Collision.CanHit(NPC.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) + calamityGlobalNPC.newAI[3] -= 2f; + + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + + NPC.localAI[1] = NPC.Center.X - player.Center.X < 0 ? 1f : -1f; + } + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Spawn segments + if (calamityGlobalNPC.newAI[2] == 0f && NPC.ai[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; + int Previous = NPC.whoAmI; + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + { + if (segments % 2 == 0) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + } + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI); + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + + calamityGlobalNPC.newAI[2] = 1f; + } + + // Big barf attack + if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) + { + NPC.localAI[0] += 1f; + if (NPC.localAI[0] >= (revenge ? 360f : 420f)) + { + if (Vector2.Distance(player.Center, NPC.Center) > 320f) + { + NPC.localAI[0] = 0f; + NPC.netUpdate = true; + SoundEngine.PlaySound(SoundID.NPCDeath13, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = expertMode ? 8 : 6; + if (phase3) + totalProjectiles *= 2; + + int type = ModContent.ProjectileType(); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; + + float maximumVelocityMult = death ? 0.75f : 0.5f; + if (expertMode) + velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); + + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, CloudDamage, 0f, Main.myPlayer); + } + } + } + } + } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (CalamityNPCTypeSets.AquaticScourge.Contains(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = Main.getGoodWorld ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + float scourgeAcceleration = 0.08f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + scourgeAcceleration = revenge ? 0.18f : 0.15f; + if (expertMode) + { + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeAcceleration += 0.03f * (1f - lifeRatio); + } + scourgeMaxSpeed += 3f * enrageScale; + scourgeAcceleration += 0.06f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + scourgeAcceleration += Vector2.Distance(player.Center, NPC.Center) * 0.000045f; + } + + // Increase acceleration after spiral attack + if (NPC.localAI[3] > 0f) + { + float accelerationMultiplier = MathHelper.Lerp(1f, 2f, NPC.localAI[3] / colorFadeTimeAfterSpiral); + scourgeAcceleration *= accelerationMultiplier; + } + + if (Main.getGoodWorld) + { + scourgeMaxSpeed *= 1.15f; + scourgeAcceleration *= 1.15f; + } + } + + if (!doSpiral) + { + if (calamityGlobalNPC.newAI[0] != 1f) + { + scourgeTargetY += 400; + if (Math.Abs(NPC.Center.X - player.Center.X) < 500f) + { + if (NPC.velocity.X > 0f) + scourgeTargetX = player.Center.X + 600f; + else + scourgeTargetX = player.Center.X - 600f; + } + } + + float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; + float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; + float scourgeSpeed = NPC.velocity.Length(); + if (scourgeSpeed > 0f) + { + if (scourgeSpeed > scourgeHigherSpeed) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= scourgeHigherSpeed; + } + else if (scourgeSpeed < scourgeLowerSpeed) + { + NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); + NPC.velocity *= scourgeLowerSpeed; + } + } + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + + if (!doSpiral) + { + float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); + float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); + float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; + scourgeTargetX *= scourgeTimeToReachTarget; + scourgeTargetY *= scourgeTimeToReachTarget; + + if ((NPC.velocity.X > 0f && scourgeTargetX > 0f) || (NPC.velocity.X < 0f && scourgeTargetX < 0f) || (NPC.velocity.Y > 0f && scourgeTargetY > 0f) || (NPC.velocity.Y < 0f && scourgeTargetY < 0f)) + { + if (NPC.velocity.X < scourgeTargetX) + { + NPC.velocity.X += scourgeAcceleration; + } + else + { + if (NPC.velocity.X > scourgeTargetX) + NPC.velocity.X -= scourgeAcceleration; + } + + if (NPC.velocity.Y < scourgeTargetY) + { + NPC.velocity.Y += scourgeAcceleration; + } + else + { + if (NPC.velocity.Y > scourgeTargetY) + NPC.velocity.Y -= scourgeAcceleration; + } + + if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.X > 0f && scourgeTargetX < 0f) || (NPC.velocity.X < 0f && scourgeTargetX > 0f))) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += scourgeAcceleration * 2f; + else + NPC.velocity.Y -= scourgeAcceleration * 2f; + } + + if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((NPC.velocity.Y > 0f && scourgeTargetY < 0f) || (NPC.velocity.Y < 0f && scourgeTargetY > 0f))) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += scourgeAcceleration * 2f; + else + NPC.velocity.X -= scourgeAcceleration * 2f; + } + } + else + { + if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) + { + if (NPC.velocity.X < scourgeTargetX) + NPC.velocity.X += scourgeAcceleration * 1.1f; + else if (NPC.velocity.X > scourgeTargetX) + NPC.velocity.X -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += scourgeAcceleration; + else + NPC.velocity.Y -= scourgeAcceleration; + } + } + else + { + if (NPC.velocity.Y < scourgeTargetY) + NPC.velocity.Y += scourgeAcceleration * 1.1f; + else if (NPC.velocity.Y > scourgeTargetY) + NPC.velocity.Y -= scourgeAcceleration * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < scourgeMaxSpeed * 0.5) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += scourgeAcceleration; + else + NPC.velocity.X -= scourgeAcceleration; + } + } + } + + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -205,13 +643,13 @@ namespace CalamityMod.NPCs.AquaticScourge if (spawnInfo.Player.Calamity().ZoneSulphur && spawnInfo.Water) { if (!NPC.AnyNPCs(ModContent.NPCType())) - return (Main.getGoodWorld ? 0.05f : 0.01f); + return Main.zenithWorld ? 0.1f : 0.01f; } return 0f; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -303,7 +741,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/AquaticScourge/AquaticScourgeTail.cs b/NPCs/AquaticScourge/AquaticScourgeTail.cs index 989e090678..75935256b7 100644 --- a/NPCs/AquaticScourge/AquaticScourgeTail.cs +++ b/NPCs/AquaticScourge/AquaticScourgeTail.cs @@ -1,7 +1,9 @@ -using System.IO; +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Systems.Collections; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -25,7 +27,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 36; // 72 NPC.width = 32; NPC.height = 32; NPC.defense = 25; @@ -35,8 +37,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.knockBackResist = 0f; NPC.alpha = 255; NPC.LifeMaxNERB(80000, 96000, 1000000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax *= 2; NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -46,9 +46,7 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.dontCountMe = true; NPC.chaseable = false; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -62,9 +60,6 @@ namespace CalamityMod.NPCs.AquaticScourge NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -88,7 +83,202 @@ namespace CalamityMod.NPCs.AquaticScourge public override void AI() { - AquaticScourgeAI.VanillaAquaticScourgeAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + bool getFuckedAI = Main.zenithWorld; + + // Adjust hostility and stats + bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; + if (NPC.justHit || NPC.life <= NPC.lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.zenithWorld) + { + if (nonHostile) + { + // Kiss my motherfucking ass you piece of shit game + NPC.timeLeft *= 20; + NPC.npcSlots = 16f; + NPC.damage = NPC.defDamage; + CalamityGlobalNPC.BossKillTimes.TryGetValue(NPC.type, out int revKillTime); + calamityGlobalNPC.KillTime = revKillTime; + calamityGlobalNPC.newAI[0] = 1f; + nonHostile = false; + NPC.chaseable = true; + NPC.netUpdate = true; + } + } + else + NPC.damage = 0; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.75f; + bool phase3 = lifeRatio < 0.5f; + bool phase4 = lifeRatio < 0.25f; + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool notOcean = player.position.Y < 300f || + player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || + (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); + } + + bool biomeEnraged = NPC.localAI[2] <= 0f; + float enrageScale = 0f; + if (biomeEnraged) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 2f; + } + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = getFuckedAI; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // Kill body and tail + bool shouldDespawn = true; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + { + shouldDespawn = false; + break; + } + } + if (!shouldDespawn) + { + if (NPC.ai[1] <= 0f) + shouldDespawn = true; + else if (Main.npc[(int)NPC.ai[1]].life <= 0) + shouldDespawn = true; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + } + + float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; + if (player.dead || Vector2.Distance(NPC.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) + { + calamityGlobalNPC.newAI[1] = 1f; + NPC.TargetClosest(false); + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + NPC.velocity.Y += 2f; + + if (NPC.position.Y > Main.worldSurface * 16D) + { + for (int a = 0; a < Main.npc.Length; a++) + { + int type = Main.npc[a].type; + if (CalamityNPCTypeSets.AquaticScourge.Contains(type)) + Main.npc[a].active = false; + } + } + } + else + calamityGlobalNPC.newAI[1] = 0f; + + // Change direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + // Alpha changes + if (Main.npc[(int)NPC.ai[1]].alpha < 128) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + Vector2 scourgePosition = NPC.Center; + Vector2 predictionVector = Main.getGoodWorld ? Main.player[NPC.target].velocity * 20f : Vector2.Zero; + float scourgeTargetX = player.Center.X + predictionVector.X; + float scourgeTargetY = player.Center.Y + predictionVector.Y; + + // Velocity and movement + float scourgeMaxSpeed = 5f; + if (calamityGlobalNPC.newAI[0] == 1f) + { + scourgeMaxSpeed = revenge ? 14.4f : 12f; + if (expertMode) + scourgeMaxSpeed += 2.4f * (1f - lifeRatio); + scourgeMaxSpeed += 3f * enrageScale; + if (death || getFuckedAI) + { + scourgeMaxSpeed += 5f; + scourgeMaxSpeed += Vector2.Distance(player.Center, NPC.Center) * 0.001f; + } + + if (Main.getGoodWorld) + scourgeMaxSpeed *= 1.15f; + } + + scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; + scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; + scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; + scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; + scourgeTargetX -= scourgePosition.X; + scourgeTargetY -= scourgePosition.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + scourgePosition = NPC.Center; + scourgeTargetX = Main.npc[(int)NPC.ai[1]].Center.X - scourgePosition.X; + scourgeTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - scourgePosition.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; + float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); + int scourgeWidth = NPC.width; + scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; + scourgeTargetX *= scourgeTargetDist; + scourgeTargetY *= scourgeTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + scourgeTargetX; + NPC.position.Y = NPC.position.Y + scourgeTargetY; + + if (scourgeTargetX < 0f) + NPC.spriteDirection = -1; + else if (scourgeTargetX > 0f) + NPC.spriteDirection = 1; + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -138,7 +328,6 @@ namespace CalamityMod.NPCs.AquaticScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) @@ -164,7 +353,7 @@ namespace CalamityMod.NPCs.AquaticScourge public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 180, true); + target.AddBuff(ModContent.BuffType(), 300, true); } } } diff --git a/NPCs/Astral/Aries.cs b/NPCs/Astral/Aries.cs index 5dfecc0272..070908c158 100644 --- a/NPCs/Astral/Aries.cs +++ b/NPCs/Astral/Aries.cs @@ -33,28 +33,23 @@ namespace CalamityMod.NPCs.Astral NPC.width = 66; NPC.height = 64; NPC.aiStyle = NPCAIStyleID.Herpling; - NPC.defense = 14; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 380; + NPC.defense = 22; + NPC.lifeMax = 300; NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(silver: 3); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 85; - NPC.defense = 24; + NPC.defense = 32; NPC.knockBackResist = 0.5f; - NPC.lifeMax = 570; + NPC.lifeMax = 450; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Astraglomerate.cs b/NPCs/Astral/Astraglomerate.cs index 0be0820f7c..b6b8cd566f 100644 --- a/NPCs/Astral/Astraglomerate.cs +++ b/NPCs/Astral/Astraglomerate.cs @@ -37,18 +37,17 @@ namespace CalamityMod.NPCs.Astral NPC.height = 62; NPC.aiStyle = -1; NPC.damage = 0; - NPC.defense = 15; - NPC.DR_NERD(0.15f); + NPC.defense = 30; NPC.lifeMax = 600; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 90; - NPC.defense = 25; + NPC.defense = 40; NPC.lifeMax = 900; } NPC.Calamity().VulnerableToHeat = true; @@ -58,10 +57,6 @@ namespace CalamityMod.NPCs.Astral { NPC.scale = 3f; } - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/AstralProbe.cs b/NPCs/Astral/AstralProbe.cs index 741efed4a0..dea2e8be53 100644 --- a/NPCs/Astral/AstralProbe.cs +++ b/NPCs/Astral/AstralProbe.cs @@ -36,13 +36,12 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 0; // 0 contact damage, laser damage is handled separately NPC.width = 30; //324 NPC.height = 30; //216 - NPC.defense = 10; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 70; + NPC.defense = 20; + NPC.lifeMax = 120; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.95f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = SoundID.NPCDeath14; @@ -51,17 +50,13 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 30; - NPC.defense = 20; + NPC.defense = 30; NPC.knockBackResist = 0.85f; - NPC.lifeMax = 105; + NPC.lifeMax = 180; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/AstralSlime.cs b/NPCs/Astral/AstralSlime.cs index 20af8be840..b192406b1f 100644 --- a/NPCs/Astral/AstralSlime.cs +++ b/NPCs/Astral/AstralSlime.cs @@ -26,10 +26,10 @@ namespace CalamityMod.NPCs.Astral NPC.width = 36; NPC.height = 31; NPC.aiStyle = NPCAIStyleID.Slime; - NPC.defense = 8; - NPC.lifeMax = 250; + NPC.defense = 18; + NPC.lifeMax = 240; NPC.knockBackResist = 0.6f; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.alpha = 60; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; @@ -39,16 +39,12 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 65; - NPC.defense = 18; - NPC.lifeMax = 375; + NPC.defense = 28; + NPC.lifeMax = 360; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/AstralachneaGround.cs b/NPCs/Astral/AstralachneaGround.cs index 13373f41c5..514c83b194 100644 --- a/NPCs/Astral/AstralachneaGround.cs +++ b/NPCs/Astral/AstralachneaGround.cs @@ -33,12 +33,11 @@ namespace CalamityMod.NPCs.Astral NPC.height = 34; NPC.aiStyle = NPCAIStyleID.Fighter; NPC.damage = 55; - NPC.defense = 20; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 630; + NPC.defense = 30; + NPC.lifeMax = 500; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.38f; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); NPC.timeLeft = NPC.activeTime * 2; AnimationType = NPCID.WallCreeper; Banner = ModContent.NPCType(); @@ -46,16 +45,12 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 90; - NPC.defense = 30; + NPC.defense = 40; NPC.knockBackResist = 0.28f; - NPC.lifeMax = 945; + NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Astral/AstralachneaWall.cs b/NPCs/Astral/AstralachneaWall.cs index 9cf146f5d7..a5beafb51f 100644 --- a/NPCs/Astral/AstralachneaWall.cs +++ b/NPCs/Astral/AstralachneaWall.cs @@ -40,13 +40,12 @@ namespace CalamityMod.NPCs.Astral NPC.height = 60; NPC.aiStyle = -1; NPC.damage = 55; - NPC.defense = 20; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 630; + NPC.defense = 30; + NPC.lifeMax = 500; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0f; NPC.noGravity = true; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); NPC.timeLeft = NPC.activeTime * 2; AnimationType = NPCID.BlackRecluseWall; Banner = NPC.type; @@ -54,16 +53,12 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 90; - NPC.defense = 30; - NPC.lifeMax = 945; + NPC.defense = 40; + NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Atlas.cs b/NPCs/Astral/Atlas.cs index 363ff9bb8b..6e492d6f90 100644 --- a/NPCs/Astral/Atlas.cs +++ b/NPCs/Astral/Atlas.cs @@ -125,10 +125,9 @@ namespace CalamityMod.NPCs.Astral NPC.height = 88; NPC.damage = 70; NPC.defense = 40; - NPC.DR_NERD(0.15f); NPC.lifeMax = 1200; NPC.knockBackResist = 0.08f; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(silver: 50); NPC.aiStyle = -1; NPC.DeathSound = DeathSound; NPC.rarity = 1; @@ -154,10 +153,6 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/FusionFeeder.cs b/NPCs/Astral/FusionFeeder.cs index f9373dd5c2..b1b4c7c1a4 100644 --- a/NPCs/Astral/FusionFeeder.cs +++ b/NPCs/Astral/FusionFeeder.cs @@ -58,9 +58,8 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 45; NPC.aiStyle = -1; NPC.lifeMax = 500; - NPC.defense = 12; - NPC.DR_NERD(0.15f); - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.defense = 28; + NPC.value = Item.buyPrice(silver: 8); NPC.knockBackResist = 0.8f; NPC.behindTiles = true; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; @@ -70,17 +69,13 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 65; - NPC.defense = 22; + NPC.defense = 38; NPC.knockBackResist = 0.7f; NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public static bool ValidMovementPosition(Tile tile) @@ -315,6 +310,7 @@ namespace CalamityMod.NPCs.Astral { npcLoot.Add(ItemID.SharkFin, 8); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 2, 3, 3, 4)); + npcLoot.Add(ItemID.Nachos, 30); } } } diff --git a/NPCs/Astral/Glomerling.cs b/NPCs/Astral/Glomerling.cs index ccbe4388c2..c314049689 100644 --- a/NPCs/Astral/Glomerling.cs +++ b/NPCs/Astral/Glomerling.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.Astral NPC.aiStyle = -1; NPC.damage = 30; NPC.defense = 0; - NPC.lifeMax = 190; + NPC.lifeMax = 160; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.5f; NPC.noGravity = true; @@ -50,15 +50,11 @@ namespace CalamityMod.NPCs.Astral NPC.damage = 50; NPC.defense = 8; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 285; + NPC.lifeMax = 240; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Hadarian.cs b/NPCs/Astral/Hadarian.cs index 76e15717a4..c6c1c6c104 100644 --- a/NPCs/Astral/Hadarian.cs +++ b/NPCs/Astral/Hadarian.cs @@ -42,28 +42,23 @@ namespace CalamityMod.NPCs.Astral NPC.height = 40; NPC.aiStyle = -1; NPC.damage = 50; - NPC.defense = 8; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 420; + NPC.defense = 18; + NPC.lifeMax = 360; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.knockBackResist = 0.75f; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 80; - NPC.defense = 18; + NPC.defense = 28; NPC.knockBackResist = 0.65f; - NPC.lifeMax = 630; + NPC.lifeMax = 540; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Mantis.cs b/NPCs/Astral/Mantis.cs index 07658108a6..3910718d16 100644 --- a/NPCs/Astral/Mantis.cs +++ b/NPCs/Astral/Mantis.cs @@ -38,33 +38,27 @@ namespace CalamityMod.NPCs.Astral public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; NPC.damage = 55; NPC.width = 60; NPC.height = 58; NPC.aiStyle = -1; - NPC.defense = 6; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 430; + NPC.defense = 22; + NPC.lifeMax = 400; NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 85; - NPC.defense = 16; + NPC.defense = 32; NPC.knockBackResist = 0.1f; - NPC.lifeMax = 645; + NPC.lifeMax = 600; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/Nova.cs b/NPCs/Astral/Nova.cs index 31482df041..8737f78575 100644 --- a/NPCs/Astral/Nova.cs +++ b/NPCs/Astral/Nova.cs @@ -52,22 +52,21 @@ namespace CalamityMod.NPCs.Astral NPC.width = 78; NPC.height = 50; NPC.damage = 45; - NPC.defense = 15; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 290; + NPC.defense = 26; + NPC.lifeMax = 300; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 75; - NPC.defense = 25; + NPC.defense = 36; NPC.knockBackResist = 0.4f; - NPC.lifeMax = 435; + NPC.lifeMax = 450; } if (CalamityWorld.revenge) { @@ -82,10 +81,6 @@ namespace CalamityMod.NPCs.Astral NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/SightseerCollider.cs b/NPCs/Astral/SightseerCollider.cs index 3689d48278..ae8b05b1fb 100644 --- a/NPCs/Astral/SightseerCollider.cs +++ b/NPCs/Astral/SightseerCollider.cs @@ -40,30 +40,25 @@ namespace CalamityMod.NPCs.Astral NPC.width = 48; NPC.height = 40; NPC.damage = 38; - NPC.defense = 16; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 390; + NPC.defense = 28; + NPC.lifeMax = 320; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.58f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 58; - NPC.defense = 26; + NPC.defense = 38; NPC.knockBackResist = 0.48f; - NPC.lifeMax = 585; + NPC.lifeMax = 480; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/SightseerSpitter.cs b/NPCs/Astral/SightseerSpitter.cs index 7163f98338..17ac78ee83 100644 --- a/NPCs/Astral/SightseerSpitter.cs +++ b/NPCs/Astral/SightseerSpitter.cs @@ -42,30 +42,25 @@ namespace CalamityMod.NPCs.Astral NPC.width = 64; NPC.height = 56; NPC.damage = 50; - NPC.defense = 20; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 540; + NPC.defense = 35; + NPC.lifeMax = 500; NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; NPC.noGravity = true; NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); NPC.aiStyle = -1; Banner = NPC.type; BannerItem = ModContent.ItemType(); if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 85; - NPC.defense = 30; + NPC.defense = 45; NPC.knockBackResist = 0.7f; - NPC.lifeMax = 810; + NPC.lifeMax = 750; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Astral/StellarCulex.cs b/NPCs/Astral/StellarCulex.cs index f8ed4ceff0..c3d38bd18d 100644 --- a/NPCs/Astral/StellarCulex.cs +++ b/NPCs/Astral/StellarCulex.cs @@ -40,13 +40,11 @@ namespace CalamityMod.NPCs.Astral NPC.width = 60; NPC.height = 50; NPC.aiStyle = NPCAIStyleID.Bat; //bats - NPC.npcSlots = 0.5f; //needed? NPC.damage = 55; - NPC.defense = 18; - NPC.DR_NERD(0.15f); + NPC.defense = 26; NPC.knockBackResist = 0.65f; - NPC.lifeMax = 270; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.lifeMax = 280; + NPC.value = Item.buyPrice(silver: 5); NPC.DeathSound = CommonCalamitySounds.AstralNPCDeathSound; AnimationType = NPCID.GiantFlyingFox; Banner = NPC.type; @@ -54,17 +52,13 @@ namespace CalamityMod.NPCs.Astral if (DownedBossSystem.downedAstrumAureus) { NPC.damage = 90; - NPC.defense = 28; + NPC.defense = 36; NPC.knockBackResist = 0.55f; - NPC.lifeMax = 405; + NPC.lifeMax = 420; } NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/AstrumAureus/AstrumAureus.cs b/NPCs/AstrumAureus/AstrumAureus.cs index ab27b1d31a..f28d818989 100644 --- a/NPCs/AstrumAureus/AstrumAureus.cs +++ b/NPCs/AstrumAureus/AstrumAureus.cs @@ -19,12 +19,13 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.NPCs.TownNPCs; +using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -87,22 +88,25 @@ namespace CalamityMod.NPCs.AstrumAureus } } + public static int LaserDamage = 25; // 100 + public static int CrystalDamage = 30; // 120 + public override void SetDefaults() { NPC.lavaImmune = true; NPC.noGravity = true; NPC.npcSlots = 15f; - NPC.GetNPCDamage(); + NPC.damage = 80; // 160 NPC.Calamity().canBreakPlayerDefense = true; NPC.width = 374; NPC.height = 374; NPC.defense = 40; - NPC.DR_NERD(0.4f); - NPC.LifeMaxNERB(120000, 140000, 740000); // 30 seconds in boss rush + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(100000, 120000, 740000); // 30 seconds in boss rush NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 25, 0, 0); + NPC.value = Item.buyPrice(gold: 15); NPC.boss = true; NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = true; @@ -110,12 +114,9 @@ namespace CalamityMod.NPCs.AstrumAureus SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; if (Main.getGoodWorld) - NPC.scale *= 0.8f; + NPC.scale = 0.7f; if (Main.zenithWorld) - NPC.scale *= 1.5f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); + NPC.scale = 1.5f; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -153,8 +154,912 @@ namespace CalamityMod.NPCs.AstrumAureus public override void AI() { - AstrumAureusAI.VanillaAstrumAureusAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.astrumAureus = NPC.whoAmI; + + // Variables + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); + bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); + bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; + bool phase5 = lifeRatio < 0.3f && revenge; + + // Exhaustion + bool exhausted = NPC.ai[2] >= (phase3 ? 2f : 1f); + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit + float noProjectileOrPhaseIncrementTime = 240f; + + bool dontAttack = NPC.localAI[3] > 0f; + if (dontAttack) + { + NPC.localAI[3] -= 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.localAI[3] -= death ? 4f : expertMode ? 2f : 1f; + } + + float astralFlameBarrageTimerIncrement = 1f; + if (expertMode) + astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); + + float walkingVelocity = phase5 ? 7f : 5f; + if (expertMode) + walkingVelocity += 1.5f * (1f - lifeRatio); + if (revenge) + walkingVelocity += Math.Abs(NPC.Center.X - player.Center.X) * 0.0025f; + if (Main.getGoodWorld) + walkingVelocity *= 1.15f; + + float walkingProjectileVelocity = walkingVelocity * 0.8f; + + // Direction + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; + + // Used to reduce Aureus' fall speed + bool reduceFallSpeed = NPC.velocity.Y > 0f && Collision.SolidCollision(NPC.position + Vector2.UnitY * 1.1f * NPC.velocity.Y, NPC.width, NPC.height) && NPC.ai[0] == 4f; + + // Despawn + bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + if (!player.active || player.dead || despawnDistance) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || despawnDistance) + { + NPC.noTileCollide = true; + + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + NPC.velocity.Y += 0.1f; + if (NPC.velocity.Y > 12f) + NPC.velocity.Y = 12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; + bool geldonPhase2 = lifeRatio <= 0.1f; + if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) + { + slimeProjCounter++; + if (slimeProjCounter % 180 == 0) + { + SoundEngine.PlaySound(SoundID.Item33, NPC.Center); // Intentionally keeping the old laser sound in GFB + + if (slimePhase == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int totalProjectiles = death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, CrystalDamage, 0f, Main.myPlayer, 0f, 1f); + } + } + slimePhase = 0; + } + else + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + float aureusLaserSpeed = 7f; + float aureusLaserTargetX = player.Center.X - NPC.Center.X; + float aureusLaserTargetY = player.Center.Y - NPC.Center.Y; + float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); + aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; + aureusLaserTargetX *= aureusLaserTargetDist; + aureusLaserTargetY *= aureusLaserTargetDist; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, LaserDamage, 0f, Main.myPlayer); + for (int i = 0; i < 4; i++) + { + Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, LaserDamage, 0f, Main.myPlayer); + } + } + slimePhase = 1; + } + } + RevengeanceAndDeathAI.BuffedMimicAI(NPC, Mod); + NPC.noGravity = false; + NPC.noTileCollide = false; + return; + } + else + { + NPC.noGravity = true; + } + + // Emit light when not Idle + if (NPC.ai[0] != 1f) + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.3f, 0.5f, 0f); + + // Fire projectiles while walking, teleporting, or falling + if (NPC.ai[0] == 2f || NPC.ai[0] >= 5f) + { + if (!dontAttack) + NPC.localAI[0] += NPC.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; + + float astralFlameBarrageGateValue = phase4 ? 30f : 60f; + if (NPC.localAI[0] >= astralFlameBarrageGateValue) + { + // Fire astral flames while teleporting + if (NPC.ai[0] >= 5f && NPC.ai[0] != 7) + { + NPC.localAI[0] = 0f; + SoundEngine.PlaySound(FlameCrystalSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float velocity = death ? (8f + NPC.localAI[2] * 0.025f) : 7f; + int type = ModContent.ProjectileType(); + float spreadLimit = phase4 ? 100f : 50f; + float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; + Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale); + Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * NPC.scale); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, CrystalDamage, 0f, Main.myPlayer); + } + } + } + + float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; + if (NPC.localAI[0] >= laserBarrageGateValue) + { + // Fire astral lasers while walking + if (NPC.ai[0] == 2f) + { + NPC.localAI[0] = 0f; + + SoundEngine.PlaySound(LaserSound, NPC.Center); + + if (calamityGlobalNPC.newAI[2] == 0f) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase2 ? 3 : 5; + int spread = !phase2 ? 8 : 10; + + int type = ModContent.ProjectileType(); + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, LaserDamage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + + if (phase3) + { + float flameVelocity = walkingProjectileVelocity; + maxProjectiles = 2; + spread = 45; + + type = ModContent.ProjectileType(); + projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * flameVelocity; + rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, CrystalDamage, 0f, Main.myPlayer); + } + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int maxProjectiles = !phase3 ? (death ? 11 : 9) : (death ? 17 : 15); + int spread = !phase3 ? (death ? 18 : 16) : (death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int centralLaser = maxProjectiles / 2; + int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * walkingProjectileVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, LaserDamage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); + } + } + } + } + } + } + } + else + NPC.localAI[0] = 0f; + + // Start up + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 1f; + NPC.netUpdate = true; + CustomGravity(); + } + + // Idle + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down + NPC.velocity.X *= 0.8f; + + // Stay vulnerable for 3 seconds + NPC.ai[1] += 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; + + if (NPC.ai[1] >= 180f) + { + // Set AI to random state and reset other AI arrays + NPC.TargetClosest(); + switch (Main.rand.Next(phase3 ? 3 : 2)) + { + case 0: + NPC.ai[0] = 2f; + break; + + case 1: + NPC.ai[0] = 3f; + break; + + case 2: + NPC.ai[0] = 5f; + break; + + default: + break; + } + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Stop colliding with tiles if entering walking phase + NPC.noTileCollide = NPC.ai[0] == 2f; + + NPC.netUpdate = true; + } + else + CustomGravity(); + } + + // Walk + else if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Set walking direction + if (Math.Abs(NPC.Center.X - player.Center.X) < 200f * NPC.scale) + { + NPC.velocity.X *= 0.8f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + } + else + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + + if (NPC.direction > 0) + NPC.velocity.X = (NPC.velocity.X * 20f + walkingVelocity) / 21f; + if (NPC.direction < 0) + NPC.velocity.X = (NPC.velocity.X * 20f - walkingVelocity) / 21f; + } + + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && player.position.Y <= NPC.position.Y + NPC.height && !NPC.collideX) + { + CustomGravity(); + NPC.noTileCollide = false; + } + else + { + NPC.noTileCollide = true; + + // Walk through tiles if colliding with tiles and player is out of reach + int aureusHitboxWidth = 80; + int aureusHitboxHeight = 20; + Vector2 aureusHitboxTileCollideSize = new Vector2(NPC.Center.X - (aureusHitboxWidth / 2), NPC.position.Y + NPC.height - aureusHitboxHeight); + + bool nearPlayerWalkingThroughTiles = false; + if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width && NPC.position.Y + NPC.height < player.position.Y + player.height - 16f) + nearPlayerWalkingThroughTiles = true; + + if (nearPlayerWalkingThroughTiles) + { + NPC.velocity.Y += 0.5f; + } + else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y = 0f; + + if (NPC.velocity.Y > -0.2) + NPC.velocity.Y -= 0.025f; + else + NPC.velocity.Y -= 0.2f; + + if (NPC.velocity.Y < -4f) + NPC.velocity.Y = -4f; + } + else + { + if (NPC.velocity.Y < 0f) + NPC.velocity.Y = 0f; + + if (NPC.velocity.Y < 0.1) + NPC.velocity.Y += 0.025f; + else + NPC.velocity.Y += 0.5f; + } + } + + // Walk for a maximum of 6 seconds + if (!dontAttack) + { + NPC.ai[1] += 1f; + if (NPC.Distance(player.Center) < 240f) + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; + } + + if (NPC.ai[1] >= (360f - (death ? 90f * (1f - lifeRatio) : 0f))) + { + // Collide with tiles again + NPC.noTileCollide = false; + + // Set AI to next phase (Jump) and reset other AI + NPC.TargetClosest(); + NPC.ai[0] = exhausted ? 1f : 3f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + NPC.netUpdate = true; + } + + // Limit downward velocity + if (NPC.velocity.Y > 10f) + NPC.velocity.Y = 10f; + } + + // Jump + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.noTileCollide = false; + + if (NPC.velocity.Y == 0f) + { + // Slow down + NPC.velocity.X *= 0.8f; + + // Half second delay before jumping + if (!dontAttack) + NPC.ai[1] += 1f; + + if (NPC.ai[1] >= 30f) + { + NPC.ai[1] = -20f; + } + else if (NPC.ai[1] == -1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + // Set jump velocity, reset and set AI to next phase (Stomp) + float distanceFromPlayerOnXAxis = NPC.Center.X - player.Center.X; + NPC.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; + calamityGlobalNPC.newAI[3] = NPC.direction; + + // The limit for how much Aureus can multiply its jump velocity + float speedMultLimit = 1f; + + // Maxes out when the player is a full 2000 pixels away from or above Aureus + float multiplier = 1f / 2000f; + + // Increase Aureus jump velocity X if it's far enough away from the player + float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); + float distanceGateValue = 400f; + bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; + if (increaseJumpVelocityX) + { + calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; + if (calamityGlobalNPC.newAI[0] > speedMultLimit) + calamityGlobalNPC.newAI[0] = speedMultLimit; + } + + // Increase Aureus jump velocity Y if it's far enough above the player + float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; + if (increaseJumpVelocityY) + { + calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; + if (calamityGlobalNPC.newAI[1] > speedMultLimit) + calamityGlobalNPC.newAI[1] = speedMultLimit; + } + + float velocity = 20f; + if (expertMode) + velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); + if (Main.getGoodWorld) + velocity *= 1.15f; + + NPC.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - NPC.Center).SafeNormalize(Vector2.Zero) * velocity; + NPC.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); + + NPC.noTileCollide = true; + + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + + SoundEngine.PlaySound(JumpSound, NPC.Center); + + NPC.netUpdate = true; + } + } + + // Don't run custom gravity when starting a jump + if (NPC.ai[0] != 4f) + CustomGravity(); + } + + // Stomp + else if (NPC.ai[0] == 4f) + { + if (NPC.velocity.Y == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and NPC + SoundStyle soundToPlay = Main.zenithWorld ? ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : StompSound; + SoundEngine.PlaySound(soundToPlay, NPC.Center); + + if (Main.zenithWorld) + { + float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + } + + // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) + NPC.TargetClosest(); + NPC.localAI[1] += 1f; + float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; + if (NPC.localAI[1] >= maxStompAmt) + { + NPC.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); + NPC.localAI[1] = 0f; + NPC.ai[2] += 1f; + NPC.ai[3] = 0f; + NPC.noTileCollide = false; + NPC.netUpdate = true; + } + else + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0 ? 1 : -1; + NPC.ai[0] = 3f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + + // Spawn dust for visual effect + for (int i = (int)NPC.position.X - 20; i < (int)NPC.position.X + NPC.width + 40; i += 20) + { + for (int j = 0; j < 4; j++) + { + int stompDust = Dust.NewDust(new Vector2(NPC.position.X - 20f, NPC.position.Y + NPC.height), NPC.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); + Main.dust[stompDust].velocity *= 0.2f; + } + } + + // Fire lasers or flames on stomp + SoundEngine.PlaySound(LaserSound, NPC.Center); + + if (Main.zenithWorld) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool crystal = Main.rand.NextBool(); + int type = crystal ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = crystal ? CrystalDamage : LaserDamage; + int totalProjectiles = death ? 12 : revenge ? 10 : expertMode ? 8 : 6; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 10f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); + } + } + } + else if (calamityGlobalNPC.newAI[2] == 0f && phase2) + { + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float flameVelocity = 6f; + int maxProjectiles = death ? 3 : 2; + int spread = death ? 28 : 20; + + int type = ModContent.ProjectileType(); + Vector2 spawnVector = new Vector2(NPC.Center.X, NPC.Center.Y - 80f * NPC.scale); + Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * NPC.scale); + Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, CrystalDamage, 0f, Main.myPlayer); + } + } + } + else + { + calamityGlobalNPC.newAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float laserVelocity = Main.getGoodWorld ? 7f : death ? 6f : 5f; + int maxProjectiles = !phase3 ? (death ? 11 : 9) : (death ? 15 : 13); + int spread = !phase3 ? (death ? 18 : 16) : (death ? 22 : 20); + + int type = ModContent.ProjectileType(); + int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; + Vector2 projectileVelocity = Vector2.Normalize(player.Center - NPC.Center) * laserVelocity; + float rotation = MathHelper.ToRadians(spread); + for (int i = 0; i < maxProjectiles; i++) + { + if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, LaserDamage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); + } + } + } + } + } + else + { + // Set damage + NPC.damage = NPC.defDamage; + + // Set velocities while falling, this happens before the stomp + // Fall through + if (!player.dead) + { + if ((player.position.Y > NPC.Bottom.Y && NPC.velocity.Y > 0f) || (player.position.Y < NPC.Bottom.Y && NPC.velocity.Y < 0f)) + NPC.noTileCollide = true; + else if ((NPC.velocity.Y > 0f && NPC.Bottom.Y > Main.player[NPC.target].Top.Y) || (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height))) + NPC.noTileCollide = false; + } + + if (NPC.position.X < player.position.X && NPC.position.X + NPC.width > player.position.X + player.width) + { + // Make sure Aureus falls quickly when directly on top of or below the player + if (NPC.ai[3] < 30f) + NPC.ai[3] = 30f; + + NPC.velocity.X *= 0.8f; + + if (NPC.Bottom.Y < player.position.Y) + { + // Make sure Aureus falls rather quickly + if (NPC.velocity.Y < -3f) + NPC.velocity.Y = -3f; + + float fallSpeed = 1.2f; + if (expertMode) + fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); + if (Main.getGoodWorld) + fallSpeed += 0.5f; + + if (calamityGlobalNPC.newAI[1] > 0f) + fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + NPC.velocity.Y += fallSpeed; + } + } + else + { + // Push Aureus towards the player on the X axis if he's not directly on top of or below the player + float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.0001f; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; + + if (NPC.direction < 0) + NPC.velocity.X -= velocityXChange; + else if (NPC.direction > 0) + NPC.velocity.X += velocityXChange; + + float velocityXCap = 12f; + if (expertMode) + velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); + if (Main.getGoodWorld) + velocityXCap += 5f; + + if (calamityGlobalNPC.newAI[0] > 0f) + velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; + + float playerLocation = NPC.Center.X - player.Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; + + if (slowDown) + velocityXCap *= 0.333f; + + if (NPC.velocity.X < -velocityXCap) + NPC.velocity.X = -velocityXCap; + if (NPC.velocity.X > velocityXCap) + NPC.velocity.X = velocityXCap; + } + + // Don't start falling quickly until half a second has passed + NPC.ai[3] += 1f; + if (NPC.ai[3] > 30f) + CustomGravity(); + } + } + + // Teleport + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Slow down + NPC.velocity.X *= 0.8f; + + // Start teleport + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (death) + NPC.localAI[2] += 1.25f; + + if (phase4) + { + NPC.localAI[1] += 1f; + if (death) + NPC.localAI[2] += 1.25f; + } + + if (NPC.localAI[1] >= (death ? 180f : 240f)) + { + // Reset localAI and find a teleport destination + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + + Vector2 vectorAimedAheadOfTarget = Main.player[NPC.target].Center + new Vector2((float)Math.Round(Main.player[NPC.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; + Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); + int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); + + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + NPC.ai[1] = teleportTileX * 16 + 8; + NPC.ai[3] = teleportTileY * 16 + 16; + break; + } + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + NPC.ai[1] = bottom.X; + NPC.ai[3] = bottom.Y; + } + + // Set AI to next phase (Mid-teleport) + NPC.ai[0] = 6f; + NPC.netUpdate = true; + } + } + + CustomGravity(); + } + + // Mid-teleport + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (death) + NPC.localAI[2] += 1.25f; + + if (phase4) + { + if (death) + NPC.localAI[2] += 1.25f; + } + + // Turn invisible + NPC.alpha += 10; + if (NPC.alpha >= 255) + { + // Set position to teleport destination + NPC.Bottom = new Vector2(NPC.ai[1], NPC.ai[3]); + + // Reset alpha and set AI to next phase (End of teleport) + NPC.alpha = 255; + NPC.ai[0] = 7f; + NPC.localAI[2] = 0f; + NPC.netUpdate = true; + } + + // Play sound for cool effect + if (NPC.soundDelay == 0) + { + NPC.soundDelay = 15; + SoundEngine.PlaySound(TeleportSound, NPC.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + // End of teleport + else if (NPC.ai[0] == 7f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Turn visible + NPC.alpha -= 10; + if (NPC.alpha <= 0) + { + // Spawn Aureus Spawns + bool spawnFlag = expertMode; + if (NPC.CountNPCS(ModContent.NPCType()) >= 2) + spawnFlag = false; + + if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) + { + int aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -10f; + Main.npc[aureusSpawn].netUpdate = true; + if (revenge) + { + aureusSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y - 25f * NPC.scale), ModContent.NPCType()); + Main.npc[aureusSpawn].velocity.Y = -15f; + Main.npc[aureusSpawn].netUpdate = true; + } + + if (death) + { + int damageAmt = NPC.lifeMax / 50; + NPC.life -= damageAmt; + if (NPC.life < 1) + NPC.life = 1; + + NPC.DamageEffect(damageAmt); + } + } + + // Reset alpha and set AI to next phase (Idle) + NPC.alpha = 0; + NPC.ai[0] = exhausted ? 1f : 2f; + NPC.ai[1] = 0f; + NPC.ai[2] += 1f; + NPC.localAI[3] = noProjectileOrPhaseIncrementTime; + + // Stop colliding with tiles if entering walking phase + NPC.noTileCollide = NPC.ai[0] == 2f; + + NPC.netUpdate = true; + } + + // Play sound at teleport destination for cool effect + if (NPC.soundDelay == 0) + { + NPC.soundDelay = 15; + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + } + + // Emit dust to make the teleport pretty + for (int i = 0; i < 10; i++) + { + int teleportDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, ModContent.DustType(), NPC.velocity.X, NPC.velocity.Y, 255, default, 2f); + Main.dust[teleportDust].noGravity = true; + Main.dust[teleportDust].velocity *= 0.5f; + } + + CustomGravity(); + } + + void CustomGravity() + { + float gravity = 0.36f; + float maxFallSpeed = 12f; + + if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) + maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; + + if (Main.getGoodWorld && !reduceFallSpeed) + { + gravity *= 1.15f; + maxFallSpeed *= 1.15f; + } + + NPC.velocity.Y += gravity; + if (NPC.velocity.Y > maxFallSpeed) + NPC.velocity.Y = maxFallSpeed; + } } + public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; public override void FindFrame(int frameHeight) { @@ -372,7 +1277,7 @@ namespace CalamityMod.NPCs.AstrumAureus return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } @@ -433,8 +1338,6 @@ namespace CalamityMod.NPCs.AstrumAureus CalamityGlobalNPC.SetNewBossJustDowned(NPC); - CalamityGlobalNPC.SetNewShopVariable(new int[] { ModContent.NPCType() }, DownedBossSystem.downedAstrumAureus); - // If Astrum Aureus has not yet been killed, notify players of new Astral enemy drops if (!DownedBossSystem.downedAstrumAureus) { @@ -513,7 +1416,6 @@ namespace CalamityMod.NPCs.AstrumAureus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } // Can only hit the target if within certain distance diff --git a/NPCs/AstrumAureus/AureusSpawn.cs b/NPCs/AstrumAureus/AureusSpawn.cs index 3daa83d2c7..9d20520ac4 100644 --- a/NPCs/AstrumAureus/AureusSpawn.cs +++ b/NPCs/AstrumAureus/AureusSpawn.cs @@ -35,9 +35,9 @@ namespace CalamityMod.NPCs.AstrumAureus public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 60; // 120 NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.width = 90; NPC.height = 60; NPC.Opacity = 0f; @@ -308,11 +308,10 @@ namespace CalamityMod.NPCs.AstrumAureus { if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 36 : (3 + (int)((NPC.scale - 1f) * 3)); + int totalProjectiles = 3 + (int)((NPC.scale - 1f) * 3); double radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage2 = NPC.GetProjectileDamage(type); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : 6f; + float velocity = 6f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); @@ -320,7 +319,7 @@ namespace CalamityMod.NPCs.AstrumAureus for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, damage2, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, vector255, type, AstrumAureus.LaserDamage, 0f, Main.myPlayer); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusBody.cs b/NPCs/AstrumDeus/AstrumDeusBody.cs index ecfa2a3a11..1a017ad86a 100644 --- a/NPCs/AstrumDeus/AstrumDeusBody.cs +++ b/NPCs/AstrumDeus/AstrumDeusBody.cs @@ -1,13 +1,16 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -51,9 +54,13 @@ namespace CalamityMod.NPCs.AstrumDeus } } + public static int LaserDamage = 30; // 120 + public static int HelixLaserDamage = 40; // 160 + public static int MineDamage = 40; // 160 + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 70; // 140 NPC.npcSlots = 5f; NPC.width = 38; NPC.height = 44; @@ -64,9 +71,7 @@ namespace CalamityMod.NPCs.AstrumDeus AIType = -1; NPC.knockBackResist = 0f; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.5f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.4f; else if (CalamityWorld.revenge) NPC.scale *= 1.35f; @@ -84,9 +89,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.dontCountMe = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -112,7 +114,309 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + else + NPC.damage = NPC.defDamage; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (Main.zenithWorld) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + + // Copy dontTakeDamage and Opacity from head + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + if (deathModeEnragePhase_BodyAndTail) + { + NPC.defense = 25; + calamityGlobalNPC.DR = 0.15f; + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !NPC.dontTakeDamage) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + int headType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; + } + if (shouldDespawn) + { + if (Main.npc.IndexInRange((int)NPC.ai[1]) && Main.npc[(int)NPC.ai[1]].active && Main.npc[(int)NPC.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NPC.ForceNetUpdate(false); + } + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + if (gfbWormCount > 0) + segmentVelocity += (gfbMaxWormCount - gfbWormCount) * 0.444f; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + // Shoot lasers + NPC.localAI[0] += 1f; + + int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; + float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; + float timer = NPC.ai[0] + 15f; + float divisor = timer + shootProjectile; + bool canFireProjectiles = NPC.Opacity >= 1f; + bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; + + if (canFireProjectiles) + { + if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) + { + float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; + if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % laserDivisor == 0f) + { + NPC.TargetClosest(); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (deathModeEnragePhase_BodyAndTail) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, MineDamage, 0f, Main.myPlayer, split, 0f); + } + } + + if (Vector2.Distance(player.Center, NPC.Center) > 80f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float deusLaserSpeed = death ? 16f : revenge ? 14f : 13f; + if (gfbWormCount > 0) + deusLaserSpeed += (gfbMaxWormCount - gfbWormCount) * 0.444f; + + Vector2 deusLaserCenter = NPC.Center; + float deusLaserTargetX = player.Center.X - deusLaserCenter.X; + float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y; + float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); + deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; + deusLaserTargetX *= deusLaserTargetDist; + deusLaserTargetY *= deusLaserTargetDist; + deusLaserCenter.X += deusLaserTargetX * 5f; + deusLaserCenter.Y += deusLaserTargetY * 5f; + + Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); + Vector2 laserVelocity = shootDirection * deusLaserSpeed; + + int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = shootGodRays ? HelixLaserDamage : LaserDamage; + if (shootGodRays) + { + SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, NPC.Center); + // Waving beams need to start offset so they cross each other neatly. + float waveSideOffset = Main.rand.NextFloat(9f, 14f); + Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; + + for (int i = -1; i <= 1; i += 2) + { + Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); + Projectile godRay = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + + // Tell this Phased God Ray exactly which way it should be waving. + godRay.localAI[1] = i * 0.5f; + } + } + else + { + SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); + Projectile.NewProjectile(NPC.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); + } + } + } + } + } + else + { + if (NPC.localAI[0] % divisor == 0f && NPC.ai[0] % 2f == 0f) + { + Vector2 velocity = Vector2.Zero; + if (movingMines) + { + Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); + randomMineMovement.Normalize(); + randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; + velocity = randomMineMovement; + } + + int type = ModContent.ProjectileType(); + float split = (splittingMines && NPC.ai[0] % 3f == 0f) ? 1f : 0f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, MineDamage, 0f, Main.myPlayer, split, 0f); + } + } + } + + // Follow the head + Vector2 segmentCenter = NPC.Center; + float segmentTargetX = player.Center.X; + float segmentTargetY = player.Center.Y; + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + segmentCenter = NPC.Center; + segmentTargetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentCenter.X; + segmentTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentCenter.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = NPC.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + segmentTargetX; + NPC.position.Y = NPC.position.Y + segmentTargetY; + + if (segmentTargetX < 0f) + NPC.spriteDirection = -1; + else if (segmentTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -259,7 +563,6 @@ namespace CalamityMod.NPCs.AstrumDeus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/AstrumDeus/AstrumDeusHead.cs b/NPCs/AstrumDeus/AstrumDeusHead.cs index eb5c436317..728439106b 100644 --- a/NPCs/AstrumDeus/AstrumDeusHead.cs +++ b/NPCs/AstrumDeus/AstrumDeusHead.cs @@ -1,6 +1,7 @@ -using System.IO; -using CalamityMod.BiomeManagers; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Accessories; @@ -17,8 +18,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Packets; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -78,7 +78,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 120; // 240 NPC.npcSlots = 5f; NPC.width = 56; NPC.height = 56; @@ -89,9 +89,7 @@ namespace CalamityMod.NPCs.AstrumDeus AIType = -1; NPC.knockBackResist = 0f; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.5f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.4f; else if (CalamityWorld.revenge) NPC.scale *= 1.35f; @@ -100,7 +98,7 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); - NPC.value = Item.buyPrice(0, 50, 0, 0); + NPC.value = Item.buyPrice(gold: 50); NPC.alpha = 255; NPC.behindTiles = true; NPC.noGravity = true; @@ -119,9 +117,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.value /= 5; } - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -149,7 +144,634 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, true); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + else + NPC.damage = NPC.defDamage; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Despawn safety, make sure to target another player if the current player target is too far away + if (increaseSpeedMore) + NPC.TargetClosest(); + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (Main.zenithWorld) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + + // Split into two worms + float splitAnimationTime = 180f; + bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; + bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; + if (deathModeFinalWormEnrage) + { + if (calamityGlobalNPC.newAI[0] != 3f) + { + SoundEngine.PlaySound(SplitSound, player.Center); + calamityGlobalNPC.newAI[0] = 3f; + NPC.defense = 12; + calamityGlobalNPC.DR = 0.075f; + + // Despawns the other deus worm segments + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + + if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) + { + wormseg.life = 0; + wormseg.active = false; + } + } + } + + calamityGlobalNPC.newAI[2] += 10f; + if (calamityGlobalNPC.newAI[2] > 162f) + calamityGlobalNPC.newAI[2] = 162f; + + NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + } + + bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; + if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) + { + NPC.dontTakeDamage = true; + + calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; + NPC.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); + + bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; + + // + // CODE TWEAKED BY: OZZATRON + // September 20th, 2020 + // reason: fixing Astrum Deus death mode NPC cap bug + // + + // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. + if (despawning) + { + // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. + if (doubleWormPhase) + return; + + // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. + int bodyID = ModContent.NPCType(); + int tailID = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC wormseg = Main.npc[i]; + if (!wormseg.active) + continue; + if (wormseg.type == bodyID || wormseg.type == tailID) + { + wormseg.life = 0; + wormseg.active = false; + } + } + + // The unsplit Astrum Deus worm head will die next frame. + NPC.life = 0; + + // Do not spawn worms client side. The server handles this. + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int wormamt = Main.zenithWorld ? 5 : 1; + for (int i = 0; i < wormamt; i++) + { + // Now that the original worm doesn't exist, startCount can be zero. + // int startCount = NPC.whoAmI + phase1Length + 1; + int startIndexHeadOne = 1; + int headOneID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadOne); + Main.npc[headOneID].Calamity().newAI[0] = 1f; + Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; + Main.npc[headOneID].timeLeft *= 20; + Main.npc[headOneID].ForceNetUpdate(); + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); + } + + // Make sure the second split worm is also contiguous. + int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; + int headTwoID = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPC.type, startIndexHeadTwo); + Main.npc[headTwoID].Calamity().newAI[0] = 2f; + Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; + Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; + Main.npc[headTwoID].timeLeft *= 20; + Main.npc[headTwoID].ForceNetUpdate(); + + // On server, immediately send the correct extra AI of this head to clients. + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); + } + } + + SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); + } + return; + } + } + + if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses + { + float pushForce = 0.25f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherDeus = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherDeus.active || k == NPC.whoAmI) + continue; + + // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. + bool sameProjType = otherDeus.type == NPC.type; + float taxicabDist = Vector2.Distance(NPC.Center, otherDeus.Center); + float distancegate = 320f; + if (sameProjType && taxicabDist < distancegate) + { + if (NPC.position.X < otherDeus.position.X) + NPC.velocity.X -= pushForce; + else + NPC.velocity.X += pushForce; + + if (NPC.position.Y < otherDeus.position.Y) + NPC.velocity.Y -= pushForce; + else + NPC.velocity.Y += pushForce; + } + } + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (NPC.ai[0] == 0f) + { + int Previous = NPC.whoAmI; + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + for (int segments = 0; segments < maxLength; segments++) + { + int lol; + if (segments >= 0 && segments < maxLength - 1) + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, bodyType, NPC.whoAmI); + else + lol = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, tailType, NPC.whoAmI); + + if (segments % 2 == 0) + Main.npc[lol].localAI[3] = 1f; + + Main.npc[lol].realLife = NPC.whoAmI; + Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; + Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; + + if (Main.dedServ) + { + SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); + } + + Main.npc[lol].ai[3] = segments + 1; + Main.npc[lol].ai[2] = NPC.whoAmI; + Main.npc[lol].ai[1] = Previous; + Main.npc[Previous].ai[0] = lol; + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); + Previous = lol; + } + } + } + + if (NPC.life > Main.npc[(int)NPC.ai[0]].life) + NPC.life = Main.npc[(int)NPC.ai[0]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + if (gfbWormCount > 0) + segmentVelocity += (gfbMaxWormCount - gfbWormCount) * 0.444f; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + int headTilePositionX = (int)(NPC.position.X / 16f) - 1; + int headTileWidthPosX = (int)((NPC.position.X + NPC.width) / 16f) + 2; + int headTilePositionY = (int)(NPC.position.Y / 16f) - 1; + int headTileWidthPosY = (int)((NPC.position.Y + NPC.height) / 16f) + 2; + + if (headTilePositionX < 0) + headTilePositionX = 0; + if (headTileWidthPosX > Main.maxTilesX) + headTileWidthPosX = Main.maxTilesX; + if (headTilePositionY < 0) + headTilePositionY = 0; + if (headTileWidthPosY > Main.maxTilesY) + headTileWidthPosY = Main.maxTilesY; + + // Fly or not + bool shouldFly = flyAtTarget; + if (!shouldFly) + { + for (int k = headTilePositionX; k < headTileWidthPosX; k++) + { + for (int l = headTilePositionY; l < headTileWidthPosY; l++) + { + if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) + { + Vector2 vector2; + vector2.X = k * 16f; + vector2.Y = l * 16f; + if (NPC.position.X + NPC.width > vector2.X && NPC.position.X < vector2.X + 16f && NPC.position.Y + NPC.height > vector2.Y && NPC.position.Y < vector2.Y + 16f) + { + shouldFly = true; + break; + } + } + } + } + } + + // Start flying if target is not within a certain distance + if (!shouldFly) + { + NPC.localAI[1] = 1f; + + Rectangle rectangle = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); + int noFlyZone = 200; + int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); + int height = 400 - heightReduction; + bool outsideNoFlyZone = true; + + if (NPC.position.Y > player.position.Y) + { + for (int m = 0; m < Main.maxPlayers; m++) + { + if (Main.player[m].active) + { + Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); + if (rectangle.Intersects(rectangle2)) + { + outsideNoFlyZone = false; + break; + } + } + } + + if (outsideNoFlyZone) + shouldFly = true; + } + } + else + NPC.localAI[1] = 0f; + + // Despawn + if (player.dead) + { + shouldFly = false; + float velocity = 2f; + NPC.velocity.Y -= velocity; + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + segmentVelocity *= 2f; + NPC.velocity.Y -= velocity; + } + + int headType = ModContent.NPCType(); + int bodyType = ModContent.NPCType(); + int tailType = ModContent.NPCType(); + if ((double)NPC.position.Y < Main.topWorld + 16f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) + { + Main.npc[i].active = false; + Main.npc[i].ForceNetUpdate(false); + } + } + } + } + + // Speed and movement + float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); + float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); + float speed = (hasJustSpawned ? 0.26f : deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; + float turnSpeed = (hasJustSpawned ? 0.3f : deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; + if (gfbWormCount > 0) + { + speed += (gfbMaxWormCount - gfbWormCount) * 0.00555f; + turnSpeed += (gfbMaxWormCount - gfbWormCount) * 0.00888f; + } + + if (flyAtTarget) + { + float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; + speed *= speedMultiplier; + } + + if (revenge) + { + float revMultiplier = 1.1f; + speed *= revMultiplier; + turnSpeed *= revMultiplier; + } + + speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + + if (Main.getGoodWorld) + { + speed *= 1.15f; + turnSpeed *= 1.15f; + } + + Vector2 deusCenter = NPC.Center; + float deusTargetX = player.Center.X; + float deusTargetY = player.Center.Y; + deusTargetX = (int)(deusTargetX / 16f) * 16; + deusTargetY = (int)(deusTargetY / 16f) * 16; + deusCenter.X = (int)(deusCenter.X / 16f) * 16; + deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; + deusTargetX -= deusCenter.X; + deusTargetY -= deusCenter.Y; + + if (!shouldFly) + { + NPC.velocity.Y += 0.15f; + if (NPC.velocity.Y > segmentVelocity) + NPC.velocity.Y = segmentVelocity; + + // This bool exists to stop the strange wiggle behavior when worms are falling down + bool slowXVelocity = Math.Abs(NPC.velocity.X) > speed; + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.4) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X -= speed * 1.1f; + else + NPC.velocity.X += speed * 1.1f; + } + else if (NPC.velocity.Y == segmentVelocity) + { + if (slowXVelocity) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed; + } + else + NPC.velocity.X = 0f; + } + else if (NPC.velocity.Y > 4f) + { + if (slowXVelocity) + { + if (NPC.velocity.X < 0f) + NPC.velocity.X += speed * 0.9f; + else + NPC.velocity.X -= speed * 0.9f; + } + else + NPC.velocity.X = 0f; + } + } + else + { + float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); + float deusAbsoluteTargetX = Math.Abs(deusTargetX); + float deusAbsoluteTargetY = Math.Abs(deusTargetY); + float deusTimeToReachTarget = segmentVelocity / deusTargetDist; + deusTargetX *= deusTimeToReachTarget; + deusTargetY *= deusTimeToReachTarget; + + bool speedUpWhileFlying = false; + if (flyAtTarget) + { + if (((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f) || (NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) > speed / 2f && deusTargetDist < 400f) + { + speedUpWhileFlying = true; + + if (Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y) < segmentVelocity) + NPC.velocity *= 1.1f; + } + + if (NPC.position.Y > player.position.Y) + { + speedUpWhileFlying = true; + + if (Math.Abs(NPC.velocity.X) < segmentVelocity / 2f) + { + if (NPC.velocity.X == 0f) + NPC.velocity.X -= NPC.direction; + + NPC.velocity.X *= 1.1f; + } + else if (NPC.velocity.Y > -segmentVelocity) + NPC.velocity.Y -= speed; + } + } + + if (!speedUpWhileFlying) + { + if (!flyAtTarget) + { + if (((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f)) && ((NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f))) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += turnSpeed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= turnSpeed; + + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += turnSpeed; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= turnSpeed; + } + } + + if ((NPC.velocity.X > 0f && deusTargetX > 0f) || (NPC.velocity.X < 0f && deusTargetX < 0f) || (NPC.velocity.Y > 0f && deusTargetY > 0f) || (NPC.velocity.Y < 0f && deusTargetY < 0f)) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed; + + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += speed; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= speed; + + if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((NPC.velocity.X > 0f && deusTargetX < 0f) || (NPC.velocity.X < 0f && deusTargetX > 0f))) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed * 2f; + else + NPC.velocity.Y -= speed * 2f; + } + + if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((NPC.velocity.Y > 0f && deusTargetY < 0f) || (NPC.velocity.Y < 0f && deusTargetY > 0f))) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed * 2f; + else + NPC.velocity.X -= speed * 2f; + } + } + else if (deusAbsoluteTargetX > deusAbsoluteTargetY) + { + if (NPC.velocity.X < deusTargetX) + NPC.velocity.X += speed * 1.1f; + else if (NPC.velocity.X > deusTargetX) + NPC.velocity.X -= speed * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y += speed; + else + NPC.velocity.Y -= speed; + } + } + else + { + if (NPC.velocity.Y < deusTargetY) + NPC.velocity.Y += speed * 1.1f; + else if (NPC.velocity.Y > deusTargetY) + NPC.velocity.Y -= speed * 1.1f; + + if ((Math.Abs(NPC.velocity.X) + Math.Abs(NPC.velocity.Y)) < segmentVelocity * 0.5) + { + if (NPC.velocity.X > 0f) + NPC.velocity.X += speed; + else + NPC.velocity.X -= speed; + } + } + } + } + + if (shouldFly) + { + if (NPC.localAI[0] != 1f) + NPC.ForceNetUpdate(false); + + NPC.localAI[0] = 1f; + } + else + { + if (NPC.localAI[0] != 0f) + NPC.ForceNetUpdate(false); + + NPC.localAI[0] = 0f; + } + + if (((NPC.velocity.X > 0f && NPC.oldVelocity.X < 0f) || (NPC.velocity.X < 0f && NPC.oldVelocity.X > 0f) || (NPC.velocity.Y > 0f && NPC.oldVelocity.Y < 0f) || (NPC.velocity.Y < 0f && NPC.oldVelocity.Y > 0f)) && !NPC.justHit) + NPC.ForceNetUpdate(false); + + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; } public override bool CheckActive() @@ -272,9 +894,9 @@ namespace CalamityMod.NPCs.AstrumDeus } } - public override void BossLoot(ref string name, ref int potionType) => potionType = ModContent.ItemType(); + public override void BossLoot(ref int potionType) => potionType = ModContent.ItemType(); - public static bool ShouldNotDropThings(NPC npc) => npc.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && npc.Calamity().newAI[0] != 3f); + public static bool ShouldNotDropThings(NPC NPC) => NPC.Calamity().newAI[0] == 0f || ((CalamityWorld.death || BossRushEvent.BossRushActive) && NPC.Calamity().newAI[0] != 3f); public override bool SpecialOnKill() { diff --git a/NPCs/AstrumDeus/AstrumDeusTail.cs b/NPCs/AstrumDeus/AstrumDeusTail.cs index 127a782e6c..d231d34b8d 100644 --- a/NPCs/AstrumDeus/AstrumDeusTail.cs +++ b/NPCs/AstrumDeus/AstrumDeusTail.cs @@ -1,13 +1,15 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -39,7 +41,7 @@ namespace CalamityMod.NPCs.AstrumDeus public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 60; // 120 NPC.npcSlots = 5f; NPC.width = 52; NPC.height = 68; @@ -50,9 +52,7 @@ namespace CalamityMod.NPCs.AstrumDeus AIType = -1; NPC.knockBackResist = 0f; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.5f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.4f; else if (CalamityWorld.revenge) NPC.scale *= 1.35f; @@ -70,9 +70,6 @@ namespace CalamityMod.NPCs.AstrumDeus NPC.dontCountMe = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -96,7 +93,203 @@ namespace CalamityMod.NPCs.AstrumDeus public override void AI() { - AstrumDeusAI.VanillaAstrumDeusAI(NPC, Mod, false); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Difficulty variables + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Deus cannot hit for 3 seconds or while invulnerable + bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || NPC.dontTakeDamage; + if (doNotDealDamage) + NPC.damage = 0; + else + NPC.damage = NPC.defDamage; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool increaseSpeed = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; + bool increaseSpeedMore = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + // Inflict Extreme Gravity to nearby players + if (revenge) + { + if (!Main.dedServ) + { + if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + } + } + + // Life + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases based on life percentage + bool halfHealth = lifeRatio < 0.5f; + bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; + bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; + bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; + bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; + bool splittingMines = lifeRatio < 0.7f; + bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; + bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; + bool deathModeEnragePhase_BodyAndTail = false; + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + float resistanceTime = doubleWormPhase ? 300f : 600f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; + + // Flight timer + float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); + + calamityGlobalNPC.newAI[3] += 1f; + if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) + calamityGlobalNPC.newAI[3] = 0f; + // Sound effect for swapping between attack behaviors in phase 2 + if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) + SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); + + // Phase for flying at the player + bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; + + // Length of worms + int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; + int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; + int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; + int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; + + // Become gradually more pissed as more worms are killed + int gfbMaxWormCount = 10; + int gfbWormCount = 0; + if (Main.zenithWorld) + gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); + if (gfbWormCount > gfbMaxWormCount) + gfbWormCount = gfbMaxWormCount; + + // Copy dontTakeDamage and Opacity from head + NPC.dontTakeDamage = Main.npc[(int)NPC.ai[2]].dontTakeDamage; + NPC.Opacity = Main.npc[(int)NPC.ai[2]].Opacity; + deathModeEnragePhase_BodyAndTail = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] == 3f; + if (deathModeEnragePhase_BodyAndTail) + { + NPC.defense = 25; + calamityGlobalNPC.DR = 0.15f; + } + + // Set worm variable + if (NPC.ai[2] > 0f) + NPC.realLife = (int)NPC.ai[2]; + + // Alpha effects + if (Main.npc[(int)NPC.ai[1]].alpha < 128 && !NPC.dontTakeDamage) + { + NPC.alpha -= 42; + if (NPC.alpha < 0) + NPC.alpha = 0; + } + + // Check if other segments are still alive, if not, die + bool shouldDespawn = true; + int headType = ModContent.NPCType(); + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].type != headType || !Main.npc[i].active) + continue; + shouldDespawn = false; + break; + } + if (shouldDespawn) + { + if (Main.npc.IndexInRange((int)NPC.ai[1]) && Main.npc[(int)NPC.ai[1]].active && Main.npc[(int)NPC.ai[1]].life > 0) + shouldDespawn = false; + } + if (shouldDespawn) + { + NPC.life = 0; + NPC.HitEffect(0, 10.0); + NPC.checkDead(); + NPC.active = false; + NPC.ForceNetUpdate(false); + } + + // Direction + if (NPC.velocity.X < 0f) + NPC.spriteDirection = -1; + else if (NPC.velocity.X > 0f) + NPC.spriteDirection = 1; + + if (NPC.life > Main.npc[(int)NPC.ai[1]].life) + NPC.life = Main.npc[(int)NPC.ai[1]].life; + + bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning + float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; + + float segmentVelocityBoost = 5f * (1f - lifeRatio); + segmentVelocity += segmentVelocityBoost; + if (gfbWormCount > 0) + segmentVelocity += (gfbMaxWormCount - gfbWormCount) * 0.444f; + + if (revenge) + { + float revMultiplier = 1.1f; + segmentVelocity *= revMultiplier; + } + + // Follow the head + Vector2 segmentCenter = NPC.Center; + float segmentTargetX = player.Center.X; + float segmentTargetY = player.Center.Y; + segmentTargetX = (int)(segmentTargetX / 16f) * 16; + segmentTargetY = (int)(segmentTargetY / 16f) * 16; + segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; + segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; + segmentTargetX -= segmentCenter.X; + segmentTargetY -= segmentCenter.Y; + + if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) + { + try + { + segmentCenter = NPC.Center; + segmentTargetX = Main.npc[(int)NPC.ai[1]].Center.X - segmentCenter.X; + segmentTargetY = Main.npc[(int)NPC.ai[1]].Center.Y - segmentCenter.Y; + } + catch + { + } + + NPC.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; + float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); + int segmentWidth = NPC.width; + segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; + segmentTargetX *= segmentTargetDist; + segmentTargetY *= segmentTargetDist; + NPC.velocity = Vector2.Zero; + NPC.position.X = NPC.position.X + segmentTargetX; + NPC.position.Y = NPC.position.Y + segmentTargetY; + + if (segmentTargetX < 0f) + NPC.spriteDirection = -1; + else if (segmentTargetX > 0f) + NPC.spriteDirection = 1; + } + + // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer + if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) + { + SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, NPC.Center); + calamityGlobalNPC.newAI[1] = 1f; + } + + // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing + if (calamityGlobalNPC.newAI[1] < resistanceTime && ((NPC.position - NPC.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) + calamityGlobalNPC.newAI[1] += 1f; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -205,13 +398,12 @@ namespace CalamityMod.NPCs.AstrumDeus public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 180); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/BaseWormNPC.cs b/NPCs/BaseWormNPC.cs new file mode 100644 index 0000000000..778d4f4fec --- /dev/null +++ b/NPCs/BaseWormNPC.cs @@ -0,0 +1,629 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs +{ + #region Animations + public class WormAnimation + { + + + public Dictionary AnimationKeyframes = new(); + + /// + /// The rigidity of segments + /// + public float segmentRigidity = 0.75f; + /// + /// Should this animation mirror to match the worm's X direction? + /// + public bool mirror = true; + /// + /// Should this animation apply the animation's rotation values? + /// + public bool applyRotation = true; + public class WormKeyframe + { + public float[] segmentOffsets = new float[1]; + /// + /// Creates the segment rotation offsets for the given keyframe. + /// Everything to NaN, which will inherit the rotation offset of the frame before it. + /// + public WormKeyframe(params (float, float)[] parameters) + { + segmentOffsets = new float[200]; + var off = new List(); + for (var i = 0; i < 200; i++) + { + bool broken = false; + for (var i2 = 0; i2 < parameters.Length; i2++) + { + if (parameters[i2].Item1 == i) + { + segmentOffsets[i] = parameters[i2].Item2; + broken = true; + break; + } + } + if (!broken) + segmentOffsets[i] = float.NaN; + } + } + + public static WormKeyframe GetCurrent(BaseWormNPC HeadNPC) + { + WormKeyframe kf = new(); + for (var i = 0; i < HeadNPC.Segments.Count(); i++) + { + if (i == 0) + { + + var dif = ShortestAngle(HeadNPC.NPC.rotation, HeadNPC.Segments[i].rotation); + kf.segmentOffsets[i] = dif; + //Main.NewText((HeadNPC.NPC.rotation, HeadNPC.Segments[i].DirectionFrom(HeadNPC.NPC.Center).ToRotation())); + } + else + { + var dif = ShortestAngle(HeadNPC.Segments[i - 1].rotation, HeadNPC.Segments[i].rotation); + kf.segmentOffsets[i] = dif; + } + } + return kf; + } + static float ShortestAngle(float from, float to) + { + float difference = to - from; + + while (difference < -MathHelper.Pi) + difference += MathHelper.TwoPi; + while (difference > MathHelper.Pi) + difference -= MathHelper.TwoPi; + + return difference; + } + /// + /// Converts this keyframe into a usable array. + /// + /// + public float[] ClearTheNaNs() + { + float[] offsets = new float[segmentOffsets.Length]; + for (var i = 0; i < segmentOffsets.Length; i++) + { + if (float.IsNaN(segmentOffsets[i])) + { + if (i == 0) + offsets[i] = 0; + else + offsets[i] = offsets[i - 1]; + } + else + { + offsets[i] = segmentOffsets[i]; + } + } + return offsets; + } + } + + /// + /// Applies this animation for the given frame + /// + /// + /// + public void ApplyAnimationFrame(Entity HeadEntity, float frame) + { + var orderedKeyframes = AnimationKeyframes.OrderBy(x => x.Key); + (int, float[], float)? prev = null; + (int, float[], float)? next = null; + float[] goalSegmentRotOffsets = new float[200]; + float goalRotation = float.NaN; + foreach (var item in orderedKeyframes) + { + if (item.Key < frame) + { + prev = (item.Key, item.Value.Item1.ClearTheNaNs(), item.Value.Item2); + } + else + { + next = (item.Key, item.Value.Item1.ClearTheNaNs(), item.Value.Item2); + break; + } + } + if (next.HasValue && prev.HasValue) + { + float completion = (frame - prev.Value.Item1) / (next.Value.Item1 - prev.Value.Item1); + for (var i = 0; i < goalSegmentRotOffsets.Length; i++) + { + goalSegmentRotOffsets[i] = MathHelper.Lerp(prev.Value.Item2[i], next.Value.Item2[i], completion); + } + if (float.IsNaN(next.Value.Item3) && frame == next.Value.Item1) + AnimationKeyframes[next.Value.Item1] = (AnimationKeyframes[next.Value.Item1].Item1, next.Value.Item3); + if (!float.IsNaN(prev.Value.Item3)) + { + goalRotation = MathHelper.Lerp(prev.Value.Item3, next.Value.Item3, completion); + } + } + else + { + if (prev.HasValue) + goalSegmentRotOffsets = prev.Value.Item2; + if (next.HasValue) + { + goalSegmentRotOffsets = next.Value.Item2; + if (float.IsNaN(next.Value.Item3) && frame == next.Value.Item1) + AnimationKeyframes[next.Value.Item1] = (AnimationKeyframes[next.Value.Item1].Item1, next.Value.Item3); + } + } + //We use the same animation framework for both projectiles and NPCs, but applying it is different for each type and so we do the final applications here. + if (HeadEntity is NPC) + { + BaseWormNPC HeadNPC = ((NPC)HeadEntity).ModNPC(); + if (HeadNPC.Segments.Count > 0) + { + if (applyRotation && !(float.IsNaN(goalRotation))) + { + HeadNPC.NPC.rotation = goalRotation * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1); + } + for (int i = 0; i < HeadNPC.Segments.Count; i++) + { + + Vector2 pos1 = HeadNPC.NPC.Center; + float dist = HeadNPC.SegmentTypePositionOffsets[0]; + if (i != 0) + { + dist = HeadNPC.SegmentTypePositionOffsets[HeadNPC.Segments[i - 1].segmentType + 1]; + } + dist *= HeadNPC.NPC.scale; + Vector2 rot = (HeadNPC.NPC.rotation - MathHelper.PiOver2).ToRotationVector2(); + if (rot == Vector2.Zero) + rot = HeadNPC.Segments[0].Center.AngleTo(HeadNPC.NPC.Center).ToRotationVector2(); + if (i >= 1) + { + pos1 = HeadNPC.Segments[i - 1].Center; + rot = HeadNPC.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); + } + rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadNPC.NPC.velocity.X.DirectionalSign() : 1)); + var dir = HeadNPC.Segments[i].Center.DirectionFrom(pos1); + HeadNPC.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; + HeadNPC.Segments[i].velocity = HeadNPC.Segments[i].Center.DirectionTo(pos1); + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + } + + for (int i = 1; i < HeadNPC.Segments.Count - 1; i++) + { + HeadNPC.Segments[i].rotation = HeadNPC.Segments[i + 1].Center.DirectionTo(HeadNPC.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + } + } + } + else if (HeadEntity is Projectile) + { + BaseWormProjectile HeadProjectile = ((Projectile)HeadEntity).ModProjectile(); + if (HeadProjectile.Segments.Count > 0) + { + if (applyRotation && !(float.IsNaN(goalRotation))) + { + HeadProjectile.Projectile.rotation = goalRotation * (mirror ? HeadProjectile.Projectile.velocity.X.DirectionalSign() : 1); + } + for (int i = 0; i < HeadProjectile.Segments.Count; i++) + { + + Vector2 pos1 = HeadProjectile.Projectile.Center; + float dist = HeadProjectile.SegmentTypePositionOffsets[0]; + if (i != 0) + { + dist = HeadProjectile.SegmentTypePositionOffsets[HeadProjectile.Segments[i - 1].segmentType + 1]; + } + dist *= HeadProjectile.Projectile.scale; + Vector2 rot = (HeadProjectile.Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); + if (rot == Vector2.Zero) + rot = HeadProjectile.Segments[0].Center.AngleTo(HeadProjectile.Projectile.Center).ToRotationVector2(); + if (i >= 1) + { + pos1 = HeadProjectile.Segments[i - 1].Center; + rot = HeadProjectile.Segments[i - 1].velocity.SafeNormalize(Vector2.Zero); + } + rot = rot.RotatedBy(goalSegmentRotOffsets[i] * (mirror ? HeadProjectile.Projectile.velocity.X.DirectionalSign() : 1)); + var dir = HeadProjectile.Segments[i].Center.DirectionFrom(pos1); + HeadProjectile.Segments[i].Center = pos1 + Vector2.Lerp(dir, -(rot), segmentRigidity) * dist; + HeadProjectile.Segments[i].velocity = HeadProjectile.Segments[i].Center.DirectionTo(pos1); + HeadProjectile.Segments[i].rotation = HeadProjectile.Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + } + + for (int i = 1; i < HeadProjectile.Segments.Count - 1; i++) + { + HeadProjectile.Segments[i].rotation = HeadProjectile.Segments[i + 1].Center.DirectionTo(HeadProjectile.Segments[i - 1].Center).ToRotation() + MathHelper.PiOver2; + } + } + } + } + } + #endregion + + #region Segment Class + /// + /// This class is used to store the information of each segment's location, size, and texture path + /// Due to the amount of segments, there is only one actual NPC for this boss + /// + public class BaseWormSegment + { + /// + /// The type of segment this is. Segment type is used to determine spacing and textures. + /// + public int segmentType = 0; + + /// + /// The position of the center of this segment + /// + public Vector2 Center = Vector2.Zero; + + /// + /// The rotation of this segment in radians + /// + public float rotation = 0; + + /// + /// The velocity this segment has. + /// Currently doesn't actually do anything besides be a token value if needed to be read by something + /// + public Vector2 velocity = Vector2.Zero; + /// + /// How opaque this segment is. Ranges from 1 (fully opaque) to 0 (fully transparent) + /// + public float Opacity = 1; + public BaseWormSegment(ModNPC Head, int segmentStyle = 0) + { + Center = Head.NPC.Center; + rotation = Head.NPC.rotation; + velocity = Head.NPC.velocity; + segmentType = segmentStyle; + } + + public BaseWormSegment(ModProjectile Head, int segmentStyle = 0) + { + Center = Head.Projectile.Center; + rotation = Head.Projectile.rotation; + velocity = Head.Projectile.velocity; + segmentType = segmentStyle; + } + } + #endregion + public abstract class BaseWormNPC : ModNPC + { + #region Abstracts & Commonly Overriden Fields + /// + /// The amount of segments of this worm. This does not include the head + /// + public abstract int SegmentCount { get; } + /// + /// A list of the offsets to the next segment in the worm from this segment + /// DOES include the head + /// + public abstract List SegmentTypePositionOffsets { get; } + /// + /// A list of all textures for the segments to draw with + /// does NOT include the head + /// + public abstract List SegmentTextures { get; } + /// + /// The type of the worm hitbox NPC + /// Make sure that NPC is a child of BaseWormHitboxNPC! + /// + public abstract int WormHitboxNpcType { get; } + /// + /// Offsets for drawing each segment + /// + public List SegmentTypeDrawOffsets = new List(); + + + /// + /// How far through the current animation this worm is + /// + public float AnimationFrame = 0; + /// + /// The active animation for the worm + /// + public WormAnimation ActiveAnimation = null; + #endregion + + #region Segments + /// + /// The list of all segments of this worm + /// + public List Segments = new(); + + /// + /// The textures for each segment type of this worm. Works like getting a texture from TextureAssets + /// + public List> SegmentTextureAssets + { + get + { + if (internalTexAssets.Count == 0) + for (var i = 0; i < SegmentTextures.Count; i++) + { + internalTexAssets.Add(ModContent.Request(SegmentTextures[i])); + if (SegmentTypeDrawOffsets.Count <= i) + { + SegmentTypeDrawOffsets.Add(Vector2.Zero); + } + } + return internalTexAssets; + } + } + + /// + /// Internal list that stores the textureassets. + /// Use SegmentTextureAssets to get the data stored here. + /// + private List> internalTexAssets = new List>(); + + public enum SegmentFollowLogic + { + Regular = 0, //Traditional worm segment logic + Exact = 1, //Follows the path the head took exactly + // In the future, add a segment logic that supports solid tile collisions and forces applied to *any* segment + } + + /// + /// Which type of segment following logic this worm should currently use + /// + public SegmentFollowLogic SegmentFollowType; + + /// + /// How rigid the segment should be when using default segment logic + /// + public float SegmentRigidity = 0.2f; + + /// + /// The points used by ExactSegmentLogic to exactly follow the head + /// + private List segmentPoints = new List(); + + /// + /// Updates the positions of the segments based on the value set in SegmentFollowType + /// + public void UpdateSegments() + { + NPC.position += NPC.velocity; //Update this segment's movement so that all other segments use this as the base. This is undone at the end of the method. + if (ActiveAnimation is not null) + { + ActiveAnimation.ApplyAnimationFrame(NPC, AnimationFrame); + AnimationFrame++; + if (AnimationFrame > ActiveAnimation.AnimationKeyframes.Keys.Max()) + { + AnimationFrame = 0; + ActiveAnimation = null; + } + } + else + { + if (segmentPoints.Count < 1 || segmentPoints[0].Distance(NPC.Center) > 8) + { + segmentPoints.Insert(0, NPC.Center); + } + while (segmentPoints.Count > 300) + { + segmentPoints.RemoveAt(segmentPoints.Count - 1); + } + switch (SegmentFollowType) + { + case (SegmentFollowLogic.Regular): + RegularSegmentLogic(); + break; + case (SegmentFollowLogic.Exact): + ExactSegmentLogic(); + break; + } + } + NPC.position -= NPC.velocity; + + //Spawning hitboxes for all the segments near the player + SpawnHitboxes(); + + } + + private void RegularSegmentLogic() + { + for (int i = 0; i < Segments.Count; i++) + { + float segmentDistance = SegmentTypePositionOffsets[0]; + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + { + aheadSeg = Segments[i - 1]; + segmentDistance = SegmentTypePositionOffsets[Segments[i - 1].segmentType + 1]; + } + segmentDistance *= NPC.scale; + Vector2 nexSegDir = aheadSeg.Center - thisSeg.Center; + if (aheadSeg.rotation != thisSeg.rotation) + { + nexSegDir = nexSegDir.RotatedBy(MathHelper.WrapAngle(aheadSeg.rotation - thisSeg.rotation) * SegmentRigidity); + nexSegDir = nexSegDir.MoveTowards((aheadSeg.rotation - thisSeg.rotation).ToRotationVector2(), 1f); + } + thisSeg.rotation = nexSegDir.ToRotation() + MathHelper.PiOver2; + thisSeg.Center = aheadSeg.Center - nexSegDir.SafeNormalize(Vector2.Zero) * segmentDistance; + + } + } + + private void ExactSegmentLogic() + { + float dist = 40f; + int segmentPointInUse = 0; + for (int i = 0; i < Segments.Count; i++) + { + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + aheadSeg = Segments[i - 1]; + bool hasMoved = false; + while (segmentPointInUse < segmentPoints.Count) + { + if (segmentPointInUse == 0) + { + if (aheadSeg.Center.Distance(segmentPoints[0]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[0]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + else + { + if (aheadSeg.Center.Distance(segmentPoints[segmentPointInUse]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[segmentPointInUse]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + } + if (!hasMoved && segmentPointInUse >= segmentPoints.Count) + { + thisSeg.Center = segmentPoints[segmentPoints.Count - 1]; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + } + } + + /// + /// Spawns the hitboxes for the worm's segments. + /// Won't spawn hitboxes if there's less than 5 avaliable NPC slots + /// + public virtual void SpawnHitboxes() + { + if (Main.netMode != NetmodeID.MultiplayerClient) + for (int i = 0; i < Segments.Count; i++) + { + if (Main.npc.Count(x => x.active) >= Main.maxNPCs - 5) + break; + if (Main.player.Any(x => x.active && Segments[i].Center.Distance(x.Center) < 1200)) + { + if (Main.npc.Any(x => x.active && x.type == WormHitboxNpcType && x.ai[1] == i && x.ai[0] == NPC.whoAmI)) + { + Main.npc.First(x => x.active && x.type == WormHitboxNpcType && x.ai[1] == i && x.ai[0] == NPC.whoAmI).ai[2] = 0; + } + else + NPC.NewNPC(NPC.GetSource_Misc("Hitbox"), (int)Segments[i].Center.X, (int)Segments[i].Center.Y + 100, WormHitboxNpcType, ai0: NPC.whoAmI, ai1: i); + } + } + } + #endregion + + #region Defaults + + public override void SetStaticDefaults() + { + NPCID.Sets.MustAlwaysDraw[Type] = true; + } + public override void SetDefaults() + { + for (var i = 0; i < SegmentCount - 1; i++) + { + Segments.Add(new BaseWormSegment(this, 0)); + } + Segments.Add(new BaseWormSegment(this, 1)); + } + + #endregion + + #region Draw + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + for (int i = Segments.Count - 1; i >= 0; i--) + { + DrawSegment(spriteBatch, screenPos, drawColor, Segments[i]); + } + spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - Main.screenPosition, null, drawColor, NPC.rotation, TextureAssets.Npc[Type].Value.Size() / 2, NPC.scale, SpriteEffects.None, 1); + return false; + } + + public virtual void DrawSegment(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor, BaseWormSegment segment) + { + var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); + if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) + { + return; + } + var tex = SegmentTextureAssets[segment.segmentType].Value; + spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color * segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), NPC.scale, SpriteEffects.None, 1); + } + #endregion + } + + //The segments near a player spawn a hitbox NPC to allow damaging players and taking damage + public abstract class BaseWormHitboxNPC : ModNPC + { + public override void SetDefaults() + { + NPC.width = 200; + NPC.height = 200; + NPC.lifeMax = 10000; + NPC.knockBackResist = 0; + NPC.noTileCollide = true; + NPC.aiStyle = -1; + } + + public override bool? CanBeHitByItem(Player player, Item item) + { + var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByItem(player, item); + if (canhit.HasValue && !canhit.Value) + return false; + return base.CanBeHitByItem(player, item); + } + + public override bool? CanBeHitByProjectile(Projectile projectile) + { + var canhit = Main.npc[(int)NPC.ai[0]].ModNPC.CanBeHitByProjectile(projectile); + if (canhit.HasValue && !canhit.Value) + return false; + return base.CanBeHitByProjectile(projectile); + } + + public override void AI() + { + var headNPC = Main.npc[(int)NPC.ai[0]]; + if (!(headNPC.ModNPC is BaseWormNPC && headNPC.active)) + { + NPC.active = false; + return; + } + NPC.realLife = (int)NPC.ai[0]; + NPC.damage = headNPC.damage; + NPC.lifeMax = headNPC.lifeMax; + NPC.life = headNPC.life; + NPC.Center = (headNPC.ModNPC as BaseWormNPC).Segments[(int)NPC.ai[1]].Center; + } + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + return false; + } + } +} diff --git a/NPCs/BrimstoneElemental/Brimling.cs b/NPCs/BrimstoneElemental/Brimling.cs index 478a14704b..b6b30908e0 100644 --- a/NPCs/BrimstoneElemental/Brimling.cs +++ b/NPCs/BrimstoneElemental/Brimling.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; // 0 contact damage, projectile damage values are pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.width = 60; NPC.height = 60; NPC.defense = 0; @@ -93,25 +93,18 @@ namespace CalamityMod.NPCs.BrimstoneElemental } // Variables for buffing the AI - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining for Brim float lifeRatio = Main.npc[CalamityGlobalNPC.brimstoneElemental].life / (float)Main.npc[CalamityGlobalNPC.brimstoneElemental].lifeMax; // Enraged Brim checks - bool biomeEnraged = Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().newAI[3] <= 0f || bossRush; - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].ZoneUnderworldHeight || bossRush)) - { - Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().CurrentlyEnraged = !bossRush; + bool biomeEnraged = Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().newAI[3] <= 0f; + float enrageScale = 0f; + if (biomeEnraged && !Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].ZoneUnderworldHeight) enrageScale += 1f; - } - if (biomeEnraged && (!Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Calamity().ZoneCalamity || bossRush)) - { - Main.npc[CalamityGlobalNPC.brimstoneElemental].Calamity().CurrentlyEnraged = !bossRush; + if (biomeEnraged && !Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Calamity().ZoneCalamity) enrageScale += 1f; - } // Brim phase checks bool brimIsAboutToTeleport = Main.npc[CalamityGlobalNPC.brimstoneElemental].ai[0] == 1f && Main.npc[CalamityGlobalNPC.brimstoneElemental].alpha == 0; @@ -153,7 +146,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { float projectileVelocity = 5f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = BrimstoneElemental.DartDamage; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocity * 3f); } } @@ -246,7 +239,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental { float projectileVelocity = 5f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = BrimstoneElemental.HellfireballDamage; SoundEngine.PlaySound(BrimstoneElemental.HellfireballSound, NPC.Center); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].Center - NPC.Center) * projectileVelocity, type, damage, 0f, Main.myPlayer, Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].position.X, Main.player[Main.npc[CalamityGlobalNPC.brimstoneElemental].target].position.Y); } diff --git a/NPCs/BrimstoneElemental/BrimstoneElemental.cs b/NPCs/BrimstoneElemental/BrimstoneElemental.cs index 7a5a563e17..306bc4ec15 100644 --- a/NPCs/BrimstoneElemental/BrimstoneElemental.cs +++ b/NPCs/BrimstoneElemental/BrimstoneElemental.cs @@ -15,10 +15,12 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Enemy; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -63,14 +65,21 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPCID.Sets.MPAllowedEnemies[Type] = true; } + // These values are all applied alongside their respective GFB attacks (too many to list) + public static int DartDamage = 19; // 76 + public static int HellblastDamage = 24; // 96 + public static int HellfireballDamage = 24; // 96 + public static int RayDamage = 35; // 140 + public override void SetDefaults() { NPC.npcSlots = 64f; - NPC.GetNPCDamage(); + NPC.damage = 56; // 112 + NPC.Calamity().canBreakPlayerDefense = true; NPC.width = 100; NPC.height = 150; NPC.defense = 15; - NPC.value = Item.buyPrice(0, 16, 0, 0); + NPC.value = Item.buyPrice(gold: 12); NPC.LifeMaxNERB(41000, 49200, 500000); NPC.DR_NERD(0.2f); NPC.knockBackResist = 0f; @@ -86,9 +95,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -123,7 +129,681 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void AI() { - BrimstoneElementalAI.VanillaBrimstoneElementalAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Used for Brimling AI states + CalamityGlobalNPC.brimstoneElemental = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.2f, 0f, 0f); + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + bool despawnDistance = Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; + + if (!player.active || player.dead || despawnDistance) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || despawnDistance) + { + NPC.rotation = NPC.velocity.X * 0.04f; + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Reset defense + NPC.defense = NPC.defDefense; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = NPC.ai[0] == 4f; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Variables for buffing the AI + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + bool phase2 = lifeRatio < 0.5f && revenge; + bool phase3 = lifeRatio < 0.33f; + + // Enrage + if ((!player.ZoneUnderworldHeight || !player.Calamity().ZoneCalamity) && !BossRushEvent.BossRushActive) + { + if (calamityGlobalNPC.newAI[3] > 0f) + calamityGlobalNPC.newAI[3] -= 1f; + } + else + calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f; + + float enrageScale = 0f; + if (biomeEnraged && !player.ZoneUnderworldHeight) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 0.5f; + } + if (biomeEnraged && !player.Calamity().ZoneCalamity) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + NPC.Calamity().DR = NPC.ai[0] == 4f ? 0.6f : 0.2f; + + // Emit dust + int dustAmt = (NPC.ai[0] == 2f) ? 2 : 1; + int size = (NPC.ai[0] == 2f) ? 50 : 35; + if (NPC.ai[0] != 1f) + { + for (int i = 0; i < 2; i++) + { + if (Main.rand.Next(3) < dustAmt) + { + int dust = Dust.NewDust(NPC.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, NPC.velocity.X * 0.5f, NPC.velocity.Y * 0.5f, 90, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.2f; + Main.dust[dust].fadeIn = 1f; + } + } + } + + // Distance from destination where Brimmy stops moving + float movementDistanceGateValue = 100f; + + // How fast Brimmy moves to the destination + float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (NPC.ai[0] == 5f ? 0.05f : NPC.ai[0] == 3f ? 1.5f : 1f); + baseVelocity += 3f * enrageScale; + if (expertMode) + baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); + + float baseAcceleration = (death ? 0.12f : 0.1f) * (NPC.ai[0] == 5f ? 0.5f : NPC.ai[0] == 3f ? 1.5f : 1f); + baseAcceleration += 0.06f * enrageScale; + if (expertMode) + baseAcceleration += 0.03f * (1f - lifeRatio); + + // This is where Brimmy should be + Vector2 destination = NPC.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); + + // How far Brimmy is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.ai[0] != 4f) + CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Rotation and direction + if (NPC.ai[0] <= 2f || NPC.ai[0] == 5f) + { + NPC.rotation = NPC.velocity.X * 0.04f; + if (NPC.ai[0] != 5 || (NPC.ai[1] < 180f && NPC.ai[0] == 5f)) + { + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + } + } + + if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. + { + int newMode; + if (lifeRatio <= 0.8f && lifeRatio > 0.6f) + { + newMode = 1; // Sand + } + else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) + { + newMode = 2; // Rare Sand + } + else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) + { + newMode = 3; // Cloud + } + else if (lifeRatio <= 0.2f) + { + newMode = 4; // Water + } + else + { + newMode = 0; // Brimstone, default + } + if (newMode != currentMode) + { + SoundEngine.PlaySound(SoundID.Item29, NPC.Center); + } + currentMode = newMode; + } + + if (NPC.ai[0] == -1f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int phase; + int random = phase2 ? 6 : 5; + do phase = Main.rand.Next(random); + while (phase == NPC.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && NPC.localAI[3] != 0f)); + + NPC.ai[0] = phase; + NPC.ai[1] = 0f; + + // Cocoon phase cooldown + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + else if (phase == 4) + { + NPC.localAI[3] = 3f; + SoundEngine.PlaySound(HideInShellSound, player.Center); + } + + // Prevent netUpdate from being blocked by the spam counter. + // A phase switch sync is a critical operation that must be synced. + NPC.ForceNetUpdate(false); + } + } + + // Pick a location to teleport to + else if (NPC.ai[0] == 0f) + { + NPC.chaseable = true; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + + if (NPC.localAI[1] >= (death ? 120f : 180f)) + { + NPC.TargetClosest(); + NPC.localAI[1] = 0f; + int timer = 0; + int playerPosX; + int playerPosY; + while (true) + { + timer++; + playerPosX = (int)player.Center.X / 16; + playerPosY = (int)player.Center.Y / 16; + + int min = 12; + int max = 16; + + if (Main.rand.NextBool()) + playerPosX += Main.rand.Next(min, max); + else + playerPosX -= Main.rand.Next(min, max); + + if (Main.rand.NextBool()) + playerPosY += Main.rand.Next(min, max); + else + playerPosY -= Main.rand.Next(min, max); + + if (!WorldGen.SolidTile(playerPosX, playerPosY)) + break; + + if (timer > 100) + return; + } + NPC.ai[0] = 1f; + NPC.ai[1] = playerPosX; + NPC.ai[2] = playerPosY; + NPC.netUpdate = true; + } + } + } + + // Teleport to location + else if (NPC.ai[0] == 1f) + { + // Disable contact damage for some time while fading away + NPC.damage = 0; + + NPC.chaseable = true; + Vector2 position = new Vector2(NPC.ai[1] * 16f - (NPC.width / 2), NPC.ai[2] * 16f - (NPC.height / 2)); + for (int m = 0; m < 5; m++) + { + int dust = Dust.NewDust(position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + NPC.alpha += death ? 5 : revenge ? 4 : expertMode ? 3 : 2; + if (NPC.alpha >= 255) + { + int spawnType = currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); + int enemyCount = currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && currentMode != 2) // dont spawn anything if gfb rare sand + { + for (int i = 0; i < enemyCount; i++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, spawnType); + } + SoundEngine.PlaySound(TeleportSound, NPC.Center); + NPC.alpha = 255; + NPC.position = position; + for (int n = 0; n < 15; n++) + { + int warpDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f); + Main.dust[warpDust].noGravity = true; + } + NPC.ai[0] = 2f; + NPC.netUpdate = true; + } + } + + // Either teleport again or go to next AI state + else if (NPC.ai[0] == 2f) + { + if (NPC.alpha >= 255) + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SoundID.Item68, NPC.Center); + int type = ModContent.ProjectileType(); + int damage = RayDamage; + Vector2 pos = NPC.Center; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + if (currentMode >= 1 && currentMode <= 3) + { + int tornadoType = currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); + } + } + if (currentMode == 2) + { + int healAmt = NPC.lifeMax / 25; + if (healAmt > 0) + { + NPC.life += healAmt; + NPC.HealEffect(healAmt, true); + NPC.netUpdate = true; + } + } + } + } + + NPC.alpha -= 50; + if (NPC.alpha <= 0) + { + // Restore contact damage once returned to proper opacity + NPC.damage = NPC.defDamage; + NPC.chaseable = true; + NPC.ai[3] += 1f; + NPC.alpha = 0; + if (NPC.ai[3] >= 2f || phase2 || Main.getGoodWorld) + { + NPC.ai[0] = -1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else + { + NPC.ai[0] = 0f; + } + NPC.netUpdate = true; + } + } + + // Float above target and fire projectiles + else if (NPC.ai[0] == 3f) + { + NPC.chaseable = true; + NPC.rotation = NPC.velocity.X * 0.04f; + + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; + divisor -= 3f * enrageScale; + float divisor2 = divisor * 2f; + + if (NPC.ai[1] % divisor == divisor - 1f) + { + float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); + int type = ModContent.ProjectileType(); + int damage = HellfireballDamage; + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item30, player.Center); + } + else + { + SoundEngine.PlaySound(HellfireballSound, player.Center); + } + Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].timeLeft = 240; + } + + if (NPC.ai[1] % divisor2 == divisor2 - 1f) + { + velocity = (death ? 5f : 4f) + 2f * enrageScale; + type = ModContent.ProjectileType(); + damage = DartDamage; + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item21, player.Center); + } + else + { + SoundEngine.PlaySound(DartSound, player.Center); + } + projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; + int numProj = death ? 8 : 4; + int spread = death ? 90 : 45; + if (Main.getGoodWorld) + { + numProj *= 3; + spread *= 2; + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float rotation = MathHelper.ToRadians(spread); + float projectileVelocityToPass = velocity * 3f; + for (int i = 0; i < numProj; i++) + { + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + } + } + } + } + + if (NPC.ai[1] >= divisor * (death ? 5f : 10f)) + { + NPC.TargetClosest(); + NPC.ai[0] = -1f; + NPC.ai[1] = 3f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + } + + // Cocoon bullet hell + else if (NPC.ai[0] == 4f) + { + NPC.defense = NPC.defDefense * 4; + + NPC.chaseable = false; + NPC.localAI[0] += 1f; + if (Main.getGoodWorld) + NPC.localAI[0] += 2f; + if (expertMode) + NPC.localAI[0] += 1f - lifeRatio; + NPC.localAI[0] += enrageScale; + + if (NPC.localAI[0] >= 120f) + { + NPC.localAI[0] = 0f; + + float projectileSpeed = death ? 9f : revenge ? 8f : 6f; + projectileSpeed += 2f * enrageScale; + + Vector2 projectileVelocity = player.Center - NPC.Center; + + float radialOffset = 0.2f; + float diameter = 80f; + + projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; + + Vector2 velocity = projectileVelocity; + velocity = velocity.SafeNormalize(Vector2.UnitY); + velocity *= diameter; + + int totalProjectiles = 6; + float offsetAngle = MathHelper.Pi * radialOffset; + int type = ModContent.ProjectileType(); + int damage = HellblastDamage; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int j = 0; j < totalProjectiles; j++) + { + float radians = j - (totalProjectiles - 1f) / 2f; + Vector2 offset = velocity.RotatedBy(offsetAngle * radians); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Main.projectile[proj].timeLeft = 300; + Main.projectile[proj].tileCollide = false; + } + } + + totalProjectiles = 12; + float radians2 = MathHelper.TwoPi / totalProjectiles; + type = ModContent.ProjectileType(); + damage = DartDamage; + if (currentMode == 4) + { + type = ModContent.ProjectileType(); + SoundEngine.PlaySound(SoundID.Item26, player.Center); + } + else + { + SoundEngine.PlaySound(ShellFireSound, player.Center); + } + double angleA = radians2 * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float projectileVelocityToPass = projectileSpeed * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + } + + if (death) + { + spinningPoint = NPC.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); + } + } + } + + NPC.localAI[2] += 1f; + } + + NPC.velocity *= 0.95f; + NPC.rotation = NPC.velocity.X * 0.04f; + float playerLocation = NPC.Center.X - player.Center.X; + NPC.direction = playerLocation < 0f ? 1 : -1; + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (death ? 240f : 300f)) + { + NPC.TargetClosest(); + NPC.ai[0] = -1f; + NPC.ai[1] = 4f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] = 0f; + NPC.netUpdate = true; + } + } + + // Laser beam attack + else if (NPC.ai[0] == 5f) + { + NPC.chaseable = true; + + NPC.defense = NPC.defDefense * 2; + + Vector2 source = new Vector2(NPC.Center.X + (NPC.spriteDirection > 0 ? 34f : -34f), NPC.Center.Y - 74f); + Vector2 aimAt = player.Center + player.velocity * 20f; + float aimResponsiveness = (NPC.ai[2] == 1f || death) ? 0.1f : 0.25f; + + Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); + if (aimVector.HasNaNs()) + aimVector = -Vector2.UnitY; + aimVector = Vector2.Lerp(aimVector, NPC.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness).SafeNormalize(Vector2.UnitY); + aimVector *= 6f; + + Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); + if (laserVelocity.HasNaNs()) + laserVelocity = -Vector2.UnitY; + + calamityGlobalNPC.newAI[1] = laserVelocity.X; + calamityGlobalNPC.newAI[2] = laserVelocity.Y; + + // Rev = 190 + 165 = 355 + // Death = 165 + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 240f) + { + NPC.TargetClosest(); + NPC.ai[2] += 1f; + NPC.localAI[0] = 0f; + NPC.localAI[1] = 0f; + if (NPC.ai[2] >= (death ? 1f : 2f)) + { + NPC.ai[0] = -1f; + NPC.ai[1] = 5f; + NPC.ai[2] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + else + { + NPC.ai[1] = 0f; + calamityGlobalNPC.newAI[0] = 0f; + } + } + else if (NPC.ai[1] >= 180f) + { + NPC.velocity *= 0.95f; + if (NPC.ai[1] == 180f) + { + SoundEngine.PlaySound(SoundID.Item68, source); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 laserVelocity2 = new Vector2(NPC.localAI[0], NPC.localAI[1]); + laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); + int type = ModContent.ProjectileType(); + int damage = RayDamage; + + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + } + } + } + else + { + float playSoundTimer = 30f; + if (NPC.ai[1] < 150f) + { + switch ((int)NPC.ai[2]) + { + case 0: + NPC.ai[1] += 0.5f; + break; + case 1: + NPC.ai[1] += 1f; + playSoundTimer = 40f; + break; + } + if (death) + { + NPC.ai[1] += 0.5f; + playSoundTimer += 10f; + } + } + + if (NPC.ai[1] % playSoundTimer == 0f) + SoundEngine.PlaySound(SoundID.Item20, NPC.Center); + + if (NPC.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, NPC.whoAmI); + } + } + + calamityGlobalNPC.newAI[0] = 1f; + } + else + { + if (NPC.ai[1] == 150f) + { + NPC.localAI[0] = laserVelocity.X; + NPC.localAI[1] = laserVelocity.Y; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + + if (Main.zenithWorld) + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, -NPC.localAI[0], NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source.X, source.Y, NPC.localAI[0], -NPC.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, NPC.whoAmI); + } + } + } + } + } + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -134,7 +814,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } public override void FindFrame(int frameHeight) // 9 total frames @@ -186,14 +866,14 @@ namespace CalamityMod.NPCs.BrimstoneElemental } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); @@ -220,7 +900,7 @@ namespace CalamityMod.NPCs.BrimstoneElemental normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); // Vanity - normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), 7); normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); } @@ -255,7 +935,6 @@ namespace CalamityMod.NPCs.BrimstoneElemental public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Bumblebirb/Bumblefuck.cs b/NPCs/Bumblebirb/Bumblefuck.cs deleted file mode 100644 index a5b097b190..0000000000 --- a/NPCs/Bumblebirb/Bumblefuck.cs +++ /dev/null @@ -1,539 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Events; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Mounts; -using CalamityMod.Items.Placeables.Furniture.BossRelics; -using CalamityMod.Items.Placeables.Furniture.DevPaintings; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.Potions; -using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.ItemDropRules; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Bumblebirb -{ - [AutoloadBossHead] - public class Bumblefuck : ModNPC - { - public static Asset GlowTexture; - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Scale = 0.5f, - PortraitScale = 0.85f, - PortraitPositionYOverride = 14f - }; - value.Position.X += 20f; - value.Position.Y += 8f; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - NPCID.Sets.MPAllowedEnemies[Type] = true; - if (!Main.dedServ) - { - GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); - } - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; - public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; - - public override void SetDefaults() - { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.npcSlots = 32f; - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.width = 130; - NPC.height = 100; - NPC.defense = 40; - NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500 - NPC.knockBackResist = 0f; - NPC.boss = true; - NPC.noTileCollide = true; - NPC.lavaImmune = true; - NPC.noGravity = true; - NPC.value = Item.buyPrice(1, 0, 0, 0); - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - NPC.Calamity().VulnerableToElectricity = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") - }); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - for (int i = 0; i < 4; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - for (int i = 0; i < 4; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirbAI(NPC, Mod); - } - - public override void FindFrame(int frameHeight) - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); - bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; - - // Animation goes nyoom - if (Main.zenithWorld) - { - NPC.frameCounter += 4; - } - - float newPhaseTimer = 180f; - bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || - (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - - if (phaseSwitchPhase || birbSpawn) - { - float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; - int frameTimer = 180; - if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20)) - { - NPC.frameCounter += 1D; - if (NPC.frameCounter > 5D) - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 5) - { - NPC.frame.Y = 0; - } - } - else - { - NPC.frame.Y = frameHeight * 4; - if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) - { - NPC.frame.Y = frameHeight * 5; - } - } - } - else if (NPC.ai[0] == 5f) - { - int otherFrameTimer = 120; - if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10)) - { - NPC.frameCounter += 1D; - if (NPC.frameCounter > 5D) - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 5) - { - NPC.frame.Y = 0; - } - } - else - { - NPC.frame.Y = frameHeight * 4; - if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) - { - NPC.frame.Y = frameHeight * 5; - } - } - } - else - { - NPC.frameCounter += (NPC.ai[0] == 3.2f ? 1.5 : 1D); - if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 5) - { - NPC.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); - - float newPhaseTimer = 180f; - bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || - (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); - Color color = drawColor; - Color altColor = Color.White; - - float lerpDrawTransition = 0f; - int newAITracker = 120; - int buffColorDampener = 60; - - if (phase3 && calamityGlobalNPC.newAI[3] == 1f) - { - color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.6f, 0.2f, 1f); - } - else if (phase2 && calamityGlobalNPC.newAI[2] == 1f) - { - color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); - } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) - { - float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker; - phase2TranBuff /= (float)buffColorDampener; - color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f); - } - - int afterimageAmt = 10; - int afterimageIncrement = 2; - if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) - { - afterimageAmt = 4; - } - if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) - { - afterimageAmt = 7; - } - if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) - { - altColor = Color.Yellow; - lerpDrawTransition = 0.5f; - } - else - { - color = altColor; - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += afterimageIncrement) - { - Color afterimageColor = color; - afterimageColor = Color.Lerp(afterimageColor, altColor, lerpDrawTransition); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (float)(afterimageAmt - i) / 15f; - Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - int extraAfterimageAmt = 0; - float extraAfterimageDampener = 0f; - float afterimageScaler = 0f; - - if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) - { - extraAfterimageAmt = 4; - } - - if (NPC.ai[0] == 5f) - { - if (NPC.ai[1] > 60f) - { - extraAfterimageAmt = 6; - extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi)); - extraAfterimageDampener /= 3f; - afterimageScaler = 40f; - } - } - - if (phaseSwitchPhase) - { - if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker) - { - extraAfterimageAmt = 6; - extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); - extraAfterimageDampener /= 3f; - afterimageScaler = 60f; - } - else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) - { - extraAfterimageAmt = 6; - extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); - extraAfterimageDampener /= 3f; - afterimageScaler = 60f; - } - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int j = 0; j < extraAfterimageAmt; j++) - { - Color extraAfterimageColor = altColor; - extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, lerpDrawTransition); - extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); - extraAfterimageColor *= 1f - extraAfterimageDampener; - Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; - extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - Color mainDrawingColor = altColor; - mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); - mainDrawingColor = NPC.GetAlpha(mainDrawingColor); - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - - if (phase2) - { - texture2D15 = GlowTexture.Value; - Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); - altColor = Color.Red; - - lerpDrawTransition = 1f; - extraAfterimageDampener = 0.5f; - afterimageScaler = 10f; - afterimageIncrement = 1; - - if (phaseSwitchPhase) - { - float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; - glowmaskDampener /= (float)buffColorDampener; - altColor *= glowmaskDampener; - glowmaskColor *= glowmaskDampener; - } - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int k = 1; k < afterimageAmt; k += afterimageIncrement) - { - Color glowmaskAfterimageColor = glowmaskColor; - glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition); - glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; - Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; - glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - - for (int l = 1; l < extraAfterimageAmt; l++) - { - Color extraGlowmaskAfterimageColor = glowmaskColor; - extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, lerpDrawTransition); - extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); - extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; - Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; - extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - - return false; - } - - private static Color buffColor(Color newColor, float R, float G, float B, float A) - { - newColor.R = (byte)((float)newColor.R * R); - newColor.G = (byte)((float)newColor.G * G); - newColor.B = (byte)((float)newColor.B * B); - newColor.A = (byte)((float)newColor.A * A); - return newColor; - } - - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.SuperHealingPotion; - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); - - // Normal drops: Everything that would otherwise be in the bag - var normalOnly = npcLoot.DefineNormalOnlyDropSet(); - { - // Weapons - int[] items = new int[] - { - ModContent.ItemType(), - ModContent.ItemType(), - ModContent.ItemType() - }; - normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); - normalOnly.Add(ModContent.ItemType(), 10); - - // Materials - normalOnly.Add(ModContent.ItemType(), 1, 25, 30); - - // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - - // Vanity - normalOnly.Add(ModContent.ItemType(), 7); - normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); - } - - npcLoot.Add(ModContent.ItemType(), 10); - - // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); - - // GFB Omega Healing Potion drop - npcLoot.DefineConditionalDropSet(DropHelper.GFB).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 50, 100), true); - - // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), Main.zenithWorld ? 360 : 180); - } - - public override void OnKill() - { - // Don't bother running any of this in Boss Rush. - if (BossRushEvent.BossRushActive) - return; - - CalamityGlobalNPC.SetNewBossJustDowned(NPC); - - // Mark The Dragonfolly as dead - DownedBossSystem.downedDragonfolly = true; - CalamityNetcode.SyncWorld(); - - if (Main.zenithWorld) - { - int spacing = 40; - int amt = 7; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - - } - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (!Main.dedServ) - { - for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now - { - string gore = "Bumble"; - float randomSpread = Main.rand.Next(-200, 201) / 100f; - gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find(gore).Type, 1f); - } - } - } - } - } -} diff --git a/NPCs/Bumblebirb/Bumblefuck2.cs b/NPCs/Bumblebirb/Bumblefuck2.cs deleted file mode 100644 index ef8f02eaf5..0000000000 --- a/NPCs/Bumblebirb/Bumblefuck2.cs +++ /dev/null @@ -1,153 +0,0 @@ -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.Bumblebirb -{ - public class Bumblefuck2 : ModNPC - { - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - NPCID.Sets.TrailingMode[Type] = 1; - this.HideFromBestiary(); - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.width = 120; - NPC.height = 80; - NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); - NPC.knockBackResist = 0.15f; - NPC.lavaImmune = true; - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, true); - } - - public override void OnKill() - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 5; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; - if (Main.zenithWorld) - { - NPC.frameCounter += 2D; - } - if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 4) - { - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); - int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (afterimageAmt - i) / 15f; - Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void ModifyTypeName(ref string typeName) - { - if (Main.zenithWorld) - { - typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); - } - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/Bumblebirb/DraconicSwarmer.cs b/NPCs/Bumblebirb/DraconicSwarmer.cs new file mode 100644 index 0000000000..86b4ac4ff2 --- /dev/null +++ b/NPCs/Bumblebirb/DraconicSwarmer.cs @@ -0,0 +1,355 @@ +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Bumblebirb +{ + public class DraconicSwarmer : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; + this.HideFromBestiary(); + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; + + public override void SetDefaults() + { + NPC.damage = 96; // 192 + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + AIType = -1; + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); + NPC.knockBackResist = 0.15f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + } + + public override void AI() + { + Player player = Main.player[NPC.target]; + + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + if (NPC.timeLeft > 5) + NPC.timeLeft = 5; + } + + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + if (NPC.ai[0] == 0f || NPC.ai[0] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + { + Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; + if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) + { + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + NPC.velocity += otherSwarmerDirection; + NPC nPC6 = Main.npc[i]; + nPC6.velocity -= otherSwarmerDirection; + } + } + } + } + + if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + { + NPC.TargetClosest(true); + Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 5600f) + NPC.ai[0] = -1f; + } + else + { + Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) + NPC.ai[0] = 1f; + } + + if (NPC.ai[0] == -1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f; + return; + } + + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; + + Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerIdleTargetDist.Length() > 2800f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else if (swarmerIdleTargetDist.Length() > 400f) + { + float swarmerIdleSpeed = 9f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 90f) + { + NPC.ai[1] = 0f; + NPC.ai[0] = 2f; + } + } + else + { + if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead) + NPC.TargetClosest(true); + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + Vector2 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + + NPC.ai[2] += 0.0166666675f; + float swarmerChargeSpeed = 12f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; + + NPC.ForceNetUpdate(); + + return; + } + + if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f; + + Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = 18f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.velocity = swarmerDecelerateTargetDist; + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 2.1f; + NPC.ai[1] = 0f; + } + } + else if (NPC.ai[0] == 2.1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.velocity *= 1.01f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 30f) + { + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + return; + } + + if (NPC.ai[1] > 60f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + } + } + } + } + + public override void OnKill() + { + int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); + if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) + Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), Dragonfolly.LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (Main.zenithWorld) + { + NPC.frameCounter += 2D; + } + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 4) + { + NPC.frame.Y = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + return false; + } + + public override void ModifyTypeName(ref string typeName) + { + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + } +} diff --git a/NPCs/Bumblebirb/Dragonfolly.cs b/NPCs/Bumblebirb/Dragonfolly.cs new file mode 100644 index 0000000000..7a0926637d --- /dev/null +++ b/NPCs/Bumblebirb/Dragonfolly.cs @@ -0,0 +1,1347 @@ +using System; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Events; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Mounts; +using CalamityMod.Items.Placeables.Furniture.BossRelics; +using CalamityMod.Items.Placeables.Furniture.DevPaintings; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Potions; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.NPCs.Bumblebirb +{ + [AutoloadBossHead] + public class Dragonfolly : ModNPC + { + public static Asset GlowTexture; + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 6; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Scale = 0.5f, + PortraitScale = 0.85f, + PortraitPositionYOverride = 14f + }; + value.Position.X += 20f; + value.Position.Y += 8f; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.MPAllowedEnemies[Type] = true; + if (!Main.dedServ) + { + GlowTexture = ModContent.Request("CalamityMod/NPCs/Bumblebirb/BirbGlow", AssetRequestMode.AsyncLoad); + } + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/Birb"; + public override string BossHeadTexture => "CalamityMod/NPCs/Bumblebirb/Birb_Head_Boss"; + + public static float DashDamageMult = 1.5f; // 240 + public static int FeatherDamage = 36; // 144 + public static int LightningDamage = 64; // 256 + + public override void SetDefaults() + { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 80; // 160 + NPC.npcSlots = 32f; + NPC.aiStyle = -1; + AIType = -1; + NPC.width = 130; + NPC.height = 100; + NPC.defense = 40; + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(187500, 225000, 300000); // Old HP - 227500, 252500 + NPC.knockBackResist = 0f; + NPC.boss = true; + NPC.noTileCollide = true; + NPC.lavaImmune = true; + NPC.noGravity = true; + NPC.value = Item.buyPrice(gold: 50); + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = false; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Bumblefuck") + }); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.localAI[0]); + writer.Write(NPC.localAI[1]); + writer.Write(NPC.localAI[2]); + writer.Write(NPC.localAI[3]); + for (int i = 0; i < 4; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.localAI[0] = reader.ReadSingle(); + NPC.localAI[1] = reader.ReadSingle(); + NPC.localAI[2] = reader.ReadSingle(); + NPC.localAI[3] = reader.ReadSingle(); + for (int i = 0; i < 4; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void AI() + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Variables + float rotationMult = 3f; + float rotationAmt = 0.03f; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Adjust slowing debuff immunity + bool immuneToSlowingDebuffs = NPC.ai[0] == 3f || NPC.ai[0] == 3.1f || NPC.ai[0] == 3.2f; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; + NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; + + // If target is outside the jungle for more than 5 seconds, enrage + if (!player.ZoneJungle && !BossRushEvent.BossRushActive) + { + if (NPC.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) + NPC.localAI[1] += 1f; + } + else + NPC.localAI[1] = 0f; + + // If dragonfolly is off screen, enrage for the next couple attacks + if (Vector2.Distance(player.Center, NPC.Center) > 1200f) + NPC.localAI[2] = 2f; + + // Enrage scale + float enrageScale = death ? 1.5f : 1f; + if (NPC.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax) + { + NPC.Calamity().CurrentlyEnraged = true; + enrageScale += 1f; + } + + if (NPC.localAI[2] > 0f) + enrageScale += 1f; + + if (Main.getGoodWorld) + enrageScale += 0.5f; + + if (enrageScale > 3f) + enrageScale = 3f; + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.2f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[0] != 0f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + } + + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; + + float birbSpawnPhaseTimer = 180f; + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + calamityGlobalNPC.DR = phaseSwitchPhase || NPC.ai[0] == 5f || enrageScale == 3f ? 0.55f : 0.1f; + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || NPC.ai[0] == 5f || enrageScale == 3f; + + if (phaseSwitchPhase) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + if (phase3) + { + calamityGlobalNPC.newAI[1] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 5; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + calamityGlobalNPC.newAI[3] = 1f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.SyncExtraAI(); + NPC.ForceNetUpdate(false); + } + } + else + { + calamityGlobalNPC.newAI[0] += 1f; + + // Sound + if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 20; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[2] = 1f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.SyncExtraAI(); + NPC.ForceNetUpdate(false); + } + } + + Vector2 follyTargetDirection = player.Center - NPC.Center; + float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + NPC.velocity = (NPC.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + return; + } + + // Max spawn amount + int maxBirbs = Main.zenithWorld ? 12 : revenge ? 3 : 2; + + // Variable for charging + float chargeDistance = 600f; + if (phase2) + chargeDistance -= 50f; + if (phase3) + chargeDistance -= 50f; + chargeDistance -= (enrageScale - 1f) * 100f; + + // Phase switch + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.Center.X < player.Center.X - 2f) + NPC.direction = 1; + if (NPC.Center.X > player.Center.X + 2f) + NPC.direction = -1; + + // Direction and rotation + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + // Fly to target if target is too far away, otherwise get close to target and then slow down + Vector2 follyFlyTargetDirection = player.Center - NPC.Center; + follyFlyTargetDirection.Y -= 200f; + if (follyFlyTargetDirection.Length() > 2800f) + { + NPC.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + else if (follyFlyTargetDirection.Length() > 240f) + { + float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; + float follyFlyVelocityMult = 30f; + follyFlyTargetDirection.Normalize(); + follyFlyTargetDirection *= follyFlySpeed; + NPC.velocity = (NPC.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + // Phase switch + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 30f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + while (NPC.ai[0] == 0f) + { + if (phase2) + NPC.localAI[0] += 1f; + + if (NPC.localAI[0] >= (phase3 ? 7 : 9)) + { + NPC.TargetClosest(); + NPC.ai[0] = 5f; + NPC.localAI[0] = 0f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Decrease amount of attacks until able to spawn small birbs again + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + } + else + { + int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); + if (phase3) + follyAttackPicker = 1; + + float featherVelocity = 2f + (enrageScale - 1f); + int type = ModContent.ProjectileType(); + + if (follyAttackPicker == 0 && NPC.localAI[3] == 0f) + { + NPC.TargetClosest(); + NPC.ai[0] = 2f; + + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Birb will do at least 1 different attack before entering this phase again + NPC.localAI[3] = 1f; + } + else if (follyAttackPicker == 1) + { + NPC.TargetClosest(); + NPC.ai[0] = 3f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + // Decrease amount of attacks until able to use other attacks again + if (NPC.localAI[3] > 0f) + NPC.localAI[3] -= 1f; + + if (phase2 && NPC.ai[3] == 0f) + { + NPC.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = 40; + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = 800; + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (Main.getGoodWorld) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + } + else + { + if (spawnRight) + { + if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + } + else + { + if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + } + } + else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && NPC.localAI[3] == 0f) + { + NPC.TargetClosest(); + NPC.ai[0] = 4f; + + // Birb will do at least 2 different attacks before entering this phase again + NPC.localAI[3] = 2f; + + // Decrease enraged attacks by 1 + if (NPC.localAI[2] > 0f) + NPC.localAI[2] -= 1f; + + if (NPC.ai[3] == 0f) + { + NPC.ai[3] = 3f; + SoundEngine.PlaySound(SoundID.Item102, player.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int totalProjectiles = phase2 ? 40 : 48; + + if (Main.getGoodWorld) + totalProjectiles *= 2; + + float radians = MathHelper.TwoPi / totalProjectiles; + int distance = phase2 ? 1200 : 1320; + + if (Main.getGoodWorld) + distance *= 2; + + bool spawnRight = player.velocity.X > 0f; + for (int i = 0; i < totalProjectiles; i++) + { + if (spawnRight) + { + if (i >= totalProjectiles / 2) + break; + + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + else + { + if (i >= totalProjectiles / 2) + { + Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; + Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, FeatherDamage, 0f, Main.myPlayer); + } + } + } + } + } + else + { + // Decrease the feather variable, feathers can be used again if it's at 0 + if (NPC.ai[3] > 0f) + NPC.ai[3] -= 1f; + } + } + } + } + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Fly to target + else if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + Vector2 follyTargetDirection = player.Center - NPC.Center; + if (follyTargetDirection.Length() < 800f) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + float velocity = 14f + (enrageScale - 1f) * 4f; + float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; + float follyVelocityMult = 25f; + follyTargetDirection.Normalize(); + follyTargetDirection *= follyTargetDistance; + NPC.velocity = (NPC.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; + } + + // Fly towards target quickly + else if (NPC.ai[0] == 2f) + { + NPC.damage = NPC.defDamage; + + if (NPC.target < 0 || !player.active || player.dead) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + if (player.Center.X - 10f < NPC.Center.X) + NPC.direction = -1; + else if (player.Center.X + 10f > NPC.Center.X) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 1.25f) / 5f; + + Vector2 follyQuickFlyTargetDirection = player.Center - NPC.Center; + follyQuickFlyTargetDirection.Y -= 20f; + NPC.ai[2] += 0.0222222228f; + if (expertMode) + NPC.ai[2] += 0.0166666675f; + + float velocity = 8f + (enrageScale - 1f) * 2f; + float follyQuickFlySpeed = velocity + NPC.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; + if (Main.getGoodWorld) + follyQuickFlySpeed *= 2f; + + float follyQuickFlyVelMult = 20f; + follyQuickFlyTargetDirection.Normalize(); + follyQuickFlyTargetDirection *= follyQuickFlySpeed; + NPC.velocity = (NPC.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= (Main.getGoodWorld ? 90f : 180f)) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Line up charge + else if (NPC.ai[0] == 3f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 follyLineUpTargetDirection = player.Center - NPC.Center; + follyLineUpTargetDirection.Y -= 12f; + if (NPC.Center.X > player.Center.X) + follyLineUpTargetDirection.X += chargeDistance; + else + follyLineUpTargetDirection.X -= chargeDistance; + + float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; + if (Math.Abs(NPC.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(NPC.Center.Y - player.Center.Y) < verticalDistanceGateValue) + { + NPC.ai[0] = 3.1f; + NPC.ai[1] = 0f; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + + NPC.ai[1] += 0.0333333351f; + float velocity = 16f + (enrageScale - 1f) * 4f; + float follyLineUpSpeed = velocity + NPC.ai[1]; + float follyLineUpVelMult = 4f; + follyLineUpTargetDirection.Normalize(); + follyLineUpTargetDirection *= follyLineUpSpeed; + NPC.velocity = (NPC.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; + } + + // Prepare to charge + else if (NPC.ai[0] == 3.1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 0.85f) / 5f; + + Vector2 follyChargePrepareTargetDirection = player.Center - NPC.Center; + follyChargePrepareTargetDirection.Y -= 12f; + float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; + float follyChargePrepareVelMult = 8f; + follyChargePrepareTargetDirection.Normalize(); + follyChargePrepareTargetDirection *= follyChargePrepareSpeed; + NPC.velocity = (NPC.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) + { + NPC.damage = (int)Math.Round(NPC.defDamage * DashDamageMult); + + NPC.velocity = follyChargePrepareTargetDirection; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 3.2f; + NPC.ai[1] = NPC.direction; + + NPC.ForceNetUpdate(false); + NPC.SyncExtraAI(); + } + } + + // Charge + else if (NPC.ai[0] == 3.2f) + { + NPC.damage = (int)Math.Round(NPC.defDamage * DashDamageMult); + + NPC.ai[2] += 0.0333333351f; + float velocity = 28f + (enrageScale - 1f) * 4f; + NPC.velocity.X = (velocity + NPC.ai[2]) * NPC.ai[1]; + + if ((NPC.ai[1] > 0f && NPC.Center.X > player.Center.X + (chargeDistance - 140f)) || (NPC.ai[1] < 0f && NPC.Center.X < player.Center.X - (chargeDistance - 140f))) + { + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.TargetClosest(); + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ForceNetUpdate(false); + } + else if (Math.Abs(NPC.Center.X - player.Center.X) > chargeDistance + 200f) + { + NPC.TargetClosest(); + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ForceNetUpdate(false); + } + } + + NPC.rotation = (NPC.rotation * rotationMult * 0.5f + NPC.velocity.X * rotationAmt * 0.85f) / 5f; + } + + // Birb spawn + else if (NPC.ai[0] == 4f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.ai[1] == 0f) + { + Vector2 destination2 = player.Center + new Vector2(0f, -200f); + Vector2 desiredVelocity2 = NPC.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; + NPC.SimpleFlyMovement(desiredVelocity2, 1.5f); + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.Distance(player.Center) < 600f || NPC.ai[2] >= 180f) + { + NPC.ai[1] = 1f; + NPC.ForceNetUpdate(false); + } + } + else + { + if (NPC.ai[1] < 90f) + NPC.velocity *= 0.95f; + else + NPC.velocity *= 0.98f; + + if (NPC.ai[1] == 90f) + { + if (NPC.velocity.Y > 0f) + NPC.velocity.Y /= 3f; + + NPC.velocity.Y -= 3f; + } + + // Sound + if (NPC.ai[1] == birbSpawnPhaseTimer - 60f) + { + float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; + SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, NPC.Center); + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + bool gfbSpawnFlag = Main.zenithWorld && (NPC.ai[1] == 145f || NPC.ai[1] == 150f || NPC.ai[1] == 160f || NPC.ai[1] == 165f); + bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (NPC.ai[1] == 140f || (revenge && NPC.ai[1] == 155f) || NPC.ai[1] == 170f || gfbSpawnFlag); + if (spawnFlag) + { + Vector2 follySpawnCenter = NPC.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); + if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), NPC.whoAmI); + + NPC.ForceNetUpdate(false); + } + } + + NPC.ai[1] += 1f; + } + + if (NPC.ai[1] >= birbSpawnPhaseTimer) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.ForceNetUpdate(false); + } + } + + // Spit homing aura sphere + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + // Velocity + NPC.velocity *= 0.98f; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + // Play sound + float aiGateValue = 120f; + if (NPC.ai[1] == aiGateValue - 30f) + { + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 follySpawnCenter = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); + if (ai0 > 3f) + ai0 = 3f; + + Projectile.NewProjectile(NPC.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, NPC.target + 1); + NPC.ForceNetUpdate(false); + } + + if (Main.zenithWorld) + { + int spacing = 30; + int amt = 3; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= aiGateValue) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ForceNetUpdate(false); + } + } + } + + public override void FindFrame(int frameHeight) + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + bool birbSpawn = NPC.ai[0] == 4f && NPC.ai[1] > 0f; + + // Animation goes nyoom + if (Main.zenithWorld) + { + NPC.frameCounter += 4; + } + + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + if (phaseSwitchPhase || birbSpawn) + { + float frameGateValue = birbSpawn ? NPC.ai[1] : phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]; + int frameTimer = 180; + if (frameGateValue < (frameTimer - 60) || frameGateValue > (frameTimer - 20)) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + else + { + NPC.frame.Y = frameHeight * 4; + if (frameGateValue > (frameTimer - 50) && frameGateValue < (frameTimer - 25)) + { + NPC.frame.Y = frameHeight * 5; + } + } + } + else if (NPC.ai[0] == 5f) + { + int otherFrameTimer = 120; + if (NPC.ai[1] < (otherFrameTimer - 50) || NPC.ai[1] > (otherFrameTimer - 10)) + { + NPC.frameCounter += 1D; + if (NPC.frameCounter > 5D) + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + else + { + NPC.frame.Y = frameHeight * 4; + if (NPC.ai[1] > (otherFrameTimer - 40) && NPC.ai[1] < (otherFrameTimer - 15)) + { + NPC.frame.Y = frameHeight * 5; + } + } + } + else + { + NPC.frameCounter += (NPC.ai[0] == 3.2f ? 1.5 : 1D); + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 5) + { + NPC.frame.Y = 0; + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f) || death; + bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f); + + float newPhaseTimer = 180f; + bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || + (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); + + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); + Color color = drawColor; + Color altColor = Color.White; + + float lerpDrawTransition = 0f; + int newAITracker = 120; + int buffColorDampener = 60; + + if (phase3 && calamityGlobalNPC.newAI[3] == 1f) + { + color = CalamityGlobalNPC.buffColor(color, 0.9f, 0.6f, 0.2f, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[2] == 1f) + { + color = CalamityGlobalNPC.buffColor(color, 0.7f, 0.7f, 0.3f, 1f); + } + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) + { + float phase2TranBuff = calamityGlobalNPC.newAI[0] - (float)newAITracker; + phase2TranBuff /= (float)buffColorDampener; + color = CalamityGlobalNPC.buffColor(color, 1f - 0.3f * phase2TranBuff, 1f - 0.3f * phase2TranBuff, 1f - 0.7f * phase2TranBuff, 1f); + } + + int afterimageAmt = 10; + int afterimageIncrement = 2; + if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) + { + afterimageAmt = 4; + } + if (NPC.ai[0] == 1f || NPC.ai[0] == 3f || NPC.ai[0] == 4.1f) + { + afterimageAmt = 7; + } + if (NPC.ai[0] == 2f || NPC.ai[0] == 3.2f || (phase2 && calamityGlobalNPC.newAI[2] == 1f)) + { + altColor = Color.Yellow; + lerpDrawTransition = 0.5f; + } + else + { + color = altColor; + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += afterimageIncrement) + { + Color afterimageColor = color; + afterimageColor = Color.Lerp(afterimageColor, altColor, lerpDrawTransition); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (float)(afterimageAmt - i) / 15f; + Vector2 afterimageDrawPos = NPC.oldPos[i] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + afterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + afterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimageDrawPos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + int extraAfterimageAmt = 0; + float extraAfterimageDampener = 0f; + float afterimageScaler = 0f; + + if (NPC.ai[0] == 0f || NPC.ai[0] == 3.1f || NPC.ai[0] == 4f || NPC.ai[0] == 4.2f) + { + extraAfterimageAmt = 4; + } + + if (NPC.ai[0] == 5f) + { + if (NPC.ai[1] > 60f) + { + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((NPC.ai[1] - 60f) / 30f * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 40f; + } + } + + if (phaseSwitchPhase) + { + if (phase3 && calamityGlobalNPC.newAI[1] > (float)newAITracker) + { + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[1] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; + } + else if (phase2 && calamityGlobalNPC.newAI[0] > (float)newAITracker) + { + extraAfterimageAmt = 6; + extraAfterimageDampener = 1f - (float)Math.Cos((double)((calamityGlobalNPC.newAI[0] - (float)newAITracker) / (float)buffColorDampener * MathHelper.TwoPi)); + extraAfterimageDampener /= 3f; + afterimageScaler = 60f; + } + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int j = 0; j < extraAfterimageAmt; j++) + { + Color extraAfterimageColor = altColor; + extraAfterimageColor = Color.Lerp(extraAfterimageColor, altColor, lerpDrawTransition); + extraAfterimageColor = NPC.GetAlpha(extraAfterimageColor); + extraAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraAfterimageDrawPos = NPC.Center + ((float)j / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + extraAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraAfterimageDrawPos, NPC.frame, extraAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + Color mainDrawingColor = altColor; + mainDrawingColor = Color.Lerp(mainDrawingColor, altColor, lerpDrawTransition); + mainDrawingColor = NPC.GetAlpha(mainDrawingColor); + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, (phase3 && calamityGlobalNPC.newAI[3] == 1f ? mainDrawingColor : NPC.GetAlpha(altColor)), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + if (phase2) + { + texture2D15 = GlowTexture.Value; + Color glowmaskColor = Color.Lerp(Color.White, Color.Red, 0.5f); + altColor = Color.Red; + + lerpDrawTransition = 1f; + extraAfterimageDampener = 0.5f; + afterimageScaler = 10f; + afterimageIncrement = 1; + + if (phaseSwitchPhase) + { + float glowmaskDampener = (phase3 ? calamityGlobalNPC.newAI[1] : calamityGlobalNPC.newAI[0]) - (float)newAITracker; + glowmaskDampener /= (float)buffColorDampener; + altColor *= glowmaskDampener; + glowmaskColor *= glowmaskDampener; + } + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int k = 1; k < afterimageAmt; k += afterimageIncrement) + { + Color glowmaskAfterimageColor = glowmaskColor; + glowmaskAfterimageColor = Color.Lerp(glowmaskAfterimageColor, altColor, lerpDrawTransition); + glowmaskAfterimageColor *= (float)(afterimageAmt - k) / 15f; + Vector2 glowmaskAfterimageDrawPos = NPC.oldPos[k] + new Vector2((float)NPC.width, (float)NPC.height) / 2f - screenPos; + glowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + glowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, glowmaskAfterimageDrawPos, NPC.frame, glowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + + for (int l = 1; l < extraAfterimageAmt; l++) + { + Color extraGlowmaskAfterimageColor = glowmaskColor; + extraGlowmaskAfterimageColor = Color.Lerp(extraGlowmaskAfterimageColor, altColor, lerpDrawTransition); + extraGlowmaskAfterimageColor = NPC.GetAlpha(extraGlowmaskAfterimageColor); + extraGlowmaskAfterimageColor *= 1f - extraAfterimageDampener; + Vector2 extraGlowmaskAfterimageDrawPos = NPC.Center + ((float)l / (float)extraAfterimageAmt * MathHelper.TwoPi + NPC.rotation).ToRotationVector2() * afterimageScaler * extraAfterimageDampener - screenPos; + extraGlowmaskAfterimageDrawPos -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; + extraGlowmaskAfterimageDrawPos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, extraGlowmaskAfterimageDrawPos, NPC.frame, extraGlowmaskAfterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + + return false; + } + + private static Color buffColor(Color newColor, float R, float G, float B, float A) + { + newColor.R = (byte)((float)newColor.R * R); + newColor.G = (byte)((float)newColor.G * G); + newColor.B = (byte)((float)newColor.B * B); + newColor.A = (byte)((float)newColor.A * A); + return newColor; + } + + public override void BossLoot(ref int potionType) => potionType = ItemID.SuperHealingPotion; + + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + + // Normal drops: Everything that would otherwise be in the bag + var normalOnly = npcLoot.DefineNormalOnlyDropSet(); + { + // Weapons + int[] items = new int[] + { + ModContent.ItemType(), + ModContent.ItemType(), + ModContent.ItemType() + }; + normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, items)); + + // Materials + normalOnly.Add(ModContent.ItemType(), 1, 25, 30); + + // Equipment + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + + // Vanity + normalOnly.Add(ModContent.ItemType(), 7); + normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); + } + + npcLoot.Add(ModContent.ItemType(), 10); + + // Relic + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); + + // GFB Omega Healing Potion drop + npcLoot.DefineConditionalDropSet(DropHelper.GFB).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 50, 100), true); + + // Lore + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedDragonfolly, ModContent.ItemType(), desc: DropHelper.FirstKillText); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage > 0) + target.AddBuff(ModContent.BuffType(), Main.zenithWorld ? 360 : 180); + } + + public override void OnKill() + { + // Don't bother running any of this in Boss Rush. + if (BossRushEvent.BossRushActive) + return; + + CalamityGlobalNPC.SetNewBossJustDowned(NPC); + + // Mark The Dragonfolly as dead + DownedBossSystem.downedDragonfolly = true; + CalamityNetcode.SyncWorld(); + + if (Main.zenithWorld) + { + int spacing = 40; + int amt = 7; + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < amt; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (spacing * i) - (spacing * amt / 2), NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), LightningDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + + } + + public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) + { + NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); + } + + public override void ModifyTypeName(ref string typeName) + { + if (Main.zenithWorld) + { + typeName = CalamityUtils.GetTextValue("NPCs.Bumblebirb"); + } + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (!Main.dedServ) + { + for (int i = 0; i < 6; i++) // 1 head, 1 wing, 4 legs = 6. one wing due to them being chonky boyes now + { + string gore = "Bumble"; + float randomSpread = Main.rand.Next(-200, 201) / 100f; + gore += i == 0 ? "Head" : i > 1 ? "Leg" : "Wing"; + Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity * randomSpread, Mod.Find(gore).Type, 1f); + } + } + } + } + } +} diff --git a/NPCs/CalClone/CalamitasClone.cs b/NPCs/CalClone/CalamitasClone.cs index 1fa25a84ae..499a2bcb04 100644 --- a/NPCs/CalClone/CalamitasClone.cs +++ b/NPCs/CalClone/CalamitasClone.cs @@ -14,14 +14,14 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; -using CalamityMod.Sounds; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using ReLogic.Utilities; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -61,10 +61,15 @@ namespace CalamityMod.NPCs.CalClone } } + public static int DartDamage = 22; // 88 + public static int HellblastDamage = 25; // 100 + public static int HellfireballDamage = 25; // 100 + public static int FireblastDamage = 35; // 140; Also applies to GFB Gigablasts + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 70; // 140 NPC.npcSlots = 14f; NPC.width = 120; NPC.height = 120; @@ -72,10 +77,9 @@ namespace CalamityMod.NPCs.CalClone if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 0.8f; - NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 12 : 25; - NPC.value = Item.buyPrice(0, 20, 0, 0); - NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.075f : 0.15f); - NPC.LifeMaxNERB(37500, 45000, 520000); + NPC.defense = 25; + NPC.value = Item.buyPrice(gold: 15); + NPC.LifeMaxNERB(39000, 46875, 520000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -87,9 +91,6 @@ namespace CalamityMod.NPCs.CalClone NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -134,7 +135,685 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCalamitasCloneAI(NPC, Mod, BulletHellWarnSlot); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + // Variables for increasing difficulty + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + // Phases + bool phase2 = lifeRatio < 0.7f || death; + bool phase3 = lifeRatio < 0.35f; + bool phase4 = lifeRatio <= 0.1f && death; + + // Don't take damage during bullet hells + NPC.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; + + // Variable for live brothers + bool brotherAlive = false; + + // For seekers + CalamityGlobalNPC.calamitas = NPC.whoAmI; + + // Seeker ring + if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) + { + SoundEngine.PlaySound(SoundID.Item72, NPC.Center); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int seekerAmt = death ? 10 : 5; + int seekerSpread = 360 / seekerAmt; + int seekerDistance = death ? 180 : 150; + for (int i = 0; i < seekerAmt; i++) + { + int spawn = NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(NPC.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), NPC.whoAmI, 0, 0, 0, -1); + Main.npc[spawn].ai[0] = i * seekerSpread; + } + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + calamityGlobalNPC.newAI[1] = 1f; + } + + // CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase. + // newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase. + + // Do bullet hell or spawn brothers + if (calamityGlobalNPC.newAI[0] == 0f && NPC.life > 0) + calamityGlobalNPC.newAI[0] = 1f; + + // Bullet hells at 70% and 10%, brothers at 40% + if (NPC.life > 0) + { + int calClonePhaseThreshold = (int)(NPC.lifeMax * 0.3); + if (((NPC.life + calClonePhaseThreshold) / (float)NPC.lifeMax) < calamityGlobalNPC.newAI[0]) + { + calamityGlobalNPC.newAI[0] -= 0.3f; + if (calamityGlobalNPC.newAI[0] <= 0.1f) + { + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + calamityGlobalNPC.newAI[2] = 2f; + + if (Main.zenithWorld) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + else if (calamityGlobalNPC.newAI[0] <= 0.4f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.position.Y + NPC.height, ModContent.NPCType(), NPC.whoAmI); + } + + string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; + Color messageColor = Color.Orange; + CalamityUtils.DisplayLocalizedText(key, messageColor); + + SpawnDust(); + } + else + { + SoundEngine.PlaySound(SoundID.Item109, NPC.Center); + calamityGlobalNPC.newAI[2] = 1f; + + if (Main.zenithWorld) + calamityGlobalNPC.newAI[3] = 0f; + + SpawnDust(); + } + } + } + + // Immunity if brothers are alive + if (CalamityGlobalNPC.cataclysm != -1) + { + if (Main.npc[CalamityGlobalNPC.cataclysm].active) + brotherAlive = true; + } + if (CalamityGlobalNPC.catastrophe != -1) + { + if (Main.npc[CalamityGlobalNPC.catastrophe].active) + brotherAlive = true; + } + + if (brotherAlive) + NPC.dontTakeDamage = true; + + void SpawnDust() + { + int dustAmt = 50; + int random = 3; + + for (int j = 0; j < 10; j++) + { + random += j; + int dustAmtSpawned = 0; + int scale = random * 6; + float dustPositionX = NPC.Center.X - (scale / 2); + float dustPositionY = NPC.Center.Y - (scale / 2); + while (dustAmtSpawned < dustAmt) + { + float dustVelocityX = Main.rand.Next(-random, random); + float dustVelocityY = Main.rand.Next(-random, random); + float dustVelocityScalar = random * 2f; + float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); + dustVelocity = dustVelocityScalar / dustVelocity; + dustVelocityX *= dustVelocity; + dustVelocityY *= dustVelocity; + int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + Main.dust[dust].noGravity = true; + Main.dust[dust].position.X = NPC.Center.X; + Main.dust[dust].position.Y = NPC.Center.Y; + Main.dust[dust].position.X += Main.rand.Next(-10, 11); + Main.dust[dust].position.Y += Main.rand.Next(-10, 11); + Main.dust[dust].velocity.X = dustVelocityX; + Main.dust[dust].velocity.Y = dustVelocityY; + dustAmtSpawned++; + } + } + } + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Target variable + Player player = Main.player[NPC.target]; + + // Rotation + Vector2 npcCenter = new Vector2(NPC.Center.X, NPC.position.Y + NPC.height - 59f); + Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); + Vector2 rotationVector = npcCenter - lookAt; + + float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; + if (rotation < 0f) + rotation += MathHelper.TwoPi; + else if (rotation > MathHelper.TwoPi) + rotation -= MathHelper.TwoPi; + + float rotationAmt = 0.1f; + if (NPC.rotation < rotation) + { + if ((rotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= rotationAmt; + else + NPC.rotation += rotationAmt; + } + else if (NPC.rotation > rotation) + { + if ((NPC.rotation - rotation) > MathHelper.Pi) + NPC.rotation += rotationAmt; + else + NPC.rotation -= rotationAmt; + } + + if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt) + NPC.rotation = rotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > rotation - rotationAmt && NPC.rotation < rotation + rotationAmt) + NPC.rotation = rotation; + + // Despawn + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying) + warningSound.Stop(); + + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + NPC.alpha = 0; + NPC.netUpdate = true; + } + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Distance from destination where Cal Clone stops moving + float movementDistanceGateValue = 100f; + + // How fast Cal Clone moves to the destination + float baseVelocity = (expertMode ? 10f : 8.5f) * (NPC.ai[1] == 4f ? 1.4f : 1f); + float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (NPC.ai[1] == 4f ? 1.4f : 1f); + if (revenge) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (death) + { + baseVelocity += 1.5f * (1f - lifeRatio); + baseAcceleration += 0.03f * (1f - lifeRatio); + } + if (Main.getGoodWorld) + { + baseVelocity *= 1.15f; + baseAcceleration *= 1.15f; + } + + // What side Cal Clone should be on, relative to the target + int xPos = 1; + if (NPC.Center.X < player.Center.X) + xPos = -1; + + // How far Cal Clone should be from the target + float averageDistance = 500f; + float chargeDistance = phase4 ? 300f : 400f; + + // This is where Cal Clone should be + Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || NPC.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : + NPC.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : + new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); + + // Add some random distance to the destination after certain attacks + if (NPC.localAI[0] == 1f) + { + NPC.localAI[0] = 0f; + NPC.localAI[2] = Main.rand.Next(-50, 51); + NPC.localAI[3] = Main.rand.Next(-300, 301); + NPC.netUpdate = true; + } + + // Add a bit of randomness to the destination + if (death) + { + destination.X += NPC.ai[1] == 0f ? NPC.localAI[3] : NPC.localAI[2]; + destination.Y += NPC.ai[1] == 0f ? NPC.localAI[2] : NPC.localAI[3]; + } + + // How far Cal Clone is from where she's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.ai[1] == 0f || NPC.ai[1] == 1f || NPC.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) + CalamityUtils.SmoothMovement(NPC, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); + + // Bullet hell phase + if (calamityGlobalNPC.newAI[2] > 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (calamityGlobalNPC.newAI[3] < 900f) + { + calamityGlobalNPC.newAI[3] += 1f; + NPC.dontTakeDamage = true; + NPC.alpha = 255; + + float rotX = player.Center.X - NPC.Center.X; + float rotY = player.Center.Y - NPC.Center.Y; + NPC.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[2] == 2f) + { + int type = ModContent.ProjectileType(); + int damage = FireblastDamage; + if (Main.zenithWorld) + type = ModContent.ProjectileType(); + + float gigaBlastFrequency = Main.getGoodWorld ? 120f : expertMode ? 180f : 240f; + float projSpeed = 5f; + if (calamityGlobalNPC.newAI[3] <= 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); + } + else if (calamityGlobalNPC.newAI[3] > 600f) + { + if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); + } + } + } + + NPC.ai[0] += 1f; + float hellblastGateValue = expertMode ? 12f : 16f; + if (NPC.ai[0] >= hellblastGateValue) + { + NPC.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = HellblastDamage; + float projSpeed = 4f; + // Blasts aimed directly at the player's horizontal position, does not spawn during the second bullet hell + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f && calamityGlobalNPC.newAI[2] != 2f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + + if (calamityGlobalNPC.newAI[3] == 900f - 360f) + BulletHellWarnSlot = SoundEngine.PlaySound(CalamitasClone.BulletHellWarning with { Volume = 0.75f }, player.Center); + if (calamityGlobalNPC.newAI[3] > 900f - 360f) + { + if (SoundEngine.TryGetActiveSound(BulletHellWarnSlot, out var warningSound) && warningSound.IsPlaying) + warningSound.Position = player.Center; + } + } + else + { + NPC.ai[0] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + SoundEngine.PlaySound(CalamitasClone.BulletHellEnd with { Volume = 0.75f }, player.Center); + + // Prevent bullshit charge hits when second bullet hell ends. + if (phase4) + { + NPC.ai[1] = 4f; + NPC.ai[2] = -105f; + NPC.TargetClosest(); + } + else + { + if (death) + { + int AIState = Main.rand.Next(3); + switch (AIState) + { + case 0: + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + break; + case 1: + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + break; + case 2: + NPC.ai[1] = 4f; + NPC.ai[2] = -105f; + NPC.TargetClosest(); + break; + } + } + else + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + if (death) + NPC.localAI[0] = 1f; + } + + NPC.netUpdate = true; + + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.active) + { + if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) + { + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + else if (projectile.type == ModContent.ProjectileType()) + { + projectile.ai[2] = 1f; + + if (projectile.timeLeft > 60) + projectile.timeLeft = 60; + } + } + } + } + + return; + } + else if (Main.zenithWorld) + { + if (calamityGlobalNPC.newAI[3] < 900f) + calamityGlobalNPC.newAI[3] += 1f; + else + calamityGlobalNPC.newAI[3] = 0f; + + NPC.ai[0] += 1f; + float hellblastGateValue = 30f; + if (NPC.ai[0] >= hellblastGateValue) + { + NPC.ai[0] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ModContent.ProjectileType(); + int damage = HellblastDamage; + float projSpeed = 4f; + if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) + { + float distance = Main.rand.NextBool() ? -1000f : 1000f; + float velocity = distance == -1000f ? projSpeed : -projSpeed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + + if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + else // Blasts from above, left, and right + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); + } + } + } + } + + NPC.alpha = NPC.dontTakeDamage ? 255 : 0; + + // Float above target and fire hellfireballs + if (NPC.ai[1] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[2] += 1f; + float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); + if (NPC.ai[2] >= phaseTimer || phase4) + { + // Prevent going to other positions during brothers phase + if (!brotherAlive) + NPC.ai[1] = death && !phase4 && Main.rand.NextBool() ? 4f : 1f; + + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + + if (Main.netMode != NetmodeID.MultiplayerClient && !brotherAlive) + { + NPC.localAI[1] += 1f; + if (expertMode) + NPC.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; + if (revenge) + NPC.localAI[1] += 0.5f; + + if (NPC.localAI[1] >= 120f) + { + NPC.localAI[1] = 0f; + SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, NPC.Center); + + float projectileVelocity = expertMode ? 14f : 12.5f; + int type = ModContent.ProjectileType(); + Vector2 predictionVector = Main.getGoodWorld ? player.velocity * 20f : Vector2.Zero; + Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - NPC.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, HellfireballDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + Main.projectile[proj].netUpdate = true; + } + } + } + + // Float to the side of the target and fire + else if (NPC.ai[1] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (Main.netMode != NetmodeID.MultiplayerClient && !brotherAlive) + { + NPC.localAI[1] += 1f; + if (revenge) + NPC.localAI[1] += 0.5f; + if (expertMode) + NPC.localAI[1] += 0.5f; + + if (NPC.localAI[1] >= 50f && Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + NPC.localAI[1] = 0f; + + float projectileVelocity = expertMode ? 12.5f : 11f; + int type = ModContent.ProjectileType(); + int damage = HellblastDamage; + Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; + Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; + + if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) + { + type = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, HellfireballDamage, 0f, Main.myPlayer, player.position.X, player.position.Y); + } + else + { + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f); + } + } + } + + NPC.ai[2] += 1f; + float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); + if (NPC.ai[2] >= phaseTimer || phase4) + { + if (brotherAlive) + NPC.ai[1] = 0f; + else if (death && !phase4 && Main.rand.NextBool()) + NPC.ai[1] = 0f; + else + NPC.ai[1] = phase2 && revenge ? 4f : 0f; + + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + } + else if (NPC.ai[1] == 2f) + { + // Set damage + NPC.damage = NPC.defDamage; + SoundEngine.PlaySound(ChargeSound, NPC.Center); + NPC.rotation = rotation; + + float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; + + Vector2 vector = Vector2.Normalize(player.Center - NPC.Center); + NPC.velocity = vector * chargeVelocity; + + NPC.ai[1] = 3f; + NPC.netUpdate = true; + } + else if (NPC.ai[1] == 3f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.ai[2] += 1f; + + float chargeTime = phase4 ? 35f : death ? 40f : 45f; + if (NPC.ai[2] >= chargeTime) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.velocity *= 0.9f; + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + { + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + // Leave behind slow hellblasts in Death Mode + if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && NPC.ai[2] % (phase4 ? 6f : 10f) == 0f) + { + int type = ModContent.ProjectileType(); + Vector2 fireballVelocity = Main.getGoodWorld ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : NPC.velocity * 0.01f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, HellblastDamage, 0f, Main.myPlayer, 1f, 0f); + } + } + + if (NPC.ai[2] >= chargeTime + 10f) + { + if (!phase4) + NPC.ai[3] += 1f; + + NPC.ai[2] = 0f; + + NPC.rotation = rotation; + NPC.netUpdate = true; + + if (NPC.ai[3] >= 2f) + { + NPC.TargetClosest(); + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + + NPC.ai[1] = 4f; + } + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (phase4 ? 15f : 30f)) + { + NPC.ai[1] = 2f; + NPC.ai[2] = 0f; + if (death) + NPC.localAI[0] = 1f; + + NPC.netUpdate = true; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -215,7 +894,7 @@ namespace CalamityMod.NPCs.CalClone // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); - normalOnly.Add(ModContent.ItemType(), 10); + normalOnly.Add(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Materials normalOnly.Add(ModContent.ItemType(), 1, 8, 10); @@ -256,7 +935,7 @@ namespace CalamityMod.NPCs.CalClone CalamityNetcode.SyncWorld(); } - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; + public override void BossLoot(ref int potionType) => potionType = ItemID.GreaterHealingPotion; public override void HitEffect(NPC.HitInfo hit) { @@ -305,7 +984,6 @@ namespace CalamityMod.NPCs.CalClone public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -317,7 +995,7 @@ namespace CalamityMod.NPCs.CalClone public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } } } diff --git a/NPCs/CalClone/Cataclysm.cs b/NPCs/CalClone/Cataclysm.cs index bec5c00aa9..b8338510e8 100644 --- a/NPCs/CalClone/Cataclysm.cs +++ b/NPCs/CalClone/Cataclysm.cs @@ -4,11 +4,12 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -47,11 +48,13 @@ namespace CalamityMod.NPCs.CalClone } } + public static int FlamethrowerDamage = 30; // 120 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 54; // 108 NPC.npcSlots = 5f; NPC.width = 120; NPC.height = 120; @@ -59,9 +62,8 @@ namespace CalamityMod.NPCs.CalClone if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; - NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; - NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); - NPC.LifeMaxNERB(11000, 13200, 80000); + NPC.defense = 10; + NPC.LifeMaxNERB(8500, 10000, 80000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -109,7 +111,309 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCataclysmAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (NPC.alpha < 255) + { + NPC.velocity *= 0.9f; + + NPC.alpha += 2; + if (NPC.alpha > 255) + NPC.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + NPC.active = false; + + NPC.active = false; + return; + } + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + CalamityGlobalNPC.cataclysm = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (NPC.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= calCloneBroRotationSpeed; + else + NPC.rotation += calCloneBroRotationSpeed; + } + else if (NPC.rotation > calCloneBroRotation) + { + if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi) + NPC.rotation += calCloneBroRotationSpeed; + else + NPC.rotation -= calCloneBroRotationSpeed; + } + + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + return; + } + } + + if (NPC.ai[1] == 0f) + { + float calCloneBroProjAttackMaxSpeed = 5f; + float calCloneBroProjAttackAccel = 0.1f; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (NPC.position.X + (NPC.width / 2) < player.position.X + player.width) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (NPC.velocity.X < calCloneBroProjTargetX) + { + NPC.velocity.X += calCloneBroProjAttackAccel; + if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f) + NPC.velocity.X += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.X > calCloneBroProjTargetX) + { + NPC.velocity.X -= calCloneBroProjAttackAccel; + if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f) + NPC.velocity.X -= calCloneBroProjAttackAccel; + } + if (NPC.velocity.Y < calCloneBroProjTargetY) + { + NPC.velocity.Y += calCloneBroProjAttackAccel; + if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + NPC.velocity.Y += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.Y > calCloneBroProjTargetY) + { + NPC.velocity.Y -= calCloneBroProjAttackAccel; + if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + NPC.velocity.Y -= calCloneBroProjAttackAccel; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) + { + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.netUpdate = true; + } + + bool fireDelay = NPC.ai[2] > 120f || NPC.life < NPC.lifeMax * 0.9; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay) + { + if (NPC.localAI[2] == 0f) + SoundEngine.PlaySound(Cataclysm.FlamethrowerStart, NPC.Center); + + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 30f) + { + NPC.localAI[2] = 1f; + SoundEngine.PlaySound(Cataclysm.FlamethrowerLoop, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 3f; + if (revenge) + NPC.localAI[1] += 1f; + + if (NPC.localAI[1] > 12f) + { + NPC.localAI[1] = 0f; + float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; + int type = ModContent.ProjectileType(); + calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += NPC.velocity.Y * 0.5f; + calCloneBroProjTargetX += NPC.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, FlamethrowerDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (NPC.ai[1] == 1f) + { + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + NPC.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = NPC.Center; + float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + NPC.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center); + + int type = ModContent.ProjectileType(); + + int totalProjectiles = death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, CalamitasClone.DartDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (NPC.ai[1] == 2f) + { + NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + NPC.ai[2] += 0.25f; + if (revenge) + NPC.ai[2] += 0.25f; + + if (NPC.ai[2] >= 75f) + { + NPC.velocity.X *= 0.93f; + NPC.velocity.Y *= 0.93f; + + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + if (NPC.ai[2] >= 105f) + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.rotation = calCloneBroRotation; + if (NPC.ai[3] >= 3f) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + NPC.ai[1] = 1f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -237,7 +541,7 @@ namespace CalamityMod.NPCs.CalClone public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/NPCs/CalClone/Catastrophe.cs b/NPCs/CalClone/Catastrophe.cs index dcae21a2da..3c341d7b8c 100644 --- a/NPCs/CalClone/Catastrophe.cs +++ b/NPCs/CalClone/Catastrophe.cs @@ -4,12 +4,14 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Placeables.Furniture.Trophies; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; +using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -41,11 +43,13 @@ namespace CalamityMod.NPCs.CalClone } } + public static int BallDamage = 22; // 88 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 54; // 108 NPC.npcSlots = 5f; NPC.width = 120; NPC.height = 120; @@ -53,9 +57,8 @@ namespace CalamityMod.NPCs.CalClone if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; - NPC.defense = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 15 : 10; - NPC.DR_NERD((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.225f : 0.15f); - NPC.LifeMaxNERB(9200, 11025, 80000); + NPC.defense = 10; + NPC.LifeMaxNERB(8500, 10000, 80000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -103,7 +106,304 @@ namespace CalamityMod.NPCs.CalClone public override void AI() { - CalamitasCloneAI.VanillaCatastropheAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + + if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) + { + if (NPC.alpha < 255) + { + NPC.velocity *= 0.9f; + + NPC.alpha += 2; + if (NPC.alpha > 255) + NPC.alpha = 255; + + int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - NPC.alpha) / 255f)); + for (int i = 0; i < dustAmount; i++) + { + int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); + Main.dust[dust].noGravity = true; + Main.dust[dust].fadeIn = 1f; + } + } + else + NPC.active = false; + + return; + } + + // Percent life remaining + float lifeRatio = NPC.life / (float)NPC.lifeMax; + + CalamityGlobalNPC.catastrophe = NPC.whoAmI; + + // Emit light + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1f, 0f, 0f); + + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + float calCloneBroPlayerXDist = NPC.position.X + (NPC.width / 2) - player.position.X - (player.width / 2); + float calCloneBroPlayerYDist = NPC.position.Y + NPC.height - 59f - player.position.Y - (player.height / 2); + float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; + if (calCloneBroRotation < 0f) + calCloneBroRotation += MathHelper.TwoPi; + else if (calCloneBroRotation > MathHelper.TwoPi) + calCloneBroRotation -= MathHelper.TwoPi; + + float calCloneBroRotationSpeed = 0.15f; + if (NPC.rotation < calCloneBroRotation) + { + if ((calCloneBroRotation - NPC.rotation) > MathHelper.Pi) + NPC.rotation -= calCloneBroRotationSpeed; + else + NPC.rotation += calCloneBroRotationSpeed; + } + else if (NPC.rotation > calCloneBroRotation) + { + if ((NPC.rotation - calCloneBroRotation) > MathHelper.Pi) + NPC.rotation += calCloneBroRotationSpeed; + else + NPC.rotation -= calCloneBroRotationSpeed; + } + + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + else if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > calCloneBroRotation - calCloneBroRotationSpeed && NPC.rotation < calCloneBroRotation + calCloneBroRotationSpeed) + NPC.rotation = calCloneBroRotation; + + if (!player.active || player.dead) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + if (NPC.ai[1] != 0f) + { + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.netUpdate = true; + } + + return; + } + } + + if (NPC.ai[1] == 0f) + { + float calCloneBroProjAttackMaxSpeed = 4.5f; + float calCloneBroProjAttackAccel = 0.2f; + + if (Main.getGoodWorld) + { + calCloneBroProjAttackMaxSpeed *= 1.15f; + calCloneBroProjAttackAccel *= 1.15f; + } + + int calCloneBroProjAttackDirection = 1; + if (NPC.Center.X < player.Center.X) + calCloneBroProjAttackDirection = -1; + + Vector2 calCloneBroProjLocation = NPC.Center; + float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; + float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; + float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + + if (expertMode) + { + if (calCloneBroProjTargetDist > 300f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 400f) + calCloneBroProjAttackMaxSpeed += 0.5f; + if (calCloneBroProjTargetDist > 500f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 600f) + calCloneBroProjAttackMaxSpeed += 0.55f; + if (calCloneBroProjTargetDist > 700f) + calCloneBroProjAttackMaxSpeed += 0.6f; + if (calCloneBroProjTargetDist > 800f) + calCloneBroProjAttackMaxSpeed += 0.6f; + } + + calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + + if (NPC.velocity.X < calCloneBroProjTargetX) + { + NPC.velocity.X += calCloneBroProjAttackAccel; + if (NPC.velocity.X < 0f && calCloneBroProjTargetX > 0f) + NPC.velocity.X += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.X > calCloneBroProjTargetX) + { + NPC.velocity.X -= calCloneBroProjAttackAccel; + if (NPC.velocity.X > 0f && calCloneBroProjTargetX < 0f) + NPC.velocity.X -= calCloneBroProjAttackAccel; + } + if (NPC.velocity.Y < calCloneBroProjTargetY) + { + NPC.velocity.Y += calCloneBroProjAttackAccel; + if (NPC.velocity.Y < 0f && calCloneBroProjTargetY > 0f) + NPC.velocity.Y += calCloneBroProjAttackAccel; + } + else if (NPC.velocity.Y > calCloneBroProjTargetY) + { + NPC.velocity.Y -= calCloneBroProjAttackAccel; + if (NPC.velocity.Y > 0f && calCloneBroProjTargetY < 0f) + NPC.velocity.Y -= calCloneBroProjAttackAccel; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) + { + NPC.ai[1] = 1f; + NPC.ai[2] = 0f; + NPC.target = 255; + NPC.netUpdate = true; + } + + bool fireDelay = NPC.ai[2] > 120f || lifeRatio < 0.9f; + if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height) && fireDelay) + { + NPC.localAI[2] += 1f; + if (NPC.localAI[2] > 36f) + { + NPC.localAI[2] = 0f; + SoundEngine.PlaySound(SoundID.Item34, NPC.Center); + } + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.localAI[1] += 1f; + if (revenge) + NPC.localAI[1] += 0.5f; + + if (NPC.localAI[1] > 50f) + { + NPC.localAI[1] = 0f; + float calCloneBroProjSpeed = death ? 14f : 12f; + int type = ModContent.ProjectileType(); + calCloneBroProjLocation = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; + calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; + calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); + calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; + calCloneBroProjTargetX *= calCloneBroProjTargetDist; + calCloneBroProjTargetY *= calCloneBroProjTargetDist; + calCloneBroProjTargetY += NPC.velocity.Y * 0.5f; + calCloneBroProjTargetX += NPC.velocity.X * 0.5f; + calCloneBroProjLocation.X -= calCloneBroProjTargetX; + calCloneBroProjLocation.Y -= calCloneBroProjTargetY; + Projectile.NewProjectile(NPC.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, BallDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + } + else + { + if (NPC.ai[1] == 1f) + { + SoundEngine.PlaySound(SoundID.Roar, NPC.Center); + NPC.rotation = calCloneBroRotation; + + float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); + if (expertMode) + calCloneBroChargeSpeed += 2f; + if (revenge) + calCloneBroChargeSpeed += 2f; + if (Main.getGoodWorld) + calCloneBroChargeSpeed *= 1.25f; + + Vector2 calCloneBroChargeCenter = new Vector2(NPC.position.X + NPC.width * 0.5f, NPC.position.Y + NPC.height * 0.5f); + float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; + float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; + float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); + calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; + NPC.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; + NPC.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; + NPC.ai[1] = 2f; + + if (Main.zenithWorld) + { + SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, NPC.Center); + + int type = ModContent.ProjectileType(); + + int totalProjectiles = death ? 10 : revenge ? 8 : expertMode ? 6 : 4; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 5f; + Vector2 spinningPoint = new Vector2(0f, -velocity); + float projectileVelocityToPass = velocity * 3f; + for (int k = 0; k < totalProjectiles; k++) + { + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, CalamitasClone.DartDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + } + + for (int i = 0; i < 6; i++) + Dust.NewDust(NPC.position + NPC.velocity, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f); + } + return; + } + + if (NPC.ai[1] == 2f) + { + NPC.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); + if (expertMode) + NPC.ai[2] += 0.25f; + if (revenge) + NPC.ai[2] += 0.25f; + + if (NPC.ai[2] >= 60f) //50 + { + NPC.velocity.X *= 0.93f; + NPC.velocity.Y *= 0.93f; + + if (NPC.velocity.X > -0.1 && NPC.velocity.X < 0.1) + NPC.velocity.X = 0f; + if (NPC.velocity.Y > -0.1 && NPC.velocity.Y < 0.1) + NPC.velocity.Y = 0f; + } + else + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) - MathHelper.PiOver2; + + if (NPC.ai[2] >= 90f) //80 + { + NPC.ai[3] += 1f; + NPC.ai[2] = 0f; + NPC.rotation = calCloneBroRotation; + if (NPC.ai[3] >= 4f) + { + NPC.ai[1] = 0f; + NPC.ai[3] = 0f; + return; + } + NPC.ai[1] = 1f; + } + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -231,7 +531,7 @@ namespace CalamityMod.NPCs.CalClone public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/NPCs/CalClone/SoulSeeker.cs b/NPCs/CalClone/SoulSeeker.cs index d6a78285ce..8c72841b5b 100644 --- a/NPCs/CalClone/SoulSeeker.cs +++ b/NPCs/CalClone/SoulSeeker.cs @@ -40,9 +40,8 @@ namespace CalamityMod.NPCs.CalClone NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.defense = 10; - NPC.DR_NERD(0.1f); NPC.lifeMax = CalamityWorld.death ? 1500 : 2500; if (BossRushEvent.BossRushActive) { @@ -53,10 +52,6 @@ namespace CalamityMod.NPCs.CalClone NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -119,8 +114,7 @@ namespace CalamityMod.NPCs.CalClone Dust.NewDust(NPC.position, NPC.width, NPC.height, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 1f, parent.target, 1f, 0f, projectileSpeed * 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, CalamitasClone.DartDamage, 1f, parent.target, 1f, 0f, projectileSpeed * 2f); } timer = 0; } diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs deleted file mode 100644 index b4b7b4b27b..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AquaticScourgeAI.cs +++ /dev/null @@ -1,629 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AquaticScourgeAI - { - public static void VanillaAquaticScourgeAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool getFuckedAI = Main.zenithWorld; - - if (head) - CalamityGlobalNPC.aquaticScourge = npc.whoAmI; - - // Adjust hostility and stats - bool nonHostile = calamityGlobalNPC.newAI[0] == 0f; - if (npc.justHit || npc.life <= npc.lifeMax * 0.999 || bossRush || Main.getGoodWorld) - { - if (nonHostile) - { - // Kiss my motherfucking ass you piece of shit game - npc.timeLeft *= 20; - npc.npcSlots = 16f; - CalamityGlobalNPC.BossKillTimes.TryGetValue(npc.type, out int revKillTime); - calamityGlobalNPC.KillTime = revKillTime; - calamityGlobalNPC.newAI[0] = 1f; - nonHostile = false; - npc.boss = head; - npc.chaseable = true; - npc.netUpdate = true; - } - } - else - npc.damage = 0; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.75f; - bool phase3 = lifeRatio < 0.5f; - bool phase4 = lifeRatio < 0.25f; - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - if (!head) - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool notOcean = player.position.Y < 300f || - player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - notOcean = player.position.Y < Main.UnderworldLayer * 0.8f || player.position.Y > Main.UnderworldLayer || - (player.position.X > 7680f && player.position.X < (Main.maxTilesX * 16 - 7680)); - } - - // Enrage - if (head) - { - if (notOcean && !player.Calamity().ZoneSulphur && !bossRush) - { - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - } - else - npc.localAI[2] = CalamityGlobalNPC.biomeEnrageTimerMax; - } - - bool biomeEnraged = npc.localAI[2] <= 0f || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Circular movement - float colorFadeTimeAfterSpiral = 90f; - float spiralGateValue = 480f; - bool doSpiral = false; - if (head && calamityGlobalNPC.newAI[0] == 1f && calamityGlobalNPC.newAI[2] == 1f && (revenge || getFuckedAI)) - { - doSpiral = calamityGlobalNPC.newAI[1] == 0f && calamityGlobalNPC.newAI[3] >= spiralGateValue; - if (Vector2.Distance(npc.Center, player.Center) < (getFuckedAI ? 1600f : 1000f) || doSpiral) - calamityGlobalNPC.newAI[3] += 1f; - - if (doSpiral) - { - npc.localAI[3] = colorFadeTimeAfterSpiral; - - // Vomit acid mist - float acidMistBarfDivisor = getFuckedAI ? 2f : ((float)Math.Floor(bossRush ? 4f : death ? 5f : 6f) * (phase3 ? 1.5f : 1f)); - if (calamityGlobalNPC.newAI[3] % acidMistBarfDivisor == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float mistVelocity = death ? 10f : 8f; - Vector2 projectileVelocity = (npc.Center + npc.velocity * 10f - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * mistVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - Main.projectile[proj].timeLeft = getFuckedAI ? 240 : 600; - } - } - - // Vomit circular spreads of acid clouds while in phase 3 - float toxicCloudBarfDivisor = bossRush ? 20f : death ? 30f : 40f; - if (calamityGlobalNPC.newAI[3] % toxicCloudBarfDivisor == 0f && phase3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = (phase4 ? 6 : 9) + (getFuckedAI ? Main.rand.Next(-2, 3) : (int)((calamityGlobalNPC.newAI[3] - spiralGateValue) / toxicCloudBarfDivisor) * (phase4 ? 2 : 3)); - float radians = MathHelper.TwoPi / totalProjectiles; - float cloudVelocity = 1f + enrageScale; - Vector2 spinningPoint = new Vector2(0f, -cloudVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer); - } - } - } - - // Velocity boost - if (calamityGlobalNPC.newAI[3] == spiralGateValue) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= 24f; - } - - // Spin velocity - float velocity = (float)(Math.PI * 2D) / 120f; - // In GFB, contracts the radius as the fight progresses - if (getFuckedAI) - velocity *= phase3 ? 1.5f : phase2 ? 1.25f : 1f; - npc.velocity = npc.velocity.RotatedBy(-(double)velocity * npc.localAI[1]); - // Speed up even more in GFB for more radius - if (getFuckedAI && npc.velocity.Length() <= 32f) - npc.velocity *= 1.1f; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - - // Reset and charge at target - // Don't reset in GFB - if (!getFuckedAI && calamityGlobalNPC.newAI[3] >= spiralGateValue + 120f) - { - calamityGlobalNPC.newAI[3] = 0f; - npc.TargetClosest(); - } - } - else - { - if (!Collision.CanHit(npc.Center, 1, 1, player.position, player.width, player.height) && calamityGlobalNPC.newAI[3] > 300f) - calamityGlobalNPC.newAI[3] -= 2f; - - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - npc.localAI[1] = npc.Center.X - player.Center.X < 0 ? 1f : -1f; - } - } - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = doSpiral || getFuckedAI; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - if (head) - { - // Spawn segments - if (calamityGlobalNPC.newAI[2] == 0f && npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxLength = getFuckedAI ? 24 : death ? 80 : revenge ? 40 : expertMode ? 35 : 30; - int Previous = npc.whoAmI; - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - { - if (segments % 2 == 0) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - } - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); - Previous = lol; - } - } - - calamityGlobalNPC.newAI[2] = 1f; - } - - // Big barf attack - if (calamityGlobalNPC.newAI[0] == 1f && (!doSpiral && phase2) || (getFuckedAI && !phase3)) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] >= (revenge ? 360f : 420f)) - { - if (Vector2.Distance(player.Center, npc.Center) > 320f) - { - npc.localAI[0] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.NPCDeath13, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = bossRush ? 10 : expertMode ? 8 : 6; - if (phase3) - totalProjectiles *= 2; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 velocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= Main.rand.Next(phase3 ? 300 : 100, 401) * 0.01f; - - float maximumVelocityMult = death ? 0.75f : 0.5f; - if (expertMode) - velocity *= 1f + (maximumVelocityMult * (0.5f - lifeRatio)); - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + velocity.SafeNormalize(Vector2.UnitY) * 5f, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - - // Fire teeth depending on body type - else - { - if (calamityGlobalNPC.newAI[0] == 1f && (!phase3 || phase4)) - { - npc.localAI[0] += 1f; - float shootProjectile = 300; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - - if (npc.type == ModContent.NPCType()) - { - if (npc.localAI[0] % divisor == 0f && (npc.ai[0] % 3f == 0f || getFuckedAI || !death)) - { - npc.TargetClosest(); - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float toothVelocity = death ? 9f : 8f; - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float accelerate = phase4 ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity * 5f, projectileVelocity * toothVelocity, type, damage, 0f, Main.myPlayer, accelerate, 0f); - } - - npc.netUpdate = true; - } - } - } - } - } - - // Kill body and tail - if (!head) - { - bool shouldDespawn = true; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) - { - shouldDespawn = false; - break; - } - } - if (!shouldDespawn) - { - if (npc.ai[1] <= 0f) - shouldDespawn = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - shouldDespawn = true; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - } - } - else - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - - float maxDistance = calamityGlobalNPC.newAI[0] == 1f ? 12800f : 6400f; - if (player.dead || Vector2.Distance(npc.Center, player.Center) > maxDistance || (nonHostile && biomeEnraged)) - { - calamityGlobalNPC.newAI[1] = 1f; - npc.TargetClosest(false); - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16D) - npc.velocity.Y += 2f; - - if (npc.position.Y > Main.worldSurface * 16D) - { - for (int a = 0; a < Main.npc.Length; a++) - { - int type = Main.npc[a].type; - if (type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType() || type == ModContent.NPCType()) - Main.npc[a].active = false; - } - } - } - else - calamityGlobalNPC.newAI[1] = 0f; - - // Change direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Alpha changes - if (head || Main.npc[(int)npc.ai[1]].alpha < 128) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - Vector2 scourgePosition = npc.Center; - Vector2 predictionVector = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.player[npc.target].velocity * 20f : Vector2.Zero; - float scourgeTargetX = player.Center.X + predictionVector.X; - float scourgeTargetY = player.Center.Y + predictionVector.Y; - - // Velocity and movement - float scourgeMaxSpeed = 5f; - float scourgeAcceleration = 0.08f; - if (calamityGlobalNPC.newAI[0] == 1f) - { - scourgeMaxSpeed = revenge ? 14.4f : 12f; - scourgeAcceleration = revenge ? 0.18f : 0.15f; - if (expertMode) - { - scourgeMaxSpeed += 2.4f * (1f - lifeRatio); - scourgeAcceleration += 0.03f * (1f - lifeRatio); - } - scourgeMaxSpeed += 3f * enrageScale; - scourgeAcceleration += 0.06f * enrageScale; - if (death || getFuckedAI) - { - scourgeMaxSpeed += 5f; - scourgeAcceleration -= getFuckedAI ? 0f : 0.03f; - scourgeMaxSpeed += Vector2.Distance(player.Center, npc.Center) * 0.001f; - scourgeAcceleration += Vector2.Distance(player.Center, npc.Center) * 0.000045f; - } - - // Increase acceleration after spiral attack - if (npc.localAI[3] > 0f) - { - float accelerationMultiplier = MathHelper.Lerp(1f, 2f, npc.localAI[3] / colorFadeTimeAfterSpiral); - scourgeAcceleration *= accelerationMultiplier; - } - - if (Main.getGoodWorld) - { - scourgeMaxSpeed *= 1.15f; - scourgeAcceleration *= 1.15f; - } - } - - if (head && !doSpiral) - { - if (calamityGlobalNPC.newAI[0] != 1f) - { - scourgeTargetY += 400; - if (Math.Abs(npc.Center.X - player.Center.X) < 500f) - { - if (npc.velocity.X > 0f) - scourgeTargetX = player.Center.X + 600f; - else - scourgeTargetX = player.Center.X - 600f; - } - } - - float scourgeHigherSpeed = scourgeMaxSpeed * 1.3f; - float scourgeLowerSpeed = scourgeMaxSpeed * 0.7f; - float scourgeSpeed = npc.velocity.Length(); - if (scourgeSpeed > 0f) - { - if (scourgeSpeed > scourgeHigherSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeHigherSpeed; - } - else if (scourgeSpeed < scourgeLowerSpeed) - { - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= scourgeLowerSpeed; - } - } - } - - scourgeTargetX = (int)(scourgeTargetX / 16f) * 16; - scourgeTargetY = (int)(scourgeTargetY / 16f) * 16; - scourgePosition.X = (int)(scourgePosition.X / 16f) * 16; - scourgePosition.Y = (int)(scourgePosition.Y / 16f) * 16; - scourgeTargetX -= scourgePosition.X; - scourgeTargetY -= scourgePosition.Y; - float scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - - if (!head) - { - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - scourgePosition = npc.Center; - scourgeTargetX = Main.npc[(int)npc.ai[1]].Center.X - scourgePosition.X; - scourgeTargetY = Main.npc[(int)npc.ai[1]].Center.Y - scourgePosition.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(scourgeTargetY, scourgeTargetX) + MathHelper.PiOver2; - scourgeTargetDist = (float)Math.Sqrt(scourgeTargetX * scourgeTargetX + scourgeTargetY * scourgeTargetY); - int scourgeWidth = npc.width; - scourgeTargetDist = (scourgeTargetDist - scourgeWidth) / scourgeTargetDist; - scourgeTargetX *= scourgeTargetDist; - scourgeTargetY *= scourgeTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + scourgeTargetX; - npc.position.Y = npc.position.Y + scourgeTargetY; - - if (scourgeTargetX < 0f) - npc.spriteDirection = -1; - else if (scourgeTargetX > 0f) - npc.spriteDirection = 1; - } - } - else if (!doSpiral) - { - float scourgeAbsoluteTargetX = Math.Abs(scourgeTargetX); - float scourgeAbsoluteTargetY = Math.Abs(scourgeTargetY); - float scourgeTimeToReachTarget = scourgeMaxSpeed / scourgeTargetDist; - scourgeTargetX *= scourgeTimeToReachTarget; - scourgeTargetY *= scourgeTimeToReachTarget; - - if ((npc.velocity.X > 0f && scourgeTargetX > 0f) || (npc.velocity.X < 0f && scourgeTargetX < 0f) || (npc.velocity.Y > 0f && scourgeTargetY > 0f) || (npc.velocity.Y < 0f && scourgeTargetY < 0f)) - { - if (npc.velocity.X < scourgeTargetX) - { - npc.velocity.X += scourgeAcceleration; - } - else - { - if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration; - } - - if (npc.velocity.Y < scourgeTargetY) - { - npc.velocity.Y += scourgeAcceleration; - } - else - { - if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration; - } - - if (Math.Abs(scourgeTargetY) < scourgeMaxSpeed * 0.2 && ((npc.velocity.X > 0f && scourgeTargetX < 0f) || (npc.velocity.X < 0f && scourgeTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration * 2f; - else - npc.velocity.Y -= scourgeAcceleration * 2f; - } - - if (Math.Abs(scourgeTargetX) < scourgeMaxSpeed * 0.2 && ((npc.velocity.Y > 0f && scourgeTargetY < 0f) || (npc.velocity.Y < 0f && scourgeTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration * 2f; - else - npc.velocity.X -= scourgeAcceleration * 2f; - } - } - else - { - if (scourgeAbsoluteTargetX > scourgeAbsoluteTargetY) - { - if (npc.velocity.X < scourgeTargetX) - npc.velocity.X += scourgeAcceleration * 1.1f; - else if (npc.velocity.X > scourgeTargetX) - npc.velocity.X -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += scourgeAcceleration; - else - npc.velocity.Y -= scourgeAcceleration; - } - } - else - { - if (npc.velocity.Y < scourgeTargetY) - npc.velocity.Y += scourgeAcceleration * 1.1f; - else if (npc.velocity.Y > scourgeTargetY) - npc.velocity.Y -= scourgeAcceleration * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < scourgeMaxSpeed * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += scourgeAcceleration; - else - npc.velocity.X -= scourgeAcceleration; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - - // Calculate contact damage based on velocity - if (!nonHostile) - { - float minimalContactDamageVelocity = scourgeMaxSpeed * 0.25f; - float minimalDamageVelocity = scourgeMaxSpeed * 0.5f; - if (head) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs deleted file mode 100644 index 6762f39117..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumAureusAI.cs +++ /dev/null @@ -1,974 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AstrumAureusAI - { - public static void VanillaAstrumAureusAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.astrumAureus = npc.whoAmI; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.85f : expertMode ? 0.8f : 0.75f); - bool phase3 = lifeRatio < (revenge ? 0.7f : expertMode ? 0.6f : 0.5f); - bool phase4 = lifeRatio < (revenge ? 0.5f : 0.4f) && expertMode; - bool phase5 = lifeRatio < 0.3f && revenge; - - // Exhaustion - bool exhausted = npc.ai[2] >= (phase3 ? 2f : 1f); - calamityGlobalNPC.DR = exhausted ? 0.2f : 0.4f; - npc.defense = exhausted ? npc.defDefense / 2 : npc.defDefense; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Don't fire projectiles and don't increment phase timers for 4 seconds after the teleport phase to avoid cheap bullshit - float noProjectileOrPhaseIncrementTime = 240f; - - bool dontAttack = npc.localAI[3] > 0f; - if (dontAttack) - { - npc.localAI[3] -= 1f; - if (npc.justHit && masterMode) - npc.localAI[3] -= 3f; - if (npc.Distance(player.Center) < 240f) - npc.localAI[3] -= masterMode ? 4f : expertMode ? 2f : 1f; - } - - float enrageScale = bossRush ? 1f : 0f; - if ((Main.IsItDay() && !player.Calamity().ZoneAstral) || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - float astralFlameBarrageTimerIncrement = 1f; - if (expertMode) - astralFlameBarrageTimerIncrement += death ? (float)Math.Round(3f * (1f - lifeRatio)) : (float)Math.Round(2f * (1f - lifeRatio)); - - float walkingVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 6f : 5f; - walkingVelocity += 3f * enrageScale; - if (phase5) - walkingVelocity += 2f; - if (expertMode) - walkingVelocity += 1.5f * (1f - lifeRatio); - if (revenge) - walkingVelocity += Math.Abs(npc.Center.X - player.Center.X) * 0.0025f; - if (Main.getGoodWorld) - walkingVelocity *= 1.15f; - - float walkingProjectileVelocity = walkingVelocity * 0.8f; - - // Direction - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; - - // Used to reduce Aureus' fall speed - bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height) && npc.ai[0] == 4f; - - // Despawn - bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.noTileCollide = true; - - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 12f) - npc.velocity.Y = 12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - bool geldonPhase1 = lifeRatio > 0.6f && lifeRatio <= 0.7f; - bool geldonPhase2 = lifeRatio <= 0.1f; - if (Main.zenithWorld && (geldonPhase1 || geldonPhase2)) - { - AstrumAureus.AstrumAureus astrumAureus = npc.ModNPC(); - astrumAureus.slimeProjCounter++; - if (astrumAureus.slimeProjCounter % 180 == 0) - { - SoundEngine.PlaySound(SoundID.Item33, npc.Center); // Intentionally keeping the old laser sound in GFB - - if (astrumAureus.slimePhase == 1) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - astrumAureus.slimePhase = 0; - } - else - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float aureusLaserSpeed = 7f; - float aureusLaserTargetX = player.Center.X - npc.Center.X; - float aureusLaserTargetY = player.Center.Y - npc.Center.Y; - float aureusLaserTargetDist = (float)Math.Sqrt(aureusLaserTargetX * aureusLaserTargetX + aureusLaserTargetY * aureusLaserTargetY); - aureusLaserTargetDist = aureusLaserSpeed / aureusLaserTargetDist; - aureusLaserTargetX *= aureusLaserTargetDist; - aureusLaserTargetY *= aureusLaserTargetDist; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX, aureusLaserTargetY, type, damage, 0f, Main.myPlayer); - for (int i = 0; i < 4; i++) - { - Vector2 offset = new Vector2(Main.rand.Next(-6, 7), Main.rand.Next(-6, 7)); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, aureusLaserTargetX + offset.X, aureusLaserTargetY + offset.Y, type, damage, 0f, Main.myPlayer); - } - } - astrumAureus.slimePhase = 1; - } - } - RevengeanceAndDeathAI.BuffedMimicAI(npc, mod); - npc.noGravity = false; - npc.noTileCollide = false; - return; - } - else - { - npc.noGravity = true; - } - - // Emit light when not Idle - if (npc.ai[0] != 1f) - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.3f, 0.5f, 0f); - - // Fire projectiles while walking, teleporting, or falling - if (npc.ai[0] == 2f || npc.ai[0] >= 5f) - { - if (!dontAttack) - npc.localAI[0] += npc.ai[0] == 2f ? 1f : astralFlameBarrageTimerIncrement; - - float astralFlameBarrageGateValue = phase4 ? 30f : 60f; - if (npc.localAI[0] >= astralFlameBarrageGateValue) - { - // Fire astral flames while teleporting - if (npc.ai[0] >= 5f && npc.ai[0] != 7) - { - npc.localAI[0] = 0f; - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.FlameCrystalSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float velocity = death ? (8f + npc.localAI[2] * 0.025f) : 7f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float spreadLimit = (phase4 ? 100f : 50f) + enrageScale * 50f; - float randomSpread = (Main.rand.NextFloat() - 0.5f) * spreadLimit; - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X + randomSpread, spawnVector.Y - 100f * npc.scale); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, Vector2.Normalize(destination - spawnVector) * velocity, type, damage, 0f, Main.myPlayer); - } - } - } - - float laserBarrageGateValue = phase5 ? 160f : phase3 ? 120f : phase2 ? 80f : 60f; - if (npc.localAI[0] >= laserBarrageGateValue) - { - // Fire astral lasers while walking - if (npc.ai[0] == 2f) - { - npc.localAI[0] = 0f; - - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); - - if (calamityGlobalNPC.newAI[2] == 0f) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase2 ? (bossRush ? 5 : 3) : (bossRush ? 7 : 5); - int spread = !phase2 ? (bossRush ? 11 : 8) : (bossRush ? 12 : 10); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - - if (phase3) - { - float flameVelocity = walkingProjectileVelocity; - maxProjectiles = 2; - spread = 45; - - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * flameVelocity; - rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 19 : death ? 17 : 15); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int centralLaser = maxProjectiles / 2; - int[] lasersToNotFire = new int[6] { centralLaser - 3, centralLaser - 2, centralLaser - 1, centralLaser + 1, centralLaser + 2, centralLaser + 3 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * walkingProjectileVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3] && i != lasersToNotFire[4] && i != lasersToNotFire[5]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, walkingProjectileVelocity * 2f); - } - } - } - } - } - } - } - else - npc.localAI[0] = 0f; - - // Start up - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 1f; - npc.netUpdate = true; - CustomGravity(); - } - - // Idle - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Slow down - npc.velocity.X *= 0.8f; - - // Stay vulnerable for 3 seconds - npc.ai[1] += 1f; - if (npc.justHit && masterMode) - npc.ai[1] += 3f; - if (npc.Distance(player.Center) < 240f) - npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; - - if (npc.ai[1] >= 180f || bossRush) - { - // Set AI to random state and reset other AI arrays - npc.TargetClosest(); - switch (Main.rand.Next(phase3 ? 3 : 2)) - { - case 0: - npc.ai[0] = 2f; - break; - - case 1: - npc.ai[0] = 3f; - break; - - case 2: - npc.ai[0] = 5f; - break; - - default: - break; - } - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - else - CustomGravity(); - } - - // Walk - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Set walking direction - if (Math.Abs(npc.Center.X - player.Center.X) < 200f * npc.scale) - { - npc.velocity.X *= 0.8f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - - if (npc.direction > 0) - npc.velocity.X = (npc.velocity.X * 20f + walkingVelocity) / 21f; - if (npc.direction < 0) - npc.velocity.X = (npc.velocity.X * 20f - walkingVelocity) / 21f; - } - - if (Collision.CanHit(npc.position, npc.width, npc.height, player.Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height) && player.position.Y <= npc.position.Y + npc.height && !npc.collideX) - { - CustomGravity(); - npc.noTileCollide = false; - } - else - { - npc.noTileCollide = true; - - // Walk through tiles if colliding with tiles and player is out of reach - int aureusHitboxWidth = 80; - int aureusHitboxHeight = 20; - Vector2 aureusHitboxTileCollideSize = new Vector2(npc.Center.X - (aureusHitboxWidth / 2), npc.position.Y + npc.height - aureusHitboxHeight); - - bool nearPlayerWalkingThroughTiles = false; - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width && npc.position.Y + npc.height < player.position.Y + player.height - 16f) - nearPlayerWalkingThroughTiles = true; - - if (nearPlayerWalkingThroughTiles) - { - npc.velocity.Y += 0.5f; - } - else if (Collision.SolidCollision(aureusHitboxTileCollideSize, aureusHitboxWidth, aureusHitboxHeight)) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y > -0.2) - npc.velocity.Y -= 0.025f; - else - npc.velocity.Y -= 0.2f; - - if (npc.velocity.Y < -4f) - npc.velocity.Y = -4f; - } - else - { - if (npc.velocity.Y < 0f) - npc.velocity.Y = 0f; - - if (npc.velocity.Y < 0.1) - npc.velocity.Y += 0.025f; - else - npc.velocity.Y += 0.5f; - } - } - - // Walk for a maximum of 6 seconds - if (!dontAttack) - { - npc.ai[1] += 1f; - if (npc.Distance(player.Center) < 240f) - npc.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; - } - - if (npc.ai[1] >= ((bossRush ? 270f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f))) - { - // Collide with tiles again - npc.noTileCollide = false; - - // Set AI to next phase (Jump) and reset other AI - npc.TargetClosest(); - npc.ai[0] = exhausted ? 1f : 3f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.netUpdate = true; - } - - // Limit downward velocity - if (npc.velocity.Y > 10f) - npc.velocity.Y = 10f; - } - - // Jump - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = false; - - if (npc.velocity.Y == 0f) - { - // Slow down - npc.velocity.X *= 0.8f; - - // Half second delay before jumping - if (!dontAttack) - npc.ai[1] += 1f; - - if (npc.ai[1] >= 30f) - { - npc.ai[1] = -20f; - } - else if (npc.ai[1] == -1f) - { - // Set damage - npc.damage = npc.defDamage; - - // Set jump velocity, reset and set AI to next phase (Stomp) - float distanceFromPlayerOnXAxis = npc.Center.X - player.Center.X; - npc.direction = distanceFromPlayerOnXAxis < 0 ? 1 : -1; - calamityGlobalNPC.newAI[3] = npc.direction; - - // The limit for how much Aureus can multiply its jump velocity - float speedMultLimit = 1f; - - // Maxes out when the player is a full 2000 pixels away from or above Aureus - float multiplier = 1f / 2000f; - - // Increase Aureus jump velocity X if it's far enough away from the player - float distanceAwayFromTarget = Math.Abs(distanceFromPlayerOnXAxis); - float distanceGateValue = 400f; - bool increaseJumpVelocityX = distanceAwayFromTarget > distanceGateValue && expertMode; - if (increaseJumpVelocityX) - { - calamityGlobalNPC.newAI[0] = (distanceAwayFromTarget - distanceGateValue) * multiplier; - if (calamityGlobalNPC.newAI[0] > speedMultLimit) - calamityGlobalNPC.newAI[0] = speedMultLimit; - } - - // Increase Aureus jump velocity Y if it's far enough above the player - float distanceBelowTarget = npc.position.Y - (player.position.Y + 80f); - bool increaseJumpVelocityY = distanceBelowTarget > 0f && revenge; - if (increaseJumpVelocityY) - { - calamityGlobalNPC.newAI[1] = distanceBelowTarget * multiplier; - if (calamityGlobalNPC.newAI[1] > speedMultLimit) - calamityGlobalNPC.newAI[1] = speedMultLimit; - } - - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 27f : 20f; - velocity += 6f * enrageScale; - if (expertMode) - velocity += death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - if (Main.getGoodWorld) - velocity *= 1.15f; - - npc.velocity = (new Vector2(player.Center.X, player.Center.Y - 500f) - npc.Center).SafeNormalize(Vector2.Zero) * velocity; - npc.velocity *= new Vector2(calamityGlobalNPC.newAI[0] + 1f, calamityGlobalNPC.newAI[1] + 1f); - - npc.noTileCollide = true; - - npc.ai[0] = 4f; - npc.ai[1] = 0f; - - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.JumpSound, npc.Center); - - npc.netUpdate = true; - } - } - - // Don't run custom gravity when starting a jump - if (npc.ai[0] != 4f) - CustomGravity(); - } - - // Stomp - else if (npc.ai[0] == 4f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Play stomp sound. Gotta specify the filepath to avoid confusion between the namespace and npc - SoundStyle soundToPlay = Main.zenithWorld ? NPCs.ExoMechs.Ares.AresGaussNuke.NukeExplosionSound : NPCs.AstrumAureus.AstrumAureus.StompSound; - SoundEngine.PlaySound(soundToPlay, npc.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 16 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - } - - // Stomp and jump again, if stomped twice then reset and set AI to next phase (Teleport or Idle) - npc.TargetClosest(); - npc.localAI[1] += 1f; - float maxStompAmt = phase5 ? 5f : phase3 ? 2f : 3f; - if (npc.localAI[1] >= maxStompAmt) - { - npc.ai[0] = exhausted ? 1f : (phase3 ? 5f : 2f); - npc.localAI[1] = 0f; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.noTileCollide = false; - npc.netUpdate = true; - } - else - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.ai[0] = 3f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - - // Spawn dust for visual effect - for (int i = (int)npc.position.X - 20; i < (int)npc.position.X + npc.width + 40; i += 20) - { - for (int j = 0; j < 4; j++) - { - int stompDust = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + npc.height), npc.width + 20, 4, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - Main.dust[stompDust].velocity *= 0.2f; - } - } - - // Fire lasers or flames on stomp - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.LaserSound, npc.Center); - - if (Main.zenithWorld) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 14 : death ? 12 : revenge ? 10 : expertMode ? 8 : 6; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 10f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 1f); - } - } - } - else if (calamityGlobalNPC.newAI[2] == 0f && phase2) - { - calamityGlobalNPC.newAI[2] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float flameVelocity = 6f; - int maxProjectiles = bossRush ? 4 : death ? 3 : 2; - int spread = bossRush ? 36 : death ? 28 : 20; - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 spawnVector = new Vector2(npc.Center.X, npc.Center.Y - 80f * npc.scale); - Vector2 destination = new Vector2(spawnVector.X, spawnVector.Y + 100f * npc.scale); - Vector2 projectileVelocity = Vector2.Normalize(destination - spawnVector) * flameVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector + Vector2.Normalize(perturbedSpeed) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - else - { - calamityGlobalNPC.newAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float laserVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 7f : death ? 6f : 5f; - int maxProjectiles = !phase3 ? (bossRush ? 13 : death ? 11 : 9) : (bossRush ? 17 : death ? 15 : 13); - int spread = !phase3 ? (bossRush ? 20 : death ? 18 : 16) : (bossRush ? 24 : death ? 22 : 20); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int[] lasersToNotFire = new int[4] { 1, 3, maxProjectiles - 2, maxProjectiles - 4 }; - Vector2 projectileVelocity = Vector2.Normalize(player.Center - npc.Center) * laserVelocity; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < maxProjectiles; i++) - { - if (i != lasersToNotFire[0] && i != lasersToNotFire[1] && i != lasersToNotFire[2] && i != lasersToNotFire[3]) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(maxProjectiles - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, laserVelocity * 2f); - } - } - } - } - } - else - { - // Set damage - npc.damage = npc.defDamage; - - // Set velocities while falling, this happens before the stomp - // Fall through - if (!player.dead) - { - if ((player.position.Y > npc.Bottom.Y && npc.velocity.Y > 0f) || (player.position.Y < npc.Bottom.Y && npc.velocity.Y < 0f)) - npc.noTileCollide = true; - else if ((npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) || (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidCollision(npc.position, npc.width, npc.height))) - npc.noTileCollide = false; - } - - if (npc.position.X < player.position.X && npc.position.X + npc.width > player.position.X + player.width) - { - // Make sure Aureus falls quickly when directly on top of or below the player - if (npc.ai[3] < 30f) - npc.ai[3] = 30f; - - npc.velocity.X *= 0.8f; - - if (npc.Bottom.Y < player.position.Y) - { - // Make sure Aureus falls rather quickly - if (npc.velocity.Y < -3f) - npc.velocity.Y = -3f; - - float fallSpeed = 1.2f; - fallSpeed += 0.36f * enrageScale; - if (expertMode) - fallSpeed += death ? 0.36f * (1f - lifeRatio) : 0.24f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - fallSpeed += 0.5f; - - if (calamityGlobalNPC.newAI[1] > 0f) - fallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - npc.velocity.Y += fallSpeed; - } - } - else - { - // Push Aureus towards the player on the X axis if he's not directly on top of or below the player - float velocityXChange = 0.2f + Math.Abs(npc.Center.X - player.Center.X) * 0.0001f; - velocityXChange += 0.1f * enrageScale; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXChange *= calamityGlobalNPC.newAI[0] + 1f; - - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; - - float velocityXCap = 12f; - velocityXCap += 3.6f * enrageScale; - if (expertMode) - velocityXCap += death ? 3.6f * (1f - lifeRatio) : 2.4f * (1f - lifeRatio); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - velocityXCap += 5f; - - if (calamityGlobalNPC.newAI[0] > 0f) - velocityXCap *= calamityGlobalNPC.newAI[0] + 1f; - - float playerLocation = npc.Center.X - player.Center.X; - int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; - bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[3]; - - if (slowDown) - velocityXCap *= 0.333f; - - if (npc.velocity.X < -velocityXCap) - npc.velocity.X = -velocityXCap; - if (npc.velocity.X > velocityXCap) - npc.velocity.X = velocityXCap; - } - - // Don't start falling quickly until half a second has passed - npc.ai[3] += 1f; - if (npc.ai[3] > 30f) - CustomGravity(); - } - } - - // Teleport - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Slow down - npc.velocity.X *= 0.8f; - - // Start teleport - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - npc.localAI[1] += 1f; - if (death) - npc.localAI[2] += 1.25f; - } - - if (npc.localAI[1] >= (bossRush ? 60f : death ? 180f : 240f)) - { - // Reset localAI and find a teleport destination - npc.TargetClosest(); - npc.localAI[1] = 0f; - - Vector2 vectorAimedAheadOfTarget = Main.player[npc.target].Center + new Vector2((float)Math.Round(Main.player[npc.target].velocity.X), 0f).SafeNormalize(Vector2.Zero) * 1000f; - Point point4 = vectorAimedAheadOfTarget.ToTileCoordinates(); - int teleportTries = 0; - while (teleportTries < 100) - { - teleportTries++; - int teleportTileX = Main.rand.Next(point4.X - 5, point4.X + 6); - int teleportTileY = Main.rand.Next(point4.Y - 5, point4.Y); - - if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) - { - npc.ai[1] = teleportTileX * 16 + 8; - npc.ai[3] = teleportTileY * 16 + 16; - break; - } - } - - // Default teleport if the above conditions aren't met in 100 iterations - if (teleportTries >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.ai[1] = bottom.X; - npc.ai[3] = bottom.Y; - } - - // Set AI to next phase (Mid-teleport) - npc.ai[0] = 6f; - npc.netUpdate = true; - } - } - - CustomGravity(); - } - - // Mid-teleport - else if (npc.ai[0] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (death) - npc.localAI[2] += 1.25f; - - if (phase4) - { - if (death) - npc.localAI[2] += 1.25f; - } - - // Turn invisible - npc.alpha += 10; - if (npc.alpha >= 255) - { - // Set position to teleport destination - npc.Bottom = new Vector2(npc.ai[1], npc.ai[3]); - - // Reset alpha and set AI to next phase (End of teleport) - npc.alpha = 255; - npc.ai[0] = 7f; - npc.localAI[2] = 0f; - npc.netUpdate = true; - } - - // Play sound for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(AstrumAureus.AstrumAureus.TeleportSound, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - // End of teleport - else if (npc.ai[0] == 7f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Turn visible - npc.alpha -= 10; - if (npc.alpha <= 0) - { - // Spawn Aureus Spawns - bool spawnFlag = expertMode; - if (NPC.CountNPCS(ModContent.NPCType()) >= 2) - spawnFlag = false; - - if (spawnFlag && Main.netMode != NetmodeID.MultiplayerClient) - { - int aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -10f; - Main.npc[aureusSpawn].netUpdate = true; - if (revenge) - { - aureusSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.Center.Y - 25f * npc.scale), ModContent.NPCType()); - Main.npc[aureusSpawn].velocity.Y = -15f; - Main.npc[aureusSpawn].netUpdate = true; - } - - if (death) - { - int damageAmt = npc.lifeMax / 50; - npc.life -= damageAmt; - if (npc.life < 1) - npc.life = 1; - - npc.DamageEffect(damageAmt); - } - } - - // Reset alpha and set AI to next phase (Idle) - npc.alpha = 0; - npc.ai[0] = exhausted ? 1f : 2f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.localAI[3] = noProjectileOrPhaseIncrementTime; - - // Stop colliding with tiles if entering walking phase - npc.noTileCollide = npc.ai[0] == 2f; - - npc.netUpdate = true; - } - - // Play sound at teleport destination for cool effect - if (npc.soundDelay == 0) - { - npc.soundDelay = 15; - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - } - - // Emit dust to make the teleport pretty - for (int i = 0; i < 10; i++) - { - int teleportDust = Dust.NewDust(npc.position, npc.width, npc.height, ModContent.DustType(), npc.velocity.X, npc.velocity.Y, 255, default, 2f); - Main.dust[teleportDust].noGravity = true; - Main.dust[teleportDust].velocity *= 0.5f; - } - - CustomGravity(); - } - - void CustomGravity() - { - float gravity = 0.36f + 0.12f * enrageScale; - float maxFallSpeed = reduceFallSpeed ? 12f : 12f + 4f * enrageScale; - - if (calamityGlobalNPC.newAI[1] > 0f && !reduceFallSpeed) - maxFallSpeed *= calamityGlobalNPC.newAI[1] + 1f; - - if (Main.getGoodWorld && !reduceFallSpeed) - { - gravity *= 1.15f; - maxFallSpeed *= 1.15f; - } - - npc.velocity.Y += gravity; - if (npc.velocity.Y > maxFallSpeed) - npc.velocity.Y = maxFallSpeed; - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs deleted file mode 100644 index c7bc0300cc..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/AstrumDeusAI.cs +++ /dev/null @@ -1,915 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Packets; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class AstrumDeusAI - { - public static void VanillaAstrumDeusAI(NPC npc, Mod mod, bool head) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Difficulty variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float enrageScale = bossRush ? 0.5f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1.5f; - } - - // Deus cannot hit for 3 seconds or while invulnerable - bool doNotDealDamage = calamityGlobalNPC.newAI[1] < 180f || npc.dontTakeDamage; - if (doNotDealDamage) - npc.damage = 0; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; - bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - // Despawn safety, make sure to target another player if the current player target is too far away - if (increaseSpeedMore && head) - npc.TargetClosest(); - - // Inflict Extreme Gravity to nearby players - if (revenge) - { - if (!Main.dedServ) - { - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < CalamityGlobalNPC.CatchUpDistance350Tiles) - Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); - } - } - - // Life - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases based on life percentage - bool halfHealth = lifeRatio < 0.5f; - bool doubleWormPhase = calamityGlobalNPC.newAI[0] != 0f; - bool startFlightPhase = lifeRatio < 0.8f || death || doubleWormPhase; - bool phase2 = lifeRatio < 0.5f && doubleWormPhase && expertMode; - bool phase3 = lifeRatio < 0.2f && doubleWormPhase && expertMode; - bool splittingMines = lifeRatio < 0.7f; - bool movingMines = lifeRatio < 0.3f && doubleWormPhase && expertMode; - bool deathModeEnragePhase_Head = calamityGlobalNPC.newAI[0] == 3f; - bool deathModeEnragePhase_BodyAndTail = false; - - // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - float resistanceTime = doubleWormPhase ? 300f : 600f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < resistanceTime; - - // Flight timer - float aiSwitchTimer = doubleWormPhase ? (Main.getGoodWorld ? 600f : 1200f) : (Main.getGoodWorld ? 900f : 1800f); - - calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= aiSwitchTimer) - calamityGlobalNPC.newAI[3] = 0f; - // Sound effect for swapping between attack behaviors in phase 2 - if (doubleWormPhase && calamityGlobalNPC.newAI[3] % aiSwitchTimer == 0f && !(deathModeEnragePhase_Head || deathModeEnragePhase_BodyAndTail)) - SoundEngine.PlaySound(AstrumDeusHead.SplitSound with { Pitch = -0.2f, Volume = 0.9f }, player.Center); - - // Phase for flying at the player - bool flyAtTarget = calamityGlobalNPC.newAI[3] >= (aiSwitchTimer * 0.5f) && startFlightPhase; - - // Length of worms - int phase1Length = death ? 80 : revenge ? 70 : expertMode ? 60 : 50; - int phase2Length = death ? 40 : revenge ? 35 : expertMode ? 30 : 25; - int gfbLength = death ? 8 : revenge ? 7 : expertMode ? 6 : 5; - int maxLength = Main.zenithWorld && doubleWormPhase ? gfbLength : doubleWormPhase ? phase2Length : phase1Length; - - // Become gradually more pissed as more worms are killed - int gfbMaxWormCount = 10; - int gfbWormCount = 0; - if (CalamityWorld.LegendaryMode && revenge) - gfbWormCount = NPC.CountNPCS(ModContent.NPCType()); - if (gfbWormCount > gfbMaxWormCount) - gfbWormCount = gfbMaxWormCount; - if (gfbWormCount > 0) - enrageScale += (gfbMaxWormCount - gfbWormCount) * 0.111f; - - // Split into two worms - if (head) - { - float splitAnimationTime = 180f; - bool oneWormAlive = NPC.CountNPCS(ModContent.NPCType()) < 2; - bool deathModeFinalWormEnrage = death && doubleWormPhase && oneWormAlive && calamityGlobalNPC.newAI[1] >= resistanceTime; - if (deathModeFinalWormEnrage) - { - if (calamityGlobalNPC.newAI[0] != 3f) - { - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - calamityGlobalNPC.newAI[0] = 3f; - npc.defense = 12; - calamityGlobalNPC.DR = 0.075f; - - // Despawns the other deus worm segments - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - - if ((wormseg.type == bodyID || wormseg.type == tailID) && Main.npc[(int)wormseg.ai[2]].Calamity().newAI[0] != 3f) - { - wormseg.life = 0; - wormseg.active = false; - } - } - } - - calamityGlobalNPC.newAI[2] += 10f; - if (calamityGlobalNPC.newAI[2] > 162f) - calamityGlobalNPC.newAI[2] = 162f; - - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - } - - bool despawnRemainingWorm = doubleWormPhase && oneWormAlive && !death; - if ((halfHealth && calamityGlobalNPC.newAI[0] == 0f) || despawnRemainingWorm) - { - npc.dontTakeDamage = true; - - calamityGlobalNPC.newAI[2] += despawnRemainingWorm ? 10f : 1f; - npc.Opacity = MathHelper.Clamp(1f - (calamityGlobalNPC.newAI[2] / splitAnimationTime), 0f, 1f); - - bool despawning = calamityGlobalNPC.newAI[2] == splitAnimationTime; - - // - // CODE TWEAKED BY: OZZATRON - // September 20th, 2020 - // reason: fixing Astrum Deus death mode NPC cap bug - // - - // Despawn the unsplit Astrum Deus and spawn two half-size Astrum Deus worms. - if (despawning) - { - // If this is already a split worm (newAI[0] != 0f) then don't do anything. At all. - if (doubleWormPhase) - return; - - // Mark all existing body and tail segments as inactive. This instantly frees up their NPC slots for the freshly spawned worms. - int bodyID = ModContent.NPCType(); - int tailID = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC wormseg = Main.npc[i]; - if (!wormseg.active) - continue; - if (wormseg.type == bodyID || wormseg.type == tailID) - { - wormseg.life = 0; - wormseg.active = false; - } - } - - // The unsplit Astrum Deus worm head will die next frame. - npc.life = 0; - - // Do not spawn worms client side. The server handles this. - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int wormamt = Main.zenithWorld ? 5 : 1; - for (int i = 0; i < wormamt; i++) - { - // Now that the original worm doesn't exist, startCount can be zero. - // int startCount = npc.whoAmI + phase1Length + 1; - int startIndexHeadOne = 1; - int headOneID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadOne); - Main.npc[headOneID].Calamity().newAI[0] = 1f; - Main.npc[headOneID].velocity = Vector2.Normalize(player.Center - Main.npc[headOneID].Center) * 16f; - Main.npc[headOneID].timeLeft *= 20; - Main.npc[headOneID].ForceNetUpdate(); - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[headOneID]); - } - - // Make sure the second split worm is also contiguous. - int startIndexHeadTwo = startIndexHeadOne + phase2Length + 1; - int headTwoID = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, npc.type, startIndexHeadTwo); - Main.npc[headTwoID].Calamity().newAI[0] = 2f; - Main.npc[headTwoID].Calamity().newAI[3] = Main.getGoodWorld ? 300f : 600f; - Main.npc[headTwoID].velocity = Vector2.Normalize(player.Center - Main.npc[headTwoID].Center) * 16f; - Main.npc[headTwoID].timeLeft *= 20; - Main.npc[headTwoID].ForceNetUpdate(); - - // On server, immediately send the correct extra AI of this head to clients. - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[headTwoID]); - } - } - - SoundEngine.PlaySound(AstrumDeusHead.SplitSound, player.Center); - } - return; - } - } - - if (Main.zenithWorld && calamityGlobalNPC.newAI[1] < 10f) // desync the deuses - { - float pushForce = 0.25f; - for (int k = 0; k < Main.maxNPCs; k++) - { - NPC otherDeus = Main.npc[k]; - // Short circuits to make the loop as fast as possible - if (!otherDeus.active || k == npc.whoAmI) - continue; - - // If the other projectile is indeed the same owned by the same player and they're too close, nudge them away. - bool sameProjType = otherDeus.type == npc.type; - float taxicabDist = Vector2.Distance(npc.Center, otherDeus.Center); - float distancegate = 320f; - if (sameProjType && taxicabDist < distancegate) - { - if (npc.position.X < otherDeus.position.X) - npc.velocity.X -= pushForce; - else - npc.velocity.X += pushForce; - - if (npc.position.Y < otherDeus.position.Y) - npc.velocity.Y -= pushForce; - else - npc.velocity.Y += pushForce; - } - } - } - } - - // Copy dontTakeDamage and Opacity from head - else - { - npc.dontTakeDamage = Main.npc[(int)npc.ai[2]].dontTakeDamage; - npc.Opacity = Main.npc[(int)npc.ai[2]].Opacity; - deathModeEnragePhase_BodyAndTail = Main.npc[(int)npc.ai[2]].Calamity().newAI[0] == 3f; - - if (deathModeEnragePhase_BodyAndTail) - { - npc.defense = 25; - calamityGlobalNPC.DR = 0.15f; - } - } - - // Set worm variable - if (npc.ai[2] > 0f) - npc.realLife = (int)npc.ai[2]; - - // Alpha effects - if ((head || Main.npc[(int)npc.ai[1]].alpha < 128) && !npc.dontTakeDamage) - { - // Alpha changes - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - // Check if other segments are still alive, if not, die - if (!head) - { - bool shouldDespawn = true; - int headType = ModContent.NPCType(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type != headType || !Main.npc[i].active) - continue; - shouldDespawn = false; - break; - } - if (shouldDespawn) - { - if (Main.npc.IndexInRange((int)npc.ai[1]) && Main.npc[(int)npc.ai[1]].active && Main.npc[(int)npc.ai[1]].life > 0) - shouldDespawn = false; - } - if (shouldDespawn) - { - npc.life = 0; - npc.HitEffect(0, 10.0); - npc.checkDead(); - npc.active = false; - npc.ForceNetUpdate(false); - } - } - - // Direction - if (npc.velocity.X < 0f) - npc.spriteDirection = -1; - else if (npc.velocity.X > 0f) - npc.spriteDirection = 1; - - // Head code - if (head) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f) - { - int Previous = npc.whoAmI; - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - for (int segments = 0; segments < maxLength; segments++) - { - int lol; - if (segments >= 0 && segments < maxLength - 1) - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, bodyType, npc.whoAmI); - else - lol = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, tailType, npc.whoAmI); - - if (segments % 2 == 0) - Main.npc[lol].localAI[3] = 1f; - - Main.npc[lol].realLife = npc.whoAmI; - Main.npc[lol].Calamity().newAI[0] = Main.npc[Previous].Calamity().newAI[0]; - Main.npc[lol].Calamity().newAI[3] = Main.npc[Previous].Calamity().newAI[3]; - - if (Main.dedServ) - { - SyncCalamityNPCAIArrayPacket.Send(Main.npc[lol]); - } - - Main.npc[lol].ai[3] = segments + 1; - Main.npc[lol].ai[2] = npc.whoAmI; - Main.npc[lol].ai[1] = Previous; - Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol); - Previous = lol; - } - } - } - - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - else - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - bool hasJustSpawned = calamityGlobalNPC.newAI[1] < resistanceTime * 0.4f && !doubleWormPhase; // Speed boost for the first 4 seconds after spawning - float segmentVelocity = hasJustSpawned ? 25f : deathModeEnragePhase_Head ? 19f : death ? 17.5f : 16f; - - float segmentVelocityBoost = 5f * (1f - lifeRatio); - segmentVelocity += segmentVelocityBoost; - segmentVelocity += 4f * enrageScale; - - if (revenge) - { - float revMultiplier = 1.1f; - segmentVelocity *= revMultiplier; - } - - if (head) - { - int headTilePositionX = (int)(npc.position.X / 16f) - 1; - int headTileWidthPosX = (int)((npc.position.X + npc.width) / 16f) + 2; - int headTilePositionY = (int)(npc.position.Y / 16f) - 1; - int headTileWidthPosY = (int)((npc.position.Y + npc.height) / 16f) + 2; - - if (headTilePositionX < 0) - headTilePositionX = 0; - if (headTileWidthPosX > Main.maxTilesX) - headTileWidthPosX = Main.maxTilesX; - if (headTilePositionY < 0) - headTilePositionY = 0; - if (headTileWidthPosY > Main.maxTilesY) - headTileWidthPosY = Main.maxTilesY; - - // Fly or not - bool shouldFly = flyAtTarget; - if (!shouldFly) - { - for (int k = headTilePositionX; k < headTileWidthPosX; k++) - { - for (int l = headTilePositionY; l < headTileWidthPosY; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - Vector2 vector2; - vector2.X = k * 16f; - vector2.Y = l * 16f; - if (npc.position.X + npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - shouldFly = true; - break; - } - } - } - } - } - - // Start flying if target is not within a certain distance - if (!shouldFly) - { - npc.localAI[1] = 1f; - - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = 200; - int heightReduction = death ? 130 : (int)(130f * (1f - lifeRatio)); - int height = 400 - heightReduction; - bool outsideNoFlyZone = true; - - if (npc.position.Y > player.position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - noFlyZone, (int)Main.player[m].position.Y - noFlyZone, noFlyZone * 2, height); - if (rectangle.Intersects(rectangle2)) - { - outsideNoFlyZone = false; - break; - } - } - } - - if (outsideNoFlyZone) - shouldFly = true; - } - } - else - npc.localAI[1] = 0f; - - // Despawn - if (player.dead) - { - shouldFly = false; - float velocity = 2f; - npc.velocity.Y -= velocity; - if ((double)npc.position.Y < Main.topWorld + 16f) - { - segmentVelocity *= 2f; - npc.velocity.Y -= velocity; - } - - int headType = ModContent.NPCType(); - int bodyType = ModContent.NPCType(); - int tailType = ModContent.NPCType(); - if ((double)npc.position.Y < Main.topWorld + 16f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].type == headType || Main.npc[i].type == bodyType || Main.npc[i].type == tailType) - { - Main.npc[i].active = false; - Main.npc[i].ForceNetUpdate(false); - } - } - } - } - - // Speed and movement - float speedBoost = death ? (0.1f * (1f - lifeRatio)) : (0.13f * (1f - lifeRatio)); - float turnSpeedBoost = death ? (0.18f * (1f - lifeRatio)) : (0.2f * (1f - lifeRatio)); - float speed = (hasJustSpawned ? 0.26f : deathModeEnragePhase_Head ? 0.2f : death ? 0.18f : 0.13f) + speedBoost; - float turnSpeed = (hasJustSpawned ? 0.3f : deathModeEnragePhase_Head ? 0.27f : death ? 0.25f : 0.2f) + turnSpeedBoost; - speed += 0.05f * enrageScale; - turnSpeed += 0.08f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = deathModeEnragePhase_Head ? 1.25f : doubleWormPhase ? (phase3 ? 1.25f : phase2 ? 1.2f : 1.15f) : 1f; - speed *= speedMultiplier; - } - - if (revenge) - { - float revMultiplier = 1.1f; - speed *= revMultiplier; - turnSpeed *= revMultiplier; - } - - speed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - turnSpeed *= increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; - - if (Main.getGoodWorld) - { - speed *= 1.15f; - turnSpeed *= 1.15f; - } - - Vector2 deusCenter = npc.Center; - float deusTargetX = player.Center.X; - float deusTargetY = player.Center.Y; - deusTargetX = (int)(deusTargetX / 16f) * 16; - deusTargetY = (int)(deusTargetY / 16f) * 16; - deusCenter.X = (int)(deusCenter.X / 16f) * 16; - deusCenter.Y = (int)(deusCenter.Y / 16f) * 16; - deusTargetX -= deusCenter.X; - deusTargetY -= deusCenter.Y; - - if (!shouldFly) - { - npc.velocity.Y += 0.15f; - if (npc.velocity.Y > segmentVelocity) - npc.velocity.Y = segmentVelocity; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > speed; - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= speed * 1.1f; - else - npc.velocity.X += speed * 1.1f; - } - else if (npc.velocity.Y == segmentVelocity) - { - if (slowXVelocity) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += speed * 0.9f; - else - npc.velocity.X -= speed * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - float deusTargetDist = (float)Math.Sqrt(deusTargetX * deusTargetX + deusTargetY * deusTargetY); - float deusAbsoluteTargetX = Math.Abs(deusTargetX); - float deusAbsoluteTargetY = Math.Abs(deusTargetY); - float deusTimeToReachTarget = segmentVelocity / deusTargetDist; - deusTargetX *= deusTimeToReachTarget; - deusTargetY *= deusTimeToReachTarget; - - bool speedUpWhileFlying = false; - if (flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f) || (npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f)) && Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) > speed / 2f && deusTargetDist < 400f) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < segmentVelocity) - npc.velocity *= 1.1f; - } - - if (npc.position.Y > player.position.Y) - { - speedUpWhileFlying = true; - - if (Math.Abs(npc.velocity.X) < segmentVelocity / 2f) - { - if (npc.velocity.X == 0f) - npc.velocity.X -= npc.direction; - - npc.velocity.X *= 1.1f; - } - else if (npc.velocity.Y > -segmentVelocity) - npc.velocity.Y -= speed; - } - } - - if (!speedUpWhileFlying) - { - if (!flyAtTarget) - { - if (((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f)) && ((npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f))) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += turnSpeed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= turnSpeed; - - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += turnSpeed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= turnSpeed; - } - } - - if ((npc.velocity.X > 0f && deusTargetX > 0f) || (npc.velocity.X < 0f && deusTargetX < 0f) || (npc.velocity.Y > 0f && deusTargetY > 0f) || (npc.velocity.Y < 0f && deusTargetY < 0f)) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed; - - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed; - - if (Math.Abs(deusTargetY) < segmentVelocity * 0.2 && ((npc.velocity.X > 0f && deusTargetX < 0f) || (npc.velocity.X < 0f && deusTargetX > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed * 2f; - else - npc.velocity.Y -= speed * 2f; - } - - if (Math.Abs(deusTargetX) < segmentVelocity * 0.2 && ((npc.velocity.Y > 0f && deusTargetY < 0f) || (npc.velocity.Y < 0f && deusTargetY > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed * 2f; - else - npc.velocity.X -= speed * 2f; - } - } - else if (deusAbsoluteTargetX > deusAbsoluteTargetY) - { - if (npc.velocity.X < deusTargetX) - npc.velocity.X += speed * 1.1f; - else if (npc.velocity.X > deusTargetX) - npc.velocity.X -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += speed; - else - npc.velocity.Y -= speed; - } - } - else - { - if (npc.velocity.Y < deusTargetY) - npc.velocity.Y += speed * 1.1f; - else if (npc.velocity.Y > deusTargetY) - npc.velocity.Y -= speed * 1.1f; - - if ((Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < segmentVelocity * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += speed; - else - npc.velocity.X -= speed; - } - } - } - } - - if (shouldFly) - { - if (npc.localAI[0] != 1f) - npc.ForceNetUpdate(false); - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.ForceNetUpdate(false); - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.ForceNetUpdate(false); - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - } - - // Only the main worm body and tail use this code - else - { - // Shoot lasers - if (npc.type == ModContent.NPCType()) - { - npc.localAI[0] += 1f; - - int shootTime = (doubleWormPhase && expertMode) ? 2 : 1; - float shootProjectile = (doubleWormPhase && expertMode) ? 200 : 400; - float timer = npc.ai[0] + 15f; - float divisor = timer + shootProjectile; - bool canFireProjectiles = npc.Opacity >= 1f; - bool shootGodRays = phase2 || deathModeEnragePhase_BodyAndTail; - - if (canFireProjectiles) - { - if (!flyAtTarget || deathModeEnragePhase_BodyAndTail) - { - float laserDivisor = (phase2 && !deathModeEnragePhase_BodyAndTail) ? 4f : 2f; - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % laserDivisor == 0f) - { - npc.TargetClosest(); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (deathModeEnragePhase_BodyAndTail) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(90, 121) * 0.01f; - velocity = randomMineMovement; - } - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - - if (Vector2.Distance(player.Center, npc.Center) > 80f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float deusLaserSpeed = (death ? 16f : revenge ? 14f : 13f) + enrageScale * 4f; - - Vector2 deusLaserCenter = npc.Center; - float deusLaserTargetX = player.Center.X - deusLaserCenter.X; - float deusLaserTargetY = player.Center.Y - deusLaserCenter.Y; - float deusLaserTargetDist = (float)Math.Sqrt(deusLaserTargetX * deusLaserTargetX + deusLaserTargetY * deusLaserTargetY); - deusLaserTargetDist = deusLaserSpeed / deusLaserTargetDist; - deusLaserTargetX *= deusLaserTargetDist; - deusLaserTargetY *= deusLaserTargetDist; - deusLaserCenter.X += deusLaserTargetX * 5f; - deusLaserCenter.Y += deusLaserTargetY * 5f; - - Vector2 shootDirection = new Vector2(deusLaserTargetX, deusLaserTargetY).SafeNormalize(Vector2.UnitY); - Vector2 laserVelocity = shootDirection * deusLaserSpeed; - - int type = shootGodRays ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (shootGodRays) - { - SoundEngine.PlaySound(AstrumDeusHead.GodRaySound, npc.Center); - // Waving beams need to start offset so they cross each other neatly. - float waveSideOffset = Main.rand.NextFloat(9f, 14f); - Vector2 perp = shootDirection.RotatedBy(-MathHelper.PiOver2) * waveSideOffset; - - for (int i = -1; i <= 1; i += 2) - { - Vector2 laserStartPos = deusLaserCenter + i * perp + Main.rand.NextVector2CircularEdge(6f, 6f); - Projectile godRay = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), laserStartPos, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - - // Tell this Phased God Ray exactly which way it should be waving. - godRay.localAI[1] = i * 0.5f; - } - } - else - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, npc.Center); - Projectile.NewProjectile(npc.GetSource_FromAI(), deusLaserCenter, laserVelocity, type, damage, 0f, Main.myPlayer, player.Center.X, player.Center.Y); - } - } - } - } - } - else - { - if (npc.localAI[0] % divisor == 0f && npc.ai[0] % 2f == 0f) - { - Vector2 velocity = Vector2.Zero; - if (movingMines) - { - Vector2 randomMineMovement = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); - randomMineMovement.Normalize(); - randomMineMovement *= Main.rand.Next(30, 121) * 0.01f; - velocity = randomMineMovement; - } - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float split = (splittingMines && npc.ai[0] % 3f == 0f) ? 1f : 0f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity, type, damage, 0f, Main.myPlayer, split, 0f); - } - } - } - } - - // Follow the head - Vector2 segmentCenter = npc.Center; - float segmentTargetX = player.Center.X; - float segmentTargetY = player.Center.Y; - segmentTargetX = (int)(segmentTargetX / 16f) * 16; - segmentTargetY = (int)(segmentTargetY / 16f) * 16; - segmentCenter.X = (int)(segmentCenter.X / 16f) * 16; - segmentCenter.Y = (int)(segmentCenter.Y / 16f) * 16; - segmentTargetX -= segmentCenter.X; - segmentTargetY -= segmentCenter.Y; - - if (npc.ai[1] > 0f && npc.ai[1] < Main.npc.Length) - { - try - { - segmentCenter = npc.Center; - segmentTargetX = Main.npc[(int)npc.ai[1]].Center.X - segmentCenter.X; - segmentTargetY = Main.npc[(int)npc.ai[1]].Center.Y - segmentCenter.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(segmentTargetY, segmentTargetX) + MathHelper.PiOver2; - float segmentTargetDist = (float)Math.Sqrt(segmentTargetX * segmentTargetX + segmentTargetY * segmentTargetY); - int segmentWidth = npc.width; - segmentTargetDist = (segmentTargetDist - segmentWidth) / segmentTargetDist; - segmentTargetX *= segmentTargetDist; - segmentTargetY *= segmentTargetDist; - npc.velocity = Vector2.Zero; - npc.position.X = npc.position.X + segmentTargetX; - npc.position.Y = npc.position.Y + segmentTargetY; - - if (segmentTargetX < 0f) - npc.spriteDirection = -1; - else if (segmentTargetX > 0f) - npc.spriteDirection = 1; - } - } - - // Play spawn sound on Deus on the first frame because otherwise the sound wouldn't play properly in multiplayer - if (calamityGlobalNPC.newAI[1] == 0f && !doubleWormPhase) - { - SoundEngine.PlaySound(AstrumDeusHead.SpawnSound, npc.Center); - calamityGlobalNPC.newAI[1] = 1f; - } - - // 5 seconds of resistance in phase 2, 10 seconds in phase 1, to prevent spawn killing - if (calamityGlobalNPC.newAI[1] < resistanceTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 1f)) - calamityGlobalNPC.newAI[1] += 1f; - - // Calculate contact damage based on velocity - if (!doNotDealDamage) - { - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - if (head) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs deleted file mode 100644 index 3719557ee3..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/BrimstoneElementalAI.cs +++ /dev/null @@ -1,737 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class BrimstoneElementalAI - { - public static void VanillaBrimstoneElementalAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - BrimstoneElemental.BrimstoneElemental brimmy = npc.ModNPC(); - - // Used for Brimling AI states - CalamityGlobalNPC.brimstoneElemental = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1.2f, 0f, 0f); - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - bool despawnDistance = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - - if (!player.active || player.dead || despawnDistance) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || despawnDistance) - { - npc.rotation = npc.velocity.X * 0.04f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - CalamityPlayer modPlayer = player.Calamity(); - - // Reset defense - npc.defense = npc.defDefense; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == 4f; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables for buffing the AI - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - bool phase2 = lifeRatio < 0.5f && revenge; - bool phase3 = lifeRatio < 0.33f; - - // Enrage - if ((!player.ZoneUnderworldHeight || !modPlayer.ZoneCalamity) && !bossRush) - { - if (calamityGlobalNPC.newAI[3] > 0f) - calamityGlobalNPC.newAI[3] -= 1f; - } - else - calamityGlobalNPC.newAI[3] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = calamityGlobalNPC.newAI[3] <= 0f || bossRush; - - float enrageScale = bossRush ? 0.5f : 0f; - if (biomeEnraged && (!player.ZoneUnderworldHeight || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - if (biomeEnraged && (!modPlayer.ZoneCalamity || bossRush)) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - npc.Calamity().DR = npc.ai[0] == 4f ? 0.6f : 0.2f; - - // Emit dust - int dustAmt = (npc.ai[0] == 2f) ? 2 : 1; - int size = (npc.ai[0] == 2f) ? 50 : 35; - if (npc.ai[0] != 1f) - { - for (int i = 0; i < 2; i++) - { - if (Main.rand.Next(3) < dustAmt) - { - int dust = Dust.NewDust(npc.Center - new Vector2(size), size * 2, size * 2, DustID.LifeDrain, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.2f; - Main.dust[dust].fadeIn = 1f; - } - } - } - - // Distance from destination where Brimmy stops moving - float movementDistanceGateValue = 100f; - - // How fast Brimmy moves to the destination - float baseVelocity = (death ? 6f : revenge ? 5.5f : expertMode ? 5f : 4.5f) * (npc.ai[0] == 5f ? 0.05f : npc.ai[0] == 3f ? 1.5f : 1f); - baseVelocity += 3f * enrageScale; - if (expertMode) - baseVelocity += death ? 3f * (1f - lifeRatio) : 2f * (1f - lifeRatio); - - float baseAcceleration = (death ? 0.12f : 0.1f) * (npc.ai[0] == 5f ? 0.5f : npc.ai[0] == 3f ? 1.5f : 1f); - baseAcceleration += 0.06f * enrageScale; - if (expertMode) - baseAcceleration += 0.03f * (1f - lifeRatio); - - // This is where Brimmy should be - Vector2 destination = npc.ai[0] != 3f ? player.Center : new Vector2(player.Center.X, player.Center.Y - 300f); - - // How far Brimmy is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[0] != 4f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Rotation and direction - if (npc.ai[0] <= 2f || npc.ai[0] == 5f) - { - npc.rotation = npc.velocity.X * 0.04f; - if (npc.ai[0] != 5 || (npc.ai[1] < 180f && npc.ai[0] == 5f)) - { - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - } - } - - if (Main.zenithWorld) // in gfb, Brimmy channels the power of the other elementals. - { - int newMode; - if (lifeRatio <= 0.8f && lifeRatio > 0.6f) - { - newMode = 1; // Sand - } - else if (lifeRatio <= 0.6f && lifeRatio > 0.4f) - { - newMode = 2; // Rare Sand - } - else if (lifeRatio <= 0.4f && lifeRatio > 0.2f) - { - newMode = 3; // Cloud - } - else if (lifeRatio <= 0.2f) - { - newMode = 4; // Water - } - else - { - newMode = 0; // Brimstone, default - } - if (newMode != brimmy.currentMode) - { - SoundEngine.PlaySound(SoundID.Item29, npc.Center); - } - brimmy.currentMode = newMode; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int phase; - int random = phase2 ? 6 : 5; - do phase = Main.rand.Next(random); - while (phase == npc.ai[1] || (phase == 0 && phase3 && revenge) || phase == 1 || phase == 2 || (phase == 4 && npc.localAI[3] != 0f)); - - npc.ai[0] = phase; - npc.ai[1] = 0f; - - // Cocoon phase cooldown - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - else if (phase == 4) - { - npc.localAI[3] = 3f; - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HideInShellSound, player.Center); - } - - // Prevent netUpdate from being blocked by the spam counter. - // A phase switch sync is a critical operation that must be synced. - npc.ForceNetUpdate(false); - } - } - - // Pick a location to teleport to - else if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.justHit) - npc.localAI[1] += masterMode ? 7f : expertMode ? 5f : 3f; - if (npc.Distance(player.Center) < 160f) - npc.localAI[1] += masterMode ? 4f : expertMode ? 2f : 1f; - - if (npc.localAI[1] >= (bossRush ? 90f : death ? 120f : 180f)) - { - npc.TargetClosest(); - npc.localAI[1] = 0f; - int timer = 0; - int playerPosX; - int playerPosY; - while (true) - { - timer++; - playerPosX = (int)player.Center.X / 16; - playerPosY = (int)player.Center.Y / 16; - - int min = 12; - int max = 16; - - if (Main.rand.NextBool()) - playerPosX += Main.rand.Next(min, max); - else - playerPosX -= Main.rand.Next(min, max); - - if (Main.rand.NextBool()) - playerPosY += Main.rand.Next(min, max); - else - playerPosY -= Main.rand.Next(min, max); - - if (!WorldGen.SolidTile(playerPosX, playerPosY)) - break; - - if (timer > 100) - return; - } - npc.ai[0] = 1f; - npc.ai[1] = playerPosX; - npc.ai[2] = playerPosY; - npc.netUpdate = true; - } - } - } - - // Teleport to location - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - Vector2 position = new Vector2(npc.ai[1] * 16f - (npc.width / 2), npc.ai[2] * 16f - (npc.height / 2)); - for (int m = 0; m < 5; m++) - { - int dust = Dust.NewDust(position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - npc.alpha += bossRush ? 8 : death ? 5 : revenge ? 4 : expertMode ? 3 : 2; - if (npc.alpha >= 255) - { - int spawnType = brimmy.currentMode == 3 ? NPCID.AngryNimbus : ModContent.NPCType(); - int enemyCount = brimmy.currentMode == 3 ? 3 : 1; // 3 angry nimbi if cloud, otherwise 1 brimling - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(spawnType) < (death ? 1 : 2) && revenge && brimmy.currentMode != 2) // dont spawn anything if gfb rare sand - { - for (int i = 0; i < enemyCount; i++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, spawnType); - } - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.TeleportSound, npc.Center); - npc.alpha = 255; - npc.position = position; - for (int n = 0; n < 15; n++) - { - int warpDust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, 3f); - Main.dust[warpDust].noGravity = true; - } - npc.ai[0] = 2f; - npc.netUpdate = true; - } - } - - // Either teleport again or go to next AI state - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha >= 255) - { - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SoundID.Item68, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 pos = npc.Center; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, 1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(0, -1), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, new Vector2(-1, 0), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - if (brimmy.currentMode >= 1 && brimmy.currentMode <= 3) - { - int tornadoType = brimmy.currentMode == 3 ? ModContent.ProjectileType() : ProjectileID.SandnadoHostileMark; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), pos, Vector2.Zero, tornadoType, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - if (brimmy.currentMode == 2) - { - int healAmt = npc.lifeMax / 25; - if (healAmt > 0) - { - npc.life += healAmt; - npc.HealEffect(healAmt, true); - npc.netUpdate = true; - } - } - } - } - - npc.alpha -= 50; - if (npc.alpha <= 0) - { - npc.chaseable = true; - npc.ai[3] += 1f; - npc.alpha = 0; - if (npc.ai[3] >= 2f || phase2 || Main.getGoodWorld) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[0] = 0f; - } - npc.netUpdate = true; - } - } - - // Float above target and fire projectiles - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - npc.rotation = npc.velocity.X * 0.04f; - - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - float divisor = expertMode ? (death ? 80f : revenge ? 45f : 50f) - (float)Math.Ceiling(10f * (1f - lifeRatio)) : 50f; - divisor -= 3f * enrageScale; - float divisor2 = divisor * 2f; - - if (npc.ai[1] % divisor == divisor - 1f) - { - float velocity = (death ? 7f : revenge ? 6f : 5f) + (2f * enrageScale) + (expertMode ? 3f * (1f - lifeRatio) : 0f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item30, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, player.Center); - } - Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 5f, projectileVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].timeLeft = 240; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (npc.ai[1] % divisor2 == divisor2 - 1f) - { - velocity = (death ? 5f : 4f) + 2f * enrageScale; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item21, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.DartSound, player.Center); - } - projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = death ? 8 : 4; - int spread = death ? 90 : 45; - if (Main.getGoodWorld) - { - numProj *= 3; - spread *= 2; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float rotation = MathHelper.ToRadians(spread); - float projectileVelocityToPass = velocity * 3f; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj2].extraUpdates += 1; - } - } - } - } - - if (npc.ai[1] >= divisor * (death ? 5f : 10f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - - // Cocoon bullet hell - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.defense = npc.defDefense * 4; - - npc.chaseable = false; - npc.localAI[0] += 1f; - if (Main.getGoodWorld) - npc.localAI[0] += 2f; - if (expertMode) - npc.localAI[0] += 1f - lifeRatio; - npc.localAI[0] += enrageScale; - - if (npc.localAI[0] >= 120f) - { - npc.localAI[0] = 0f; - - float projectileSpeed = death ? 9f : revenge ? 8f : 6f; - projectileSpeed += 2f * enrageScale; - - Vector2 projectileVelocity = player.Center - npc.Center; - - float radialOffset = 0.2f; - float diameter = 80f; - - projectileVelocity = projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileSpeed; - - Vector2 velocity = projectileVelocity; - velocity = velocity.SafeNormalize(Vector2.UnitY); - velocity *= diameter; - - int totalProjectiles = 6; - float offsetAngle = (float)Math.PI * radialOffset; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int j = 0; j < totalProjectiles; j++) - { - float radians = j - (totalProjectiles - 1f) / 2f; - Vector2 offset = velocity.RotatedBy(offsetAngle * radians); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, projectileVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].tileCollide = false; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - - totalProjectiles = 12; - float radians2 = MathHelper.TwoPi / totalProjectiles; - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - if (brimmy.currentMode == 4) - { - type = ModContent.ProjectileType(); - SoundEngine.PlaySound(SoundID.Item26, player.Center); - } - else - { - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.ShellFireSound, player.Center); - } - double angleA = radians2 * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(projectileSpeed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(0f, -projectileSpeed) : new Vector2(-velocityX, -projectileSpeed); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float projectileVelocityToPass = projectileSpeed * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - - if (death) - { - spinningPoint = npc.localAI[2] % 2f == 0f ? new Vector2(-velocityX, -projectileSpeed) : new Vector2(0f, -projectileSpeed); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 vector255 = spinningPoint.RotatedBy(radians2 * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + vector255.SafeNormalize(Vector2.UnitY) * 5f, vector255 * 0.75f, type, damage, 0f, Main.myPlayer, 1f, 0f, projectileVelocityToPass); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; - } - } - } - - npc.localAI[2] += 1f; - } - - npc.velocity *= 0.95f; - npc.rotation = npc.velocity.X * 0.04f; - float playerLocation = npc.Center.X - player.Center.X; - npc.direction = playerLocation < 0f ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (death ? 240f : 300f)) - { - npc.TargetClosest(); - npc.ai[0] = -1f; - npc.ai[1] = 4f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] = 0f; - npc.netUpdate = true; - } - } - - // Laser beam attack - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.chaseable = true; - - npc.defense = npc.defDefense * 2; - - Vector2 source = new Vector2(npc.Center.X + (npc.spriteDirection > 0 ? 34f : -34f), npc.Center.Y - 74f); - Vector2 aimAt = player.Center + player.velocity * 20f; - float aimResponsiveness = bossRush ? 0.05f : (npc.ai[2] == 1f || death) ? 0.1f : 0.25f; - - Vector2 aimVector = (aimAt - source).SafeNormalize(Vector2.UnitY); - if (aimVector.HasNaNs()) - aimVector = -Vector2.UnitY; - aimVector = (Vector2.Lerp(aimVector, npc.velocity.SafeNormalize(Vector2.UnitY), aimResponsiveness)).SafeNormalize(Vector2.UnitY); - aimVector *= 6f; - - Vector2 laserVelocity = aimVector.SafeNormalize(Vector2.UnitY); - if (laserVelocity.HasNaNs()) - laserVelocity = -Vector2.UnitY; - - calamityGlobalNPC.newAI[1] = laserVelocity.X; - calamityGlobalNPC.newAI[2] = laserVelocity.Y; - - // Rev = 190 + 165 = 355 - // Death = 165 - - npc.ai[1] += 1f; - if (npc.ai[1] >= 240f) - { - npc.TargetClosest(); - npc.ai[2] += 1f; - npc.localAI[0] = 0f; - npc.localAI[1] = 0f; - if (npc.ai[2] >= (death ? 1f : 2f)) - { - npc.ai[0] = -1f; - npc.ai[1] = 5f; - npc.ai[2] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - else - { - npc.ai[1] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - } - } - else if (npc.ai[1] >= 180f) - { - npc.velocity *= 0.95f; - if (npc.ai[1] == 180f) - { - SoundEngine.PlaySound(SoundID.Item68, source); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 laserVelocity2 = new Vector2(npc.localAI[0], npc.localAI[1]); - laserVelocity2 = laserVelocity2.SafeNormalize(Vector2.UnitY); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity2, type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity2.X, laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity2.X, -laserVelocity2.Y), type, damage, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - } - } - else - { - float playSoundTimer = 30f; - if (npc.ai[1] < 150f) - { - switch ((int)npc.ai[2]) - { - case 0: - npc.ai[1] += 0.5f; - break; - case 1: - npc.ai[1] += 1f; - playSoundTimer = 40f; - break; - } - if (death) - { - npc.ai[1] += 0.5f; - playSoundTimer += 10f; - } - } - - if (npc.ai[1] % playSoundTimer == 0f) - SoundEngine.PlaySound(SoundID.Item20, npc.Center); - - if (npc.ai[1] < 150f && calamityGlobalNPC.newAI[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source, -laserVelocity, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(-laserVelocity.X, laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source, new Vector2(laserVelocity.X, -laserVelocity.Y), ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - } - } - - calamityGlobalNPC.newAI[0] = 1f; - } - else - { - if (npc.ai[1] == 150f) - { - npc.localAI[0] = laserVelocity.X; - npc.localAI[1] = laserVelocity.Y; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - if (Main.getGoodWorld) - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - - if (Main.zenithWorld) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, -npc.localAI[0], npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - Projectile.NewProjectile(npc.GetSource_FromAI(), source.X, source.Y, npc.localAI[0], -npc.localAI[1], ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 1f, npc.whoAmI); - } - } - } - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs deleted file mode 100644 index 7ee45394c2..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/BumblebirbAI.cs +++ /dev/null @@ -1,1078 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class BumblebirbAI - { - public static void VanillaBumblebirbAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Variables - float rotationMult = 3f; - float rotationAmt = 0.03f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = npc.ai[0] == 3f || npc.ai[0] == 3.1f || npc.ai[0] == 3.2f; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - // If target is outside the jungle for more than 5 seconds, enrage - if (!player.ZoneJungle) - { - if (npc.localAI[1] < CalamityGlobalNPC.biomeEnrageTimerMax) - npc.localAI[1] += 1f; - } - else - npc.localAI[1] = 0f; - - // If dragonfolly is off screen, enrage for the next couple attacks - if (Vector2.Distance(player.Center, npc.Center) > 1200f) - npc.localAI[2] = 2f; - - // Enrage scale - float enrageScale = death ? 1.5f : 1f; - if (npc.localAI[1] >= CalamityGlobalNPC.biomeEnrageTimerMax || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - if (npc.localAI[2] > 0f || bossRush) - enrageScale += 1f; - - if (Main.getGoodWorld) - enrageScale += 0.5f; - - if (enrageScale > 3f) - enrageScale = 3f; - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.2f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[0] != 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - } - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < (revenge ? 0.75f : 0.5f); - bool phase3 = lifeRatio < (death ? 0.4f : revenge ? 0.25f : 0.1f) && expertMode; - - float birbSpawnPhaseTimer = 180f; - float newPhaseTimer = 180f; - bool phaseSwitchPhase = (phase2 && calamityGlobalNPC.newAI[0] < newPhaseTimer && calamityGlobalNPC.newAI[2] != 1f) || - (phase3 && calamityGlobalNPC.newAI[1] < newPhaseTimer && calamityGlobalNPC.newAI[3] != 1f); - - calamityGlobalNPC.DR = (phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush)) ? (bossRush ? 0.99f : 0.55f) : 0.1f; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phaseSwitchPhase || npc.ai[0] == 5f || (enrageScale == 3f && !bossRush); - - int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); - - if (phaseSwitchPhase) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - if (phase3) - { - calamityGlobalNPC.newAI[1] += 1f; - - // Sound - if (calamityGlobalNPC.newAI[1] == newPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 5; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (calamityGlobalNPC.newAI[1] >= newPhaseTimer) - { - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 1f; - calamityGlobalNPC.newAI[3] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.SyncExtraAI(); - npc.ForceNetUpdate(false); - } - } - else - { - calamityGlobalNPC.newAI[0] += 1f; - - // Sound - if (calamityGlobalNPC.newAI[0] == newPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 20; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.defDamage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (calamityGlobalNPC.newAI[0] >= newPhaseTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[2] = 1f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.SyncExtraAI(); - npc.ForceNetUpdate(false); - } - } - - Vector2 follyTargetDirection = player.Center - npc.Center; - float follyTargetDistance = 4f + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - return; - } - - // Max spawn amount - int maxBirbs = (CalamityWorld.LegendaryMode && revenge) ? 12 : revenge ? 3 : 2; - - // Variable for charging - float chargeDistance = 600f; - if (phase2) - chargeDistance -= 50f; - if (phase3) - chargeDistance -= 50f; - chargeDistance -= (enrageScale - 1f) * 100f; - - // Phase switch - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.Center.X < player.Center.X - 2f) - npc.direction = 1; - if (npc.Center.X > player.Center.X + 2f) - npc.direction = -1; - - // Direction and rotation - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - // Fly to target if target is too far away, otherwise get close to target and then slow down - Vector2 follyFlyTargetDirection = player.Center - npc.Center; - follyFlyTargetDirection.Y -= 200f; - if (follyFlyTargetDirection.Length() > 2800f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - else if (follyFlyTargetDirection.Length() > 240f) - { - float follyFlySpeed = 12f + (enrageScale - 1f) * 6f; - float follyFlyVelocityMult = 30f; - follyFlyTargetDirection.Normalize(); - follyFlyTargetDirection *= follyFlySpeed; - npc.velocity = (npc.velocity * (follyFlyVelocityMult - 1f) + follyFlyTargetDirection) / follyFlyVelocityMult; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - // Phase switch - npc.ai[1] += 1f; - if (npc.ai[1] >= 30f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - while (npc.ai[0] == 0f) - { - if (phase2) - npc.localAI[0] += 1f; - - if (npc.localAI[0] >= (phase3 ? 7 : 9)) - { - npc.TargetClosest(); - npc.ai[0] = 5f; - npc.localAI[0] = 0f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to spawn small birbs again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - } - else - { - int follyAttackPicker = phase2 ? Main.rand.Next(2) + 1 : Main.rand.Next(3); - if (phase3) - follyAttackPicker = 1; - - float featherVelocity = 2f + (enrageScale - 1f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - if (follyAttackPicker == 0 && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 2f; - - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Birb will do at least 1 different attack before entering this phase again - npc.localAI[3] = 1f; - } - else if (follyAttackPicker == 1) - { - npc.TargetClosest(); - npc.ai[0] = 3f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - // Decrease amount of attacks until able to use other attacks again - if (npc.localAI[3] > 0f) - npc.localAI[3] -= 1f; - - if (phase2 && npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = 40; - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = 800; - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (Main.getGoodWorld) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (spawnRight) - { - if (i >= (int)(totalProjectiles * 0.125) && i <= (int)(totalProjectiles * 0.375)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - else - { - if (i >= (int)(totalProjectiles * 0.625) && i <= (int)(totalProjectiles * 0.875)) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - else if (NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && npc.localAI[3] == 0f) - { - npc.TargetClosest(); - npc.ai[0] = 4f; - - // Birb will do at least 2 different attacks before entering this phase again - npc.localAI[3] = 2f; - - // Decrease enraged attacks by 1 - if (npc.localAI[2] > 0f) - npc.localAI[2] -= 1f; - - if (npc.ai[3] == 0f) - { - npc.ai[3] = 3f; - SoundEngine.PlaySound(SoundID.Item102, player.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = phase2 ? 40 : 48; - - if (Main.getGoodWorld) - totalProjectiles *= 2; - - float radians = MathHelper.TwoPi / totalProjectiles; - int distance = phase2 ? 1200 : 1320; - - if (Main.getGoodWorld) - distance *= 2; - - bool spawnRight = player.velocity.X > 0f; - for (int i = 0; i < totalProjectiles; i++) - { - if (spawnRight) - { - if (i >= totalProjectiles / 2) - break; - - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - else - { - if (i >= totalProjectiles / 2) - { - Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -featherVelocity).RotatedBy(radians * i)) * distance; - Vector2 velocity = Vector2.Normalize(player.Center - spawnVector) * featherVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - else - { - // Decrease the feather variable, feathers can be used again if it's at 0 - if (npc.ai[3] > 0f) - npc.ai[3] -= 1f; - } - } - } - } - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Fly to target - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - Vector2 follyTargetDirection = player.Center - npc.Center; - if (follyTargetDirection.Length() < 800f) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - float velocity = 14f + (enrageScale - 1f) * 4f; - float follyTargetDistance = velocity + follyTargetDirection.Length() / 100f; - float follyVelocityMult = 25f; - follyTargetDirection.Normalize(); - follyTargetDirection *= follyTargetDistance; - npc.velocity = (npc.velocity * (follyVelocityMult - 1f) + follyTargetDirection) / follyVelocityMult; - } - - // Fly towards target quickly - else if (npc.ai[0] == 2f) - { - // Set reduced damage - npc.damage = reducedSetDamage; - - if (npc.target < 0 || !player.active || player.dead) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - if (player.Center.X - 10f < npc.Center.X) - npc.direction = -1; - else if (player.Center.X + 10f > npc.Center.X) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 1.25f) / 5f; - - Vector2 follyQuickFlyTargetDirection = player.Center - npc.Center; - follyQuickFlyTargetDirection.Y -= 20f; - npc.ai[2] += 0.0222222228f; - if (expertMode) - npc.ai[2] += 0.0166666675f; - - float velocity = 8f + (enrageScale - 1f) * 2f; - float follyQuickFlySpeed = velocity + npc.ai[2] + follyQuickFlyTargetDirection.Length() / 120f; - if (CalamityWorld.LegendaryMode && revenge) - follyQuickFlySpeed *= 2f; - - float follyQuickFlyVelMult = 20f; - follyQuickFlyTargetDirection.Normalize(); - follyQuickFlyTargetDirection *= follyQuickFlySpeed; - npc.velocity = (npc.velocity * (follyQuickFlyVelMult - 1f) + follyQuickFlyTargetDirection) / follyQuickFlyVelMult; - - npc.ai[1] += 1f; - if (npc.ai[1] >= ((CalamityWorld.LegendaryMode && revenge) ? 90f : 180f)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Line up charge - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - - Vector2 follyLineUpTargetDirection = player.Center - npc.Center; - follyLineUpTargetDirection.Y -= 12f; - if (npc.Center.X > player.Center.X) - follyLineUpTargetDirection.X += chargeDistance; - else - follyLineUpTargetDirection.X -= chargeDistance; - - float verticalDistanceGateValue = (phase3 ? 100f : 20f) + (enrageScale - 1f) * 20f; - if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance - 50f && Math.Abs(npc.Center.Y - player.Center.Y) < verticalDistanceGateValue) - { - npc.ai[0] = 3.1f; - npc.ai[1] = 0f; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - - npc.ai[1] += 0.0333333351f; - float velocity = 16f + (enrageScale - 1f) * 4f; - float follyLineUpSpeed = velocity + npc.ai[1]; - float follyLineUpVelMult = 4f; - follyLineUpTargetDirection.Normalize(); - follyLineUpTargetDirection *= follyLineUpSpeed; - npc.velocity = (npc.velocity * (follyLineUpVelMult - 1f) + follyLineUpTargetDirection) / follyLineUpVelMult; - } - - // Prepare to charge - else if (npc.ai[0] == 3.1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - - Vector2 follyChargePrepareTargetDirection = player.Center - npc.Center; - follyChargePrepareTargetDirection.Y -= 12f; - float follyChargePrepareSpeed = 28f + (enrageScale - 1f) * 4f; - float follyChargePrepareVelMult = 8f; - follyChargePrepareTargetDirection.Normalize(); - follyChargePrepareTargetDirection *= follyChargePrepareSpeed; - npc.velocity = (npc.velocity * (follyChargePrepareVelMult - 1f) + follyChargePrepareTargetDirection) / follyChargePrepareVelMult; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.velocity = follyChargePrepareTargetDirection; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 3.2f; - npc.ai[1] = npc.direction; - - npc.ForceNetUpdate(false); - npc.SyncExtraAI(); - } - } - - // Charge - else if (npc.ai[0] == 3.2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 0.0333333351f; - float velocity = 28f + (enrageScale - 1f) * 4f; - npc.velocity.X = (velocity + npc.ai[2]) * npc.ai[1]; - - if ((npc.ai[1] > 0f && npc.Center.X > player.Center.X + (chargeDistance - 140f)) || (npc.ai[1] < 0f && npc.Center.X < player.Center.X - (chargeDistance - 140f))) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.TargetClosest(); - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ForceNetUpdate(false); - } - else if (Math.Abs(npc.Center.X - player.Center.X) > chargeDistance + 200f) - { - npc.TargetClosest(); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ForceNetUpdate(false); - } - } - - npc.rotation = (npc.rotation * rotationMult * 0.5f + npc.velocity.X * rotationAmt * 0.85f) / 5f; - } - - // Birb spawn - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - Vector2 destination2 = player.Center + new Vector2(0f, -200f); - Vector2 desiredVelocity2 = npc.SafeDirectionTo(destination2, -Vector2.UnitY) * 18f; - npc.SimpleFlyMovement(desiredVelocity2, 1.5f); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[2] += 1f; - if (npc.Distance(player.Center) < 600f || npc.ai[2] >= 180f) - { - npc.ai[1] = 1f; - npc.ForceNetUpdate(false); - } - } - else - { - if (npc.ai[1] < 90f) - npc.velocity *= 0.95f; - else - npc.velocity *= 0.98f; - - if (npc.ai[1] == 90f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y /= 3f; - - npc.velocity.Y -= 3f; - } - - // Sound - if (npc.ai[1] == birbSpawnPhaseTimer - 60f) - { - float squawkpitch = Main.zenithWorld ? 1.3f : 0.25f; - SoundEngine.PlaySound(SoundID.DD2_BetsyScream with { Pitch = squawkpitch }, npc.Center); - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bool gfbSpawnFlag = CalamityWorld.LegendaryMode && revenge && (npc.ai[1] == 145f || npc.ai[1] == 150f || npc.ai[1] == 160f || npc.ai[1] == 165f); - bool spawnFlag = NPC.CountNPCS(ModContent.NPCType()) < maxBirbs && (npc.ai[1] == 140f || (revenge && npc.ai[1] == 155f) || npc.ai[1] == 170f || gfbSpawnFlag); - if (spawnFlag) - { - Vector2 follySpawnCenter = npc.Center + (MathHelper.TwoPi * Main.rand.NextFloat()).ToRotationVector2() * new Vector2(2f, 1f) * 50f * (0.6f + Main.rand.NextFloat() * 0.4f); - if (Vector2.Distance(follySpawnCenter, player.Center) > 150f) - NPC.NewNPC(npc.GetSource_FromAI(), (int)follySpawnCenter.X, (int)follySpawnCenter.Y, ModContent.NPCType(), npc.whoAmI); - - npc.ForceNetUpdate(false); - } - } - - npc.ai[1] += 1f; - } - - if (npc.ai[1] >= birbSpawnPhaseTimer) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.ForceNetUpdate(false); - } - } - - // Spit homing aura sphere - else if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - // Play sound - float aiGateValue = 120f; - if (npc.ai[1] == aiGateValue - 30f) - { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 follySpawnCenter = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - float ai0 = (phase3 ? 2f : 0f) + (enrageScale - 1f); - if (ai0 > 3f) - ai0 = 3f; - - Projectile.NewProjectile(npc.GetSource_FromAI(), follySpawnCenter.X, follySpawnCenter.Y, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, ai0, npc.target + 1); - npc.ForceNetUpdate(false); - } - - if (Main.zenithWorld) - { - int spacing = 30; - int amt = 3; - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, npc.Center - Vector2.UnitY * 300f); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < amt; i++) - { - Vector2 fireFrom = new Vector2(npc.Center.X + (spacing * i) - (spacing * amt / 2), npc.Center.Y - 900f); - Vector2 ai0 = npc.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), npc.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= aiGateValue) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ForceNetUpdate(false); - } - } - } - - public static void VanillaBumblebirb2AI(NPC npc, Mod mod, bool bossMinion) - { - Player player = Main.player[npc.target]; - - float rotationMult = 4f; - float rotationAmt = 0.04f; - - if (Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.timeLeft > 5) - npc.timeLeft = 5; - } - - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt * 1.25f) / 10f; - - if (npc.ai[0] == 0f || npc.ai[0] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) - { - Vector2 otherSwarmerDirection = Main.npc[i].Center - npc.Center; - if (otherSwarmerDirection.Length() < (npc.width + npc.height)) - { - otherSwarmerDirection.Normalize(); - otherSwarmerDirection *= -0.1f; - npc.velocity += otherSwarmerDirection; - NPC nPC6 = Main.npc[i]; - nPC6.velocity -= otherSwarmerDirection; - } - } - } - } - - if (npc.target < 0 || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - npc.TargetClosest(true); - Vector2 swarmerTargetDist = Main.player[npc.target].Center - npc.Center; - if (Main.player[npc.target].dead || swarmerTargetDist.Length() > (bossMinion ? 5600f : 2800f)) - npc.ai[0] = -1f; - } - else - { - Vector2 swarmerCatchUpTargetDist = Main.player[npc.target].Center - npc.Center; - if (npc.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) - npc.ai[0] = 1f; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); - npc.velocity = (npc.velocity * 21f + swarmerDespawnVelMult) / 10f; - return; - } - - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.TargetClosest(true); - npc.spriteDirection = npc.direction; - - Vector2 swarmerIdleTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerIdleTargetDist.Length() > 2800f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else if (swarmerIdleTargetDist.Length() > 400f) - { - float swarmerIdleSpeed = (bossMinion ? 9f : 7f) + swarmerIdleTargetDist.Length() / 100f + npc.ai[1] / 15f; - swarmerIdleTargetDist.Normalize(); - swarmerIdleTargetDist *= swarmerIdleSpeed; - npc.velocity = (npc.velocity * 29f + swarmerIdleTargetDist) / 30f; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - } - else if (npc.velocity.Length() > 2f) - npc.velocity *= 0.95f; - else if (npc.velocity.Length() < 1f) - npc.velocity *= 1.05f; - - npc.ai[1] += 1f; - if (npc.ai[1] >= (bossMinion ? 90f : 105f)) - { - npc.ai[1] = 0f; - npc.ai[0] = 2f; - } - } - else - { - if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.target < 0 || !Main.player[npc.target].active || Main.player[npc.target].dead) - npc.TargetClosest(true); - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult + npc.velocity.X * rotationAmt) / 10f; - - Vector2 swarmerChargeTargetDist = Main.player[npc.target].Center - npc.Center; - if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - - npc.ai[2] += 0.0166666675f; - float swarmerChargeSpeed = (bossMinion ? 12f : 9f) + npc.ai[2] + swarmerChargeTargetDist.Length() / 150f; - float swarmerChargeVelMult = 25f; - swarmerChargeTargetDist.Normalize(); - swarmerChargeTargetDist *= swarmerChargeSpeed; - npc.velocity = (npc.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - npc.ForceNetUpdate(); - - return; - } - - if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - npc.rotation = (npc.rotation * rotationMult * 0.75f + npc.velocity.X * rotationAmt * 1.25f) / 8f; - - Vector2 swarmerDecelerateTargetDist = Main.player[npc.target].Center - npc.Center; - swarmerDecelerateTargetDist.Y -= 8f; - float swarmerDecelerateSpeed = bossMinion ? 18f : 14f; - float swarmerDecelerateVelMult = 8f; - swarmerDecelerateTargetDist.Normalize(); - swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; - npc.velocity = (npc.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.ai[1] += 1f; - if (npc.ai[1] > 10f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.velocity = swarmerDecelerateTargetDist; - if (Main.getGoodWorld && !Main.zenithWorld) - npc.velocity *= 1.15f; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.ai[0] = 2.1f; - npc.ai[1] = 0f; - } - } - else if (npc.ai[0] == 2.1f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else if (npc.velocity.X > 0f) - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - npc.velocity *= 1.01f; - - npc.ai[1] += 1f; - if (npc.ai[1] > 30f) - { - if (!Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - return; - } - - if (npc.ai[1] > 60f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs deleted file mode 100644 index 7dfb5557da..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/CalamitasCloneAI.cs +++ /dev/null @@ -1,1405 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.CalClone; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class CalamitasCloneAI - { - public static void VanillaCalamitasCloneAI(NPC npc, Mod mod, SlotId warn) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - // Variables for increasing difficulty - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Phases - bool phase2 = lifeRatio < 0.7f || death; - bool phase3 = lifeRatio < 0.35f; - bool phase4 = lifeRatio <= 0.1f && death; - - // Don't take damage during bullet hells - npc.dontTakeDamage = calamityGlobalNPC.newAI[2] > 0f; - - // Variable for live brothers - bool brotherAlive = false; - - // For seekers - CalamityGlobalNPC.calamitas = npc.whoAmI; - - // Seeker ring - if (calamityGlobalNPC.newAI[1] == 0f && phase3 && expertMode) - { - SoundEngine.PlaySound(SoundID.Item72, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int seekerAmt = death ? 10 : 5; - int seekerSpread = 360 / seekerAmt; - int seekerDistance = death ? 180 : 150; - for (int i = 0; i < seekerAmt; i++) - { - int spawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * seekerSpread) * seekerDistance)), (int)(npc.Center.Y + (Math.Cos(i * seekerSpread) * seekerDistance)), ModContent.NPCType(), npc.whoAmI, 0, 0, 0, -1); - Main.npc[spawn].ai[0] = i * seekerSpread; - } - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText3"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - calamityGlobalNPC.newAI[1] = 1f; - } - - // CIT 14SEP2024: Fixed bug where her phases would get offset by dealing a large amount of damage in a single hit to take her into a new phase. - // newAI[0] now starts at 1 and has 0.3 subtracted from it for each phase, instead of it storing her current health when she enters a new phase. - - // Do bullet hell or spawn brothers - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = 1f; - - // Bullet hells at 70% and 10%, brothers at 40% - if (npc.life > 0) - { - int calClonePhaseThreshold = (int)(npc.lifeMax * 0.3); - if (((npc.life + calClonePhaseThreshold) / (float)npc.lifeMax) < calamityGlobalNPC.newAI[0]) - { - calamityGlobalNPC.newAI[0] -= 0.3f; - if (calamityGlobalNPC.newAI[0] <= 0.1f) - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 2f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - else if (calamityGlobalNPC.newAI[0] <= 0.4f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.position.Y + npc.height, ModContent.NPCType(), npc.whoAmI); - } - - string key = "Mods.CalamityMod.Status.Boss.CalamitasBossText2"; - Color messageColor = Color.Orange; - CalamityUtils.DisplayLocalizedText(key, messageColor); - - SpawnDust(); - } - else - { - SoundEngine.PlaySound(SoundID.Item109, npc.Center); - calamityGlobalNPC.newAI[2] = 1f; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - calamityGlobalNPC.newAI[3] = 0f; - - SpawnDust(); - } - } - } - - // Immunity if brothers are alive - if (CalamityGlobalNPC.cataclysm != -1) - { - if (Main.npc[CalamityGlobalNPC.cataclysm].active) - brotherAlive = true; - } - if (CalamityGlobalNPC.catastrophe != -1) - { - if (Main.npc[CalamityGlobalNPC.catastrophe].active) - brotherAlive = true; - } - - if (brotherAlive) - npc.dontTakeDamage = true; - - void SpawnDust() - { - int dustAmt = 50; - int random = 3; - - for (int j = 0; j < 10; j++) - { - random += j; - int dustAmtSpawned = 0; - int scale = random * 6; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Target variable - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - // Rotation - Vector2 npcCenter = new Vector2(npc.Center.X, npc.position.Y + npc.height - 59f); - Vector2 lookAt = new Vector2(player.position.X - (player.width / 2), player.position.Y - (player.height / 2)); - Vector2 rotationVector = npcCenter - lookAt; - - // Boss Rush predictive charge rotation - if (npc.ai[1] == 4f && phase4 && bossRush) - { - // Velocity - float chargeVelocity = 30f; - chargeVelocity += 5f * enrageScale; - lookAt += Main.player[npc.target].velocity * 20f; - rotationVector = Vector2.Normalize(npcCenter - lookAt) * chargeVelocity; - } - - float rotation = (float)Math.Atan2(rotationVector.Y, rotationVector.X) + MathHelper.PiOver2; - if (rotation < 0f) - rotation += MathHelper.TwoPi; - else if (rotation > MathHelper.TwoPi) - rotation -= MathHelper.TwoPi; - - float rotationAmt = 0.1f; - if (npc.rotation < rotation) - { - if ((rotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= rotationAmt; - else - npc.rotation += rotationAmt; - } - else if (npc.rotation > rotation) - { - if ((npc.rotation - rotation) > MathHelper.Pi) - npc.rotation += rotationAmt; - else - npc.rotation -= rotationAmt; - } - - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > rotation - rotationAmt && npc.rotation < rotation + rotationAmt) - npc.rotation = rotation; - - // Despawn - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (SoundEngine.TryGetActiveSound(warn, out var warningSound) && warningSound.IsPlaying) - warningSound.Stop(); - - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - // Distance from destination where Cal Clone stops moving - float movementDistanceGateValue = 100f; - - // How fast Cal Clone moves to the destination - float baseVelocity = (expertMode ? 10f : 8.5f) * (npc.ai[1] == 4f ? 1.4f : 1f); - float baseAcceleration = (expertMode ? 0.18f : 0.155f) * (npc.ai[1] == 4f ? 1.4f : 1f); - baseVelocity += 4f * enrageScale; - baseAcceleration += 0.1f * enrageScale; - if (revenge) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (death) - { - baseVelocity += 1.5f * (1f - lifeRatio); - baseAcceleration += 0.03f * (1f - lifeRatio); - } - if (Main.getGoodWorld) - { - baseVelocity *= 1.15f; - baseAcceleration *= 1.15f; - } - - // What side Cal Clone should be on, relative to the target - int xPos = 1; - if (npc.Center.X < player.Center.X) - xPos = -1; - - // How far Cal Clone should be from the target - float averageDistance = 500f; - float chargeDistance = phase4 ? 300f : 400f; - - // This is where Cal Clone should be - Vector2 destination = (calamityGlobalNPC.newAI[2] > 0f || npc.ai[1] == 0f) ? new Vector2(player.Center.X, player.Center.Y - averageDistance) : - npc.ai[1] == 1f ? new Vector2(player.Center.X + averageDistance * xPos, player.Center.Y) : - new Vector2(player.Center.X + chargeDistance * xPos, player.Center.Y); - - // Add some random distance to the destination after certain attacks - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 0f; - npc.localAI[2] = Main.rand.Next(-50, 51); - npc.localAI[3] = Main.rand.Next(-300, 301); - npc.netUpdate = true; - } - - // Add a bit of randomness to the destination - if (death) - { - destination.X += npc.ai[1] == 0f ? npc.localAI[3] : npc.localAI[2]; - destination.Y += npc.ai[1] == 0f ? npc.localAI[2] : npc.localAI[3]; - } - - // How far Cal Clone is from where she's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.ai[1] == 0f || npc.ai[1] == 1f || npc.ai[1] == 4f || calamityGlobalNPC.newAI[2] > 0f) - CalamityUtils.SmoothMovement(npc, movementDistanceGateValue, distanceFromDestination, baseVelocity, baseAcceleration, true); - - // Bullet hell phase - if (calamityGlobalNPC.newAI[2] > 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (calamityGlobalNPC.newAI[3] < 900f) - { - calamityGlobalNPC.newAI[3] += 1f; - npc.dontTakeDamage = true; - npc.alpha = 255; - - float rotX = player.Center.X - npc.Center.X; - float rotY = player.Center.Y - npc.Center.Y; - npc.rotation = (float)Math.Atan2(rotY, rotX) - MathHelper.PiOver2; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[2] == 2f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - if (Main.zenithWorld) - type = ModContent.ProjectileType(); - - float gigaBlastFrequency = (Main.getGoodWorld ? 120f : expertMode ? 180f : 240f) - enrageScale * 15f; - float projSpeed = bossRush ? 6.25f : 5f; - if (calamityGlobalNPC.newAI[3] <= 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] <= 600f && calamityGlobalNPC.newAI[3] > 300f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from right - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -projSpeed, 0f, type, damage, 0f, Main.myPlayer); - } - else if (calamityGlobalNPC.newAI[3] > 600f) - { - if (calamityGlobalNPC.newAI[3] % gigaBlastFrequency == 0f) // Blasts from top - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - - npc.ai[0] += 1f; - float hellblastGateValue = (expertMode ? 12f : 16f) - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 4.5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - - if (calamityGlobalNPC.newAI[3] == 900f - 360f) - warn = SoundEngine.PlaySound(CalamitasClone.BulletHellWarning, player.Center); - if (calamityGlobalNPC.newAI[3] > 900f - 360f) - { - if (SoundEngine.TryGetActiveSound(warn, out var warningSound) && warningSound.IsPlaying) - warningSound.Position = player.Center; - } - } - else - { - npc.ai[0] = 0f; - npc.ai[3] = 0f; - npc.localAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - SoundEngine.PlaySound(CalamitasClone.BulletHellEnd, player.Center); - - // Prevent bullshit charge hits when second bullet hell ends. - if (phase4) - { - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - } - else - { - if (death) - { - int AIState = Main.rand.Next(3); - switch (AIState) - { - case 0: - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - case 1: - npc.ai[1] = 1f; - npc.ai[2] = 0f; - break; - case 2: - npc.ai[1] = 4f; - npc.ai[2] = -105f; - npc.TargetClosest(); - break; - } - } - else - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - if (death) - npc.localAI[0] = 1f; - } - - npc.netUpdate = true; - - for (int x = 0; x < Main.maxProjectiles; x++) - { - Projectile projectile = Main.projectile[x]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - else if (projectile.type == ModContent.ProjectileType()) - { - projectile.ai[2] = 1f; - - if (projectile.timeLeft > 60) - projectile.timeLeft = 60; - } - } - } - } - - return; - } - else if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - { - if (calamityGlobalNPC.newAI[3] < 900f) - calamityGlobalNPC.newAI[3] += 1f; - else - calamityGlobalNPC.newAI[3] = 0f; - - npc.ai[0] += 1f; - float hellblastGateValue = 30f - enrageScale; - if (npc.ai[0] >= hellblastGateValue) - { - npc.ai[0] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float projSpeed = bossRush ? 5f : 4f; - if (calamityGlobalNPC.newAI[3] % (hellblastGateValue * 6f) == 0f) - { - float distance = Main.rand.NextBool() ? -1000f : 1000f; - float velocity = distance == -1000f ? projSpeed : -projSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - - if (calamityGlobalNPC.newAI[3] < 300f) // Blasts from above - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else if (calamityGlobalNPC.newAI[3] < 600f) // Blasts from left and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 0.5f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 0.5f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - else // Blasts from above, left, and right - { - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, projSpeed - 1f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -(projSpeed - 1f), 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - Projectile.NewProjectile(npc.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), projSpeed - 1f, 0f, type, damage, 0f, Main.myPlayer, 2f, 0f); - } - } - } - } - - npc.alpha = npc.dontTakeDamage ? 255 : 0; - - // Float above target and fire hellfireballs - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - float phaseTimer = 400f - (death ? 120f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 4f; - else - npc.ai[1] = 1f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (expertMode) - npc.localAI[1] += death ? 2f * (1f - lifeRatio) : 1f - lifeRatio; - if (revenge) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 180f : 120f)) - { - npc.localAI[1] = 0f; - SoundEngine.PlaySound(BrimstoneElemental.BrimstoneElemental.HellfireballSound, npc.Center); - - float projectileVelocity = expertMode ? 14f : 12.5f; - projectileVelocity += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool shootPredictiveShot = CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(); - Vector2 predictionVector = shootPredictiveShot ? player.velocity * 20f : Vector2.Zero; - Vector2 fireballVelocity = Vector2.Normalize(player.Center + predictionVector - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - Main.projectile[proj].netUpdate = true; - } - } - } - - // Float to the side of the target and fire - else if (npc.ai[1] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (!brotherAlive) - { - if (revenge) - npc.localAI[1] += 0.5f; - if (expertMode) - npc.localAI[1] += 0.5f; - } - - if (npc.localAI[1] >= (brotherAlive ? 75f : 50f) && Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - npc.localAI[1] = 0f; - - float projectileVelocity = expertMode ? 12.5f : 11f; - projectileVelocity += 3f * enrageScale; - int type = brotherAlive ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = Vector2.Normalize(player.Center - npc.Center) * projectileVelocity; - Vector2 offset = Vector2.Normalize(fireballVelocity) * 40f; - - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) - { - type = ModContent.ProjectileType(); - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y); - } - else - { - float ai0 = type == ModContent.ProjectileType() ? 1f : player.position.X; - float ai1 = type == ModContent.ProjectileType() ? 0f : player.position.Y; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, fireballVelocity, type, damage, 0f, Main.myPlayer, ai0, ai1); - } - } - } - - npc.ai[2] += 1f; - float phaseTimer = 240f - (death ? 60f * (1f - lifeRatio) : 0f); - if (npc.ai[2] >= phaseTimer || phase4) - { - if (death && !phase4 && Main.rand.NextBool() && !brotherAlive) - npc.ai[1] = 0f; - else - npc.ai[1] = !brotherAlive && phase2 && revenge ? 4f : 0f; - - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - SoundEngine.PlaySound(CalamitasClone.ChargeSound, npc.Center); - npc.rotation = rotation; - - float chargeVelocity = phase4 ? 30f : death ? 28f : 25f; - chargeVelocity += 5f * enrageScale; - - Vector2 vector = Vector2.Normalize(player.Center + (phase4 && bossRush ? player.velocity * 20f : Vector2.Zero) - npc.Center); - npc.velocity = vector * chargeVelocity; - - npc.ai[1] = 3f; - npc.netUpdate = true; - } - else if (npc.ai[1] == 3f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - - float chargeTime = phase4 ? 35f : death ? 40f : 45f; - if (npc.ai[2] >= chargeTime) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.9f; - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - { - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - // Leave behind slow hellblasts in Death Mode - if (Main.netMode != NetmodeID.MultiplayerClient && death && phase3 && npc.ai[2] % (phase4 ? 6f : 10f) == 0f) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 fireballVelocity = CalamityWorld.LegendaryMode ? Main.rand.NextVector2CircularEdge(0.02f, 0.02f) : npc.velocity * 0.01f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, fireballVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); - } - } - - if (npc.ai[2] >= chargeTime + 10f) - { - if (!phase4) - npc.ai[3] += 1f; - - npc.ai[2] = 0f; - - npc.rotation = rotation; - npc.netUpdate = true; - - if (npc.ai[3] >= 2f) - { - npc.TargetClosest(); - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - - npc.ai[1] = 4f; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (phase4 ? 15f : 30f)) - { - npc.ai[1] = 2f; - npc.ai[2] = 0f; - if (death) - npc.localAI[0] = 1f; - - npc.netUpdate = true; - } - } - } - - public static void VanillaCataclysmAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (npc.alpha < 255) - { - npc.velocity *= 0.9f; - - npc.alpha += 2; - if (npc.alpha > 255) - npc.alpha = 255; - - int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); - for (int i = 0; i < dustAmount; i++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - } - else - npc.active = false; - - npc.active = false; - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.cataclysm = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - float calCloneBroProjAttackMaxSpeed = 5f; - float calCloneBroProjAttackAccel = 0.1f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.06f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.position.X + (npc.width / 2) < player.position.X + player.width) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroProjTargetX = player.position.X + (player.width / 2) + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (240f - (death ? 120f * (1f - lifeRatio) : 0f))) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || npc.life < npc.lifeMax * 0.9; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - if (npc.localAI[2] == 0f) - SoundEngine.PlaySound(Cataclysm.FlamethrowerStart, npc.Center); - - npc.localAI[2] += 1f; - if (npc.localAI[2] > 30f) - { - npc.localAI[2] = 1f; - SoundEngine.PlaySound(Cataclysm.FlamethrowerLoop, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 3f; - if (revenge) - npc.localAI[1] += 1f; - - if (npc.localAI[1] > 12f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = NPC.AnyNPCs(ModContent.NPCType()) ? 4f : 6f; - calCloneBroProjSpeed += enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = 14f + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 3f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = npc.Center; - float calCloneBroChargeTargetXDist = player.Center.X - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.Center.Y - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - float projectileVelocityToPass = velocity * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 75f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 105f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.rotation = calCloneBroRotation; - if (npc.ai[3] >= 3f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - - public static void VanillaCatastropheAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - if (CalamityGlobalNPC.calamitas < 0 || !Main.npc[CalamityGlobalNPC.calamitas].active) - { - if (npc.alpha < 255) - { - npc.velocity *= 0.9f; - - npc.alpha += 2; - if (npc.alpha > 255) - npc.alpha = 255; - - int dustAmount = (int)Math.Round(MathHelper.Lerp(1f, 5f, (255 - npc.alpha) / 255f)); - for (int i = 0; i < dustAmount; i++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.LifeDrain, 0f, -1f, 90, default, Main.rand.NextFloat(0.5f, 2f)); - Main.dust[dust].noGravity = true; - Main.dust[dust].fadeIn = 1f; - } - } - else - npc.active = false; - - return; - } - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - CalamityGlobalNPC.catastrophe = npc.whoAmI; - - // Emit light - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), 1f, 0f, 0f); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - float calCloneBroPlayerXDist = npc.position.X + (npc.width / 2) - player.position.X - (player.width / 2); - float calCloneBroPlayerYDist = npc.position.Y + npc.height - 59f - player.position.Y - (player.height / 2); - float calCloneBroRotation = (float)Math.Atan2(calCloneBroPlayerYDist, calCloneBroPlayerXDist) + MathHelper.PiOver2; - if (calCloneBroRotation < 0f) - calCloneBroRotation += MathHelper.TwoPi; - else if (calCloneBroRotation > MathHelper.TwoPi) - calCloneBroRotation -= MathHelper.TwoPi; - - float calCloneBroRotationSpeed = 0.15f; - if (npc.rotation < calCloneBroRotation) - { - if ((calCloneBroRotation - npc.rotation) > MathHelper.Pi) - npc.rotation -= calCloneBroRotationSpeed; - else - npc.rotation += calCloneBroRotationSpeed; - } - else if (npc.rotation > calCloneBroRotation) - { - if ((npc.rotation - calCloneBroRotation) > MathHelper.Pi) - npc.rotation += calCloneBroRotationSpeed; - else - npc.rotation -= calCloneBroRotationSpeed; - } - - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > calCloneBroRotation - calCloneBroRotationSpeed && npc.rotation < calCloneBroRotation + calCloneBroRotationSpeed) - npc.rotation = calCloneBroRotation; - - if (!player.active || player.dead) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - if (npc.ai[1] != 0f) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - return; - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - float calCloneBroProjAttackMaxSpeed = 4.5f; - float calCloneBroProjAttackAccel = 0.2f; - calCloneBroProjAttackMaxSpeed += 2f * enrageScale; - calCloneBroProjAttackAccel += 0.1f * enrageScale; - - if (Main.getGoodWorld) - { - calCloneBroProjAttackMaxSpeed *= 1.15f; - calCloneBroProjAttackAccel *= 1.15f; - } - - int calCloneBroProjAttackDirection = 1; - if (npc.Center.X < player.Center.X) - calCloneBroProjAttackDirection = -1; - - Vector2 calCloneBroProjLocation = npc.Center; - float calCloneBroProjTargetX = player.Center.X + (calCloneBroProjAttackDirection * 180) - calCloneBroProjLocation.X; - float calCloneBroProjTargetY = player.Center.Y - calCloneBroProjLocation.Y; - float calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - - if (expertMode) - { - if (calCloneBroProjTargetDist > 300f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 400f) - calCloneBroProjAttackMaxSpeed += 0.5f; - if (calCloneBroProjTargetDist > 500f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 600f) - calCloneBroProjAttackMaxSpeed += 0.55f; - if (calCloneBroProjTargetDist > 700f) - calCloneBroProjAttackMaxSpeed += 0.6f; - if (calCloneBroProjTargetDist > 800f) - calCloneBroProjAttackMaxSpeed += 0.6f; - } - - calCloneBroProjTargetDist = calCloneBroProjAttackMaxSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - - if (npc.velocity.X < calCloneBroProjTargetX) - { - npc.velocity.X += calCloneBroProjAttackAccel; - if (npc.velocity.X < 0f && calCloneBroProjTargetX > 0f) - npc.velocity.X += calCloneBroProjAttackAccel; - } - else if (npc.velocity.X > calCloneBroProjTargetX) - { - npc.velocity.X -= calCloneBroProjAttackAccel; - if (npc.velocity.X > 0f && calCloneBroProjTargetX < 0f) - npc.velocity.X -= calCloneBroProjAttackAccel; - } - if (npc.velocity.Y < calCloneBroProjTargetY) - { - npc.velocity.Y += calCloneBroProjAttackAccel; - if (npc.velocity.Y < 0f && calCloneBroProjTargetY > 0f) - npc.velocity.Y += calCloneBroProjAttackAccel; - } - else if (npc.velocity.Y > calCloneBroProjTargetY) - { - npc.velocity.Y -= calCloneBroProjAttackAccel; - if (npc.velocity.Y > 0f && calCloneBroProjTargetY < 0f) - npc.velocity.Y -= calCloneBroProjAttackAccel; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (180f - (death ? 90f * (1f - lifeRatio) : 0f))) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.target = 255; - npc.netUpdate = true; - } - - bool fireDelay = npc.ai[2] > 120f || lifeRatio < 0.9f; - if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) && fireDelay) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 36f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (revenge) - npc.localAI[1] += 0.5f; - - if (npc.localAI[1] > 50f) - { - npc.localAI[1] = 0f; - float calCloneBroProjSpeed = death ? 14f : 12f; - calCloneBroProjSpeed += 3f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - calCloneBroProjLocation = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - calCloneBroProjTargetX = player.position.X + (player.width / 2) - calCloneBroProjLocation.X; - calCloneBroProjTargetY = player.position.Y + (player.height / 2) - calCloneBroProjLocation.Y; - calCloneBroProjTargetDist = (float)Math.Sqrt(calCloneBroProjTargetX * calCloneBroProjTargetX + calCloneBroProjTargetY * calCloneBroProjTargetY); - calCloneBroProjTargetDist = calCloneBroProjSpeed / calCloneBroProjTargetDist; - calCloneBroProjTargetX *= calCloneBroProjTargetDist; - calCloneBroProjTargetY *= calCloneBroProjTargetDist; - calCloneBroProjTargetY += npc.velocity.Y * 0.5f; - calCloneBroProjTargetX += npc.velocity.X * 0.5f; - calCloneBroProjLocation.X -= calCloneBroProjTargetX; - calCloneBroProjLocation.Y -= calCloneBroProjTargetY; - Projectile.NewProjectile(npc.GetSource_FromAI(), calCloneBroProjLocation.X, calCloneBroProjLocation.Y, calCloneBroProjTargetX, calCloneBroProjTargetY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - } - else - { - if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - SoundEngine.PlaySound(SoundID.Roar, npc.Center); - npc.rotation = calCloneBroRotation; - - float calCloneBroChargeSpeed = (NPC.AnyNPCs(ModContent.NPCType()) ? 12f : 16f) + (death ? 4f * (1f - lifeRatio) : 0f); - calCloneBroChargeSpeed += 4f * enrageScale; - if (expertMode) - calCloneBroChargeSpeed += 2f; - if (revenge) - calCloneBroChargeSpeed += 2f; - if (Main.getGoodWorld) - calCloneBroChargeSpeed *= 1.25f; - - Vector2 calCloneBroChargeCenter = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height * 0.5f); - float calCloneBroChargeTargetXDist = player.position.X + (player.width / 2) - calCloneBroChargeCenter.X; - float calCloneBroChargeTargetYDist = player.position.Y + (player.height / 2) - calCloneBroChargeCenter.Y; - float calCloneBroChargeTargetDistance = (float)Math.Sqrt(calCloneBroChargeTargetXDist * calCloneBroChargeTargetXDist + calCloneBroChargeTargetYDist * calCloneBroChargeTargetYDist); - calCloneBroChargeTargetDistance = calCloneBroChargeSpeed / calCloneBroChargeTargetDistance; - npc.velocity.X = calCloneBroChargeTargetXDist * calCloneBroChargeTargetDistance; - npc.velocity.Y = calCloneBroChargeTargetYDist * calCloneBroChargeTargetDistance; - npc.ai[1] = 2f; - - if (Main.zenithWorld) - { - SoundEngine.PlaySound(SupremeCalamitas.SupremeCalamitas.BrimstoneShotSound, npc.Center); - - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - damage /= 2; - - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 8 : expertMode ? 6 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 5f; - Vector2 spinningPoint = new Vector2(0f, -velocity); - float projectileVelocityToPass = velocity * 3f; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); - } - - for (int i = 0; i < 6; i++) - Dust.NewDust(npc.position + npc.velocity, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, 0f); - } - return; - } - - if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f + (death ? 0.5f * (1f - lifeRatio) : 0f); - if (expertMode) - npc.ai[2] += 0.25f; - if (revenge) - npc.ai[2] += 0.25f; - - if (npc.ai[2] >= 60f) //50 - { - // Avoid cheap bullshit - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - - npc.velocity.X *= 0.93f; - npc.velocity.Y *= 0.93f; - - if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) - npc.velocity.X = 0f; - if (npc.velocity.Y > -0.1 && npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 90f) //80 - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = calCloneBroRotation; - if (npc.ai[3] >= 4f) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - return; - } - npc.ai[1] = 1f; - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs deleted file mode 100644 index 7fc43d201c..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/CeaselessVoidAI.cs +++ /dev/null @@ -1,619 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class CeaselessVoidAI - { - public static void VanillaCeaselessVoidAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - CalamityGlobalNPC.voidBoss = npc.whoAmI; - - // Percent life remaining - double lifeRatio = npc.life / (double)npc.lifeMax; - - // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Phases - bool phase2 = lifeRatio <= 0.7; - bool phase3 = lifeRatio <= 0.4; - bool phase4 = lifeRatio <= 0.1; - bool theBigSucc = npc.life / (double)npc.lifeMax <= 0.1; - bool succSoHardThatYouDie = npc.life / (double)npc.lifeMax <= 0.005; - - // Spawn Dark Energies - int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; - if (phase2) - darkEnergyAmt += 1; - if (phase3) - darkEnergyAmt += 1; - if (phase4) - darkEnergyAmt += 1; - - if (Main.getGoodWorld) - darkEnergyAmt *= 2; - - // Spawn a few Dark Energies as soon as the fight starts - int spacing = 360 / darkEnergyAmt; - int distance2 = 10; - if (npc.ai[2] == 0f) - { - npc.ai[2] = 1f; - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - } - - // If there are any Dark Energies alive, change AI and don't take damage - bool anyDarkEnergies = NPC.AnyNPCs(ModContent.NPCType()); - bool movingDuringSuccPhase = npc.ai[3] == 0f; - npc.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.TargetClosest(); - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - Player player = Main.player[npc.target]; - - // Speed enrage - bool moveVeryFast = Vector2.Distance(npc.Center, player.Center) > 960f || (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0); - - // Despawn - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - npc.TargetClosest(false); - player = Main.player[npc.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, npc.Center) > 5600f) - { - if (npc.velocity.Y > 3f) - npc.velocity.Y = 3f; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -12f) - npc.velocity.Y = -12f; - - if (npc.timeLeft > 60) - npc.timeLeft = 60; - - return; - } - } - else if (npc.timeLeft < 1800) - npc.timeLeft = 1800; - - float tileEnrageMult = (CalamityWorld.LegendaryMode && revenge) ? 1.5f : bossRush ? 1.375f : 1f; - npc.Calamity().CurrentlyEnraged = tileEnrageMult > 1f && !bossRush; - - // Set AI variable to be used by Dark Energies - npc.ai[1] = tileEnrageMult; - - // Increase projectile fire rate based on number of nearby active tiles - float projectileFireRateMultiplier = MathHelper.Lerp(0.5f, 1.5f, 1f - ((tileEnrageMult - 1f) / 0.5f)); - - // Decides whether Ceaseless moves closer to its target or not - float distanceRequiredToMove = (Main.getGoodWorld || !anyDarkEnergies) ? 320f : bossRush ? 600f : death ? 520f : revenge ? 480f : expertMode ? 440f : 400f; - bool move = Vector2.Distance(npc.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(npc.Center, 1, 1, player.Center, 1, 1); - - // Succ attack - if (!anyDarkEnergies) - { - // This is here because it's used in multiple places - float suckDistance = (CalamityWorld.LegendaryMode && revenge) ? 2400f : bossRush ? 1920f : death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; - - // Move closer to the target before trying to succ - if (movingDuringSuccPhase) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (move) - Movement(true); - else - npc.ai[3] = 1f; - } - else - { - // Set damage - npc.damage = npc.defDamage; - - // Use this to generate more and more dust in final phase - float finalPhaseDustRatio = 1f; - if (succSoHardThatYouDie) - { - finalPhaseDustRatio = 5f; - } - else if (theBigSucc) - { - float amount = (10f - (float)(npc.life / (double)npc.lifeMax) * 100f) / 10f; - finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); - } - - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - - // Move towards target again if they get outside the succ radius - float moveCloserGateValue = suckDistance * 0.8f; - if (Vector2.Distance(npc.Center, player.Center) > moveCloserGateValue) - npc.ai[3] = 0f; - - // Ceaseless Void sucks in dark energy in different patterns - // This attack also sucks in all players that are within reach of the succ - int dustRings = 3; - for (int h = 0; h < dustRings; h++) - { - float distanceDivisor = h + 1f; - float dustDistance = suckDistance / distanceDivisor; - int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); - float angleIncrement = MathHelper.TwoPi / numDust; - Vector2 dustOffset = new Vector2(dustDistance, 0f); - dustOffset = dustOffset.RotatedByRandom(MathHelper.TwoPi); - - int var = (int)(dustDistance / finalPhaseDustRatio); - float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; - for (int i = 0; i < numDust; i++) - { - if (Main.rand.NextBool(var)) - { - dustOffset = dustOffset.RotatedBy(angleIncrement); - int dust = Dust.NewDust(npc.Center, 1, 1, ModContent.DustType()); - Main.dust[dust].position = npc.Center + dustOffset; - Main.dust[dust].fadeIn = 1f; - Main.dust[dust].velocity = Vector2.Normalize(npc.Center - Main.dust[dust].position) * dustVelocity; - Main.dust[dust].scale = 3f - h; - } - } - } - - float succPower = 0.125f + finalPhaseDustRatio * 0.125f; - for (int i = 0; i < Main.maxPlayers; i++) - { - float distance = Vector2.Distance(Main.player[i].Center, npc.Center); - if (distance < suckDistance && Main.player[i].grappling[0] == -1) - { - if (Collision.CanHit(npc.Center, 1, 1, Main.player[i].Center, 1, 1)) - { - float distanceRatio = distance / suckDistance; - float multiplier = 1f - distanceRatio; - - if (Main.player[i].Center.X < npc.Center.X) - Main.player[i].velocity.X += succPower * multiplier; - else - Main.player[i].velocity.X -= succPower * multiplier; - } - } - } - - // Slowly die in final phase and then implode - // This phase lasts 20 seconds - if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int damageAmt = npc.lifeMax / 200; - npc.life -= damageAmt; - npc.DamageEffect(damageAmt); - } - - if (npc.life <= ((npc.lifeMax / 200) * 5) && !npc.ModNPC().playedbuildsound) - { - SoundEngine.PlaySound(CeaselessVoid.CeaselessVoid.BuildupSound, npc.Center); - npc.ModNPC().playedbuildsound = true; - } - - if (npc.life <= 0) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - } - - npc.netUpdate = true; - } - - // Beam Portals - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (calamityGlobalNPC.newAI[1] == 0f) - { - int numBeamPortals = bossRush ? 4 : revenge ? 3 : 2; - float degrees = 360 / numBeamPortals; - float beamPortalDistance = bossRush ? 360f : death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - for (int i = 0; i < numBeamPortals; i++) - { - float ai1 = i * degrees; - Projectile.NewProjectile(npc.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, damage, 0f, Main.myPlayer, ai1, 0f); - } - } - } - - // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active - float beamPortalTimeLeft = 600f; - bool summonLessDarkEnergies = false; - if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) - { - calamityGlobalNPC.newAI[1] += 1f; - summonLessDarkEnergies = true; - } - else if (theBigSucc) - calamityGlobalNPC.newAI[1] += 1f; - - // Suck in Dark Energy projectiles from far away - calamityGlobalNPC.newAI[3] += 1f; - float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; - if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) - { - calamityGlobalNPC.newAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 0.5f; - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1]); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - - npc.localAI[1] += 10f; - } - - // Summon some extra projectiles in Expert Mode - if (phase2 && expertMode) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] >= 60f * projectileFireRateMultiplier) - { - npc.localAI[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f != 0f; - float speed = 2f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - - // Summon some extra projectiles in Revengeance Mode - if (phase4 && revenge) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 90f * projectileFireRateMultiplier) - { - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - bool normalSpread = npc.localAI[0] % 2f == 0f; - float speed = 4f; - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalSpread ? new Vector2(0f, -speed) : new Vector2(-velocityX, -speed); - float radialOffset = MathHelper.ToRadians(npc.localAI[1] * 0.25f); - for (int i = 0; i < totalProjectiles; i++) - { - Vector2 spawnVector = npc.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; - Vector2 velocity = Vector2.Normalize(npc.Center - spawnVector) * speed; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnVector, velocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - if (move) - { - Movement(false); - } - else - { - // Slow down - if (npc.velocity.Length() > 0.5f) - npc.velocity *= 0.8f; - else - npc.velocity = Vector2.Zero; - } - - // Count up all Dark Energy HP values - int totalDarkEnergyHP = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - totalDarkEnergyHP += darkEnergy.life; - } - - // Destroy all Dark Energies if their total HP is below 20% - int darkEnergyMaxHP = bossRush ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; - //These are still needed so that CV Dark energy despawn works properly - double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; - darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); - - int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; - int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; - int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); - if (totalDarkEnergyHP < succPhaseGateValue) - { - SoundEngine.PlaySound(SoundID.NPCDeath44, npc.Center); - - // Kill all Dark Energies - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC darkEnergy = Main.npc[i]; - if (darkEnergy.active && darkEnergy.type == ModContent.NPCType()) - { - darkEnergy.HitEffect(); - darkEnergy.active = false; - darkEnergy.netUpdate = true; - } - } - - // Generate a dust explosion - int dustAmt = 30; - int random = 3; - for (int j = 0; j < 10; j++) - { - random += j * 2; - int dustAmtSpawned = 0; - int scale = random * 13; - float dustPositionX = npc.Center.X - (scale / 2); - float dustPositionY = npc.Center.Y - (scale / 2); - while (dustAmtSpawned < dustAmt) - { - float dustVelocityX = Main.rand.Next(-random, random); - float dustVelocityY = Main.rand.Next(-random, random); - float dustVelocityScalar = random * 2f; - float dustVelocity = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - dustVelocity = dustVelocityScalar / dustVelocity; - dustVelocityX *= dustVelocity; - dustVelocityY *= dustVelocity; - int dust = Dust.NewDust(new Vector2(dustPositionX, dustPositionY), scale, scale, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 100, default, 5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position.X = npc.Center.X; - Main.dust[dust].position.Y = npc.Center.Y; - Main.dust[dust].position.X += Main.rand.Next(-10, 11); - Main.dust[dust].position.Y += Main.rand.Next(-10, 11); - Main.dust[dust].velocity.X = dustVelocityX; - Main.dust[dust].velocity.Y = dustVelocityY; - dustAmtSpawned++; - } - } - } - } - - // Basic movement towards a location - void Movement(bool succ) - { - float velocity = moveVeryFast ? 25f : bossRush ? 15f : ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)) * tileEnrageMult; - float acceleration = (moveVeryFast ? 0.75f : bossRush ? 0.3f : death ? 0.2f : expertMode ? 0.16f : 0.12f) + (float)(death ? 0.04f * (1D - lifeRatio) : 0f) * tileEnrageMult; - - // Increase speed dramatically in succ phase - if (succ) - { - velocity *= 2f; - acceleration *= 2f; - } - - if (Main.getGoodWorld) - { - velocity *= 1.15f; - acceleration *= 1.15f; - } - - Vector2 destination = player.Center; - - // Move between 8 different positions around the player, in order - float maxDistance = 320f; - Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; - if (!succ && Main.getGoodWorld) - { - // Move to a new location every few seconds - calamityGlobalNPC.newAI[2] += 1f; - float newPositionGateValue = bossRush ? 120f : death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; - if (calamityGlobalNPC.newAI[2] > newPositionGateValue) - { - calamityGlobalNPC.newAI[2] = 0f; - - npc.ai[0] += 1f; - if (npc.ai[0] > 7f) - npc.ai[0] = 0f; - } - - switch ((int)npc.ai[0]) - { - case 0: - break; - case 1: - moveToOffset.X = -maxDistance; - break; - case 2: - moveToOffset.X = -maxDistance; - moveToOffset.Y = 0f; - break; - case 3: - moveToOffset.X = -maxDistance; - moveToOffset.Y = maxDistance; - break; - case 4: - moveToOffset.Y = maxDistance; - break; - case 5: - moveToOffset.X = maxDistance; - moveToOffset.Y = maxDistance; - break; - case 6: - moveToOffset.X = maxDistance; - moveToOffset.Y = 0f; - break; - case 7: - moveToOffset.X = maxDistance; - break; - } - } - - destination += moveToOffset; - - // How far Ceaseless Void is from where it's supposed to be - Vector2 distanceFromDestination = destination - npc.Center; - - // Movement - if (npc.Distance(destination) > maxDistance || succ || !Main.getGoodWorld) - CalamityUtils.SmoothMovement(npc, 0f, distanceFromDestination, velocity, acceleration, true); - } - - // Spawn more Dark Energies as the fight progresses - if (calamityGlobalNPC.newAI[0] == 0f && npc.life > 0) - calamityGlobalNPC.newAI[0] = npc.lifeMax; - - if (npc.life > 0) - { - int healthGateValue = (int)(npc.lifeMax * 0.3); - if ((npc.life + healthGateValue) < calamityGlobalNPC.newAI[0]) - { - npc.TargetClosest(); - calamityGlobalNPC.newAI[0] = npc.life; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - calamityGlobalNPC.newAI[3] = 0f; - npc.ai[3] = 0f; - npc.localAI[0] += 1f; - npc.localAI[1] = 0f; - npc.localAI[2] = 0f; - npc.localAI[3] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (phase4) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 4f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 3f, 0f, 0f); - } - else if (phase3) - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 3f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 0.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2f, 0f, 0f); - } - else - { - for (int i = 0; i < darkEnergyAmt; i++) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 0f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 1f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(npc.Center.Y + (Math.Cos(i * spacing) * distance2)), ModContent.NPCType(), npc.whoAmI, i * spacing, 2f, 0f, 0f); - } - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 1.5f, 0f, 0f); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + (Math.Sin(0) * distance2)), (int)(npc.Center.Y + (Math.Cos(0) * distance2)), ModContent.NPCType(), npc.whoAmI, 0f, 2.5f, 0f, 0f); - } - } - - // Despawn potentially hazardous projectiles when entering a new phase - for (int i = 0; i < Main.maxProjectiles; i++) - { - Projectile projectile = Main.projectile[i]; - if (projectile.active) - { - if (projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType() || - projectile.type == ModContent.ProjectileType() || projectile.type == ModContent.ProjectileType()) - { - if (projectile.timeLeft > 30) - projectile.timeLeft = 30; - } - } - } - } - } - } - } -} diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs deleted file mode 100644 index 281d6b94ab..0000000000 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ /dev/null @@ -1,1702 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; -using CalamityMod.Dusts; -using CalamityMod.Events; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.SulphurousSea; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; -using CalamityMod.Systems; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs -{ - public static class OldDukeAI - { - public static void VanillaOldDukeAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - OldDuke.OldDuke modNPC = npc.ModNPC(); - - npc.Calamity().canBreakPlayerDefense = true; - - // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; - - // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float exhaustionGateValue = 360f; - if (Main.getGoodWorld) - exhaustionGateValue *= 0.5f; - - float numberOfAttacksBeforeExhaustion = 12f; - float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); - bool exhausted = calamityGlobalNPC.newAI[1] == 1f; - bool phase2 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase2_Death : revenge ? OldDuke.OldDuke.LifePercentagePhase2_Revenge : OldDuke.OldDuke.LifePercentagePhase2_Normal); - bool phase3 = lifeRatio <= (death ? OldDuke.OldDuke.LifePercentagePhase3_Death : (revenge ? OldDuke.OldDuke.LifePercentagePhase3_Revenge : OldDuke.OldDuke.LifePercentagePhase3_Expert)) && expertMode; - bool phase2AI = npc.ai[0] > 4f; - bool phase3AI = npc.ai[0] > 9f; - - int phase = (npc.ModNPC as OldDuke.OldDuke).Phase; - - bool charging = npc.ai[3] < 10f; - float pie = (float)Math.PI; - - if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) - calamityGlobalNPC.newAI[1] = 1f; - - float alphaScale = (255 - npc.alpha) / 255f; - float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; - float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; - Lighting.AddLight((int)((npc.position.X + (npc.width / 2)) / 16f), (int)((npc.position.Y + (npc.height / 2)) / 16f), redLight, greenLight, 0f); - - if (CalamityServerConfig.Instance.BossesStopWeather) - CalamityWorld.StopRain(); - else if (!Main.raining && !BossRushEvent.BossRushActive) - CalamityWorld.StartRain(); - - // Adjust stats - int setDamage = npc.defDamage; - calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; - npc.defense = exhausted ? 0 : npc.defDefense; - if (phase3AI) - { - setDamage = (int)Math.Round(setDamage * 1.2); - npc.defense = exhausted ? 0 : npc.defDefense - 40; - } - else if (phase2AI) - { - setDamage = (int)Math.Round(setDamage * 1.1); - npc.defense = exhausted ? 0 : npc.defDefense - 20; - } - - int idlePhaseTimer = expertMode ? 55 : 60; - float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; - float idlePhaseVelocity = expertMode ? 14f : 13f; - if (phase3AI) - { - idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; - idlePhaseVelocity = expertMode ? 12f : 11f; - } - else if (phase2AI & charging) - { - idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; - idlePhaseVelocity = expertMode ? 15f : 14f; - } - - int chargeTime = expertMode ? 34 : 36; - float chargeVelocity = expertMode ? 20f : 19f; - if (phase3AI) - { - chargeTime = expertMode ? 28 : 30; - chargeVelocity = expertMode ? 26f : 25f; - } - else if (charging & phase2AI) - { - chargeTime = expertMode ? 31 : 33; - chargeVelocity = expertMode ? 24f : 23f; - } - - if (bossRush) - { - idlePhaseTimer = 35; - idlePhaseAcceleration *= 1.25f; - idlePhaseVelocity *= 1.2f; - chargeTime -= 3; - chargeVelocity *= 1.25f; - } - else if (death) - { - idlePhaseTimer = 51; - idlePhaseAcceleration *= 1.05f; - idlePhaseVelocity *= 1.05f; - chargeTime -= 2; - chargeVelocity *= 1.1f; - } - else if (revenge) - { - idlePhaseTimer = 53; - idlePhaseAcceleration *= 1.025f; - idlePhaseVelocity *= 1.025f; - chargeTime -= 1; - chargeVelocity *= 1.05f; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeVelocity *= 1.25f; - - if (exhausted) - idlePhaseVelocity *= 0.25f; - - // Variables - int maxToothBallBelches = bossRush ? 5 : death ? 4 : 3; - int toothBallBelchPhaseDivisor = bossRush ? 24 : death ? 30 : 40; - int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; - float toothBallBelchPhaseAcceleration = bossRush ? 0.95f : death ? 0.6f : 0.55f; - float toothBallBelchPhaseVelocity = bossRush ? 14f : death ? 10f : 9f; - float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; - float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; - float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; - float sharkronVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; - int attackTimer = 120; - int phaseTransitionTimer = 180; - int teleportPauseTimer = 30; - int toothBallSpinPhaseDivisor = bossRush ? 27 : death ? 32 : 45; - int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; - float spinTime = toothBallSpinTimer / 2f; - float toothBallSpinToothBallVelocity = bossRush ? 14f : death ? 9.5f : 9f; - float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; - float spinSpeed = MathHelper.TwoPi / spinTime; - - Player player = Main.player[npc.target]; - - // Get target - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active) - { - npc.TargetClosest(); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - // Despawn safety, make sure to target another player if the current player target is too far away - if (Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) - npc.TargetClosest(); - - // Despawn - if (player.dead || Vector2.Distance(player.Center, npc.Center) > 8800f) - { - npc.TargetClosest(); - - npc.velocity.Y -= 0.4f; - - if (npc.timeLeft > 10) - npc.timeLeft = 10; - - if (npc.timeLeft == 1) - { - AcidRainEvent.AccumulatedKillPoints = 0; - AcidRainEvent.HasTriedToSummonOldDuke = false; - AcidRainEvent.UpdateInvasion(false); - npc.timeLeft = 0; - } - - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - if (exhausted) - { - npc.Calamity().canBreakPlayerDefense = false; - - // Play exhausted sound - if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < 2800f) - SoundEngine.PlaySound(OldDuke.OldDuke.HuffSound with { Volume = OldDuke.OldDuke.HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); - - if (Main.zenithWorld) - { - float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, npc.Distance(Main.LocalPlayer.Center), true); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; - - if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) - SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f }, player.Center); // fart - - if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) - { - Vector2 dist = player.Center - npc.Center; - dist.Normalize(); - dist *= 3; - dist.X += Main.rand.NextFloat(-0.5f, 0.5f); - dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, -dist, type, damage, 0, Main.myPlayer); - } - } - - calamityGlobalNPC.newAI[0] -= bossRush ? 1.5f : 1f; - if (calamityGlobalNPC.newAI[0] <= 0f) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - } - } - - // Enrage variable - bool enrage = !bossRush && - (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - - // Check for the flipped Abyss - if (Main.remixWorld) - { - enrage = !bossRush && - (player.position.Y < Main.UnderworldLayer * 16 * 0.8f || player.position.Y > Main.UnderworldLayer * 16 || - (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); - } - - // Enrage - if (enrage) - { - if (npc.localAI[1] > 0f) - npc.localAI[1] -= 1f; - } - else - npc.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = npc.localAI[1] <= 0f; - - npc.Calamity().CurrentlyEnraged = biomeEnraged || bossRush; - - // Increased DR while transitioning phases and not exhausted - if (!exhausted) - calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.75f) : 0.5f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - // Enrage - if (biomeEnraged) - { - toothBallBelchPhaseTimer = 60; - toothBallBelchPhaseDivisor = 20; - toothBallBelchPhaseAcceleration = 1f; - toothBallBelchPhaseVelocity = 15f; - goreVelocityX = 12f; - goreVelocityY = 16f; - sharkronVelocity = 20f; - idlePhaseTimer = 20; - idlePhaseAcceleration = 1.2f; - idlePhaseVelocity = 20f; - chargeTime = 25; - chargeVelocity += 8f; - toothBallSpinPhaseDivisor = 24; - toothBallSpinToothBallVelocity = 15f; - setDamage *= 2; - npc.defense = npc.defDefense * 3; - } - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge) - chargeTime *= 2; - - // Set variables for spawn effects - if (npc.localAI[0] == 0f) - { - npc.alpha = 255; - - npc.velocity.Y = -12f; - npc.velocity.X = Main.rand.NextFloat(-2f, 2f); - - npc.localAI[0] = 1f; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - // Rotation - float rateOfRotation = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f || npc.ai[0] == 7f || npc.ai[0] == 14f) - rateOfRotation = 0f; - if (npc.ai[0] == 3f || npc.ai[0] == 4f) - rateOfRotation = 0.01f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - rateOfRotation = 0.05f; - - Vector2 rotationVector = player.Center - npc.Center; - if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) - { - // Rotate to show direction of predictive charge - if (npc.ai[0] == 0f && !phase2) - { - if (npc.ai[3] < 6f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 5f && !phase3) - { - if (npc.ai[3] < 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - else if (npc.ai[0] == 10f) - { - if (npc.ai[3] < 8f && npc.ai[3] != 1f && npc.ai[3] != 4f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } - } - - float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); - if (npc.spriteDirection == 1) - dukeRotationSpeed += pie; - if (dukeRotationSpeed < 0f) - dukeRotationSpeed += MathHelper.TwoPi; - if (dukeRotationSpeed > MathHelper.TwoPi) - dukeRotationSpeed -= MathHelper.TwoPi; - if (npc.ai[0] == -1f || npc.ai[0] == 3f || npc.ai[0] == 4f) - dukeRotationSpeed = 0f; - if (npc.ai[0] == 8f || npc.ai[0] == 13f) - dukeRotationSpeed = pie * 0.1666666667f * npc.spriteDirection; - - if (npc.rotation < dukeRotationSpeed) - { - if (dukeRotationSpeed - npc.rotation > pie) - npc.rotation -= rateOfRotation; - else - npc.rotation += rateOfRotation; - } - if (npc.rotation > dukeRotationSpeed) - { - if (npc.rotation - dukeRotationSpeed > pie) - npc.rotation += rateOfRotation; - else - npc.rotation -= rateOfRotation; - } - - if ((npc.ai[0] != 8f && npc.ai[0] != 13f) || npc.spriteDirection == 1) - { - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - if (npc.rotation > dukeRotationSpeed - rateOfRotation && npc.rotation < dukeRotationSpeed + rateOfRotation) - npc.rotation = dukeRotationSpeed; - } - - // Alpha adjustments - if (npc.ai[0] != -1f && (npc.ai[0] < 9f || npc.ai[0] > 12f)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - // Spawn effects - if (npc.ai[0] == -1f) - { - npc.alpha = (int)MathHelper.Lerp(npc.alpha, 0, 0.2f); - - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.Calamity().newAI[3] == 0f) - npc.velocity *= 0.98f; - - // Direction - int dukeFaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (dukeFaceDirection != 0) - { - npc.direction = dukeFaceDirection; - npc.spriteDirection = -npc.direction; - } - - // Alpha - if (npc.ai[2] > 20f) - { - npc.velocity *= 0.9f; - - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - if (npc.alpha < 0) - npc.alpha = 0; - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[2] == 75) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - CalamityUtils.AddScreenshakeAt(npc.Center, 14); - SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(-0.5f), npc.Center); - SoundEngine.PlaySound(OldDuke.OldDuke.DashSoundP3, npc.Center); - } - - if (npc.ai[2] >= 75f) - { - float sd = player.Center.X > npc.Center.X ? -1f : 1f; - - (npc.ModNPC as OldDuke.OldDuke).shake = 2f; - npc.rotation = MathHelper.Lerp(MathHelper.WrapAngle(npc.rotation), MathHelper.ToRadians(sd == 1f ? 75f : -75f), 0.2f); - - if (npc.ai[2] % 5f == 1f) - { - Vector2 mouthCenter = npc.Center + new Vector2(-80 * sd, 0).RotatedBy(npc.rotation); - - float factor = (npc.ai[2] - 75f) / 50f; - - float a = MathHelper.Lerp(1f, 0f, factor); - - GeneralParticleHandler.SpawnParticle(new CustomPulse(mouthCenter, Vector2.Zero, new Color(55, 55, 55).MultiplyRGBA(new Color(a, a, a, a)), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.08f + (0.15f * factor), 10)); - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= 125f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - - // Phase 1 - else if (npc.ai[0] == 0f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); - - // Rotation and direction - int dukeLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (dukeLookAt != 0) - { - if (npc.ai[2] == 0f && dukeLookAt != npc.direction) - npc.rotation += pie; - - npc.direction = dukeLookAt; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) - { - int oldDukeAttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - oldDukeAttackPicker = 1; - break; - case 6: - npc.ai[3] = 1f; - oldDukeAttackPicker = 2; - break; - case 7: - npc.ai[3] = 0f; - oldDukeAttackPicker = 3; - break; - } - - if (phase2) - oldDukeAttackPicker = 4; - - // Set velocity for charge - if (oldDukeAttackPicker == 1) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - DoChargeBurst(npc, 0); - - // Direction - if (dukeLookAt != 0) - { - npc.direction = dukeLookAt; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - // Tooth Balls - else if (oldDukeAttackPicker == 2) - { - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Call sharks from the sides of the screen - else if (oldDukeAttackPicker == 3) - { - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to phase 2 - else if (oldDukeAttackPicker == 4) - { - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 1f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 10f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - // Spawn dust - Vector2 vel = npc.velocity; - vel.Normalize(); - vel *= 55f; - - DoChargeVisual(npc, phase); - - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball belch - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * toothBallBelchPhaseVelocity; - npc.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); - - // Play sounds and spawn Tooth Balls - if (npc.ai[2] == 0f) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] % toothBallBelchPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 toothBallDirection = Vector2.Normalize(player.Center - npc.Center) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(Main.player[npc.target].Center - npc.Center) * toothBallFinalVelocity; - Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * npc.velocity.Length(); - Main.npc[toothBall].netUpdate = true; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Direction - int toothBallLookAt = Math.Sign(player.Center.X - npc.Center.X); - if (toothBallLookAt != 0) - { - npc.direction = toothBallLookAt; - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallBelchPhaseTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Call sharks from the sides of the screen - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound and spawn sharks - if (npc.ai[2] == attackTimer - 30) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 900f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 1800f), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 2 and call sharks from below - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 2 - else if (npc.ai[0] == 5f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); - - // Direction and rotation - int phase2FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase2FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase2FaceDirection != npc.direction) - npc.rotation += pie; - - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) - { - int phase2AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - phase2AttackPicker = 1; - break; - case 4: - npc.ai[3] = 1f; - phase2AttackPicker = 2; - break; - case 5: - npc.ai[3] = 0f; - phase2AttackPicker = 3; - break; - } - - if (phase3) - phase2AttackPicker = 4; - - // Set velocity for charge - if (phase2AttackPicker == 1) - { - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - DoChargeBurst(npc, 1); - } - - // Set velocity for spin - else if (phase2AttackPicker == 2) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase2FaceDirection != 0) - { - npc.direction = phase2FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase2AttackPicker == 3) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Go to next phase - else if (phase2AttackPicker == 4) - { - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 6f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 8f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - DoChargeVisual(npc, phase); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 7f) - { - // Set damage - npc.damage = 0; - - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase2ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 30f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * (float)npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 8f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase2GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 100f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Transition to phase 3 and summon sharks from above - else if (npc.ai[0] == 9f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Sound - if (npc.ai[2] == phaseTransitionTimer - 60) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (npc.ai[2] >= phaseTransitionTimer - 60) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 200f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(npc.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(npc.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= phaseTransitionTimer) - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = 0f; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Phase 3 - else if (npc.ai[0] == 10f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - // Movement location - if (npc.ai[1] == 0f) - npc.ai[1] = 500 * Math.Sign((npc.Center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-npc.ai[1], -300f) - npc.Center - npc.velocity) * idlePhaseVelocity; - npc.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); - - // Rotation and direction - int phase3FaceDirection = Math.Sign(player.Center.X - npc.Center.X); - if (phase3FaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3FaceDirection != npc.direction) - { - npc.rotation += pie; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - // Phase switch - if (calamityGlobalNPC.newAI[1] != 1f) - { - npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer) - { - int phase3AttackPicker = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - phase3AttackPicker = 1; - break; - case 1: - case 8: - phase3AttackPicker = 2; - break; - case 4: - npc.ai[3] = 1f; - phase3AttackPicker = 3; - break; - case 9: - npc.ai[3] = 6f; - phase3AttackPicker = 4; - break; - } - - // Set velocity for charge - if (phase3AttackPicker == 1) - { - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - // Velocity and rotation - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - DoChargeBurst(npc, 2); - } - - // Pause - else if (phase3AttackPicker == 2) - { - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - else if (phase3AttackPicker == 3) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - // Set velocity for spin - else if (phase3AttackPicker == 4) - { - // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center - npc.Center) * spinAttackSpeed; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (phase3FaceDirection != 0) - { - npc.direction = phase3FaceDirection; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[0] = 14f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - } - - npc.netUpdate = true; - } - } - } - - // Charge - else if (npc.ai[0] == 11f) - { - // Set damage - npc.damage = setDamage; - - // The dumbest thing to ever exist - if (CalamityWorld.LegendaryMode && revenge && npc.ai[2] % 6f == 0f) - { - // Rotation and direction - int dir = Math.Sign(player.Center.X - npc.Center.X); - if (dir != 0) - { - if (npc.ai[2] == 0f && dir != npc.direction) - npc.rotation += pie; - - npc.direction = dir; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - - Vector2 distanceVector = player.Center + player.velocity * 20f - npc.Center; - npc.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - - // Direction - if (dir != 0) - { - npc.direction = dir; - - if (npc.spriteDirection == 1) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - else - { - // Accelerate - npc.velocity *= 1.01f; - } - - DoChargeVisual(npc, phase); - - npc.ai[2] += 1f; - if (npc.ai[2] >= chargeTime) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Pause before teleport - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Alpha - if (npc.alpha < 255 && npc.ai[2] >= teleportPauseTimer - 15f) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == teleportPauseTimer / 2) - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == teleportPauseTimer - 1f) - { - // Teleport location - if (npc.ai[1] == 0f) - npc.ai[1] = 600 * Math.Sign((npc.Center - player.Center).X); - - // Rotation and direction - Vector2 center = player.Center + new Vector2(npc.ai[1], -300f); - Vector2 npcCenter = npc.Center = center; - int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); - if (phase3TeleportFaceDirection != 0) - { - if (npc.ai[2] == 0f && phase3TeleportFaceDirection != npc.direction) - { - npc.rotation += pie; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = phase3TeleportFaceDirection; - - if (npc.spriteDirection != -npc.direction) - npc.rotation += pie; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= teleportPauseTimer) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - - npc.ai[3] += 2f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - - // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen - else if (npc.ai[0] == 13f) - { - // Avoid cheap bullshit - npc.damage = 0; - - // Velocity - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - - // Play sound - if (npc.ai[2] == attackTimer - 30) - { - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 phase3GoreDirection = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + npc.Center; - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - int totalGore = Main.getGoodWorld ? 40 : 20; - for (int i = 0; i < totalGore; i++) - { - float velocityX = npc.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); - - if (Main.getGoodWorld) - { - velocityX *= Main.rand.NextFloat() + 0.5f; - velocityY *= Main.rand.NextFloat() + 0.5f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, damage, 0f, Main.myPlayer, 0f, 0f); - } - } - } - - if (npc.ai[2] >= attackTimer - 90) - { - if (npc.ai[2] % 18f == 0f) - { - calamityGlobalNPC.newAI[2] += 150f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float x = 900f - calamityGlobalNPC.newAI[2]; - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - - if (Main.getGoodWorld) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X + x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X - x), (int)(npc.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, npc.whoAmI, 0f, 255); - } - } - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= attackTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - calamityGlobalNPC.newAI[2] = 0f; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - // Tooth Ball and Vortex spin - else if (npc.ai[0] == 14f) - { - // Set damage - npc.damage = 0; - - // Play sounds and spawn Tooth Balls and a Vortex - if (npc.ai[2] == 0f) - { - modNPC.RoarSoundSlot = SoundEngine.PlaySound(OldDuke.OldDuke.RoarSound, npc.Center); - - SoundEngine.PlaySound(OldDuke.OldDuke.VortexSpawnSound, npc.Center); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - Vector2 vortexSpawn = npc.Center + npc.velocity.RotatedBy(MathHelper.PiOver2 * -npc.direction) * spinTime / MathHelper.TwoPi; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, damage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); - } - - if (npc.ai[2] % toothBallSpinPhaseDivisor == 0f) - { - if (npc.ai[2] != 0f) - SoundEngine.PlaySound(OldDuke.OldDuke.VomitSound, npc.Center); - - Vector2 phase3ToothBallDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; - Vector2 toothBallVelocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * toothBallSpinToothBallVelocity; - Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int toothBall = NPC.NewNPC(npc.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); - Main.npc[toothBall].target = npc.target; - Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; - Main.npc[toothBall].netUpdate = true; - Main.npc[toothBall].ai[3] = 60f; - } - - for (int i = 0; i < 50; i++) - { - int dustID; - switch (Main.rand.Next(6)) - { - case 0: - case 1: - case 2: - case 3: - dustID = (int)CalamityDusts.SulphurousSeaAcid; - break; - default: - dustID = DustID.Blood; - break; - } - - // Choose a random speed and angle to belch out the vomit - float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); - float angleRandom = 0.06f; - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - // Pick a size for the vomit particles - float scale = Main.rand.NextFloat(1f, 2f); - - // Actually spawn the vomit - int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); - Main.dust[idx].noGravity = true; - } - } - - // Velocity and rotation - npc.velocity = npc.velocity.RotatedBy(-(double)spinSpeed * npc.direction); - npc.rotation -= spinSpeed * npc.direction; - - npc.ai[2] += 1f; - if (npc.ai[2] >= toothBallSpinTimer) - { - calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.TargetClosest(); - npc.netUpdate = true; - } - } - - if (SoundEngine.TryGetActiveSound(modNPC.RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) - roarSound.Position = npc.Center; - } - - static Color FireGreen = new Color(155, 255, 55); - - static void DoChargeBurst(NPC npc, int phase) - { - SoundEngine.PlaySound(phase > 1 ? OldDuke.OldDuke.DashSoundP3 : OldDuke.OldDuke.DashSound, npc.Center); - - if (phase > 1) - { - for (int i = 0; i < 30; i++) - { - float fl = Main.rand.NextFloat(-60f, 60f); - GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20f) + new Vector2(0f, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); - } - - CalamityUtils.AddScreenshakeAt(npc.Center, 10f, 3000f); - - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3f, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2f, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); - } - } - - static void DoChargeVisual(NPC npc, int phase) - { - float progress = npc.ai[2]; - - int chargeTime = 36; - - Color col = Color.Lerp(phase > 0 ? FireGreen : new Color(100, 100, 100, 55), new Color(55, 55, 55, 55), progress / chargeTime); - - if (phase > 1) - { - if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f) - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3f, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20)); - - (npc.ModNPC as OldDuke.OldDuke).NuclearOverlayVisual = 1f; - } - - if (Main.rand.NextBool()) - GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2f), npc.velocity / 2f, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f))); - } - } -} diff --git a/NPCs/CalamityDrawParameterNPC.cs b/NPCs/CalamityDrawParameterNPC.cs index ca630f4f02..40c5bf6185 100644 --- a/NPCs/CalamityDrawParameterNPC.cs +++ b/NPCs/CalamityDrawParameterNPC.cs @@ -45,8 +45,8 @@ namespace CalamityMod.NPCs #region Load / Unload public override void Load() { - DrawingMiracleBlight = new bool[Main.maxNPCs]; - DrawingPolarity = new bool[Main.maxNPCs]; + DrawingMiracleBlight = new bool[Main.maxNPCs + 1]; + DrawingPolarity = new bool[Main.maxNPCs + 1]; } public override void Unload() @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs return false; // Do not draw if the npc does not have miracle blight, or has the polarity effect. - if (calNPC.miracleBlight <= 0 || polNPC.CurPolarity > 0f) + if (!calNPC.miracleBlight || polNPC.CurPolarity > 0f) return false; // Do not draw if the current player has the trippy effect. @@ -121,7 +121,7 @@ namespace CalamityMod.NPCs return false; // I don't know who would be using this while also inflicting miracle blight, but in that rare case, do not draw these. - if (calNPC.miracleBlight > 0) + if (calNPC.miracleBlight) return false; // Do not draw if the npc doesn't have the polarity effect. diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 3bacff807f..163157712f 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -10,6 +10,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Buffs.Summon.Whips; using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.ExtraTextures; @@ -17,6 +18,8 @@ using CalamityMod.Graphics.Metaballs; using CalamityMod.Graphics.Renderers.CalamityRenderers; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Armor.PlagueReaper; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.Tools; using CalamityMod.Items.Weapons.Melee; @@ -72,9 +75,7 @@ using CalamityMod.UI; using CalamityMod.UI.DebuffSystem; using CalamityMod.Walls.DraedonStructures; using CalamityMod.World; -using Microsoft.Build.Evaluation; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Operations; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using MonoMod.Utils; @@ -148,10 +149,25 @@ namespace CalamityMod.NPCs /// public bool? VulnerableToWater = null; - public const double BaseDoTDamageMult = 1D; - public const double VulnerableToDoTDamageMult = 2D; - public const double VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5; - public const double ResistantToDoTDamageMult = 0.5; + public const float BaseDoTDamageMult = 1f; + public const float VulnerableToDoTDamageMult = 2f; + public const float VulnerableToDoTDamageMult_Worms_SlimeGod = 1.5f; + public const float ResistantToDoTDamageMult = 0.5f; + + public StatModifier TypelessDebuffMultiplier = new StatModifier(); + public StatModifier HeatDebuffMultiplier = new StatModifier(); + public StatModifier ColdDebuffMultiplier = new StatModifier(); + public StatModifier SicknessDebuffMultiplier = new StatModifier(); + public StatModifier WaterDebuffMultiplier = new StatModifier(); + public StatModifier ElectricDebuffMultiplier = new StatModifier(); + + // These are all recalculated constantly, while the regular ones are recalulated only on hit + public StatModifier ActiveTypelessDebuffMultiplier = new StatModifier(); + public StatModifier ActiveHeatDebuffMultiplier = new StatModifier(); + public StatModifier ActiveColdDebuffMultiplier = new StatModifier(); + public StatModifier ActiveSicknessDebuffMultiplier = new StatModifier(); + public StatModifier ActiveWaterDebuffMultiplier = new StatModifier(); + public StatModifier ActiveElectricDebuffMultiplier = new StatModifier(); // Cold debuff effects public bool IncreasedColdEffects_EskimoSet = false; @@ -189,8 +205,6 @@ namespace CalamityMod.NPCs public float velocityPriorToPhaseSwap = 0f; public const float velocityPriorToPhaseSwapIncrement = 0.1f; - public bool ShouldFallThroughPlatforms; - /// Allows hostile NPCs to deal defense damage to the player, used mostly for hard-hitting bosses. public bool canBreakPlayerDefense = false; @@ -219,24 +233,8 @@ namespace CalamityMod.NPCs /// public int destroyerLaserColor = -1; - /// Constant multiplier used to increase vanilla enemy health. - private const double EnemyHPMultiplier = 1.25; /// Constant multiplier used to decrease the health and/or damage of pre-Hardmode Desert enemies. private const double DesertEnemyStatMultiplier = 0.75; - /// - /// Constant multiplier used to decrease vanilla boss health in Master Mode.
- /// When combined with the universal health multiplier, results in 27.5% more health than Expert Mode. - ///
- public const double MasterModeBossHPMultiplier = 0.85; - - /// Constant multiplier used to decrease enemy health in Master Mode. - public const double MasterModeEnemyHPMultiplier = 0.75; - /// Constant multiplier used to decrease enemy damage in Master Mode. - public const double MasterModeEnemyDamageMultiplier = 0.9; - /// Constant multiplier used to decrease enemy knockback resistance. - public const float ExpertModeEnemyKnockbackMultiplier = 0.05f; - /// - public const float MasterModeEnemyKnockbackMultiplier = 0.1f; /// Constant multiplier used for decreasing the health and damage of mechanical bosses if the Early Hardmode Progression Rework config is enabled. public const double EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic = 0.8; @@ -289,17 +287,20 @@ namespace CalamityMod.NPCs /// Tracks the current slowing debuff cooldown for this NPC. public int debuffResistanceTimer = 0; - // Debuffs - public int vaporfied = 0; - public int timeSlow = 0; - public int gState = 0; - public int tesla = 0; - public int tSad = 0; - public int eutrophication = 0; - public int webbed = 0; - public int slowed = 0; - public int electrified = 0; - public int pearlAura = 0; + #region Debuffs + public bool vaporfied = false; + public bool timeDistortion = false; + public bool glacialState = false; + public bool galvanicCorrosion = false; + public bool temporalSadness = false; + public bool eutrophication = false; + public bool webbed = false; + public bool electrified = false; + public bool pearlAura = false; + + public float manaBurn = 0f; + public float manaBurnPeak = 0f; + public float playerManaBurnIntensity = 0f; /// /// Counter variable that increments while the NPC is inflicted with Pearl Aura.
/// Used to determine when Giant Pearl's pearl shards should rain down onto the NPC. @@ -310,24 +311,25 @@ namespace CalamityMod.NPCs /// Used for properly counting pearl shard amount and for giving pearl shards an owner. ///
public int pearlAuraOwner = -1; - public int bBlood = 0; - public int brainRot = 0; - public int heavybleeding = 0; - public int laceration = 0; - public int elementalMix = 0; - public int marked = 0; - public int absorberAffliction = 0; - public int irradiated = 0; - public int bFlames = 0; - public int demonicFlames = 0; + public bool burningBlood = false; + public bool brainRot = false; + public bool heavyBleeding = false; + public bool laceration = false; + public bool elementalMix = false; + public bool markedForDeath = false; + public bool absorberAffliction = false; + public bool irradiated = false; + public double irradiatedContactBoost = 1.5; + public bool brimstoneFlames = false; + public bool demonicFlames = false; public int demonicFlamesBonusDamage = 0; - public int hFlames = 0; - /// Plague debuff. - public int pFlames = 0; - public int aCrunch = 0; - public int crumble = 0; + public bool holyFlames = false; + public bool plague = false; + public bool armorCrunch = false; + public bool crumble = false; public int antlionCloudDebuffTimer = 0; + public bool scionsCurioEffected = false; public int warbannerBurnTime = 0; // Determines the rate that the enemy is damaged public int warbannerBurnTimer = 0; // The duration of the debuff public int warbannerBurnStacks = 0; // The stacks increase how fast the debuff hits @@ -384,41 +386,41 @@ namespace CalamityMod.NPCs /// Counter used for removing stacks of Shred. The number of stacks is subtracted every frame, and when it hits zero, it is reset and one stack is removed. public int somaShredFalloff = Shred.StackFalloffFrames; - public int cDepth = 0; - public int rTide = 0; - public int hPressure = 0; - public int gsInferno = 0; - public int dragonFire = 0; - public int vermillionFlux = 0; - public int auricRebuke = 0; - public int staticDischarge = 0; - public int miracleBlight = 0; - public int astralInfection = 0; - public int wDeath = 0; - public int nightwither = 0; + public bool crushDepth = false; + public bool riptide = false; + public bool hadopelagicPressure = false; + public bool godSlayerInferno = false; + public bool dragonFire = false; + public bool vermillionFlux = false; + public bool auricRebuke = false; + public bool staticDischarge = false; + public bool miracleBlight = false; + public bool astralInfection = false; + public bool whisperingDeath = false; + public bool nightwither = false; /// If greater than 0, this NPC has been "shocked" by Ilmeris' Spark's on hurt effect. public int shocked = 0; - public int voidfrost = 0; - public int shellfishVore = 0; - public int clamDebuff = 0; - public int sulphurPoison = 0; + public bool voidfrost = false; + public bool shellfishStaffDebuff = false; + public bool snapClamDebuff = false; + public bool sulphurPoison = false; /// If greater than 0, makes this NPC constantly spawn heart gores. public int ladHearts = 0; - public int kamiFlu = 0; - public int relicOfResilienceWeakness = 0; + public bool relicOfResilienceWeakness = false; /// Cooldown variable for spawning Gauss Dagger's gauss flux projectiles. public int GaussFluxTimer = 0; - public int sagePoisonTime = 0; + public bool sagePoison = false; public int sagePoisonDamage = 0; - public int vulnerabilityHex = 0; - public int trueVulnerabilityHex = 0; - public int banishingFire = 0; - public int wither = 0; + public bool vulnerabilityHex = false; + public bool trueVulnerabilityHex = false; + public bool banishingFire = false; + public bool wither = false; /// /// If greater than 0, this enemy will appear to disintegrate into ash when killed.
/// Used by Rancor's laser beam. ///
public int ashesOnDeath = 0; + #endregion // whoAmI Variables public static int[] bobbitWormBottom = new int[5]; @@ -478,6 +480,7 @@ namespace CalamityMod.NPCs // Drawing variables. public FireParticleSet VulnerabilityHexFireDrawer = null; + public FireParticleSet ManaBurnFireDrawer = null; /// /// Boss Enrage variable for use with the boss health UI.
@@ -556,8 +559,6 @@ namespace CalamityMod.NPCs myClone.velocityPriorToPhaseSwap = velocityPriorToPhaseSwap; - myClone.ShouldFallThroughPlatforms = ShouldFallThroughPlatforms; - myClone.canBreakPlayerDefense = canBreakPlayerDefense; myClone.miscDefenseLoss = miscDefenseLoss; @@ -587,33 +588,34 @@ namespace CalamityMod.NPCs myClone.debuffResistanceTimer = debuffResistanceTimer; myClone.vaporfied = vaporfied; - myClone.timeSlow = timeSlow; - myClone.gState = gState; - myClone.tesla = tesla; - myClone.tSad = tSad; + myClone.timeDistortion = timeDistortion; + myClone.glacialState = glacialState; + myClone.galvanicCorrosion = galvanicCorrosion; + myClone.temporalSadness = temporalSadness; myClone.eutrophication = eutrophication; myClone.webbed = webbed; - myClone.slowed = slowed; myClone.electrified = electrified; myClone.pearlAura = pearlAura; myClone.pearlAuraCounter = pearlAuraCounter; - myClone.bBlood = bBlood; + myClone.burningBlood = burningBlood; myClone.brainRot = brainRot; - myClone.heavybleeding = heavybleeding; + myClone.heavyBleeding = heavyBleeding; myClone.laceration = laceration; myClone.elementalMix = elementalMix; - myClone.marked = marked; + myClone.markedForDeath = markedForDeath; myClone.absorberAffliction = absorberAffliction; myClone.irradiated = irradiated; - myClone.bFlames = bFlames; + myClone.irradiatedContactBoost = irradiatedContactBoost; + myClone.brimstoneFlames = brimstoneFlames; myClone.demonicFlames = demonicFlames; myClone.demonicFlamesBonusDamage = demonicFlamesBonusDamage; - myClone.hFlames = hFlames; - myClone.pFlames = pFlames; - myClone.aCrunch = aCrunch; + myClone.holyFlames = holyFlames; + myClone.plague = plague; + myClone.armorCrunch = armorCrunch; myClone.crumble = crumble; myClone.antlionCloudDebuffTimer = antlionCloudDebuffTimer; + myClone.scionsCurioEffected = scionsCurioEffected; myClone.warbannerBurnTime = warbannerBurnTime; myClone.warbannerBurnTimer = warbannerBurnTimer; myClone.warbannerBurnStacks = warbannerBurnStacks; @@ -644,28 +646,27 @@ namespace CalamityMod.NPCs myClone.somaShredApplicator = somaShredApplicator; myClone.somaShredFalloff = somaShredFalloff; - myClone.cDepth = cDepth; - myClone.rTide = rTide; - myClone.hPressure = hPressure; - myClone.gsInferno = gsInferno; + myClone.crushDepth = crushDepth; + myClone.riptide = riptide; + myClone.hadopelagicPressure = hadopelagicPressure; + myClone.godSlayerInferno = godSlayerInferno; myClone.miracleBlight = miracleBlight; myClone.dragonFire = dragonFire; myClone.vermillionFlux = vermillionFlux; myClone.auricRebuke = auricRebuke; myClone.staticDischarge = staticDischarge; myClone.astralInfection = astralInfection; - myClone.wDeath = wDeath; + myClone.whisperingDeath = whisperingDeath; myClone.nightwither = nightwither; myClone.shocked = shocked; myClone.voidfrost = voidfrost; - myClone.shellfishVore = shellfishVore; - myClone.clamDebuff = clamDebuff; + myClone.shellfishStaffDebuff = shellfishStaffDebuff; + myClone.snapClamDebuff = snapClamDebuff; myClone.sulphurPoison = sulphurPoison; myClone.ladHearts = ladHearts; - myClone.kamiFlu = kamiFlu; myClone.relicOfResilienceWeakness = relicOfResilienceWeakness; myClone.GaussFluxTimer = GaussFluxTimer; - myClone.sagePoisonTime = sagePoisonTime; + myClone.sagePoison = sagePoison; myClone.sagePoisonDamage = sagePoisonDamage; myClone.vulnerabilityHex = vulnerabilityHex; myClone.trueVulnerabilityHex = trueVulnerabilityHex; @@ -675,6 +676,7 @@ namespace CalamityMod.NPCs // This gets set up as needed. myClone.VulnerabilityHexFireDrawer = null; + myClone.ManaBurnFireDrawer = null; myClone.CurrentlyEnraged = CurrentlyEnraged; @@ -775,6 +777,79 @@ namespace CalamityMod.NPCs CanHaveBossHealthBar = false; ShouldCloseHPBar = false; if (arcZapCooldown > 0) { arcZapCooldown--; } + + //Debuff Bool clearing. + // Doze 2jun2025 - Moved here from PostAI so drawing can read the bools. + if (debuffResistanceTimer > 0) + debuffResistanceTimer--; + + timeDistortion = false; + galvanicCorrosion = false; + glacialState = false; + temporalSadness = false; + eutrophication = false; + webbed = false; + vaporfied = false; + electrified = false; + pearlAura = false; + burningBlood = false; + brainRot = false; + heavyBleeding = false; + laceration = false; + elementalMix = false; + if (!trueVulnerabilityHex && !vulnerabilityHex) + { + cursorFocus = 0; + } + trueVulnerabilityHex = false; + vulnerabilityHex = false; + markedForDeath = false; + absorberAffliction = false; + irradiated = false; + if (scionsCurioEffected) + irradiatedContactBoost = 2f; + brimstoneFlames = false; + if (!demonicFlames) + demonicFlamesBonusDamage = 0; + demonicFlames = false; + holyFlames = false; + plague = false; + // Soma Prime's Shred stacks have a unique falloff mechanic in the debuff's own file. + armorCrunch = false; + crumble = false; + crushDepth = false; + hadopelagicPressure = false; + riptide = false; + godSlayerInferno = false; + dragonFire = false; + vermillionFlux = false; + auricRebuke = false; + staticDischarge = false; + miracleBlight = false; + astralInfection = false; + whisperingDeath = false; + nightwither = false; + if (shocked > 0) + shocked--; + voidfrost = false; + shellfishStaffDebuff = false; + snapClamDebuff = false; + sulphurPoison = false; + sagePoison = false; + if (GaussFluxTimer > 0) + GaussFluxTimer--; + if (ladHearts > 0) + ladHearts--; + banishingFire = false; + wither = false; + if (ashesOnDeath > 0) + ashesOnDeath--; + + if (antlionCloudDebuffTimer > 0) + antlionCloudDebuffTimer--; + if (cursorFocus > 0 && cursorFocus < cursorFocusMax) + cursorFocus--; + relicOfResilienceWeakness = false; } #endregion @@ -841,539 +916,114 @@ namespace CalamityMod.NPCs damage = projectileCount * 4; } } - - // Shellfish Staff (and Mollusk armor) debuff stacking - if (shellfishVore > 0) - { - int projectileCount = 0; - int owner = 255; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == ProjectileType() && - p.ai[0] == 1f && p.ai[1] == npc.whoAmI) - { - owner = p.owner; - projectileCount++; - if (projectileCount >= 5) - { - projectileCount = 5; - break; - } - } - } - - Item heldItem = Main.player[owner].ActiveItem(); - int totalDamage = (int)Main.player[owner].GetTotalDamage().ApplyTo(150f); - - if (CalamityUtils.ShouldTriggerSummonPenalty(Main.player[owner], heldItem)) - totalDamage = (int)(totalDamage * BalancingConstants.SummonerCrossClassNerf); - - int totalDisplayedDamage = totalDamage / 5; - ApplyDPSDebuff(projectileCount * totalDamage, projectileCount * totalDisplayedDamage, ref npc.lifeRegen, ref damage); - } - - // Snap Clam debuff stacking - if (clamDebuff > 0) - { - int projectileCount = 0; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.ai[0] == 1f && p.ai[1] == npc.whoAmI) - { - if (p.type == ProjectileType()) - projectileCount += 2; - if (p.type == ProjectileType()) - projectileCount++; - } - } - - ApplyDPSDebuff(projectileCount * 15, projectileCount * 3, ref npc.lifeRegen, ref damage); - } - - // Parasitic Scepter debuff stacking - if (irradiated > 0) - { - int projectileCount = 0; - foreach (Projectile p in Main.ActiveProjectiles) - { - if (p.type == ProjectileType() && - p.ai[0] == 1f && p.ai[1] == npc.whoAmI) - { - projectileCount++; - } - } - - if (projectileCount > 0) - ApplyDPSDebuff(projectileCount * 20, projectileCount * 4, ref npc.lifeRegen, ref damage); - else - ApplyDPSDebuff(20, 4, ref npc.lifeRegen, ref damage); - } #endregion // Debuff vulnerabilities and resistances. // Damage multiplier calcs. // Worms that are vulnerable to debuffs and Slime God slimes take reduced damage from vulnerabilities. #region Debuff System Multiplier Calculations - bool wormBoss = DesertScourgeIDList.Includes(npc.type) || EaterOfWorldsIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type) || - AquaticScourgeIDList.Includes(npc.type) || AstrumDeusIDList.Includes(npc.type) || StormWeaverIDList.Includes(npc.type); - bool slimeGod = SlimeGodIDList.Includes(npc.type); + bool wormBoss = CalamityNPCTypeSets.DesertScourge.Contains(npc.type) || CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || CalamityNPCTypeSets.Perforators.Contains(npc.type) || + CalamityNPCTypeSets.AquaticScourge.Contains(npc.type) || CalamityNPCTypeSets.AstrumDeus.Contains(npc.type) || CalamityNPCTypeSets.StormWeaver.Contains(npc.type); + bool slimeGod = CalamityNPCTypeSets.SlimeGod.Contains(npc.type); - bool slimed = npc.drippingSlime || npc.drippingSparkleSlime; - bool wetReducedEffectiveness = npc.wet || npc.honeyWet || npc.dripping; - double heatDamageMult = slimed ? ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; - if (wetReducedEffectiveness) - heatDamageMult *= wormBoss || slimeGod ? 0.66 : ResistantToDoTDamageMult; + + ActiveHeatDebuffMultiplier = HeatDebuffMultiplier; + ActiveColdDebuffMultiplier = ColdDebuffMultiplier; + ActiveSicknessDebuffMultiplier = SicknessDebuffMultiplier; + ActiveElectricDebuffMultiplier = ElectricDebuffMultiplier; + ActiveWaterDebuffMultiplier = WaterDebuffMultiplier; + + if (irradiated) + { + float irradiatedBoost = scionsCurioEffected ? 1.75f : 1f; + ActiveSicknessDebuffMultiplier += irradiatedBoost; + } + + if (npc.drippingSlime || npc.drippingSparkleSlime) + { + ActiveHeatDebuffMultiplier += 1; + } + + if (npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping) + { + ActiveElectricDebuffMultiplier += 1; + } + + if (npc.wet || npc.honeyWet || npc.dripping) + { + ActiveColdDebuffMultiplier += 1; + ActiveHeatDebuffMultiplier -= 0.5f; + } + if (npc.HasBuff(BuffID.Chilled)) //Nothing inflicts this at the moment. Put here so we can start using it. + { + ActiveWaterDebuffMultiplier += 1; + } if (VulnerableToHeat.HasValue) { if (VulnerableToHeat.Value) - heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 1.25 : 1.5) : ((wormBoss || slimeGod) ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); + ActiveHeatDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - heatDamageMult *= slimed ? ((wormBoss || slimeGod) ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; + ActiveHeatDebuffMultiplier *= ResistantToDoTDamageMult; } - double coldDamageMult = BaseDoTDamageMult; if (VulnerableToCold.HasValue) { if (VulnerableToCold.Value) - coldDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; + ActiveColdDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - coldDamageMult *= ResistantToDoTDamageMult; + ActiveColdDebuffMultiplier *= ResistantToDoTDamageMult; } - double sicknessDamageMult = irradiated > 0 ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToSickness.HasValue) { if (VulnerableToSickness.Value) - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); + ActiveSicknessDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - sicknessDamageMult *= irradiated > 0 ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; + ActiveSicknessDebuffMultiplier *= ResistantToDoTDamageMult; } - - bool increasedElectricityDamage = npc.wet || npc.honeyWet || npc.lavaWet || npc.dripping; - double electricityDamageMult = increasedElectricityDamage ? (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult) : BaseDoTDamageMult; if (VulnerableToElectricity.HasValue) { if (VulnerableToElectricity.Value) - electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 1.25 : 1.5) : (wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult); + ActiveElectricDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - electricityDamageMult *= increasedElectricityDamage ? (wormBoss ? 0.66 : ResistantToDoTDamageMult) : ResistantToDoTDamageMult; + ActiveElectricDebuffMultiplier *= ResistantToDoTDamageMult; } - - double waterDamageMult = BaseDoTDamageMult; if (VulnerableToWater.HasValue) { if (VulnerableToWater.Value) - waterDamageMult *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; + ActiveWaterDebuffMultiplier *= wormBoss ? VulnerableToDoTDamageMult_Worms_SlimeGod : VulnerableToDoTDamageMult; else - waterDamageMult *= ResistantToDoTDamageMult; - } - - if (IncreasedColdEffects_EskimoSet) - coldDamageMult += 0.25; - if (IncreasedColdEffects_CryoStone) - coldDamageMult += 0.5; - - if (IncreasedElectricityEffects_Unused) - electricityDamageMult += 0.5; - - if (IncreasedHeatEffects_Fireball) - heatDamageMult += Fireball.HeatDebuffBoost; - if (IncreasedHeatEffects_FireBoots > 0) - heatDamageMult += 0.25 * IncreasedHeatEffects_FireBoots; - if (IncreasedHeatEffects_CinnamonRoll) - heatDamageMult += CinnamonRoll.HeatDebuffBoost; - - if (IncreasedSicknessEffects_ToxicHeart) - sicknessDamageMult += 0.5; - - if (IncreasedWaterEffects_Amulet1) - waterDamageMult += 0.35; - if (IncreasedWaterEffects_Amulet2) - waterDamageMult += 0.75; - - if (IncreasedSicknessAndWaterEffects_CorrosiveSpine) - { - sicknessDamageMult += 0.25; - waterDamageMult += 0.25; - } - if (IncreasedSicknessAndWaterEffects_EvergreenGin) - { - sicknessDamageMult += EvergreenGin.SicknessWaterDebuffBoost; - waterDamageMult += EvergreenGin.SicknessWaterDebuffBoost; - } - - //Amalgam triples all elemental debuff damage. Ironically this excludes Elemental Mix - if (IncreasedDebuffEffects_Amalgam) - { - heatDamageMult += 3.5; - coldDamageMult += 3.5; - waterDamageMult += 3.5; - sicknessDamageMult += 3.5; - electricityDamageMult += 3.5; - } - - // Subtract 1 for the vanilla damage multiplier because it's already dealing DoT in the vanilla regen code. - double vanillaHeatDamageMult = heatDamageMult - BaseDoTDamageMult; - double vanillaColdDamageMult = coldDamageMult - BaseDoTDamageMult; - double vanillaSicknessDamageMult = sicknessDamageMult - BaseDoTDamageMult; - #endregion - - // Oiled - bool hasColdOil = npc.onFrostBurn || npc.onFrostBurn2; - bool hasHotOil = npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; - bool hasModHotOil = bFlames > 0 || demonicFlames > 0 || hFlames > 0 || gsInferno > 0 || dragonFire > 0 || banishingFire > 0 || vulnerabilityHex > 0; - if (npc.oiled && (hasColdOil || hasHotOil || hasModHotOil)) - { - double multiplier = 1D; - if (hasColdOil) - multiplier *= vanillaColdDamageMult; - if (hasHotOil || (hasModHotOil && hasColdOil)) - multiplier *= vanillaHeatDamageMult; - if (hasModHotOil && !hasColdOil && !hasHotOil) - multiplier *= heatDamageMult; - - int baseOiledDoTValue = (int)(50 * multiplier); - npc.lifeRegen -= baseOiledDoTValue; - if (damage < baseOiledDoTValue / 4) - damage = baseOiledDoTValue / 4; - } - - #region Cold Debuffs - // Frostburn - if (npc.onFrostBurn) - { - int baseFrostBurnDoTValue = (int)(16 * vanillaColdDamageMult); - npc.lifeRegen -= baseFrostBurnDoTValue; - if (damage < baseFrostBurnDoTValue / 4) - damage = baseFrostBurnDoTValue / 4; - } - - // Frostbite - if (npc.onFrostBurn2) - { - int baseFrostBiteDoTValue = (int)(50 * vanillaColdDamageMult); - npc.lifeRegen -= baseFrostBiteDoTValue; - if (damage < baseFrostBiteDoTValue / 4) - damage = baseFrostBiteDoTValue / 4; - } - - // Nightwither - if (nightwither > 0) - { - int baseNightwitherDoTValue = (int)(200 * coldDamageMult); - ApplyDPSDebuff(baseNightwitherDoTValue, baseNightwitherDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Voidfrost - if (voidfrost > 0) - { - int baseVoidfrostDoTValue = (int)(300 * coldDamageMult); - ApplyDPSDebuff(baseVoidfrostDoTValue, baseVoidfrostDoTValue / 5, ref npc.lifeRegen, ref damage); + ActiveWaterDebuffMultiplier *= ResistantToDoTDamageMult; } #endregion - #region Electricity Debuffs - // Static Discharge - if (staticDischarge > 0) + + bool hasModHotOil = false; + //Apply DoT Debuffs + for (var index = 0; index < npc.buffType.Count(); index++) { - int baseStaticDischargeDoTValue = (int)(5 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 24 on moving targets - ApplyDPSDebuff(baseStaticDischargeDoTValue, baseStaticDischargeDoTValue / 15, ref npc.lifeRegen, ref damage); + var type = npc.buffType[index]; + var debuffData = BuffDatasets.DebuffDataset[type]; + if (debuffData == null || debuffData == DebuffData.Oiled) //Oiled is done after + continue; + debuffData.NPCLifeRegenMethod(npc, type, ref index,ref damage); + if (debuffData.HeatDebuffScaling > 0) + hasModHotOil = true; } - - // Electrified - if (electrified > 0) + //Oiled comes after so that we can detect if they have a heat debuff in the above loop + bool hasVanillaOil = npc.onFrostBurn || npc.onFrostBurn2 || npc.onFire || npc.onFire2 || npc.onFire3 || npc.shadowFlame; + if (npc.oiled) { - int baseElectrifiedDoTValue = (int)(21 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 84 on moving targets - ApplyDPSDebuff(baseElectrifiedDoTValue, baseElectrifiedDoTValue / 22, ref npc.lifeRegen, ref damage); - } - - // Vermillion Flux - if (vermillionFlux > 0) - { - int baseVermillionFluxDoTValue = (int)(100 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 400 on moving targets - ApplyDPSDebuff(baseVermillionFluxDoTValue, baseVermillionFluxDoTValue / 40, ref npc.lifeRegen, ref damage); - } - - // Auric Rebuke - if (auricRebuke > 0) - { - int baseAuricRebukeDoTValue = (int)(200 * (npc.velocity.X == 0 ? 1 : 4) * electricityDamageMult); // 800 on moving targets - ApplyDPSDebuff(baseAuricRebukeDoTValue, baseAuricRebukeDoTValue / 70, ref npc.lifeRegen, ref damage); - } - #endregion - - #region Heat Debuffs - // On Fire - if (npc.onFire) - { - int baseOnFireDoTValue = (int)(12 * vanillaHeatDamageMult); - npc.lifeRegen -= baseOnFireDoTValue; - if (damage < baseOnFireDoTValue / 4) - damage = baseOnFireDoTValue / 4; - } - - // Hellfire - if (npc.onFire3) - { - int baseHellfireDoTValue = (int)(30 * vanillaHeatDamageMult); - npc.lifeRegen -= baseHellfireDoTValue; - if (damage < baseHellfireDoTValue / 4) - damage = baseHellfireDoTValue / 4; - } - - // Cursed Inferno - if (npc.onFire2) - { - int baseCursedInfernoDoTValue = (int)(48 * vanillaHeatDamageMult); - npc.lifeRegen -= baseCursedInfernoDoTValue; - if (damage < baseCursedInfernoDoTValue / 4) - damage = baseCursedInfernoDoTValue / 4; - } - - // Shadowflame - if (npc.shadowFlame) - { - int baseShadowFlameDoTValue = (int)(60 * vanillaHeatDamageMult); - npc.lifeRegen -= baseShadowFlameDoTValue; - if (damage < baseShadowFlameDoTValue / 4) - damage = baseShadowFlameDoTValue / 4; - } - - // Daybroken - // 18OCT2023: Ozzatron: im not gonna sugarcoat it - // vanilla debuff damage from Daybreak impales scales linearly up to 8 for 800 DPS - // instead of allowing this entire 800 DPS to be multiplied by heat weakness + heat DoT bonuses, - // each Daybreak spear beyond the first is only affected 25% as much by weaknesses or resistances. - // This also stops Daybreak's DPS from being utterly shafted by heat resistance. - // As no other weapon can stack Daybroken, this has no effect on other weapons (they count as "1 Daybreak spear") - if (npc.daybreak) - { - int numImpaledSpears = 0; - for (int k = 0; k < Main.maxProjectiles; k++) - { - if (Main.projectile[k].active && Main.projectile[k].type == ProjectileID.Daybreak && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI) - numImpaledSpears++; - } - - // If there are no Daybreak impaled spears, Daybroken has 1x potency (it was applied some other way) - float daybrokenMultiplier = numImpaledSpears <= 1 ? 1f : (1f + 0.25f * (numImpaledSpears - 1)); - - int baseDaybreakDoTValue = (int)(daybrokenMultiplier * 2 * 100 * vanillaHeatDamageMult); - npc.lifeRegen -= baseDaybreakDoTValue; - if (damage < baseDaybreakDoTValue / 4) - damage = baseDaybreakDoTValue / 4; - } - - // Brimstone Flames - if (bFlames > 0) - { - int baseBrimstoneFlamesDoTValue = (int)(60 * heatDamageMult); - ApplyDPSDebuff(baseBrimstoneFlamesDoTValue, baseBrimstoneFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Demonic Flames - // An unresistable fire debuff that you can set the damage of when it is applied - // This way it can be viable for multiple tiers - if (demonicFlames > 0) - { - int baseDemonicFlamesDoTValue = (int)((demonicFlamesBonusDamage) * Math.Max(heatDamageMult, 1)); - ApplyDPSDebuff(baseDemonicFlamesDoTValue, baseDemonicFlamesDoTValue / 15, ref npc.lifeRegen, ref damage); - } - - // Holy Flames - if (hFlames > 0) - { - int baseHolyFlamesDoTValue = (int)(300 * heatDamageMult); - ApplyDPSDebuff(baseHolyFlamesDoTValue, baseHolyFlamesDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // God Slayer Inferno - if (gsInferno > 0) - { - int baseGodSlayerInfernoDoTValue = (int)(500 * heatDamageMult); - ApplyDPSDebuff(baseGodSlayerInfernoDoTValue, baseGodSlayerInfernoDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Dragonfire - if (dragonFire > 0) - { - int baseDragonFireDoTValue = (int)(960 * heatDamageMult); - ApplyDPSDebuff(baseDragonFireDoTValue, baseDragonFireDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Vulnerability Hex - if (vulnerabilityHex > 0) - { - int baseVulnerabilityHexDoTValue = (int)(VulnerabilityHex.DPS * heatDamageMult); - ApplyDPSDebuff(baseVulnerabilityHexDoTValue, VulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); - } - - // True Vulnerability Hex - if (trueVulnerabilityHex > 0) - { - int baseTrueVHexDoTValue = (int)(TrueVulnerabilityHex.DPS * heatDamageMult); - ApplyDPSDebuff(baseTrueVHexDoTValue, TrueVulnerabilityHex.TickNumber, ref npc.lifeRegen, ref damage); - } - - // Banishing Fire - if (banishingFire > 0) - { - int baseBanishingFireDoTValue = (int)((npc.lifeMax >= 1000000 ? npc.lifeMax / 500 : 4000) * heatDamageMult); - ApplyDPSDebuff(baseBanishingFireDoTValue, baseBanishingFireDoTValue / 5, ref npc.lifeRegen, ref damage); - } - #endregion - - #region Sickness Debuffs - // Poisoned - if (npc.poisoned) - { - int basePoisonedDoTValue = (int)(12 * vanillaSicknessDamageMult); - npc.lifeRegen -= basePoisonedDoTValue; - if (damage < basePoisonedDoTValue / 4) - damage = basePoisonedDoTValue / 4; - } - - // Venom - if (npc.venom) - { - int baseVenomDoTValue = (int)(60 * vanillaSicknessDamageMult); - npc.lifeRegen -= baseVenomDoTValue; - if (damage < baseVenomDoTValue / 4) - damage = baseVenomDoTValue / 4; - } - - // Burning Blood - if (bBlood > 0) - { - int baseBurningBloodDoTValue = (int)(40 * sicknessDamageMult); - ApplyDPSDebuff(baseBurningBloodDoTValue, baseBurningBloodDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Brain Rot - if (brainRot > 0) - { - int baseBrainRotDoTValue = (int)(40 * sicknessDamageMult); - ApplyDPSDebuff(baseBrainRotDoTValue, baseBrainRotDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Sage Poison - if (sagePoisonTime > 0) - { - // npc.Calamity().sagePoisonDamage = 50 * (float)(Math.Pow(totalSageSpirits, 0.73D) + Math.Pow(totalSageSpirits, 1.1D)) * 0.5f - // See SageNeedle.cs for details - int baseSagePoisonDoTValue = (int)(npc.Calamity().sagePoisonDamage * sicknessDamageMult); - ApplyDPSDebuff(baseSagePoisonDoTValue, baseSagePoisonDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Astral Infection - if (astralInfection > 0) - { - int baseAstralInfectionDoTValue = (int)(75 * sicknessDamageMult); - ApplyDPSDebuff(baseAstralInfectionDoTValue, baseAstralInfectionDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Plague - if (pFlames > 0) - { - int basePlagueDoTValue = (int)(100 * sicknessDamageMult); - ApplyDPSDebuff(basePlagueDoTValue, basePlagueDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Sulphuric Poisoning - if (sulphurPoison > 0) - { - int baseSulphurPoisonDoTValue = (int)(240 * sicknessDamageMult); - ApplyDPSDebuff(baseSulphurPoisonDoTValue, baseSulphurPoisonDoTValue / 5, ref npc.lifeRegen, ref damage); - } - - // Kami Debuff from Yanmei's Knife - if (kamiFlu > 0) - { - int baseKamiFluDoTValue = (int)(YanmeisKnife.DebuffDoT * sicknessDamageMult); - ApplyDPSDebuff(baseKamiFluDoTValue, baseKamiFluDoTValue / 10, ref npc.lifeRegen, ref damage); - } - - //Absorber Affliction - if (absorberAffliction > 0) - { - int baseAbsorberDoTValue = (int)(400 * sicknessDamageMult); - ApplyDPSDebuff(baseAbsorberDoTValue, baseAbsorberDoTValue / 65, ref npc.lifeRegen, ref damage); - } - #endregion - - #region Water Debuffs - // Riptide - if (rTide > 0) - { - int baseRiptideDoTValue = (int)(30 * waterDamageMult); - ApplyDPSDebuff(baseRiptideDoTValue, baseRiptideDoTValue / 3, ref npc.lifeRegen, ref damage); - } - - // Crush Depth - if (cDepth > 0) - { - int baseCrushDepthDoTValue = (int)(100 * waterDamageMult); - ApplyDPSDebuff(baseCrushDepthDoTValue, baseCrushDepthDoTValue / 2, ref npc.lifeRegen, ref damage); - } - - //Hadopelagic Pressure - if (hPressure > 0) - { - int baseHadopelagicPressureDoTValue = (int)(400 * waterDamageMult); - ApplyDPSDebuff(baseHadopelagicPressureDoTValue, baseHadopelagicPressureDoTValue / 2, ref npc.lifeRegen, ref damage); - } - #endregion - - if (npc.dryadBane) - { - // Buffs match 1:1 with Town NPC buffs - // See CalamityGlobalTownNPC: BuffTownNPC - float buffedDryadsBaneMult = 0f + - (NPC.downedMoonlord ? 0.6f : 0f) + - (DownedBossSystem.downedProvidence ? 0.2f : 0f) + - (DownedBossSystem.downedPolterghast ? 0.2f : 0f) + - (DownedBossSystem.downedDoG ? 0.2f : 0f) + - (DownedBossSystem.downedYharon ? 0.2f : 0f) + - (DownedBossSystem.downedExoMechs ? 0.6f : 0f) + - (DownedBossSystem.downedCalamitas ? 0.6f : 0f); - if (Main.expertMode) - buffedDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; - int buffedDryadsBaneDoTValue = 2 * (int)(4 * buffedDryadsBaneMult); - npc.lifeRegen -= buffedDryadsBaneDoTValue; - - // Scales damage tick if greater than the vanilla amount - float vanillaDryadsBaneMult = 1f + - (NPC.downedBoss1 ? 0.1f : 0f) + - (NPC.downedBoss2 ? 0.1f : 0f) + - (NPC.downedBoss3 ? 0.1f : 0f) + - (NPC.downedQueenBee ? 0.1f : 0f) + - (Main.hardMode ? 0.4f : 0f) + - (NPC.downedMechBoss1 ? 0.15f : 0f) + - (NPC.downedMechBoss1 ? 0.15f : 0f) + - (NPC.downedMechBoss1 ? 0.15f : 0f) + - (NPC.downedPlantBoss ? 0.15f : 0f) + - (NPC.downedGolemBoss ? 0.15f : 0f) + - (NPC.downedAncientCultist ? 0.15f : 0f); - if (Main.expertMode) - vanillaDryadsBaneMult *= Main.GameModeInfo.TownNPCDamageMultiplier; - int totalDryadsBaneDoTValue = 2 * (int)(4 * vanillaDryadsBaneMult) + buffedDryadsBaneDoTValue; - if (damage < totalDryadsBaneDoTValue / 6) - damage = totalDryadsBaneDoTValue / 6; + var oil = DebuffData.Oiled; + int index = npc.FindBuffIndex(BuffID.Oiled); + if (hasVanillaOil) + npc.lifeRegen -= oil.EnemyVanillaRegenToCancelOut; + oil.NPCLifeRegenMethod(npc, BuffID.Oiled, ref index, ref damage); } // Debuffs that aren't affected by weaknesses or resistances. - if (vaporfied > 0) - ApplyDPSDebuff(30, 6, ref npc.lifeRegen, ref damage); if (somaShredStacks > 0) Shred.TickDebuff(npc, this); - if (heavybleeding > 0) - ApplyDPSDebuff(80, 10, ref npc.lifeRegen, ref damage); - if (laceration > 0) - ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); - if (elementalMix > 0) - ApplyDPSDebuff(400, 100, ref npc.lifeRegen, ref damage); - if (miracleBlight > 0) - ApplyDPSDebuff(3000, 500, ref npc.lifeRegen, ref damage); // Reduce DoT on worm bosses and Creepers by 75%. if ((wormBoss || npc.type == NPCID.Creeper) && npc.lifeRegen < 0) @@ -1386,6 +1036,30 @@ namespace CalamityMod.NPCs if (((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && (CalamityWorld.death || BossRushEvent.BossRushActive)) npc.lifeRegen = 0; } + + // Mana Burn + //This is at the end to leave it full effect on worms, and to force the DOT numbers to match mana burn + if (manaBurn > 0) + { + if (manaBurnPeak >= 0.1f) + { + manaBurnPeak *= 0.999f; + } + manaBurnPeak = Math.Max(manaBurnPeak, manaBurn); + int burnPerSecond = (int)MathF.Ceiling(manaBurn * 0.5f); + manaBurn -= burnPerSecond / 60f; + + if (npc.lifeRegen > 0) + npc.lifeRegen = 0; + + npc.lifeRegen -= burnPerSecond * 2; + damage += (int)(burnPerSecond * 0.5f); + } + else + { + manaBurnPeak = 0; + playerManaBurnIntensity = 0; + } } public void ApplyDPSDebuff(int lifeRegenValue, int damageValue, ref int lifeRegen, ref int damage) @@ -1405,116 +1079,29 @@ namespace CalamityMod.NPCs { #region Setup Vanilla DR Values DRValues = new SortedDictionary { - { NPCID.AngryBonesBig, 0.2f }, - { NPCID.AngryBonesBigHelmet, 0.2f }, - { NPCID.AngryBonesBigMuscle, 0.2f }, - { NPCID.AnomuraFungus, 0.1f }, - { NPCID.Antlion, 0.1f }, - { NPCID.Arapaima, 0.1f }, - { NPCID.ArmoredSkeleton, 0.15f }, - { NPCID.ArmoredViking, 0.1f }, - { NPCID.BigMimicCorruption, 0.3f }, - { NPCID.BigMimicCrimson, 0.3f }, - { NPCID.BigMimicHallow, 0.3f }, - { NPCID.BigMimicJungle, 0.3f }, - { NPCID.BlueArmoredBones, 0.2f }, - { NPCID.BlueArmoredBonesMace, 0.2f }, - { NPCID.BlueArmoredBonesNoPants, 0.2f }, - { NPCID.BlueArmoredBonesSword, 0.2f }, - { NPCID.BoneLee, 0.2f }, - { NPCID.Crab, 0.05f }, - { NPCID.Crawdad, 0.2f }, - { NPCID.Crawdad2, 0.2f }, { NPCID.CultistBoss, 0.15f }, - { NPCID.Deerclops, 0.05f }, - { NPCID.DD2Betsy, 0.1f }, - { NPCID.DD2OgreT2, 0.1f }, - { NPCID.DD2OgreT3, 0.15f }, - { NPCID.DeadlySphere, 0.4f }, - { NPCID.DiabolistRed, 0.2f }, - { NPCID.DiabolistWhite, 0.2f }, { NPCID.DukeFishron, 0.15f }, { NPCID.DungeonGuardian, 0.9f }, - { NPCID.DungeonSpirit, 0.2f }, - { NPCID.ElfCopter, 0.15f }, - { NPCID.Everscream, 0.1f }, - { NPCID.FlyingAntlion, 0.05f }, - { NPCID.GiantCursedSkull, 0.2f }, - { NPCID.GiantShelly, 0.2f }, - { NPCID.GiantShelly2, 0.2f }, - { NPCID.GiantTortoise, 0.35f }, - { NPCID.Golem, 0.25f }, - { NPCID.GolemFistLeft, 0.25f }, - { NPCID.GolemFistRight, 0.25f }, - { NPCID.GolemHead, 0.25f }, - { NPCID.GolemHeadFree, 0.25f }, - { NPCID.GraniteFlyer, 0.1f }, - { NPCID.GraniteGolem, 0.15f }, - { NPCID.GreekSkeleton, 0.1f }, - { NPCID.HellArmoredBones, 0.2f }, - { NPCID.HellArmoredBonesMace, 0.2f }, - { NPCID.HellArmoredBonesSpikeShield, 0.2f }, - { NPCID.HellArmoredBonesSword, 0.2f }, - { NPCID.IceGolem, 0.1f }, - { NPCID.IceQueen, 0.1f }, - { NPCID.IceTortoise, 0.35f }, - { NPCID.HeadlessHorseman, 0.05f }, - { NPCID.MartianDrone, 0.2f }, - { NPCID.MartianSaucer, 0.2f }, - { NPCID.MartianSaucerCannon, 0.2f }, - { NPCID.MartianSaucerCore, 0.2f }, - { NPCID.MartianSaucerTurret, 0.2f }, - { NPCID.MartianTurret, 0.2f }, - { NPCID.MartianWalker, 0.35f }, - { NPCID.Mimic, 0.3f }, + { NPCID.Golem, 0.15f }, + { NPCID.GolemFistLeft, 0.15f }, + { NPCID.GolemFistRight, 0.15f }, + { NPCID.GolemHead, 0.15f }, { NPCID.MoonLordCore, 0.15f }, { NPCID.MoonLordHand, 0.15f }, { NPCID.MoonLordHead, 0.15f }, - { NPCID.Mothron, 0.2f }, - { NPCID.MothronEgg, 0.5f }, - { NPCID.MourningWood, 0.1f }, - { NPCID.Necromancer, 0.2f }, - { NPCID.NecromancerArmored, 0.2f }, - { NPCID.Paladin, 0.45f }, - { NPCID.PirateCaptain, 0.05f }, - { NPCID.PirateShipCannon, 0.15f }, { NPCID.Plantera, 0.15f }, - { NPCID.PlanterasTentacle, 0.1f }, { NPCID.HallowBoss, 0.15f }, - { NPCID.PossessedArmor, 0.25f }, - { NPCID.PresentMimic, 0.3f }, { NPCID.PrimeCannon, 0.2f }, { NPCID.PrimeLaser, 0.2f }, { NPCID.PrimeSaw, 0.2f }, { NPCID.PrimeVice, 0.2f }, - { NPCID.Probe, 0.2f }, - { NPCID.Pumpking, 0.1f }, - { NPCID.QueenBee, 0.05f }, - { NPCID.RaggedCaster, 0.2f }, - { NPCID.RaggedCasterOpenCoat, 0.2f }, { NPCID.Retinazer, 0.2f }, - { NPCID.RustyArmoredBonesAxe, 0.2f }, - { NPCID.RustyArmoredBonesFlail, 0.2f }, - { NPCID.RustyArmoredBonesSword, 0.2f }, - { NPCID.RustyArmoredBonesSwordNoArmor, 0.2f }, - { NPCID.SandElemental, 0.1f }, - { NPCID.SantaNK1, 0.35f }, - { NPCID.SeaSnail, 0.05f }, - { NPCID.SkeletonArcher, 0.1f }, - { NPCID.SkeletonCommando, 0.2f }, - { NPCID.SkeletonSniper, 0.2f }, - { NPCID.SkeletronHand, 0.05f }, - { NPCID.SkeletronHead, 0.05f }, { NPCID.SkeletronPrime, 0.2f }, { NPCID.Spazmatism, 0.2f }, - { NPCID.TacticalSkeleton, 0.2f }, { NPCID.TheDestroyer, 0.1f }, { NPCID.TheDestroyerBody, 0.2f }, { NPCID.TheDestroyerTail, 0.35f }, - { NPCID.TheHungry, 0.1f }, - { NPCID.UndeadViking, 0.1f }, - { NPCID.WalkingAntlion, 0.1f }, - { NPCID.WallofFlesh, 0.5f }, + { NPCID.WallofFlesh, 0.15f }, }; #endregion @@ -1551,7 +1138,7 @@ namespace CalamityMod.NPCs { NPCID.Creeper, 1800 }, // 0:30 (30 seconds, length of Creepers phase) { NPCID.Deerclops, 5400 }, // 1:30 (90 seconds) { NPCID.QueenBee, 7200 }, // 2:00 (120 seconds) - { NPCID.SkeletronHead, 9000 }, // 2:30 (150 seconds) + { NPCID.SkeletronHead, 7200 }, // 2:00 (120 seconds) { NPCID.WallofFlesh, 7200 }, // 2:00 (120 seconds) { NPCID.WallofFleshEye, 7200 }, { NPCID.QueenSlimeBoss, 7200 }, // 2:00 (120 seconds) @@ -1562,10 +1149,10 @@ namespace CalamityMod.NPCs { NPCID.TheDestroyerTail, 10800 }, { NPCID.SkeletronPrime, 10800 }, // 3:00 (180 seconds) { NPCID.Plantera, 10800 }, // 3:00 (180 seconds) - { NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds) { NPCID.Golem, 9000 }, // 2:30 (150 seconds) { NPCID.GolemHead, 3600 }, // 1:00 (60 seconds) { NPCID.DukeFishron, 9000 }, // 2:30 (150 seconds) + { NPCID.HallowBoss, 10800 }, // 3:00 (180 seconds) { NPCID.CultistBoss, 9000 }, // 2:30 (150 seconds) { NPCID.MoonLordCore, 14400 }, // 4:00 (240 seconds) { NPCID.MoonLordHand, 7200 }, // 2:00 (120 seconds) @@ -1591,7 +1178,7 @@ namespace CalamityMod.NPCs { NPCType(), 9000 }, { NPCType(), 9000 }, { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 14400 }, // 4:00 (240 seconds) + { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 10800 }, { NPCType(), 10800 }, // 3:00 (180 seconds) @@ -1600,8 +1187,8 @@ namespace CalamityMod.NPCs { NPCType(), 7200 }, { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 10800 }, // 3:00 (180 seconds) - { NPCType(), 5400 }, // 1:30 (90 seconds) - { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) + { NPCType(), 7200 }, // 2:00 (120 seconds) { NPCType(), 14400 }, // 4:00 (240 seconds) { NPCType(), 10800 }, // 3:00 (180 seconds) { NPCType(), 1200 }, // 0:20 (20 seconds) @@ -1614,7 +1201,7 @@ namespace CalamityMod.NPCs { NPCType(), 14400 }, // 4:00 (240 seconds) { NPCType(), 14400 }, // DoG Phase 1 is 1:30, DoG Phase 2 is 2:30 { NPCType(), 14400 }, - { NPCType(), 14700 }, // 4:05 (245 seconds) -- he spends 5 seconds invincible where you can't do anything + { NPCType(), 14400 }, // 4:00 (240 seconds) { NPCType(), 21600 }, // 6:00 (360 seconds) { NPCType(), 21600 }, { NPCType(), 21600 }, // 6:00 (360 seconds) @@ -1642,8 +1229,6 @@ namespace CalamityMod.NPCs public override void SetDefaults(NPC npc) { - ShouldFallThroughPlatforms = false; - for (int i = 0; i < maxPlayerImmunities; i++) dashImmunityTime[i] = 0; @@ -1659,7 +1244,7 @@ namespace CalamityMod.NPCs } // Aquatic Scourge sets kill time in AI, not here. - if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !AquaticScourgeIDList.Includes(npc.type)) + if (BossKillTimes.TryGetValue(npc.type, out int revKillTime) && !CalamityNPCTypeSets.AquaticScourge.Contains(npc.type)) { KillTime = revKillTime; } @@ -1679,13 +1264,15 @@ namespace CalamityMod.NPCs if (BossRushEvent.BossRushActive) BossRushStatChanges(npc, Mod); - BossValueChanges(npc); - if (CalamityWorld.revenge) RevDeathStatChanges(npc, Mod); OtherStatChanges(npc); + // Change Queen Slime's fart sound on death to something more serious. Except GFB though because naturally + if (npc.type == NPCID.QueenSlimeBoss) + npc.DeathSound = Main.zenithWorld ? new SoundStyle("CalamityMod/Sounds/Item/GFBScreams/Scream", 8) : SoundID.NPCDeath1; + // Function lives in NPCDebuffs.cs // This applies to ALL NPCs, vanilla AND Calamity. // Calamity NPC debuff immunity definitions live here. @@ -1700,6 +1287,14 @@ namespace CalamityMod.NPCs BoundNPCSafety(Mod, npc); } + + public override bool? CanFallThroughPlatforms(NPC npc) + { + // Allow the free Golem Head to pass through platforms in Rev+ + if (npc.type == NPCID.GolemHeadFree && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) + return true; + return base.CanFallThroughPlatforms(npc); + } #endregion #region Boss Health UI Variable Setting @@ -1741,16 +1336,16 @@ namespace CalamityMod.NPCs break; case NPCID.Golem: - npc.lifeMax = 30000; + npc.lifeMax = 40000; break; case NPCID.GolemHead: - npc.lifeMax = 20000; + npc.lifeMax = 26500; break; case NPCID.GolemFistRight: case NPCID.GolemFistLeft: - npc.lifeMax = 7000; + npc.lifeMax = 7500; break; case NPCID.HallowBoss: @@ -1758,7 +1353,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - npc.lifeMax = 80000; + npc.lifeMax = 72000; break; case NPCID.PlanterasTentacle: @@ -1806,30 +1401,19 @@ namespace CalamityMod.NPCs #region Boss Rush Stat Changes private void BossRushStatChanges(NPC npc, Mod mod) { - if (BossRushHPChangeDict.TryGet(npc.type, out var newHP)) + if (CalamityNPCSets.BossRushHealth.TryGetValue(npc.type, out var newHP)) { npc.lifeMax = newHP; } } #endregion - #region Boss Value Changes - private void BossValueChanges(NPC npc) - { - if (BossValueDict.TryGet(npc.type, out var value)) - { - npc.value = value; - } - } - #endregion - #region Revengeance and Death Mode Stat Changes private void RevDeathStatChanges(NPC npc, Mod mod) { - if (DeathModeSplittingWormList.Includes(npc.type)) + if (CalamityNPCSets.DeathModeSplittingWorm[npc.type] && CalamityWorld.death) { - if (CalamityWorld.death) - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.15); } if (npc.type == NPCID.Mothron) @@ -1859,16 +1443,18 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); } - else if (npc.type == NPCID.Golem || npc.type == NPCID.GolemHead) + else if (npc.type == NPCID.Golem) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5); - - if (npc.type == NPCID.Golem) - npc.npcSlots = 64f; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); + npc.npcSlots = 64f; } - else if (npc.type == NPCID.GolemHeadFree) + else if (npc.type == NPCID.GolemHead) { - npc.dontTakeDamage = false; + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); + } + else if (npc.type == NPCID.GolemFistLeft || npc.type == NPCID.GolemFistRight) + { + npc.scale *= 1.15f; } else if (npc.type == NPCID.HallowBoss) { @@ -1880,10 +1466,10 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 32f; } - else if (DestroyerIDList.Includes(npc.type)) + else if (CalamityNPCTypeSets.Destroyer.Contains(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.25); - npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; + npc.scale *= Main.zenithWorld ? 2f : 1.2f; npc.npcSlots = 10f; } else if (npc.type == NPCID.Probe) @@ -1891,19 +1477,19 @@ namespace CalamityMod.NPCs if (CalamityWorld.death) npc.lifeMax = (int)Math.Round(npc.lifeMax * 2D); - npc.scale *= Main.zenithWorld ? 2f : CalamityWorld.death ? 1.4f : 1.2f; + npc.scale *= Main.zenithWorld ? 2f : 1.2f; } - else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) + else if (npc.type == NPCID.SkeletronPrime) { - // HP boosted in Master Mode due to having two heads (piercing can make them die faster than normal here since they share an HP bar) - npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.masterMode ? 1.7 : 1.2)); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 12f; } else if (npc.type <= NPCID.PrimeLaser && npc.type >= NPCID.PrimeCannon) { - npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.55); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.65); + npc.scale = 1.15f; } - else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism || npc.type == NPCType()) + else if (npc.type == NPCID.Retinazer || npc.type == NPCID.Spazmatism) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); npc.npcSlots = 10f; @@ -1961,7 +1547,7 @@ namespace CalamityMod.NPCs { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.4); } - else if (EaterOfWorldsIDList.Includes(npc.type)) + else if (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type)) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.2); @@ -1987,9 +1573,9 @@ namespace CalamityMod.NPCs else npc.scale = Main.getGoodWorld ? 3f : 1.5f; - npc.lifeMax = (int)Math.Round(npc.lifeMax * (Main.getGoodWorld ? 1.8 : 1.5)); + npc.lifeMax = (int)Math.Round(npc.lifeMax * 1.5); } - else if ((npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental || npc.type == NPCID.Ghost) && CalamityWorld.LegendaryMode) + else if ((npc.type == NPCID.Wraith || npc.type == NPCID.Mimic || npc.type == NPCID.Reaper || npc.type == NPCID.PresentMimic || npc.type == NPCID.SandElemental || npc.type == NPCID.Ghost) && Main.getGoodWorld) { npc.knockBackResist = 0f; } @@ -1999,8 +1585,8 @@ namespace CalamityMod.NPCs #region Vulnerabilities and Resistances private void VulnerabilitiesAndResistances(NPC npc) { - // These enemies are categorized in such a way to make them easy to understand. - // Do not mess with these categories unless you ask me for permission - Fab. + // These enemies are categorized in such a way to make them easy to understand + // Regroup these if necessary, reminder to keep it comprehensive switch (npc.type) { // Regular organic desert enemies. @@ -2057,7 +1643,6 @@ namespace CalamityMod.NPCs // Organic undead or other enemies that are covered in slime. case NPCID.ArmedZombieSlimed: case NPCID.BigSlimedZombie: - case NPCID.BunnySlimed: case NPCID.SlimedZombie: case NPCID.SmallSlimedZombie: VulnerableToCold = true; @@ -2697,6 +2282,204 @@ namespace CalamityMod.NPCs VulnerableToHeat = true; VulnerableToSickness = false; break; + + // Town NPCs. Mostly irrelevant, but it displays in the Bestiary + case NPCID.Merchant: + case NPCID.Nurse: + case NPCID.ArmsDealer: + case NPCID.Dryad: + case NPCID.Guide: + case NPCID.OldMan: + case NPCID.Demolitionist: + case NPCID.Clothier: + case NPCID.BoundGoblin: + case NPCID.BoundWizard: + case NPCID.GoblinTinkerer: + case NPCID.Wizard: + case NPCID.BoundMechanic: + case NPCID.Mechanic: + case NPCID.Truffle: + case NPCID.Steampunker: + case NPCID.DyeTrader: + case NPCID.PartyGirl: + case NPCID.Painter: + case NPCID.WitchDoctor: + case NPCID.Pirate: + case NPCID.Stylist: + case NPCID.WebbedStylist: + case NPCID.TravellingMerchant: + case NPCID.Angler: + case NPCID.SleepingAngler: + case NPCID.DD2Bartender: + case NPCID.BartenderUnconscious: + case NPCID.Golfer: + case NPCID.GolferRescue: + case NPCID.BestiaryGirl: + case NPCID.Princess: + case NPCID.TownCat: + case NPCID.TownDog: + case NPCID.TownBunny: + VulnerableToCold = true; + VulnerableToHeat = true; + VulnerableToSickness = true; + break; + case NPCID.SantaClaus: + VulnerableToCold = false; + VulnerableToHeat = true; + VulnerableToSickness = true; + break; + case NPCID.TaxCollector: + VulnerableToCold = true; + VulnerableToHeat = false; + VulnerableToSickness = true; + break; + // Non-organic Town NPCs. + case NPCID.Cyborg: + case NPCID.BoundTownSlimeOld: + VulnerableToSickness = false; + break; + // Town Slimes. + case NPCID.TownSlimeBlue: + case NPCID.TownSlimeGreen: + case NPCID.TownSlimeOld: + case NPCID.TownSlimePurple: + case NPCID.TownSlimeRainbow: + case NPCID.TownSlimeRed: + case NPCID.TownSlimeYellow: + case NPCID.TownSlimeCopper: + case NPCID.BoundTownSlimePurple: + VulnerableToSickness = false; + VulnerableToHeat = true; + break; + + // Critters + case NPCID.Bunny: + case NPCID.Bird: + case NPCID.BirdBlue: + case NPCID.BirdRed: + case NPCID.Squirrel: + case NPCID.Mouse: + case NPCID.BunnySlimed: + case NPCID.BunnyXmas: + case NPCID.Firefly: + case NPCID.Butterfly: + case NPCID.Worm: + case NPCID.LightningBug: + case NPCID.Snail: + case NPCID.GlowingSnail: + case NPCID.Frog: + case NPCID.Duck: + case NPCID.Duck2: + case NPCID.DuckWhite: + case NPCID.DuckWhite2: + case NPCID.ScorpionBlack: + case NPCID.Scorpion: + case NPCID.TruffleWorm: + case NPCID.TruffleWormDigger: + case NPCID.Grasshopper: + case NPCID.GoldBird: + case NPCID.GoldBunny: + case NPCID.GoldButterfly: + case NPCID.GoldFrog: + case NPCID.GoldGrasshopper: + case NPCID.GoldMouse: + case NPCID.GoldWorm: + case NPCID.EnchantedNightcrawler: + case NPCID.Grubby: + case NPCID.Sluggy: + case NPCID.Buggy: + case NPCID.SquirrelRed: + case NPCID.SquirrelGold: + case NPCID.PartyBunny: + case NPCID.BlackDragonfly: + case NPCID.BlueDragonfly: + case NPCID.GreenDragonfly: + case NPCID.OrangeDragonfly: + case NPCID.RedDragonfly: + case NPCID.YellowDragonfly: + case NPCID.GoldDragonfly: + case NPCID.Seagull: + case NPCID.Seagull2: + case NPCID.LadyBug: + case NPCID.GoldLadyBug: + case NPCID.Maggot: + case NPCID.Grebe: + case NPCID.Grebe2: + case NPCID.Rat: + case NPCID.Owl: + case NPCID.WaterStrider: + case NPCID.GoldWaterStrider: + case NPCID.ExplosiveBunny: + case NPCID.EmpressButterfly: + case NPCID.Stinkbug: + case NPCID.ScarletMacaw: + case NPCID.BlueMacaw: + case NPCID.Toucan: + case NPCID.YellowCockatiel: + case NPCID.GrayCockatiel: + case NPCID.Shimmerfly: + case NPCID.BoundTownSlimeYellow: + VulnerableToCold = true; + VulnerableToHeat = true; + VulnerableToSickness = true; + break; + // Water Critters + case NPCID.Goldfish: + case NPCID.GoldfishWalker: + case NPCID.GoldGoldfish: + case NPCID.GoldGoldfishWalker: + case NPCID.Pupfish: + case NPCID.Dolphin: + case NPCID.Turtle: + case NPCID.TurtleJungle: + case NPCID.SeaTurtle: + case NPCID.Seahorse: + case NPCID.GoldSeahorse: + VulnerableToHeat = false; + VulnerableToSickness = true; + VulnerableToElectricity = true; + VulnerableToWater = false; + break; + // Penguins + case NPCID.Penguin: + case NPCID.PenguinBlack: + VulnerableToCold = false; + VulnerableToHeat = true; + VulnerableToSickness = true; + break; + // Fairies + case NPCID.FairyCritterPink: + case NPCID.FairyCritterGreen: + case NPCID.FairyCritterBlue: + VulnerableToSickness = false; + break; + // Gem Critters + case NPCID.GemSquirrelAmethyst: + case NPCID.GemSquirrelTopaz: + case NPCID.GemSquirrelSapphire: + case NPCID.GemSquirrelEmerald: + case NPCID.GemSquirrelRuby: + case NPCID.GemSquirrelDiamond: + case NPCID.GemSquirrelAmber: + case NPCID.GemBunnyAmethyst: + case NPCID.GemBunnyTopaz: + case NPCID.GemBunnySapphire: + case NPCID.GemBunnyEmerald: + case NPCID.GemBunnyDiamond: + case NPCID.GemBunnyAmber: + VulnerableToCold = true; + VulnerableToSickness = true; + VulnerableToWater = true; + break; + // Underworld Critters + case NPCID.HellButterfly: + case NPCID.Lavafly: + case NPCID.MagmaSnail: + VulnerableToCold = true; + VulnerableToHeat = false; + VulnerableToSickness = true; + VulnerableToWater = true; + break; } } #endregion @@ -2706,14 +2489,7 @@ namespace CalamityMod.NPCs { EditGlobalCoinDrops(npc); - // Put this first so that any boss damage value modifications aren't reset - bool vanillaNPC = npc.type < NPCID.Count; - if (vanillaNPC && NPCStats.EnemyStats.ContactDamageValues.ContainsKey(npc.type)) - { - npc.GetNPCDamage(); - npc.defDamage = npc.damage; - } - if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || BossHPScalingList.Includes(npc.type)) + if ((npc.boss && npc.type != NPCID.MartianSaucerCore) || CalamityNPCSets.ScalesHealthLikeBoss[npc.type]) { double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; npc.lifeMax += (int)Math.Round(npc.lifeMax * HPBoost); @@ -2725,43 +2501,14 @@ namespace CalamityMod.NPCs case NPCID.EyeofCthulhu: case NPCID.BrainofCthulhu: case NPCID.QueenBee: - case NPCID.Crawdad: - case NPCID.Crawdad2: - case NPCID.ManEater: - case NPCID.AngryTrapper: - case NPCID.Snatcher: - case NPCID.SpikeBall: - case NPCID.DesertBeast: - case NPCID.BoneLee: case NPCID.Paladin: case NPCID.BigMimicCorruption: case NPCID.BigMimicCrimson: case NPCID.BigMimicHallow: - case NPCID.DiggerHead: - case NPCID.SeekerHead: - case NPCID.DuneSplicerHead: - case NPCID.SolarCrawltipedeHead: - case NPCID.Mimic: - case NPCID.SandShark: - case NPCID.SandsharkCorrupt: - case NPCID.SandsharkCrimson: - case NPCID.SandsharkHallow: - case NPCID.Butcher: - case NPCID.DeadlySphere: case NPCID.Mothron: - case NPCID.Reaper: - case NPCID.Psycho: - case NPCID.PresentMimic: - case NPCID.Yeti: - case NPCID.NebulaBeast: - case NPCID.SolarCorite: - case NPCID.StardustWormHead: case NPCID.EaterofWorldsHead: case NPCID.SkeletronHead: - case NPCID.SkeletronHand: case NPCID.WallofFlesh: - case NPCID.TheHungry: - case NPCID.TheHungryII: case NPCID.Spazmatism: case NPCID.Retinazer: case NPCID.TheDestroyer: @@ -2776,36 +2523,19 @@ namespace CalamityMod.NPCs case NPCID.GolemFistLeft: case NPCID.GolemFistRight: case NPCID.CultistDragonHead: - case NPCID.AncientCultistSquidhead: - case NPCID.AncientLight: case NPCID.DD2OgreT2: case NPCID.DD2OgreT3: case NPCID.DD2Betsy: case NPCID.PumpkingBlade: case NPCID.SantaNK1: case NPCID.DukeFishron: - case NPCID.RockGolem: - case NPCID.BloodEelHead: case NPCID.BloodNautilus: - case NPCID.GoblinShark: - case NPCID.ZombieMerman: case NPCID.HallowBoss: case NPCID.QueenSlimeBoss: case NPCID.Deerclops: canBreakPlayerDefense = true; break; - // Enemies that should have coldDamage set to true - case NPCID.IceMimic: - canBreakPlayerDefense = true; - npc.coldDamage = true; - break; - - case NPCID.IceBat: - case NPCID.IceTortoise: - npc.coldDamage = true; - break; - // These go through walls and are very annoying with the new tombstone breaking spawning them mechanic in 1.4 case NPCID.Ghost: npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); @@ -2819,11 +2549,6 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.25); break; - case NPCID.ChatteringTeethBomb: - npc.damage = 100; - canBreakPlayerDefense = true; - break; - case NPCID.LarvaeAntlion: npc.lifeMax = 15; break; @@ -2859,8 +2584,6 @@ namespace CalamityMod.NPCs npc.lifeMax = (int)Math.Round(npc.lifeMax * 0.5); npc.damage = (int)Math.Round(npc.damage * DesertEnemyStatMultiplier); npc.defDamage = npc.damage; - // Tomb Crawler Head has 0 defense so there is no need to reduce it - canBreakPlayerDefense = true; break; case NPCID.TombCrawlerBody: @@ -2877,7 +2600,6 @@ namespace CalamityMod.NPCs case NPCID.Sharkron2: npc.width = npc.height = 36; npc.chaseable = false; - canBreakPlayerDefense = true; break; // Fix drawing issues with Golem's Free Head @@ -2906,9 +2628,10 @@ namespace CalamityMod.NPCs npc.dontTakeDamage = true; break; - // Make Fishron and Anahita Bubbles immune to damage in Death Mode + // Make Fishron and Anahita Bubbles have actual health in Death Mode case NPCID.DetonatingBubble: - npc.dontTakeDamage = CalamityWorld.death; + if (CalamityWorld.death) + npc.lifeMax = 300; break; default: @@ -2920,7 +2643,7 @@ namespace CalamityMod.NPCs { if (!NPC.downedMechBossAny) { - if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) || npc.type == NPCID.Probe || CalamityNPCTypeSets.SkeletronPrime.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2930,7 +2653,7 @@ namespace CalamityMod.NPCs } else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) { - if (DestroyerIDList.Includes(npc.type) || npc.type == NPCID.Probe || SkeletronPrimeIDList.Includes(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) || npc.type == NPCID.Probe || CalamityNPCTypeSets.SkeletronPrime.Contains(npc.type) || npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { double multiplier = Main.expertMode ? EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; npc.lifeMax = (int)Math.Round(npc.lifeMax * multiplier); @@ -2957,7 +2680,7 @@ namespace CalamityMod.NPCs } } - if (Main.hardMode && HardmodeNPCNerfList.Includes(npc.type)) + if (Main.hardMode && CalamityNPCSets.NerfDamageInHardmode[npc.type]) { npc.damage = (int)Math.Round(npc.damage * 0.75); npc.defDamage = npc.damage; @@ -2965,21 +2688,21 @@ namespace CalamityMod.NPCs if (DownedBossSystem.downedDoG) { - if (PumpkinMoonBuffList.Includes(npc.type)) + if (CalamityNPCSets.IsBuffedPumpkinMoonEnemy[npc.type]) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 3.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (FrostMoonBuffList.Includes(npc.type)) + else if (CalamityNPCSets.IsBuffedFrostMoonEnemy[npc.type]) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; npc.life = npc.lifeMax; npc.defDamage = npc.damage; } - else if (EclipseBuffList.Includes(npc.type)) + else if (CalamityNPCSets.IsBuffedSolarEclipseEnemy[npc.type]) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 5D); npc.damage += 30; @@ -2990,7 +2713,7 @@ namespace CalamityMod.NPCs if (NPC.downedMoonlord) { - if (BuffedDungeonEnemiesList.Includes(npc.type)) + if (CalamityNPCSets.IsBuffedDungeonEnemy[npc.type]) { npc.lifeMax = (int)Math.Round(npc.lifeMax * 2.5); npc.damage += 30; @@ -2998,575 +2721,6 @@ namespace CalamityMod.NPCs npc.defDamage = npc.damage; } } - - // Nerf KB resist in Expert and Master using this roundabout method - if (Main.expertMode) - AdjustExpertModeStatScaling(npc); - - // Adjust a ton of enemy stats - switch (npc.type) - { - case NPCID.AngryBones: - case NPCID.AngryBonesBig: - case NPCID.AngryBonesBigHelmet: - case NPCID.AngryBonesBigMuscle: - case NPCID.BigBoned: - case NPCID.ShortBones: - case NPCID.AnomuraFungus: - case NPCID.Antlion: - case NPCID.WalkingAntlion: - case NPCID.GiantWalkingAntlion: - case NPCID.LarvaeAntlion: - case NPCID.FlyingAntlion: - case NPCID.GiantFlyingAntlion: - case NPCID.BabySlime: - case NPCID.BlackSlime: - case NPCID.BlazingWheel: - case NPCID.BloodCrawler: - case NPCID.BloodCrawlerWall: - case NPCID.BlueJellyfish: - case NPCID.GreenJellyfish: - case NPCID.PinkJellyfish: - case NPCID.BloodJelly: - case NPCID.FungoFish: - case NPCID.BlueSlime: - case NPCID.BoneSerpentBody: - case NPCID.BoneSerpentHead: - case NPCID.BoneSerpentTail: - case NPCID.CaveBat: - case NPCID.CochinealBeetle: - case NPCID.Crab: - case NPCID.Crawdad: - case NPCID.Crawdad2: - case NPCID.Crimera: - case NPCID.BigCrimera: - case NPCID.LittleCrimera: - case NPCID.CursedSkull: - case NPCID.CyanBeetle: - case NPCID.Demon: - case NPCID.DemonEye: - case NPCID.CataractEye: - case NPCID.CataractEye2: - case NPCID.DemonEye2: - case NPCID.DemonEyeOwl: - case NPCID.DemonEyeSpaceship: - case NPCID.DialatedEye: - case NPCID.DialatedEye2: - case NPCID.GreenEye: - case NPCID.GreenEye2: - case NPCID.PurpleEye: - case NPCID.PurpleEye2: - case NPCID.SleepyEye: - case NPCID.SleepyEye2: - case NPCID.DevourerBody: - case NPCID.DevourerHead: - case NPCID.DevourerTail: - case NPCID.DoctorBones: - case NPCID.DungeonSlime: - case NPCID.EaterofSouls: - case NPCID.BigEater: - case NPCID.LittleEater: - case NPCID.FaceMonster: - case NPCID.ArmedZombieEskimo: - case NPCID.ZombieEskimo: - case NPCID.FungiBulb: - case NPCID.Ghost: - case NPCID.GiantShelly: - case NPCID.GiantShelly2: - case NPCID.GiantWormBody: - case NPCID.GiantWormHead: - case NPCID.GiantWormTail: - case NPCID.Gnome: - case NPCID.GoblinScout: - case NPCID.GraniteFlyer: - case NPCID.GraniteGolem: - case NPCID.GreenSlime: - case NPCID.Harpy: - case NPCID.Hellbat: - case NPCID.GreekSkeleton: - case NPCID.Hornet: - case NPCID.HornetFatty: - case NPCID.HornetHoney: - case NPCID.HornetLeafy: - case NPCID.HornetSpikey: - case NPCID.HornetStingy: - case NPCID.BigHornetFatty: - case NPCID.BigHornetHoney: - case NPCID.BigHornetLeafy: - case NPCID.BigHornetSpikey: - case NPCID.BigHornetStingy: - case NPCID.BigMossHornet: - case NPCID.GiantMossHornet: - case NPCID.LittleHornetFatty: - case NPCID.LittleHornetHoney: - case NPCID.LittleHornetLeafy: - case NPCID.LittleHornetSpikey: - case NPCID.LittleHornetStingy: - case NPCID.LittleMossHornet: - case NPCID.MossHornet: - case NPCID.TinyMossHornet: - case NPCID.IceBat: - case NPCID.IceSlime: - case NPCID.JungleBat: - case NPCID.JungleSlime: - case NPCID.LacBeetle: - case NPCID.LavaSlime: - case NPCID.MaggotZombie: - case NPCID.ManEater: - case NPCID.MeteorHead: - case NPCID.MotherSlime: - case NPCID.MushiLadybug: - case NPCID.Nymph: - case NPCID.Pinky: - case NPCID.Piranha: - case NPCID.PurpleSlime: - case NPCID.Raven: - case NPCID.RedSlime: - case NPCID.Salamander: - case NPCID.Salamander2: - case NPCID.Salamander3: - case NPCID.Salamander4: - case NPCID.Salamander5: - case NPCID.Salamander6: - case NPCID.Salamander7: - case NPCID.Salamander8: - case NPCID.Salamander9: - case NPCID.SandSlime: - case NPCID.SeaSnail: - case NPCID.Shark: - case NPCID.ShimmerSlime: - case NPCID.Skeleton: - case NPCID.SkeletonAlien: - case NPCID.SkeletonAstonaut: - case NPCID.SkeletonTopHat: - case NPCID.ArmoredSkeleton: - case NPCID.BigHeadacheSkeleton: - case NPCID.BigMisassembledSkeleton: - case NPCID.BigPantlessSkeleton: - case NPCID.BigSkeleton: - case NPCID.BoneThrowingSkeleton: - case NPCID.BoneThrowingSkeleton2: - case NPCID.BoneThrowingSkeleton3: - case NPCID.BoneThrowingSkeleton4: - case NPCID.HeadacheSkeleton: - case NPCID.HeavySkeleton: - case NPCID.MisassembledSkeleton: - case NPCID.PantlessSkeleton: - case NPCID.SmallMisassembledSkeleton: - case NPCID.SmallHeadacheSkeleton: - case NPCID.SmallSkeleton: - case NPCID.SmallPantlessSkeleton: - case NPCID.SporeSkeleton: - case NPCID.TacticalSkeleton: - case NPCID.SkeletonSniper: - case NPCID.SkeletonCommando: - case NPCID.DarkCaster: - case NPCID.FireImp: - case NPCID.Snatcher: - case NPCID.SnowFlinx: - case NPCID.SpikeBall: - case NPCID.SpikedIceSlime: - case NPCID.SpikedJungleSlime: - case NPCID.SporeBat: - case NPCID.ZombieMushroom: - case NPCID.ZombieMushroomHat: - case NPCID.Squid: - case NPCID.Tim: - case NPCID.TombCrawlerBody: - case NPCID.TombCrawlerHead: - case NPCID.TombCrawlerTail: - case NPCID.UndeadMiner: - case NPCID.UndeadViking: - case NPCID.VoodooDemon: - case NPCID.Vulture: - case NPCID.WallCreeper: - case NPCID.WallCreeperWall: - case NPCID.YellowSlime: - case NPCID.Zombie: - case NPCID.ZombieDoctor: - case NPCID.ZombieElf: - case NPCID.ZombieElfBeard: - case NPCID.ZombieElfGirl: - case NPCID.ZombieMerman: - case NPCID.ZombiePixie: - case NPCID.ZombieRaincoat: - case NPCID.ZombieSuperman: - case NPCID.ZombieSweater: - case NPCID.ZombieXmas: - case NPCID.ArmedTorchZombie: - case NPCID.ArmedZombie: - case NPCID.ArmedZombieCenx: - case NPCID.ArmedZombiePincussion: - case NPCID.ArmedZombieSlimed: - case NPCID.ArmedZombieSwamp: - case NPCID.ArmedZombieTwiggy: - case NPCID.BaldZombie: - case NPCID.BigBaldZombie: - case NPCID.BigFemaleZombie: - case NPCID.BigPincushionZombie: - case NPCID.BigRainZombie: - case NPCID.BigSlimedZombie: - case NPCID.BigSwampZombie: - case NPCID.BigTwiggyZombie: - case NPCID.BigZombie: - case NPCID.BloodZombie: - case NPCID.FemaleZombie: - case NPCID.PincushionZombie: - case NPCID.SlimedZombie: - case NPCID.SmallBaldZombie: - case NPCID.SmallFemaleZombie: - case NPCID.SmallPincushionZombie: - case NPCID.SmallRainZombie: - case NPCID.SmallSlimedZombie: - case NPCID.SmallSwampZombie: - case NPCID.SmallTwiggyZombie: - case NPCID.SmallZombie: - case NPCID.SwampZombie: - case NPCID.TorchZombie: - case NPCID.TwiggyZombie: - case NPCID.AnglerFish: - case NPCID.AngryTrapper: - case NPCID.Arapaima: - case NPCID.ArmoredViking: - case NPCID.DesertBeast: - case NPCID.BlackRecluse: - case NPCID.BlackRecluseWall: - case NPCID.BloodFeeder: - case NPCID.Mummy: - case NPCID.BloodMummy: - case NPCID.DarkMummy: - case NPCID.LightMummy: - case NPCID.BlueArmoredBones: - case NPCID.BlueArmoredBonesMace: - case NPCID.BlueArmoredBonesNoPants: - case NPCID.BlueArmoredBonesSword: - case NPCID.BoneLee: - case NPCID.ChaosElemental: - case NPCID.Clinger: - case NPCID.BigMimicCorruption: - case NPCID.BigMimicCrimson: - case NPCID.BigMimicHallow: - case NPCID.BigMimicJungle: - case NPCID.CorruptSlime: - case NPCID.Corruptor: - case NPCID.Crimslime: - case NPCID.BigCrimslime: - case NPCID.LittleCrimslime: - case NPCID.CrimsonAxe: - case NPCID.CultistArcherBlue: - case NPCID.CultistArcherWhite: - case NPCID.CultistDevote: - case NPCID.CursedHammer: - case NPCID.Derpling: - case NPCID.Herpling: - case NPCID.DesertDjinn: - case NPCID.DiabolistRed: - case NPCID.DiabolistWhite: - case NPCID.DiggerBody: - case NPCID.DiggerHead: - case NPCID.DiggerTail: - case NPCID.DesertGhoul: - case NPCID.DesertGhoulCorruption: - case NPCID.DesertGhoulCrimson: - case NPCID.DesertGhoulHallow: - case NPCID.DuneSplicerBody: - case NPCID.DuneSplicerHead: - case NPCID.DuneSplicerTail: - case NPCID.DungeonSpirit: - case NPCID.EnchantedSword: - case NPCID.FloatyGross: - case NPCID.FlyingSnake: - case NPCID.Gastropod: - case NPCID.GiantBat: - case NPCID.GiantCursedSkull: - case NPCID.GiantFlyingFox: - case NPCID.GiantFungiBulb: - case NPCID.GiantTortoise: - case NPCID.IceTortoise: - case NPCID.HellArmoredBones: - case NPCID.HellArmoredBonesMace: - case NPCID.HellArmoredBonesSpikeShield: - case NPCID.HellArmoredBonesSword: - case NPCID.HoppinJack: - case NPCID.IceElemental: - case NPCID.Mimic: - case NPCID.IceMimic: - case NPCID.PresentMimic: - case NPCID.IchorSticker: - case NPCID.IcyMerman: - case NPCID.IlluminantBat: - case NPCID.IlluminantSlime: - case NPCID.JungleCreeper: - case NPCID.JungleCreeperWall: - case NPCID.DesertLamiaDark: - case NPCID.DesertLamiaLight: - case NPCID.Lavabat: - case NPCID.Lihzahrd: - case NPCID.LihzahrdCrawler: - case NPCID.Medusa: - case NPCID.Moth: - case NPCID.Necromancer: - case NPCID.NecromancerArmored: - case NPCID.Paladin: - case NPCID.PigronCorruption: - case NPCID.PigronCrimson: - case NPCID.PigronHallow: - case NPCID.Pixie: - case NPCID.PossessedArmor: - case NPCID.RaggedCaster: - case NPCID.RaggedCasterOpenCoat: - case NPCID.RedDevil: - case NPCID.RockGolem: - case NPCID.RuneWizard: - case NPCID.RustyArmoredBonesAxe: - case NPCID.RustyArmoredBonesFlail: - case NPCID.RustyArmoredBonesSword: - case NPCID.RustyArmoredBonesSwordNoArmor: - case NPCID.DesertScorpionWalk: - case NPCID.DesertScorpionWall: - case NPCID.SkeletonArcher: - case NPCID.Slimeling: - case NPCID.Slimer: - case NPCID.Slimer2: - case NPCID.ToxicSludge: - case NPCID.Unicorn: - case NPCID.WanderingEye: - case NPCID.Werewolf: - case NPCID.Wolf: - case NPCID.SeekerBody: - case NPCID.SeekerHead: - case NPCID.SeekerTail: - case NPCID.Wraith: - case NPCID.WyvernBody: - case NPCID.WyvernBody2: - case NPCID.WyvernBody3: - case NPCID.WyvernHead: - case NPCID.WyvernLegs: - case NPCID.WyvernTail: - case NPCID.BloodEelBody: - case NPCID.BloodEelHead: - case NPCID.BloodEelTail: - case NPCID.BloodSquid: - case NPCID.ChatteringTeethBomb: - case NPCID.Clown: - case NPCID.CorruptBunny: - case NPCID.CorruptGoldfish: - case NPCID.CorruptPenguin: - case NPCID.Drippler: - case NPCID.GoblinShark: - case NPCID.TheGroom: - case NPCID.TheBride: - case NPCID.CrimsonBunny: - case NPCID.CrimsonGoldfish: - case NPCID.CrimsonPenguin: - case NPCID.EyeballFlyingFish: - case NPCID.Dandelion: - case NPCID.AngryNimbus: - case NPCID.FlyingFish: - case NPCID.IceGolem: - case NPCID.RainbowSlime: - case NPCID.UmbrellaSlime: - case NPCID.Tumbleweed: - case NPCID.SandShark: - case NPCID.SandsharkCorrupt: - case NPCID.SandsharkCrimson: - case NPCID.SandsharkHallow: - case NPCID.SandElemental: - case NPCID.BloodNautilus: - case NPCID.GoblinArcher: - case NPCID.GoblinPeon: - case NPCID.GoblinSorcerer: - case NPCID.GoblinSummoner: - case NPCID.GoblinThief: - case NPCID.GoblinWarrior: - case NPCID.MisterStabby: - case NPCID.SnowBalla: - case NPCID.SnowmanGangsta: - case NPCID.Parrot: - case NPCID.PirateCaptain: - case NPCID.PirateCorsair: - case NPCID.PirateCrossbower: - case NPCID.PirateDeadeye: - case NPCID.PirateDeckhand: - case NPCID.PirateGhost: - case NPCID.PirateShipCannon: - case NPCID.MothronSpawn: - case NPCID.Mothron: - case NPCID.Butcher: - case NPCID.CreatureFromTheDeep: - case NPCID.DeadlySphere: - case NPCID.DrManFly: - case NPCID.Eyezor: - case NPCID.Frankenstein: - case NPCID.Fritz: - case NPCID.Nailhead: - case NPCID.Psycho: - case NPCID.Reaper: - case NPCID.ThePossessed: - case NPCID.SwampThing: - case NPCID.Vampire: - case NPCID.VampireBat: - case NPCID.BrainScrambler: - case NPCID.GigaZapper: - case NPCID.MartianWalker: - case NPCID.GrayGrunt: - case NPCID.MartianDrone: - case NPCID.MartianEngineer: - case NPCID.MartianOfficer: - case NPCID.RayGunner: - case NPCID.Scutlix: - case NPCID.ScutlixRider: - case NPCID.MartianTurret: - case NPCID.HeadlessHorseman: - case NPCID.Hellhound: - case NPCID.Splinterling: - case NPCID.Poltergeist: - case NPCID.Scarecrow1: - case NPCID.Scarecrow2: - case NPCID.Scarecrow3: - case NPCID.Scarecrow4: - case NPCID.Scarecrow5: - case NPCID.Scarecrow6: - case NPCID.Scarecrow7: - case NPCID.Scarecrow8: - case NPCID.Scarecrow9: - case NPCID.Scarecrow10: - case NPCID.ElfArcher: - case NPCID.ElfCopter: - case NPCID.Flocko: - case NPCID.GingerbreadMan: - case NPCID.Krampus: - case NPCID.Nutcracker: - case NPCID.NutcrackerSpinning: - case NPCID.Yeti: - case NPCID.NebulaBeast: - case NPCID.NebulaBrain: - case NPCID.NebulaHeadcrab: - case NPCID.NebulaSoldier: - case NPCID.SolarCorite: - case NPCID.SolarCrawltipedeBody: - case NPCID.SolarCrawltipedeHead: - case NPCID.SolarCrawltipedeTail: - case NPCID.SolarDrakomire: - case NPCID.SolarDrakomireRider: - case NPCID.SolarSolenian: - case NPCID.SolarSpearman: - case NPCID.SolarSroller: - case NPCID.StardustCellBig: - case NPCID.StardustCellSmall: - case NPCID.StardustJellyfishBig: - case NPCID.StardustWormBody: - case NPCID.StardustWormHead: - case NPCID.StardustWormTail: - case NPCID.StardustSoldier: - case NPCID.StardustSpiderBig: - case NPCID.StardustSpiderSmall: - case NPCID.VortexHornet: - case NPCID.VortexHornetQueen: - case NPCID.VortexLarva: - case NPCID.VortexRifleman: - case NPCID.VortexSoldier: - case NPCID.DD2DarkMageT1: - case NPCID.DD2DarkMageT3: - case NPCID.DD2OgreT2: - case NPCID.DD2OgreT3: - case NPCID.MartianSaucerCore: - case NPCID.MartianSaucerCannon: - case NPCID.MartianSaucerTurret: - case NPCID.DD2SkeletonT1: - case NPCID.DD2SkeletonT3: - case NPCID.DD2DrakinT2: - case NPCID.DD2DrakinT3: - case NPCID.DD2GoblinBomberT1: - case NPCID.DD2GoblinBomberT2: - case NPCID.DD2GoblinBomberT3: - case NPCID.DD2GoblinT1: - case NPCID.DD2GoblinT2: - case NPCID.DD2GoblinT3: - case NPCID.DD2JavelinstT1: - case NPCID.DD2JavelinstT2: - case NPCID.DD2JavelinstT3: - case NPCID.DD2KoboldFlyerT2: - case NPCID.DD2KoboldFlyerT3: - case NPCID.DD2KoboldWalkerT2: - case NPCID.DD2KoboldWalkerT3: - case NPCID.DD2LightningBugT3: - case NPCID.DD2WitherBeastT2: - case NPCID.DD2WitherBeastT3: - case NPCID.DD2WyvernT1: - case NPCID.DD2WyvernT2: - case NPCID.DD2WyvernT3: - case NPCID.SlimeSpiked: - - // Buff enemy HP by 25% - npc.lifeMax = (int)Math.Round(npc.lifeMax * EnemyHPMultiplier); - - // Nerf a shitload of Master Mode enemies - // HP is nerfed by 25% (this nerf is higher due to the player not dealing any more damage in Master) - // Damage is nerfed by 15% (this nerf is lower due to the player having 100% effective defense in Master) - if (Main.masterMode) - { - AdjustMasterModeStatScaling(npc); - npc.defDamage = npc.damage; - } - - break; - - case NPCID.AncientCultistSquidhead: - // This guy only gets Master Mode nerfs - // HP is nerfed by 25% (this nerf is higher due to the player not dealing any more damage in Master) - // Damage is nerfed by 15% (this nerf is lower due to the player having 100% effective defense in Master) - if (Main.masterMode) - { - AdjustMasterModeStatScaling(npc); - npc.defDamage = npc.damage; - } - break; - - case NPCID.KingSlime: - case NPCID.EyeofCthulhu: - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - case NPCID.BrainofCthulhu: - case NPCID.Creeper: - case NPCID.QueenBee: - case NPCID.SkeletronHead: - case NPCID.SkeletronHand: - case NPCID.Deerclops: - case NPCID.WallofFlesh: - case NPCID.WallofFleshEye: - case NPCID.QueenSlimeBoss: - case NPCID.Retinazer: - case NPCID.Spazmatism: - case NPCID.TheDestroyer: - case NPCID.TheDestroyerBody: - case NPCID.TheDestroyerTail: - case NPCID.SkeletronPrime: - case NPCID.PrimeCannon: - case NPCID.PrimeLaser: - case NPCID.PrimeSaw: - case NPCID.PrimeVice: - case NPCID.Plantera: - case NPCID.PlanterasTentacle: - case NPCID.Golem: - case NPCID.GolemHead: - case NPCID.GolemHeadFree: - case NPCID.GolemFistLeft: - case NPCID.GolemFistRight: - case NPCID.HallowBoss: - case NPCID.DukeFishron: - case NPCID.CultistBoss: - case NPCID.MoonLordCore: - case NPCID.MoonLordFreeEye: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - - if (Main.masterMode) - AdjustMasterModeStatScaling(npc, true); - - break; - } } #endregion @@ -3671,7 +2825,7 @@ namespace CalamityMod.NPCs return; bool countsAsBoss = npc.boss || NPCID.Sets.ShouldBeCountedAsBoss[npc.type]; - bool scalesLikeBoss = countsAsBoss || BossHPScalingList.List.Contains(npc.type); + bool scalesLikeBoss = countsAsBoss || CalamityNPCSets.ScalesHealthLikeBoss[npc.type]; bool isCalamityNPC = npc.ModNPC != null && npc.ModNPC.Mod == CalamityMod.Instance; // 14APR2025: Ozzatron: Reworked how Calamity changes the health of Expert+ multiplayer bosses @@ -3769,18 +2923,21 @@ namespace CalamityMod.NPCs // Apply armor penetration based on Calamity debuffs. The hit system manages the sequencing. // Ozzatron 05JAN2023: fixed doubled armor pen, this time for real - int defenseReduction = (marked > 0 && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither > 0 ? RemsRevenge.WitherDefenseReduction : 0) + miscDefenseLoss; + int defenseReduction = (markedForDeath && DR <= 0f ? MarkedforDeath.DefenseReduction : 0) + (wither ? RemsRevenge.WitherDefenseReduction : 0) + miscDefenseLoss; modifiers.ArmorPenetration += defenseReduction; // DR applies after vanilla defense. ApplyDR(npc, ref modifiers); // Damage reduction on spawn for certain worm bosses. - if (EaterOfWorldsIDList.Includes(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) - modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(BossRushEvent.BossRushActive ? 0.6f : 0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f))); - if (DestroyerIDList.Includes(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) - modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f))); - if (AstrumDeusIDList.Includes(npc.type)) + if (CalamityWorld.revenge) + { + if (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) && newAI[1] < EaterOfWorldsAI.DRIncreaseTime) + modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / EaterOfWorldsAI.DRIncreaseTime, 0f, 1f))); + if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) && newAI[1] < DestroyerAI.DRIncreaseTime) + modifiers.FinalDamage *= 1f - (float)Math.Sqrt(MathHelper.Lerp(0f, 0.99f, MathHelper.Clamp(1f - newAI[1] / DestroyerAI.DRIncreaseTime, 0f, 1f))); + } + if (CalamityNPCTypeSets.AstrumDeus.Contains(npc.type)) { float drTime = newAI[0] != 0f ? 300f : 600f; if (newAI[1] < drTime) @@ -3806,17 +2963,9 @@ namespace CalamityMod.NPCs effectiveDR = 0f; // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac - // Cirrus being active makes the extra DR cease to function - bool cirrusBossActive = false; - if (SCal != -1) - { - if (Main.npc[SCal].active) - cirrusBossActive = Main.npc[SCal].ModNPC().cirrus; - } - bool enragedProvi = npc.type == NPCType() && !ProvUtils.StandardAI(); bool dayEmpress = npc.type == NPCID.HallowBoss && NPC.ShouldEmpressBeEnraged(); - if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && !cirrusBossActive && (enragedProvi || dayEmpress)) + if (KillTime > 0 && AITimer < KillTime && !BossRushEvent.BossRushActive && (enragedProvi || dayEmpress)) { // Set the DR scaling factor float DRScalar = 10f; @@ -3845,20 +2994,22 @@ namespace CalamityMod.NPCs modifiers.FinalDamage *= finalMultiplier; } + //TODO: + //This will need to be adjusted to use DebuffData in the future. + //However, we still need to decide what to actually do with these due to the general flattening of DR amounts and removal from most enemies + //This means that this will be handled in the future private float DefaultDRMath(NPC npc, float DR) { float calcDR = DR; - if (marked > 0) + if (markedForDeath) calcDR *= 0.5f; - if (absorberAffliction > 0) + if (absorberAffliction) calcDR *= 0.8f; - if (npc.Calamity().kamiFlu > 0) - calcDR *= YanmeisKnife.DebuffDamageReductionMult; - if (npc.Calamity().aCrunch > 0) + if (npc.Calamity().armorCrunch) calcDR *= ArmorCrunch.MultiplicativeDamageReductionEnemy; - if (npc.Calamity().crumble > 0) + if (npc.Calamity().crumble) calcDR *= Crumbling.MultiplicativeDamageReductionEnemy; - if (relicOfResilienceWeakness > 0) + if (relicOfResilienceWeakness) calcDR *= 0.5f; @@ -3928,18 +3079,12 @@ namespace CalamityMod.NPCs #region Boss Head Slot public override void BossHeadSlot(NPC npc, ref int index) { - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) + if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) { - if (npc.type == NPCID.SkeletronPrime && (Main.masterMode || BossRushEvent.BossRushActive)) - index = ExtraTextureRefs.BossHeadIndex_ChadPrime; - - if (npc.type == NPCID.DukeFishron && (CalamityWorld.death || BossRushEvent.BossRushActive)) - { - float lifeRatio = npc.life / (float)npc.lifeMax; - float mapIconVanishValue = Main.masterMode ? 0.3f : 0.4f; - if (lifeRatio < mapIconVanishValue || (lifeRatio > 0.9f && (Main.masterMode || BossRushEvent.BossRushActive))) - index = -1; - } + float lifeRatio = npc.life / (float)npc.lifeMax; + float mapIconVanishValue = 0.3f; + if (lifeRatio < mapIconVanishValue || lifeRatio > 0.9f) + index = -1; } } #endregion @@ -3948,7 +3093,7 @@ namespace CalamityMod.NPCs public override bool PreAI(NPC npc) { // Change Spaz and Ret weaknesses and resistances when phase 2 starts. - if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer || npc.type == NPCType()) + if (npc.type == NPCID.Spazmatism || npc.type == NPCID.Retinazer) { if (npc.ai[0] >= 2f) { @@ -3962,6 +3107,16 @@ namespace CalamityMod.NPCs if (VulnerabilityHexFireDrawer != null) VulnerabilityHexFireDrawer.Update(); + if (ManaBurnFireDrawer != null) + { + ManaBurnFireDrawer.LocalTimer = 0; + float power = npc.height / 100f; + if (power > 2.75f) + power = 2.75f; + ManaBurnFireDrawer.RelativePower = power * MathHelper.Lerp(0.5f, 1.5f, MathHelper.Clamp(manaBurn / manaBurnPeak, 0, 1)) * playerManaBurnIntensity; + ManaBurnFireDrawer.Update(); + } + SetPatreonTownNPCName(npc, Mod); // Decrement each immune timer if it's greater than 0. @@ -3978,9 +3133,6 @@ namespace CalamityMod.NPCs { if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) Main.LocalPlayer.AddBuff(BuffType(), 2); - - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && npc.type == NPCType() && Vector2.Distance(Main.LocalPlayer.Center, npc.Center) < BossZenDistance) - Main.LocalPlayer.AddBuff(BuffType(), 2); } if (npc.type != NPCType()) @@ -4002,7 +3154,7 @@ namespace CalamityMod.NPCs } // Setting this in SetDefaults will disable expert mode scaling, so put it here instead - if (ZeroContactDamageNPCList.Includes(npc.type) && (npc.type != NPCID.RuneWizard || !Main.zenithWorld)) + if (CalamityNPCSets.DealsZeroContactDamage[npc.type] && !(npc.type == NPCID.RuneWizard && Main.zenithWorld)) npc.damage = 0; // Don't do damage for 42 frames after spawning in @@ -4026,10 +3178,6 @@ namespace CalamityMod.NPCs if (npc.type == NPCID.BloodNautilus) return DreadnautilusAI.BuffedDreadnautilusAI(npc, Mod); - // More telegraphs - if (npc.type == NPCID.SpikedIceSlime || npc.type == NPCID.SpikedJungleSlime || npc.type == NPCID.SlimeSpiked) - return SlimeAI.BuffedSlimeAI(npc, Mod); - // Decrease the projectile velocities of several fighter enemies and make them better to fight in general // Also limit the amount of times Vortex Larvae and Hornets can evolve if (npc.type == NPCID.IceGolem || npc.type == NPCID.Eyezor || npc.type == NPCID.VortexRifleman || @@ -4127,73 +3275,6 @@ namespace CalamityMod.NPCs return DukeFishronAI.BuffedDetonatingBubbleAI(npc, Mod); } - // Expert+ Hive Mind Vile Spits - if (npc.type == NPCID.VileSpitEaterOfWorlds) - { - if (Main.expertMode || BossRushEvent.BossRushActive) - { - if (npc.ai[1] >= 69f) - { - if (npc.target == Main.maxPlayers) - { - npc.TargetClosest(); - - float velocity = Main.getGoodWorld ? 12f : (Main.masterMode || BossRushEvent.BossRushActive) ? 10.5f : 9f; - if (npc.ai[1] == 70f) - velocity *= 0.4f; - - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - } - - if (Main.getGoodWorld && !npc.dontTakeDamage) - { - if ((double)(npc.Center.Y / 16f) < Main.worldSurface) - npc.dontTakeDamage = true; - } - - npc.damage = npc.GetAttackDamage_ScaledByStrength(32f); - - npc.ai[0] += 1f; - if (npc.ai[0] > 3f) - npc.ai[0] = 3f; - - if (npc.ai[0] == 2f) - { - npc.position += npc.velocity; - SoundEngine.PlaySound(SoundID.NPCDeath9, npc.Center); - for (int i = 0; i < 20; i++) - { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f) + npc.netOffset, npc.width, npc.height, DustID.CorruptGibs, 0f, 0f, 100, default, 1.8f); - Main.dust[dust].velocity *= 1.3f; - Main.dust[dust].velocity += npc.velocity; - Main.dust[dust].noGravity = true; - } - } - - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - } - - npc.EncourageDespawn(100); - - npc.position += npc.netOffset; - for (int i = 0; i < 2; i++) - { - int dust = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 2f), npc.width, npc.height, DustID.CorruptGibs, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 1.3f); - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].noGravity = true; - } - - npc.rotation += 0.4f * npc.direction; - npc.position -= npc.netOffset; - - return false; - } - } - } - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { switch (npc.type) @@ -4232,6 +3313,10 @@ namespace CalamityMod.NPCs case NPCID.QueenSlimeBoss: return QueenSlimeAI.BuffedQueenSlimeAI(npc, Mod); + case NPCID.QueenSlimeMinionBlue: + return QueenSlimeAI.BuffedQueenSlimeCrystalSlimeAI(npc, Mod); + case NPCID.QueenSlimeMinionPink: + return QueenSlimeAI.BuffedQueenSlimeBouncySlimeAI(npc, Mod); case NPCID.TheDestroyer: case NPCID.TheDestroyerBody: @@ -4331,106 +3416,6 @@ namespace CalamityMod.NPCs } } - // Adjust vanilla AI in Classic, Expert and Master - // Fair contact damage and a few Expert/Master AI edits happen here - // Deerclops doesn't deserve love so he's not here - else if (!CalamityMod.ExternalFlag_DisableNonRevBossAI) - { - switch (npc.type) - { - case NPCID.KingSlime: - return KingSlimeAI.VanillaKingSlimeAI(npc, Mod); - - case NPCID.EyeofCthulhu: - return EyeOfCthulhuAI.VanillaEyeofCthulhuAI(npc, Mod); - - case NPCID.EaterofWorldsHead: - case NPCID.EaterofWorldsBody: - case NPCID.EaterofWorldsTail: - return EaterOfWorldsAI.VanillaEaterofWorldsAI(npc, Mod); - - case NPCID.BrainofCthulhu: - return BrainOfCthulhuAI.VanillaBrainofCthulhuAI(npc, Mod); - case NPCID.Creeper: - return BrainOfCthulhuAI.VanillaCreeperAI(npc, Mod); - - case NPCID.QueenBee: - return QueenBeeAI.VanillaQueenBeeAI(npc, Mod); - - case NPCID.SkeletronHand: - return SkeletronAI.VanillaSkeletronHandAI(npc, Mod); - case NPCID.SkeletronHead: - return SkeletronAI.VanillaSkeletronAI(npc, Mod); - - case NPCID.WallofFlesh: - return WallOfFleshAI.VanillaWallofFleshAI(npc, Mod); - case NPCID.WallofFleshEye: - return WallOfFleshAI.VanillaWallofFleshEyeAI(npc, Mod); - - case NPCID.QueenSlimeBoss: - return QueenSlimeAI.VanillaQueenSlimeAI(npc, Mod); - - case NPCID.TheDestroyer: - case NPCID.TheDestroyerBody: - case NPCID.TheDestroyerTail: - return DestroyerAI.VanillaDestroyerAI(npc, Mod); - case NPCID.Probe: - return DestroyerAI.VanillaProbeAI(npc, Mod); - - case NPCID.Retinazer: - return TwinsAI.VanillaRetinazerAI(npc, Mod); - case NPCID.Spazmatism: - return TwinsAI.VanillaSpazmatismAI(npc, Mod); - - case NPCID.SkeletronPrime: - return SkeletronPrimeAI.VanillaSkeletronPrimeAI(npc, Mod); - case NPCID.PrimeLaser: - return SkeletronPrimeAI.VanillaPrimeLaserAI(npc, Mod); - case NPCID.PrimeCannon: - return SkeletronPrimeAI.VanillaPrimeCannonAI(npc, Mod); - case NPCID.PrimeVice: - return SkeletronPrimeAI.VanillaPrimeViceAI(npc, Mod); - case NPCID.PrimeSaw: - return SkeletronPrimeAI.VanillaPrimeSawAI(npc, Mod); - - case NPCID.Plantera: - return PlanteraAI.VanillaPlanteraAI(npc, Mod); - - case NPCID.HallowBoss: - return EmpressofLightAI.VanillaEmpressofLightAI(npc, Mod); - - case NPCID.Golem: - return GolemAI.VanillaGolemAI(npc, Mod); - case NPCID.GolemFistLeft: - case NPCID.GolemFistRight: - return GolemAI.VanillaGolemFistAI(npc, Mod); - case NPCID.GolemHead: - return GolemAI.VanillaGolemHeadAI(npc, Mod); - case NPCID.GolemHeadFree: - return GolemAI.VanillaGolemHeadFreeAI(npc, Mod); - - case NPCID.DukeFishron: - return DukeFishronAI.VanillaDukeFishronAI(npc, Mod); - - case NPCID.CultistBoss: - case NPCID.CultistBossClone: - return CultistAI.VanillaCultistAI(npc, Mod); - case NPCID.AncientLight: - return CultistAI.VanillaAncientLightAI(npc, Mod); - case NPCID.AncientDoom: - return CultistAI.VanillaAncientDoomAI(npc, Mod); - - /*case NPCID.MoonLordCore: - case NPCID.MoonLordHand: - case NPCID.MoonLordHead: - case NPCID.MoonLordFreeEye: - return MoonLordAI.VanillaMoonLordAI(npc, Mod);*/ - - default: - break; - } - } - if (CalamityWorld.revenge) { switch (npc.aiStyle) @@ -4456,6 +3441,8 @@ namespace CalamityMod.NPCs case NPCID.ToxicSludge: case NPCID.IceSlime: case NPCID.Crimslime: + case NPCID.SpikedIceSlime: + case NPCID.SpikedJungleSlime: case NPCID.UmbrellaSlime: case NPCID.RainbowSlime: case NPCID.SlimeMasked: @@ -4465,6 +3452,7 @@ namespace CalamityMod.NPCs case NPCID.SlimeRibbonGreen: case NPCID.SlimeRibbonRed: case NPCID.SandSlime: + case NPCID.SlimeSpiked: case NPCID.GoldenSlime: case NPCID.ShimmerSlime: return SlimeAI.BuffedSlimeAI(npc, Mod); @@ -5055,12 +4043,6 @@ namespace CalamityMod.NPCs } } - if (npc.type == NPCID.QueenSlimeMinionBlue) - return QueenSlimeAI.QueenSlimeCrystalSlimeAI(npc, Mod); - - if (npc.type == NPCID.QueenSlimeMinionPink) - return QueenSlimeAI.QueenSlimeBouncySlimeAI(npc, Mod); - if (npc.type == NPCID.FungiBulb) return RevengeanceAndDeathAI.BuffedPlantAI(npc, Mod); @@ -5436,16 +4418,6 @@ namespace CalamityMod.NPCs npc.damage = npc.ai[0] == 2f ? npc.defDamage : 0; break; - case NPCID.DD2GoblinT1: - case NPCID.DD2GoblinT2: - case NPCID.DD2GoblinT3: - npc.damage = (npc.ai[0] > 0f && npc.ai[0] < 24f) ? npc.defDamage : 0; - break; - - case NPCID.PumpkingBlade: - npc.damage = (npc.ai[2] == 2f || npc.ai[2] == 5f) ? npc.defDamage : 0; - break; - case NPCID.Mothron: npc.damage = npc.ai[0] == 3.2f ? (int)Math.Round(npc.defDamage * 1.3) : npc.ai[0] == 2f ? (int)Math.Round(npc.defDamage * 0.5) : 0; break; @@ -5454,10 +4426,6 @@ namespace CalamityMod.NPCs npc.damage = npc.ai[0] == 2.1f ? npc.defDamage : 0; break; - case NPCID.Flocko: - npc.damage = npc.ai[0] > 0f ? npc.defDamage : 0; - break; - case NPCID.Mimic: case NPCID.IceMimic: case NPCID.PresentMimic: @@ -5476,32 +4444,11 @@ namespace CalamityMod.NPCs break; - case NPCID.DeadlySphere: - npc.damage = npc.ai[0] == 1f ? npc.defDamage : 0; - break; - - case NPCID.NebulaHeadcrab: - npc.damage = npc.ai[0] == 5f ? npc.defDamage : 0; - break; - case NPCID.MartianDrone: case NPCID.SolarCorite: npc.damage = (npc.ai[0] == 2f || npc.ai[0] == 3f) ? npc.defDamage : 0; break; - case NPCID.ArmedTorchZombie: - case NPCID.ArmedZombie: - case NPCID.ArmedZombieCenx: - case NPCID.ArmedZombieEskimo: - case NPCID.ArmedZombiePincussion: - case NPCID.ArmedZombieSlimed: - case NPCID.ArmedZombieSwamp: - case NPCID.ArmedZombieTwiggy: - case NPCID.Crawdad: - case NPCID.Crawdad2: - npc.damage = npc.ai[2] == 0f ? 0 : (int)Math.Round(npc.defDamage * 1.4); - break; - case NPCID.GraniteFlyer: npc.damage = npc.ai[0] == -1f ? 0 : npc.defDamage; break; @@ -5510,21 +4457,6 @@ namespace CalamityMod.NPCs npc.damage = npc.ai[2] < 0f ? 0 : npc.defDamage; break; - case NPCID.Squid: - case NPCID.BlueJellyfish: - case NPCID.GreenJellyfish: - case NPCID.PinkJellyfish: - case NPCID.BloodJelly: - case NPCID.FungoFish: - float damagingVelocity = npc.type == NPCID.GreenJellyfish ? 3.6f : 2.8f; - npc.damage = (npc.dontTakeDamage || npc.velocity.Length() > damagingVelocity) ? npc.defDamage : 0; - break; - - case NPCID.Herpling: - case NPCID.Derpling: - npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; - break; - case NPCID.BlueSlime: case NPCID.MotherSlime: case NPCID.LavaSlime: @@ -5553,7 +4485,6 @@ namespace CalamityMod.NPCs case NPCID.JungleSlime: case NPCID.BabySlime: case NPCID.Pinky: - case NPCID.BunnySlimed: case NPCID.Slimeling: case NPCID.Slimer2: npc.damage = (npc.velocity.Y == 0f || npc.velocity.Length() < 3f) ? 0 : npc.defDamage; @@ -5665,127 +4596,7 @@ namespace CalamityMod.NPCs npc.ai[3] = 0f; } - // Debuff decrements - if (debuffResistanceTimer > 0) - debuffResistanceTimer--; - - if (timeSlow > 0) - timeSlow--; - if (tesla > 0) - tesla--; - if (gState > 0) - gState--; - if (tSad > 0) - tSad--; - if (eutrophication > 0) - eutrophication--; - if (webbed > 0) - webbed--; - if (slowed > 0) - slowed--; - if (kamiFlu > 0) - kamiFlu--; - if (vaporfied > 0) - vaporfied--; - - if (electrified > 0) - electrified--; - if (pearlAura > 0) - pearlAura--; - if (bBlood > 0) - bBlood--; - if (brainRot > 0) - brainRot--; - if (heavybleeding > 0) - heavybleeding--; - if (laceration > 0) - laceration--; - if (elementalMix > 0) - elementalMix--; - if (trueVulnerabilityHex > 0) - { - vulnerabilityHex = 0; // You cannot stack True VHex with its lesser counterpart. - trueVulnerabilityHex--; - if (trueVulnerabilityHex == 0) - cursorFocus = 0; - } - if (vulnerabilityHex > 0) - vulnerabilityHex--; - if (marked > 0) - marked--; - if (absorberAffliction > 0) - absorberAffliction--; - if (irradiated > 0) - irradiated--; - if (bFlames > 0) - bFlames--; - if (demonicFlames > 0) - demonicFlames--; - else - demonicFlamesBonusDamage = 0; - if (hFlames > 0) - hFlames--; - if (pFlames > 0) - pFlames--; - // Soma Prime's Shred stacks have a unique falloff mechanic in the debuff's own file. - if (aCrunch > 0) - aCrunch--; - if (crumble > 0) - crumble--; - if (cDepth > 0) - cDepth--; - if (hPressure > 0) - hPressure--; - if (rTide > 0) - rTide--; - if (gsInferno > 0) - gsInferno--; - if (dragonFire > 0) - dragonFire--; - if (vermillionFlux > 0) - vermillionFlux--; - if (auricRebuke > 0) - auricRebuke--; - if (staticDischarge > 0) - staticDischarge--; - if (miracleBlight > 0) - miracleBlight--; - if (astralInfection > 0) - astralInfection--; - if (wDeath > 0) - wDeath--; - if (nightwither > 0) - nightwither--; - if (shocked > 0) - shocked--; - if (voidfrost > 0) - voidfrost--; - if (shellfishVore > 0) - shellfishVore--; - if (clamDebuff > 0) - clamDebuff--; - if (sulphurPoison > 0) - sulphurPoison--; - if (sagePoisonTime > 0) - sagePoisonTime--; - if (GaussFluxTimer > 0) - GaussFluxTimer--; - if (ladHearts > 0) - ladHearts--; - if (banishingFire > 0) - banishingFire--; - if (wither > 0) - wither--; - if (ashesOnDeath > 0) - ashesOnDeath--; - - if (antlionCloudDebuffTimer > 0) - antlionCloudDebuffTimer--; - if (cursorFocus > 0 && cursorFocus < cursorFocusMax) - cursorFocus--; - - if (relicOfResilienceWeakness > 0) - relicOfResilienceWeakness--; + if (warbannerBurnTimer > 0) warbannerBurnTimer--; @@ -5970,7 +4781,7 @@ namespace CalamityMod.NPCs // Pearl Aura shard spawning // Slowing is handled in the general slowing code below - if (pearlAura > 0) + if (pearlAura) { pearlAuraCounter++; if (pearlAuraCounter >= 45) @@ -6017,25 +4828,23 @@ namespace CalamityMod.NPCs if (debuffResistanceTimer <= 0 || (debuffResistanceTimer > slowingDebuffResistanceMin)) { // Slowing debuffs which set a velocity hard cap take priority first. - if (vulnerabilityHex > 0) + if (vulnerabilityHex) npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-Calamity.MaxNPCSpeed), new Vector2(Calamity.MaxNPCSpeed, 10f)); - else if (kamiFlu > 360) - npc.velocity = Vector2.Clamp(npc.velocity, new Vector2(-YanmeisKnife.DebuffNPCSpeedCap), new Vector2(YanmeisKnife.DebuffNPCSpeedCap)); // Then debuffs which apply a multiplier to velocity. // These multipliers can stack with each other, even if you'll rarely see this on a boss. float velocitySlownessFactor = 1f; - if (tSad > 0) + if (temporalSadness) velocitySlownessFactor += 0.2f; - if (timeSlow > 0) + if (timeDistortion) velocitySlownessFactor += 0.15f; - if (webbed > 0) + if (webbed) velocitySlownessFactor += 0.15f; - if (gState > 0) + if (glacialState) { float baseSlownessFactor = 0.1f; if (VulnerableToCold.HasValue) @@ -6048,10 +4857,10 @@ namespace CalamityMod.NPCs velocitySlownessFactor += baseSlownessFactor; } - if (pearlAura > 0) + if (pearlAura) velocitySlownessFactor += 0.1f; - if (eutrophication > 0) + if (eutrophication) { float baseSlownessFactor = 0.05f; if (VulnerableToWater.HasValue) @@ -6064,10 +4873,7 @@ namespace CalamityMod.NPCs velocitySlownessFactor += baseSlownessFactor; } - if (slowed > 0) - velocitySlownessFactor += 0.05f; - - if (tesla > 0) + if (galvanicCorrosion) { float baseSlownessFactor = 0.05f; if (VulnerableToElectricity.HasValue) @@ -6080,7 +4886,7 @@ namespace CalamityMod.NPCs velocitySlownessFactor += baseSlownessFactor; } - if (vaporfied > 0) + if (vaporfied) velocitySlownessFactor += 0.05f; // Divide 1 by the slowness factor to get the amount to slow by. @@ -6196,7 +5002,7 @@ namespace CalamityMod.NPCs shocked = 120; } - if (target.Calamity().snowman) + if (target.Transformation().Type == ModContent.ItemType()) { if (npc.type == NPCID.Demon || npc.type == NPCID.VoodooDemon || npc.type == NPCID.RedDevil) target.AddBuff(BuffType(), 36000); @@ -6204,21 +5010,6 @@ namespace CalamityMod.NPCs switch (npc.type) { - case NPCID.VileSpitEaterOfWorlds: - case NPCID.VileSpit: - - target.AddBuff(BuffType(), 180); - if (Main.rand.NextBool(10)) - target.AddBuff(BuffID.Weak, 3600); - else if (Main.rand.NextBool(5)) - target.AddBuff(BuffID.Weak, 720); - else if (Main.rand.NextBool(2)) - target.AddBuff(BuffID.Weak, 120); - else - target.AddBuff(BuffID.Weak, 60); - - break; - case NPCID.DevourerHead: case NPCID.FaceMonster: target.AddBuff(BuffID.Weak, 180); @@ -6234,28 +5025,10 @@ namespace CalamityMod.NPCs target.AddBuff(BuffID.BrokenArmor, 300); break; - case NPCID.PossessedArmor: - target.AddBuff(BuffID.Cursed, 60); - break; - - case NPCID.Ghost: - case NPCID.PirateGhost: - target.AddBuff(BuffID.Cursed, 60); - target.AddBuff(BuffID.Silenced, 180); - break; - - case NPCID.ChaosElemental: - target.AddBuff(BuffID.Silenced, 180); - break; - case NPCID.IlluminantBat: target.AddBuff(BuffID.Confused, 120); break; - case NPCID.IlluminantSlime: - target.AddBuff(BuffID.Slow, 180); - break; - case NPCID.Piranha: target.AddBuff(BuffID.Bleeding, 180); break; @@ -6278,60 +5051,17 @@ namespace CalamityMod.NPCs target.AddBuff(BuffType(), 120); break; - case NPCID.EyeofCthulhu: - if (npc.ai[0] > 2f) - target.AddBuff(BuffID.Bleeding, 180); - break; - - case NPCID.WallofFlesh: - target.AddBuff(BuffID.Bleeding, 300); - break; - - case NPCID.Spazmatism: - if (npc.ai[0] != 1f && npc.ai[0] != 2f && npc.ai[0] != 0f) - target.AddBuff(BuffType(), 180); - break; - - case NPCID.SkeletronPrime: - if (npc.ai[1] == 1f || npc.ai[1] == 2f) - target.AddBuff(BuffType(), 180); - break; - - case NPCID.PrimeSaw: - target.AddBuff(BuffType(), 120); - break; - - case NPCID.Plantera: - if (npc.life < npc.lifeMax / 2) - target.AddBuff(BuffID.Poisoned, 360); - break; - - case NPCID.PlanterasTentacle: - target.AddBuff(BuffID.Poisoned, 180); - break; - case NPCID.Golem: - target.AddBuff(BuffType(), 480); + if (CalamityWorld.revenge) + target.AddBuff(BuffType(), 480); break; case NPCID.GolemHead: case NPCID.GolemHeadFree: case NPCID.GolemFistRight: case NPCID.GolemFistLeft: - target.AddBuff(BuffType(), 240); - break; - - case NPCID.DukeFishron: - target.AddBuff(BuffType(), 180); - break; - - case NPCID.AncientLight: - target.AddBuff(BuffType(), 120); - break; - - case NPCID.HallowBoss: - if (NPC.ShouldEmpressBeEnraged()) - target.AddBuff(BuffType(), 360); + if (CalamityWorld.revenge) + target.AddBuff(BuffType(), 240); break; case NPCID.BloodNautilus: @@ -6358,20 +5088,8 @@ namespace CalamityMod.NPCs if (Main.hardMode) { - switch (npc.type) - { - case NPCID.BigBoned: - case NPCID.ShortBones: - case NPCID.AngryBones: - case NPCID.AngryBonesBig: - case NPCID.AngryBonesBigMuscle: - case NPCID.AngryBonesBigHelmet: - target.AddBuff(BuffType(), 120); - break; - - default: - break; - } + if (CalamityNPCTypeSets.AngryBones[npc.type]) + target.AddBuff(BuffType(), 120); if (NPC.downedPlantBoss) { @@ -6468,7 +5186,7 @@ namespace CalamityMod.NPCs { CalamityPlayer modPlayer = player.Calamity(); if (modPlayer.camper && !player.StandingStill()) - modifiers.SourceDamage *= 0.1f; + modifiers.SourceDamage *= 0.5f; if (IsArmored()) //Hide combat text so we can draw our own for armored NPCs { @@ -6476,22 +5194,30 @@ namespace CalamityMod.NPCs } // True melee resists - if (EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper || PerforatorWormIDList.Includes(npc.type) || - AquaticScourgeIDList.Includes(npc.type) || DestroyerIDList.Includes(npc.type) || AstrumDeusIDList.Includes(npc.type) || - StormWeaverIDList.Includes(npc.type) || ThanatosIDList.Includes(npc.type) || npc.type == NPCType() || - npc.type == NPCType() || npc.type == NPCType() || npc.type == NPCType()) + if (item.CountsAsClass() && item.type != ItemType()) { - float damageMult = ThanatosIDList.Includes(npc.type) ? 0.35f : npc.type == NPCType() ? 0.8f : 0.5f; - if (item.CountsAsClass() && item.type != ItemType()) - modifiers.SourceDamage *= damageMult; + float damageMult = 1f; + if (npc.type == NPCType()) + damageMult = 0.8f; + else if (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || npc.type == NPCID.Creeper || npc.type == NPCType()) + damageMult = 0.75f; + else if (CalamityNPCTypeSets.Perforators.Contains(npc.type) || CalamityNPCTypeSets.AquaticScourge.Contains(npc.type) || CalamityNPCTypeSets.Destroyer.Contains(npc.type) || + CalamityNPCTypeSets.Ravager.Contains(npc.type) || CalamityNPCTypeSets.AstrumDeus.Contains(npc.type) || CalamityNPCTypeSets.StormWeaver.Contains(npc.type) || + npc.type == NPCType() || npc.type == NPCType()) + damageMult = 0.5f; + else if (CalamityNPCTypeSets.Thanatos.Contains(npc.type)) + damageMult = 0.35f; + + modifiers.SourceDamage *= damageMult; } } #endregion #region Modify Hit By Projectile public static bool DisableMultWhipTag = false; - //this bool does nothing on this branch, its just here so that CalTestHelpers doesn't crash searching for it - //if you want to mess with this, please do so in the summoner branch - Shade + //this bool does nothing on the main branch, its just here so that CalTestHelpers doesn't crash searching for it + //if you want to mess with this to test whips, please do so in the summoner branch - Shade + public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref NPC.HitModifiers modifiers) { Player player = Main.player[projectile.owner]; @@ -6625,58 +5351,66 @@ namespace CalamityMod.NPCs if (!projectile.npcProj && !projectile.trap) { - // Plague Reaper deals 1.1x damage to Plagued enemies - if (projectile.CountsAsClass() && modPlayer.plagueReaper && pFlames > 0) - modifiers.SourceDamage *= 1.1f; + // Plague Reaper deals extra damage to Plagued enemies + if (projectile.CountsAsClass() && modPlayer.plagueReaper && plague) + modifiers.SourceDamage *= PlagueReaperMask.SetBonusPlaguedRangedDamageMult; // True Vulnerability Hex causes enemies to take 1.15x damage, 2.5x from Calamity itself - if (trueVulnerabilityHex > 0) - modifiers.SourceDamage *= (projectile.type == ProjectileType() && projectile.ai[1] == 1f) ? 2.5f : 1.15f; - } - - // Any weapons that shoot projectiles from anywhere other than the player's center aren't affected by point-blank shot damage boost. - if (!Main.player[projectile.owner].ActiveItem().IsAir && Main.player[projectile.owner].ActiveItem().Calamity().canFirePointBlankShots && projectile.CountsAsClass()) - { - if (projectile.Calamity().pointBlankShotDuration > 0 && projectile.Calamity().pointBlankShotDistanceTravelled < CalamityGlobalProjectile.PointBlankShotDistanceLimit) - { - float pointBlankShotDurationRatio = projectile.Calamity().pointBlankShotDuration / (float)CalamityGlobalProjectile.DefaultPointBlankDuration; - float pointBlankShotDistanceRatio = 1f - projectile.Calamity().pointBlankShotDistanceTravelled / CalamityGlobalProjectile.PointBlankShotDistanceLimit; - float pointBlankDamageRatio = (pointBlankShotDurationRatio < pointBlankShotDistanceRatio ? pointBlankShotDurationRatio : pointBlankShotDistanceRatio) * 0.25f; - float pointBlankShotDamageMultiplier = 1f + pointBlankDamageRatio; - modifiers.SourceDamage *= pointBlankShotDamageMultiplier; - projectile.Calamity().pointBlankShotDuration = 0; - } + if (trueVulnerabilityHex) + modifiers.SourceDamage *= (projectile.type == ProjectileType() && projectile.ai[1] == 255f) ? 2.5f : 1.15f; } // Apply balancing resists/vulnerabilities. BalancingChangesManager.ApplyFromProjectile(npc, ref modifiers, projectile); - if (GrenadeResistIDList.Includes(projectile.type)) + if (CalamityProjectileSets.ResistedExplosiveProjectile[projectile.type]) { // Eater of Worlds has a vanilla resist in Expert+, this gives it to him in Normal mode // Note that Calamity reduces the vanilla resist from 80% to 60% - bool hasResist = EaterOfWorldsIDList.Includes(npc.type) && !Main.expertMode; + bool hasResist = CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) && !Main.expertMode; // Add a resist for BoC's creepers and Prehardmode worm bosses - if (npc.type == NPCID.Creeper || DesertScourgeIDList.Includes(npc.type) || PerforatorWormIDList.Includes(npc.type)) + if (npc.type == NPCID.Creeper || CalamityNPCTypeSets.DesertScourge.Contains(npc.type) || CalamityNPCTypeSets.Perforators.Contains(npc.type)) hasResist = true; if (hasResist) - modifiers.SourceDamage *= 0.4f; + modifiers.SourceDamage *= 0.33f; } if (modPlayer.camper && !player.StandingStill()) - modifiers.SourceDamage *= 0.1f; + modifiers.SourceDamage *= 0.5f; if ((projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) && (player.ownedProjectileCounts[ProjectileType()] > 0 || player.ownedProjectileCounts[ProjectileType()] > 0 || (player.Calamity().rOfResilienceCooldown == 0 && player.HeldItem.type == ItemType()))) modifiers.SourceDamage *= 0.1f; + //Doze apr-6-2025: with the summon tag system we now have this is unnececcessary and very likely causes issues on MP, so i'm commenting it out for the time being. Once further testing is done, delete it entirely. + //Delete ardor blososm sparks and buff if hit by something that isnt a minion or sentry while not having Ardor Blossom Star in hand + /*if (npc.HasBuff() && player.HeldItem.type != ModContent.ItemType() && !projectile.minion && !ProjectileID.Sets.MinionShot[projectile.type] && !projectile.sentry) + { + npc.RequestBuffRemoval(ModContent.BuffType()); + //Remove all embers from this enemy + for (int k = 0; k < Main.maxProjectiles; k++) + { + if (Main.projectile[k].active && Main.projectile[k].type == ModContent.ProjectileType() && Main.projectile[k].ai[0] == 1f && Main.projectile[k].ai[1] == npc.whoAmI && Main.projectile[k].owner == player.whoAmI) + Main.projectile[k].Kill(); + } + }*/ + //Handle summon tag effects if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) - EditWhipTagDamage(projectile, npc, ref modifiers); + { + EditSummonTagDamage(projectile, npc, ref modifiers); + } + + } - #endregion + #endregion #region OnHitBy overrides public override void OnHitByProjectile(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) { + if (projectile.minion || ProjectileID.Sets.MinionShot[projectile.type] || projectile.sentry || ProjectileID.Sets.SentryShot[projectile.type]) + { + SummonTagOnHitEffects(npc, projectile, hit, damagedone); + } + if (IsArmored()) { CombatText.NewText(npc.Hitbox, Color.Gray, damagedone, hit.Crit); @@ -6701,75 +5435,88 @@ namespace CalamityMod.NPCs } } + #endregion - #region Whip Tag - // Make whip tags multiplicative, by effectively reversing the process done to it - private void EditWhipTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) + #region Summon Tag + //doze 03-15-2025: A full refactor of the summon tag system to make it easier to use and more flexible. Ping me with any questions. + private void EditSummonTagDamage(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers) { - // Don't make it run through the index if it's a trap - if (proj.npcProj || proj.trap) + if (proj.npcProj || proj.trap || proj.owner == -1) // don't run on non-player-owned projectiles. return; + var player = Main.player[proj.owner]; + var modPlayer = player.Calamity(); + + float critChance = modPlayer.bonusCritTag; float TagDamageMult = ProjectileID.Sets.SummonTagDamageMultiplier[proj.type]; + + TagDamageMult += modPlayer.bonusMultTag; + modifiers.FlatBonusDamage += modPlayer.bonusFlatTag; + for (int i = 0; i < NPC.maxBuffs; i++) { if (npc.buffTime[i] >= 1) { - switch (npc.buffType[i]) + int type = npc.buffType[i]; + if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) { - case BuffID.BlandWhipEnemyDebuff: // Leather Whip - modifiers.FlatBonusDamage += -4f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.DurendalTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.ThornWhipNPCDebuff: // Snapthorn - modifiers.FlatBonusDamage += -6f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.SnapthornTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.BoneWhipNPCDebuff: // Spinal Tap - modifiers.FlatBonusDamage += -7f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.SpinalTapTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.FlameWhipEnemyDebuff: // Firecracker - modifiers.ScalingBonusDamage += (BalancingConstants.FirecrackerExplosionDamageMultiplier - 2.75f) * TagDamageMult; - break; - case BuffID.CoolWhipNPCDebuff: // Cool Whip - modifiers.FlatBonusDamage += -6f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.CoolWhipTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.SwordWhipNPCDebuff: // Durendal - modifiers.FlatBonusDamage += -9f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.DurendalTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.ScytheWhipEnemyDebuff: // Dark Harvest - modifiers.FlatBonusDamage += -10f * TagDamageMult; - break; - case BuffID.MaceWhipNPCDebuff: // Morning Star - modifiers.FlatBonusDamage += -8f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.MorningStarTagDamageMultiplier - 1f) * TagDamageMult; - break; - case BuffID.RainbowWhipNPCDebuff: // Kaleidoscope - modifiers.FlatBonusDamage += -20f * TagDamageMult; - modifiers.ScalingBonusDamage += (BalancingConstants.KaleidoscopeTagDamageMultiplier - 1f) * TagDamageMult; - break; + tag.TagModifyHitEffects(proj, npc, ref modifiers, ref TagDamageMult, ref critChance); } } } - //BuffType cannot be used in switch case, so that has to be handled outside of it - //Verify that the owner of the proj has psc state higher or equal to psc buffs - if (npc.HasBuff() && Main.player[proj.owner].Calamity().pscState >= (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Buffs) + + //For the vanilla Monk/Shinobi armor critting with Lightning Auras. In vanilla it doesn't stack additively but frankly I do not care. It's not like aura is that good anyway. + if (proj.type == ProjectileID.DD2LightningAuraT1 || proj.type == ProjectileID.DD2LightningAuraT2 || proj.type == ProjectileID.DD2LightningAuraT3) { - var empowered = Main.player[proj.owner].Calamity().pscState == (int)ProfanedSoulCrystal.ProfanedSoulCrystalState.Empowered; - //20% is balanced for non empowered, while 40% helps ensure psc remains balanced at empowered tier - //Some PSC projectiles receive a reduced amount of benefit from this, for balancing purposes - modifiers.ScalingBonusDamage += (empowered ? 0.4f : 0.2f) * TagDamageMult; - if (!Main.dedServ) + if (player.setMonkT3) { - var color = ProvUtils.GetColorBasedOnEnrage(!Main.dayTime, 0); - float power = Math.Min(npc.height / 100f, 3f); - var position = new Vector2(Main.rand.NextFloat(npc.Left.X, npc.Right.X), Main.rand.NextFloat(npc.Top.Y, npc.Bottom.Y)); - var particle = new FlameParticle(position, 50, 0.25f, power, color * (Main.dayTime ? 1f : 1.25f), color * (Main.dayTime ? 1.25f : 1f)); - GeneralParticleHandler.SpawnParticle(particle); + critChance += 0.25f; // 1/4 chance to crit with Shinobi + } + else if (player.setMonkT2) + { + critChance += 0.166f; // 1/6 chance to crit with Monk + } + } + + //Used to convert all multiplicative tag into crit chance and vice-versa. If both force tag crit and multiplicative are applied, chooses one at random. + if (modPlayer.forceSummonTagCrit && !(modPlayer.forceSummonTagMultiplicative && Main.rand.NextBool())) + { + critChance += modifiers.ScalingBonusDamage.Value; + modifiers.ScalingBonusDamage += -modifiers.ScalingBonusDamage.Value; + + } + else if (modPlayer.forceSummonTagMultiplicative) + { + + modifiers.ScalingBonusDamage += critChance; + critChance = 0; + } + + //currently doesn't support more than 100% crit chance, todo if something does more than +100% tag damage + if (Main.rand.NextFloat() < critChance) + modifiers.SetCrit(); + else + modifiers.DisableCrit(); //This is to prevent Morning Star and Kalei from critting with their vanilla tag effect. If you want a minion/sentry to crit, you *must* make sure to change critChance in this function. + } + + //This is for whip tag effects that run on hit and don't modify the damage of the hit. + private void SummonTagOnHitEffects(NPC npc, Projectile projectile, NPC.HitInfo hit, int damagedone) + { + if (projectile.npcProj || projectile.trap || projectile.owner == -1) // don't run on non-player-owned projectiles. + return; + + Player player = Main.player[projectile.owner]; + + for (int i = 0; i < NPC.maxBuffs; i++) + { + if (npc.buffTime[i] >= 1) + { + int type = npc.buffType[i]; + if (CalamityBuffSets.SummonTagDebuff.TryGetValue(type, out SummonTag tag)) + { + tag.TagOnHit(npc, projectile, hit, damagedone); + } } } } @@ -6778,26 +5525,6 @@ namespace CalamityMod.NPCs #region Check Dead public override bool CheckDead(NPC npc) { - if (npc.type == NPCID.SkeletronPrime) - { - if ((Main.masterMode || BossRushEvent.BossRushActive) && CalamityWorld.revenge) - { - // Kill the other head if he's still alive when this head dies - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC nPC = Main.npc[i]; - if (nPC.active && nPC.type == NPCType() && nPC.life > 0) - { - nPC.life = 0; - nPC.HitEffect(); - nPC.checkDead(); - nPC.active = false; - nPC.netUpdate = true; - } - } - } - } - if (npc.lifeMax > 1000 && npc.type != NPCID.DungeonSpirit && npc.type != NPCType() && npc.type != NPCType() && @@ -6862,7 +5589,7 @@ namespace CalamityMod.NPCs { if (Main.netMode != NetmodeID.MultiplayerClient) { - int slimeAmt = Main.getGoodWorld ? Main.rand.Next(6) + 10 : Main.rand.Next(2) + 2; // 2 to 3 extra + int slimeAmt = Main.rand.Next(2) + 2; // 2 to 3 extra for (int s = 0; s < slimeAmt; s++) { int slime = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)(npc.position.Y + npc.height), NPCID.BlueSlime, 0, 0f, 0f, 0f, 0f, 255); @@ -6870,8 +5597,8 @@ namespace CalamityMod.NPCs npc2.SetDefaults(NPCID.BabySlime); npc2.velocity.X = npc.velocity.X * 2f; npc2.velocity.Y = npc.velocity.Y; - npc2.velocity.X += Main.rand.Next(-20, 20) * (Main.getGoodWorld ? 0.5f : 0.1f) + s * npc.direction * (Main.getGoodWorld ? 0.5f : 0.3f); - npc2.velocity.Y -= Main.rand.Next(0, 10) * (Main.getGoodWorld ? 0.5f : 0.1f) + s; + npc2.velocity.X += Main.rand.Next(-20, 20) * 0.1f + s * npc.direction * 0.3f; + npc2.velocity.Y -= Main.rand.Next(10) * 0.1f + s; npc2.ai[0] = -1000 * Main.rand.Next(3); if (Main.dedServ && slime < Main.maxNPCs) @@ -6915,7 +5642,7 @@ namespace CalamityMod.NPCs } // Plague debuff on kill effect - if (pFlames > 0 && npc.life <= 0 && npc.realLife == -1) + if (plague && npc.life <= 0 && npc.realLife == -1) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -6948,6 +5675,148 @@ namespace CalamityMod.NPCs } } } + + if (scionsCurioEffected && npc.life <= 0 && npc.realLife == -1) + { + for (int g = 0; g < 17; g++) + { + int DustID = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(npc.Center, DustID); + dust.scale = Main.rand.NextFloat(1.1f, 1.35f); + dust.velocity = new Vector2(9, 9).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.9f) + Vector2.UnitY * -10; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Green : Color.Chartreuse; + dust.fadeIn = Main.rand.NextFloat(0.2f, 2f); + } + Particle blastvfx = new CustomPulse(npc.Center, Vector2.Zero, Color.Chartreuse * 0.9f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.15f, 10, true); + GeneralParticleHandler.SpawnParticle(blastvfx); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.5f, Pitch = Main.rand.NextFloat(0.5f, 0.7f), MaxInstances = 6 }, npc.Center); + + int explosionDamage = 12; + float highestDamage = 0; + Player Owner = null; + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + + float playerRangedDamage = player.GetTotalDamage(DamageClass.Ranged).ApplyTo(explosionDamage); + if (playerRangedDamage > highestDamage && player.Calamity().scionsCurio) + { + highestDamage = playerRangedDamage; + Owner = player; + } + } + + // Create Blast + float blastSize = 115; + float minMultiplier = 0.5f; + int hitsToMinMult = 5; + int debuff = ModContent.BuffType(); + int debuffTime = 300; + Projectile blast = Projectile.NewProjectileDirect((Owner != null ? Owner.GetSource_FromThis() : npc.GetSource_FromThis()), npc.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(highestDamage), 7, (Owner != null ? Owner.whoAmI : -1), blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; + } + + bool fakeAbbadon = false; // Will be used for abbadon revamp + if (fakeAbbadon && npc.life <= 0 && npc.realLife == -1) + { + float areaOfEffect = 500; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Color color1 = Color.Crimson; + Color color2 = Color.OrangeRed; + for (int r = 0; r < Main.maxNPCs; r++) + { + NPC target = Main.npc[r]; + + if (target != null && target.IsAnEnemy(true, true) && Vector2.Distance(target.Center, npc.Center) <= areaOfEffect) + { + if (target.life <= 0) + { + target.Calamity().scionsCurioEffected = true; + } + else + { + for (int g = 0; g < 7; g++) + { + int DustID = ModContent.DustType(); + Dust dust2 = Dust.NewDustDirect(target.Center, target.width, target.height, DustID); + dust2.scale = Main.rand.NextFloat(0.6f, 0.75f); + dust2.velocity = new Vector2(4, 4).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 0.8f); + dust2.noGravity = true; + dust2.color = Main.rand.NextBool() ? color2 : color1; + } + + Vector2 start = npc.Center; + Vector2 end = target.Center; + Color color = Main.rand.NextBool() ? color2 : color1; + + Vector2 lerpVel = Vector2.Lerp(start, end, 0.5f); + float scale = 0.015f; + Particle spark = new CustomSpark(lerpVel, npc.SafeDirectionTo(target.Center), "CalamityMod/Particles/BloomLineThick", false, 18, scale, color, new Vector2(1.2f, (Utils.Distance(start, end) * 0.034f)), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + for (int u = 0; u < 2; u++) + { + Vector2 pos = start; + if (u == 0) pos = end; + Particle spark2 = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 18, 0.55f, color, Vector2.One, true, true, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + float distance = Vector2.Distance(target.Center, npc.Center); + int maxDusts = (int)distance; + int dustCaper = 60; + int dustDivisor = maxDusts / dustCaper; + if (dustDivisor < 2) + dustDivisor = 2; + + Vector2 dustLineStart = target.Center; + Vector2 dustLineEnd = npc.Center; + Vector2 currentDustPos = default; + Vector2 dustVel = npc.Center.DirectionTo(target.Center); + int startingPoint = Main.rand.Next(0, 400 + 1); + Vector2 lastDustPos = default; + for (int i = 0; i < maxDusts; i++) + { + float sine = (float)Math.Sin((i + startingPoint) * 0.425f / MathHelper.Pi); + float endStartFade = Math.Min(Utils.GetLerpValue(maxDusts * 0.8f, 0, i), Utils.GetLerpValue(0 + maxDusts * 0.2f, maxDusts, i)); + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 6 * sine * endStartFade; + if (i == 0) + lastDustPos = currentDustPos; + + /*Dust dustLine = Dust.NewDustPerfect(currentDustPos, ModContent.DustType()); + dustLine.position = currentDustPos; + dustLine.velocity = Vector2.Zero; + dustLine.noGravity = true; + dustLine.scale = 1.5f * Math.Max(endStartFade, 0.7f); + dustLine.fadeIn = Main.rand.NextFloat() * 2f; + dustLine.color = Color.Lerp(color1, color2, Utils.GetLerpValue(0, maxDusts, i));*/ + + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 55 * sine * endStartFade; + Dust dustLinger = Dust.NewDustPerfect(currentDustPos, ModContent.DustType()); + dustLinger.position = currentDustPos; + dustLinger.velocity = currentDustPos.DirectionTo(lastDustPos) * (Main.rand.NextBool(5) ? 4f : Main.rand.NextFloat(0.2f, 0.8f)); + dustLinger.noGravity = true; + dustLinger.scale = Main.rand.NextFloat(0.8f, 1f) * 1.5f; + dustLinger.fadeIn = Main.rand.NextFloat(0.6f, 1f) * 4; + dustLinger.color = Color.Lerp(color1, color2, Utils.GetLerpValue(0, maxDusts, i)); + + lastDustPos = currentDustPos; + } + + target.Calamity().scionsCurioEffected = true; + if (target.Calamity().irradiated) + target.buffTime[target.FindBuffIndex(ModContent.BuffType())] += 90; + else + target.AddBuff(BuffType(), 180); + } + } + } + } + } } #endregion @@ -7016,7 +5885,13 @@ namespace CalamityMod.NPCs if (CalamityWorld.death && Main.bloodMoon) { spawnRate = (int)(spawnRate * 0.25); - maxSpawns = (int)(maxSpawns * 10f); + maxSpawns = (int)(maxSpawns * 5f); + } + + if (CalamityWorld.death && player.ZoneGraveyard) + { + spawnRate = (int)(spawnRate * 0.6667); + maxSpawns = (int)(maxSpawns * 1.5f); } if (NPC.LunarApocalypseIsUp) @@ -7032,27 +5907,18 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge) spawnRate = (int)(spawnRate * 0.85); - if (Main.SceneMetrics.WaterCandleCount > 0) - spawnRate = (int)(spawnRate * 0.8888); // On top of 0.75 = 0.6666x (1.33x -> 1.5x spawn rate) - if (player.enemySpawns) // Battle Potion - { - spawnRate = (int)(spawnRate * 0.8); // On top of 0.5 = 0.4x (2x -> 2.5x spawn rate) - maxSpawns = (int)(maxSpawns * 1.25f); // On top of 2 (2x -> 2.5x max spawns) - } if (player.Calamity().chaosCandle) { - spawnRate = (int)(spawnRate * 0.4); // 2.5x spawn rate - maxSpawns = (int)(maxSpawns * 2.5f); + spawnRate = (int)(spawnRate * 0.5); // 2x spawn rate + maxSpawns = (int)(maxSpawns * 2f); } if (player.Calamity().zerg) { - spawnRate = (int)(spawnRate * 0.2); // 5x spawn rate - maxSpawns = (int)(maxSpawns * 5f); + spawnRate = (int)(spawnRate * 0.25); // 4x spawn rate + maxSpawns = (int)(maxSpawns * 4f); } // Reductions - if (Main.SceneMetrics.PeaceCandleCount > 0) - spawnRate = (int)(spawnRate * 1.0989); // On top of 1.3 = 1.4286x (0.77x -> 0.7x spawn rate) if (player.Calamity().tranquilityCandle) { spawnRate = (int)(spawnRate * 1.6666); // 0.6x spawn rate @@ -7060,8 +5926,8 @@ namespace CalamityMod.NPCs } if (player.Calamity().zen || (CalamityServerConfig.Instance.ForceTownSafety && player.townNPCs > 1f && Main.expertMode)) { - spawnRate = (int)(spawnRate * 3.3333); // 0.3x spawn rate - maxSpawns = (int)(maxSpawns * 0.3f); + spawnRate = (int)(spawnRate * 2.5); // 0.4x spawn rate + maxSpawns = (int)(maxSpawns * 0.4f); } if (player.Calamity().isNearbyBoss && CalamityServerConfig.Instance.BossZen) { @@ -7187,8 +6053,8 @@ namespace CalamityMod.NPCs continue; WeightedRandom pool = new WeightedRandom(); - pool.Add(NPCID.None, 0f); - pool.Add(NPCType(), 0.25f); + pool.Add(NPCID.None, 1f); + pool.Add(NPCType(), 0.05f); int typeToSpawn = pool.Get(); if (typeToSpawn != NPCID.None) @@ -7244,13 +6110,6 @@ namespace CalamityMod.NPCs pool[NPCID.ChaosElemental] = SpawnCondition.Cavern.Chance * 0.125f; } - // Replace vanilla Lava Slimes with Calamity Lava Slimes to avoid annoying lava drops - if (spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone && CalamityServerConfig.Instance.RemoveLavaDropsFromLavaSlimes && Main.expertMode) - { - pool.Add(NPCType(), SpawnCondition.Underworld.Chance); - pool.Remove(NPCID.LavaSlime); - } - // Spawn Green Jellyfish in prehm and Blue Jellyfish in hardmode if (spawnInfo.Player.ZoneRockLayerHeight && spawnInfo.Water && !calamityBiomeZone) { @@ -7289,8 +6148,16 @@ namespace CalamityMod.NPCs } } - // 12JUL2023: Ozzatron: what does this do - // 27SEP2023: Fabsol: disables vanilla spawns "a pool of [0] indicates vanilla spawning" + // Increased Maggot Zombie,the Groom, and the Bride spawn rates in a Graveyard + if (spawnInfo.Player.ZoneGraveyard) + { + pool[NPCID.MaggotZombie] = SpawnCondition.OverworldNightMonster.Chance * 0.2f; + pool[NPCID.TheGroom] = SpawnCondition.OverworldNightMonster.Chance * 0.035f; + pool[NPCID.TheBride] = SpawnCondition.OverworldNightMonster.Chance * 0.035f; + + } + + // Disable vanilla spawns while in the Brimstone Crag if (calamityBiomeZone) { pool[0] = 0f; @@ -7384,11 +6251,6 @@ namespace CalamityMod.NPCs // If the doll is active, Voodoo Demons cannot spawn (via modded means). if (voodooDemonDollActive) pool.Remove(NPCID.VoodooDemon); - // Otherwise, if it's pre-Hardmode, provide a modded spawn entry that makes them much more common. - else if (!Main.hardMode && spawnInfo.Player.ZoneUnderworldHeight && !calamityBiomeZone) - { - pool[NPCID.VoodooDemon] = SpawnCondition.Underworld.Chance * 0.15f; - } } #endregion @@ -7450,8 +6312,14 @@ namespace CalamityMod.NPCs { if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) - npc.frameCounter = 0D; + // Used to force the head to look to the sides for the laser spread attack + if (npc.type == NPCID.GolemHead && (npc.ai[0] == 2f || npc.ai[0] == 3f)) + { + if (npc.localAI[1] == 1f) + npc.frame.Y = frameHeight * 2; + else + npc.frame.Y = frameHeight * 4; + } } // Increment the bestiary worm timer when hovering over the NPC or having their entry open. Pauses otherwise if (npc.IsABestiaryIconDummy) @@ -7463,15 +6331,18 @@ namespace CalamityMod.NPCs bestiaryWormTimer = 0; } } + + } // Debuff visuals. Alphabetical order as per usual, please + // TODO - Merge these into DebuffData public override void DrawEffects(NPC npc, ref Color drawColor) { if (!npc.canDisplayBuffs) return; - if (absorberAffliction > 0) + if (absorberAffliction) AbsorberAffliction.DrawEffects(npc, ref drawColor); // Rancor's burn effect @@ -7488,58 +6359,58 @@ namespace CalamityMod.NPCs } } - if (astralInfection > 0) + if (astralInfection) AstralInfectionDebuff.DrawEffects(npc, ref drawColor); // Brimstone Flames and Demonshade Enrage set bonus share the same visual effects // TODO -- change this when Demonshade is reworked - if (bFlames > 0 || npc.HasBuff()) + if (brimstoneFlames || npc.HasBuff()) BrimstoneFlames.DrawEffects(npc, ref drawColor); - if (demonicFlames > 0) + if (demonicFlames) DemonicFlames.DrawEffects(npc, ref drawColor); - if (bBlood > 0) + if (burningBlood ) BurningBlood.DrawEffects(npc, ref drawColor); - if (brainRot > 0) + if (brainRot) BrainRot.DrawEffects(npc, ref drawColor); - if (cDepth > 0) + if (crushDepth) CrushDepth.DrawEffects(npc, ref drawColor); - if (hPressure > 0) + if (hadopelagicPressure) HadopelagicPressure.DrawEffects(npc, ref drawColor); - if (dragonFire > 0) + if (dragonFire) Dragonfire.DrawEffects(npc, ref drawColor); - if (vermillionFlux > 0) + if (vermillionFlux) VermillionFlux.DrawEffects(npc, ref drawColor); - if (auricRebuke > 0) + if (auricRebuke) AuricRebuke.DrawEffects(npc, ref drawColor); - if (staticDischarge > 0) + if (staticDischarge) StaticDischarge.DrawEffects(npc, ref drawColor); - if (elementalMix > 0) + if (elementalMix) ElementalMix.DrawEffects(npc, ref drawColor); // Eutrophication and Temporal Sadness share the same visual effects - if (eutrophication > 0 || tSad > 0) + if (eutrophication || temporalSadness) Eutrophication.DrawEffects(npc, ref drawColor); - if (gsInferno > 0) + if (godSlayerInferno) GodSlayerInferno.DrawEffects(npc, ref drawColor); // Holy Flames and Banishing Fire share the same visual effects - if (hFlames > 0 || banishingFire > 0) + if (holyFlames || banishingFire) HolyFlames.DrawEffects(npc, ref drawColor); - if (heavybleeding > 0) + if (heavyBleeding) HeavyBleeding.DrawEffects(npc, ref drawColor); - + if (hyperiusFxTimer > 0) { float rate = (Main.GlobalTimeWrappedHourly * 5); @@ -7578,7 +6449,7 @@ namespace CalamityMod.NPCs } } - if (laceration > 0) + if (laceration) Laceration.DrawEffects(npc, ref drawColor); if (laserBurnTimer > 0) @@ -7604,34 +6475,34 @@ namespace CalamityMod.NPCs } // These draw effects do not include Miracle Blight's shader - if (miracleBlight > 0) + if (miracleBlight) MiracleBlight.DrawEffects(npc, ref drawColor); - if (nightwither > 0) + if (nightwither) Nightwither.DrawEffects(npc, ref drawColor); - if (pearlAura > 0) + if (pearlAura) PearlAura.DrawEffects(npc, ref drawColor); - if (pFlames > 0) // Plague debuff + if (plague) // Plague debuff Plague.DrawEffects(npc, ref drawColor); - if (relicOfResilienceWeakness > 0) + if (relicOfResilienceWeakness) ProfanedWeakness.DrawEffects(npc, ref drawColor); - if (rTide > 0) + if (riptide) RiptideDebuff.DrawEffects(npc, ref drawColor); - + if (somaShredStacks > 0 && !Main.dedServ) Shred.DrawEffects(npc, this, ref drawColor); - - if (sulphurPoison > 0) + + if (sulphurPoison) SulphuricPoisoning.DrawEffects(npc, ref drawColor); - if (trueVulnerabilityHex > 0) + if (trueVulnerabilityHex) TrueVulnerabilityHex.DrawEffects(npc, ref drawColor); - if (vaporfied > 0) + if (vaporfied) Vaporfied.DrawEffects(npc, ref drawColor); if (veriumDoomTimer > 0) @@ -7646,33 +6517,18 @@ namespace CalamityMod.NPCs } } - if (voidfrost > 0) + if (voidfrost) Voidfrost.DrawEffects(npc, ref drawColor); // TODO -- These debuff visuals cannot be moved because they correspond to vanilla debuffs - if (electrified > 0) + if (electrified) { if (Main.rand.NextBool()) { Dust.NewDustDirect(npc.position, npc.width, npc.height, DustID.Electric, Main.rand.NextFloat(-2f, 2f), Main.rand.NextFloat(-2f, 2f), 0, default, 0.35f); } } - if (slowed > 0) - { - if (Main.rand.Next(5) < 4) - { - int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, DustID.SpookyWood, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 225, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.1f; - Main.dust[dust].velocity.Y += 0.25f; - if (Main.rand.NextBool()) - { - Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; - } - } - } - if (webbed > 0) + if (webbed) { if (Main.rand.Next(5) < 4) { @@ -7706,35 +6562,35 @@ namespace CalamityMod.NPCs // Calamity debuff coloring effects // These are in order of precedence because they override each other. - if (gState > 0) + if (glacialState) drawColor = Color.Cyan; - else if (auricRebuke > 0) + else if (auricRebuke) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkBlue, Color.White, Utils.Remap(npc.width, 30, 400, 0.4f, 0.7f, true)) : Color.White; } - else if (vermillionFlux > 0) + else if (vermillionFlux) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.DarkRed, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } - else if (electrified > 0) + else if (electrified) { int scaleFactor = (int)(Utils.Remap(npc.width, 30, 400, 5, 15, true)); drawColor = Main.rand.NextBool(scaleFactor) ? Color.Lerp(Color.SlateGray, Color.White, Utils.Remap(npc.width, 30, 400, 0, 0.7f, true)) : Color.White; } - else if (absorberAffliction > 0) + else if (absorberAffliction) drawColor = Color.DarkSeaGreen; - else if (marked > 0 || vaporfied > 0) + else if (markedForDeath || vaporfied) drawColor = Color.Fuchsia; - else if (pearlAura > 0) + else if (pearlAura) drawColor = new Color(185, 185, 255); - else if (timeSlow > 0 || tesla > 0) + else if (timeDistortion || galvanicCorrosion) drawColor = Color.Aquamarine; } @@ -7744,7 +6600,7 @@ namespace CalamityMod.NPCs if (npc.IsABestiaryIconDummy) return null; - if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (Main.LocalPlayer.Calamity().trippy || (npc.type == NPCID.KingSlime && Main.zenithWorld)) return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Main.DiscoR); if (npc.type == NPCID.KingSlime && CalamityWorld.death) @@ -7761,9 +6617,6 @@ namespace CalamityMod.NPCs if (npc.HasBuff()) return new Color(200, 50, 50, 255 - npc.alpha); - if (npc.Calamity().kamiFlu > 0 && !KamiDebuffColorImmuneList.Includes(npc.type)) - return new Color(51, 197, 108, 255 - npc.alpha); - if (npc.type == NPCID.VileSpit || npc.type == NPCID.VileSpitEaterOfWorlds) return new Color(150, 200, 0, npc.alpha); @@ -7773,56 +6626,58 @@ namespace CalamityMod.NPCs return null; } + + //TODO - Make this a part of DebuffData public static List<(string, Predicate)> moddedDebuffTextureList = new List<(string, Predicate)> { // All Calamity DoTs in alphabetical order - ("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff", NPC => NPC.Calamity().astralInfection > 0), - ("CalamityMod/Buffs/DamageOverTime/AuricRebuke", NPC => NPC.Calamity().auricRebuke > 0), - ("CalamityMod/Buffs/DamageOverTime/BanishingFire", NPC => NPC.Calamity().banishingFire > 0), - ("CalamityMod/Buffs/DamageOverTime/BrainRot", NPC => NPC.Calamity().brainRot > 0), - ("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames", NPC => NPC.Calamity().bFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/DemonicFlames", NPC => NPC.Calamity().demonicFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/BurningBlood", NPC => NPC.Calamity().bBlood > 0), - ("CalamityMod/Buffs/DamageOverTime/CrushDepth", NPC => NPC.Calamity().cDepth > 0), - ("CalamityMod/Buffs/DamageOverTime/Dragonfire", NPC => NPC.Calamity().dragonFire > 0), - ("CalamityMod/Buffs/DamageOverTime/ElementalMix", NPC => NPC.Calamity().elementalMix > 0), - ("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno", NPC => NPC.Calamity().gsInferno > 0), - ("CalamityMod/Buffs/DamageOverTime/HadopelagicPressure", NPC => NPC.Calamity().hPressure > 0), - ("CalamityMod/Buffs/DamageOverTime/HolyFlames", NPC => NPC.Calamity().hFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/Laceration", NPC => NPC.Calamity().laceration > 0), - ("CalamityMod/Buffs/DamageOverTime/HeavyBleeding", NPC => NPC.Calamity().heavybleeding > 0), - ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight > 0), - ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither > 0), - ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().pFlames > 0), - ("CalamityMod/Buffs/DamageOverTime/RiptideDebuff", NPC => NPC.Calamity().rTide > 0), - ("CalamityMod/Buffs/DamageOverTime/SagePoison", NPC => NPC.Calamity().sagePoisonTime > 0), - ("CalamityMod/Buffs/DamageOverTime/ShellfishClaps", NPC => NPC.Calamity().shellfishVore > 0), + ("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff", NPC => NPC.Calamity().astralInfection), + ("CalamityMod/Buffs/DamageOverTime/AuricRebuke", NPC => NPC.Calamity().auricRebuke), + ("CalamityMod/Buffs/DamageOverTime/BanishingFire", NPC => NPC.Calamity().banishingFire), + ("CalamityMod/Buffs/DamageOverTime/BrainRot", NPC => NPC.Calamity().brainRot), + ("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames", NPC => NPC.Calamity().brimstoneFlames), + ("CalamityMod/Buffs/DamageOverTime/DemonicFlames", NPC => NPC.Calamity().demonicFlames), + ("CalamityMod/Buffs/DamageOverTime/BurningBlood", NPC => NPC.Calamity().burningBlood), + ("CalamityMod/Buffs/DamageOverTime/CrushDepth", NPC => NPC.Calamity().crushDepth), + ("CalamityMod/Buffs/DamageOverTime/Dragonfire", NPC => NPC.Calamity().dragonFire), + ("CalamityMod/Buffs/DamageOverTime/ElementalMix", NPC => NPC.Calamity().elementalMix), + ("CalamityMod/Buffs/DamageOverTime/GodSlayerInferno", NPC => NPC.Calamity().godSlayerInferno), + ("CalamityMod/Buffs/DamageOverTime/HadopelagicPressure", NPC => NPC.Calamity().hadopelagicPressure), + ("CalamityMod/Buffs/DamageOverTime/HolyFlames", NPC => NPC.Calamity().holyFlames), + ("CalamityMod/Buffs/DamageOverTime/Laceration", NPC => NPC.Calamity().laceration), + ("CalamityMod/Buffs/DamageOverTime/HeavyBleeding", NPC => NPC.Calamity().heavyBleeding), + ("CalamityMod/Buffs/DamageOverTime/ManaBurn", NPC => NPC.Calamity().manaBurn > 0), + ("CalamityMod/Buffs/DamageOverTime/MiracleBlight", NPC => NPC.Calamity().miracleBlight), + ("CalamityMod/Buffs/DamageOverTime/Nightwither", NPC => NPC.Calamity().nightwither), + ("CalamityMod/Buffs/DamageOverTime/Plague", NPC => NPC.Calamity().plague), + ("CalamityMod/Buffs/DamageOverTime/RiptideDebuff", NPC => NPC.Calamity().riptide), + ("CalamityMod/Buffs/DamageOverTime/SagePoison", NPC => NPC.Calamity().sagePoison), + ("CalamityMod/Buffs/DamageOverTime/ShellfishClaps", NPC => NPC.Calamity().shellfishStaffDebuff), ("CalamityMod/Buffs/DamageOverTime/Shred", NPC => NPC.Calamity().somaShredStacks > 0), - ("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff", NPC => NPC.Calamity().clamDebuff > 0), - ("CalamityMod/Buffs/DamageOverTime/StaticDischarge", NPC => NPC.Calamity().staticDischarge > 0), - ("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning", NPC => NPC.Calamity().sulphurPoison > 0), - ("CalamityMod/Buffs/DamageOverTime/TrueVulnerabilityHex", NPC => NPC.Calamity().trueVulnerabilityHex > 0), - ("CalamityMod/Buffs/DamageOverTime/Vaporfied", NPC => NPC.Calamity().vaporfied > 0), - ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux > 0), - ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost > 0), - ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex > 0), + ("CalamityMod/Buffs/DamageOverTime/SnapClamDebuff", NPC => NPC.Calamity().snapClamDebuff), + ("CalamityMod/Buffs/DamageOverTime/StaticDischarge", NPC => NPC.Calamity().staticDischarge), + ("CalamityMod/Buffs/DamageOverTime/SulphuricPoisoning", NPC => NPC.Calamity().sulphurPoison), + ("CalamityMod/Buffs/DamageOverTime/TrueVulnerabilityHex", NPC => NPC.Calamity().trueVulnerabilityHex), + ("CalamityMod/Buffs/DamageOverTime/Vaporfied", NPC => NPC.Calamity().vaporfied), + ("CalamityMod/Buffs/DamageOverTime/VermillionFlux", NPC => NPC.Calamity().vermillionFlux), + ("CalamityMod/Buffs/DamageOverTime/Voidfrost", NPC => NPC.Calamity().voidfrost), + ("CalamityMod/Buffs/DamageOverTime/VulnerabilityHex", NPC => NPC.Calamity().vulnerabilityHex), // All other important Calamity debuffs, in alphabetical order - ("CalamityMod/Buffs/StatDebuffs/AbsorberAffliction", NPC => NPC.Calamity().absorberAffliction > 0), - ("CalamityMod/Buffs/StatDebuffs/ArmorCrunch", NPC => NPC.Calamity().aCrunch > 0), - ("CalamityMod/Buffs/StatDebuffs/Crumbling", NPC => NPC.Calamity().crumble > 0), - ("CalamityMod/Buffs/StatDebuffs/Eutrophication", NPC => NPC.Calamity().eutrophication > 0), - ("CalamityMod/Buffs/StatDebuffs/GalvanicCorrosion", NPC => NPC.Calamity().tesla > 0), - ("CalamityMod/Buffs/StatDebuffs/GlacialState", NPC => NPC.Calamity().gState > 0), - ("CalamityMod/Buffs/StatDebuffs/Irradiated", NPC => NPC.Calamity().irradiated > 0), - ("CalamityMod/Buffs/StatDebuffs/KamiFlu", NPC => NPC.Calamity().kamiFlu > 0), - ("CalamityMod/Buffs/StatDebuffs/MarkedforDeath", NPC => NPC.Calamity().marked > 0), - ("CalamityMod/Buffs/StatDebuffs/PearlAura", NPC => NPC.Calamity().pearlAura > 0), - ("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness", NPC => NPC.Calamity().relicOfResilienceWeakness > 0), - ("CalamityMod/Buffs/StatDebuffs/TemporalSadness", NPC => NPC.Calamity().tSad > 0), - ("CalamityMod/Buffs/StatDebuffs/TimeDistortion", NPC => NPC.Calamity().timeSlow > 0), - ("CalamityMod/Buffs/StatDebuffs/WhisperingDeath", NPC => NPC.Calamity().wDeath > 0), - ("CalamityMod/Buffs/StatDebuffs/WitherDebuff", NPC => NPC.Calamity().wither > 0), + ("CalamityMod/Buffs/StatDebuffs/AbsorberAffliction", NPC => NPC.Calamity().absorberAffliction), + ("CalamityMod/Buffs/StatDebuffs/ArmorCrunch", NPC => NPC.Calamity().armorCrunch), + ("CalamityMod/Buffs/StatDebuffs/Crumbling", NPC => NPC.Calamity().crumble), + ("CalamityMod/Buffs/StatDebuffs/Eutrophication", NPC => NPC.Calamity().eutrophication), + ("CalamityMod/Buffs/StatDebuffs/GalvanicCorrosion", NPC => NPC.Calamity().galvanicCorrosion), + ("CalamityMod/Buffs/StatDebuffs/GlacialState", NPC => NPC.Calamity().glacialState), + ("CalamityMod/Buffs/StatDebuffs/Irradiated", NPC => NPC.Calamity().irradiated), + ("CalamityMod/Buffs/StatDebuffs/MarkedforDeath", NPC => NPC.Calamity().markedForDeath), + ("CalamityMod/Buffs/StatDebuffs/PearlAura", NPC => NPC.Calamity().pearlAura), + ("CalamityMod/Buffs/StatDebuffs/ProfanedWeakness", NPC => NPC.Calamity().relicOfResilienceWeakness), + ("CalamityMod/Buffs/StatDebuffs/TemporalSadness", NPC => NPC.Calamity().temporalSadness), + ("CalamityMod/Buffs/StatDebuffs/TimeDistortion", NPC => NPC.Calamity().timeDistortion), + ("CalamityMod/Buffs/StatDebuffs/WhisperingDeath", NPC => NPC.Calamity().whisperingDeath), + ("CalamityMod/Buffs/StatDebuffs/WitherDebuff", NPC => NPC.Calamity().wither), }; public override bool PreDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -7855,7 +6710,7 @@ namespace CalamityMod.NPCs } if (npc.type != NPCID.BrainofCthulhu && (npc.type != NPCID.DukeFishron || npc.ai[0] <= 9f) && npc.active) { - if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || NeedsDebuffIconDisplayList.Includes(npc.type))) + if (CalamityClientConfig.Instance.DebuffDisplay && (npc.boss || BossHealthBarManager.MinibossHPBarList.Contains(npc.type) || BossHealthBarManager.OneToMany.ContainsKey(npc.type) || CalamityNPCSets.ForceDrawDebuffDisplay[npc.type])) { List currentDebuffs = new List() { }; @@ -7866,9 +6721,8 @@ namespace CalamityMod.NPCs currentDebuffs.Add(Request(moddedDebuffTextureList[b].Item1).Value); } } - // Vanilla damage over time debuffs - if (electrified > 0) + if (electrified) currentDebuffs.Add(TextureAssets.Buff[BuffID.Electrified].Value); if (npc.onFire) currentDebuffs.Add(TextureAssets.Buff[BuffID.OnFire].Value); @@ -7908,9 +6762,7 @@ namespace CalamityMod.NPCs currentDebuffs.Add(TextureAssets.Buff[BuffID.Confused].Value); if (npc.ichor) currentDebuffs.Add(TextureAssets.Buff[BuffID.Ichor].Value); - if (slowed > 0) - currentDebuffs.Add(TextureAssets.Buff[BuffID.Slow].Value); - if (webbed > 0) + if (webbed) currentDebuffs.Add(TextureAssets.Buff[BuffID.Webbed].Value); if (npc.midas) currentDebuffs.Add(TextureAssets.Buff[BuffID.Midas].Value); @@ -7926,8 +6778,6 @@ namespace CalamityMod.NPCs currentDebuffs.Add(TextureAssets.Buff[BuffID.Slimed].Value); if (npc.drippingSparkleSlime) currentDebuffs.Add(TextureAssets.Buff[BuffID.GelBalloonBuff].Value); - if (npc.markedByScytheWhip) // Dark Harvest whip, the only Whip debuff that has an NPC bool - currentDebuffs.Add(TextureAssets.Buff[BuffID.ScytheWhipEnemyDebuff].Value); // Total amount of elements in the buff list int buffTextureListLength = currentDebuffs.Count(); @@ -7971,6 +6821,33 @@ namespace CalamityMod.NPCs if (currentDebuffs[i] == TextureAssets.Buff[BuffType()].Value) ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, somaShredStacks.ToString(), npc.Center - screenPos - new Vector2(drawPosX, drawPosY + additionalYOffset) + Vector2.One * 4f, Color.Gold, 0f, Vector2.Zero, Vector2.One * Main.UIScale * 0.8f); } + + + // Draw summon tag display. TODO: make it use custom textures provided by SummonTag. + int yOffset = 0; + for (int i = NPC.maxBuffs - 1; i >= 0; i--) + { + if (npc.buffTime[i] > 0) + { + if (CalamityBuffSets.SummonTagDebuff.TryGetValue(npc.buffType[i], out SummonTag tag)) + { + // Fetch the item and its frames + var tex = TextureAssets.Item[tag.TagItem].Value; + Rectangle frame = (Main.itemAnimations[tag.TagItem] == null) ? tex.Frame() : Main.itemAnimations[tag.TagItem].GetFrame(tex); + if (tag.TagTexture != null) + { + tex = tag.TagTexture.Value; + frame = tex.Frame(); + } + + // Draw it accordingly + // This is drawn below the NPC as opposed to above to differentiate from regular debuffs + Vector2 drawPos = npc.Center - screenPos + Vector2.UnitY * (drawPosY + frame.Height * 0.5f + yOffset); + spriteBatch.Draw(tex, drawPos, frame, Color.White, 0f, frame.Size() * 0.5f, 0.75f, SpriteEffects.None, 0f); + yOffset += frame.Height + 4; + } + } + } } } @@ -7978,11 +6855,85 @@ namespace CalamityMod.NPCs if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType() || DestroyerIDList.Includes(npc.type)) + if (CalamityNPCTypeSets.Destroyer.Contains(npc.type)) shouldDrawBool = false; + + // Allows correct frames to draw in Rev+ phases + // GFB can rot for all I care + if (npc.type == NPCID.SkeletronPrime && !NPC.IsMechQueenUp) + { + int frameHeight = TextureAssets.Npc[npc.type].Value.Height / Main.npcFrameCount[npc.type]; + if (npc.ai[1] == 0f || npc.ai[1] == 4f) + { + newAI[2] += 1f; + if (newAI[2] >= 12f) + { + newAI[2] = 0f; + newAI[3] += frameHeight; + + if (newAI[3] / frameHeight >= 2f) + newAI[3] = 0f; + } + } + + // Spinning probe spawn or fly over phase + else if (npc.ai[1] == 5f || npc.ai[1] == 6f) + { + newAI[2] = 0f; + newAI[3] = frameHeight; + } + + // Spinning phase + else + { + newAI[2] = 0f; + newAI[3] = frameHeight * 2; + } + + npc.frame.Y = (int)newAI[3]; + } + + if (npc.type == NPCID.GolemHeadFree) + { + // Draw the head as usual. + Texture2D golemHeadTexture = TextureAssets.Npc[npc.type].Value; + Vector2 headDrawPosition = npc.Center - screenPos; + spriteBatch.Draw(golemHeadTexture, headDrawPosition, npc.frame, npc.GetAlpha(drawColor), 0f, npc.frame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the eyes. The way vanilla handles this is hardcoded bullshit that cannot handle different hitboxes and thus requires rewriting. + Color eyeColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, 0); + Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f); + Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2); + spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the glowmasks. + int frameCounter = (int)npc.frameCounter / 4; + Rectangle frame = TextureAssets.Extra[106].Value.Frame(1, 8); + frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y; + Rectangle glowFrame = frame; + spriteBatch.Draw(TextureAssets.Extra[106].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + frame = npc.frame; + Rectangle glowFrame2 = frame; + spriteBatch.Draw(TextureAssets.Extra[107].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); + + // Draw the sparkle telegraphs for the laser spread attack if applicable. + if (npc.ai[0] == 3f && npc.ai[1] <= 60f) + { + spriteBatch.SetBlendState(BlendState.Additive); + for (int i = -1; i <= 1; i += 2) + { + Texture2D sparkle = Request("CalamityMod/Particles/Sparkle2").Value; + Vector2 sparkleDraw = headDrawPosition + new Vector2(14f * i, -15f) * npc.scale; + Color drawFade = Color.Yellow * Utils.GetLerpValue(0, 30, 60f - npc.ai[1], true); + spriteBatch.Draw(sparkle, sparkleDraw, null, drawFade, MathHelper.Pi * 0.02f * npc.ai[1] * i, sparkle.Size() / 2f, 1.25f * npc.scale, SpriteEffects.None, 0f); + } + spriteBatch.SetBlendState(BlendState.AlphaBlend); + } + shouldDrawBool = false; + } } - if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || npc.type == NPCID.Probe || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) + if (npc.type == NPCID.Corruptor || npc.type == NPCID.BloodSquid || (npc.type == NPCID.HornetHoney && npc.ai[3] == 1f)) { Texture2D texture = TextureAssets.Npc[npc.type].Value; @@ -7995,31 +6946,6 @@ namespace CalamityMod.NPCs shouldDrawBool = false; } - if (npc.type == NPCID.GolemHeadFree) - { - // Draw the head as usual. - Texture2D golemHeadTexture = TextureAssets.Npc[npc.type].Value; - Vector2 headDrawPosition = npc.Center - screenPos; - spriteBatch.Draw(golemHeadTexture, headDrawPosition, npc.frame, npc.GetAlpha(drawColor), 0f, npc.frame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); - - // Draw the eyes. The way vanilla handles this is hardcoded bullshit that cannot handle different hitboxes and thus requires rewriting. - Color eyeColor = new Color(Main.mouseTextColor, Main.mouseTextColor, Main.mouseTextColor, 0); - Vector2 eyesDrawPosition = headDrawPosition - npc.scale * new Vector2(1f, 12f); - Rectangle eyesFrame = new Rectangle(0, 0, TextureAssets.Golem[1].Value.Width, TextureAssets.Golem[1].Value.Height / 2); - spriteBatch.Draw(TextureAssets.Golem[1].Value, eyesDrawPosition, eyesFrame, eyeColor, 0f, eyesFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); - - // Draw the glowmasks. - int frameCounter = (int)npc.frameCounter / 4; - Rectangle frame = TextureAssets.Extra[106].Value.Frame(1, 8); - frame.Y += frame.Height * 2 * frameCounter + npc.frame.Y; - Rectangle glowFrame = frame; - spriteBatch.Draw(TextureAssets.Extra[106].Value, eyesDrawPosition, glowFrame, eyeColor, 0f, glowFrame.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); - frame = npc.frame; - Rectangle glowFrame2 = frame; - spriteBatch.Draw(TextureAssets.Extra[107].Value, eyesDrawPosition, glowFrame2, eyeColor, 0f, glowFrame2.Size() * 0.5f, npc.scale, SpriteEffects.None, 0f); - shouldDrawBool = false; - } - if (Main.LocalPlayer.Calamity().trippy && !npc.IsABestiaryIconDummy) { SpriteEffects spriteEffects = SpriteEffects.None; @@ -8143,8 +7069,8 @@ namespace CalamityMod.NPCs } else { - // VHex and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons - if (npc.Calamity().vulnerabilityHex > 0 || npc.Calamity().trueVulnerabilityHex > 0) + // VHex, Mana Burn and Miracle Blight visuals do not appear if Odd Mushroom is in use for sanity reasons + if (npc.Calamity().vulnerabilityHex || npc.Calamity().trueVulnerabilityHex) { float compactness = npc.width * 0.6f; if (compactness < 10f) @@ -8152,14 +7078,33 @@ namespace CalamityMod.NPCs float power = npc.height / 100f; if (power > 2.75f) power = 2.75f; + var color = Color.Red; if (VulnerabilityHexFireDrawer is null || VulnerabilityHexFireDrawer.LocalTimer >= VulnerabilityHexFireDrawer.SetLifetime) - VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().trueVulnerabilityHex > 0 ? npc.Calamity().trueVulnerabilityHex : npc.Calamity().vulnerabilityHex, 1, Color.Red * 1.25f, Color.Red, compactness, power); + VulnerabilityHexFireDrawer = new FireParticleSet(npc.Calamity().trueVulnerabilityHex ? npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())] : npc.buffTime[npc.FindBuffIndex(ModContent.BuffType())], 1, Color.Red * 1.25f, Color.Red, compactness, power); else VulnerabilityHexFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); } else VulnerabilityHexFireDrawer = null; + // Mana Burn effect is just vhex but blue + if (npc.Calamity().manaBurn > 0) + { + float compactness = npc.width * 0.6f; + if (compactness < 10f) + compactness = 10f; + float power = npc.height / 100f; + if (power > 2.75f) + power = 2.75f; + var color = Color.Blue; + if (ManaBurnFireDrawer is null || ManaBurnFireDrawer.LocalTimer >= ManaBurnFireDrawer.SetLifetime) + ManaBurnFireDrawer = new FireParticleSet(60, 1, color * 1.25f, color, compactness, power); + else + ManaBurnFireDrawer.DrawSet(npc.Bottom - Vector2.UnitY * (12f - npc.gfxOffY)); + } + else + ManaBurnFireDrawer = null; + // Only draw the NPC if told to by the miracle blight drawer. if (MiracleBlightRenderer.ValidToDraw(npc)) return MiracleBlightRenderer.ActuallyDoPreDraw; @@ -8181,7 +7126,6 @@ namespace CalamityMod.NPCs public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -8245,7 +7189,7 @@ namespace CalamityMod.NPCs } // Destroyer drawing and laser telegraphs - else if (DestroyerIDList.Includes(npc.type) && !npc.IsABestiaryIconDummy) + else if (CalamityNPCTypeSets.Destroyer.Contains(npc.type) && !npc.IsABestiaryIconDummy) { Texture2D npcTexture = TextureAssets.Npc[npc.type].Value; int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; @@ -8337,10 +7281,8 @@ namespace CalamityMod.NPCs } else if (npc.type == NPCID.TheDestroyerBody && revenge) { - float shootProjectileTime = death ? (masterMode ? (phase5 ? 30f : phase4 ? 60f : 90f) : 270f) : (masterMode ? (phase5 ? 90f : phase4 ? 120f : 150f) : 450f); - float bodySegmentTime = npc.ai[0] * (masterMode ? 15f : 30f); - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; + float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; + float telegraphGateValue = shootProjectileTime - DestroyerAI.LaserTelegraphTime; if (newAI[0] > telegraphGateValue) { switch (destroyerLaserColor) @@ -8360,15 +7302,6 @@ namespace CalamityMod.NPCs telegraphProgress = MathHelper.Clamp((newAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); } } - else if (npc.type == NPCID.TheDestroyerBody) - { - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - DestroyerAI.LaserTelegraphTime; - if (npc.localAI[0] > telegraphGateValue) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / DestroyerAI.LaserTelegraphTime, 0f, 1f); - } } Texture2D glowTexture = CalamityClientConfig.Instance.EnableVanillaTextureEdits ? ExtraTextureRefs.DestroyerHeadGlowmask.Value : TextureAssets.Dest[0].Value; @@ -8393,124 +7326,24 @@ namespace CalamityMod.NPCs } // Laser telegraph - else if (npc.type == NPCID.Probe && CalamityClientConfig.Instance.EnableVanillaTextureEdits) + else if (npc.type == NPCID.Probe) { - float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : BossRushEvent.BossRushActive ? DestroyerAI.ProbeLaserGateValue_BossRush : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; - Texture2D glowTexture = ExtraTextureRefs.ProbeGlowmask.Value; + float eyeTelegraphGateValue = (NPC.IsMechQueenUp ? DestroyerAI.ProbeLaserGateValue_Mechdusa : revenge ? DestroyerAI.ProbeLaserGateValue_Rev : DestroyerAI.ProbeLaserGateValue) - DestroyerAI.ProbeLaserTelegraphTime; + Texture2D glowTexture = Request("CalamityMod/Particles/Sparkle").Value; Vector2 halfSize = npc.frame.Size() / 2; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; + Vector2 drawPosition = npc.Center - screenPos + Vector2.UnitX.RotatedBy(npc.rotation) * (npc.width * 0.45f * npc.spriteDirection) + Vector2.UnitY * npc.gfxOffY; float colorScale = MathHelper.Clamp((npc.localAI[0] - eyeTelegraphGateValue) / DestroyerAI.ProbeLaserTelegraphTime, 0f, 1f); - Color drawColor2 = Color.Lerp(new Color(150, 0, 0, 192), new Color(255, 100, 150, 192), colorScale); - for (int i = 0; i < 2; i++) - { - spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, - drawColor2, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } + Color drawColor2 = new Color(255, 100, 150, 192) * colorScale; + spriteBatch.SetBlendState(BlendState.Additive); + spriteBatch.Draw(glowTexture, drawPosition, npc.frame, drawColor2, npc.rotation, halfSize, npc.scale * 1.1f, SpriteEffects.None, 0f); + spriteBatch.SetBlendState(BlendState.AlphaBlend); } if (revenge) { - // Create additional afterimages in the cardinal directions in Rev+ - if (npc.type == NPCID.BrainofCthulhu) - { - float secondAfterimageSetHealthValue = (int)(npc.lifeMax * 0.8f); - if (npc.life < secondAfterimageSetHealthValue) - { - int totalAfterimages = death ? 12 : 4; - for (int i = 0; i < totalAfterimages; i++) - { - Color currentColor = npc.GetAlpha(drawColor); - float opacityScale = 1f - MathHelper.Lerp(0.34f, 1f, npc.life / (float)secondAfterimageSetHealthValue); - float opacity = Main.getGoodWorld ? 0.7f : opacityScale; - - opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); - - Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); - if (i > 3) - { - currentColor *= 0.5f; - distanceFromTargetX *= 0.5f; - distanceFromTargetY *= 0.5f; - } - if (i > 7) - currentColor *= 0.5f; - - switch (i) - { - case 0: - case 4: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y; - break; - - case 1: - case 5: - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X; - break; - - case 2: - case 6: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y; - break; - - case 3: - case 7: - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X; - break; - - case 8: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 9: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 10: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - case 11: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - default: - break; - } - - position.X -= npc.width / 2; - position.Y -= npc.height / 2; - - Vector2 halfSize = npc.frame.Size() / 2; - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - int width = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Width(); - int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); - spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } - } - } - // Telegraph for charge and blood shots - else if (npc.type == NPCID.Creeper) + if (npc.type == NPCID.Creeper) { if (NPC.crimsonBoss < 0) return; @@ -8531,10 +7364,10 @@ namespace CalamityMod.NPCs opacity = 1f; opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); + currentColor.R = (byte)(currentColor.R * opacity); + currentColor.G = (byte)(currentColor.G * opacity); + currentColor.B = (byte)(currentColor.B * opacity); + currentColor.A = (byte)(currentColor.A * opacity); int totalAfterimages = 4; for (int i = 0; i < totalAfterimages; i++) { @@ -8558,90 +7391,6 @@ namespace CalamityMod.NPCs int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); } - - float secondAfterimageSetHealthValue = (int)(Main.npc[NPC.crimsonBoss].lifeMax * 0.8f); - if (Main.npc[NPC.crimsonBoss].life < secondAfterimageSetHealthValue) - { - currentColor = npc.GetAlpha(drawColor); - float opacityScale = 1f - Main.npc[NPC.crimsonBoss].life / (float)secondAfterimageSetHealthValue; - opacity = Main.getGoodWorld ? 1f : opacityScale; - - opacity = MathHelper.Clamp(opacity, 0f, 1f); - currentColor.R = (byte)((float)(int)currentColor.R * opacity); - currentColor.G = (byte)((float)(int)currentColor.G * opacity); - currentColor.B = (byte)((float)(int)currentColor.B * opacity); - currentColor.A = (byte)((float)(int)currentColor.A * opacity); - totalAfterimages = death ? 12 : 4; - for (int i = 0; i < totalAfterimages; i++) - { - Vector2 position = npc.position; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.LocalPlayer.Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.LocalPlayer.Center.Y); - if (i > 3) - { - currentColor *= 0.5f; - distanceFromTargetX *= 0.5f; - distanceFromTargetY *= 0.5f; - } - - switch (i) - { - case 0: - case 4: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; - break; - - case 1: - case 5: - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; - break; - - case 2: - case 6: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromBrain.Y; - break; - - case 3: - case 7: - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - position.X = Main.LocalPlayer.Center.X + distanceFromBrain.X; - break; - - case 8: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 9: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y - distanceFromTargetY; - break; - - case 10: - position.X = Main.LocalPlayer.Center.X + distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - case 11: - position.X = Main.LocalPlayer.Center.X - distanceFromTargetX; - position.Y = Main.LocalPlayer.Center.Y + distanceFromTargetY; - break; - - default: - break; - } - - position.X -= npc.width / 2; - position.Y -= npc.height / 2; - - int width = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Width(); - int height = TextureAssets.Npc[npc.type] is null ? 0 : TextureAssets.Npc[npc.type].Height(); - spriteBatch.Draw(TextureAssets.Npc[npc.type].Value, new Vector2(position.X - screenPos.X + (float)(npc.width / 2) - (float)width * npc.scale / 2f + halfSize.X * npc.scale, position.Y - screenPos.Y + (float)npc.height - (float)height * npc.scale / (float)Main.npcFrameCount[npc.type] + 4f + halfSize.Y * npc.scale + npc.gfxOffY), npc.frame, currentColor, npc.rotation, halfSize, npc.scale, spriteEffects, 0f); - } - } } float beginTelegraphGateValue = BrainOfCthulhuAI.TimeBeforeCreeperAttack - BrainOfCthulhuAI.CreeperTelegraphTime; @@ -8726,83 +7475,6 @@ namespace CalamityMod.NPCs } } - // His afterimages I can't get to work, so fuck it - else if (npc.type == NPCID.SkeletronPrime || npc.type == NPCType()) - { - Texture2D npcTexture = (death && npc.type == NPCID.SkeletronPrime) ? ExtraTextureRefs.ChadPrime.Value : TextureAssets.Npc[npc.type].Value; - int frameHeight = npcTexture.Height / Main.npcFrameCount[npc.type]; - - npc.frame.Y = (int)newAI[3]; - - // Mechdusa drawing - if (NPC.IsMechQueenUp) - { - if (npc.ai[1] == 0f || npc.ai[1] == 4f) - { - newAI[2] += 1f; - if (newAI[2] >= 12f) - { - newAI[2] = 0f; - newAI[3] += frameHeight; - if (newAI[3] / frameHeight >= 5) - newAI[3] = frameHeight * 3; - } - } - else - { - newAI[2] = 0f; - newAI[3] = frameHeight * 5; - } - } - - // Floating phase - else if (npc.ai[1] == 0f || npc.ai[1] == 4f) - { - newAI[2] += 1f; - if (newAI[2] >= 12f) - { - newAI[2] = 0f; - newAI[3] += frameHeight; - - if (newAI[3] / frameHeight >= 2f) - newAI[3] = 0f; - } - } - - // Spinning probe spawn or fly over phase - else if (npc.ai[1] == 5f || npc.ai[1] == 6f) - { - newAI[2] = 0f; - newAI[3] = frameHeight; - } - - // Spinning phase - else - { - newAI[2] = 0f; - newAI[3] = frameHeight * 2; - } - - npc.frame.Y = (int)newAI[3]; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (npc.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - spriteBatch.Draw(npcTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, npc.GetAlpha(drawColor), npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); - - Color eyesColor = new Color(200, 200, 200, 0); - if (death) - { - int alpha = 192; - eyesColor = npc.type == NPCType() ? new Color(150, 100, 255, alpha) : new Color(255, 255, 0, alpha); - Texture2D glowTexture = npc.type == NPCID.SkeletronPrime ? ExtraTextureRefs.ChadPrimeEyeGlowmask.Value : SkeletronPrime2.EyeTexture.Value; - spriteBatch.Draw(glowTexture, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); - } - else - spriteBatch.Draw(TextureAssets.BoneEyes.Value, npc.Center - screenPos + new Vector2(0, npc.gfxOffY), npc.frame, eyesColor, npc.rotation, npc.frame.Size() / 2, npc.scale, spriteEffects, 0f); - } - else if (npc.type == NPCID.Plantera) { // Percent life remaining @@ -9161,7 +7833,7 @@ namespace CalamityMod.NPCs { return DownedBossSystem.downedGuardians; } - else if (type == NPCType()) + else if (type == NPCType()) { return DownedBossSystem.downedDragonfolly; } @@ -9219,8 +7891,7 @@ namespace CalamityMod.NPCs { if (!GetDownedBossVariable(npc.type)) { - BossTypeDict.TryGet(npc.type, out int newBossTypeJustDowned); - + CalamityNPCSets.BossSpeedrunTimerID.TryGetValue(npc.type, out int newBossTypeJustDowned); for (int i = 0; i < Main.maxPlayers; i++) { Player player = Main.player[i]; @@ -9262,13 +7933,13 @@ namespace CalamityMod.NPCs #region Should Affect NPC public static bool ShouldAffectNPC(NPC target) { - if (EaterOfWorldsIDList.Includes(target.type) || DestroyerIDList.Includes(target.type)) + if (CalamityNPCTypeSets.EaterOfWorlds.Contains(target.type) || CalamityNPCTypeSets.Destroyer.Contains(target.type)) return false; if (target.damage > 0 && !target.boss && !target.friendly && !target.dontTakeDamage && target.type != NPCID.Creeper && target.type != NPCType() && target.type != NPCID.MourningWood && target.type != NPCID.Everscream && target.type != NPCID.SantaNK1 && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCType() && target.type != NPCID.GolemFistLeft && target.type != NPCID.GolemFistRight && - target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !EnemyImmunitiesList.Includes(target.type) && !AcidRainEvent.AllMinibosses.Contains(target.type)) + target.type != NPCType() && target.type != NPCType() && target.type != NPCID.DD2Betsy && !CalamityNPCSets.ResistSlowingDebuffsAndOtherSpecialEffects[target.type] && !AcidRainEvent.AllMinibosses.Contains(target.type)) { return true; } @@ -9899,37 +8570,6 @@ namespace CalamityMod.NPCs } #endregion - #region Adjust Difficulty Stat Scaling - // Adjust HP and damage in Master Mode - public static void AdjustMasterModeStatScaling(NPC npc, bool isABoss = false) - { - if (!Main.masterMode) - return; - - // Bosses and enemies have separate HP reduction multipliers - npc.lifeMax = (int)Math.Round(npc.lifeMax * (isABoss ? MasterModeBossHPMultiplier : MasterModeEnemyHPMultiplier)); - - // Bosses do not get their damage reduced - if (!isABoss) - npc.damage = (int)Math.Round(npc.damage * MasterModeEnemyDamageMultiplier); - } - - // Adjust only knockback resist in Expert Mode (this is also adjusted in Master Mode because Expert has to be enabled if Master is enabled) - public static void AdjustExpertModeStatScaling(NPC npc) - { - if (!Main.expertMode) - return; - - if (npc.knockBackResist <= 0f) - return; - - // Knockback resist is backasswards in this fucking game so we need to add to the knockBackResist variable here :^) - float knockBackResistMult = Main.masterMode ? MasterModeEnemyKnockbackMultiplier : ExpertModeEnemyKnockbackMultiplier; - float knockBackResistReduction = npc.knockBackResist * knockBackResistMult; - npc.knockBackResist += knockBackResistReduction; - } - #endregion - #region Bestiary public override void SetBestiary(NPC npc, BestiaryDatabase database, BestiaryEntry bestiaryEntry) { @@ -10102,34 +8742,5 @@ namespace CalamityMod.NPCs return result; } #endregion - - #region Type Name Changes - public override void ModifyTypeName(NPC npc, ref string typeName) - { - if ((Main.masterMode && CalamityWorld.death) || BossRushEvent.BossRushActive) - { - if (npc.type == NPCID.SkeletronPrime) - { - typeName = CalamityUtils.GetTextValue("NPCs.SkeletronOmega.DisplayName"); - } - if (npc.type == NPCID.PrimeSaw) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaSaw.DisplayName"); - } - if (npc.type == NPCID.PrimeLaser) - { - typeName = CalamityUtils.GetTextValue("NPCs.OmegaLaser.DisplayName"); - } - if (npc.type == NPCID.PrimeVice) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaVice.DisplayName"); - } - if (npc.type == NPCID.PrimeCannon) - { - typeName = CalamityUtils.GetTextValue("NPCs.AlphaCannon.DisplayName"); - } - } - } - #endregion } } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 159d4cd730..819ac0d178 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -98,12 +98,6 @@ namespace CalamityMod.NPCs case NPCID.Werewolf: npcLoot.ChangeDropRate(ItemID.MoonCharm, 1, 20); break; - - // Possessed Armor - // Nazar @ 1% Normal, 2% Expert+ - case NPCID.PossessedArmor: - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); - break; #endregion #region Sky / Space @@ -178,12 +172,6 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 3, 2)); break; - // Skeleton Merchant - // Punch Card @ 100% - case NPCID.SkeletonMerchant: - npcLoot.Add(ModContent.ItemType()); - break; - // Skeleton Archer // Magic Quiver @ 5% (2.5% in Vanilla) // Marrow @ 2.5% (0.5% in Vanilla) @@ -280,8 +268,16 @@ namespace CalamityMod.NPCs // Dreamer Ghoul // Trifold Map @ 1% Normal, 2% Expert+ + // Light Shard @ 10% case NPCID.DesertGhoulHallow: npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.TrifoldMap, 100, 50)); + npcLoot.ChangeDropRate(ItemID.LightShard, 1, 10); + break; + + // Crystal Thresher + // Light Shard @ 10% + case NPCID.SandsharkHallow: + npcLoot.ChangeDropRate(ItemID.LightShard, 1, 10); break; // Sand Elemental @@ -289,10 +285,19 @@ namespace CalamityMod.NPCs // Rare Elemental in a Bottle @ 10% Normal, 16.67% Expert+ // Desert Key @ 10% case NPCID.SandElemental: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); npcLoot.Add(ItemID.DungeonDesertKey, 10); break; + + // Tainted Ghoul, Vile Ghoul, Bone Biter, Flesh Reaver + // Dark Shard @ 10% + case NPCID.DesertGhoulCorruption: + case NPCID.DesertGhoulCrimson: + case NPCID.SandsharkCorrupt: + case NPCID.SandsharkCrimson: + npcLoot.ChangeDropRate(ItemID.DarkShard, 1, 10); + break; #endregion #region Ice @@ -454,14 +459,10 @@ namespace CalamityMod.NPCs break; // Chaos Elemental - // Megaphone @ 1% Normal, 2% Expert+ // Rod of Discord @ 0.5% Normal, 0.625% Expert+ (2.5 times higher chance than vanilla) case NPCID.ChaosElemental: - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); - // Remove the vanilla loot rule for Rod of Discord. npcLoot.RemoveWhere((rule) => rule is CommonDrop conditionalRule && conditionalRule.itemId == ItemID.RodofDiscord); - // Define a replacement rule which has an increased chance. npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.RodofDiscord, 200, 160)); break; @@ -472,12 +473,6 @@ namespace CalamityMod.NPCs npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.TrifoldMap, 100, 50)); break; - // Illuminant Slime - // Fast Clock @ 1% Normal, 2% Expert+ - case NPCID.IlluminantSlime: - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.FastClock, 100, 50)); - break; - // Gastropod // 5-10 Pink Gel @ 100% case NPCID.Gastropod: @@ -551,7 +546,12 @@ namespace CalamityMod.NPCs #endregion #region Jungle - //Moss hornets are after all of this switching since it no longer works if placed here + // Moss Hornet + // Needler @ 4% Normal, 6.67% Expert+ + // This automatically covers all variations + case NPCID.MossHornet: + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); + break; // Moth // Butterfly Dust @ 100% INSTEAD OF 50% @@ -684,19 +684,20 @@ namespace CalamityMod.NPCs #endregion #region Graveyard - // Alternate Blood Orb obtainment methods (10%) + // Alternate Blood Orb obtainment methods (20%) case NPCID.MaggotZombie: + postEoC.Add(ModContent.ItemType(), 5); + break; + + // 100%, 3-6 each case NPCID.TheBride: case NPCID.TheGroom: - postEoC.Add(ModContent.ItemType(), 10); + postEoC.Add(ModContent.ItemType(), 1, 3, 6); break; // Ghost Bracelet @ 5% (Dandy requests this drops at a "high chance" but inventory clutter is real so) - // Nazar and Megaphone @ 1% Normal, 2% Expert case NPCID.Ghost: npcLoot.Add(ModContent.ItemType(), 20); - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); break; #endregion @@ -714,14 +715,11 @@ namespace CalamityMod.NPCs npcLoot.Add(ModContent.ItemType(), 1, 6, 12); break; - // Wandering Eye Fish - // Bouncing Eyeball @ 10% Normal, 16.66% Expert+ + // Wandering Eye Fish, Zombie Merman + // Bouncing Eyeball @ 12.5% case NPCID.EyeballFlyingFish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 10, 6)); - postEoC.Add(ModContent.ItemType(), 1, 10, 12); - break; - case NPCID.ZombieMerman: + npcLoot.Add(ModContent.ItemType(), 8); postEoC.Add(ModContent.ItemType(), 1, 10, 12); break; @@ -798,13 +796,6 @@ namespace CalamityMod.NPCs rev.Add(ItemID.FlyingDutchmanMasterTrophy); rev.Add(ItemID.PirateShipMountItem, 4); break; - - // Pirate's Curse - // Nazar and Megaphone @ 1% Normal, 2% Expert - case NPCID.PirateGhost: - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Nazar, 100, 50)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.Megaphone, 100, 50)); - break; #endregion #region Solar Eclipse @@ -982,15 +973,15 @@ namespace CalamityMod.NPCs #region Martian Madness // Martian Madness On-Foot Soldiers - // 1.5% chance to drop any of the three Calamity martian drops + // 1% chance to drop any of the three Calamity martian drops case NPCID.BrainScrambler: case NPCID.GrayGrunt: case NPCID.GigaZapper: case NPCID.RayGunner: case NPCID.ScutlixRider: - npcLoot.Add(ModContent.ItemType(), 66); - npcLoot.Add(ModContent.ItemType(), 66); - npcLoot.Add(ModContent.ItemType(), 66); + npcLoot.Add(ModContent.ItemType(), 100); + npcLoot.Add(ModContent.ItemType(), 100); + npcLoot.Add(ModContent.ItemType(), 100); break; // Martian Engineer @@ -1115,14 +1106,9 @@ namespace CalamityMod.NPCs break; // Angler - // Golden Fishing Rod @ 100% IF fed to a Trasher - // OTHERWISE, // Golden Fishing Rod @ 8.33% IF Hardmode case NPCID.Angler: - LeadingConditionRule trasherLCR = new LeadingConditionRule(DropHelper.AnglerFedToTrasherCondition); - trasherLCR.Add(ItemDropRule.ByCondition(DropHelper.TrasherText, ItemID.GoldenFishingRod)); - trasherLCR.OnFailedConditions(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.GoldenFishingRod, 12)); - npcLoot.Add(trasherLCR); + hardmode.Add(ItemID.GoldenFishingRod, 12, 1, 1); break; #endregion @@ -1145,10 +1131,10 @@ namespace CalamityMod.NPCs npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.RoyalGel)); // Would be in the bag otherwise - npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.Remix, ItemID.Keybrand, 4)); - npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.NotRemix, ItemID.Katana, 4)); + npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.Remix, ItemID.Keybrand, DropHelper.NormalWeaponDropRateInt)); + npcLoot.AddNormalOnly(ItemDropRule.ByCondition(DropHelper.NotRemix, ItemID.Katana, DropHelper.NormalWeaponDropRateInt)); - npcLoot.AddNormalOnly(ModContent.ItemType(), 10); + npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Master items drop in Revengeance @@ -1167,8 +1153,8 @@ namespace CalamityMod.NPCs npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.EoCShield)); // Would be in the bag otherwise - npcLoot.AddNormalOnly(ModContent.ItemType(), 10); - npcLoot.AddNormalOnly(ModContent.ItemType(), 4); + npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); + npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); // Master items drop in Revengeance @@ -1292,7 +1278,7 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal npcLoot.AddNormalOnly(DropHelper.PerPlayer(ItemID.HiveBackpack)); - npcLoot.AddNormalOnly(ModContent.ItemType(), 10); + npcLoot.AddNormalOnly(ModContent.ItemType(), DropHelper.NormalWeaponDropRateFraction); // Would be in the bag otherwise npcLoot.AddNormalOnly(ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1358,6 +1344,7 @@ namespace CalamityMod.NPCs var wofWeapons = new int[] { ItemID.BreakerBlade, + ModContent.ItemType(), ItemID.ClockworkAssaultRifle, ModContent.ItemType(), ItemID.LaserRifle, @@ -1394,9 +1381,6 @@ namespace CalamityMod.NPCs } catch (ArgumentNullException) { } - // Would be in the bag otherwise - npcLoot.AddNormalOnly(ModContent.ItemType(), 10); - // Drop Hermit's Box directly for EACH player, regardles of Expert or not. 100% chance on first kill, 10% chance afterwards. // The special first kill rule is unlisted in the Bestiary LeadingConditionRule firstWoFKill = new(DropHelper.If(() => !Main.hardMode)); @@ -1497,7 +1481,6 @@ namespace CalamityMod.NPCs // Expert+ drops are also available on Normal. These are done manually due to Last Twin Standing. npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ItemID.MechanicalWheelPiece); - npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ModContent.ItemType(), 10); // Would be in the bag otherwise npcLoot.AddIf((info) => !Main.expertMode && IsLastTwinStanding(info), ModContent.ItemType(), ThankYouPainting.DropInt); @@ -1815,8 +1798,8 @@ namespace CalamityMod.NPCs rev.Add(ItemID.FairyQueenMasterTrophy); rev.Add(ItemID.FairyQueenPetItem, 4); - // GFB Cirrus' Vodka and Terraformer drop - GFB.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 1, 9999), true); + // GFB Purple Haze and Terraformer drop + GFB.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 1, 9999), true); GFB.Add(DropHelper.PerPlayer(ItemID.Clentaminator2), hideLootReport: true); // Lore @@ -1892,58 +1875,18 @@ namespace CalamityMod.NPCs break; #endregion } - //If the enemy is part of a list (Hornets, Skeletons, etc,) place it here as in the section before it no longer works + //If the enemy is part of a list, place it here as in the section before it no longer works #region Enemy Lists - - // All Moss Hornets - // Needler @ 4% Normal, 6.67% Expert+ - if (MossHornetIDList.Includes(npc.type)) - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 25, 15)); - // All Skeletons // Ancient Bone Dust @ 20% Normal, 33.33% Expert+ - if (SkeletonIDList.Includes(npc.type)) + if (CalamityNPCTypeSets.Skeleton[npc.type]) npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 5, 3)); // All Hardmode Dungeon Enemies // Ectoplasm @ 20% - if (BuffedDungeonEnemiesList.Includes(npc.type)) + if (CalamityNPCSets.IsBuffedDungeonEnemy[npc.type]) npcLoot.Add(ItemID.Ectoplasm, 5); #endregion - - // Blanket remove all specific food item drops that have changed obtainment methods in Calamity - // This is type-indiscriminate and will also most probably hit modded NPCs too - - // CIT 7NOV2024: Yeah it hits modded NPCs; in fact it removes GFB drops from Ravager and Deus - // Fixing this by making the code only run if the NPC is not a boss - if (!npc.boss) - { - int[] randomFoodItems = new int[] -{ - ItemID.ApplePie, - ItemID.BananaSplit, - ItemID.BBQRibs, - ItemID.Burger, - ItemID.MilkCarton, - ItemID.ChocolateChipCookie, - ItemID.CoffeeCup, - ItemID.CreamSoda, - ItemID.FriedEgg, - ItemID.Fries, - ItemID.Grapes, - ItemID.Hotdog, - ItemID.IceCream, - ItemID.Milkshake, - ItemID.Nachos, - ItemID.Pizza, - ItemID.PotatoChips, - ItemID.ShrimpPoBoy, - ItemID.Spaghetti, - ItemID.Steak -}; - foreach (int foodItemID in randomFoodItems) - npcLoot.RemoveWhere((rule) => rule is ItemDropWithConditionRule foodRule && foodRule.itemId == foodItemID); - } } #endregion @@ -1975,7 +1918,7 @@ namespace CalamityMod.NPCs public override bool PreKill(NPC npc) { // Stop Eater of Worlds segments and Brain of Cthulhu Creepers from dropping partial loot in Rev+ - if (CalamityWorld.revenge && (EaterOfWorldsIDList.Includes(npc.type) || npc.type == NPCID.Creeper)) + if (CalamityWorld.revenge && (CalamityNPCTypeSets.EaterOfWorlds.Contains(npc.type) || npc.type == NPCID.Creeper)) DropHelper.BlockDrops(ItemID.DemoniteOre, ItemID.ShadowScale, ItemID.CrimtaneOre, ItemID.TissueSample); // Boss Rush pre-kill effects @@ -2063,7 +2006,7 @@ namespace CalamityMod.NPCs break; case NPCID.WallofFlesh: - SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant, NPCID.BestiaryGirl }, Main.hardMode); + SetNewShopVariable(new int[] { NPCID.Merchant, NPCID.ArmsDealer, NPCID.Dryad, NPCID.Painter, NPCID.WitchDoctor, NPCID.Stylist, NPCID.DyeTrader, NPCID.Demolitionist, NPCID.PartyGirl, NPCID.Clothier, NPCID.SkeletonMerchant }, Main.hardMode); SetNewBossJustDowned(npc); if (!Main.hardMode && !BossRushEvent.BossRushActive) @@ -2090,7 +2033,7 @@ namespace CalamityMod.NPCs case NPCID.TheDestroyer: SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss1 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2102,7 +2045,7 @@ namespace CalamityMod.NPCs if (lastTwinStanding) { SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || NPC.downedMechBoss2 || !NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss2 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2112,7 +2055,7 @@ namespace CalamityMod.NPCs case NPCID.SkeletronPrime: SetNewShopVariable(new int[] { NPCID.Demolitionist, NPCID.DD2Bartender, NPCID.Stylist, NPCID.Truffle }, NPC.downedMechBossAny); - SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); + SetNewShopVariable(new int[] { NPCID.Stylist, ModContent.NPCType(), ModContent.NPCType() }, !NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3); SetNewBossJustDowned(npc); if (!NPC.downedMechBoss3 && CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -2120,7 +2063,7 @@ namespace CalamityMod.NPCs break; case NPCID.Plantera: - SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedPlantBoss); + SetNewShopVariable(new int[] { NPCID.WitchDoctor, NPCID.Truffle, NPCID.BestiaryGirl, ModContent.NPCType() }, NPC.downedPlantBoss); SetNewBossJustDowned(npc); // Spawn Perennial Ore if Plantera has never been killed @@ -2156,7 +2099,7 @@ namespace CalamityMod.NPCs break; case NPCID.Golem: - SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType(), ModContent.NPCType() }, NPC.downedGolemBoss); + SetNewShopVariable(new int[] { NPCID.ArmsDealer, NPCID.Cyborg, NPCID.Steampunker, NPCID.Wizard, NPCID.WitchDoctor, NPCID.DD2Bartender, ModContent.NPCType() }, NPC.downedGolemBoss); SetNewBossJustDowned(npc); // If Golem has never been killed, send a message about the Plague. diff --git a/NPCs/CalamityGlobalTownNPC.cs b/NPCs/CalamityGlobalTownNPC.cs index c50caa0208..6cd8ea55a7 100644 --- a/NPCs/CalamityGlobalTownNPC.cs +++ b/NPCs/CalamityGlobalTownNPC.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Ammo; using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Vanity; @@ -14,6 +15,7 @@ using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.Furniture; using CalamityMod.Items.Placeables.Furniture.Fountains; using CalamityMod.Items.Potions; +using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems.Invasion; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; @@ -25,6 +27,7 @@ using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Enums; using Terraria.GameContent; using Terraria.ID; using Terraria.Localization; @@ -73,7 +76,6 @@ namespace CalamityMod.NPCs }; private static readonly string[] ArmsDealerNames = { - "Drifter", "Finchi", "Heniek", // <@!363404700445442050> (kazurgundu) "Fire", // <@!354362326947856384> (ultimatefirewaster) @@ -88,17 +90,18 @@ namespace CalamityMod.NPCs { "Joeseph Jostar", "Storm Havik", // <@!1013452363178197072> (fishnotduck) + "Magorfis Splunt the Greater Finklejim", // <@!147490809334333440> (eidolbyssus) }; private static readonly string[] CyborgNames = { "Sylux", // <@!331812782183809025> (gonkachino) - "XL-39 Nemesis", // <@!1104036024063107082> (yashimayamanata) + "Nemesis", // <@!1104036024063107082> (yashimayamanata) }; private static readonly string[] DemolitionistNames = { "Tavish DeGroot", // <@!442447226992721930> (magicoal) "Fimmy", // <@!407348617079160832> (darkmega5) - "Dorira", // <@!215269032360804352> (crimsoncb) + "John Helldiver", // <@!614126424751603714> (exellent.) }; private static readonly string[] DryadNames = { @@ -107,6 +110,7 @@ namespace CalamityMod.NPCs "Jasmine", // <@!430532867479699456> (phantasmagoria.) "Cybil", // <@!486507232666845185> (Captain Doofus#????) "Ruth", // <@!1001307586068492388> (briny_coffee) + "Kanna", // <@!730203712898859018> (cosmoredeathwish) }; private static readonly string[] DyeTraderNames = null; private static readonly string[] GoblinTinkererNames = @@ -121,6 +125,9 @@ namespace CalamityMod.NPCs "Him", // <@!931019614958256139> (himtheguy1) "Tooshiboots", // <@!333532730593771522> (ulmod) "Neesh", // <@!175803493464932352> (xjetty) + "Bars Boldia", // <@!332989575708540939> (careless_imp) + "Basel Raiden John Clive Fantasy 16", // <@!529392083136413696> (raiden_ii) + "Gobby, Destroyer of Wallets", // <@!429024941296582658> (bwlstorm) }; private static readonly string[] GolferNames = null; private static readonly string[] GuideNames = @@ -140,9 +147,9 @@ namespace CalamityMod.NPCs "Alfred Rend", // <@!606301806481375255> (deadsqurp300) "Leeman", // <@!281999243168841728> (tweee) "Mihai", // <@!373941893467209730> (cmihaii.) - "Cooler Kevin", // <@!614126424751603714> (exellent.) "Dinkleberg", // <@!581993958037520404> (hyperionzx) - "Wamy", + "Wamy", // Fab added this name with no Discord ID. May be a donor who has no Discord account. + "Baggute", // <@!535140564174110720> (thebaggutegamer) }; private static readonly string[] MechanicNames = { @@ -155,6 +162,7 @@ namespace CalamityMod.NPCs private static readonly string[] MerchantNames = { "Morshu", // <@!194931581826236416> (uberransy) + "Spamton G. Spamton", // <@!497146350438318101> (j.u.n.e.s) }; private static readonly string[] NurseNames = { @@ -180,10 +188,11 @@ namespace CalamityMod.NPCs "Captain Billy Bones", // <@!699589229507772416> (djackv) "Captain J. Crackers", // <@!233232602994049024> (qyuuno) "Gol D. Roger", // <@!256228859110752257> (xtra3678) + "Yarrim", // <@!290061123137306624> (borb9834) + "Hector Barbossa", // <@!615704209303797790> (thatrockisfullamagic) }; private static readonly string[] PrincessNames = { - "Catalyst", // <@!156672312425316352> (xaqult) "Nyapano", // <@!120976656826368003> (nyapano) "Jade", // <@!187395834625785869> (verymasterninja) "Nyavi Aceso", // <@!270260920888852480> (navigator.) @@ -191,16 +200,20 @@ namespace CalamityMod.NPCs "Gwynevere", // <@!142752927348424704> (nuclearchaosazathoth) "Hael", // <@!641747280944431156> (kalebtull) "Yumesaki Mirrin", // <@!100235144744415232> (milinen) + "Vela", // <@!208719047146209281> (nyxxynightstar) }; private static readonly string[] SantaClausNames = { "Jank", // <@!339950757472239616> (jankle_) + "Aoi Kurashiki", // <@!358411687885537291> (nothinpurrsonal) }; private static readonly string[] SkeletonMerchantNames = { "Sans Undertale", // <@!145379091648872450> (shayy) "Papyrus Undertale", // <@!262663471189983242> (nycro) + "Gaster Undertale", // <@!924706306093379614> (enamoured) "Mr. Bones", // <@!359215912856977408> (jaybones.) + "Freakbob", // <@!377863128140087296> (jevilamv) }; private static readonly string[] SteampunkerNames = { @@ -209,6 +222,8 @@ namespace CalamityMod.NPCs "Mòrag Ladair", // <@!161893929485074432> (jalapeno9) "Linn", // <@!277983612383526913> (duckycolors) "Eira", // <@!1166136068408623234> (taela_gemetha) + "Kreutz", // <@!553445849149997056> (red_r_kreutz) + "Cathlyn", // <@!156672312425316352> (xaqult) }; private static readonly string[] StylistNames = { @@ -217,6 +232,7 @@ namespace CalamityMod.NPCs "Xsiana", // <@!625780237489143839> (lokistic) "Lain", // <@!655201622863118337> (literallyadeerfr) "Hamis", // <@!608455754093035521> (haefer) + "Brio Scarlet", // <@!358576903701004289> (brio_scarlet) }; private static readonly string[] TavernkeepNames = { @@ -233,24 +249,25 @@ namespace CalamityMod.NPCs private static readonly string[] TravelingMerchantNames = { "Stan Pines", - "Slap Battles", // <@!923504188615450654> (gravityglider.) + "Intergaze", // <@!923504188615450654> (intergaze) "Borgus", // <@!539127427482255376> (therealmeepman) + "Postman Hiss", // <@!454638106122125312> (karinthefairy) }; private static readonly string[] TruffleNames = { "Aldrimil", // <@!413719640238194689> (Thorioum#2475) + "Wonton", // <@!1198092982923043040> (imonthatgudkush) + "Mad Lad", // <@!215269032360804352> (crimsoncb) }; private static readonly string[] WitchDoctorNames = { "Sok'ar", "Aeroni", // <@!348174404984766465> (aeroni) (previously: toxin) "Mixcoatl", // <@!284775927294984203> (.sharzz) - "Khatunz", // <@!303022375191183360> (jackshiz) "Amnesia Wapers", // <@!326821498323075073> (retardedadvicefromaretard) }; private static readonly string[] WizardNames = { - "Mage One-Trick", // <@!340996105460514816> (pixlgray) "Inorim, son of Ivukey", "Jensen", "Merasmus", // <@!288066987819663360> (spiderprovidence) @@ -259,6 +276,7 @@ namespace CalamityMod.NPCs "Chris Tallballs", // <@!770211589076418571> (vysterx) (previously: bewearium) "Syethas", // <@!325413275066171393> (cosmicstariight) "Nextdoor Psycho", // <@!173261518572486656> (nextdoorpsycho) + "Mike Cyclops", // <@!702327497475227741> (seichoseicho) }; private static readonly string[] ZoologistNames = { @@ -266,7 +284,22 @@ namespace CalamityMod.NPCs "Lacuna", // <@!790746689211203604> (_lacuna_) "Mae Borowski", //<@!219158690433990656> (justakkolite) "Fera", // <@!195850711567826945> (juneark_) + "Gwenhwyvar", // <@!291342874497515531> (diamondnife) + "Daxie", // <@!465438861103988737> (daxie626) }; + // Town Slimes + private static readonly string[] ClumsySlimeNames = null; + private static readonly string[] CoolSlimeNames = null; + private static readonly string[] DivaSlimeNames = null; + private static readonly string[] ElderSlimeNames = null; + private static readonly string[] MysticSlimeNames = null; + private static readonly string[] NerdySlimeNames = + { + "Big Blungus", // <@!272759434282008577> (schmoov) + "Rimuru Tempest", // <@!806463201398358036> (c0d3_404) + }; + private static readonly string[] SquireSlimeNames = null; + private static readonly string[] SurlySlimeNames = null; // The following sets are for the 1.4 Town Pets: Town Dogs, Cats and Bunnies. // All three pet types come in numerous breeds. Each breed has its own name pool. @@ -281,6 +314,8 @@ namespace CalamityMod.NPCs private static readonly string[] TownDogNames = { "Ozymandias", // <@!146333264871686145> (ozzatron) + "Miss Throws a Lot", // <@!799345607847182400> (oakhamsam) + "Brikwilla", // <@!543803736909414438> (lavendercobra) }; private static readonly string[] TownDogLabradorNames = { @@ -321,14 +356,20 @@ namespace CalamityMod.NPCs private static readonly string[] TownCatBlackNames = { "Bear", // <@!183424826407518208> (lilac_vrt_olligoci) + "Storm", // <@!620383533516718085> (airwaveslr) }; private static readonly string[] TownCatOrangeTabbyNames = { "Felix", // <@!183424826407518208> (lilac_vrt_olligoci) "Tardo", // <@!739343546867384391> (midnight295) + "Dali", // <@!460238880436781061> (darthlego) + "Kiba", // <@!852348657072340992> (jollydragonslayer) }; private static readonly string[] TownCatRussianBlueNames = null; - private static readonly string[] TownCatSilverNames = null; + private static readonly string[] TownCatSilverNames = + { + "Archie", // <@!303022375191183360> (jackshiz) + }; private static readonly string[] TownCatWhiteNames = null; private const int TownBunnyWhiteVanillaNames = 14; @@ -337,7 +378,11 @@ namespace CalamityMod.NPCs private const int TownBunnyFlemishVanillaNames = 12; private const int TownBunnyLopVanillaNames = 13; private const int TownBunnySilverVanillaNames = 13; - private static readonly string[] TownBunnyNames = null; + private static readonly string[] TownBunnyNames = + { + "Poco", // <@!1192261996146593872> (tostitomuncher33) + "Puffer", // <@!181103507711983616> (piky) + }; private static readonly string[] TownBunnyWhiteNames = null; private static readonly string[] TownBunnyAngoraNames = null; private static readonly string[] TownBunnyDutchNames = null; @@ -575,6 +620,32 @@ namespace CalamityMod.NPCs AddNewNames(nameList, ZoologistNames); break; + // Town Slimes + case NPCID.TownSlimePurple: // Clumsy Slime + AddNewNames(nameList, ClumsySlimeNames); + break; + case NPCID.TownSlimeGreen: // Cool Slime + AddNewNames(nameList, CoolSlimeNames); + break; + case NPCID.TownSlimeRainbow: // Diva Slime + AddNewNames(nameList, DivaSlimeNames); + break; + case NPCID.TownSlimeOld: // Elder Slime + AddNewNames(nameList, ElderSlimeNames); + break; + case NPCID.TownSlimeYellow: // Mystic Slime + AddNewNames(nameList, MysticSlimeNames); + break; + case NPCID.TownSlimeBlue: // Nerdy Slime + AddNewNames(nameList, NerdySlimeNames); + break; + case NPCID.TownSlimeCopper: // Squire Slime + AddNewNames(nameList, SquireSlimeNames); + break; + case NPCID.TownSlimeRed: // Surly Slime + AddNewNames(nameList, SurlySlimeNames); + break; + // This function doesn't work with Town Pets currently case NPCID.TownCat: AddNewNames(nameList, TownCatNames); @@ -689,7 +760,6 @@ namespace CalamityMod.NPCs (NPCID.SkeletonMerchant, (Player player) => player.Calamity().newSkeletonMerchantInventory, (Player player, bool enabled) =>{ player.Calamity().newSkeletonMerchantInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newAmidiasInventory,(Player player, bool enabled) =>{ player.Calamity().newAmidiasInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newBanditInventory,(Player player, bool enabled) =>{ player.Calamity().newBanditInventory = enabled; }), - (NPCType(), (Player player) => player.Calamity().newCirrusInventory,(Player player, bool enabled) =>{ player.Calamity().newCirrusInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newPermafrostInventory,(Player player, bool enabled) =>{ player.Calamity().newPermafrostInventory = enabled; }), (NPCType(), (Player player) => player.Calamity().newCalamitasInventory,(Player player, bool enabled) =>{ player.Calamity().newCalamitasInventory = enabled; }) // lol }; @@ -769,7 +839,6 @@ namespace CalamityMod.NPCs #region NPC Chat public override void GetChat(NPC npc, ref string chat) { - int cirrus = NPC.FindFirstNPC(NPCType()); int permadong = NPC.FindFirstNPC(NPCType()); int seahorse = NPC.FindFirstNPC(NPCType()); int thief = NPC.FindFirstNPC(NPCType()); @@ -825,9 +894,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.DarksunEclipse"); else if (Main.rand.NextBool(5) && Main.LocalPlayer.ZoneGlowshroom) { - if (Main.rand.NextBool() && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.DryadChat.DrunkPrincessShroom").Format(Main.npc[cirrus].GivenName); - else chat = CalamityUtils.GetTextValue("Vanilla.DryadChat.Mushroom"); } else if (Main.rand.NextBool(5) && Main.LocalPlayer.Calamity().ZoneSulphur) @@ -868,8 +934,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.Eclipse"); else if (Main.rand.NextBool(5) && AcidRainEvent.AcidRainEventIsOngoing) chat = CalamityUtils.GetTextValue("Vanilla.MechanicChat.AcidRain"); - else if (Main.rand.NextBool(5) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.MechanicChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Merchant: @@ -918,8 +982,6 @@ namespace CalamityMod.NPCs case NPCID.PartyGirl: if (Main.rand.NextBool(4) && Main.eclipse) chat = CalamityUtils.GetTextValue("Vanilla.PartyGirlChat.Eclipse" + Main.rand.Next(1, 2 + 1)); - else if (Main.rand.NextBool(10) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.PartyGirlChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.Pirate: @@ -927,8 +989,6 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.PreLeviathan"); else if (Main.rand.NextBool(5) && DownedBossSystem.downedAquaticScourge) chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.WetScourgeDefeated"); - else if (Main.rand.NextBool(5) && cirrus != -1) - chat = CalamityUtils.GetTextValue("Vanilla.PirateChat.DrunkPrincess"); else if (Main.rand.NextBool(5) && seahorse != -1) chat = CalamityUtils.GetText("Vanilla.PirateChat.SeaKing").Format(Main.npc[seahorse].GivenName); else if (Main.rand.NextBool(5) && Main.LocalPlayer.Center.ToTileCoordinates().X < 380 && !Main.LocalPlayer.Calamity().ZoneSulphur) @@ -955,12 +1015,6 @@ namespace CalamityMod.NPCs string worldEvil = Language.GetTextValue("LegacyMisc." + (WorldGen.crimson ? 102 : 101)); if (Main.rand.NextBool(15) && Main.hardMode) chat = CalamityUtils.GetText("Vanilla.StylistChat.Hardmode").Format(worldEvil); - if (Main.rand.NextBool(15) && cirrus != -1) - { - int noChildSafetyCirrusLines = NPC.downedMoonlord ? Main.rand.Next(2, 3 + 1) : Main.rand.Next(1, 2 + 1); - int childSafetyCirrusLines = NPC.downedMoonlord ? 3 : 1; - chat = CalamityUtils.GetText("Vanilla.StylistChat.DrunkPrincess" + (ChildSafety.Disabled ? noChildSafetyCirrusLines : childSafetyCirrusLines)).Format(Main.npc[cirrus].GivenName); - } if ((Main.rand.NextBool(npc.GivenName == "Amber" ? 10 : 15)) && Main.LocalPlayer.Calamity().pSoulArtifact) { if (Main.LocalPlayer.Calamity().profanedCrystalBuffs) @@ -973,8 +1027,6 @@ namespace CalamityMod.NPCs case NPCID.DD2Bartender: if (Main.rand.NextBool(5) && !Main.dayTime && Main.moonPhase == 0) chat = CalamityUtils.GetTextValue("Vanilla.TavernkeepChat.FullMoon"); - else if (Main.rand.NextBool(10) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.TavernkeepChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); break; case NPCID.TaxCollector: @@ -1003,15 +1055,8 @@ namespace CalamityMod.NPCs chat = CalamityUtils.GetTextValue("Vanilla.TaxCollectorChat.Has100Plat"); break; - case NPCID.TravellingMerchant: - if (Main.rand.NextBool(5) && cirrus != -1 && angelstatue != -1) - chat = CalamityUtils.GetText("Vanilla.TravellingMerchantChat.DrunkPrincessMerchant").Format(Main.npc[cirrus].GivenName, Main.npc[angelstatue].GivenName); - break; - case NPCID.Truffle: - if (Main.rand.NextBool(4) && cirrus != -1) - chat = CalamityUtils.GetText("Vanilla.TruffleChat.DrunkPrincess").Format(Main.npc[cirrus].GivenName); - else if (Main.rand.NextBool(8)) + if (Main.rand.NextBool(8)) chat = CalamityUtils.GetTextValue("Vanilla.TruffleChat.Normal"); break; @@ -1039,10 +1084,8 @@ namespace CalamityMod.NPCs public void BoundNPCSafety(Mod mod, NPC npc) { // Make Bound Town NPCs take no damage - if (BoundNPCIDList.Includes(npc.type)) - { + if (CalamityNPCTypeSets.BoundTownNPC[npc.type]) npc.dontTakeDamageFromHostiles = true; - } } public void MakeTownNPCsTakeMoreDamage(NPC npc, Projectile projectile, Mod mod, ref NPC.HitModifiers modifiers) @@ -1105,104 +1148,94 @@ namespace CalamityMod.NPCs public override void ModifyShop(NPCShop shop) { int type = shop.NpcType; - int goldCost = NPC.downedMoonlord ? 16 : Main.hardMode ? 8 : 4; - - bool happy = Main.LocalPlayer.currentShoppingSettings.PriceAdjustment <= 0.9; + Condition spelunkerGlowCondition = new(Language.GetText("Conditions.NightDayFullMoon"), () => !Main.dayTime || Main.GetMoonPhase() == MoonPhase.Full); // Identical to the one in NPCShopDatabase Condition hasFlareGunUpgrade = new(CalamityUtils.GetText("Condition.HasFlareGun"), () => (Main.LocalPlayer.HasItem(ItemType()) || Main.LocalPlayer.HasItem(ItemType())) && !Main.LocalPlayer.HasItem(ItemID.FlareGun)); - Condition roguePlayer = CalamityConditions.PlayerHasRogueArmor; - Condition wingedPlayer = CalamityConditions.PlayerHasWings; - Condition revengeance = CalamityConditions.InRevengeanceMode; - Condition drunk = CalamityConditions.PlayerAlcoholPoisoned; - Condition downedPolterghast = CalamityConditions.DownedPolterghast; - Condition downedDoG = CalamityConditions.DownedDevourerOfGods; + Condition bestiaryProgressLacewing = new(CalamityUtils.GetText("Condition.LacewingBestiary"), () => Main.GetBestiaryProgressReport().CompletionPercent >= 0.4f); if (type == NPCID.Merchant) { - shop.AddWithCustomValue(ItemID.Bottle, Item.buyPrice(copper: 20)) - .AddWithCustomValue(ItemID.WormholePotion, Item.buyPrice(silver: 5), Condition.HappyEnoughToSellPylons); - shop.Add(ItemID.Flare, hasFlareGunUpgrade) - .Add(ItemID.BlueFlare, hasFlareGunUpgrade) - .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())) - .AddWithCustomValue(ItemID.Burger, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.Hotdog, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.CoffeeCup, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons); + shop.InsertBefore(ItemID.LesserHealingPotion, ItemID.Bottle) + .InsertAfter(ItemID.ManaPotion, ItemID.WormholePotion, Condition.HappyEnoughToSellPylons) + .InsertAfter(ItemID.Safe, ItemID.MusicBox) + .InsertAfter(ItemID.Flare, ItemID.Flare, hasFlareGunUpgrade) + .InsertAfter(ItemID.BlueFlare, ItemID.BlueFlare, hasFlareGunUpgrade) + .AddWithCustomValue(ItemID.AngelStatue, Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCType())); } if (type == NPCID.DyeTrader) { - shop.Add(ItemType(), Condition.Hardmode) + shop.Add(Condition.Hardmode) .AddWithCustomValue(ItemID.DyeTradersScimitar, Item.buyPrice(gold: 15)); } if (type == NPCID.Demolitionist) { - shop.Add(ItemType(), Condition.DownedMechBossAny); + shop.Add(Condition.DownedMechBossAny); } if (type == NPCID.ArmsDealer) { - - shop.AddWithCustomValue(ItemType(), Item.buyPrice(gold: 25), Condition.Hardmode) - .AddWithCustomValue(ItemID.Boomstick, Item.buyPrice(gold: 20), Condition.DownedQueenBee) - .AddWithCustomValue(ItemID.Uzi, Item.buyPrice(gold: 45), Condition.DownedPlantera) - .AddWithCustomValue(ItemID.TacticalShotgun, Item.buyPrice(gold: 60), Condition.DownedGolem) - .AddWithCustomValue(ItemID.SniperRifle, Item.buyPrice(gold: 60), Condition.DownedGolem) - .AddWithCustomValue(ItemID.RifleScope, Item.buyPrice(gold: 60), Condition.DownedGolem); + shop.AddWithCustomValue(ItemType(), Item.buyPrice(gold: 20), Condition.DownedSkeletron) + .Add(Condition.Hardmode) + .AddWithCustomValue(ItemID.Boomstick, Item.buyPrice(gold: 25), Condition.DownedQueenBee) + .AddWithCustomValue(ItemID.Uzi, Item.buyPrice(gold: 50), Condition.DownedPlantera) + .AddWithCustomValue(ItemID.TacticalShotgun, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .AddWithCustomValue(ItemID.SniperRifle, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .AddWithCustomValue(ItemID.RifleScope, Item.buyPrice(platinum: 1), Condition.DownedGolem); } if (type == NPCID.Stylist) { - shop.Add(ItemType(), roguePlayer) - .Add(ItemType(), wingedPlayer) - .Add(ItemType(), revengeance) - .Add(ItemType(), revengeance) - .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)) - .Add(ItemType(), Condition.NpcIsPresent(NPCType()), drunk) - .AddWithCustomValue(ItemID.ChocolateChipCookie, Item.buyPrice(gold: 3), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCType())); + shop.Add(CalamityConditions.PlayerHasRogueArmor) + .Add(CalamityConditions.PlayerHasWings) + .Add(CalamityConditions.InRevengeanceMode) + .Add(CalamityConditions.InRevengeanceMode) + .AddWithCustomValue(ItemID.StylistKilLaKillScissorsIWish, Item.buyPrice(gold: 15)); } if (type == NPCID.Cyborg) { - shop.AddWithCustomValue(ItemID.RocketLauncher, Item.buyPrice(gold: 25), Condition.DownedGolem) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 50), Condition.DownedGolem) - .Add(ItemType(), downedPolterghast); + shop.AddWithCustomValue(ItemID.RocketLauncher, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .Add(Condition.DownedGolem) + .Add(CalamityConditions.DownedPolterghast); } if (type == NPCID.Dryad) { - shop.AddWithCustomValue(ItemID.JungleRose, Item.buyPrice(gold: 2)) - .AddWithCustomValue(ItemID.NaturesGift, Item.buyPrice(gold: 10)) - .Add(ItemType()) - .AddWithCustomValue(ItemID.Grapes, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) - .Add(ItemType(), Condition.DownedSkeletron) - .Add(ItemID.CorruptSeeds, Condition.CrimsonWorld, Condition.InGraveyard, Condition.PreHardmode) - .Add(ItemID.CrimsonSeeds, Condition.CorruptWorld, Condition.InGraveyard, Condition.PreHardmode) // Vanilla sells these in Hardmode, we just make them available at all times - .Add(ItemType(), Condition.NotBloodMoon, Condition.Hardmode); + shop.InsertAfter(ItemID.AshGrassSeeds, ItemType(), Condition.DownedSkeletron) + // Vanilla sells these in Hardmode, we just make them available at all times + // Fun fact: Corrupt and Crimson Seeds are sold twice, in different positions! + // This position is placed over the Graveyard one, and not the Blood Moon one (which is what happens if you insert after Corrupt Seeds). Totally awesome shop database. - Iris + .InsertAfter(ItemID.GrassWall, ItemID.CorruptSeeds, Condition.CrimsonWorld, Condition.InGraveyard, Condition.PreHardmode) + .InsertAfter(ItemID.GrassWall, ItemID.CrimsonSeeds, Condition.CorruptWorld, Condition.InGraveyard, Condition.PreHardmode) + .InsertAfter(ItemID.HallowedGrassEcho, ItemType(), Condition.NotBloodMoon, Condition.Hardmode) + .AddWithCustomValue(ItemID.JungleRose, Item.buyPrice(gold: 3)) + .AddWithCustomValue(ItemID.NaturesGift, Item.buyPrice(gold: 15)) + .Add(); } if (type == NPCID.GoblinTinkerer) { - shop.Add(ItemType()) - .Add(ItemID.Toolbox, Condition.NpcIsPresent(NPCID.Mechanic)) - .AddWithCustomValue(ItemID.Spaghetti, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron); + shop.Add() + .Add(ItemID.Toolbox, Condition.NpcIsPresent(NPCID.Mechanic)); } if (type == NPCID.Mechanic) { - shop.AddWithCustomValue(ItemID.BuilderPotion, Item.buyPrice(gold: 4), Condition.HappyEnoughToSellPylons) - .AddWithCustomValue(ItemID.CombatWrench, Item.buyPrice(gold: 10)); + shop.AddWithCustomValue(ItemID.BuilderPotion, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons) + .AddWithCustomValue(ItemID.CombatWrench, Item.buyPrice(gold: 15)); } if (type == NPCID.Clothier) { - shop.AddWithCustomValue(ItemType(), Item.buyPrice(gold: 10)) - .AddWithCustomValue(ItemID.GoldenKey, Item.buyPrice(gold: 5), Condition.Hardmode) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 8), downedDoG) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 8), downedDoG) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 8), downedDoG) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 8), downedDoG) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 8), downedDoG); + shop.Add() + .AddWithCustomValue(ItemID.GoldenKey, Item.buyPrice(gold: 15), Condition.Hardmode) + .Add(CalamityConditions.DownedDevourerOfGods) + .Add(CalamityConditions.DownedDevourerOfGods) + .Add(CalamityConditions.DownedDevourerOfGods) + .Add(CalamityConditions.DownedDevourerOfGods) + .Add(CalamityConditions.DownedDevourerOfGods); } if (type == NPCID.Painter) @@ -1212,68 +1245,97 @@ namespace CalamityMod.NPCs if (type == NPCID.Steampunker) { - shop.Add(ItemType(), Condition.NotRemixWorld) - .Add(ItemID.PurpleSolution, Condition.InGraveyard, Condition.CrimsonWorld, Condition.NotRemixWorld) - .Add(ItemID.RedSolution, Condition.InGraveyard, Condition.CorruptWorld, Condition.NotRemixWorld); + shop.InsertAfter(ItemID.BlueSolution, ItemType(), Condition.NotRemixWorld) + .InsertAfter(ItemID.PurpleSolution, ItemID.PurpleSolution, Condition.InGraveyard, Condition.CrimsonWorld, Condition.NotRemixWorld) + .InsertAfter(ItemID.RedSolution, ItemID.RedSolution, Condition.InGraveyard, Condition.CorruptWorld, Condition.NotRemixWorld) + .Add() + .Add() + .Add() + .Add(); } if (type == NPCID.Wizard) { - shop.AddWithCustomValue(ItemType(), CalamityGlobalItem.RarityLightRedBuyPrice * 3) - .AddWithCustomValue(ItemID.MagicMissile, Item.buyPrice(gold: 5)) - .AddWithCustomValue(ItemID.SpectreStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) - .AddWithCustomValue(ItemID.InfernoFork, Item.buyPrice(gold: 25), Condition.DownedGolem) - .AddWithCustomValue(ItemID.ShadowbeamStaff, Item.buyPrice(gold: 25), Condition.DownedGolem) - .AddWithCustomValue(ItemID.MagnetSphere, Item.buyPrice(gold: 25), Condition.DownedGolem); + shop.Add() + .AddWithCustomValue(ItemID.MagicMissile, Item.buyPrice(gold: 25)) + .AddWithCustomValue(ItemID.SpectreStaff, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .AddWithCustomValue(ItemID.InfernoFork, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .AddWithCustomValue(ItemID.ShadowbeamStaff, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .AddWithCustomValue(ItemID.MagnetSphere, Item.buyPrice(platinum: 1), Condition.DownedGolem) + .Add() + .Add() + .Add() + .Add(); } if (type == NPCID.WitchDoctor) { - shop.Add(ItemType()) - .Add(ItemType()) - .Add(ItemType()) - .Add(ItemType()) - .Add(ItemType()) - .AddWithCustomValue(ItemID.ButterflyDust, Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ItemID.FriedEgg, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons); + shop.InsertAfter(ItemID.OasisFountain, ItemType()) + .InsertAfter(ItemID.OasisFountain, ItemType()) + .InsertAfter(ItemID.OasisFountain, ItemType()) + .InsertAfter(ItemID.OasisFountain, ItemType()) + .InsertAfter(ItemID.OasisFountain, ItemType()) + .AddWithCustomValue(ItemID.ButterflyDust, Item.buyPrice(gold: 25), Condition.DownedGolem); } if (type == NPCID.PartyGirl) { - shop.AddWithCustomValue(ItemID.GenderChangePotion, Item.buyPrice(silver: 25), Condition.HappyEnoughToSellPylons) - .AddWithCustomValue(ItemID.Pizza, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.DownedSkeletron) - .AddWithCustomValue(ItemID.CreamSoda, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons); + shop.Add(ItemID.GenderChangePotion, Condition.HappyEnoughToSellPylons); } if (type == NPCID.Princess) { - shop.AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(gold: 50), Condition.Hardmode) - .Add(ItemType()) - .Add(ItemID.AppleJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.FruitJuice, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.Lemonade, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.PrismaticPunch, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.SmoothieofDarkness, Condition.NpcIsPresent(NPCType())) - .Add(ItemID.TropicalSmoothie, Condition.NpcIsPresent(NPCType())); + Mod musicMod = ExternalMods.musicMod; + musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); + musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); + musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); + musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); + + shop.InsertAfter(ItemID.MusicBoxCredits, interlude1Box.Type, CalamityConditions.DownedCalamitasClone) + .InsertAfter(ItemID.MusicBoxCredits, interlude2Box.Type, Condition.DownedMoonLord) + .InsertAfter(ItemID.MusicBoxCredits, interlude3Box.Type, CalamityConditions.DownedYharon) + .InsertAfter(ItemID.MusicBoxCredits, eulogyBox.Type, CalamityConditions.DownedDevourerOfGods) + .AddWithCustomValue(ItemID.PrincessWeapon, Item.buyPrice(platinum: 1), Condition.Hardmode) + .Add(); } if (type == NPCID.SkeletonMerchant) { - shop.AddWithCustomValue(ItemType(), Item.buyPrice(silver: 25)) - .Add(ItemID.MilkCarton) + shop.InsertAfter(ItemID.HealingPotion, ItemType()) + .InsertAfter(ItemID.HealingPotion, ItemID.MilkCarton) + .InsertAfter(ItemID.SpelunkerFlare, ItemID.SpelunkerFlare, spelunkerGlowCondition, hasFlareGunUpgrade) .AddWithCustomValue(ItemID.Marrow, Item.buyPrice(gold: 25), Condition.Hardmode) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 12)) - .AddWithCustomValue(ItemType(), Item.buyPrice(gold: 12)); - } - - if (type == NPCID.Golfer) - { - shop.AddWithCustomValue(ItemID.PotatoChips, Item.buyPrice(gold: 1), Condition.HappyEnoughToSellPylons); + .AddWithCustomValue(Item.buyPrice(gold: 15)) + .AddWithCustomValue(Item.buyPrice(gold: 15)); } if (type == NPCID.BestiaryGirl) { - shop.AddWithCustomValue(ItemID.Steak, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.Hardmode); + shop.Add(ItemID.EmpressButterfly, bestiaryProgressLacewing); + } + + if (type == NPCID.Truffle) + { + shop.Add(); + } + } + + public override void ModifyActiveShop(NPC npc, string shopName, Item[] items) + { + // TODO: Uses a hardcoded string since dedicated names are currently hardcoded strings + // Will need to be changed if dedicated names are localized in the future + if (npc.type == NPCID.SkeletonMerchant && npc.GivenName == "Sans Undertale") + { + int index = 0; + for (int i = 0; i < Chest.maxItems; i++) + { + if (items[i] == null) + { + index = i; + break; + } + } + items[index] = new Item(ItemType()); } } #endregion diff --git a/NPCs/CalamityPierceResistance.cs b/NPCs/CalamityPierceResistance.cs index c69f0b3ad7..ac34f3d460 100644 --- a/NPCs/CalamityPierceResistance.cs +++ b/NPCs/CalamityPierceResistance.cs @@ -62,7 +62,6 @@ namespace CalamityMod.NPCs exemptProjectiles.Add(ProjectileType()); // Included here as it does not have a projectile exemptProjectiles.Add(ProjectileID.MonkStaffT3); exemptProjectiles.Add(ProjectileID.PiercingStarlight); - exemptProjectiles.Add(ProjectileID.SandnadoFriendly); exemptProjectiles.Add(ProjectileID.Terragrim); // Specific vanilla projectile single hitbox exemptions @@ -70,6 +69,9 @@ namespace CalamityMod.NPCs singleHitboxExemptProjectiles[ProjectileID.NettleBurstLeft] = true; singleHitboxExemptProjectiles[ProjectileID.NettleBurstRight] = true; singleHitboxExemptProjectiles[ProjectileID.PrincessWeapon] = true; + singleHitboxExemptProjectiles[ProjectileID.ToxicCloud] = true; + singleHitboxExemptProjectiles[ProjectileID.ToxicCloud2] = true; + singleHitboxExemptProjectiles[ProjectileID.ToxicCloud3] = true; var projectileTypes = AssemblyManager.GetLoadableTypes(CalamityMod.Instance.Code) .Where(type => !type.IsAbstract && type.IsSubclassOf(typeof(ModProjectile))); @@ -145,7 +147,7 @@ namespace CalamityMod.NPCs private void PierceResistGlobal(Projectile projectile, NPC npc, ref NPC.HitModifiers modifiers) { // Thanatos segments do not trigger pierce resistance if they are closed - if (ThanatosIDList.Includes(npc.type) && npc.GetGlobalNPC().unbreakableDR) + if (CalamityNPCTypeSets.Thanatos.Contains(npc.type) && npc.GetGlobalNPC().unbreakableDR) return; float damageReduction = projectile.Calamity().timesPierced * BalancingConstants.PierceResistHarshness; diff --git a/NPCs/CeaselessVoid/CeaselessVoid.cs b/NPCs/CeaselessVoid/CeaselessVoid.cs index 64336874e0..6554662478 100644 --- a/NPCs/CeaselessVoid/CeaselessVoid.cs +++ b/NPCs/CeaselessVoid/CeaselessVoid.cs @@ -12,13 +12,14 @@ using CalamityMod.Items.Potions; using CalamityMod.Items.TreasureBags; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; +using CalamityMod.Projectiles.Boss; using CalamityMod.Sounds; using CalamityMod.UI.VanillaBossBars; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using System; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -26,6 +27,8 @@ using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; +using CalamityMod.UI; namespace CalamityMod.NPCs.CeaselessVoid { @@ -39,6 +42,8 @@ namespace CalamityMod.NPCs.CeaselessVoid public bool playedbuildsound = false; + public bool madeItToLocation = true; + public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 6; @@ -52,34 +57,33 @@ namespace CalamityMod.NPCs.CeaselessVoid NPCID.Sets.MPAllowedEnemies[Type] = true; if (!Main.dedServ) { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); + GlowTexture = Request(Texture + "Glow", AssetRequestMode.AsyncLoad); } } + public static int BeamPortalDamage = 60; // 240 + public static int DarkEnergyProjectileDamage = 60; // 240 + public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 180; // 360 NPC.npcSlots = 36f; NPC.width = 100; NPC.height = 100; NPC.defense = 80; - CalamityGlobalNPC global = NPC.Calamity(); - global.DR = 0.5f; + NPC.Calamity().DR = 0.5f; NPC.LifeMaxNERB(65000, 78000, 72000); - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(gold: 50); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.boss = true; - NPC.BossBar = ModContent.GetInstance(); + NPC.BossBar = GetInstance(); NPC.DeathSound = DeathSound; + NPC.Calamity().canBreakPlayerDefense = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -125,7 +129,530 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void AI() { - CeaselessVoidAI.VanillaCeaselessVoidAI(NPC, Mod); + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); + CalamityGlobalNPC.voidBoss = NPC.whoAmI; + + // Percent life remaining + double lifeRatio = NPC.life / (double)NPC.lifeMax; + + // Difficulty modes + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Phases + bool phase2 = lifeRatio <= 0.7; + bool phase3 = lifeRatio <= 0.4; + bool phase4 = lifeRatio <= 0.1; + bool theBigSucc = NPC.life / (double)NPC.lifeMax <= 0.1; + bool succSoHardThatYouDie = NPC.life / (double)NPC.lifeMax <= 0.005; + + // Spawn Dark Energies + int darkEnergyAmt = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; + if (phase2) + darkEnergyAmt += 1; + if (phase3) + darkEnergyAmt += 1; + if (phase4) + darkEnergyAmt += 1; + + if (Main.getGoodWorld) + darkEnergyAmt *= 2; + + // Spawn a few Dark Energies as soon as the fight starts + int spacing = 360 / darkEnergyAmt; + int distance2 = 10; + if (NPC.ai[2] == 0f) + { + NPC.ai[2] = 1f; + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 0.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1.5f); + } + + // If there are any Dark Energies alive, change AI and don't take damage + bool anyDarkEnergies = NPC.AnyNPCs(NPCType()); + bool movingDuringSuccPhase = NPC.ai[3] == 0f; + NPC.dontTakeDamage = anyDarkEnergies || theBigSucc || movingDuringSuccPhase; + + // Get a target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + NPC.TargetClosest(); + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + Player player = Main.player[NPC.target]; + + // Despawn + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || (player.position.Y < Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive)) + { + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || (player.position.Y < Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive)) + { + if (NPC.velocity.Y > 3f) + NPC.velocity.Y = 3f; + NPC.velocity.Y -= 0.1f; + if (NPC.velocity.Y < -12f) + NPC.velocity.Y = -12f; + + if (NPC.timeLeft > 60) + NPC.timeLeft = 60; + + return; + } + } + else if (NPC.timeLeft < 1800) + NPC.timeLeft = 1800; + + // Increase projectile fire rate based on number of nearby active tiles + float projectileFireRateMultiplier = Main.getGoodWorld ? 0.5f : 1.5f; + + // Decides whether Ceaseless moves closer to its target or not + float distanceRequiredToMove = Main.getGoodWorld ? 300f : 720f; + bool move = Vector2.Distance(NPC.Center, player.Center) > distanceRequiredToMove || !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); + + // Succ attack + if (!anyDarkEnergies) + { + // This is here because it's used in multiple places + float suckDistance = death ? 1600f : revenge ? 1440f : expertMode ? 1280f : 1040f; + + // Move closer to the target before trying to succ + if (movingDuringSuccPhase) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (move) + Movement(true); + else + NPC.ai[3] = 1f; + } + else + { + // Set damage + NPC.damage = NPC.defDamage; + + // Use this to generate more and more dust in final phase + float finalPhaseDustRatio = 1f; + if (succSoHardThatYouDie) + { + finalPhaseDustRatio = 5f; + } + else if (theBigSucc) + { + float amount = (10f - (float)(NPC.life / (double)NPC.lifeMax) * 100f) / 10f; + finalPhaseDustRatio += MathHelper.Lerp(0f, 2f, amount); + } + + // Slow down + if (NPC.velocity.Length() > 0.5f) + NPC.velocity *= 0.8f; + else + NPC.velocity = Vector2.Zero; + + // Move towards target again if they get outside the succ radius + float moveCloserGateValue = suckDistance * 0.8f; + if (Vector2.Distance(NPC.Center, player.Center) > moveCloserGateValue) + NPC.ai[3] = 0f; + + // Ceaseless Void sucks in dark energy in different patterns + // This attack also sucks in all players that are within reach of the succ + for (int h = 0; h < 3; h++) + { + float distanceDivisor = h + 1f; + float dustDistance = suckDistance / distanceDivisor; + int numDust = (int)(0.1f * MathHelper.TwoPi * dustDistance); + Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * dustDistance; + + int var = (int)(dustDistance / finalPhaseDustRatio); + float dustVelocity = 24f / distanceDivisor * finalPhaseDustRatio; + for (int i = 0; i < numDust; i++) + { + if (Main.rand.NextBool(var)) + { + dustOffset = dustOffset.RotatedBy(MathHelper.TwoPi / numDust); + Vector2 dustSpawn = NPC.Center + dustOffset; + Dust dust = Dust.NewDustPerfect(dustSpawn, DustType(), Utils.DirectionTo(dustSpawn, NPC.Center) * dustVelocity, Scale: 3 - h); + dust.fadeIn = 1f; + } + } + } + + float succPower = 0.125f + finalPhaseDustRatio * 0.125f; + for (int i = 0; i < Main.maxPlayers; i++) + { + float distance = Vector2.Distance(Main.player[i].Center, NPC.Center); + if (distance < suckDistance && Main.player[i].grappling[0] == -1) + { + if (Collision.CanHit(NPC.Center, 1, 1, Main.player[i].Center, 1, 1)) + { + float distanceRatio = distance / suckDistance; + float multiplier = 1f - distanceRatio; + + if (Main.player[i].Center.X < NPC.Center.X) + Main.player[i].velocity.X += succPower * multiplier; + else + Main.player[i].velocity.X -= succPower * multiplier; + } + } + } + + // Slowly die in final phase and then implode + // This phase lasts 20 seconds + if (theBigSucc && calamityGlobalNPC.newAI[1] % 60f == 0f) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int damageAmt = NPC.lifeMax / 200; + NPC.life -= damageAmt; + NPC.DamageEffect(damageAmt); + } + + if (NPC.life <= (NPC.lifeMax / 40) && !playedbuildsound) + { + SoundEngine.PlaySound(BuildupSound, NPC.Center); + playedbuildsound = true; + } + + if (NPC.life <= 0) + { + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + } + + NPC.netUpdate = true; + } + + // Beam Portals + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (calamityGlobalNPC.newAI[1] == 0f) + { + int numBeamPortals = revenge ? 3 : 2; + float degrees = 360 / numBeamPortals; + float beamPortalDistance = death ? 400f : revenge ? 420f : expertMode ? 440f : 480f; + int type = ProjectileType(); + for (int i = 0; i < numBeamPortals; i++) + { + float ai1 = i * degrees; + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (float)(Math.Sin(i * degrees) * beamPortalDistance), player.Center.Y + (float)(Math.Cos(i * degrees) * beamPortalDistance), 0f, 0f, type, BeamPortalDamage, 0f, Main.myPlayer, ai1, 0f); + } + } + } + + // Use this timer to lessen Dark Energy projectile rate of fire while Beam Portals are active + float beamPortalTimeLeft = 600f; + bool summonLessDarkEnergies = false; + if (calamityGlobalNPC.newAI[1] < beamPortalTimeLeft) + { + calamityGlobalNPC.newAI[1] += 1f; + summonLessDarkEnergies = true; + } + else if (theBigSucc) + calamityGlobalNPC.newAI[1] += 1f; + + // Suck in Dark Energy projectiles from far away + calamityGlobalNPC.newAI[3] += 1f; + float darkEnergySpiralGateValue = (summonLessDarkEnergies ? 24f : 12f) * projectileFireRateMultiplier; + if (calamityGlobalNPC.newAI[3] >= darkEnergySpiralGateValue) + { + calamityGlobalNPC.newAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + bool normalSpread = NPC.localAI[0] % 2f == 0f; + float speed = 0.5f; + int totalProjectiles = 4; + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -speed, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1]); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(MathHelper.TwoPi / totalProjectiles * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, DarkEnergyProjectileDamage, 0f, Main.myPlayer); + } + } + + NPC.localAI[1] += 10f; + } + + // Summon some extra projectiles in Expert Mode + if (phase2 && expertMode) + { + NPC.localAI[2] += 1f; + if (NPC.localAI[2] >= 60f * projectileFireRateMultiplier) + { + NPC.localAI[2] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + bool normalSpread = NPC.localAI[0] % 2f != 0f; + float speed = 2f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -velocityX, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, DarkEnergyProjectileDamage, 0f, Main.myPlayer); + } + } + } + } + + // Summon some extra projectiles in Revengeance Mode + if (phase4 && revenge) + { + NPC.localAI[3] += 1f; + if (NPC.localAI[3] >= 90f * projectileFireRateMultiplier) + { + NPC.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int type = ProjectileType(); + bool normalSpread = NPC.localAI[0] % 2f == 0f; + float speed = 4f; + int totalProjectiles = 2; + float radians = MathHelper.TwoPi / totalProjectiles; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX = (float)(speed * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = new Vector2(normalSpread ? 0f : -velocityX, -speed); + float radialOffset = MathHelper.ToRadians(NPC.localAI[1] * 0.25f); + for (int i = 0; i < totalProjectiles; i++) + { + Vector2 spawnVector = NPC.Center + Vector2.Normalize(spinningPoint.RotatedBy(radians * i + radialOffset)) * suckDistance; + Vector2 velocity = Vector2.Normalize(NPC.Center - spawnVector) * speed; + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, velocity, type, DarkEnergyProjectileDamage, 0f, Main.myPlayer); + } + } + } + } + } + } + else + { + // Avoid cheap bullshit + NPC.damage = 0; + if (move) + { + madeItToLocation = false; + } + if (!madeItToLocation) + { + Movement(false); + } + else + { + // Slow down + if (NPC.velocity.Length() > 0.5f) + NPC.velocity *= 0.8f; + else + NPC.velocity = Vector2.Zero; + } + + // Count up all Dark Energy HP values + int totalDarkEnergyHP = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == NPCType()) + totalDarkEnergyHP += darkEnergy.life; + } + + // Destroy all Dark Energies if their total HP is below 20% + int darkEnergyMaxHP = BossRushEvent.BossRushActive ? DarkEnergy.MaxBossRushHP : DarkEnergy.MaxHP; + //These are still needed so that CV Dark energy despawn works properly + double HPBoost = CalamityServerConfig.Instance.BossHealthBoost * 0.01; + darkEnergyMaxHP += (int)(darkEnergyMaxHP * HPBoost); + + int totalDarkEnergiesSpawned = darkEnergyAmt * 3 + 2; + int totalDarkEnergyMaxHP = darkEnergyMaxHP * totalDarkEnergiesSpawned; + int succPhaseGateValue = (int)(totalDarkEnergyMaxHP * 0.2); + if (totalDarkEnergyHP < succPhaseGateValue) + { + SoundEngine.PlaySound(SoundID.NPCDeath44, NPC.Center); + + // Kill all Dark Energies + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC darkEnergy = Main.npc[i]; + if (darkEnergy.active && darkEnergy.type == NPCType()) + { + darkEnergy.HitEffect(); + darkEnergy.active = false; + darkEnergy.netUpdate = true; + } + } + + // Generate a dust explosion + int dustAmt = 30; + int random = 3; + for (int j = 0; j < 10; j++) + { + random += j * 2; + for (int d = 0; d < dustAmt; d++) + { + Vector2 dustVelocity = new Vector2(Main.rand.Next(-random, random), Main.rand.Next(-random, random)); + dustVelocity = Vector2.Normalize(dustVelocity) * random * 2f; + Dust realDust = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2CircularEdge(10f, 10f), (int)CalamityDusts.PurpleCosmilite, dustVelocity, 100, default, 5f); + realDust.noGravity = true; + } + } + } + } + + // Basic movement towards a location + void Movement(bool succ) + { + float velocity = ((expertMode ? 7.5f : 6f) + (float)(death ? 2f * (1D - lifeRatio) : 0f)); + float acceleration = (death ? 0.2f : expertMode ? 0.16f : 0.12f) + (float)(death ? 0.04f * (1D - lifeRatio) : 0f); + + // Increase speed dramatically in succ phase + if (succ) + { + velocity *= 2f; + acceleration *= 2f; + } + + if (!madeItToLocation) + { + + velocity *= 2f; + acceleration *= 5f; + } + + if (Main.getGoodWorld) + { + velocity *= 1.15f; + acceleration *= 1.15f; + } + + Vector2 destination = player.Center; + + // Move between 8 different positions around the player, in order + float maxDistance = 320f; + Vector2 moveToOffset = succ ? Vector2.Zero : Main.getGoodWorld ? new Vector2(0f, -maxDistance) : Vector2.Zero; + if ((!succ && Main.getGoodWorld) || !madeItToLocation) + { + // Move to a new location every few seconds + calamityGlobalNPC.newAI[2] += 1f; + float newPositionGateValue = death ? 180f : revenge ? 210f : expertMode ? 240f : 300f; + if (calamityGlobalNPC.newAI[2] > newPositionGateValue) + { + calamityGlobalNPC.newAI[2] = 0f; + + NPC.ai[0] += 1f; + if (NPC.ai[0] > 7f) + NPC.ai[0] = 0f; + } + moveToOffset += new Vector2(maxDistance, 0).RotatedBy(NPC.ai[0] / 8f * MathHelper.TwoPi); + } + + destination += moveToOffset; + + // How far Ceaseless Void is from where it's supposed to be + Vector2 distanceFromDestination = destination - NPC.Center; + + // Movement + if (NPC.Distance(destination) > maxDistance || succ || (!Main.getGoodWorld && !madeItToLocation)) + CalamityUtils.SmoothMovement(NPC, 0f, distanceFromDestination, velocity, acceleration, true); + if (NPC.Distance(destination) < 80) + { + madeItToLocation = true; + } + } + + // Spawn more Dark Energies as the fight progresses + if (calamityGlobalNPC.newAI[0] == 0f && NPC.life > 0) + calamityGlobalNPC.newAI[0] = NPC.lifeMax; + + if (NPC.life > 0) + { + int healthGateValue = (int)(NPC.lifeMax * 0.3); + if ((NPC.life + healthGateValue) < calamityGlobalNPC.newAI[0]) + { + NPC.TargetClosest(); + calamityGlobalNPC.newAI[0] = NPC.life; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + calamityGlobalNPC.newAI[3] = 0f; + NPC.ai[3] = 0f; + NPC.localAI[0] += 1f; + NPC.localAI[1] = 0f; + NPC.localAI[2] = 0f; + NPC.localAI[3] = 0f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + if (phase4) + { + madeItToLocation = false; + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j * 2f); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 3f); + } + else if (phase3) + { + madeItToLocation = false; + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j * 1.5f); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 0.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 2f); + } + else + { + madeItToLocation = false; + for (int i = 0; i < darkEnergyAmt; i++) + { + for (int j = 0; j < 3; j++) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + (Math.Sin(i * spacing) * distance2)), (int)(NPC.Center.Y + (Math.Cos(i * spacing) * distance2)), NPCType(), NPC.whoAmI, i * spacing, j); + } + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 1.5f); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)(NPC.Center.Y + distance2), NPCType(), NPC.whoAmI, 0f, 2.5f); + } + } + + // Despawn potentially hazardous projectiles when entering a new phase + for (int i = 0; i < Main.maxProjectiles; i++) + { + Projectile projectile = Main.projectile[i]; + if (projectile.active) + { + if (projectile.type == ProjectileType() || projectile.type == ProjectileType() || + projectile.type == ProjectileType() || projectile.type == ProjectileType()) + { + if (projectile.timeLeft > 30) + projectile.timeLeft = 30; + } + } + } + } + } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -219,7 +746,7 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void ModifyNPCLoot(NPCLoot npcLoot) { - npcLoot.Add(ItemDropRule.BossBag(ModContent.ItemType())); + npcLoot.Add(ItemDropRule.BossBag(ItemType())); // Normal drops: Everything that would otherwise be in the bag LeadingConditionRule normalOnly = new LeadingConditionRule(new Conditions.NotExpert()); @@ -228,40 +755,40 @@ namespace CalamityMod.NPCs.CeaselessVoid // Weapons int[] weapons = new int[] { - ModContent.ItemType(), - ModContent.ItemType(), + ItemType(), + ItemType(), }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); // Materials - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 10, 12)); + normalOnly.Add(DropHelper.PerPlayer(ItemType(), 1, 10, 12)); // Equipment - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(DropHelper.PerPlayer(ItemType())); // Vanity - normalOnly.Add(ModContent.ItemType(), 7); - var godSlayerVanity = ItemDropRule.Common(ModContent.ItemType(), 20); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); - godSlayerVanity.OnSuccess(ItemDropRule.Common(ModContent.ItemType())); + normalOnly.Add(ItemType(), 7); + var godSlayerVanity = ItemDropRule.Common(ItemType(), 20); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ItemType())); + godSlayerVanity.OnSuccess(ItemDropRule.Common(ItemType())); normalOnly.Add(godSlayerVanity); - normalOnly.Add(ModContent.ItemType(), ThankYouPainting.DropInt); + normalOnly.Add(ItemType(), ThankYouPainting.DropInt); } - npcLoot.Add(ModContent.ItemType(), 10); + npcLoot.Add(ItemType(), 10); // Relic - npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ModContent.ItemType()); + npcLoot.DefineConditionalDropSet(DropHelper.RevAndMaster).Add(ItemType()); // GFB Eclipse Mirror and Nucleogenesis drop var GFBOnly = npcLoot.DefineConditionalDropSet(DropHelper.GFB); { - GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); - GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); + GFBOnly.Add(DropHelper.PerPlayer(ItemType()), hideLootReport: true); + GFBOnly.Add(DropHelper.PerPlayer(ItemType()), hideLootReport: true); } // Lore - npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCeaselessVoid, ModContent.ItemType(), desc: DropHelper.FirstKillText); + npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCeaselessVoid, ItemType(), desc: DropHelper.FirstKillText); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) @@ -269,9 +796,9 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { - potionType = ModContent.ItemType(); + potionType = ItemType(); } public override void HitEffect(NPC.HitInfo hit) @@ -279,12 +806,8 @@ namespace CalamityMod.NPCs.CeaselessVoid if (NPC.soundDelay == 0 && NPC.life >= NPC.lifeMax * 0.05f) { NPC.soundDelay = 8; - float pitchVar = 0; - if (Main.zenithWorld) - { - pitchVar = Main.rand.Next(-60, 41) * 0.01f; - } - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + pitchVar }, NPC.Center); + float pitchVar = Main.zenithWorld ? 0.4f : 0; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCHit/OtherworldlyHit") with { PitchVariance = pitchVar }, NPC.Center); } for (int k = 0; k < 5; k++) diff --git a/NPCs/CeaselessVoid/DarkEnergy.cs b/NPCs/CeaselessVoid/DarkEnergy.cs index 52f34259d9..f147f52a7f 100644 --- a/NPCs/CeaselessVoid/DarkEnergy.cs +++ b/NPCs/CeaselessVoid/DarkEnergy.cs @@ -45,9 +45,9 @@ namespace CalamityMod.NPCs.CeaselessVoid public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.dontTakeDamage = true; NPC.width = NPC.height = HitboxSize; NPC.defense = 50; @@ -59,10 +59,6 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -161,18 +157,14 @@ namespace CalamityMod.NPCs.CeaselessVoid NPC.timeLeft = 1800; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Gets how enraged Ceaseless Void is - float tileEnrageMult = Main.npc[CalamityGlobalNPC.voidBoss].ai[1]; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Distance from Ceaseless Void - double maxDistance = bossRush ? 1200D : death ? 1040D : revenge ? 960D : expertMode ? 880D : minMaxDistance; + double maxDistance = death ? 1040D : revenge ? 960D : expertMode ? 880D : minMaxDistance; double rateOfChangeIncrease = (maxDistance / minMaxDistance) - 1D; - double rateOfChange = (NPC.ai[1] * 0.5f) + 2D + (tileEnrageMult - 1f) + rateOfChangeIncrease; + double rateOfChange = (NPC.ai[1] * 0.5f) + 2D + rateOfChangeIncrease; if (NPC.Calamity().newAI[0] == 0f) { distance += rateOfChange; @@ -193,7 +185,7 @@ namespace CalamityMod.NPCs.CeaselessVoid } // Rotation velocity - float minRotationVelocity = 0.5f + tileEnrageMult - 1f; + float minRotationVelocity = 0.5f; float rotationVelocityIncrease = death ? 0.2f : revenge ? 0.15f : expertMode ? 0.1f : 0f; rotationVelocityIncrease += rotationVelocityIncrease * (NPC.ai[1] * 0.5f); @@ -284,7 +276,7 @@ namespace CalamityMod.NPCs.CeaselessVoid if (Main.zenithWorld) { if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Obstructed, 30, true); + target.AddBuff(BuffID.Blackout, 30, true); } } diff --git a/NPCs/Crabulon/CrabShroom.cs b/NPCs/Crabulon/CrabShroom.cs index 2c3e928208..665ccc03c2 100644 --- a/NPCs/Crabulon/CrabShroom.cs +++ b/NPCs/Crabulon/CrabShroom.cs @@ -28,17 +28,15 @@ namespace CalamityMod.NPCs.Crabulon public override void SetDefaults() { NPC.aiStyle = -1; - NPC.GetNPCDamage(); + NPC.damage = 18; // 36 NPC.width = 14; NPC.height = 14; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) NPC.scale = 2f; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 15; + NPC.lifeMax = 15; if (BossRushEvent.BossRushActive) - NPC.lifeMax = 8000; - if (Main.getGoodWorld) - NPC.lifeMax *= 2; + NPC.lifeMax = 6000; AIType = -1; NPC.knockBackResist = 0.5f; NPC.noGravity = true; @@ -48,10 +46,6 @@ namespace CalamityMod.NPCs.Crabulon NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -70,8 +64,8 @@ namespace CalamityMod.NPCs.Crabulon bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - float xVelocityLimit = BossRushEvent.BossRushActive ? 12f : death ? 8f : revenge ? 6f : 5f; - float yVelocityLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; + float xVelocityLimit = death ? 8f : revenge ? 6f : 5f; + float yVelocityLimit = Main.getGoodWorld ? 0.25f : death ? 0.75f : revenge ? 0.9f : 1f; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -103,7 +97,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.rotation = NPC.velocity.X * 0.1f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) { float pushVelocity = 0.5f; foreach (NPC n in Main.ActiveNPCs) diff --git a/NPCs/Crabulon/Crabulon.cs b/NPCs/Crabulon/Crabulon.cs index e14dd79c61..531fdd9487 100644 --- a/NPCs/Crabulon/Crabulon.cs +++ b/NPCs/Crabulon/Crabulon.cs @@ -73,11 +73,13 @@ namespace CalamityMod.NPCs.Crabulon } } + public static int MushroomShotDamage = 9; // 36 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 40; // 64 (1.6x expert scaling) NPC.npcSlots = 14f; - NPC.GetNPCDamage(); NPC.width = 196; NPC.height = 196; NPC.defense = 8; @@ -88,7 +90,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.noTileCollide = false; NPC.boss = true; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.value = Item.buyPrice(gold: 5); NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToHeat = true; @@ -100,9 +102,6 @@ namespace CalamityMod.NPCs.Crabulon NPC.scale *= 1.5f; NPC.defense += 12; } - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -132,11 +131,9 @@ namespace CalamityMod.NPCs.Crabulon { Lighting.AddLight(NPC.Center, 0f, 0.3f, 0.7f); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; NPC.spriteDirection = NPC.direction; @@ -146,7 +143,7 @@ namespace CalamityMod.NPCs.Crabulon // Phases bool phase2 = lifeRatio < 0.66f && expertMode; bool phase3 = lifeRatio < 0.33f && expertMode; - bool phase4 = lifeRatio < 0.15f && masterMode; + bool phase4 = lifeRatio < 0.15f && death; int despawnDistanceInTiles = 500; @@ -186,32 +183,6 @@ namespace CalamityMod.NPCs.Crabulon else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - // Enrage - if ((!player.ZoneGlowshroom || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (biomeEnraged && (!player.ZoneGlowshroom || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - if (Main.getGoodWorld) - enrageScale += 0.5f; - if (NPC.ai[0] < 2f) { int mushBombAmt = phase4 ? 6 : phase3 ? 3 : phase2 ? 2 : 1; @@ -241,7 +212,7 @@ namespace CalamityMod.NPCs.Crabulon { float yVelocity = death ? 1f : expertMode ? 2.5f : 4f; Vector2 projectileVelocity = (Vector2.Normalize(player.Center - NPC.Center) * mushBombSpeed) - Vector2.UnitY * yVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, NPC.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -259,9 +230,9 @@ namespace CalamityMod.NPCs.Crabulon if (phase3) NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) - NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; - // Gets tired easily in final phase. - Fabsol + // Gets tired easily in final phase. float idleTime = phase4 ? 480f : death ? 60f : expertMode ? 90f : 120f; if (NPC.ai[1] >= idleTime) { @@ -279,14 +250,14 @@ namespace CalamityMod.NPCs.Crabulon // Avoid cheap bullshit NPC.damage = 0; - float walkingVelocity = (death ? (5f + 2f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f) + 2.5f * enrageScale; + float walkingVelocity = death ? (5f + 2f * (1f - lifeRatio)) : expertMode ? 5f : 3.5f; if (phase2) walkingVelocity += 0.5f; if (phase3) walkingVelocity += 0.75f; if (phase4) walkingVelocity += 1f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) walkingVelocity *= 2f; bool shouldWalkSlower = false; @@ -355,7 +326,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; if (NPC.Distance(player.Center) < 160f) - NPC.ai[1] += masterMode ? 4f : expertMode ? 2f : 1f; + NPC.ai[1] += death ? 4f : expertMode ? 2f : 1f; float stompPhaseGateValue = (revenge ? 150f : expertMode ? 240f : 360f) - (death ? 90f * (1f - lifeRatio) : 0f); if (NPC.ai[1] >= stompPhaseGateValue) @@ -410,7 +381,7 @@ namespace CalamityMod.NPCs.Crabulon NPC.ai[1] += 1f; } - float jumpGateValue = (bossRush ? 15f : expertMode ? 60f : 120f) / (enrageScale + 1f); + float jumpGateValue = expertMode ? 60f : 120f; if (NPC.ai[1] >= jumpGateValue) { NPC.ai[1] = -20f; @@ -518,26 +489,25 @@ namespace CalamityMod.NPCs.Crabulon SoundEngine.PlaySound(SlamSound, NPC.Center); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if ((NPC.ai[2] % 2f == 0f || death) && ((phase2 && revenge) || (phase3 && expertMode))) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; + float projectileVelocity = CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 24 : phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. + int numProj = phase4 ? 14 : CalamityWorld.death ? (phase3 ? 10 : 16) : 12; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 randomVelocityVector = new Vector2((Main.rand.NextFloat() - 0.5f) * 4f, (Main.rand.NextFloat() - 0.5f) * 4f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -550,19 +520,19 @@ namespace CalamityMod.NPCs.Crabulon SoundEngine.PlaySound(SoundID.Item42, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - float projectileVelocity = BossRushEvent.BossRushActive ? 24f : CalamityWorld.death ? 15f : 10f; + float projectileVelocity = CalamityWorld.death ? 15f : 10f; Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; destination.Normalize(); destination *= projectileVelocity; - // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. - Fabsol - int numProj = bossRush ? 16 : phase4 ? 8 : (phase3 && death) ? 6 : 8; + // Less mushrooms in Death Mode phase 3 because otherwise it's an absolute shitshow. + int numProj = phase4 ? 8 : (phase3 && death) ? 6 : 8; float rotation = MathHelper.ToRadians(60); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 randomVelocityVector = new Vector2((Main.rand.NextFloat() - 0.5f) * 4f, (Main.rand.NextFloat() - 0.5f) * 4f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, new Vector2(perturbedSpeed.X, -projectileVelocity) + randomVelocityVector, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -644,7 +614,7 @@ namespace CalamityMod.NPCs.Crabulon } else { - float velocityX = (death ? 0.15f : expertMode ? 0.125f : 0.1f) + 0.05f * enrageScale; + float velocityX = death ? 0.15f : expertMode ? 0.125f : 0.1f; if (NPC.direction < 0) NPC.velocity.X -= velocityX; else if (NPC.direction > 0) @@ -714,16 +684,17 @@ namespace CalamityMod.NPCs.Crabulon center = player.Center; center.Y -= 320f + Math.Abs(player.Center.Y - NPC.Center.Y); - center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X - NPC.Center.X > 0f) ? 1 : -1); + center.X += Math.Abs(player.Center.X - NPC.Center.X) * ((player.Center.X > NPC.Center.X) ? 1 : -1); NPC.ai[2] = 1f; NPC.ai[3] = NPC.Bottom.Y; NPC.noTileCollide = true; - float leapVelocity = bossRush ? 24f : death ? 18f : 16f; + float leapVelocity = death ? 18f : 16f; NPC.velocity = center - NPC.Center; NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero); NPC.velocity *= leapVelocity; + NPC.velocity.X *= 0.6f; float velocityMinY = -leapVelocity; if (NPC.velocity.Y > velocityMinY) @@ -733,7 +704,7 @@ namespace CalamityMod.NPCs.Crabulon } else { - float mushroomFireRate = death ? 20f : 10f; + float mushroomFireRate = 15f; if (NPC.ai[1] % mushroomFireRate == 0f) { SoundEngine.PlaySound(SoundID.Item42, NPC.Center); @@ -741,7 +712,6 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float yVelocity = death ? 3f : 2f; if (death) { @@ -751,11 +721,11 @@ namespace CalamityMod.NPCs.Crabulon for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = initialVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, perturbedSpeed, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } else - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.UnitY * yVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.UnitY * yVelocity, type, MushroomShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } @@ -775,7 +745,6 @@ namespace CalamityMod.NPCs.Crabulon NPC.netUpdate = true; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -785,10 +754,10 @@ namespace CalamityMod.NPCs.Crabulon Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity - ((i / (float)numProj) * initialVelocity), type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), initialVelocity - (i / (float)numProj * initialVelocity), type, MushroomShotDamage, 0f, Main.myPlayer); for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 81), Main.rand.Next(-20, 1)), -(initialVelocity - ((i / (float)numProj) * initialVelocity)), type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(-81, 0), Main.rand.Next(-20, 1)), -(initialVelocity - (i / (float)numProj * initialVelocity)), type, MushroomShotDamage, 0f, Main.myPlayer); } for (int j = (int)NPC.position.X - 20; j < (int)NPC.position.X + NPC.width + 40; j += 20) @@ -877,7 +846,6 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); int maxColumns = 5; int mushroomsPerColumn = 8; Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(210f, 8f); @@ -890,7 +858,7 @@ namespace CalamityMod.NPCs.Crabulon for (int j = 0; j < mushroomsPerColumn; j++) { initialVelocity += Vector2.UnitX * Main.rand.NextFloat(-0.5f, 0.5f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(70f * (i + 1), 0f), -(initialVelocity - ((j / (float)mushroomsPerColumn) * initialVelocity)), type, damage, 0f, Main.myPlayer, 1f, NPC.Bottom.Y - 16f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(70f * (i + 1), 0f), -(initialVelocity - ((j / (float)mushroomsPerColumn) * initialVelocity)), type, MushroomShotDamage, 0f, Main.myPlayer, 1f, NPC.Bottom.Y - 16f); } initialVelocity = Vector2.UnitY * 16f; @@ -908,17 +876,16 @@ namespace CalamityMod.NPCs.Crabulon if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float xVelocity = death ? 3f : 1.5f; int numProj = 3; Vector2 initialVelocity = Vector2.UnitX * xVelocity; Vector2 initialSpawnLocation = NPC.Bottom - new Vector2(0f, 8f); for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 41), 0f), initialVelocity - ((i / (float)numProj) * initialVelocity), type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation + new Vector2(Main.rand.Next(0, 41), 0f), initialVelocity - ((i / (float)numProj) * initialVelocity), type, MushroomShotDamage, 0f, Main.myPlayer); for (int i = 0; i < numProj; i++) - Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 41), 0f), -(initialVelocity - ((i / (float)numProj) * initialVelocity)), type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), initialSpawnLocation - new Vector2(Main.rand.Next(0, 41), 0f), -(initialVelocity - ((i / (float)numProj) * initialVelocity)), type, MushroomShotDamage, 0f, Main.myPlayer); } float playerLocation = NPC.Center.X - player.Center.X; @@ -983,7 +950,7 @@ namespace CalamityMod.NPCs.Crabulon { if (Main.netMode != NetmodeID.MultiplayerClient) { - int crabShroomSpawnFreq = (int)(NPC.lifeMax * ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.01 : Main.getGoodWorld ? 0.02 : 0.05)); + int crabShroomSpawnFreq = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.02 : 0.05)); if ((NPC.life + crabShroomSpawnFreq) < NPC.localAI[0]) { NPC.localAI[0] = NPC.life; @@ -1004,6 +971,7 @@ namespace CalamityMod.NPCs.Crabulon } } } + public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; // Can only hit the target if within certain distance public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -1262,7 +1230,7 @@ namespace CalamityMod.NPCs.Crabulon public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Crags/CalamityEye.cs b/NPCs/Crags/CalamityEye.cs index 622541bb79..bdd3bce54c 100644 --- a/NPCs/Crags/CalamityEye.cs +++ b/NPCs/Crags/CalamityEye.cs @@ -29,10 +29,10 @@ namespace CalamityMod.NPCs.Crags NPC.width = 30; NPC.height = 30; NPC.defense = 12; - NPC.lifeMax = 180; + NPC.lifeMax = 140; NPC.knockBackResist = 0.75f; AnimationType = NPCID.DemonEye; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; if (DownedBossSystem.downedProvidence) @@ -47,10 +47,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/DespairStone.cs b/NPCs/Crags/DespairStone.cs index a386dfd7fa..62d3df7ee4 100644 --- a/NPCs/Crags/DespairStone.cs +++ b/NPCs/Crags/DespairStone.cs @@ -5,7 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Crags; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -35,10 +35,9 @@ namespace CalamityMod.NPCs.Crags NPC.width = 66; NPC.height = 64; NPC.defense = 38; - NPC.DR_NERD(0.35f); NPC.lifeMax = 180; NPC.knockBackResist = 0.1f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit41; NPC.DeathSound = SoundID.NPCDeath14; NPC.behindTiles = true; @@ -55,10 +54,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/HeatSpirit.cs b/NPCs/Crags/HeatSpirit.cs index 1c14f41f6e..cfc7c0469f 100644 --- a/NPCs/Crags/HeatSpirit.cs +++ b/NPCs/Crags/HeatSpirit.cs @@ -37,7 +37,7 @@ namespace CalamityMod.NPCs.Crags NPC.defense = 8; NPC.lifeMax = 50; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; NPC.noGravity = true; @@ -47,10 +47,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/InfernalCongealment.cs b/NPCs/Crags/InfernalCongealment.cs index e398dc8703..4cfd936e34 100644 --- a/NPCs/Crags/InfernalCongealment.cs +++ b/NPCs/Crags/InfernalCongealment.cs @@ -25,11 +25,11 @@ namespace CalamityMod.NPCs.Crags NPC.damage = 40; NPC.width = 40; NPC.height = 30; - NPC.defense = 10; - NPC.lifeMax = 380; + NPC.defense = 30; + NPC.lifeMax = 250; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.alpha = 50; NPC.lavaImmune = true; NPC.noGravity = false; @@ -48,10 +48,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/RenegadeWarlock.cs b/NPCs/Crags/RenegadeWarlock.cs index b2d3445b4a..bcccb39aeb 100644 --- a/NPCs/Crags/RenegadeWarlock.cs +++ b/NPCs/Crags/RenegadeWarlock.cs @@ -26,11 +26,11 @@ namespace CalamityMod.NPCs.Crags NPC.width = 18; NPC.height = 40; NPC.defense = 16; - NPC.lifeMax = 100; + NPC.lifeMax = 300; NPC.knockBackResist = 0.5f; AnimationType = NPCID.ZombieXmas; AIType = NPCID.ChaosElemental; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath50; if (DownedBossSystem.downedProvidence) @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/Scryllar.cs b/NPCs/Crags/Scryllar.cs index 22af9262fa..8fc4cdedc4 100644 --- a/NPCs/Crags/Scryllar.cs +++ b/NPCs/Crags/Scryllar.cs @@ -32,10 +32,10 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 18; - NPC.lifeMax = 120; + NPC.lifeMax = 160; NPC.alpha = 100; NPC.knockBackResist = 0.7f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit49; NPC.DeathSound = SoundID.NPCDeath51; NPC.noGravity = true; @@ -53,10 +53,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Crags/ScryllarRage.cs b/NPCs/Crags/ScryllarRage.cs index 310531060d..e81d366f5d 100644 --- a/NPCs/Crags/ScryllarRage.cs +++ b/NPCs/Crags/ScryllarRage.cs @@ -23,10 +23,10 @@ namespace CalamityMod.NPCs.Crags NPC.width = 80; NPC.height = 80; NPC.defense = 10; - NPC.lifeMax = 75; + NPC.lifeMax = 100; NPC.alpha = 100; NPC.knockBackResist = 0.9f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit49; NPC.DeathSound = SoundID.NPCDeath51; NPC.noGravity = true; @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Crags/SoulSlurper.cs b/NPCs/Crags/SoulSlurper.cs index 9e3be9a95a..e90d2850ea 100644 --- a/NPCs/Crags/SoulSlurper.cs +++ b/NPCs/Crags/SoulSlurper.cs @@ -40,10 +40,9 @@ namespace CalamityMod.NPCs.Crags NPC.width = 40; NPC.height = 40; NPC.defense = 30; - NPC.DR_NERD(0.15f); NPC.lifeMax = 80; NPC.knockBackResist = 0.65f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.noGravity = true; NPC.lavaImmune = true; NPC.HitSound = SoundID.NPCHit4; @@ -60,10 +59,6 @@ namespace CalamityMod.NPCs.Crags NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Cryogen/Cryogen.cs b/NPCs/Cryogen/Cryogen.cs index 0f477936d4..6e9427f179 100644 --- a/NPCs/Cryogen/Cryogen.cs +++ b/NPCs/Cryogen/Cryogen.cs @@ -89,11 +89,15 @@ namespace CalamityMod.NPCs.Cryogen } } + public static int IceBlastDamage = 23; // 92; Also applies to GFB darts + public static int IceRainDamage = 23; // 92; Also applies to GFB darts + public static int IceBombDamage = 28; // 112; Also applies to GFB fireblasts + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 69; // 138 NPC.npcSlots = 24f; - NPC.GetNPCDamage(); NPC.width = 86; NPC.height = 88; NPC.defense = 15; @@ -102,7 +106,7 @@ namespace CalamityMod.NPCs.Cryogen NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 16, 0, 0); + NPC.value = Item.buyPrice(gold: 6); NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); NPC.noGravity = true; @@ -126,9 +130,6 @@ namespace CalamityMod.NPCs.Cryogen NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; } - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -183,34 +184,9 @@ namespace CalamityMod.NPCs.Cryogen Player player = Main.player[NPC.target]; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Enrage - if (!player.ZoneSnow && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = death ? 0.5f : 0f; - if (biomeEnraged) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - - if (enrageScale > 2f) - enrageScale = 2f; - - if (bossRush) - enrageScale = 3f; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -294,7 +270,7 @@ namespace CalamityMod.NPCs.Cryogen else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) { int spawnType = Main.zenithWorld ? NPCID.RedDevil : NPCID.IceGolem; if (!NPC.AnyNPCs(spawnType)) @@ -320,14 +296,14 @@ namespace CalamityMod.NPCs.Cryogen } } - float chargePhaseGateValue = bossRush ? 240f : 360f; + float chargePhaseGateValue = 360f; float chargeDuration = 60f; - float chargeTelegraphTime = NPC.ai[0] == 2f ? ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 60f : 80f) : ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 90f : 120f); + float chargeTelegraphTime = NPC.ai[0] == 2f ? (Main.getGoodWorld ? 60f : 80f) : (Main.getGoodWorld ? 90f : 120f); float chargeTelegraphMaxRotationIncrement = 1f; float chargeTelegraphRotationIncrement = chargeTelegraphMaxRotationIncrement / chargeTelegraphTime; float chargeSlowDownTime = 15f; - float chargeVelocityMin = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 24f : 12f; - float chargeVelocityMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 42f : 30f; + float chargeVelocityMin = Main.getGoodWorld ? 24f : 12f; + float chargeVelocityMax = Main.getGoodWorld ? 42f : 30f; if (Main.getGoodWorld) { chargePhaseGateValue *= 0.7f; @@ -340,7 +316,7 @@ namespace CalamityMod.NPCs.Cryogen if (expertMode && (NPC.ai[0] < 5f || !phase6) && !chargePhase) { calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= (bossRush ? 660f : 900f)) + if (calamityGlobalNPC.newAI[3] >= 900f) { calamityGlobalNPC.newAI[3] = 0f; SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); @@ -350,7 +326,6 @@ namespace CalamityMod.NPCs.Cryogen int totalProjectiles = 3; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBomb; - int damage = NPC.GetProjectileDamage(type); float velocity = 2f + NPC.ai[0]; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -359,7 +334,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBombDamage, 0f, Main.myPlayer); } } } @@ -382,11 +357,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = bossRush ? 24 : 16; + int totalProjectiles = 16; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBlast; - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; + float velocity = death ? 9.5f : 9f; float projectileVelocityToPass = 0f; if (type == ModContent.ProjectileType()) projectileVelocityToPass = velocity * 2f; @@ -395,7 +369,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBlastDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -406,8 +380,7 @@ namespace CalamityMod.NPCs.Cryogen float playerYDist = player.Center.Y - cryogenCenter.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float cryogenSpeed = revenge ? 5f : 4f; - cryogenSpeed += 4f * enrageScale; + float cryogenSpeed = death ? 7f : revenge ? 5f : 4f; playerDistance = cryogenSpeed / playerDistance; playerXDist *= playerDistance; @@ -458,11 +431,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = bossRush ? 18 : 12; + int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBlast; - int damage = NPC.GetProjectileDamage(type); - float velocity2 = 9f + enrageScale; + float velocity2 = death ? 9.5f : 9f; float projectileVelocityToPass = 0f; if (type == ModContent.ProjectileType()) projectileVelocityToPass = velocity2 * 2f; @@ -471,16 +443,14 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBlastDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } } - float velocity = revenge ? 3.5f : 4f; - float acceleration = 0.15f; - velocity -= enrageScale * 0.8f; - acceleration += 0.07f * enrageScale; + float velocity = death ? 3.1f : revenge ? 3.5f : 4f; + float acceleration = death ? 0.185f : 0.15f; if (NPC.position.Y > player.position.Y - 375f) { @@ -538,8 +508,7 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { int type = iceRain; - int damage = NPC.GetProjectileDamage(type); - float maxVelocity = 9f + enrageScale; + float maxVelocity = death ? 9.5f : 9f; float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); int totalProjectiles = 10; int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.7f); @@ -559,7 +528,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectilesShot; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceRainDamage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -578,7 +547,7 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (chargeVelocity + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (chargeVelocity + (death ? 1f : 0f)); if (NPC.velocity.Length() < chargeVelocityMin) { @@ -656,11 +625,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = bossRush ? 18 : 12; + int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBlast; - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; + float velocity = death ? 9.5f : 9f; float projectileVelocityToPass = 0f; if (type == ModContent.ProjectileType()) projectileVelocityToPass = velocity * 2f; @@ -669,7 +637,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBlastDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -680,8 +648,7 @@ namespace CalamityMod.NPCs.Cryogen float playerYDist = player.Center.Y - cryogenCenter.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float cryogenSpeed = revenge ? 7f : 6f; - cryogenSpeed += 4f * enrageScale; + float cryogenSpeed = death ? 9f : revenge ? 7f : 6f; playerDistance = cryogenSpeed / playerDistance; playerXDist *= playerDistance; @@ -708,8 +675,7 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { int type = iceRain; - int damage = NPC.GetProjectileDamage(type); - float maxVelocity = 9f + enrageScale; + float maxVelocity = death ? 9.5f : 9f; float velocity = maxVelocity - (calamityGlobalNPC.newAI[0] * maxVelocity * 0.5f); int totalProjectiles = calamityGlobalNPC.newAI[1] == 0f ? 8 : 4; int maxTotalProjectileReductionBasedOnRotationSpeed = (int)(totalProjectiles * 0.4f); @@ -729,7 +695,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectilesShot; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceRainDamage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -748,7 +714,7 @@ namespace CalamityMod.NPCs.Cryogen if (NPC.ai[1] == chargeGateValue) { float chargeVelocity = Vector2.Distance(NPC.Center, player.Center) / chargeDuration * 2f; - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (chargeVelocity + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (chargeVelocity + (death ? 1f : 0f)); if (NPC.velocity.Length() < chargeVelocityMin) { @@ -819,11 +785,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = bossRush ? 18 : 12; + int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBlast; - int damage = NPC.GetProjectileDamage(type); - float velocity = 10f + enrageScale; + float velocity = death ? 10.5f : 10f; float projectileVelocityToPass = 0f; if (type == ModContent.ProjectileType()) projectileVelocityToPass = velocity * 2f; @@ -832,7 +797,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBlastDamage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); } } } @@ -843,8 +808,7 @@ namespace CalamityMod.NPCs.Cryogen float playerYDist = player.Center.Y - cryogenCenter.Y; float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); - float speed = revenge ? 5.5f : 5f; - speed += 3f * enrageScale; + float speed = death ? 7f : revenge ? 5.5f : 5f; playerDistance = speed / playerDistance; playerXDist *= playerDistance; @@ -927,11 +891,10 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { int type = iceRain; - int damage = NPC.GetProjectileDamage(type); - float velocity = 9f + enrageScale; + float velocity = death ? 9.5f : 9f; for (int i = 0; i < 3; i++) { - int totalProjectiles = bossRush ? 9 : 6; + int totalProjectiles = 6; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = velocity - (velocity * 0.33f * i); float projectileVelocityToPass = 0f; @@ -949,7 +912,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceRainDamage, 0f, Main.myPlayer, 0f, type == ModContent.ProjectileType() ? 0f : velocity, projectileVelocityToPass); } } } @@ -1019,7 +982,7 @@ namespace CalamityMod.NPCs.Cryogen { if (NPC.ai[1] == 60f) // Spawn homing ice blasts on charge { - NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (18f + enrageScale * 2f); + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * (death ? 19f : 18f); if (Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) { @@ -1028,12 +991,11 @@ namespace CalamityMod.NPCs.Cryogen if (Main.netMode != NetmodeID.MultiplayerClient) { int type = iceBlast; - int damage = NPC.GetProjectileDamage(type); - float velocity = 1.5f + enrageScale * 0.5f; + float velocity = death ? 1.75f : 1.5f; int totalSpreads = phase7 ? 3 : 2; for (int i = 0; i < totalSpreads; i++) { - int totalProjectiles = bossRush ? 3 : 2; + int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = velocity - (velocity * (phase7 ? 0.25f : 0.5f) * i); float projectileVelocityToPass = 0f; @@ -1052,7 +1014,7 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer, ai, type == ModContent.ProjectileType() ? 0f : 1f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBlastDamage, 0f, Main.myPlayer, ai, type == ModContent.ProjectileType() ? 0f : 1f, projectileVelocityToPass); } } } @@ -1096,7 +1058,7 @@ namespace CalamityMod.NPCs.Cryogen return; } - float chargeVelMult = 18f + enrageScale * 2f; + float chargeVelMult = death ? 19f : 18f; Vector2 chargeDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); float playerchargeXDist = player.position.X + player.width * 0.5f - chargeDirection.X; @@ -1156,14 +1118,13 @@ namespace CalamityMod.NPCs.Cryogen NPC.rotation = NPC.velocity.X * 0.1f; calamityGlobalNPC.newAI[3] += 1f; - if (calamityGlobalNPC.newAI[3] >= (bossRush ? 50f : 75f)) + if (calamityGlobalNPC.newAI[3] >= 75f) { calamityGlobalNPC.newAI[3] = 0f; SoundEngine.PlaySound(Main.zenithWorld ? SoundID.NPCHit41 : HitSound, NPC.Center); int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; int type = iceBomb; - int damage = NPC.GetProjectileDamage(type); float velocity2 = 6f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -1172,12 +1133,12 @@ namespace CalamityMod.NPCs.Cryogen for (int k = 0; k < totalProjectiles; k++) { Vector2 projSpreadRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(projSpreadRotation) * 30f, projSpreadRotation, type, IceBombDamage, 0f, Main.myPlayer); } } NPC.ai[1] += 1f; - if (NPC.ai[1] >= (bossRush ? 120f : 180f)) + if (NPC.ai[1] >= 180f) { NPC.TargetClosest(); NPC.ai[0] = 4f; @@ -1187,10 +1148,8 @@ namespace CalamityMod.NPCs.Cryogen NPC.netUpdate = true; } - float velocity = revenge ? 5f : 6f; - float acceleration = 0.2f; - velocity -= enrageScale; - acceleration += 0.07f * enrageScale; + float velocity = death ? 4.5f : revenge ? 5f : 6f; + float acceleration = death ? 0.535f : 0.2f; if (NPC.position.Y > player.position.Y - 375f) { @@ -1341,7 +1300,6 @@ namespace CalamityMod.NPCs.Cryogen public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void ModifyTypeName(ref string typeName) @@ -1391,7 +1349,7 @@ namespace CalamityMod.NPCs.Cryogen } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } @@ -1506,15 +1464,9 @@ namespace CalamityMod.NPCs.Cryogen if (hurtInfo.Damage > 0) { if (Main.zenithWorld) - { - target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - } else - { - target.AddBuff(BuffID.Frostburn, 360); target.AddBuff(BuffID.Chilled, 120); - } } } } diff --git a/NPCs/Cryogen/CryogenShield.cs b/NPCs/Cryogen/CryogenShield.cs index bb4ee5cc49..a2befaa003 100644 --- a/NPCs/Cryogen/CryogenShield.cs +++ b/NPCs/Cryogen/CryogenShield.cs @@ -24,11 +24,11 @@ namespace CalamityMod.NPCs.Cryogen public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 60; // 120 NPC.aiStyle = -1; AIType = -1; NPC.noTileCollide = true; NPC.coldDamage = true; - NPC.GetNPCDamage(); NPC.width = 216; NPC.height = 216; NPC.scale *= (CalamityWorld.death || BossRushEvent.BossRushActive || Main.getGoodWorld) ? 0.8f : 1f; @@ -115,15 +115,9 @@ namespace CalamityMod.NPCs.Cryogen if (hurtInfo.Damage > 0) { if (Main.zenithWorld) - { - target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - } else - { - target.AddBuff(BuffID.Frostburn, 360); target.AddBuff(BuffID.Chilled, 120); - } } } diff --git a/NPCs/DesertScourge/DesertNuisanceBody.cs b/NPCs/DesertScourge/DesertNuisanceBody.cs index fad5059241..d696d93a50 100644 --- a/NPCs/DesertScourge/DesertNuisanceBody.cs +++ b/NPCs/DesertScourge/DesertNuisanceBody.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 12; // 24 NPC.width = 88; NPC.height = 88; @@ -48,8 +48,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense += 27; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4800; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -64,18 +64,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[3] > 0f) { @@ -170,28 +166,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * segmentOffset; NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHead.SegmentVelocity_Master : - DesertNuisanceHead.SegmentVelocity_Expert; - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CheckActive() => false; diff --git a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs index e82400e730..74ab964b4a 100644 --- a/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceBodyYoung.cs @@ -39,7 +39,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 12; // 24 NPC.width = 78; NPC.height = 78; @@ -48,8 +48,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense += 26; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4000; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -64,18 +64,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[3] > 0f) { @@ -178,28 +174,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.rotation = directionToNextSegment.ToRotation() + MathHelper.PiOver2; NPC.Center = aheadSegment.Center - directionToNextSegment.SafeNormalize(Vector2.Zero) * NPC.scale * segmentOffset; NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : - DesertNuisanceHeadYoung.SegmentVelocity_Expert; - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CheckActive() => false; diff --git a/NPCs/DesertScourge/DesertNuisanceHead.cs b/NPCs/DesertScourge/DesertNuisanceHead.cs index b12922cb56..d3be799c43 100644 --- a/NPCs/DesertScourge/DesertNuisanceHead.cs +++ b/NPCs/DesertScourge/DesertNuisanceHead.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public const float SegmentVelocity_Expert = 11f; - public const float SegmentVelocity_Master = 13.5f; + public const float SegmentVelocity_Death = 13.5f; public const float SegmentVelocity_GoodWorld = 19f; public const float SegmentVelocity_ZenithSeed = 22f; @@ -53,7 +53,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 25; // 40 (1.6x expert scaling) NPC.defense = 3; if (Main.getGoodWorld) @@ -63,8 +63,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 88; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4800; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -79,9 +79,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); - if (Main.zenithWorld) NPC.scale *= 2; } @@ -110,17 +107,15 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Become angry when the other Nuisance dies. bool getMad = (!NPC.AnyNPCs(ModContent.NPCType()) && revenge) || death; // Enrage - if (!Main.player[NPC.target].ZoneDesert && !bossRush) + if (!Main.player[NPC.target].ZoneDesert && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -128,12 +123,12 @@ namespace CalamityMod.NPCs.DesertScourge else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; - float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; + float enrageScale = getMad ? 0.5f : 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 2f; } @@ -274,10 +269,10 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); if (Main.player[NPC.target].dead) @@ -300,12 +295,6 @@ namespace CalamityMod.NPCs.DesertScourge } } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - { - speed *= 1.5f; - turnSpeed *= 1.5f; - } - Vector2 npcCenter = NPC.Center; float playerX = Main.player[NPC.target].Center.X; float targettingPosition = Main.player[NPC.target].Center.Y; @@ -458,19 +447,6 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -601,6 +577,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs index 69bd6158db..0b8353912f 100644 --- a/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceHeadYoung.cs @@ -23,7 +23,7 @@ namespace CalamityMod.NPCs.DesertScourge private bool tailSpawned = false; public const float SegmentVelocity_Expert = 10f; - public const float SegmentVelocity_Master = 12f; + public const float SegmentVelocity_Death = 12f; public const float SegmentVelocity_GoodWorld = 16f; public const float SegmentVelocity_ZenithSeed = 18f; @@ -45,7 +45,7 @@ namespace CalamityMod.NPCs.DesertScourge { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 25; // 40 (1.6x expert scaling) NPC.defense = 2; if (Main.getGoodWorld) @@ -55,8 +55,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.height = 78; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4000; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -71,9 +71,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); - if (Main.zenithWorld) NPC.scale *= 2; } @@ -106,17 +103,15 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Become angry when the other Nuisance dies. bool getMad = (!NPC.AnyNPCs(ModContent.NPCType()) && revenge) || death; // Enrage - if (!Main.player[NPC.target].ZoneDesert && !bossRush) + if (!Main.player[NPC.target].ZoneDesert && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -124,12 +119,12 @@ namespace CalamityMod.NPCs.DesertScourge else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; - float enrageScale = bossRush ? 1f : getMad ? 0.5f : 0f; + float enrageScale = getMad ? 0.5f : 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 2f; } @@ -172,16 +167,10 @@ namespace CalamityMod.NPCs.DesertScourge { Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * (revenge ? 10f : 8f); int numProj = death ? 6 : getMad ? 4 : 3; - int spread = masterMode ? 28 : getMad ? 22 : 20; - if (masterMode) - { - numProj += 2; - spread += 8; - } + int spread = death ? 28 : getMad ? 22 : 20; float rotation = MathHelper.ToRadians(spread); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); @@ -194,7 +183,7 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, DesertScourgeHead.SpitDamage, 0f, Main.myPlayer); Main.projectile[proj].aiStyle = -1; Main.projectile[proj].netUpdate = true; } @@ -318,10 +307,10 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : SegmentVelocity_Expert; maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) + if (death) maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); if (Main.player[NPC.target].dead) @@ -344,12 +333,6 @@ namespace CalamityMod.NPCs.DesertScourge } } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - { - speed *= 1.5f; - turnSpeed *= 1.5f; - } - Vector2 npcCenter = NPC.Center; float playerX = Main.player[NPC.target].Center.X; float targettingPosition = Main.player[NPC.target].Center.Y; @@ -499,19 +482,6 @@ namespace CalamityMod.NPCs.DesertScourge if (NPC.Distance(destination) > (getMad ? 750f : 1000f)) NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -644,6 +614,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.7f * balance); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/DesertScourge/DesertNuisanceTail.cs b/NPCs/DesertScourge/DesertNuisanceTail.cs index 8b8bc97303..56ce8db014 100644 --- a/NPCs/DesertScourge/DesertNuisanceTail.cs +++ b/NPCs/DesertScourge/DesertNuisanceTail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 10; // 20 NPC.width = 88; NPC.height = 88; @@ -30,8 +30,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense += 34; NPC.LifeMaxNERB(1500, 1800, 40000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4800; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -46,18 +46,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -134,28 +130,6 @@ namespace CalamityMod.NPCs.DesertScourge else if (playerXPos > 0f) NPC.spriteDirection = -1; } - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHead.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHead.SegmentVelocity_Master : - DesertNuisanceHead.SegmentVelocity_Expert; - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs index 193643be96..5b6bc7ee94 100644 --- a/NPCs/DesertScourge/DesertNuisanceTailYoung.cs +++ b/NPCs/DesertScourge/DesertNuisanceTailYoung.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 10; // 20 NPC.width = 78; NPC.height = 78; @@ -30,8 +30,8 @@ namespace CalamityMod.NPCs.DesertScourge NPC.defense += 33; NPC.LifeMaxNERB(1300, 1560, 35000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.lifeMax = 4000; + if (Main.getGoodWorld) + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -46,18 +46,14 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -142,28 +138,6 @@ namespace CalamityMod.NPCs.DesertScourge else if (playerXPos > 0f) NPC.spriteDirection = -1; } - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertNuisanceHeadYoung.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertNuisanceHeadYoung.SegmentVelocity_GoodWorld : - masterMode ? DesertNuisanceHeadYoung.SegmentVelocity_Master : - DesertNuisanceHeadYoung.SegmentVelocity_Expert; - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - if (masterMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/DesertScourge/DesertScourgeBody.cs b/NPCs/DesertScourge/DesertScourgeBody.cs index 522dbcd0ef..916fa6ba25 100644 --- a/NPCs/DesertScourge/DesertScourgeBody.cs +++ b/NPCs/DesertScourge/DesertScourgeBody.cs @@ -43,15 +43,14 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 16; // 32 NPC.width = 104; NPC.height = 104; NPC.defense = 6; - NPC.DR_NERD(0.05f); - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) - NPC.lifeMax *= 4; + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -71,9 +70,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => false; @@ -92,9 +88,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[3] > 0f) { @@ -214,30 +209,6 @@ namespace CalamityMod.NPCs.DesertScourge bool burrow = head.Calamity().newAI[0] >= burrowTimeGateValue; bool lungeUpward = burrow && head.Calamity().newAI[1] == 1f; bool quickFall = head.Calamity().newAI[1] == 2f; - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : - masterMode ? DesertScourgeHead.SegmentVelocity_Master : - expertMode ? DesertScourgeHead.SegmentVelocity_Expert : - DesertScourgeHead.SegmentVelocity_Normal; - if (burrow || lungeUpward) - maxChaseSpeed *= 1.5f; - if (expertMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/DesertScourge/DesertScourgeHead.cs b/NPCs/DesertScourge/DesertScourgeHead.cs index 3659112078..8ade55c3dc 100644 --- a/NPCs/DesertScourge/DesertScourgeHead.cs +++ b/NPCs/DesertScourge/DesertScourgeHead.cs @@ -42,7 +42,7 @@ namespace CalamityMod.NPCs.DesertScourge public const float SegmentVelocity_Normal = 10f; public const float SegmentVelocity_Expert = 12.5f; - public const float SegmentVelocity_Master = 15f; + public const float SegmentVelocity_Death = 15f; public const float SegmentVelocity_GoodWorld = 21f; public const float SegmentVelocity_ZenithSeed = 24f; @@ -56,7 +56,6 @@ namespace CalamityMod.NPCs.DesertScourge public const float LungeUpwardCutoffDistance = 420f; public const float BurrowDistance_Hide = 1080f; public const float BurrowDistance = 800f; - public const float BurrowDistance_BossRush = 400f; public const float OpenMouthForBiteDistance = 220f; private const int OpenMouthStopFrame = 4; @@ -85,23 +84,25 @@ namespace CalamityMod.NPCs.DesertScourge NPCID.Sets.MPAllowedEnemies[Type] = true; } + public static int SpitDamage = 10; // 40 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 40; // 64 (1.6x expert scaling) NPC.defense = 4; NPC.npcSlots = 12f; NPC.width = 104; NPC.height = 104; - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) - NPC.lifeMax *= 4; + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; NPC.boss = true; - NPC.value = Item.buyPrice(0, 2, 0, 0); + NPC.value = Item.buyPrice(gold: 1); NPC.alpha = 255; NPC.behindTiles = true; NPC.noGravity = true; @@ -112,21 +113,17 @@ namespace CalamityMod.NPCs.DesertScourge if (Main.getGoodWorld) NPC.scale *= 0.4f; - if (Main.zenithWorld) NPC.scale *= 4f; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) { - if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !Main.masterMode) + if ((NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !CalamityWorld.death) index = -1; } @@ -165,14 +162,12 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Check for Nuisances - bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !masterMode; + bool hide = (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType())) && !death; if (hide) { NPC.Calamity().newAI[0] = 0f; @@ -192,7 +187,7 @@ namespace CalamityMod.NPCs.DesertScourge Player player = Main.player[NPC.target]; // Enrage - if (!player.ZoneDesert && !bossRush) + if (!player.ZoneDesert && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -200,12 +195,12 @@ namespace CalamityMod.NPCs.DesertScourge else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 2f; } @@ -238,7 +233,7 @@ namespace CalamityMod.NPCs.DesertScourge bool lungeUpward = burrow && NPC.Calamity().newAI[1] == 1f; bool quickFall = NPC.Calamity().newAI[1] == 2f; - float burrowDistance = hide ? BurrowDistance_Hide : bossRush ? BurrowDistance_BossRush : BurrowDistance; + float burrowDistance = hide ? BurrowDistance_Hide : BurrowDistance; float speed = death ? 0.105f : 0.085f; float turnSpeed = death ? 0.21f : 0.17f; @@ -311,12 +306,11 @@ namespace CalamityMod.NPCs.DesertScourge if (death) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < 7; i++) { Vector2 sandSpitPos = new Vector2((i - 2) * 16f, -Math.Abs((i - 2) * 16f)); Vector2 sandSpitVelocity = ((sandSplashSpawnPos + Vector2.UnitY * 80f) - (sandSplashSpawnPos + sandSpitPos)).SafeNormalize(Vector2.UnitY) * -((Math.Abs(i - 3) + 1) * 3f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, SpitDamage, 0f, Main.myPlayer); } } } @@ -366,12 +360,11 @@ namespace CalamityMod.NPCs.DesertScourge if (death) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < 7; i++) { Vector2 sandSpitPos = new Vector2((i - 2) * 16f, -Math.Abs((i - 2) * 16f)); Vector2 sandSpitVelocity = ((sandSplashSpawnPos + Vector2.UnitY * 80f) - (sandSplashSpawnPos + sandSpitPos)).SafeNormalize(Vector2.UnitY) * -((Math.Abs(i - 3) + 1) * 3f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), sandSplashSpawnPos + sandSpitPos, sandSpitVelocity, type, SpitDamage, 0f, Main.myPlayer); } } } @@ -544,7 +537,7 @@ namespace CalamityMod.NPCs.DesertScourge float maxChaseSpeed = Main.zenithWorld ? SegmentVelocity_ZenithSeed : Main.getGoodWorld ? SegmentVelocity_GoodWorld : - masterMode ? SegmentVelocity_Master : + death ? SegmentVelocity_Death : expertMode ? SegmentVelocity_Expert : SegmentVelocity_Normal; if (burrow || lungeUpward) @@ -602,15 +595,14 @@ namespace CalamityMod.NPCs.DesertScourge { // Spit a huge spread of sand upwards that falls down SoundEngine.PlaySound(SandBlastSound, NPC.Center); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 16f : bossRush ? 10f : death ? 8.5f : revenge ? 8f : expertMode ? 7.5f : 6f; + float velocity = Main.getGoodWorld ? 16f : death ? 8.5f : revenge ? 8f : expertMode ? 7.5f : 6f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 projectileVelocity = (NPC.Center + NPC.velocity * 10f - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; - int numProj = bossRush ? 30 : death ? 24 : revenge ? 21 : expertMode ? 18 : 12; + int numProj = death ? 24 : revenge ? 21 : expertMode ? 18 : 12; if (Main.getGoodWorld) numProj *= 2; - int spread = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 120 : 90; + int spread = Main.getGoodWorld ? 120 : 90; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { @@ -623,7 +615,7 @@ namespace CalamityMod.NPCs.DesertScourge } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(perturbedSpeed) * 5f, perturbedSpeed, type, SpitDamage, 0f, Main.myPlayer); } NPC.TargetClosest(); @@ -808,26 +800,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.velocity += (destination - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; } - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (hide) - { - NPC.damage = 0; - } - else - { - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -947,7 +919,7 @@ namespace CalamityMod.NPCs.DesertScourge } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.SandBlock; } @@ -1073,7 +1045,7 @@ namespace CalamityMod.NPCs.DesertScourge public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/DesertScourge/DesertScourgeTail.cs b/NPCs/DesertScourge/DesertScourgeTail.cs index b969562016..c736d3dab9 100644 --- a/NPCs/DesertScourge/DesertScourgeTail.cs +++ b/NPCs/DesertScourge/DesertScourgeTail.cs @@ -23,15 +23,14 @@ namespace CalamityMod.NPCs.DesertScourge public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 14; // 28 NPC.width = 104; NPC.height = 104; NPC.defense = 9; - NPC.DR_NERD(0.1f); - NPC.LifeMaxNERB(4200, 5000, 1400000); + NPC.LifeMaxNERB(4200, 5000, 1150000); if (Main.getGoodWorld) - NPC.lifeMax *= 4; + NPC.lifeMax *= 2; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; @@ -51,9 +50,6 @@ namespace CalamityMod.NPCs.DesertScourge NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -72,9 +68,8 @@ namespace CalamityMod.NPCs.DesertScourge public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -176,30 +171,6 @@ namespace CalamityMod.NPCs.DesertScourge bool burrow = head.Calamity().newAI[0] >= burrowTimeGateValue; bool lungeUpward = burrow && head.Calamity().newAI[1] == 1f; bool quickFall = head.Calamity().newAI[1] == 2f; - - // Calculate contact damage based on velocity - float maxChaseSpeed = Main.zenithWorld ? DesertScourgeHead.SegmentVelocity_ZenithSeed : - Main.getGoodWorld ? DesertScourgeHead.SegmentVelocity_GoodWorld : - masterMode ? DesertScourgeHead.SegmentVelocity_Master : - expertMode ? DesertScourgeHead.SegmentVelocity_Expert : - DesertScourgeHead.SegmentVelocity_Normal; - if (burrow || lungeUpward) - maxChaseSpeed *= 1.5f; - if (expertMode) - maxChaseSpeed += maxChaseSpeed * 0.2f * (1f - lifeRatio); - - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity || NPC.dontTakeDamage) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) diff --git a/NPCs/DevourerofGods/CosmicGuardianBody.cs b/NPCs/DevourerofGods/CosmicGuardianBody.cs index 8041253706..6188c4cf81 100644 --- a/NPCs/DevourerofGods/CosmicGuardianBody.cs +++ b/NPCs/DevourerofGods/CosmicGuardianBody.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 120; // 240 NPC.width = 34; NPC.height = 34; NPC.defense = 60; @@ -52,10 +52,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -142,21 +138,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.X = NPC.position.X + targetX; NPC.position.Y = NPC.position.Y + targetY; } - - // Calculate contact damage based on velocity - float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/DevourerofGods/CosmicGuardianHead.cs b/NPCs/DevourerofGods/CosmicGuardianHead.cs index 6eb9fba049..378971f286 100644 --- a/NPCs/DevourerofGods/CosmicGuardianHead.cs +++ b/NPCs/DevourerofGods/CosmicGuardianHead.cs @@ -50,7 +50,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 180; // 360 NPC.width = 64; NPC.height = 76; NPC.defense = 40; @@ -65,10 +65,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -189,8 +185,8 @@ namespace CalamityMod.NPCs.DevourerofGods Vector2 segmentDirection = NPC.Center; float dogHeadX = Main.npc[CalamityGlobalNPC.DoGHead].position.X + (Main.npc[CalamityGlobalNPC.DoGHead].width / 2); float dogHeadY = Main.npc[CalamityGlobalNPC.DoGHead].position.Y + (Main.npc[CalamityGlobalNPC.DoGHead].height / 2); - float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; - float velocityMult = BossRushEvent.BossRushActive ? 0.9f : CalamityWorld.revenge ? 0.75f : 0.23f; + float segmentVelocity = CalamityWorld.revenge ? 25f : 23f; + float velocityMult = CalamityWorld.revenge ? 0.75f : 0.23f; float maxDistanceFromDoGHead = 160f; if (increaseSpeedMore) @@ -337,19 +333,6 @@ namespace CalamityMod.NPCs.DevourerofGods } } - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; } diff --git a/NPCs/DevourerofGods/CosmicGuardianTail.cs b/NPCs/DevourerofGods/CosmicGuardianTail.cs index be71961cd5..ac3627b1c3 100644 --- a/NPCs/DevourerofGods/CosmicGuardianTail.cs +++ b/NPCs/DevourerofGods/CosmicGuardianTail.cs @@ -33,7 +33,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 90; // 180 NPC.width = 30; NPC.height = 50; NPC.defense = 70; @@ -49,10 +49,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.DeathSound = SoundID.NPCDeath14; NPC.netAlways = true; NPC.dontCountMe = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -139,21 +135,6 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.position.X = NPC.position.X + targetX; NPC.position.Y = NPC.position.Y + targetY; } - - // Calculate contact damage based on velocity - float segmentVelocity = BossRushEvent.BossRushActive ? 30f : CalamityWorld.revenge ? 25f : 23f; - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) diff --git a/NPCs/DevourerofGods/DevourerofGodsBody.cs b/NPCs/DevourerofGods/DevourerofGodsBody.cs index 79e71a6b1d..43dd699c66 100644 --- a/NPCs/DevourerofGods/DevourerofGodsBody.cs +++ b/NPCs/DevourerofGods/DevourerofGodsBody.cs @@ -62,7 +62,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 120; // 240 NPC.npcSlots = 5f; NPC.width = 56; NPC.height = 56; @@ -91,9 +91,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.getGoodWorld) NPC.scale *= 1.5f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -159,10 +156,9 @@ namespace CalamityMod.NPCs.DevourerofGods float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase2 = lifeRatio < 0.6f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (phase2) { @@ -272,25 +268,11 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.spriteDirection = (directionToNextSegment.X > 0).ToDirectionInt(); // Velocity variables - float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; + float segmentVelocity = death ? 17.5f : 16f; if (expertMode) segmentVelocity += 4f * (1f - lifeRatio); if (Main.getGoodWorld) segmentVelocity *= 1.1f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -438,7 +420,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/DevourerofGods/DevourerofGodsHead.cs b/NPCs/DevourerofGods/DevourerofGodsHead.cs index 232c5b3899..fee6b77511 100644 --- a/NPCs/DevourerofGods/DevourerofGodsHead.cs +++ b/NPCs/DevourerofGods/DevourerofGodsHead.cs @@ -5,7 +5,9 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Dusts; using CalamityMod.Events; +using CalamityMod.Fonts; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.LoreItems; using CalamityMod.Items.Materials; @@ -154,6 +156,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Sounds public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/DevourerSpawn"); public static readonly SoundStyle AttackSound = new("CalamityMod/Sounds/Custom/DevourerAttack"); + public static readonly SoundStyle HitSound = new("CalamityMod/Sounds/NPCHit/OtherworldlyHit"); public static readonly SoundStyle DeathAnimationSound = new("CalamityMod/Sounds/NPCKilled/DevourerDeath"); public static readonly SoundStyle DeathExplosionSound = new("CalamityMod/Sounds/NPCKilled/DevourerDeathImpact"); public static readonly SoundStyle DeathSegmentSound = new("CalamityMod/Sounds/NPCKilled/DevourerSegmentBreak", 4); @@ -191,10 +194,13 @@ namespace CalamityMod.NPCs.DevourerofGods }); } + public static int LaserWallDamage = 75; // 300 + public static int FireballDamage = 60; // 240; Also applies to Legendary Mode Ichor Blob + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 250; // 500 NPC.npcSlots = 5f; NPC.width = 104; NPC.height = 104; @@ -205,7 +211,7 @@ namespace CalamityMod.NPCs.DevourerofGods AIType = -1; NPC.knockBackResist = 0f; NPC.boss = true; - NPC.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 1, gold: 50); NPC.Opacity = 0f; NPC.behindTiles = true; NPC.noGravity = true; @@ -215,9 +221,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.getGoodWorld) NPC.scale *= 1.5f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -363,10 +366,9 @@ namespace CalamityMod.NPCs.DevourerofGods bool flyUpDuringLaserWalls = laserWallPhase == (int)LaserWallPhase.FireLaserWalls || (laserWallPhase == (int)LaserWallPhase.End && teleportTimer > 0); bool flies = NPC.ai[3] == 0f || flyUpDuringLaserWalls; Vector2 destination = flyUpDuringLaserWalls ? (player.Center - Vector2.UnitY * 480f) : player.Center; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -401,14 +403,14 @@ namespace CalamityMod.NPCs.DevourerofGods extrapitch = Main.zenithWorld ? 0.3f : 0f; // Velocity variables - float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; + float segmentVelocity = death ? 17.5f : 16f; if (expertMode) segmentVelocity += 4f * (1f - lifeRatio); - float speed = bossRush ? 18f : death ? 16.5f : 15f; - float turnSpeed = bossRush ? 0.36f : death ? 0.33f : 0.3f; - float homingSpeed = bossRush ? 36f : death ? 30f : 24f; - float homingTurnSpeed = bossRush ? 0.48f : death ? 0.405f : 0.33f; + float speed = death ? 16.5f : 15f; + float turnSpeed = death ? 0.33f : 0.3f; + float homingSpeed = death ? 30f : 24f; + float homingTurnSpeed = death ? 0.405f : 0.33f; if (expertMode) { @@ -418,7 +420,7 @@ namespace CalamityMod.NPCs.DevourerofGods homingTurnSpeed += 0.15f * (1f - lifeRatio); } - float groundPhaseTurnSpeed = bossRush ? 0.3f : death ? 0.24f : 0.18f; + float groundPhaseTurnSpeed = death ? 0.24f : 0.18f; if (expertMode) groundPhaseTurnSpeed += 0.1f * (1f - lifeRatio); @@ -499,7 +501,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.localAI[2] == timeWhenDoGShouldTeleportDuringPhase2Countdown + (death ? TimeBeforeTeleport_Death : CalamityWorld.revenge ? TimeBeforeTeleport_Revengeance : Main.expertMode ? TimeBeforeTeleport_Expert : TimeBeforeTeleport_Normal)) SpawnTeleportLocation(player, true); if (NPC.localAI[2] == timeWhenDoGShouldTeleportDuringPhase2Countdown) - Teleport(player, bossRush, death, revenge, expertMode, phase5); + Teleport(player, death, revenge, expertMode, phase5); // Just in case the projectile cap is reached and the teleport rift doesn't spawn. if (AwaitingPhase2Teleport && NPC.localAI[2] == 0f) @@ -550,7 +552,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Dialogue the moment the second phase starts - if (NPC.localAI[2] == 60f && !bossRush) + if (NPC.localAI[2] == 60f && !BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText5"; Color messageColor = Color.Cyan; @@ -621,7 +623,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Teleport if (teleportTimer == 0) - Teleport(player, bossRush, death, revenge, expertMode, phase5); + Teleport(player, death, revenge, expertMode, phase5); } // Do the death animation once killed. @@ -642,7 +644,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser walls - float adjustedAlphaGateValue = AlphaGateValue - (bossRush ? 360f : death ? 180f : 0f); + float adjustedAlphaGateValue = AlphaGateValue - (death ? 180f : 0f); if (phase4 && !spawnedGuardians3 && postTeleportTimer <= 0) { if (laserWallPhase == (int)LaserWallPhase.SetUp) @@ -668,7 +670,7 @@ namespace CalamityMod.NPCs.DevourerofGods } // Fire laser walls every X seconds after a laser wall phase ends - float laserWallGateValue = LaserWallCooldown - (bossRush ? 360f : death ? 180f : 0f); + float laserWallGateValue = LaserWallCooldown - (death ? 180f : 0f); if (calamityGlobalNPC.newAI[3] >= laserWallGateValue) { NPC.Opacity = 0f; @@ -713,7 +715,7 @@ namespace CalamityMod.NPCs.DevourerofGods calamityGlobalNPC.newAI[3] = 0f; // Anger message - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText6"; Color messageColor = Color.Cyan; @@ -751,10 +753,10 @@ namespace CalamityMod.NPCs.DevourerofGods // Fireballs // Check angle and distance to make sure it's realistic that they'd be fired - if (NPC.Opacity >= 1f && (distanceFromTarget > 480f || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) && (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) + if (NPC.Opacity >= 1f && distanceFromTarget > 480f && (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) { calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : 150f) && calamityGlobalNPC.newAI[0] % ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 30f : phase7 ? 30f : 60f) == 0f) + if (calamityGlobalNPC.newAI[0] >= (Main.getGoodWorld ? 30f : 150f) && calamityGlobalNPC.newAI[0] % (Main.getGoodWorld ? 30f : phase7 ? 30f : 60f) == 0f) { float fireballSpeed = 8f; Vector2 fireballVelocity = Vector2.Normalize(player.Center - NPC.Center) * fireballSpeed + NPC.velocity * 0.5f; @@ -764,12 +766,12 @@ namespace CalamityMod.NPCs.DevourerofGods Dust.NewDust(NPC.Center, 52, 52, (int)CalamityDusts.PurpleCosmilite, dustVelocity.X, dustVelocity.Y); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = FireballDamage; if (Main.netMode != NetmodeID.MultiplayerClient) Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, fireballVelocity, type, damage, 0f, Main.myPlayer); - if (CalamityWorld.LegendaryMode && revenge) + if (Main.zenithWorld) { for (int l = 0; l < 8; l++) { @@ -786,13 +788,12 @@ namespace CalamityMod.NPCs.DevourerofGods int numBlobs = 4; type = ModContent.ProjectileType(); - damage = 60; for (int i = 0; i < numBlobs; i++) { Vector2 blobVelocity = new Vector2(Main.rand.Next(-100, 101), Main.rand.Next(-100, 101)); blobVelocity.Normalize(); - blobVelocity *= Main.rand.Next(400, 801) * (bossRush ? 0.02f : 0.01f); + blobVelocity *= Main.rand.Next(400, 801) * 0.01f; blobVelocity *= Main.rand.NextFloat() + 1f; float blobVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.5f; @@ -812,7 +813,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (!spawnedGuardians3 && laserWallPhase == (int)LaserWallPhase.FireLaserWalls) { float spawnOffset = 1200f; - float divisor = bossRush ? 100f : 150f; + float divisor = 150f; if (calamityGlobalNPC.newAI[1] % divisor == 0f) { @@ -821,7 +822,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Side walls float targetPosY = player.position.Y; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = LaserWallDamage; int halfTotalDiagonalShots = totalDiagonalShots / 2; Vector2 start = default; Vector2 velocity = default; @@ -1112,7 +1113,7 @@ namespace CalamityMod.NPCs.DevourerofGods speedCopy += Vector2.Distance(destination, NPC.Center) * 0.005f; turnSpeedCopy += Vector2.Distance(destination, NPC.Center) * 0.00025f; - if (CalamityWorld.LegendaryMode && revenge) + if (Main.getGoodWorld) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; @@ -1270,7 +1271,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (increaseSpeed) groundPhaseTurnSpeed *= 2f; - if (CalamityWorld.LegendaryMode && revenge) + if (Main.getGoodWorld) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) segmentVelocity *= 2f; @@ -1386,8 +1387,8 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - double maximumSpeed1 = bossRush ? 0.52 : death ? 0.46 : 0.4; - double maximumSpeed2 = bossRush ? 1.25 : death ? 1.125 : 1D; + double maximumSpeed1 = death ? 0.46 : 0.4; + double maximumSpeed2 = death ? 1.125 : 1D; if (expertMode) { @@ -1533,7 +1534,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (revenge) spawnDoGCountdown = 10; - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.EdgyBossText"; Color messageColor = Color.Cyan; @@ -1582,8 +1583,8 @@ namespace CalamityMod.NPCs.DevourerofGods } // Laser barrage attack variables - float laserBarrageGateValue = bossRush ? 1080f : death ? 1320f : 1440f; - float laserBarrageShootGateValue = bossRush ? 160f : 240f; + float laserBarrageGateValue = death ? 1320f : 1440f; + float laserBarrageShootGateValue = 240f; float laserBarragePhaseGateValue = laserBarrageGateValue - laserBarrageShootGateValue; // Spawn segments @@ -1635,7 +1636,7 @@ namespace CalamityMod.NPCs.DevourerofGods // Side walls int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = LaserWallDamage; Vector2 start = default; Vector2 velocity = default; Vector2 aim = expertMode ? player.Center + player.velocity * 20f : Vector2.Zero; @@ -1871,7 +1872,7 @@ namespace CalamityMod.NPCs.DevourerofGods turnSpeedCopy += distanceFromTarget * 0.0001f * (1f - lifeRatio); } - if (CalamityWorld.LegendaryMode && revenge) + if (Main.getGoodWorld) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) speedCopy *= 2f; @@ -2015,7 +2016,7 @@ namespace CalamityMod.NPCs.DevourerofGods else if (increaseSpeed) groundPhaseTurnSpeed *= 2f; - if (CalamityWorld.LegendaryMode && revenge) + if (Main.getGoodWorld) { if ((player.Center - NPC.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(NPC.velocity.ToRotation(), MathHelper.PiOver4) == NPC.velocity.ToRotation()) segmentVelocity *= 2f; @@ -2131,8 +2132,8 @@ namespace CalamityMod.NPCs.DevourerofGods } else { - double maximumSpeed1 = bossRush ? 0.52 : death ? 0.46 : 0.4; - double maximumSpeed2 = bossRush ? 1.25 : death ? 1.125 : 1D; + double maximumSpeed1 = death ? 0.46 : 0.4; + double maximumSpeed2 = death ? 1.125 : 1D; if (expertMode) { @@ -2266,19 +2267,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.Distance(player.Center) > 2400f) NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - if (NPC.life > Main.npc[(int)NPC.ai[0]].life) NPC.life = Main.npc[(int)NPC.ai[0]].life; } @@ -2313,7 +2301,7 @@ namespace CalamityMod.NPCs.DevourerofGods } } - private void Teleport(Player player, bool bossRush, bool death, bool revenge, bool expertMode, bool phase5) + private void Teleport(Player player, bool death, bool revenge, bool expertMode, bool phase5) { Vector2 newPosition = GetRiftLocation(true); @@ -2325,13 +2313,13 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = FireballDamage; float finalVelocity = 10f; int totalSpreads = revenge ? 6 : 3; float mult = revenge ? 1.5f : 3f; for (int i = 0; i < totalSpreads; i++) { - int totalProjectiles = (CalamityWorld.LegendaryMode && revenge) ? 30 : bossRush ? 18 : 12; + int totalProjectiles = Main.getGoodWorld ? 30 : 12; float radians = MathHelper.TwoPi / totalProjectiles; float newVelocity = finalVelocity - i * mult; float velocityMult = 1f + ((finalVelocity - newVelocity) / (newVelocity * 2f) / 100f); @@ -2351,7 +2339,7 @@ namespace CalamityMod.NPCs.DevourerofGods NPC.TargetClosest(); NPC.position = newPosition; - float chargeVelocity = bossRush ? 30f : death ? 26f : revenge ? 24f : expertMode ? 22f : 20f; + float chargeVelocity = death ? 26f : revenge ? 24f : expertMode ? 22f : 20f; float maxChargeDistance = 1600f; postTeleportTimer = (int)Math.Round(maxChargeDistance / chargeVelocity); AwaitingPhase2Teleport = false; @@ -2550,7 +2538,7 @@ namespace CalamityMod.NPCs.DevourerofGods return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -2603,9 +2591,6 @@ namespace CalamityMod.NPCs.DevourerofGods // Extraneous potions npcLoot.DefineConditionalDropSet(() => true).Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 5, 15), hideLootReport: true); // Healing Potions don't show up in the Bestiary - // Alicorn Mount - npcLoot.AddIf((info) => info.player.Calamity().cirrusVodka, ModContent.ItemType()); - // Normal drops: Everything that would otherwise be in the bag var normalOnly = npcLoot.DefineNormalOnlyDropSet(); { @@ -2621,7 +2606,6 @@ namespace CalamityMod.NPCs.DevourerofGods }; normalOnly.Add(DropHelper.CalamityStyle(DropHelper.NormalWeaponDropRateFraction, weapons)); normalOnly.Add(ModContent.ItemType(), 10); - normalOnly.Add(ModContent.ItemType(), 10); // Vanity normalOnly.Add(ModContent.ItemType(), 7); @@ -2752,7 +2736,7 @@ namespace CalamityMod.NPCs.DevourerofGods if (NPC.soundDelay == 0) { NPC.soundDelay = 8; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + extrapitch }, NPC.Center); + SoundEngine.PlaySound(HitSound with { Pitch = HitSound.Pitch + extrapitch }, NPC.Center); } if (NPC.life <= 0) { @@ -2814,9 +2798,9 @@ namespace CalamityMod.NPCs.DevourerofGods Rectangle location = new Rectangle((int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height); // Speak in Wingdings if the Punch Card is equipped - if (target.Calamity().punchCard && DoGWingdings.Wingdings != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) + if (target.Transformation().Type == ModContent.ItemType() && FontAssetSystem.Fonts["Wingdings"] != null && System.Environment.OSVersion.Platform == PlatformID.Win32NT && !GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive && !GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) { - Vector2 vector = DoGWingdings.Wingdings.MeasureString(Language.GetTextValue(text)); + Vector2 vector = FontAssetSystem.Fonts["Wingdings"].MeasureString(Language.GetTextValue(text)); // This is how normal combat text spawn positioning is handled float positionX = (float)location.X + (float)location.Width * 0.5f - vector.X * 0.5f + Main.rand.Next(-(int)((double)location.Width * 0.5), (int)((double)location.Width * 0.5) + 1); float positionY = (float)location.Y + (float)location.Height * 0.25f - vector.Y * 0.5f + Main.rand.Next(-(int)((double)location.Height * 0.5), (int)((double)location.Height * 0.5) + 1); diff --git a/NPCs/DevourerofGods/DevourerofGodsTail.cs b/NPCs/DevourerofGods/DevourerofGodsTail.cs index ac2e7d6dc6..64e31b8cae 100644 --- a/NPCs/DevourerofGods/DevourerofGodsTail.cs +++ b/NPCs/DevourerofGods/DevourerofGodsTail.cs @@ -65,7 +65,7 @@ namespace CalamityMod.NPCs.DevourerofGods public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 100; // 200 NPC.npcSlots = 5f; NPC.width = 66; NPC.height = 66; @@ -87,9 +87,6 @@ namespace CalamityMod.NPCs.DevourerofGods if (Main.getGoodWorld) NPC.scale *= 1.5f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -160,9 +157,8 @@ namespace CalamityMod.NPCs.DevourerofGods float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase2 = lifeRatio < 0.6f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (phase2) { @@ -277,7 +273,6 @@ namespace CalamityMod.NPCs.DevourerofGods segmentDirection.Y = (int)(segmentDirection.Y / 16f) * 16; playerXDist -= segmentDirection.X; playerYDist -= segmentDirection.Y; - float playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); if (NPC.ai[1] > 0f && NPC.ai[1] < Main.npc.Length) { try @@ -290,7 +285,7 @@ namespace CalamityMod.NPCs.DevourerofGods { } NPC.rotation = (float)System.Math.Atan2(playerYDist, playerXDist) + MathHelper.PiOver2; - playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); + float playerDistance = (float)System.Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); int segmentWidth = NPC.width; playerDistance = (playerDistance - segmentWidth) / playerDistance; playerXDist *= playerDistance; @@ -306,25 +301,11 @@ namespace CalamityMod.NPCs.DevourerofGods } // Velocity variables - float segmentVelocity = bossRush ? 19f : death ? 17.5f : 16f; + float segmentVelocity = death ? 17.5f : 16f; if (expertMode) segmentVelocity += 4f * (1f - lifeRatio); if (Main.getGoodWorld) segmentVelocity *= 1.1f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -404,7 +385,7 @@ namespace CalamityMod.NPCs.DevourerofGods { NPC.soundDelay = 8; float extrapitch = Main.zenithWorld ? 0.3f : 0f; - SoundEngine.PlaySound(CommonCalamitySounds.OtherwordlyHitSound with { Pitch = CommonCalamitySounds.OtherwordlyHitSound.Pitch + extrapitch }, NPC.Center); + SoundEngine.PlaySound(DevourerofGodsHead.HitSound with { Pitch = DevourerofGodsHead.HitSound.Pitch + extrapitch }, NPC.Center); } if (NPC.life <= 0) { @@ -475,7 +456,6 @@ namespace CalamityMod.NPCs.DevourerofGods public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/DraedonLabThings/RepairUnitCritter.cs b/NPCs/DraedonLabThings/RepairUnitCritter.cs index 9134f87a5f..767b505105 100644 --- a/NPCs/DraedonLabThings/RepairUnitCritter.cs +++ b/NPCs/DraedonLabThings/RepairUnitCritter.cs @@ -124,7 +124,6 @@ namespace CalamityMod.NPCs.DraedonLabThings Initialized = true; } - NPC.Calamity().ShouldFallThroughPlatforms = false; switch (CurrentState) { case BehaviorState.WalkAround: @@ -147,6 +146,7 @@ namespace CalamityMod.NPCs.DraedonLabThings } } } + public override bool? CanFallThroughPlatforms() => CurrentState == BehaviorState.WalkOnWalls; public void WalkAroundOnGround() { @@ -263,7 +263,6 @@ namespace CalamityMod.NPCs.DraedonLabThings { StuckCount = 0f; WantsToClimbOnSomeWall = false; - NPC.Calamity().ShouldFallThroughPlatforms = true; // Generate unusual movement patterns based on sines. float offsetAngle = CalamityUtils.AperiodicSin(Time / 360f, 0f, 1f) * 0.006f; diff --git a/NPCs/ExoMechs/Apollo/Apollo.cs b/NPCs/ExoMechs/Apollo/Apollo.cs index e78f4f714b..a38606dec9 100644 --- a/NPCs/ExoMechs/Apollo/Apollo.cs +++ b/NPCs/ExoMechs/Apollo/Apollo.cs @@ -144,11 +144,15 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo } } + public static int FireballDamage = 80; // 320 + public static int BoltDamage = 70; // 280 + public static int RocketDamage = 95; // 380 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 240; // 480 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 204; NPC.height = 226; NPC.defense = 100; @@ -158,7 +162,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 1); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -167,9 +171,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -237,10 +238,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -416,13 +416,13 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo // Phase 7 - 0, 1, 2 // Gate values - float reducedTimeForGateValue = bossRush ? 48f : death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; + float reducedTimeForGateValue = death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f; float normalAttackTime = 360f - reducedTimeForGateValue; float berserkAttackTime = lastMechAlive ? 225f - reducedTimeForGateValue_Berserk : 270f - reducedTimeForGateValue_Berserk; float attackPhaseGateValue = shouldGetBuffedByBerserkPhase ? berserkAttackTime : normalAttackTime; float timeToLineUpAttack = 30f; - float timeToLineUpCharge = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; + float timeToLineUpCharge = death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; if (Main.getGoodWorld) { @@ -435,7 +435,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo float chargeLocationDistanceGateValue = 40f; // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (AIState == (int)Phase.LineUpChargeCombo ? 40f : 20f) * baseVelocityMult; // Attack gate values @@ -443,7 +443,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo bool doBigAttack = calamityGlobalNPC.newAI[3] >= attackPhaseGateValue + 2f + timeToLineUpAttack; // Charge velocity - float chargeVelocity = bossRush ? 115f : death ? 105f : revenge ? 101.25f : expertMode ? 97.5f : 90f; + float chargeVelocity = death ? 105f : revenge ? 101.25f : expertMode ? 97.5f : 90f; if (Main.getGoodWorld) { @@ -993,10 +993,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 plasmaVelocity = Vector2.Normalize(aimedVector) * projectileVelocity; Vector2 offset = Vector2.Normalize(plasmaVelocity) * 70f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, plasmaVelocity, type, FireballDamage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); } } } @@ -1057,10 +1056,9 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 rocketVelocity = Vector2.Normalize(aimedVector) * projectileVelocity * 1.2f; Vector2 offset = Vector2.Normalize(rocketVelocity) * 70f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, rocketVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, rocketVelocity, type, RocketDamage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); } } @@ -1180,12 +1178,11 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo NPC.ForceNetUpdate(); // Plasma bolts on charge - if (Main.netMode != NetmodeID.MultiplayerClient && (!(Main.zenithWorld && !exoMechdusa) || (CalamityWorld.LegendaryMode && revenge))) // I'm not that evil (you aren't, but I am - Fab) + if (Main.netMode != NetmodeID.MultiplayerClient && !(Main.zenithWorld && !exoMechdusa)) { - int totalProjectiles = bossRush ? 16 : death ? 12 : 8; + int totalProjectiles = death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)(NPC.GetProjectileDamage(ModContent.ProjectileType()) * 0.8); float velocity = 0.5f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -1194,7 +1191,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity2, type, BoltDamage, 0f, Main.myPlayer); } } @@ -1673,7 +1670,7 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1819,7 +1816,6 @@ namespace CalamityMod.NPCs.ExoMechs.Apollo public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Ares/AresBody.cs b/NPCs/ExoMechs/Ares/AresBody.cs index 0ba70930b6..cf48624756 100644 --- a/NPCs/ExoMechs/Ares/AresBody.cs +++ b/NPCs/ExoMechs/Ares/AresBody.cs @@ -138,7 +138,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public const float deathrayTelegraphDuration_Expert = 120f; public const float deathrayTelegraphDuration_Rev = 105f; public const float deathrayTelegraphDuration_Death = 90f; - public const float deathrayTelegraphDuration_BossRush = 60f; // Total duration of the deathrays public const float deathrayDuration = 600f; @@ -220,10 +219,15 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + public static int BlenderDamage = 105; // 420 + + // Hekate (GFB) + public static int NeuronLaserDamage = 80; // 320 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; - NPC.damage = 100; NPC.width = 220; NPC.height = 252; NPC.defense = 100; @@ -233,7 +237,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 1); NPC.noGravity = true; NPC.noTileCollide = true; NPC.DeathSound = CommonCalamitySounds.ExoDeathSound; @@ -242,9 +246,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.BossBar = ModContent.GetInstance(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -300,10 +301,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; if (NPC.ai[2] > 0f) NPC.realLife = (int)NPC.ai[2]; @@ -386,8 +386,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 betweenL = NeuronLeft + velocity * 650; SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound with { Volume = CommonCalamitySounds.LaserCannonSound.Volume - 0.2f, Pitch = CommonCalamitySounds.LaserCannonSound.Pitch + 0.2f }, NeuronRight); - Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenL, betweenL + velocity, ModContent.ProjectileType(), 111, 0f, Main.myPlayer, 7, NPC.whoAmI); - Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenR, betweenR + velocity, ModContent.ProjectileType(), 111, 0f, Main.myPlayer, 7, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenL, betweenL + velocity, ModContent.ProjectileType(), NeuronLaserDamage, 0f, Main.myPlayer, 7, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), betweenR, betweenR + velocity, ModContent.ProjectileType(), NeuronLaserDamage, 0f, Main.myPlayer, 7, NPC.whoAmI); } neurontimer = 0; @@ -505,11 +505,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Prevent mechs from being respawned - if (otherExoMechWasFirst) + // CIT 08JUN2025: This code is pointless and makes me unable to work swapping the laser arm position. Commenting it out. + /*if (otherExoMechWasFirst) { if (NPC.ai[3] < 1f) NPC.ai[3] = 1f; - } + }*/ // Phases bool spawnOtherExoMechs = lifeRatio < 0.7f && NPC.ai[3] == 0f; @@ -606,7 +607,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 destination = SecondaryAIState == (float)SecondaryPhase.PassiveAndImmune ? new Vector2(player.Center.X, player.Center.Y - 800f) : AIState != (float)Phase.Deathrays ? new Vector2(player.Center.X, player.Center.Y - 425f) : player.Center; // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (EnragedState == (float)Enraged.Yes ? 22f : 14f) * baseVelocityMult; float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f; float decelerationVelocityMult = 0.85f; @@ -888,7 +889,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else { // Enrage if the target is more than the deathray length away - if ((distanceFromTarget > DeathrayEnrageDistance || (CalamityWorld.LegendaryMode && revenge)) && EnragedState == (float)Enraged.No) + if ((distanceFromTarget > DeathrayEnrageDistance || Main.zenithWorld) && EnragedState == (float)Enraged.No) { // Play enrage sound if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < soundDistance) @@ -907,7 +908,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares calamityGlobalNPC.newAI[3] = 1f; NPC.velocity *= decelerationVelocityMult; - int totalProjectiles = bossRush ? 12 : death ? 10 : revenge ? 9 : expertMode ? 8 : 6; + int totalProjectiles = death ? 10 : revenge ? 9 : expertMode ? 8 : 6; if (Main.getGoodWorld) totalProjectiles += 4; @@ -920,8 +921,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); spinningPoint.Normalize(); - float deathrayTelegraphDuration = bossRush ? deathrayTelegraphDuration_BossRush : death ? deathrayTelegraphDuration_Death : - revenge ? deathrayTelegraphDuration_Rev : expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal; + float deathrayTelegraphDuration = death ? deathrayTelegraphDuration_Death : revenge ? deathrayTelegraphDuration_Rev : + expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal; calamityGlobalNPC.newAI[2] += (EnragedState == (float)Enraged.Yes && calamityGlobalNPC.newAI[2] % 2f == 0f) ? 2f : 1f; if (calamityGlobalNPC.newAI[2] < deathrayTelegraphDuration) @@ -991,12 +992,11 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 spawnPoint = NPC.Center + new Vector2(-1f, 23f); for (int k = 0; k < totalProjectiles; k++) { Vector2 laserVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPoint + Vector2.Normalize(laserVelocity) * 35f, laserVelocity, type, BlenderDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -1105,8 +1105,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { scale = 2f; @@ -1495,7 +1493,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1625,7 +1623,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares npcLoot.Add(ItemDropRule.BossBagByCondition(DropHelper.If(CanDropLoot), ModContent.ItemType())); // Legendary seed soup - mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().exoMechdusa), ModContent.ItemType()), hideLootReport: true); + mainDrops.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().exoMechdusa), ModContent.ItemType()), hideLootReport: true); // All other drops are contained in the bag, so they only drop directly on Normal if (!Main.expertMode) @@ -1710,7 +1708,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresGaussNuke.cs b/NPCs/ExoMechs/Ares/AresGaussNuke.cs index 7234ce1600..96f6790a80 100644 --- a/NPCs/ExoMechs/Ares/AresGaussNuke.cs +++ b/NPCs/ExoMechs/Ares/AresGaussNuke.cs @@ -85,10 +85,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + public static int NukeDamage = 135; // 540 + public static int SparkDamage = 70; // 280 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; - NPC.damage = 100; NPC.width = 170; NPC.height = 120; NPC.defense = 100; @@ -106,9 +109,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.hide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -146,10 +146,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; @@ -238,7 +237,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Calamity().newAI[3] = 0f; // Predictiveness - float predictionAmt = bossRush ? 20f : death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; + float predictionAmt = death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; if (nerfedAttacks) predictionAmt *= 0.5f; if (passivePhase) @@ -326,7 +325,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; @@ -422,9 +421,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float nukeOffset = 40f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * nukeOffset, gaussNukeVelocity, type, damage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.Normalize(gaussNukeVelocity) * nukeOffset, gaussNukeVelocity, type, NukeDamage, 0f, Main.myPlayer, 0f, Main.player[targetIndex].Center.Y); } // Recoil @@ -487,8 +485,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override void FindFrame(int frameHeight) { // Use telegraph frames when using gauss nuke @@ -702,7 +698,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresLaserCannon.cs b/NPCs/ExoMechs/Ares/AresLaserCannon.cs index 81107f0d5a..01137624d4 100644 --- a/NPCs/ExoMechs/Ares/AresLaserCannon.cs +++ b/NPCs/ExoMechs/Ares/AresLaserCannon.cs @@ -88,10 +88,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + public static int LaserDamage = 80; // 320 + public static int BeamDamage = 105; // 420 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; - NPC.damage = 100; NPC.width = 154; NPC.height = 90; NPC.defense = 100; @@ -109,9 +112,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.hide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -151,10 +151,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; @@ -184,6 +183,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool nerfedAttacks = false; if (exoTwinsAlive) nerfedAttacks = Main.npc[CalamityGlobalNPC.draedonExoMechTwinGreen].Calamity().newAI[1] != (float)Apollo.Apollo.SecondaryPhase.PassiveAndImmune; + // Used to make the beam only sweep horizontally during mecha mayhem phase + bool mechaMayhem = nerfedAttacks && exoWormAlive && Main.npc[CalamityGlobalNPC.draedonExoMechWorm].Calamity().newAI[1] != (float)ThanatosHead.SecondaryPhase.PassiveAndImmune; // Phases bool berserk = lifeRatio < 0.4f || (otherExoMechsAlive == 0 && lifeRatio < 0.7f); @@ -325,7 +326,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; float baseAcceleration = shouldGetBuffedByBerserkPhase ? 1.25f : 1f; @@ -346,7 +347,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares else if (shouldGetBuffedByBerserkPhase) deathrayPhaseGateValue *= 0.5f; - float deathrayPhaseVelocity = (nerfedAttacks ? 6f : passivePhase ? 9f : 12f) * baseVelocityMult; + float deathrayPhaseVelocity = (nerfedAttacks ? 8f : passivePhase ? 9f : 12f) * baseVelocityMult; if (lastMechAlive) deathrayPhaseVelocity *= 1.2f; else if (shouldGetBuffedByBerserkPhase) @@ -356,8 +357,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || !fireNormalLasers; // Telegraph duration for deathray spiral - float deathraySpiralTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : - revenge ? AresBody.deathrayTelegraphDuration_Rev : expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; + float deathraySpiralTelegraphDuration = death ? AresBody.deathrayTelegraphDuration_Death : revenge ? AresBody.deathrayTelegraphDuration_Rev : + expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; // Variable to disable deathray firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || @@ -455,10 +456,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 laserVelocity = Vector2.Normalize(Main.player[targetIndex].Center - NPC.Center); Vector2 laserOffset = laserVelocity * 70f + Vector2.UnitY * 16f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserOffset, Main.player[targetIndex].Center, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserOffset, Main.player[targetIndex].Center, type, LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -486,7 +486,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float beamOffset = 84f; float beamOffset2 = 16f; Vector2 source = horizontalLaserSweep ? new Vector2(NPC.Center.X - beamOffset2 * NPC.direction, NPC.Center.Y + beamOffset) : new Vector2(NPC.Center.X + beamOffset * NPC.direction, NPC.Center.Y + beamOffset2); @@ -494,7 +493,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (laserVelocity.HasNaNs()) laserVelocity = -Vector2.UnitY; - Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, laserVelocity, type, BeamDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -512,10 +511,21 @@ namespace CalamityMod.NPCs.ExoMechs.Ares AIState = (float)Phase.Nothing; calamityGlobalNPC.newAI[2] = 0f; - // Change deathray sweep type for next deathray phase + // Change deathray sweep type for next deathray phase; this does not affect anything during mecha mayhem calamityGlobalNPC.newAI[3] += 1f; if (calamityGlobalNPC.newAI[3] > 1f) calamityGlobalNPC.newAI[3] = 0f; + + // If mecha mayhem, make Ares swap the position of the laser and gauss arms, and ensure the beam always sweeps horizontal + if (mechaMayhem) + { + calamityGlobalNPC.newAI[3] = 0f; + if (Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] == 0f) + Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] = 1f; + else + Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ai[3] = 0f; + Main.npc[CalamityGlobalNPC.draedonExoMechPrime].ForceNetUpdate(); + } } break; @@ -536,8 +546,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override void FindFrame(int frameHeight) { // Use telegraph frames when using deathrays @@ -751,7 +759,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs index 65d8a89c91..145ad2fd20 100644 --- a/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs +++ b/NPCs/ExoMechs/Ares/AresPlasmaFlamethrower.cs @@ -82,10 +82,13 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + public static int FireballDamage = 80; // 320 + public static int BoltDamage = 70; // 280 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; - NPC.damage = 100; NPC.width = 152; NPC.height = 90; NPC.defense = 100; @@ -103,9 +106,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.hide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -145,10 +145,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; @@ -237,7 +236,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.Calamity().newAI[3] = 0f; // Predictiveness - float predictionAmt = bossRush ? 20f : death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; + float predictionAmt = death ? 15f : revenge ? 13.75f : expertMode ? 12.5f : 10f; if (nerfedAttacks) predictionAmt *= 0.5f; if (passivePhase) @@ -338,7 +337,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; @@ -354,8 +353,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral - float deathrayTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : - revenge ? AresBody.deathrayTelegraphDuration_Rev : expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; + float deathrayTelegraphDuration = death ? AresBody.deathrayTelegraphDuration_Death : revenge ? AresBody.deathrayTelegraphDuration_Rev : + expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; // Variable to cancel plasma bolt firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || @@ -444,13 +443,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 plasmaOffset = Vector2.Normalize(plasmaBoltVelocity) * 40f + Vector2.UnitY * 16f; if (boltsSplitLess) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, -1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, FireballDamage, 0f, Main.myPlayer, -1f); else - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, damage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + plasmaOffset, plasmaBoltVelocity, type, FireballDamage, 0f, Main.myPlayer, Main.player[targetIndex].Center.X, Main.player[targetIndex].Center.Y); } // Recoil @@ -487,8 +485,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override void FindFrame(int frameHeight) { // Use telegraph frames when using plasma bolts @@ -700,7 +696,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs index 50617f35d7..9f7c029980 100644 --- a/NPCs/ExoMechs/Ares/AresTeslaCannon.cs +++ b/NPCs/ExoMechs/Ares/AresTeslaCannon.cs @@ -83,10 +83,12 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } + public static int OrbDamage = 80; // 320 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; - NPC.damage = 100; NPC.width = 172; NPC.height = 108; NPC.defense = 100; @@ -104,9 +106,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.hide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -146,10 +145,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].life / (float)Main.npc[CalamityGlobalNPC.draedonExoMechPrime].lifeMax; @@ -238,7 +236,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares NPC.localAI[0] = 0f; // Predictiveness - float predictionAmt = bossRush ? 40f : death ? 30f : revenge ? 27.5f : expertMode ? 25f : 20f; + float predictionAmt = death ? 30f : revenge ? 27.5f : expertMode ? 25f : 20f; if (nerfedAttacks) predictionAmt *= 0.5f; if (passivePhase) @@ -341,7 +339,7 @@ namespace CalamityMod.NPCs.ExoMechs.Ares Vector2 destination = Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Center + (calamityGlobalNPC_Body.newAI[0] == (float)AresBody.Phase.Deathrays ? offset2 : offset); // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = (enraged ? 38f : 30f) * baseVelocityMult; baseVelocity *= 1f + Main.npc[(int)NPC.ai[2]].localAI[2]; @@ -354,8 +352,8 @@ namespace CalamityMod.NPCs.ExoMechs.Ares bool canFire = Vector2.Distance(NPC.Center, Main.player[targetIndex].Center) > 320f || calamityGlobalNPC_Body.newAI[0] != (float)AresBody.Phase.Deathrays; // Telegraph duration for deathray spiral - float deathrayTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : - revenge ? AresBody.deathrayTelegraphDuration_Rev : expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; + float deathrayTelegraphDuration = death ? AresBody.deathrayTelegraphDuration_Death : revenge ? AresBody.deathrayTelegraphDuration_Rev : + expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; // Variable to cancel tesla orb firing bool doNotFire = calamityGlobalNPC_Body.newAI[1] == (float)AresBody.SecondaryPhase.PassiveAndImmune || @@ -443,10 +441,9 @@ namespace CalamityMod.NPCs.ExoMechs.Ares if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 orbOffset = Vector2.Normalize(teslaOrbVelocity) * 40f + Vector2.UnitY * 8f; float identity = fireMoreOrbs ? -2f : calamityGlobalNPC.newAI[3] + (calamityGlobalNPC.newAI[2] - teslaOrbTelegraphDuration) / divisor; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + orbOffset, teslaOrbVelocity, type, damage, 0f, Main.myPlayer, identity); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + orbOffset, teslaOrbVelocity, type, OrbDamage, 0f, Main.myPlayer, identity); } // Recoil @@ -484,8 +481,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override void FindFrame(int frameHeight) { // Use telegraph frames when using tesla orbs @@ -696,7 +691,6 @@ namespace CalamityMod.NPCs.ExoMechs.Ares public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } } } diff --git a/NPCs/ExoMechs/Artemis/Artemis.cs b/NPCs/ExoMechs/Artemis/Artemis.cs index 7818bae958..7cc58477a2 100644 --- a/NPCs/ExoMechs/Artemis/Artemis.cs +++ b/NPCs/ExoMechs/Artemis/Artemis.cs @@ -174,11 +174,14 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } + public static int LaserDamage = 80; // 320 + public static int BeamDamage = 105; // 420 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 190; // 380 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 204; NPC.height = 226; NPC.defense = 100; @@ -196,9 +199,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.BossBar = ModContent.GetInstance(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -270,10 +270,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis NPC.frame = new Rectangle(NPC.width * frameX, NPC.height * frameY, NPC.width, NPC.height); // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -450,7 +449,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis // Phase 7 - 0, 1, 2 // Gate values - float reducedTimeForGateValue = bossRush ? 48f : death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; + float reducedTimeForGateValue = death ? 32f : revenge ? 24f : expertMode ? 16f : 0f; float reducedTimeForGateValue_Berserk = reducedTimeForGateValue * 0.5f; float normalAttackTime = 360f - reducedTimeForGateValue; float berserkAttackTime = lastMechAlive ? 225f - reducedTimeForGateValue_Berserk : 270f - reducedTimeForGateValue_Berserk; @@ -494,7 +493,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis float movementDistanceGateValue = 100f; // Charge variables - float chargeVelocity = nerfedAttacks ? 60f : bossRush ? 81f : death ? 74f : revenge ? 70.5f : expertMode ? 67f : 60f; + float chargeVelocity = nerfedAttacks ? 60f : death ? 74f : revenge ? 70.5f : expertMode ? 67f : 60f; if (Main.getGoodWorld) chargeVelocity *= 1.15f; @@ -517,7 +516,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis predictionAmt *= 0.5f; // Velocity and acceleration values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (bossRush ? 1.15f : death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.25f : 0f) + (death ? 1.1f : revenge ? 1.075f : expertMode ? 1.05f : 1f); float baseVelocity = ((AIState == (int)Phase.Deathray || lineUpAttack || AIState == (int)Phase.LaserShotgun) ? 40f : 20f) * baseVelocityMult; float decelerationVelocityMult = 0.85f; @@ -777,10 +776,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 offset = laserVelocity * 70f; float setVelocityInAI = 7.5f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileDestination, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + offset, projectileDestination, type, LaserDamage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } } @@ -832,10 +830,9 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 laserVelocity = chargeVelocityNormalized * 10f; - int numLasersPerSpread = bossRush ? 10 : death ? 8 : expertMode ? 6 : 4; - int spread = bossRush ? 30 : death ? 26 : expertMode ? 21 : 15; + int numLasersPerSpread = death ? 8 : expertMode ? 6 : 4; + int spread = death ? 26 : expertMode ? 21 : 15; float rotation = MathHelper.ToRadians(spread); float distanceFromTarget = Vector2.Distance(NPC.Center, NPC.Center + chargeVelocityNormalized * chargeDistance); float setVelocityInAI = death ? 7f : revenge ? 6.75f : expertMode ? 6.5f : 6f; @@ -848,7 +845,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 offset = normalizedPerturbedSpeed * 70f; Vector2 newCenter = NPC.Center + offset; - Projectile.NewProjectile(NPC.GetSource_FromAI(), newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, LaserDamage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } } @@ -929,14 +926,13 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 laserVelocity = Vector2.Normalize(aimedVector) * 10f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); /* Spread: * lastMechAlive = 20, 25, 30 * normal = 16, 20, 24 * nerfedAttacks = 12, 15, 18 */ - int numLasersAddedByDifficulty = bossRush ? 3 : death ? 2 : expertMode ? 1 : 0; + int numLasersAddedByDifficulty = death ? 2 : expertMode ? 1 : 0; int numLasersPerSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 3 : lastMechAlive ? 7 : 5) + numLasersAddedByDifficulty; int baseSpread = ((nerfedAttacks || nerfedLaserShotgun) ? 9 : lastMechAlive ? 20 : 15) + numLasersAddedByDifficulty * 2; int spread = baseSpread + (int)(calamityGlobalNPC.newAI[2] / divisor2) * (baseSpread / 4); @@ -954,7 +950,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis Vector2 newCenter = NPC.Center + offset; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, damage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), newCenter, newCenter + normalizedPerturbedSpeed * distanceFromTarget, type, LaserDamage, 0f, Main.myPlayer, setVelocityInAI, NPC.whoAmI); } } @@ -1087,8 +1083,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - int laser = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.whoAmI); + int laser = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, BeamDamage, 0f, Main.myPlayer, NPC.whoAmI); if (Main.projectile.IndexInRange(laser)) { Main.projectile[laser].ai[0] = NPC.whoAmI; @@ -1099,7 +1094,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis else { // This first variable is used to adjust how long it takes for the rotation rate to reach max - float rotationSpeedMult = bossRush ? 6.66f : death ? 4f : revenge ? 3f : expertMode ? 2.5f : 2f; + float rotationSpeedMult = death ? 4f : revenge ? 3f : expertMode ? 2.5f : 2f; // This is used to adjust both the radians and the velocity of the spin moved per frame // At 15% progress it will be at max rotation in Boss Rush @@ -1592,7 +1587,7 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1619,7 +1614,6 @@ namespace CalamityMod.NPCs.ExoMechs.Artemis public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Draedon.cs b/NPCs/ExoMechs/Draedon.cs index d0e4c41861..ad8ffb7bb4 100644 --- a/NPCs/ExoMechs/Draedon.cs +++ b/NPCs/ExoMechs/Draedon.cs @@ -112,6 +112,9 @@ namespace CalamityMod.NPCs.ExoMechs } } + // GFB + public static int PulseRifleDamage = 100; // 400 + public override void SetDefaults() { NPC.damage = 0; @@ -524,7 +527,7 @@ namespace CalamityMod.NPCs.ExoMechs Vector2 shoot = PlayerToFollow.Center - NPC.Center; shoot.Normalize(); shoot *= 4; - int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center - Vector2.UnitY * 30, shoot, ModContent.ProjectileType(), 116, 0, Main.myPlayer); + int p = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center - Vector2.UnitY * 30, shoot, ModContent.ProjectileType(), PulseRifleDamage, 0, Main.myPlayer); if (p.WithinBounds(Main.maxProjectiles)) { Main.projectile[p].timeLeft *= 2; diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs index e2eda50072..63d10f0991 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody1.cs @@ -65,8 +65,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 150; // 300 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 88; NPC.height = 88; NPC.defense = 100; @@ -88,9 +88,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -141,10 +138,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Check if other segments are still alive, if not, die bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); @@ -254,7 +250,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; + double numSegmentsAbleToFire = death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) numSegmentsAbleToFire *= 1.25; @@ -306,10 +302,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -364,12 +359,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; + float predictionAmt = death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -378,7 +372,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { @@ -386,18 +380,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -522,7 +516,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Velocity and turn speed values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling @@ -533,20 +527,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.getGoodWorld) baseVelocity *= 1.15f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = baseVelocity * 0.25f; - float minimalDamageVelocity = baseVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -690,7 +670,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs index 411630ec67..fb5343f815 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosBody2.cs @@ -64,8 +64,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 150; // 300 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 90; NPC.height = 90; NPC.defense = 100; @@ -87,9 +87,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -140,10 +137,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Check if other segments are still alive, if not, die bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); @@ -253,7 +249,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; + double numSegmentsAbleToFire = death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) numSegmentsAbleToFire *= 1.25; @@ -305,10 +301,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -363,12 +358,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; + float predictionAmt = death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -377,7 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { @@ -385,18 +379,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -525,7 +519,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Velocity and turn speed values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling @@ -536,20 +530,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.getGoodWorld) baseVelocity *= 1.15f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = baseVelocity * 0.25f; - float minimalDamageVelocity = baseVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -695,7 +675,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs index d4eb16b82b..7e3b79d92b 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosHead.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosHead.cs @@ -166,11 +166,14 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } + public static int LaserDamage = 80; // 320 + public static int BeamDamage = 135; // 540 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 240; // 480 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 164; NPC.height = 164; NPC.defense = 100; @@ -181,7 +184,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 1); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -192,9 +195,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.chaseable = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -253,7 +253,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } public float GetSlowdownAreaEdgeRadius(bool lastMechAlive) => - (BossRushEvent.BossRushActive ? 400f : CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.6f : 1f) * (Main.zenithWorld && !exoMechdusa ? 2 : Main.getGoodWorld ? 0.5f : 1f); + (CalamityWorld.death ? 600f : CalamityWorld.revenge ? 700f : Main.expertMode ? 800f : 1000f) * (lastMechAlive ? 0.75f : 1f) * (Main.zenithWorld && !exoMechdusa ? 2 : Main.getGoodWorld ? 0.75f : 1f); public int CheckForOtherMechs(ref int targetIndex, out bool exoPrimeAlive, out bool exoTwinsAlive) { @@ -297,10 +297,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos CalamityGlobalNPC.draedonExoMechWorm = NPC.whoAmI; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -518,7 +517,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos float laserBarrageLocationDistance = turnDistance * 3f; // Velocity and turn speed values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling @@ -941,8 +940,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, BeamDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -1046,19 +1044,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } } - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = baseVelocity * 0.25f; - float minimalDamageVelocity = baseVelocity * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -1245,7 +1230,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1367,7 +1352,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs index 8faffda3d8..5e888f834e 100644 --- a/NPCs/ExoMechs/Thanatos/ThanatosTail.cs +++ b/NPCs/ExoMechs/Thanatos/ThanatosTail.cs @@ -64,8 +64,8 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.npcSlots = 5f; - NPC.GetNPCDamage(); NPC.width = 76; NPC.height = 110; NPC.defense = 100; @@ -87,9 +87,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadSlot(ref int index) @@ -140,10 +137,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos NPC.life = Main.npc[(int)NPC.ai[1]].life; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Check if other segments are still alive, if not, die bool shouldDespawn = !NPC.AnyNPCs(ModContent.NPCType()); @@ -253,7 +249,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (NPC.Calamity().newAI[0] == 0f) NPC.ai[3] += 1f; - double numSegmentsAbleToFire = bossRush ? 42D : death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; + double numSegmentsAbleToFire = death ? 36D : revenge ? 34D : expertMode ? 30D : 24D; if (shouldGetBuffedByBerserkPhase) numSegmentsAbleToFire *= 1.25; @@ -305,10 +301,9 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -363,12 +358,11 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } } - float predictionAmt = bossRush ? 24f : death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; + float predictionAmt = death ? 20f : revenge ? 18f : expertMode ? 16f : 12f; if (NPC.ai[0] % 3f == 0f) predictionAmt *= 0.5f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); SoundEngine.PlaySound(CommonCalamitySounds.ExoLaserShootSound, NPC.Center); for (int i = 0; i < numProjectiles; i++) { @@ -377,7 +371,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos { // Normal laser if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } else { @@ -385,18 +379,18 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (shouldGetBuffedByBerserkPhase && NPC.ai[0] % 3f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, targetCenterArray[i], type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } // Predictive laser Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); // Opposite laser projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt; if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, damage, 0f, Main.myPlayer, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileDestination, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, NPC.whoAmI); } } } @@ -523,7 +517,7 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos } // Velocity and turn speed values - float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (bossRush ? 1.25f : death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); + float baseVelocityMult = (shouldGetBuffedByBerserkPhase ? 0.15f : 0f) + (death ? 1.2f : revenge ? 1.175f : expertMode ? 1.15f : 1.1f); float baseVelocity = 10f * baseVelocityMult; // Increase top velocity if target is dead or if Thanatos is uncoiling @@ -534,20 +528,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos if (Main.getGoodWorld) baseVelocity *= 1.15f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = baseVelocity * 0.25f; - float minimalDamageVelocity = baseVelocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CanHitPlayer(Player target, ref int cooldownSlot) @@ -694,7 +674,6 @@ namespace CalamityMod.NPCs.ExoMechs.Thanatos public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/GreatSandShark/GreatSandShark.cs b/NPCs/GreatSandShark/GreatSandShark.cs index 008c2637d5..42af41cb27 100644 --- a/NPCs/GreatSandShark/GreatSandShark.cs +++ b/NPCs/GreatSandShark/GreatSandShark.cs @@ -52,12 +52,11 @@ namespace CalamityMod.NPCs.GreatSandShark NPC.width = 300; NPC.height = 120; NPC.defense = 40; - NPC.DR_NERD(0.25f); NPC.LifeMaxNERB(9200, 11000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.value = Item.buyPrice(gold: 5); NPCID.Sets.TrailCacheLength[Type] = 8; NPCID.Sets.TrailingMode[Type] = 1; NPC.behindTiles = true; diff --git a/NPCs/HiveMind/DankCreeper.cs b/NPCs/HiveMind/DankCreeper.cs index 758f6cac73..baef197d63 100644 --- a/NPCs/HiveMind/DankCreeper.cs +++ b/NPCs/HiveMind/DankCreeper.cs @@ -16,7 +16,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 24; // 48 NPC.width = 70; NPC.height = 70; NPC.defense = 6; @@ -25,14 +25,14 @@ namespace CalamityMod.NPCs.HiveMind if (BossRushEvent.BossRushActive) NPC.lifeMax = 2000; if (Main.getGoodWorld) - NPC.lifeMax *= 4; - - if ((CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + { + NPC.lifeMax *= 3; NPC.reflectsProjectiles = true; + } NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.3f; + NPC.knockBackResist = 0.3f; NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit1; @@ -40,10 +40,6 @@ namespace CalamityMod.NPCs.HiveMind NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -65,11 +61,9 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - bool masterMode = Main.masterMode; + bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; - float speed = masterMode ? 15f : revenge ? 13f : 11f; - if (BossRushEvent.BossRushActive) - speed = 18f; + float speed = death ? 15f : revenge ? 13f : 11f; if (NPC.ai[1] < 90f) NPC.ai[1] += 1f; @@ -126,7 +120,7 @@ namespace CalamityMod.NPCs.HiveMind if (hurtInfo.Damage < 0) return; - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } public override void HitEffect(NPC.HitInfo hit) @@ -157,8 +151,7 @@ namespace CalamityMod.NPCs.HiveMind if ((Main.expertMode || BossRushEvent.BossRushActive) && Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, HiveMind.ShaderainDamage, 0f, Main.myPlayer); } } } diff --git a/NPCs/HiveMind/DarkHeart.cs b/NPCs/HiveMind/DarkHeart.cs index 56c9153f18..3970830b8e 100644 --- a/NPCs/HiveMind/DarkHeart.cs +++ b/NPCs/HiveMind/DarkHeart.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.HiveMind public override void SetDefaults() { - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.width = 32; NPC.height = 32; NPC.defense = 2; @@ -30,11 +30,11 @@ namespace CalamityMod.NPCs.HiveMind if (BossRushEvent.BossRushActive) NPC.lifeMax = 1800; if (Main.getGoodWorld) - NPC.lifeMax *= 4; + NPC.lifeMax *= 3; NPC.aiStyle = -1; AIType = -1; - NPC.knockBackResist = BossRushEvent.BossRushActive ? 0f : 0.4f; + NPC.knockBackResist = 0.4f; NPC.noGravity = true; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath21; @@ -63,7 +63,6 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -74,21 +73,19 @@ namespace CalamityMod.NPCs.HiveMind if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) NPC.TargetClosest(); - float velocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10f : death ? 7f : revenge ? 6f : 4f; - float acceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; - float deceleration = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; - if (masterMode) + // Despawn if Hive Mind isn't present + if (CalamityGlobalNPC.hiveMind == -1) { - velocity += 2f; - acceleration += 0.2f; - deceleration -= 0.05f; - } - if (BossRushEvent.BossRushActive) - { - velocity *= 2f; - acceleration *= 2f; + NPC.life = 0; + NPC.HitEffect(); + NPC.checkDead(); + NPC.active = false; } + float velocity = Main.getGoodWorld ? 10f : death ? 7f : revenge ? 6f : 4f; + float acceleration = Main.getGoodWorld ? 0.5f : death ? 0.35f : revenge ? 0.3f : 0.2f; + float deceleration = Main.getGoodWorld ? 0.9f : death ? 0.95f : revenge ? 0.96f : 0.98f; + if (NPC.position.Y > Main.player[NPC.target].position.Y - 400f) { if (NPC.velocity.Y > 0f) @@ -105,7 +102,7 @@ namespace CalamityMod.NPCs.HiveMind } bool dropRain = NPC.Bottom.Y < Main.player[NPC.target].position.Y - 350f && Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height); - float distanceX = masterMode ? 200f : 400f; + float distanceX = death ? 200f : 400f; if (NPC.Center.X > Main.player[NPC.target].Center.X + distanceX) { dropRain = false; @@ -135,10 +132,9 @@ namespace CalamityMod.NPCs.HiveMind int shaderainXPos = (int)(NPC.position.X + 10f + Main.rand.Next(NPC.width - 20)); int shaderainYos = (int)(NPC.position.Y + NPC.height + 4f); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - float randomXVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextFloat() * 5f : 0f; + float randomXVelocity = Main.getGoodWorld ? Main.rand.NextFloat() * 5f : 0f; float velocityY = 8f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, velocityY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shaderainXPos, shaderainYos, randomXVelocity, velocityY, type, HiveMind.ShaderainDamage, 0f, Main.myPlayer); } } } diff --git a/NPCs/HiveMind/HiveBlob.cs b/NPCs/HiveMind/HiveBlob.cs index 195befe9ea..f9467741d4 100644 --- a/NPCs/HiveMind/HiveBlob.cs +++ b/NPCs/HiveMind/HiveBlob.cs @@ -14,20 +14,23 @@ namespace CalamityMod.NPCs.HiveMind { public class HiveBlob : ModNPC { - private const float ShootGateValue = 240f; + private const float NormalShootGate = 240f; + private const float FastShootGate = 180f; private const float TelegraphDuration = 120f; - private const float ShowTelegraphValue = ShootGateValue - TelegraphDuration; + private bool FastVariant => NPC.ai[2] > 0f; - public override void SetStaticDefaults() - { - NPCID.Sets.NeedsExpertScaling[Type] = true; - } + public override void SetStaticDefaults() => NPCID.Sets.NeedsExpertScaling[Type] = true; + + public static int VileClotDamage = 8; // 32 + + // Legendary Mode exclusive + public static int CursedFlameDamage = 15; // 60 public override void SetDefaults() { NPC.npcSlots = 0.1f; NPC.aiStyle = -1; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.width = 25; NPC.height = 25; @@ -62,7 +65,6 @@ namespace CalamityMod.NPCs.HiveMind public override void AI() { bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; @@ -108,10 +110,11 @@ namespace CalamityMod.NPCs.HiveMind } } - float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; float acceleration = 0.8f; - float distanceFromMind = Main.getGoodWorld ? 256f : 128f; + float distanceFromMind = FastVariant ? 96f : 128f; + if (Main.getGoodWorld) + distanceFromMind *= 2; float hiveMindX = Main.npc[hiveMind].Center.X; float hiveMindY = Main.npc[hiveMind].Center.Y; @@ -162,16 +165,16 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { + float shootGateValue = FastVariant ? FastShootGate : NormalShootGate; if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) - NPC.localAI[1] = ShootGateValue * 0.5f; + NPC.localAI[1] = shootGateValue * 0.5f; - float shootGateValue = ShootGateValue; if (NPC.localAI[1] < shootGateValue) { NPC.localAI[1] += 1f; - if (NPC.localAI[1] < ShowTelegraphValue) + if (NPC.localAI[1] < shootGateValue - TelegraphDuration) NPC.localAI[1] += Main.rand.Next(2); - if (masterMode) + if (death) NPC.localAI[1] += 1f; } @@ -184,8 +187,6 @@ namespace CalamityMod.NPCs.HiveMind if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) { float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (masterMode) - projSpeed += 2f; if (Main.getGoodWorld) projSpeed *= 1.5f; @@ -196,8 +197,8 @@ namespace CalamityMod.NPCs.HiveMind playerDist = projSpeed / playerDist; playerX *= playerDist; playerY *= playerDist; - int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); + int type = (Main.getGoodWorld && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); + int damage = type == ProjectileID.CursedFlameHostile ? CursedFlameDamage : VileClotDamage; Vector2 projectileVelocity = new Vector2(playerX, playerY); if (type == ProjectileID.CursedFlameHostile) { @@ -227,8 +228,9 @@ namespace CalamityMod.NPCs.HiveMind vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); Color color = NPC.GetAlpha(drawColor); - if (NPC.localAI[1] > ShowTelegraphValue) - color = Color.Lerp(color, Color.LimeGreen * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - ShowTelegraphValue) / TelegraphDuration, 0f, 1f)); + float shootGateValue = FastVariant ? FastShootGate : NormalShootGate; + if (NPC.localAI[1] > shootGateValue - TelegraphDuration) + color = Color.Lerp(color, Color.LimeGreen * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - (shootGateValue - TelegraphDuration)) / TelegraphDuration, 0f, 1f)); spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); @@ -254,6 +256,16 @@ namespace CalamityMod.NPCs.HiveMind for (int k = 0; k < 10; k++) Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } + + if (Main.netMode != NetmodeID.MultiplayerClient && FastVariant && Main.zenithWorld) + { + // Spawn even more blobs on death + for (int i = 1; i < 3; i++) + { + Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); + NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); + } + } } } } diff --git a/NPCs/HiveMind/HiveBlob2.cs b/NPCs/HiveMind/HiveBlob2.cs deleted file mode 100644 index 0587b8edb2..0000000000 --- a/NPCs/HiveMind/HiveBlob2.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System; -using CalamityMod.Events; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.HiveMind -{ - public class HiveBlob2 : ModNPC - { - private const float ShootGateValue = 180f; - private const float TelegraphDuration = 120f; - private const float ShowTelegraphValue = ShootGateValue - TelegraphDuration; - - public override LocalizedText DisplayName => CalamityUtils.GetText("NPCs.HiveBlob.DisplayName"); - public override string Texture => "CalamityMod/NPCs/HiveMind/HiveBlob"; - - public override void SetStaticDefaults() - { - this.HideFromBestiary(); - NPCID.Sets.NeedsExpertScaling[Type] = true; - } - - public override void SetDefaults() - { - NPC.npcSlots = 0.1f; - NPC.aiStyle = -1; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats - NPC.width = 25; - NPC.height = 25; - - NPC.lifeMax = 75; - if (BossRushEvent.BossRushActive) - NPC.lifeMax = 1300; - if (Main.getGoodWorld) - NPC.lifeMax *= 2; - - NPC.knockBackResist = 0.9f; - AIType = -1; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.chaseable = false; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - } - - public override void AI() - { - bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - - bool getFuckedAI = Main.zenithWorld; - - int hiveMind = CalamityGlobalNPC.hiveMind; - if (hiveMind < 0 || !Main.npc[hiveMind].active) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - return; - } - - // When Hive Mind starts flying around - bool phase2 = Main.npc[hiveMind].life / (float)Main.npc[hiveMind].lifeMax < 0.8f; - - if (phase2) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - return; - } - - NPC.alpha = Main.npc[hiveMind].alpha; - - if (NPC.ai[3] > 0f) - hiveMind = (int)NPC.ai[3] - 1; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] -= getFuckedAI ? 10f : 1f; //Relocation rate - float RandomPositionMultiplier = getFuckedAI ? 2f : 1f; - if (NPC.localAI[0] <= 0f) - { - NPC.localAI[0] = Main.rand.Next(180, 361); - NPC.ai[0] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //X position - NPC.ai[1] = Main.rand.Next(-100, 101) * RandomPositionMultiplier; //Y position - NPC.netUpdate = true; - } - } - - float hiveMindVelocity = Main.npc[hiveMind].velocity.Length(); - float relocateSpeed = getFuckedAI ? 1.2f : death ? 0.8f : revenge ? 0.7f : expertMode ? 0.6f : 0.5f; - float acceleration = 0.8f; - float distanceFromMind = Main.getGoodWorld ? 192f : 96f; - - float hiveMindX = Main.npc[hiveMind].Center.X; - float hiveMindY = Main.npc[hiveMind].Center.Y; - Vector2 hiveMindPos = new Vector2(hiveMindX, hiveMindY); - float randomPosX = hiveMindX + NPC.ai[0]; - float randomPosY = hiveMindY + NPC.ai[1]; - float finalRandPosX = randomPosX - hiveMindPos.X; - float finalRandPosY = randomPosY - hiveMindPos.Y; - float finalRandDistance = (float)Math.Sqrt(finalRandPosX * finalRandPosX + finalRandPosY * finalRandPosY); - finalRandDistance = distanceFromMind / finalRandDistance; - finalRandPosX *= finalRandDistance; - finalRandPosY *= finalRandDistance; - - if (NPC.position.X < hiveMindX + finalRandPosX) - { - NPC.velocity.X += relocateSpeed; - if (NPC.velocity.X < 0f && finalRandPosX > 0f) - NPC.velocity.X *= acceleration; - } - else if (NPC.position.X > hiveMindX + finalRandPosX) - { - NPC.velocity.X -= relocateSpeed; - if (NPC.velocity.X > 0f && finalRandPosX < 0f) - NPC.velocity.X *= acceleration; - } - if (NPC.position.Y < hiveMindY + finalRandPosY) - { - NPC.velocity.Y += relocateSpeed; - if (NPC.velocity.Y < 0f && finalRandPosY > 0f) - NPC.velocity.Y *= acceleration; - } - else if (NPC.position.Y > hiveMindY + finalRandPosY) - { - NPC.velocity.Y -= relocateSpeed; - if (NPC.velocity.Y > 0f && finalRandPosY < 0f) - NPC.velocity.Y *= acceleration; - } - - float velocityLimit = relocateSpeed * 16f; - if (NPC.velocity.X > velocityLimit) - NPC.velocity.X = velocityLimit; - if (NPC.velocity.X < -velocityLimit) - NPC.velocity.X = -velocityLimit; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; - if (NPC.velocity.Y < -velocityLimit) - NPC.velocity.Y = -velocityLimit; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) - NPC.localAI[1] = ShootGateValue * 0.5f; - - float shootGateValue = ShootGateValue; - if (NPC.localAI[1] < shootGateValue) - { - NPC.localAI[1] += 1f; - if (NPC.localAI[1] < ShowTelegraphValue) - NPC.localAI[1] += Main.rand.Next(2); - if (masterMode) - NPC.localAI[1] += 1f; - } - - if (NPC.alpha > 0) - return; - - if (NPC.localAI[1] >= shootGateValue && Vector2.Distance(Main.player[Main.npc[hiveMind].target].Center, NPC.Center) > 80f) - { - NPC.localAI[1] = 0f; - if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[Main.npc[hiveMind].target].position, Main.player[Main.npc[hiveMind].target].width, Main.player[Main.npc[hiveMind].target].height)) - { - float projSpeed = death ? 8f : revenge ? 7f : expertMode ? 6f : 4f; - if (masterMode) - projSpeed += 2f; - if (Main.getGoodWorld) - projSpeed *= 1.5f; - - Vector2 projDirection = NPC.Center; - float playerX = Main.player[Main.npc[hiveMind].target].Center.X - projDirection.X; - float playerY = Main.player[Main.npc[hiveMind].target].Center.Y - projDirection.Y; - float playerDist = (float)Math.Sqrt(playerX * playerX + playerY * playerY); - playerDist = projSpeed / playerDist; - playerX *= playerDist; - playerY *= playerDist; - int type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge && Main.rand.NextBool(5)) ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - int damage = type == ProjectileID.CursedFlameHostile ? 30 : NPC.GetProjectileDamage(type); - Vector2 projectileVelocity = new Vector2(playerX, playerY); - if (type == ProjectileID.CursedFlameHostile) - { - Vector2 v = Main.player[Main.npc[hiveMind].target].Center - NPC.Center - Main.player[Main.npc[hiveMind].target].velocity * 20f; - projectileVelocity = v.SafeNormalize(Vector2.UnitY) * projSpeed; - } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projDirection, projectileVelocity, type, damage, 0f, Main.myPlayer); - NPC.netUpdate = true; - } - } - } - } - - public override bool CanHitNPC(NPC target) => NPC.alpha == 0; // Can only be hit while fully visible - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture = TextureAssets.Npc[Type].Value; - Vector2 vector = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / 2); - - Vector2 vector2 = NPC.Center - screenPos; - vector2 -= new Vector2(texture.Width, texture.Height) * NPC.scale / 2f; - vector2 += vector * NPC.scale + new Vector2(0f, NPC.gfxOffY); - Color color = NPC.GetAlpha(drawColor); - - if (NPC.localAI[1] > ShowTelegraphValue) - color = Color.Lerp(color, Color.LimeGreen * NPC.Opacity, MathHelper.Clamp((NPC.localAI[1] - ShowTelegraphValue) / TelegraphDuration, 0f, 1f)); - - spriteBatch.Draw(texture, vector2, NPC.frame, color, NPC.rotation, vector, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void OnKill() - { - int closestPlayer = Player.FindClosest(NPC.Center, 1, 1); - if (Main.rand.NextBool(4) && Main.player[closestPlayer].statLife < Main.player[closestPlayer].statLifeMax2) - Item.NewItem(NPC.GetSource_Loot(), (int)NPC.position.X, (int)NPC.position.Y, NPC.width, NPC.height, ItemID.Heart); - } - - public override bool CheckActive() => false; - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - - if (NPC.life <= 0) - { - for (int k = 0; k < 10; k++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); - - if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) - { - // Spawn even more blobs on death - for (int i = 1; i < 3; i++) - { - Vector2 spawnAt = NPC.Center + new Vector2(0f, NPC.height / 2f); - NPC.NewNPC(NPC.GetSource_FromThis(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); - } - } - } - } - } -} diff --git a/NPCs/HiveMind/HiveMind.cs b/NPCs/HiveMind/HiveMind.cs index 8e18fc78ad..accf78c801 100644 --- a/NPCs/HiveMind/HiveMind.cs +++ b/NPCs/HiveMind/HiveMind.cs @@ -54,8 +54,7 @@ namespace CalamityMod.NPCs.HiveMind } // This block of values can be modified in SetDefaults() based on difficulty mode or something - private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private int burrowTimer = 420; + private int burrowTimer = 120; private int minimumDriftTime = 300; private int teleportRadius = 300; private int decelerationTime = 30; @@ -74,7 +73,6 @@ namespace CalamityMod.NPCs.HiveMind private int rainDashAmount = 1; private int rainDashesPerformed = 0; private bool performingRainDashCombo = false; - private int vileSpitFireRate = 24; // Fire rate for Expert-exclusive Vile Spits during phase 1 teleports private int phase2timer = 360; private int rotationDirection; private double rotation; @@ -136,11 +134,13 @@ namespace CalamityMod.NPCs.HiveMind } } + public static int ShaderainDamage = 12; // 48 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 40; // 64 (1.6x expert scaling) NPC.npcSlots = 5f; - NPC.GetNPCDamage(); // this is the only allowed case for using constant directly // as it doesn't have proper frame info yet @@ -148,20 +148,18 @@ namespace CalamityMod.NPCs.HiveMind NPC.height = frameHeight_P1; NPC.defense = 8; - NPC.LifeMaxNERB(7700, 9200, 350000); + NPC.LifeMaxNERB(6150, 7350, 350000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 8, 0, 0); + NPC.value = Item.buyPrice(gold: 5); NPC.boss = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (expertMode) { @@ -177,7 +175,6 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 28; driftSpeed = 2f; driftBoost = 2f; - vileSpitFireRate = 18; } if (death) @@ -190,29 +187,6 @@ namespace CalamityMod.NPCs.HiveMind lungeTime = 23; driftSpeed = 3.5f; driftBoost = 1.5f; - vileSpitFireRate = 15; - } - - if (bossRush) - { - lungeRots = 0.4; - minimumDriftTime = 40; - reelbackFade = 10; - lungeTime = 16; - driftSpeed = 6f; - driftBoost = 1f; - vileSpitFireRate = 12; - } - - if (masterMode) - { - lungeRots += 0.1; - minimumDriftTime /= 2; - reelbackFade *= 2; - lungeTime -= 5; - driftSpeed += ((death && !bossRush) ? 0.5f : 1f); - driftBoost += ((death && !bossRush) ? 0.5f : 1f); - vileSpitFireRate -= 6; } if (Main.getGoodWorld) @@ -226,9 +200,6 @@ namespace CalamityMod.NPCs.HiveMind NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -248,7 +219,6 @@ namespace CalamityMod.NPCs.HiveMind public override void SendExtraAI(BinaryWriter writer) { - writer.Write(biomeEnrageTimer); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.noTileCollide); writer.Write(NPC.noGravity); @@ -272,7 +242,6 @@ namespace CalamityMod.NPCs.HiveMind public override void ReceiveExtraAI(BinaryReader reader) { - biomeEnrageTimer = reader.ReadInt32(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.noTileCollide = reader.ReadBoolean(); NPC.noGravity = reader.ReadBoolean(); @@ -368,17 +337,15 @@ namespace CalamityMod.NPCs.HiveMind private void SpawnStuff() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; int maxSpawns = death ? Main.rand.Next(3, 5) : revenge ? 3 : expertMode ? Main.rand.Next(2, 4) : 2; for (int i = 0; i < maxSpawns; i++) { - int type = 0; - int choice = masterMode ? 1 : -1; + int type; + int choice = -1; do { choice++; @@ -418,8 +385,7 @@ namespace CalamityMod.NPCs.HiveMind private void ReelBack() { - bool bossRush = BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || bossRush; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; NPC.alpha = 0; phase2timer = 0; @@ -457,38 +423,13 @@ namespace CalamityMod.NPCs.HiveMind Player player = Main.player[NPC.target]; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Enrage - if ((!player.ZoneCorrupt || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!player.ZoneCorrupt || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - // Phase 2 settings if (IsPhaseTwo) { @@ -544,11 +485,11 @@ namespace CalamityMod.NPCs.HiveMind CalamityGlobalNPC.hiveMind = NPC.whoAmI; - if (!player.active || player.dead) + if (!player.active || player.dead || !(player.ZoneCorrupt || BossRushEvent.BossRushActive)) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead) + if (!player.active || player.dead || !(player.ZoneCorrupt || BossRushEvent.BossRushActive)) { if (NPC.timeLeft > 60) NPC.timeLeft = 60; @@ -594,7 +535,7 @@ namespace CalamityMod.NPCs.HiveMind maxBlobs = 50; for (int i = 0; i < maxBlobs; i++) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(), NPC.whoAmI); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType(), NPC.whoAmI, ai2: Main.rand.Next(2)); } } @@ -631,15 +572,15 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { - int maxSpawns = bossRush ? 16 : death ? 8 : revenge ? 6 : expertMode ? Main.rand.Next(4, 6) : Main.rand.Next(3, 5); - int maxDankSpawns = bossRush ? 4 : death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; + int maxSpawns = death ? 5 : revenge ? 4 : expertMode ? Main.rand.Next(3, 5) : Main.rand.Next(2, 4); + int maxDankSpawns = death ? Main.rand.Next(2, 4) : revenge ? 2 : expertMode ? Main.rand.Next(1, 3) : 1; for (int i = 0; i < maxSpawns; i++) { int x = (int)(NPC.position.X + Main.rand.Next(NPC.width - 32)); int y = (int)(NPC.position.Y + Main.rand.Next(NPC.height - 32)); - int type = Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType(); + int type = ModContent.NPCType(); if (NPC.CountNPCS(ModContent.NPCType()) < maxDankSpawns) type = ModContent.NPCType(); @@ -657,7 +598,7 @@ namespace CalamityMod.NPCs.HiveMind burrowTimer--; if (burrowTimer < -120) { - burrowTimer = (death ? 180 : revenge ? 300 : expertMode ? 360 : 420) - (int)enrageScale * 55; + burrowTimer = death ? 180 : revenge ? 300 : expertMode ? 360 : 420; if (burrowTimer < 30) burrowTimer = 30; @@ -688,15 +629,6 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } - - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } } else if (burrowTimer == -60) { @@ -717,7 +649,7 @@ namespace CalamityMod.NPCs.HiveMind for (int i = 0; i < Main.maxNPCs; i++) { NPC hiveBlob = Main.npc[i]; - if (hiveBlob.active && (hiveBlob.type == ModContent.NPCType() || hiveBlob.type == ModContent.NPCType())) + if (hiveBlob.active && hiveBlob.type == ModContent.NPCType()) { hiveBlob.position.X = NPC.position.X; hiveBlob.position.Y = NPC.position.Y; @@ -749,15 +681,6 @@ namespace CalamityMod.NPCs.HiveMind burrowedDust2 = Dust.NewDust(new Vector2(NPC.position.X, NPC.Center.Y), NPC.width, NPC.height / 2, DustID.Demonite, 0f, -3f, 100, default, 2.5f * NPC.scale); Main.dust[burrowedDust2].velocity *= 1f; } - - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && burrowTimer % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } } else if (burrowTimer == 0) { @@ -779,8 +702,8 @@ namespace CalamityMod.NPCs.HiveMind { case 0: // Slowdrift - // Avoid cheap bullshit - NPC.damage = 0; + // Set damage + NPC.damage = NPC.defDamage; if (NPC.alpha > 0) { @@ -845,11 +768,11 @@ namespace CalamityMod.NPCs.HiveMind NPC.ForceNetUpdate(); } - if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f) + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f || !(player.ZoneCorrupt || BossRushEvent.BossRushActive)) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f) + if (!player.active || player.dead || Vector2.Distance(NPC.Center, player.Center) > 8000f || !(player.ZoneCorrupt || BossRushEvent.BossRushActive)) { if (NPC.timeLeft > 60) NPC.timeLeft = 60; @@ -872,21 +795,11 @@ namespace CalamityMod.NPCs.HiveMind return; } - if (expertMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % (vileSpitFireRate * 2) == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 69f); - } - } - NPC.velocity = player.Center - NPC.Center; phase2timer--; - if (masterMode) + if (death) { // Use an attack sooner if being hit if (NPC.justHit) @@ -899,7 +812,7 @@ namespace CalamityMod.NPCs.HiveMind if (phase2timer <= -180) // No stalling drift mode forever { - NPC.velocity *= 2f / 255f * (reelbackFade + 2 * (int)enrageScale); + NPC.velocity *= 2f / 255f * reelbackFade; ReelBack(); NPC.ForceNetUpdate(); } @@ -907,9 +820,9 @@ namespace CalamityMod.NPCs.HiveMind { NPC.velocity.Normalize(); if (expertMode) // Variable velocity in expert and up - NPC.velocity *= driftSpeed + enrageScale + driftBoost * lifeRatio; + NPC.velocity *= driftSpeed + driftBoost * lifeRatio; else - NPC.velocity *= driftSpeed + enrageScale; + NPC.velocity *= driftSpeed; } break; @@ -919,7 +832,7 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; - NPC.alpha += reelbackFade + 2 * (int)enrageScale; + NPC.alpha += reelbackFade; NPC.velocity -= deceleration; if (NPC.alpha >= 255) @@ -934,7 +847,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y = NPC.ai[2] * 16 - NPC.height / 2; } - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); NPC.ForceNetUpdate(); } else if (NPC.ai[1] == 0f && NPC.ai[2] == 0f) @@ -960,7 +873,7 @@ namespace CalamityMod.NPCs.HiveMind // Avoid cheap bullshit NPC.damage = 0; - NPC.alpha += reelbackFade + 2 * (int)enrageScale; + NPC.alpha += reelbackFade; NPC.velocity -= deceleration; if (NPC.alpha >= 255) @@ -999,18 +912,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.ForceNetUpdate(); if (NPC.alpha > 0) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - - if (masterMode) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); - } - } - + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection; phase2timer = lungesPerformed > 0 ? (lungeDelay / (lungesPerformed + 1)) : lungeDelay; @@ -1028,28 +930,17 @@ namespace CalamityMod.NPCs.HiveMind // Set damage NPC.damage = NPC.defDamage; - phase2timer = lungeTime - 4 * (int)enrageScale; - NPC.velocity = player.Center + (bossRush ? player.velocity * 20f : Vector2.Zero) - NPC.Center; + phase2timer = lungeTime; + NPC.velocity = player.Center - NPC.Center; NPC.velocity.Normalize(); - NPC.velocity *= teleportRadius / (lungeTime - (int)enrageScale); + NPC.velocity *= teleportRadius / lungeTime; dashStarted = true; SoundEngine.PlaySound(RoarSound, NPC.Center); NPC.netUpdate = true; } else { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); - - if (masterMode) - { - NPC.localAI[2] += 1f; - if (Collision.CanHitLine(NPC.Center, 1, 1, player.Center, 1, 1) && NPC.Distance(player.Center) > 160f && NPC.localAI[2] % vileSpitFireRate == 0) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 70f); - } - } - + NPC.Center = player.Center + new Vector2(teleportRadius, 0).RotatedBy(rotation); rotation += rotationIncrement * rotationDirection * phase2timer / lungeDelay; } } @@ -1086,7 +977,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.Y += teleportRadius; } - NPC.alpha -= masterMode ? 10 : 5; + NPC.alpha -= 5; if (NPC.alpha < 0) NPC.alpha = 0; @@ -1148,7 +1039,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.position.X += (death ? (teleportRadius * 1.5f) : teleportRadius) * (rainDashesPerformed == 0 ? rotationDirection : -rotationDirection); } - NPC.alpha -= masterMode ? 10 : 5; + NPC.alpha -= 5; if (NPC.alpha < 0) NPC.alpha = 0; @@ -1180,10 +1071,9 @@ namespace CalamityMod.NPCs.HiveMind if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 cloudSpawnPos = new Vector2(NPC.position.X + Main.rand.Next(NPC.width), NPC.position.Y + Main.rand.Next(NPC.height)); - Vector2 randomVelocity = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? Main.rand.NextVector2CircularEdge(4f, 4f) : Vector2.Zero; - Projectile.NewProjectile(NPC.GetSource_FromAI(), cloudSpawnPos, randomVelocity, type, damage, 0, Main.myPlayer, 11f); + Vector2 randomVelocity = Main.getGoodWorld ? Main.rand.NextVector2CircularEdge(4f, 4f) : Vector2.Zero; + Projectile.NewProjectile(NPC.GetSource_FromAI(), cloudSpawnPos, randomVelocity, type, ShaderainDamage, 0, Main.myPlayer, 11f); } if (NPC.ai[0] == 10f) @@ -1217,7 +1107,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); performingRainDashCombo = false; rainDashesPerformed = 0; state = 0; @@ -1232,7 +1122,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); performingLungeCombo = false; lungesPerformed = 0; state = 0; @@ -1240,7 +1130,7 @@ namespace CalamityMod.NPCs.HiveMind } else { - phase2timer = minimumDriftTime + Main.rand.Next(masterMode ? 61 : 121); + phase2timer = minimumDriftTime + Main.rand.Next(death ? 61 : 121); state = 0; } @@ -1327,7 +1217,7 @@ namespace CalamityMod.NPCs.HiveMind if (hurtInfo.Damage < 0) return; - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 240); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) => NPC.scale == 1f; // Only draw HP bar while at full size @@ -1345,7 +1235,7 @@ namespace CalamityMod.NPCs.HiveMind public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * 0.8f); } public override void HitEffect(NPC.HitInfo hit) @@ -1357,13 +1247,6 @@ namespace CalamityMod.NPCs.HiveMind { if (Main.netMode != NetmodeID.MultiplayerClient) { - if (Main.rand.NextBool(15)) - { - int hiveBlobCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); - if (hiveBlobCount < 3) - NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, Main.rand.NextBool() ? ModContent.NPCType() : ModContent.NPCType()); - } - if (Main.rand.NextBool(30)) { if (NPC.CountNPCS(NPCID.EaterofSouls) < 2) @@ -1414,7 +1297,7 @@ namespace CalamityMod.NPCs.HiveMind } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.HealingPotion; } @@ -1463,7 +1346,6 @@ namespace CalamityMod.NPCs.HiveMind normalOnly.Add(ItemID.DemoniteBar, 1, 10, 15); normalOnly.Add(ItemID.RottenChunk, 1, 10, 15); normalOnly.Add(ItemID.CorruptSeeds, 1, 10, 15); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.CursedFlame, 1, 10, 20)); // Equipment diff --git a/NPCs/HiveMind/HiveTumor.cs b/NPCs/HiveMind/HiveTumor.cs index 8a3269a23c..a092cd754e 100644 --- a/NPCs/HiveMind/HiveTumor.cs +++ b/NPCs/HiveMind/HiveTumor.cs @@ -25,7 +25,7 @@ namespace CalamityMod.NPCs.HiveMind NPC.width = 30; //324 NPC.height = 30; //216 NPC.defense = 0; - NPC.lifeMax = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : 1000; + NPC.lifeMax = Main.zenithWorld ? 10 : 1000; NPC.knockBackResist = 0f; NPC.chaseable = false; NPC.HitSound = SoundID.NPCHit1; @@ -80,7 +80,7 @@ namespace CalamityMod.NPCs.HiveMind type = ModContent.NPCType(); break; case 4: - type = ModContent.NPCType(); + type = ModContent.NPCType(); break; default: break; @@ -131,7 +131,7 @@ namespace CalamityMod.NPCs.HiveMind { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Demonite, hit.HitDirection, -1f, 0, default, 1f); } - if (Main.netMode != NetmodeID.MultiplayerClient && (!NPC.AnyNPCs(ModContent.NPCType()) || (CalamityWorld.LegendaryMode && CalamityWorld.revenge))) + if (Main.netMode != NetmodeID.MultiplayerClient && (!NPC.AnyNPCs(ModContent.NPCType()) || Main.zenithWorld)) { Vector2 spawnAt = NPC.Bottom; NPC.NewNPC(NPC.GetSource_Death(), (int)spawnAt.X, (int)spawnAt.Y, ModContent.NPCType()); diff --git a/NPCs/Leviathan/Anahita.cs b/NPCs/Leviathan/Anahita.cs index 04d468c868..5f6a77634e 100644 --- a/NPCs/Leviathan/Anahita.cs +++ b/NPCs/Leviathan/Anahita.cs @@ -29,7 +29,7 @@ namespace CalamityMod.NPCs.Leviathan private int frameUsed = 0; public bool HasBegunSummoningLeviathan = false; private int DrawProjectileTelegraphTimer = 0; - private int LegendaryModeAttackChosen = 0; + private int GetGoodAttackChosen = 0; public static Asset ChargeTexture; public bool WaitingForLeviathan { @@ -59,21 +59,26 @@ namespace CalamityMod.NPCs.Leviathan } } + public static float DashDamageMult = 1.5f; // 150 + public static int SpearDamage = 27; // 108 + public static int MistDamage = 24; // 96 + public static int SongDamage = 30; // 120 + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 50; // 100 NPC.npcSlots = 16f; NPC.width = 100; NPC.height = 100; NPC.defense = 20; - NPC.DR_NERD(0.2f); NPC.LifeMaxNERB(35000, 42000, 260000); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); - NPC.value = Item.buyPrice(0, 12, 50, 0); + NPC.value = Item.buyPrice(gold: 7, silver: 50); NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = HitSound; @@ -88,9 +93,6 @@ namespace CalamityMod.NPCs.Leviathan if (Main.zenithWorld) NPC.scale *= 4f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -141,9 +143,6 @@ namespace CalamityMod.NPCs.Leviathan if (HasBegunSummoningLeviathan && CalamityGlobalNPC.LeviAndAna == -1) CalamityGlobalNPC.LeviAndAna = NPC.whoAmI; - // Set to false so she doesn't do it constantly - NPC.Calamity().canBreakPlayerDefense = false; - // Light Lighting.AddLight((int)(NPC.Center.X / 16f), (int)(NPC.Center.Y / 16f), 0f, 0.5f, 0.3f); @@ -162,15 +161,13 @@ namespace CalamityMod.NPCs.Leviathan // Variables Player player = Main.player[NPC.target]; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Enrage - if (notOcean && !bossRush) + if (notOcean && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -178,12 +175,12 @@ namespace CalamityMod.NPCs.Leviathan else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; float enrageScale = 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 1.5f; } @@ -194,8 +191,6 @@ namespace CalamityMod.NPCs.Leviathan if (!leviAlive) bubbleVelocity += 2f * (1f - lifeRatio); if (Main.getGoodWorld) - bubbleVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) bubbleVelocity *= 2f; // Phases @@ -240,7 +235,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.rotation = NPC.rotation.AngleTowards(idealRotation, 0.08f); - if (bossRush || Collision.WetCollision(NPC.position, NPC.width, NPC.height) || NPC.position.Y > (Main.worldSurface - 125f) * 16f) + if (BossRushEvent.BossRushActive || Collision.WetCollision(NPC.position, NPC.width, NPC.height) || NPC.position.Y > (Main.worldSurface - 125f) * 16f) { int oldAlpha = NPC.alpha; NPC.alpha = Utils.Clamp(NPC.alpha + 9, 0, 255); @@ -316,6 +311,7 @@ namespace CalamityMod.NPCs.Leviathan NPC.dontTakeDamage = true; } + NPC.canDisplayBuffs = true; // Hover near the target, invisible if the Leviathan is present and not sufficiently injured. if ((phase3 || death) && WaitingForLeviathan && !Main.zenithWorld) { @@ -343,6 +339,7 @@ namespace CalamityMod.NPCs.Leviathan } NPC.dontTakeDamage = true; + NPC.canDisplayBuffs = false; if (NPC.ai[0] != -1f) { @@ -654,17 +651,17 @@ namespace CalamityMod.NPCs.Leviathan int totalTelegraphs = 8; float telegraphDist = 500f; - // In Legendary, the projectiles she fires is randomized - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + // In FTW, the projectiles she fires is randomized + if (Main.getGoodWorld) { - LegendaryModeAttackChosen = Main.rand.Next(3); - if (LegendaryModeAttackChosen == 2) + GetGoodAttackChosen = Main.rand.Next(3); + if (GetGoodAttackChosen == 2) telegraphDist -= 50f; for (int i = 0; i < totalTelegraphs; i++) { Vector2 spawnVector = player.Center - Vector2.UnitY.RotatedBy(MathHelper.TwoPi / totalTelegraphs * i) * telegraphDist; - int tele = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, player.whoAmI, LegendaryModeAttackChosen); + int tele = Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnVector, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, player.whoAmI, GetGoodAttackChosen); Main.projectile[tele].netUpdate = true; } @@ -709,13 +706,13 @@ namespace CalamityMod.NPCs.Leviathan int totalProjectiles = 8; int projectileDistance = 600; int type = ModContent.ProjectileType(); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + int damage = SpearDamage; + if (Main.getGoodWorld) { float radians = MathHelper.TwoPi / totalProjectiles; - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < totalProjectiles; i++) { - switch (LegendaryModeAttackChosen) + switch (GetGoodAttackChosen) { case 0: SoundEngine.PlaySound(SoundID.Item21, player.Center); @@ -723,11 +720,13 @@ namespace CalamityMod.NPCs.Leviathan case 1: type = ModContent.ProjectileType(); + damage = MistDamage; SoundEngine.PlaySound(SoundID.Item30, player.Center); break; case 2: type = ModContent.ProjectileType(); + damage = SongDamage; float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.musicPitch = soundPitch; SoundEngine.PlaySound(SoundID.Item26, player.Center); @@ -751,12 +750,14 @@ namespace CalamityMod.NPCs.Leviathan case 1: totalProjectiles = 3; type = ModContent.ProjectileType(); + damage = MistDamage; SoundEngine.PlaySound(SoundID.Item30, player.Center); break; case 2: totalProjectiles = 6; type = ModContent.ProjectileType(); + damage = SongDamage; float soundPitch = (Main.rand.NextFloat() - 0.5f) * 0.5f; Main.musicPitch = soundPitch; SoundEngine.PlaySound(SoundID.Item26, player.Center); @@ -770,7 +771,6 @@ namespace CalamityMod.NPCs.Leviathan totalProjectiles += totalProjectiles / 2; float radians = MathHelper.TwoPi / totalProjectiles; - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < totalProjectiles; i++) { Vector2 spawnVector = player.Center + Vector2.Normalize(new Vector2(0f, -projectileVelocity).RotatedBy(radians * i)) * projectileDistance; @@ -827,9 +827,11 @@ namespace CalamityMod.NPCs.Leviathan if (revenge) chargeVelocity += 2f + (death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio)); - if (Main.getGoodWorld) chargeVelocity *= 1.15f; + // Stunt velocity at the end of the charge attack to prevent her flying off + if (NPC.ai[0] == -1f) + chargeVelocity *= 0.3f; NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * chargeVelocity; NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); @@ -851,10 +853,9 @@ namespace CalamityMod.NPCs.Leviathan // Charge else if (NPC.ai[0] == 4f) { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); + NPC.damage = (int)Math.Round(NPC.defDamage * DashDamageMult); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && NPC.ai[1] % 5f == 0f) + if (Main.zenithWorld && NPC.ai[1] % 5f == 0f) { SoundEngine.PlaySound(SoundID.Item85, NPC.Center); Vector2 bubbleSpawnPos = new Vector2(NPC.position.X + (NPC.width / 2) + (15 * NPC.direction * NPC.scale), NPC.position.Y + 30 * NPC.scale); @@ -981,7 +982,7 @@ namespace CalamityMod.NPCs.Leviathan if (DrawProjectileTelegraphTimer > 0) { Color telegraphColor = Color.Black; - switch (CalamityWorld.LegendaryMode && CalamityWorld.revenge ? LegendaryModeAttackChosen : (int)NPC.localAI[3]) + switch (Main.getGoodWorld ? GetGoodAttackChosen : (int)NPC.localAI[3]) { case 0: telegraphColor = new Color(55, 70, 240); @@ -1022,7 +1023,7 @@ namespace CalamityMod.NPCs.Leviathan //200x636 } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } @@ -1049,7 +1050,6 @@ namespace CalamityMod.NPCs.Leviathan public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/AnahitasIceShield.cs b/NPCs/Leviathan/AnahitasIceShield.cs index cd2355115a..2341a2fbde 100644 --- a/NPCs/Leviathan/AnahitasIceShield.cs +++ b/NPCs/Leviathan/AnahitasIceShield.cs @@ -29,16 +29,16 @@ namespace CalamityMod.NPCs.Leviathan public override void SetDefaults() { + NPC.damage = 50; // 100 NPC.aiStyle = -1; AIType = -1; NPC.noTileCollide = true; NPC.coldDamage = true; - NPC.GetNPCDamage(); NPC.width = 100; NPC.height = 100; NPC.defense = 10; - NPC.DR_NERD(0.5f); - NPC.lifeMax = BossRushEvent.BossRushActive ? 1000 : 650; + NPC.DR_NERD(0.25f); + NPC.lifeMax = BossRushEvent.BossRushActive ? 2000 : 750; NPC.alpha = 255; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; diff --git a/NPCs/Leviathan/AquaticAberration.cs b/NPCs/Leviathan/AquaticAberration.cs index 59dded4f7f..e809b6b408 100644 --- a/NPCs/Leviathan/AquaticAberration.cs +++ b/NPCs/Leviathan/AquaticAberration.cs @@ -37,9 +37,8 @@ namespace CalamityMod.NPCs.Leviathan public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 50; // 100 NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 50; NPC.height = 50; NPC.defense = 14; @@ -57,10 +56,6 @@ namespace CalamityMod.NPCs.Leviathan if (Main.getGoodWorld) NPC.scale *= 1.3f; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -97,10 +92,9 @@ namespace CalamityMod.NPCs.Leviathan // Avoid cheap bullshit NPC.damage = 0; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; NPC.TargetClosest(false); @@ -129,13 +123,13 @@ namespace CalamityMod.NPCs.Leviathan sirenAlive = false; } - float inertia = bossRush ? 24f : death ? 26f : revenge ? 27f : expertMode ? 28f : 30f; + float inertia = death ? 26f : revenge ? 27f : expertMode ? 28f : 30f; if (!sirenAlive || leviathanInPhase4) inertia *= 0.75f; if (NPC.ai[0] == 0f) { - float lungeSpeed = bossRush ? 14f : death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; + float lungeSpeed = death ? 12f : revenge ? 11f : expertMode ? 10f : 8f; if (!sirenAlive || leviathanInPhase4) lungeSpeed *= 1.25f; @@ -300,7 +294,5 @@ namespace CalamityMod.NPCs.Leviathan } } } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ItemDropRule.NormalvsExpert(ItemID.AdhesiveBandage, 100, 50)); } } diff --git a/NPCs/Leviathan/Leviathan.cs b/NPCs/Leviathan/Leviathan.cs index 6bc4f523b7..fc7a3933a7 100644 --- a/NPCs/Leviathan/Leviathan.cs +++ b/NPCs/Leviathan/Leviathan.cs @@ -57,21 +57,23 @@ namespace CalamityMod.NPCs.Leviathan AttackTexture = ModContent.Request("CalamityMod/NPCs/Leviathan/LeviathanAttack", AssetRequestMode.AsyncLoad); } + public static int BoulderDamage = 40; // 160 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 20f; - NPC.GetNPCDamage(); + NPC.damage = 100; // 200 NPC.width = 900; NPC.height = 450; NPC.defense = 40; - NPC.DR_NERD(0.3f); - NPC.LifeMaxNERB(60000, 72000, 600000); + NPC.DR_NERD(0.1f); + NPC.LifeMaxNERB(57000, 68400, 600000); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; NPC.Opacity = 0f; - NPC.value = Item.buyPrice(0, 12, 50, 0); + NPC.value = Item.buyPrice(gold: 7, silver: 50); NPC.HitSound = SoundID.NPCHit56; NPC.DeathSound = SoundID.NPCDeath60; NPC.noTileCollide = true; @@ -89,9 +91,6 @@ namespace CalamityMod.NPCs.Leviathan if (Main.zenithWorld) NPC.scale *= 0.3f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -131,10 +130,9 @@ namespace CalamityMod.NPCs.Leviathan if (CalamityGlobalNPC.LeviAndAna == -1) CalamityGlobalNPC.LeviAndAna = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; Vector2 npcCenter = NPC.Center; // Is in spawning animation @@ -201,7 +199,7 @@ namespace CalamityMod.NPCs.Leviathan bool notOcean = player.position.Y < 800f || player.position.Y > Main.worldSurface * 16D || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400)); // Enrage - if (notOcean && !bossRush) + if (notOcean && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -209,12 +207,12 @@ namespace CalamityMod.NPCs.Leviathan else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; - float enrageScale = bossRush ? 1f : 0f; + float enrageScale = 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 2f; } @@ -224,12 +222,10 @@ namespace CalamityMod.NPCs.Leviathan bool immuneToSlowingDebuffs = NPC.ai[0] == 2f; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Despawn @@ -395,7 +391,6 @@ namespace CalamityMod.NPCs.Leviathan { float speed = (sirenAlive && !phase4 && !death) ? 13.5f : 16f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (expertMode) speed = (sirenAlive && !phase4 && !death) ? 14f : 17f; @@ -414,12 +409,11 @@ namespace CalamityMod.NPCs.Leviathan if (Main.zenithWorld) { - type = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? ProjectileID.BouncyBoulder : ProjectileID.Boulder; + type = Main.rand.NextBool() ? ProjectileID.BouncyBoulder : ProjectileID.Boulder; leviCenter.Y -= 5; //Shoot a bit more up since boulders are affected by gravity - damage *= 2; } - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), leviCenter.X, leviCenter.Y, xDestination, yDestination, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), leviCenter.X, leviCenter.Y, xDestination, yDestination, type, BoulderDamage, 0f, Main.myPlayer); if (Main.zenithWorld) Main.projectile[proj].scale *= 5f; @@ -444,16 +438,8 @@ namespace CalamityMod.NPCs.Leviathan float playerDistance = (float)Math.Sqrt(playerXDist * playerXDist + playerYDist * playerYDist); NPC.ai[1] += 1f; - int activePlayerAmt = 0; - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active && !Main.player[i].dead && (npcCenter - Main.player[i].Center).Length() < 1000f) - activePlayerAmt++; - } - NPC.ai[1] += activePlayerAmt / 2; - bool spawnedAberration = false; - float aberrationSpawnDelay = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 20f : (!sirenAlive || phase4) ? 60f : 40f; + float aberrationSpawnDelay = Main.zenithWorld ? 20f : (!sirenAlive || phase4) ? 60f : 50f; if (NPC.ai[1] > aberrationSpawnDelay) { NPC.ai[1] = 0f; @@ -461,8 +447,8 @@ namespace CalamityMod.NPCs.Leviathan spawnedAberration = true; } - int spawnLimit = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10 : (sirenAlive && !phase4) ? 1 : (death ? 2 : 3); - if (spawnedAberration && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit) + int spawnLimit = Main.zenithWorld ? 20 : Main.getGoodWorld ? 6 : (sirenAlive && !phase4) ? 0 : 2; + if (spawnedAberration && NPC.CountNPCS(ModContent.NPCType()) < spawnLimit && NPC.ai[2] <= spawnLimit) { SoundEngine.PlaySound(soundChoice with { Pitch = soundChoice.Pitch + extrapitch }, npcCenter); if (Main.netMode != NetmodeID.MultiplayerClient) @@ -811,7 +797,7 @@ namespace CalamityMod.NPCs.Leviathan } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } @@ -985,7 +971,6 @@ namespace CalamityMod.NPCs.Leviathan public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/Leviathan/LeviathanStart.cs b/NPCs/Leviathan/LeviathanStart.cs index 19205bd748..7aeb82cfcf 100644 --- a/NPCs/Leviathan/LeviathanStart.cs +++ b/NPCs/Leviathan/LeviathanStart.cs @@ -1,6 +1,7 @@ using System.IO; using CalamityMod.CalPlayer; using CalamityMod.Items.Accessories; +using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; diff --git a/NPCs/NormalNPCs/AeroSlime.cs b/NPCs/NormalNPCs/AeroSlime.cs index a72b4648a6..9ab7fe5394 100644 --- a/NPCs/NormalNPCs/AeroSlime.cs +++ b/NPCs/NormalNPCs/AeroSlime.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 75; NPC.knockBackResist = 0.8f; AnimationType = NPCID.Slimer; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -41,10 +41,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ArmoredDiggerBody.cs b/NPCs/NormalNPCs/ArmoredDiggerBody.cs index a4ea0b9aeb..a4a5b58ce7 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerBody.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerBody.cs @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 38; NPC.height = 38; NPC.defense = 20; - NPC.DR_NERD(0.2f); NPC.lifeMax = 20000; NPC.knockBackResist = 0f; NPC.aiStyle = -1; @@ -41,10 +40,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -157,21 +152,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.position.X = NPC.position.X + targetXDist; NPC.position.Y = NPC.position.Y + targetYDist; } - - // Calculate contact damage based on velocity - float maxChaseSpeed = CalamityWorld.death ? 13.5f : 10f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/ArmoredDiggerHead.cs b/NPCs/NormalNPCs/ArmoredDiggerHead.cs index 5f230ad2bb..5b812c76be 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerHead.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerHead.cs @@ -40,12 +40,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 54; NPC.height = 54; NPC.defense = 10; - NPC.DR_NERD(0.1f); NPC.lifeMax = 20000; NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 5, 0, 0); + NPC.value = Item.buyPrice(gold: 5); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -56,10 +55,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -394,19 +389,6 @@ namespace CalamityMod.NPCs.NormalNPCs } } - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + 1.57f; if (flying) @@ -439,14 +421,14 @@ namespace CalamityMod.NPCs.NormalNPCs { if (!CalamityPlayer.areThereAnyDamnBosses && NPC.downedPlantBoss && !NPC.AnyNPCs(ModContent.NPCType())) { - float spawnRateDivisor = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 125f : CalamityWorld.revenge ? 425f : 500f; + float spawnRateDivisor = CalamityWorld.revenge ? 425f : 500f; return 1 / spawnRateDivisor; } } return 0f; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } diff --git a/NPCs/NormalNPCs/ArmoredDiggerTail.cs b/NPCs/NormalNPCs/ArmoredDiggerTail.cs index 8aa015ef78..39359d581f 100644 --- a/NPCs/NormalNPCs/ArmoredDiggerTail.cs +++ b/NPCs/NormalNPCs/ArmoredDiggerTail.cs @@ -24,7 +24,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 34; NPC.height = 34; NPC.defense = 30; - NPC.DR_NERD(0.3f); NPC.lifeMax = 20000; NPC.knockBackResist = 0f; NPC.aiStyle = -1; @@ -40,10 +39,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -107,21 +102,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.position.X = NPC.position.X + targetXDist; NPC.position.Y = NPC.position.Y + targetYDist; } - - // Calculate contact damage based on velocity - float maxChaseSpeed = CalamityWorld.death ? 13.5f : 10f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool CheckActive() diff --git a/NPCs/NormalNPCs/AuroraSpirit.cs b/NPCs/NormalNPCs/AuroraSpirit.cs index adff77a47e..95e4beec0b 100644 --- a/NPCs/NormalNPCs/AuroraSpirit.cs +++ b/NPCs/NormalNPCs/AuroraSpirit.cs @@ -32,8 +32,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 24; NPC.defense = 8; NPC.alpha = 100; - NPC.lifeMax = 65; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.lifeMax = 200; + NPC.value = Item.buyPrice(silver: 1); NPC.knockBackResist = 0f; NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath15; @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/BloodlettingServant.cs b/NPCs/NormalNPCs/BloodlettingServant.cs deleted file mode 100644 index d2b172c462..0000000000 --- a/NPCs/NormalNPCs/BloodlettingServant.cs +++ /dev/null @@ -1,326 +0,0 @@ -using System; -using CalamityMod.Events; -using CalamityMod.Gores; -using CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class BloodlettingServant : ModNPC - { - private const float ChargeGateValue = 180f; - private const float ChargeTelegraphGateValue = 90f; - private const float ChargeDuration = 60f; - private const float ChargeDuration_Death = 50f; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); - } - - public override void SetDefaults() - { - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.width = 44; - NPC.height = 30; - if (Main.tenthAnniversaryWorld) - NPC.scale *= 0.5f; - if (Main.getGoodWorld) - NPC.scale *= 1.1f; - - NPC.defense = 5; - NPC.lifeMax = 96; - NPC.knockBackResist = 0f; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToSickness = true; - } - - public override void AI() - { - Lighting.AddLight(NPC.Center, 0.3f, 0.3f, 0.3f); - - NPC.TargetClosest(); - Player target = Main.player[NPC.target]; - bool targetDead = target.dead; - - bool phase2 = NPC.life < NPC.lifeMax * 0.5; - float enrageScale = 1f + NPC.ai[2]; - - float enrageScaleMaxSpeedBonus = 2f * enrageScale; - float maxSpeedX = (phase2 ? (CalamityWorld.death ? 10f : 8f) : (CalamityWorld.death ? 8f : 6f)) + enrageScaleMaxSpeedBonus; - float maxSpeedY = (phase2 ? (CalamityWorld.death ? 8f : 6f) : (CalamityWorld.death ? 4f : 3f)) + enrageScaleMaxSpeedBonus; - float xAccel = maxSpeedX * 0.01f; - float xAccelBoost1 = maxSpeedX * 0.01f; - float xAccelBoost2 = maxSpeedX * 0.0075f; - float yAccel = maxSpeedY * 0.01f; - float yAccelBoost1 = maxSpeedY * 0.01f; - float yAccelBoost2 = maxSpeedY * 0.0075f; - - float chargeVelocity = 12f + enrageScaleMaxSpeedBonus * 2f; - bool attemptingToCharge = NPC.ai[0] >= ChargeGateValue; - bool farEnoughForCharge = NPC.Distance(target.Center) >= 320f; - bool closeEnoughForCharge = NPC.Distance(target.Center) < 480f; - bool charging = (attemptingToCharge && farEnoughForCharge && closeEnoughForCharge) || NPC.ai[1] > 0f; - - float projectileShootGateValue = CalamityWorld.death ? 180f : 270f; - if (Main.getGoodWorld) - projectileShootGateValue *= 0.5f; - - Vector2 lookAt = target.Center - NPC.Center; - float rateOfRotation = charging ? 0f : 0.1f; - float chargeDuration = CalamityWorld.death ? ChargeDuration_Death : ChargeDuration; - NPC.Calamity().canBreakPlayerDefense = charging; - if (charging) - { - if (NPC.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath9, NPC.Center); - NPC.velocity = lookAt.SafeNormalize(Vector2.UnitY) * chargeVelocity; - NPC.spriteDirection = lookAt.X < 0f ? -1 : 1; - NPC.rotation = NPC.velocity.ToRotation() + (lookAt.X < 0f ? MathHelper.Pi : 0f); - - NPC.ai[1] = 1f; - if (NPC.ai[3] > projectileShootGateValue * 0.5f) - NPC.ai[3] = projectileShootGateValue * 0.5f; - - NPC.ForceNetUpdate(); - } - - if (NPC.ai[1] < ChargeDuration + 1f) - { - NPC.ai[1] += 1f; - if (NPC.ai[1] > ChargeDuration + 1f - 10f) - NPC.velocity *= 0.8f; - - if (NPC.ai[1] >= ChargeDuration + 1f) - { - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ForceNetUpdate(); - } - } - } - else - { - if (lookAt.X > 0f) - { - NPC.spriteDirection = 1; - NPC.rotation = lookAt.ToRotation(); - } - if (lookAt.X < 0f) - { - NPC.spriteDirection = -1; - NPC.rotation = lookAt.ToRotation() + MathHelper.Pi; - } - } - - if (phase2) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 1.3); - - if (NPC.ai[0] < ChargeGateValue && !targetDead) - { - NPC.ai[0] += 1f; - if (NPC.ai[0] == ChargeGateValue) - NPC.ForceNetUpdate(); - } - } - else - NPC.damage = NPC.defDamage; - - if (targetDead) - { - NPC.velocity.Y -= 0.04f; - - if (NPC.timeLeft > 10) - NPC.timeLeft = 10; - } - else if (!attemptingToCharge) - { - DemonEyeAI.DemonEyeBatMovement(NPC, maxSpeedX, maxSpeedY, xAccel, xAccelBoost1, xAccelBoost2, yAccel, yAccelBoost1, yAccelBoost2); - - NPC.ai[3] += enrageScale; - bool shootProjectile = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(NPC.Center, target.Center) > 240f; - if (NPC.ai[3] >= projectileShootGateValue && shootProjectile) - { - NPC.ai[3] = 0f; - float projectileSpeed = CalamityWorld.death ? 16f : 12f; - Vector2 projectileVelocity = NPC.SafeDirectionTo(target.Center) * projectileSpeed; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int projType = ProjectileID.BloodShot; - int projDamage = NPC.GetProjectileDamage(projType); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 10f, projectileVelocity, projType, projDamage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 600; - } - - NPC.ForceNetUpdate(); - } - - float pushVelocity = 0.2f * enrageScale; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active) - { - if (i != NPC.whoAmI && Main.npc[i].type == NPC.type) - { - if (Vector2.Distance(NPC.Center, Main.npc[i].Center) < 48f * NPC.scale) - { - if (NPC.position.X < Main.npc[i].position.X) - NPC.velocity.X -= pushVelocity; - else - NPC.velocity.X += pushVelocity; - - if (NPC.position.Y < Main.npc[i].position.Y) - NPC.velocity.Y -= pushVelocity; - else - NPC.velocity.Y += pushVelocity; - } - } - } - } - } - else if (!charging) - { - Vector2 destination = target.Center + new Vector2(-280f * NPC.spriteDirection, -280f); - Vector2 desiredVelocity = NPC.SafeDirectionTo(destination, -Vector2.UnitY) * chargeVelocity; - NPC.SimpleFlyMovement(desiredVelocity, enrageScale); - } - - if (Main.rand.NextBool(20)) - { - Vector2 dustSpawnTopLeft = new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f); - Dust blood = Dust.NewDustDirect(dustSpawnTopLeft, NPC.width, NPC.height / 2, DustID.Blood, NPC.velocity.X, 2f, 0, new Color(128, 0, 0, 255 - NPC.alpha), 1f); - blood.velocity.X *= 0.5f; - blood.velocity.Y *= 0.1f; - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += 1D; - if (NPC.life < NPC.lifeMax * 0.5) - { - if (NPC.frame.Y < frameHeight * 3) - NPC.frame.Y = frameHeight * 3; - if (NPC.frameCounter >= 8D) - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 5) - NPC.frame.Y = frameHeight * 3; - } - } - else - { - if (NPC.frameCounter >= 8D) - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 2) - NPC.frame.Y = 0; - } - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (NPC.ai[0] >= ChargeTelegraphGateValue) - { - Texture2D npcTexture = TextureAssets.Npc[Type].Value; - Color originalColor = NPC.GetAlpha(drawColor); - Color newColor = new Color(192, 0, 0, 255 - NPC.alpha); - Vector2 drawPosition = NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY); - Vector2 origin = NPC.frame.Size() / 2; - - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - float telegraphScalar = MathHelper.Clamp((NPC.ai[0] - ChargeTelegraphGateValue) / ChargeTelegraphGateValue, 0f, 1f); - Color telegraphColor = Color.Lerp(originalColor, newColor, telegraphScalar); - - if (CalamityClientConfig.Instance.Afterimages && NPC.ai[1] > 0f) - { - int afterimageAmount = 10; - int afterImageIncrement = 2; - for (int j = 0; j < afterimageAmount; j += afterImageIncrement) - { - Color afterimageColor = telegraphColor; - afterimageColor = Color.Lerp(afterimageColor, originalColor, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (afterimageAmount - j) / 15f; - Vector2 afterimagePos = NPC.oldPos[j] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(npcTexture.Width, npcTexture.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - afterimagePos += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(npcTexture, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - } - } - - spriteBatch.Draw(npcTexture, drawPosition, NPC.frame, telegraphColor, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - - return false; - } - - return true; - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (Main.dedServ) - return; - - if (NPC.life > 0) - { - for (int i = 0; i < hit.Damage / (double)NPC.lifeMax * 100; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f); - - if (NPC.life < NPC.lifeMax * 0.5f && NPC.localAI[0] == 0f) - { - NPC.localAI[0] = 1f; - Gore.NewGore(NPC.GetSource_FromThis(), NPC.Center, NPC.velocity, Mod.Find("BloodlettingServant1").Type); - for (int i = 0; i < 50; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f); - Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f); - Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f); - Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha); - } - } - } - else - { - for (int i = 0; i < 100; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2f * hit.HitDirection, -2f); - Main.dust[dust].scale = Main.rand.NextFloat(1.6f, 2.4f); - Main.dust[dust].velocity *= Main.rand.NextFloat(1.6f, 2.4f); - Main.dust[dust].color = new Color(128, 0, 0, 255 - NPC.alpha); - } - for (int g = 2; g <= 4; g++) - { - Vector2 goreVel = NPC.velocity.RotatedByRandom(MathHelper.Pi); - Gore.NewGore(NPC.GetSource_Death(), NPC.Center, goreVel, Mod.Find("BloodlettingServant" + g).Type); - } - } - } - } -} diff --git a/NPCs/NormalNPCs/BloodlettingServant.png b/NPCs/NormalNPCs/BloodlettingServant.png deleted file mode 100644 index 5bb5258c6c..0000000000 Binary files a/NPCs/NormalNPCs/BloodlettingServant.png and /dev/null differ diff --git a/NPCs/NormalNPCs/BloomSlime.cs b/NPCs/NormalNPCs/BloomSlime.cs index bc4f8c9849..283baad070 100644 --- a/NPCs/NormalNPCs/BloomSlime.cs +++ b/NPCs/NormalNPCs/BloomSlime.cs @@ -23,11 +23,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 80; NPC.width = 40; NPC.height = 30; - NPC.defense = 25; - NPC.lifeMax = 1500; + NPC.defense = 40; + NPC.lifeMax = 2000; NPC.knockBackResist = 0.3f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.value = Item.buyPrice(silver: 25); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -38,10 +38,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Bohldohr.cs b/NPCs/NormalNPCs/Bohldohr.cs index a6a4b88510..a7c0f35756 100644 --- a/NPCs/NormalNPCs/Bohldohr.cs +++ b/NPCs/NormalNPCs/Bohldohr.cs @@ -1,7 +1,6 @@ using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.SummonItems; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.NPCs.Other; using CalamityMod.World; using Terraria; @@ -16,16 +15,15 @@ namespace CalamityMod.NPCs.NormalNPCs { public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; NPC.aiStyle = -1; AIType = -1; NPC.damage = 80; NPC.width = 40; NPC.height = 40; - NPC.defense = 18; - NPC.lifeMax = 375; + NPC.defense = 32; + NPC.lifeMax = 600; NPC.knockBackResist = 0.95f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit7; NPC.DeathSound = SoundID.NPCDeath35; NPC.behindTiles = true; @@ -33,10 +31,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/BucketZombie.cs b/NPCs/NormalNPCs/BucketZombie.cs index d0b4edf209..0da926be3c 100644 --- a/NPCs/NormalNPCs/BucketZombie.cs +++ b/NPCs/NormalNPCs/BucketZombie.cs @@ -25,20 +25,17 @@ namespace CalamityMod.NPCs.NormalNPCs AnimationType = NPCID.Zombie; NPC.aiStyle = NPCAIStyleID.Fighter; NPC.CloneDefaults(NPCID.Zombie); - NPC.lifeMax = 50; + NPC.lifeMax = 60; NPC.defense = 15; NPC.damage = 16; NPC.knockBackResist = 0.45f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.npcSlots = 1.15f; // Equal to the strongest variants + NPC.value = Item.buyPrice(silver: 1); Banner = NPCID.Zombie; BannerItem = ItemID.ZombieBanner; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool PreAI() diff --git a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs similarity index 65% rename from NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs rename to NPCs/NormalNPCs/CalamityRegularEnemyAI.cs index f0ec92c278..14ee15c69d 100644 --- a/NPCs/CalamityAIs/CalamityRegularEnemyAIs/CalamityRegularEnemyAI.cs +++ b/NPCs/NormalNPCs/CalamityRegularEnemyAI.cs @@ -1,25 +1,10 @@ using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.CalPlayer; using CalamityMod.Dusts; -using CalamityMod.Events; using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; using CalamityMod.NPCs.SulphurousSea; using CalamityMod.NPCs.SunkenSea; -using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Enemy; -using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -27,23 +12,23 @@ using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs +namespace CalamityMod.NPCs.NormalNPCs { public static class CalamityRegularEnemyAI { #region Gem Crawler AI public static void GemCrawlerAI(NPC npc, Mod mod, float speedDetect, float speedAdditive) { - int turnAroundDelay = 30; - bool unusedFlag = false; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction > 0) || (npc.velocity.X < 0f && npc.direction < 0))) + var turnAroundDelay = 30; + var unusedFlag = false; + var isRunning = false; + var shouldTurnAround = false; + if (npc.velocity.Y == 0f && (npc.velocity.X > 0f && npc.direction > 0 || npc.velocity.X < 0f && npc.direction < 0)) { isRunning = true; npc.ai[3] += 1f; } - if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay) | isRunning) + if ((npc.position.X == npc.oldPosition.X || npc.ai[3] >= turnAroundDelay) | isRunning) { npc.ai[3] += 1f; shouldTurnAround = true; @@ -52,7 +37,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] -= 1f; } - if (npc.ai[3] > (float)(turnAroundDelay * 10)) + if (npc.ai[3] > turnAroundDelay * 10) { npc.ai[3] = 0f; } @@ -60,19 +45,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] = 0f; } - if (npc.ai[3] == (float)turnAroundDelay) + if (npc.ai[3] == turnAroundDelay) { npc.netUpdate = true; } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (targetDist < 200f && !shouldTurnAround) { npc.ai[3] = 0f; } - if (npc.ai[3] < (float)turnAroundDelay) + if (npc.ai[3] < turnAroundDelay) { npc.TargetClosest(true); } @@ -101,9 +86,9 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.direction = 1; } } - float maxVelocity = speedDetect; //5 - float acceleration = speedAdditive; //0.05 - if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction > 0) || (npc.velocity.X >= 0f && npc.direction < 0))) + var maxVelocity = speedDetect; //5 + var acceleration = speedAdditive; //0.05 + if (!unusedFlag && (npc.velocity.Y == 0f || npc.wet || npc.velocity.X <= 0f && npc.direction > 0 || npc.velocity.X >= 0f && npc.direction < 0)) { if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) { @@ -131,7 +116,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y >= 0f) { - int faceDirection = 0; + var faceDirection = 0; if (npc.velocity.X < 0f) { faceDirection = -1; @@ -140,13 +125,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { faceDirection = 1; } - Vector2 position = npc.position; + var position = npc.position; position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); - if ((float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X && ((Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[(int)Main.tile[x, y].TileType] && !Main.tileSolidTop[(int)Main.tile[x, y].TileType]) || (Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile)) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 1].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 1].TileType] || (Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 4].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 4].TileType]))) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 2].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x, y - 3].TileType] || Main.tileSolidTop[(int)Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[x - faceDirection, y - 3].TileType])) + var x = (int)((position.X + npc.width / 2 + (npc.width / 2 + 1) * faceDirection) / 16f); + var y = (int)((position.Y + npc.height - 1f) / 16f); + if (x * 16 < position.X + npc.width && x * 16 + 16 > position.X && (Main.tile[x, y].HasUnactuatedTile && !Main.tile[x, y].TopSlope && !Main.tile[x, y - 1].TopSlope && Main.tileSolid[Main.tile[x, y].TileType] && !Main.tileSolidTop[Main.tile[x, y].TileType] || Main.tile[x, y - 1].IsHalfBlock && Main.tile[x, y - 1].HasUnactuatedTile) && (!Main.tile[x, y - 1].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 1].TileType] || Main.tileSolidTop[Main.tile[x, y - 1].TileType] || Main.tile[x, y - 1].IsHalfBlock && (!Main.tile[x, y - 4].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 4].TileType] || Main.tileSolidTop[Main.tile[x, y - 4].TileType])) && (!Main.tile[x, y - 2].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 2].TileType] || Main.tileSolidTop[Main.tile[x, y - 2].TileType]) && (!Main.tile[x, y - 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[x, y - 3].TileType] || Main.tileSolidTop[Main.tile[x, y - 3].TileType]) && (!Main.tile[x - faceDirection, y - 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[x - faceDirection, y - 3].TileType])) { - float npcBottom = (float)(y * 16); + var npcBottom = (float)(y * 16); if (Main.tile[x, y].IsHalfBlock) { npcBottom += 8f; @@ -155,13 +140,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npcBottom -= 8f; } - if (npcBottom < position.Y + (float)npc.height) + if (npcBottom < position.Y + npc.height) { - float percentageTileRisen = position.Y + (float)npc.height - npcBottom; + var percentageTileRisen = position.Y + npc.height - npcBottom; if (percentageTileRisen <= 16.1f) { - npc.gfxOffY += npc.position.Y + (float)npc.height - npcBottom; - npc.position.Y = npcBottom - (float)npc.height; + npc.gfxOffY += npc.position.Y + npc.height - npcBottom; + npc.position.Y = npcBottom - npc.height; if (percentageTileRisen < 9f) { npc.stepSpeed = 1f; @@ -181,11 +166,11 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs public static void DungeonSpiritAI(NPC npc, Mod mod, float speed, float rotation, bool lantern = false) { npc.TargetClosest(true); - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); - float homingSpeed = speed; + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var homingSpeed = speed; if (lantern) { @@ -212,7 +197,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs if (lantern) { npc.rotation = npc.velocity.X * 0.08f; - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.spriteDirection = npc.direction > 0 ? 1 : -1; } else npc.rotation = (float)Math.Atan2((double)yDist, (double)xDist) + rotation; @@ -222,23 +207,23 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs #region Unicorn AI public static void UnicornAI(NPC npc, Mod mod, bool spin, float bounciness, float speedDetect, float speedAdditive, float bouncy1 = -8.5f, float bouncy2 = -7.5f, float bouncy3 = -7f, float bouncy4 = -6f, float bouncy5 = -8f) { - bool DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - bool DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); - int turnAroundDelay = 30; - bool isRunning = false; - bool shouldTurnAround = false; - if (npc.velocity.Y == 0f && ((npc.velocity.X > 0f && npc.direction < 0) || (npc.velocity.X < 0f && npc.direction > 0))) + var DogPhase1 = npc.type == ModContent.NPCType() && npc.life > npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + var DogPhase2 = npc.type == ModContent.NPCType() && npc.life <= npc.lifeMax * (CalamityWorld.death ? 0.9 : CalamityWorld.revenge ? 0.7 : 0.5); + var turnAroundDelay = 30; + var isRunning = false; + var shouldTurnAround = false; + if (npc.velocity.Y == 0f && (npc.velocity.X > 0f && npc.direction < 0 || npc.velocity.X < 0f && npc.direction > 0)) { isRunning = true; npc.ai[3] += 1f; } - int turnAroundDelayMult = DogPhase1 ? 10 : 4; + var turnAroundDelayMult = DogPhase1 ? 10 : 4; if (!DogPhase1) { - bool noYVelocity = npc.velocity.Y == 0f; - for (int i = 0; i < Main.maxNPCs; i++) + var noYVelocity = npc.velocity.Y == 0f; + for (var i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < (float)npc.width) + if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type && Math.Abs(npc.position.X - Main.npc[i].position.X) + Math.Abs(npc.position.Y - Main.npc[i].position.Y) < npc.width) { if (npc.position.X < Main.npc[i].position.X) { @@ -263,7 +248,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.velocity.Y = 0f; } } - if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= (float)turnAroundDelay || isRunning) + if (npc.position.X == npc.oldPosition.X || npc.ai[3] >= turnAroundDelay || isRunning) { npc.ai[3] += 1f; shouldTurnAround = true; @@ -272,7 +257,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] -= 1f; } - if (npc.ai[3] > (float)(turnAroundDelay * turnAroundDelayMult)) + if (npc.ai[3] > turnAroundDelay * turnAroundDelayMult) { npc.ai[3] = 0f; } @@ -280,33 +265,33 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { npc.ai[3] = 0f; } - if (npc.ai[3] == (float)turnAroundDelay) + if (npc.ai[3] == turnAroundDelay) { npc.netUpdate = true; } - Vector2 npcPos = new Vector2(npc.Center.X, npc.Center.Y); - float xDist = Main.player[npc.target].Center.X - npcPos.X; - float yDist = Main.player[npc.target].Center.Y - npcPos.Y; - float targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); + var npcPos = new Vector2(npc.Center.X, npc.Center.Y); + var xDist = Main.player[npc.target].Center.X - npcPos.X; + var yDist = Main.player[npc.target].Center.Y - npcPos.Y; + var targetDist = (float)Math.Sqrt((double)(xDist * xDist + yDist * yDist)); if (targetDist < 200f && !shouldTurnAround) { npc.ai[3] = 0f; } if (!DogPhase1) { - if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && ((npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f) || (npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f))) + if (npc.velocity.Y == 0f && Math.Abs(npc.velocity.X) > 3f && (npc.Center.X < Main.player[npc.target].Center.X && npc.velocity.X > 0f || npc.Center.X > Main.player[npc.target].Center.X && npc.velocity.X < 0f)) { npc.velocity.Y -= bounciness; if (npc.type == ModContent.NPCType()) { SoundEngine.PlaySound(SoundID.Item14, npc.Center); - for (int k = 0; k < 10; k++) + for (var k = 0; k < 10; k++) { Dust.NewDust(npc.position, npc.width, npc.height, (int)CalamityDusts.Brimstone, 0f, -1f, 0, default, 1f); } if (Main.zenithWorld) { - float screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); + var screenShakePower = 2 * Utils.GetLerpValue(1300f, 0f, npc.Distance(Main.LocalPlayer.Center), true); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; } @@ -317,21 +302,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (DogPhase2) { - for (int k = 0; k < 5; k++) + for (var k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); } } if (npc.type == ModContent.NPCType()) { - for (int k = 0; k < 5; k++) + for (var k = 0; k < 5; k++) { Dust.NewDust(npc.position, npc.width, npc.height, DustID.Water, 0f, -1f, 0, default, 1f); } } } } - if (npc.ai[3] < (float)turnAroundDelay) + if (npc.ai[3] < turnAroundDelay) { npc.TargetClosest(true); } @@ -361,19 +346,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } } - if (npc.velocity.Y == 0f || npc.wet || (npc.velocity.X <= 0f && npc.direction < 0) || (npc.velocity.X >= 0f && npc.direction > 0)) + if (npc.velocity.Y == 0f || npc.wet || npc.velocity.X <= 0f && npc.direction < 0 || npc.velocity.X >= 0f && npc.direction > 0) { if (Math.Sign(npc.velocity.X) != npc.direction && !DogPhase1) { npc.velocity.X *= 0.92f; } - float sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * (float)Math.Sign(Main.windSpeedCurrent); + var sandstormPush = MathHelper.Lerp(0.6f, 1f, Math.Abs(Main.windSpeedCurrent)) * Math.Sign(Main.windSpeedCurrent); if (!Main.player[npc.target].ZoneSandstorm) { sandstormPush = 0f; } - float maxVelocity = speedDetect; - float acceleration = speedAdditive; + var maxVelocity = speedDetect; + var acceleration = speedAdditive; if (npc.velocity.X < -maxVelocity || npc.velocity.X > maxVelocity) { if (npc.velocity.Y == 0f) @@ -400,7 +385,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y >= 0f) { - int faceDirection = 0; + var faceDirection = 0; if (npc.velocity.X < 0f) { faceDirection = -1; @@ -409,30 +394,30 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { faceDirection = 1; } - Vector2 position = npc.position; + var position = npc.position; position.X += npc.velocity.X; - int x = (int)((position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 1) * faceDirection)) / 16f); - int y = (int)((position.Y + (float)npc.height - 1f) / 16f); + var x = (int)((position.X + npc.width / 2 + (npc.width / 2 + 1) * faceDirection) / 16f); + var y = (int)((position.Y + npc.height - 1f) / 16f); // 21JAN2023: Ozzatron -- this is probably the single most unmaintainable if statement I've ever seen // I have broken all the individual statements out even though I do not fully understand the code. - Tile t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); - Tile t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); - Tile t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); - Tile t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); - Tile t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement - Tile t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); - bool positionCheck = (float)(x * 16) < position.X + (float)npc.width && (float)(x * 16 + 16) > position.X; - bool tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; - bool oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; - bool canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || (t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType])); - bool twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; - bool threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; + var t_xy = CalamityUtils.ParanoidTileRetrieval(x, y); + var t_xy1 = CalamityUtils.ParanoidTileRetrieval(x, y - 1); + var t_xy2 = CalamityUtils.ParanoidTileRetrieval(x, y - 2); + var t_xy3 = CalamityUtils.ParanoidTileRetrieval(x, y - 3); + var t_xOffY3 = CalamityUtils.ParanoidTileRetrieval(x - faceDirection, y - 3); // 3 down, offset 1 in the direction of the NPC's movement + var t_xy4 = CalamityUtils.ParanoidTileRetrieval(x, y - 4); + var positionCheck = x * 16 < position.X + npc.width && x * 16 + 16 > position.X; + var tileSolidityCheck1 = t_xy.HasUnactuatedTile && !t_xy.TopSlope && !t_xy1.TopSlope && Main.tileSolid[t_xy.TileType] && !Main.tileSolidTop[t_xy.TileType]; + var oneBelowIsSolidHalf = t_xy1.IsHalfBlock && t_xy1.HasUnactuatedTile; + var canFallThrough = !t_xy1.HasUnactuatedTile || !Main.tileSolid[t_xy1.TileType] || Main.tileSolidTop[t_xy1.TileType] || t_xy1.IsHalfBlock && (!t_xy4.HasUnactuatedTile || !Main.tileSolid[t_xy4.TileType] || Main.tileSolidTop[t_xy4.TileType]); + var twoDownIsNonSolid = !t_xy2.HasUnactuatedTile || !Main.tileSolid[t_xy2.TileType] || Main.tileSolidTop[t_xy2.TileType]; + var threeDownIsNonSolid = !t_xy3.HasUnactuatedTile || !Main.tileSolid[t_xy3.TileType] || Main.tileSolidTop[t_xy3.TileType]; // Notice it doesn't check for platforms in ther offset position. This is why walking AIs twirl on 1-wide platforms in hellevators. They have to turn around before this check succeeds. - bool threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; + var threeDownOffsetIsNonSolid = !t_xOffY3.HasUnactuatedTile || !Main.tileSolid[t_xOffY3.TileType]; if (positionCheck && (tileSolidityCheck1 || oneBelowIsSolidHalf) && canFallThrough && twoDownIsNonSolid && threeDownIsNonSolid && threeDownOffsetIsNonSolid) { - float tilePixelPosition = (float)(y * 16); + var tilePixelPosition = (float)(y * 16); if (Main.tile[x, y].IsHalfBlock) { tilePixelPosition += 8f; @@ -441,13 +426,13 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { tilePixelPosition -= 8f; } - if (tilePixelPosition < position.Y + (float)npc.height) + if (tilePixelPosition < position.Y + npc.height) { - float percentageTileRisen = position.Y + (float)npc.height - tilePixelPosition; + var percentageTileRisen = position.Y + npc.height - tilePixelPosition; if ((double)percentageTileRisen <= 16.1) { - npc.gfxOffY += npc.position.Y + (float)npc.height - tilePixelPosition; - npc.position.Y = tilePixelPosition - (float)npc.height; + npc.gfxOffY += npc.position.Y + npc.height - tilePixelPosition; + npc.position.Y = tilePixelPosition - npc.height; if (percentageTileRisen < 9f) { npc.stepSpeed = 1f; @@ -462,15 +447,15 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } if (npc.velocity.Y == 0f) { - int npcTileX = (int)((npc.position.X + (float)(npc.width / 2) + (float)((npc.width / 2 + 2) * npc.direction) + npc.velocity.X * 5f) / 16f); - int npcTileY = (int)((npc.position.Y + (float)npc.height - 15f) / 16f); - int spriteDirection = npc.spriteDirection; + var npcTileX = (int)((npc.position.X + npc.width / 2 + (npc.width / 2 + 2) * npc.direction + npc.velocity.X * 5f) / 16f); + var npcTileY = (int)((npc.position.Y + npc.height - 15f) / 16f); + var spriteDirection = npc.spriteDirection; spriteDirection *= -1; - if ((npc.velocity.X < 0f && spriteDirection == -1) || (npc.velocity.X > 0f && spriteDirection == 1)) + if (npc.velocity.X < 0f && spriteDirection == -1 || npc.velocity.X > 0f && spriteDirection == 1) { - if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 2].TileType]) + if (Main.tile[npcTileX, npcTileY - 2].HasUnactuatedTile && Main.tileSolid[Main.tile[npcTileX, npcTileY - 2].TileType]) { - if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 3].TileType]) + if (Main.tile[npcTileX, npcTileY - 3].HasUnactuatedTile && Main.tileSolid[Main.tile[npcTileX, npcTileY - 3].TileType]) { npc.velocity.Y = bouncy1; npc.netUpdate = true; @@ -481,17 +466,17 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.netUpdate = true; } } - else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY - 1].TileType]) + else if (Main.tile[npcTileX, npcTileY - 1].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY - 1].TopSlope && Main.tileSolid[Main.tile[npcTileX, npcTileY - 1].TileType]) { npc.velocity.Y = bouncy3; npc.netUpdate = true; } - else if (npc.position.Y + (float)npc.height - (float)(npcTileY * 16) > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[(int)Main.tile[npcTileX, npcTileY].TileType]) + else if (npc.position.Y + npc.height - npcTileY * 16 > 20f && Main.tile[npcTileX, npcTileY].HasUnactuatedTile && !Main.tile[npcTileX, npcTileY].TopSlope && Main.tileSolid[Main.tile[npcTileX, npcTileY].TileType]) { npc.velocity.Y = bouncy4; npc.netUpdate = true; } - else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[(int)Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) + else if ((npc.directionY < 0 || Math.Abs(npc.velocity.X) > 3f) && (!Main.tile[npcTileX, npcTileY + 1].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX, npcTileY + 1].TileType]) && (!Main.tile[npcTileX, npcTileY + 2].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX, npcTileY + 2].TileType]) && (!Main.tile[npcTileX + npc.direction, npcTileY + 3].HasUnactuatedTile || !Main.tileSolid[Main.tile[npcTileX + npc.direction, npcTileY + 3].TileType])) { npc.velocity.Y = bouncy5; npc.netUpdate = true; @@ -515,21 +500,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs public static void PassiveSwimmingAI(NPC npc, Mod mod, int passiveness, float detectRange, float xSpeed, float ySpeed, float speedLimitX, float speedLimitY, float rotation, bool spriteFacesLeft = true) { if (spriteFacesLeft) - npc.spriteDirection = (npc.direction > 0) ? 1 : -1; + npc.spriteDirection = npc.direction > 0 ? 1 : -1; else - npc.spriteDirection = (npc.direction > 0) ? -1 : 1; + npc.spriteDirection = npc.direction > 0 ? -1 : 1; npc.noGravity = true; if (npc.direction == 0) npc.TargetClosest(); - Player target = Main.player[npc.target]; + var target = Main.player[npc.target]; if (npc.justHit && passiveness != 3) npc.chaseable = true; if (npc.wet) { - bool hasWetTarget = npc.chaseable; + var hasWetTarget = npc.chaseable; npc.TargetClosest(false); target = Main.player[npc.target]; @@ -610,18 +595,18 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs // Swim away from the player if (passiveness == 3) { - npc.velocity.X = npc.velocity.X - (float)npc.direction * xSpeed; - npc.velocity.Y = npc.velocity.Y - (float)npc.directionY * ySpeed; + npc.velocity.X = npc.velocity.X - npc.direction * xSpeed; + npc.velocity.Y = npc.velocity.Y - npc.directionY * ySpeed; } // Swim toward the player else { - npc.velocity.X = npc.velocity.X + (float)npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); - npc.velocity.Y = npc.velocity.Y + (float)npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); + npc.velocity.X = npc.velocity.X + npc.direction * (CalamityWorld.death ? 2f * xSpeed : CalamityWorld.revenge ? 1.5f * xSpeed : xSpeed); + npc.velocity.Y = npc.velocity.Y + npc.directionY * (CalamityWorld.death ? 2f * ySpeed : CalamityWorld.revenge ? 1.5f * ySpeed : ySpeed); } - float velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; - float velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; + var velocityCapX = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitX : CalamityWorld.revenge ? 1.5f * speedLimitX : speedLimitX; + var velocityCapY = CalamityWorld.death && passiveness != 3 ? 2f * speedLimitY : CalamityWorld.revenge ? 1.5f * speedLimitY : speedLimitY; npc.velocity.X = MathHelper.Clamp(npc.velocity.X, -velocityCapX, velocityCapX); npc.velocity.Y = MathHelper.Clamp(npc.velocity.Y, -velocityCapY, velocityCapY); @@ -631,22 +616,22 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs // Laserfish shoot the player if (npc.type == ModContent.NPCType()) { - npc.localAI[0] += (CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f); + npc.localAI[0] += CalamityWorld.death ? 2f : CalamityWorld.revenge ? 1.5f : 1f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - float speed = 5f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + var speed = 5f; + var vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + var velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + var velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + var dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); dist = speed / dist; velX *= dist; velY *= dist; - int damage = Main.masterMode ? 34 : Main.expertMode ? 40 : 50; - int beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); + var damage = Main.masterMode ? 34 : Main.expertMode ? 40 : 50; + var beam = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 25f : -25f), npc.Center.Y + (target.position.Y > npc.Center.Y ? 5f : -5f), velX, velY, ProjectileID.EyeBeam, damage, 0f, Main.myPlayer); Main.projectile[beam].tileCollide = true; } } @@ -657,21 +642,21 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs { if ((target.Center - npc.Center).Length() < 350f) { - npc.localAI[0] += (CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f); + npc.localAI[0] += CalamityWorld.death ? 3f : CalamityWorld.revenge ? 2f : 1f; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= 180f) { npc.localAI[0] = 0f; if (Collision.CanHit(npc.position, npc.width, npc.height, target.position, target.width, target.height)) { - float speed = 4f; - Vector2 vector = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)(npc.height / 2)); - float velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); - float velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); - float dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); + var speed = 4f; + var vector = new Vector2(npc.position.X + npc.width * 0.5f, npc.position.Y + npc.height / 2); + var velX = target.Center.X - vector.X + Main.rand.NextFloat(-20f, 20f); + var velY = target.Center.Y - vector.Y + Main.rand.NextFloat(-20f, 20f); + var dist = (float)Math.Sqrt((double)(velX * velX + velY * velY)); dist = speed / dist; velX *= dist; velY *= dist; - int damage = Main.masterMode ? 21 : Main.expertMode ? 25 : 35; + var damage = Main.masterMode ? 21 : Main.expertMode ? 25 : 35; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + (npc.spriteDirection == 1 ? 10f : -10f), npc.Center.Y, velX, velY, ModContent.ProjectileType(), damage, 0f, Main.myPlayer); } } @@ -685,7 +670,7 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs else { // No target behavior - npc.velocity.X += (float)npc.direction * 0.1f; + npc.velocity.X += npc.direction * 0.1f; if (npc.velocity.X < -2.5f || npc.velocity.X > 2.5f) npc.velocity.X *= 0.95f; @@ -703,8 +688,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs } } - int npcTileX = (int)(npc.position.X + (float)(npc.width / 2)) / 16; - int npcTileY = (int)(npc.position.Y + (float)(npc.height / 2)) / 16; + var npcTileX = (int)(npc.position.X + npc.width / 2) / 16; + var npcTileY = (int)(npc.position.Y + npc.height / 2) / 16; if (Main.tile[npcTileX, npcTileY - 1].LiquidAmount > 128) { if (Main.tile[npcTileX, npcTileY + 1].HasTile) @@ -733,8 +718,8 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs npc.ai[0] = 1f; } - npc.rotation = npc.velocity.Y * (float)npc.direction * rotation; - float rotationLimit = 2f * rotation; + npc.rotation = npc.velocity.Y * npc.direction * rotation; + var rotationLimit = 2f * rotation; npc.rotation = MathHelper.Clamp(npc.rotation, -rotationLimit, rotationLimit); } #endregion diff --git a/NPCs/NormalNPCs/CladCrab.cs b/NPCs/NormalNPCs/CladCrab.cs index 286ae38309..13144ab802 100644 --- a/NPCs/NormalNPCs/CladCrab.cs +++ b/NPCs/NormalNPCs/CladCrab.cs @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 100; NPC.aiStyle = -1; NPC.knockBackResist = 0.4f; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = SoundID.NPCHit41 with { Pitch = 0.6f }; NPC.DeathSound = SoundID.NPCDeath36 with { Pitch = -0.4f }; Banner = NPC.type; @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/NormalNPCs/CloudElemental.cs b/NPCs/NormalNPCs/CloudElemental.cs index 11bbb3861e..59e654931e 100644 --- a/NPCs/NormalNPCs/CloudElemental.cs +++ b/NPCs/NormalNPCs/CloudElemental.cs @@ -75,10 +75,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 80; NPC.height = 140; NPC.defense = 18; - NPC.DR_NERD(0.05f); NPC.lifeMax = 6000; NPC.knockBackResist = 0.05f; - NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.value = Item.buyPrice(gold: 1, silver: 50); NPC.HitSound = SoundID.NPCHit23; NPC.DeathSound = SoundID.NPCDeath39; NPC.noGravity = true; @@ -91,10 +90,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; NPC.Calamity().VulnerableToHeat = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Cnidrion.cs b/NPCs/NormalNPCs/Cnidrion.cs index a1455124e3..836d928cba 100644 --- a/NPCs/NormalNPCs/Cnidrion.cs +++ b/NPCs/NormalNPCs/Cnidrion.cs @@ -35,11 +35,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 6; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.DR_NERD(0.05f); NPC.lifeMax = 280; NPC.knockBackResist = 0.05f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 25, 0); + NPC.value = Item.buyPrice(silver: 25); NPC.HitSound = SoundID.NPCHit12; NPC.DeathSound = SoundID.NPCDeath18; NPC.rarity = 2; @@ -48,10 +47,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -98,14 +93,13 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { Player player = Main.player[NPC.target]; - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; + NPC.spriteDirection = (NPC.direction > 0) ? 1 : -1; float movementSpeed = 1f; NPC.TargetClosest(true); bool stopMoving = false; int offsetX = 80; - int projectileDamage = masterMode ? 8 : expertMode ? 9 : 12; + int projectileDamage = Main.masterMode ? 8 : Main.expertMode ? 9 : 12; if (NPC.life < NPC.lifeMax * 0.33 && CalamityWorld.death) { movementSpeed = 2f; diff --git a/NPCs/NormalNPCs/CrawlerAmber.cs b/NPCs/NormalNPCs/CrawlerAmber.cs index f954995ab2..227d0ecc74 100644 --- a/NPCs/NormalNPCs/CrawlerAmber.cs +++ b/NPCs/NormalNPCs/CrawlerAmber.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -28,9 +27,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 10; - NPC.lifeMax = 115; + NPC.lifeMax = 150; NPC.knockBackResist = 0.3f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerAmethyst.cs b/NPCs/NormalNPCs/CrawlerAmethyst.cs index a4e87c0b90..6b16f0d70a 100644 --- a/NPCs/NormalNPCs/CrawlerAmethyst.cs +++ b/NPCs/NormalNPCs/CrawlerAmethyst.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -30,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 75; NPC.knockBackResist = 0.75f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 60); + NPC.value = Item.buyPrice(copper: 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerCrystal.cs b/NPCs/NormalNPCs/CrawlerCrystal.cs index e1a0792b18..ff2d4b4d03 100644 --- a/NPCs/NormalNPCs/CrawlerCrystal.cs +++ b/NPCs/NormalNPCs/CrawlerCrystal.cs @@ -3,7 +3,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -27,11 +26,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 35; NPC.width = 44; NPC.height = 34; - NPC.defense = 12; - NPC.lifeMax = 375; + NPC.defense = 22; + NPC.lifeMax = 400; NPC.knockBackResist = 0.15f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -39,10 +38,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerDiamond.cs b/NPCs/NormalNPCs/CrawlerDiamond.cs index 09e32974f5..0ebb7f1a93 100644 --- a/NPCs/NormalNPCs/CrawlerDiamond.cs +++ b/NPCs/NormalNPCs/CrawlerDiamond.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -26,11 +25,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 24; NPC.width = 44; NPC.height = 34; - NPC.defense = 8; - NPC.lifeMax = 190; + NPC.defense = 10; + NPC.lifeMax = 180; NPC.knockBackResist = 0.35f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerEmerald.cs b/NPCs/NormalNPCs/CrawlerEmerald.cs index 83098672ad..9b30b0aacc 100644 --- a/NPCs/NormalNPCs/CrawlerEmerald.cs +++ b/NPCs/NormalNPCs/CrawlerEmerald.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -30,7 +29,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 135; NPC.knockBackResist = 0.55f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 20); + NPC.value = Item.buyPrice(silver: 1, copper: 20); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerRuby.cs b/NPCs/NormalNPCs/CrawlerRuby.cs index 85e11808ee..1d25a513f7 100644 --- a/NPCs/NormalNPCs/CrawlerRuby.cs +++ b/NPCs/NormalNPCs/CrawlerRuby.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -27,10 +26,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 8; - NPC.lifeMax = 170; + NPC.lifeMax = 150; NPC.knockBackResist = 0.45f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 60); + NPC.value = Item.buyPrice(silver: 1, copper: 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerSapphire.cs b/NPCs/NormalNPCs/CrawlerSapphire.cs index 82e676db37..e307c06005 100644 --- a/NPCs/NormalNPCs/CrawlerSapphire.cs +++ b/NPCs/NormalNPCs/CrawlerSapphire.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -27,10 +26,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 6; - NPC.lifeMax = 115; + NPC.lifeMax = 120; NPC.knockBackResist = 0.65f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrawlerTopaz.cs b/NPCs/NormalNPCs/CrawlerTopaz.cs index 3ce4c15784..029c66b7bd 100644 --- a/NPCs/NormalNPCs/CrawlerTopaz.cs +++ b/NPCs/NormalNPCs/CrawlerTopaz.cs @@ -2,7 +2,6 @@ using CalamityMod.Items.Accessories; using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -27,10 +26,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 34; NPC.defense = 4; - NPC.lifeMax = 60; + NPC.lifeMax = 90; NPC.knockBackResist = 0.85f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 60); + NPC.value = Item.buyPrice(copper: 60); NPC.HitSound = SoundID.NPCHit33; NPC.DeathSound = SoundID.NPCDeath36; Banner = NPC.type; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CrimulanBlightSlime.cs b/NPCs/NormalNPCs/CrimulanBlightSlime.cs index 71ef2aa14a..71a4064edc 100644 --- a/NPCs/NormalNPCs/CrimulanBlightSlime.cs +++ b/NPCs/NormalNPCs/CrimulanBlightSlime.cs @@ -24,10 +24,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 165; + NPC.lifeMax = 130; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.alpha = 105; NPC.lavaImmune = false; NPC.noGravity = false; @@ -38,10 +38,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/CryoSlime.cs b/NPCs/NormalNPCs/CryoSlime.cs index d9aa5f45f2..30e71d6f11 100644 --- a/NPCs/NormalNPCs/CryoSlime.cs +++ b/NPCs/NormalNPCs/CryoSlime.cs @@ -22,11 +22,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 30; NPC.width = 40; NPC.height = 30; - NPC.defense = 8; - NPC.lifeMax = 180; + NPC.defense = 24; + NPC.lifeMax = 280; NPC.knockBackResist = 0.6f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -39,10 +39,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Cryon.cs b/NPCs/NormalNPCs/Cryon.cs index b82920a32c..7dad72a7b4 100644 --- a/NPCs/NormalNPCs/Cryon.cs +++ b/NPCs/NormalNPCs/Cryon.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Terraria; using Terraria.GameContent.Bestiary; @@ -23,11 +22,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 42; NPC.width = 50; NPC.height = 64; - NPC.defense = 10; - NPC.DR_NERD(0.1f); - NPC.lifeMax = 375; + NPC.defense = 25; + NPC.lifeMax = 300; NPC.knockBackResist = 0.4f; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(silver: 3); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; Banner = NPC.type; @@ -36,10 +34,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/EbonianBlightSlime.cs b/NPCs/NormalNPCs/EbonianBlightSlime.cs index 98a2b2a496..52d7ad737c 100644 --- a/NPCs/NormalNPCs/EbonianBlightSlime.cs +++ b/NPCs/NormalNPCs/EbonianBlightSlime.cs @@ -24,10 +24,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 60; NPC.height = 42; NPC.defense = 8; - NPC.lifeMax = 165; + NPC.lifeMax = 130; NPC.knockBackResist = 0.3f; AnimationType = NPCID.RainbowSlime; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.alpha = 105; NPC.lavaImmune = false; NPC.noGravity = false; @@ -38,10 +38,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Eidolist.cs b/NPCs/NormalNPCs/Eidolist.cs index 7fde916b9d..eed93943a1 100644 --- a/NPCs/NormalNPCs/Eidolist.cs +++ b/NPCs/NormalNPCs/Eidolist.cs @@ -43,7 +43,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 80; NPC.lifeMax = 5000; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.value = Item.buyPrice(silver: 30); NPC.Opacity = 0f; NPC.noGravity = true; NPC.noTileCollide = false; @@ -57,10 +57,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs index af1c94e9ad..5d6caef76d 100644 --- a/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs +++ b/NPCs/NormalNPCs/FearlessGoldfishWarrior.cs @@ -27,9 +27,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 36; NPC.height = 32; NPC.defense = Main.hardMode ? 10 : 2; - NPC.lifeMax = Main.hardMode ? 190 : 65; + NPC.lifeMax = Main.hardMode ? 150 : 50; NPC.knockBackResist = Main.hardMode ? 0.2f : 0.5f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; @@ -38,10 +38,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Foveanator.cs b/NPCs/NormalNPCs/Foveanator.cs deleted file mode 100644 index 30d5b09bca..0000000000 --- a/NPCs/NormalNPCs/Foveanator.cs +++ /dev/null @@ -1,977 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; -using CalamityMod.Events; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.Projectiles.Boss; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.Chat; -using Terraria.GameContent; -using Terraria.GameContent.Achievements; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class Foveanator : ModNPC - { - public static int phase1IconIndex; - public static int phase2IconIndex; - - public static Asset GlowTexture; - - public override void Load() - { - string phase1IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Head_Boss"; - string phase2IconPath = "CalamityMod/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss"; - - phase1IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase1IconPath, -1); - phase2IconIndex = CalamityMod.Instance.AddBossHeadTexture(phase2IconPath, -1); - } - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); - - if (!Main.dedServ) - GlowTexture = ModContent.Request("CalamityMod/NPCs/NormalNPCs/FoveanatorGlow", AssetRequestMode.AsyncLoad); - } - - public override void SetDefaults() - { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.aiStyle = -1; - AIType = -1; - NPC.GetNPCDamage(); - NPC.DR_NERD(0.2f); - - NPC.width = 100; - NPC.height = 100; - if (Main.tenthAnniversaryWorld) - NPC.scale *= 0.5f; - if (Main.getGoodWorld) - NPC.scale *= 0.8f; - - NPC.defense = 10; - NPC.lifeMax = 24000; - NPC.knockBackResist = 0f; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.boss = true; - NPC.SpawnWithHigherTime(30); - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath14; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToSickness = true; - AnimationType = NPCID.Retinazer; - Music = MusicID.Boss2; - - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - for (int i = 0; i < 4; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - for (int i = 0; i < 4; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void BossHeadSlot(ref int index) => index = NPC.ai[0] >= 3f ? phase2IconIndex : phase1IconIndex; - - public override void AI() - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Get a target - if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) - CalamityUtils.CalamityTargeting(NPC, default); - - float enrageScale = bossRush ? 0.5f : 0.3f; - if (Main.IsItDay() || bossRush) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - // Check for Retinazer - bool retAlive = false; - if (CalamityGlobalNPC.laserEye != -1) - retAlive = Main.npc[CalamityGlobalNPC.laserEye].active; - - // Check for Spazmatism or Retinazer - bool spazAlive = false; - if (CalamityGlobalNPC.fireEye != -1) - spazAlive = Main.npc[CalamityGlobalNPC.fireEye].active; - - // Explode if ret and spaz are dead - if (!retAlive && !spazAlive) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - return; - } - - Vector2 lookDirection = NPC.Center - Main.player[NPC.target].Center; - int direction = (NPC.Center.X < Main.player[NPC.target].position.X + Main.player[NPC.target].width) ? -1 : 1; - - float hoverRotation = lookDirection.ToRotation() + MathHelper.PiOver2; - if (hoverRotation < 0f) - hoverRotation += MathHelper.TwoPi; - else if (hoverRotation > MathHelper.TwoPi) - hoverRotation -= MathHelper.TwoPi; - - // Rotate faster during energy bomb and laser barrage - float rotationRate = NPC.ai[1] == 3f ? 0.25f : 0.15f; - NPC.rotation = NPC.rotation.AngleTowards(hoverRotation, rotationRate); - - if (Main.rand.NextBool(5)) - { - int foveaDust = Dust.NewDust(new Vector2(NPC.position.X, NPC.position.Y + NPC.height * 0.25f), NPC.width, (int)(NPC.height * 0.5f), DustID.Blood, NPC.velocity.X, 2f, 0, default, 1f); - Dust dust = Main.dust[foveaDust]; - dust.velocity.X *= 0.5f; - dust.velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.player[NPC.target].dead && NPC.timeLeft < 10) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (i != NPC.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == NPC.type) && Main.npc[i].timeLeft - 1 > NPC.timeLeft) - NPC.timeLeft = Main.npc[i].timeLeft - 1; - } - } - - // Phase HP ratios - float phase2LifeRatio = 0.85f; - float finalPhaseLifeRatio = 0.4f; - - // Movement variables - float phase1MaxSpeedIncrease = 2f; - float phase1MaxAccelerationIncrease = 0.025f; - float phase1MaxChargeSpeedIncrease = 1f; - - // Phase duration variables - float phase1MaxLaserPhaseDurationDecrease = 120f; - - // Go to phase 2 early if Spaz and Ret health total goes below 50% - // Go to final phase early if Spaz and Ret health total goes below 20% - float retAndSpazHPRatio = 0f; - if (CalamityGlobalNPC.fireEye != -1) - { - if (Main.npc[CalamityGlobalNPC.fireEye].active) - retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.fireEye].life / (float)Main.npc[CalamityGlobalNPC.fireEye].lifeMax; - } - if (CalamityGlobalNPC.laserEye != -1) - { - if (Main.npc[CalamityGlobalNPC.laserEye].active) - retAndSpazHPRatio += Main.npc[CalamityGlobalNPC.laserEye].life / (float)Main.npc[CalamityGlobalNPC.laserEye].lifeMax; - } - - // Phase checks - bool phase2 = lifeRatio < phase2LifeRatio || retAndSpazHPRatio < 0.5f; - bool finalPhase = lifeRatio < finalPhaseLifeRatio || retAndSpazHPRatio < 0.2f; - - Vector2 mechQueenSpacing = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC NPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = NPC.GetMechQueenCenter(); - Vector2 eyePosition = new Vector2(0f, -300f); - eyePosition *= 0.75f; - float mechdusaRotation = NPC.velocity.X * 0.025f; - mechQueenSpacing = mechQueenCenter + eyePosition; - mechQueenSpacing = mechQueenSpacing.RotatedBy(mechdusaRotation, mechQueenCenter); - } - - NPC.reflectsProjectiles = false; - - // Despawn - if (Main.player[NPC.target].dead) - { - NPC.velocity.Y -= 0.04f; - if (NPC.timeLeft > 10) - { - NPC.timeLeft = 10; - return; - } - } - - else if (NPC.ai[0] == 0f) - { - if (NPC.ai[1] == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - float maxVelocity = 8.5f; - float acceleration = 0.12f; - maxVelocity += 4.5f * enrageScale; - acceleration += 0.06f * enrageScale; - - if (death) - { - maxVelocity += phase1MaxSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - acceleration += phase1MaxAccelerationIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - } - - if (Main.getGoodWorld) - { - maxVelocity *= 1.15f; - acceleration *= 1.15f; - } - - // Foveanator stays further away from the player than Retinazer (Retinazer distance is 300, Foveanator distance is 450) - float distanceFromTarget = 450f; - Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction - Vector2.UnitY * distanceFromTarget; - float distanceFromDestination = (destination - NPC.Center).Length(); - Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); - - if (NPC.IsMechQueenUp) - { - maxVelocity = 14f; - - destination = mechQueenSpacing; - distanceFromDestination = (destination - NPC.Center).Length(); - idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY); - - if (distanceFromDestination > maxVelocity) - idealVelocity *= maxVelocity / distanceFromDestination; - - float inertia = 60f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia; - } - else - NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - - // Foveanator stays in this phase longer than Retinazer (Foveanator time is 450, Retinazer time is 300) - // Foveanator has longer cooldown between firing projectiles than Retinazer (Foveanator cooldown is 60, Retinazer cooldown is 30) - float phaseGateValue = 450f - (death ? phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - float laserGateValue = 60f; - if (NPC.IsMechQueenUp) - { - phaseGateValue = 1350f; - laserGateValue = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 120f : 180f); - } - - NPC.ai[2] += 1f; - if (NPC.ai[2] >= phaseGateValue) - { - NPC.ai[1] = 1f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(NPC, default); - - NPC.netUpdate = true; - } - else if (distanceFromDestination < (death ? 960f : 800f)) - { - if (!Main.player[NPC.target].dead) - { - NPC.ai[3] += 1f; - if (Main.getGoodWorld) - NPC.ai[3] += 0.5f; - } - - if (NPC.ai[3] >= laserGateValue) - { - NPC.ai[3] = 0f; - - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float laserSpeed = 6f + 1.5f * enrageScale; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 laserVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 60f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - else if (NPC.ai[1] == 1f) - { - // Set damage - NPC.damage = NPC.defDamage; - - NPC.rotation = hoverRotation; - - float chargeSpeed = 4f; - chargeSpeed += 1f * enrageScale; - if (death) - chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) - chargeSpeed += 1f; - - NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; - - NPC.ai[1] = 2f; - } - else if (NPC.ai[1] == 2f) - { - // Set damage - NPC.damage = NPC.defDamage; - - NPC.ai[2] += 1f; - float decelerateGateValue = 72f + (death ? 12f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - if (NPC.ai[2] >= decelerateGateValue) - { - // Avoid cheap bullshit - NPC.damage = 0; - - float decelerationMultiplier = 0.8f - (death ? 0.2f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - NPC.velocity *= decelerationMultiplier; - - if (Math.Abs(NPC.velocity.X) < 0.1) - NPC.velocity.X = 0f; - if (Math.Abs(NPC.velocity.Y) < 0.1) - NPC.velocity.Y = 0f; - } - else - { - // Accelerative charge - float maxVelocity = 24f; - maxVelocity += 6f * enrageScale; - if (death) - maxVelocity += (phase1MaxChargeSpeedIncrease * 6f) * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) - maxVelocity += 6f; - - if (NPC.velocity.Length() < maxVelocity) - { - NPC.velocity *= 1.04f; - if (NPC.velocity.Length() > maxVelocity) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxVelocity; - } - } - - NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; - } - - float delayBeforeChargingAgain = 96f - (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - if (NPC.ai[2] >= delayBeforeChargingAgain) - { - NPC.ai[3] += 1f; - NPC.ai[2] = 0f; - - NPC.rotation = hoverRotation; - - float totalCharges = death ? 3f : 2f; - if (NPC.ai[3] >= totalCharges) - { - NPC.ai[1] = 0f; - NPC.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(NPC, default); - } - else - NPC.ai[1] = 1f; - } - } - - // Enter phase 2 - if (phase2) - { - NPC.ai[0] = 1f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(NPC, default); - - NPC.netUpdate = true; - } - } - - else if (NPC.ai[0] == 1f || NPC.ai[0] == 2f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - if (NPC.IsMechQueenUp) - NPC.reflectsProjectiles = true; - - if (NPC.ai[0] == 1f) - { - NPC.ai[2] += 0.005f; - if (NPC.ai[2] > 0.5f) - NPC.ai[2] = 0.5f; - } - else - { - NPC.ai[2] -= 0.005f; - if (NPC.ai[2] < 0f) - NPC.ai[2] = 0f; - } - - NPC.rotation += NPC.ai[2]; - - NPC.ai[1] += 1f; - if (NPC.ai[2] >= 0.2f) - { - if (NPC.ai[1] % 10f == 0f) - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - bool shootLaser = NPC.ai[1] % 20f == 0f; - - int type = shootLaser ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - float projectileSpeed = shootLaser ? (6f + 1.5f * enrageScale) : 16f; - float ai0 = shootLaser ? 0f : (death ? 1f : 0f); - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - int numProj = shootLaser ? 4 : 2; - int spread = shootLaser ? 15 : 30; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, ai0); - } - } - } - } - - if (NPC.ai[1] == 100f) - { - NPC.ai[0] += 1f; - NPC.ai[1] = 0f; - if (NPC.ai[0] == 3f) - { - NPC.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, NPC.Center); - - if (!Main.dedServ) - { - for (int i = 0; i < 2; i++) - { - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator1").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); - Gore.NewGore(NPC.GetSource_FromAI(), NPC.position, new Vector2(Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f), 6, NPC.scale); - } - } - - for (int j = 0; j < 20; j++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); - } - } - - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, Main.rand.Next(-30, 31) * 0.2f, Main.rand.Next(-30, 31) * 0.2f, 0, default, 1f); - - NPC.velocity *= 0.98f; - if (Math.Abs(NPC.velocity.X) < 0.1) - NPC.velocity.X = 0f; - if (Math.Abs(NPC.velocity.Y) < 0.1) - NPC.velocity.Y = 0f; - } - else - { - // If in phase 2 but Spaz or Ret aren't - bool spazOrRetInPhase1 = false; - if (CalamityGlobalNPC.fireEye != -1) - { - if (Main.npc[CalamityGlobalNPC.fireEye].active) - spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.fireEye].ai[0] == 0f; - } - if (CalamityGlobalNPC.laserEye != -1) - { - if (Main.npc[CalamityGlobalNPC.laserEye].active) - spazOrRetInPhase1 = Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 1f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 2f || Main.npc[CalamityGlobalNPC.laserEye].ai[0] == 0f; - } - - NPC.chaseable = !spazOrRetInPhase1; - - int setDamage = (int)Math.Round(NPC.defDamage * 1.5); - NPC.defense = NPC.defDefense + 14; - calamityGlobalNPC.DR = spazOrRetInPhase1 ? 0.9999f : 0.2f; - calamityGlobalNPC.unbreakableDR = spazOrRetInPhase1; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = spazOrRetInPhase1; - - NPC.HitSound = SoundID.NPCHit4; - - if (NPC.ai[1] == 0f) - { - // Avoid cheap bullshit - NPC.damage = 0; - - float maxVelocity = 4f + (death ? 1.2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.06f + (death ? 0.02f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - maxVelocity += 2f * enrageScale; - acceleration += 0.04f * enrageScale; - - float distanceFromTarget = 360f; - Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction; - float distanceFromDestination = (destination - NPC.Center).Length(); - Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); - - if (!NPC.IsMechQueenUp) - { - // Boost speed if too far from target - if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, 12f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); - - if (Main.getGoodWorld) - { - maxVelocity *= 1.15f; - acceleration *= 1.15f; - } - - NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - } - - // Fire flamethrower for x seconds - NPC.ai[2] += (retAlive && spazAlive) ? 1f : 2f; - float phaseGateValue = NPC.IsMechQueenUp ? 1350f : 360f - (death ? 90f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - if (NPC.ai[2] >= phaseGateValue) - { - // Go to charge phase or fire large barrage of lasers and energy bombs if in final phase - NPC.ai[1] = finalPhase ? 3f : 1f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - - // Fire fireballs and flamethrower - else if (Collision.CanHit(NPC.position, NPC.width, NPC.height, Main.player[NPC.target].position, Main.player[NPC.target].width, Main.player[NPC.target].height)) - { - // Play flame sound on timer - NPC.localAI[2] += 1f; - if (NPC.localAI[2] > 22f) - { - NPC.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, NPC.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[1] += 1f; - if (NPC.localAI[1] > 4f) - { - NPC.localAI[1] = 0f; - - float foveanatorFlamethrowerSpeed = 4f + 2f * enrageScale; - float timeForFlamethrowerToReachMaxVelocity = (retAlive && spazAlive) ? 120f : 60f; - float flamethrowerSpeedScalar = MathHelper.Clamp(NPC.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); - foveanatorFlamethrowerSpeed = MathHelper.Lerp(0.1f, foveanatorFlamethrowerSpeed, flamethrowerSpeedScalar); - - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 flamethrowerVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; - - if (NPC.IsMechQueenUp) - flamethrowerVelocity = (NPC.rotation + MathHelper.PiOver2).ToRotationVector2() * foveanatorFlamethrowerSpeed + NPC.velocity * 0.5f; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 100f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - - if (NPC.IsMechQueenUp) - { - maxVelocity = 14f; - - destination = mechQueenSpacing; - distanceFromDestination = (destination - NPC.Center).Length(); - idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitY); - - if (distanceFromDestination > maxVelocity) - idealVelocity *= maxVelocity / distanceFromDestination; - - float inertia = 60f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + idealVelocity) / inertia; - } - } - - // Charge - else if (NPC.ai[1] == 1f) - { - // Set damage - NPC.damage = setDamage; - - // Play charge sound - // TODO - Make this a jet turbine sound or something - //SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); - - // Set rotation and velocity - NPC.rotation = hoverRotation; - - float chargeSpeed = 4.5f + (death ? 1.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - chargeSpeed += 4f * enrageScale; - if (Main.getGoodWorld) - chargeSpeed *= 1.2f; - - NPC.velocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * chargeSpeed; - - NPC.ai[1] = 2f; - } - - // Maintain charge velocity until deceleration - else if (NPC.ai[1] == 2f) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[2] += 1f; - - float chargeTime = 60f - (death ? 20f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - - // Slow down - if (NPC.ai[2] >= chargeTime) - { - // Avoid cheap bullshit - NPC.damage = 0; - - float deceleration = 0.8f - (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - NPC.velocity *= deceleration; - - if (Math.Abs(NPC.velocity.X) < 0.1) - NPC.velocity.X = 0f; - if (Math.Abs(NPC.velocity.Y) < 0.1) - NPC.velocity.Y = 0f; - } - else - { - // Accelerative charge - float maxVelocity = 27f; - maxVelocity += 6f * enrageScale; - if (death) - maxVelocity += 7.5f * ((1f - lifeRatio) / (1f - phase2LifeRatio)); - if (Main.getGoodWorld) - maxVelocity *= 1.2f; - - // Spawn Energy Bombs along the way - float energyBombFireRate = 8f; - if (NPC.ai[2] % energyBombFireRate == 0f) - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.velocity.SafeNormalize(Vector2.UnitY) * 60f, Vector2.Zero, type, damage, 0f, Main.myPlayer, death ? 2f : 1f); - } - } - - if (NPC.velocity.Length() < maxVelocity) - { - NPC.velocity *= 1.06f; - if (NPC.velocity.Length() > maxVelocity) - { - NPC.velocity.Normalize(); - NPC.velocity *= maxVelocity; - } - } - - NPC.rotation = NPC.velocity.ToRotation() - MathHelper.PiOver2; - } - - // Charge 2 times - if (NPC.ai[2] >= chargeTime * 1.3f) - { - NPC.ai[3] += 1f; - NPC.ai[2] = 0f; - - NPC.rotation = hoverRotation; - - float maxCharges = 2f; - if (NPC.ai[3] >= maxCharges) - { - NPC.ai[1] = 0f; - NPC.ai[3] = 0f; - } - else - NPC.ai[1] = 1f; - } - } - - // Laser and energy bomb barrage - else if (NPC.ai[1] == 3f) - { - float maxVelocity = 12f + (death ? 2.4f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.16f + (death ? 0.32f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - maxVelocity += 6f * enrageScale; - acceleration += 0.08f * enrageScale; - - if (Main.getGoodWorld) - { - maxVelocity *= 1.15f; - acceleration *= 1.15f; - } - - float distanceFromTarget = 640f; - Vector2 destination = Main.player[NPC.target].Center + Vector2.UnitX * distanceFromTarget * direction; - float distanceFromDestination = (destination - NPC.Center).Length(); - Vector2 idealVelocity = (destination - NPC.Center).SafeNormalize(Vector2.UnitX * direction); - - bool gettingIntoPosition = NPC.ai[2] == 0f; - if (NPC.Distance(Main.player[NPC.target].Center) < distanceFromTarget && gettingIntoPosition) - { - NPC.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); - } - else - { - NPC.SimpleFlyMovement(idealVelocity * maxVelocity * 0.5f, acceleration * 0.5f); - - // Fire 2 spreads (3 in Death Mode) of energy bombs and lasers - int totalSpreads = death ? 6 : 4; - - // Fire rates - float laserBarrageFireRate = 45f; - float energyBombFireRate = 90f; - - NPC.ai[2] += 1f; - - // Energy bombs - if (NPC.ai[2] % energyBombFireRate == 0f) - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * 16f; - int numProj = 3; - int spread = 30; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer, death ? 1f : 0f); - } - } - - NPC.ai[3] += 1f; - } - - else if (NPC.ai[2] % laserBarrageFireRate == 0f) - { - SoundEngine.PlaySound(AstrumDeusHead.LaserSound, NPC.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - float projectileSpeed = 8f + 2f * enrageScale; - Vector2 projectileVelocity = (Main.player[NPC.target].Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - int numProj = 4; - int spread = 40; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 60f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - - NPC.ai[3] += 1f; - } - - // Charge - if (NPC.ai[3] >= totalSpreads) - { - NPC.ai[1] = 1f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - } - } - } - } - - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - spriteBatch.Draw(TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); - - Texture2D glowTexture = GlowTexture.Value; - spriteBatch.Draw(glowTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, Color.White, NPC.rotation, NPC.frame.Size() / 2, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life > 0) - { - for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 100D; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, hit.HitDirection, -1f); - - return; - } - - for (int i = 0; i < 150; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 2 * hit.HitDirection, -2f); - - if (!Main.dedServ) - { - for (int i = 0; i < 2; i++) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 2, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 9, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), Mod.Find("Foveanator2").Type, NPC.scale); - } - } - - for (int i = 0; i < 10; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 31, 0f, 0f, 100, default, 1.5f); - Main.dust[dust].velocity *= 1.4f; - } - - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, 0f, 0f, 100, default, 1.5f); - Main.dust[dust].velocity *= 3f; - } - - if (!Main.dedServ) - { - int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y += 1f; - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y += 1f; - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y -= 1f; - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default, Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y -= 1f; - } - } - } -} diff --git a/NPCs/NormalNPCs/Foveanator.png b/NPCs/NormalNPCs/Foveanator.png deleted file mode 100644 index 67291fe4aa..0000000000 Binary files a/NPCs/NormalNPCs/Foveanator.png and /dev/null differ diff --git a/NPCs/NormalNPCs/FoveanatorGlow.png b/NPCs/NormalNPCs/FoveanatorGlow.png deleted file mode 100644 index d8b3325658..0000000000 Binary files a/NPCs/NormalNPCs/FoveanatorGlow.png and /dev/null differ diff --git a/NPCs/NormalNPCs/Foveanator_Head_Boss.png b/NPCs/NormalNPCs/Foveanator_Head_Boss.png deleted file mode 100644 index 7c93efb49e..0000000000 Binary files a/NPCs/NormalNPCs/Foveanator_Head_Boss.png and /dev/null differ diff --git a/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png b/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png deleted file mode 100644 index 6a6b7c7532..0000000000 Binary files a/NPCs/NormalNPCs/Foveanator_Phase2_Head_Boss.png and /dev/null differ diff --git a/NPCs/NormalNPCs/Frogfish.cs b/NPCs/NormalNPCs/Frogfish.cs index 3c4fe4c6f8..0e64c5dc05 100644 --- a/NPCs/NormalNPCs/Frogfish.cs +++ b/NPCs/NormalNPCs/Frogfish.cs @@ -1,6 +1,5 @@ using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -26,7 +25,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 100; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.5f; @@ -37,10 +36,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Horse.cs b/NPCs/NormalNPCs/Horse.cs index 23da274c57..6c6806ec9b 100644 --- a/NPCs/NormalNPCs/Horse.cs +++ b/NPCs/NormalNPCs/Horse.cs @@ -40,12 +40,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 230; NPC.height = 230; NPC.defense = 20; - NPC.DR_NERD(0.1f); NPC.lifeMax = 3800; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.05f; - NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.value = Item.buyPrice(gold: 1, silver: 50); NPC.dontTakeDamage = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -55,10 +54,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/IceClasper.cs b/NPCs/NormalNPCs/IceClasper.cs index dd5b9c3d62..737450557d 100644 --- a/NPCs/NormalNPCs/IceClasper.cs +++ b/NPCs/NormalNPCs/IceClasper.cs @@ -81,12 +81,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 50; NPC.height = 50; NPC.defense = 12; - NPC.lifeMax = 750; + NPC.lifeMax = 500; NPC.knockBackResist = 0.25f; NPC.noTileCollide = true; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; NPC.rarity = 2; @@ -96,10 +96,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ImpiousImmolator.cs b/NPCs/NormalNPCs/ImpiousImmolator.cs index 923a6e30ad..0cf4327328 100644 --- a/NPCs/NormalNPCs/ImpiousImmolator.cs +++ b/NPCs/NormalNPCs/ImpiousImmolator.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 3000; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(silver: 50); NPC.HitSound = SoundID.NPCHit5; NPC.DeathSound = SoundID.NPCDeath7; NPC.knockBackResist = 0.2f; @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs index 18b6c3c052..0379b92424 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelEmerald.cs @@ -36,7 +36,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); + NPC.damage = 24; // 72 (Death exlusive) NPC.width = 32; NPC.height = 32; NPC.defense = 15; diff --git a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs index 9a644aa5ae..78e7fd1c13 100644 --- a/NPCs/NormalNPCs/KingSlimeJewelRuby.cs +++ b/NPCs/NormalNPCs/KingSlimeJewelRuby.cs @@ -25,9 +25,10 @@ namespace CalamityMod.NPCs.NormalNPCs private const int BoltShootGateValue = 60; private const int BoltShootGateValue_Death = 75; - private const int BoltShootGateValue_BossRush = 45; private const float LightTelegraphDuration = 45f; + public static int JewelBoltDamage = 10; // 40 + public override void SetStaticDefaults() { NPCID.Sets.NeedsExpertScaling[Type] = true; @@ -39,7 +40,7 @@ namespace CalamityMod.NPCs.NormalNPCs { NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; NPC.width = 32; NPC.height = 32; NPC.defense = 10; @@ -55,6 +56,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void AI() { + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Despawn if (!CalamityPlayer.areThereAnyDamnBosses) @@ -124,7 +126,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Fire projectiles NPC.ai[0] += 1f; - if (NPC.ai[0] >= (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) + if (NPC.ai[0] >= (death ? BoltShootGateValue_Death : BoltShootGateValue)) { NPC.ai[0] = 0f; @@ -134,7 +136,7 @@ namespace CalamityMod.NPCs.NormalNPCs Vector2 projVector = new Vector2(xDist, yDist); float projLength = projVector.Length(); - float speed = Main.masterMode ? 12f : 10f; + float speed = death ? 12f : 10f; int type = ModContent.ProjectileType(); projLength = speed / projLength; @@ -151,19 +153,18 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.netMode != NetmodeID.MultiplayerClient) { - int damage = NPC.GetProjectileDamage(type); - if (CalamityWorld.death || BossRushEvent.BossRushActive) + if (death) { - int numProj = Main.masterMode ? 5 : 4; + int numProj = 4; float rotation = MathHelper.ToRadians(18); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projVector.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, perturbedSpeed, type, JewelBoltDamage, 0f, Main.myPlayer); } } else - Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), npcPos, projVector, type, JewelBoltDamage, 0f, Main.myPlayer); } NPC.netUpdate = true; @@ -192,7 +193,7 @@ namespace CalamityMod.NPCs.NormalNPCs float alph = 0f; - float colorTelegraphGateValue = (BossRushEvent.BossRushActive ? BoltShootGateValue_BossRush : (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue)) - LightTelegraphDuration; + float colorTelegraphGateValue = (CalamityWorld.death ? BoltShootGateValue_Death : BoltShootGateValue) - LightTelegraphDuration; if (NPC.ai[0] > colorTelegraphGateValue) alph = MathHelper.Lerp(0f, 1f, (NPC.ai[0] - colorTelegraphGateValue) / LightTelegraphDuration); diff --git a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs b/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs deleted file mode 100644 index 38cd0a6c25..0000000000 --- a/NPCs/NormalNPCs/LavaSlimeNoLavaDrop.cs +++ /dev/null @@ -1,75 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class LavaSlimeNoLavaDrop : ModNPC - { - public override string Texture => $"Terraria/Images/NPC_{NPCID.LavaSlime}"; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 2; - this.HideFromBestiary(); - } - - public override void SetDefaults() - { - NPC.aiStyle = NPCAIStyleID.Slime; - AIType = NPCID.LavaSlime; - AnimationType = NPCID.LavaSlime; - NPC.width = 24; - NPC.height = 18; - NPC.damage = 15; - NPC.defense = 10; - NPC.lifeMax = 50; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath1; - NPC.scale = 1.1f; - NPC.alpha = 50; - NPC.lavaImmune = true; - NPC.value = 120f; - if (Main.remixWorld) - { - NPC.damage = 7; - NPC.defense = 2; - NPC.lifeMax = 25; - NPC.value = 25f; - } - //Banner = NPCID.LavaSlime; - //BannerItem = ItemID.LavaSlimeBanner; - - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = false; - NPC.Calamity().VulnerableToHeat = false; - NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life > 0) - { - for (int i = 0; (double)i < hit.Damage / (double)NPC.lifeMax * 80D; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - - return; - } - - for (int i = 0; i < 40; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, 6, hit.HitDirection * 2, -1f, NPC.alpha, default, 1.5f); - if (Main.rand.Next(8) != 0) - Main.dust[dust].noGravity = true; - } - } - } -} diff --git a/NPCs/NormalNPCs/MantisShrimp.cs b/NPCs/NormalNPCs/MantisShrimp.cs index 0bd649cac1..6d8f03f37b 100644 --- a/NPCs/NormalNPCs/MantisShrimp.cs +++ b/NPCs/NormalNPCs/MantisShrimp.cs @@ -29,11 +29,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 24; NPC.defense = 10; - NPC.DR_NERD(0.1f); - NPC.lifeMax = 50; + NPC.lifeMax = 60; NPC.aiStyle = NPCAIStyleID.Fighter; AIType = NPCID.Crab; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; @@ -42,10 +41,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/OverloadedSoldier.cs b/NPCs/NormalNPCs/OverloadedSoldier.cs index 1419f7e2b8..7c121bb4a4 100644 --- a/NPCs/NormalNPCs/OverloadedSoldier.cs +++ b/NPCs/NormalNPCs/OverloadedSoldier.cs @@ -29,20 +29,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 18; NPC.height = 40; NPC.defense = 18; - NPC.DR_NERD(0.15f); - NPC.lifeMax = NPC.downedMoonlord ? 1700 : 170; + NPC.lifeMax = NPC.downedMoonlord ? 3000 : 300; NPC.knockBackResist = 0.3f; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = SoundID.NPCHit2; NPC.DeathSound = SoundID.NPCDeath2; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PerennialSlime.cs b/NPCs/NormalNPCs/PerennialSlime.cs index eb62be6480..623c3f6f76 100644 --- a/NPCs/NormalNPCs/PerennialSlime.cs +++ b/NPCs/NormalNPCs/PerennialSlime.cs @@ -22,11 +22,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 35; NPC.width = 40; NPC.height = 30; - NPC.defense = 12; - NPC.lifeMax = 225; + NPC.defense = 20; + NPC.lifeMax = 360; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.alpha = 50; NPC.lavaImmune = false; NPC.noGravity = false; @@ -37,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpirit.cs b/NPCs/NormalNPCs/PhantomSpirit.cs index 1f94654c10..1d05b99e30 100644 --- a/NPCs/NormalNPCs/PhantomSpirit.cs +++ b/NPCs/NormalNPCs/PhantomSpirit.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -23,12 +22,12 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 70; NPC.width = 16; NPC.height = 16; - NPC.defense = 10; - NPC.lifeMax = 1250; + NPC.defense = 40; + NPC.lifeMax = 1500; NPC.knockBackResist = 0.2f; AnimationType = NPCID.DungeonSpirit; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(silver: 20); NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.noGravity = true; @@ -36,10 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpiritL.cs b/NPCs/NormalNPCs/PhantomSpiritL.cs index 2f7849b747..f533643661 100644 --- a/NPCs/NormalNPCs/PhantomSpiritL.cs +++ b/NPCs/NormalNPCs/PhantomSpiritL.cs @@ -3,7 +3,6 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -23,18 +22,20 @@ namespace CalamityMod.NPCs.NormalNPCs Main.npcFrameCount[Type] = 5; } + public static int ShotDamage = 60; // 240 + public override void SetDefaults() { + NPC.damage = 100; // 200 NPC.aiStyle = -1; - NPC.damage = 100; NPC.width = 32; NPC.height = 80; NPC.scale *= 1.2f; - NPC.defense = 30; - NPC.lifeMax = 3750; + NPC.defense = 60; + NPC.lifeMax = 3500; NPC.knockBackResist = 0.1f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 60, 0); + NPC.value = Item.buyPrice(silver: 60); NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.noGravity = true; @@ -42,10 +43,6 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -88,11 +85,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.ai[2] = 0f; float projSpeed = 10f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); targetDistance = projSpeed / targetDistance; targetXDist *= targetDistance; targetYDist *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), spiritPosition.X, spiritPosition.Y, targetXDist, targetYDist, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spiritPosition.X, spiritPosition.Y, targetXDist, targetYDist, type, ShotDamage, 0f, Main.myPlayer, 0f, 0f); } } diff --git a/NPCs/NormalNPCs/PhantomSpiritM.cs b/NPCs/NormalNPCs/PhantomSpiritM.cs index 5d35236eba..e36da27bba 100644 --- a/NPCs/NormalNPCs/PhantomSpiritM.cs +++ b/NPCs/NormalNPCs/PhantomSpiritM.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -26,11 +25,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 80; NPC.scale *= 1.1f; - NPC.defense = 25; + NPC.defense = 50; NPC.lifeMax = 2500; NPC.knockBackResist = 0.15f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 40, 0); + NPC.value = Item.buyPrice(silver: 40); NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.noGravity = true; @@ -38,10 +37,6 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/PhantomSpiritS.cs b/NPCs/NormalNPCs/PhantomSpiritS.cs index 9608b72321..75b6ca3667 100644 --- a/NPCs/NormalNPCs/PhantomSpiritS.cs +++ b/NPCs/NormalNPCs/PhantomSpiritS.cs @@ -1,7 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -25,11 +24,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.damage = 80; NPC.width = 32; NPC.height = 80; - NPC.defense = 20; - NPC.lifeMax = 1875; + NPC.defense = 45; + NPC.lifeMax = 2000; NPC.knockBackResist = 0.2f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 30, 0); + NPC.value = Item.buyPrice(silver: 30); NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.noGravity = true; @@ -37,10 +36,6 @@ namespace CalamityMod.NPCs.NormalNPCs Banner = ModContent.NPCType(); BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Piggy.cs b/NPCs/NormalNPCs/Piggy.cs index 4b2106e519..9782a5d91d 100644 --- a/NPCs/NormalNPCs/Piggy.cs +++ b/NPCs/NormalNPCs/Piggy.cs @@ -34,7 +34,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.aiStyle = NPCAIStyleID.Passive; AIType = NPCID.Squirrel; NPC.knockBackResist = 0.99f; - NPC.value = Item.buyPrice(0, 2, 0, 0); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; Banner = NPC.type; diff --git a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs index d766fc1f04..0908378d3d 100644 --- a/NPCs/NormalNPCs/PlanterasFreeTentacle.cs +++ b/NPCs/NormalNPCs/PlanterasFreeTentacle.cs @@ -28,11 +28,9 @@ namespace CalamityMod.NPCs.NormalNPCs public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 60; NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); - NPC.DR_NERD(0.1f); NPC.width = 24; NPC.height = 24; NPC.defense = 20; @@ -45,10 +43,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -190,13 +184,7 @@ namespace CalamityMod.NPCs.NormalNPCs public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * balance); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(BuffID.Poisoned, 180); + NPC.damage = (int)(NPC.damage * 1.15f); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/NormalNPCs/ProfanedEnergyBody.cs b/NPCs/NormalNPCs/ProfanedEnergyBody.cs index 31fd92aaa5..2942860f46 100644 --- a/NPCs/NormalNPCs/ProfanedEnergyBody.cs +++ b/NPCs/NormalNPCs/ProfanedEnergyBody.cs @@ -31,11 +31,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 72; NPC.height = 36; NPC.defense = 50; - NPC.DR_NERD(0.1f); NPC.lifeMax = 2500; NPC.knockBackResist = 0f; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 50, 0); + NPC.value = Item.buyPrice(silver: 50); NPC.lavaImmune = true; NPC.noGravity = true; NPC.HitSound = SoundID.NPCHit52; @@ -46,10 +45,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Rimehound.cs b/NPCs/NormalNPCs/Rimehound.cs index 4fb5748983..b3e68cefb3 100644 --- a/NPCs/NormalNPCs/Rimehound.cs +++ b/NPCs/NormalNPCs/Rimehound.cs @@ -1,7 +1,6 @@ using System.IO; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.World; using Terraria; using Terraria.Audio; @@ -38,17 +37,17 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 56; NPC.height = 56; NPC.defense = 4; - NPC.lifeMax = 65; + NPC.lifeMax = 80; if (DownedBossSystem.downedCryogen) { NPC.damage = 60; NPC.defense = 10; - NPC.lifeMax = 1250; + NPC.lifeMax = 600; } NPC.knockBackResist = 0.3f; AnimationType = NPCID.Hellhound; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = HitSound; NPC.DeathSound = SoundID.NPCDeath5; Banner = NPC.type; @@ -57,10 +56,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = false; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Rotdog.cs b/NPCs/NormalNPCs/Rotdog.cs index 71a8eab684..fb733e8c7c 100644 --- a/NPCs/NormalNPCs/Rotdog.cs +++ b/NPCs/NormalNPCs/Rotdog.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 75; NPC.knockBackResist = 0.3f; AIType = NPCID.Wolf; - NPC.value = Item.buyPrice(0, 0, 1, 50); + NPC.value = Item.buyPrice(silver: 1, copper: 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath5; Banner = NPC.type; @@ -35,10 +35,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/ScornEater.cs b/NPCs/NormalNPCs/ScornEater.cs index 343fafa2b4..2891aa5e74 100644 --- a/NPCs/NormalNPCs/ScornEater.cs +++ b/NPCs/NormalNPCs/ScornEater.cs @@ -40,12 +40,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 160; NPC.height = 160; NPC.defense = 38; - NPC.DR_NERD(0.05f); NPC.lifeMax = 9000; - NPC.knockBackResist = 0.1f; + NPC.knockBackResist = 0f; AIType = -1; NPC.lavaImmune = true; - NPC.value = Item.buyPrice(0, 0, 75, 0); + NPC.value = Item.buyPrice(silver: 75); NPC.DeathSound = DeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -53,10 +52,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -79,8 +74,6 @@ namespace CalamityMod.NPCs.NormalNPCs if (NPC.velocity.Y == 0f) { - NPC.knockBackResist = 0f; - // Avoid cheap bullshit NPC.damage = 0; @@ -141,8 +134,6 @@ namespace CalamityMod.NPCs.NormalNPCs } else { - NPC.knockBackResist = 0.1f; - if (NPC.direction == 1 && NPC.velocity.X < 1f) { NPC.velocity.X += 0.1f; diff --git a/NPCs/NormalNPCs/ShockstormShuttle.cs b/NPCs/NormalNPCs/ShockstormShuttle.cs index c41c3b21dc..4d0f33e355 100644 --- a/NPCs/NormalNPCs/ShockstormShuttle.cs +++ b/NPCs/NormalNPCs/ShockstormShuttle.cs @@ -4,6 +4,7 @@ using CalamityMod.Items.Accessories.Vanity; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.Ores; +using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.Bestiary; @@ -28,12 +29,11 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 64; NPC.height = 38; NPC.defense = 15; - NPC.DR_NERD(0.15f); - NPC.lifeMax = 190; + NPC.lifeMax = 250; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.noGravity = true; @@ -42,10 +42,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -89,8 +85,8 @@ namespace CalamityMod.NPCs.NormalNPCs npcPos.X += velocity.X; npcPos.Y += velocity.Y; - int spread = Main.getGoodWorld ? 100 : 20; - for (int i = 0; i < (Main.getGoodWorld ? 10 : 2); i++) + int spread = 20; + for (int i = 0; i < 2; i++) { velocity = Main.player[NPC.target].Center - npcPos; targetDist = velocity.Length(); @@ -408,7 +404,7 @@ namespace CalamityMod.NPCs.NormalNPCs { return 0f; } - return SpawnCondition.Sky.Chance * (Main.getGoodWorld ? 0.5f : 0.1f); + return SpawnCondition.Sky.Chance * 0.1f; } public override void ModifyNPCLoot(NPCLoot npcLoot) diff --git a/NPCs/NormalNPCs/SkeletronPrime2.cs b/NPCs/NormalNPCs/SkeletronPrime2.cs deleted file mode 100644 index dcbd25f0ae..0000000000 --- a/NPCs/NormalNPCs/SkeletronPrime2.cs +++ /dev/null @@ -1,922 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.DataStructures; -using CalamityMod.Events; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.Chat; -using Terraria.GameContent.Achievements; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.NPCs.NormalNPCs -{ - [AutoloadBossHead] - public class SkeletronPrime2 : ModNPC - { - public override string BossHeadTexture => $"Terraria/Images/NPC_Head_Boss_18"; - - public static Asset EyeTexture; - - public const int BombTimeLeft = 600; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 6; - NPCID.Sets.NPCBestiaryDrawModifiers bestiaryData = new NPCID.Sets.NPCBestiaryDrawModifiers() { Hide = true }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(Type, bestiaryData); - if (!Main.dedServ) - { - EyeTexture = ModContent.Request("CalamityMod/ExtraTextures/SkeletronPrime2HeadGlow"); - } - } - - public override void SetDefaults() - { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.aiStyle = NPCAIStyleID.SkeletronPrimeHead; - NPC.GetNPCDamage(); - NPC.DR_NERD(0.2f); - - NPC.width = 80; - NPC.height = 102; - if (Main.tenthAnniversaryWorld) - NPC.scale *= 0.5f; - if (Main.getGoodWorld) - NPC.scale *= 1.1f; - - NPC.defense = 24; - NPC.lifeMax = 28000; - NPC.knockBackResist = 0f; - NPC.noGravity = true; - NPC.noTileCollide = true; - NPC.boss = true; - NPC.HitSound = SoundID.NPCHit4; - NPC.DeathSound = SoundID.NPCDeath14; - NPC.Calamity().VulnerableToElectricity = true; - NPC.Calamity().VulnerableToSickness = false; - AnimationType = NPCID.SkeletronPrime; - Music = MusicID.Boss3; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(NPC.localAI[0]); - writer.Write(NPC.localAI[1]); - writer.Write(NPC.localAI[2]); - writer.Write(NPC.localAI[3]); - for (int i = 0; i < 4; i++) - writer.Write(NPC.Calamity().newAI[i]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - NPC.localAI[0] = reader.ReadSingle(); - NPC.localAI[1] = reader.ReadSingle(); - NPC.localAI[2] = reader.ReadSingle(); - NPC.localAI[3] = reader.ReadSingle(); - for (int i = 0; i < 4; i++) - NPC.Calamity().newAI[i] = reader.ReadSingle(); - } - - public override void BossHeadRotation(ref float rotation) - { - rotation = (NPC.ai[1] == 1f || NPC.ai[1] == 2f) ? NPC.rotation : 0f; - } - - public override void AI() - { - CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - - // Percent life remaining - float lifeRatio = NPC.life / (float)NPC.lifeMax; - - // Spawn arms - if (calamityGlobalNPC.newAI[1] == 0f) - { - calamityGlobalNPC.newAI[1] = 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // This head owns the Cannon and the Vice in Master Mode - int arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeCannon, NPC.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = NPC.whoAmI; - Main.npc[arm].target = NPC.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y, NPCID.PrimeVice, NPC.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = NPC.whoAmI; - Main.npc[arm].target = NPC.target; - Main.npc[arm].ai[3] = 150f; - Main.npc[arm].netUpdate = true; - } - - NPC.SyncExtraAI(); - } - - if (!Main.npc[(int)NPC.ai[0]].active || Main.npc[(int)NPC.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - NPC.life = 0; - NPC.HitEffect(); - NPC.active = false; - NPC.netUpdate = true; - } - else - { - // Set direction to the other head's direction - NPC.direction = Main.npc[(int)NPC.ai[0]].direction; - - // Link the HP of both heads - if (NPC.life > Main.npc[(int)NPC.ai[0]].life) - NPC.life = Main.npc[(int)NPC.ai[0]].life; - - // Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real - if (!NPC.IsMechQueenUp) - { - float pushVelocity = 0.25f; - if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) < 80f * NPC.scale) - { - if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X) - NPC.velocity.X -= pushVelocity; - else - NPC.velocity.X += pushVelocity; - - if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y) - NPC.velocity.Y -= pushVelocity; - else - NPC.velocity.Y += pushVelocity; - } - else if (Vector2.Distance(NPC.Center, Main.npc[(int)NPC.ai[0]].Center) > 240f * NPC.scale) - { - if (NPC.position.X < Main.npc[(int)NPC.ai[0]].position.X) - NPC.velocity.X += pushVelocity; - else - NPC.velocity.X -= pushVelocity; - - if (NPC.position.Y < Main.npc[(int)NPC.ai[0]].position.Y) - NPC.velocity.Y += pushVelocity; - else - NPC.velocity.Y -= pushVelocity; - } - } - } - - // Check if arms are alive - bool cannonAlive = false; - bool laserAlive = false; - bool viceAlive = false; - bool sawAlive = false; - if (CalamityGlobalNPC.primeCannon != -1) - { - if (Main.npc[CalamityGlobalNPC.primeCannon].active) - cannonAlive = true; - } - if (CalamityGlobalNPC.primeLaser != -1) - { - if (Main.npc[CalamityGlobalNPC.primeLaser].active) - laserAlive = true; - } - if (CalamityGlobalNPC.primeVice != -1) - { - if (Main.npc[CalamityGlobalNPC.primeVice].active) - viceAlive = true; - } - if (CalamityGlobalNPC.primeSaw != -1) - { - if (Main.npc[CalamityGlobalNPC.primeSaw].active) - sawAlive = true; - } - bool allArmsDead = !cannonAlive && !laserAlive && !viceAlive && !sawAlive; - NPC.chaseable = allArmsDead; - - NPC.defense = NPC.defDefense; - - // Phases - bool phase2 = lifeRatio < 0.66f; - bool phase3 = lifeRatio < 0.33f; - bool spawnSpazmatism = lifeRatio < 0.5f && !bossRush && NPC.localAI[2] == 0f; - - // Spawn Spazmatism in Master Mode (just like Oblivion from Avalon) - if (spawnSpazmatism) - { - Player spazmatismSpawnPlayer = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)]; - SoundEngine.PlaySound(SoundID.Roar, spazmatismSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int spazmatism = NPC.NewNPC(NPC.GetBossSpawnSource(spazmatismSpawnPlayer.whoAmI), (int)spazmatismSpawnPlayer.Center.X, (int)spazmatismSpawnPlayer.Center.Y - 810, NPCID.Retinazer, 1); - if (spazmatism != Main.maxNPCs) - { - Main.npc[spazmatism].target = spazmatismSpawnPlayer.whoAmI; - Main.npc[spazmatism].timeLeft *= 20; - Main.npc[spazmatism].localAI[3] = 1f; - Main.npc[spazmatism].SyncVanillaLocalAI(); - string typeName = Main.npc[spazmatism].TypeName; - if (Main.dedServ && spazmatism < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, spazmatism); - - AchievementsHelper.CheckMechaMayhem(); - } - } - - NPC.localAI[2] = 1f; - NPC.SyncVanillaLocalAI(); - } - - // Despawn - if (Main.npc[(int)NPC.ai[0]].ai[1] == 3f) - NPC.ai[1] = 3f; - - // Activate daytime enrage - if (Main.IsItDay() && !bossRush && NPC.ai[1] != 3f && NPC.ai[1] != 2f) - { - // Heal - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int healAmt = NPC.life - 300; - if (healAmt < 0) - { - int absHeal = Math.Abs(healAmt); - NPC.life += absHeal; - NPC.HealEffect(absHeal, true); - NPC.netUpdate = true; - } - } - - NPC.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); - } - - // Adjust slowing debuff immunity - bool immuneToSlowingDebuffs = NPC.ai[1] == 5f; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; - NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; - - bool normalLaserRotation = NPC.localAI[1] % 2f == 0f; - - // Prevents cheap hits - bool canUseAttackInMaster = NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 350f; - - // Float near player - if (NPC.ai[1] == 0f || NPC.ai[1] == 4f) - { - // Avoid unfair bullshit - NPC.damage = 0; - - // Start other phases; if arms are dead, start with spin phase - bool otherHeadChargingOrSpinning = Main.npc[(int)NPC.ai[0]].ai[1] == 5f || Main.npc[(int)NPC.ai[0]].ai[1] == 1f; - - // Start spin phase after 1.875 seconds - NPC.ai[2] += phase3 ? 1.2f : 0.8f; - if (NPC.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || phase3) && canUseAttackInMaster) - { - bool shouldSpinAround = NPC.ai[1] == 4f && NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - 320f && - Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) < 600f && Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 400f; - - bool shouldCharge = !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; - if (shouldCharge) - { - NPC.ai[2] = 0f; - NPC.ai[1] = 1f; - NPC.netUpdate = true; - } - else if (shouldSpinAround || NPC.ai[1] != 4f) - { - if (shouldSpinAround) - { - NPC.localAI[3] = 300f; - NPC.SyncVanillaLocalAI(); - } - - NPC.ai[2] = 0f; - NPC.ai[1] = shouldSpinAround ? 5f : 1f; - NPC.netUpdate = true; - } - } - - if (NPC.IsMechQueenUp) - NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); - else - NPC.rotation = NPC.velocity.X / 15f; - - float acceleration = (bossRush ? 0.16f : 0.12f) + (death ? 0.05f * (1f - lifeRatio) : 0f); - float accelerationMult = 1f; - if (!cannonAlive) - { - acceleration += 0.0125f; - accelerationMult += 0.25f; - } - if (!laserAlive) - { - acceleration += 0.0125f; - accelerationMult += 0.25f; - } - if (!viceAlive) - acceleration += 0.0125f; - if (!sawAlive) - acceleration += 0.0125f; - acceleration *= accelerationMult; - - float topVelocity = acceleration * 100f; - float deceleration = 0.7f; - - float headDecelerationUpDist = 0f; - float headDecelerationDownDist = 0f; - float headDecelerationHorizontalDist = 0f; - int headHorizontalDirection = ((!(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X < NPC.Center.X)) ? 1 : (-1)); - if (NPC.IsMechQueenUp) - { - headDecelerationHorizontalDist = -150f * (float)headHorizontalDirection; - headDecelerationUpDist = 50f; - headDecelerationDownDist = 50f; - } - - if (NPC.position.Y > Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (320f + headDecelerationUpDist)) - { - if (NPC.velocity.Y > 0f) - NPC.velocity.Y *= deceleration; - - NPC.velocity.Y -= acceleration; - - if (NPC.velocity.Y > topVelocity) - NPC.velocity.Y = topVelocity; - } - else if (NPC.position.Y < Main.player[Main.npc[(int)NPC.ai[0]].target].position.Y - (360f + headDecelerationDownDist)) - { - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= deceleration; - - NPC.velocity.Y += acceleration; - - if (NPC.velocity.Y < -topVelocity) - NPC.velocity.Y = -topVelocity; - } - - if (NPC.Center.X > Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X + (400f + headDecelerationHorizontalDist)) - { - if (NPC.velocity.X > 0f) - NPC.velocity.X *= deceleration; - - NPC.velocity.X -= acceleration; - - if (NPC.velocity.X > topVelocity) - NPC.velocity.X = topVelocity; - } - if (NPC.Center.X < Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - (400f + headDecelerationHorizontalDist)) - { - if (NPC.velocity.X < 0f) - NPC.velocity.X *= deceleration; - - NPC.velocity.X += acceleration; - - if (NPC.velocity.X < -topVelocity) - NPC.velocity.X = -topVelocity; - } - } - - else - { - // Spinning - if (NPC.ai[1] == 1f) - { - NPC.defense *= 2; - NPC.damage = NPC.defDamage * 2; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; - - if (phase2 && Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= 60f) - { - NPC.localAI[0] = 0f; - - int totalProjectiles = bossRush ? 20 : death ? 12 : 10; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ProjectileID.FrostBeam; - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - float velocity = 4.5f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 140f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[proj].timeLeft = 600; - } - NPC.localAI[1] += 1f; - } - } - - NPC.ai[2] += 1f; - if (NPC.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); - - // Spin for 3 seconds then return to floating phase - float phaseTimer = 240f; - if (phase2 && !phase3) - phaseTimer += 60f; - - if (NPC.ai[2] >= (phaseTimer - (death ? 60f * (1f - lifeRatio) : 0f))) - { - NPC.ai[2] = 0f; - NPC.ai[1] = 4f; - NPC.localAI[0] = 0f; - } - - if (NPC.IsMechQueenUp) - NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); - else - NPC.rotation += NPC.direction * 0.3f; - - Vector2 headPosition = NPC.Center; - float headTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headPosition.X; - float headTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headPosition.Y; - float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); - - float speed = bossRush ? 12f : 8f; - if (phase2) - speed += 0.5f; - if (phase3) - speed += 0.5f; - - if (headTargetDistance > 150f) - { - float baseDistanceVelocityMult = 1f + MathHelper.Clamp((headTargetDistance - 150f) * 0.0015f, 0.05f, 1.5f); - speed *= baseDistanceVelocityMult; - } - - if (NPC.IsMechQueenUp) - { - float mechdusaSpeedMult = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); - speed *= mechdusaSpeedMult; - } - - headTargetDistance = speed / headTargetDistance; - NPC.velocity.X = headTargetX * headTargetDistance; - NPC.velocity.Y = headTargetY * headTargetDistance; - - if (NPC.IsMechQueenUp) - { - float mechdusaAccelMult = Vector2.Distance(NPC.Center, Main.player[Main.npc[(int)NPC.ai[0]].target].Center); - if (mechdusaAccelMult < 0.1f) - mechdusaAccelMult = 0f; - - if (mechdusaAccelMult < speed) - NPC.velocity = NPC.velocity.SafeNormalize(Vector2.Zero) * mechdusaAccelMult; - } - } - - // Daytime enrage - if (NPC.ai[1] == 2f) - { - NPC.damage = 1000; - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - - calamityGlobalNPC.CurrentlyEnraged = true; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; - - if (NPC.IsMechQueenUp) - NPC.rotation = NPC.rotation.AngleLerp(NPC.velocity.X / 15f * 0.5f, 0.75f); - else - NPC.rotation += NPC.direction * 0.3f; - - Vector2 enragedHeadPosition = NPC.Center; - float enragedHeadTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - enragedHeadPosition.X; - float enragedHeadTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - enragedHeadPosition.Y; - float enragedHeadTargetDist = (float)Math.Sqrt(enragedHeadTargetX * enragedHeadTargetX + enragedHeadTargetY * enragedHeadTargetY); - - float enragedHeadSpeed = 10f; - enragedHeadSpeed += enragedHeadTargetDist / 100f; - if (enragedHeadSpeed < 8f) - enragedHeadSpeed = 8f; - if (enragedHeadSpeed > 32f) - enragedHeadSpeed = 32f; - - enragedHeadTargetDist = enragedHeadSpeed / enragedHeadTargetDist; - NPC.velocity.X = enragedHeadTargetX * enragedHeadTargetDist; - NPC.velocity.Y = enragedHeadTargetY * enragedHeadTargetDist; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - NPC.localAI[0] += 1f; - if (NPC.localAI[0] >= 60f) - { - NPC.localAI[0] = 0f; - Vector2 headCenter = NPC.Center; - if (Collision.CanHit(headCenter, 1, 1, Main.player[Main.npc[(int)NPC.ai[0]].target].position, Main.player[Main.npc[(int)NPC.ai[0]].target].width, Main.player[Main.npc[(int)NPC.ai[0]].target].height)) - { - enragedHeadSpeed = 7f; - float enragedHeadSkullTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); - float enragedHeadSkullTargetDist = (float)Math.Sqrt(enragedHeadSkullTargetX * enragedHeadSkullTargetX + enragedHeadSkullTargetY * enragedHeadSkullTargetY); - enragedHeadSkullTargetDist = enragedHeadSpeed / enragedHeadSkullTargetDist; - enragedHeadSkullTargetX *= enragedHeadSkullTargetDist; - enragedHeadSkullTargetY *= enragedHeadSkullTargetDist; - - Vector2 value = new Vector2(enragedHeadSkullTargetX * 1f + Main.rand.Next(-50, 51) * 0.01f, enragedHeadSkullTargetY * 1f + Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); - value *= enragedHeadSpeed; - value += NPC.velocity; - enragedHeadSkullTargetX = value.X; - enragedHeadSkullTargetY = value.Y; - - int type = ProjectileID.Skull; - headCenter += value * 5f; - int enragedSkulls = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, 250, 0f, Main.myPlayer, -1f, 0f); - Main.projectile[enragedSkulls].timeLeft = 300; - } - } - } - } - - // Despawning - if (NPC.ai[1] == 3f) - { - // Avoid unfair bullshit - NPC.damage = 0; - - if (NPC.IsMechQueenUp) - { - int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].EncourageDespawn(5); - - mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Spazmatism); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].EncourageDespawn(5); - - if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) - { - mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.TheDestroyer); - if (mechdusaBossDespawning >= 0) - Main.npc[mechdusaBossDespawning].Transform(NPCID.TheDestroyerTail); - - NPC.EncourageDespawn(5); - } - - NPC.velocity.Y += 0.1f; - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= 0.95f; - - NPC.velocity.X *= 0.95f; - if (NPC.velocity.Y > 13f) - NPC.velocity.Y = 13f; - } - else - { - NPC.velocity.Y += 0.1f; - if (NPC.velocity.Y < 0f) - NPC.velocity.Y *= 0.9f; - - NPC.velocity.X *= 0.9f; - - if (NPC.timeLeft > 500) - NPC.timeLeft = 500; - } - } - - // Fly around in a circle - if (NPC.ai[1] == 5f) - { - // Avoid unfair bullshit - NPC.damage = 0; - - NPC.ai[2] += 1f; - - NPC.rotation = NPC.velocity.X / 50f; - - float bombSpawnDivisor = bossRush ? 14f : death ? 22f - (float)Math.Round(5f * (1f - lifeRatio)) : 22f; - float totalBombs = 6f; - int bombSpread = bossRush ? 250 : death ? 125 : 100; - - // Spin for about 3 seconds - float spinVelocity = 24f; - if (NPC.ai[2] == 2f) - { - // Play angry noise - SoundEngine.PlaySound(SoundID.ForceRoar, NPC.Center); - - // Set spin direction - if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X > 0f) - calamityGlobalNPC.newAI[0] = 1f; - else if (Main.player[Main.npc[(int)NPC.ai[0]].target].velocity.X < 0f) - calamityGlobalNPC.newAI[0] = -1f; - else - calamityGlobalNPC.newAI[0] = Main.player[Main.npc[(int)NPC.ai[0]].target].direction; - - // Set spin velocity - NPC.velocity.X = MathHelper.Pi * NPC.localAI[3] / spinVelocity; - NPC.velocity *= -calamityGlobalNPC.newAI[0]; - NPC.SyncExtraAI(); - NPC.netUpdate = true; - } - - // Maintain velocity and spit homing bombs - else if (NPC.ai[2] > 2f) - { - NPC.velocity = NPC.velocity.RotatedBy(MathHelper.Pi / spinVelocity * -calamityGlobalNPC.newAI[0]); - if (NPC.ai[2] == 3f) - NPC.velocity *= 0.6f; - - if (NPC.ai[2] % bombSpawnDivisor == 0f) - { - NPC.localAI[0] += 1f; - - if (Vector2.Distance(Main.player[Main.npc[(int)NPC.ai[0]].target].Center, NPC.Center) > 64f) - { - SoundEngine.PlaySound(SoundID.Item61, NPC.Center); - CreateParticles(NPC, new Vector2(NPC.Center.X + Main.rand.Next(NPC.width / 2), NPC.Center.Y + 4f)); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 headCenter = NPC.Center; - float enragedHeadSpeed = 6f + (death ? 2f * (1f - lifeRatio) : 0f); - float enragedHeadBombTargetX = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X - headCenter.X + Main.rand.Next(-20, 21); - float enragedHeadBombTargetY = Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - headCenter.Y + Main.rand.Next(-20, 21); - float enragedHeadBombTargetDist = (float)Math.Sqrt(enragedHeadBombTargetX * enragedHeadBombTargetX + enragedHeadBombTargetY * enragedHeadBombTargetY); - enragedHeadBombTargetDist = enragedHeadSpeed / enragedHeadBombTargetDist; - enragedHeadBombTargetX *= enragedHeadBombTargetDist; - enragedHeadBombTargetY *= enragedHeadBombTargetDist; - - Vector2 value = new Vector2(enragedHeadBombTargetX + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f, enragedHeadBombTargetY + Main.rand.Next(-bombSpread, bombSpread + 1) * 0.01f).SafeNormalize(Vector2.UnitY); - value *= enragedHeadSpeed; - enragedHeadBombTargetX = value.X; - enragedHeadBombTargetY = value.Y; - - int type = ProjectileID.BombSkeletronPrime; - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - int enragedBombs = Projectile.NewProjectile(NPC.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadBombTargetX, enragedHeadBombTargetY, type, damage, 0f, Main.myPlayer, -1f); - Main.projectile[enragedBombs].timeLeft = BombTimeLeft; - Main.projectile[enragedBombs].tileCollide = false; - } - } - - // Go to floating phase, or spinning phase if in phase 2 - if (NPC.localAI[0] >= totalBombs) - { - NPC.velocity = NPC.velocity.SafeNormalize(Vector2.UnitY); - - // Fly overhead and spit spreads of bombs into the air if on low health - NPC.ai[1] = phase3 ? 6f : 1f; - NPC.ai[2] = 0f; - NPC.localAI[3] = 0f; - NPC.localAI[0] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - NPC.SyncVanillaLocalAI(); - NPC.SyncExtraAI(); - NPC.netUpdate = true; - } - } - } - } - - // Fly overhead and spit bombs - if (NPC.ai[1] == 6f) - { - // Avoid unfair bullshit - NPC.damage = 0; - - NPC.rotation = NPC.velocity.X / 15f; - - float flightVelocity = bossRush ? 28f : death ? 25f : 22f; - float flightAcceleration = bossRush ? 1.16f : death ? 0.96f : 0.76f; - - Vector2 destination = new Vector2(Main.player[Main.npc[(int)NPC.ai[0]].target].Center.X, Main.player[Main.npc[(int)NPC.ai[0]].target].Center.Y - 420f); - NPC.SimpleFlyMovement((destination - NPC.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); - - // Spit bombs and then go to floating phase - NPC.localAI[3] += 1f; - if (Vector2.Distance(NPC.Center, destination) < 160f || NPC.ai[2] > 0f || NPC.localAI[3] > 120f) - { - float bombSpawnDivisor = death ? 50f : 60f; - float totalBombSpreads = 2f; - NPC.ai[2] += 1f; - if (NPC.ai[2] % bombSpawnDivisor == 0f) - { - NPC.localAI[0] += 1f; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = bossRush ? 24 : 12; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ProjectileID.BombSkeletronPrime; - int damage = NPC.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - float velocity = 12f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = normalLaserRotation ? new Vector2(0f, -velocity) : new Vector2(-velocityX, -velocity); - Vector2 upwardVelocity = Vector2.UnitY * velocity; - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 bombVelocity = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f + bombVelocity.SafeNormalize(Vector2.UnitY) * 15f, bombVelocity - upwardVelocity, type, damage, 0f, Main.myPlayer, -2f); - Main.projectile[proj].timeLeft = BombTimeLeft; - Main.projectile[proj].tileCollide = false; - } - NPC.localAI[1] += 1f; - } - - SoundEngine.PlaySound(SoundID.Item62, NPC.Center); - CreateParticles(NPC, new Vector2(NPC.Center.X, NPC.Center.Y + 4f), 5); - - if (NPC.localAI[0] >= totalBombSpreads) - { - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.localAI[3] = 0f; - calamityGlobalNPC.newAI[0] = 0f; - NPC.localAI[0] = 0f; - NPC.SyncVanillaLocalAI(); - NPC.SyncExtraAI(); - NPC.netUpdate = true; - } - } - } - } - } - } - - private void CreateParticles(NPC npc, Vector2 position, int amountMultiplier = 1) - { - int firstDustCloudParticleAmount = 30 * amountMultiplier; - int secondDustCloudParticleAmount = 20 * amountMultiplier; - int goreAmount = 2 * amountMultiplier; - - for (int dustIndex = 0; dustIndex < firstDustCloudParticleAmount; dustIndex++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[dust].velocity *= 1.4f; - } - - for (int dustIndex = 0; dustIndex < secondDustCloudParticleAmount; dustIndex++) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 3.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 7f; - dust = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[dust].velocity *= 3f; - } - - for (int goreIndex = 0; goreIndex < goreAmount; goreIndex++) - { - float goreVelocityMultiplier = 0.4f; - if (goreIndex >= goreAmount / 2) - goreVelocityMultiplier = 0.8f; - - int gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= goreVelocityMultiplier; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y += 1f; - gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= goreVelocityMultiplier; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y += 1f; - gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= goreVelocityMultiplier; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y -= 1f; - gore = Gore.NewGore(npc.GetSource_FromAI(), npc.Center, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= goreVelocityMultiplier; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y -= 1f; - } - } - - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; - - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) - { - NPC.lifeMax = (int)(NPC.lifeMax * 0.75f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override bool CheckActive() => false; - - public override bool CheckDead() - { - // Kill the lead head if he's still alive when this head dies - for (int i = 0; i < Main.maxNPCs; i++) - { - NPC nPC = Main.npc[i]; - if (nPC.active && nPC.type == NPCID.SkeletronPrime && nPC.life > 0) - { - nPC.life = 0; - nPC.HitEffect(); - nPC.checkDead(); - nPC.active = false; - nPC.netUpdate = true; - } - } - - return true; - } - - public override void HitEffect(NPC.HitInfo hit) - { - if (NPC.life <= 0) - { - if (!Main.dedServ) - { - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_1").Type, NPC.scale); - Gore.NewGore(NPC.GetSource_Death(), NPC.position, NPC.velocity, Mod.Find("SkeletronPrime2_2").Type, NPC.scale); - - int gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y += 1f; - - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y += 1f; - - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X += 1f; - Main.gore[gore].velocity.Y -= 1f; - - gore = Gore.NewGore(NPC.GetSource_Death(), NPC.position, default(Vector2), Main.rand.Next(61, 64)); - Main.gore[gore].velocity *= 0.4f; - Main.gore[gore].velocity.X -= 1f; - Main.gore[gore].velocity.Y -= 1f; - } - - for (int i = 0; i < 10; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[dust].velocity *= 1.4f; - } - - for (int i = 0; i < 5; i++) - { - int dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 5f; - - dust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Torch, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[dust].velocity *= 3f; - } - } - } - } -} diff --git a/NPCs/NormalNPCs/SkeletronPrime2.png b/NPCs/NormalNPCs/SkeletronPrime2.png deleted file mode 100644 index c019c31308..0000000000 Binary files a/NPCs/NormalNPCs/SkeletronPrime2.png and /dev/null differ diff --git a/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png b/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png deleted file mode 100644 index 38362cb253..0000000000 Binary files a/NPCs/NormalNPCs/SkeletronPrime2_Head_Boss.png and /dev/null differ diff --git a/NPCs/NormalNPCs/Stormlion.cs b/NPCs/NormalNPCs/Stormlion.cs index 54d7a9714c..9616633e81 100644 --- a/NPCs/NormalNPCs/Stormlion.cs +++ b/NPCs/NormalNPCs/Stormlion.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 100; NPC.knockBackResist = 0.2f; AnimationType = NPCID.WalkingAntlion; - NPC.value = Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = HitSound; NPC.DeathSound = DeathSound; Banner = NPC.type; @@ -39,10 +39,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/Sunskater.cs b/NPCs/NormalNPCs/Sunskater.cs index d866ccbd01..8b5242520f 100644 --- a/NPCs/NormalNPCs/Sunskater.cs +++ b/NPCs/NormalNPCs/Sunskater.cs @@ -34,10 +34,10 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 58; NPC.height = 22; NPC.defense = 4; - NPC.lifeMax = 125; + NPC.lifeMax = 160; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(silver: 3); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = Main.zenithWorld ? AresGaussNuke.NukeExplosionSound : DeathSound; NPC.knockBackResist = 0.7f; @@ -47,10 +47,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/NormalNPCs/SuperDummyNPC.cs b/NPCs/NormalNPCs/SuperDummyNPC.cs index f5a06984a4..d910753482 100644 --- a/NPCs/NormalNPCs/SuperDummyNPC.cs +++ b/NPCs/NormalNPCs/SuperDummyNPC.cs @@ -28,7 +28,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.lifeMax = 9999999; NPC.HitSound = null; NPC.DeathSound = SoundID.NPCDeath2; - NPC.value = 0f; NPC.knockBackResist = 0f; NPC.netAlways = true; NPC.aiStyle = NPCAIStyleID.FaceClosestPlayer; @@ -62,7 +61,8 @@ namespace CalamityMod.NPCs.NormalNPCs public override void UpdateLifeRegen(ref int damage) { - NPC.lifeRegen += 2000000; + if (NPC.lifeRegen >= 0) + NPC.lifeRegen += 2000000; } public override bool CanHitPlayer(Player target, ref int cooldownSlot) => Main.zenithWorld; diff --git a/NPCs/NormalNPCs/WildBumblebirb.cs b/NPCs/NormalNPCs/WildBumblebirb.cs new file mode 100644 index 0000000000..6734a6b014 --- /dev/null +++ b/NPCs/NormalNPCs/WildBumblebirb.cs @@ -0,0 +1,376 @@ +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Sounds; +using CalamityMod.World; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; + +namespace CalamityMod.NPCs.NormalNPCs +{ + public class WildBumblebirb : ModNPC + { + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 5; + NPCID.Sets.TrailingMode[Type] = 1; + NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() + { + Position = Vector2.UnitX * 36f + }; + NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + } + + public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; + + public override void SetDefaults() + { + NPC.npcSlots = 1f; + NPC.aiStyle = -1; + AIType = -1; + NPC.damage = 90; + NPC.width = 120; + NPC.height = 80; + NPC.defense = 20; + NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 + NPC.knockBackResist = 0.15f; + NPC.lavaImmune = true; + NPC.noTileCollide = true; + NPC.noGravity = true; + NPC.HitSound = SoundID.NPCHit51; + NPC.DeathSound = SoundID.NPCDeath46; + Banner = NPC.type; + BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck") + }); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle) + return 0f; + + // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. + if (NPC.AnyNPCs(NPC.type)) + return 0f; + + return SpawnCondition.SurfaceJungle.Chance * 0.14f; + } + + public override void AI() + { + Player player = Main.player[NPC.target]; + + float rotationMult = 4f; + float rotationAmt = 0.04f; + + if (Vector2.Distance(player.Center, NPC.Center) > 5600f) + { + if (NPC.timeLeft > 5) + NPC.timeLeft = 5; + } + + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt * 1.25f) / 10f; + + if (NPC.ai[0] == 0f || NPC.ai[0] == 1f) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + if (i != NPC.whoAmI && Main.npc[i].active && Main.npc[i].type == NPC.type) + { + Vector2 otherSwarmerDirection = Main.npc[i].Center - NPC.Center; + if (otherSwarmerDirection.Length() < (NPC.width + NPC.height)) + { + otherSwarmerDirection.Normalize(); + otherSwarmerDirection *= -0.1f; + NPC.velocity += otherSwarmerDirection; + NPC nPC6 = Main.npc[i]; + nPC6.velocity -= otherSwarmerDirection; + } + } + } + } + + if (NPC.target < 0 || Main.player[NPC.target].dead || !Main.player[NPC.target].active) + { + NPC.TargetClosest(true); + Vector2 swarmerTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (Main.player[NPC.target].dead || swarmerTargetDist.Length() > 2800f) + NPC.ai[0] = -1f; + } + else + { + Vector2 swarmerCatchUpTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (NPC.ai[0] > 1f && swarmerCatchUpTargetDist.Length() > 3600f) + NPC.ai[0] = 1f; + } + + if (NPC.ai[0] == -1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + Vector2 swarmerDespawnVelMult = new Vector2(0f, -8f); + NPC.velocity = (NPC.velocity * 21f + swarmerDespawnVelMult) / 10f; + return; + } + + if (NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.TargetClosest(true); + NPC.spriteDirection = NPC.direction; + + Vector2 swarmerIdleTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerIdleTargetDist.Length() > 2800f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + else if (swarmerIdleTargetDist.Length() > 400f) + { + float swarmerIdleSpeed = 7f + swarmerIdleTargetDist.Length() / 100f + NPC.ai[1] / 15f; + swarmerIdleTargetDist.Normalize(); + swarmerIdleTargetDist *= swarmerIdleSpeed; + NPC.velocity = (NPC.velocity * 29f + swarmerIdleTargetDist) / 30f; + } + else if (NPC.velocity.Length() > 2f) + NPC.velocity *= 0.95f; + else if (NPC.velocity.Length() < 1f) + NPC.velocity *= 1.05f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] >= 105f) + { + NPC.ai[1] = 0f; + NPC.ai[0] = 2f; + } + } + else + { + if (NPC.ai[0] == 1f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.target < 0 || !Main.player[NPC.target].active || Main.player[NPC.target].dead) + NPC.TargetClosest(true); + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult + NPC.velocity.X * rotationAmt) / 10f; + + Vector2 swarmerChargeTargetDist = Main.player[NPC.target].Center - NPC.Center; + if (swarmerChargeTargetDist.Length() < 800f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + } + + NPC.ai[2] += 0.0166666675f; + float swarmerChargeSpeed = 9f + NPC.ai[2] + swarmerChargeTargetDist.Length() / 150f; + float swarmerChargeVelMult = 25f; + swarmerChargeTargetDist.Normalize(); + swarmerChargeTargetDist *= swarmerChargeSpeed; + NPC.velocity = (NPC.velocity * (swarmerChargeVelMult - 1f) + swarmerChargeTargetDist) / swarmerChargeVelMult; + + NPC.ForceNetUpdate(); + + return; + } + + if (NPC.ai[0] == 2f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + NPC.rotation = (NPC.rotation * rotationMult * 0.75f + NPC.velocity.X * rotationAmt * 1.25f) / 8f; + + Vector2 swarmerDecelerateTargetDist = Main.player[NPC.target].Center - NPC.Center; + swarmerDecelerateTargetDist.Y -= 8f; + float swarmerDecelerateSpeed = 14f; + float swarmerDecelerateVelMult = 8f; + swarmerDecelerateTargetDist.Normalize(); + swarmerDecelerateTargetDist *= swarmerDecelerateSpeed; + NPC.velocity = (NPC.velocity * (swarmerDecelerateVelMult - 1f) + swarmerDecelerateTargetDist) / swarmerDecelerateVelMult; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 10f) + { + // Set damage + NPC.damage = NPC.defDamage; + + NPC.velocity = swarmerDecelerateTargetDist; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else + NPC.direction = 1; + + NPC.ai[0] = 2.1f; + NPC.ai[1] = 0f; + } + } + else if (NPC.ai[0] == 2.1f) + { + // Set damage + NPC.damage = NPC.defDamage; + + if (NPC.velocity.X < 0f) + NPC.direction = -1; + else if (NPC.velocity.X > 0f) + NPC.direction = 1; + + NPC.spriteDirection = NPC.direction; + + NPC.velocity *= 1.01f; + + NPC.ai[1] += 1f; + if (NPC.ai[1] > 30f) + { + if (!Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + return; + } + + if (NPC.ai[1] > 60f) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + } + } + } + } + + public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); + public override void OnKill() + { + if (Main.zenithWorld) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + for (int i = 0; i < 5; i++) + { + Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); + Vector2 ai0 = NPC.Center - fireFrom; + float ai = Main.rand.Next(100); + Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), 45, 0f, Main.myPlayer, ai0.ToRotation(), ai); + } + } + } + } + + public override void FindFrame(int frameHeight) + { + NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; + if (Main.zenithWorld) + { + NPC.frameCounter += 2D; + } + if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base + { + NPC.frameCounter = 0D; + NPC.frame.Y += frameHeight; + } + if (NPC.frame.Y >= frameHeight * 4) + { + NPC.frame.Y = 0; + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + SpriteEffects spriteEffects = SpriteEffects.None; + if (NPC.spriteDirection == 1) + spriteEffects = SpriteEffects.FlipHorizontally; + + Texture2D texture2D15 = TextureAssets.Npc[Type].Value; + Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); + int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; + + if (CalamityClientConfig.Instance.Afterimages) + { + for (int i = 1; i < afterimageAmt; i += 2) + { + Color afterimageColor = drawColor; + afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); + afterimageColor = NPC.GetAlpha(afterimageColor); + afterimageColor *= (afterimageAmt - i) / 15f; + Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; + afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + } + } + + Vector2 drawLocation = NPC.Center - screenPos; + drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; + drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); + spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + + return false; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 50; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + } +} diff --git a/NPCs/NormalNPCs/WildBumblefuck.cs b/NPCs/NormalNPCs/WildBumblefuck.cs deleted file mode 100644 index b0be162495..0000000000 --- a/NPCs/NormalNPCs/WildBumblefuck.cs +++ /dev/null @@ -1,173 +0,0 @@ -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Sounds; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ModLoader.Utilities; - -namespace CalamityMod.NPCs.NormalNPCs -{ - public class WildBumblefuck : ModNPC - { - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 5; - NPCID.Sets.TrailingMode[Type] = 1; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Position = Vector2.UnitX * 36f - }; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - } - - public override string Texture => "CalamityMod/NPCs/Bumblebirb/BumbleFolly"; - - public override void SetDefaults() - { - NPC.npcSlots = 1f; - NPC.aiStyle = -1; - AIType = -1; - NPC.damage = 90; - NPC.width = 120; - NPC.height = 80; - NPC.defense = 20; - NPC.LifeMaxNERB(9375, 11250, 5000); // Old HP - 12000, 15000 - NPC.knockBackResist = 0.15f; - NPC.lavaImmune = true; - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.HitSound = SoundID.NPCHit51; - NPC.DeathSound = SoundID.NPCDeath46; - Banner = NPC.type; - BannerItem = ModContent.ItemType(); - NPC.Calamity().VulnerableToHeat = true; - NPC.Calamity().VulnerableToCold = true; - NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.Jungle, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.WildBumblefuck") - }); - } - - public override float SpawnChance(NPCSpawnInfo spawnInfo) - { - if (spawnInfo.PlayerSafe || !NPC.downedMoonlord || spawnInfo.Player.Calamity().ZoneSunkenSea || !spawnInfo.Player.ZoneJungle) - return 0f; - - // Keep this as a separate if check, because it's a loop and we don't want to be checking it constantly. - if (NPC.AnyNPCs(NPC.type)) - return 0f; - - return SpawnCondition.SurfaceJungle.Chance * 0.14f; - } - - public override void AI() - { - BumblebirbAI.VanillaBumblebirb2AI(NPC, Mod, false); - } - - public override void ModifyNPCLoot(NPCLoot npcLoot) => npcLoot.Add(ModContent.ItemType(), 1, 5, 7); - public override void OnKill() - { - if (Main.zenithWorld) - { - SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, NPC.Center - Vector2.UnitY * 300f); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int i = 0; i < 5; i++) - { - Vector2 fireFrom = new Vector2(NPC.Center.X + (40 * i) - 120, NPC.Center.Y - 900f); - Vector2 ai0 = NPC.Center - fireFrom; - float ai = Main.rand.Next(100); - Vector2 velocity = Vector2.Normalize(ai0.RotatedByRandom(MathHelper.PiOver4)) * 7f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom.X, fireFrom.Y, velocity.X, velocity.Y, ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer, ai0.ToRotation(), ai); - } - } - } - } - - public override void FindFrame(int frameHeight) - { - NPC.frameCounter += NPC.ai[0] == 2.1f ? 1.5 : 1D; - if (Main.zenithWorld) - { - NPC.frameCounter += 2D; - } - if (NPC.frameCounter > 4D) //iban said the time between frames was 5 so using that as a base - { - NPC.frameCounter = 0D; - NPC.frame.Y += frameHeight; - } - if (NPC.frame.Y >= frameHeight * 4) - { - NPC.frame.Y = 0; - } - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2(TextureAssets.Npc[Type].Value.Width / 2, TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2); - int afterimageAmt = NPC.ai[0] == 2.1f ? 7 : 0; - - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 1; i < afterimageAmt; i += 2) - { - Color afterimageColor = drawColor; - afterimageColor = Color.Lerp(afterimageColor, Color.Gold, 0.5f); - afterimageColor = NPC.GetAlpha(afterimageColor); - afterimageColor *= (afterimageAmt - i) / 15f; - Vector2 afterimagePos = NPC.oldPos[i] + new Vector2(NPC.width, NPC.height) / 2f - screenPos; - afterimagePos -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - afterimagePos += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, afterimagePos, NPC.frame, afterimageColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - } - } - - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2(texture2D15.Width, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; - drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - - return false; - } - - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - if (NPC.life <= 0) - { - for (int k = 0; k < 50; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.CopperCoin, hit.HitDirection, -1f, 0, default, 1f); - } - } - } - } -} diff --git a/NPCs/NormalNPCs/WulfrumAmplifier.cs b/NPCs/NormalNPCs/WulfrumAmplifier.cs index 80a086b0d8..525ddc4bdb 100644 --- a/NPCs/NormalNPCs/WulfrumAmplifier.cs +++ b/NPCs/NormalNPCs/WulfrumAmplifier.cs @@ -51,9 +51,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 44; NPC.height = 44; NPC.defense = 4; - NPC.lifeMax = Main.zenithWorld ? 90 : 58; + NPC.lifeMax = Main.zenithWorld ? 200 : 100; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = Hit; @@ -64,10 +64,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 1.5f; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -99,7 +95,7 @@ namespace CalamityMod.NPCs.NormalNPCs // Spawn some off-screen enemies to act as threats if the player enters the field. if (Main.netMode != NetmodeID.MultiplayerClient) { - int enemiesToSpawn = CalamityWorld.LegendaryMode ? 4 : CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 1; + int enemiesToSpawn = Main.getGoodWorld ? 4 : CalamityWorld.death ? 3 : CalamityWorld.revenge ? 2 : 1; for (int i = 0; i < enemiesToSpawn; i++) { int tries = 0; @@ -123,7 +119,7 @@ namespace CalamityMod.NPCs.NormalNPCs else if (tries < 500 && Main.zenithWorld) { //Summon the army - int npcToSpawn = CalamityWorld.LegendaryMode ? 0 : Main.rand.Next(0, 4); + int npcToSpawn = Main.rand.Next(0, 4); switch (enemiesToSpawn) { case 0: @@ -190,11 +186,11 @@ namespace CalamityMod.NPCs.NormalNPCs Dust.NewDust(npcAtIndex.position, npcAtIndex.width, npcAtIndex.height, DustID.Electric); } } - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) { laserDelay--; NPC.spriteDirection = (player.Center.X - NPC.Center.X < 0).ToDirectionInt(); - for (int times = CalamityWorld.LegendaryMode ? 3 : 2; times > 0 && laserDelay == 0; times--) + for (int times = 3; times > 0 && laserDelay == 0; times--) { Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitX * 6f * NPC.spriteDirection, NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 4.5f, ProjectileID.SaucerMissile, 10, 0f); } diff --git a/NPCs/NormalNPCs/WulfrumDrone.cs b/NPCs/NormalNPCs/WulfrumDrone.cs index 58beddcec3..7a041ec944 100644 --- a/NPCs/NormalNPCs/WulfrumDrone.cs +++ b/NPCs/NormalNPCs/WulfrumDrone.cs @@ -70,9 +70,9 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 32; NPC.height = 32; NPC.defense = 4; - NPC.lifeMax = 27; + NPC.lifeMax = 25; NPC.knockBackResist = 0.35f; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(copper: 80); NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = WulfrumAmplifier.Hit; @@ -81,10 +81,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -180,7 +176,7 @@ namespace CalamityMod.NPCs.NormalNPCs if (Main.zenithWorld) { int spread = 15; - for (int times = CalamityWorld.LegendaryMode ? 3 : 2; times > 0; times--) + for (int times = 3; times > 0; times--) { Vector2 velocity = NPC.SafeDirectionTo(player.Center, Vector2.UnitY) * 6f; Vector2 perturbedspeed = new Vector2(velocity.X + Main.rand.Next(-2, 3), velocity.Y + Main.rand.Next(-2, 3)).RotatedBy(MathHelper.ToRadians(spread)); diff --git a/NPCs/NormalNPCs/WulfrumGyrator.cs b/NPCs/NormalNPCs/WulfrumGyrator.cs index 8427304eff..a93af36bb5 100644 --- a/NPCs/NormalNPCs/WulfrumGyrator.cs +++ b/NPCs/NormalNPCs/WulfrumGyrator.cs @@ -55,19 +55,15 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.width = 40; NPC.height = 40; NPC.defense = 5; - NPC.lifeMax = 23; + NPC.lifeMax = 25; NPC.knockBackResist = 0.15f; - NPC.value = Item.buyPrice(0, 0, 0, 75); + NPC.value = Item.buyPrice(copper: 75); NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -132,8 +128,8 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.direction = direction; NPC.ForceNetUpdate(); } - //GOTTA GO FAST (Legendary only) - if (CalamityWorld.LegendaryMode) + //GOTTA GO FAST (FTW only) + if (Main.getGoodWorld) { NPC.velocity *= 1.01f; //Overcharged diff --git a/NPCs/NormalNPCs/WulfrumHovercraft.cs b/NPCs/NormalNPCs/WulfrumHovercraft.cs index b278e299f7..fe522f1f96 100644 --- a/NPCs/NormalNPCs/WulfrumHovercraft.cs +++ b/NPCs/NormalNPCs/WulfrumHovercraft.cs @@ -79,7 +79,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.height = 38; NPC.defense = 4; NPC.lifeMax = 25; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; NPC.noGravity = true; @@ -88,10 +88,6 @@ namespace CalamityMod.NPCs.NormalNPCs BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -321,8 +317,8 @@ namespace CalamityMod.NPCs.NormalNPCs } } } - //Become a spark piñata in Legendary - if (CalamityWorld.LegendaryMode && Supercharged) + //Become a spark piñata in FTW + if (Main.getGoodWorld && Supercharged) { for (int Sparks = Main.rand.Next(2, 5); Sparks > 0; Sparks--) { diff --git a/NPCs/NormalNPCs/WulfrumRover.cs b/NPCs/NormalNPCs/WulfrumRover.cs index 32f84de137..abb690b689 100644 --- a/NPCs/NormalNPCs/WulfrumRover.cs +++ b/NPCs/NormalNPCs/WulfrumRover.cs @@ -59,7 +59,7 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.defense = 4; NPC.lifeMax = 40; NPC.knockBackResist = Main.zenithWorld ? 0f : 0.15f; - NPC.value = Item.buyPrice(0, 0, 0, 75); + NPC.value = Item.buyPrice(copper: 75); NPC.HitSound = WulfrumAmplifier.Hit; NPC.DeathSound = CommonCalamitySounds.WulfrumNPCDeathSound; Banner = NPC.type; @@ -68,10 +68,6 @@ namespace CalamityMod.NPCs.NormalNPCs NPC.Calamity().VulnerableToElectricity = true; if (Main.zenithWorld) NPC.scale = 2f; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -101,11 +97,11 @@ namespace CalamityMod.NPCs.NormalNPCs if (Supercharged) { SuperchargeTimer--; - NPC.defense = CalamityWorld.LegendaryMode ? 20 : 13; + NPC.defense = Main.getGoodWorld ? 20 : 13; } else if (!Supercharged) { - NPC.defense = CalamityWorld.LegendaryMode ? 10 : 4; + NPC.defense = Main.getGoodWorld ? 10 : 4; } Player player = Main.player[NPC.target]; @@ -188,7 +184,7 @@ namespace CalamityMod.NPCs.NormalNPCs Main.projectile[mine].hostile = true; Main.projectile[mine].timeLeft = 60; } - mineDelay = CalamityWorld.LegendaryMode ? 3 : 5; + mineDelay = 3; } else if (Main.zenithWorld && mineDelay >= 1) mineDelay--; diff --git a/NPCs/OldDuke/OldDuke.cs b/NPCs/OldDuke/OldDuke.cs index 88e48e8dbe..b568b5ea57 100644 --- a/NPCs/OldDuke/OldDuke.cs +++ b/NPCs/OldDuke/OldDuke.cs @@ -18,9 +18,9 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; -using CalamityMod.NPCs.CalamityAIs.CalamityBossAIs; using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using CalamityMod.Systems; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -59,8 +59,8 @@ namespace CalamityMod.NPCs.OldDuke public static readonly SoundStyle VortexSpawnSound = new("CalamityMod/Sounds/Custom/OldDukeVortexSpawn"); public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/OldDukeDash"); public static readonly SoundStyle DashSoundP3 = new("CalamityMod/Sounds/Custom/OldDukeDashP3"); - - public SlotId RoarSoundSlot; + private static Color FireGreen = new Color(155, 255, 55); + private SlotId RoarSoundSlot; public static Asset GlowTexture; @@ -84,14 +84,23 @@ namespace CalamityMod.NPCs.OldDuke } } + public static float Phase2ContactDamageMult = 1.1f; // 308 + public static float Phase3ContactDamageMult = 1.2f; // 336 + public static int GoreDamage = 55; // 220 + public static int VortexDamage = 105; // 420 + + // GFB exclusive + public static int FartDamage = 80; // 320 + public override void SetDefaults() { + NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 140; // 280 NPC.alpha = 255; NPC.width = 150; NPC.height = 100; NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.defense = 90; NPC.DR_NERD(0.5f, null, null, null, true); NPC.LifeMaxNERB(500000, 600000, 400000); @@ -101,7 +110,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.npcSlots = 15f; NPC.HitSound = SoundID.NPCHit14; NPC.DeathSound = SoundID.NPCDeath20; - NPC.value = Item.buyPrice(2, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 1, gold: 50); NPC.boss = true; NPC.netAlways = true; NPC.timeLeft = NPC.activeTime * 30; @@ -110,9 +119,6 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -143,30 +149,1629 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().newAI[i] = reader.ReadSingle(); } + #region Visual Helper Methods + static void DoChargeBurst(NPC npc, int phase) + { + SoundEngine.PlaySound(phase > 1 ? DashSoundP3 : DashSound, npc.Center); + + if (phase > 1) + { + for (int i = 0; i < 30; i++) + { + float fl = Main.rand.NextFloat(-60f, 60f); + GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20f) + new Vector2(0f, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); + } + + CalamityUtils.AddScreenshakeAt(npc.Center, 10f, 3000f); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3f, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2f, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); + } + } + static void DoChargeVisual(NPC npc, int phase) + { + float progress = npc.ai[2]; + int chargeTime = 36; + + Color col = Color.Lerp(phase > 0 ? FireGreen : new Color(100, 100, 100, 55), new Color(55, 55, 55, 55), progress / chargeTime); + + if (phase > 1) + { + if (Math.Floor(VisualTimerSystem.GlobalVisualTimer % 6f) < 1f) + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, npc.velocity / 3f, col, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.04f, 0.1f, 20)); + + (npc.ModNPC as OldDuke).NuclearOverlayVisual = 1f; + } + + if (Main.rand.NextBool()) + GeneralParticleHandler.SpawnParticle(new CustomSpark(npc.Center - (npc.velocity * 2f), npc.velocity / 2f, "CalamityMod/Particles/ForwardSmear", false, 10, Main.rand.NextFloat(0.3f, 0.5f), col, new Vector2(1f, Main.rand.NextFloat(1.45f, 1.6f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f))); + } + #endregion + public override void AI() { + CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); shake = MathHelper.Lerp(shake, 0f, 0.1f); + // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + // Variables + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + float exhaustionGateValue = 360f; + if (Main.getGoodWorld) + exhaustionGateValue *= 0.5f; + + float numberOfAttacksBeforeExhaustion = 12f; + float exhaustionIncreasePerAttack = exhaustionGateValue * (1f / numberOfAttacksBeforeExhaustion); + bool exhausted = calamityGlobalNPC.newAI[1] == 1f; bool phase2 = lifeRatio <= (death ? LifePercentagePhase2_Death : revenge ? LifePercentagePhase2_Revenge : LifePercentagePhase2_Normal); bool phase3 = lifeRatio <= (death ? LifePercentagePhase3_Death : (revenge ? LifePercentagePhase3_Revenge : LifePercentagePhase3_Expert)) && expertMode; - + bool phase2AI = NPC.ai[0] > 4f; + bool phase3AI = NPC.ai[0] > 9f; + Phase = phase3 ? 2 : phase2 ? 1 : 0; NuclearOverlayVisual = (Phase == 2 && NPC.Calamity().newAI[1] != 1) ? MathHelper.Lerp(NuclearOverlayVisual, 0.2f, 0.2f) : MathHelper.Lerp(NuclearOverlayVisual, 0f, 0.1f); - OldDukeAI.VanillaOldDukeAI(NPC, Mod); + bool charging = NPC.ai[3] < 10f; + if (calamityGlobalNPC.newAI[0] >= exhaustionGateValue) + calamityGlobalNPC.newAI[1] = 1f; + + float alphaScale = (255 - NPC.alpha) / 255f; + float redLight = (phase3AI ? 0.4f : phase2AI ? 0.64f : 0.88f) * alphaScale; + float greenLight = (phase3AI ? 1.2f : phase2AI ? 0.8f : 0.4f) * alphaScale; + Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), redLight, greenLight, 0f); + + if (CalamityServerConfig.Instance.BossesStopWeather) + CalamityWorld.StopRain(); + else if (!Main.raining && !BossRushEvent.BossRushActive) + CalamityWorld.StartRain(); + + // Adjust stats + NPC.damage = NPC.defDamage; + calamityGlobalNPC.DR = exhausted ? 0f : 0.5f; + NPC.defense = exhausted ? 0 : NPC.defDefense; + if (phase3AI) + { + NPC.damage = (int)Math.Round(NPC.defDamage * Phase3ContactDamageMult); + NPC.defense = exhausted ? 0 : NPC.defDefense - 40; + } + else if (phase2AI) + { + NPC.damage = (int)Math.Round(NPC.defDamage * Phase2ContactDamageMult); + NPC.defense = exhausted ? 0 : NPC.defDefense - 20; + } + + int idlePhaseTimer = expertMode ? 55 : 60; + float idlePhaseAcceleration = expertMode ? 0.75f : 0.7f; + float idlePhaseVelocity = expertMode ? 14f : 13f; + if (phase3AI) + { + idlePhaseAcceleration = expertMode ? 0.6f : 0.55f; + idlePhaseVelocity = expertMode ? 12f : 11f; + } + else if (phase2AI & charging) + { + idlePhaseAcceleration = expertMode ? 0.8f : 0.75f; + idlePhaseVelocity = expertMode ? 15f : 14f; + } + + int chargeTime = expertMode ? 34 : 36; + float chargeVelocity = expertMode ? 20f : 19f; + if (phase3AI) + { + chargeTime = expertMode ? 28 : 30; + chargeVelocity = expertMode ? 26f : 25f; + } + else if (charging & phase2AI) + { + chargeTime = expertMode ? 31 : 33; + chargeVelocity = expertMode ? 24f : 23f; + } + + if (death) + { + idlePhaseTimer = 51; + idlePhaseAcceleration *= 1.05f; + idlePhaseVelocity *= 1.05f; + chargeTime -= 2; + chargeVelocity *= 1.1f; + } + else if (revenge) + { + idlePhaseTimer = 53; + idlePhaseAcceleration *= 1.025f; + idlePhaseVelocity *= 1.025f; + chargeTime -= 1; + chargeVelocity *= 1.05f; + } + + // The dumbest thing to ever exist + if (Main.zenithWorld) + chargeVelocity *= 1.25f; + + if (exhausted) + idlePhaseVelocity *= 0.25f; + + // Variables + int maxToothBallBelches = death ? 4 : 3; + int toothBallBelchPhaseDivisor = death ? 30 : 40; + int toothBallBelchPhaseTimer = toothBallBelchPhaseDivisor * maxToothBallBelches; + float toothBallBelchPhaseAcceleration = death ? 0.6f : 0.55f; + float toothBallBelchPhaseVelocity = death ? 10f : 9f; + float toothBallFinalVelocity = death ? 14f : revenge ? 13f : 12f; + float goreVelocityX = death ? 8f : revenge ? 7.5f : expertMode ? 7f : 6f; + float goreVelocityY = death ? 10.5f : revenge ? 10f : expertMode ? 9.5f : 8f; + float sharkronVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + int attackTimer = 120; + int phaseTransitionTimer = 180; + int teleportPauseTimer = 30; + int toothBallSpinPhaseDivisor = death ? 32 : 45; + int toothBallSpinTimer = maxToothBallBelches * toothBallSpinPhaseDivisor; + float spinTime = toothBallSpinTimer / 2f; + float toothBallSpinToothBallVelocity = death ? 9.5f : 9f; + float spinAttackSpeed = Main.zenithWorld ? 44f : 22f; + float spinSpeed = MathHelper.TwoPi / spinTime; + + Player player = Main.player[NPC.target]; + + // Get target + if (NPC.target < 0 || NPC.target == Main.maxPlayers || player.dead || !player.active) + { + NPC.TargetClosest(); + player = Main.player[NPC.target]; + NPC.netUpdate = true; + } + + // Despawn safety, make sure to target another player if the current player target is too far away + if (Vector2.Distance(player.Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) + NPC.TargetClosest(); + + // Despawn + if (player.dead || Vector2.Distance(player.Center, NPC.Center) > 8800f) + { + NPC.TargetClosest(); + + NPC.velocity.Y -= 0.4f; + + if (NPC.timeLeft > 10) + NPC.timeLeft = 10; + + if (NPC.timeLeft == 1) + { + AcidRainEvent.AccumulatedKillPoints = 0; + AcidRainEvent.HasTriedToSummonOldDuke = false; + AcidRainEvent.UpdateInvasion(false); + NPC.timeLeft = 0; + } + + if (NPC.ai[0] > 4f) + NPC.ai[0] = 5f; + else + NPC.ai[0] = 0f; + + NPC.ai[2] = 0f; + } + + if (exhausted) + { + // Disable contact damage while tired + NPC.damage = 0; + + // Play exhausted sound and huff fumes + if (calamityGlobalNPC.newAI[0] % 60f == 0f && Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) + { + SoundEngine.PlaySound(HuffSound with { Volume = HuffSound.Volume * 1.25f }, Main.LocalPlayer.Center); + for (int i = 0; i < 40; i++) + { + float scale = Main.rand.NextFloat(1f, 3f); + Vector2 fumePos = NPC.Center + NPC.rotation.ToRotationVector2() * (Main.rand.NextBool() ? 100f : 80f) * NPC.direction; + Vector2 fumeVel = Vector2.UnitX * NPC.velocity.X + Vector2.UnitY.RotatedByRandom(MathHelper.ToRadians(12f)) * scale * -8f * Main.rand.NextFloat(1f, 1.25f); + MediumMistParticle fume = new(fumePos, fumeVel, GlowColor, Color.DarkSlateGray, scale, 150f); + GeneralParticleHandler.SpawnParticle(fume); + } + + Vector2 pulsePos = NPC.Center + NPC.rotation.ToRotationVector2() * 88f * NPC.direction; + CustomPulse pulse = new(pulsePos, Vector2.Zero, Color.White * 0.2f, "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.125f, 30); + GeneralParticleHandler.SpawnParticle(pulse); + } + + if (Main.zenithWorld) + { + float screenShakePower = 10 * Utils.GetLerpValue(800f, 0f, NPC.Distance(Main.LocalPlayer.Center), true); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenShakePower) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenShakePower; + + if (calamityGlobalNPC.newAI[0] == exhaustionGateValue) + SoundEngine.PlaySound(SoundID.NPCDeath64 with { Pitch = SoundID.NPCDeath64.Pitch - 0.9f, Volume = SoundID.NPCDeath64.Volume + 0.4f }, player.Center); // fart + + if (Main.netMode != NetmodeID.MultiplayerClient && calamityGlobalNPC.newAI[0] % 5f == 0f) + { + Vector2 dist = player.Center - NPC.Center; + dist.Normalize(); + dist *= 3; + dist.X += Main.rand.NextFloat(-0.5f, 0.5f); + dist.Y += Main.rand.NextFloat(-0.5f, 0.5f); + int type = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, -dist, type, FartDamage, 0, Main.myPlayer); + } + } + + calamityGlobalNPC.newAI[0] -= 1f; + if (calamityGlobalNPC.newAI[0] <= 0f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + } + } + + // Enrage variable + bool enrage = !BossRushEvent.BossRushActive && + (player.position.Y < 300f || player.position.Y > Main.worldSurface * 16.0 || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + + // Check for the flipped Abyss + if (Main.remixWorld) + { + enrage = !BossRushEvent.BossRushActive && + (player.position.Y < Main.UnderworldLayer * 16 * 0.8f || player.position.Y > Main.UnderworldLayer * 16 || + (player.position.X > 8000f && player.position.X < (Main.maxTilesX * 16 - 8000))); + } + + // Enrage + if (enrage) + { + if (NPC.localAI[1] > 0f) + NPC.localAI[1] -= 1f; + } + else + NPC.localAI[1] = CalamityGlobalNPC.biomeEnrageTimerMax; + + bool biomeEnraged = NPC.localAI[1] <= 0f; + + NPC.Calamity().CurrentlyEnraged = biomeEnraged; + + // Increased DR while transitioning phases and not exhausted + if (!exhausted) + calamityGlobalNPC.DR = (NPC.ai[0] == -1f || NPC.ai[0] == 4f || NPC.ai[0] == 9f) ? 0.75f : 0.5f; + + calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = NPC.ai[0] == -1f || NPC.ai[0] == 4f || NPC.ai[0] == 9f; + + // Enrage + if (biomeEnraged) + { + toothBallBelchPhaseTimer = 60; + toothBallBelchPhaseDivisor = 20; + toothBallBelchPhaseAcceleration = 1f; + toothBallBelchPhaseVelocity = 15f; + goreVelocityX = 12f; + goreVelocityY = 16f; + sharkronVelocity = 20f; + idlePhaseTimer = 20; + idlePhaseAcceleration = 1.2f; + idlePhaseVelocity = 20f; + chargeTime = 25; + chargeVelocity += 8f; + toothBallSpinPhaseDivisor = 24; + toothBallSpinToothBallVelocity = 15f; + NPC.damage *= 2; + NPC.defense = NPC.defDefense * 3; + } + + // The dumbest thing to ever exist + if (Main.zenithWorld) + chargeTime *= 2; + + // Set variables for spawn effects + if (NPC.localAI[0] == 0f) + { + NPC.alpha = 255; + + NPC.velocity.Y = -12f; + NPC.velocity.X = Main.rand.NextFloat(-2f, 2f); + + NPC.localAI[0] = 1f; + NPC.rotation = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = -1f; + NPC.netUpdate = true; + } + } + + // Rotation + float rateOfRotation = 0.04f; + if (NPC.ai[0] == 1f || NPC.ai[0] == 6f || NPC.ai[0] == 7f || NPC.ai[0] == 14f) + rateOfRotation = 0f; + if (NPC.ai[0] == 3f || NPC.ai[0] == 4f) + rateOfRotation = 0.01f; + if (NPC.ai[0] == 8f || NPC.ai[0] == 13f) + rateOfRotation = 0.05f; + + Vector2 rotationVector = player.Center - NPC.Center; + if (calamityGlobalNPC.newAI[1] != 1f && !player.dead) + { + // Rotate to show direction of predictive charge + if (NPC.ai[0] == 0f && !phase2) + { + if (NPC.ai[3] < 6f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + else if (NPC.ai[0] == 5f && !phase3) + { + if (NPC.ai[3] < 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + else if (NPC.ai[0] == 10f) + { + if (NPC.ai[3] < 8f && NPC.ai[3] != 1f && NPC.ai[3] != 4f) + { + rateOfRotation = 0.1f; + rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - NPC.Center) * chargeVelocity; + } + } + } + + float dukeRotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); + if (NPC.spriteDirection == 1) + dukeRotationSpeed += MathHelper.Pi; + if (dukeRotationSpeed < 0f) + dukeRotationSpeed += MathHelper.TwoPi; + if (dukeRotationSpeed > MathHelper.TwoPi) + dukeRotationSpeed -= MathHelper.TwoPi; + if (NPC.ai[0] == -1f || NPC.ai[0] == 3f || NPC.ai[0] == 4f) + dukeRotationSpeed = 0f; + if (NPC.ai[0] == 8f || NPC.ai[0] == 13f) + dukeRotationSpeed = MathHelper.Pi * 0.1666666667f * NPC.spriteDirection; + + if (NPC.rotation < dukeRotationSpeed) + { + if (dukeRotationSpeed - NPC.rotation > MathHelper.Pi) + NPC.rotation -= rateOfRotation; + else + NPC.rotation += rateOfRotation; + } + if (NPC.rotation > dukeRotationSpeed) + { + if (NPC.rotation - dukeRotationSpeed > MathHelper.Pi) + NPC.rotation += rateOfRotation; + else + NPC.rotation -= rateOfRotation; + } + + if ((NPC.ai[0] != 8f && NPC.ai[0] != 13f) || NPC.spriteDirection == 1) + { + if (NPC.rotation > dukeRotationSpeed - rateOfRotation && NPC.rotation < dukeRotationSpeed + rateOfRotation) + NPC.rotation = dukeRotationSpeed; + if (NPC.rotation < 0f) + NPC.rotation += MathHelper.TwoPi; + if (NPC.rotation > MathHelper.TwoPi) + NPC.rotation -= MathHelper.TwoPi; + if (NPC.rotation > dukeRotationSpeed - rateOfRotation && NPC.rotation < dukeRotationSpeed + rateOfRotation) + NPC.rotation = dukeRotationSpeed; + } + + // Alpha adjustments + if (NPC.ai[0] != -1f && (NPC.ai[0] < 9f || NPC.ai[0] > 12f)) + { + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.alpha += 15; + else + NPC.alpha -= 15; + + if (NPC.alpha < 0) + NPC.alpha = 0; + if (NPC.alpha > 150) + NPC.alpha = 150; + } + + // Spawn effects + if (NPC.ai[0] == -1f) + { + NPC.alpha = (int)MathHelper.Lerp(NPC.alpha, 0, 0.2f); + + // Disable contact damage while spawning + NPC.damage = 0; + + // Velocity + if (NPC.Calamity().newAI[3] == 0f) + NPC.velocity *= 0.98f; + + // Direction + int dukeFaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (dukeFaceDirection != 0) + { + NPC.direction = dukeFaceDirection; + NPC.spriteDirection = -NPC.direction; + } + + // Alpha + if (NPC.ai[2] > 20f) + { + NPC.velocity *= 0.9f; + + NPC.alpha -= 5; + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + NPC.alpha += 15; + if (NPC.alpha < 0) + NPC.alpha = 0; + if (NPC.alpha > 150) + NPC.alpha = 150; + } + + if (NPC.ai[2] == 75) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + CalamityUtils.AddScreenshakeAt(NPC.Center, 14); + SoundEngine.PlaySound(SoundID.DD2_BetsyFlameBreath.WithPitchOffset(-0.5f), NPC.Center); + SoundEngine.PlaySound(DashSoundP3, NPC.Center); + } + + if (NPC.ai[2] >= 75f) + { + float sd = player.Center.X > NPC.Center.X ? -1f : 1f; + + shake = 2f; + NPC.rotation = MathHelper.Lerp(MathHelper.WrapAngle(NPC.rotation), MathHelper.ToRadians(sd == 1f ? 75f : -75f), 0.2f); + + if (NPC.ai[2] % 5f == 1f) + { + Vector2 mouthCenter = NPC.Center + new Vector2(-80 * sd, 0).RotatedBy(NPC.rotation); + + float factor = (NPC.ai[2] - 75f) / 50f; + + float a = MathHelper.Lerp(1f, 0f, factor); + + GeneralParticleHandler.SpawnParticle(new CustomPulse(mouthCenter, Vector2.Zero, new Color(55, 55, 55).MultiplyRGBA(new Color(a, a, a, a)), "CalamityMod/Particles/DustyCircleHardEdge", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.05f, 0.08f + (0.15f * factor), 10)); + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= 125f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.netUpdate = true; + } + } + + // Phase 1 + else if (NPC.ai[0] == 0f && !player.dead) + { + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 phase1IdleSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(phase1IdleSpeed, idlePhaseAcceleration); + + // Rotation and direction + int dukeLookAt = Math.Sign(player.Center.X - NPC.Center.X); + if (dukeLookAt != 0) + { + if (NPC.ai[2] == 0f && dukeLookAt != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dukeLookAt; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase2 && !phase2AI)) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer || (phase2 && !phase2AI)) + { + int oldDukeAttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + oldDukeAttackPicker = 1; + break; + case 6: + NPC.ai[3] = 1f; + oldDukeAttackPicker = 2; + break; + case 7: + NPC.ai[3] = 0f; + oldDukeAttackPicker = 3; + break; + } + + if (phase2) + oldDukeAttackPicker = 4; + + // Set velocity for charge + if (oldDukeAttackPicker == 1) + { + NPC.ai[0] = 1f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + DoChargeBurst(NPC, 0); + + // Direction + if (dukeLookAt != 0) + { + NPC.direction = dukeLookAt; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + + // Tooth Balls + else if (oldDukeAttackPicker == 2) + { + NPC.ai[0] = 2f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Call sharks from the sides of the screen + else if (oldDukeAttackPicker == 3) + { + NPC.ai[0] = 3f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Go to phase 2 + else if (oldDukeAttackPicker == 4) + { + NPC.ai[0] = 4f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 1f) + { + // The dumbest thing to ever exist + if (Main.zenithWorld && NPC.ai[2] % 10f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + // Spawn dust + Vector2 vel = NPC.velocity; + vel.Normalize(); + vel *= 55f; + + DoChargeVisual(NPC, Phase); + + GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + vel + vel.RotatedBy(MathHelper.ToRadians(90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); + GeneralParticleHandler.SpawnParticle(new SparkParticle(NPC.Center + vel + vel.RotatedBy(MathHelper.ToRadians(-90)), vel / 7f, false, 20, 0.75f, new Color(155, 155, 155, 55), true)); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball belch + else if (NPC.ai[0] == 2f) + { + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 toothBallBelchPhaseSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * toothBallBelchPhaseVelocity; + NPC.SimpleFlyMovement(toothBallBelchPhaseSpeed, toothBallBelchPhaseAcceleration); + + // Play sounds and spawn Tooth Balls + if (NPC.ai[2] == 0f) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] % toothBallBelchPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 toothBallDirection = Vector2.Normalize(player.Center - NPC.Center) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(Main.player[NPC.target].Center - NPC.Center) * toothBallFinalVelocity; + Vector2 toothBallSpawnPos = new Vector2(toothBallDirection.X, toothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * NPC.velocity.Length(); + Main.npc[toothBall].netUpdate = true; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Direction + int toothBallLookAt = Math.Sign(player.Center.X - NPC.Center.X); + if (toothBallLookAt != 0) + { + NPC.direction = toothBallLookAt; + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallBelchPhaseTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Call sharks from the sides of the screen + else if (NPC.ai[0] == 3f) + { + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound and spawn sharks + if (NPC.ai[2] == attackTimer - 30) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 900f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 1800f), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 0f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Transition to phase 2 and call sharks from below + else if (NPC.ai[0] == 4f) + { + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Sound + if (NPC.ai[2] == phaseTransitionTimer - 60) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] >= phaseTransitionTimer - 60) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y + 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Phase 2 + else if (NPC.ai[0] == 5f && !player.dead) + { + // Velocity + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 dukePhase2IdleSpeed = Vector2.Normalize(player.Center + new Vector2(NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(dukePhase2IdleSpeed, idlePhaseAcceleration); + + // Direction and rotation + int phase2FaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (phase2FaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase2FaceDirection != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f || (phase3 && !phase3AI)) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer || (phase3 && !phase3AI)) + { + int phase2AttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 1: + case 2: + case 3: + phase2AttackPicker = 1; + break; + case 4: + NPC.ai[3] = 1f; + phase2AttackPicker = 2; + break; + case 5: + NPC.ai[3] = 0f; + phase2AttackPicker = 3; + break; + } + + if (phase3) + phase2AttackPicker = 4; + + // Set velocity for charge + if (phase2AttackPicker == 1) + { + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + DoChargeBurst(NPC, 1); + } + + // Set velocity for spin + else if (phase2AttackPicker == 2) + { + // Velocity and rotation + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinAttackSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase2FaceDirection != 0) + { + NPC.direction = phase2FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[0] = 7f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + else if (phase2AttackPicker == 3) + { + NPC.ai[0] = 8f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Go to next phase + else if (phase2AttackPicker == 4) + { + NPC.ai[0] = 9f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 6f) + { + // The dumbest thing to ever exist + if (Main.zenithWorld && NPC.ai[2] % 8f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + DoChargeVisual(NPC, Phase); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (NPC.ai[0] == 7f) + { + // Play sounds and spawn Tooth Balls and a Vortex + if (NPC.ai[2] == 0f) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + SoundEngine.PlaySound(VortexSpawnSound, NPC.Center); + int type = ModContent.ProjectileType(); + Vector2 vortexSpawn = NPC.Center + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, VortexDamage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (NPC.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 phase2ToothBallDirection = Vector2.Normalize(NPC.velocity) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(NPC.velocity).RotatedBy(MathHelper.PiOver2 * NPC.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase2ToothBallDirection.X, phase2ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = NPC.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 30f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinSpeed * (float)NPC.direction); + NPC.rotation -= spinSpeed * NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (NPC.ai[0] == 8f) + { + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase2GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + int type = ModContent.ProjectileType(); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), phase2GoreDirection.X, phase2GoreDirection.Y, velocityX, -velocityY, type, GoreDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 100f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Transition to phase 3 and summon sharks from above + else if (NPC.ai[0] == 9f) + { + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Sound + if (NPC.ai[2] == phaseTransitionTimer - 60) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (NPC.ai[2] >= phaseTransitionTimer - 60) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 200f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, 1f, sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2]), (int)(NPC.Center.Y - 540f), ModContent.NPCType(), 0, 0f, 0f, -1f, sharkronVelocity, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + 50f + calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, 1f, -sharkronVelocity, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - 50f - calamityGlobalNPC.newAI[2] * 0.5f), (int)(NPC.Center.Y + 270f), ModContent.NPCType(), 0, 0f, 0f, -1f, -sharkronVelocity, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= phaseTransitionTimer) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = 0f; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Phase 3 + else if (NPC.ai[0] == 10f && !player.dead) + { + // Alpha + NPC.alpha -= 25; + if (NPC.alpha < 0) + NPC.alpha = 0; + + // Movement location + if (NPC.ai[1] == 0f) + NPC.ai[1] = 500 * Math.Sign((NPC.Center - player.Center).X); + + Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(-NPC.ai[1], -300f) - NPC.Center - NPC.velocity) * idlePhaseVelocity; + NPC.SimpleFlyMovement(desiredVelocity, idlePhaseAcceleration); + + // Rotation and direction + int phase3FaceDirection = Math.Sign(player.Center.X - NPC.Center.X); + if (phase3FaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase3FaceDirection != NPC.direction) + { + NPC.rotation += MathHelper.Pi; + for (int l = 0; l < NPC.oldPos.Length; l++) + NPC.oldPos[l] = Vector2.Zero; + } + + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + // Phase switch + if (calamityGlobalNPC.newAI[1] != 1f) + { + NPC.ai[2] += 1f; + if (NPC.ai[2] >= idlePhaseTimer) + { + int phase3AttackPicker = 0; + switch ((int)NPC.ai[3]) + { + case 0: + case 2: + case 3: + case 5: + case 6: + case 7: + phase3AttackPicker = 1; + break; + case 1: + case 8: + phase3AttackPicker = 2; + break; + case 4: + NPC.ai[3] = 1f; + phase3AttackPicker = 3; + break; + case 9: + NPC.ai[3] = 6f; + phase3AttackPicker = 4; + break; + } + + // Set velocity for charge + if (phase3AttackPicker == 1) + { + NPC.ai[0] = 11f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + // Velocity and rotation + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + DoChargeBurst(NPC, 2); + } + + // Pause + else if (phase3AttackPicker == 2) + { + NPC.ai[0] = 12f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + else if (phase3AttackPicker == 3) + { + NPC.ai[0] = 13f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + // Set velocity for spin + else if (phase3AttackPicker == 4) + { + // Velocity and rotation + NPC.velocity = Vector2.Normalize(player.Center - NPC.Center) * spinAttackSpeed; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (phase3FaceDirection != 0) + { + NPC.direction = phase3FaceDirection; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + NPC.ai[0] = 14f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + } + + NPC.netUpdate = true; + } + } + } + + // Charge + else if (NPC.ai[0] == 11f) + { + // The dumbest thing to ever exist + if (Main.zenithWorld && NPC.ai[2] % 6f == 0f) + { + // Rotation and direction + int dir = Math.Sign(player.Center.X - NPC.Center.X); + if (dir != 0) + { + if (NPC.ai[2] == 0f && dir != NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.direction = dir; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + + Vector2 distanceVector = player.Center + player.velocity * 20f - NPC.Center; + NPC.velocity = Vector2.Normalize(distanceVector) * chargeVelocity; + NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X); + + // Direction + if (dir != 0) + { + NPC.direction = dir; + + if (NPC.spriteDirection == 1) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + else + { + // Accelerate + NPC.velocity *= 1.01f; + } + + DoChargeVisual(NPC, Phase); + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= chargeTime) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.ai[3] += 2f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Pause before teleport + else if (NPC.ai[0] == 12f) + { + // Disable contact damage during the teleporting phase + NPC.damage = 0; + + // Alpha + if (NPC.alpha < 255 && NPC.ai[2] >= teleportPauseTimer - 15f) + { + NPC.alpha += 17; + if (NPC.alpha > 255) + NPC.alpha = 255; + } + + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == teleportPauseTimer / 2) + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient && NPC.ai[2] == teleportPauseTimer - 1f) + { + // Teleport location + if (NPC.ai[1] == 0f) + NPC.ai[1] = 600 * Math.Sign((NPC.Center - player.Center).X); + + // Rotation and direction + Vector2 center = player.Center + new Vector2(NPC.ai[1], -300f); + Vector2 npcCenter = NPC.Center = center; + int phase3TeleportFaceDirection = Math.Sign(player.Center.X - npcCenter.X); + if (phase3TeleportFaceDirection != 0) + { + if (NPC.ai[2] == 0f && phase3TeleportFaceDirection != NPC.direction) + { + NPC.rotation += MathHelper.Pi; + for (int n = 0; n < NPC.oldPos.Length; n++) + NPC.oldPos[n] = Vector2.Zero; + } + + NPC.direction = phase3TeleportFaceDirection; + + if (NPC.spriteDirection != -NPC.direction) + NPC.rotation += MathHelper.Pi; + + NPC.spriteDirection = -NPC.direction; + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= teleportPauseTimer) + { + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + + NPC.ai[3] += 2f; + if (NPC.ai[3] >= 9f) + NPC.ai[3] = 0f; + + NPC.netUpdate = true; + } + } + + // Vomit a huge amount of gore into the sky and call sharks from the sides of the screen + else if (NPC.ai[0] == 13f) + { + // Velocity + NPC.velocity *= 0.98f; + NPC.velocity.Y = MathHelper.Lerp(NPC.velocity.Y, 0f, 0.02f); + + // Play sound + if (NPC.ai[2] == attackTimer - 30) + { + SoundEngine.PlaySound(VomitSound, NPC.Center); + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Vector2 phase3GoreDirection = NPC.rotation.ToRotationVector2() * (Vector2.UnitX * NPC.direction) * (NPC.width + 20) / 2f + NPC.Center; + int type = ModContent.ProjectileType(); + int totalGore = Main.getGoodWorld ? 40 : 20; + for (int i = 0; i < totalGore; i++) + { + float velocityX = NPC.direction * goreVelocityX * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + float velocityY = goreVelocityY * (Main.rand.NextFloat(0.2f, 0.8f) + 0.5f); + + if (Main.getGoodWorld) + { + velocityX *= Main.rand.NextFloat() + 0.5f; + velocityY *= Main.rand.NextFloat() + 0.5f; + } + + Projectile.NewProjectile(NPC.GetSource_FromAI(), phase3GoreDirection.X, phase3GoreDirection.Y, velocityX, -velocityY, type, GoreDamage, 0f, Main.myPlayer, 0f, 0f); + } + } + } + + if (NPC.ai[2] >= attackTimer - 90) + { + if (NPC.ai[2] % 18f == 0f) + { + calamityGlobalNPC.newAI[2] += 150f; + + if (Main.netMode != NetmodeID.MultiplayerClient) + { + float x = 900f - calamityGlobalNPC.newAI[2]; + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2]), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + + if (Main.getGoodWorld) + { + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X + x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)(NPC.Center.X - x), (int)(NPC.Center.Y - calamityGlobalNPC.newAI[2] * 0.5f), ModContent.NPCType(), 0, 0f, 0f, NPC.whoAmI, 0f, 255); + } + } + } + } + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= attackTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + calamityGlobalNPC.newAI[2] = 0f; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + // Tooth Ball and Vortex spin + else if (NPC.ai[0] == 14f) + { + // Play sounds and spawn Tooth Balls and a Vortex + if (NPC.ai[2] == 0f) + { + RoarSoundSlot = SoundEngine.PlaySound(RoarSound, NPC.Center); + + SoundEngine.PlaySound(VortexSpawnSound, NPC.Center); + int type = ModContent.ProjectileType(); + Vector2 vortexSpawn = NPC.Center + NPC.velocity.RotatedBy(MathHelper.PiOver2 * -NPC.direction) * spinTime / MathHelper.TwoPi; + if (Main.netMode != NetmodeID.MultiplayerClient) + Projectile.NewProjectile(NPC.GetSource_FromAI(), vortexSpawn, Vector2.Zero, type, VortexDamage, 0f, Main.myPlayer, vortexSpawn.X, vortexSpawn.Y); + } + + if (NPC.ai[2] % toothBallSpinPhaseDivisor == 0f) + { + if (NPC.ai[2] != 0f) + SoundEngine.PlaySound(VomitSound, NPC.Center); + + Vector2 phase3ToothBallDirection = Vector2.Normalize(NPC.velocity) * (NPC.width + 20) / 2f + NPC.Center; + Vector2 toothBallVelocity = Vector2.Normalize(NPC.velocity).RotatedBy(MathHelper.PiOver2 * NPC.direction) * toothBallSpinToothBallVelocity; + Vector2 toothBallSpawnPos = new Vector2(phase3ToothBallDirection.X, phase3ToothBallDirection.Y + 45f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int toothBall = NPC.NewNPC(NPC.GetSource_FromAI(), (int)toothBallSpawnPos.X, (int)toothBallSpawnPos.Y, ModContent.NPCType(), 0, toothBallVelocity.X, toothBallVelocity.Y); + Main.npc[toothBall].target = NPC.target; + Main.npc[toothBall].velocity = Vector2.Normalize(toothBallVelocity) * toothBallSpinToothBallVelocity * 0.5f; + Main.npc[toothBall].netUpdate = true; + Main.npc[toothBall].ai[3] = 60f; + } + + for (int i = 0; i < 50; i++) + { + int dustID; + switch (Main.rand.Next(6)) + { + case 0: + case 1: + case 2: + case 3: + dustID = (int)CalamityDusts.SulphurousSeaAcid; + break; + default: + dustID = DustID.Blood; + break; + } + + // Choose a random speed and angle to belch out the vomit + float dustSpeed = Main.rand.NextFloat(3.0f, 12.0f); + float angleRandom = 0.06f; + Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(toothBallVelocity.ToRotation()); + dustVel = dustVel.RotatedBy(-angleRandom); + dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); + + // Pick a size for the vomit particles + float scale = Main.rand.NextFloat(1f, 2f); + + // Actually spawn the vomit + int idx = Dust.NewDust(toothBallSpawnPos, 40, 40, dustID, dustVel.X, dustVel.Y, 0, default, scale); + Main.dust[idx].noGravity = true; + } + } + + // Velocity and rotation + NPC.velocity = NPC.velocity.RotatedBy(-(double)spinSpeed * NPC.direction); + NPC.rotation -= spinSpeed * NPC.direction; + + NPC.ai[2] += 1f; + if (NPC.ai[2] >= toothBallSpinTimer) + { + calamityGlobalNPC.newAI[0] += exhaustionIncreasePerAttack; + NPC.ai[0] = 10f; + NPC.ai[1] = 0f; + NPC.ai[2] = 0f; + NPC.TargetClosest(); + NPC.netUpdate = true; + } + } + + if (SoundEngine.TryGetActiveSound(RoarSoundSlot, out var roarSound) && roarSound.IsPlaying) + roarSound.Position = NPC.Center; } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void ModifyTypeName(ref string typeName) @@ -449,7 +2054,7 @@ namespace CalamityMod.NPCs.OldDuke return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -523,8 +2128,8 @@ namespace CalamityMod.NPCs.OldDuke { if (hurtInfo.Damage > 0) { - target.AddBuff(ModContent.BuffType(), 480); - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), Phase == 2 ? 600 : Phase == 1 ? 480 : 360); + target.AddBuff(ModContent.BuffType(), Phase == 2 ? 300 : Phase == 1 ? 240 : 180); if (Main.zenithWorld) { target.AddBuff(BuffID.Rabies, Main.rand.Next(180, 601)); diff --git a/NPCs/OldDuke/OldDukeToothBall.cs b/NPCs/OldDuke/OldDukeToothBall.cs index 8d259c4bd9..0b1fbeba78 100644 --- a/NPCs/OldDuke/OldDukeToothBall.cs +++ b/NPCs/OldDuke/OldDukeToothBall.cs @@ -21,12 +21,15 @@ namespace CalamityMod.NPCs.OldDuke this.HideFromBestiary(); } + public static int ToothDamage = 55; // 220 + public static int CloudDamage = 70; // 280 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.width = 40; NPC.height = 40; NPC.defense = 0; @@ -45,20 +48,15 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.65f, 0.55f, 0f); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; NPC.rotation += NPC.velocity.X * 0.05f; @@ -117,7 +115,7 @@ namespace CalamityMod.NPCs.OldDuke float velocity = death ? 14f : revenge ? 13f : 12f; if (expertMode) { - float speedUpMult = bossRush ? 0.01f : 0.005f; + float speedUpMult = 0.005f; velocity += Vector2.Distance(player.Center, NPC.Center) * speedUpMult; } @@ -147,7 +145,7 @@ namespace CalamityMod.NPCs.OldDuke NPC.velocity.X = (NPC.velocity.X * inertia + targetXDist) / (inertia + 1f); NPC.velocity.Y = (NPC.velocity.Y * inertia + targetYDist) / (inertia + 1f); - float toothBallAccel = bossRush ? 0.65f : 0.5f; + float toothBallAccel = 0.5f; foreach (var n in Main.ActiveNPCs) { if (n.whoAmI != NPC.whoAmI && n.type == NPC.type) @@ -188,7 +186,6 @@ namespace CalamityMod.NPCs.OldDuke int totalProjectiles = CalamityWorld.death ? 5 : CalamityWorld.revenge ? 4 : 3; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float velocity = 10f; double angleA = radians * 0.5; double angleB = MathHelper.ToRadians(90f) - angleA; @@ -197,14 +194,13 @@ namespace CalamityMod.NPCs.OldDuke for (int k = 0; k < totalProjectiles; k++) { Vector2 toothSpikeRotation = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, toothSpikeRotation * 0.1f, type, damage, 0f, Main.myPlayer, toothSpikeRotation.X, toothSpikeRotation.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, toothSpikeRotation * 0.1f, type, ToothDamage, 0f, Main.myPlayer, toothSpikeRotation.X, toothSpikeRotation.Y); } if (Main.expertMode) { type = ModContent.ProjectileType(); - damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, CloudDamage, 0f, Main.myPlayer); } } @@ -216,16 +212,11 @@ namespace CalamityMod.NPCs.OldDuke int type = ModContent.ProjectileType(); for (int i = 0; i < 2; i++) Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - Main.rand.Next(-1, 2), Main.rand.Next(-6, -3), type, NPC.damage / 2, 0f, Main.myPlayer); + Main.rand.Next(-1, 2), Main.rand.Next(-6, -3), type, OldDuke.GoreDamage, 0f, Main.myPlayer); } } } - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)/* tModPorter Note: bossLifeScale -> balance (bossAdjustment is different, see the docs for details) */ - { - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) { cooldownSlot = ImmunityCooldownID.Bosses; @@ -259,12 +250,6 @@ namespace CalamityMod.NPCs.OldDuke return base.PreDraw(spriteBatch, screenPos, drawColor); } - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240); - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 3; k++) diff --git a/NPCs/OldDuke/SulphurousSharkron.cs b/NPCs/OldDuke/SulphurousSharkron.cs index e2b4fdfe64..d399c527f3 100644 --- a/NPCs/OldDuke/SulphurousSharkron.cs +++ b/NPCs/OldDuke/SulphurousSharkron.cs @@ -28,11 +28,11 @@ namespace CalamityMod.NPCs.OldDuke public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.aiStyle = -1; AIType = -1; NPC.width = 44; NPC.height = 44; - NPC.GetNPCDamage(); NPC.defense = 100; NPC.lifeMax = 6000; if (BossRushEvent.BossRushActive) @@ -52,10 +52,6 @@ namespace CalamityMod.NPCs.OldDuke NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -74,10 +70,9 @@ namespace CalamityMod.NPCs.OldDuke { Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 0.7f * NPC.Opacity, 0.9f * NPC.Opacity, 0f); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead) { @@ -106,12 +101,12 @@ namespace CalamityMod.NPCs.OldDuke // Fly up bool upwardAI = NPC.ai[3] < 0f; - float flyTowardTargetGateValue = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; - float extraTime = bossRush ? 60f : death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; + float flyTowardTargetGateValue = death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; + float extraTime = death ? 70f : revenge ? 75f : expertMode ? 80f : 90f; float aiGateValue = flyTowardTargetGateValue + extraTime; float dieGateValue = aiGateValue + extraTime * 4f; float fallDownGateValue = aiGateValue + extraTime; - float maxVelocity = bossRush ? 22f : death ? 20f : revenge ? 19f : expertMode ? 18f : 16f; + float maxVelocity = death ? 20f : revenge ? 19f : expertMode ? 18f : 16f; if (NPC.ai[0] == 0f) { @@ -146,7 +141,7 @@ namespace CalamityMod.NPCs.OldDuke Vector2 targetDistance = Main.player[NPC.target].Center - NPC.Center; targetDistance.Normalize(); targetDistance *= scaleFactor2; - float inertia = bossRush ? 20f : death ? 23f : revenge ? 25f : expertMode ? 27f : 30f; + float inertia = death ? 23f : revenge ? 25f : expertMode ? 27f : 30f; NPC.velocity = (NPC.velocity * (inertia - 1f) + targetDistance) / inertia; NPC.velocity.Normalize(); NPC.velocity *= scaleFactor2; @@ -216,20 +211,14 @@ namespace CalamityMod.NPCs.OldDuke { int spawnX = NPC.width / 2; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < 10; i++) { Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X + Main.rand.Next(-spawnX, spawnX), NPC.Center.Y, - Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, damage, 0f, Main.myPlayer); + Main.rand.Next(-3, 4), Main.rand.Next(-12, -6), type, OldDuke.GoreDamage, 0f, Main.myPlayer); } } } - public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment)/* tModPorter Note: bossLifeScale -> balance (bossAdjustment is different, see the docs for details) */ - { - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { if (NPC.IsABestiaryIconDummy) @@ -273,12 +262,6 @@ namespace CalamityMod.NPCs.OldDuke return NPC.Opacity == 1f; } - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240); - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 5; k++) diff --git a/NPCs/Other/CalamitasEnchantDemon.cs b/NPCs/Other/CalamitasEnchantDemon.cs index 831470fdd5..bcd5e9b907 100644 --- a/NPCs/Other/CalamitasEnchantDemon.cs +++ b/NPCs/Other/CalamitasEnchantDemon.cs @@ -30,7 +30,6 @@ namespace CalamityMod.NPCs.Other NPC.DeathSound = SoundID.NPCDeath18; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.value = 0f; NPC.knockBackResist = 0f; NPC.netAlways = true; NPC.aiStyle = 0; diff --git a/NPCs/Other/DemonPortal.cs b/NPCs/Other/DemonPortal.cs index 4c870617d8..bef1ccef69 100644 --- a/NPCs/Other/DemonPortal.cs +++ b/NPCs/Other/DemonPortal.cs @@ -25,7 +25,6 @@ namespace CalamityMod.NPCs.Other NPC.lifeMax = 25000; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.value = 0f; NPC.knockBackResist = 0f; NPC.netAlways = true; NPC.aiStyle = -1; diff --git a/NPCs/Other/ExhumedHeart.cs b/NPCs/Other/ExhumedHeart.cs index dd0a285bbe..d123d5aebe 100644 --- a/NPCs/Other/ExhumedHeart.cs +++ b/NPCs/Other/ExhumedHeart.cs @@ -32,7 +32,6 @@ namespace CalamityMod.NPCs.Other NPC.lifeMax = 50000; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.value = 0f; NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0f; diff --git a/NPCs/Other/LecherousOrb.cs b/NPCs/Other/LecherousOrb.cs index 5d6d4e7e7d..2ed0ff9386 100644 --- a/NPCs/Other/LecherousOrb.cs +++ b/NPCs/Other/LecherousOrb.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.Other NPC.lifeMax = 180000; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.value = 0f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath7; NPC.knockBackResist = 0f; diff --git a/NPCs/Other/THELORDE.cs b/NPCs/Other/THELORDE.cs index 360e1a19fa..516be41821 100644 --- a/NPCs/Other/THELORDE.cs +++ b/NPCs/Other/THELORDE.cs @@ -63,7 +63,7 @@ namespace CalamityMod.NPCs.Other NPC.defense = 100; NPC.lifeMax = 2500000; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(100, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 100); NPC.HitSound = SoundID.NPCHit13; NPC.DeathSound = null; NPC.boss = true; @@ -584,8 +584,7 @@ namespace CalamityMod.NPCs.Other public override void ModifyNPCLoot(NPCLoot npcLoot) { double pisquaredover6 = Math.Pow(MathHelper.Pi, 2) / 6; - npcLoot.AddIf(() => CalamityWorld.LegendaryMode && CalamityWorld.revenge, ModContent.ItemType()); // guaranteed in legendarev mode - npcLoot.AddIf(() => !(CalamityWorld.LegendaryMode && CalamityWorld.revenge), ModContent.ItemType(), 27); // otherwise 1 in 27 + npcLoot.Add(ModContent.ItemType()); npcLoot.Add(ModContent.ItemType(), 1, 22, (int)(pisquaredover6 * 100)); } } diff --git a/NPCs/Perforator/PerforatorBodyLarge.cs b/NPCs/Perforator/PerforatorBodyLarge.cs index cbc5e97425..18063cf7e3 100644 --- a/NPCs/Perforator/PerforatorBodyLarge.cs +++ b/NPCs/Perforator/PerforatorBodyLarge.cs @@ -39,12 +39,12 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 20; // 40 NPC.width = 60; NPC.height = 60; NPC.defense = 8; - NPC.LifeMaxNERB(2700, 3240, 80000); + NPC.LifeMaxNERB(2160, 2600, 80000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -60,9 +60,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -72,10 +70,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -147,21 +141,6 @@ namespace CalamityMod.NPCs.Perforator NPC.spriteDirection = -1; } - // Calculate contact damage based on velocity - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) diff --git a/NPCs/Perforator/PerforatorBodyMedium.cs b/NPCs/Perforator/PerforatorBodyMedium.cs index 04b29437b1..94bbae9e1f 100644 --- a/NPCs/Perforator/PerforatorBodyMedium.cs +++ b/NPCs/Perforator/PerforatorBodyMedium.cs @@ -36,13 +36,13 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 14; // 28 NPC.npcSlots = 5f; NPC.width = 40; NPC.height = 40; NPC.defense = 6; - NPC.LifeMaxNERB(180, 216, 7000); + NPC.LifeMaxNERB(144, 172, 7000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -58,9 +58,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -72,16 +70,11 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; NPC.realLife = -1; @@ -114,8 +107,7 @@ namespace CalamityMod.NPCs.Perforator { spawnedBlob = true; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.life = 0; @@ -130,8 +122,7 @@ namespace CalamityMod.NPCs.Perforator { spawnedBlob = true; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.type = ModContent.NPCType(); @@ -151,8 +142,7 @@ namespace CalamityMod.NPCs.Perforator if (death && !spawnedBlob) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } int whoAmI2 = NPC.whoAmI; @@ -207,22 +197,6 @@ namespace CalamityMod.NPCs.Perforator NPC.position.Y += targetY; } - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; - float minimalDamageVelocity = maxChaseSpeed * 0.8f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) @@ -286,15 +260,14 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer); for (int i = -1; i < 2; i++) //releases 3 Ichor Shots { int type2 = ModContent.ProjectileType(); Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); int spread = Main.rand.Next(16, 36); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, PerforatorHive.IchorShotDamage, 0f, Main.myPlayer); } } } @@ -323,8 +296,7 @@ namespace CalamityMod.NPCs.Perforator { if (hurtInfo.Damage > 0) { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(BuffID.Ichor, 120); + target.AddBuff(BuffID.Ichor, 240); } } } diff --git a/NPCs/Perforator/PerforatorBodySmall.cs b/NPCs/Perforator/PerforatorBodySmall.cs index 0ef54560de..160109d293 100644 --- a/NPCs/Perforator/PerforatorBodySmall.cs +++ b/NPCs/Perforator/PerforatorBodySmall.cs @@ -34,12 +34,12 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 12; // 24 NPC.width = 42; NPC.height = 42; NPC.defense = 4; - NPC.LifeMaxNERB(1200, 1440, 50000); + NPC.LifeMaxNERB(960, 1152, 50000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -55,9 +55,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -67,10 +65,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -142,22 +136,6 @@ namespace CalamityMod.NPCs.Perforator NPC.spriteDirection = -1; } - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; - float minimalDamageVelocity = maxChaseSpeed * 0.8f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) diff --git a/NPCs/Perforator/PerforatorHeadLarge.cs b/NPCs/Perforator/PerforatorHeadLarge.cs index 600cdb43e7..ab2fd8ced9 100644 --- a/NPCs/Perforator/PerforatorHeadLarge.cs +++ b/NPCs/Perforator/PerforatorHeadLarge.cs @@ -12,6 +12,7 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator @@ -25,8 +26,6 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfLargeDeath"); public static Asset GlowTexture; - - private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -48,17 +47,20 @@ namespace CalamityMod.NPCs.Perforator } } + // GFB exclusive + public static int LaserWallDamage = 10; // 40 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 40; // 80 NPC.npcSlots = 5f; NPC.width = 70; NPC.height = 84; NPC.defense = 4; - NPC.LifeMaxNERB(2700, 3240, 80000); + NPC.LifeMaxNERB(2160, 2600, 80000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -73,9 +75,7 @@ namespace CalamityMod.NPCs.Perforator NPC.DeathSound = DeathSound; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -85,10 +85,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -106,24 +102,21 @@ namespace CalamityMod.NPCs.Perforator public override void SendExtraAI(BinaryWriter writer) { - writer.Write(biomeEnrageTimer); for (int i = 0; i < 4; i++) writer.Write(NPC.Calamity().newAI[i]); } public override void ReceiveExtraAI(BinaryReader reader) { - biomeEnrageTimer = reader.ReadInt32(); for (int i = 0; i < 4; i++) NPC.Calamity().newAI[i] = reader.ReadSingle(); } public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (NPC.target < 0 || NPC.target == Main.maxPlayers || Main.player[NPC.target].dead || !Main.player[NPC.target].active) @@ -135,23 +128,6 @@ namespace CalamityMod.NPCs.Perforator Player player = Main.player[NPC.target]; - // Enrage - if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!player.ZoneCrimson || bossRush)) - enrageScale += 1f; - if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) - enrageScale += 1f; - // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -160,9 +136,9 @@ namespace CalamityMod.NPCs.Perforator if (expertMode) { - float velocityScale = (death ? 0.1f : 0.07f) * enrageScale; + float velocityScale = death ? 0.1f : 0.07f; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.07f : 0.05f) * enrageScale; + float accelerationScale = death ? 0.07f : 0.05f; turnSpeed += accelerationScale * (1f - lifeRatio); } @@ -223,7 +199,7 @@ namespace CalamityMod.NPCs.Perforator for (int i = 0; i < spitProjectileAmount; i++) { int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = type == ModContent.ProjectileType() ? PerforatorHive.IchorShotDamage : PerforatorHive.BloodGeyserDamage; Projectile.NewProjectile(NPC.GetSource_FromAI(), spitLocation + Main.rand.NextVector2CircularEdge(8f, 8f), NPC.velocity.SafeNormalize(Vector2.UnitY) * spitProjectileBaseVelocity + Main.rand.NextVector2CircularEdge(spitProjectileRandomVelocityLimit, spitProjectileRandomVelocityLimit), @@ -239,11 +215,10 @@ namespace CalamityMod.NPCs.Perforator for (int i = 0; i < spitBlobAmount; i++) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Projectile.NewProjectile(NPC.GetSource_FromAI(), spitLocation + Main.rand.NextVector2CircularEdge(8f, 8f), NPC.velocity.SafeNormalize(Vector2.UnitY) * spitBlobBaseVelocity + Main.rand.NextVector2CircularEdge(spitBlobRandomVelocityLimit, spitBlobRandomVelocityLimit), - type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); + type, PerforatorHive.IchorShotDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } } @@ -365,7 +340,7 @@ namespace CalamityMod.NPCs.Perforator float laserOffset = 1500f; float laserVelocity = 4f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = LaserWallDamage; NPC.Calamity().newAI[3]++; if (NPC.Calamity().newAI[3] > 180f) // Effectively 10 seconds but give a little headstart in case players kill it too fast @@ -537,19 +512,6 @@ namespace CalamityMod.NPCs.Perforator if (NPC.Distance(player.Center) > 1280f) NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; - float minimalDamageVelocity = maxChargeSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -636,11 +598,8 @@ namespace CalamityMod.NPCs.Perforator } } - public override void BossLoot(ref string name, ref int potionType) - { - name = CalamityUtils.GetTextValue("NPCs.PerforatorLarge"); - potionType = ItemID.HealingPotion; - } + public override LocalizedText DeathMessage => CalamityUtils.GetText("NPCs.PerforatorLarge"); + public override void BossLoot(ref int potionType) => potionType = ItemID.HealingPotion; public override bool SpecialOnKill() { diff --git a/NPCs/Perforator/PerforatorHeadMedium.cs b/NPCs/Perforator/PerforatorHeadMedium.cs index 2638f557a3..05bf4dca42 100644 --- a/NPCs/Perforator/PerforatorHeadMedium.cs +++ b/NPCs/Perforator/PerforatorHeadMedium.cs @@ -11,6 +11,7 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator @@ -24,7 +25,6 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfMediumDeath"); public static Asset GlowTexture; - public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); @@ -48,13 +48,13 @@ namespace CalamityMod.NPCs.Perforator { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 24; // 48 NPC.npcSlots = 5f; NPC.width = 58; NPC.height = 68; NPC.defense = 2; - NPC.LifeMaxNERB(180, 216, 7000); + NPC.LifeMaxNERB(144, 172, 7000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -69,9 +69,7 @@ namespace CalamityMod.NPCs.Perforator NPC.DeathSound = DeathSound; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -83,10 +81,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -104,16 +98,9 @@ namespace CalamityMod.NPCs.Perforator public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if ((NPC.position.Y / 16f) < Main.worldSurface || bossRush) - enrageScale += 1f; - if (!Main.player[NPC.target].ZoneCrimson || bossRush) - enrageScale += 1f; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Total body segments float totalSegments = GetMediumPerforatorSegmentsCount(); @@ -129,9 +116,9 @@ namespace CalamityMod.NPCs.Perforator if (expertMode) { - float velocityScale = (death ? 0.125f : 0.085f) * enrageScale; + float velocityScale = death ? 0.125f : 0.085f; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.085f : 0.06f) * enrageScale; + float accelerationScale = death ? 0.085f : 0.06f; turnSpeed += accelerationScale * (1f - lifeRatio); } @@ -166,8 +153,7 @@ namespace CalamityMod.NPCs.Perforator { spawnedBlob = true; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.life = 0; @@ -181,8 +167,7 @@ namespace CalamityMod.NPCs.Perforator if (death && !spawnedBlob) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, NPC.velocity + Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.life = 0; @@ -441,19 +426,6 @@ namespace CalamityMod.NPCs.Perforator if (NPC.Distance(player.Center) > 1280f) NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; - float minimalDamageVelocity = maxChargeSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -494,7 +466,7 @@ namespace CalamityMod.NPCs.Perforator public static int GetMediumPerforatorSegmentsCount() { - return CalamityWorld.LegendaryMode ? 20 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 14 : CalamityWorld.revenge ? 13 : Main.expertMode ? 12 : 10; + return Main.getGoodWorld ? 20 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 14 : CalamityWorld.revenge ? 13 : Main.expertMode ? 12 : 10; } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -559,24 +531,20 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer); for (int i = -1; i < 2; i++) //releases 3 Ichor Shots { int type2 = ModContent.ProjectileType(); Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); int spread = Main.rand.Next(16, 36); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, PerforatorHive.IchorShotDamage, 0f, Main.myPlayer); } } } - public override void BossLoot(ref string name, ref int potionType) - { - name = CalamityUtils.GetTextValue("NPCs.PerforatorMedium"); - potionType = ItemID.HealingPotion; - } + public override LocalizedText DeathMessage => CalamityUtils.GetText("NPCs.PerforatorMedium"); + public override void BossLoot(ref int potionType) => potionType = ItemID.HealingPotion; public override bool SpecialOnKill() { @@ -592,8 +560,7 @@ namespace CalamityMod.NPCs.Perforator { if (hurtInfo.Damage > 0) { - target.AddBuff(ModContent.BuffType(), 240); - target.AddBuff(BuffID.Ichor, 240); + target.AddBuff(BuffID.Ichor, 360); } } } diff --git a/NPCs/Perforator/PerforatorHeadSmall.cs b/NPCs/Perforator/PerforatorHeadSmall.cs index b0120e825c..7e21656207 100644 --- a/NPCs/Perforator/PerforatorHeadSmall.cs +++ b/NPCs/Perforator/PerforatorHeadSmall.cs @@ -12,6 +12,7 @@ using Terraria.Audio; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.NPCs.Perforator @@ -25,9 +26,6 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); public static Asset GlowTexture; - - private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private const int MsgType = 23; private bool TailSpawned = false; public override void SetStaticDefaults() @@ -53,12 +51,12 @@ namespace CalamityMod.NPCs.Perforator { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 22; // 44 NPC.npcSlots = 5f; NPC.width = 42; NPC.height = 62; - NPC.LifeMaxNERB(1200, 1440, 50000); + NPC.LifeMaxNERB(960, 1152, 50000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -73,9 +71,7 @@ namespace CalamityMod.NPCs.Perforator NPC.DeathSound = DeathSound; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -85,10 +81,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -104,39 +96,11 @@ namespace CalamityMod.NPCs.Perforator }); } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(biomeEnrageTimer); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - biomeEnrageTimer = reader.ReadInt32(); - } - public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - // Enrage - if ((!Main.player[NPC.target].ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!Main.player[NPC.target].ZoneCrimson || bossRush)) - enrageScale += 1f; - if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) - enrageScale += 1f; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -146,9 +110,9 @@ namespace CalamityMod.NPCs.Perforator if (expertMode) { - float velocityScale = (death ? 0.2f : 0.14f) * enrageScale; + float velocityScale = death ? 0.2f : 0.14f; speed += velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.15f : 0.1f) * enrageScale; + float accelerationScale = death ? 0.15f : 0.1f; turnSpeed += accelerationScale * (1f - lifeRatio); } @@ -183,7 +147,7 @@ namespace CalamityMod.NPCs.Perforator Main.npc[lol].ai[2] = NPC.whoAmI; Main.npc[lol].ai[1] = Previous; Main.npc[Previous].ai[0] = lol; - NetMessage.SendData(MsgType, -1, -1, null, lol, 0f, 0f, 0f, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, lol, 0f, 0f, 0f, 0); Previous = lol; } @@ -454,19 +418,6 @@ namespace CalamityMod.NPCs.Perforator if (NPC.Distance(player.Center) > 1280f) NPC.velocity += (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = maxChargeSpeed * 0.25f; - float minimalDamageVelocity = maxChargeSpeed * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2((double)NPC.velocity.Y, (double)NPC.velocity.X) + MathHelper.PiOver2; if (shouldFly) @@ -557,11 +508,8 @@ namespace CalamityMod.NPCs.Perforator } } - public override void BossLoot(ref string name, ref int potionType) - { - name = CalamityUtils.GetTextValue("NPCs.PerforatorSmall"); - potionType = ItemID.HealingPotion; - } + public override LocalizedText DeathMessage => CalamityUtils.GetText("NPCs.PerforatorSmall"); + public override void BossLoot(ref int potionType) => potionType = ItemID.HealingPotion; public override bool SpecialOnKill() { diff --git a/NPCs/Perforator/PerforatorHive.cs b/NPCs/Perforator/PerforatorHive.cs index 144a0ed936..3889abcdb1 100644 --- a/NPCs/Perforator/PerforatorHive.cs +++ b/NPCs/Perforator/PerforatorHive.cs @@ -18,6 +18,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Ranged; using CalamityMod.Items.Weapons.Rogue; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -43,13 +44,21 @@ namespace CalamityMod.NPCs.Perforator public static readonly SoundStyle DeathSound = new("CalamityMod/Sounds/NPCKilled/PerfHiveDeath"); public static Asset GlowTexture; + // Squash n' stretch won't affect actual hitbox size + private const int Width = 110; + private const int Height = 100; - private int biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - private bool small = false; - private bool medium = false; - private bool large = false; + private bool smallSpawned = false; + private bool mediumSpawned = false; + private bool largeSpawned = false; private int wormsAlive = 0; + private float addedStretch; + private int squashTimer = 0; // Tracks current progress in scaling animation + private const int squashInterval = 24; + private const float maxSquash = 0.3f; // Upper intensity + private float wormSpawnStateTimer = 0f; // For managing worm spawn animation + public override void SetStaticDefaults() { Main.npcFrameCount[Type] = 10; @@ -63,19 +72,23 @@ namespace CalamityMod.NPCs.Perforator } } + public static int BloodGeyserDamage = 12; // 48 + public static int IchorShotDamage = 12; // 48 + public static int IchorBlobDamage = 12; // 48 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; NPC.npcSlots = 18f; - NPC.GetNPCDamage(); - NPC.width = 110; - NPC.height = 100; + NPC.damage = 30; // 48 (1.6x expert scaling) + NPC.width = Width; + NPC.height = Height; NPC.defense = 4; - NPC.LifeMaxNERB(6000, 7200, 270000); + NPC.LifeMaxNERB(4800, 5750, 270000); NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 8, 0, 0); + NPC.value = Item.buyPrice(gold: 5); NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -84,9 +97,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -109,22 +119,22 @@ namespace CalamityMod.NPCs.Perforator public override void SendExtraAI(BinaryWriter writer) { - writer.Write(biomeEnrageTimer); writer.Write(wormsAlive); - writer.Write(small); - writer.Write(medium); - writer.Write(large); + writer.Write(smallSpawned); + writer.Write(mediumSpawned); + writer.Write(largeSpawned); writer.Write(NPC.localAI[2]); + writer.Write(wormSpawnStateTimer); } public override void ReceiveExtraAI(BinaryReader reader) { - biomeEnrageTimer = reader.ReadInt32(); wormsAlive = reader.ReadInt32(); - small = reader.ReadBoolean(); - medium = reader.ReadBoolean(); - large = reader.ReadBoolean(); + smallSpawned = reader.ReadBoolean(); + mediumSpawned = reader.ReadBoolean(); + largeSpawned = reader.ReadBoolean(); NPC.localAI[2] = reader.ReadSingle(); + wormSpawnStateTimer = reader.ReadSingle(); } public override void AI() @@ -139,13 +149,12 @@ namespace CalamityMod.NPCs.Perforator if (Vector2.Distance(Main.player[NPC.target].Center, NPC.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles) NPC.TargetClosest(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Variables for ichor blob phase - float blobPhaseGateValue = bossRush ? 450f : 600f; + float blobPhaseGateValue = 600f; bool floatAboveToFireBlobs = NPC.ai[2] >= blobPhaseGateValue - 120f; Player player = Main.player[NPC.target]; @@ -155,36 +164,16 @@ namespace CalamityMod.NPCs.Perforator // Phases based on life percentage bool phase2 = lifeRatio < 0.7f; - bool phase3 = medium && revenge; - // Enrage - if ((!player.ZoneCrimson || (NPC.position.Y / 16f) < Main.worldSurface) && !bossRush) - { - if (biomeEnrageTimer > 0) - biomeEnrageTimer--; - } - else - biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; + bool spawnSmall = Main.getGoodWorld ? lifeRatio < 0.85f : lifeRatio < 0.75f; + bool spawnMedium = Main.getGoodWorld ? lifeRatio < 0.60f : lifeRatio < 0.50f; + bool spawnLarge = Main.getGoodWorld ? lifeRatio < 0.45f : lifeRatio < 0.25f; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; - - float enrageScale = bossRush ? 1f : 0f; - if (biomeEnraged && (!player.ZoneCrimson || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - if (biomeEnraged && ((NPC.position.Y / 16f) < Main.worldSurface || bossRush)) - { - NPC.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || !(player.ZoneCrimson || BossRushEvent.BossRushActive)) { NPC.TargetClosest(false); player = Main.player[NPC.target]; - if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f) + if (!player.active || player.dead || Vector2.Distance(player.Center, NPC.Center) > 5600f || !(player.ZoneCrimson || BossRushEvent.BossRushActive)) { NPC.rotation = NPC.velocity.X * 0.04f; @@ -200,6 +189,8 @@ namespace CalamityMod.NPCs.Perforator return; } } + + // Natural despawn prevention else if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; @@ -208,7 +199,7 @@ namespace CalamityMod.NPCs.Perforator { // Leak projectiles everywhere and start healing int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = type == ModContent.ProjectileType() ? IchorShotDamage : BloodGeyserDamage; int spread = Main.rand.Next(-45, 46); Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread)), type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); @@ -242,79 +233,141 @@ namespace CalamityMod.NPCs.Perforator else wormsAlive = 0; - // Do not spit from side mouth while the large worm is alive - // Death Mode ignores this - if (largeWormAlive && !death) - phase3 = false; - NPC.Calamity().DR = wormsAlive * 0.3f; - if (NPC.ai[3] == 0f && NPC.life > 0) - NPC.ai[3] = NPC.lifeMax; - - bool canSpawnWorms = !small || !medium || !large || Main.getGoodWorld; - if (NPC.life > 0 && canSpawnWorms) + if (Main.netMode != NetmodeID.MultiplayerClient && wormSpawnStateTimer == 0f) { - if (Main.netMode != NetmodeID.MultiplayerClient) + if ((!smallSpawned && spawnSmall) || + (!mediumSpawned && spawnMedium) || + (!largeSpawned && spawnLarge)) { - int wormSpawnGateValue = (int)(NPC.lifeMax * (Main.getGoodWorld ? 0.15 : 0.25)); - if ((NPC.life + wormSpawnGateValue) < NPC.ai[3]) + wormSpawnStateTimer = 1f; // Start slowing down to spawn a worm + NPC.netUpdate = true; + } + } + + if (wormSpawnStateTimer > 0f) + { + + NPC.velocity *= 0.94f; // Slow down + NPC.rotation = NPC.velocity.X * 0.04f; // Update rotation to match velocity + + NPC.damage = 0; + + wormSpawnStateTimer++; + + int slowDownDuration = 20; + int waitBeforeSpawnDuration = 40; + int totalStateDuration = slowDownDuration + waitBeforeSpawnDuration; + + if (wormSpawnStateTimer >= slowDownDuration && wormSpawnStateTimer < totalStateDuration) + { + if (Main.rand.NextBool(7)) { - NPC.ai[3] = NPC.life; - int wormType = ModContent.NPCType(); - if (!small) - { - small = true; - } - else if (!medium) - { - medium = true; - wormType = ModContent.NPCType(); - } - else if (!large) - { - large = true; - wormType = ModContent.NPCType(); - } + int bloodLifetime = Main.rand.Next(20, 45); + float bloodScale = Main.rand.NextFloat(0.5f, 1f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.DarkRed, Main.rand.NextFloat(0.7f)); + float randomSpeedMultiplier = Main.rand.NextFloat(0.8f, 1.6f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit(5) * 1.5f * randomSpeedMultiplier; + bloodVelocity.Y -= 8f; - if (Main.getGoodWorld && lifeRatio < 0.5f) - { - if (lifeRatio > 0.35f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.2f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - else if (lifeRatio > 0.05f) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); - } - else - { - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); + Vector2 randomOffset = Main.rand.NextVector2Unit() * Main.rand.NextFloat(25f, 50f); + Vector2 spawnPosition = NPC.Center + randomOffset; - // Spawn two small worms in Death - if (death) - { - if (wormType == ModContent.NPCType()) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); - } - } - - NPC.TargetClosest(); - - SoundEngine.PlaySound(WormSpawn, NPC.Center); - - for (int i = 0; i < 16; i++) - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Ichor); - - for (int j = 0; j < 32; j++) - { - int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood); - Main.dust[bloodDust].noGravity = true; - Main.dust[bloodDust].scale = 3f; - bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood); - Main.dust[bloodDust].scale = 2f; - } + BloodParticle blood = new BloodParticle(spawnPosition, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); } } + + else if (wormSpawnStateTimer >= totalStateDuration) + { + // Blood vars change based on worm spawned + Color bloodColor = Color.Lerp(Color.Crimson, Color.DarkRed, Main.rand.NextFloat(0.9f)); + int bloodAmt = 0; + float minScale = 1f; + float maxScale = 1.8f; + int wormType = -1; + + if (!smallSpawned) + { + + smallSpawned = true; + wormType = ModContent.NPCType(); + + bloodAmt = 12; + } + else if (!mediumSpawned && spawnMedium) + { + mediumSpawned = true; + wormType = ModContent.NPCType(); + + bloodColor = Color.Lerp(Color.Yellow, Color.Orange, Main.rand.NextFloat(0.9f)); + bloodAmt = 12; + minScale = 1.5f; + maxScale = 2.4f; + } + else if (!largeSpawned && spawnLarge) + { + largeSpawned = true; + wormType = ModContent.NPCType(); + + bloodAmt = 18; + minScale = 1.4f; + maxScale = 2.2f; + } + + for (int i = 0; i < bloodAmt; ++i) + { + int bloodLifetime = Main.rand.Next(80, 140); + float bloodScale = Main.rand.NextFloat(minScale, maxScale); + + float randomSpeedMultiplier = Main.rand.NextFloat(1.4f, 2.2f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 4 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(NPC.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + + + if (Main.getGoodWorld && lifeRatio < 0.5f) + { + if (lifeRatio > 0.35f) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); + else if (lifeRatio > 0.2f) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); + else if (lifeRatio > 0.05f) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), ModContent.NPCType(), 1); + } + if (wormType != -1) + { + squashTimer = squashInterval; // Start scaling animation + + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); + + // Spawn two small worms in Death + if (death) + { + if (wormType == ModContent.NPCType()) + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X + Main.rand.Next(-25, 26), (int)NPC.Center.Y + Main.rand.Next(-25, 26), wormType, 1); + } + } + + NPC.TargetClosest(); + SoundEngine.PlaySound(WormSpawn, NPC.Center); + wormSpawnStateTimer = 0f; // Resets for next time its called + NPC.netUpdate = true; + } + return; // Don't progress in the AI loop until a worm has finished spawning + } + + if (squashTimer > 0) + { + squashTimer--; + addedStretch = MathHelper.Lerp(0f, maxSquash, (float) squashTimer / squashInterval); + } + else + { + addedStretch = 0f; } if (Math.Abs(NPC.Center.X - player.Center.X) > 10f) @@ -329,7 +382,7 @@ namespace CalamityMod.NPCs.Perforator // Emit ichor blobs if (phase2) { - if (wormsAlive == 0 || large || bossRush || floatAboveToFireBlobs || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (wormsAlive == 0 || largeSpawned || floatAboveToFireBlobs || Main.getGoodWorld) { NPC.ai[2] += 1f; if (NPC.ai[2] >= blobPhaseGateValue) @@ -337,10 +390,30 @@ namespace CalamityMod.NPCs.Perforator if (NPC.ai[2] < blobPhaseGateValue + 300f) { if (NPC.velocity.Length() > 0.5f) - NPC.velocity *= bossRush ? 0.94f : 0.96f; + NPC.velocity *= 0.96f; else NPC.ai[2] = blobPhaseGateValue + 300f; + } + + if (NPC.ai[2] < blobPhaseGateValue + 180f) + { + if (Main.rand.NextBool(4)) + { + int bloodLifetime = Main.rand.Next(25, 35); + float bloodScale = Main.rand.NextFloat(0.6f, 0.95f); + Color bloodColor = Color.Lerp(Color.Yellow, Color.Orange, Main.rand.NextFloat(0.8f)); + float randomSpeedMultiplier = Main.rand.NextFloat(1.5f, 2.5f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * randomSpeedMultiplier; + + Vector2 spawnPosition = NPC.Center; + spawnPosition.Y += 42; + + BloodParticle blood = new BloodParticle(spawnPosition, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + } + else { NPC.ai[2] = 0f; @@ -358,31 +431,28 @@ namespace CalamityMod.NPCs.Perforator Main.dust[ichorDust].scale = 0.5f; } - bool ichorBlobBigWormPhase = wormsAlive > 0 && large; + bool ichorBlobBigWormPhase = wormsAlive > 0 && largeSpawned; int numBlobs = expertMode ? (ichorBlobBigWormPhase ? 4 : 6) : (ichorBlobBigWormPhase ? 2 : 4); if (Main.getGoodWorld) numBlobs *= 2; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); int blobSpread = expertMode ? (ichorBlobBigWormPhase ? 66 : 100) : (ichorBlobBigWormPhase ? 33 : 66); for (int i = 0; i < numBlobs; i++) { Vector2 blobVelocity = new Vector2(Main.rand.Next(-blobSpread, blobSpread + 1), Main.rand.Next(-blobSpread, blobSpread + 1)); blobVelocity.Normalize(); - blobVelocity *= Main.rand.Next(400, 801) * (bossRush ? 0.02f : 0.01f); + blobVelocity *= Main.rand.Next(400, 801) * 0.01f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) blobVelocity *= Main.rand.NextFloat() + 1f; float blobVelocityYAdd = Math.Abs(blobVelocity.Y) * 0.25f; if (blobVelocity.Y < 2f) blobVelocity.Y = 2f + blobVelocityYAdd; - // Fall a bit further or shorter depending on which blob it is - float fallFurtherDistance = 48f * (i - numBlobs / 2); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 50f, blobVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y + fallFurtherDistance); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 50f, blobVelocity, type, IchorBlobDamage, 0f, Main.myPlayer, 0f, player.Center.Y); } } @@ -391,9 +461,6 @@ namespace CalamityMod.NPCs.Perforator } } - // Movement velocities, increased while enraged - float velocityEnrageIncrease = enrageScale; - // When firing blobs, float above the target and don't call any other projectile firing or movement code if (floatAboveToFireBlobs) { @@ -401,71 +468,13 @@ namespace CalamityMod.NPCs.Perforator NPC.damage = 0; if (revenge) - Movement(player, 9f + velocityEnrageIncrease, 0.3f, 450f); + Movement(player, 9f, 0.3f, 450f); else - Movement(player, 6f + velocityEnrageIncrease, 0.2f, 450f); + Movement(player, 6f, 0.2f, 450f); return; } - // Side mouth starts spitting when it opens - if (phase3) - { - NPC.localAI[2] += 1f; - if (NPC.frame.Y / (TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type]) == 5 && NPC.localAI[2] >= 0f) - { - // Ensure it only spits once - // Spits half as much while the medium worm is alive - NPC.localAI[2] = mediumWormAlive ? -70f : -10f; - - Vector2 centerOffset = new Vector2(NPC.direction == 1 ? 52f : -52f, -4f); - Vector2 mouthLocation = NPC.Center + centerOffset; - Vector2 spitVelocity = (mouthLocation + (Vector2.UnitX * 100f * NPC.direction) - mouthLocation).SafeNormalize(Vector2.UnitY) * 6f; - - SoundEngine.PlaySound(SoundID.Item17, mouthLocation); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int maxProjectiles = 3; - Vector2 dustSpawnBox = new Vector2(12f, 12f); - Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; - for (int i = 0; i < maxProjectiles; i++) - { - bool ichor = Main.rand.NextBool(); - int type = ichor ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Vector2 randomizedProjectileSpawnLocation = mouthLocation + Main.rand.NextVector2CircularEdge(4f, 4f); - Vector2 randomizedProjectileVelocity = spitVelocity + Main.rand.NextVector2CircularEdge(1.5f, 1.5f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), randomizedProjectileSpawnLocation, randomizedProjectileVelocity, type, damage, 0f, Main.myPlayer, 0f, player.Center.Y); - - float dustSpeed = Main.rand.NextFloat(3.0f, 9.0f); - float angleRandom = 0.05f; - Vector2 dustVelocity = new Vector2(dustSpeed, 0.0f).RotatedBy(randomizedProjectileVelocity.ToRotation()); - dustVelocity = dustVelocity.RotatedBy(-angleRandom); - dustVelocity = dustVelocity.RotatedByRandom(2.0f * angleRandom); - - if (ichor) - { - for (int j = 0; j < 4; j++) - { - int ichorDust = Dust.NewDust(randomizedProjectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Ichor); - Main.dust[ichorDust].velocity = dustVelocity; - } - } - else - { - for (int j = 0; j < 4; j++) - { - int bloodDust = Dust.NewDust(randomizedProjectileSpawnLocation - dustSpawnOffset, (int)dustSpawnBox.X, (int)dustSpawnBox.Y, DustID.Blood); - Main.dust[bloodDust].velocity = dustVelocity; - Main.dust[bloodDust].scale = 2f; - } - } - } - } - } - } - if (Main.netMode != NetmodeID.MultiplayerClient) { NPC.localAI[0] += 1f; @@ -474,24 +483,23 @@ namespace CalamityMod.NPCs.Perforator NPC.localAI[0] = 0f; SoundEngine.PlaySound(GeyserShoot, NPC.Center); - bool ichor = Main.rand.NextBool(); - int type = ichor ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); int numProj = death ? 16 : revenge ? 14 : expertMode ? 12 : 10; - if (phase3) - numProj = death ? 12 : revenge ? 10 : expertMode ? 8 : 6; if (Main.getGoodWorld) numProj *= 2; int spread = 75; float velocity = 8f; Vector2 destination = wormsAlive > 0 ? player.Center : NPC.Center - Vector2.UnitY * 100f; - Vector2 projectileVelocity = new Vector2(Vector2.Normalize(destination - NPC.Center).X * velocity, -velocity); + Vector2 projectileVelocity = new Vector2(Utils.DirectionTo(NPC.Center, destination).X * velocity, -velocity); float rotation = MathHelper.ToRadians(spread); Vector2 dustSpawnBox = new Vector2(12f, 12f); Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProj; i++) { + bool ichor = Main.rand.NextBool(); + int type = ichor ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = ichor ? IchorShotDamage : BloodGeyserDamage; + Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); Vector2 randomVelocity = new Vector2(Main.rand.NextFloat() - 0.5f, Main.rand.NextFloat() - 0.5f); Vector2 projectileSpawnLocation = NPC.Center + Vector2.Normalize(perturbedSpeed) * 50f; @@ -535,14 +543,14 @@ namespace CalamityMod.NPCs.Perforator // Set damage NPC.damage = NPC.defDamage; - if (large || death) - Movement(player, 13f + velocityEnrageIncrease, death ? 0.115f : 0.1f, 20f); - else if (medium) - Movement(player, 12f + velocityEnrageIncrease, death ? 0.11f : 0.095f, 30f); - else if (small) - Movement(player, 11f + velocityEnrageIncrease, death ? 0.105f : 0.09f, 40f); + if (largeSpawned || death) + Movement(player, 13f, death ? 0.115f : 0.1f, 20f); + else if (mediumSpawned) + Movement(player, 12f, death ? 0.11f : 0.095f, 30f); + else if (smallSpawned) + Movement(player, 11f, death ? 0.105f : 0.09f, 40f); else - Movement(player, 10f + velocityEnrageIncrease, death ? 0.1f : 0.085f, 50f); + Movement(player, 10f, death ? 0.1f : 0.085f, 50f); break; @@ -551,7 +559,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 8f + velocityEnrageIncrease, 0.2f, 350f); + Movement(player, 8f, 0.2f, 350f); break; @@ -560,7 +568,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 8f + velocityEnrageIncrease, 0.2f, 275f); + Movement(player, 8f, 0.2f, 275f); break; @@ -569,7 +577,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 8f + velocityEnrageIncrease, 0.2f, 200f); + Movement(player, 8f, 0.2f, 200f); break; } @@ -579,7 +587,7 @@ namespace CalamityMod.NPCs.Perforator // Avoid cheap bullshit NPC.damage = 0; - Movement(player, 6f + velocityEnrageIncrease, 0.15f, 350f); + Movement(player, 6f, 0.15f, 350f); } } @@ -600,22 +608,19 @@ namespace CalamityMod.NPCs.Perforator public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - spriteEffects = SpriteEffects.FlipHorizontally; + SpriteEffects spriteEffects = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Texture2D texture = TextureAssets.Npc[Type].Value; + Color drawColorAlpha = NPC.GetAlpha(drawColor); - Texture2D texture2D15 = TextureAssets.Npc[Type].Value; - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); + Vector2 scaleStretch = new Vector2(1f - addedStretch, 1f + addedStretch) * NPC.scale; + float yOffset = addedStretch * 0.5f * NPC.height; // offset from stretching - Vector2 drawLocation = NPC.Center - screenPos; - drawLocation -= new Vector2((float)texture2D15.Width, (float)(texture2D15.Height / Main.npcFrameCount[Type])) * NPC.scale / 2f; - drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); - - texture2D15 = GlowTexture.Value; + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, drawColorAlpha, NPC.rotation, NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); + texture = GlowTexture.Value; Color glowmaskColor = Color.Lerp(Color.White, Color.Yellow, 0.5f); - spriteBatch.Draw(texture2D15, drawLocation, NPC.frame, glowmaskColor, NPC.rotation, halfSizeTexture, NPC.scale, spriteEffects, 0f); + // done again to fix glowmask not matching sprite + spriteBatch.Draw(texture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY - yOffset), NPC.frame, glowmaskColor, NPC.rotation, NPC.frame.Size() * 0.5f, scaleStretch, spriteEffects, 0f); return false; } @@ -623,10 +628,10 @@ namespace CalamityMod.NPCs.Perforator public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); + NPC.damage = (int)(NPC.damage * 0.8f); } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.HealingPotion; } @@ -677,7 +682,6 @@ namespace CalamityMod.NPCs.Perforator normalOnly.Add(ItemID.CrimtaneBar, 1, 10, 15); normalOnly.Add(ItemID.Vertebrae, 1, 10, 15); normalOnly.Add(ItemID.CrimsonSeeds, 1, 10, 15); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType(), 1, 25, 30)); normalOnly.Add(ItemDropRule.ByCondition(DropHelper.Hardmode(), ItemID.Ichor, 1, 10, 20)); // Equipment @@ -702,15 +706,6 @@ namespace CalamityMod.NPCs.Perforator npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedPerforator, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - { - target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(BuffID.Ichor, 300); - } - } - public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < hit.Damage / NPC.lifeMax * 100.0; k++) @@ -732,7 +727,7 @@ namespace CalamityMod.NPCs.Perforator NPC.height = 100; NPC.position.X = NPC.position.X - (float)(NPC.width / 2); NPC.position.Y = NPC.position.Y - (float)(NPC.height / 2); - for (int i = 0; i < 40; i++) + for (int i = 0; i < 12; i++) { int ichorDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[ichorDust].velocity *= 3f; @@ -742,7 +737,7 @@ namespace CalamityMod.NPCs.Perforator Main.dust[ichorDust].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f; } } - for (int j = 0; j < 70; j++) + for (int j = 0; j < 20; j++) { int bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 3f); Main.dust[bloodDust].noGravity = true; @@ -750,6 +745,19 @@ namespace CalamityMod.NPCs.Perforator bloodDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Blood, 0f, 0f, 100, default, 2f); Main.dust[bloodDust].velocity *= 2f; } + // Blood burst + for (int i = 0; i < 24; ++i) + { + int bloodLifetime = Main.rand.Next(120, 200); + float bloodScale = Main.rand.NextFloat(1.3f, 2.6f); + Color bloodColor = Color.Lerp(Color.Crimson, Color.DarkRed, Main.rand.NextFloat(0.9f)); + float randomSpeedMultiplier = Main.rand.NextFloat(4.5f, 9f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit(6) * 2.5f * randomSpeedMultiplier; + bloodVelocity.Y -= 14f; + + BloodParticle blood = new BloodParticle(NPC.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } } } } diff --git a/NPCs/Perforator/PerforatorTailLarge.cs b/NPCs/Perforator/PerforatorTailLarge.cs index 710b6bf4db..8259cead41 100644 --- a/NPCs/Perforator/PerforatorTailLarge.cs +++ b/NPCs/Perforator/PerforatorTailLarge.cs @@ -34,12 +34,12 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 16; // 32 NPC.width = 60; NPC.height = 78; NPC.defense = 12; - NPC.LifeMaxNERB(2700, 3240, 80000); + NPC.LifeMaxNERB(2160, 2600, 80000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -55,9 +55,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -67,10 +65,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -143,21 +137,6 @@ namespace CalamityMod.NPCs.Perforator NPC.spriteDirection = -1; } - // Calculate contact damage based on velocity - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.25f; - float minimalDamageVelocity = maxChaseSpeed * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) @@ -235,7 +214,7 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 120, true); + target.AddBuff(ModContent.BuffType(), 180, true); } } } diff --git a/NPCs/Perforator/PerforatorTailMedium.cs b/NPCs/Perforator/PerforatorTailMedium.cs index 1c83b3ec71..88fb7306fd 100644 --- a/NPCs/Perforator/PerforatorTailMedium.cs +++ b/NPCs/Perforator/PerforatorTailMedium.cs @@ -36,13 +36,13 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 12; // 24 NPC.npcSlots = 5f; NPC.width = 40; NPC.height = 50; NPC.defense = 10; - NPC.LifeMaxNERB(180, 216, 7000); + NPC.LifeMaxNERB(144, 172, 7000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -58,9 +58,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -72,16 +70,11 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; NPC.realLife = -1; @@ -102,8 +95,7 @@ namespace CalamityMod.NPCs.Perforator { spawnedBlob = true; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.life = 0; @@ -117,8 +109,7 @@ namespace CalamityMod.NPCs.Perforator if (death && !spawnedBlob) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, damage, 0f, Main.myPlayer, 0f, NPC.Center.Y); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Main.rand.NextVector2CircularEdge(3f, 3f), type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer, 0f, NPC.Center.Y); } NPC.life = 0; @@ -168,22 +159,6 @@ namespace CalamityMod.NPCs.Perforator NPC.position.Y += targetY; } - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; - float minimalDamageVelocity = maxChaseSpeed * 0.8f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) @@ -267,15 +242,14 @@ namespace CalamityMod.NPCs.Perforator if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.UnitY, type, PerforatorHive.IchorBlobDamage, 0f, Main.myPlayer); for (int i = -1; i < 2; i++) //releases 3 Ichor Shots { int type2 = ModContent.ProjectileType(); Vector2 baseVelocity = Vector2.UnitY * Main.rand.NextFloat(-12.5f, -5f); int spread = Main.rand.Next(16, 36); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, baseVelocity.RotatedBy(MathHelper.ToRadians(spread * i)), type2, PerforatorHive.IchorShotDamage, 0f, Main.myPlayer); } } } @@ -284,8 +258,7 @@ namespace CalamityMod.NPCs.Perforator { if (hurtInfo.Damage > 0) { - target.AddBuff(ModContent.BuffType(), 60); - target.AddBuff(BuffID.Ichor, 60); + target.AddBuff(BuffID.Ichor, 240); } } } diff --git a/NPCs/Perforator/PerforatorTailSmall.cs b/NPCs/Perforator/PerforatorTailSmall.cs index 433f7586b5..5078662f3f 100644 --- a/NPCs/Perforator/PerforatorTailSmall.cs +++ b/NPCs/Perforator/PerforatorTailSmall.cs @@ -34,12 +34,12 @@ namespace CalamityMod.NPCs.Perforator public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 10; // 20 NPC.width = 40; NPC.height = 34; NPC.defense = 8; - NPC.LifeMaxNERB(1200, 1440, 50000); + NPC.LifeMaxNERB(960, 1152, 50000); if (Main.zenithWorld) NPC.lifeMax *= 4; @@ -55,9 +55,7 @@ namespace CalamityMod.NPCs.Perforator NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -67,10 +65,6 @@ namespace CalamityMod.NPCs.Perforator NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) @@ -143,22 +137,6 @@ namespace CalamityMod.NPCs.Perforator NPC.spriteDirection = -1; } - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float maxChaseSpeed = 16f; - float minimalContactDamageVelocity = maxChaseSpeed * 0.4f; - float minimalDamageVelocity = maxChaseSpeed * 0.8f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } - if (Main.npc[(int)NPC.ai[1]].alpha >= 85) { if (NPC.alpha > 0 && NPC.life > 0) @@ -235,7 +213,7 @@ namespace CalamityMod.NPCs.Perforator public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 60, true); + target.AddBuff(ModContent.BuffType(), 120, true); } } } diff --git a/NPCs/PlagueEnemies/Melter.cs b/NPCs/PlagueEnemies/Melter.cs index 065874a933..8b293fff79 100644 --- a/NPCs/PlagueEnemies/Melter.cs +++ b/NPCs/PlagueEnemies/Melter.cs @@ -31,20 +31,16 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.damage = 55; NPC.width = 38; NPC.height = 34; - NPC.defense = 15; - NPC.lifeMax = 630; + NPC.defense = 20; + NPC.lifeMax = 800; NPC.knockBackResist = 0.3f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit1; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PestilentSlime.cs b/NPCs/PlagueEnemies/PestilentSlime.cs index 72f79c03b4..404305cecf 100644 --- a/NPCs/PlagueEnemies/PestilentSlime.cs +++ b/NPCs/PlagueEnemies/PestilentSlime.cs @@ -31,11 +31,11 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.damage = 55; NPC.width = 40; NPC.height = 30; - NPC.defense = 12; - NPC.lifeMax = 440; + NPC.defense = 35; + NPC.lifeMax = 600; NPC.knockBackResist = 0.5f; AnimationType = NPCID.CorruptSlime; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.alpha = 60; NPC.lavaImmune = false; NPC.noGravity = false; @@ -45,10 +45,6 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlagueCharger.cs b/NPCs/PlagueEnemies/PlagueCharger.cs index c7ae9751ce..03c4d3b92a 100644 --- a/NPCs/PlagueEnemies/PlagueCharger.cs +++ b/NPCs/PlagueEnemies/PlagueCharger.cs @@ -36,14 +36,14 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.damage = 37; NPC.width = 36; NPC.height = 30; - NPC.defense = 20; + NPC.defense = 32; NPC.scale *= 0.5f; - NPC.lifeMax = 250; + NPC.lifeMax = 720; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.4f; AnimationType = NPCID.Bee; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit4; NPC.noGravity = true; NPC.noTileCollide = false; @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlagueChargerLarge.cs b/NPCs/PlagueEnemies/PlagueChargerLarge.cs index d3666be1d0..752dc4a30f 100644 --- a/NPCs/PlagueEnemies/PlagueChargerLarge.cs +++ b/NPCs/PlagueEnemies/PlagueChargerLarge.cs @@ -31,14 +31,14 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.damage = 45; NPC.width = 36; NPC.height = 30; - NPC.defense = 25; + NPC.defense = 36; NPC.scale *= 0.75f; - NPC.lifeMax = 380; + NPC.lifeMax = 840; NPC.aiStyle = NPCAIStyleID.Flying; AIType = NPCID.Bee; NPC.knockBackResist = 0.3f; AnimationType = NPCID.Bee; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit4; NPC.noGravity = true; NPC.noTileCollide = false; @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.PlagueEnemies BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs index 0374f876c4..4a8bfcc316 100644 --- a/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs +++ b/NPCs/PlagueEnemies/PlaguebringerMiniboss.cs @@ -42,9 +42,8 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.width = 66; NPC.height = 66; NPC.defense = 24; - NPC.DR_NERD(0.2f); NPC.lifeMax = 8750; - NPC.value = Item.buyPrice(0, 1, 50, 0); + NPC.value = Item.buyPrice(gold: 1, silver: 50); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; @@ -61,10 +60,6 @@ namespace CalamityMod.NPCs.PlagueEnemies { NPC.scale = 2f; } - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/Plagueshell.cs b/NPCs/PlagueEnemies/Plagueshell.cs index 55d9b3004b..4c728c12c0 100644 --- a/NPCs/PlagueEnemies/Plagueshell.cs +++ b/NPCs/PlagueEnemies/Plagueshell.cs @@ -27,11 +27,11 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.aiStyle = NPCAIStyleID.GiantTortoise; NPC.width = 46; NPC.height = 32; - NPC.defense = 32; - NPC.lifeMax = 1000; + NPC.defense = 50; + NPC.lifeMax = 1200; NPC.knockBackResist = 0.2f; AnimationType = NPCID.GiantTortoise; - NPC.value = Item.buyPrice(0, 0, 15, 0); + NPC.value = Item.buyPrice(silver: 15); NPC.HitSound = SoundID.NPCHit24; NPC.noGravity = false; Banner = NPC.type; @@ -39,10 +39,6 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlagueEnemies/Viruling.cs b/NPCs/PlagueEnemies/Viruling.cs index d8e5832bbd..df650e78ee 100644 --- a/NPCs/PlagueEnemies/Viruling.cs +++ b/NPCs/PlagueEnemies/Viruling.cs @@ -30,20 +30,16 @@ namespace CalamityMod.NPCs.PlagueEnemies NPC.damage = 60; NPC.width = 58; NPC.height = 44; - NPC.defense = 18; - NPC.lifeMax = 500; + NPC.defense = 32; + NPC.lifeMax = 900; NPC.knockBackResist = 0.3f; - NPC.value = Item.buyPrice(0, 0, 10, 0); + NPC.value = Item.buyPrice(silver: 10); NPC.HitSound = SoundID.NPCHit22; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs index 7b264b2ddc..54e52eea8d 100644 --- a/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs +++ b/NPCs/PlaguebringerGoliath/PlagueHomingMissile.cs @@ -31,8 +31,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 70; // 140 NPC.width = 22; NPC.height = 22; NPC.defense = 20; @@ -46,18 +45,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.noTileCollide = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; Lighting.AddLight(NPC.Center, 0.015f, 0.1f, 0f); @@ -112,7 +106,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { NPC.localAI[1] += 1f; float timeBeforeExploding = 480f + NPC.ai[3] * 2f; - float homingDuration = (bossRush ? 430f : death ? 340f : revenge ? 290f : expertMode ? 240f : 150f) + NPC.ai[3] * 2f; + float homingDuration = (death ? 340f : revenge ? 290f : expertMode ? 240f : 150f) + NPC.ai[3] * 2f; if (NPC.localAI[1] == timeBeforeExploding) { CheckDead(); @@ -134,7 +128,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { NPC.noTileCollide = false; - if (NPC.velocity.Length() < (bossRush ? 25f : 20f)) + if (NPC.velocity.Length() < 20f) NPC.velocity *= 1.01f; if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) @@ -266,7 +260,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath target.AddBuff(BuffID.Poisoned, 240); target.AddBuff(BuffID.Venom, 240); } - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 120); } } diff --git a/NPCs/PlaguebringerGoliath/PlagueMine.cs b/NPCs/PlaguebringerGoliath/PlagueMine.cs index 6146ad8433..eb7fb95f8f 100644 --- a/NPCs/PlaguebringerGoliath/PlagueMine.cs +++ b/NPCs/PlaguebringerGoliath/PlagueMine.cs @@ -30,7 +30,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 80; // 160 NPC.width = 42; NPC.height = 42; NPC.defense = 20; @@ -44,17 +44,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; Lighting.AddLight(NPC.Center, 0.03f, 0.2f, 0f); @@ -78,7 +73,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 vector = Main.player[NPC.target].Center - NPC.Center; float distanceRequiredForExplosion = 90f; - float timeBeforeExplosion = (bossRush ? 1000f : death ? 740f : revenge ? 520f : 400f) + NPC.ai[3] * 4f; + float timeBeforeExplosion = (death ? 740f : revenge ? 520f : 400f) + NPC.ai[3] * 4f; if (vector.Length() < distanceRequiredForExplosion || NPC.ai[0] >= timeBeforeExplosion) { CheckDead(); @@ -94,7 +89,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } NPC.TargetClosest(true); - float velocity = (bossRush ? 14f : death ? 12f : revenge ? 10f : 8f) + NPC.ai[3] * 0.04f; + float velocity = (death ? 12f : revenge ? 10f : 8f) + NPC.ai[3] * 0.04f; Vector2 npcDirection = new Vector2(NPC.Center.X + (float)(NPC.direction * 20), NPC.Center.Y + 6f); float targetX = player.position.X + (float)player.width * 0.5f - npcDirection.X; float targetY = player.Center.Y - npcDirection.Y; @@ -102,7 +97,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath float npcSpeed = velocity / targetDistance; targetX *= npcSpeed; targetY *= npcSpeed; - float inertia = (bossRush ? 35f : death ? 40f : revenge ? 45f : 50f) - NPC.ai[3] * 0.25f; + float inertia = (death ? 40f : revenge ? 45f : 50f) - NPC.ai[3] * 0.25f; NPC.velocity.X = (NPC.velocity.X * inertia + targetX) / (inertia + 1f); NPC.velocity.Y = (NPC.velocity.Y * inertia + targetY) / (inertia + 1f); } @@ -156,7 +151,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath target.AddBuff(BuffID.Poisoned, 300); target.AddBuff(BuffID.Venom, 300); } - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs index 8a18300de4..0bd369b793 100644 --- a/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs +++ b/NPCs/PlaguebringerGoliath/PlaguebringerGoliath.cs @@ -84,10 +84,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } + public static int StingerDamage = 28; // 112 + public static int NukeDamage = 35; // 140; Also applies to GFB Peanuts and Gauss Nukes + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 90; // 180 NPC.npcSlots = 64f; NPC.width = 198; NPC.height = 198; @@ -98,16 +101,13 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.aiStyle = -1; AIType = -1; NPC.boss = true; - NPC.value = Item.buyPrice(0, 30, 0, 0); + NPC.value = Item.buyPrice(gold: 25); NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit4; NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -158,10 +158,9 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.height = (int)(NPC.frame.Height * (charging ? 1.5f : 1.8f)); // Mode variables - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -186,12 +185,10 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath bool immuneToSlowingDebuffs = NPC.ai[0] == 0f || NPC.ai[0] == 4f; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Light @@ -210,7 +207,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath // Missile countdown if (halfLife && MissileCountdown == 0) - MissileCountdown = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 300 : 600; + MissileCountdown = Main.getGoodWorld ? 300 : 600; if (MissileCountdown > 1) MissileCountdown--; @@ -231,7 +228,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath Vector2 distFromPlayer = player.Center - NPC.Center; // Enrage - if (!player.ZoneJungle && !bossRush) + if (!player.ZoneJungle && !BossRushEvent.BossRushActive) { if (biomeEnrageTimer > 0) biomeEnrageTimer--; @@ -239,12 +236,12 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath else biomeEnrageTimer = CalamityGlobalNPC.biomeEnrageTimerMax; - bool biomeEnraged = biomeEnrageTimer <= 0 || bossRush; + bool biomeEnraged = biomeEnrageTimer <= 0; float enrageScale = death ? 0.5f : 0f; if (biomeEnraged) { - NPC.Calamity().CurrentlyEnraged = !bossRush; + NPC.Calamity().CurrentlyEnraged = true; enrageScale += 1.5f; } @@ -254,10 +251,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.getGoodWorld) enrageScale += 0.5f; - if (bossRush) - enrageScale = 2f; - - bool diagonalDash = (revenge && phase2) || bossRush; + bool diagonalDash = (revenge && phase2); if (NPC.ai[0] != 0f && NPC.ai[0] != 4f) NPC.rotation = NPC.velocity.X * 0.02f; @@ -545,8 +539,8 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (calamityGlobalNPC.newAI[0] > 90f) NPC.velocity *= 1.01f; - // Spawn honey in legendary rev+ - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge && calamityGlobalNPC.newAI[0] % 6f == 0f) + // Spawn honey in the stupid seed + if (Main.zenithWorld && calamityGlobalNPC.newAI[0] % 6f == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -633,7 +627,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath calamityGlobalNPC.newAI[0] += 1f; if ((Vector2.Distance(NPC.Center, player.Center) < 640f && canHitTarget) || calamityGlobalNPC.newAI[0] >= 180f) { - NPC.ai[0] = (phase3 || bossRush) ? 5f : 1f; + NPC.ai[0] = phase3 ? 5f : 1f; NPC.ai[1] = 0f; calamityGlobalNPC.newAI[0] = 0f; @@ -804,7 +798,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath NPC.direction = playerLocation < 0 ? 1 : -1; NPC.spriteDirection = NPC.direction; - if (NPC.ai[2] > ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 3f : 5f)) + if (NPC.ai[2] > 5f) { NPC.ai[0] = -1f; NPC.ai[1] = 2f; @@ -869,7 +863,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath if (Main.zenithWorld) type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = type == ModContent.ProjectileType() ? NukeDamage : StingerDamage; Projectile.NewProjectile(NPC.GetSource_FromAI(), stingerSpawnPos.X, stingerSpawnPos.Y, projXDist, projYDist, type, damage, 0f, Main.myPlayer, challengeAmt, player.position.Y); NPC.netUpdate = true; } @@ -915,7 +909,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath missileVelocity += 2f * enrageScale; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = NukeDamage; int chargeDistanceX = 600; float chargeSpeed = revenge ? 28f : 26f; @@ -980,15 +974,14 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath baseVelocity *= 0.4f; } - int missiles = bossRush ? 16 : MissileProjectiles; - int spread = bossRush ? 18 : 24; + int spread = 24; if (!gaussMode) { - for (int i = 0; i < missiles; i++) + for (int i = 0; i < MissileProjectiles; i++) { - Vector2 spawn = NPC.Center; // Normal = 96, Boss Rush = 144 - spawn.X += i * (int)(spread * 1.125) - (missiles * (spread / 2)); // Normal = -96 to 93, Boss Rush = -144 to 156 - Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / missiles))); + Vector2 spawn = NPC.Center; + spawn.X += i * (int)(spread * 1.125) - (MissileProjectiles * (spread / 2)); + Vector2 velocity = baseVelocity.RotatedBy(MathHelper.ToRadians(-MissileAngleSpread / 2 + (MissileAngleSpread * i / MissileProjectiles))); Projectile.NewProjectile(NPC.GetSource_FromAI(), spawn, velocity, type, damage, 0f, Main.myPlayer, nukeBarrageChallengeAmt, player.position.Y); } } @@ -1316,7 +1309,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.GreaterHealingPotion; } @@ -1346,7 +1339,7 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath { ModContent.ItemType(), ModContent.ItemType(), - ModContent.ItemType(), + ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), ModContent.ItemType(), @@ -1384,7 +1377,6 @@ namespace CalamityMod.NPCs.PlaguebringerGoliath public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/Polterghast/PhantomFuckYou.cs b/NPCs/Polterghast/PhantomFuckYou.cs index 5e0b097a77..9d828e3f88 100644 --- a/NPCs/Polterghast/PhantomFuckYou.cs +++ b/NPCs/Polterghast/PhantomFuckYou.cs @@ -23,18 +23,19 @@ namespace CalamityMod.NPCs.Polterghast NPCID.Sets.TrailingMode[Type] = 1; } + public static int MineDamage = 70; // 280 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.aiStyle = -1; AIType = -1; NPC.width = 30; NPC.height = 30; NPC.defense = 45; - NPC.DR_NERD(0.1f); NPC.noGravity = true; NPC.noTileCollide = true; NPC.chaseable = false; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats NPC.lifeMax = 20000; NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; @@ -98,7 +99,7 @@ namespace CalamityMod.NPCs.Polterghast direction *= 0.5f; NPC.rotation = direction.ToRotation(); - if (!chargePhase || (CalamityWorld.LegendaryMode && CalamityWorld.revenge)) + if (!chargePhase || Main.getGoodWorld) { NPC.ai[2] += 1f; float shootMineGateValue = 150f; @@ -110,10 +111,9 @@ namespace CalamityMod.NPCs.Polterghast if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float maxVelocity = 8f * tileEnrageMult; float acceleration = 1.15f + (tileEnrageMult - 1f) * 0.15f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, direction, type, damage, 1f, NPC.target, maxVelocity, acceleration); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, direction, type, MineDamage, 1f, NPC.target, maxVelocity, acceleration); } NPC.ai[2] = 0f; } diff --git a/NPCs/Polterghast/PolterPhantom.cs b/NPCs/Polterghast/PolterPhantom.cs index d5de2b05cd..d1e74b8527 100644 --- a/NPCs/Polterghast/PolterPhantom.cs +++ b/NPCs/Polterghast/PolterPhantom.cs @@ -38,13 +38,13 @@ namespace CalamityMod.NPCs.Polterghast { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 180; // 360 NPC.width = 90; NPC.height = 120; NPC.defense = 45; NPC.DR_NERD(0.1f); NPC.LifeMaxNERB(62500, 75000, 60000); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) NPC.lifeMax *= 4; NPC.knockBackResist = 0f; @@ -57,9 +57,6 @@ namespace CalamityMod.NPCs.Polterghast NPC.HitSound = SoundID.NPCHit36; NPC.DeathSound = SoundID.NPCDeath39; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void BossHeadRotation(ref float rotation) @@ -97,10 +94,9 @@ namespace CalamityMod.NPCs.Polterghast { CalamityGlobalNPC.ghostBossClone = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; if (CalamityGlobalNPC.ghostBoss < 0 || !Main.npc[CalamityGlobalNPC.ghostBoss].active) { @@ -142,7 +138,7 @@ namespace CalamityMod.NPCs.Polterghast float velocity = 3f; float acceleration = 0.03f; - if (!player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0) + if (!player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0) { despawnTimer--; if (despawnTimer <= 0) @@ -176,26 +172,21 @@ namespace CalamityMod.NPCs.Polterghast } // Predictiveness - Vector2 predictionVector = chargePhase && bossRush ? player.velocity * 20f : Vector2.Zero; - Vector2 lookAt = player.Center + predictionVector; + Vector2 lookAt = player.Center; Vector2 rotationVector = lookAt - vector; // Rotation if (NPC.Calamity().newAI[3] == 0f) { - float playerXDestination = player.Center.X + predictionVector.X - vector.X; - float playerYDestination = player.Center.Y + predictionVector.Y - vector.Y; + float playerXDestination = player.Center.X - vector.X; + float playerYDestination = player.Center.Y - vector.Y; NPC.rotation = (float)Math.Atan2(playerYDestination, playerXDestination) + MathHelper.PiOver2; } else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - int reducedSetDamage = (int)Math.Round(NPC.defDamage * 0.5); - if (!chargePhase) { - NPC.damage = reducedSetDamage; - // Set this here to avoid despawn issues reachedChargingPoint = false; @@ -232,7 +223,7 @@ namespace CalamityMod.NPCs.Polterghast float movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); float maxDistanceFromHooks = expertMode ? 650f : 500f; - if (speedBoost || bossRush) + if (speedBoost) maxDistanceFromHooks += 250f; if (death) maxDistanceFromHooks += maxDistanceFromHooks * 0.1f * (1f - lifeRatio); @@ -311,23 +302,17 @@ namespace CalamityMod.NPCs.Polterghast if (NPC.Calamity().newAI[1] == 0f) { - NPC.damage = NPC.defDamage; - NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; NPC.Calamity().newAI[1] = 1f; } else { - NPC.damage = NPC.defDamage; - NPC.Calamity().newAI[2] += 1f; // Slow down for a few frames float totalChargeTime = chargeDistance * 4f / chargeVelocity; float slowDownTime = chargeVelocity; { - NPC.damage = reducedSetDamage; - if (NPC.Calamity().newAI[2] >= totalChargeTime - slowDownTime) NPC.velocity *= 0.9f; } @@ -352,9 +337,6 @@ namespace CalamityMod.NPCs.Polterghast } else { - // Do not deal damage during movement to avoid cheap bullshit hits - NPC.damage = 0; - // Random location choice if (NPC.ai[0] == 0f) { @@ -544,7 +526,6 @@ namespace CalamityMod.NPCs.Polterghast public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Polterghast/Polterghast.cs b/NPCs/Polterghast/Polterghast.cs index 34c64b4665..ed71bbe269 100644 --- a/NPCs/Polterghast/Polterghast.cs +++ b/NPCs/Polterghast/Polterghast.cs @@ -65,27 +65,27 @@ namespace CalamityMod.NPCs.Polterghast public static List creepySounds = new List { - NPCs.DevourerofGods.DevourerofGodsHead.AttackSound, - NPCs.Providence.Providence.HolyRaySound, - NPCs.ExoMechs.Ares.AresBody.EnragedSound, - NPCs.ExoMechs.Ares.AresBody.LaserStartSound, - NPCs.ExoMechs.Thanatos.ThanatosHead.VentSound, - NPCs.SupremeCalamitas.SupremeCalamitas.SepulcherSummonSound, - NPCs.SupremeCalamitas.SupremeCalamitas.SpawnSound, - NPCs.Ravager.RavagerBody.LimbLossSound, - NPCs.HiveMind.HiveMind.RoarSound, - NPCs.Yharon.Yharon.RoarSound, - NPCs.DesertScourge.DesertScourgeHead.RoarSound, - NPCs.OldDuke.OldDuke.RoarSound, - NPCs.Abyss.ReaperShark.SearchRoarSound, - NPCs.Abyss.ReaperShark.EnragedRoarSound, - NPCs.Abyss.LuminousCorvina.ScreamSound, - NPCs.Abyss.DevilFish.MaskBreakSound, - NPCs.PrimordialWyrm.PrimordialWyrmHead.ChargeSound, - NPCs.GreatSandShark.GreatSandShark.RoarSound, - NPCs.AcidRain.Mauler.RoarSound, - NPCs.AstrumDeus.AstrumDeusHead.DeathSound, - NPCs.AstrumAureus.AstrumAureus.HitSound, + DevourerofGods.DevourerofGodsHead.AttackSound, + Providence.Providence.HolyRaySound, + ExoMechs.Ares.AresBody.EnragedSound, + ExoMechs.Ares.AresBody.LaserStartSound, + ExoMechs.Thanatos.ThanatosHead.VentSound, + SupremeCalamitas.SupremeCalamitas.SepulcherSummonSound, + SupremeCalamitas.SupremeCalamitas.SpawnSound, + Ravager.RavagerBody.LimbLossSound, + HiveMind.HiveMind.RoarSound, + Yharon.Yharon.RoarSound, + DesertScourge.DesertScourgeHead.RoarSound, + OldDuke.OldDuke.RoarSound, + ReaperShark.SearchRoarSound, + ReaperShark.EnragedRoarSound, + LuminousCorvina.ScreamSound, + DevilFish.MaskBreakSound, + PrimordialWyrm.PrimordialWyrmHead.ChargeSound, + GreatSandShark.GreatSandShark.RoarSound, + AcidRain.Mauler.RoarSound, + AstrumDeus.AstrumDeusHead.DeathSound, + AstrumAureus.AstrumAureus.HitSound, SoundID.ScaryScream, SoundID.DD2_KoboldFlyerHurt }; @@ -103,11 +103,18 @@ namespace CalamityMod.NPCs.Polterghast } } + public static float Phase2ContactDamageMult = 1.25f; // 300 + public static float Phase3ContactDamageMult = 1.5f; // 360 + public static int BlueShotDamage = 60; // 240 + public static int BlueBlastDamage = 65; // 260 + public static int RedShotDamage = 65; // 260 + public static int RedBlastDamage = 70; // 280 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.npcSlots = 50f; - NPC.GetNPCDamage(); NPC.width = 90; NPC.height = 120; NPC.defense = 90; @@ -116,17 +123,13 @@ namespace CalamityMod.NPCs.Polterghast NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(1, 50, 0, 0); + NPC.value = Item.buyPrice(platinum: 1); NPC.boss = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.netAlways = true; NPC.HitSound = HitSound; NPC.DeathSound = SoundID.NPCDeath39; - NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -203,12 +206,11 @@ namespace CalamityMod.NPCs.Polterghast // Variables Vector2 vector = NPC.Center; - bool bossRush = BossRushEvent.BossRushActive; bool speedBoost = false; bool despawnBoost = false; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Phases bool phase2 = lifeRatio < (death ? 0.9f : revenge ? 0.8f : expertMode ? 0.65f : 0.5f); @@ -331,7 +333,7 @@ namespace CalamityMod.NPCs.Polterghast } } - bool despawn = !player.ZoneDungeon && !bossRush && player.position.Y < Main.worldSurface * 16.0; + bool despawn = !player.ZoneDungeon && !BossRushEvent.BossRushActive && player.position.Y < Main.worldSurface * 16.0; if (despawn) { despawnTimer--; @@ -416,26 +418,19 @@ namespace CalamityMod.NPCs.Polterghast float baseProjectileVelocity = speedBoost ? 9.375f : 7.5f; // Predictiveness - Vector2 predictionVector = chargePhase && bossRush ? player.velocity * 20f : Vector2.Zero; - Vector2 lookAt = player.Center + predictionVector; + Vector2 lookAt = player.Center; Vector2 rotationVector = lookAt - vector; // Rotation if (calamityGlobalNPC.newAI[3] == 0f) { - float playerXDestination = player.Center.X + predictionVector.X - vector.X; - float playerYDestination = player.Center.Y + predictionVector.Y - vector.Y; + float playerXDestination = player.Center.X - vector.X; + float playerYDestination = player.Center.Y - vector.Y; NPC.rotation = (float)Math.Atan2(playerYDestination, playerXDestination) + MathHelper.PiOver2; } else NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; - int phase1ReducedSetDamage = (int)Math.Round(NPC.defDamage * 0.5); - int phase2Damage = (int)Math.Round(NPC.defDamage * 1.2); - int phase2ReducedSetDamage = (int)Math.Round(phase2Damage * 0.5); - int phase3Damage = (int)Math.Round(NPC.defDamage * 1.4); - int phase3ReducedSetDamage = (int)Math.Round(phase3Damage * 0.5); - if (!chargePhase) { NPC.ai[2] += 1f; @@ -472,7 +467,7 @@ namespace CalamityMod.NPCs.Polterghast float movementLimitedDistance = (float)Math.Sqrt(movementLimitedXDist * movementLimitedXDist + movementLimitedYDist * movementLimitedYDist); float maxDistanceFromHooks = expertMode ? 650f : 500f; - if (speedBoost || bossRush) + if (speedBoost) maxDistanceFromHooks += 250f; if (death) maxDistanceFromHooks += maxDistanceFromHooks * 0.1f * (1f - lifeRatio); @@ -542,15 +537,11 @@ namespace CalamityMod.NPCs.Polterghast if (calamityGlobalNPC.newAI[1] == 0f) { - NPC.damage = phase3 ? phase3Damage : phase2 ? phase2Damage : NPC.defDamage; - NPC.velocity = Vector2.Normalize(rotationVector) * chargeVelocity; calamityGlobalNPC.newAI[1] = 1f; } else { - NPC.damage = phase3 ? phase3Damage : phase2 ? phase2Damage : NPC.defDamage; - calamityGlobalNPC.newAI[2] += 1f; // Slow down for a few frames @@ -558,8 +549,6 @@ namespace CalamityMod.NPCs.Polterghast float slowDownTime = chargeVelocity; if (calamityGlobalNPC.newAI[2] >= totalChargeTime - slowDownTime) { - NPC.damage = phase3 ? phase3ReducedSetDamage : phase2 ? phase2ReducedSetDamage : phase1ReducedSetDamage; - NPC.velocity *= 0.9f; } @@ -587,8 +576,6 @@ namespace CalamityMod.NPCs.Polterghast } else { - NPC.damage = phase3 ? phase3ReducedSetDamage : phase2 ? phase2ReducedSetDamage : phase1ReducedSetDamage; - // Pick a charging location // Set charge locations X if (vector.X >= player.Center.X) @@ -668,9 +655,7 @@ namespace CalamityMod.NPCs.Polterghast // Phase 1: "Polterghast" if (!phase2 && !phase3) { - if (!isInChargePhase) - NPC.damage = phase1ReducedSetDamage; - + NPC.damage = NPC.defDamage; NPC.defense = NPC.defDefense; if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) @@ -693,13 +678,14 @@ namespace CalamityMod.NPCs.Polterghast if (notLiningUpCharge) { int type = ModContent.ProjectileType(); + int damage = BlueShotDamage; if (Main.rand.NextBool(3)) { NPC.localAI[1] = -30f; type = ModContent.ProjectileType(); + damage = BlueBlastDamage; } - int damage = NPC.GetProjectileDamage(type); Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) @@ -712,14 +698,13 @@ namespace CalamityMod.NPCs.Polterghast else { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 6; i++) { float offset = MathHelper.ToRadians(MathHelper.Lerp(-40f, 40f, i / 5f)); - Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, BlueBlastDamage, 0f, Main.myPlayer); shot.timeLeft = 450; } } @@ -773,9 +758,7 @@ namespace CalamityMod.NPCs.Polterghast } } - if (!isInChargePhase) - NPC.damage = phase2ReducedSetDamage; - + NPC.damage = (int)Math.Round(NPC.defDamage * Phase2ContactDamageMult); NPC.defense = (int)Math.Round(NPC.defDefense * 0.8); if (Main.netMode != NetmodeID.MultiplayerClient && !isInChargePhase) @@ -798,13 +781,14 @@ namespace CalamityMod.NPCs.Polterghast if (notLiningUpCharge) { int type = ModContent.ProjectileType(); + int damage = RedShotDamage; if (Main.rand.NextBool(3)) { NPC.localAI[1] = -30f; type = ModContent.ProjectileType(); + damage = RedBlastDamage; } - int damage = NPC.GetProjectileDamage(type); Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 1f); Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 7; i++) @@ -817,13 +801,12 @@ namespace CalamityMod.NPCs.Polterghast else { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * (baseProjectileVelocity + 5f); Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < 7; i++) { float offset = MathHelper.ToRadians(MathHelper.Lerp(-50f, 50f, i / 6f)); - Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, damage, 0f, Main.myPlayer); + Projectile shot = Projectile.NewProjectileDirect(NPC.GetSource_FromAI(), firingPos, spreadVel.RotatedBy(offset), type, RedBlastDamage, 0f, Main.myPlayer); shot.timeLeft = 450; } } @@ -894,9 +877,7 @@ namespace CalamityMod.NPCs.Polterghast } } - if (!isInChargePhase) - NPC.damage = phase3ReducedSetDamage; - + NPC.damage = (int)Math.Round(NPC.defDamage * Phase3ContactDamageMult); NPC.defense = (int)Math.Round(NPC.defDefense * 0.5); NPC.localAI[1] += 1f; @@ -907,8 +888,9 @@ namespace CalamityMod.NPCs.Polterghast { int numProj = (getPissed ? 10 : 8); float maxSpread = getPissed ? 125 : 110; - int type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + bool red = Main.rand.NextBool(); + int type = red ? ModContent.ProjectileType() : ModContent.ProjectileType(); + int damage = red ? RedShotDamage : BlueShotDamage; Vector2 spreadVel = NPC.SafeDirectionTo(Main.player[NPC.target].Center) * baseProjectileVelocity; Vector2 firingPos = NPC.Center + spreadVel * 3f; for (int i = 0; i < numProj; i++) @@ -949,7 +931,7 @@ namespace CalamityMod.NPCs.Polterghast } } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1226,7 +1208,6 @@ namespace CalamityMod.NPCs.Polterghast public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/Polterghast/PolterghastHook.cs b/NPCs/Polterghast/PolterghastHook.cs index a31142c7f1..1a19e9ce1f 100644 --- a/NPCs/Polterghast/PolterghastHook.cs +++ b/NPCs/Polterghast/PolterghastHook.cs @@ -32,11 +32,13 @@ namespace CalamityMod.NPCs.Polterghast } } + public static int ShotDamage = 55; // 220 + public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.aiStyle = -1; AIType = -1; - NPC.damage = 0; NPC.width = 40; NPC.height = 40; NPC.lifeMax = 50000; @@ -150,7 +152,7 @@ namespace CalamityMod.NPCs.Polterghast NPC.ai[2] += 1f; if (NPC.ai[3] == 0f) { - if (NPC.ai[2] > ((CalamityWorld.LegendaryMode && revenge) ? 12f : 120f)) + if (NPC.ai[2] > (Main.getGoodWorld ? 40f : 120f)) { NPC.ai[2] = 0f; NPC.ai[3] = 1f; @@ -166,11 +168,10 @@ namespace CalamityMod.NPCs.Polterghast { float shotSpeed = 10f * tileEnrageMult; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); targetDistance = shotSpeed / targetDistance; targetX *= targetDistance; targetY *= targetDistance; - Projectile.NewProjectile(NPC.GetSource_FromAI(), hookPosition.X, hookPosition.Y, targetX, targetY, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), hookPosition.X, hookPosition.Y, targetX, targetY, type, ShotDamage, 0f, Main.myPlayer, 0f, 0f); } } return; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs index abbf84aaa3..3da6b9ad65 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBody.cs @@ -31,7 +31,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void SetDefaults() { - NPC.damage = 100; + NPC.damage = 0; // No contact damage NPC.width = 100; NPC.height = 88; NPC.defense = 0; @@ -65,8 +65,6 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void AI() { - NPC.damage = 0; - // Difficulty modes bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs index c89ee5b210..5a8d2566a7 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmBodyAlt.cs @@ -27,9 +27,11 @@ namespace CalamityMod.NPCs.PrimordialWyrm } } + public static int FireballDamage = 110; // 440 + public override void SetDefaults() { - NPC.damage = 100; + NPC.damage = 0; NPC.width = 110; NPC.height = 88; NPC.defense = 0; @@ -63,8 +65,6 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void AI() { - NPC.damage = 0; - // Difficulty modes bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; @@ -134,8 +134,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm Vector2 destination = Main.player[Main.npc[(int)NPC.ai[2]].target].Center - NPC.Center; Vector2 velocity = Vector2.Normalize(destination) * fireballVelocity; int type = ProjectileID.CultistBossFireBallClone; - int damage = NPC.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, FireballDamage, 0f, Main.myPlayer); Main.projectile[proj].tileCollide = false; } } diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs index 3e312cbf39..8786ae0910 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmHead.cs @@ -108,11 +108,18 @@ namespace CalamityMod.NPCs.PrimordialWyrm } } + public static int IceMistDamage = 110; // 440 + public static int LightningDamage = 140; // 560 + + // Reused Cultist projectiles + public static float LightDamageMult = 2.445f; // 440 + public static float DoomDamageMult = 2.445f; // 440 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 300; // 600 NPC.npcSlots = 50f; - NPC.GetNPCDamage(); NPC.width = 230; NPC.height = 138; NPC.LifeMaxNERB(2500000, 3000000); @@ -120,7 +127,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm AIType = -1; NPC.Opacity = 0f; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(5, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 5); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; @@ -212,7 +219,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm // Target variable Player player = Main.player[NPC.target]; - bool targetDownDeep = player.Calamity().ZoneAbyssLayer4 || BossRushEvent.BossRushActive; + bool targetDownDeep = player.Calamity().ZoneAbyssLayer4; bool targetOnMount = player.mount.Active; // Check whether enraged for the sake of the HP bar UI @@ -340,12 +347,10 @@ namespace CalamityMod.NPCs.PrimordialWyrm bool immuneToSlowingDebuffs = AIState == (float)Phase.FinalPhase || AIState == (float)Phase.ShadowFireballSpin; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; NPC.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - NPC.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; NPC.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Adjust opacity @@ -648,22 +653,21 @@ namespace CalamityMod.NPCs.PrimordialWyrm float ai = Main.rand.Next(100); Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; int type = ProjectileID.CultistBossLightningOrbArc; - int damage = NPC.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, LightningDamage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; // Opposite bolt projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; ai = Main.rand.Next(100); projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, LightningDamage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; // Normal bolt projectileDestination = targetCenterArray[i] - NPC.Center; ai = Main.rand.Next(100); projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * lightningVelocity; - proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, LightningDamage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; } } @@ -942,18 +946,17 @@ namespace CalamityMod.NPCs.PrimordialWyrm Vector2 projectileDestination = targetCenterArray[i] + Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; Vector2 projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; int type = ProjectileID.CultistBossIceMist; - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, IceMistDamage, 0f, Main.myPlayer, 0f, 1f); // Opposite mist projectileDestination = targetCenterArray[i] - Main.player[whoAmIArray[i]].velocity * predictionAmt - NPC.Center; projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, IceMistDamage, 0f, Main.myPlayer, 0f, 1f); // Normal bolt projectileDestination = targetCenterArray[i] - NPC.Center; projectileVelocity = Vector2.Normalize(projectileDestination) * iceMistVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, IceMistDamage, 0f, Main.myPlayer, 0f, 1f); } } @@ -1149,13 +1152,12 @@ namespace CalamityMod.NPCs.PrimordialWyrm if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.CultistBossLightningOrbArc; - int damage = NPC.GetProjectileDamage(type); for (int i = 0; i < numLightningBolts; i++) { Vector2 projectileDestination = player.Center - lightningSpawnLocation; Vector2 projectileVelocity = Vector2.Normalize(projectileDestination.RotatedByRandom(MathHelper.PiOver4)) * baseVelocity * 0.5f; float ai = Main.rand.Next(100); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), lightningSpawnLocation, projectileVelocity, type, damage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), lightningSpawnLocation, projectileVelocity, type, LightningDamage, 0f, Main.myPlayer, projectileDestination.ToRotation(), ai); Main.projectile[proj].tileCollide = false; lightningSpawnLocation.Y += distanceBetweenBolts; if (i == numLightningBolts / 2) @@ -1477,7 +1479,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -1526,7 +1528,6 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void ModifyTypeName(ref string typeName) diff --git a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs index cb7c3ff52e..1796a73b70 100644 --- a/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs +++ b/NPCs/PrimordialWyrm/PrimordialWyrmTail.cs @@ -28,7 +28,7 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void SetDefaults() { - NPC.damage = 100; + NPC.damage = 0; NPC.width = 100; NPC.height = 120; NPC.defense = 0; @@ -52,8 +52,6 @@ namespace CalamityMod.NPCs.PrimordialWyrm public override void AI() { - NPC.damage = 0; - // Difficulty modes bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs index 4afdca7d56..c18317d5c6 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianCommander.cs @@ -65,12 +65,17 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } + public static int FireDamage = 36; // 144; HolyFire, HolyFire2 + public static int SpearDamage = 42; // 168; HolySpear, ProfanedSpear + public static int HolyBlastDamage = 60; // 240 + public static int RayDamage = 80; // 320 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 120; // 240 NPC.npcSlots = 20f; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 228; NPC.height = 186; NPC.defense = 40; @@ -82,16 +87,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians AIType = -1; NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(gold: 50); NPC.HitSound = SoundID.NPCHit52; NPC.DeathSound = SoundID.NPCDeath55; NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -153,10 +155,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Rotation NPC.rotation = NPC.velocity.X * 0.005f; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -359,7 +360,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians float goLowOrHighDistance = 540f; // Side swap variables for Phase 2 - float defenderCommanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float defenderCommanderGuardPhase2Duration = death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float moveToOtherSideInPhase2GateValue = defenderCommanderGuardPhase2Duration - 120f; float timeBeforeMoveToOtherSideInPhase2Reset = moveToOtherSideInPhase2GateValue * 2f; float totalGoLowDurationPhase2 = 210f; @@ -367,13 +368,11 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = bossRush ? 32f : death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; + float maxChargeVelocity = death ? 28f : revenge ? 26f : expertMode ? 24f : 20f; if (Main.getGoodWorld) - maxChargeVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && revenge) maxChargeVelocity *= 2f; - float inertia = bossRush ? 40f : death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; + float inertia = death ? 45f : revenge ? 47f : expertMode ? 50f : 55f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (!phase1) @@ -456,7 +455,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (!goLow && !goLowPhase2 && !goHigh) calamityGlobalNPC.newAI[0] = -NPC.direction; - float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (healerAlive) @@ -493,7 +492,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 targetVector = destination - NPC.Center; Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; - float phaseGateValue = bossRush ? 50f : death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; + float phaseGateValue = death ? 66f : revenge ? 75f : expertMode ? 83f : 100f; bool continueShootingProjectiles = phase1 || (NPC.ai[2] < (phaseGateValue * 5f)); if (continueShootingProjectiles) @@ -507,7 +506,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Alternate between firing profaned spears and holy fire // Shoot holy blasts in final phase NPC.ai[2] += 1f; - float projectileShootGateValue = bossRush ? 40f : death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; + float projectileShootGateValue = death ? 60f : revenge ? 90f : expertMode ? 100f : 150f; if (NPC.ai[2] % projectileShootGateValue == 0f) { if (phase1) @@ -521,10 +520,10 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool shootSpear = NPC.ai[2] % (projectileShootGateValue * 2f) == 0f; - float projectileVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float projectileVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; Vector2 finalProjectileVelocity = Vector2.Normalize(player.Center - shootFrom) * projectileVelocity; int type = shootSpear ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = shootSpear ? SpearDamage : FireDamage; if (type == ModContent.ProjectileType()) finalProjectileVelocity *= 0.5f; @@ -534,8 +533,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (fireExtraProjectiles && shootSpear) { - int baseProjectileAmt = bossRush ? 4 : 2; - int spread = bossRush ? 18 : 10; + int baseProjectileAmt = 2; + int spread = 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -554,18 +553,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians else { // Shoot holy blasts - float holyBlastVelocity = bossRush ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + float holyBlastVelocity = death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; int projTimeLeft = (int)(2000f / holyBlastVelocity); Vector2 finalHolyBlastVelocity = Vector2.Normalize(player.Center - shootFrom) * holyBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalHolyBlastVelocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); - Main.projectile[proj].timeLeft = projTimeLeft; - } + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, finalHolyBlastVelocity, ModContent.ProjectileType(), HolyBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); + Main.projectile[proj].timeLeft = projTimeLeft; } // Dust for blasting out the holy blasts @@ -667,7 +661,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = bossRush ? 90f : death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; + float phaseGateValue = death ? 100f : revenge ? 110f : expertMode ? 120f : 135f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -688,7 +682,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = bossRush ? 1.053333f : death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; + float velocityMult = death ? 1.05037f : revenge ? 1.047407f : expertMode ? 1.044444f : 1.04f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -732,10 +726,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians for (int k = 0; k < totalDustPerProjectile; k++) Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, projectileVelocity.X, projectileVelocity.Y, 0, default, 1f); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, ModContent.ProjectileType(), FireDamage, 0f, Main.myPlayer); } } } @@ -791,7 +783,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians bool targetRanAwayAndWillNowBeFucked = NPC.ai[2] == 1f; bool boostVelocityToCatchUp = NPC.ai[1] == 0f || targetRanAwayAndWillNowBeFucked; - float velocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float velocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) velocity *= 1.25f; if (boostVelocityToCatchUp) @@ -803,7 +795,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 desiredVelocity = targetVector.SafeNormalize(new Vector2(NPC.direction, 0f)) * velocity; float totalSpears = 12f; - float shootDuration = bossRush ? 240f : death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; + float shootDuration = death ? 280f : revenge ? 300f : expertMode ? 320f : 360f; float dontShootTime = shootDuration * 0.3f; float phaseGateValue = dontShootTime + shootDuration; @@ -848,7 +840,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } else if (NPC.ai[1] % spearShootDivisor == 0f) { - float spearVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float spearVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; if (Main.getGoodWorld) spearVelocity *= 1.25f; if (boostVelocityToCatchUp) @@ -856,8 +848,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 velocity2 = Vector2.Normalize(player.Center - shootFrom) * spearVelocity; Vector2 knockbackVelocity = velocity2 * 0.1f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, shootFrom); for (int k = 0; k < totalDustPerProjectile; k++) @@ -866,8 +856,8 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[1] % (spearShootDivisor * 3) == 0f || targetRanAwayAndWillNowBeFucked) { knockbackVelocity *= 2f; - int baseProjectileAmt = bossRush ? 8 : expertMode ? 6 : 4; - int spread = bossRush ? 60 : expertMode ? 50 : 40; + int baseProjectileAmt = expertMode ? 6 : 4; + int spread = expertMode ? 50 : 40; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < baseProjectileAmt; i++) { @@ -877,12 +867,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians Dust.NewDust(shootFrom, 30, 30, (int)CalamityDusts.ProfanedFire, perturbedSpeed.X, perturbedSpeed.Y, 0, default, 1f); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, perturbedSpeed, type, damage, 0f, Main.myPlayer, targetRanAwayAndWillNowBeFucked ? -2f : -1f, -30f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, perturbedSpeed, ModContent.ProjectileType(), SpearDamage, 0f, Main.myPlayer, targetRanAwayAndWillNowBeFucked ? -2f : -1f, -30f); } } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2 * 0.85f, type, damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2 * 0.85f, ModContent.ProjectileType(), SpearDamage, 0f, Main.myPlayer, 1f, 0f); if (!targetRanAwayAndWillNowBeFucked) NPC.velocity = -knockbackVelocity; @@ -903,7 +893,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } float laserGateValue = 120f; - float velocity = bossRush ? 4.5f : death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; + float velocity = death ? 4f : revenge ? 3.75f : expertMode ? 3.5f : 3f; if (NPC.ai[1] < laserGateValue) velocity *= 6f; if (Main.getGoodWorld) @@ -959,7 +949,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { if (NPC.ai[2] == laserGateValue) { - float rotation = bossRush ? 435f : death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; + float rotation = death ? 445f : revenge ? 450f : expertMode ? 455f : 465f; if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && Vector2.Distance(Main.LocalPlayer.Center, NPC.Center) < 2800f) SoundEngine.PlaySound(HolyRaySound, Main.LocalPlayer.Center); @@ -973,23 +963,20 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (laserVelocity.X < 0f) beamDirection = 1f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - // 60 degrees offset laserVelocity = laserVelocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, laserVelocity, type, damage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, laserVelocity, ModContent.ProjectileType(), RayDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); // -60 degrees offset if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, type, damage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, ModContent.ProjectileType(), RayDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); - if (CalamityWorld.LegendaryMode && revenge) + if (CalamityWorld.death) { rotation *= 0.33f; laserVelocity = laserVelocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, laserVelocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, laserVelocity, ModContent.ProjectileType(), RayDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, -laserVelocity, ModContent.ProjectileType(), RayDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI); } NPC.netUpdate = true; @@ -1206,13 +1193,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians return false; } - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.SuperHealingPotion; + public override void BossLoot(ref int potionType) => potionType = ItemID.SuperHealingPotion; public override void ModifyNPCLoot(NPCLoot npcLoot) { npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ModContent.ItemType(), 7); - npcLoot.Add(ModContent.ItemType(), 5); + npcLoot.Add(ModContent.ItemType(), 4); npcLoot.Add(ModContent.ItemType(), 10); npcLoot.Add(ModContent.ItemType()); npcLoot.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 1, 15, 20, 20, 25)); @@ -1273,13 +1260,12 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 300); + target.AddBuff(ModContent.BuffType(), 180); } public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs index 8c0774d5d3..096b038dc9 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianDefender.cs @@ -54,13 +54,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } + public static int FireDamage = 36; // 144; HolyFlare + public static int BlobDamage = 36; // 144 + public static int FireSentryDamage = 54; // 216; HolyBomb + public static int MoltenBlastDamage = 54; // 216 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 108; // 216 NPC.npcSlots = 3f; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 228; NPC.height = 164; NPC.defense = 50; @@ -76,10 +81,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -242,17 +243,16 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Get the Guardian Commander's target Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool phase1 = healerAlive; NPC.chaseable = !phase1; // Phase durations - float commanderGuardPhase2Duration = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float commanderGuardPhase2Duration = death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; float timeBeforeRocksRespawnInPhase2 = 90f; float throwRocksGateValue = 60f; @@ -261,7 +261,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Charge variables float chargeVelocityMult = 0.25f; - float maxChargeVelocity = bossRush ? 25f : death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; + float maxChargeVelocity = death ? 22f : revenge ? 20.5f : expertMode ? 19f : 16f; if (Main.getGoodWorld) maxChargeVelocity *= 1.15f; @@ -381,7 +381,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } - float moveVelocity = bossRush ? 24f : death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; + float moveVelocity = death ? 22f : revenge ? 21f : expertMode ? 20f : 18f; if (Main.getGoodWorld) moveVelocity *= 1.25f; if (healerAlive) @@ -431,7 +431,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Lay a holy bomb every once in a while in phase 1 and while not doing the laser attack if (!commanderUsingLaser) { - float projectileShootGateValue = bossRush ? 420f : death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; + float projectileShootGateValue = death ? 480f : revenge ? 510f : expertMode ? 540f : 600f; NPC.ai[1] += 1f; if (NPC.ai[1] >= projectileShootGateValue) { @@ -444,9 +444,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians projectileVelocityY += expertMode ? 4f : 3f; Vector2 projectileVelocity = new Vector2(NPC.velocity.X * 0.25f, projectileVelocityY); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, ModContent.ProjectileType(), FireSentryDamage, 0f, Main.myPlayer); } } } @@ -501,18 +499,13 @@ namespace CalamityMod.NPCs.ProfanedGuardians float shootMoltenBlastsGateValue = commanderGuardPhase2Duration / moltenBlastsDivisor; if (NPC.ai[1] % shootMoltenBlastsGateValue == 0f && !commanderGoingLowOrHighInPhase2) { - float moltenBlastVelocity = bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + float moltenBlastVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; int projTimeLeft = (int)(2400f / moltenBlastVelocity); Vector2 velocity = Vector2.Normalize(player.Center - shootFrom) * moltenBlastVelocity; if (Main.netMode != NetmodeID.MultiplayerClient) { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity, type, damage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); - Main.projectile[proj].timeLeft = projTimeLeft; - } + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity, ModContent.ProjectileType(), MoltenBlastDamage, 0f, Main.myPlayer, player.position.X, player.position.Y, 1f); + Main.projectile[proj].timeLeft = projTimeLeft; } // Dust for blasting out the molten blasts @@ -608,7 +601,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.spriteDirection = Math.Sign(NPC.velocity.X); NPC.ai[1] += 1f; - float phaseGateValue = bossRush ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; + float phaseGateValue = death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; if (NPC.ai[1] >= phaseGateValue) { NPC.ai[0] = 3f; @@ -629,7 +622,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = bossRush ? 1.04f : death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; + float velocityMult = death ? 1.036667f : revenge ? 1.035f : expertMode ? 1.033333f : 1.03f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -641,7 +634,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians else if (NPC.localAI[2] == 1f) { // Charge towards target - float inertia = bossRush ? 57f : death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; + float inertia = death ? 63f : revenge ? 66f : expertMode ? 69f : 75f; NPC.velocity = (NPC.velocity * (inertia - 1f) + targetVector * (NPC.velocity.Length() + (0.111111117f * inertia))) / inertia; // Stop charging towards the player when within a certain distance @@ -672,9 +665,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians projectileVelocityY += expertMode ? 4f : 3f; Vector2 projectileVelocity = new Vector2(NPC.velocity.X * 0.25f, projectileVelocityY); - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, ModContent.ProjectileType(), FireSentryDamage, 0f, Main.myPlayer); } } } @@ -947,7 +938,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitByProjectile(Projectile projectile, ref NPC.HitModifiers modifiers) diff --git a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs index 5a23446c69..2f7cc1f54d 100644 --- a/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs +++ b/NPCs/ProfanedGuardians/ProfanedGuardianHealer.cs @@ -50,6 +50,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians Main.npcFrameCount[Type] = 10; NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { PortraitPositionXOverride = 0, @@ -67,13 +68,18 @@ namespace CalamityMod.NPCs.ProfanedGuardians } } + public static int CrystalDamage = 48; // 192 + public static int StarDamage = 54; // 216; HolyBurnOrb + + public static int StarHeal = Main.expertMode ? 50 : 35; // HolyLight + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 0; // No contact damage NPC.npcSlots = 3f; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 228; NPC.height = 164; NPC.defense = 30; @@ -89,10 +95,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -108,7 +110,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians }); } - public float GetStarShootSlowDownGateValue() => BossRushEvent.BossRushActive ? 180f : CalamityWorld.death ? 210f : CalamityWorld.revenge ? 225f : Main.expertMode ? 240f : 270f; + public float GetStarShootSlowDownGateValue() => CalamityWorld.death ? 210f : CalamityWorld.revenge ? 225f : Main.expertMode ? 240f : 270f; public float GetStarShootGateValue() => GetStarShootSlowDownGateValue() + 60f; @@ -134,9 +136,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians { CalamityGlobalNPC.doughnutBossHealer = NPC.whoAmI; - // Avoid cheap bullshit - NPC.damage = 0; - Lighting.AddLight((int)((NPC.position.X + (NPC.width / 2)) / 16f), (int)((NPC.position.Y + (NPC.height / 2)) / 16f), 1.1f, 0.9f, 0f); if (CalamityGlobalNPC.doughnutBoss < 0 || !Main.npc[CalamityGlobalNPC.doughnutBoss].active) @@ -164,10 +163,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Get the Guardian Commander's target Player player = Main.player[Main.npc[CalamityGlobalNPC.doughnutBoss].target]; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -193,7 +191,6 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (NPC.ai[2] >= 45f) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); int totalProjectiles = 10; float radians = MathHelper.TwoPi / totalProjectiles; float projectileVelocity = 8f; @@ -201,7 +198,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, damage); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, velocity2, type, 0, 0f, Main.myPlayer, 0f, StarHeal); } NPC.ai[2] = 0f; } @@ -216,7 +213,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians } bool useCrystalShards = AIState == (float)Phase.CrystalShards; - float velocity = useCrystalShards ? (bossRush ? 18f : death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); + float velocity = useCrystalShards ? (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) : (Main.npc[CalamityGlobalNPC.doughnutBoss].velocity.Length() + 5f); if (Main.getGoodWorld) velocity *= 1.25f; @@ -267,7 +264,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { // Increment timer AITimer += 1f; - float crystalShootGateValue = bossRush ? 140f : death ? 180f : revenge ? 200f : expertMode ? 220f : 260f; + float crystalShootGateValue = death ? 180f : revenge ? 200f : expertMode ? 220f : 260f; float crystalShootPhaseDuration = crystalShootGateValue + crystalShootGateValue * 0.25f; // Generate dust that scales with how close the crystals are to firing @@ -303,8 +300,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - int totalProjectiles = bossRush ? 18 : death ? 16 : revenge ? 14 : expertMode ? 12 : 10; + int totalProjectiles = death ? 16 : revenge ? 14 : expertMode ? 12 : 10; float speedX = -12f; float speedAdjustment = Math.Abs(speedX * 2f / (totalProjectiles - 1)); float speedY = -4f; @@ -320,7 +316,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians randomizedVelocity = revenge ? (new Vector2(randomFloatX, randomFloatY) * randomVelocityMult) : Vector2.Zero; } Vector2 projectileVelocity = new Vector2(speedX + speedAdjustment * i + distanceFromDestination.SafeNormalize(Vector2.Zero).X * Math.Abs(player.velocity.X), speedY) + randomizedVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, damage, 0f, Main.myPlayer, x4); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, projectileVelocity, type, CrystalDamage, 0f, Main.myPlayer, x4); } } } @@ -343,7 +339,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians { SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, shootFrom); - int totalFlameProjectiles = bossRush ? 20 : 16; + int totalFlameProjectiles = 16; int totalRings = revenge ? 3 : 2; int healingStarChance = revenge ? 8 : expertMode ? 6 : 4; double radians = MathHelper.TwoPi / totalFlameProjectiles; @@ -360,16 +356,14 @@ namespace CalamityMod.NPCs.ProfanedGuardians Vector2 vector2 = spinningPoint.RotatedBy(radians * j); int type = ModContent.ProjectileType(); - int dmgAmt = NPC.GetProjectileDamage(type); if (Main.rand.NextBool(healingStarChance) && !death) { type = ModContent.ProjectileType(); - dmgAmt = NPC.GetProjectileDamageNoScaling(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, 0, 0f, Main.myPlayer, 0f, StarHeal); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, dmgAmt, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom, vector2, type, StarDamage, 0f, Main.myPlayer); Color dustColor = Main.hslToRgb(Main.rgbToHsl(type == ModContent.ProjectileType() ? Color.Orange : Color.Green).X, 1f, 0.5f); dustColor.A = 255; @@ -404,7 +398,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Move towards a location above the player if (distanceFromDestination.Length() > idealDistanceFromDestination) { - float inertia = bossRush ? 28f : death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; + float inertia = death ? 32f : revenge ? 34f : expertMode ? 36f : 40f; if (lifeRatio < 0.5f) inertia *= 0.8f; if (Main.getGoodWorld) diff --git a/NPCs/ProfanedGuardians/ProfanedRocks.cs b/NPCs/ProfanedGuardians/ProfanedRocks.cs index 64ea8d4e8b..d9988fbf75 100644 --- a/NPCs/ProfanedGuardians/ProfanedRocks.cs +++ b/NPCs/ProfanedGuardians/ProfanedRocks.cs @@ -43,9 +43,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 100; // 200 NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.dontTakeDamage = true; NPC.width = 50; NPC.height = 50; @@ -142,10 +142,9 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.timeLeft = 1800; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Spin and fly at the target if ((Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[0] != 0f && Main.npc[CalamityGlobalNPC.doughnutBossDefender].ai[1] >= -60f) || NPC.Calamity().newAI[0] < 0f) @@ -159,7 +158,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Distance the rock travels before it starts to fall down float maxChargeDistance = 4800f; - float chargeSpeed = bossRush ? 20f : death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; + float chargeSpeed = death ? 18f : revenge ? 17f : expertMode ? 16f : 14f; float fallDownGateValue = maxChargeDistance / chargeSpeed; // Fall down after some time and blow up if inside tiles @@ -209,7 +208,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Start off slow Vector2 finalVelocity = NPC.SafeDirectionTo(player.Center, -Vector2.UnitY) * chargeSpeed; - if (CalamityWorld.LegendaryMode && revenge) + if (Main.getGoodWorld) finalVelocity *= Main.rand.NextFloat(1f, 1.7f); NPC.Calamity().newAI[2] = finalVelocity.X; @@ -229,7 +228,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Push away from each other in Death and Boss Rush if (death) { - float pushVelocity = bossRush ? 0.2f : 0.15f; + float pushVelocity = 0.15f; foreach (NPC n in Main.ActiveNPCs) { if (n.whoAmI != NPC.whoAmI && n.type == NPC.type) @@ -257,7 +256,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians // Rotate faster and charge NPC.Calamity().newAI[1] += 1f; - float chargeGateValue = bossRush ? 60f : death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; + float chargeGateValue = death ? 80f : revenge ? 90f : expertMode ? 100f : 120f; chargeGateValue += chargeGateValue * 0.5f * NPC.ai[1]; float anglularSpeed = NPC.Calamity().newAI[1] / chargeGateValue; anglularSpeed = 0.05f + anglularSpeed * 0.2f; @@ -279,7 +278,7 @@ namespace CalamityMod.NPCs.ProfanedGuardians NPC.damage = 0; // Distance from Defender Guardian - double maxDistance = bossRush ? 360D : death ? 340D : revenge ? 330D : expertMode ? 320D : MinMaxDistance; + double maxDistance = death ? 340D : revenge ? 330D : expertMode ? 320D : MinMaxDistance; double rateOfChangeIncrease = (maxDistance / MinMaxDistance) - 1D; double rateOfChange = (NPC.ai[1] * 0.5f) + 2D + rateOfChangeIncrease; if (NPC.Calamity().newAI[0] == 0f) diff --git a/NPCs/Providence/ProvSpawnDefense.cs b/NPCs/Providence/ProvSpawnDefense.cs index ee8f6aa180..eb17e4fab3 100644 --- a/NPCs/Providence/ProvSpawnDefense.cs +++ b/NPCs/Providence/ProvSpawnDefense.cs @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Providence/ProvSpawnHealer.cs b/NPCs/Providence/ProvSpawnHealer.cs index a89548e32b..349951bee9 100644 --- a/NPCs/Providence/ProvSpawnHealer.cs +++ b/NPCs/Providence/ProvSpawnHealer.cs @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Providence/ProvSpawnOffense.cs b/NPCs/Providence/ProvSpawnOffense.cs index e9295deaa6..79901f95c9 100644 --- a/NPCs/Providence/ProvSpawnOffense.cs +++ b/NPCs/Providence/ProvSpawnOffense.cs @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.Providence NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) diff --git a/NPCs/Providence/Providence.cs b/NPCs/Providence/Providence.cs index 7a97449c25..6c9361bfb6 100644 --- a/NPCs/Providence/Providence.cs +++ b/NPCs/Providence/Providence.cs @@ -169,6 +169,7 @@ namespace CalamityMod.NPCs.Providence Main.npcFrameCount[Type] = 3; NPCID.Sets.TrailingMode[Type] = 1; NPCID.Sets.BossBestiaryPriority.Add(Type); + NPCID.Sets.NeedsExpertScaling[Type] = true; NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() { Scale = 0.2f, @@ -237,10 +238,22 @@ namespace CalamityMod.NPCs.Providence base.ModifyHoverBoundingBox(ref boundingBox); } + public static int FireDamage = 36; // 144; HolyFire, HolyFire2, HolyFlare + public static int BlobDamage = 36; // 144 + public static int FireSentryDamage = 54; // 216; HolyBomb + public static int MoltenBlastDamage = 54; // 216 + public static int StarDamage = 54; // 216; HolyBurnOrb + public static int SpearDamage = 42; // 168 + public static int CrystalDamage = 48; // 192 + public static int HolyBlastDamage = 60; // 240 + public static int RayDamage = 100; // 400 + + public static int StarHeal = Main.expertMode ? 50 : 35; // HolyLight + public override void SetDefaults() { NPC.npcSlots = 36f; - NPC.damage = 100; + NPC.damage = 0; // No contact damage NPC.width = 600; NPC.height = 450; NPC.defense = 50; @@ -249,7 +262,7 @@ namespace CalamityMod.NPCs.Providence NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(1, 50, 0, 0); + NPC.value = Item.buyPrice(platinum: 1, gold: 50); NPC.boss = true; NPC.Opacity = 0f; NPC.noGravity = true; @@ -263,9 +276,6 @@ namespace CalamityMod.NPCs.Providence if (Main.getGoodWorld) NPC.scale *= 0.25f; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -358,12 +368,10 @@ namespace CalamityMod.NPCs.Providence Player player = Main.player[NPC.target]; // Enraged bool and Color shifting - bool bossRush = BossRushEvent.BossRushActive; - bool getFuckedAI = Main.zenithWorld; if (getFuckedAI) NPC.localAI[1] = (float)BossMode.Rainbow; - else if (hasBeenGivenFullPower || bossRush) // Enraged behavior + else if (hasBeenGivenFullPower) // Enraged behavior NPC.localAI[1] = (float)BossMode.Enraged; else NPC.localAI[1] = (float)BossMode.Normal; @@ -414,24 +422,7 @@ namespace CalamityMod.NPCs.Providence NPC.ForceNetUpdate(false); } - // Increase all projectile damage while enraged, but reduce to 0 for Zenith - int projectileDamageMult = 1; - if (getFuckedAI) - projectileDamageMult = 0; - else if (fullPowerAI) - projectileDamageMult = 2; - - NPC.Calamity().CurrentlyEnraged = !bossRush && fullPowerAI; - - // Projectile damage values - int holyLaserDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int crystalDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holySpearDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyBombDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int moltenBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyFireDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyBlastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; - int holyStarDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()) * projectileDamageMult; + NPC.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && fullPowerAI; // Change dust type while enraged int dustType = ProvUtils.GetDustID(); @@ -450,13 +441,9 @@ namespace CalamityMod.NPCs.Providence // Spear phase float spearRateIncrease = 1f - lifeRatio; - float bossRushSpearRateIncrease = 0.25f; float baseSpearRate = 18f; float spearRate = 1f + spearRateIncrease; - if (bossRush) - spearRate += bossRushSpearRateIncrease; - // Projectile fire rate multiplier double attackRateMult = 1D; @@ -654,20 +641,6 @@ namespace CalamityMod.NPCs.Providence return; } - // Damage - if (attackerAlive) - { - double damageMult = 1.25; - holyLaserDamage = (int)(holyLaserDamage * damageMult); - crystalDamage = (int)(crystalDamage * damageMult); - holySpearDamage = (int)(holySpearDamage * damageMult); - holyBombDamage = (int)(holyBombDamage * damageMult); - moltenBlastDamage = (int)(moltenBlastDamage * damageMult); - holyFireDamage = (int)(holyFireDamage * damageMult); - holyBlastDamage = (int)(holyBlastDamage * damageMult); - holyStarDamage = (int)(holyStarDamage * damageMult); - } - // Defense if (defenderAlive) NPC.defense = NPC.defDefense * 2; @@ -860,7 +833,7 @@ namespace CalamityMod.NPCs.Providence // Velocity and acceleration float speedIncreaseTimer = fullPowerAI ? 75f : death ? 120f : 150f; - bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer || bossRush; + bool increaseSpeed = calamityGlobalNPC.newAI[0] > speedIncreaseTimer; float accelerationBoost = death ? 0.3f * (1f - lifeRatio) : 0.2f * (1f - lifeRatio); float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); float acceleration = (expertMode ? 1.1f : 1.05f) + accelerationBoost; @@ -878,10 +851,8 @@ namespace CalamityMod.NPCs.Providence else if (increaseSpeed) { velocity += (calamityGlobalNPC.newAI[0] - speedIncreaseTimer) * 0.04f; - if (velocity > 30f || bossRush) + if (velocity > 30f) velocity = 30f; - if (bossRush) - acceleration = 2f; } if (Main.getGoodWorld) @@ -928,8 +899,8 @@ namespace CalamityMod.NPCs.Providence int phase = 0; // Holy ray in hallow, Crystal in hell - bool useLaser = (phase2 && biomeType == 1) || bossRush; - bool useCrystal = (phase2 && biomeType == 2) || bossRush; + bool useLaser = (phase2 && biomeType == 1) || BossRushEvent.BossRushActive; + bool useCrystal = (phase2 && biomeType == 2) || BossRushEvent.BossRushActive; // Unique pattern for Death Mode and Boss Rush if (death) @@ -1161,7 +1132,7 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); - int projectileShootGateValue = (bossRush ? 18 : expertMode ? 24 : 26) - shootBoost; + int projectileShootGateValue = (expertMode ? 24 : 26) - shootBoost; projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); @@ -1176,7 +1147,7 @@ namespace CalamityMod.NPCs.Providence Vector2 predictionAmount = player.velocity * 100f; Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), holyBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), HolyBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1206,8 +1177,6 @@ namespace CalamityMod.NPCs.Providence int shootBoost = death ? (int)Math.Round(6f * (1f - lifeRatio)) : (int)Math.Round(5f * (1f - lifeRatio)); int projectileShootGateValue = (expertMode ? 36 : 39) - shootBoost; - if (bossRush) - projectileShootGateValue = 27; projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); @@ -1226,7 +1195,7 @@ namespace CalamityMod.NPCs.Providence if (fullPowerAI) projectileVelocityY *= 2f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyFireDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), FireDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } } @@ -1255,7 +1224,7 @@ namespace CalamityMod.NPCs.Providence } float divisor = (expertMode ? 2f : 3f) + (float)Math.Floor(3f * lifeRatio) + (attackRateMult > 1D ? (float)Math.Ceiling(attackRateMult * 1.6) : 0f); - int totalFlameProjectiles = bossRush ? 45 : 36; + int totalFlameProjectiles = 36; int chains = 4; float interval = totalFlameProjectiles / chains * divisor; double patternInterval = Math.Floor(NPC.ai[3] / interval); @@ -1276,17 +1245,13 @@ namespace CalamityMod.NPCs.Providence { Vector2 vector2 = spinningPoint.RotatedBy(radians * i + MathHelper.ToRadians(NPC.ai[2])); - int projectileType = ModContent.ProjectileType(); - int dmgAmt = holyStarDamage; if (Main.rand.NextBool(healingStarChance) && !death) { - projectileType = ModContent.ProjectileType(); - dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, StarHeal); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, ModContent.ProjectileType(), StarDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } // Radial offset @@ -1299,7 +1264,7 @@ namespace CalamityMod.NPCs.Providence { NPC.ai[2] = 0f; - totalFlameProjectiles = bossRush ? 20 : 16; + totalFlameProjectiles = 16; if (NPC.ai[3] % (divisor * totalFlameProjectiles) == 0f) { calamityGlobalNPC.newAI[1] += 1f; @@ -1313,17 +1278,13 @@ namespace CalamityMod.NPCs.Providence { Vector2 vector2 = spinningPoint.RotatedBy(radians * i); - int projectileType = ModContent.ProjectileType(); - int dmgAmt = holyStarDamage; if (Main.rand.NextBool(healingStarChance) && !death) { - projectileType = ModContent.ProjectileType(); - dmgAmt = NPC.GetProjectileDamageNoScaling(projectileType); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, 0, 0f, Main.myPlayer, 0f, dmgAmt); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, StarHeal); } else if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, projectileType, dmgAmt, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, vector2, ModContent.ProjectileType(), StarDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } } } @@ -1343,9 +1304,8 @@ namespace CalamityMod.NPCs.Providence foreach (int t in targets) { Vector2 velocity2 = Vector2.Normalize(Main.player[t].Center - fireSparklesFrom) * cocoonProjVelocity * 1.5f; - int type = ModContent.ProjectileType(); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, type, holyStarDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireSparklesFrom, velocity2, ModContent.ProjectileType(), StarDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); Color dustColor = Main.hslToRgb(Main.rgbToHsl(fullPowerAI ? new Color(100, 200, 250) : Color.Orange).X, 1f, 0.5f); dustColor.A = 255; @@ -1388,7 +1348,7 @@ namespace CalamityMod.NPCs.Providence if (!Main.dedServ) { Player player2 = Main.LocalPlayer; - bool inLiquid = (player2.wet || player2.honeyWet) && !player2.lavaWet; + bool inLiquid = player2.Calamity().countsAsAnyWet && !player2.lavaWet; if (!player2.dead && player2.active && Vector2.Distance(player2.Center, NPC.Center) < 2800f && !inLiquid) { @@ -1445,8 +1405,6 @@ namespace CalamityMod.NPCs.Providence int shootBoost = death ? (int)Math.Round(5f * (1f - lifeRatio)) : (int)Math.Round(4f * (1f - lifeRatio)); int projectileShootGateValue = (expertMode ? 24 : 26) - shootBoost; - if (bossRush) - projectileShootGateValue = 18; projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); @@ -1461,7 +1419,7 @@ namespace CalamityMod.NPCs.Providence Vector2 predictionAmount = player.velocity * 100f; Vector2 projectileVelocity = (player.Center + (predictiveShots ? predictionAmount : Vector2.Zero) - projectileFirePosition).SafeNormalize(Vector2.UnitY) * projSpeed * 0.1f; Vector2 explodePosition = predictiveShots ? (player.position + predictionAmount) : player.position; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), moltenBlastDamage, 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileFirePosition, projectileVelocity, ModContent.ProjectileType(), MoltenBlastDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, explodePosition.X, explodePosition.Y); } } else if (NPC.ai[3] < 0f) @@ -1490,7 +1448,7 @@ namespace CalamityMod.NPCs.Providence NPC.ai[3] += 1f; int shootBoost = death ? (int)Math.Round(12f * (1f - lifeRatio)) : (int)Math.Round(10f * (1f - lifeRatio)); - int projectileShootGateValue = (bossRush ? 54 : expertMode ? 73 : 77) - shootBoost; + int projectileShootGateValue = (expertMode ? 73 : 77) - shootBoost; projectileShootGateValue = (int)(projectileShootGateValue * attackRateMult); @@ -1506,7 +1464,7 @@ namespace CalamityMod.NPCs.Providence projectileVelocityY += expertMode ? 4f : 3f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), holyBombDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFrom.X, shootFrom.Y, NPC.velocity.X * 0.25f, projectileVelocityY, ModContent.ProjectileType(), FireSentryDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } } @@ -1549,7 +1507,7 @@ namespace CalamityMod.NPCs.Providence if (calamityGlobalNPC.newAI[2] % 2f == 0f) { - int totalSpearProjectiles = bossRush ? 15 : 12; + int totalSpearProjectiles = 12; double radians = MathHelper.TwoPi / totalSpearProjectiles; Vector2 spinningPoint = Vector2.Normalize(new Vector2(-calamityGlobalNPC.newAI[1], -cocoonProjVelocity)); @@ -1565,10 +1523,10 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, vector2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); - if (CalamityWorld.LegendaryMode && revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -vector2, projectileType, holySpearDamage, 0f, Main.myPlayer); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -vector2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer); } } @@ -1592,10 +1550,10 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, velocity2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, 1f, 0f); - if (CalamityWorld.LegendaryMode && revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -velocity2, projectileType, holySpearDamage, 0f, Main.myPlayer, 1f, 0f); + if (Main.getGoodWorld) + Projectile.NewProjectile(NPC.GetSource_FromAI(), fireFrom, -velocity2, projectileType, SpearDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, 1f, 0f); } } @@ -1684,7 +1642,7 @@ namespace CalamityMod.NPCs.Providence if (Main.netMode != NetmodeID.MultiplayerClient) { float timeLeft = fullPowerAI ? (float)(getFuckedAI ? gfbCrystalTime : enragedCrystalTime) : 0f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), crystalDamage, 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); + Projectile.NewProjectile(NPC.GetSource_FromAI(), crystalSpawnPos, Vector2.Zero, ModContent.ProjectileType(), CrystalDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, lifeRatio, 0f, timeLeft); } } @@ -1746,20 +1704,20 @@ namespace CalamityMod.NPCs.Providence // 60 degrees offset velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), RayDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); // -60 degrees offset if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), RayDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); if (fullPowerAI && lifeRatio < 0.5f) { rotation *= 0.33f; velocity = velocity.RotatedBy(-(double)beamDirection * MathHelper.TwoPi / 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, velocity.X, velocity.Y, ModContent.ProjectileType(), RayDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); if (revenge) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), holyLaserDamage, 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center.X, NPC.Center.Y + 64f * NPC.scale, -velocity.X, -velocity.Y, ModContent.ProjectileType(), RayDamage.CalculateProvidenceDamage(), 0f, Main.myPlayer, -beamDirection * MathHelper.TwoPi / rotation, NPC.whoAmI, ai2: 2f); } NPC.ForceNetUpdate(false); @@ -1955,8 +1913,6 @@ namespace CalamityMod.NPCs.Providence } } - public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; - public override bool CheckDead() { NPC.life = 1; @@ -2099,7 +2055,7 @@ namespace CalamityMod.NPCs.Providence npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedProvidence, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -2543,7 +2499,6 @@ namespace CalamityMod.NPCs.Providence public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * 0.8f); } public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) @@ -2765,7 +2720,29 @@ namespace CalamityMod.NPCs.Providence // These will be used for almost every single one of her projectiles, so it's useful to have. public static class ProvUtils { - public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld && !BossRushEvent.BossRushActive; + public static bool StandardAI() => (CalamityGlobalNPC.holyBoss == -1 || !Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) && !Main.zenithWorld; + + public static int CalculateProvidenceDamage(this int damage) + { + // GFB replaces conventional damage with negative healing + if (Main.zenithWorld) + return 0; + + // Enrage + if (CalamityGlobalNPC.holyBoss != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBoss].Calamity().CurrentlyEnraged) + damage *= 2; + } + + // Offense Guardian + if (CalamityGlobalNPC.holyBossAttacker != -1) + { + if (Main.npc[CalamityGlobalNPC.holyBossAttacker].active) + damage = (int)(damage * 1.25f); + } + return damage; + } // Simplified to day/night only. For PSC public static Color GetColorBasedOnEnrage(int Alpha, bool Outline = false) => GetColorBasedOnEnrage(!Main.IsItDay() && !Main.remixWorld, Alpha, Outline); diff --git a/NPCs/Ravager/FlamePillar.cs b/NPCs/Ravager/FlamePillar.cs index 78144eff7a..69962e5cf5 100644 --- a/NPCs/Ravager/FlamePillar.cs +++ b/NPCs/Ravager/FlamePillar.cs @@ -27,9 +27,12 @@ namespace CalamityMod.NPCs.Ravager } } + public static int FlameDamage = 30; // 120 + public static int PostProviFlameBuff = 20; // +80 = 200 + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 75; // 150 NPC.width = 40; NPC.height = 150; NPC.defense = 35; @@ -44,10 +47,6 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void FindFrame(int frameHeight) @@ -122,8 +121,7 @@ namespace CalamityMod.NPCs.Ravager } Vector2 velocity = new Vector2(speedX, speedY); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, FlameDamage + (provy ? PostProviFlameBuff : 0), 0f, Main.myPlayer, 0f, 0f); } NPC.ai[2] += 1f; @@ -138,6 +136,7 @@ namespace CalamityMod.NPCs.Ravager } } } + public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { diff --git a/NPCs/Ravager/RavagerBody.cs b/NPCs/Ravager/RavagerBody.cs index 1003555aee..1807ed445f 100644 --- a/NPCs/Ravager/RavagerBody.cs +++ b/NPCs/Ravager/RavagerBody.cs @@ -69,18 +69,24 @@ namespace CalamityMod.NPCs.Ravager } } + // GFB exclusive + public static int BlasterDamage = 92; // 368 + + // Legendary exclusive + public static int RockDamage = 60; // 240 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 90; // 180 NPC.lavaImmune = true; NPC.noGravity = true; NPC.npcSlots = 20f; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 332; NPC.height = 214; NPC.defense = 55; - NPC.value = Item.buyPrice(0, 30, 0, 0); + NPC.value = Item.buyPrice(gold: 25); NPC.DR_NERD(0.35f); NPC.LifeMaxNERB(45000, 54000, 460000); if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) @@ -88,7 +94,7 @@ namespace CalamityMod.NPCs.Ravager NPC.damage = (int)(NPC.damage * 1.5); NPC.defense *= 2; NPC.lifeMax *= 4; - NPC.value *= 3f; + NPC.value *= 4f; } NPC.knockBackResist = 0f; AIType = -1; @@ -100,9 +106,6 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = DeathSound; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -149,10 +152,9 @@ namespace CalamityMod.NPCs.Ravager { CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -227,22 +229,14 @@ namespace CalamityMod.NPCs.Ravager if (immunePhase) { NPC.dontTakeDamage = true; - if (bossRush) - { - if (!Main.dedServ) - { - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) - Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); - } - } } else { NPC.dontTakeDamage = false; - if (!Main.dedServ) + foreach (Player p in Main.ActivePlayers) { - if (!Main.LocalPlayer.dead && Main.LocalPlayer.active && revenge) - Main.LocalPlayer.AddBuff(ModContent.BuffType(), 2); + if (!p.dead && revenge) + p.AddBuff(ModContent.BuffType(), 2); } } @@ -253,7 +247,7 @@ namespace CalamityMod.NPCs.Ravager Vector2 Pos = player.Center; //Spawn projectiles based on player's center. Having it be based on the boss turned out weird. (Except for final) int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = BlasterDamage; if (finalStand) //Circle { Vector2 circleOffset = Pos + (Vector2.UnitY * 640f).RotatedBy(MathHelper.ToRadians(NPC.localAI[1] * 3f)); @@ -526,11 +520,11 @@ namespace CalamityMod.NPCs.Ravager if (revenge) { - float multiplier = bossRush ? 0.003f : 0.0015f; + float multiplier = 0.0015f; if (distanceBelowTarget > 0f) calamityGlobalNPC.newAI[1] += 1f + distanceBelowTarget * multiplier; - float speedMultLimit = bossRush ? 3f : 2f; + float speedMultLimit = 2f; if (calamityGlobalNPC.newAI[1] > speedMultLimit) calamityGlobalNPC.newAI[1] = speedMultLimit; @@ -594,30 +588,6 @@ namespace CalamityMod.NPCs.Ravager bool anyRockPillars = NPC.AnyNPCs(ModContent.NPCType()); bool anyFlamePillars = NPC.AnyNPCs(ModContent.NPCType()); - if (CalamityWorld.LegendaryMode && revenge) - { - if (!expertMode || anyRockPillars || anyFlamePillars) - SoundEngine.PlaySound(PillarSound, NPC.Center); - - // Eruption of bouncing rock projectiles - float projectileVelocity = 12f; - int type = ModContent.ProjectileType(); - Vector2 destination = new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center; - destination.Normalize(); - destination *= projectileVelocity; - int numProj = 11; - float rotation = MathHelper.ToRadians(90); - for (int i = 0; i < numProj; i++) - { - // Spawn projectiles 0, 1, 2, 3, 7, 8, 9 and 10 - if (i < 4 || i > 6) - { - Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + Vector2.UnitY * 30f * NPC.scale + Vector2.Normalize(perturbedSpeed) * 30f * NPC.scale, perturbedSpeed, type, 60, 0f, Main.myPlayer); - } - } - } - if (expertMode) { foreach (NPC n in Main.ActiveNPCs) @@ -721,7 +691,7 @@ namespace CalamityMod.NPCs.Ravager { if (phase2) { - float stopBeforeFallTime = bossRush ? 25f : 30f; + float stopBeforeFallTime = 30f; if (!anyHeadActive) stopBeforeFallTime -= 15f; else if (expertMode) @@ -738,7 +708,7 @@ namespace CalamityMod.NPCs.Ravager NPC.damage = NPC.defDamage; float fallSpeedBoost = !anyHeadActive ? 1.8f : death ? 1.8f * (1f - lifeRatio) : 1.2f * (1f - lifeRatio); - float fallSpeed = (bossRush ? 1.8f : 1.2f) + fallSpeedBoost; + float fallSpeed = 1.2f + fallSpeedBoost; if (calamityGlobalNPC.newAI[1] > 1f) fallSpeed *= calamityGlobalNPC.newAI[1]; @@ -755,7 +725,7 @@ namespace CalamityMod.NPCs.Ravager if (NPC.Bottom.Y < player.position.Y) { float fallSpeedBoost = !anyHeadActive ? 0.9f : death ? 0.9f * (1f - lifeRatio) : 0.6f * (1f - lifeRatio); - float fallSpeed = (bossRush ? 0.9f : 0.6f) + fallSpeedBoost; + float fallSpeed = 0.6f + fallSpeedBoost; if (calamityGlobalNPC.newAI[1] > 1f) fallSpeed *= calamityGlobalNPC.newAI[1]; @@ -766,7 +736,7 @@ namespace CalamityMod.NPCs.Ravager } else { - float velocityMult = bossRush ? 2f : 1.8f; + float velocityMult = 1.8f; float velocityXChange = 0.2f + Math.Abs(NPC.Center.X - player.Center.X) * 0.001f; float velocityXBoost = !anyHeadActive ? 6f : death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); @@ -815,11 +785,6 @@ namespace CalamityMod.NPCs.Ravager { float gravity = phase2 ? 0f : 0.45f; float maxFallSpeed = reduceFallSpeed ? 12f : phase2 ? 24f : 15f; - if (bossRush && !reduceFallSpeed) - { - gravity *= 1.25f; - maxFallSpeed *= 1.25f; - } if (calamityGlobalNPC.newAI[1] > 1f && !reduceFallSpeed) maxFallSpeed *= calamityGlobalNPC.newAI[1]; @@ -836,7 +801,7 @@ namespace CalamityMod.NPCs.Ravager player = Main.player[NPC.target]; } - int distanceFromTarget = player.dead ? 1600 : bossRush ? 8400 : 5600; + int distanceFromTarget = player.dead ? 1600 : 5600; if (Vector2.Distance(NPC.Center, player.Center) > distanceFromTarget) { NPC.TargetClosest(); @@ -849,6 +814,7 @@ namespace CalamityMod.NPCs.Ravager } } } + public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { @@ -908,7 +874,6 @@ namespace CalamityMod.NPCs.Ravager public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) @@ -1009,7 +974,7 @@ namespace CalamityMod.NPCs.Ravager target.AddBuff(ModContent.BuffType(), 480); } - public override void BossLoot(ref string name, ref int potionType) => potionType = ItemID.GreaterHealingPotion; + public override void BossLoot(ref int potionType) => potionType = ItemID.GreaterHealingPotion; public override void OnKill() { diff --git a/NPCs/Ravager/RavagerClawLeft.cs b/NPCs/Ravager/RavagerClawLeft.cs index 84cda3e20c..3b6dcc5f2d 100644 --- a/NPCs/Ravager/RavagerClawLeft.cs +++ b/NPCs/Ravager/RavagerClawLeft.cs @@ -25,9 +25,9 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 75; // 150 NPC.lavaImmune = true; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 80; NPC.height = 40; NPC.defense = 40; @@ -52,10 +52,6 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerClawRight.cs b/NPCs/Ravager/RavagerClawRight.cs index b8855ebe09..21ec899f26 100644 --- a/NPCs/Ravager/RavagerClawRight.cs +++ b/NPCs/Ravager/RavagerClawRight.cs @@ -25,9 +25,9 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 75; // 150 NPC.lavaImmune = true; NPC.aiStyle = -1; - NPC.GetNPCDamage(); NPC.width = 80; NPC.height = 40; NPC.defense = 40; @@ -52,15 +52,10 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() { - //Main.NewText(NPC.ai[0]); if (CalamityGlobalNPC.scavenger < 0 || !Main.npc[CalamityGlobalNPC.scavenger].active) { if (Main.netMode != NetmodeID.MultiplayerClient) diff --git a/NPCs/Ravager/RavagerHead.cs b/NPCs/Ravager/RavagerHead.cs index ecdcb25659..b4cac0f67b 100644 --- a/NPCs/Ravager/RavagerHead.cs +++ b/NPCs/Ravager/RavagerHead.cs @@ -21,10 +21,13 @@ namespace CalamityMod.NPCs.Ravager NPCID.Sets.NeedsExpertScaling[Type] = true; } + public static int NukeDamage = 35; // 140 + public static int PostProviNukeBuff = 25; // +100 = 240 + public override void SetDefaults() { NPC.aiStyle = -1; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.width = 80; NPC.height = 80; NPC.defense = 40; @@ -49,10 +52,6 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -94,13 +93,12 @@ namespace CalamityMod.NPCs.Ravager NPC.TargetClosest(); NPC.ai[1] = 0f; - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int type = ModContent.ProjectileType(); if (Main.netMode != NetmodeID.MultiplayerClient) { Vector2 shootFromVector = new Vector2(NPC.Center.X, NPC.Center.Y - 20f); Vector2 velocity = new Vector2(0f, -15f); - int nuke = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFromVector, velocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, NPC.target, 0f); + int nuke = Projectile.NewProjectile(NPC.GetSource_FromAI(), shootFromVector, velocity, type, NukeDamage + (provy ? PostProviNukeBuff : 0), 0f, Main.myPlayer, NPC.target, 0f); Main.projectile[nuke].velocity.Y = -15f; } } diff --git a/NPCs/Ravager/RavagerHead2.cs b/NPCs/Ravager/RavagerHead2.cs index f33e45eb6e..b7c57c63bf 100644 --- a/NPCs/Ravager/RavagerHead2.cs +++ b/NPCs/Ravager/RavagerHead2.cs @@ -20,15 +20,18 @@ namespace CalamityMod.NPCs.Ravager NPCID.Sets.NeedsExpertScaling[Type] = true; } + public static int HomingDartDamage = 30; // 120 + public static int PostProviDartBuff = 20; // +80 == 200 + public override void SetDefaults() { NPC.aiStyle = -1; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.width = 80; NPC.height = 80; NPC.defense = 40; NPC.DR_NERD(0.15f); - NPC.lifeMax = 10000; + NPC.lifeMax = 20000; NPC.knockBackResist = 0f; AIType = -1; NPC.netAlways = true; @@ -39,7 +42,7 @@ namespace CalamityMod.NPCs.Ravager if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) { NPC.defense *= 2; - NPC.lifeMax *= 4; + NPC.lifeMax *= 3; } if (BossRushEvent.BossRushActive) { @@ -47,10 +50,6 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -65,9 +64,8 @@ namespace CalamityMod.NPCs.Ravager Player player = Main.player[Main.npc[CalamityGlobalNPC.scavenger].target]; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool provy = DownedBossSystem.downedProvidence && !bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool provy = DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive; if (NPC.timeLeft < 1800) NPC.timeLeft = 1800; @@ -107,11 +105,10 @@ namespace CalamityMod.NPCs.Ravager NPC.rotation = headRotation; NPC.ai[1] += 1f; - bool fireProjectiles = NPC.ai[1] >= (bossRush ? 240f : 480f); + bool fireProjectiles = NPC.ai[1] >= 480f; if (fireProjectiles && Vector2.Distance(NPC.Center, player.Center) > 80f) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float projectileVelocity = death ? 8f : 6f; if (NPC.ai[1] >= 600f) @@ -122,9 +119,8 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(RavagerHead.MissileSound, NPC.Center); - type = ModContent.ProjectileType(); - damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); + type = ModContent.ProjectileType(); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity * 0.25f, type, RavagerHead.NukeDamage + (provy ? RavagerHead.PostProviNukeBuff : 0), 0f, Main.myPlayer, Main.npc[CalamityGlobalNPC.scavenger].target, 0f); } } else @@ -134,7 +130,7 @@ namespace CalamityMod.NPCs.Ravager if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundID.Item33, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, damage + (provy ? 30 : 0), 0f, Main.myPlayer, 0f, -1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity, type, HomingDartDamage + (provy ? PostProviDartBuff : 0), 0f, Main.myPlayer, 0f, -1f); } } } diff --git a/NPCs/Ravager/RavagerLegLeft.cs b/NPCs/Ravager/RavagerLegLeft.cs index 6c55b7750e..95d7ec3d32 100644 --- a/NPCs/Ravager/RavagerLegLeft.cs +++ b/NPCs/Ravager/RavagerLegLeft.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { NPC.aiStyle = -1; - NPC.damage = 0; + NPC.damage = 0; // No contact damage NPC.width = 60; NPC.height = 60; NPC.defense = 40; @@ -45,10 +45,6 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RavagerLegRight.cs b/NPCs/Ravager/RavagerLegRight.cs index 41f8232445..bcb5cf0a7f 100644 --- a/NPCs/Ravager/RavagerLegRight.cs +++ b/NPCs/Ravager/RavagerLegRight.cs @@ -20,7 +20,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { NPC.aiStyle = -1; - NPC.damage = 0; + NPC.damage = 0; // No contact damage NPC.width = 60; NPC.height = 60; NPC.defense = 40; @@ -45,10 +45,6 @@ namespace CalamityMod.NPCs.Ravager } NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() diff --git a/NPCs/Ravager/RockPillar.cs b/NPCs/Ravager/RockPillar.cs index ff8adfd193..bf01bf7c0d 100644 --- a/NPCs/Ravager/RockPillar.cs +++ b/NPCs/Ravager/RockPillar.cs @@ -21,7 +21,7 @@ namespace CalamityMod.NPCs.Ravager public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 90; // 180 NPC.width = 60; NPC.height = 300; NPC.defense = 50; @@ -36,10 +36,6 @@ namespace CalamityMod.NPCs.Ravager NPC.DeathSound = SoundID.NPCDeath14; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = true; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -57,18 +53,25 @@ namespace CalamityMod.NPCs.Ravager if (NPC.alpha > 0) { + // Avoid cheap bullshit + NPC.damage = 0; + NPC.alpha -= 10; if (NPC.alpha < 0) NPC.alpha = 0; } + else + { + if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) + NPC.damage = (int)(NPC.defDamage * 1.5); + else + NPC.damage = NPC.defDamage; + } if (NPC.ai[0] == 0f) { if (NPC.velocity.Y == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - if (NPC.ai[1] == -1f) { SoundEngine.PlaySound(SoundID.Item62, NPC.Center); @@ -92,14 +95,8 @@ namespace CalamityMod.NPCs.Ravager Main.dust[rockDust2].velocity *= 2f; } - // Set damage - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - NPC.noTileCollide = true; - NPC.velocity.X = (BossRushEvent.BossRushActive ? 15 : 12) * NPC.direction; + NPC.velocity.X = 12 * NPC.direction; NPC.velocity.Y = -28.5f; NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -108,12 +105,6 @@ namespace CalamityMod.NPCs.Ravager } else { - // Set damage - if (DownedBossSystem.downedProvidence && !BossRushEvent.BossRushActive) - NPC.damage = (int)Math.Round(NPC.defDamage * 1.5); - else - NPC.damage = NPC.defDamage; - if (NPC.velocity.Y == 0f || Vector2.Distance(NPC.Center, Main.npc[CalamityGlobalNPC.scavenger].Center) > 2800f) { SoundEngine.PlaySound(SoundID.Item14, NPC.Center); @@ -133,7 +124,7 @@ namespace CalamityMod.NPCs.Ravager } } } - + public override bool? CanFallThroughPlatforms() => NPC.target >= 0 && Main.player[NPC.target].position.Y > NPC.position.Y + NPC.height; public override bool CheckActive() => false; public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/Signus/CosmicLantern.cs b/NPCs/Signus/CosmicLantern.cs index dc5150c594..11e2cb20a3 100644 --- a/NPCs/Signus/CosmicLantern.cs +++ b/NPCs/Signus/CosmicLantern.cs @@ -1,7 +1,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -26,30 +26,28 @@ namespace CalamityMod.NPCs.Signus { GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); } + NPCID.Sets.DontDoHardmodeScaling[Type] = true; //prevent HP from scaling. We manually scale the damage to compensate } public override void SetDefaults() { + NPC.damage = 120 * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); // 240 NPC.aiStyle = -1; AIType = -1; - NPC.GetNPCDamage(); NPC.width = 25; NPC.height = 25; NPC.defense = 50; - NPC.lifeMax = 25; + NPC.lifeMax = 3; NPC.alpha = 255; - NPC.knockBackResist = 0.85f; + NPC.knockBackResist = 0f; NPC.noGravity = true; NPC.dontTakeDamage = true; NPC.chaseable = false; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; + NPC.SuperArmor = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -117,11 +115,14 @@ namespace CalamityMod.NPCs.Signus bool revenge = CalamityWorld.revenge; float playerDistNormMult = revenge ? 24f : 22f; - if (BossRushEvent.BossRushActive) - playerDistNormMult = 30f; CalamityRegularEnemyAI.DungeonSpiritAI(NPC, Mod, playerDistNormMult, 0f, true); } + public override void ModifyIncomingHit(ref NPC.HitModifiers modifiers) + { + modifiers.DisableCrit(); + } + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { SpriteEffects spriteEffects = SpriteEffects.None; diff --git a/NPCs/Signus/CosmicMine.cs b/NPCs/Signus/CosmicMine.cs index 69af4f8c13..8a2a83f901 100644 --- a/NPCs/Signus/CosmicMine.cs +++ b/NPCs/Signus/CosmicMine.cs @@ -24,7 +24,7 @@ namespace CalamityMod.NPCs.Signus public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 140; // 280 NPC.width = 30; NPC.height = 30; NPC.lifeMax = 4800; @@ -38,10 +38,6 @@ namespace CalamityMod.NPCs.Signus NPC.HitSound = SoundID.NPCHit53; NPC.DeathSound = SoundID.NPCDeath44; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/Signus/Signus.cs b/NPCs/Signus/Signus.cs index eb3761f198..b1eb2b27f6 100644 --- a/NPCs/Signus/Signus.cs +++ b/NPCs/Signus/Signus.cs @@ -69,16 +69,22 @@ namespace CalamityMod.NPCs.Signus } } + public static int ScytheDamage = 60; // 240 + public static int DustDamage = 60; // 240; Also applies to Legendary Mode Peanuts + + // GFB exclusive + public static int StealthStrikeMult = 2; // 480 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 160; // 320 NPC.npcSlots = 32f; - NPC.GetNPCDamage(); NPC.width = 130; NPC.height = 130; NPC.defense = 60; NPC.LifeMaxNERB(320000, 375000, 380000); - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(gold: 50); NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; @@ -89,9 +95,6 @@ namespace CalamityMod.NPCs.Signus NPC.HitSound = SoundID.NPCHit49; NPC.DeathSound = SoundID.NPCDeath51; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -129,10 +132,9 @@ namespace CalamityMod.NPCs.Signus CalamityGlobalNPC.signus = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; Vector2 vectorCenter = NPC.Center; @@ -141,8 +143,8 @@ namespace CalamityMod.NPCs.Signus lifeToAlpha = (int)((Main.getGoodWorld ? 200D : 100D) * (1D - lifeRatio)); int maxCharges = death ? 1 : revenge ? 2 : expertMode ? 3 : 4; int maxTeleports = (death && lifeRatio < 0.9) ? 1 : revenge ? 2 : expertMode ? 3 : 4; - float inertia = bossRush ? 9f : death ? 10f : revenge ? 11f : expertMode ? 12f : 14f; - float chargeVelocity = bossRush ? 16f : death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; + float inertia = death ? 10f : revenge ? 11f : expertMode ? 12f : 14f; + float chargeVelocity = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; if (Main.getGoodWorld) { inertia *= 0.5f; @@ -237,9 +239,6 @@ namespace CalamityMod.NPCs.Signus if (NPC.ai[0] <= 2f) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; @@ -251,7 +250,7 @@ namespace CalamityMod.NPCs.Signus if (phase3 || revenge) NPC.knockBackResist = 0f; - float speed = bossRush ? 20f : revenge ? 15f : expertMode ? 14f : 12f; + float speed = revenge ? 15f : expertMode ? 14f : 12f; if (expertMode) speed += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); @@ -288,12 +287,9 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 0f) { - // Avoid cheap bullshit - NPC.damage = 0; - if (Main.netMode != NetmodeID.MultiplayerClient) { - NPC.localAI[1] += bossRush ? 1.5f : 1f; + NPC.localAI[1] += 1f; if (expertMode) NPC.localAI[1] += death ? 3f * (float)(1D - lifeRatio) : 2f * (float)(1D - lifeRatio); @@ -345,7 +341,7 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 1f) { - // Avoid cheap bullshit + // Disable contact damage for some time while fading away NPC.damage = 0; Vector2 position = new Vector2(NPC.ai[1] * 16f - (NPC.width / 2), NPC.ai[2] * 16f - (NPC.height / 2)); @@ -356,7 +352,7 @@ namespace CalamityMod.NPCs.Signus Main.dust[dust].fadeIn = 1f; } - NPC.alpha += bossRush ? 3 : 2; + NPC.alpha += 2; if (expertMode) NPC.alpha += death ? (int)Math.Round(4.5D * (1D - lifeRatio)) : (int)Math.Round(3D * (1D - lifeRatio)); @@ -381,12 +377,11 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 2f) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.alpha -= 50; if (NPC.alpha <= lifeToAlpha) { + // Restore contact damage once returned to proper opacity + NPC.damage = NPC.defDamage; if (Main.netMode != NetmodeID.MultiplayerClient && revenge) { SoundEngine.PlaySound(SoundID.Item122, NPC.Center); @@ -465,15 +460,12 @@ namespace CalamityMod.NPCs.Signus } else if (NPC.ai[0] == 3f) { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.rotation = NPC.velocity.X * 0.04f; float playerLocation = vectorCenter.X - player.Center.X; NPC.direction = playerLocation < 0f ? 1 : -1; NPC.spriteDirection = NPC.direction; - float divisor = expertMode ? (bossRush ? 10f : death ? 12f : revenge ? 15f : 20f) - (float)Math.Ceiling(5D * (1D - lifeRatio)) : 20f; + float divisor = expertMode ? (death ? 12f : revenge ? 15f : 20f) - (float)Math.Ceiling(5D * (1D - lifeRatio)) : 20f; float scytheBarrageTime = divisor * 3f; float scytheBarrageCooldown = divisor * 3f; @@ -496,16 +488,14 @@ namespace CalamityMod.NPCs.Signus scytheXDist *= scytheDistance; scytheYDist *= scytheDistance; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist, scytheYDist, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist, scytheYDist, type, ScytheDamage, 0f, Main.myPlayer, 0f, NPC.target + 1); if (stealthTimer >= maxStealth) { - damage *= 2; SoundEngine.PlaySound(RaidersTalisman.StealthHitSound, NPC.Center); for (int i = 0; i < 4; i++) { Vector2 offset = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist + offset.X, scytheYDist + offset.Y, type, damage, 0f, Main.myPlayer, 0f, NPC.target + 1); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter.X, vectorCenter.Y, scytheXDist + offset.X, scytheYDist + offset.Y, type, ScytheDamage * StealthStrikeMult, 0f, Main.myPlayer, 0f, NPC.target + 1); } stealthTimer = 0; } @@ -513,8 +503,8 @@ namespace CalamityMod.NPCs.Signus } } - float maxVelocityY = bossRush ? 1.5f : death ? 2.5f : 3f; - float maxVelocityX = bossRush ? 5f : death ? 7f : 8f; + float maxVelocityY = death ? 2.5f : 3f; + float maxVelocityX = death ? 7f : 8f; if (NPC.position.Y > player.position.Y - 250f) { @@ -632,10 +622,7 @@ namespace CalamityMod.NPCs.Signus if (calamityGlobalNPC.newAI[0] == 0f) // Line up the charge { - // Avoid cheap bullshit - NPC.damage = 0; - - float velocity = bossRush ? 18f : revenge ? 16f : expertMode ? 15f : 14f; + float velocity = revenge ? 16f : expertMode ? 15f : 14f; if (expertMode) velocity += death ? 6f * (float)(1D - lifeRatio) : 4f * (float)(1D - lifeRatio); @@ -670,17 +657,11 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 1f) // Pause before charge { - // Avoid cheap bullshit - NPC.damage = 0; - NPC.velocity *= 0.8f; NPC.ai[1] += 1f; if (NPC.ai[1] >= 5f) { - // Set damage - NPC.damage = NPC.defDamage; - calamityGlobalNPC.newAI[0] = 2f; NPC.netUpdate = true; @@ -697,9 +678,6 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 2f) // Charging { - // Set damage - NPC.damage = NPC.defDamage; - if (Main.netMode != NetmodeID.MultiplayerClient) { bool buffed = false; @@ -712,15 +690,10 @@ namespace CalamityMod.NPCs.Signus if ((phase2 || buffed) && NPC.ai[2] % 3f == 0f) { SoundEngine.PlaySound(SoundID.Item73, NPC.Center); - int type = (CalamityWorld.LegendaryMode && revenge) ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = (CalamityWorld.LegendaryMode && revenge) ? 60 : NPC.GetProjectileDamage(type); - Vector2 velocity = Main.zenithWorld ? new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) : Vector2.Zero; - if (Main.getGoodWorld && !Main.zenithWorld) - { - velocity = new Vector2(Main.rand.Next(-5, 6), Main.rand.Next(-5, 6)); - } + int type = Main.zenithWorld ? ModContent.ProjectileType() : ModContent.ProjectileType(); + Vector2 velocity = Main.rand.NextVector2Circular(Main.zenithWorld ? 10f : 0f, Main.zenithWorld ? 10f : 0f); int ai = buffed ? 69 : 0; - Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, velocity, type, damage, 0f, Main.myPlayer, ai); + Projectile.NewProjectile(NPC.GetSource_FromAI(), vectorCenter, velocity, type, DustDamage, 0f, Main.myPlayer, ai); } } @@ -750,9 +723,6 @@ namespace CalamityMod.NPCs.Signus } else if (calamityGlobalNPC.newAI[0] == 3f) // Slow down after charging and reset { - // Avoid cheap bullshit - NPC.damage = 0; - if (stealthTimer >= maxStealth) { stealthTimer = 0; @@ -916,7 +886,7 @@ namespace CalamityMod.NPCs.Signus return false; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -984,7 +954,6 @@ namespace CalamityMod.NPCs.Signus public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn.cs b/NPCs/SlimeGod/CorruptSlimeSpawn.cs index 9d19bc6ba6..fd9842e659 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn.cs @@ -20,17 +20,18 @@ namespace CalamityMod.NPCs.SlimeGod NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; } + // GFB exclusive + public static int ShaderainDamage = 12; // 48 + public override void SetDefaults() { NPC.aiStyle = NPCAIStyleID.Bat; - NPC.GetNPCDamage(); + NPC.damage = 28; // 56 NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.scale = 2f; NPC.defense = 6; - NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 360 : 180; + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 180; NPC.knockBackResist = 0.7f; AnimationType = NPCID.Slimer; NPC.lavaImmune = false; @@ -40,10 +41,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -84,8 +81,7 @@ namespace CalamityMod.NPCs.SlimeGod if (Main.zenithWorld && Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, ShaderainDamage, 0f, Main.myPlayer); } } diff --git a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs index e8df94c69d..2a4539f271 100644 --- a/NPCs/SlimeGod/CorruptSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CorruptSlimeSpawn2.cs @@ -23,14 +23,12 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.aiStyle = NPCAIStyleID.Slime; - NPC.GetNPCDamage(); + NPC.damage = 20; // 40 NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.scale = 2f; NPC.defense = 4; - NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 180 : 90; + NPC.lifeMax = BossRushEvent.BossRushActive ? 5000 : 90; NPC.knockBackResist = 0.9f; AnimationType = NPCID.CorruptSlime; NPC.lavaImmune = false; @@ -40,10 +38,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void AI() @@ -85,14 +79,13 @@ namespace CalamityMod.NPCs.SlimeGod double deltaAngleBoom = spreadBoom / 8f; double offsetAngleBoom; int iBoom; - int damageBoom = 30; for (iBoom = 0; iBoom < 5; iBoom++) { int projectileType = ModContent.ProjectileType(); offsetAngleBoom = startAngleBoom + deltaAngleBoom * (iBoom + iBoom * iBoom) / 2f + 32f * iBoom; float velocityfactor = 0.3f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocityfactor), (float)(Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocityfactor), (float)(-Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, damageBoom, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(Math.Sin(offsetAngleBoom) * velocityfactor), (float)(Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), valueBoom.X, valueBoom.Y, (float)(-Math.Sin(offsetAngleBoom) * velocityfactor), (float)(-Math.Cos(offsetAngleBoom) * velocityfactor), projectileType, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 0f, 0f); } } } diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs index 4cb9744c71..acbf43a7cf 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn.cs @@ -22,14 +22,12 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.aiStyle = NPCAIStyleID.Slime; - NPC.GetNPCDamage(); + NPC.damage = 20; // 40 NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.scale = 2f; NPC.defense = 4; - NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 220 : 110; + NPC.lifeMax = BossRushEvent.BossRushActive ? 10000 : 110; NPC.knockBackResist = 0.8f; AnimationType = NPCID.CorruptSlime; NPC.lavaImmune = false; @@ -39,10 +37,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs index 9f321b1817..49d8410197 100644 --- a/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs +++ b/NPCs/SlimeGod/CrimsonSlimeSpawn2.cs @@ -26,17 +26,17 @@ namespace CalamityMod.NPCs.SlimeGod NPCID.Sets.BossBestiaryPriority.Add(Type); } + public static int SmallSpikeDamage = 11; // 44 + public override void SetDefaults() { NPC.aiStyle = NPCAIStyleID.Slime; - NPC.GetNPCDamage(); + NPC.damage = 28; // 56 NPC.width = 40; NPC.height = 30; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - NPC.scale = 2f; NPC.defense = 6; - NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 260 : 130; + NPC.lifeMax = BossRushEvent.BossRushActive ? 12000 : 130; NPC.knockBackResist = 0.7f; NPC.lavaImmune = false; NPC.noGravity = false; @@ -101,7 +101,7 @@ namespace CalamityMod.NPCs.SlimeGod spikeTimer -= 1f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); + int damage = SmallSpikeDamage; if (Main.zenithWorld) type = Main.rand.NextBool() ? ModContent.ProjectileType() : ModContent.ProjectileType(); diff --git a/NPCs/SlimeGod/CrimulanPaladin.cs b/NPCs/SlimeGod/CrimulanPaladin.cs index b4947f9b8a..852cfe7269 100644 --- a/NPCs/SlimeGod/CrimulanPaladin.cs +++ b/NPCs/SlimeGod/CrimulanPaladin.cs @@ -28,17 +28,18 @@ namespace CalamityMod.NPCs.SlimeGod this.HideFromBestiary(); } + public static int BigSpikeDamage = 15; // 60 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 42; // 84 NPC.width = Width; NPC.height = Height; NPC.defense = 12; NPC.LifeMaxNERB(7500, 9000, 160000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; NPC.knockBackResist = 0f; - NPC.value = 0f; NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; @@ -49,9 +50,6 @@ namespace CalamityMod.NPCs.SlimeGod AIType = -1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -82,10 +80,9 @@ namespace CalamityMod.NPCs.SlimeGod CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -97,7 +94,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 24; - setDamage += 25; + setDamage += SlimeGodCore.PossessionDamageBoost; } // Used for landing squash and stretch @@ -112,7 +109,10 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = Main.getGoodWorld ? 0.8f : 1f; + + // How fast the slime slams down + float slamVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; // Used for how fast the slime animates NPC.aiAction = 0; @@ -152,7 +152,7 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { // Spread of random globs in meme mode - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) { int type = ModContent.ProjectileType(); for (int i = 0; i < 30; i++) @@ -185,7 +185,6 @@ namespace CalamityMod.NPCs.SlimeGod // Spread of spikes float projectileVelocity = 2f; int type2 = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type2); Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; @@ -220,7 +219,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, BigSpikeDamage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); } // Die @@ -238,15 +237,23 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - if (bossRush) - enraged = true; - if (NPC.localAI[1] != 1f) { if (enraged) NPC.defense = NPC.defDefense * 2; } + // Slow down dramatically while teleporting + if (NPC.ai[0] == 4f || NPC.ai[0] == 5f) + { + if (Math.Abs(NPC.velocity.X) > 0.1f) + { + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) <= 0.1f) + NPC.velocity.X = 0f; + } + } + // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[0] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -254,10 +261,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; - - NPC.ai[0] = 5f; + NPC.ai[0] = 4f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -311,35 +315,30 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport by increasing ai[3] + // Get ready to teleport if (calamityGlobalNPC.newAI[0] < teleportGateValue) { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - calamityGlobalNPC.newAI[0] += death ? 3f : 2f; + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + calamityGlobalNPC.newAI[0] += 10f; + } else - calamityGlobalNPC.newAI[0] += 1f; + { + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) + calamityGlobalNPC.newAI[0] += death ? 3f : 2f; + else + calamityGlobalNPC.newAI[0] += 1f; + } } - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); + float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; if (NPC.ai[0] == 0f) { - // Catch up to the target if too far away - float catchUpDistance = 1600f; - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[0] = 4f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit @@ -368,7 +367,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; float jumpGateValue = 50f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + float velocityX = death ? 14f : revenge ? 13f : expertMode ? 12f : 10f; if (revenge) { float moveBoost = death ? 22f * (1f - lifeRatio) : 14f * (1f - lifeRatio); @@ -377,7 +376,7 @@ namespace CalamityMod.NPCs.SlimeGod velocityX += speedBoost; } - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) speedMult += distanceBelowTarget * 0.002f; @@ -385,10 +384,7 @@ namespace CalamityMod.NPCs.SlimeGod if (speedMult > 2f) speedMult = 2f; - float velocityY = 8f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 4f; - + float velocityY = 6f; float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; if (NPC.ai[1] >= jumpGateValue) { @@ -443,11 +439,13 @@ namespace CalamityMod.NPCs.SlimeGod { switch ((int)NPC.localAI[2]) { + // Jump combo default: case 1: NPC.ai[0] = 2f; break; + // Slam case 2: NPC.ai[0] = 1f; break; @@ -459,7 +457,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; } NPC.ai[1] = 0f; @@ -472,6 +470,8 @@ namespace CalamityMod.NPCs.SlimeGod landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; } } + + // Jump above for slam attack else if (NPC.ai[0] == 1f) { // Avoid cheap bullshit @@ -484,45 +484,51 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; + + float distanceAboveTarget = 350f; + Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - if (NPC.ai[1] > 12f) + float moveSpeed = slamVelocity - 6f; + float inertia = 5f; + velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + + float delayBeforeSlamming = 12f; + if (NPC.ai[1] > delayBeforeSlamming) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = targetDist; + NPC.velocity = velocity; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - targetDist = targetDist.SafeNormalize(Vector2.UnitY); - targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; + float inertia = 6f; + velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; } } + + // Slam down else if (NPC.ai[0] == 1.1f) { // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -556,7 +562,6 @@ namespace CalamityMod.NPCs.SlimeGod // Spread of spikes float projectileVelocity = 2f; int type2 = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type2); Vector2 spawnLocation = new Vector2(NPC.Center.X, NPC.Center.Y + 50f * NPC.scale); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; @@ -591,7 +596,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, damage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type2, BigSpikeDamage, 0f, Main.myPlayer, maxVelocity, acceleration, spikeType); } } @@ -611,9 +616,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y > slamVelocity) + NPC.velocity.Y = slamVelocity; } // Jump in quick succession @@ -628,30 +632,21 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - if (NPC.ai[1] > 15f) + float jumpGateValue = 15f; + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - NPC.velocity.Y -= 3f; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.25f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.5f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.75f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.25f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.5f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; + float jumpSpeedX = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 10f) + distanceSpeedBoost) * NPC.direction; + float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); - NPC.velocity.X = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 11f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else @@ -663,7 +658,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); + float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -708,67 +703,28 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Catch up to the target if too far away - else if (NPC.ai[0] == 4f) - { - // Avoid cheap bullshit - NPC.damage = setDamage; - - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.spriteDirection = NPC.direction; - - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.ai[3] = 0f; - NPC.netUpdate = true; - } - - float movementSpeed = 16f; - if (distanceFromTarget.Length() > movementSpeed) - { - distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); - distanceFromTarget *= movementSpeed; - } - - float inertia = 25f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; - } - // Teleport shit - else if (NPC.ai[0] == 5f) + else if (NPC.ai[0] == 4f) { // Avoid cheap bullshit NPC.damage = 0; NPC.aiAction = 1; NPC.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; + float teleportTime = death ? 30f : 40f; scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; } @@ -782,13 +738,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[crimsonDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 6f) + else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit NPC.damage = 0; NPC.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + float teleportEndTime = death ? 15f : 20f; scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) @@ -849,9 +805,9 @@ namespace CalamityMod.NPCs.SlimeGod { bossLife = (float)NPC.life; - int offset = 32; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int offset = 16; + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); diff --git a/NPCs/SlimeGod/EbonianPaladin.cs b/NPCs/SlimeGod/EbonianPaladin.cs index 4aa40da436..b28982e265 100644 --- a/NPCs/SlimeGod/EbonianPaladin.cs +++ b/NPCs/SlimeGod/EbonianPaladin.cs @@ -38,7 +38,7 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 40; // 80 NPC.width = Width; NPC.height = Height; NPC.defense = 10; @@ -49,15 +49,11 @@ namespace CalamityMod.NPCs.SlimeGod NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = 0f; NPC.Opacity = 1f; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -86,10 +82,9 @@ namespace CalamityMod.NPCs.SlimeGod CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -98,10 +93,10 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - setDamage += 22; + setDamage += SlimeGodCore.PossessionDamageBoost; } - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = Main.getGoodWorld ? 0.8f : 1f; NPC.aiAction = 0; // Get a target @@ -131,7 +126,7 @@ namespace CalamityMod.NPCs.SlimeGod if (lifeRatio <= 0.5f && Main.netMode != NetmodeID.MultiplayerClient && expertMode) { - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) { int type = ModContent.ProjectileType(); for (int i = 0; i < 30; i++) @@ -160,15 +155,100 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - if (bossRush) - { - enraged = true; - hyperMode = true; - } - // For animating the wings NPC.localAI[0] += 1f; + // Slow down dramatically while teleporting + if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) + { + if (NPC.velocity.Length() > 0.1f) + { + NPC.velocity *= 0.8f; + if (NPC.velocity.Length() <= 0.1f) + NPC.velocity = Vector2.Zero; + } + } + + // Teleport + float teleportGateValue = 1080f; + if (!player.dead && NPC.timeLeft > 10 && calamityGlobalNPC.newAI[1] >= teleportGateValue && NPC.ai[0] == 0f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[0] = 5f; + NPC.ai[1] = 0f; + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.netUpdate = true; + NPC.TargetClosest(false); + player = Main.player[NPC.target]; + + float distanceAhead = 960f; + Vector2 randomDefault = Main.rand.NextBool() ? Vector2.UnitX : -Vector2.UnitX; + Vector2 vectorAimedAheadOfTarget = player.Center + new Vector2((float)Math.Round(player.velocity.X), 0f).SafeNormalize(randomDefault) * distanceAhead; + Point predictiveTeleportPoint = vectorAimedAheadOfTarget.ToTileCoordinates(); + int randomPredictiveTeleportOffset = 5; + int teleportTries = 0; + while (teleportTries < 100) + { + teleportTries++; + int teleportTileX = Main.rand.Next(predictiveTeleportPoint.X - randomPredictiveTeleportOffset, predictiveTeleportPoint.X + randomPredictiveTeleportOffset + 1); + int teleportTileY = Main.rand.Next(predictiveTeleportPoint.Y - randomPredictiveTeleportOffset, predictiveTeleportPoint.Y); + + if (!Main.tile[teleportTileX, teleportTileY].HasUnactuatedTile) + { + bool canTeleportToTile = true; + if (canTeleportToTile && Main.tile[teleportTileX, teleportTileY].LiquidType == LiquidID.Lava) + canTeleportToTile = false; + if (canTeleportToTile && !Collision.CanHitLine(NPC.Center, 0, 0, predictiveTeleportPoint.ToVector2() * 16, 0, 0)) + canTeleportToTile = false; + + if (canTeleportToTile) + { + calamityGlobalNPC.newAI[2] = teleportTileX * 16 + 8; + calamityGlobalNPC.newAI[3] = teleportTileY * 16 + 16; + calamityGlobalNPC.newAI[1] = 0f; + break; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; + } + else + predictiveTeleportPoint.X += predictiveTeleportPoint.X < 0f ? 1 : -1; + } + + // Default teleport if the above conditions aren't met in 100 iterations + if (teleportTries >= 100) + { + Vector2 bottom = Main.player[Player.FindClosest(NPC.position, NPC.width, NPC.height)].Bottom; + calamityGlobalNPC.newAI[2] = bottom.X; + calamityGlobalNPC.newAI[3] = bottom.Y; + calamityGlobalNPC.newAI[1] = 0f; + } + } + } + + // Get ready to teleport + if (calamityGlobalNPC.newAI[1] < teleportGateValue) + { + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + calamityGlobalNPC.newAI[1] += 10f; + } + else + { + float teleportFasterDistance = 1000f; + if (NPC.Distance(player.Center) > teleportFasterDistance) + calamityGlobalNPC.newAI[1] += death ? 3f : 2f; + else + calamityGlobalNPC.newAI[1] += 1f; + } + } + if (NPC.ai[0] == 0f) { // Avoid cheap bullshit @@ -181,7 +261,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.timeLeft > 10) { NPC.ai[1] += 1f; - int idleTime = bossRush ? 30 : death ? 75 : revenge ? 90 : 120; + int idleTime = death ? 75 : revenge ? 90 : 120; if (NPC.ai[1] >= idleTime) { NPC.ai[1] = 0f; @@ -231,7 +311,6 @@ namespace CalamityMod.NPCs.SlimeGod int numProjectiles = Main.getGoodWorld ? 12 : death ? 6 : 4; float projectileVelocity = death ? 8f : 6f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; float rotation = MathHelper.ToRadians(80); @@ -242,7 +321,7 @@ namespace CalamityMod.NPCs.SlimeGod Vector2 dustSpawnOffset = dustSpawnBox * 0.5f; for (int i = 0; i < numProjectiles; i++) { - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) destination *= Main.rand.NextFloat() + 0.5f; Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProjectiles - 1))); @@ -262,7 +341,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } // Fire slime balls directly at players with a max of 2 @@ -296,7 +375,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } } } @@ -345,14 +424,13 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.ai[1] == 1f) { NPC.ai[3] += 1f; - float slimeDropGateValue = bossRush ? 10f : death ? 20f : revenge ? 25f : expertMode ? 30f : 40f; + float slimeDropGateValue = death ? 20f : revenge ? 25f : expertMode ? 30f : 40f; if (NPC.ai[3] % slimeDropGateValue == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { float projectileVelocity = 3f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y + 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int dustType = DustID.TintableDust; @@ -376,7 +454,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, destination, type, damage, 0f, Main.myPlayer, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, destination, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 1f); } SoundEngine.PlaySound(SlimeGodCore.ShotSound, NPC.Center); @@ -402,15 +480,16 @@ namespace CalamityMod.NPCs.SlimeGod // Distance required to charge float minChargeSafeDistance = 650f; + // Duration for slow down after charging + float slowDownDurationAfterCharge = revenge ? 90f : 120f; + // Charge variables float chargeVelocityMult = 0.1f; - float maxChargeVelocity = (bossRush || enraged) ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + float maxChargeVelocity = enraged ? 12f : death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; if (Main.getGoodWorld) - maxChargeVelocity *= 1.15f; - if (CalamityWorld.LegendaryMode && revenge) maxChargeVelocity *= 2f; - float inertia = (bossRush || enraged) ? 100f : death ? 110f : revenge ? 114f : expertMode ? 120f : 130f; + float inertia = death ? 110f : revenge ? 114f : expertMode ? 120f : 130f; if (lifeRatio < 0.75f) inertia *= 0.8f; if (Main.getGoodWorld) @@ -450,11 +529,10 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.ai[2] += 1f; - float phaseGateValue = (bossRush || enraged) ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; + float phaseGateValue = enraged ? 120f : death ? 140f : revenge ? 150f : expertMode ? 160f : 180f; if (NPC.ai[2] >= phaseGateValue) { NPC.ai[1] = 2f; - float slowDownDurationAfterCharge = revenge ? 90f : 120f; NPC.ai[2] = slowDownDurationAfterCharge; NPC.localAI[2] = 0f; NPC.velocity *= 0.5f; @@ -469,7 +547,7 @@ namespace CalamityMod.NPCs.SlimeGod // Accelerate if (NPC.velocity.Length() < maxChargeVelocity) { - float velocityMult = (bossRush || enraged) ? 1.15f : death ? 1.13f : revenge ? 1.12f : expertMode ? 1.11f : 1.1f; + float velocityMult = enraged ? 1.15f : death ? 1.13f : revenge ? 1.12f : expertMode ? 1.11f : 1.1f; NPC.velocity = targetVector * (NPC.velocity.Length() * velocityMult); if (NPC.velocity.Length() > maxChargeVelocity) { @@ -506,7 +584,19 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - NPC.ai[2] -= 1f; + // Fly to a location that the player can hit + bool flyToHittableLocation = NPC.ai[2] == slowDownDurationAfterCharge && !Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1); + if (flyToHittableLocation) + { + Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(new Vector2(NPC.direction, 0f)) * maxChargeVelocity; + NPC.SimpleFlyMovement(velocity, 0.25f); + } + else + { + NPC.velocity *= 0.95f; + NPC.ai[2] -= 1f; + } + if (NPC.ai[2] <= 0f) { NPC.Calamity().newAI[0] = NPC.ai[0]; @@ -518,8 +608,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.TargetClosest(); NPC.netUpdate = true; } - - NPC.velocity *= 0.95f; } } @@ -540,6 +628,76 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Teleport shit + else if (NPC.ai[0] == 5f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.aiAction = 1; + NPC.ai[1] += 1f; + float teleportTime = death ? 30f : 40f; + scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.Bottom = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + NPC.netUpdate = true; + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) + { + NPC.ai[0] = 6f; + NPC.ai[1] = 0f; + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int i = 0; i < 5; i++) + { + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; + } + } + else if (NPC.ai[0] == 6f) + { + // Avoid cheap bullshit + NPC.damage = 0; + + NPC.ai[1] += 1f; + float teleportEndTime = death ? 15f : 20f; + scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); + scale = 0.5f + scale * 0.5f; + if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.ai[0] = 0f; + NPC.ai[1] = -10f; + NPC.netUpdate = true; + NPC.TargetClosest(); + } + + if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportEndTime * 2f) + { + NPC.ai[0] = 0f; + NPC.ai[1] = -10f; + NPC.TargetClosest(); + } + + // Emit teleport dust + Color dustColor = Color.Lavender; + dustColor.A = 150; + for (int i = 0; i < 5; i++) + { + int corruptDust = Dust.NewDust(NPC.position + Vector2.UnitX * -20f, NPC.width + 40, NPC.height, DustID.TintableDust, NPC.velocity.X, NPC.velocity.Y, 0, dustColor, 2f); + Main.dust[corruptDust].noGravity = true; + Main.dust[corruptDust].velocity *= 0.5f; + } + } + if (bossLife == 0f && NPC.life > 0) bossLife = NPC.lifeMax; @@ -570,8 +728,8 @@ namespace CalamityMod.NPCs.SlimeGod for (int j = 0; j < randSlimeAmt; j++) { int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); @@ -590,14 +748,12 @@ namespace CalamityMod.NPCs.SlimeGod public static void FlyMovement(NPC npc, bool slimeBombardment = false) { // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool masterMode = Main.masterMode; bool death = CalamityWorld.death; bool revenge = CalamityWorld.revenge; bool ableToDropSlime = npc.ai[1] == 1f; - float flyVelocity = bossRush ? 20f : death ? 15f : revenge ? 12.5f : 10f; - float flyAcceleration = bossRush ? 0.24f : death ? 0.18f : revenge ? 0.15f : 0.12f; + float flyVelocity = death ? 15f : revenge ? 12.5f : 10f; + float flyAcceleration = death ? 0.18f : revenge ? 0.15f : 0.12f; if (slimeBombardment) { @@ -610,7 +766,7 @@ namespace CalamityMod.NPCs.SlimeGod } float slimeBombardmentDistance = 720f; - float flyDistanceY = slimeBombardment ? -450f : masterMode ? -360f : -405f; + float flyDistanceY = slimeBombardment ? -450f : death ? -360f : -405f; float flyDistanceX = slimeBombardment ? (ableToDropSlime ? (slimeBombardmentDistance * -npc.ai[2]) : (slimeBombardmentDistance * npc.ai[2])) : 0f; Vector2 destination = Main.player[npc.target].Center + new Vector2(flyDistanceX, flyDistanceY); diff --git a/NPCs/SlimeGod/SlimeGodCore.cs b/NPCs/SlimeGod/SlimeGodCore.cs index 8e702a3dd7..e305a07cb0 100644 --- a/NPCs/SlimeGod/SlimeGodCore.cs +++ b/NPCs/SlimeGod/SlimeGodCore.cs @@ -43,6 +43,15 @@ namespace CalamityMod.NPCs.SlimeGod Crimulan } + private enum AggressionLevel + { + Neutral, + FireProjectiles, + ChargeAbovePlayer, + ChargeAtPlayer, + DoEverythingMoreOften + } + private bool slimesSpawned = false; private int buffedSlime = 0; @@ -51,7 +60,6 @@ namespace CalamityMod.NPCs.SlimeGod public static readonly SoundStyle ShotSound = new("CalamityMod/Sounds/Custom/SlimeGodShot", 2); public static readonly SoundStyle BigShotSound = new("CalamityMod/Sounds/Custom/SlimeGodBigShot", 2); - public static Asset ZenithSeedEyeTexture; public static Asset EyeTexture; public static Asset OverlayTexture; @@ -64,35 +72,26 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetStaticDefaults() { NPCID.Sets.BossBestiaryPriority.Add(Type); - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Scale = 0.5f, - PortraitScale = 0.6f, - CustomTexturePath = "CalamityMod/ExtraTextures/Bestiary/SlimeGod_Bestiary", - PortraitPositionXOverride = 40, - PortraitPositionYOverride = 40 - }; - value.Position.X += 65; - value.Position.Y += 35; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; NPCID.Sets.MPAllowedEnemies[Type] = true; if (!Main.dedServ) { - ZenithSeedEyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/SlimeGodEyes", AssetRequestMode.AsyncLoad); EyeTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreEye", AssetRequestMode.AsyncLoad); OverlayTexture = ModContent.Request("CalamityMod/NPCs/SlimeGod/ExtraTextures/SlimeGodCoreOverlay", AssetRequestMode.AsyncLoad); } } + public static int GlobDamage = 15; // 60 + public static int PossessionDamageBoost = 10; // +20 flat contact damage + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 40; // 80 NPC.npcSlots = 10f; NPC.width = 96; NPC.height = 98; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) NPC.scale = 2f; NPC.defense = 6; @@ -102,7 +101,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 12, 0, 0); + NPC.value = Item.buyPrice(gold: 8); NPC.Opacity = 0.8f; NPC.boss = true; NPC.BossBar = ModContent.GetInstance(); @@ -113,9 +112,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -203,13 +199,11 @@ namespace CalamityMod.NPCs.SlimeGod Lighting.AddLight(NPC.Center, light.X, light.Y, light.Z); CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - CalamityGlobalNPC.slimeGod = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // For animating the eye NPC.localAI[0] += 1f; @@ -236,17 +230,17 @@ namespace CalamityMod.NPCs.SlimeGod // Charge at level 2 // Follow the player around instead of the Paladins at level 3 // Buff a Paladin far sooner, fire more projectiles, and charge faster at level 4 - int aggressionLevel = 0; + int aggressionLevel = (int)AggressionLevel.Neutral; if (!NPC.AnyNPCs(ModContent.NPCType()) && !NPC.AnyNPCs(ModContent.NPCType())) { - aggressionLevel = 1; + aggressionLevel = (int)AggressionLevel.FireProjectiles; int splitPaladinCount = NPC.CountNPCS(ModContent.NPCType()) + NPC.CountNPCS(ModContent.NPCType()); if (splitPaladinCount < 2) - aggressionLevel = 4; + aggressionLevel = (int)AggressionLevel.DoEverythingMoreOften; else if (splitPaladinCount < 3) - aggressionLevel = 3; + aggressionLevel = (int)AggressionLevel.ChargeAtPlayer; else if (splitPaladinCount < 4) - aggressionLevel = 2; + aggressionLevel = (int)AggressionLevel.ChargeAbovePlayer; } // Enrage based on large slimes @@ -409,7 +403,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.timeLeft = 1800; // Hide inside large slime - float hideInsideLargeSlimePhaseGateValue = aggressionLevel == 4 ? 120f : phase2 ? 300f : 900f; + float hideInsideLargeSlimePhaseGateValue = aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften ? 120f : phase2 ? 300f : 900f; float hideInsideLargeSlimePhaseDuration = 600f; float exitLargeSlimeGateValue = hideInsideLargeSlimePhaseGateValue + hideInsideLargeSlimePhaseDuration; calamityGlobalNPC.newAI[2] += 1f; @@ -493,11 +487,11 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - if (expertMode && aggressionLevel >= 1) + if (expertMode && aggressionLevel >= (int)AggressionLevel.FireProjectiles) { - float divisor = bossRush ? 50f : death ? 90f : revenge ? 120f : 150f; + float divisor = death ? 90f : revenge ? 120f : 150f; divisor -= (aggressionLevel - 1) * 10f; - if (aggressionLevel == 4) + if (aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften) divisor *= 0.5f; if (calamityGlobalNPC.newAI[2] % divisor == 0f) @@ -509,17 +503,15 @@ namespace CalamityMod.NPCs.SlimeGod { float projectileVelocity = 4f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, GlobDamage, 0f, Main.myPlayer); } else { float projectileVelocity = 8f + (aggressionLevel - 1) * 2f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocity, type, GlobDamage, 0f, Main.myPlayer); } } } @@ -533,121 +525,65 @@ namespace CalamityMod.NPCs.SlimeGod float flySpeed = death ? 15f : revenge ? 13.5f : expertMode ? 12f : 9f; flySpeed += aggressionLevel; - if (aggressionLevel == 4) + if (aggressionLevel == (int)AggressionLevel.DoEverythingMoreOften) flySpeed += 3f; if (phase2) flySpeed *= 1.1f; - if (bossRush) - flySpeed *= 1.2f; if (Main.getGoodWorld) flySpeed *= 1.3f; - Vector2 flyDirection = new Vector2(NPC.Center.X + (NPC.direction * 20), NPC.Center.Y + 6f); - Vector2 flyDestination = aggressionLevel >= 3 ? player.Center : GetFlyDestination(player); - Vector2 idealVelocity = (flyDestination - flyDirection).SafeNormalize(Vector2.UnitY) * flySpeed; + Vector2 flyDestination = aggressionLevel >= (int)AggressionLevel.ChargeAtPlayer ? player.Center : player.Center - Vector2.UnitY * 320f; + Vector2 idealVelocity = (flyDestination - NPC.Center).SafeNormalize(Vector2.UnitY) * flySpeed; float distanceFromFlyDestination = NPC.Distance(flyDestination); - if (aggressionLevel >= 2) + if (aggressionLevel >= (int)AggressionLevel.ChargeAbovePlayer) { NPC.ai[0] -= 1f; - if (distanceFromFlyDestination < 200f || NPC.ai[0] > 0f) + float chargeGateDistance = aggressionLevel >= (int)AggressionLevel.ChargeAtPlayer ? 160f : 80f; + float chargeCooldown = 20f; + if (distanceFromFlyDestination < chargeGateDistance || NPC.ai[0] > 0f) { // Set damage NPC.damage = NPC.defDamage; - if (distanceFromFlyDestination < 200f) - NPC.ai[0] = 20f; - - if (NPC.velocity.X < 0f) - NPC.direction = -1; - else - NPC.direction = 1; + if (distanceFromFlyDestination < chargeGateDistance) + NPC.ai[0] = chargeCooldown; + NPC.direction = NPC.velocity.X < 0f ? -1 : 1; NPC.rotation += NPC.direction * 0.3f; return; } } - if (distanceFromFlyDestination < 150f && aggressionLevel < 2) + float slowDownDistance = 160f; + if (distanceFromFlyDestination < slowDownDistance && aggressionLevel < (int)AggressionLevel.ChargeAbovePlayer) { - if (NPC.velocity.Length() > flySpeed * 0.2f) + if (NPC.velocity.Length() > flySpeed * 0.1f) NPC.velocity *= 0.9f; } else { - float inertia = 50f; - inertia -= aggressionLevel * 3f; + float minInertia = 6f; + float minInertiaDistance = 200f; + float maxInertia = 50f - aggressionLevel * 3f; + float maxInertiaDistance = 600f; + float totalInertiaAdjustmentDistance = maxInertiaDistance - minInertiaDistance; + float distanceFromInertiaAdjustmentCutoff = distanceFromFlyDestination - minInertiaDistance; if (Main.getGoodWorld) - inertia *= 0.8f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - inertia *= Main.rand.NextFloat(0.2f, 1f); + maxInertia *= 0.8f; + + float inertia = distanceFromFlyDestination >= maxInertiaDistance ? maxInertia : + distanceFromFlyDestination <= minInertiaDistance ? minInertia : + MathHelper.Lerp(minInertia, maxInertia, 1f - (totalInertiaAdjustmentDistance - distanceFromInertiaAdjustmentCutoff) / totalInertiaAdjustmentDistance); NPC.velocity = (NPC.velocity * inertia + idealVelocity) / (inertia + 1f); - if (distanceFromFlyDestination < 350f) - NPC.velocity = (NPC.velocity * 10f + idealVelocity) / 11f; - if (distanceFromFlyDestination < 300f) - NPC.velocity = (NPC.velocity * 7f + idealVelocity) / 8f; } NPC.rotation = NPC.velocity.X * 0.05f; } - public Vector2 GetFlyDestination(Player target) - { - // Find all large slimes in the world. - // If multiple slimes are present, and they are all relatively close together, try to stay in their general area. - // If they are far apart, try to stay towards the closest slime. - // If no slimes exist, or they are all extremely far away, try to stay near the target player instead. - - int largeCrimulanPaladin = ModContent.NPCType(); - int splitCrimulanPaladin = ModContent.NPCType(); - int largeEbonianPaladin = ModContent.NPCType(); - int splitEbonianPaladin = ModContent.NPCType(); - List largeSlimes = new(); - - float ignoreGeneralAreaDistanceThreshold = 750f; - float ignoreAllSlimesDistanceThreshold = 3200f; - - // Find all slimes within a generous area. - foreach (NPC n in Main.ActiveNPCs) - { - int npcType = n.type; - if (npcType != largeCrimulanPaladin && npcType != splitCrimulanPaladin && npcType != largeEbonianPaladin && npcType != splitEbonianPaladin) - continue; - - if (!NPC.WithinRange(n.Center, ignoreAllSlimesDistanceThreshold)) - continue; - - largeSlimes.Add(n); - } - - // If no slimes were found, don't bother doing any more calculations. Just use the player's center. - if (largeSlimes.Count <= 0) - return target.Center; - - // Find the closest slime. - NPC closestSlime = largeSlimes.OrderBy(n => n.Distance(NPC.Center)).First(); - - // Get the general area of all the slimes by averaging together their positions. - Vector2 generalSlimeArea = Vector2.Zero; - for (int i = 0; i < largeSlimes.Count; i++) - generalSlimeArea += largeSlimes[i].Center; - generalSlimeArea /= largeSlimes.Count; - - // Determine the average deviation of all slimes from the general area. - // This provides a general idea of how far apart all the slimes are from each-other. - float averageGeneralAreaDistanceDeviation = largeSlimes.Average(s => s.Distance(generalSlimeArea)); - - // The slimes are too far apart. Simply go with the closest slime. - if (averageGeneralAreaDistanceDeviation > ignoreGeneralAreaDistanceThreshold) - return closestSlime.Center; - - // Otherwise, use the average general position as a place to hover. - return generalSlimeArea; - } - public override Color? GetAlpha(Color drawColor) { Color newColor = new Color(255, 255, 255, 255); @@ -679,10 +615,9 @@ namespace CalamityMod.NPCs.SlimeGod Texture2D texture = TextureAssets.Npc[Type].Value; Texture2D eyeTexture = EyeTexture.Value; Texture2D overlayTexture = OverlayTexture.Value; - Texture2D pog = ZenithSeedEyeTexture.Value; // Used for animating the eye - if (NPC.localAI[0] % 6f == 0f) + if (NPC.localAI[0] % 6f == 0f && !NPC.IsABestiaryIconDummy) { eyeFrameDrawn++; if (eyeFrameX == 0) @@ -746,9 +681,6 @@ namespace CalamityMod.NPCs.SlimeGod // Draw the overlay spriteBatch.Draw(overlayTexture, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - if (Main.zenithWorld) - spriteBatch.Draw(pog, NPC.Center - screenPos + new Vector2(0f, NPC.gfxOffY), NPC.frame, drawColorAlpha, NPC.rotation, origin, NPC.scale, spriteEffects, 0f); - return false; } @@ -773,7 +705,7 @@ namespace CalamityMod.NPCs.SlimeGod return minDist <= 40f * NPC.scale; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ItemID.HealingPotion; } diff --git a/NPCs/SlimeGod/SlimeGodEyes.png b/NPCs/SlimeGod/SlimeGodEyes.png deleted file mode 100644 index dda0f23656..0000000000 Binary files a/NPCs/SlimeGod/SlimeGodEyes.png and /dev/null differ diff --git a/NPCs/SlimeGod/SplitCrimulanPaladin.cs b/NPCs/SlimeGod/SplitCrimulanPaladin.cs index cbf6b5c86c..54c404647b 100644 --- a/NPCs/SlimeGod/SplitCrimulanPaladin.cs +++ b/NPCs/SlimeGod/SplitCrimulanPaladin.cs @@ -40,14 +40,13 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 36; // 72 NPC.LifeMaxNERB(1875, 2250, 80000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.GetNPCDamage(); NPC.width = Width; NPC.height = Height; NPC.defense = 10; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; @@ -58,9 +57,6 @@ namespace CalamityMod.NPCs.SlimeGod AIType = -1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -97,10 +93,9 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodRed < 0 || !Main.npc[CalamityGlobalNPC.slimeGodRed].active) CalamityGlobalNPC.slimeGodRed = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -112,7 +107,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 20; - setDamage += 22; + setDamage += SlimeGodCore.PossessionDamageBoost; } // Used for landing squash and stretch @@ -127,7 +122,10 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; // Used for teleporting - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = Main.getGoodWorld ? 0.8f : 1f; + + // How fast the slime slams down + float slamVelocity = death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f; // Used for how fast the slime animates NPC.aiAction = 0; @@ -169,15 +167,23 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - if (bossRush) - enraged = true; - if (NPC.localAI[1] != 1f) { if (enraged) NPC.defense = NPC.defDefense * 2; } + // Slow down dramatically while teleporting + if (NPC.ai[0] == 4f || NPC.ai[0] == 5f) + { + if (Math.Abs(NPC.velocity.X) > 0.1f) + { + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) <= 0.1f) + NPC.velocity.X = 0f; + } + } + // Teleport float teleportGateValue = 720f; if (!player.dead && NPC.timeLeft > 10 && NPC.ai[3] >= teleportGateValue && NPC.ai[0] == 0f && NPC.velocity.Y == 0f) @@ -185,10 +191,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; - - NPC.ai[0] = 5f; + NPC.ai[0] = 4f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -242,35 +245,31 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport by increasing ai[3] + // Get ready to teleport // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + NPC.ai[3] += 10f; + } else - NPC.ai[3] += 1f; + { + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } } - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); + float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; if (NPC.ai[0] == 0f) { - // Catch up to the target if too far away - float catchUpDistance = 1600f; - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[0] = 4f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit @@ -299,7 +298,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += 1f; float jumpGateValue = 40f; - float velocityX = death ? 11.5f : revenge ? 10.5f : expertMode ? 9.5f : 7.5f; + float velocityX = death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f; if (revenge) { float moveBoost = death ? 11f * (1f - lifeRatio) : 7f * (1f - lifeRatio); @@ -308,7 +307,7 @@ namespace CalamityMod.NPCs.SlimeGod velocityX += speedBoost; } - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) speedMult += distanceBelowTarget * 0.002f; @@ -316,10 +315,7 @@ namespace CalamityMod.NPCs.SlimeGod if (speedMult > 2f) speedMult = 2f; - float velocityY = 8f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 4f; - + float velocityY = 6f; float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; if (NPC.ai[1] >= jumpGateValue) { @@ -368,11 +364,13 @@ namespace CalamityMod.NPCs.SlimeGod { switch ((int)NPC.localAI[2]) { + // Jump combo default: case 1: NPC.ai[0] = 2f; break; + // Slam case 2: NPC.ai[0] = 1f; break; @@ -384,7 +382,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -11f : revenge ? -10f : expertMode ? -9f : -8f; + NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; } NPC.ai[1] = 0f; @@ -396,6 +394,8 @@ namespace CalamityMod.NPCs.SlimeGod landingRecoil += (NPC.ai[2] - jumpTelegraphGateValue) / telegraphTime; } } + + // Jump above for slam attack else if (NPC.ai[0] == 1f) { // Avoid cheap bullshit @@ -408,45 +408,51 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; + + float distanceAboveTarget = 300f; + Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - targetDist *= death ? 11f : revenge ? 10f : expertMode ? 9f : 8f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; - if (NPC.ai[1] > 12f) + float moveSpeed = slamVelocity - 6f; + float inertia = 5f; + velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; + + float delayBeforeSlamming = 12f; + if (NPC.ai[1] > delayBeforeSlamming) { NPC.ai[1] = 0f; NPC.ai[0] = 1.1f; NPC.ai[2] = 0f; - NPC.velocity = targetDist; + NPC.velocity = velocity; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - targetDist = targetDist.SafeNormalize(Vector2.UnitY); - targetDist *= (death ? 13f : revenge ? 12f : expertMode ? 11f : 10f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + float moveSpeed = (death ? 18.25f : revenge ? 16.5f : expertMode ? 15.5f : 13.5f) + distanceSpeedBoost; + float inertia = 6f; + velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; } } + + // Slam down else if (NPC.ai[0] == 1.1f) { // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; if (NPC.ai[2] == 0f && (atTargetPosition || NPC.localAI[1] == 0f) && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -467,7 +473,6 @@ namespace CalamityMod.NPCs.SlimeGod // Eruption of slime balls that fall down float projectileVelocity = 8f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 3; @@ -496,7 +501,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed * 1.5f, type, damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed * 1.5f, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer, 1f, 0f); } // Fire slime balls directly at players with a max of 2 @@ -530,7 +535,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } } } @@ -549,10 +554,9 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; - NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 22f : death ? 16f : revenge ? 15f : expertMode ? 14f : 13f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; + NPC.velocity.Y += 0.55f; + if (NPC.velocity.Y > slamVelocity) + NPC.velocity.Y = slamVelocity; } // Jump in quick succession @@ -567,30 +571,21 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - if (NPC.ai[1] > 15f) + float jumpGateValue = 15f; + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - NPC.velocity.Y -= 3f; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.25f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.5f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.75f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.25f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.5f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; + float jumpSpeedX = ((death ? 16.25f : revenge ? 14.5f : expertMode ? 13.5f : 11.5f) + distanceSpeedBoost) * NPC.direction; + float jumpSpeedY = -4f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -16f) + jumpSpeedY = -16f; + + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); - NPC.velocity.X = ((death ? 14f : revenge ? 13f : expertMode ? 12f : 11f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else @@ -602,7 +597,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 5.5f : revenge ? 5f : expertMode ? 4.5f : 4f); + float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -646,66 +641,28 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } - // Catch up to the target if too far away - else if (NPC.ai[0] == 4f) - { - // Set damage - NPC.damage = setDamage; - - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.spriteDirection = NPC.direction; - - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - - float movementSpeed = 16f; - if (distanceFromTarget.Length() > movementSpeed) - { - distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); - distanceFromTarget *= movementSpeed; - } - - float inertia = 20f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; - } - // Teleport shit - else if (NPC.ai[0] == 5f) + else if (NPC.ai[0] == 4f) { // Avoid cheap bullshit NPC.damage = 0; NPC.aiAction = 1; NPC.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; + float teleportTime = death ? 30f : 40f; scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; } @@ -719,13 +676,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[crimsonDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 6f) + else if (NPC.ai[0] == 5f) { // Avoid cheap bullshit NPC.damage = 0; NPC.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + float teleportEndTime = death ? 15f : 20f; scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) @@ -787,8 +744,8 @@ namespace CalamityMod.NPCs.SlimeGod bossLife = (float)NPC.life; int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); int slimeType = Main.rand.NextBool(3) ? ModContent.NPCType() : ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); diff --git a/NPCs/SlimeGod/SplitEbonianPaladin.cs b/NPCs/SlimeGod/SplitEbonianPaladin.cs index 9a0213d635..94812533c6 100644 --- a/NPCs/SlimeGod/SplitEbonianPaladin.cs +++ b/NPCs/SlimeGod/SplitEbonianPaladin.cs @@ -40,16 +40,15 @@ namespace CalamityMod.NPCs.SlimeGod public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 36; // 72 NPC.LifeMaxNERB(2000, 2400, 110000); NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.GetNPCDamage(); NPC.width = Width; NPC.height = Height; NPC.defense = 8; NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 1, 0, 0); NPC.Opacity = 1f; NPC.lavaImmune = false; NPC.noGravity = false; @@ -58,9 +57,6 @@ namespace CalamityMod.NPCs.SlimeGod NPC.DeathSound = SoundID.NPCDeath1; NPC.Calamity().VulnerableToHeat = true; NPC.Calamity().VulnerableToSickness = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -97,10 +93,9 @@ namespace CalamityMod.NPCs.SlimeGod if (CalamityGlobalNPC.slimeGodPurple < 0 || !Main.npc[CalamityGlobalNPC.slimeGodPurple].active) CalamityGlobalNPC.slimeGodPurple = NPC.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || NPC.localAI[1] == 1f || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || NPC.localAI[1] == 1f || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -109,7 +104,7 @@ namespace CalamityMod.NPCs.SlimeGod if (NPC.localAI[1] == 1f) { NPC.defense = NPC.defDefense + 16; - setDamage += 20; + setDamage += SlimeGodCore.PossessionDamageBoost; } // Used for landing squash and stretch @@ -123,7 +118,11 @@ namespace CalamityMod.NPCs.SlimeGod addedStretch = -landingRecoil; - float scale = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.6f : Main.getGoodWorld ? 0.8f : 1f; + float scale = Main.getGoodWorld ? 0.8f : 1f; + + // How fast the slime slams down + float slamVelocity = death ? 16f : revenge ? 15f : expertMode ? 14f : 12f; + NPC.aiAction = 0; NPC.noTileCollide = false; NPC.noGravity = false; @@ -161,10 +160,15 @@ namespace CalamityMod.NPCs.SlimeGod enraged = false; } - if (bossRush) + // Slow down dramatically while teleporting + if (NPC.ai[0] == 5f || NPC.ai[0] == 6f) { - enraged = true; - hyperMode = true; + if (Math.Abs(NPC.velocity.X) > 0.1f) + { + NPC.velocity.X *= 0.8f; + if (Math.Abs(NPC.velocity.X) <= 0.1f) + NPC.velocity.X = 0f; + } } // Teleport @@ -174,10 +178,7 @@ namespace CalamityMod.NPCs.SlimeGod // Avoid cheap bullshit NPC.damage = 0; - // Slow down dramatically - NPC.velocity.X *= 0.5f; - - NPC.ai[0] = 6f; + NPC.ai[0] = 5f; NPC.ai[1] = 0f; NPC.ai[2] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -231,35 +232,31 @@ namespace CalamityMod.NPCs.SlimeGod } } - // Get ready to teleport by increasing ai[3] + // Get ready to teleport // This only occurs in Rev and Death for the split Slime Gods if (NPC.ai[3] < teleportGateValue && revenge) { - float teleportFasterDistance = 500f; - if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) - NPC.ai[3] += death ? 3f : 2f; + // Teleport very soon if too far away + float catchUpDistance = 1500f; + bool fastTeleport = NPC.Distance(player.Center) > catchUpDistance; + if (fastTeleport) + { + NPC.ai[3] += 10f; + } else - NPC.ai[3] += 1f; + { + float teleportFasterDistance = 500f; + if (!Collision.CanHitLine(NPC.Center, 0, 0, player.Center, 0, 0) || Math.Abs(NPC.Top.Y - player.Bottom.Y) > teleportFasterDistance) + NPC.ai[3] += death ? 3f : 2f; + else + NPC.ai[3] += 1f; + } } - float distanceSpeedBoost = Vector2.Distance(player.Center, NPC.Center) * (bossRush ? 0.008f : 0.005f); + float distanceSpeedBoost = NPC.Distance(player.Center) * 0.005f; if (NPC.ai[0] == 0f) { - // Catch up to the target if too far away - float catchUpDistance = 1600f; - bool phaseThroughTilesToReachTarget = Vector2.Distance(player.Center, NPC.Center) > catchUpDistance || !Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height); - if (Main.netMode != NetmodeID.MultiplayerClient && phaseThroughTilesToReachTarget) - { - // Set damage - NPC.damage = setDamage; - - NPC.ai[0] = 5f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - if (NPC.velocity.Y == 0f) { // Avoid cheap bullshit @@ -288,7 +285,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.ai[1] += hyperMode ? 2f : 1f; float jumpGateValue = 45f; - float velocityX = death ? 10f : revenge ? 9f : expertMode ? 8f : 6f; + float velocityX = death ? 13f : revenge ? 12f : expertMode ? 11f : 9f; if (revenge) { float moveBoost = death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio); @@ -297,7 +294,7 @@ namespace CalamityMod.NPCs.SlimeGod velocityX += speedBoost; } - float distanceBelowTarget = NPC.position.Y - (player.position.Y + 80f); + float distanceBelowTarget = NPC.Top.Y - (player.Top.Y + 80f); float speedMult = 1f; if (distanceBelowTarget > 0f) speedMult += distanceBelowTarget * 0.002f; @@ -306,9 +303,6 @@ namespace CalamityMod.NPCs.SlimeGod speedMult = 2f; float velocityY = 10f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - velocityY += 2f; - float jumpTelegraphGateValue2 = jumpGateValue - telegraphTime; if (NPC.ai[1] > jumpGateValue) { @@ -377,7 +371,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.noTileCollide = true; - NPC.velocity.Y = death ? -10f : revenge ? -9f : expertMode ? -8f : -7f; + NPC.velocity.Y = death ? -12f : revenge ? -11f : expertMode ? -10f : -8f; } NPC.ai[1] = 0f; @@ -404,13 +398,12 @@ namespace CalamityMod.NPCs.SlimeGod float slimeShotVelocity = 6f; Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * slimeShotVelocity; float minFiringDistance = 160f; // 10 tile distance - if (Vector2.Distance(NPC.Center, player.Center) > minFiringDistance) + if (NPC.Distance(player.Center) > minFiringDistance) { SoundEngine.PlaySound(SlimeGodCore.BigShotSound, NPC.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); int numProj = death ? 5 : 3; int spread = death ? 12 : 8; float rotation = MathHelper.ToRadians(spread); @@ -418,7 +411,7 @@ namespace CalamityMod.NPCs.SlimeGod { Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(3f, 3f); Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 45f * NPC.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 45f * NPC.scale, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } } } @@ -442,37 +435,40 @@ namespace CalamityMod.NPCs.SlimeGod NPC.spriteDirection = NPC.direction; NPC.TargetClosest(); - Vector2 targetCenter = player.Center; - targetCenter.Y -= 350f; - Vector2 targetDist = targetCenter - NPC.Center; + + float distanceAboveTarget = 350f; + Vector2 velocity = player.Center - Vector2.UnitY * distanceAboveTarget - NPC.Center; if (NPC.ai[2] == 1f) { NPC.ai[1] += 1f; - targetDist = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY); - targetDist *= death ? 10f : revenge ? 9f : expertMode ? 8f : 7f; - NPC.velocity = (NPC.velocity * 4f + targetDist) / 5f; + float moveSpeed = slamVelocity - 6f; + float inertia = 5f; + velocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; - if (NPC.ai[1] > 12f) + float delayBeforeSlamming = 12f; + if (NPC.ai[1] > delayBeforeSlamming) { NPC.ai[1] = 0f; NPC.ai[0] = 2.1f; NPC.ai[2] = 0f; - NPC.velocity = targetDist; + NPC.velocity = velocity; } } else { - if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - 300f) + if (Math.Abs(NPC.Center.X - player.Center.X) < 40f && NPC.Center.Y < player.Center.Y - (distanceAboveTarget - 50f)) { NPC.ai[1] = 0f; NPC.ai[2] = 1f; return; } - targetDist = targetDist.SafeNormalize(Vector2.UnitY); - targetDist *= (death ? 12f : revenge ? 11f : expertMode ? 10f : 9f) + distanceSpeedBoost; - NPC.velocity = (NPC.velocity * 5f + targetDist) / 6f; + float moveSpeed = (death ? 16f : revenge ? 15f : expertMode ? 14f : 12f) + distanceSpeedBoost; + float inertia = 6f; + velocity = velocity.SafeNormalize(Vector2.UnitY) * moveSpeed; + NPC.velocity = (NPC.velocity * (inertia - 1f) + velocity) / inertia; } } else if (NPC.ai[0] == 2.1f) @@ -480,7 +476,7 @@ namespace CalamityMod.NPCs.SlimeGod // Set damage NPC.damage = setDamage; - bool atTargetPosition = NPC.position.Y + NPC.height >= player.position.Y; + bool atTargetPosition = NPC.Bottom.Y >= player.Top.Y; if (NPC.ai[2] == 0f && atTargetPosition && Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1) && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) { NPC.ai[2] = 1f; @@ -501,7 +497,6 @@ namespace CalamityMod.NPCs.SlimeGod // Eruption of slime balls float projectileVelocity = 4f; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); Vector2 destination = (new Vector2(NPC.Center.X, NPC.Center.Y - 100f) - NPC.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 9; @@ -533,7 +528,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, perturbedSpeed, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } } @@ -568,7 +563,7 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[slimeDust].noGravity = true; } - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileLocation, projFireDirection, type, SlimeGodCore.GlobDamage, 0f, Main.myPlayer); } } } @@ -588,9 +583,8 @@ namespace CalamityMod.NPCs.SlimeGod NPC.noGravity = true; NPC.velocity.Y += 0.5f; - float velocityLimit = bossRush ? 20f : death ? 15f : revenge ? 14f : expertMode ? 13f : 12f; - if (NPC.velocity.Y > velocityLimit) - NPC.velocity.Y = velocityLimit; + if (NPC.velocity.Y > slamVelocity) + NPC.velocity.Y = slamVelocity; } else if (NPC.ai[0] == 3f) { @@ -603,30 +597,21 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.8f; NPC.ai[1] += 1f; - if (NPC.ai[1] > 15f) + float jumpGateValue = 15f; + if (NPC.ai[1] > jumpGateValue) { // Set damage NPC.damage = setDamage; NPC.ai[1] = 0f; - NPC.velocity.Y -= 6f; - if (player.position.Y + player.height < NPC.Center.Y) - NPC.velocity.Y -= 1.2f; - if (player.position.Y + player.height < NPC.Center.Y - 40f) - NPC.velocity.Y -= 1.4f; - if (player.position.Y + player.height < NPC.Center.Y - 80f) - NPC.velocity.Y -= 1.7f; - if (player.position.Y + player.height < NPC.Center.Y - 120f) - NPC.velocity.Y -= 2f; - if (player.position.Y + player.height < NPC.Center.Y - 160f) - NPC.velocity.Y -= 2.2f; - if (player.position.Y + player.height < NPC.Center.Y - 200f) - NPC.velocity.Y -= 2.4f; - if (!Collision.CanHit(NPC.Center, 1, 1, player.Center, 1, 1)) - NPC.velocity.Y -= 2f; + float jumpSpeedX = ((death ? 12f : revenge ? 11f : expertMode ? 10f : 8f) + distanceSpeedBoost) * NPC.direction; + float jumpSpeedY = -6f - (NPC.Top.Y > player.Bottom.Y ? ((NPC.Top.Y - player.Bottom.Y) * 0.05f) : 0f); + if (jumpSpeedY < -18f) + jumpSpeedY = -18f; + + NPC.velocity = new Vector2(jumpSpeedX, jumpSpeedY); - NPC.velocity.X = ((death ? 11f : revenge ? 10f : expertMode ? 9f : 8f) + distanceSpeedBoost) * NPC.direction; NPC.ai[2] += 1f; } else @@ -638,7 +623,7 @@ namespace CalamityMod.NPCs.SlimeGod NPC.damage = setDamage; NPC.velocity.X *= 0.98f; - float velocityLimit = (death ? 6.5f : revenge ? 6f : expertMode ? 5.5f : 5f); + float velocityLimit = (death ? 7f : revenge ? 6.5f : expertMode ? 6f : 5f); if (NPC.direction < 0 && NPC.velocity.X > -velocityLimit) NPC.velocity.X = -velocityLimit; if (NPC.direction > 0 && NPC.velocity.X < velocityLimit) @@ -682,63 +667,28 @@ namespace CalamityMod.NPCs.SlimeGod NPC.velocity.X *= 0.98f; } + // Teleport shit else if (NPC.ai[0] == 5f) - { - // Set damage - NPC.damage = setDamage; - - NPC.direction = NPC.velocity.X < 0f ? -1 : 1; - NPC.spriteDirection = NPC.direction; - - NPC.noTileCollide = true; - NPC.noGravity = true; - NPC.knockBackResist = 0f; - - Vector2 distanceFromTarget = player.Center - NPC.Center; - distanceFromTarget.Y -= 16f; - if (Main.netMode != NetmodeID.MultiplayerClient && distanceFromTarget.Length() < 500f && !Collision.SolidCollision(NPC.position, NPC.width, NPC.height) && - Collision.CanHit(NPC.position, NPC.width, NPC.height, player.position, player.width, player.height)) - { - // Avoid cheap bullshit - NPC.damage = 0; - - NPC.ai[0] = 0f; - NPC.ai[1] = 0f; - NPC.ai[2] = 0f; - NPC.netUpdate = true; - } - - float movementSpeed = 16f; - if (distanceFromTarget.Length() > movementSpeed) - { - distanceFromTarget = distanceFromTarget.SafeNormalize(Vector2.UnitY); - distanceFromTarget *= movementSpeed; - } - - float inertia = 25f; - NPC.velocity = (NPC.velocity * (inertia - 1f) + distanceFromTarget) / inertia; - } - else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; NPC.aiAction = 1; NPC.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; + float teleportTime = death ? 30f : 40f; scale = MathHelper.Clamp((teleportTime - NPC.ai[1]) / teleportTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportTime && Main.netMode != NetmodeID.MultiplayerClient) { NPC.Bottom = new Vector2(NPC.localAI[0], NPC.localAI[3]); - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; NPC.netUpdate = true; } if (Main.netMode == NetmodeID.MultiplayerClient && NPC.ai[1] >= teleportTime * 2f) { - NPC.ai[0] = 7f; + NPC.ai[0] = 6f; NPC.ai[1] = 0f; } @@ -752,13 +702,13 @@ namespace CalamityMod.NPCs.SlimeGod Main.dust[corruptDust].velocity *= 0.5f; } } - else if (NPC.ai[0] == 7f) + else if (NPC.ai[0] == 6f) { // Avoid cheap bullshit NPC.damage = 0; NPC.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + float teleportEndTime = death ? 15f : 20f; scale = MathHelper.Clamp(NPC.ai[1] / teleportEndTime, 0f, 1f); scale = 0.5f + scale * 0.5f; if (NPC.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) @@ -819,8 +769,8 @@ namespace CalamityMod.NPCs.SlimeGod bossLife = (float)NPC.life; int offset = 16; - int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset)); - int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset)); + int x = (int)(NPC.position.X + offset + (float)Main.rand.Next(NPC.width - offset * 2)); + int y = (int)(NPC.position.Y + offset + (float)Main.rand.Next(NPC.height - offset * 2)); int slimeType = ModContent.NPCType(); int slimeSpawn = NPC.NewNPC(NPC.GetSource_FromAI(), x, y, slimeType); Main.npc[slimeSpawn].SetDefaults(slimeType); diff --git a/NPCs/StormWeaver/StormWeaverBody.cs b/NPCs/StormWeaver/StormWeaverBody.cs index 0519194931..70d85d9033 100644 --- a/NPCs/StormWeaver/StormWeaverBody.cs +++ b/NPCs/StormWeaver/StormWeaverBody.cs @@ -32,9 +32,11 @@ namespace CalamityMod.NPCs.StormWeaver } } + public static int LaserDamage = 54; // 216 + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 90; // 180 NPC.npcSlots = 5f; NPC.width = 40; NPC.height = 40; @@ -60,9 +62,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -73,9 +73,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -101,10 +98,9 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Shed armor bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; @@ -116,7 +112,7 @@ namespace CalamityMod.NPCs.StormWeaver Player player = Main.player[NPC.target]; // Update armored settings to naked settings - if (phase2 && (!CalamityWorld.LegendaryMode || !revenge)) + if (phase2 && (!Main.zenithWorld || !revenge)) { // Spawn armor gore and set other crucial variables if (!NPC.chaseable) @@ -146,7 +142,7 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode != NetmodeID.MultiplayerClient) { // Fire a barrage of lasers every 5 seconds - float laserBarrageGateValue = bossRush ? 200f : 300f; + float laserBarrageGateValue = 300f; if (Main.npc[(int)NPC.ai[2]].localAI[0] % laserBarrageGateValue == 0f) { float bodySegmentDivisor = death ? 6 : revenge ? 5 : expertMode ? 4 : 3; @@ -156,8 +152,7 @@ namespace CalamityMod.NPCs.StormWeaver float projectileVelocity = death ? 6.25f : revenge ? 5.75f : expertMode ? 5.5f : 5f; Vector2 velocityVector = Vector2.Normalize(player.Center - NPC.Center) * projectileVelocity; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocityVector, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, velocityVector, type, LaserDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 900; } } @@ -236,21 +231,6 @@ namespace CalamityMod.NPCs.StormWeaver else if (targetX > 0f) NPC.spriteDirection = 1; } - - // Calculate contact damage based on velocity - float velocity = (phase2 ? 12f : 10f) + (bossRush ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); - float minimalContactDamageVelocity = velocity * 0.25f; - float minimalDamageVelocity = velocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -262,18 +242,17 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase2 = lifeRatio < 0.8f && (!CalamityWorld.LegendaryMode || !revenge); + bool phase2 = lifeRatio < 0.8f && (!Main.zenithWorld || !revenge); bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; @@ -299,17 +278,16 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; @@ -369,7 +347,6 @@ namespace CalamityMod.NPCs.StormWeaver public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } diff --git a/NPCs/StormWeaver/StormWeaverHead.cs b/NPCs/StormWeaver/StormWeaverHead.cs index e2488b3a43..1b104433df 100644 --- a/NPCs/StormWeaver/StormWeaverHead.cs +++ b/NPCs/StormWeaver/StormWeaverHead.cs @@ -83,16 +83,20 @@ namespace CalamityMod.NPCs.StormWeaver } } + public static int LightningDamage = 64; // 256 + public static int FrostWaveDamage = 64; // 256 + public static int TornadoDamage = 72; // 288 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 180; // 360 NPC.npcSlots = 5f; NPC.width = 74; NPC.height = 74; NPC.lifeMax = 825000; NPC.LifeMaxNERB(NPC.lifeMax, NPC.lifeMax, 500000); - NPC.value = Item.buyPrice(1, 0, 0, 0); + NPC.value = Item.buyPrice(gold: 50); // Phase one settings CalamityGlobalNPC global = NPC.Calamity(); @@ -112,9 +116,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.noTileCollide = true; NPC.netAlways = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -125,9 +127,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -171,14 +170,13 @@ namespace CalamityMod.NPCs.StormWeaver { CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; if (CalamityServerConfig.Instance.BossesStopWeather) CalamityWorld.StopRain(); - else if (!Main.raining && !bossRush) + else if (!Main.raining && !BossRushEvent.BossRushActive) CalamityWorld.StartRain(); float lifeRatio = NPC.life / (float)NPC.lifeMax; @@ -193,7 +191,7 @@ namespace CalamityMod.NPCs.StormWeaver bool phase4 = lifeRatio < 0.3f; // Update armored settings to naked settings - if (phase2 && (!CalamityWorld.LegendaryMode || !revenge)) + if (phase2 && !Main.zenithWorld) { // Spawn armor gore, roar and set other crucial variables if (!NPC.chaseable) @@ -280,7 +278,7 @@ namespace CalamityMod.NPCs.StormWeaver } // Used for body and tail projectile firing timings in phase 1 - if (!phase2 || (CalamityWorld.LegendaryMode && revenge)) + if (!phase2 || Main.zenithWorld) NPC.localAI[0] += 1f; } @@ -333,8 +331,8 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 npcCenter = NPC.Center; float targetCenterX = Main.player[NPC.target].Center.X; float targetCenterY = Main.player[NPC.target].Center.Y; - float velocity = (phase2 ? 12f : 10f) + (bossRush ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); - float acceleration = (phase2 ? 0.24f : 0.2f) + (bossRush ? 0.12f : revenge ? 0.08f : expertMode ? 0.04f : 0f); + float velocity = (phase2 ? 12f : 10f) + (revenge ? 1.5f : expertMode ? 1f : 0f); + float acceleration = (phase2 ? 0.24f : 0.2f) + (revenge ? 0.08f : expertMode ? 0.04f : 0f); // Start charging at the player when in phase 2 if (phase2) @@ -358,7 +356,7 @@ namespace CalamityMod.NPCs.StormWeaver bool useTornadoes = calamityGlobalNPC.newAI[3] % 2f != 0f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; if (phase4 && expertMode) @@ -468,7 +466,6 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.FrostWave; - int waveDamage = NPC.GetProjectileDamage(type); int totalWaves = death ? (phase4 ? 27 : 25) : (phase4 ? 25 : 23); int shotSpacing = death ? (phase4 ? 185 : 200) : (phase4 ? 200 : 215); float projectileSpawnX = Main.player[NPC.target].Center.X - totalWaves * shotSpacing * 0.5f; @@ -520,7 +517,7 @@ namespace CalamityMod.NPCs.StormWeaver // Frost Waves start moving after 30 frames // Frost Waves take 30 frames to reach full velocity Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnX, Main.player[NPC.target].Center.Y - 1600f, 0f, velocityY * 0.5f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0f, velocityY); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnX, Main.player[NPC.target].Center.Y - 1600f, 0f, velocityY * 0.1f, type, waveDamage, 0f, Main.myPlayer, delayBeforeFiring, velocityY); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawnX, Main.player[NPC.target].Center.Y - 1600f, 0f, velocityY * 0.1f, type, FrostWaveDamage, 0f, Main.myPlayer, delayBeforeFiring, velocityY); projectileSpawnX += shotSpacing; } } @@ -540,13 +537,12 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ModContent.ProjectileType(); - int tornadoDamage = NPC.GetProjectileDamage(projectileType); int totalTornadoes = revenge ? 7 : expertMode ? 5 : 3; float spawnDistance = revenge ? 750f : expertMode ? 900f : 1050f; for (int i = 0; i < totalTornadoes; i++) { Vector2 spawnPosition = Main.player[NPC.target].Center + Vector2.UnitX * spawnDistance * (i - totalTornadoes / 2); - Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, 0, 0f, Main.myPlayer, tornadoDamage, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnPosition, Vector2.Zero, projectileType, 0, 0f, Main.myPlayer, TornadoDamage, 1f); } } } @@ -558,7 +554,8 @@ namespace CalamityMod.NPCs.StormWeaver if (calamityGlobalNPC.newAI[0] == chargePhaseGateValue - 70) { Vector2 soundCenter = Main.player[NPC.target].Center; - SoundEngine.PlaySound(CommonCalamitySounds.LightningTelegraph, soundCenter); + SoundStyle lightning = new("CalamityMod/Sounds/Custom/LightningTelegraph") { Volume = 0.7f }; + SoundEngine.PlaySound(lightning, soundCenter); } if (calamityGlobalNPC.newAI[0] >= chargePhaseGateValue) { @@ -676,8 +673,7 @@ namespace CalamityMod.NPCs.StormWeaver Vector2 aimDirection = Main.player[NPC.target].Center - source; float ai = Main.rand.Next(100); int type = ProjectileID.CultistBossLightningOrbArc; - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, damage, 0f, Main.myPlayer, aimDirection.ToRotation(), ai); + Projectile.NewProjectile(NPC.GetSource_FromAI(), source, boltVelocity, type, LightningDamage, 0f, Main.myPlayer, aimDirection.ToRotation(), ai); } } } @@ -780,19 +776,6 @@ namespace CalamityMod.NPCs.StormWeaver } } - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = velocity * 0.25f; - float minimalDamageVelocity = velocity * 0.5f; - if (NPC.velocity.Length() <= minimalContactDamageVelocity) - { - NPC.damage = (int)Math.Round(NPC.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((NPC.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp((float)Math.Round(NPC.defDamage * 0.5), NPC.defDamage, velocityDamageScalar); - } - NPC.rotation = (float)Math.Atan2(NPC.velocity.Y, NPC.velocity.X) + MathHelper.PiOver2; if (phase4) @@ -818,7 +801,7 @@ namespace CalamityMod.NPCs.StormWeaver SoundEngine.PlaySound(SoundID.Thunder, NPC.Center); // Start a storm when in third phase. Don't do this during Boss Rush - if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f || bossRush) + if (Main.netMode == NetmodeID.MultiplayerClient || (Main.netMode == NetmodeID.SinglePlayer && Main.gameMenu) || calamityGlobalNPC.newAI[1] > 0f || BossRushEvent.BossRushActive) return; CalamityWorld.StartRain(true, true); @@ -840,18 +823,17 @@ namespace CalamityMod.NPCs.StormWeaver CalamityGlobalNPC calamityGlobalNPC = NPC.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase2 = lifeRatio < 0.8f && (!CalamityWorld.LegendaryMode || !revenge); + bool phase2 = lifeRatio < 0.8f && !Main.zenithWorld; bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; @@ -877,21 +859,20 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - int buffDuration = NPC.Calamity().newAI[0] >= chargePhaseGateValue ? 480 : 240; + int buffDuration = NPC.Calamity().newAI[0] >= chargePhaseGateValue ? 360 : 240; if (hurtInfo.Damage > 0) target.AddBuff(BuffID.Electrified, buffDuration); } @@ -954,7 +935,7 @@ namespace CalamityMod.NPCs.StormWeaver return true; } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } diff --git a/NPCs/StormWeaver/StormWeaverTail.cs b/NPCs/StormWeaver/StormWeaverTail.cs index 4fb551873c..3608b9cc4d 100644 --- a/NPCs/StormWeaver/StormWeaverTail.cs +++ b/NPCs/StormWeaver/StormWeaverTail.cs @@ -35,9 +35,11 @@ namespace CalamityMod.NPCs.StormWeaver } } + public static int LightningOrbDamage = 64; // 256 + public override void SetDefaults() { - NPC.GetNPCDamage(); + NPC.damage = 80; // 160 NPC.npcSlots = 5f; NPC.width = 48; NPC.height = 80; @@ -59,9 +61,7 @@ namespace CalamityMod.NPCs.StormWeaver NPC.netAlways = true; NPC.dontCountMe = true; - if (BossRushEvent.BossRushActive) - NPC.scale *= 1.25f; - else if (CalamityWorld.death) + if (CalamityWorld.death || BossRushEvent.BossRushActive) NPC.scale *= 1.2f; else if (CalamityWorld.revenge) NPC.scale *= 1.15f; @@ -72,9 +72,6 @@ namespace CalamityMod.NPCs.StormWeaver NPC.scale *= 0.7f; NPC.Calamity().VulnerableToElectricity = false; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SendExtraAI(BinaryWriter writer) @@ -114,15 +111,14 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.life > Main.npc[(int)NPC.ai[1]].life) NPC.life = Main.npc[(int)NPC.ai[1]].life; - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; // Shed armor bool phase2 = NPC.life / (float)NPC.lifeMax < 0.8f; // Update armored settings to naked settings - if (phase2 && (!CalamityWorld.LegendaryMode || !CalamityWorld.revenge)) + if (phase2 && (!Main.zenithWorld || !CalamityWorld.revenge)) { // Spawn armor gore and set other crucial variables if (NPC.takenDamageMultiplier == 2f) @@ -150,12 +146,11 @@ namespace CalamityMod.NPCs.StormWeaver if (Main.netMode != NetmodeID.MultiplayerClient) { // Fire a lightning orb every 5 seconds - float spawnOrbGateValue = bossRush ? 200f : 300f; + float spawnOrbGateValue = 300f; if (Main.npc[(int)NPC.ai[2]].localAI[0] % spawnOrbGateValue == 0f) { int type = ProjectileID.CultistBossLightningOrb; - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, LightningOrbDamage, 0f, Main.myPlayer); } } } @@ -232,21 +227,6 @@ namespace CalamityMod.NPCs.StormWeaver else if (targetX > 0f) NPC.spriteDirection = 1; } - - // Calculate contact damage based on velocity - float velocity = (phase2 ? 12f : 10f) + (bossRush ? 3f : revenge ? 1.5f : expertMode ? 1f : 0f); - float minimalContactDamageVelocity = velocity * 0.25f; - float minimalDamageVelocity = velocity * 0.5f; - float bodyAndTailVelocity = (NPC.position - NPC.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - NPC.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - NPC.damage = (int)MathHelper.Lerp(0f, NPC.defDamage, velocityDamageScalar); - } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -258,18 +238,17 @@ namespace CalamityMod.NPCs.StormWeaver if (NPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; - bool phase2 = lifeRatio < 0.8f && (!CalamityWorld.LegendaryMode || !revenge); + bool phase2 = lifeRatio < 0.8f && (!Main.zenithWorld || !revenge); bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; @@ -303,21 +282,20 @@ namespace CalamityMod.NPCs.StormWeaver public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; float lifeRatio = NPC.life / (float)NPC.lifeMax; bool phase3 = lifeRatio < 0.55f; // Gate value that decides when Storm Weaver will charge - float chargePhaseGateValue = bossRush ? 280f : death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; + float chargePhaseGateValue = death ? 320f : revenge ? 340f : expertMode ? 360f : 400f; if (!phase3) chargePhaseGateValue *= 0.5f; - int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= chargePhaseGateValue ? 120 : 60; + int buffDuration = Main.npc[(int)NPC.ai[2]].Calamity().newAI[0] >= chargePhaseGateValue ? 240 : 120; if (hurtInfo.Damage > 0) target.AddBuff(BuffID.Electrified, buffDuration); } @@ -372,7 +350,6 @@ namespace CalamityMod.NPCs.StormWeaver public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } } } diff --git a/NPCs/SulphurousSea/AnthozoanCrab.cs b/NPCs/SulphurousSea/AnthozoanCrab.cs index 2c4804bbdd..dc21b19b4f 100644 --- a/NPCs/SulphurousSea/AnthozoanCrab.cs +++ b/NPCs/SulphurousSea/AnthozoanCrab.cs @@ -38,9 +38,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 56; NPC.height = 42; NPC.defense = 22; - NPC.lifeMax = 1130; + NPC.lifeMax = 900; NPC.aiStyle = AIType = -1; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath46; NPC.knockBackResist = 0.04f; @@ -51,10 +51,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/AquaticUrchin.cs b/NPCs/SulphurousSea/AquaticUrchin.cs index bdcea410e6..f794e7757a 100644 --- a/NPCs/SulphurousSea/AquaticUrchin.cs +++ b/NPCs/SulphurousSea/AquaticUrchin.cs @@ -29,9 +29,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 20; NPC.height = 20; NPC.defense = 10; - NPC.lifeMax = Main.hardMode ? 380 : 70; + NPC.lifeMax = Main.hardMode ? 300 : 100; NPC.knockBackResist = 0.8f; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(silver: 3); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath15; NPC.behindTiles = true; @@ -46,10 +46,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/BelchingCoral.cs b/NPCs/SulphurousSea/BelchingCoral.cs index 4034dc9a41..597eded883 100644 --- a/NPCs/SulphurousSea/BelchingCoral.cs +++ b/NPCs/SulphurousSea/BelchingCoral.cs @@ -36,9 +36,9 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 54; NPC.height = 42; NPC.defense = 25; - NPC.lifeMax = 1250; + NPC.lifeMax = 1000; NPC.aiStyle = AIType = -1; - NPC.value = Item.buyPrice(0, 0, 8, 0); + NPC.value = Item.buyPrice(silver: 8); NPC.HitSound = SoundID.NPCHit42; NPC.DeathSound = SoundID.NPCDeath5; NPC.knockBackResist = 0f; @@ -49,10 +49,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Gnasher.cs b/NPCs/SulphurousSea/Gnasher.cs index 3a06c588b5..893ea62786 100644 --- a/NPCs/SulphurousSea/Gnasher.cs +++ b/NPCs/SulphurousSea/Gnasher.cs @@ -3,7 +3,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -32,12 +32,11 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 50; NPC.height = 36; NPC.defense = 30; - NPC.DR_NERD(0.15f); NPC.lifeMax = 50; NPC.knockBackResist = 0.25f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 60); + NPC.value = Item.buyPrice(copper: 60); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath54; NPC.chaseable = false; @@ -48,10 +47,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Sulflounder.cs b/NPCs/SulphurousSea/Sulflounder.cs index fcf3f4e3d8..602c085d80 100644 --- a/NPCs/SulphurousSea/Sulflounder.cs +++ b/NPCs/SulphurousSea/Sulflounder.cs @@ -2,7 +2,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Potions; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -30,10 +30,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 42; NPC.height = 32; NPC.defense = 15; - NPC.lifeMax = 50; + NPC.lifeMax = 60; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 0, 80); + NPC.value = Item.buyPrice(copper: 80); NPC.HitSound = SoundID.NPCHit50; NPC.DeathSound = SoundID.NPCDeath53; NPC.knockBackResist = 0.35f; @@ -45,10 +45,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Toxicatfish.cs b/NPCs/SulphurousSea/Toxicatfish.cs index 70e1136ec5..ac3bda6439 100644 --- a/NPCs/SulphurousSea/Toxicatfish.cs +++ b/NPCs/SulphurousSea/Toxicatfish.cs @@ -2,7 +2,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Terraria; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -28,10 +28,10 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.width = 98; NPC.height = 40; NPC.defense = 12; - NPC.lifeMax = 150; + NPC.lifeMax = 120; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath40; NPC.knockBackResist = 0.8f; @@ -43,10 +43,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[2] { ModContent.GetInstance().Type, ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SulphurousSea/Trasher.cs b/NPCs/SulphurousSea/Trasher.cs index eb6d2b20c1..0d74458909 100644 --- a/NPCs/SulphurousSea/Trasher.cs +++ b/NPCs/SulphurousSea/Trasher.cs @@ -32,16 +32,15 @@ namespace CalamityMod.NPCs.SulphurousSea public override void SetDefaults() { - NPC.Calamity().canBreakPlayerDefense = true; NPC.noGravity = true; NPC.damage = 50; NPC.width = 150; NPC.height = 40; NPC.defense = 22; - NPC.lifeMax = 250; + NPC.lifeMax = 200; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 3, 0); + NPC.value = Item.buyPrice(silver: 3); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath5; NPC.knockBackResist = 0.15f; @@ -52,10 +51,6 @@ namespace CalamityMod.NPCs.SulphurousSea NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/AlphaSeaMinnow.cs b/NPCs/SunkenSea/AlphaSeaMinnow.cs index e4890a96f7..189335adb2 100644 --- a/NPCs/SunkenSea/AlphaSeaMinnow.cs +++ b/NPCs/SunkenSea/AlphaSeaMinnow.cs @@ -8,7 +8,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.DataStructures; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Enums; using System.Collections.Generic; using Steamworks; @@ -27,19 +26,23 @@ namespace CalamityMod.NPCs.SunkenSea public ref float CurrentBehavior => ref NPC.ai[1]; public static int IdleRandomMovementUnlikeliness = 250; - public static int IdleMinPathDistance = 600; + public static int IdleMinPathDistance = 100; public static int IdleMaxPathDistance = 1200; public static int FleeTileAnticipationDistance = 64; public Vector2 randomPathPoint; + public bool instantiated = false; + protected override List PreyIDs => new List(); protected override List PredatorIDs => new List() { ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() }; protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; @@ -54,6 +57,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.npcSlots = 0.5f; NPC.noGravity = true; NPC.damage = 0; @@ -73,7 +77,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToWater = false; NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -93,12 +96,12 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.TargetClosest(false); // Spawn a shoal of minnows - int fishCount = Main.rand.Next(5, 10); + int fishCount = Main.rand.Next(2, 7); // More spawn in the Radiant Reefs if (NPC.HasPlayerTarget) { if (Main.player[NPC.target].Calamity().ZoneRadiantReefs) - fishCount += 5; + fishCount += 3; } for (int i = 0; i < fishCount; i++) { @@ -107,15 +110,18 @@ namespace CalamityMod.NPCs.SunkenSea int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, minnowtype); Main.npc[n].ai[2] = NPC.whoAmI; // makes the spawned minnow recognize this one as the alpha } - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.6f, - MaxSpeed = 4f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.6f, + MaxSpeed = 4f, + }; + } if (NPC.wet) { switch (CurrentBehavior) @@ -161,7 +167,8 @@ namespace CalamityMod.NPCs.SunkenSea // While it doesn't have any obstacles in front of it, run away in a straight line. // Try to manuever if there are any obstacles. - if (!Main.tile[(NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) + Point lookAheadPosition = (NPC.Center + NPC.DirectionFrom(CurrentPredator.Center) * FleeTileAnticipationDistance).ToTileCoordinates(); + if (!CalamityUtils.ParanoidTileRetrieval(lookAheadPosition.X, lookAheadPosition.Y).IsTileSolid()) { NPC.velocity += NPC.DirectionFrom(CurrentPredator.Center) * pathfinding.Acceleration; pathfinding.ClearResults(); @@ -238,7 +245,11 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + if (spawnInfo.Player.Calamity().ZoneRadiantReefs) + return SpawnCondition.CaveJellyfish.Chance * 0.6f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } return 0f; } @@ -274,14 +285,17 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.rarity = 3; NPC.catchItem = ModContent.ItemType(); - NPC.value = 100000; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.03f; + if (spawnInfo.Player.Calamity().ZoneRadiantReefs) + return SpawnCondition.CaveJellyfish.Chance * 0.2f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.05f; + } return 0f; } diff --git a/NPCs/SunkenSea/BabyGhostBell.cs b/NPCs/SunkenSea/BabyGhostBell.cs index 8f2eebf5f8..bf1ea170d6 100644 --- a/NPCs/SunkenSea/BabyGhostBell.cs +++ b/NPCs/SunkenSea/BabyGhostBell.cs @@ -27,7 +27,7 @@ namespace CalamityMod.NPCs.SunkenSea public bool hasBeenHit = false; public static Asset RadiantTexture; public static Asset VoltaicTexture; - public static Asset RedTexture; + public static Asset PinkTexture; public static Asset GreenTexture; public static Asset GoldTexture; public ref float Variant => ref NPC.ai[1]; @@ -35,7 +35,7 @@ namespace CalamityMod.NPCs.SunkenSea { Blue = 0, Green = 1, - Red = 2, + Pink = 2, Radiant = 3, Voltaic = 4, Gold = 5 @@ -60,7 +60,7 @@ namespace CalamityMod.NPCs.SunkenSea RadiantTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRadiant"); VoltaicTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellVoltaic"); GreenTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGreen"); - RedTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellRed"); + PinkTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellPink"); GoldTexture = ModContent.Request("CalamityMod/NPCs/SunkenSea/BabyGhostBellGold"); } @@ -76,6 +76,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.chaseable = false; + NPC.dontTakeDamageFromHostiles = true; NPC.aiStyle = -1; AIType = -1; NPC.damage = 0; @@ -84,13 +85,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 0; NPC.lifeMax = 5; NPC.knockBackResist = 1f; - NPC.alpha = 100; + NPC.alpha = 75; NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.catchItem = (short)ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -120,7 +120,7 @@ namespace CalamityMod.NPCs.SunkenSea { return; } - Variant = Main.rand.Next(1, 4); + Variant = Main.rand.Next(0, 3); if (Main.rand.NextBool(30)) { Variant = (int)JellyColor.Radiant; @@ -141,21 +141,19 @@ namespace CalamityMod.NPCs.SunkenSea case (int)JellyColor.Green: NPC.catchItem = ModContent.ItemType(); break; - case (int)JellyColor.Red: - NPC.catchItem = ModContent.ItemType(); + case (int)JellyColor.Pink: + NPC.catchItem = ModContent.ItemType(); break; case (int)JellyColor.Radiant: { NPC.catchItem = ModContent.ItemType(); NPC.rarity = 3; - NPC.value = 100000; } break; case (int)JellyColor.Gold: { NPC.catchItem = ModContent.ItemType(); NPC.rarity = 3; - NPC.value = 100000; } break; case (int)JellyColor.Voltaic: @@ -270,7 +268,7 @@ namespace CalamityMod.NPCs.SunkenSea Color lightColor = Color.LightBlue; // Voltaic uses the same light blue switch (Variant) { - case (int)JellyColor.Red: + case (int)JellyColor.Pink: lightColor = Color.Pink; break; case (int)JellyColor.Green: @@ -286,11 +284,6 @@ namespace CalamityMod.NPCs.SunkenSea { NPC.ProduceGoldCritterDust(); } - if (Variant == (int)JellyColor.Radiant || Variant == (int)JellyColor.Gold) - { - NPC.rarity = 3; - NPC.value = 100000; - } } public override void ModifyTypeName(ref string typeName) @@ -336,8 +329,8 @@ namespace CalamityMod.NPCs.SunkenSea int dustType = DustID.BlueCrystalShard; switch (Variant) { - case (int)JellyColor.Red: - dustType = DustID.RedTorch; + case (int)JellyColor.Pink: + dustType = DustID.PinkTorch; break; case (int)JellyColor.Green: dustType = DustID.GemEmerald; @@ -367,8 +360,8 @@ namespace CalamityMod.NPCs.SunkenSea Texture2D texture = TextureAssets.Npc[Type].Value; switch (Variant) { - case (int)JellyColor.Red: - texture = RedTexture.Value; + case (int)JellyColor.Pink: + texture = PinkTexture.Value; break; case (int)JellyColor.Green: texture = GreenTexture.Value; diff --git a/NPCs/SunkenSea/BabyGhostBell.png b/NPCs/SunkenSea/BabyGhostBell.png index 083f1c0909..798cf525ee 100644 Binary files a/NPCs/SunkenSea/BabyGhostBell.png and b/NPCs/SunkenSea/BabyGhostBell.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGold.png b/NPCs/SunkenSea/BabyGhostBellGold.png index 6a1935feff..198d7a739d 100644 Binary files a/NPCs/SunkenSea/BabyGhostBellGold.png and b/NPCs/SunkenSea/BabyGhostBellGold.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellGreen.png b/NPCs/SunkenSea/BabyGhostBellGreen.png index c2d4a7604e..aa7ee07608 100644 Binary files a/NPCs/SunkenSea/BabyGhostBellGreen.png and b/NPCs/SunkenSea/BabyGhostBellGreen.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellPink.png b/NPCs/SunkenSea/BabyGhostBellPink.png new file mode 100644 index 0000000000..46093d1e35 Binary files /dev/null and b/NPCs/SunkenSea/BabyGhostBellPink.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRadiant.png b/NPCs/SunkenSea/BabyGhostBellRadiant.png index 932587a820..701a3c69bc 100644 Binary files a/NPCs/SunkenSea/BabyGhostBellRadiant.png and b/NPCs/SunkenSea/BabyGhostBellRadiant.png differ diff --git a/NPCs/SunkenSea/BabyGhostBellRed.png b/NPCs/SunkenSea/BabyGhostBellRed.png deleted file mode 100644 index 2e4dd1d457..0000000000 Binary files a/NPCs/SunkenSea/BabyGhostBellRed.png and /dev/null differ diff --git a/NPCs/SunkenSea/BabyGhostBellVoltaic.png b/NPCs/SunkenSea/BabyGhostBellVoltaic.png index f714e78a35..a0d92340e2 100644 Binary files a/NPCs/SunkenSea/BabyGhostBellVoltaic.png and b/NPCs/SunkenSea/BabyGhostBellVoltaic.png differ diff --git a/NPCs/SunkenSea/CarrionSwallower.cs b/NPCs/SunkenSea/CarrionSwallower.cs index 715e0884c3..d072498999 100644 --- a/NPCs/SunkenSea/CarrionSwallower.cs +++ b/NPCs/SunkenSea/CarrionSwallower.cs @@ -1,6 +1,9 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Materials; +using CalamityMod.NPCs.NormalNPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; using Microsoft.Xna.Framework; @@ -40,7 +43,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.DD2_SkeletonHurt; NPC.DeathSound = SoundID.DD2_SkeletonDeath; NPC.noGravity = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; //Banner = NPC.type; //BannerItem = ModContent.ItemType(); } @@ -197,7 +200,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.6f; + return SpawnCondition.Cavern.Chance * 0.4f; } return 0f; } @@ -216,5 +219,9 @@ namespace CalamityMod.NPCs.SunkenSea spriteBatch.Draw(tex, NPC.Center - screenPos, frame, drawColor, NPC.rotation, frame.Size() / 2f, NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); return false; } + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + } } } diff --git a/NPCs/SunkenSea/Clam.cs b/NPCs/SunkenSea/Clam.cs index e7eccea2f6..d7dd89529c 100644 --- a/NPCs/SunkenSea/Clam.cs +++ b/NPCs/SunkenSea/Clam.cs @@ -47,6 +47,8 @@ namespace CalamityMod.NPCs.SunkenSea public ref float ShellRotation => ref NPC.localAI[0]; + public int originalDamage; + #region Textures public static Asset bottomJawTex; @@ -84,11 +86,10 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { - NPC.damage = Main.hardMode ? 60 : 30; + originalDamage = NPC.damage = Main.hardMode ? 60 : 30; NPC.width = 50; NPC.height = 30; NPC.defense = 9999; - NPC.DR_NERD(0.25f); NPC.lifeMax = Main.hardMode ? 300 : 150; if (Main.expertMode) { @@ -96,7 +97,7 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); + NPC.value = Main.hardMode ? Item.buyPrice(silver: 5) : Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit4; NPC.knockBackResist = 0; Banner = NPC.type; @@ -106,11 +107,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + SpawnModBiomes = new int[3] { ModContent.GetInstance().Type, ModContent.GetInstance().Type, ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -164,6 +161,8 @@ namespace CalamityMod.NPCs.SunkenSea { case (int)PhaseType.Idle: { + NPC.damage = 0; + NPC.chaseable = false; NPC.velocity.X *= 0.9f; if (ShellRotation > 0) { @@ -206,16 +205,14 @@ namespace CalamityMod.NPCs.SunkenSea } break; } - // If it aggro'd, decrease kb resist and defense since it's no longer stuck in the ground - if (CurrentPhase == (int)PhaseType.Attacking) - { - NPC.knockBackResist = 0.05f; - NPC.defense = Main.hardMode ? 15 : 6; - } } break; case (int)PhaseType.Attacking: { + NPC.damage = 0; + NPC.knockBackResist = 0.05f; + NPC.defense = Main.hardMode ? 15 : 6; + NPC.chaseable = true; Timer++; if (NPC.velocity.Y == 0) { @@ -231,6 +228,8 @@ namespace CalamityMod.NPCs.SunkenSea } else { + NPC.damage = originalDamage; + if (NPC.velocity.Y < 0) { ShellRotation += 0.065f; @@ -247,7 +246,6 @@ namespace CalamityMod.NPCs.SunkenSea ShellRotation = 0; } - // Squirt if (Timer > Main.rand.Next(220, 260) && NPC.HasSight(Target.Center) && ShellRotation == 0) { @@ -259,6 +257,8 @@ namespace CalamityMod.NPCs.SunkenSea break; case (int)PhaseType.Squirt: { + NPC.damage = 0; + NPC.chaseable = true; // Slow down. Once the clam is rested, start incrementing Timer if (NPC.velocity.Y == 0) { @@ -300,6 +300,7 @@ namespace CalamityMod.NPCs.SunkenSea // Fire the projectile if (Timer == (endClose - 5)) { + NPC.damage = originalDamage; Vector2 velocity = NPC.SafeDirectionTo(Target.Center, Vector2.UnitY) * 5; // If the player is on the other side of the clam, flip the jet so that it doesn't fire backwards @@ -308,7 +309,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), NPC.damage / 2, 1); + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, velocity, ModContent.ProjectileType(), Main.hardMode ? 30 : 15, 1); } for (int i = 0; i < 9; i++) { @@ -330,6 +331,9 @@ namespace CalamityMod.NPCs.SunkenSea break; case (int)PhaseType.Pod: { + NPC.damage = 0; + + NPC.chaseable = true; NPC pod = Main.npc[(int)NPC.localAI[2] - 1]; // If the Pearlpod is invalid, go back to idling if (pod == null || !pod.active || pod.life < 0 || pod.ModNPC == null || pod.ModNPC is not Pearlpod) diff --git a/NPCs/SunkenSea/EutrophicRay.cs b/NPCs/SunkenSea/EutrophicRay.cs index 48e4ebabed..e0ee8289b4 100644 --- a/NPCs/SunkenSea/EutrophicRay.cs +++ b/NPCs/SunkenSea/EutrophicRay.cs @@ -1,11 +1,16 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.BiomeManagers; +using CalamityMod.Enums; +using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; @@ -13,49 +18,79 @@ using Terraria.ModLoader; using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class EutrophicRay : ModNPC + public class EutrophicRay : SunkenSeaNPC { - public bool hasBeenHit = false; - public static Asset GlowTexture; + public static Asset TailTexture; + public static Asset TailGlowTexture; + #region Fields + protected override List PreyIDs => []; + protected override List PredatorIDs => + [ + ModContent.NPCType(), + ModContent.NPCType(), + //ModContent.NPCType(), + //ModContent.NPCType() + ]; + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; + + private bool hasBeenHit = false; + private bool shouldAttack => NPC.life < (int)(NPC.lifeMax * 0.6f); + private Entity AttackingEntity; + private Entity AvoidedEntity; + private Action _currentBehavior; + private Action CurrentBehavior + { + get => _currentBehavior; + set + { + if (value != _currentBehavior) + OnBehaviorChange(value); + _previousBehavior = _currentBehavior; + _currentBehavior = value; + } + } + private Action _previousBehavior; + #endregion + + public override void Load() + { + GlowTexture = ModContent.Request(Texture + "Glow"); + TailTexture = ModContent.Request(Texture + "Tail"); + TailGlowTexture = ModContent.Request(Texture + "TailGlow"); + } public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 5; - NPCID.Sets.NPCBestiaryDrawModifiers value = new NPCID.Sets.NPCBestiaryDrawModifiers(); - value.Position.X += 24f; - NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; - if (!Main.dedServ) - { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); - } + Main.npcFrameCount[Type] = 7; + NPCID.Sets.TrailingMode[Type] = 3; + NPCID.Sets.TrailCacheLength[Type] = 15; + base.SetStaticDefaults(); } public override void SetDefaults() { - NPC.damage = Main.hardMode ? 50 : 20; - NPC.width = 116; - NPC.height = 36; - NPC.defense = Main.hardMode ? 15 : 5; - NPC.DR_NERD(0.05f); - NPC.lifeMax = Main.hardMode ? 500 : 150; - NPC.aiStyle = -1; - AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); + base.SetDefaults(); + NPC.width = 54; + NPC.height = 68; + NPC.damage = 20; + NPC.defense = 5; + NPC.lifeMax = 200; + NPC.scale = 0.85f; + + NPC.noGravity = true; + NPC.noTileCollide = false; + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath55; NPC.knockBackResist = 0.5f; + Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -71,160 +106,294 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(NPC.chaseable); writer.Write(hasBeenHit); } - public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); hasBeenHit = reader.ReadBoolean(); } + public override void OnSpawn(IEntitySource source) + { + pathfinding = new PathfindingManager(NPC) + { + MaxSpeed = 4.85f, + Acceleration = 0.5f + }; + CurrentBehavior = IdleBehavior; + } + + #region AI Functions public override void AI() { - NPC.TargetClosest(true); - if (NPC.velocity.X > 0.25f) + if (pathfinding == null) { - NPC.spriteDirection = 1; - } - else if (NPC.velocity.X < 0.25f) - { - NPC.spriteDirection = -1; + pathfinding = new PathfindingManager(NPC) + { + MaxSpeed = 4.85f, + Acceleration = 0.5f + }; } + CurrentBehavior?.Invoke(); + + // If out of water, act like you're out of water. + if ((NPC.noTileCollide ? !(Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : !NPC.wet) && CurrentBehavior != OutOfWaterBehavior) + CurrentBehavior = OutOfWaterBehavior; + + // Used for determining if it should run from players. if (NPC.justHit && !hasBeenHit) - { hasBeenHit = true; - NPC.damage = NPC.defDamage; - NPC.noTileCollide = true; - NPC.noGravity = true; - if (NPC.Center.X < Main.player[NPC.target].Center.X) - { - NPC.ai[0] = 1f; - } - else - { - NPC.ai[0] = 2f; - } - } NPC.chaseable = hasBeenHit; - if (hasBeenHit) + + float curRot = NPC.rotation; + float newRot = NPC.velocity.ToRotation() + MathHelper.Pi; + if (Math.Abs(MathHelper.WrapAngle(curRot) - MathHelper.WrapAngle(newRot)) > MathHelper.PiOver4) { - float AccelerationY = Main.hardMode ? 0.4f : 0.2f; - float MaxSpeedY = Main.hardMode ? 4f : 2.5f; - float Rotation = 0; - if ((NPC.Center.Y + 0.4f) > Main.player[NPC.target].Center.Y) - { - NPC.velocity.Y -= AccelerationY; - if (NPC.velocity.Y < -MaxSpeedY) - { - NPC.velocity.Y = -MaxSpeedY; - } - } - else if ((NPC.Center.Y - 0.4f) < Main.player[NPC.target].Center.Y) - { - NPC.velocity.Y += AccelerationY; - if (NPC.velocity.Y > MaxSpeedY) - { - NPC.velocity.Y = MaxSpeedY; - } - } - float AccelerationX = Main.hardMode ? 0.4f : 0.25f; - float MaxSpeedX = Main.hardMode ? 6f : 4f; - - if (NPC.ai[0] == 1f) - { - Rotation = -0.05f; - NPC.velocity.X -= AccelerationX; - if (NPC.velocity.X < -MaxSpeedX) - { - NPC.velocity.X = -MaxSpeedX; - } - - if ((NPC.Center.X + 300f) < Main.player[NPC.target].Center.X) - { - NPC.ai[0] = 2f; - } - } - else if (NPC.ai[0] == 2f) - { - Rotation = 0.05f; - NPC.velocity.X += AccelerationX; - if (NPC.velocity.X > MaxSpeedX) - { - NPC.velocity.X = MaxSpeedX; - } - - if ((NPC.Center.X - 300f) > Main.player[NPC.target].Center.X) - { - NPC.ai[0] = 1f; - } - } - - NPC.rotation = NPC.velocity.Y * Rotation; - if (NPC.rotation < -0.1f) - { - NPC.rotation = -0.1f; - } - if (NPC.rotation > 0.1f) - { - NPC.rotation = 0.1f; - return; - } + NPC.rotation = Utils.AngleLerp(curRot, newRot, 0.1f); } else - NPC.damage = 0; + { + NPC.rotation = newRot; + } } + private void OnBehaviorChange(Action newBehavior) + { + if (newBehavior == OutOfWaterBehavior) + NPC.noGravity = false; + + pathfinding.MaxSpeed = newBehavior == FleeBehavior ? 6.5f : 5f; + } + + private void IdleBehavior() + { + // Don't deal damage while idling. + NPC.damage = 0; + // If inside solid tiles, attempt to get out of them by occasionally bursting in a random direction. + if (Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (Main.rand.NextBool(150)) + NPC.velocity = Main.rand.NextVector2CircularEdge(7.5f, 7.5f); + + NPC.velocity *= 0.98f; + } + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.NextFloat(200f, 800f), SunkenSeaTileValidity)); + } + private void AttackBehavior() + { + // Check what specifically the hunted entity is. If there is none, go back to idling. + AttackingEntity = AttackingEntity is NPC ? CurrentPrey : CurrentPlayer; + if (AttackingEntity == null) + { + CurrentBehavior = IdleBehavior; + return; + } + + // Set damage while attacking. Clear idle behavior pathfinding to prevent it continuously trying to return to that path when attacking. + NPC.damage = NPC.defDamage; + pathfinding.ClearResults(); + NPC.noTileCollide = true; + + float maxSpeedX = 8.2f; + float maxSpeedY = 3.2f; + float accelX = 0.25f; + float accelY = 0.3f; + int directionX = (NPC.Center.X < AttackingEntity.Center.X).ToDirectionInt(); + int directionY = (NPC.Center.Y < AttackingEntity.Center.Y).ToDirectionInt(); + + NPC.velocity.X += accelX * directionX; + if (NPC.velocity.X > maxSpeedX) + NPC.velocity.X = maxSpeedX; + if (NPC.velocity.X < -maxSpeedX) + NPC.velocity.X = -maxSpeedX; + + NPC.velocity.Y += accelY * directionY; + if (NPC.velocity.Y > maxSpeedY) + NPC.velocity.Y = maxSpeedY; + if (NPC.velocity.Y < -maxSpeedY) + NPC.velocity.Y = -maxSpeedY; + } + private void FleeBehavior() + { + // Check what specifically the predator is. If there is none, go back to idling. + AvoidedEntity = AvoidedEntity is NPC ? CurrentPredator : CurrentPlayer; + if (AvoidedEntity == null) + { + CurrentBehavior = IdleBehavior; + return; + } + + // If you reach the attack threshold, start attacking. + if (shouldAttack && AvoidedEntity is Player) + { + CurrentBehavior = AttackBehavior; + AttackingEntity = AvoidedEntity; + AvoidedEntity = null; + return; + } + + // Don't deal damage while fleeing. + NPC.damage = 0; + NPC.noTileCollide = true; + + // Flee in a straight line if possible, otherwise pathfind away from the attacker. + if (!Main.tile[(NPC.Center + NPC.DirectionFrom(AvoidedEntity.Center) * 64f).ToTileCoordinates()].IsTileSolid()) + { + NPC.velocity += NPC.DirectionFrom(AvoidedEntity.Center) * pathfinding.Acceleration; + pathfinding.ClearResults(); + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + { + float distanceFromAvoided = Vector2.Distance(NPC.Center, AvoidedEntity.Center); + Vector2 pathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); + NPC.netUpdate = true; + pathfinding.DoPathfinding(new(NPC.Center, pathPoint, SunkenSeaTileValidity)); + } + } + private void OutOfWaterBehavior() + { + NPC.damage = 0; + NPC.velocity.X *= 0.985f; + if (NPC.noTileCollide ? (Collision.WetCollision(NPC.position, NPC.width, NPC.height) || Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) : NPC.wet) + { + NPC.noGravity = true; + CurrentBehavior = _previousBehavior; + } + } + #endregion + + #region Creature Detection and Hit Logic + protected override bool PlayerSearchFilter(Player p) => (Vector2.DistanceSquared(NPC.Center, p.Center) < 262144f && hasBeenHit) || shouldAttack; + protected override bool NPCSearchFilter(NPC n) => Vector2.DistanceSquared(NPC.Center, n.Center) < 102400f && (PreyIDs.Contains(n.type) || PredatorIDs.Contains(n.type)); + protected override void OnPreyDetection(NPC prey) + { + if (CurrentPredator is not null) + { + CurrentBehavior = AttackBehavior; + NPC.noTileCollide = true; + AttackingEntity = prey; + } + } + public override bool CanHitNPC(NPC target) => PreyIDs.Contains(target.type); + protected override void OnPredatorDetection(NPC predator) + { + CurrentBehavior = FleeBehavior; + NPC.noTileCollide = false; + AvoidedEntity = predator; + } + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + protected override void OnPlayerDetection(Player player) + { + if (CurrentPredator is not null && !hasBeenHit) + return; + + if (shouldAttack) + { + CurrentBehavior = AttackBehavior; + AttackingEntity = player; + } + else if (hasBeenHit) + { + CurrentBehavior = FleeBehavior; + AvoidedEntity = player; + } + NPC.noTileCollide = shouldAttack; + } + #endregion public override void FindFrame(int frameHeight) { - NPC.frameCounter += (hasBeenHit || NPC.IsABestiaryIconDummy) ? 0.15f : 0f; + NPC.frameCounter += 0.15f; NPC.frameCounter %= Main.npcFrameCount[Type]; int frame = (int)NPC.frameCounter; NPC.frame.Y = frame * frameHeight; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); - Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[Type])) * 1f / 2f; - vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(GlowTexture.Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); - } + Texture2D tex = TextureAssets.Npc[NPC.type].Value; + Vector2 halfSizeTexture = new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[Type]); + Vector2 vector = NPC.Center - screenPos; + Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0); + spriteBatch.Draw(tex, vector, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); + spriteBatch.Draw(GlowTexture.Value, vector, NPC.frame, color, NPC.rotation, halfSizeTexture, NPC.scale, 0, 0f); - public override bool? CanBeHitByProjectile(Projectile projectile) - { - if (projectile.minion && !projectile.Calamity().overridesMinionDamagePrevention) + // Position where the tail starts + Vector2 tailOffset = Vector2.UnitX.RotatedBy(NPC.rotation) * (tex.Width / 2 - 4); + + if (NPC.IsABestiaryIconDummy) { - return hasBeenHit; + for (int i = 0; i < NPC.oldRot.Length; i++) + { + NPC.oldRot[i] = 0; + } + for (int i = 0; i < NPC.oldPos.Length; i++) + { + NPC.oldPos[i] = Vector2.UnitX.RotatedBy(NPC.rotation) * ((tex.Width / 2 - 4) + i * 8); + } } - return null; + + float currentSegmentRotation = NPC.rotation; + List tailDrawPositions = new List(); + int segAmt = 7; + int tailLength = 40; + for (int i = 0; i < segAmt; i++) + { + float tailCompletionRatio = i / (float)segAmt; + float wrappedAngularOffset = MathHelper.WrapAngle(NPC.oldRot[i + 1] - currentSegmentRotation) * 0.6f; + float segmentRotationOffset = MathHelper.Clamp(wrappedAngularOffset, -0.24f, 0.24f); + + Vector2 Offset = Vector2.UnitX.RotatedBy(NPC.rotation); + Vector2 tailSegmentOffset = Vector2.UnitX.RotatedBy(currentSegmentRotation) * tailCompletionRatio * tailLength + Offset; + tailDrawPositions.Add(NPC.Center + tailSegmentOffset + tailOffset); + + currentSegmentRotation += segmentRotationOffset; + } + for (int i = 0; i < tailDrawPositions.Count; i++) + { + Vector2 pos = tailDrawPositions[i]; + float rot = pos.DirectionTo(NPC.Center + Vector2.UnitX.RotatedBy(NPC.rotation)).ToRotation(); + if (i > 0) + { + Vector2 oldPos = tailDrawPositions[i - 1]; + rot = pos.DirectionTo(oldPos).ToRotation(); + } + int frame = i switch + { + 1 => 10, + 5 => 20, + 6 => 32, + _ => 0 + }; + int height = 8; + if (i == 6) + height = 10; + rot += MathHelper.PiOver2; + + spriteBatch.Draw(TailTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), NPC.GetAlpha(drawColor), rot, new Vector2(6, 4), NPC.scale, 0, 0f); + spriteBatch.Draw(TailGlowTexture.Value, pos - screenPos, new Rectangle(0, frame, 10, height), color, rot, new Vector2(6, 4), NPC.scale, 0, 0f); + } + + return false; } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.6f; + if (spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.6f; } return 0f; } public override void HitEffect(NPC.HitInfo hit) { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); - } if (NPC.life <= 0) { - for (int k = 0; k < 25; k++) + for (int k = 0; k < 15; k++) { Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); } diff --git a/NPCs/SunkenSea/EutrophicRay.png b/NPCs/SunkenSea/EutrophicRay.png index f005213289..76f3c10590 100644 Binary files a/NPCs/SunkenSea/EutrophicRay.png and b/NPCs/SunkenSea/EutrophicRay.png differ diff --git a/NPCs/SunkenSea/EutrophicRayGlow.png b/NPCs/SunkenSea/EutrophicRayGlow.png index 585d222148..805039ba34 100644 Binary files a/NPCs/SunkenSea/EutrophicRayGlow.png and b/NPCs/SunkenSea/EutrophicRayGlow.png differ diff --git a/NPCs/SunkenSea/EutrophicRayTail.png b/NPCs/SunkenSea/EutrophicRayTail.png new file mode 100644 index 0000000000..f15d72f500 Binary files /dev/null and b/NPCs/SunkenSea/EutrophicRayTail.png differ diff --git a/NPCs/SunkenSea/EutrophicRayTailGlow.png b/NPCs/SunkenSea/EutrophicRayTailGlow.png new file mode 100644 index 0000000000..3c7ef2ce64 Binary files /dev/null and b/NPCs/SunkenSea/EutrophicRayTailGlow.png differ diff --git a/NPCs/SunkenSea/FesteringRemains.cs b/NPCs/SunkenSea/FesteringRemains.cs index 72137b1c30..21f70be2af 100644 --- a/NPCs/SunkenSea/FesteringRemains.cs +++ b/NPCs/SunkenSea/FesteringRemains.cs @@ -11,6 +11,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using System.IO; +using CalamityMod.Items.Materials; namespace CalamityMod.NPCs.SunkenSea { @@ -31,7 +32,7 @@ namespace CalamityMod.NPCs.SunkenSea //Banner = NPC.type; //BannerItem = ModContent.ItemType(); NPC.chaseable = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -142,7 +143,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.6f; + return SpawnCondition.Cavern.Chance * 0.4f; } return 0f; } @@ -179,5 +180,9 @@ namespace CalamityMod.NPCs.SunkenSea } return true; } + public override void ModifyNPCLoot(NPCLoot npcLoot) + { + npcLoot.Add(ModContent.ItemType(), 1, 1, 2); + } } } diff --git a/NPCs/SunkenSea/GhostBell.cs b/NPCs/SunkenSea/GhostBell.cs index 640c48a995..fc7a89e6ff 100644 --- a/NPCs/SunkenSea/GhostBell.cs +++ b/NPCs/SunkenSea/GhostBell.cs @@ -1,12 +1,21 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.DataStructures; +using CalamityMod.Enums; using CalamityMod.Items.Accessories; using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.GameContent.ItemDropRules; @@ -16,34 +25,77 @@ using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { - public class GhostBell : ModNPC + public class GhostBell : SunkenSeaNPC { - public bool hasBeenHit = false; + public static Asset PinkTexture; + public static Asset GreenTexture; - public static Asset GlowTexture; + public static int ElectrifyingPhaseDuration => 180; + public static int ElectrifyingPhaseDischarge => 60; + public static int ElectrifyingPhaseCooldown => 120; + + public ref float Phase => ref NPC.ai[0]; + + public ref float Variant => ref NPC.ai[1]; + + public ref float Timer => ref NPC.ai[3]; + + public enum PhaseType + { + Idle = 0, + Angry = 1, + Electrifying = 2 + } + + public enum JellyColor + { + Blue = 0, + Green = 1, + Pink = 2 + } + + public List> tentacles = []; + + protected override List PreyIDs => + [ + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ]; + + protected override List PredatorIDs => []; + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.PolypForest; + + public override void Load() + { + GreenTexture = ModContent.Request(Texture + "Green"); + PinkTexture = ModContent.Request(Texture + "Pink"); + } public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 6; - if (!Main.dedServ) - { - GlowTexture = ModContent.Request(Texture + "Glow", AssetRequestMode.AsyncLoad); - } + base.SetStaticDefaults(); + Main.npcFrameCount[Type] = 1; } public override void SetDefaults() { + base.SetDefaults(); NPC.noGravity = true; NPC.aiStyle = -1; AIType = -1; - NPC.damage = Main.hardMode ? 75 : 25; - NPC.width = 54; - NPC.height = 76; - NPC.defense = Main.hardMode ? 10 : 0; - NPC.lifeMax = Main.hardMode ? 400 : 120; + NPC.damage = 25; + NPC.width = 74; + NPC.height = 58; + NPC.defense = 0; + NPC.lifeMax = 120; NPC.knockBackResist = 0f; NPC.alpha = 100; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 5, 0) : Item.buyPrice(0, 0, 1, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = SoundID.NPCHit25; NPC.DeathSound = SoundID.NPCDeath28; Banner = NPC.type; @@ -52,11 +104,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = false; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -70,106 +117,387 @@ namespace CalamityMod.NPCs.SunkenSea public override void SendExtraAI(BinaryWriter writer) { writer.Write(NPC.chaseable); - writer.Write(hasBeenHit); } public override void ReceiveExtraAI(BinaryReader reader) { NPC.chaseable = reader.ReadBoolean(); - hasBeenHit = reader.ReadBoolean(); + } + + public override void OnSpawn(IEntitySource source) + { + NPC.TargetClosest(); + Variant = Main.rand.Next(0, 3); + if (Phase == (int)PhaseType.Idle) + { + // 1-3 in the Polyp Forest, 3-4 in the burrows + int jellyAmt = Main.player[NPC.target].Calamity().ZonePolypForest ? Main.rand.Next(2, 4) : Main.rand.Next(3, 5); + // A swarm of babies spawns if the jelly is in the Polyp Forest + if (Main.player[NPC.target].Calamity().ZonePolypForest) + { + for (int i = 0; i < jellyAmt; i++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int bebe = NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), ModContent.NPCType(), ai0: -1); + Main.npc[bebe].rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); + } + } + } + // Spawn more adults + for (int i = 0; i < jellyAmt; i++) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.NewNPC(NPC.GetSource_FromThis(), (int)(NPC.Center.X + Main.rand.NextFloat(1f, 2f)), (int)(NPC.Center.Y + Main.rand.NextFloat(1f, 2f)), Type, ai0: -1, ai2: Main.rand.Next(0, 60)); + } + } + } } public override void AI() { - Lighting.AddLight(NPC.Center, 0f, (255 - NPC.alpha) * 1.5f / 255f, (255 - NPC.alpha) * 1.5f / 255f); - if (NPC.justHit) + if (pathfinding == null) { - hasBeenHit = true; - } - NPC.chaseable = hasBeenHit; - if (NPC.localAI[0] == 0f) - { - NPC.localAI[0] = 1f; - NPC.velocity.Y = -6f; - NPC.netUpdate = true; - } - if (NPC.wet) - { - NPC.noGravity = true; - if (NPC.localAI[2] > 0f) + pathfinding = new PathfindingManager(NPC) { - NPC.localAI[2] -= 1f; - } - if (NPC.localAI[2] <= 0f) + Acceleration = 0.1f, + MaxSpeed = 1f, + }; + } + + CreateTentacles(); + NPC.ai[2]++; + + // Lite + var lightColor = Variant switch + { + (int)JellyColor.Pink => Color.LightPink, + (int)JellyColor.Green => Color.MediumSpringGreen, + _ => Color.LightBlue, + }; + Lighting.AddLight(NPC.Center, (lightColor.R - NPC.alpha) * 1f / 255f, (lightColor.G - NPC.alpha) * 1f / 255f, (lightColor.B - NPC.alpha) * 1f / 255f); + + NPC.chaseable = Phase > 0; + NPC.noGravity = NPC.wet; + + NPC.netUpdate = true; + NPC.netSpam = 0; + + Entity target = CurrentPrey; + if (NPC.target > -1 && (int)Phase >= (int)PhaseType.Angry) + { + target = Main.player[NPC.target]; + } + + // Ghost Bells are usually in groups, so make them not overlap + float SAImovement = 0.05f; + for (int k = 0; k < Main.maxNPCs; k++) + { + NPC otherFish = Main.npc[k]; + // Short circuits to make the loop as fast as possible + if (!otherFish.active || k == NPC.whoAmI || otherFish.type != ModContent.NPCType()) + continue; + + float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); + if (taxicabDist < NPC.width * 2f) { - if (NPC.velocity.Y == 0f) - { - NPC.localAI[1] += 1f; - } + if (NPC.position.X < otherFish.position.X) + NPC.velocity.X -= SAImovement; else - { - NPC.localAI[1] = 0f; - } - NPC.velocity.Y += 0.1f; - if (NPC.velocity.Y > 3f || NPC.localAI[1] >= 6f) - { - NPC.velocity.Y = -3f; - } + NPC.velocity.X += SAImovement; + + if (NPC.position.Y < otherFish.position.Y) + NPC.velocity.Y -= SAImovement; + else + NPC.velocity.Y += SAImovement; } } - else + + if (Phase <= (int)PhaseType.Idle) { - NPC.noGravity = false; - NPC.velocity.Y = 2f; - NPC.localAI[2] = 75f; + NPC.velocity *= 0.8f; + } + + if (target == null || !target.active || target.Distance(NPC.Center) > 1000) + { + Timer = 0; + Phase = (int)PhaseType.Idle; NPC.netUpdate = true; + return; + } + + // Create an electrifying aura + if (Phase == (int)PhaseType.Electrifying) + { + // Slow down + NPC.velocity *= 0.9f; + pathfinding.ClearResults(); + Timer++; + // Create the aura + if (NPC.ai[3] == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center, Vector2.Zero, ModContent.ProjectileType(), 12, 0, ai1: NPC.whoAmI + 1); + } + } + // Reset + if (Timer >= ElectrifyingPhaseDuration) + { + Timer = -ElectrifyingPhaseCooldown; + Phase = (int)PhaseType.Angry; + NPC.netUpdate = true; + } + } + // Move towards target + else if (target != null) + { + pathfinding.DoPathfinding(new PathfindingParameters(NPC.Center, target.Center, SunkenSeaTileValiditySizeless)); + if (pathfinding.Path.Count > 0) + if (pathfinding.Path[^1].Distance(target.Center) > 300) + { + pathfinding.ClearResults(); + } + if (Phase == (int)PhaseType.Angry) + { + if (target is Player && NPC.Distance(target.Center) < 300) + { + Timer++; + } + if (Timer > 120) + { + Timer = 0; + Phase = (int)PhaseType.Electrifying; + NPC.netUpdate = true; + } + } } } - public override void FindFrame(int frameHeight) + public void CreateTentacles() { - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; + if (tentacles == null || tentacles.Count < 6) + { + // switches between tentacle indexes to determine how many segments should be on each + // aims for a more squid-like distribution, i dont know if it applies to jellyfish too + + // an embarrassing amount of time was spent figuring out these numbers + // i forgot they start at 0.. + int segmentCount = tentacles.Count switch + { + 0 or 5 => 9, + 1 or 4 => 12, + _ => 8 + }; + List segments = new List(segmentCount); + for (int i = 0; i < segmentCount; i++) + { + VerletSimulatedSegment segment = new VerletSimulatedSegment(NPC.Center - Vector2.UnitY * i * 5); + segments.Add(segment); + } + segments[0].locked = true; + tentacles.Add(segments); + } + } + + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + GetPissed(player.whoAmI); + } + + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + if (projectile.friendly && projectile.owner > -1) + { + GetPissed(projectile.owner); + } + } + + public void GetPissed(int player) + { + if (Phase <= (int)PhaseType.Idle) + { + Phase = (int)PhaseType.Angry; + NPC.netUpdate = true; + } + NPC.target = player; + + foreach (NPC n in Main.ActiveNPCs) + { + if (n.type != Type) + continue; + if (n.Distance(NPC.Center) > 400) + continue; + if (n.ModNPC().Phase <= (int)PhaseType.Idle) + n.ModNPC().GetPissed(player); + } } public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneSunkenSea && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + if (spawnInfo.Player.Calamity().ZonePolypForest) + return SpawnCondition.CaveJellyfish.Chance * 0.5f; + if (spawnInfo.Player.Calamity().ZoneGleamingBurrows) + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } return 0f; } - public override void PostDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + public override void FindFrame(int frameHeight) { - SpriteEffects spriteEffects = SpriteEffects.None; - if (NPC.spriteDirection == 1) + // For bestiary animation + if (NPC.IsABestiaryIconDummy) { - spriteEffects = SpriteEffects.FlipHorizontally; + NPC.ai[2]++; } - Vector2 center = new Vector2(NPC.Center.X, NPC.Center.Y); - Vector2 halfSizeTexture = new Vector2((float)(TextureAssets.Npc[Type].Value.Width / 2), (float)(TextureAssets.Npc[Type].Value.Height / Main.npcFrameCount[Type] / 2)); - Vector2 vector = center - screenPos; - vector -= new Vector2((float)GlowTexture.Value.Width, (float)(GlowTexture.Value.Height / Main.npcFrameCount[Type])) * 1f / 2f; - vector += halfSizeTexture * 1f + new Vector2(0f, 4f + NPC.gfxOffY); - Color color = new Color(127 - NPC.alpha, 127 - NPC.alpha, 127 - NPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.LightBlue); - Main.spriteBatch.Draw(GlowTexture.Value, vector, - new Microsoft.Xna.Framework.Rectangle?(NPC.frame), color, NPC.rotation, halfSizeTexture, 1f, spriteEffects, 0f); } - // Can only hit the target if they're touching the tentacles - public override bool CanHitPlayer(Player target, ref int cooldownSlot) + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) { - Vector2 npcCenter = NPC.Center; - Rectangle tentacleHitbox = new Rectangle((int)(npcCenter.X - (NPC.width / 4f)), (int)npcCenter.Y, NPC.width / 2, NPC.height / 2); + // Underlying tentacle colour based on parent colour + Color baseCol = Variant switch + { // all of these colours are from the sprites but slightly darkened and desaturated + (int)JellyColor.Green => new Color(29, 54, 39), // 27, 61, 40 + (int)JellyColor.Pink => new Color(79, 39, 53), // 97, 38, 60 + _ => new Color(34, 50, 89) // 36, 55, 114 + }; + // Accent color is also based on parent color + Color col = Variant switch + { // these are also directly from the sprites, with no modifications; similar in luminance for visual consistency + (int)JellyColor.Green => new Color(59, 215, 194), + (int)JellyColor.Pink => new Color(255, 145, 238), + _ => new Color(84, 215, 254) + }; - Rectangle targetHitbox = target.Hitbox; - bool insideTentacleHitbox = targetHitbox.Intersects(tentacleHitbox); + Vector2 drawOffset = Vector2.Zero; // An added offset that gives the jellyfish a visual bobbing movement - return insideTentacleHitbox; + int fullTime = 180; // How long the bob animation lasts + int localTimer = (int)(NPC.ai[2] % fullTime); + float goUp = (int)(fullTime * 0.4f); // When should the jellyfish jet upwards + int height = 30; // The vertical range the jellyfish moves + + int endElectricity = 60; + + Vector2 squash = new Vector2(1.1f, 0.9f); + Vector2 stretch = new Vector2(0.8f, 1.2f); + Vector2 finalScale; + + // Move up and down while squashing and stretching + if (localTimer < goUp) + { + drawOffset.Y += MathHelper.Lerp(height, 0, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); + finalScale = Vector2.Lerp(stretch, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, goUp - 1, localTimer, true), 1)); + } + else + { + drawOffset.Y += MathHelper.Lerp(0, height, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); + finalScale = Vector2.Lerp(squash, stretch, CalamityUtils.SineInEasing(Utils.GetLerpValue(goUp, fullTime - 1, localTimer, true), 1)); + } + // Use different squash n stretch when electrifying + if (Phase == (int)PhaseType.Electrifying) + { + squash = new Vector2(1.4f, 0.8f); + if (Timer < (ElectrifyingPhaseDuration - 80)) + finalScale = Vector2.Lerp(Vector2.One, squash, CalamityUtils.CircOutEasing(Utils.GetLerpValue(0, ElectrifyingPhaseDischarge, Timer, true), 1)); + else + finalScale = Vector2.Lerp(squash, Vector2.One, CalamityUtils.SineInEasing(Utils.GetLerpValue(endElectricity, ElectrifyingPhaseDuration, Timer, true), 1)); + } + // Keeps the hitbox centered + drawOffset.Y -= height / 2; + + if (NPC.IsABestiaryIconDummy) + { + drawOffset.Y -= 20; + } + + CreateTentacles(); + + // Update the chains + for (int i = 0; i < tentacles.Count; i++) + { + List segments = tentacles[i]; + + segments[0].oldPosition = segments[0].position; + segments[0].position = NPC.Center + new Vector2(MathHelper.Lerp(-20, 20, (i + 1) / (float)tentacles.Count), 10) + drawOffset; + + // While electrifying, flail tentacles around frantically + if (Phase == (int)PhaseType.Electrifying && Timer % 5 == 0 && Timer < endElectricity) + { + for (int j = 0; j < segments.Count; j++) + { + int randomness = (int)MathHelper.Lerp(6, 18, (1 + j) / segments.Count); + segments[j].oldPosition = segments[j].position; + segments[j].position += Main.rand.NextVector2Circular(randomness, randomness); + } + } + tentacles[i] = VerletSimulatedSegment.SimpleSimulation(segments, 5, loops: 1, gravity: 0.6f); + } + + // Draw tentacle chains + for (int t = 0; t < tentacles.Count; t++) + { + List segments = tentacles[t]; + for (int i = 0; i < segments.Count - 1; i++) + { + VerletSimulatedSegment seg = segments[i]; + float dist = i > 0 ? Vector2.Distance(seg.position, segments[i - 1].position) : 0; + if (dist <= 2) + dist = 2; + dist += 4; + if (i == segments.Count - 1) + { + dist = Vector2.Distance(seg.position, NPC.Center) + 2; + } + float rot = 0f; + if (i > 0) + rot = seg.position.DirectionTo(segments[i - 1].position).ToRotation(); + + // slight gradient to a lighter colour the higher the segment index + Color finalColor = baseCol; + finalColor *= 1 + (i * 0.15f); + + // Last few segments are way brighter + if (i > segments.Count - 3) + { + finalColor = col * (0.05f + segments.Count * 0.1f); + } + + // Color eases in and out while angry + if (Phase == (int)PhaseType.Angry || NPC.IsABestiaryIconDummy) + { + float mod = NPC.ai[2] % 30; + if (mod <= 10) + finalColor = Color.Lerp(finalColor, finalColor * 2, Utils.GetLerpValue(0, 10, mod, true)); + else if (mod >= 20) + finalColor = Color.Lerp(finalColor * 2, finalColor, Utils.GetLerpValue(20, 30, mod, true)); + else + finalColor *= 2; + } + // Color is at full brightness while electrifying + else if (Phase == (int)PhaseType.Electrifying) + finalColor *= 2; + // give the segments variable width (and an offset equal to half of the variance) to create more visual interest + // a side effect of this makes it look wiggly like some jellyfish tentacles are + SpriteEffects dir = NPC.Center.X > NPC.Center.X ? SpriteEffects.FlipVertically : SpriteEffects.None; + spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2(seg.position.X - i * 0.1f, seg.position.Y) - screenPos, new Rectangle(0, 0, (int)(3 + i * 0.2), 8), finalColor, rot + MathHelper.PiOver2, new Vector2(4, 4), new Vector2(1, dist / 8), dir, 0); + } + } + + Texture2D tex = Variant switch + { + (int)JellyColor.Pink => PinkTexture.Value, + (int)JellyColor.Green => GreenTexture.Value, + _ => TextureAssets.Npc[Type].Value + }; + + Main.EntitySpriteDraw(tex, NPC.Center - screenPos + drawOffset, null, Color.White, NPC.rotation, tex.Size() / 2, finalScale * NPC.scale, 0); + return false; } public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) diff --git a/NPCs/SunkenSea/GhostBell.png b/NPCs/SunkenSea/GhostBell.png index 0a9a975802..8af8c6e258 100644 Binary files a/NPCs/SunkenSea/GhostBell.png and b/NPCs/SunkenSea/GhostBell.png differ diff --git a/NPCs/SunkenSea/GhostBellGlow.png b/NPCs/SunkenSea/GhostBellGlow.png deleted file mode 100644 index 0a9a975802..0000000000 Binary files a/NPCs/SunkenSea/GhostBellGlow.png and /dev/null differ diff --git a/NPCs/SunkenSea/GhostBellGreen.png b/NPCs/SunkenSea/GhostBellGreen.png new file mode 100644 index 0000000000..025fed69f0 Binary files /dev/null and b/NPCs/SunkenSea/GhostBellGreen.png differ diff --git a/NPCs/SunkenSea/GhostBellPink.png b/NPCs/SunkenSea/GhostBellPink.png new file mode 100644 index 0000000000..063a71e0d1 Binary files /dev/null and b/NPCs/SunkenSea/GhostBellPink.png differ diff --git a/NPCs/SunkenSea/GiantClam.cs b/NPCs/SunkenSea/GiantClam.cs index 664d6123eb..366696548a 100644 --- a/NPCs/SunkenSea/GiantClam.cs +++ b/NPCs/SunkenSea/GiantClam.cs @@ -66,11 +66,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.width = 160; NPC.height = 120; NPC.defense = 9999; - NPC.DR_NERD(0.3f); NPC.lifeMax = Main.hardMode ? 7500 : 1250; NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 5, 0, 0) : Item.buyPrice(0, 1, 0, 0); + NPC.value = Main.hardMode ? Item.buyPrice(gold: 5) : Item.buyPrice(gold: 1); NPC.HitSound = SoundID.NPCHit4; NPC.knockBackResist = 0f; NPC.rarity = 2; @@ -78,11 +77,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -132,6 +127,12 @@ namespace CalamityMod.NPCs.SunkenSea hasBeenHit = true; } + if (!hasBeenHit) + { + // No contact damage while chillaxing + NPC.damage = 0; + } + NPC.chaseable = hasBeenHit; if (hitAmount == 5) diff --git a/NPCs/SunkenSea/HauntedChum.cs b/NPCs/SunkenSea/HauntedChum.cs index 0781e898b9..a0b1ebf8d9 100644 --- a/NPCs/SunkenSea/HauntedChum.cs +++ b/NPCs/SunkenSea/HauntedChum.cs @@ -43,10 +43,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.DD2_SkeletonDeath; NPC.noGravity = true; NPC.noTileCollide = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void AI() diff --git a/NPCs/SunkenSea/Jellyghoul.cs b/NPCs/SunkenSea/Jellyghoul.cs index 52a24f4be8..d9d6a532e0 100644 --- a/NPCs/SunkenSea/Jellyghoul.cs +++ b/NPCs/SunkenSea/Jellyghoul.cs @@ -1,14 +1,15 @@ -using CalamityMod.BiomeManagers; +using System; +using System.Collections.Generic; +using CalamityMod.BiomeManagers; using CalamityMod.DataStructures; using CalamityMod.Items.Placeables; using CalamityMod.Particles; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Systems; using CalamityMod.Walls; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using System; -using System.Collections.Generic; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -16,6 +17,7 @@ using Terraria.GameContent; using Terraria.GameContent.Bestiary; using Terraria.ID; using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; namespace CalamityMod.NPCs.SunkenSea { @@ -65,11 +67,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.noTileCollide = true; // Banner = NPC.type; //BannerItem = ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -82,7 +80,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - NPC.Center -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); + NPC.position -= new Vector2(Main.rand.NextFloat(-16 * 16, 16 * 16), Main.rand.NextFloat(4 * 16, 16 * 16)); } public override void AI() { @@ -131,6 +129,7 @@ namespace CalamityMod.NPCs.SunkenSea } if (NPC.ai[2] >= 1) { + NPC.chaseable = true; NPC.TargetClosest(false); NPC.ai[3]++; if (NPC.ai[3] >= 120 + (NPC.localAI[1] * 10)) @@ -146,8 +145,8 @@ namespace CalamityMod.NPCs.SunkenSea } if (Main.rand.NextBool(80)) { - Particle ash = new SquareAshParticle(Main.rand.NextVector2FromRectangle(NPC.getRect()), new Vector2(0, 2), Main.rand.Next(100, 200), Main.rand.NextFloat(0.8f, 1.2f), new Color(50, 50, 50)); - GeneralParticleHandler.SpawnParticle(ash); + Particle ash = new SquareAshParticle(Main.rand.NextVector2FromRectangle(NPC.getRect()), new Vector2(0, 2), Main.rand.Next(100, 200), Main.rand.NextFloat(0.8f, 1.2f), new Color(50, 50, 50)); + GeneralParticleHandler.SpawnParticle(ash); } } @@ -161,16 +160,11 @@ namespace CalamityMod.NPCs.SunkenSea public override float SpawnChance(NPCSpawnInfo spawnInfo) { - Tile tile = Framing.GetTileSafely(spawnInfo.SpawnTileX, spawnInfo.SpawnTileY); - - return !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType() ? 0.05f : 0f; - - //fuck this - //if (spawnInfo.Player.Calamity().ZoneSunkenSeaShores && !spawnInfo.Player.Calamity().clamity && tile.WallType == ModContent.WallType()) - //{ - // return 0.05f; - //} - //return 0f; + if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.9f; + } + return 0f; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SunkenSea/KelpieSeadragon.cs b/NPCs/SunkenSea/KelpieSeadragon.cs index 391eb4a8a1..e131646269 100644 --- a/NPCs/SunkenSea/KelpieSeadragon.cs +++ b/NPCs/SunkenSea/KelpieSeadragon.cs @@ -60,6 +60,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.noGravity = true; NPC.damage = 10; NPC.width = 20; @@ -68,7 +69,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = 150; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; @@ -79,10 +80,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -93,17 +90,16 @@ namespace CalamityMod.NPCs.SunkenSea }); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.3f, - MaxSpeed = 3f, - }; - } - public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.3f, + MaxSpeed = 3f, + }; + } if (NPC.direction == 0) { NPC.TargetClosest(); @@ -157,7 +153,8 @@ namespace CalamityMod.NPCs.SunkenSea SquishY = 0; break; } - NPC.chaseable = true; + if (currentTarget is Player) + NPC.chaseable = true; bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, target.Center, 1, 1); // If the target is too far from its shooting range or a tile is in the way, move closer if ((currentTarget.Distance(NPC.Center) > 300 || !hasSight) || currentTarget is NPC) @@ -202,7 +199,7 @@ namespace CalamityMod.NPCs.SunkenSea { Vector2 spawnPos = new Vector2(NPC.Center.X + NPC.direction * 18, NPC.position.Y + 22); Vector2 projSpeed = spawnPos.DirectionTo(currentTarget.Center).SafeNormalize(Vector2.Zero) * 6; - Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), NPC.damage, 0f); + Projectile.NewProjectile(NPC.GetSource_FromThis(), spawnPos, projSpeed, ModContent.ProjectileType(), 10, 0f); } } // Squash and stretch @@ -358,7 +355,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZonePolypForest && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + return SpawnCondition.CaveJellyfish.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SunkenSea/LazarusLampfish.cs b/NPCs/SunkenSea/LazarusLampfish.cs new file mode 100644 index 0000000000..0ea2671558 --- /dev/null +++ b/NPCs/SunkenSea/LazarusLampfish.cs @@ -0,0 +1,406 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Enums; +using CalamityMod.Items.Placeables; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Enemy; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.World; +using Microsoft.CodeAnalysis; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using System.IO; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.Bestiary; +using Terraria.GameContent.ItemDropRules; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +namespace CalamityMod.NPCs.SunkenSea +{ + public class LazarusLampfish : SunkenSeaNPC + { + public enum PhaseType + { + Idle = 0, + Attacking = 1, + Fleeing = 2 + } + + public static Asset cooldownTexture; + public static Asset attackTexture; + + public Vector2 randomPathPoint; + + public Entity currentTarget; + + public static int IdleRandomMovementUnlikeliness = 250; + public static int IdleMinPathDistance = 100; + public static int IdleMaxPathDistance = 800; + + public static int FleeTileAnticipationDistance = 64; + + public ref float CurrentPhase => ref NPC.ai[0]; + public ref float Timer => ref NPC.ai[1]; + + protected override List PreyIDs => new List() + { + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType(), + }; + + public static List PredatorList => new List() + { + ModContent.NPCType(), + }; + + protected override List PredatorIDs => PredatorList; + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; + + public override void Load() + { + cooldownTexture = ModContent.Request(Texture + "Cooldown"); + attackTexture = ModContent.Request(Texture + "Attack"); + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 6; + base.SetStaticDefaults(); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.noGravity = true; + NPC.damage = 40; + NPC.width = 50; + NPC.height = 30; + NPC.defense = 12; + NPC.lifeMax = 400; + NPC.aiStyle = -1; + AIType = -1; + NPC.value = Item.buyPrice(silver: 10); + NPC.HitSound = SoundID.NPCHit1; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.knockBackResist = 0.1f; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); LegacyName this to the BlindedAngler banner when it exists + NPC.chaseable = false; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToWater = false; + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.LazarusLampfish") + }); + } + + public override void AI() + { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.2f, + MaxSpeed = 3f, + }; + } + if (NPC.direction == 0) + { + NPC.TargetClosest(); + } + Player target = Main.player[NPC.target]; + // Fall and be useless if out of water + if (!NPC.wet) + { + CurrentPhase = (int)PhaseType.Idle; + Timer = 0; + NPC.velocity.X *= 0.98f; + NPC.noGravity = false; + return; + } + NPC.noGravity = true; + switch (CurrentPhase) + { + // Idle AI. Mostly sits still but occasionally moves in a random direction for a bit. + case (int)PhaseType.Idle: + NPC.chaseable = false; + NPC.ai[2]--; + if (CurrentPredator != null || CurrentPlayer != null) + { + EnterAttackMode(); + } + if (CurrentPrey != null) + { + bool huntReady = NPC.ai[2] == 0; + if (huntReady) + NPC.ai[2] = Main.rand.Next(13, 30); + + // With sight, just go straight at him. Without it, try to pathfind over them. + pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, SunkenSeaTileValidity), forceNewTask: huntReady); + pathfinding.CustomIdleBehavior = () => + { + if (CurrentPrey != null) + { + NPC.velocity += NPC.DirectionTo(CurrentPrey.Center) * pathfinding.Acceleration; + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + NPC.velocity *= 0.95f; + }; + } + else + { + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), SunkenSeaTileValidity)); + } + break; + case (int)PhaseType.Attacking: + currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; + if (currentTarget == null) + { + CurrentPhase = (int)PhaseType.Idle; + Timer = 0; + NPC.ai[2] = 0; + pathfinding.MaxSpeed = 3; + pathfinding.Acceleration = 0.2f; + break; + } + pathfinding.MaxSpeed = 8; + pathfinding.Acceleration = 0.3f; + NPC.chaseable = true; + bool hasSight = Collision.CanHitLine(NPC.Center, 1, 1, currentTarget.Center, 1, 1); + // If the target is too far from its shooting range or a tile is in the way, move closer + if (currentTarget.Distance(NPC.Center) > 200 || !hasSight) + { + bool restart = NPC.ai[2] == 0; + if (restart) + NPC.ai[2] = Main.rand.Next(13, 30); + + // With sight, just go straight at him. Without it, try to pathfind over them. + pathfinding.DoPathfinding(new(NPC.Center, currentTarget.Center, SunkenSeaTileValidity), forceNewTask: restart); + pathfinding.CustomIdleBehavior = () => + { + if (currentTarget != null) + { + NPC.velocity += NPC.DirectionTo(currentTarget.Center) * pathfinding.Acceleration; + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + NPC.velocity *= 0.95f; + }; + + NPC.ai[2]--; + } + // If close enough, start the timer for the flash + else if (Timer == 0) + { + Timer = 1; + } + // Flash! + if (Timer >= 1) + { + NPC.velocity *= 0.92f; + Timer++; + if (Timer == 60) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + Projectile.NewProjectile(NPC.GetSource_FromThis(), NPC.Center + (NPC.rotation - (NPC.spriteDirection == 1 ? 0 : MathHelper.Pi)).ToRotationVector2() * 40, Vector2.Zero, ModContent.ProjectileType(), 20, 1); + } + SoundEngine.PlaySound(SoundID.NPCDeath7 with { Pitch = 0.4f }, NPC.Center); + } + if (Timer >= 120) + { + Timer = 0; + NPC.ai[2] = 0; + CurrentPhase = (int)PhaseType.Fleeing; + } + } + break; + case (int)PhaseType.Fleeing: + { + // If the avoided entity is gone, go back to idling. + currentTarget = CurrentPredator != null ? CurrentPredator : CurrentPlayer; + if (currentTarget == null || Timer > 300) + { + CurrentPhase = currentTarget != null ? (int)PhaseType.Attacking : (int)PhaseType.Idle; + Timer = 0; + pathfinding.MaxSpeed = 3; + pathfinding.Acceleration = 0.2f; + NPC.ai[2] = currentTarget != null ? 0 : 120; + break; + } + if (Timer == 0) + { + NPC.spriteDirection = NPC.direction *= -1; + } + Timer++; + pathfinding.MaxSpeed = 8; + pathfinding.Acceleration = 0.4f; + + if (Math.Abs(NPC.velocity.X) > 0) + { + NPC.direction = NPC.velocity.X > 0 ? 1 : -1; + } + else + { + NPC.direction = NPC.Center.X > currentTarget.Center.X ? -1 : 1; + } + + // While it doesn't have any obstacles in front of it, run away in a straight line. + // Try to manuever if there are any obstacles. + if (!Main.tile[(NPC.Center + NPC.DirectionFrom(currentTarget.Center) * FleeTileAnticipationDistance).ToTileCoordinates()].IsTileSolid()) + { + NPC.velocity += NPC.DirectionFrom(currentTarget.Center) * pathfinding.Acceleration; + pathfinding.ClearResults(); + + // Cap the speed if MaxSpeed has been surpassed. + if (NPC.velocity.LengthSquared() > pathfinding.MaxSpeed * pathfinding.MaxSpeed) + NPC.velocity = Vector2.Normalize(NPC.velocity) * pathfinding.MaxSpeed; + } + else + { + float distanceFromAvoided = Vector2.Distance(NPC.Center, currentTarget.Center); + randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); + NPC.netUpdate = true; + pathfinding.DoPathfinding(new(NPC.Center, randomPathPoint, SunkenSeaTileValidity)); + } + break; + } + } + if (!(Timer >= 1 && CurrentPhase == (int)PhaseType.Attacking) && !(Timer < 3 && CurrentPhase == (int)PhaseType.Fleeing)) + { + int dir = NPC.velocity.X.DirectionalSign(); + NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); + NPC.spriteDirection = NPC.direction = dir; + } + } + + public override void FindFrame(int frameHeight) + { + if (!NPC.wet && !NPC.IsABestiaryIconDummy) + return; + NPC.frameCounter++; + if (NPC.frameCounter > 5) + { + NPC.frame.Y += frameHeight; + NPC.frameCounter = 0; + } + if (NPC.frame.Y >= Main.npcFrameCount[Type] * frameHeight) + { + NPC.frame.Y = 0; + } + } + + protected override void OnPlayerDetection(Player player) + { + EnterAttackMode(); + } + + protected override void OnPredatorDetection(NPC predator) + { + EnterAttackMode(); + } + + public void EnterAttackMode() + { + CurrentPhase = (int)PhaseType.Attacking; + Timer = 0; + NPC.ai[2] = 0; + } + + protected override bool NPCSearchFilter(NPC n) + { + return base.NPCSearchFilter(n) || (n == CurrentPredator || n == CurrentPrey) && Vector2.DistanceSquared(NPC.Center, n.Center) < 700f * 700f; + } + + protected override bool PlayerSearchFilter(Player p) + { + return base.PlayerSearchFilter(p) || (p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); + } + + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(randomPathPoint); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + randomPathPoint = reader.ReadVector2(); + } + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if ((spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.CaveJellyfish.Chance * 0.3f; + } + return 0f; + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + if (NPC.life <= 0) + { + for (int k = 0; k < 25; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.BlueCrystalShard, hit.HitDirection, -1f, 0, default, 1f); + } + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + if (NPC.IsABestiaryIconDummy) + return true; + Asset tex = TextureAssets.Npc[Type]; + Rectangle frame = NPC.frame; + Vector2 origin = new Vector2(tex.Width() / 2, tex.Height() / 2 / Main.npcFrameCount[Type]); + + if (CurrentPhase == (int)PhaseType.Attacking && Timer > 0) + { + tex = attackTexture; + frame = tex.Frame(1, 11, 0, (int)MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, 120, Timer, true))); + origin = new Vector2(tex.Width() / 2, tex.Height() / 22); + } + if (CurrentPhase == (int)PhaseType.Fleeing) + { + tex = cooldownTexture; + frame = tex.Frame(1, 4, 0, (int)MathHelper.Lerp(0, 3, Utils.GetLerpValue(0, 24, Timer % 24, true))); + origin = new Vector2(tex.Width() / 2, tex.Height() / 8); + } + SpriteEffects fx = NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + spriteBatch.Draw(tex.Value, NPC.Center - Main.screenPosition + new Vector2(0, NPC.gfxOffY), frame, drawColor, NPC.rotation, origin, NPC.scale, fx, 0); + return false; + } + } +} diff --git a/NPCs/SunkenSea/LazarusLampfish.png b/NPCs/SunkenSea/LazarusLampfish.png new file mode 100644 index 0000000000..8d06df2008 Binary files /dev/null and b/NPCs/SunkenSea/LazarusLampfish.png differ diff --git a/NPCs/SunkenSea/LazarusLampfishAttack.png b/NPCs/SunkenSea/LazarusLampfishAttack.png new file mode 100644 index 0000000000..d143d51cbb Binary files /dev/null and b/NPCs/SunkenSea/LazarusLampfishAttack.png differ diff --git a/NPCs/SunkenSea/LazarusLampfishCooldown.png b/NPCs/SunkenSea/LazarusLampfishCooldown.png new file mode 100644 index 0000000000..48eba44b4d Binary files /dev/null and b/NPCs/SunkenSea/LazarusLampfishCooldown.png differ diff --git a/NPCs/SunkenSea/Leerslug.cs b/NPCs/SunkenSea/Leerslug.cs index 839a595799..9e0692ce65 100644 --- a/NPCs/SunkenSea/Leerslug.cs +++ b/NPCs/SunkenSea/Leerslug.cs @@ -54,7 +54,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 3; NPC.lifeMax = 200; NPC.knockBackResist = 0.2f; - NPC.value = Item.buyPrice(0, 0, 0, 0); + NPC.value = Item.buyPrice(silver: 1); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; @@ -66,11 +66,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void ReceiveExtraAI(BinaryReader reader) diff --git a/NPCs/SunkenSea/LostShoal.cs b/NPCs/SunkenSea/LostShoal.cs index a4c93e02ad..19d401715f 100644 --- a/NPCs/SunkenSea/LostShoal.cs +++ b/NPCs/SunkenSea/LostShoal.cs @@ -68,7 +68,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -87,7 +87,6 @@ namespace CalamityMod.NPCs.SunkenSea { Variant = (int)ShoalColor.Gold; NPC.catchItem = ItemID.GoldCoin; - NPC.value = 10000; } RandomOpacityOffset = Main.rand.NextFloat(MathHelper.TwoPi); @@ -188,7 +187,7 @@ namespace CalamityMod.NPCs.SunkenSea if (Role == 0) { // the amount of fish to spawn - int fishCount = 5; + int fishCount = Main.rand.Next(3, 6); for (int i = 0; i < fishCount; i++) { int n = NPC.NewNPC(NPC.GetSource_FromThis(), (int)NPC.Center.X, (int)NPC.Center.Y, ModContent.NPCType()); diff --git a/NPCs/SunkenSea/Pearlpod.cs b/NPCs/SunkenSea/Pearlpod.cs index 21457f00b0..85d2f0e357 100644 --- a/NPCs/SunkenSea/Pearlpod.cs +++ b/NPCs/SunkenSea/Pearlpod.cs @@ -33,7 +33,6 @@ namespace CalamityMod.NPCs.SunkenSea protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; - public abstract int PearlType { get; } public abstract float SpawnRate { get; } public abstract int ItemType { get; } @@ -53,12 +52,11 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.aiStyle = NPCAIStyleID.Snail; NPC.damage = 0; - NPC.width = 24; - NPC.height = 24; + NPC.width = 30; + NPC.height = 30; NPC.defense = 0; NPC.lifeMax = 20; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -73,7 +71,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void ReceiveExtraAI(BinaryReader reader) @@ -244,10 +241,6 @@ namespace CalamityMod.NPCs.SunkenSea } NPC.dontTakeDamage = false; } - if (NPC.type == ModContent.NPCType()) - { - NPC.ProduceGoldCritterDust(); - } } /// @@ -338,15 +331,16 @@ namespace CalamityMod.NPCs.SunkenSea { return !(CurrentPhase == (int)PhaseType.Hiding && !IsClamValid()) && (base.PlayerSearchFilter(p) || p == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, p.Center) < 600f * 600f); } + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); public override void FindFrame(int frameHeight) { NPC.frameCounter++; - if (NPC.frameCounter > 8) + if (NPC.frameCounter > 6) { NPC.frameCounter = 0; NPC.frame.Y += frameHeight; - if (NPC.frame.Y > frameHeight * 5) + if (NPC.frame.Y > frameHeight * 3) { NPC.frame.Y = 0; } @@ -369,11 +363,6 @@ namespace CalamityMod.NPCs.SunkenSea Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Coralstone, hit.HitDirection, -1f, 0, default, 1f); } } - - public override void ModifyNPCLoot(NPCLoot npcLoot) - { - npcLoot.Add(PearlType); - } } public class PearlpodWhite : Pearlpod @@ -381,9 +370,8 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { base.SetStaticDefaults(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.WhitePearl; public override float SpawnRate => 0.6f; public override int ItemType => ModContent.ItemType(); } @@ -393,11 +381,10 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetStaticDefaults(); this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.PinkPearl; - public override float SpawnRate => 0.2f; + public override float SpawnRate => 0.05f; public override int ItemType => ModContent.ItemType(); } public class PearlpodBlack : Pearlpod @@ -406,37 +393,9 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetStaticDefaults(); this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; + Main.npcFrameCount[Type] = 4; } - public override int PearlType => ItemID.BlackPearl; - public override float SpawnRate => 0.05f; + public override float SpawnRate => 0.2f; public override int ItemType => ModContent.ItemType(); } - public class PearlpodGold : Pearlpod - { - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - this.HideFromBestiary(); - Main.npcFrameCount[Type] = 6; - } - public override void SetDefaults() - { - base.SetDefaults(); - NPC.value = 120000; - NPC.catchItem = ItemType; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - NPC.rarity = 3; - } - public override int PearlType => ItemID.GoldCoin; - public override float SpawnRate => 0.0005f; - public override int ItemType => ModContent.ItemType(); - public override void HitEffect(NPC.HitInfo hit) - { - for (int k = 0; k < 5; k++) - { - Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.GoldCritter, hit.HitDirection, -1f, 0, default, 1f); - } - } - } } diff --git a/NPCs/SunkenSea/PearlpodBlack.png b/NPCs/SunkenSea/PearlpodBlack.png index d5712b33f6..405f8278dd 100644 Binary files a/NPCs/SunkenSea/PearlpodBlack.png and b/NPCs/SunkenSea/PearlpodBlack.png differ diff --git a/NPCs/SunkenSea/PearlpodGold.png b/NPCs/SunkenSea/PearlpodGold.png deleted file mode 100644 index e6e92061d2..0000000000 Binary files a/NPCs/SunkenSea/PearlpodGold.png and /dev/null differ diff --git a/NPCs/SunkenSea/PearlpodPink.png b/NPCs/SunkenSea/PearlpodPink.png index 3c54290643..65ffef0598 100644 Binary files a/NPCs/SunkenSea/PearlpodPink.png and b/NPCs/SunkenSea/PearlpodPink.png differ diff --git a/NPCs/SunkenSea/PearlpodWhite.png b/NPCs/SunkenSea/PearlpodWhite.png index 97ccc73385..b23e06f817 100644 Binary files a/NPCs/SunkenSea/PearlpodWhite.png and b/NPCs/SunkenSea/PearlpodWhite.png differ diff --git a/NPCs/SunkenSea/PodobooKoi.cs b/NPCs/SunkenSea/PodobooKoi.cs index 90a4a13136..22b3f9f7c3 100644 --- a/NPCs/SunkenSea/PodobooKoi.cs +++ b/NPCs/SunkenSea/PodobooKoi.cs @@ -8,7 +8,6 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ModLoader.Utilities; using Terraria.DataStructures; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; using CalamityMod.Enums; using System.Collections.Generic; using Steamworks; @@ -62,7 +61,7 @@ namespace CalamityMod.NPCs.SunkenSea protected override List PreyIDs => new List() { - + ModContent.NPCType() }; protected override List PredatorIDs => new List() { @@ -79,15 +78,16 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetStaticDefaults() { - Main.npcFrameCount[Type] = 1; + Main.npcFrameCount[Type] = 15; base.SetStaticDefaults(); } public override void SetDefaults() { + base.SetDefaults(); NPC.noGravity = true; NPC.damage = 30; - NPC.width = 40; + NPC.width = 32; NPC.height = 32; NPC.defense = 10; NPC.lifeMax = 1000; @@ -102,7 +102,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToWater = true; //Banner = NPC.type; //BannerItem = ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -120,21 +119,25 @@ namespace CalamityMod.NPCs.SunkenSea { CurrentVariant = Main.rand.Next(1, 4); } - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } if (NPC.ai[3] <= 0) { lavaLine = FindLavaLine(); NPC.ai[3] = 180; } NPC.ai[3]--; + NPC.chaseable = false; if (NPC.lavaWet) { switch (CurrentBehavior) @@ -168,12 +171,21 @@ namespace CalamityMod.NPCs.SunkenSea public void IdleBehavior() { // At random, the mob will choose a random nearby point and pathfind there. - pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValiditySizeless)); + pathfinding.DoPathfinding(new(NPC.Center, NPC.Center + Main.rand.NextVector2Unit() * Main.rand.Next(IdleMinPathDistance, IdleMaxPathDistance), LavaTileValidityLenient)); } - public bool LavaTileValiditySizeless(Point point) + /// + /// Same as LavaTileValidity but without the requirement for a full tile of lava + /// + /// + /// + public bool LavaTileValidityLenient(Point point) { - return !(Main.tile[point].IsTileSolidGround() || Main.tile[point].LiquidAmount < 255 || Main.tile[point].LiquidType != LiquidID.Lava); + Point actualFuckingPoint = new Point(point.X * 16, point.Y * 16); + + return NPC.Hitbox.Contains(actualFuckingPoint) + || !NPC.GetIntersectingHitboxPoints( + actualFuckingPoint, 10, 10).Any(a => Main.tile[a].IsTileSolidGround() || Main.tile[a].LiquidAmount < 25 || Main.tile[a].LiquidType != LiquidID.Lava); } public void FleeBehavior() @@ -204,7 +216,7 @@ namespace CalamityMod.NPCs.SunkenSea float distanceFromAvoided = Vector2.Distance(NPC.Center, CurrentPredator.Center); randomPathPoint = NPC.Center + Main.rand.NextVector2Unit() * Utils.Remap(distanceFromAvoided, 0f, 960f, 80f, 3200f); NPC.netUpdate = true; - pathfinding.DoPathfinding(new(NPC.Center, randomPathPoint, LavaTileValidity)); + pathfinding.DoPathfinding(new(NPC.Center, randomPathPoint, LavaTileValidityLenient)); } } @@ -218,7 +230,7 @@ namespace CalamityMod.NPCs.SunkenSea return; } pathfinding.MaxSpeed = 8; - pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, LavaTileValidity)); + pathfinding.DoPathfinding(new(NPC.Center, CurrentPrey.Center, LavaTileValidityLenient)); } public void HostileBehavior() @@ -235,6 +247,7 @@ namespace CalamityMod.NPCs.SunkenSea return; } + NPC.chaseable = true; bool noLava = lavaLine == Vector2.Zero; // If this is true, use its lava behavior bool useLavaAI = CurrentPlayer.lavaWet && NPC.Distance(CurrentPlayer.Center) < 500; @@ -280,7 +293,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.velocity.Y = 4; } pathfinding.MaxSpeed = 6; - pathfinding.DoPathfinding(new(NPC.Center, CurrentPlayer.Center, LavaTileValiditySizeless)); + pathfinding.DoPathfinding(new(NPC.Center, CurrentPlayer.Center, LavaTileValidityLenient)); // Mark the fish as currently trying to chase the player NPC.Calamity().newAI[0] = 1; } @@ -355,7 +368,7 @@ namespace CalamityMod.NPCs.SunkenSea pathfinding.MaxSpeed = 4; ShootTimer--; - if (ShootTimer <= -30) + if (ShootTimer <= -40) { ShootTimer = fireRate; @@ -463,12 +476,35 @@ namespace CalamityMod.NPCs.SunkenSea if (!NPC.wet && !NPC.IsABestiaryIconDummy) { NPC.frameCounter = 0.0; + NPC.frame.Y = 0; return; } - NPC.frameCounter += 0.1f; - NPC.frameCounter %= Main.npcFrameCount[Type]; - int frame = (int)NPC.frameCounter; - NPC.frame.Y = frame * frameHeight; + bool shooting = ShootTimer <= -1; + int interval = shooting ? 12 : 6; + NPC.frameCounter++; + if (NPC.frameCounter > interval) + { + NPC.frame.Y++; + NPC.frameCounter = 0; + } + if (shooting) + { + if (NPC.frame.Y < 9) + { + NPC.frame.Y = 9; + } + if (NPC.frame.Y > 14) + { + NPC.frame.Y = 14; + } + } + else + { + if (NPC.frame.Y >= 9) + { + NPC.frame.Y = 0; + } + } } public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) @@ -486,9 +522,9 @@ namespace CalamityMod.NPCs.SunkenSea tex = bubbleEyedTex.Value; break; } - float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -30, ShootTimer, true)); + float animSped = MathHelper.Lerp(0, 10, Utils.GetLerpValue(0, -40, ShootTimer, true)); Vector2 scale = Vector2.One + new Vector2(MathF.Cos(Main.GlobalTimeWrappedHourly * animSped), MathF.Sin(Main.GlobalTimeWrappedHourly * animSped)) * 0.05f; - spriteBatch.Draw(tex, NPC.Center - screenPos, null, NPC.GetAlpha(drawColor), NPC.rotation, tex.Size() / 2, scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + spriteBatch.Draw(tex, NPC.Center - screenPos, tex.Frame(1, 15, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 30), scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } @@ -506,6 +542,7 @@ namespace CalamityMod.NPCs.SunkenSea writer.WriteVector2(randomPathPoint); writer.WriteVector2(lavaLine); writer.Write(NPC.Calamity().newAI[0]); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) @@ -513,6 +550,7 @@ namespace CalamityMod.NPCs.SunkenSea randomPathPoint = reader.ReadVector2(); lavaLine = reader.ReadVector2(); NPC.Calamity().newAI[0] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); } } } diff --git a/NPCs/SunkenSea/PodobooKoi.png b/NPCs/SunkenSea/PodobooKoi.png index e8b7fcedc2..a917e63dc3 100644 Binary files a/NPCs/SunkenSea/PodobooKoi.png and b/NPCs/SunkenSea/PodobooKoi.png differ diff --git a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png index 10c5578fee..ca341e7ea7 100644 Binary files a/NPCs/SunkenSea/PodobooKoiBubbleEyed.png and b/NPCs/SunkenSea/PodobooKoiBubbleEyed.png differ diff --git a/NPCs/SunkenSea/PodobooKoiComet.png b/NPCs/SunkenSea/PodobooKoiComet.png index cb0a01e071..85350e418e 100644 Binary files a/NPCs/SunkenSea/PodobooKoiComet.png and b/NPCs/SunkenSea/PodobooKoiComet.png differ diff --git a/NPCs/SunkenSea/PodobooKoiOranda.png b/NPCs/SunkenSea/PodobooKoiOranda.png index 0fc87f9ec2..1f11720fca 100644 Binary files a/NPCs/SunkenSea/PodobooKoiOranda.png and b/NPCs/SunkenSea/PodobooKoiOranda.png differ diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs index f35b008550..f172a5c609 100644 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -70,7 +70,8 @@ namespace CalamityMod.NPCs.SunkenSea protected override List PredatorIDs => new List() { ModContent.NPCType(), - ModContent.NPCType() + ModContent.NPCType(), + ModContent.NPCType() }; protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.PolypForest; @@ -101,6 +102,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.npcSlots = 0.1f; NPC.noGravity = true; NPC.damage = 0; @@ -120,16 +122,10 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void OnSpawn(IEntitySource source) { - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; // Panaseas released by the player do not randomize when spawned if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) { @@ -181,6 +177,14 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } // Reset polyp index in case the polyp dies if (PolypIndex > -1) { @@ -228,11 +232,6 @@ namespace CalamityMod.NPCs.SunkenSea { NPC.ProduceGoldCritterDust(); } - if (Variant == (int)FishColor.Gold || Variant == (int)FishColor.Radiant) - { - NPC.rarity = 3; - NPC.value = 100000; - } } public void IdleBehavior() @@ -335,7 +334,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (CurrentBehavior == (int)PhaseType.Idle) { - pathfinding.ClearResults(); + pathfinding?.ClearResults(); CurrentBehavior = (int)PhaseType.Flee; AlertPolyp(); } diff --git a/NPCs/SunkenSea/Polyperil.cs b/NPCs/SunkenSea/Polyperil.cs index b493e79370..b2019f9781 100644 --- a/NPCs/SunkenSea/Polyperil.cs +++ b/NPCs/SunkenSea/Polyperil.cs @@ -3,6 +3,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; using System.Collections.Generic; +using System.IO; using Terraria; using Terraria.DataStructures; using Terraria.GameContent; @@ -24,7 +25,7 @@ namespace CalamityMod.NPCs.SunkenSea public static Asset pinkTexture = null; - public static Asset radiantTexture = null; + public static Asset voltaicTexture = null; // The tentacles do all the work protected override List PreyIDs => new List(); @@ -41,7 +42,7 @@ namespace CalamityMod.NPCs.SunkenSea pinkTexture = ModContent.Request(Texture + "Pink"); blueTexture = ModContent.Request(Texture + "Blue"); greenTexture = ModContent.Request(Texture + "Green"); - radiantTexture = ModContent.Request(Texture + "Radiant"); + voltaicTexture = ModContent.Request(Texture + "Voltaic"); } public override void SetStaticDefaults() @@ -66,7 +67,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); // Banner = NPC.type; // BannerItem = ModContent.ItemType(); @@ -74,22 +75,25 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = false; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(NPC.chaseable); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + NPC.chaseable = reader.ReadBoolean(); } public override void OnSpawn(IEntitySource source) { // Pick a random color Color = Main.rand.Next(0, 3); - // 1 in 30 chance to be Radiant - if (Main.rand.NextBool(30)) - { + // 1 in 15 chance to be Voltaic + if (Main.rand.NextBool(15)) Color = 3; - NPC.rarity = 3; - NPC.value = 100000; - } // Spawn tentacles int dist = 80; @@ -99,7 +103,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (Main.netMode != NetmodeID.MultiplayerClient) { - Vector2 pos = NPC.Center + new Vector2(Main.rand.Next(-dist, dist), Main.rand.Next(-dist, dist)); + Vector2 pos = NPC.Center + new Vector2(Main.rand.Next(-dist, dist), 20); NPC tent = NPC.NewNPCDirect(NPC.GetSource_FromThis(), NPC.Center, ModContent.NPCType(), ai0: NPC.whoAmI); tent.ModNPC().anchor = pos; } @@ -139,19 +143,26 @@ namespace CalamityMod.NPCs.SunkenSea } } - public override void ModifyTypeName(ref string typeName) - { - if (Color == 3) - { - typeName = CalamityUtils.GetTextValue("NPCs.RadiantPolyperil"); - } - } - public override bool CanBeHitByNPC(NPC attacker) { return PredatorIDs.Contains(attacker.type); } + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public void PlayerHurt() + { + NPC.chaseable = true; + } + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) @@ -171,7 +182,7 @@ namespace CalamityMod.NPCs.SunkenSea { 1 => blueTexture.Value, 2 => greenTexture.Value, - 3 => radiantTexture.Value, + 3 => voltaicTexture.Value, _ => pinkTexture.Value }; diff --git a/NPCs/SunkenSea/Polyperil.png b/NPCs/SunkenSea/Polyperil.png index 5bbca02b46..5cec975ef0 100644 Binary files a/NPCs/SunkenSea/Polyperil.png and b/NPCs/SunkenSea/Polyperil.png differ diff --git a/NPCs/SunkenSea/PolyperilBlue.png b/NPCs/SunkenSea/PolyperilBlue.png index c460ca13bd..4f91afe357 100644 Binary files a/NPCs/SunkenSea/PolyperilBlue.png and b/NPCs/SunkenSea/PolyperilBlue.png differ diff --git a/NPCs/SunkenSea/PolyperilGreen.png b/NPCs/SunkenSea/PolyperilGreen.png index dc55d8f6e0..74a51dcf1c 100644 Binary files a/NPCs/SunkenSea/PolyperilGreen.png and b/NPCs/SunkenSea/PolyperilGreen.png differ diff --git a/NPCs/SunkenSea/PolyperilPink.png b/NPCs/SunkenSea/PolyperilPink.png index 3acc1dfb6c..9c9747e5dd 100644 Binary files a/NPCs/SunkenSea/PolyperilPink.png and b/NPCs/SunkenSea/PolyperilPink.png differ diff --git a/NPCs/SunkenSea/PolyperilRadiant.png b/NPCs/SunkenSea/PolyperilRadiant.png deleted file mode 100644 index a34a37db0a..0000000000 Binary files a/NPCs/SunkenSea/PolyperilRadiant.png and /dev/null differ diff --git a/NPCs/SunkenSea/PolyperilTentacle.cs b/NPCs/SunkenSea/PolyperilTentacle.cs index 8266a01601..f7bd01e49f 100644 --- a/NPCs/SunkenSea/PolyperilTentacle.cs +++ b/NPCs/SunkenSea/PolyperilTentacle.cs @@ -62,12 +62,8 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = 0; // Banner = NPC.type; // BannerItem = ModContent.ItemType(); - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SendExtraAI(BinaryWriter writer) @@ -240,10 +236,10 @@ namespace CalamityMod.NPCs.SunkenSea // Color is based on parent color Color col = parent.ai[1] switch { - 1 => new Color(27, 233, 255), - 2 => new Color(7, 255, 204), - 3 => Color.Cyan, - _ => new Color(255, 220, 248) + 1 => new Color(27, 190, 255), + 2 => new Color(7, 255, 180), + 3 => new Color(122, 255, 240), + _ => new Color(255, 140, 248) }; // Desaturate as parent's health lowers diff --git a/NPCs/SunkenSea/PolyperilVoltaic.png b/NPCs/SunkenSea/PolyperilVoltaic.png new file mode 100644 index 0000000000..184d259a00 Binary files /dev/null and b/NPCs/SunkenSea/PolyperilVoltaic.png differ diff --git a/NPCs/SunkenSea/PrismBack.cs b/NPCs/SunkenSea/PrismBack.cs index becd1e9af5..7dde9bb49e 100644 --- a/NPCs/SunkenSea/PrismBack.cs +++ b/NPCs/SunkenSea/PrismBack.cs @@ -3,6 +3,7 @@ using CalamityMod.Enums; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Projectiles.Enemy; +using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -59,16 +60,16 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.noGravity = true; NPC.damage = 20; NPC.width = 88; NPC.height = 66; NPC.defense = 15; - NPC.DR_NERD(0.25f); NPC.lifeMax = 500; NPC.aiStyle = -1; AIType = -1; - NPC.value = Main.hardMode ? Item.buyPrice(0, 0, 8, 0) : Item.buyPrice(0, 0, 2, 0); + NPC.value = Item.buyPrice(silver: 2); NPC.HitSound = SoundID.NPCHit24; NPC.DeathSound = SoundID.NPCDeath27; NPC.knockBackResist = 0.15f; @@ -79,11 +80,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -103,16 +99,16 @@ namespace CalamityMod.NPCs.SunkenSea NPC.chaseable = reader.ReadBoolean(); } - public override void OnSpawn(IEntitySource source) - { - pathfinding = new PathfindingManager(NPC) - { - MaxSpeed = 1.8f - }; - } - public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + MaxSpeed = 1.8f + }; + } + NPC.spriteDirection = NPC.direction = MathF.Sign(NPC.velocity.X); Lighting.AddLight(NPC.Center, (255 - NPC.alpha) * 0f / 255f, (255 - NPC.alpha) * 0.75f / 255f, (255 - NPC.alpha) * 0.75f / 255f); @@ -123,7 +119,7 @@ namespace CalamityMod.NPCs.SunkenSea // TODO // Change this to kelp when it's added - int tileType = ModContent.TileType(); + int tileType = ModContent.TileType(); // Assure the kelp still exists, if it's gone, clear the tile if ((TileX != 0 || TileY != 0) && t.TileType != tileType) @@ -239,7 +235,7 @@ namespace CalamityMod.NPCs.SunkenSea { if ((spawnInfo.Player.Calamity().ZoneRadiantReefs || spawnInfo.Player.Calamity().ZoneGleamingBurrows) && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.CaveJellyfish.Chance * 0.9f; + return SpawnCondition.CaveJellyfish.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SunkenSea/PrismaticGuppy.cs b/NPCs/SunkenSea/PrismaticGuppy.cs index 8858bb6811..78b9265cf9 100644 --- a/NPCs/SunkenSea/PrismaticGuppy.cs +++ b/NPCs/SunkenSea/PrismaticGuppy.cs @@ -129,7 +129,9 @@ namespace CalamityMod.NPCs.SunkenSea protected override List PredatorIDs => new List() { ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() }; protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows | SunkenSeaBiomeFlags.ClamDen; @@ -166,6 +168,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.npcSlots = 0f; NPC.noGravity = true; NPC.damage = 0; @@ -181,7 +184,6 @@ namespace CalamityMod.NPCs.SunkenSea //BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -195,11 +197,6 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { NPC.frameCounter = Main.rand.NextFloat(FrameCount); - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.5f, - MaxSpeed = 4f, - }; CurrentShape = Main.rand.Next(0, 3); // Guppies released by the player do not randomize when spawned if (source is EntitySource_Parent parentSource && parentSource.Entity is Player) @@ -221,7 +218,6 @@ namespace CalamityMod.NPCs.SunkenSea { CurrentColor = Main.rand.Next(3, 5); NPC.rarity = 3; - NPC.value = 100000; } // Decide item.......................... switch (CurrentColor) @@ -245,6 +241,14 @@ namespace CalamityMod.NPCs.SunkenSea } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.5f, + MaxSpeed = 4f, + }; + } // Spawn more guppies if a leader/naturally spawned guppy if (Role == 0 && NPC.releaseOwner == 255) { @@ -292,6 +296,101 @@ namespace CalamityMod.NPCs.SunkenSea Role = 2; break; } + + if (!owner.active) + return; + + if (NPC.Distance(owner.Center) > 20) + pathfinding.DoPathfinding(new(NPC.Center, owner.Center, SunkenSeaTileValidity)); + else + { + float passiveMvtFloat = 0.5f; + float range = 70f; + Vector2 fischPos = NPC.Center; + float xDist = owner.Center.X - fischPos.X; + float yDist = owner.Center.Y - fischPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + xDist += 20f * -(float)owner.direction; + Vector2 leaderVector = new Vector2(xDist, yDist); + float leaderDist = leaderVector.Length(); + float returnSpeed = 8f; + //If leader is close enough, resume normal + if (leaderDist < range && owner.velocity.Y == 0f && + NPC.Bottom.Y <= owner.Bottom.Y && + !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + } + + if (leaderDist < 50f) + { + if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) + { + NPC.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (leaderDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (leaderDist > 300f) + { + passiveMvtFloat = 1f; + } + leaderDist = returnSpeed / leaderDist; + leaderVector.X *= leaderDist; + leaderVector.Y *= leaderDist; + } + if (NPC.velocity.X < leaderVector.X) + { + NPC.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) + { + NPC.velocity.X += passiveMvtFloat; + } + } + if (NPC.velocity.X > leaderVector.X) + { + NPC.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) + { + NPC.velocity.X -= passiveMvtFloat; + } + } + if (NPC.velocity.Y < leaderVector.Y) + { + NPC.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) + { + NPC.velocity.Y += passiveMvtFloat * 2f; + } + } + if (NPC.velocity.Y > leaderVector.Y) + { + NPC.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) + { + NPC.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (NPC.velocity.X >= 0.25f) + { + NPC.direction = -1; + } + else if (NPC.velocity.X < -0.25f) + { + NPC.direction = 1; + } + NPC.spriteDirection = -NPC.direction; + } + float SAImovement = 0.2f; for (int k = 0; k < Main.maxNPCs; k++) { @@ -301,7 +400,7 @@ namespace CalamityMod.NPCs.SunkenSea continue; float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width * 2f) + if (taxicabDist < NPC.width) { if (NPC.position.X < otherFish.position.X) NPC.velocity.X -= SAImovement; @@ -314,12 +413,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.velocity.Y += SAImovement; } } - - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 20) - pathfinding.DoPathfinding(new(NPC.Center, owner.Center, SunkenSeaTileValidity)); } break; // Run from predators, attempting to find crystals to camo in @@ -462,18 +555,31 @@ namespace CalamityMod.NPCs.SunkenSea dust.velocity = Vector2.Zero; dust.noGravity = true; dust.color *= 0.5f; + dust.noLight = true; } - if (CurrentColor == (int)FishColor.Gold) + Color c = Color.White; + + switch (CurrentColor) { - NPC.rarity = 3; - NPC.value = 100000; - NPC.ProduceGoldCritterDust(); + case 0: + c = Color.SkyBlue; + break; + case 1: + c = Color.SeaGreen; + break; + case 2: + c = Color.Pink; + break; + case 4: + c = Color.Cyan; + break; } - if (CurrentColor == (int)FishColor.Radiant) + Lighting.AddLight(NPC.Center, c.R / 255f, c.G / 255f, c.B / 255f); + + if (CurrentColor == (int)FishColor.Gold) { - NPC.rarity = 3; - NPC.value = 100000; + NPC.ProduceGoldCritterDust(); } } @@ -519,7 +625,7 @@ namespace CalamityMod.NPCs.SunkenSea if (spawnInfo.Player.Calamity().ZoneGleamingBurrows || spawnInfo.Player.Calamity().ZoneClamDen) return SpawnCondition.CaveJellyfish.Chance * 0.2f; if (spawnInfo.Player.Calamity().ZonePolypForest) - return SpawnCondition.CaveJellyfish.Chance * 0.05f; + return SpawnCondition.CaveJellyfish.Chance * 0.1f; } return 0f; } diff --git a/NPCs/SunkenSea/Probesnout.cs b/NPCs/SunkenSea/Probesnout.cs index 67af701c6a..b1e1a8228a 100644 --- a/NPCs/SunkenSea/Probesnout.cs +++ b/NPCs/SunkenSea/Probesnout.cs @@ -131,20 +131,29 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { - CurrentBehavior = IdlingBehavior; - NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); - NPC.GravityMultiplier *= 2f; - NPC.MaxFallSpeedMultiplier *= 2f; pathfinding = new PathfindingManager(NPC) { Acceleration = 0.4f, MaxSpeed = 8f, MinimumPointDistance = 60f }; + CurrentBehavior = IdlingBehavior; + NPC.spriteDirection = Main.rand.NextBool().ToDirectionInt(); + NPC.GravityMultiplier *= 2f; + NPC.MaxFallSpeedMultiplier *= 2f; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.4f, + MaxSpeed = 8f, + MinimumPointDistance = 60f + }; + } CurrentBehavior?.Invoke(); NPC.rotation = MathHelper.ToRadians(NPC.velocity.X * 3f); @@ -402,6 +411,7 @@ namespace CalamityMod.NPCs.SunkenSea { base.SetDefaults(); + Banner = Type; BannerItem = ItemType(); NPC.lifeMax = 5; @@ -415,7 +425,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.catchItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -466,7 +475,6 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.rarity = 3; NPC.catchItem = ItemType(); - NPC.value = 100000; } public override void HitEffect(NPC.HitInfo hit) @@ -487,7 +495,7 @@ namespace CalamityMod.NPCs.SunkenSea if (spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { if (spawnInfo.Player.Calamity().ZoneRadiantReefs) - return SpawnCondition.CaveJellyfish.Chance * 0.015f; + return SpawnCondition.CaveJellyfish.Chance * 0.05f; } return 0f; } diff --git a/NPCs/SunkenSea/SandProwler.cs b/NPCs/SunkenSea/SandProwler.cs index 24e490d52e..b734bfcad1 100644 --- a/NPCs/SunkenSea/SandProwler.cs +++ b/NPCs/SunkenSea/SandProwler.cs @@ -93,6 +93,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.damage = 50; NPC.width = 30; NPC.height = 24; @@ -101,13 +102,14 @@ namespace CalamityMod.NPCs.SunkenSea NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(silver: 20); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; NPC.netAlways = true; + NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; @@ -116,7 +118,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToWater = false; NPC.waterMovementSpeed = 1; NPC.GravityIgnoresLiquid = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -459,7 +460,7 @@ namespace CalamityMod.NPCs.SunkenSea bool shouldDespawn = true; for (int i = 0; i < Main.maxNPCs; i++) { - if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType()) + if (Main.npc[i].active && Main.npc[i].type == ModContent.NPCType() && Main.npc[i].ai[3] == 0) { shouldDespawn = false; break; @@ -601,6 +602,24 @@ namespace CalamityMod.NPCs.SunkenSea return IsHead; } + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public void PlayerHurt() + { + if (IsHead) + NPC.chaseable = true; + else + Main.npc[NPC.realLife].chaseable = true; + } + public override void ModifyNPCLoot(NPCLoot npcLoot) => DefineSandProwlerLoot(npcLoot); public static void DefineSandProwlerLoot(NPCLoot npcLoot) diff --git a/NPCs/SunkenSea/SandProwlerNested.cs b/NPCs/SunkenSea/SandProwlerNested.cs index cfac1b56f3..980e5e4919 100644 --- a/NPCs/SunkenSea/SandProwlerNested.cs +++ b/NPCs/SunkenSea/SandProwlerNested.cs @@ -88,12 +88,13 @@ namespace CalamityMod.NPCs.SunkenSea NPC.aiStyle = -1; AIType = -1; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 20, 0); + NPC.value = Item.buyPrice(silver: 20); NPC.behindTiles = true; NPC.noGravity = true; NPC.noTileCollide = true; NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; + NPC.chaseable = false; NPC.netAlways = true; Banner = NPC.type; BannerItem = ModContent.ItemType(); @@ -101,11 +102,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); NPC.waterMovementSpeed = 1f; } @@ -125,6 +121,7 @@ namespace CalamityMod.NPCs.SunkenSea writer.Write(InitialSnapDirection); writer.Write(CurrentSnapDirection); writer.Write(NPC.Calamity().newAI[1]); + writer.Write(NPC.chaseable); } public override void ReceiveExtraAI(BinaryReader reader) @@ -134,6 +131,7 @@ namespace CalamityMod.NPCs.SunkenSea InitialSnapDirection = reader.ReadSingle(); CurrentSnapDirection = reader.ReadSingle(); NPC.Calamity().newAI[1] = reader.ReadSingle(); + NPC.chaseable = reader.ReadBoolean(); } public override void AI() @@ -348,6 +346,21 @@ namespace CalamityMod.NPCs.SunkenSea } } + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public void PlayerHurt() + { + NPC.chaseable = true; + } + public override void FindFrame(int frameHeight) { if (NPC.Calamity().newAI[1] == 1) diff --git a/NPCs/SunkenSea/Scavenger.cs b/NPCs/SunkenSea/Scavenger.cs index 882329c24e..641900a856 100644 --- a/NPCs/SunkenSea/Scavenger.cs +++ b/NPCs/SunkenSea/Scavenger.cs @@ -1,10 +1,12 @@ using CalamityMod.BiomeManagers; using CalamityMod.Enums; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; using CalamityMod.Items.Critters; using CalamityMod.Items.Fishing.SunkenSeaCatches; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.SunkenSea; +using CalamityMod.Items.Placeables.FurnitureDriftwood; using CalamityMod.Items.Weapons.Magic; using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs.NormalNPCs; @@ -41,6 +43,9 @@ namespace CalamityMod.NPCs.SunkenSea { ItemID.WhitePearl, new WeightedRandom() }, { ItemID.BlackPearl, new WeightedRandom() }, { ItemID.PinkPearl, new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, + { ModContent.ItemType(), new WeightedRandom() }, { ItemID.GalaxyPearl, new WeightedRandom() }, { ModContent.ItemType(), new WeightedRandom() }, }; @@ -49,7 +54,8 @@ namespace CalamityMod.NPCs.SunkenSea { Idle = 0, FoundItem = 1, - Bartering = 2 + Bartering = 2, + Burrow = 3 } // The in world index of the item the crab is going after @@ -147,6 +153,8 @@ namespace CalamityMod.NPCs.SunkenSea AddScavengerItem(white, ItemID.Coral, 3, 10, 0.2f); AddScavengerItem(white, ItemID.Starfish, 3, 10, 0.2f); AddScavengerItem(white, ItemID.Seashell, 3, 10, 0.2f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.05f); // Critters. Golds, Radiants, Pearlpods and any Basalt Gully/Timeless Shore critters are to be excluded AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); @@ -158,7 +166,7 @@ namespace CalamityMod.NPCs.SunkenSea AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.01f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); - AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); + AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); AddScavengerItem(white, ModContent.ItemType(), 1, 0.02f); @@ -195,6 +203,11 @@ namespace CalamityMod.NPCs.SunkenSea AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); AddScavengerItem(white, ModContent.ItemType(), 1, () => Main.hardMode); + // Pearlpods can be used as a substitute for pearls + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[white]; + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[black]; + ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; + ScavengerLoot[ItemID.GalaxyPearl] = ScavengerLoot[white]; // Gives 1-2x the amount of white items ScavengerLoot[ModContent.ItemType()] = ScavengerLoot[pink]; // Gives 2 pink items @@ -273,7 +286,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.lifeMax = 350; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.15f; @@ -643,9 +656,33 @@ namespace CalamityMod.NPCs.SunkenSea } } break; + // Burrow away and despawn + case (int)PhaseType.Burrow: + { + NPC.velocity.X *= 0.95f; + if (NPC.velocity.Y == 0) + { + WalkTimer++; + GeneralParticleHandler.SpawnParticle(new Particles.StoneDebrisParticle(Main.rand.NextVector2FromRectangle(NPC.getRect() with { Y = (int)NPC.Center.Y }), new Vector2(Main.rand.NextFloat(-6, 6), Main.rand.NextFloat(-6, -2)), Lighting.GetColor(NPC.Bottom.ToTileCoordinates()), Main.rand.NextFloat(0.5f, 1.2f), 10)); + } + if (WalkTimer % 10 == 0) + { + SoundEngine.PlaySound(SoundID.Dig, NPC.Center); + } + int startFall = 40; + if (WalkTimer >= startFall) + { + NPC.alpha += 5; + if (NPC.alpha > 255) + { + NPC.active = false; + } + } + } + break; } - if (Phase != (int)PhaseType.FoundItem && WalkTimer > 0) + if ((Phase != (int)PhaseType.FoundItem && Phase != (int)PhaseType.Burrow) && WalkTimer > 0) WalkTimer--; if (TurnTimer > 0) @@ -820,6 +857,8 @@ namespace CalamityMod.NPCs.SunkenSea public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + public override bool CanHitPlayer(Player target, ref int cooldownSlot) => false; + public override float SpawnChance(NPCSpawnInfo spawnInfo) { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) @@ -836,6 +875,37 @@ namespace CalamityMod.NPCs.SunkenSea //return 0f; } + public override void OnHitByProjectile(Projectile projectile, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public override void OnHitByItem(Player player, Item item, NPC.HitInfo hit, int damageDone) + { + PlayerHurt(); + } + + public void PlayerHurt() + { + if (Phase != (int)PhaseType.Burrow) + { + WalkTimer = 0; + Phase = (int)PhaseType.Burrow; + foreach (NPC n in Main.ActiveNPCs) + { + if (n == NPC) + continue; + if (n.type != NPC.type) + continue; + if (n.Distance(NPC.Center) > 600) + continue; + Scavenger scav = n.ModNPC(); + scav.PlayerHurt(); + scav.WalkTimer += Main.rand.Next(-20, 10); + } + } + } + public override void HitEffect(NPC.HitInfo hit) { for (int k = 0; k < 2; k++) @@ -880,7 +950,15 @@ namespace CalamityMod.NPCs.SunkenSea Vector2 npcOffset = NPC.Center - screenPos + Vector2.UnitY * extraPosOffset; npcOffset -= new Vector2(texture.Width, texture.Height / frameCount) * NPC.scale / 2f; npcOffset += origin * NPC.scale + new Vector2(0f, NPC.gfxOffY); - spriteBatch.Draw(texture, npcOffset, texture.Frame(1, frameCount, 0, NPC.frame.Y), NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); + int burrowHide = 0; + if (Phase == (int)PhaseType.Burrow) + { + float comp = Utils.GetLerpValue(40, 120, WalkTimer, true); + burrowHide = (int)MathHelper.Lerp(0, texture.Height / frameCount + 1, comp); + npcOffset.Y += MathHelper.Lerp(0, NPC.height, comp); + } + Rectangle frame = texture.Frame(1, frameCount, 0, NPC.frame.Y); + spriteBatch.Draw(texture, npcOffset, frame with { Height = frame.Height - burrowHide }, NPC.GetAlpha(drawColor), NPC.rotation, origin, NPC.scale, spriteEffects, 0f); // my dreams devoured // legacy code for visually holding an item diff --git a/NPCs/SunkenSea/SeaFloaty.cs b/NPCs/SunkenSea/SeaFloaty.cs index 6746073626..a414ec9999 100644 --- a/NPCs/SunkenSea/SeaFloaty.cs +++ b/NPCs/SunkenSea/SeaFloaty.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.BiomeManagers; using CalamityMod.Enums; +using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -36,26 +37,28 @@ namespace CalamityMod.NPCs.SunkenSea SpriteDirection = -1 }; NPCID.Sets.NPCBestiaryDrawOffset[Type] = value; + NPCID.Sets.CountsAsCritter[Type] = true; base.SetStaticDefaults(); } public override void SetDefaults() { + base.SetDefaults(); NPC.npcSlots = 0.5f; NPC.aiStyle = -1; AIType = -1; - NPC.damage = 5; + NPC.damage = 0; NPC.width = 44; NPC.height = 22; NPC.defense = 0; - NPC.lifeMax = 50; + NPC.lifeMax = 5; NPC.knockBackResist = 0.5f; - NPC.value = Item.buyPrice(0, 0, 0, 50); NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; + NPC.chaseable = false; Banner = NPC.type; BannerItem = ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + NPC.catchItem = ModContent.ItemType(); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SunkenSea/SeaMinnow.cs b/NPCs/SunkenSea/SeaMinnow.cs index 095751850a..abddd9f9d4 100644 --- a/NPCs/SunkenSea/SeaMinnow.cs +++ b/NPCs/SunkenSea/SeaMinnow.cs @@ -5,7 +5,7 @@ using CalamityMod.BiomeManagers; using CalamityMod.Enums; using CalamityMod.Items.Critters; using CalamityMod.Items.Placeables.Banners; -using CalamityMod.NPCs.CalamityAIs.CalamityRegularEnemyAIs; +using CalamityMod.NPCs.NormalNPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -26,7 +26,9 @@ namespace CalamityMod.NPCs.SunkenSea protected override List PredatorIDs => new List() { ModContent.NPCType(), ModContent.NPCType(), - ModContent.NPCType() + ModContent.NPCType(), + ModContent.NPCType(), + ModContent.NPCType() }; protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.RadiantReefs | SunkenSeaBiomeFlags.GleamingBurrows; @@ -40,6 +42,7 @@ namespace CalamityMod.NPCs.SunkenSea public override void SetDefaults() { + base.SetDefaults(); NPC.npcSlots = 0f; NPC.noGravity = true; NPC.damage = 0; @@ -55,7 +58,6 @@ namespace CalamityMod.NPCs.SunkenSea BannerItem = ModContent.ItemType(); NPC.chaseable = false; NPC.catchItem = (short)ModContent.ItemType(); - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -69,14 +71,17 @@ namespace CalamityMod.NPCs.SunkenSea public override void OnSpawn(IEntitySource source) { NPC.frameCounter = Main.rand.NextFloat(Main.npcFrameCount[Type]); - pathfinding = new PathfindingManager(NPC) - { - Acceleration = 0.6f, - MaxSpeed = 5f, - }; } public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.6f, + MaxSpeed = 5f, + }; + } NPC owner = Main.npc[(int)NPC.ai[2]]; if (NPC.wet) { @@ -226,6 +231,99 @@ namespace CalamityMod.NPCs.SunkenSea } else { + if (!owner.active) + return; + + if (NPC.Distance(owner.Center) > 200) + pathfinding.DoPathfinding(new(NPC.Center, owner.Center, SunkenSeaTileValidity)); + else + { + float passiveMvtFloat = 0.5f; + float range = 100f; + Vector2 fischPos = NPC.Center; + float xDist = owner.Center.X - fischPos.X; + float yDist = owner.Center.Y - fischPos.Y; + yDist += Main.rand.NextFloat(-10, 20); + xDist += Main.rand.NextFloat(-10, 20); + xDist += 30f * -(float)owner.direction; + Vector2 leaderVector = new Vector2(xDist, yDist); + float leaderDist = leaderVector.Length(); + float returnSpeed = 8f; + //If leader is close enough, resume normal + if (leaderDist < range && owner.velocity.Y == 0f && + NPC.Bottom.Y <= owner.Bottom.Y && + !Collision.SolidCollision(NPC.position, NPC.width, NPC.height)) + { + if (NPC.velocity.Y < -6f) + { + NPC.velocity.Y = -6f; + } + } + + if (leaderDist < 50f) + { + if (Math.Abs(NPC.velocity.X) > 2f || Math.Abs(NPC.velocity.Y) > 2f) + { + NPC.velocity *= 0.99f; + } + passiveMvtFloat = 0.01f; + } + else + { + if (leaderDist < 100f) + { + passiveMvtFloat = 0.1f; + } + if (leaderDist > 300f) + { + passiveMvtFloat = 1f; + } + leaderDist = returnSpeed / leaderDist; + leaderVector.X *= leaderDist; + leaderVector.Y *= leaderDist; + } + if (NPC.velocity.X < leaderVector.X) + { + NPC.velocity.X += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X < 0f) + { + NPC.velocity.X += passiveMvtFloat; + } + } + if (NPC.velocity.X > leaderVector.X) + { + NPC.velocity.X -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.X > 0f) + { + NPC.velocity.X -= passiveMvtFloat; + } + } + if (NPC.velocity.Y < leaderVector.Y) + { + NPC.velocity.Y += passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y < 0f) + { + NPC.velocity.Y += passiveMvtFloat * 2f; + } + } + if (NPC.velocity.Y > leaderVector.Y) + { + NPC.velocity.Y -= passiveMvtFloat; + if (passiveMvtFloat > 0.05f && NPC.velocity.Y > 0f) + { + NPC.velocity.Y -= passiveMvtFloat * 2f; + } + } + if (NPC.velocity.X >= 0.25f) + { + NPC.direction = -1; + } + else if (NPC.velocity.X < -0.25f) + { + NPC.direction = 1; + } + NPC.spriteDirection = -NPC.direction; + } float SAImovement = 0.2f; for (int k = 0; k < Main.maxNPCs; k++) { @@ -235,7 +333,7 @@ namespace CalamityMod.NPCs.SunkenSea continue; float taxicabDist = Math.Abs(NPC.position.X - otherFish.position.X) + Math.Abs(NPC.position.Y - otherFish.position.Y); - if (taxicabDist < NPC.width * 2f) + if (taxicabDist < NPC.width) { if (NPC.position.X < otherFish.position.X) NPC.velocity.X -= SAImovement; @@ -248,12 +346,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.velocity.Y += SAImovement; } } - - if (!owner.active) - return; - - if (NPC.Distance(owner.Center) > 20) - pathfinding.DoPathfinding(new(NPC.Center, owner.Center, SunkenSeaTileValidity)); } int dir = NPC.velocity.X.DirectionalSign(); NPC.rotation = NPC.velocity.ToRotation() + (dir == 1 ? 0 : MathHelper.Pi); @@ -328,7 +420,6 @@ namespace CalamityMod.NPCs.SunkenSea base.SetDefaults(); NPC.catchItem = (short)ModContent.ItemType(); NPC.rarity = 3; - NPC.value = 100000; } public override void HitEffect(NPC.HitInfo hit) diff --git a/NPCs/SunkenSea/Searslug.cs b/NPCs/SunkenSea/Searslug.cs index 97bb92fce2..a09f1258e6 100644 --- a/NPCs/SunkenSea/Searslug.cs +++ b/NPCs/SunkenSea/Searslug.cs @@ -17,22 +17,35 @@ using Terraria.GameContent; using CalamityMod.Particles; using CalamityMod.Graphics.Metaballs; using ReLogic.Content; +using CalamityMod.Enums; +using System.Collections.Generic; namespace CalamityMod.NPCs.SunkenSea { - public class Searslug : ModNPC + public class Searslug : SunkenSeaNPC { public bool Skinwalker => NPC.Calamity()?.newAI[0] == 1; public static Asset glowTexture; public override void Load() => glowTexture = ModContent.Request(Texture + "Glow"); + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; + + protected override List PreyIDs => new(); + + protected override List PredatorIDs => new() + { + ModContent.NPCType() + }; + public override void SetStaticDefaults() { + base.SetStaticDefaults(); Main.npcFrameCount[Type] = 7; } public override void SetDefaults() { + base.SetDefaults(); NPC.aiStyle = NPCAIStyleID.Snail; AIType = NPCID.Snail; NPC.damage = 0; @@ -41,20 +54,19 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 0; NPC.lifeMax = 20; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 10, 0); NPC.lavaImmune = true; NPC.noGravity = false; NPC.noTileCollide = false; NPC.HitSound = SoundID.NPCHit38; NPC.DeathSound = SoundID.NPCDeath1; NPC.GravityIgnoresLiquid = true; + NPC.chaseable = false; //Banner = NPC.type; //BannerItem = ModContent.ItemType(); NPC.catchItem = ModContent.ItemType(); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToWater = true; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void ReceiveExtraAI(BinaryReader reader) @@ -134,10 +146,11 @@ namespace CalamityMod.NPCs.SunkenSea } } } + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); public override float SpawnChance(NPCSpawnInfo spawnInfo) { - if (spawnInfo.Player.Calamity().ZoneBasaltGully && spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) + if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) { return SpawnCondition.Cavern.Chance * 0.2f; } @@ -179,7 +192,7 @@ namespace CalamityMod.NPCs.SunkenSea // Wear protection! if (failed) { - player.AddBuff(BuffID.OnFire3, CalamityUtils.SecondsToFrames(5)); + player.AddBuff(BuffID.OnFire, CalamityUtils.SecondsToFrames(5)); } } } diff --git a/NPCs/SunkenSea/Sharkoon.cs b/NPCs/SunkenSea/Sharkoon.cs index c4857a199b..a695aaf629 100644 --- a/NPCs/SunkenSea/Sharkoon.cs +++ b/NPCs/SunkenSea/Sharkoon.cs @@ -193,16 +193,12 @@ namespace CalamityMod.NPCs.SunkenSea NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath1; - NPC.value = Item.buyPrice(0, 0, 5, 0); + NPC.value = Item.buyPrice(silver: 5); NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - - // Scale stats in Expert and Master - CalamityGlobalNPC.AdjustExpertModeStatScaling(NPC); - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC); } #endregion @@ -234,6 +230,14 @@ namespace CalamityMod.NPCs.SunkenSea public override void AI() { + if (pathfinding == null) + { + pathfinding = new PathfindingManager(NPC) + { + Acceleration = 0.3f, + MaxSpeed = 6f, + }; + } CurrentBehavior?.Invoke(); // Leans the Sharkoon towards the direction it's going. diff --git a/NPCs/SunkenSea/Slugbun.cs b/NPCs/SunkenSea/Slugbun.cs index 5f7b406dc4..7d55b2776d 100644 --- a/NPCs/SunkenSea/Slugbun.cs +++ b/NPCs/SunkenSea/Slugbun.cs @@ -70,7 +70,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.defense = 0; NPC.lifeMax = 20; NPC.knockBackResist = 0f; - NPC.value = Item.buyPrice(0, 0, 5, 0); NPC.lavaImmune = false; NPC.noGravity = false; NPC.noTileCollide = false; @@ -78,6 +77,7 @@ namespace CalamityMod.NPCs.SunkenSea NPC.DeathSound = SoundID.NPCDeath1; NPC.GravityIgnoresLiquid = true; AIType = NPCID.Snail; + NPC.chaseable = false; //Banner = NPC.type; //BannerItem = ModContent.ItemType(); NPC.catchItem = ModContent.ItemType(); @@ -85,7 +85,6 @@ namespace CalamityMod.NPCs.SunkenSea NPC.Calamity().VulnerableToSickness = true; NPC.Calamity().VulnerableToElectricity = true; NPC.Calamity().VulnerableToWater = false; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; } public override void ReceiveExtraAI(BinaryReader reader) @@ -135,7 +134,6 @@ namespace CalamityMod.NPCs.SunkenSea { CurrentSkin = (int)SlugSkin.Radiant; NPC.rarity = 3; - NPC.value = 100000; } // Decide item.......................... switch (CurrentSkin) @@ -192,11 +190,6 @@ namespace CalamityMod.NPCs.SunkenSea } } } - if (CurrentSkin == (int)SlugSkin.Radiant) - { - NPC.rarity = 3; - NPC.value = 100000; - } } public override void FindFrame(int frameHeight) diff --git a/NPCs/SunkenSea/Steampod.cs b/NPCs/SunkenSea/Steampod.cs new file mode 100644 index 0000000000..606ff7c184 --- /dev/null +++ b/NPCs/SunkenSea/Steampod.cs @@ -0,0 +1,502 @@ +using CalamityMod.BiomeManagers; +using CalamityMod.Items.Critters; +using CalamityMod.Items.Placeables.Banners; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; +using System.IO; +using Terraria; +using Terraria.ID; +using Terraria.GameContent.Bestiary; +using Terraria.ModLoader; +using Terraria.ModLoader.Utilities; +using Terraria.Audio; +using Terraria.DataStructures; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using ReLogic.Content; +using CalamityMod.Enums; +using System.Collections.Generic; +using System; +using CalamityMod.Particles; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using CalamityMod.Items.Weapons.Ranged; + +namespace CalamityMod.NPCs.SunkenSea +{ + public class Steampod : SunkenSeaNPC + { + public enum PhaseType + { + Idle = 0, + Hunting = 1, + LaunchUpSide = 2 + } + + public static Asset glowTex; + + public ref float CurrentPhase => ref NPC.ai[0]; + + public ref float Timer => ref NPC.ai[1]; + + public ref float Jetting => ref NPC.ai[2]; + + public ref float WalkTimer => ref NPC.Calamity().newAI[0]; + + public ref float TurnTimer => ref NPC.Calamity().newAI[1]; + + public ref float WalkOrStand => ref NPC.Calamity().newAI[2]; + + protected override SunkenSeaBiomeFlags BiomeDesignation => SunkenSeaBiomeFlags.BasaltGully; + + protected override List PredatorIDs => new List() + { + ModContent.NPCType() + }; + + protected override List PreyIDs => new List() + { + ModContent.NPCType() + }; + + public override void Load() + { + glowTex = ModContent.Request(Texture + "Glow"); + } + + public override void SetStaticDefaults() + { + Main.npcFrameCount[Type] = 17; + base.SetStaticDefaults(); + } + + public override void SetDefaults() + { + base.SetDefaults(); + NPC.aiStyle = -1; + NPC.damage = 40; + NPC.width = 44; + NPC.height = 44; + NPC.defense = 10; + NPC.lifeMax = 200; + NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(silver: 20); + NPC.lavaImmune = true; + NPC.noGravity = false; + NPC.noTileCollide = false; + NPC.HitSound = SoundID.NPCHit38; + NPC.DeathSound = SoundID.NPCDeath1; + NPC.chaseable = false; + //Banner = NPC.type; + //BannerItem = ModContent.ItemType(); + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToWater = true; + NPC.Calamity().VulnerableToCold = true; + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + for (int i = 0; i < 3; i++) + NPC.Calamity().newAI[i] = reader.ReadSingle(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + for (int i = 0; i < 3; i++) + writer.Write(NPC.Calamity().newAI[i]); + } + + public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) + { + bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] + { + new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Steampod") + }); + } + + public override void AI() + { + switch (CurrentPhase) + { + case (int)PhaseType.Idle: + { + // Initialize its direction + if (NPC.direction == 0) + NPC.direction = Main.rand.NextBool() ? -1 : 1; + // Decide if it should walk or sit + float movementSpeed = CurrentPredator != null ? 2 : 1; + bool startMovement = false; + if (WalkTimer <= 0) + { + WalkTimer = Main.rand.Next(120, 270); + WalkOrStand = WalkOrStand <= 0 ? 1 : -1; + if (WalkOrStand == 1 && Main.rand.NextBool() && CurrentPrey == null) + { + NPC.direction *= -1; + } + startMovement = true; + } + bool lookingAtPredator = CurrentPredator != null && NPC.direction == Math.Sign(CurrentPredator.Center.X - NPC.Center.X); + bool pitCheck = FallCheck(16); + // If it bumps into something, jump or turn around + if ((!startMovement && TurnTimer <= 0 && (NPC.velocity.X == 0 || pitCheck) && WalkOrStand == 1) || lookingAtPredator) + { + // Jump if there are a couple tiles and a space above + if (!pitCheck && NPC.velocity.Y == 0 && !lookingAtPredator) + { + // Chance to do a jet + bool jet = Main.rand.NextBool(4) && Jetting == 0 && !NPC.lavaWet; + if (jet) + { + if (JumpCheck(16)) + { + TurnTimer = 0; + WalkTimer = 0; + WalkOrStand = 0; + Timer = 0; + CurrentPhase = (int)PhaseType.LaunchUpSide; + } + } + else if (JumpCheck(6)) + { + NPC.velocity.Y -= 7; + NPC.velocity.X = movementSpeed * NPC.direction; + WalkOrStand = 1; + TurnTimer = 10; + } + } + // Jet upwards if a pit is in the way + else if (Jetting == 0 && !NPC.lavaWet) + { + TurnTimer = 0; + WalkTimer = 0; + WalkOrStand = 0; + Timer = 0; + CurrentPhase = (int)PhaseType.LaunchUpSide; + } + } + // Attack + Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; + if (target != null) + { + if (NPC.HasSight(target.Center) && Jetting == 0) + { + TurnTimer = 0; + WalkTimer = 0; + WalkOrStand = 0; + Timer = 0; + CurrentPhase = (int)PhaseType.Hunting; + } + } + + // Move + if (!NPC.justHit) + { + if (WalkOrStand == 1) + NPC.velocity.X = MathHelper.Lerp(NPC.velocity.X, NPC.direction * movementSpeed, 0.05f); + else if (NPC.velocity.Y == 0) + NPC.velocity.X *= 0.95f; + } + else if (WalkOrStand == -1) + { + WalkTimer = 0; + if (CurrentPredator != null) + { + WalkOrStand = 1; + WalkTimer = Main.rand.Next(180, 340); + } + } + // Bounce on lava + if (NPC.lavaWet) + { + NPC.velocity.Y = MathHelper.Min(NPC.velocity.Y - 0.2f, -4); + } + CalamityUtils.StepUpBlocks(NPC); + } + break; + case (int)PhaseType.LaunchUpSide: + { + int jumpUp = 60; // When to jet up + int jetSide = jumpUp + 40; // When to jet sideways + int jetRate = NPC.lavaWet ? 1 : 2; // How often particles spawn + + // Reset if on ground or hit ceiling + if (NPC.velocity.Y == 0 && Jetting > 0 && Timer > 5) + { + NPC.velocity.Y = 0; + Timer = 0; + Jetting = -120; + CurrentPhase = (int)PhaseType.Idle; + NPC.rotation = 0; + break; + } + + // Increment timer while on the ground + if (NPC.velocity.Y == 0 && Jetting == 0) + { + NPC.velocity.X *= 0.95f; + Timer++; + } + + // Jump + if (Timer == jumpUp && Jetting == 0) + { + Jetting = 1; + NPC.velocity.Y = -12 * (NPC.lavaWet ? 1.5f : 1); + SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); + } + // Release particles + else if (Jetting == 1) + { + Timer++; + if (Timer > jumpUp) + { + NPC.velocity.Y += 0.01f; + if (Timer % jetRate == 0) + { + SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); + GeneralParticleHandler.SpawnParticle(p); + } + } + if (Timer == jetSide) + { + Timer = 0; + Jetting = 2; + } + } + // Jet sideways + else if (Jetting == 2) + { + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + Timer++; + if (Timer == 1) + { + SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); + NPC.velocity.X = NPC.direction * 16; + NPC.velocity.Y = -2; + } + else if (Timer % jetRate == 0) + { + SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); + GeneralParticleHandler.SpawnParticle(p); + } + if (Timer > 1) + { + NPC.velocity.X += -NPC.direction * 0.01f; + } + // Failsafe if it gets trapped in jet mode + if (Timer > 300) + { + NPC.velocity.Y = 0; + Timer = 0; + Jetting = -120; + CurrentPhase = (int)PhaseType.Idle; + NPC.rotation = 0; + break; + } + } + } + break; + case (int)PhaseType.Hunting: + { + int jumpUp = 60; + int jetSide = jumpUp + 20; + int jetRate = 1; + + Entity target = CurrentPrey != null ? CurrentPrey : CurrentPlayer; + + // If the target is gone, reset + if ((NPC.velocity.Y == 0 && Jetting > 0 && Timer > jetSide) || target == null) + { + NPC.velocity.Y = 0; + NPC.velocity.X = 0; + Timer = 0; + Jetting = -120; + CurrentPhase = (int)PhaseType.Idle; + NPC.rotation = 0; + break; + } + + // Jet towards the target + if (NPC.velocity.Y == 0 && Jetting == 0) + { + NPC.velocity.X *= 0.95f; + Timer++; + if (Timer == jumpUp && Jetting == 0) + { + Jetting = 1; + NPC.velocity = NPC.SafeDirectionTo(target.Center) * 20; + SoundEngine.PlaySound(DragonsBreath.FireballSound with { Pitch = 0.4f }, NPC.Center); + } + } + // Release particles + if (Jetting == 1) + { + Timer++; + if (Timer % jetRate == 0) + { + SeaFoamParticle p = new SeaFoamParticle(NPC.Center, -NPC.velocity, Color.LightCyan, Color.Cyan, Main.rand.NextFloat(0.4f, 0.8f), 180f, 0.05f); + GeneralParticleHandler.SpawnParticle(p); + } + NPC.rotation = NPC.velocity.ToRotation() + MathHelper.PiOver2; + } + // Failsafe reset + if (Timer > 300) + { + NPC.velocity.Y = 0; + Timer = 0; + Jetting = -120; + CurrentPhase = (int)PhaseType.Idle; + NPC.rotation = 0; + break; + } + } + break; + } + + if (Jetting < 0) + Jetting++; + + if (WalkTimer > 0) + WalkTimer--; + + if (TurnTimer > 0) + TurnTimer--; + + NPC.spriteDirection = NPC.direction; + } + + // Checks if the horizontal position in front of it has lava or is a pit so that the pod can avoid it + public bool FallCheck(int height) + { + Point startPos = NPC.direction == 1 ? NPC.Right.ToTileCoordinates() : NPC.Left.ToTileCoordinates(); + for (int i = 1; i < height; i++) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i); + Tile above = CalamityUtils.ParanoidTileRetrieval(startPos.X + NPC.direction, startPos.Y + i - 2); + // If there's a tile, wegud + if (t.HasTile) + return false; + // If there's liquid or a pit, we not gud + if (t.LiquidAmount > 0 && above.LiquidAmount > 0) + return true; + + } + return true; + } + + // Checks if the horizontal position in front of the pod can be jumped up + public bool JumpCheck(int height) + { + Point startPos = NPC.direction == 1 ? NPC.BottomRight.ToTileCoordinates() : NPC.BottomLeft.ToTileCoordinates(); + bool canJump = false; + int add = NPC.direction == 1 ? 0 : -1; + int jumpHeight = height; + for (int i = jumpHeight; i > 0; i--) + { + Tile t = CalamityUtils.ParanoidTileRetrieval(startPos.X + add, startPos.Y - i); + // If there are tiles obfuscating the jump position, return false + if (i > (jumpHeight - 2) && t.HasTile) + return false; + // If there is a tile to jump on, return true + if (t.HasTile) + { + canJump = true; + break; + } + } + return canJump; + } + + public override void FindFrame(int frameHeight) + { + bool still = (CurrentPhase == (int)PhaseType.Idle && NPC.velocity.X == 0); + if (!still) + { + NPC.frameCounter++; + } + if (NPC.frameCounter > 6) + { + NPC.frameCounter = 0; + NPC.frame.Y += frameHeight; + } + // Jet + if (Jetting > 0) + { + if (NPC.frame.Y >= 17 * frameHeight || NPC.frame.Y < 12 * frameHeight) + { + NPC.frame.Y = 12 * frameHeight; + } + } + // Curl up + else if (CurrentPhase != (int)PhaseType.Idle) + { + if (NPC.frame.Y > 11 * frameHeight) + { + NPC.frame.Y = 11 * frameHeight; + } + if (NPC.frame.Y < 7 * frameHeight) + { + NPC.frame.Y = 7 * frameHeight; + } + } + // Nothing + else if (still) + { + NPC.frame.Y = 7 * frameHeight; + } + // Walk + else + { + if (NPC.frame.Y >= 7 * frameHeight) + { + NPC.frame.Y = 0; + } + } + } + + protected override bool NPCSearchFilter(NPC n) + { + return base.NPCSearchFilter(n) || n == CurrentPrey && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; + } + + protected override bool PlayerSearchFilter(Player n) + { + return base.PlayerSearchFilter(n) || n == CurrentPlayer && Vector2.DistanceSquared(NPC.Center, n.Center) < 960f * 960f; + } + + public override bool CanBeHitByNPC(NPC attacker) => PredatorIDs.Contains(attacker.type); + + public override float SpawnChance(NPCSpawnInfo spawnInfo) + { + if (spawnInfo.Player.Calamity().ZoneBasaltGully && !spawnInfo.Player.Calamity().clamity) + { + return SpawnCondition.Cavern.Chance * 0.5f; + } + return 0f; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) + { + if (hurtInfo.Damage <= 0) + return; + target.AddBuff(BuffID.OnFire, 120); + } + + public override void HitEffect(NPC.HitInfo hit) + { + for (int k = 0; k < 5; k++) + { + Dust.NewDust(NPC.position, NPC.width, NPC.height, DustID.Lava, hit.HitDirection, -1f, 0, default, 1f); + } + } + + public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) + { + Texture2D tex = TextureAssets.Npc[NPC.type].Value; + spriteBatch.Draw(tex, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, NPC.GetAlpha(drawColor), NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); + spriteBatch.Draw(glowTex.Value, NPC.Center - screenPos + Vector2.UnitY * NPC.gfxOffY, NPC.frame, Color.White, NPC.rotation, new Vector2(tex.Width / 2, tex.Height / 2 / Main.npcFrameCount[NPC.type]), NPC.scale, NPC.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : 0, 0); + + return false; + } + } +} diff --git a/NPCs/SunkenSea/Steampod.png b/NPCs/SunkenSea/Steampod.png index 977ce84834..dffa275d82 100644 Binary files a/NPCs/SunkenSea/Steampod.png and b/NPCs/SunkenSea/Steampod.png differ diff --git a/NPCs/SunkenSea/SteampodGlow.png b/NPCs/SunkenSea/SteampodGlow.png new file mode 100644 index 0000000000..58d243d0ea Binary files /dev/null and b/NPCs/SunkenSea/SteampodGlow.png differ diff --git a/NPCs/SunkenSea/StormlionSentry.cs b/NPCs/SunkenSea/StormlionSentry.cs index 8a47696aaa..7cadfdffe3 100644 --- a/NPCs/SunkenSea/StormlionSentry.cs +++ b/NPCs/SunkenSea/StormlionSentry.cs @@ -76,16 +76,18 @@ namespace CalamityMod.NPCs.SunkenSea NPC.damage = 15; NPC.defense = 3; NPC.knockBackResist = 0f; + NPC.value = Item.buyPrice(silver: 1); NPC.HitSound = Effects.StormlionEffects.Hit; NPC.DeathSound = Effects.StormlionEffects.Killed; NPC.noGravity = true; NPC.noTileCollide = true; // Custom tile collision + SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; + AIState = Mode.Idle; attackFeedback = 1; headRot = -MathHelper.PiOver2; - SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; //Banner = NPC.type; //BannerItem = ModContent.ItemType(); } @@ -171,7 +173,7 @@ namespace CalamityMod.NPCs.SunkenSea { SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 1f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 12), ModContent.ProjectileType(), NPC.damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 12), ModContent.ProjectileType(), 15, 0f, Main.myPlayer); for (int i = 0; i <= 12; i++) { float variance = Main.rand.NextFloat(-0.6f, 0.6f); @@ -230,7 +232,7 @@ namespace CalamityMod.NPCs.SunkenSea if (time % 2 == 0) { SoundEngine.PlaySound(Effects.StormlionEffects.Attack with { Volume = 0.2f, Pitch = 0.4f * sine, MaxInstances = 30 }, NPC.Center); - Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 6), ModContent.ProjectileType(), NPC.damage * target.statLifeMax2, 0f, Main.myPlayer); + Projectile proj = Projectile.NewProjectileDirect(NPC.GetSource_FromThis(), attackPosition, (headRot.ToRotationVector2() * 6), ModContent.ProjectileType(), 15 * target.statLifeMax2, 0f, Main.myPlayer); proj.friendly = true; proj.hostile = false; } @@ -294,7 +296,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (spawnInfo.Player.Calamity().ZoneTimelessShores && !spawnInfo.Water && !spawnInfo.Player.Calamity().clamity) { - return SpawnCondition.Cavern.Chance * 0.5f; + return SpawnCondition.Cavern.Chance * 0.7f; } return 0f; } diff --git a/NPCs/SunkenSea/SunkenSeaNPC.cs b/NPCs/SunkenSea/SunkenSeaNPC.cs index f448f03fef..0d9a00f454 100644 --- a/NPCs/SunkenSea/SunkenSeaNPC.cs +++ b/NPCs/SunkenSea/SunkenSeaNPC.cs @@ -99,8 +99,6 @@ namespace CalamityMod.NPCs.SunkenSea BiomeDesignation.HasFlag(flag)) .Select(flag => SunkenSeaBiomeCorrespondentDict.Dict[flag].BiomeType) .ToArray(); - - Banner = Type; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) diff --git a/NPCs/SupremeCalamitas/CirrusHeadIcon.png b/NPCs/SupremeCalamitas/CirrusHeadIcon.png deleted file mode 100644 index b322de98ea..0000000000 Binary files a/NPCs/SupremeCalamitas/CirrusHeadIcon.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/CirrusHeadIcon2.png b/NPCs/SupremeCalamitas/CirrusHeadIcon2.png deleted file mode 100644 index 2052f7d75f..0000000000 Binary files a/NPCs/SupremeCalamitas/CirrusHeadIcon2.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs index 32fd48411e..21313f7e11 100644 --- a/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs +++ b/NPCs/SupremeCalamitas/SepulcherBodyEnergyBall.cs @@ -104,31 +104,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas else NPC.alpha = HeadSegment.alpha; - /*AttackTimer += BossRushEvent.BossRushActive ? 1.5f : 1f; - float attackgate = !HeadSegment.Calamity().unbreakableDR && Main.zenithWorld ? 450f : 900f; - if (AttackTimer >= attackgate && NoStartAttack <= 0) - { - AttackTimer = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - int totalProjectiles = 4; - float radians = MathHelper.TwoPi / totalProjectiles; - float velocity = 1f; - float projectileVelocityToPass = 15f; - - Vector2 spinningPoint = Vector2.Normalize(new Vector2(-velocity, -velocity)); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 0f, projectileVelocityToPass); - } - NPC.netUpdate = true; - } - SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound, NPC.Center); - }*/ - if (Main.npc.IndexInRange((int)NPC.ai[1])) { Vector2 offsetToAheadSegment = AheadSegment.Center - NPC.Center; diff --git a/NPCs/SupremeCalamitas/SepulcherHead.cs b/NPCs/SupremeCalamitas/SepulcherHead.cs index 244db411f1..1e171f6b9c 100644 --- a/NPCs/SupremeCalamitas/SepulcherHead.cs +++ b/NPCs/SupremeCalamitas/SepulcherHead.cs @@ -201,8 +201,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 segmentLocation = NPC.Center; float targetX = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.X + (Main.player[NPC.target].width / 2); float targetY = CalamityGlobalNPC.SCal < 0 ? 0 : Main.npc[CalamityGlobalNPC.SCal].position.Y + (Main.player[NPC.target].height / 2); - float sepMaxSpeed = BossRushEvent.BossRushActive ? 22.5f : 20f; - float sepAcceleration = (BossRushEvent.BossRushActive ? 0.2f : 0.175f) + (0.37f - AttackCooldown * 0.0015f); + float sepMaxSpeed = 20f; + float sepAcceleration = 0.175f + (0.37f - AttackCooldown * 0.0015f); float fasterMaxSpeed = sepMaxSpeed * 1.3f; float slowerMaxSpeed = sepMaxSpeed * 0.7f; @@ -336,7 +336,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = (int)(NPC.GetProjectileDamage(type) * 0.5f); int totalProjectiles = 30; float radians = MathHelper.TwoPi / totalProjectiles; float velocity = 1f; @@ -345,7 +344,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < totalProjectiles; k++) { Vector2 projectileVelocity = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, projectileVelocity, type, SupremeCalamitas.DartDamage, 0f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); } NPC.netUpdate = true; } diff --git a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs index ce3a029a3b..10c78e8c89 100644 --- a/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs +++ b/NPCs/SupremeCalamitas/SoulSeekerSupreme.cs @@ -57,13 +57,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void SetDefaults() { + NPC.damage = 0; // No contact damage NPC.aiStyle = -1; AIType = -1; NPC.width = 40; NPC.height = 40; NPC.noGravity = true; NPC.noTileCollide = true; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats NPC.defense = 60; NPC.DR_NERD(NormalDR); NPC.lifeMax = 28000; @@ -144,7 +144,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.spriteDirection = (Target.Center.X < NPC.Center.X).ToDirectionInt(); timer++; - int shootRate = BossRushEvent.BossRushActive ? 120 : 180; + int shootRate = 180; if (timer > shootRate) { foreach (NPC seeker in Main.ActiveNPCs) @@ -162,10 +162,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float targetDist = Vector2.Distance(Target.Center, NPC.Center); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (BossRushEvent.BossRushActive) - damage /= 2; - float velocity = 5f; float projectileVelocityToPass = velocity * 3f; Vector2 shootVelocity = (Target.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; @@ -181,7 +177,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else { - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity * 0.5f, type, damage, 1f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, shootVelocity * 0.5f, type, SupremeCalamitas.DartDamage, 1f, Main.myPlayer, 0f, 3f, projectileVelocityToPass); for (int i = 0; i < 5; i++) { Dust ShotDust = Dust.NewDustPerfect(NPC.Center, Main.rand.NextBool(3) ? 60 : 114); diff --git a/NPCs/SupremeCalamitas/SupremeCalamitas.cs b/NPCs/SupremeCalamitas/SupremeCalamitas.cs index 6849d231a9..28130edbd6 100644 --- a/NPCs/SupremeCalamitas/SupremeCalamitas.cs +++ b/NPCs/SupremeCalamitas/SupremeCalamitas.cs @@ -70,10 +70,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas public const int ThirdBulletHellEndValue = BulletHellDuration * 3; public const int FourthBulletHellEndValue = BulletHellDuration * 4; public const int FifthBulletHellEndValue = BulletHellDuration * 5; - public const int CirrusPhotonRipperDamage = 3725; - private const float CirrusPhotonRipperDashVelocity = 6f; - private const float CirrusPhotonRipperMinDistanceFromTarget = 64f; - private const float CirrusPhotonRipperDashAcceleration = 0.3f; + public const int PermafrostAbsoluteZeroDamage = 3725; + private const float PermafrostPhotonRipperDashVelocity = 6f; + private const float PermafrostPhotonRipperMinDistanceFromTarget = 64f; + private const float PermafrostPhotonRipperDashAcceleration = 0.3f; public float bossLife; public float uDieLul = 1f; @@ -103,7 +103,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public bool spawnArena = false; public bool enteredBrothersPhase = false; public bool hasSummonedBrothers = false; - public bool cirrus = false; + public bool permafrost = false; public bool hasDoneDeathAnim = false; public bool postMusicHit = false; @@ -124,8 +124,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas public int bulletHellCounter2 = 0; public int attackCastDelay = 0; public int hitTimer = 0; - public int alicornFrame = 0; - public int alicornFrameCounter = 0; public int dashVisualCounter = 0; public int preventionPause = 15; // Helps prevent telefragging public int attackPause = 0; @@ -191,17 +189,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static int hoodedHeadIconP2Index; public static int hoodlessHeadIconIndex; public static int hoodlessHeadIconP2Index; - public static int cirrusHeadIconIndex; - public static int cirrusHeadIconP2Index; + public static int permafrostHeadIconIndex; public static float normalDR = 0.25f; public static float enragedDR = 0.9999f; public static readonly Color textColor = Color.Orange; - public static readonly Color cirrusTextColor = Color.Pink; + public static readonly Color permafrostTextColor = Color.LightCyan; public const int sepulcherSpawnCastTime = 75; public const int brothersSpawnCastTime = 150; - public const int MaxCirrusAlcohols = 20; - public const int MaxCirrusAlcoholDebuffDuration = 1500; // Sounds. public static readonly SoundStyle SpawnSound = new("CalamityMod/Sounds/Custom/SupremeCalamitasSpawn") { Volume = 1.2f }; @@ -209,7 +204,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public static readonly SoundStyle BrimstoneShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneShoot"); public static readonly SoundStyle BrotherHit = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersHurt", 2); public static readonly SoundStyle BrotherDeath = new("CalamityMod/Sounds/Custom/SCalSounds/BrothersDeath", 2); - public static readonly SoundStyle CatastropheSwing = new("CalamityMod/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1"); + public static readonly SoundStyle CatastropheSwing = new("CalamityMod/Sounds/Custom/SCalSounds/CatastropheResonanceSlash"); public static readonly SoundStyle BrimstoneBigShotSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneBigShoot"); // DON'T YOU WANNA BE A [BIG SHOT] public static readonly SoundStyle DashSound = new("CalamityMod/Sounds/Custom/SCalSounds/SCalDash"); public static readonly SoundStyle HellblastSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneHellblastSound"); @@ -220,8 +215,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas public SlotId BulletHellRumbleSlot; public static Asset HoodedTexture; - public static Asset CirrusTexture; - public static Asset CirrusTexture2; + public static Asset PermafrostTexture; public static Asset ShieldTopTexture; public static Asset ShieldBottomTexture; public static Asset ForcefieldTexture; @@ -231,13 +225,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas { string hoodedIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodedHeadIcon"; string hoodlessIconPath = "CalamityMod/NPCs/SupremeCalamitas/HoodlessHeadIcon"; - string cirrusIconPath = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon"; - string cirrusIconP2Path = "CalamityMod/NPCs/SupremeCalamitas/CirrusHeadIcon2"; + string permafrostIconPath = "CalamityMod/NPCs/TownNPCs/Archmage_Head"; hoodedHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodedIconPath, -1); hoodlessHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(hoodlessIconPath, -1); - cirrusHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(cirrusIconPath, -1); - cirrusHeadIconP2Index = CalamityMod.Instance.AddBossHeadTexture(cirrusIconP2Path, -1); + permafrostHeadIconIndex = CalamityMod.Instance.AddBossHeadTexture(permafrostIconPath, -1); } public override void SetStaticDefaults() @@ -254,23 +246,28 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!Main.dedServ) { HoodedTexture = ModContent.Request(Texture + "Hooded", AssetRequestMode.AsyncLoad); - CirrusTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus", AssetRequestMode.AsyncLoad); - CirrusTexture2 = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered", AssetRequestMode.AsyncLoad); + PermafrostTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremePermafrost", AssetRequestMode.AsyncLoad); ShieldTopTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldTop", AssetRequestMode.AsyncLoad); ShieldBottomTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/SupremeShieldBottom", AssetRequestMode.AsyncLoad); ForcefieldTexture = ModContent.Request("CalamityMod/NPCs/SupremeCalamitas/ForcefieldTexture", AssetRequestMode.AsyncLoad); } } + public static int DartDamage = 80; // 320 + public static int SkullDamage = 85; // 340 + public static int HellblastDamage = 95; // 380 + public static int FireblastDamage = 95; // 380 + public static int GigablastDamage = 105; // 420 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; - NPC.GetNPCDamage(); + NPC.damage = 210; // 420 NPC.npcSlots = 50f; NPC.width = NPC.height = 44; NPC.defense = 100; NPC.DR_NERD(normalDR); - NPC.value = Item.buyPrice(3, 0, 0, 0); + NPC.value = Item.buyPrice(platinum: 3); NPC.LifeMaxNERB(960000, 1150000, 900000); NPC.aiStyle = -1; AIType = -1; @@ -283,9 +280,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -300,9 +294,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void BossHeadSlot(ref int index) { bool inPhase2 = NPC.ai[0] == 3f; - if (cirrus) + if (permafrost) { - index = inPhase2 ? cirrusHeadIconP2Index : cirrusHeadIconIndex; + index = permafrostHeadIconIndex; } else { @@ -315,8 +309,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void ModifyTypeName(ref string typeName) { - if (cirrus) - typeName = CalamityUtils.GetTextValue("NPCs.SupremeCirrus"); + if (permafrost) + typeName = CalamityUtils.GetTextValue("NPCs.SupremePermafrost"); } public override void SendExtraAI(BinaryWriter writer) @@ -344,7 +338,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas writer.Write(spawnArena); writer.Write(hasSummonedBrothers); writer.Write(enteredBrothersPhase); - writer.Write(cirrus); + writer.Write(permafrost); writer.Write(NPC.dontTakeDamage); writer.Write(NPC.chaseable); @@ -396,7 +390,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas spawnArena = reader.ReadBoolean(); hasSummonedBrothers = reader.ReadBoolean(); enteredBrothersPhase = reader.ReadBoolean(); - cirrus = reader.ReadBoolean(); + permafrost = reader.ReadBoolean(); NPC.dontTakeDamage = reader.ReadBoolean(); NPC.chaseable = reader.ReadBoolean(); @@ -454,39 +448,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (CalamityServerConfig.Instance.BossesStopWeather) CalamityWorld.StopRain(); - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Used for Scal's teleport at the start of brothers phase bool teleport = false; - // cirrus and zenith scal are mutually exclusive unless it's legendary - bool zenithAI = Main.zenithWorld && (!cirrus || (CalamityWorld.LegendaryMode && revenge && cirrus)); + // permafrost and zenith scal are mutually exclusive + bool zenithAI = Main.zenithWorld && !permafrost; // Percent life remaining float lifeRatio = NPC.life / (float)NPC.lifeMax; - // Projectile damage values - int bulletHellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int barrageDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int fireblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int gigablastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int monsterDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int waveDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - int hellblastDamage = NPC.GetProjectileDamage(ModContent.ProjectileType()); - if (bossRush) - { - bulletHellblastDamage /= 2; - barrageDamage /= 2; - fireblastDamage /= 2; - gigablastDamage /= 2; - monsterDamage /= 2; - waveDamage /= 2; - hellblastDamage /= 2; - } - int bulletHellblast = zenithAI ? ModContent.ProjectileType() : ModContent.ProjectileType(); int barrage = ModContent.ProjectileType(); int gigablast = zenithAI ? ModContent.ProjectileType() : ModContent.ProjectileType(); @@ -515,14 +489,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startText) { - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalSummonText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusSummonText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostSummonText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startText = true; } @@ -557,7 +531,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (NPC.Size != hitboxSize) NPC.Size = hitboxSize; bool shouldNotUseShield = bulletHellCounter2 % BulletHellDuration != 0 || attackCastDelay > 0 || - (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) || + (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) || NPC.ai[0] == 1f || NPC.ai[0] == 2f; // Make the shield and forcefield fade away in SCal's acceptance phase. @@ -582,7 +556,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas shieldRotation = shieldRotation.AngleTowards(idealRotation, 0.18f); } } - else if (!cirrus) + else if (!permafrost) { // Emit dust off the skull at the position of its eye socket. for (float num6 = 1f; num6 < 16f; num6 += 1f) @@ -693,13 +667,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region Enrage and DR - if ((spawnArena && !player.Hitbox.Intersects(safeBox)) || bossRush) + if (spawnArena && !player.Hitbox.Intersects(safeBox)) { - float projectileVelocityMultCap = (!player.Hitbox.Intersects(safeBox) && spawnArena) ? 2f : 1.35f; + float projectileVelocityMultCap = 2f; uDieLul = MathHelper.Clamp(uDieLul * 1.01f, 1f, projectileVelocityMultCap); - protectionBoost = !bossRush; - if (!player.Hitbox.Intersects(safeBox)) - protectionBoost = true; + protectionBoost = true; } else { @@ -708,8 +680,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } NPC.Calamity().CurrentlyEnraged = !player.Hitbox.Intersects(safeBox); - // Cirrus fucks mounts if you exit her arena. - if (cirrus) + // Permafrost fucks mounts if you exit his arena. + if (permafrost) { if (!player.Hitbox.Intersects(safeBox) && player.mount.Active) { @@ -786,15 +758,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas forcefieldOpacity = Utils.GetLerpValue(0.1f, 0.6f, NPC.Opacity, true); if (NPC.alpha >= 230) { - if (DownedBossSystem.downedCalamitas && !bossRush) + if (DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive) { // Create a teleport line effect - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = initialRitualPosition; // Make the town NPC spawn. if (Main.netMode != NetmodeID.MultiplayerClient) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, permafrost ? ModContent.NPCType() : ModContent.NPCType()); } NPC.active = false; @@ -804,7 +776,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < MathHelper.Lerp(2f, 6f, 1f - NPC.Opacity); i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.noGravity = true; @@ -872,24 +844,24 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 300 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 600) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from above, left, and right { if (!Main.zenithWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -900,9 +872,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas { attackCastDelay = sepulcherSpawnCastTime; - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i < 100; i++) { @@ -948,9 +920,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); @@ -962,31 +934,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws delicious meat that explode into more meat which doesn't split + if (permafrost) { if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 2f); } } if (bulletHellCounter2 < 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 1500 && bulletHellCounter2 > 1200) { if (bulletHellCounter2 % 180 == 0) // Blasts from right - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -5f * uDieLul, 0f, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 > 1500) { if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); } bulletHellCounter++; @@ -997,21 +969,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 1200 && !Main.zenithWorld) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 1500) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1023,7 +995,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startSecondAttack && lifeRatio <= 0.75f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1035,15 +1007,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBH2Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH2Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH2Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startSecondAttack = true; @@ -1079,23 +1051,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); } #endregion - if (cirrus) + if (permafrost) { Vector2 destination = player.Center; Vector2 distanceFromDestination = destination - NPC.Center; - Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * CirrusPhotonRipperDashVelocity; + Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * PermafrostPhotonRipperDashVelocity; - if (Vector2.Distance(NPC.Center, destination) > CirrusPhotonRipperMinDistanceFromTarget) - NPC.SimpleFlyMovement(desiredVelocity * uDieLul, CirrusPhotonRipperDashAcceleration * uDieLul); + if (Vector2.Distance(NPC.Center, destination) > PermafrostPhotonRipperMinDistanceFromTarget) + NPC.SimpleFlyMovement(desiredVelocity * uDieLul, PermafrostPhotonRipperDashAcceleration * uDieLul); else NPC.velocity *= 0.9f; } @@ -1104,15 +1076,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus uses Photon Ripper - if (bulletHellCounter2 == SecondBulletHellEndValue + 1 && cirrus) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), CirrusPhotonRipperDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); + // Permafrost uses Absolute Zero which acts like Photon Ripper + if (bulletHellCounter2 == SecondBulletHellEndValue + 1 && permafrost) + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), PermafrostAbsoluteZeroDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); bulletHellCounter++; if (bulletHellCounter >= baseBulletHellProjectileGateValue + 4) @@ -1122,21 +1094,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 2100 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 2400) // Blasts from right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1148,7 +1120,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startThirdAttack && lifeRatio <= 0.5f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1160,15 +1132,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBH3Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH3Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH3Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startThirdAttack = true; @@ -1191,9 +1163,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } if (musicSyncCounter == 0 && !postMusicHit) { - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 4f, 17); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 4f, 17); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 3f, 19); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 3f, 19); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i < 30; i++) { @@ -1255,9 +1227,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); @@ -1269,22 +1241,22 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) // More clustered attack { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws Delicious Meat that explodes into more meat that splits + if (permafrost) { if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer, 0f, 2f); } } if (bulletHellCounter2 % 180 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 240 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); int divisor = revenge ? 225 : expertMode ? 450 : 675; @@ -1305,18 +1277,19 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(safeBox.Center(), permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(safeBox.Center() + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), permafrost ? Color.DarkCyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } - Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), monsterDamage, 0f, Main.myPlayer, 0f); + // Whispering Maelstrom passes through normal CanHitPlayer hooks then overrides them. This needs it to have contact damage but the number itself doesn't matter. + Projectile.NewProjectile(NPC.GetSource_FromAI(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), 100, 0f, Main.myPlayer, 0f); } bulletHellCounter++; @@ -1327,21 +1300,21 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 3000 && !Main.zenithWorld) // Blasts from below { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y + 1000f, 0f, -4f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 3300) // Blasts from left { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1353,7 +1326,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startFourthAttack && lifeRatio <= 0.3f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1365,15 +1338,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBH4Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH4Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH4Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startFourthAttack = true; @@ -1409,23 +1382,23 @@ namespace CalamityMod.NPCs.SupremeCalamitas failShotDust.velocity = dustVel * Main.rand.NextFloat(0.3f, 1.3f); failShotDust.scale = Main.rand.NextFloat(2f, 3.2f); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Pink : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.Cyan : Color.Lerp(Color.Red, Color.Magenta, 0.3f), new Vector2(1f, 1f), 0, 0.05f, 4f, 18); GeneralParticleHandler.SpawnParticle(pulse2); SoundEngine.PlaySound(BulletHellEndSound, NPC.Center); } #endregion - if (cirrus) + if (permafrost) { Vector2 destination = player.Center; Vector2 distanceFromDestination = destination - NPC.Center; - Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * CirrusPhotonRipperDashVelocity; + Vector2 desiredVelocity = (distanceFromDestination - NPC.velocity).SafeNormalize(Vector2.UnitY) * PermafrostPhotonRipperDashVelocity; - if (Vector2.Distance(NPC.Center, destination) > CirrusPhotonRipperMinDistanceFromTarget) - NPC.SimpleFlyMovement(desiredVelocity * uDieLul, CirrusPhotonRipperDashAcceleration * uDieLul); + if (Vector2.Distance(NPC.Center, destination) > PermafrostPhotonRipperMinDistanceFromTarget) + NPC.SimpleFlyMovement(desiredVelocity * uDieLul, PermafrostPhotonRipperDashAcceleration * uDieLul); else NPC.velocity *= 0.9f; } @@ -1434,32 +1407,32 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - // Cirrus throws alcohol bottles that explode into Fabstaff Rays - if (cirrus) + // Permafrost throws delicious meat that explode into more delicious meat that doesn't split + if (permafrost) { - // Cirrus uses Photon Ripper + // Permafrost uses Absolute Zero similarly to Photon Ripper if (bulletHellCounter2 == FourthBulletHellEndValue + 1) - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), CirrusPhotonRipperDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.One, ModContent.ProjectileType(), PermafrostAbsoluteZeroDamage, 0f, Main.myPlayer, 0f, 0f, NPC.whoAmI); if (bulletHellCounter2 % 90 == 0) { float bottleSpeed = 12f; Vector2 bottleVelocity = (player.Center + player.velocity * 20f - NPC.Center).SafeNormalize(Vector2.UnitY) * bottleSpeed; - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, bottleVelocity * uDieLul, ModContent.ProjectileType(), 125, 0f, Main.myPlayer); } } if (bulletHellCounter2 % 240 == 0) // Blasts from top - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 5f * uDieLul, fireblast, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 360 == 0) // Fireblasts from above - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 10f * uDieLul, gigablast, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); if (bulletHellCounter2 % 30 == 0) // Projectiles that move in wave pattern { int random = Main.rand.Next(-500, 501); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, wave, waveDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + random, -5f * uDieLul, 0f, wave, SkullDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y - random, 5f * uDieLul, 0f, wave, SkullDamage, 0f, Main.myPlayer, 0f, 2f); } bulletHellCounter++; @@ -1470,25 +1443,25 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float distance = Main.rand.NextBool() ? -1000f : 1000f; float velocity = (distance == -1000f ? 4f : -4f) * uDieLul; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + distance, player.position.Y, velocity, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } if (bulletHellCounter2 < 3900 && !Main.zenithWorld) // Blasts from above { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 4f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else if (bulletHellCounter2 < 4200) // Blasts from left and right { - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3.5f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } else // Blasts from above, left, and right { if (!Main.zenithWorld) - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + Main.rand.Next(-1000, 1001), player.position.Y - 1000f, 0f, 3f * uDieLul, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, bulletHellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X + 1000f, player.position.Y + Main.rand.Next(-1000, 1001), -3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.position.X - 1000f, player.position.Y + Main.rand.Next(-1000, 1001), 3f * uDieLul, 0f, bulletHellblast, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } @@ -1500,7 +1473,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!startFifthAttack && lifeRatio <= 0.1f) { // Bouncy Boulders - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -1513,15 +1486,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } string key = "Mods.CalamityMod.Status.Boss.SCalBH5Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBH5Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBH5Text"; - if (!bossRush) + if (!BossRushEvent.BossRushActive) { - if (DownedBossSystem.downedCalamitas && !cirrus) + if (DownedBossSystem.downedCalamitas && !permafrost) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } startFifthAttack = true; @@ -1533,7 +1506,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (gettingTired5) { - if (cirrus) + if (permafrost) { if (giveUpCounter > 1) { @@ -1546,7 +1519,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (blasterTimer % blasterDivisor == 0) { if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), circleOffset, player.Center, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), circleOffset, player.Center, ModContent.ProjectileType(), 350, 0f, Main.myPlayer, 0f, 1f); } int beamDivisor = 60; @@ -1561,12 +1534,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < totalProjectiles; k++) { Vector2 rayVelocity = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (rayVelocity).SafeNormalize(Vector2.UnitY) * 16f, rayVelocity, ModContent.ProjectileType(), 250, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + (rayVelocity).SafeNormalize(Vector2.UnitY) * 16f, rayVelocity, ModContent.ProjectileType(), 250, 0f, Main.myPlayer); if (proj.WithinBounds(Main.maxProjectiles)) { Main.projectile[proj].DamageType = DamageClass.Default; Main.projectile[proj].friendly = false; Main.projectile[proj].hostile = true; + Main.projectile[proj].tileCollide = false; } } } @@ -1581,8 +1555,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (giveUpCounter == 1) { NPC.velocity = Vector2.Zero; - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.CirrusGiveUpText", cirrusTextColor); - Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Pink); + CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.PermafrostGiveUpText", permafrostTextColor); + Dust.QuickDustLine(NPC.Center, initialRitualPosition, 500f, Color.Cyan); NPC.Center = initialRitualPosition; giveUpCounter--; } @@ -1600,7 +1574,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.active = false; NPC.netUpdate = true; - NPC.NPCLoot(); + + NPC.NPCLoot(); int cryo = NPC.FindFirstNPC(ModContent.NPCType()); + if (cryo > -1) + { + Main.npc[cryo].active = false; + Main.npc[cryo].netUpdate = true; + } } return; @@ -1613,17 +1593,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas { int buffID = NPC.buffType[l]; - bool shouldHalveDuration = DebuffsList.Includes(buffID); + bool shouldHalveDuration = CalamityBuffSets.IsDebuff[buffID]; if (shouldHalveDuration && NPC.buffTime[l] > 4) NPC.buffTime[l] = 4; } - if (!hasDoneDeathAnim && !bossRush) // Scrapped death animation for Scal + if (!hasDoneDeathAnim && !BossRushEvent.BossRushActive) // Scrapped death animation for Scal { attackPause = 5; - Dust.QuickDustLine(NPC.Center, safeBox.Center() + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, safeBox.Center() + new Vector2(0, -30), 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = safeBox.Center() + new Vector2(0, -30); NPC.velocity = new Vector2(10 * NPC.spriteDirection, -7); hasDoneDeathAnim = true; @@ -1635,7 +1615,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Teleport back to the arena on defeat if (giveUpCounter == GiveUpCounterMax) { - Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, initialRitualPosition + new Vector2(0, -30), 500f, permafrost ? Color.Cyan : Color.Red); NPC.Center = initialRitualPosition + new Vector2(0, -30); NPC.noTileCollide = false; NPC.noGravity = false; @@ -1710,7 +1690,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else { - if (bossRush) + if (BossRushEvent.BossRushActive) NPC.Center = initialRitualPosition + new Vector2(0, -30); if (NPC.velocity.Y < 8f) @@ -1718,11 +1698,11 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!canDespawn) NPC.velocity.X *= 0.965f; - if (DownedBossSystem.downedCalamitas || bossRush) + if (DownedBossSystem.downedCalamitas || BossRushEvent.BossRushActive) { if (giveUpCounter == 720) { - if (bossRush) + if (BossRushEvent.BossRushActive) { NPC.chaseable = true; NPC.dontTakeDamage = false; @@ -1732,7 +1712,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1744,15 +1724,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.NPCLoot(); } } - else if (giveUpCounter == 900 && !bossRush) + else if (giveUpCounter == 900 && !BossRushEvent.BossRushActive) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText1", textColor); } - else if (giveUpCounter == 600 && !bossRush) + else if (giveUpCounter == 600 && !BossRushEvent.BossRushActive) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText2", textColor); } - else if (giveUpCounter == 300 && !bossRush) + else if (giveUpCounter == 300 && !BossRushEvent.BossRushActive) { CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.SCalAcceptanceText3", textColor); } @@ -1762,7 +1742,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 24; i++) { Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), DustID.Torch); - brimstoneFire.color = cirrus ? Color.Pink : Color.Red; + brimstoneFire.color = permafrost ? Color.Cyan : Color.Red; brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2f, 3.25f); brimstoneFire.scale = Main.rand.NextFloat(0.95f, 1.15f); brimstoneFire.fadeIn = 1.25f; @@ -1812,15 +1792,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText4"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusBruhText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostBruhText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } gettingTired5 = true; @@ -1828,7 +1808,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (!gettingTired4 && lifeRatio <= 0.02f) { - if (!bossRush && !cirrus) + if (!BossRushEvent.BossRushActive && !permafrost) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText3"; if (DownedBossSystem.downedCalamitas) @@ -1842,7 +1822,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (!gettingTired3 && lifeRatio <= 0.04f) { - if (!bossRush && !cirrus) + if (!BossRushEvent.BossRushActive && !permafrost) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText2"; if (DownedBossSystem.downedCalamitas) @@ -1856,15 +1836,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else if (!gettingTired2 && lifeRatio <= 0.06f) { - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalDesparationText1"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusNonchalantText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostNonchalantText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } gettingTired2 = true; @@ -1875,7 +1855,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas attackCastDelay = sepulcherSpawnCastTime; for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), permafrost ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -1884,7 +1864,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 40; i++) { - Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-70f, 70f), permafrost ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -1925,17 +1905,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #endregion #region TransformSeekerandBrotherTriggers - if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) + if (!halfLife && lifeRatio <= 0.45f && hasSummonedBrothers && (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalPhase2Text"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusPhase2Text"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostPhase2Text"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } halfLife = true; @@ -1945,60 +1925,29 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (!secondStage) { - if (!bossRush) + if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalSeekerRingText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusHallowBossSpamText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostHallowBossSpamText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { - if (cirrus) + if (permafrost) { - // Spawn 1 Providence, 2 Queen Slimes and 2 Empress of Lights - int maximumBullshit = 5; - int angleFromCirrus = 360 / maximumBullshit; - int distanceFromCirrus = 300; - for (int i = 0; i < maximumBullshit; i++) - { - switch (i) - { - case 0: - int npc = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - ModContent.NPCType(), NPC.whoAmI); - Main.npc[npc].timeLeft *= 20; - CalamityUtils.BossAwakenMessage(npc); - break; - - case 1: - case 2: - int npc2 = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - NPCID.HallowBoss, NPC.whoAmI); - Main.npc[npc2].timeLeft *= 20; - break; - - case 3: - case 4: - int npc3 = NPC.NewNPC(NPC.GetSource_FromAI(), - (int)(vectorCenter.X + (Math.Sin(i * angleFromCirrus) * distanceFromCirrus)), - (int)(vectorCenter.Y + (Math.Cos(i * angleFromCirrus) * distanceFromCirrus)), - NPCID.QueenSlimeBoss, NPC.whoAmI); - Main.npc[npc3].timeLeft *= 20; - break; - - default: - break; - } - } + // Spawn a buffed Pyrogen + int npc = NPC.NewNPC(NPC.GetSource_FromAI(), + (int)(vectorCenter.X), + (int)(vectorCenter.Y), + ModContent.NPCType(), NPC.whoAmI); + Main.npc[npc].timeLeft *= 20; + Main.npc[npc].lifeMax = Main.npc[npc].life *= 22; + CalamityUtils.BossAwakenMessage(npc); } else { @@ -2040,7 +1989,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; if (!teleport) { - Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, cirrus ? Color.Pink : Color.Red); + Dust.QuickDustLine(NPC.Center, player.Center + new Vector2(0, -155), 500f, permafrost ? Color.Cyan : Color.Red); NPC.velocity = Vector2.Zero; NPC.Center = player.Center + new Vector2(0, -175); Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, Color.Red, new Vector2(1f, 1f), 0, 0.1f, 5f, 15); @@ -2096,6 +2045,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.dontTakeDamage = true; NPC.chaseable = false; NPC.damage = 0; + attackPause = 5; if (!canDespawn) NPC.velocity *= 0.95f; @@ -2263,13 +2213,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) // fireblasts pre laugh { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.7f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.LightBlue : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } @@ -2282,13 +2232,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(projectileSpawn + velOffset * 2f, velOffset * 0.8f, false, 30, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.LightBlue : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } if (Main.netMode != NetmodeID.MultiplayerClient && attackPause == 0) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } @@ -2304,7 +2254,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 6; i++) // Spread dust for pre laugh floating { Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); - GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.65f, 0.9f), permafrost ? Color.Cyan : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f)); GeneralParticleHandler.SpawnParticle(orb); } @@ -2312,7 +2262,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer, 0, 4f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, DartDamage, 0f, Main.myPlayer, 0, 4f, projectileVelocityToPass); NPC.netUpdate = true; } } @@ -2341,13 +2291,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.netUpdate = true; SoundEngine.PlaySound(DashSound, NPC.Center); - if (cirrus) + if (permafrost) { if (Main.netMode != NetmodeID.MultiplayerClient) { SoundEngine.PlaySound(SoundID.Item60, NPC.Center); float velocity = 8; - int type = ModContent.ProjectileType(); + int type = ModContent.ProjectileType(); int damage = (int)(NPC.damage / 3); Vector2 projectileVelocity = (player.Center - NPC.Center).SafeNormalize(Vector2.UnitY) * velocity; float rotation = MathHelper.ToRadians(22); @@ -2361,6 +2311,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas Main.projectile[p].DamageType = DamageClass.Default; Main.projectile[p].friendly = false; Main.projectile[p].hostile = true; + Main.projectile[p].tileCollide = true; } } } @@ -2476,7 +2427,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 6; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 18, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -2487,14 +2438,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity *= 10f * uDieLul; int projectileType = hellblast; if (attackPause == 0) - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } if (Main.rand.NextBool()) // Hand spray magic { - GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.85f, 1.2f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } @@ -2545,7 +2496,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 25; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + GlowOrbParticle spark2 = new GlowOrbParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.4f, 0.65f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } NPC.localAI[1] = 0f; @@ -2557,7 +2508,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; projectileVelocity *= 5f * uDieLul; int projectileType = gigablast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + if (attackPause == 0) + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); } } @@ -2571,8 +2523,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } - // Previously the 0.4% health threshold transition - if (lifeRatio <= 0.45f && hasSummonedBrothers && (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) + // Previously the 40% health threshold transition + if (lifeRatio <= 0.45f && hasSummonedBrothers && (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : (NPC.AnyNPCs(ModContent.NPCType()) || NPC.AnyNPCs(ModContent.NPCType()))) == false) { NPC.ai[0] = 1f; NPC.ai[1] = 0f; @@ -2617,17 +2569,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas { for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(NPC.Center, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(NPC.Center, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), cirrus ? Color.Magenta : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(NPC.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), permafrost ? Color.LightBlue : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); } - Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, cirrus ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); + Particle pulse = new DirectionalPulseRing(NPC.Center, Vector2.Zero, permafrost ? Color.LightBlue : Color.Red, new Vector2(2f, 2f), 0, 0f, 1.1f, 25); GeneralParticleHandler.SpawnParticle(pulse); SoundEngine.PlaySound(SpawnSound, NPC.Center); @@ -2636,7 +2588,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 4; i++) { - Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone); + Dust brimstoneFire = Dust.NewDustPerfect(NPC.Center + Main.rand.NextVector2Square(-24f, 24f), permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone); brimstoneFire.velocity = Vector2.UnitY * -Main.rand.NextFloat(2.75f, 4.25f); brimstoneFire.noGravity = true; } @@ -2662,7 +2614,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } else { - if (cirrus ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType())) + if (permafrost ? NPC.AnyNPCs(ModContent.NPCType()) : NPC.AnyNPCs(ModContent.NPCType())) { NPC.dontTakeDamage = true; NPC.chaseable = false; @@ -2825,14 +2777,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = false; randomShot = gigablast; - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.92f, 0f, 55); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0.4f, 55); GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } @@ -2843,14 +2795,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas canFireSplitingFireball = false; randomShot = fireblast; - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1.2f, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.95f, 0f, 55); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 1f, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.98f, 0.4f, 55); GeneralParticleHandler.SpawnParticle(pulse2); if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, fireblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, randomShot, FireblastDamage, 0f, Main.myPlayer, 0f, 2f); NPC.netUpdate = true; } } @@ -2866,7 +2818,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 7; i++) // Spred dust while floating post laugh { Vector2 dustVel = (projectileVelocity * 2).RotatedByRandom(0.9) * (Main.rand.NextFloat(0.5f, 1.9f)); - GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(projectileSpawn, dustVel, false, 15, Main.rand.NextFloat(0.75f, 1f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.3f), true, true); GeneralParticleHandler.SpawnParticle(orb); } @@ -2874,7 +2826,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { float projectileVelocityToPass = projectileVelocity.Length() * 1.3f; Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, barrageDamage, 0f, Main.myPlayer, 0f, 4f, projectileVelocityToPass); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, perturbedSpeed, randomShot, DartDamage, 0f, Main.myPlayer, 0f, 4f, projectileVelocityToPass); NPC.netUpdate = true; } } @@ -3009,7 +2961,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int i = 0; i < 9; i++) { Vector2 velOffset = NPC.DirectionTo(player.Center).RotatedByRandom(0.6) * Main.rand.NextFloat(5f, 13f); - PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), cirrus ? Color.HotPink : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); + PointParticle spark2 = new PointParticle(handPosition + velOffset * 2f, velOffset * 1.5f, false, 9, Main.rand.NextFloat(0.5f, 0.75f), permafrost ? Color.Cyan : Main.rand.NextBool(3) ? Color.Lerp(Color.Red, Color.Magenta, 0.3f) : Color.Red); GeneralParticleHandler.SpawnParticle(spark2); } @@ -3020,14 +2972,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas projectileVelocity *= 10f * uDieLul; int projectileType = hellblast; if (attackPause == 0) - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, hellblastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, HellblastDamage, 0f, Main.myPlayer, 0f, 2f); } } } if (Main.rand.NextBool()) // Hand visual post laugh { - GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), cirrus ? Color.Magenta : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); + GlowOrbParticle orb = new GlowOrbParticle(handPosition, new Vector2(0, -6).RotatedByRandom(0.4) * Main.rand.NextFloat(0.8f, 1.4f), false, 15, Main.rand.NextFloat(0.95f, 1.45f), permafrost ? Color.LightBlue : Main.rand.NextBool() ? Color.Red : Color.Lerp(Color.Red, Color.Magenta, 0.5f), true, true); GeneralParticleHandler.SpawnParticle(orb); } Dust fust = Dust.NewDustPerfect(handPosition, Main.rand.NextBool(3) ? 60 : 114); @@ -3085,9 +3037,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 projectileSpawn = NPC.Center + projectileVelocity * 8f; // Release a burst of magic dust when punching. - Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, cirrus ? Color.Pink : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); + Particle pulse = new DirectionalPulseRing(NPC.Center, projectileVelocity * 9, permafrost ? Color.Cyan : Color.Red, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.9f, 0f, 60); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, cirrus ? Color.Pink : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); + Particle pulse2 = new DirectionalPulseRing(NPC.Center, projectileVelocity * 8, permafrost ? Color.Cyan : Color.Magenta, new Vector2(0.5f, 1f), projectileVelocity.ToRotation(), 0.93f, 0.4f, 60); GeneralParticleHandler.SpawnParticle(pulse2); NPC.localAI[1] = 0f; @@ -3097,7 +3049,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas SoundEngine.PlaySound(BrimstoneBigShotSound, NPC.Center); projectileVelocity *= 5f * uDieLul; int projectileType = gigablast; - Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, gigablastDamage, 0f, Main.myPlayer, 0f, 2f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, GigablastDamage, 0f, Main.myPlayer, 0f, 2f); } } @@ -3170,31 +3122,31 @@ namespace CalamityMod.NPCs.SupremeCalamitas castMagicDust.scale = 1.67f; castMagicDust.velocity = Main.rand.NextVector2CircularEdge(0.2f, 0.2f); castMagicDust.fadeIn = 0.67f; - castMagicDust.color = cirrus ? Color.Pink : Color.Red; + castMagicDust.color = permafrost ? Color.Cyan : Color.Red; castMagicDust.noGravity = true; } if (attackCastDelay == 0) { - string key = cirrus ? "Mods.CalamityMod.Status.Boss.CirrusBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalStartText"; + string key = permafrost ? "Mods.CalamityMod.Status.Boss.PermafrostBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalStartText"; if (NPC.life <= NPC.lifeMax * 0.08) - key = cirrus ? "Mods.CalamityMod.Status.Boss.CirrusSecondBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalSepulcher2Text"; + key = permafrost ? "Mods.CalamityMod.Status.Boss.PermafrostSecondBirbSwarmText" : "Mods.CalamityMod.Status.Boss.SCalSepulcher2Text"; if (!BossRushEvent.BossRushActive) { - if (DownedBossSystem.downedCalamitas && !cirrus) + if (DownedBossSystem.downedCalamitas && !permafrost) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } foreach (Vector2 heartSpawnPosition in heartSpawnPositions) { // Make the hearts appear in a burst of flame. - // Spawn Dragonfollies if Cirrus exists. + // Spawn Dragonfollies if Permfroast exists. for (int i = 0; i < 20; i++) { - Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), cirrus ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); + Dust castFire = Dust.NewDustPerfect(heartSpawnPosition + Main.rand.NextVector2Square(-30f, 30f), permafrost ? (int)CalamityDusts.Necroplasm : (int)CalamityDusts.Brimstone); castFire.velocity = Vector2.UnitY.RotatedByRandom(0.08f) * -Main.rand.NextFloat(3f, 4.45f); castFire.scale = Main.rand.NextFloat(1.35f, 1.6f); castFire.fadeIn = 1.25f; @@ -3208,14 +3160,14 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.netMode != NetmodeID.MultiplayerClient) { - if (cirrus) + if (permafrost) { for (int x = 0; x < 5; x++) { - NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), spawnX + 50, tempSpawnY, ModContent.NPCType()); spawnX += spawnXAdd; - NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), spawnX2 - 50, tempSpawnY, ModContent.NPCType()); spawnX2 -= spawnXAdd; tempSpawnY += spawnYAdd; } @@ -3276,9 +3228,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas Vector2 leftDustPosition = Vector2.CatmullRom(leftOfCircle + Vector2.UnitY * 1000f, leftOfCircle, catastropheSpawnPosition, catastropheSpawnPosition + Vector2.UnitY * 1000f, castCompletion); Vector2 rightDustPosition = Vector2.CatmullRom(rightOfCircle + Vector2.UnitY * 1000f, rightOfCircle, cataclysmSpawnPosition, cataclysmSpawnPosition + Vector2.UnitY * 1000f, castCompletion); - GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(leftDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, permafrost ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); - GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, cirrus ? Color.Pink : Color.Red, true, true); + GlowOrbParticle orb2 = new GlowOrbParticle(rightDustPosition, Vector2.Zero, false, 20, 2.8f - attackCastDelay * 0.01f, permafrost ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb2); } @@ -3338,19 +3290,20 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!BossRushEvent.BossRushActive) { string key = "Mods.CalamityMod.Status.Boss.SCalBrothersText"; - if (cirrus) - key = "Mods.CalamityMod.Status.Boss.CirrusDoGText"; + if (permafrost) + key = "Mods.CalamityMod.Status.Boss.PermafrostDoGText"; else if (DownedBossSystem.downedCalamitas) key += "Rematch"; - CalamityUtils.DisplayLocalizedText(key, cirrus ? cirrusTextColor : textColor); + CalamityUtils.DisplayLocalizedText(key, permafrost ? permafrostTextColor : textColor); } if (Main.netMode != NetmodeID.MultiplayerClient) { bool broDirection = Main.rand.NextBool(); - CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == false ? 1 : -1); - CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, cirrus ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == true ? 1 : -1); + CalamityUtils.SpawnBossBetter(catastropheSpawnPosition, permafrost ? ModContent.NPCType() : ModContent.NPCType(), null, broDirection == false ? 1 : -1); + if (!permafrost) + CalamityUtils.SpawnBossBetter(cataclysmSpawnPosition, ModContent.NPCType(), null, broDirection == true ? 1 : -1); } SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/NPCKilled/RavagerDeath1") with { Pitch = -0.2f }, cataclysmSpawnPosition); @@ -3428,7 +3381,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas } #region Loot - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -3447,7 +3400,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas // Spawn the SCal NPC directly where the boss was if (!BossRushEvent.BossRushActive) - NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, cirrus ? ModContent.NPCType() : ModContent.NPCType()); + NPC.NewNPC(NPC.GetSource_FromAI(), (int)NPC.Center.X, (int)NPC.Center.Y + 12, permafrost ? ModContent.NPCType() : ModContent.NPCType()); // Mark Calamitas as defeated DownedBossSystem.downedCalamitas = true; @@ -3506,8 +3459,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas GFBOnly.Add(DropHelper.PerPlayer(ModContent.ItemType()), hideLootReport: true); } - // Legendary seed pony on a stick upgrade - npcLoot.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().cirrus, false), ModContent.ItemType())); + // Legendary seed Coldheart Icicle + npcLoot.Add(ItemDropRule.ByCondition(DropHelper.If(info => info.npc.type == ModContent.NPCType() && info.npc.ModNPC().permafrost, false), ModContent.ItemType())); // Lore npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedCalamitas, ModContent.ItemType(), desc: DropHelper.FirstKillText); @@ -3589,19 +3542,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.frameCounter %= 6; NPC.frame.Y = (int)NPC.frameCounter + (int)FrameType * 6; } - if (cirrus) - { - alicornFrameCounter++; - if (alicornFrameCounter > 6) - { - alicornFrame++; - alicornFrameCounter = 0; - } - if (alicornFrame > 14 || alicornFrame < 9) - { - alicornFrame = 9; - } - } } public override Color? GetAlpha(Color drawColor) => willCharge ? Color.Lerp(Color.Red, drawColor, 0.7f) * NPC.Opacity * 0.45f : null; @@ -3613,23 +3553,17 @@ namespace CalamityMod.NPCs.SupremeCalamitas spriteEffects = SpriteEffects.FlipHorizontally; Texture2D texture2D15 = DownedBossSystem.downedCalamitas && !BossRushEvent.BossRushActive ? TextureAssets.Npc[Type].Value : HoodedTexture.Value; - Texture2D pony = ModContent.Request("CalamityMod/Items/Mounts/AlicornMount_Front").Value; - bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || cirrus); + bool inPhase2 = NPC.ai[0] >= 3f && (NPC.life > NPC.lifeMax * 0.01 || permafrost); - if (cirrus) - texture2D15 = inPhase2 ? CirrusTexture2.Value : CirrusTexture.Value; + if (permafrost) + texture2D15 = PermafrostTexture.Value; Vector2 halfSizeTexture = new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type] / 2f); - Vector2 ponyOrigin = new Vector2(pony.Width / 2f, pony.Height / 30f); int afterimageAmt = 7; Rectangle frame = texture2D15.Frame(2, Main.npcFrameCount[Type], NPC.frame.Y / Main.npcFrameCount[Type], NPC.frame.Y % Main.npcFrameCount[Type]); - Rectangle ponyFrame = pony.Frame(1, 15, 0, alicornFrame); - Vector2 ponyPos = NPC.Center - screenPos; - ponyPos -= new Vector2(pony.Width / 2f, pony.Height / 15) * NPC.scale / 2f; - ponyPos += ponyOrigin * NPC.scale + new Vector2(-20, NPC.gfxOffY); - if (CalamityClientConfig.Instance.Afterimages && !(cirrus && NPC.ai[1] == 2f)) + if (CalamityClientConfig.Instance.Afterimages && !(permafrost && NPC.ai[1] == 2f)) { for (int i = 1; i < afterimageAmt; i += 2) { @@ -3648,7 +3582,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation -= new Vector2(texture2D15.Width / 2f, texture2D15.Height / Main.npcFrameCount[Type]) * NPC.scale / 2f; drawLocation += halfSizeTexture * NPC.scale + new Vector2(0f, NPC.gfxOffY); - if (!(cirrus && NPC.ai[1] == 2f)) + if (!(permafrost && NPC.ai[1] == 2f)) { if (inPhase2) { @@ -3657,7 +3591,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas drawLocation += Main.rand.NextVector2Circular(0.25f, 0.7f); // And gain a flaming aura. - Color auraColor = NPC.GetAlpha(cirrus ? Color.Pink : Color.Red) * 0.4f; + Color auraColor = NPC.GetAlpha(permafrost ? Color.Cyan : Color.Red) * 0.4f; for (int i = 0; i < 7; i++) { Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 4f).ToRotationVector2(); @@ -3671,17 +3605,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (!NPC.IsABestiaryIconDummy) { DrawForcefield(spriteBatch); - if (cirrus) - { - if (NPC.ai[1] == 2f) - { - spriteBatch.Draw(pony, ponyPos, ponyFrame, NPC.GetAlpha(drawColor), NPC.rotation, ponyOrigin, NPC.scale, spriteEffects, 0f); - } - } - else - { - DrawShield(spriteBatch); - } + DrawShield(spriteBatch); } return false; } @@ -3736,7 +3660,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas GameShaders.Misc["CalamityMod:SupremeShield"].UseImage1("Images/Misc/Perlin"); Color forcefieldColor = Color.DarkViolet; - Color secondaryForcefieldColor = (cirrus ? Color.HotPink : Color.Red) * 1.4f; + Color secondaryForcefieldColor = (permafrost ? Color.Cyan : Color.Red) * 1.4f; if (!NPC.dontTakeDamage && willCharge && NPC.ai[1] != 2f) { @@ -3815,7 +3739,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas for (int k = 0; k < 5; k++) { - Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); + Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, hit.HitDirection, -1f, 0, default, 1f); } if (NPC.life <= 0) { @@ -3825,7 +3749,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.position.Y = NPC.position.Y - (NPC.height / 2); for (int i = 0; i < 40; i++) { - int onHitDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + int onHitDust = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[onHitDust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -3835,10 +3759,10 @@ namespace CalamityMod.NPCs.SupremeCalamitas } for (int j = 0; j < 70; j++) { - int onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); + int onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 3f); Main.dust[onHitDust2].noGravity = true; Main.dust[onHitDust2].velocity *= 5f; - onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, cirrus ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); + onHitDust2 = Dust.NewDust(NPC.position, NPC.width, NPC.height, permafrost ? DustID.IceGolem : (int)CalamityDusts.Brimstone, 0f, 0f, 100, default, 2f); Main.dust[onHitDust2].velocity *= 2f; } } @@ -3847,89 +3771,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - { - target.AddBuff(ModContent.BuffType(), 600); - InflictCirrusDebuffs(target); - } - } - - public void InflictCirrusDebuffs(Player target) - { - if (cirrus) - { - switch (Main.rand.Next(MaxCirrusAlcohols)) - { - case 0: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 1: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 2: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 3: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 4: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 5: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 6: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 7: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 8: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 9: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 10: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 11: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 12: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 13: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 14: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 15: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 16: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 17: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 18: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 19: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - case 20: - target.AddBuff(ModContent.BuffType(), MaxCirrusAlcoholDebuffDuration); - break; - } - } } } } diff --git a/NPCs/SupremeCalamitas/SupremeCataclysm.cs b/NPCs/SupremeCalamitas/SupremeCataclysm.cs index f20fb06bb9..c4ff5971a3 100644 --- a/NPCs/SupremeCalamitas/SupremeCataclysm.cs +++ b/NPCs/SupremeCalamitas/SupremeCataclysm.cs @@ -74,10 +74,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } + public static int FistDamage = 100; // 400 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; NPC.width = 120; NPC.height = 120; @@ -94,9 +96,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.localAI[1] = 500; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -181,13 +180,12 @@ namespace CalamityMod.NPCs.SupremeCalamitas } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Increase DR if the target leaves SCal's arena. - NPC.Calamity().DR = SupremeCataclysm.NormalBrothersDR; + NPC.Calamity().DR = NormalBrothersDR; if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().IsTargetOutsideOfArena) NPC.Calamity().DR = SupremeCalamitas.enragedDR; @@ -326,7 +324,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (BigAttackTimer > PreBigAttackPause) { // Shoot fists. - float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (broIsAlive == false ? death ? 1.32f : 1.1f : 1); + float fireRate = MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (!broIsAlive ? death ? 1.32f : 1.1f : 1); PunchCounter += fireRate; if (PunchCounter >= PunchCounterLimit) @@ -339,9 +337,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.zenithWorld) type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; + int damage = Main.zenithWorld ? SupremeCatastrophe.SlashDamage : FistDamage; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -391,9 +387,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { // Shoot fists. - float fireRate = BossRushEvent.BossRushActive ? 2.8f : MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio); + float fireRate = MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio); if (broIsAlive == false) - fireRate = BossRushEvent.BossRushActive ? 3.5f + (29 - BigAttackLimit) * 0.45f : MathHelper.Lerp(3f, (4f + (29 - BigAttackLimit) * 0.45f), 1f - totalLifeRatio) * 1.2f; + fireRate = MathHelper.Lerp(3f, (4f + (29 - BigAttackLimit) * 0.45f), 1f - totalLifeRatio) * 1.2f; if (Phase2 && BigAttackLimit == 0) fireRate = 1; @@ -407,9 +403,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.zenithWorld) type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; + int damage = Main.zenithWorld ? SupremeCatastrophe.SlashDamage : FistDamage; Vector2 fistSpawnPosition = NPC.Center + Vector2.UnitX * 74f * NPC.direction; if ((broIsAlive == false ? BigAttackLimit <= 3 && BigAttackLimit > 0 : BigAttackLimit == 1) && death) @@ -423,7 +417,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas { if (Main.netMode != NetmodeID.MultiplayerClient) { - Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center) * 9.5f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 3); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fistSpawnPosition, NPC.DirectionTo(Target.Center) * 9.5f, ModContent.ProjectileType(), FistDamage, 0f, Main.myPlayer, 0f, PunchingFromRight.ToInt(), 3); } SoundEngine.PlaySound(SupremeCalamitas.BrimstoneShotSound with { Volume = 1.8f, Pitch = 0.5f }, NPC.Center); SoundStyle charge = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3); diff --git a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs index 596c9706a8..e6179b759c 100644 --- a/NPCs/SupremeCalamitas/SupremeCatastrophe.cs +++ b/NPCs/SupremeCalamitas/SupremeCatastrophe.cs @@ -67,10 +67,13 @@ namespace CalamityMod.NPCs.SupremeCalamitas } } + public static int SlashDamage = 100; // 400 + public static int TrailedSlashDamage = 120; // 480 + public override void SetDefaults() { NPC.BossBar = Main.BigBossProgressBar.NeverValid; - NPC.damage = 0; // 0 contact damage, projectile damage is pulled from NPCStats + NPC.damage = 0; // No contact damage NPC.npcSlots = 5f; NPC.width = 120; NPC.height = 120; @@ -87,9 +90,6 @@ namespace CalamityMod.NPCs.SupremeCalamitas NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.localAI[1] = 500; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -175,10 +175,9 @@ namespace CalamityMod.NPCs.SupremeCalamitas } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Increase DR if the target leaves SCal's arena. NPC.Calamity().DR = SupremeCataclysm.NormalBrothersDR; @@ -274,11 +273,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas dashAttackTimer--; int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; - - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, NPC.velocity.SafeNormalize(Vector2.UnitY) * 0.1f, type, damage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 4 + dashes); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, NPC.velocity.SafeNormalize(Vector2.UnitY) * 0.1f, type, TrailedSlashDamage, 0f, Main.myPlayer, 0f, SlashingFromRight.ToInt(), 4 + dashes); dashes++; if (dashes == 30 && broIsAlive == false) { @@ -308,8 +303,8 @@ namespace CalamityMod.NPCs.SupremeCalamitas { SoundStyle slash = new("CalamityMod/Sounds/Item/MurasamaBigSwing"); SoundEngine.PlaySound(slash with { Volume = 0.55f, Pitch = -0.3f }, NPC.Center); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 90f, type, damage, 0f, Main.myPlayer, 0f, 0, 50); - Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 90f, type, damage, 0f, Main.myPlayer, 0f, 0, 50); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(0.34f) * 90f, type, TrailedSlashDamage, 0f, Main.myPlayer, 0f, 0, 50); + Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center + NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 130, NPC.DirectionTo(Target.Center).RotatedBy(-0.34f) * 90f, type, TrailedSlashDamage, 0f, Main.myPlayer, 0f, 0, 50); for (int i = 0; i < 30; i++) { Vector2 vel = new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 2.5f); @@ -373,7 +368,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas else if (BigAttackTimer > PreBigAttackPause) { // Shoot sword slashes. - float fireRate = BossRushEvent.BossRushActive ? 2f : MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (broIsAlive == false ? death ? 1.25f : 1.05f : 1); + float fireRate = MathHelper.Lerp(1.5f, 2f, 1f - totalLifeRatio) * (!broIsAlive ? death ? 1.25f : 1.05f : 1); SlashCounter += fireRate; if (SlashCounter >= SlashCounterLimit) { @@ -385,9 +380,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.zenithWorld) type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; + int damage = Main.zenithWorld ? SupremeCataclysm.FistDamage : SlashDamage; Vector2 slashSpawnPosition = NPC.Center + Vector2.UnitX * 125f * NPC.direction; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -439,7 +432,7 @@ namespace CalamityMod.NPCs.SupremeCalamitas else { // Shoot sword slashes. - float fireRate = BossRushEvent.BossRushActive ? 2.8f : MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio) * (broIsAlive == false ? 1.35f : 1); + float fireRate = MathHelper.Lerp(2.5f, 3f, 1f - totalLifeRatio) * (!broIsAlive ? 1.35f : 1); if (Phase2 && BigAttackLimit == 0) fireRate = 1; SlashCounter += fireRate; @@ -452,14 +445,15 @@ namespace CalamityMod.NPCs.SupremeCalamitas if (Main.zenithWorld) type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - if (bossRush) - damage /= 2; + int damage = Main.zenithWorld ? SupremeCataclysm.FistDamage : SlashDamage; Vector2 slashSpawnPosition = NPC.Center; Vector2 firingVelocity = (broIsAlive == false ? (NPC.DirectionTo(Target.Center) + Target.velocity * 0.032f).SafeNormalize(Vector2.UnitY) : NPC.DirectionTo(Target.Center)); if ((broIsAlive == false ? BigAttackLimit <= 3 && BigAttackLimit > 0 : BigAttackLimit == 1) && death) { + if (!Main.zenithWorld) + damage = TrailedSlashDamage; + Projectile.NewProjectile(NPC.GetSource_FromAI(), slashSpawnPosition + firingVelocity * 130, (Phase2 ? NPC.DirectionTo(Target.Center) : firingVelocity) * 90f, ModContent.ProjectileType(), damage, 0f, Main.myPlayer, 0f, 5, 50); SoundStyle slash = new("CalamityMod/Sounds/Item/MurasamaBigSwing"); SoundEngine.PlaySound(slash with { Volume = 0.55f, Pitch = -0.3f - BigAttackLimit * 0.1f }, NPC.Center); diff --git a/NPCs/SupremeCalamitas/SupremeCirrus.png b/NPCs/SupremeCalamitas/SupremeCirrus.png deleted file mode 100644 index 4412c1c02b..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCirrus.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png b/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png deleted file mode 100644 index 1ce3adfdf2..0000000000 Binary files a/NPCs/SupremeCalamitas/SupremeCirrus_Shimmered.png and /dev/null differ diff --git a/NPCs/SupremeCalamitas/SupremePermafrost.png b/NPCs/SupremeCalamitas/SupremePermafrost.png new file mode 100644 index 0000000000..4e75ae0b28 Binary files /dev/null and b/NPCs/SupremeCalamitas/SupremePermafrost.png differ diff --git a/NPCs/TownNPCs/AndroombaFriendly.cs b/NPCs/TownNPCs/AndroombaFriendly.cs index 0a62a3a2f0..0ce196767d 100644 --- a/NPCs/TownNPCs/AndroombaFriendly.cs +++ b/NPCs/TownNPCs/AndroombaFriendly.cs @@ -65,6 +65,8 @@ namespace CalamityMod.NPCs.TownNPCs NPC.catchItem = (short)ModContent.ItemType(); SpawnModBiomes = new int[1] { ModContent.GetInstance().Type }; NPC.dontTakeDamage = true; + NPC.Calamity().VulnerableToSickness = false; + NPC.Calamity().VulnerableToElectricity = true; } public override bool CanChat() => false; diff --git a/NPCs/TownNPCs/Archmage.cs b/NPCs/TownNPCs/Archmage.cs index 1be98d5a41..9e3e4458ef 100644 --- a/NPCs/TownNPCs/Archmage.cs +++ b/NPCs/TownNPCs/Archmage.cs @@ -65,6 +65,9 @@ namespace CalamityMod.NPCs.TownNPCs NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.8f; AnimationType = NPCID.Guide; + NPC.Calamity().VulnerableToCold = false; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -84,7 +87,13 @@ namespace CalamityMod.NPCs.TownNPCs } } - public override bool CanTownNPCSpawn(int numTownNPCs) => DownedBossSystem.downedCryogen; + public override bool CanTownNPCSpawn(int numTownNPCs) + { + if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) + return false; + + return DownedBossSystem.downedCryogen; + } public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Permafrost") }; @@ -146,25 +155,24 @@ namespace CalamityMod.NPCs.TownNPCs public override void AddShops() { NPCShop shop = new(Type); - shop.Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType(), Condition.DownedMechBossAll) - .Add(ModContent.ItemType(), Condition.DownedMechBossAll) - .Add(ModContent.ItemType(), Condition.DownedMechBossAll) - .Add(ModContent.ItemType(), Condition.DownedMechBossAll) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType(), Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) - .Add(ModContent.ItemType()) + shop.Add() + .Add() + .Add() + .Add(Condition.DownedMechBossAll) + .Add(Condition.DownedMechBossAll) + .Add(Condition.DownedMechBossAll) + .Add(Condition.DownedMechBossAll) + .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add(Condition.DownedEverscream, Condition.DownedSantaNK1, Condition.DownedIceQueen) + .Add() .Add(ItemID.SuperManaPotion) - .Add(ModContent.ItemType()) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(5)) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType(), Condition.PlayerCarriesItem(ModContent.ItemType())) - .Add(ItemID.IceCream, Condition.HappyEnoughToSellPylons, Condition.InSnow) + .Add() + .Add() + .Add() + .Add(Condition.PlayerCarriesItem(ModContent.ItemType())) .Register(); } diff --git a/NPCs/TownNPCs/Bandit.cs b/NPCs/TownNPCs/Bandit.cs index b102150c3c..c87c764726 100644 --- a/NPCs/TownNPCs/Bandit.cs +++ b/NPCs/TownNPCs/Bandit.cs @@ -70,6 +70,9 @@ namespace CalamityMod.NPCs.TownNPCs NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.5f; AnimationType = NPCID.PartyGirl; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToHeat = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -105,7 +108,7 @@ namespace CalamityMod.NPCs.TownNPCs public override List SetNPCNameList() => new List() { - // Patron names + // Dedicated names "Xplizzy", // <@!98826096237109248> (whitegiraffe) "Freakish", // <@!750363283520749598> (freak5650) "Calder", // <@!601897959176798228> (hardlightcaster) @@ -114,6 +117,9 @@ namespace CalamityMod.NPCs.TownNPCs "Jackson", // <@!525827730646892549> (chowchow360) "Altarca", // <@!1140673052108128337> (altarca_27226_49175) "Jackie", // <@!353241811717718016> (jackalchan) + "Ishmael", // <@!840416568000381046> (vanillaoyster) + "Ariallis", // <@!518231218806980609> (ariallis) + "Shade", // <@!613133259563466755> (shade__storm) // Original names this.GetLocalizedValue("Name.Laura"), @@ -161,11 +167,6 @@ namespace CalamityMod.NPCs.TownNPCs if (witch != -1) dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); - //please help me I'm stuck in a children's video game - Fabsol - int cirrusIndex = NPC.FindFirstNPC(ModContent.NPCType()); - if (cirrusIndex != -1) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrusIndex].GivenName)); - int merchantIndex = NPC.FindFirstNPC(NPCID.Merchant); if (merchantIndex != -1) dialogue.Add(this.GetLocalization("Chat.Merchant").Format(Main.npc[merchantIndex].GivenName)); @@ -300,26 +301,23 @@ namespace CalamityMod.NPCs.TownNPCs } public override void AddShops() { - Condition downedCalclone = CalamityConditions.DownedCalamitasClone; - Condition downedDoG = CalamityConditions.DownedDevourerOfGods; - Condition downedYharon = CalamityConditions.DownedYharon; NPCShop shop = new(Type); - shop.AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 9)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 9)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40)) + shop.Add() + .Add() + .Add() + .Add() .Add(ItemID.TigerClimbingGear) - .Add(ModContent.ItemType(), Condition.DownedPirates) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 60), Condition.DownedMechBossAll) - .Add(ModContent.ItemType(), downedCalclone) - .Add(ModContent.ItemType(), Condition.DownedPlantera) - .Add(ModContent.ItemType(), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2), Condition.DownedMoonLord) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(25), downedDoG) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(40), downedYharon) - .Add(ModContent.ItemType()) //:BearWatchingYou: + .Add(Condition.DownedPirates) + .Add(Condition.DownedMechBossAll) + .Add(CalamityConditions.DownedCalamitasClone) + .Add(Condition.DownedPlantera) + .Add(Condition.DownedPlantera) + .Add(Condition.DownedGolem) + .Add(Condition.DownedMoonLord) + .Add(CalamityConditions.DownedDevourerOfGods) + .Add(CalamityConditions.DownedYharon) + .Add() //:BearWatchingYou: .Register(); } diff --git a/NPCs/TownNPCs/BrimstoneWitch.cs b/NPCs/TownNPCs/BrimstoneWitch.cs index 29717bcce1..e2ddf3ba9c 100644 --- a/NPCs/TownNPCs/BrimstoneWitch.cs +++ b/NPCs/TownNPCs/BrimstoneWitch.cs @@ -5,6 +5,7 @@ using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.Items; using CalamityMod.Projectiles.Magic; +using CalamityMod.Systems.Collections; using CalamityMod.UI.CalamitasEnchants; using Microsoft.Xna.Framework; using Terraria; @@ -65,6 +66,9 @@ namespace CalamityMod.NPCs.TownNPCs NPC.HitSound = SoundID.NPCHit1; NPC.DeathSound = SoundID.NPCDeath6; NPC.knockBackResist = 0.8f; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToCold = true; + NPC.Calamity().VulnerableToSickness = true; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -673,10 +677,6 @@ namespace CalamityMod.NPCs.TownNPCs } } - int cirrus = NPC.FindFirstNPC(NPCType()); - if (cirrus != -1 && ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName), 1.45); - if (NPC.AnyNPCs(NPCType())) dialogue.Add(this.GetLocalizedValue("Chat.SeaKing"), 1.45); @@ -686,7 +686,11 @@ namespace CalamityMod.NPCs.TownNPCs return dialogue; } - public override void SetChatButtons(ref string button, ref string button2) => button = this.GetLocalizedValue("EnchantButton"); + public override void SetChatButtons(ref string button, ref string button2) + { + button = this.GetLocalizedValue("EnchantButton"); + button2 = this.GetLocalizedValue("DonorButton"); + } public override void OnChatButtonClicked(bool firstButton, ref string shopName) { @@ -702,6 +706,29 @@ namespace CalamityMod.NPCs.TownNPCs Main.LocalPlayer.Calamity().GivenBrimstoneLocus = true; } } + else + { + Main.npcChatText = GetRandomDonors(25); + } + } + + /// + /// Returns 25 random donator usernames. + /// + public string GetRandomDonors(int numDonors) + { + IList pickingList = [..DonatorsNameList.List]; + + string[] pickedDonors = new string[numDonors]; + for (int i = 0; i < numDonors; ++i) + { + int idxSelected = Main.rand.Next(pickingList.Count); + pickedDonors[i] = pickingList[idxSelected]; + pickingList.RemoveAt(idxSelected); + } + + string text = this.GetLocalization("DonorShoutout").Format(pickedDonors); + return text; } // Make this Town NPC teleport to the Queen statue when triggered. diff --git a/NPCs/TownNPCs/Cirrus.cs b/NPCs/TownNPCs/Cirrus.cs deleted file mode 100644 index cc9e7b0623..0000000000 --- a/NPCs/TownNPCs/Cirrus.cs +++ /dev/null @@ -1,1074 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.Events; -using CalamityMod.Items.Mounts; -using CalamityMod.Items.Placeables.Furniture; -using CalamityMod.Items.Potions.Alcohol; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Summon; -using CalamityMod.Systems.Collections; -using CalamityMod.World; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; -using Terraria; -using Terraria.Audio; -using Terraria.DataStructures; -using Terraria.GameContent; -using Terraria.GameContent.Bestiary; -using Terraria.GameContent.Events; -using Terraria.GameContent.Personalities; -using Terraria.GameContent.UI; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; -using Terraria.Utilities; - -namespace CalamityMod.NPCs.TownNPCs -{ - [AutoloadHead] - [LegacyName("FAP")] - public class Cirrus : ModNPC - { - public static Asset AltTexture; - public static Asset WorkoutTexture; - - public override void SetStaticDefaults() - { - Main.npcFrameCount[Type] = 27; - NPCID.Sets.ExtraFramesCount[Type] = 9; - NPCID.Sets.AttackFrameCount[Type] = 4; - NPCID.Sets.DangerDetectRange[Type] = 400; - NPCID.Sets.AttackType[Type] = 0; - NPCID.Sets.AttackTime[Type] = 60; - NPCID.Sets.AttackAverageChance[Type] = 15; - NPCID.Sets.ShimmerTownTransform[Type] = false; - // Happiness is so fucking dogshit, I swear to christ. - Fabsol - NPC.Happiness - .SetBiomeAffection(AffectionLevel.Love) - .SetBiomeAffection(AffectionLevel.Like) - .SetBiomeAffection(AffectionLevel.Dislike) - .SetBiomeAffection(AffectionLevel.Hate) - .SetNPCAffection(NPCID.Stylist, AffectionLevel.Love) - .SetNPCAffection(NPCID.BestiaryGirl, AffectionLevel.Love) - .SetNPCAffection(NPCID.DyeTrader, AffectionLevel.Like) - .SetNPCAffection(NPCID.PartyGirl, AffectionLevel.Like) - .SetNPCAffection(NPCID.DD2Bartender, AffectionLevel.Dislike) - .SetNPCAffection(NPCID.TaxCollector, AffectionLevel.Dislike) - .SetNPCAffection(NPCID.GoblinTinkerer, AffectionLevel.Hate) - .SetNPCAffection(NPCID.Angler, AffectionLevel.Hate); - NPCID.Sets.NPCBestiaryDrawModifiers drawModifiers = new NPCID.Sets.NPCBestiaryDrawModifiers() - { - Velocity = 1f // Draws the NPC in the bestiary as if its walking +1 tiles in the x direction - }; - NPCID.Sets.NPCBestiaryDrawOffset.Add(NPC.type, drawModifiers); - if (!Main.dedServ) - { - AltTexture = ModContent.Request(Texture + "Alt", AssetRequestMode.AsyncLoad); - WorkoutTexture = ModContent.Request(Texture + "_Workout", AssetRequestMode.AsyncLoad); - } - } - - public override void SetDefaults() - { - NPC.townNPC = true; - NPC.friendly = true; - NPC.lavaImmune = true; - NPC.width = 18; - NPC.height = 40; - NPC.aiStyle = NPCAIStyleID.Passive; - NPC.damage = 10; - NPC.defense = 15; - NPC.lifeMax = 20000; - NPC.HitSound = SoundID.NPCHit1; - NPC.DeathSound = SoundID.NPCDeath6; - NPC.knockBackResist = 0.5f; - } - - public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) - { - bestiaryEntry.Info.AddRange(new IBestiaryInfoElement[] - { - BestiaryDatabaseNPCsPopulator.CommonTags.SpawnConditions.Biomes.TheHallow, - new FlavorTextBestiaryInfoElement("Mods.CalamityMod.Bestiary.Cirrus") - }); - } - - public override void FindFrame(int frameHeight) - { - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - bool workoutOutfit = Main.dayTime && beLessDrunk; - if (workoutOutfit) - frameHeight = 50; - - int extraFrameAmt = (NPC.isLikeATownNPC ? NPCID.Sets.ExtraFramesCount[Type] : 0); - if (NPC.velocity.Y == 0f) - { - if (NPC.direction == 1) - NPC.spriteDirection = 1; - - if (NPC.direction == -1) - NPC.spriteDirection = -1; - - int nonAttackFrames = Main.npcFrameCount[Type] - NPCID.Sets.AttackFrameCount[Type]; - if (NPC.ai[0] == 23f) - { - NPC.frameCounter += 1D; - int currentFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - currentFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && currentFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num239 = ((!(NPC.frameCounter < 6D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)); - if (NPC.ai[1] < 6f) - num239 = nonAttackFrames - 5; - - NPC.frame.Y = frameHeight * num239; - } - else if (NPC.ai[0] >= 20f && NPC.ai[0] <= 22f) - { - int num240 = NPC.frame.Y / frameHeight; - switch ((int)NPC.ai[0]) - { - case 20: - case 21: - case 22: - break; - } - - NPC.frame.Y = num240 * frameHeight; - } - else if (NPC.ai[0] == 2f) - { - NPC.frameCounter += 1D; - if (NPC.frame.Y / frameHeight == nonAttackFrames - 1 && NPC.frameCounter >= 5D) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - else if (NPC.frame.Y / frameHeight == 0 && NPC.frameCounter >= 40D) - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 1); - NPC.frameCounter = 0D; - } - else if (NPC.frame.Y != 0 && NPC.frame.Y != frameHeight * (nonAttackFrames - 1)) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - } - else if (NPC.ai[0] == 5f) // Sitting - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 3); - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 6f) // Throwing confetti - { - NPC.frameCounter += 1D; - int confettiFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - confettiFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && confettiFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int confettiFrame = ((!(NPC.frameCounter < 10D)) ? - ((NPC.frameCounter < 16D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 46D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 60D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 66D)) ? - ((NPC.frameCounter < 72D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 102D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 108D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 114D)) ? - ((NPC.frameCounter < 120D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 150D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 156D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 162D)) ? - ((NPC.frameCounter < 168D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 198D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 204D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 210D)) ? - ((NPC.frameCounter < 216D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 246D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 252D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 258D)) ? - ((NPC.frameCounter < 264D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 294D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 300D) ? - (nonAttackFrames - 5) : 0))) : 0)))) : 0)))) : 0)))) : 0)))) : 0)))) : 0); - - if (confettiFrame == nonAttackFrames - 4 && confettiFrameHeight == nonAttackFrames - 5) - { - Vector2 vector4 = NPC.Center + new Vector2(10 * NPC.direction, -4f); - for (int n = 0; n < 8; n++) - { - int confettiDust = Main.rand.Next(139, 143); - int partyTime = Dust.NewDust(vector4, 0, 0, confettiDust, NPC.velocity.X + (float)NPC.direction, NPC.velocity.Y - 2.5f, 0, default(Color), 1.2f); - Main.dust[partyTime].velocity.X += (float)NPC.direction * 1.5f; - Dust dust = Main.dust[partyTime]; - dust.position -= new Vector2(4f); - dust = Main.dust[partyTime]; - dust.velocity *= 2f; - Main.dust[partyTime].scale = 0.7f + Main.rand.NextFloat() * 0.3f; - } - } - - NPC.frame.Y = frameHeight * confettiFrame; - if (NPC.frameCounter >= 300D) - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 7f || NPC.ai[0] == 19f) // Talking to the player - { - NPC.frameCounter += 1D; - int playerTalkFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - playerTalkFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && playerTalkFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int playerTalkFrame = 0; - if (NPC.frameCounter < 16D) - playerTalkFrame = 0; - else if (NPC.frameCounter == 16D) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 112); - else if (NPC.frameCounter < 128D) - playerTalkFrame = ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0); - else if (NPC.frameCounter < 160D) - playerTalkFrame = 0; - else if (NPC.frameCounter != 160D) - playerTalkFrame = ((NPC.frameCounter < 220D) ? ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0) : 0); - else - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), 60); - - NPC.frame.Y = frameHeight * playerTalkFrame; - if (NPC.frameCounter >= 220D) - NPC.frameCounter = 0D; - } - else if (NPC.ai[0] == 9f) - { - NPC.frameCounter += 1D; - int num251 = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - num251; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num251 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num252 = ((!(NPC.frameCounter < 10D)) ? ((!(NPC.frameCounter < 16D)) ? (nonAttackFrames - 4) : (nonAttackFrames - 5)) : 0); - if (NPC.ai[1] < 16f) - num252 = nonAttackFrames - 5; - - if (NPC.ai[1] < 10f) - num252 = 0; - - NPC.frame.Y = frameHeight * num252; - } - else if (NPC.ai[0] == 18f) - { - NPC.frameCounter += 1D; - int num253 = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - num253; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && num253 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num254 = 0; - if (NPC.frameCounter < 10D) - num254 = 0; - else if (NPC.frameCounter < 16D) - num254 = nonAttackFrames - 1; - else - num254 = nonAttackFrames - 2; - - if (NPC.ai[1] < 16f) - num254 = nonAttackFrames - 1; - - if (NPC.ai[1] < 10f) - num254 = 0; - - num254 = Main.npcFrameCount[Type] - 2; - NPC.frame.Y = frameHeight * num254; - } - else if (NPC.ai[0] == 10f || NPC.ai[0] == 13f) // Attacking - { - NPC.frameCounter += 1D; - int attackFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = attackFrameHeight - nonAttackFrames; - if ((uint)currentFrame > 3u && attackFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int attackTimingStart = 10; - int attackFrameTiming = 6; - int attackFrame = ((!(NPC.frameCounter < (double)attackTimingStart)) ? - ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming)) ? - nonAttackFrames : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 2)) ? - (nonAttackFrames + 1) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 3)) ? - (nonAttackFrames + 2) : ((NPC.frameCounter < (double)(attackTimingStart + attackFrameTiming * 4)) ? - (nonAttackFrames + 3) : 0)))) : 0); - - NPC.frame.Y = frameHeight * attackFrame; - } - else if (NPC.ai[0] == 15f) - { - NPC.frameCounter += 1D; - int num259 = NPC.frame.Y / frameHeight; - int currentFrame = num259 - nonAttackFrames; - if ((uint)currentFrame > 3u && num259 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - float num260 = NPC.ai[1] / (float)NPCID.Sets.AttackTime[Type]; - int num261 = 0; - num261 = ((num260 > 0.65f) ? - nonAttackFrames : ((num260 > 0.5f) ? - (nonAttackFrames + 1) : ((num260 > 0.35f) ? - (nonAttackFrames + 2) : ((num260 > 0f) ? - (nonAttackFrames + 3) : 0)))); - - NPC.frame.Y = frameHeight * num261; - } - else if (NPC.ai[0] == 25f) - { - NPC.frame.Y = frameHeight; - } - else if (NPC.ai[0] == 12f) - { - NPC.frameCounter += 1D; - int num262 = NPC.frame.Y / frameHeight; - int currentFrame = num262 - nonAttackFrames; - if ((uint)currentFrame > 4u && num262 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num263 = nonAttackFrames + NPC.GetShootingFrame(NPC.ai[2]); - NPC.frame.Y = frameHeight * num263; - } - else if (NPC.ai[0] == 14f || NPC.ai[0] == 24f) - { - NPC.frameCounter += 1D; - int num264 = NPC.frame.Y / frameHeight; - int currentFrame = num264 - nonAttackFrames; - if ((uint)currentFrame > 1u && num264 != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - int num265 = 12; - int num266 = ((NPC.frameCounter % (double)num265 * 2D < (double)num265) ? nonAttackFrames : (nonAttackFrames + 1)); - NPC.frame.Y = frameHeight * num266; - if (NPC.ai[0] == 24f) - { - if (NPC.frameCounter == 60D) - EmoteBubble.NewBubble(EmoteID.EmoteConfused, new WorldUIAnchor(NPC), 60); - - if (NPC.frameCounter == 150D) - EmoteBubble.NewBubble(EmoteID.EmotionAlert, new WorldUIAnchor(NPC), 90); - - if (NPC.frameCounter >= 240D) - NPC.frame.Y = 0; - } - } - else if (NPC.ai[0] == 1001f) - { - NPC.frame.Y = frameHeight * (nonAttackFrames - 1); - NPC.frameCounter = 0D; - } - else if (NPC.CanTalk && (NPC.ai[0] == 3f || NPC.ai[0] == 4f)) // Talking to another NPC - { - NPC.frameCounter += 1D; - int npcTalkFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - npcTalkFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && npcTalkFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - bool displayEmote = NPC.ai[0] == 3f; - int npcTalkFrame = 0; - int npcTalkHandFrame = 0; - int emoteDisplayTime = -1; - int emoteDisplayTime2 = -1; - if (NPC.frameCounter < 10D) - npcTalkFrame = 0; - else if (NPC.frameCounter < 16D) - npcTalkFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 46D) - npcTalkFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 60D) - npcTalkFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 216D) - npcTalkFrame = 0; - else if (NPC.frameCounter == 216D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 70; - else if (NPC.frameCounter < 286D) - npcTalkFrame = ((NPC.frameCounter % 12D < 6D) ? (nonAttackFrames - 2) : 0); - else if (NPC.frameCounter < 320D) - npcTalkFrame = 0; - else if (NPC.frameCounter != 320D || Main.netMode == NetmodeID.MultiplayerClient) - npcTalkFrame = ((NPC.frameCounter < 420D) ? ((NPC.frameCounter % 16D < 8D) ? (nonAttackFrames - 2) : 0) : 0); - else - emoteDisplayTime = 100; - - if (NPC.frameCounter < 70D) - { - npcTalkHandFrame = 0; - } - else if (NPC.frameCounter != 70D || Main.netMode == NetmodeID.MultiplayerClient) - { - npcTalkHandFrame = ((NPC.frameCounter < 160D) ? - ((NPC.frameCounter % 16D < 8D) ? - (nonAttackFrames - 2) : 0) : ((NPC.frameCounter < 166D) ? - (nonAttackFrames - 5) : ((NPC.frameCounter < 186D) ? - (nonAttackFrames - 4) : ((NPC.frameCounter < 200D) ? - (nonAttackFrames - 5) : ((!(NPC.frameCounter < 320D)) ? - ((NPC.frameCounter < 326D) ? - (nonAttackFrames - 1) : 0) : 0))))); - } - else - emoteDisplayTime2 = 90; - - if (displayEmote) - { - NPC nPC = Main.npc[(int)NPC.ai[2]]; - if (emoteDisplayTime != -1) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(NPC), emoteDisplayTime, new WorldUIAnchor(nPC)); - - if (emoteDisplayTime2 != -1 && nPC.CanTalk) - EmoteBubble.NewBubbleNPC(new WorldUIAnchor(nPC), emoteDisplayTime2, new WorldUIAnchor(NPC)); - } - - NPC.frame.Y = frameHeight * (displayEmote ? npcTalkFrame : npcTalkHandFrame); - if (NPC.frameCounter >= 420D) - NPC.frameCounter = 0D; - } - else if (NPC.CanTalk && (NPC.ai[0] == 16f || NPC.ai[0] == 17f)) // Rock Paper Scissors - { - NPC.frameCounter += 1D; - int rpsFrameHeight = NPC.frame.Y / frameHeight; - int currentFrame = nonAttackFrames - rpsFrameHeight; - if ((uint)(currentFrame - 1) > 1u && (uint)(currentFrame - 4) > 1u && rpsFrameHeight != 0) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - - bool controlsRPS = NPC.ai[0] == 16f; - int rpsFrame = 0; - int emoteDisplayTime = -1; - if (NPC.frameCounter < 10D) - rpsFrame = 0; - else if (NPC.frameCounter < 16D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 22D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 28D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 34D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 40D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter == 40D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 45; - else if (NPC.frameCounter < 70D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 76D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 82D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 88D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 94D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 100D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter == 100D && Main.netMode != NetmodeID.MultiplayerClient) - emoteDisplayTime = 45; - else if (NPC.frameCounter < 130D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 136D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 142D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 148D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter < 154D) - rpsFrame = nonAttackFrames - 4; - else if (NPC.frameCounter < 160D) - rpsFrame = nonAttackFrames - 5; - else if (NPC.frameCounter != 160D || Main.netMode == NetmodeID.MultiplayerClient) - rpsFrame = ((NPC.frameCounter < 220D) ? (nonAttackFrames - 4) : ((NPC.frameCounter < 226D) ? (nonAttackFrames - 5) : 0)); - else - emoteDisplayTime = 75; - - if (controlsRPS && emoteDisplayTime != -1) - { - int npcPick = (int)NPC.localAI[2]; - int npcWins = (int)NPC.localAI[3]; - int opponentWins = (int)Main.npc[(int)NPC.ai[2]].localAI[3]; - int opponentPick = (int)Main.npc[(int)NPC.ai[2]].localAI[2]; - int rpsGameEnder = 3 - npcPick - npcWins; - int numGamesPlayed = 0; - if (NPC.frameCounter == 40D) - numGamesPlayed = 1; - - if (NPC.frameCounter == 100D) - numGamesPlayed = 2; - - if (NPC.frameCounter == 160D) - numGamesPlayed = 3; - - int gameCountdown = 3 - numGamesPlayed; - int rockPaperScissorsResultType = -1; - int gameFrameTimer = 0; - while (rockPaperScissorsResultType < 0) - { - currentFrame = gameFrameTimer + 1; - gameFrameTimer = currentFrame; - if (currentFrame >= 100) - break; - - rockPaperScissorsResultType = Main.rand.Next(2); - if (rockPaperScissorsResultType == 0 && opponentPick >= npcWins) - rockPaperScissorsResultType = -1; - - if (rockPaperScissorsResultType == 1 && opponentWins >= npcPick) - rockPaperScissorsResultType = -1; - - if (rockPaperScissorsResultType == -1 && gameCountdown <= rpsGameEnder) - rockPaperScissorsResultType = 2; - } - - if (rockPaperScissorsResultType == 0) - { - Main.npc[(int)NPC.ai[2]].localAI[3] += 1f; - opponentWins++; - } - - if (rockPaperScissorsResultType == 1) - { - Main.npc[(int)NPC.ai[2]].localAI[2] += 1f; - opponentPick++; - } - - int emoteType = Utils.SelectRandom(Main.rand, EmoteID.RPSPaper, EmoteID.RPSRock, EmoteID.RPSScissors); - int emoteType2 = emoteType; - switch (rockPaperScissorsResultType) - { - case 0: - switch (emoteType) - { - case EmoteID.RPSPaper: - emoteType2 = EmoteID.RPSRock; - break; - case EmoteID.RPSRock: - emoteType2 = EmoteID.RPSScissors; - break; - case EmoteID.RPSScissors: - emoteType2 = EmoteID.RPSPaper; - break; - } - break; - case 1: - switch (emoteType) - { - case EmoteID.RPSPaper: - emoteType2 = EmoteID.RPSScissors; - break; - case EmoteID.RPSRock: - emoteType2 = EmoteID.RPSPaper; - break; - case EmoteID.RPSScissors: - emoteType2 = EmoteID.RPSRock; - break; - } - break; - } - - if (gameCountdown == 0) - { - if (opponentWins >= 2) - emoteType -= 3; - - if (opponentPick >= 2) - emoteType2 -= 3; - } - - EmoteBubble.NewBubble(emoteType, new WorldUIAnchor(NPC), emoteDisplayTime); - EmoteBubble.NewBubble(emoteType2, new WorldUIAnchor(Main.npc[(int)NPC.ai[2]]), emoteDisplayTime); - } - - NPC.frame.Y = frameHeight * (controlsRPS ? rpsFrame : rpsFrame); - if (NPC.frameCounter >= 420D) - NPC.frameCounter = 0D; - } - else if (NPC.velocity.X == 0f) - { - NPC.frame.Y = 0; - NPC.frameCounter = 0D; - } - else // Walking - { - NPC.frameCounter += Math.Abs(NPC.velocity.X) * 2f; - NPC.frameCounter += 1D; - - int walkFrameHeightLimit = frameHeight * 2; - if (NPC.frame.Y < walkFrameHeightLimit) - NPC.frame.Y = walkFrameHeightLimit; - - int walkFrameTimer = 6; - if (NPC.frameCounter > (double)walkFrameTimer) - { - NPC.frame.Y += frameHeight; - NPC.frameCounter = 0D; - } - - if (NPC.frame.Y / frameHeight >= Main.npcFrameCount[Type] - extraFrameAmt) - NPC.frame.Y = walkFrameHeightLimit; - } - - return; - } - - NPC.frameCounter = 0D; - NPC.frame.Y = frameHeight; - } - - public override void AI() - { - if (!CalamityWorld.spawnedCirrus) - CalamityWorld.spawnedCirrus = true; - } - - // I'm not sure what to do here, because she's always called Cirrus. - Fabsol - /*public override void ModifyTypeName(ref string typeName) - { - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - - if (beLessDrunk) - typeName = "Cirrus"; - }*/ - - public override bool CanTownNPCSpawn(int numTownNPCs) - { - if (NPC.AnyNPCs(ModContent.NPCType()) && Main.zenithWorld) - return false; - - if (CalamityWorld.spawnedCirrus) - return true; - - foreach (Player player in Main.ActivePlayers) - { - bool hasVodka = player.InventoryHas(ModContent.ItemType()) || player.PortableStorageHas(ModContent.ItemType()); - if (hasVodka) - return Main.hardMode; - else - return DownedBossSystem.downedCalamitasClone || NPC.downedPlantBoss; - } - return false; - } - - public override List SetNPCNameList() => new List() { this.GetLocalizedValue("Name.Cirrus") }; - - public override string GetChat() - { - Player player = Main.LocalPlayer; - if (Main.zenithWorld) - { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); - } - - bool worldIsSafer = NPC.downedMoonlord; - - if (CalamityUtils.AnyBossNPCS()) - { - if (!worldIsSafer) - return this.GetLocalizedValue("Chat.BossAlive"); - else - return this.GetLocalizedValue("Chat.BossAliveAlt"); - } - - if (NPC.homeless) - return this.GetLocalizedValue("Chat.Homeless" + Main.rand.Next(1, 2 + 1)); - - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool isHappy = Main.ShopHelper.GetShoppingSettings(player, NPC).PriceAdjustment < 1D; - bool wifeIsAround = wife != -1; - bool wifeIsHappy = wifeIsAround ? Main.ShopHelper.GetShoppingSettings(player, Main.npc[wife]).PriceAdjustment < 1D : false; - bool beLessDrunk = wifeIsAround && worldIsSafer; - bool workoutOutfit = Main.dayTime && beLessDrunk; - - if (Main.bloodMoon) - { - if (Main.rand.NextBool(4)) - { - if (!beLessDrunk) - { - player.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.CirrusSlap" + Main.rand.Next(1, 2 + 1)).ToNetworkText(player.name)), player.statLife / 2, -player.direction, false, false, -1, false); ; - SoundEngine.PlaySound(CnidarianJellyfishOnTheString.SlapSound, player.Center); - return this.GetLocalizedValue("Chat.BloodMoonSlap1"); - } - else - return this.GetLocalizedValue("Chat.BloodMoonSlap2"); - } - return this.GetLocalizedValue("Chat.BloodMoon" + Main.rand.Next(1, 3 + 1)); - } - - WeightedRandom dialogue = new WeightedRandom(); - - if (!beLessDrunk) - { - dialogue.Add(this.GetLocalizedValue("Chat.Normal1")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2")); - - if (Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.Normal3")); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.Normal4")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Normal1Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Normal3Alt")); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalization("Chat.Normal4Alt").Format(Main.npc[wife].GivenName)); - - if (workoutOutfit) - dialogue.Add(this.GetLocalizedValue("Chat.NewOutfit")); - } - - int tavernKeep = NPC.FindFirstNPC(NPCID.DD2Bartender); - if (tavernKeep != -1) - { - dialogue.Add(this.GetLocalization("Chat.Tavernkeep1").Format(Main.npc[tavernKeep].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Tavernkeep2").Format(Main.npc[tavernKeep].GivenName)); - - if (ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.Tavernkeep3")); - } - - int permadong = NPC.FindFirstNPC(ModContent.NPCType()); - if (permadong != -1) - dialogue.Add(this.GetLocalization("Chat.Archmage").Format(Main.npc[permadong].GivenName)); - - int witch = NPC.FindFirstNPC(ModContent.NPCType()); - if (witch != -1) - dialogue.Add(this.GetLocalization("Chat.BrimstoneWitch").Format(Main.npc[witch].GivenName)); - - if (wifeIsAround) - { - if (worldIsSafer) - { - if (wifeIsHappy && isHappy) - dialogue.Add(this.GetLocalization("Chat.Stylist1Alt").Format(Main.npc[wife].GivenName)); - - if (ChildSafety.Disabled) - { - if (!wifeIsHappy || !isHappy) - dialogue.Add(this.GetLocalization("Chat.Stylist2Alt").Format(Main.npc[wife].GivenName)); - - dialogue.Add(this.GetLocalization("Chat.Stylist3Alt").Format(Main.npc[wife].GivenName)); - } - } - else - { - dialogue.Add(this.GetLocalization("Chat.Stylist1").Format(Main.npc[wife].GivenName)); - if (ChildSafety.Disabled) - { - dialogue.Add(this.GetLocalization("Chat.Stylist2").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Stylist3").Format(Main.npc[wife].GivenName)); - } - } - } - - if (Main.dayTime) - { - if (!beLessDrunk) - { - dialogue.Add(this.GetLocalizedValue("Chat.Day1")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Day1Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Day2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Day3Alt")); - } - - if (!isHappy) - { - int annoyingChild = NPC.FindFirstNPC(NPCID.Angler); - if (annoyingChild != -1) - dialogue.Add(this.GetLocalization("Chat.Day4").Format(Main.npc[annoyingChild].GivenName)); - } - else - dialogue.Add(this.GetLocalizedValue("Chat.Day4Alt")); - - if (beLessDrunk) - { - dialogue.Add(this.GetLocalization("Chat.DayStylist1").Format(Main.npc[wife].GivenName)); - dialogue.Add(this.GetLocalization("Chat.DayStylist2").Format(Main.npc[wife].GivenName)); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.DayDrunk1")); - dialogue.Add(this.GetLocalizedValue("Chat.DayDrunk2")); - } - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Night1")); - - if (!isHappy) - { - if (Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.Night2")); - - dialogue.Add(this.GetLocalizedValue("Chat.Night3")); - } - else - { - dialogue.Add(this.GetLocalizedValue("Chat.Night2Alt")); - dialogue.Add(this.GetLocalizedValue("Chat.Night3Alt")); - } - - dialogue.Add(this.GetLocalizedValue("Chat.Night4")); - - if (wifeIsAround) - dialogue.Add(this.GetLocalization("Chat.NightStylist").Format(Main.npc[wife].GivenName)); - } - - // She needs to be drunk to enjoy festive events, otherwise, she dislikes them. - Fabsol - if (BirthdayParty.PartyIsUp) - { - if (!beLessDrunk) - dialogue.Add(this.GetLocalizedValue("Chat.Party")); - else - dialogue.Add(this.GetLocalizedValue("Chat.PartyAlt")); - } - - // She loves her hair and freaks out if it's threatened. Also a reference to the wicked witch of the west. - Fabsol - if (AcidRainEvent.AcidRainEventIsOngoing) - dialogue.Add(this.GetLocalizedValue("Chat.AcidRain")); - - // ayy lmao meme reference (this isn't 4th-wall breaking enough to be put in GFB-only imo). - Fabsol - if (Main.invasionType == InvasionID.MartianMadness) - dialogue.Add(this.GetLocalizedValue("Chat.Martians")); - - // Reference to insane thoughts I had years ago. - Fabsol - if (DownedBossSystem.downedCryogen && ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.CryogenDefeated")); - - // Reference to the old Leviathan sprite. - Fabsol - if (DownedBossSystem.downedLeviathan) - dialogue.Add(this.GetLocalizedValue("Chat.LeviathanDefeated")); - - // Risque tentacle implication... - Fabsol - if (NPC.downedMoonlord && ChildSafety.Disabled) - dialogue.Add(this.GetLocalizedValue("Chat.MoonLordDefeated")); - - // Reference to some crazy shit I thought up at one point. - Fabsol - if (DownedBossSystem.downedPolterghast) - dialogue.Add(this.GetLocalizedValue("Chat.PolterghastDefeated")); - - // MGS2 meme line. - Fabsol - if (DownedBossSystem.downedDoG && Main.zenithWorld) - dialogue.Add(this.GetLocalizedValue("Chat.DoGDefeated")); - - // Cirrus doesn't like the creature. - Fabsol - if (player.Calamity().chibii) - { - if (!isHappy) - dialogue.Add(this.GetLocalizedValue("Chat.HasChibii")); - else - dialogue.Add(this.GetLocalizedValue("Chat.HasChibiiAlt")); - } - - // She likes fish people (including Amidias, but she has no comments for him yet). - Fabsol - if (player.Calamity().aquaticHeart && !player.Calamity().aquaticHeartHide && ChildSafety.Disabled && isHappy) - dialogue.Add(this.GetLocalizedValue("Chat.HasAnahitaTrans")); - - if (player.Calamity().cirrusVodka) - dialogue.Add(this.GetLocalizedValue("Chat.HasVodka")); - - // These are all a bit too risque for children to be seeing lol - Fabsol - if (player.HasItem(ModContent.ItemType()) && ChildSafety.Disabled) - { - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn1")); - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn2")); - dialogue.Add(this.GetLocalizedValue("Chat.HasAlicorn3")); - } - - return dialogue; - } - - public override bool PreDraw(SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) - { - if (Main.LocalPlayer.Calamity().trippy) - return false; - - int wife = NPC.FindFirstNPC(NPCID.Stylist); - bool wifeIsAround = wife != -1; - bool beLessDrunk = wifeIsAround && NPC.downedMoonlord; - bool workoutOutfit = Main.dayTime && beLessDrunk; - var something = NPC.direction == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - - Rectangle frame = NPC.frame; - if (workoutOutfit && !BirthdayParty.PartyIsUp) - frame = new Rectangle(0, NPC.frame.Y, WorkoutTexture.Width(), WorkoutTexture.Height() / Main.npcFrameCount[Type]); - - spriteBatch.Draw(BirthdayParty.PartyIsUp ? AltTexture.Value : workoutOutfit ? WorkoutTexture.Value : TextureAssets.Npc[Type].Value, NPC.Center - screenPos + new Vector2(0, NPC.gfxOffY) - new Vector2(0f, workoutOutfit ? 3f : 6f), frame, drawColor, NPC.rotation, frame.Size() / 2, NPC.scale, something, 0); - return false; - } - - public string Death() - { - int deaths = Main.LocalPlayer.numberOfDeathsPVE; - - string text = this.GetLocalization("DeathCount").Format(deaths); - - if (deaths > 10000) - text += " " + this.GetLocalizedValue("Death10000"); - else if (deaths > 5000) - text += " " + this.GetLocalizedValue("Death5000"); - else if (deaths > 2500) - text += " " + this.GetLocalizedValue("Death2500"); - else if (deaths > 1000) - text += " " + this.GetLocalizedValue("Death1000"); - else if (deaths > 500) - text += " " + this.GetLocalizedValue("Death500"); - else if (deaths > 250) - text += " " + this.GetLocalizedValue("Death250"); - else if (deaths > 100) - text += " " + this.GetLocalizedValue("Death100"); - - text += "\n\n" + this.GetLocalization("DonorShoutout").Format(DonatorsNameList.GetRandomDonors()); - - return text; - } - - public override void SetChatButtons(ref string button, ref string button2) - { - button = Language.GetTextValue("LegacyInterface.28"); - button2 = this.GetLocalizedValue("DeathCountButton"); - } - - public override void OnChatButtonClicked(bool firstButton, ref string shopName) - { - if (firstButton) - { - shopName = "Shop"; - } - else - { - Main.npcChatText = Death(); - } - } - - public override void AddShops() - { - Mod musicMod = ExternalMods.musicMod; - musicMod.TryFind("Interlude1MusicBox", out ModItem interlude1Box); - musicMod.TryFind("Interlude2MusicBox", out ModItem interlude2Box); - musicMod.TryFind("Interlude3MusicBox", out ModItem interlude3Box); - musicMod.TryFind("DevourerofGodsEulogyMusicBox", out ModItem eulogyBox); - - NPCShop shop = new(Type); - shop.AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(silver: 30)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 3)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 4), Condition.DownedMechBossAll) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 6), Condition.DownedPlantera) - .AddWithCustomValue(ItemID.EmpressButterfly, Item.buyPrice(gold: 10), Condition.DownedPlantera) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.BloodMoon) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 8), CalamityConditions.DownedAstrumAureus, Condition.TimeNight) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 10), Condition.DownedGolem) - .AddWithCustomValue(ItemID.BloodyMoscato, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.BananaDaiquiri, Item.buyPrice(silver: 75), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.PeachSangria, Item.buyPrice(silver: 50), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ItemID.PinaColada, Item.buyPrice(gold: 1), Condition.DownedMoonLord, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(2)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(1)) - .AddWithCustomValue(interlude1Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedCalamitasClone) - .AddWithCustomValue(interlude2Box.Type, Item.buyPrice(gold: 10), Condition.DownedMoonLord) - .AddWithCustomValue(interlude3Box.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedYharon) - .AddWithCustomValue(eulogyBox.Type, Item.buyPrice(gold: 10), CalamityConditions.DownedDevourerOfGods) - .AddWithCustomValue(ItemID.UnicornHorn, Item.buyPrice(0, 2, 50), Condition.HappyEnoughToSellPylons, Condition.InHallow) - .AddWithCustomValue(ItemID.Milkshake, Item.buyPrice(gold: 5), Condition.HappyEnoughToSellPylons, Condition.InHallow, Condition.NpcIsPresent(NPCID.Stylist)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 25), Condition.HappyEnoughToSellPylons, Condition.NpcIsPresent(NPCID.Stylist), Condition.NpcIsPresent(NPCID.BestiaryGirl)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 5), Condition.NpcIsPresent(NPCID.Painter)) - .Register(); - } - - // Make this Town NPC teleport to the Queen statue when triggered. - public override bool CanGoToStatue(bool toKingStatue) => !toKingStatue; - - public override void TownNPCAttackStrength(ref int damage, ref float knockback) - { - damage = 60; - knockback = 2f; - } - - public override void TownNPCAttackCooldown(ref int cooldown, ref int randExtraCooldown) - { - cooldown = 60; - randExtraCooldown = 15; - } - - public override void TownNPCAttackProj(ref int projType, ref int attackDelay) - { - projType = ModContent.ProjectileType(); - attackDelay = 1; - } - - public override void TownNPCAttackProjSpeed(ref float multiplier, ref float gravityCorrection, ref float randomOffset) - { - multiplier = 11.5f; - } - } -} diff --git a/NPCs/TownNPCs/Cirrus.png b/NPCs/TownNPCs/Cirrus.png deleted file mode 100644 index adf1db2d15..0000000000 Binary files a/NPCs/TownNPCs/Cirrus.png and /dev/null differ diff --git a/NPCs/TownNPCs/CirrusAlt.png b/NPCs/TownNPCs/CirrusAlt.png deleted file mode 100644 index 45895728f7..0000000000 Binary files a/NPCs/TownNPCs/CirrusAlt.png and /dev/null differ diff --git a/NPCs/TownNPCs/CirrusShimmered_Head.png b/NPCs/TownNPCs/CirrusShimmered_Head.png deleted file mode 100644 index 2de143f847..0000000000 Binary files a/NPCs/TownNPCs/CirrusShimmered_Head.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Head.png b/NPCs/TownNPCs/Cirrus_Head.png deleted file mode 100644 index d4b8a7cb82..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Head.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Head_Alt.png b/NPCs/TownNPCs/Cirrus_Head_Alt.png deleted file mode 100644 index ceb019d692..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Head_Alt.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Shimmered.png b/NPCs/TownNPCs/Cirrus_Shimmered.png deleted file mode 100644 index 14c9b9f3a0..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Shimmered.png and /dev/null differ diff --git a/NPCs/TownNPCs/Cirrus_Workout.png b/NPCs/TownNPCs/Cirrus_Workout.png deleted file mode 100644 index f657fe0c7c..0000000000 Binary files a/NPCs/TownNPCs/Cirrus_Workout.png and /dev/null differ diff --git a/NPCs/TownNPCs/SeaKing.cs b/NPCs/TownNPCs/SeaKing.cs index 9e2c6cd3e8..d7680a3acc 100644 --- a/NPCs/TownNPCs/SeaKing.cs +++ b/NPCs/TownNPCs/SeaKing.cs @@ -61,6 +61,10 @@ namespace CalamityMod.NPCs.TownNPCs NPC.DeathSound = SoundID.NPCDeath1; NPC.knockBackResist = 0.65f; AnimationType = NPCID.Guide; + NPC.Calamity().VulnerableToElectricity = true; + NPC.Calamity().VulnerableToHeat = false; + NPC.Calamity().VulnerableToSickness = true; + NPC.Calamity().VulnerableToWater = false; } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -103,21 +107,16 @@ namespace CalamityMod.NPCs.TownNPCs dialogue.Add(this.GetLocalizedValue("Chat.Night3")); } - int lilBitch = NPC.FindFirstNPC(NPCID.Angler); - if (lilBitch != -1) + int angler = NPC.FindFirstNPC(NPCID.Angler); + if (angler != -1) { - dialogue.Add(this.GetLocalization("Chat.Angler1").Format(Main.npc[lilBitch].GivenName)); - dialogue.Add(this.GetLocalization("Chat.Angler2").Format(Main.npc[lilBitch].GivenName)); + dialogue.Add(this.GetLocalization("Chat.Angler").Format(Main.npc[angler].GivenName)); } int witch = NPC.FindFirstNPC(ModContent.NPCType()); if (witch != -1) dialogue.Add(this.GetLocalizedValue("Chat.BrimstoneWitch")); - int cirrus = NPC.FindFirstNPC(ModContent.NPCType()); - if (cirrus != -1) - dialogue.Add(this.GetLocalization("Chat.DrunkPrincess").Format(Main.npc[cirrus].GivenName)); - int partyGirl = NPC.FindFirstNPC(NPCID.PartyGirl); if (partyGirl != -1) dialogue.Add(this.GetLocalization("Chat.PartyGirl").Format(Main.npc[partyGirl].GivenName)); @@ -199,20 +198,16 @@ namespace CalamityMod.NPCs.TownNPCs } public override void AddShops() { - Condition downedOldDuke = CalamityConditions.DownedOldDuke; - NPCShop shop = new(Type); - shop.Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .Add(ModContent.ItemType()) - .AddWithCustomValue(ItemID.TruffleWorm, Item.buyPrice(gold: 20), Condition.Hardmode) - .AddWithCustomValue(ModContent.ItemType(), Item.buyPrice(gold: 40), downedOldDuke) - .AddWithCustomValue(ItemID.ShrimpPoBoy, Item.buyPrice(gold: 2, silver: 50), Condition.HappyEnoughToSellPylons, Condition.InBeach) - .AddWithCustomValue(ItemID.Fries, Item.buyPrice(gold: 2), Condition.HappyEnoughToSellPylons, Condition.InBeach, Condition.DownedEyeOfCthulhu) + shop.Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .Add() + .AddWithCustomValue(ItemID.TruffleWorm, Item.buyPrice(gold: 25), Condition.Hardmode) + .AddWithCustomValue(Item.buyPrice(platinum: 1), CalamityConditions.DownedOldDuke) .Register(); } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs index be01b55807..cfdfcb7410 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/BrainOfCthulhuAI.cs @@ -16,13 +16,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses private const float SpinVelocity = 12f; private const int SpinRadius = 45; + // Rev+ exclusive + public static float ContactDamageMult = 1.15f; // 62 (buffed from 54) + public static int BloodShotDamage = 12; // 48 + public static bool BuffedBrainofCthulhuAI(NPC npc, Mod mod) { // whoAmI variable NPC.crimsonBoss = npc.whoAmI; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -34,28 +37,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - bool enrage = true; - int targetTileX = (int)Main.player[npc.target].Center.X / 16; - int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); - if (tile.WallType == WallID.CrimstoneUnsafe) - enrage = false; - - float enrageScale = bossRush ? 1.5f : death ? 0.5f : 0f; - if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - if (!Main.player[npc.target].ZoneCrimson || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - // Despawn check - bool despawn = Main.player[npc.target].dead && !bossRush; + bool despawn = (Main.player[npc.target].dead || !Main.player[npc.target].ZoneCrimson) && !BossRushEvent.BossRushActive; // Despawn if (despawn) @@ -69,9 +52,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.localAI[3] > 0f) npc.localAI[3] -= 1f; - // Extra distance for teleports if enraged - int teleportDistanceIncrease = (int)Math.Round(enrageScale * 3); - // Spawn Creepers if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) { @@ -151,26 +131,26 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Super fast spin and charges phase bool phase7 = lifeRatio < 0.1f; - // Spawn Creepers in Master Mode + // Spawn Creepers in Death Mode if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f && death && phase3) { npc.localAI[0] = 2f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 2f && death && phase5) { npc.localAI[0] = 3f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 3f && death && phase7) { npc.localAI[0] = 4f; - SpawnMasterModeCreepers(); + SpawnDeathModeCreepers(); } - void SpawnMasterModeCreepers() + void SpawnDeathModeCreepers() { int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountRevDeath() / 4; float attackTimerIncrement = 15f * 4; @@ -205,7 +185,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Charge variables - float chargeVelocity = (death ? 18f : 15f) + 3f * enrageScale; + float chargeVelocity = death ? 19.5f : 15f; if (phase7) chargeVelocity *= 1.2f; @@ -236,7 +216,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float velocityScale = death ? 6f : 4.5f; float velocityBoost = velocityScale * (1f - lifeRatio); - float nonChargeSpeed = (death ? 24f : 18f) + velocityBoost + 3f * enrageScale; + float nonChargeSpeed = (death ? 25.5f : 18f) + velocityBoost; if (Main.getGoodWorld) nonChargeSpeed *= 1.15f; @@ -244,7 +224,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float maxInertia = death ? 70f : 100f; float inertia = MathHelper.Lerp(minInertia, maxInertia, lifeRatio); - Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero); + Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 10f : Vector2.Zero); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitY) * nonChargeSpeed; npc.velocity = (npc.velocity * (inertia - 1f) + idealVelocity) / inertia; } @@ -268,7 +248,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { // Set damage - npc.damage = npc.defDamage; + npc.damage = (int)Math.Round(npc.defDamage * ContactDamageMult); } // Teleport @@ -290,7 +270,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); // Velocity - npc.velocity = (Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f * enrageScale : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; + npc.velocity = (Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 10f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; if (Main.getGoodWorld) npc.velocity *= 1.15f; } @@ -308,7 +288,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - if (CalamityWorld.LegendaryMode) + if (Main.zenithWorld) { if (!Main.dedServ) { @@ -333,7 +313,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Vector2.Distance(Main.player[npc.target].Center, npc.Center) < minChargeDistance) { npc.ai[2] -= 1f; - npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (-chargeVelocity - 2f * enrageScale); + npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * -chargeVelocity; if (death) npc.velocity *= 1.5f; if (Main.getGoodWorld) @@ -345,7 +325,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] >= timer) { // Shoot projectiles from 4 directions, alternating between diagonal and cardinal - float bloodShotVelocity = (death ? 7.5f : 6f) + enrageScale; + float bloodShotVelocity = death ? 8f : 6f; // Scale projectile velocity float phase7ProjectileVelocityMult = 1.2f; @@ -423,7 +403,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.BloodShot; - int damage = npc.GetProjectileDamage(type); int numProj = death ? 9 : 4; int spread = death ? 32 : 15; if (phase7) @@ -441,7 +420,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int j = 0; j < numProj; j++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), position + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), position + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; if (!canHit) Main.projectile[proj].tileCollide = false; @@ -456,7 +435,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.BloodNautilusShot; - int damage = npc.GetProjectileDamage(type); int numProj = death ? 13 : 7; int spread = death ? 60 : 40; if (phase7) @@ -479,7 +457,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity2.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; if (!canHit2) Main.projectile[proj].tileCollide = false; @@ -501,7 +479,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[0] == -1f || npc.ai[0] == -6f) { // Set damage - npc.damage = npc.defDamage; + npc.damage = (int)Math.Round(npc.defDamage * ContactDamageMult); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -527,7 +505,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!despawn) npc.localAI[1] += 1f; - float teleportGateValue = npc.ai[0] == -6f ? 300f : 210f; + float teleportGateValue = npc.ai[0] == -6f ? 270f : 210f; if (npc.localAI[1] >= teleportGateValue) { npc.localAI[1] = 0f; @@ -571,8 +549,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - int teleportX = Main.rand.Next(minX, maxX + 1) + teleportDistanceIncrease; - int teleportY = Main.rand.Next(minY, maxY + 1) + teleportDistanceIncrease; + int teleportX = Main.rand.Next(minX, maxX + 1); + int teleportY = Main.rand.Next(minY, maxY + 1); if (Main.rand.NextBool()) teleportX *= -1; @@ -699,7 +677,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); float creeperRatio = creeperCount / (float)GetBrainOfCthuluCreepersCountRevDeath(); - float velocityScale = MathHelper.Lerp(0f, 2f, 1f - creeperRatio) + enrageScale; + float velocityScale = MathHelper.Lerp(0f, 2f, 1f - creeperRatio) + (death ? 0.5f : 0f); // Check for phase 2 bool phase2 = creeperCount <= 0; @@ -772,8 +750,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses phase1TeleportTileX = (int)Main.player[npc.target].Center.X / 16; phase1TeleportTileY = (int)Main.player[npc.target].Center.Y / 16; - int min = 28 + teleportDistanceIncrease; - int max = 30 + teleportDistanceIncrease; + int min = 28; + int max = 30; if (Main.rand.NextBool()) phase1TeleportTileX += Main.rand.Next(min, max); @@ -859,23 +837,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) CalamityUtils.CalamityTargeting(npc, default); - float enrageScaleMax = 2f; - float enrageScale = bossRush ? enrageScaleMax : death ? 0.5f : 0f; - if ((npc.position.Y / 16f) < Main.worldSurface) - enrageScale += 0.5f; - if (!Main.player[npc.target].ZoneCrimson) - enrageScale += 1f; - - if (enrageScale > enrageScaleMax) - enrageScale = enrageScaleMax; - bool brainIsNotTeleportingOrCharging = Main.npc[NPC.crimsonBoss].ai[0] == 0f || Main.npc[NPC.crimsonBoss].ai[0] == -1f || Main.npc[NPC.crimsonBoss].ai[0] == -6f; bool brainIsInPhase2 = Main.npc[NPC.crimsonBoss].ai[0] < 0f; @@ -884,7 +851,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (creeperCount > GetBrainOfCthuluCreepersCountRevDeath()) creeperCount = GetBrainOfCthuluCreepersCountRevDeath(); - float creeperRatio = 1f; + float creeperRatio; if (death && brainIsInPhase2) { bool brainIsInPhase3 = Main.npc[NPC.crimsonBoss].localAI[0] == 2f; @@ -898,10 +865,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Scale the aggressiveness of the charges with amount of Creepers remaining float chargeAggressionScale = creeperRatio <= 0.1f ? 1.75f : creeperRatio <= 0.2f ? 1.25f : creeperRatio <= 0.4f ? 0.875f : creeperRatio <= 0.6f ? 0.5f : creeperRatio <= 0.8f ? 0.25f : 0f; - if (enrageScale > 0f) - chargeAggressionScale *= 1f + enrageScale; if (death) - chargeAggressionScale *= 1.25f; + chargeAggressionScale *= 1.875f; // Give off blood dust before charging float beginTelegraphGateValue = TimeBeforeCreeperAttack - CreeperTelegraphTime; @@ -930,8 +895,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float brainXDist = Main.npc[NPC.crimsonBoss].Center.X - creeperCenter.X; float brainYDist = Main.npc[NPC.crimsonBoss].Center.Y - creeperCenter.Y; float brainDistance = (float)Math.Sqrt(brainXDist * brainXDist + brainYDist * brainYDist); - float velocity = (death ? 16f : 8f) + chargeAggressionScale; - velocity += 2f * enrageScale; + float velocity = (death ? 17f : 8f) + chargeAggressionScale; if (brainIsInPhase2) { float velocityFloor = Main.npc[NPC.crimsonBoss].velocity.Length() + velocity * 0.5f; @@ -986,13 +950,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Always fully visible while charging npc.alpha = 0; - float chargeVelocity = (death ? 12f : 6f) + chargeAggressionScale; - chargeVelocity += 2f * enrageScale; + float chargeVelocity = (death ? 13f : 6f) + chargeAggressionScale; float returnToBrainGateValue = 1f; if (!brainIsInPhase2) { // Set damage - npc.damage = npc.defDamage; + npc.damage = (int)Math.Round(npc.defDamage * ContactDamageMult); Vector2 destination = Main.player[npc.target].Center + (death ? Main.player[npc.target].velocity * 20f : Vector2.Zero); Vector2 targetDirection = destination - npc.Center; @@ -1028,8 +991,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ProjectileID.BloodShot; - int damage = npc.GetProjectileDamage(projectileType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, projectileVelocity, projectileType, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, projectileVelocity, projectileType, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; if (!canHit) Main.projectile[proj].tileCollide = false; @@ -1050,440 +1012,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaBrainofCthulhuAI(NPC npc, Mod mod) - { - NPC.crimsonBoss = npc.whoAmI; - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - int brainOfCthuluCreepersCount = GetBrainOfCthuluCreepersCountVanilla(); - for (int num837 = 0; num837 < brainOfCthuluCreepersCount; num837++) - { - float x2 = npc.Center.X; - float y4 = npc.Center.Y; - x2 += (float)Main.rand.Next(-npc.width, npc.width); - y4 += (float)Main.rand.Next(-npc.height, npc.height); - int num838 = NPC.NewNPC(npc.GetSource_FromAI(), (int)x2, (int)y4, NPCID.Creeper); - Main.npc[num838].velocity = new Vector2((float)Main.rand.Next(-30, 31) * 0.1f, (float)Main.rand.Next(-30, 31) * 0.1f); - Main.npc[num838].netUpdate = true; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - int num839 = 6000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num839) - { - npc.active = false; - npc.life = 0; - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - } - } - - if (npc.ai[0] < 0f) - { - // Set damage - npc.damage = npc.defDamage; - - if (Main.getGoodWorld) - NPC.brainOfGravity = npc.whoAmI; - - if (npc.localAI[2] == 0f) - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - npc.localAI[2] = 1f; - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 392); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 393); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 394); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 395); - for (int num840 = 0; num840 < 20; num840++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - npc.dontTakeDamage = false; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - Vector2 vector104 = npc.Center; - float num841 = Main.player[npc.target].Center.X - vector104.X; - float num842 = Main.player[npc.target].Center.Y - vector104.Y; - float num843 = (float)Math.Sqrt(num841 * num841 + num842 * num842); - float num844 = Main.masterMode ? 12f : 8f; - num843 = num844 / num843; - num841 *= num843; - num842 *= num843; - float inertia = Main.masterMode ? 40f : 50f; - npc.velocity.X = (npc.velocity.X * inertia + num841) / (inertia + 1f); - npc.velocity.Y = (npc.velocity.Y * inertia + num842) / (inertia + 1f); - if (npc.ai[0] == -1f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - if (npc.justHit) - npc.localAI[1] -= Main.rand.Next(Main.masterMode ? 3 : 5); - - int num845 = 60 + Main.rand.Next(Main.masterMode ? 60 : 120); - if (Main.netMode != NetmodeID.SinglePlayer) - num845 += Main.rand.Next(Main.masterMode ? 15 : 30, Main.masterMode ? 45 : 90); - - if (npc.localAI[1] >= (float)num845) - { - npc.localAI[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, options); - - int num846 = 0; - Player player2 = Main.player[npc.target]; - do - { - num846++; - int num847 = (int)player2.Center.X / 16; - int num848 = (int)player2.Center.Y / 16; - int minValue = 10; - int num849 = 12; - float num850 = 16f; - int num851 = Main.rand.Next(minValue, num849 + 1); - int num852 = Main.rand.Next(minValue, num849 + 1); - if (Main.rand.NextBool()) - num851 *= -1; - - if (Main.rand.NextBool()) - num852 *= -1; - - Vector2 v = new Vector2(num851 * 16, num852 * 16); - if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), v.SafeNormalize(Vector2.UnitY)) > 0f) - v += v.SafeNormalize(Vector2.Zero) * num850 * player2.velocity.Length(); - - num847 += (int)(v.X / 16f); - num848 += (int)(v.Y / 16f); - if (num846 > 100 || !WorldGen.SolidTile(num847, num848)) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[3] = 0f; - npc.ai[0] = -2f; - npc.ai[1] = num847; - npc.ai[2] = num848; - npc.ForceNetUpdate(); - break; - } - } - while (num846 <= 100); - } - } - } - else if (npc.ai[0] == -2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.9f; - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] += 15f; - else - npc.ai[3] += 25f; - - if (npc.ai[3] >= 255f) - { - npc.ai[3] = 255f; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.ai[0] = -3f; - npc.ForceNetUpdate(); - } - - npc.alpha = (int)npc.ai[3]; - } - else if (npc.ai[0] == -3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode != NetmodeID.SinglePlayer) - npc.ai[3] -= 15f; - else - npc.ai[3] -= 25f; - - if (npc.ai[3] <= 0f) - { - npc.ai[3] = 0f; - npc.ai[0] = -1f; - npc.ForceNetUpdate(); - } - - npc.alpha = (int)npc.ai[3]; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - Vector2 vector105 = npc.Center; - float num853 = Main.player[npc.target].Center.X - vector105.X; - float num854 = Main.player[npc.target].Center.Y - vector105.Y; - float num855 = (float)Math.Sqrt(num853 * num853 + num854 * num854); - float num856 = Main.masterMode ? 2.5f : 1.5f; - if (Main.getGoodWorld) - num856 *= 3f; - - if (num855 < num856) - { - npc.velocity.X = num853; - npc.velocity.Y = num854; - } - else - { - num855 = num856 / num855; - npc.velocity.X = num853 * num855; - npc.velocity.Y = num854 * num855; - } - - if (npc.ai[0] == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num857 = 0; - for (int num858 = 0; num858 < Main.maxNPCs; num858++) - { - if (Main.npc[num858].active && Main.npc[num858].type == NPCID.Creeper) - num857++; - } - - if (num857 == 0) - { - npc.ai[0] = -1f; - npc.localAI[1] = 0f; - npc.alpha = 0; - npc.netUpdate = true; - } - - npc.localAI[1] += 1f; - if (npc.localAI[1] >= (float)(120 + Main.rand.Next(Main.masterMode ? 150 : 300))) - { - npc.localAI[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, options); - - int num859 = 0; - Player player3 = Main.player[npc.target]; - do - { - num859++; - int num860 = (int)player3.Center.X / 16; - int num861 = (int)player3.Center.Y / 16; - int minValue2 = 12; - int num862 = 40; - float num863 = 16f; - int num864 = Main.rand.Next(minValue2, num862 + 1); - int num865 = Main.rand.Next(minValue2, num862 + 1); - if (Main.rand.NextBool()) - num864 *= -1; - - if (Main.rand.NextBool()) - num865 *= -1; - - Vector2 v2 = new Vector2(num864 * 16, num865 * 16); - if (Vector2.Dot(player3.velocity.SafeNormalize(Vector2.UnitY), v2.SafeNormalize(Vector2.UnitY)) > 0f) - v2 += v2.SafeNormalize(Vector2.Zero) * num863 * player3.velocity.Length(); - - num860 += (int)(v2.X / 16f); - num861 += (int)(v2.Y / 16f); - if (num859 > 100 || (!WorldGen.SolidTile(num860, num861) && (num859 > 75 || Collision.CanHit(new Vector2(num860 * 16, num861 * 16), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)))) - { - npc.ai[0] = 1f; - npc.ai[1] = num860; - npc.ai[2] = num861; - npc.netUpdate = true; - break; - } - } - while (num859 <= 100); - } - } - } - else if (npc.ai[0] == 1f) - { - npc.alpha += 5; - if (npc.alpha >= 255) - { - SoundEngine.PlaySound(SoundID.Item8, npc.Center); - npc.alpha = 255; - npc.position.X = npc.ai[1] * 16f - (float)(npc.width / 2); - npc.position.Y = npc.ai[2] * 16f - (float)(npc.height / 2); - npc.ai[0] = 2f; - } - } - else if (npc.ai[0] == 2f) - { - npc.alpha -= 5; - if (npc.alpha <= 0) - { - npc.alpha = 0; - npc.ai[0] = 0f; - } - } - } - - if (Main.player[npc.target].dead || !Main.player[npc.target].ZoneCrimson) - { - if (npc.localAI[3] < 120f) - npc.localAI[3]++; - - if (npc.localAI[3] > 60f) - npc.velocity.Y += (npc.localAI[3] - 60f) * 0.25f; - - npc.ai[0] = 2f; - npc.alpha = 10; - } - else if (npc.localAI[3] > 0f) - npc.localAI[3]--; - - return false; - } - - public static bool VanillaCreeperAI(NPC npc, Mod mod) - { - if (NPC.crimsonBoss < 0) - { - npc.active = false; - npc.netUpdate = true; - return false; - } - - if (Main.masterMode) - npc.knockBackResist = 0f; - - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] = 0f; - float maxVelocity = Main.masterMode ? 10f : 8f; - Vector2 vector106 = npc.Center; - float num866 = Main.npc[NPC.crimsonBoss].Center.X - vector106.X; - float num867 = Main.npc[NPC.crimsonBoss].Center.Y - vector106.Y; - float num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); - if (num868 > 90f) - { - num868 = maxVelocity / num868; - num866 *= num868; - num867 *= num868; - npc.velocity.X = (npc.velocity.X * 15f + num866) / 16f; - npc.velocity.Y = (npc.velocity.Y * 15f + num867) / 16f; - return false; - } - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < maxVelocity) - { - float velocityMult = Main.masterMode ? 1.07f : 1.05f; - npc.velocity.Y *= velocityMult; - npc.velocity.X *= velocityMult; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && ((Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 100)) || Main.rand.NextBool(200))) - { - CalamityUtils.CalamityTargeting(npc, default); - - vector106 = npc.Center; - num866 = Main.player[npc.target].Center.X - vector106.X; - num867 = Main.player[npc.target].Center.Y - vector106.Y; - num868 = (float)Math.Sqrt(num866 * num866 + num867 * num867); - num868 = maxVelocity / num868; - npc.velocity.X = num866 * num868; - npc.velocity.Y = num867 * num868; - npc.ai[0] = 1f; - npc.netUpdate = true; - } - - return false; - } - - // Set damage - npc.damage = npc.defDamage; - - if (Main.expertMode) - { - Vector2 vector107 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - if (Main.getGoodWorld) - { - vector107 *= 12f; - npc.velocity = (npc.velocity * 49f + vector107) / 50f; - } - else - { - float chargeVelocity = Main.masterMode ? 10f : 9f; - vector107 *= chargeVelocity; - float inertia = Main.masterMode ? 75f : 100f; - npc.velocity = (npc.velocity * (inertia - 1f) + vector107) / inertia; - } - } - - Vector2 vector108 = npc.Center; - float num869 = Main.npc[NPC.crimsonBoss].Center.X - vector108.X; - float num870 = Main.npc[NPC.crimsonBoss].Center.Y - vector108.Y; - float num871 = (float)Math.Sqrt(num869 * num869 + num870 * num870); - if (num871 > 700f) - { - npc.ai[0] = 0f; - } - else - { - if (!npc.justHit) - return false; - - if (npc.knockBackResist == 0f) - { - npc.ai[1] += 1f; - float returnToBrainGateValue = Main.masterMode ? 35f : 5f; - if (npc.ai[1] > returnToBrainGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 0f; - } - } - else - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 0f; - } - } - - return false; - } - public static int GetBrainOfCthuluCreepersCountRevDeath() { - return CalamityWorld.LegendaryMode ? 40 : Main.getGoodWorld ? 35 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; - } - - public static int GetBrainOfCthuluCreepersCountVanilla() - { - return Main.getGoodWorld ? 40 : Main.masterMode ? 30 : 20; + return Main.getGoodWorld ? 40 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 30 : 20; } private static float GetCrimsonBossKnockBack(NPC npc, int numPlayers, float lifeScale, float baseKnockBackResist) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs index 2e195a2c06..9c2853f6ba 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/CultistAI.cs @@ -13,6 +13,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class CultistAI { + // Vanilla values + public static int CloneFireballDamage = 18; // 72 + public static int FireballDamage = 20; // 80 + public static int IceMistDamage = 25; // 100 + public static int LightningDamage = 30; // 120 + public static int DoomDamage = 45; // 180 (Also fixes Master Mode scaling) + public static bool BuffedCultistAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -35,8 +42,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool phase2 = lifeRatio < 0.85f || death; bool phase3 = lifeRatio < 0.7f || death; bool phase4 = lifeRatio < (death ? 0.8f : 0.55f); @@ -53,9 +59,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float distanceAboveTarget = -240f; float moveSpeed = death ? 300f : 75f; - int iceMistDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossIceMist) : 0; - int fireballDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossFireBall) : npc.GetProjectileDamage(ProjectileID.CultistBossFireBallClone); - int lightningDamage = isCultist ? npc.GetProjectileDamage(ProjectileID.CultistBossLightningOrb) : 0; + int iceMistDamage = isCultist ? IceMistDamage : 0; + int fireballDamage = isCultist ? FireballDamage : CloneFireballDamage; + int lightningDamage = isCultist ? LightningDamage : 0; int iceMistFireRate = phase2 ? 50 : 60; float iceMistSpeed = (phase6 ? 12f : 10f) + (death ? (1f - lifeRatio) : 0f); @@ -70,24 +76,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int idleTime = phase8 ? 20 : phase7 ? 30 : phase3 ? 35 : 40; float timeToFinishRitual = phase8 ? 180f : phase7 ? 240f : phase5 ? 300f : 360f; - if (bossRush) - { - iceMistFireRate = 40; - iceMistSpeed = 14f; - iceMistAmt = 3; - fireballFireRate = 8; - fireballSpeed *= 1.2f; - lightningOrbPhaseTime = 90; - ancientLightSpawnRate = 20; - ancientLightAmt = 4; - idleTime = 20; - } - if (Main.getGoodWorld) { - iceMistFireRate = 30; + iceMistFireRate = 40; iceMistSpeed = 15f; - fireballFireRate = 6; + fireballFireRate = 8; fireballSpeed *= 1.25f; lightningOrbPhaseTime = 60; ancientLightSpawnRate = 10; @@ -108,7 +101,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Enrage - if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height) || CalamityWorld.LegendaryMode) + if (!Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { calamityGlobalNPC.newAI[0] += 1f; if (calamityGlobalNPC.newAI[0] >= 120f) @@ -157,13 +150,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); npc.netUpdate = true; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); - } - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; Main.projectile[(int)npc.ai[2]].netUpdate = true; } @@ -537,7 +523,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 shadowFireballDirection = center4 + new Vector2(npc.direction * 30, 12f); Vector2 shadowFireballVelocity = playerDirection * (fireballSpeed + (float)Main.rand.NextDouble()); shadowFireballVelocity = shadowFireballVelocity.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, fireballDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), shadowFireballDirection, shadowFireballVelocity, ProjectileID.CultistBossFireBallClone, CloneFireballDamage, 0f, Main.myPlayer); } } } @@ -1072,7 +1058,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (CalamityGlobalNPC.adultEidolonWyrmHead != -1) { if (Main.npc[CalamityGlobalNPC.adultEidolonWyrmHead].active) - npc.damage *= 3; + npc.damage = (int)Math.Round(npc.defDamage * PrimordialWyrmHead.LightDamageMult); } } @@ -1101,8 +1087,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedAncientDoomAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; npc.damage = npc.defDamage = 0; float duration = 420f; float spawnAnimTime = 120f; @@ -1201,1207 +1186,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] >= duration) { int type = ProjectileID.AncientDoomProjectile; - int damage = npc.GetProjectileDamage(type); + int damage = DoomDamage; - // Triple damage if the Primordial Wyrm is alive + // Increase damage if the Primordial Wyrm is alive if (Main.npc[(int)npc.ai[0]].type == ModContent.NPCType()) - damage *= 3; + damage = (int)Math.Round(damage * PrimordialWyrmHead.DoomDamageMult); kill = true; if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = CalamityWorld.LegendaryMode ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : death ? 5 : 4; - float radians = MathHelper.TwoPi / totalProjectiles; - Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); - for (int k = 0; k < totalProjectiles; k++) - { - Vector2 doomProjRotate = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, doomProjRotate, type, damage, 0f, Main.myPlayer); - } - } - } - - if (kill) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - - return false; - } - - public static bool VanillaCultistAI(NPC npc, Mod mod) - { - // Chant sound - if (npc.ai[0] != -1f && Main.rand.NextBool(1000)) - { - SoundStyle chantSound = Utils.SelectRandom(Main.rand, new SoundStyle[] - { - SoundID.Zombie88, - SoundID.Zombie89, - SoundID.Zombie90, - SoundID.Zombie91 - }); - - SoundEngine.PlaySound(chantSound, npc.Center); - } - - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - - bool phase2 = npc.life <= npc.lifeMax / 2; - - int iceMistPhaseTime = masterMode ? 60 : expertMode ? 90 : 120; - if (Main.getGoodWorld) - iceMistPhaseTime -= 30; - - int fireballPhaseTime = Main.getGoodWorld ? 8 : masterMode ? 10 : expertMode ? 12 : 18; - int fireballAmount = Main.getGoodWorld ? 6 : masterMode ? 5 : expertMode ? 4 : 3; - - int lightningOrbPhaseTime = masterMode ? 30 : expertMode ? 40 : 80; - if (Main.getGoodWorld) - lightningOrbPhaseTime -= 20; - - int ancientLightPhaseTime = masterMode ? 40 : expertMode ? 30 : 20; - int ancientLightAmount = masterMode ? 4 : expertMode ? 3 : 2; - - int ancientDoomPhaseTime = masterMode ? 30 : 20; - int ancientDoomAmount = masterMode ? 5 : 3; - - int ritualTimeMax = phase2 ? 240 : 300; - - bool flag2 = npc.type == NPCID.CultistBoss; - bool flag3 = false; - bool flag4 = false; - if (phase2) - npc.defense = (int)Math.Round(npc.defDefense * 0.65); - - if (!flag2) - { - if (npc.ai[3] < 0f || !Main.npc[(int)npc.ai[3]].active || Main.npc[(int)npc.ai[3]].type != NPCID.CultistBoss) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - return false; - } - - npc.ai[0] = Main.npc[(int)npc.ai[3]].ai[0]; - npc.ai[1] = Main.npc[(int)npc.ai[3]].ai[1]; - if (npc.ai[0] == 5f) - { - if (npc.justHit) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - - NPC obj = Main.npc[(int)npc.ai[3]]; - obj.ai[0] = 6f; - obj.ai[1] = 0f; - obj.netUpdate = true; - } - } - else - { - flag3 = true; - flag4 = true; - } - } - else if (npc.ai[0] == 5f && npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax && npc.justHit) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - List list = new List(); - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.CultistBossClone && Main.npc[i].ai[3] == (float)npc.whoAmI) - list.Add(i); - } - - int num9 = expertMode ? 3 : 10; - foreach (int item in list) - { - NPC nPC = Main.npc[item]; - if (nPC.localAI[1] == npc.localAI[1] && num9 > 0) - { - num9--; - nPC.life = 0; - nPC.HitEffect(); - nPC.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, item); - } - else if (num9 > 0) - { - num9--; - nPC.life = 0; - nPC.HitEffect(); - nPC.active = false; - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (expertMode) - { - if (!NPC.AnyNPCs(NPCID.AncientCultistSquidhead)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)Main.projectile[(int)npc.ai[2]].Center.X, (int)Main.projectile[(int)npc.ai[2]].Center.Y, NPCID.AncientCultistSquidhead); - } - } - - Main.projectile[(int)npc.ai[2]].ai[1] = -1f; - Main.projectile[(int)npc.ai[2]].netUpdate = true; - } - - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; - float num10 = 5600f; - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - if (player.dead || !player.active || Vector2.Distance(player.Center, center) > num10) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - - new List().Add(npc.whoAmI); - for (int j = 0; j < Main.maxNPCs; j++) - { - if (Main.npc[j].active && Main.npc[j].type == NPCID.CultistBossClone && Main.npc[j].ai[3] == (float)npc.whoAmI) - { - Main.npc[j].life = 0; - Main.npc[j].HitEffect(); - Main.npc[j].active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - } - } - } - - float num11 = npc.ai[3]; - if (npc.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Zombie89, npc.Center); - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - if (npc.ai[0] == -1f) - { - npc.alpha -= 5; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] += 1f; - if (npc.ai[1] >= 420f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[1] > 360f) - { - npc.velocity *= 0.95f; - if (npc.localAI[2] != 13f) - SoundEngine.PlaySound(SoundID.Zombie105, npc.Center); - - npc.localAI[2] = 13f; - } - else if (npc.ai[1] > 300f) - { - npc.velocity = -Vector2.UnitY; - npc.localAI[2] = 10f; - } - else if (npc.ai[1] > 120f) - npc.localAI[2] = 1f; - else - npc.localAI[2] = 0f; - - flag3 = true; - flag4 = true; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - } - - npc.localAI[2] = 10f; - int num12 = Math.Sign(player.Center.X - center.X); - if (num12 != 0) - npc.direction = (npc.spriteDirection = num12); - - npc.ai[1] += 1f; - if (npc.ai[1] >= 40f && flag2) - { - int num13 = 0; - if (phase2) - { - switch ((int)npc.ai[3]) - { - case 0: - num13 = 0; - break; - case 1: - num13 = 1; - break; - case 2: - num13 = 0; - break; - case 3: - num13 = 5; - break; - case 4: - num13 = 0; - break; - case 5: - num13 = 3; - break; - case 6: - num13 = 0; - break; - case 7: - num13 = 5; - break; - case 8: - num13 = 0; - break; - case 9: - num13 = 2; - break; - case 10: - num13 = 0; - break; - case 11: - num13 = 3; - break; - case 12: - num13 = 0; - break; - case 13: - num13 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - else - { - switch ((int)npc.ai[3]) - { - case 0: - num13 = 0; - break; - case 1: - num13 = 1; - break; - case 2: - num13 = 0; - break; - case 3: - num13 = 2; - break; - case 4: - num13 = 0; - break; - case 5: - num13 = 3; - break; - case 6: - num13 = 0; - break; - case 7: - num13 = 1; - break; - case 8: - num13 = 0; - break; - case 9: - num13 = 2; - break; - case 10: - num13 = 0; - break; - case 11: - num13 = 4; - npc.ai[3] = -1f; - break; - default: - npc.ai[3] = -1f; - break; - } - } - - int maxValue = 6; - if (npc.life < npc.lifeMax / 3) - maxValue = 4; - if (npc.life < npc.lifeMax / 4) - maxValue = 3; - if (masterMode) - maxValue--; - - if (expertMode && phase2 && Main.rand.NextBool(maxValue) && num13 != 0 && num13 != 4 && num13 != 5 && NPC.CountNPCS(NPCID.AncientDoom) < 10) - num13 = 6; - - if (num13 == 0) - { - float num14 = (float)Math.Ceiling((player.Center + new Vector2(0f, -100f) - center).Length() / 50f); - if (num14 == 0f) - num14 = 1f; - - List list2 = new List(); - int num15 = 0; - list2.Add(npc.whoAmI); - for (int k = 0; k < Main.maxNPCs; k++) - { - if (Main.npc[k].active && Main.npc[k].type == NPCID.CultistBossClone && Main.npc[k].ai[3] == (float)npc.whoAmI) - list2.Add(k); - } - - bool flag5 = list2.Count % 2 == 0; - foreach (int item2 in list2) - { - NPC nPC2 = Main.npc[item2]; - Vector2 center2 = nPC2.Center; - float num16 = (float)((num15 + flag5.ToInt() + 1) / 2) * MathHelper.TwoPi * 0.4f / (float)list2.Count; - if (num15 % 2 == 1) - num16 *= -1f; - - if (list2.Count == 1) - num16 = 0f; - - Vector2 vector = new Vector2(0f, -1f).RotatedBy(num16) * new Vector2(300f, 200f); - Vector2 vector2 = player.Center + vector - center2; - nPC2.ai[0] = 1f; - nPC2.ai[1] = num14 * 2f; - nPC2.velocity = vector2 / num14; - if (npc.whoAmI >= nPC2.whoAmI) - nPC2.position -= nPC2.velocity; - - nPC2.netUpdate = true; - num15++; - } - } - - switch (num13) - { - case 1: - npc.ai[0] = 3f; - npc.ai[1] = 0f; - break; - case 2: - npc.ai[0] = 2f; - npc.ai[1] = 0f; - break; - case 3: - npc.ai[0] = 4f; - npc.ai[1] = 0f; - break; - case 4: - npc.ai[0] = 5f; - npc.ai[1] = 0f; - break; - } - - if (num13 == 5) - { - npc.ai[0] = 7f; - npc.ai[1] = 0f; - } - - if (num13 == 6) - { - npc.ai[0] = 8f; - npc.ai[1] = 0f; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - flag3 = true; - npc.localAI[2] = 10f; - if ((float)(int)npc.ai[1] % 2f != 0f && npc.ai[1] != 1f) - npc.position -= npc.velocity; - - npc.ai[1] -= 1f; - if (npc.ai[1] <= 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - npc.localAI[2] = 11f; - Vector2 vec = Vector2.Normalize(player.Center - center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % iceMistPhaseTime == 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - List list3 = new List(); - for (int l = 0; l < Main.maxNPCs; l++) - { - if (Main.npc[l].active && Main.npc[l].type == NPCID.CultistBossClone && Main.npc[l].ai[3] == (float)npc.whoAmI) - list3.Add(l); - } - - foreach (int item3 in list3) - { - NPC nPC3 = Main.npc[item3]; - Vector2 center3 = nPC3.Center; - int num17 = Math.Sign(player.Center.X - center3.X); - if (num17 != 0) - nPC3.direction = (nPC3.spriteDirection = num17); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - center3); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 vector3 = center3 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint = vec * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint = spinninpoint.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector3, spinninpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec = Vector2.Normalize(player.Center - center); - if (vec.HasNaNs()) - vec = new Vector2(npc.direction, 0f); - - Vector2 vector4 = npc.Center + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossIceMist; - int numIceMists = masterMode ? 3 : expertMode ? 2 : 1; - float iceMistVelocity = masterMode ? 8f : expertMode ? 6f : 4f; - for (int n = 0; n < numIceMists; n++) - { - Vector2 vector5 = vec * (iceMistVelocity - n * 2f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector4, vector5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, 1f); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + iceMistPhaseTime)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - npc.localAI[2] = 11f; - Vector2 vec2 = Vector2.Normalize(player.Center - center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % fireballPhaseTime == 0) - { - if ((int)(npc.ai[1] - 4f) / fireballPhaseTime == 2) - { - List list4 = new List(); - for (int num18 = 0; num18 < Main.maxNPCs; num18++) - { - if (Main.npc[num18].active && Main.npc[num18].type == NPCID.CultistBossClone && Main.npc[num18].ai[3] == (float)npc.whoAmI) - list4.Add(num18); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - foreach (int item4 in list4) - { - NPC nPC4 = Main.npc[item4]; - Vector2 center4 = nPC4.Center; - int num19 = Math.Sign(player.Center.X - center4.X); - if (num19 != 0) - nPC4.direction = (nPC4.spriteDirection = num19); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec2 = Vector2.Normalize(player.Center - center4); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - Vector2 vector6 = center4 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint2 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint2 = spinninpoint2.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector6, spinninpoint2, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - } - - int num21 = Math.Sign(player.Center.X - center.X); - if (num21 != 0) - npc.direction = (npc.spriteDirection = num21); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec2 = Vector2.Normalize(player.Center - center); - if (vec2.HasNaNs()) - vec2 = new Vector2(npc.direction, 0f); - - Vector2 vector7 = npc.Center + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBall; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - double spread = Math.PI / (masterMode ? 4D : expertMode ? 5D : 6D); - Vector2 spinninpoint3 = vec2 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint3 = spinninpoint3.RotatedByRandom(spread); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector7, spinninpoint3, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + fireballPhaseTime * fireballAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - if (flag2) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 11f; - - if (npc.ai[1] == 20f && flag2 && Main.netMode != NetmodeID.MultiplayerClient) - { - List list5 = new List(); - for (int num23 = 0; num23 < Main.maxNPCs; num23++) - { - if (Main.npc[num23].active && Main.npc[num23].type == NPCID.CultistBossClone && Main.npc[num23].ai[3] == (float)npc.whoAmI) - list5.Add(num23); - } - - foreach (int item5 in list5) - { - NPC nPC5 = Main.npc[item5]; - Vector2 center5 = nPC5.Center; - int num24 = Math.Sign(player.Center.X - center5.X); - if (num24 != 0) - nPC5.direction = (nPC5.spriteDirection = num24); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector8 = Vector2.Normalize(player.Center - center5); - if (vector8.HasNaNs()) - vector8 = new Vector2(npc.direction, 0f); - - Vector2 vector9 = center5 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - Vector2 spinninpoint4 = vector8 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint4 = spinninpoint4.RotatedByRandom(Math.PI / 6D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector9, spinninpoint4, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - int type2 = ProjectileID.CultistBossLightningOrb; - if ((int)(npc.ai[1] - 20f) % lightningOrbPhaseTime == 0) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y - 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - - if (masterMode) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X - 210f, npc.Center.Y - 210f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - } - else if (expertMode) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y + 100f, 0f, 0f, type2, npc.GetProjectileDamage(type2), 0f, Main.myPlayer); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(20 + lightningOrbPhaseTime)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f) - { - npc.localAI[2] = 10f; - if (Vector2.Normalize(player.Center - center).HasNaNs()) - new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 0f && npc.ai[1] < 30f) - { - flag3 = true; - flag4 = true; - float num26 = (npc.ai[1] - 0f) / 30f; - npc.alpha = (int)(num26 * 255f); - } - else if (npc.ai[1] >= 30f && npc.ai[1] < 90f) - { - if (npc.ai[1] == 30f && Main.netMode != NetmodeID.MultiplayerClient && flag2) - { - npc.localAI[1] += 1f; - Vector2 spinningpoint = new Vector2(180f, 0f); - List list6 = new List(); - for (int num27 = 0; num27 < Main.maxNPCs; num27++) - { - if (Main.npc[num27].active && Main.npc[num27].type == NPCID.CultistBossClone && Main.npc[num27].ai[3] == (float)npc.whoAmI) - list6.Add(num27); - } - - int num28 = 6 - list6.Count; - if (num28 > 2) - num28 = 2; - - int num29 = list6.Count + num28 + 1; - float[] array = new float[num29]; - for (int num30 = 0; num30 < array.Length; num30++) - array[num30] = Vector2.Distance(npc.Center + spinningpoint.RotatedBy((float)num30 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f), player.Center); - - int num31 = 0; - for (int num32 = 1; num32 < array.Length; num32++) - { - if (array[num31] > array[num32]) - num31 = num32; - } - - num31 = ((num31 >= num29 / 2) ? (num31 - num29 / 2) : (num31 + num29 / 2)); - int num33 = num28; - for (int num34 = 0; num34 < array.Length; num34++) - { - if (num31 != num34) - { - Vector2 center6 = npc.Center + spinningpoint.RotatedBy((float)num34 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); - if (num33-- > 0) - { - int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)center6.X, (int)center6.Y + npc.height / 2, NPCID.CultistBossClone, npc.whoAmI); - Main.npc[num35].ai[3] = npc.whoAmI; - Main.npc[num35].netUpdate = true; - Main.npc[num35].localAI[1] = npc.localAI[1]; - } - else - { - int num36 = list6[-num33 - 1]; - Main.npc[num36].Center = center6; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num36); - } - } - } - - npc.ai[2] = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, ProjectileID.CultistRitual, 0, 0f, Main.myPlayer, 0f, npc.whoAmI); - npc.Center += spinningpoint.RotatedBy((float)num31 * MathHelper.TwoPi / (float)num29 - (float)Math.PI / 2f); - npc.netUpdate = true; - list6.Clear(); - } - - flag3 = true; - flag4 = true; - npc.alpha = 255; - if (flag2) - { - Vector2 vector10 = Main.projectile[(int)npc.ai[2]].Center; - vector10 -= npc.Center; - if (vector10 == Vector2.Zero) - vector10 = -Vector2.UnitY; - - vector10.Normalize(); - if (Math.Abs(vector10.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector10.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num37 = Math.Sign(vector10.X); - if (num37 != 0) - npc.direction = (npc.spriteDirection = num37); - } - else - { - Vector2 vector11 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector11 -= npc.Center; - if (vector11 == Vector2.Zero) - vector11 = -Vector2.UnitY; - - vector11.Normalize(); - if (Math.Abs(vector11.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector11.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num38 = Math.Sign(vector11.X); - if (num38 != 0) - npc.direction = (npc.spriteDirection = num38); - } - } - else if (npc.ai[1] >= 90f && npc.ai[1] < 120f) - { - flag3 = true; - flag4 = true; - float num39 = (npc.ai[1] - 90f) / 30f; - npc.alpha = 255 - (int)(num39 * 255f); - } - else if (npc.ai[1] >= 120f && npc.ai[1] < ritualTimeMax) - { - flag4 = true; - npc.alpha = 0; - if (flag2) - { - Vector2 vector12 = Main.projectile[(int)npc.ai[2]].Center; - vector12 -= npc.Center; - if (vector12 == Vector2.Zero) - vector12 = -Vector2.UnitY; - - vector12.Normalize(); - if (Math.Abs(vector12.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector12.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num40 = Math.Sign(vector12.X); - if (num40 != 0) - npc.direction = (npc.spriteDirection = num40); - } - else - { - Vector2 vector13 = Main.projectile[(int)Main.npc[(int)npc.ai[3]].ai[2]].Center; - vector13 -= npc.Center; - if (vector13 == Vector2.Zero) - vector13 = -Vector2.UnitY; - - vector13.Normalize(); - if (Math.Abs(vector13.Y) < 0.77f) - npc.localAI[2] = 11f; - else if (vector13.Y < 0f) - npc.localAI[2] = 12f; - else - npc.localAI[2] = 10f; - - int num41 = Math.Sign(vector13.X); - if (num41 != 0) - npc.direction = (npc.spriteDirection = num41); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= ritualTimeMax) - { - flag4 = true; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 6f) - { - npc.localAI[2] = 13f; - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) - { - npc.localAI[2] = 11f; - Vector2 vec3 = Vector2.Normalize(player.Center - center); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientLightPhaseTime == 0) - { - if ((int)(npc.ai[1] - 4f) / ancientLightPhaseTime == 2) - { - List list7 = new List(); - for (int num42 = 0; num42 < Main.maxNPCs; num42++) - { - if (Main.npc[num42].active && Main.npc[num42].type == NPCID.CultistBossClone && Main.npc[num42].ai[3] == (float)npc.whoAmI) - list7.Add(num42); - } - - foreach (int item6 in list7) - { - NPC nPC6 = Main.npc[item6]; - Vector2 center7 = nPC6.Center; - int num43 = Math.Sign(player.Center.X - center7.X); - if (num43 != 0) - nPC6.direction = (nPC6.spriteDirection = num43); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec3 = Vector2.Normalize(player.Center - center7); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - Vector2 vector14 = center7 + new Vector2(npc.direction * 30, 12f); - int type = ProjectileID.CultistBossFireBallClone; - float velocity = masterMode ? 10f : expertMode ? 8f : 6f; - for (int num44 = 0; (float)num44 < 5f; num44++) - { - Vector2 spinninpoint5 = vec3 * (velocity + (float)Main.rand.NextDouble() * 4f); - spinninpoint5 = spinninpoint5.RotatedByRandom(MathHelper.TwoPi / 5D); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector14, spinninpoint5, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - } - } - - int num45 = Math.Sign(player.Center.X - center.X); - if (num45 != 0) - npc.direction = (npc.spriteDirection = num45); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - vec3 = Vector2.Normalize(player.Center - center); - if (vec3.HasNaNs()) - vec3 = new Vector2(npc.direction, 0f); - - Vector2 vector15 = npc.Center + new Vector2(npc.direction * 30, 12f); - float velocity = masterMode ? 14f : expertMode ? 12f : 10f; - float spread = MathHelper.ToRadians(masterMode ? 15f : expertMode ? 20f : 25f); - float ancientLightLimit = 5f; - for (int i = 0; (float)i < ancientLightLimit; i++) - { - Vector2 spinningpoint2 = vec3 * velocity; - spinningpoint2 = spinningpoint2.RotatedBy(spread * (float)i - (MathHelper.TwoPi / ancientLightLimit - spread) / 2f); - float ai = (Main.rand.NextFloat() - 0.5f) * 0.3f * MathHelper.TwoPi / 60f; - int num49 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector15.X, (int)vector15.Y + 7, NPCID.AncientLight, 0, 0f, ai, spinningpoint2.X, spinningpoint2.Y); - Main.npc[num49].velocity = spinningpoint2; - Main.npc[num49].netUpdate = true; - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientLightPhaseTime * ancientLightAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - npc.localAI[2] = 13f; - if (npc.ai[1] >= 4f && flag2 && (int)(npc.ai[1] - 4f) % ancientDoomPhaseTime == 0) - { - List list8 = new List(); - for (int num50 = 0; num50 < Main.maxNPCs; num50++) - { - if (Main.npc[num50].active && Main.npc[num50].type == NPCID.CultistBossClone && Main.npc[num50].ai[3] == (float)npc.whoAmI) - list8.Add(num50); - } - - int num51 = list8.Count + 1; - if (num51 > 3) - num51 = 3; - - int num52 = Math.Sign(player.Center.X - center.X); - if (num52 != 0) - npc.direction = (npc.spriteDirection = num52); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - for (int num53 = 0; num53 < num51; num53++) - { - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector16 = Main.player[npc.target].Center - npc.Center; - int num54 = 20; - int num55 = 3; - int num56 = 7; - int num57 = 2; - int num58 = 0; - bool flag6 = false; - if (vector16.Length() > 2000f) - flag6 = true; - - while (!flag6 && num58 < 100) - { - num58++; - int num59 = Main.rand.Next(point2.X - num54, point2.X + num54 + 1); - int num60 = Main.rand.Next(point2.Y - num54, point2.Y + num54 + 1); - if ((num60 < point2.Y - num56 || num60 > point2.Y + num56 || num59 < point2.X - num56 || num59 > point2.X + num56) && (num60 < point.Y - num55 || num60 > point.Y + num55 || num59 < point.X - num55 || num59 > point.X + num55) && !Main.tile[num59, num60].HasUnactuatedTile) - { - bool flag7 = true; - if (flag7 && Collision.SolidTiles(num59 - num57, num59 + num57, num60 - num57, num60 + num57)) - flag7 = false; - - if (flag7) - { - NPC.NewNPC(npc.GetSource_FromAI(), num59 * 16 + 8, num60 * 16 + 8, NPCID.AncientDoom, 0, npc.whoAmI); - flag6 = true; - break; - } - } - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)(4 + ancientDoomPhaseTime * ancientDoomAmount)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[3] += 1f; - npc.velocity = Vector2.Zero; - npc.netUpdate = true; - } - } - - if (!flag2) - npc.ai[3] = num11; - - npc.dontTakeDamage = flag3; - npc.chaseable = !flag4; - - return false; - } - - public static bool VanillaAncientLightAI(NPC npc, Mod mod) - { - npc.dontTakeDamage = true; - - // Slow and kill code - if (npc.ai[0] == -1f) - { - // Slow down over time - if (npc.velocity.Length() >= 0.2f) - { - npc.velocity *= 0.96f; - } - else - { - npc.velocity = Vector2.Zero; - npc.position = npc.oldPosition; - - // Kill after 2 seconds - npc.ai[1] += 1f; - if (npc.ai[1] >= 120f) - { - npc.HitEffect(0, 9999.0); - npc.active = false; - } - } - - return false; - } - - npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; - - // Set velocity and emit dust when spawned - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.velocity.X = npc.ai[2]; - npc.velocity.Y = npc.ai[3]; - for (int i = 0; i < 13; i++) - { - int ancientLight = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight].noGravity = true; - Main.dust[ancientLight].fadeIn = 1f; - Dust dust = Main.dust[ancientLight]; - dust.velocity *= 4f; - Main.dust[ancientLight].noLight = true; - } - } - - // Spawn dust - for (int j = 0; j < 2; j++) - { - if (Main.rand.Next(10 - (int)Math.Min(7f, npc.velocity.Length())) < 1) - { - int ancientLight2 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.AncientLight, npc.velocity.X * 0.5f, npc.velocity.Y * 0.5f, 90, default, 2.5f); - Main.dust[ancientLight2].noGravity = true; - Dust dust = Main.dust[ancientLight2]; - dust.velocity *= 0.2f; - Main.dust[ancientLight2].fadeIn = 0.4f; - if (Main.rand.NextBool(6)) - { - dust = Main.dust[ancientLight2]; - dust.velocity *= 5f; - Main.dust[ancientLight2].noLight = true; - } - else - Main.dust[ancientLight2].velocity = npc.DirectionFrom(Main.dust[ancientLight2].position) * Main.dust[ancientLight2].velocity.Length(); - } - } - - if (npc.ai[0] >= 0f) - { - npc.ai[0] += 1f; - - float duration = 120f; - - // Increase velocity for 1 second - if (npc.ai[0] < duration - 60f) - { - if (npc.velocity.Length() < 16f) - npc.velocity *= 1.005f; - } - - // Intersect velocity paths with other Ancient Lights for 1 second - if (npc.ai[0] >= duration - 60f) - npc.velocity = npc.velocity.RotatedBy(npc.ai[1]); - - // Engage slow code - if (npc.ai[0] >= duration) - npc.ai[0] = -1f; - } - - return false; - } - - public static bool VanillaAncientDoomAI(NPC npc, Mod mod) - { - npc.damage = npc.defDamage = 0; - float duration = 420f; - float spawnAnimTime = 120f; - int rateOfChange = 1; - float splitProjVelocity = Main.masterMode ? 10f : Main.expertMode ? 8f : 6f; - - // Percent life remaining for Cultist or Eidolon Wyrm - float lifeRatio = Main.npc[(int)npc.ai[0]].life / (float)Main.npc[(int)npc.ai[0]].lifeMax; - - bool phase2 = lifeRatio < 0.7f && Main.expertMode; - bool phase3 = lifeRatio < 0.4f && Main.masterMode; - - bool kill = npc.ai[1] < 0f || !Main.npc[(int)npc.ai[0]].active; - int target = Main.maxPlayers; - if (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss) - { - if (target == Main.maxPlayers) - target = Main.npc[(int)npc.ai[0]].target; - - if (phase2) - rateOfChange = 2; - - if (phase3) - rateOfChange = 3; - } - else - kill = true; - - npc.ai[1] += rateOfChange; - float growthRate = npc.ai[1] / spawnAnimTime; - growthRate = MathHelper.Clamp(growthRate, 0f, 1f); - npc.position = npc.Center; - npc.scale = MathHelper.Lerp(0f, 1f, growthRate); - npc.Center = npc.position; - npc.alpha = (int)(255f - growthRate * 255f); - - if (Main.rand.NextBool(6)) - { - Vector2 shadowflameDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust shadowflameDust = Main.dust[Dust.NewDust(npc.Center - shadowflameDustRotate * 20f, 0, 0, DustID.Shadowflame, 0f, 0f, 0, default, 1f)]; - shadowflameDust.noGravity = true; - shadowflameDust.position = npc.Center - shadowflameDustRotate * Main.rand.Next(10, 21) * npc.scale; - shadowflameDust.velocity = shadowflameDustRotate.RotatedBy(MathHelper.PiOver2) * 4f; - shadowflameDust.scale = 0.5f + Main.rand.NextFloat(); - shadowflameDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust = Main.dust[Dust.NewDust(npc.Center - darkDustRotate * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; - darkDust.noGravity = true; - darkDust.position = npc.Center - darkDustRotate * 20f * npc.scale; - darkDust.velocity = darkDustRotate.RotatedBy(-MathHelper.PiOver2) * 2f; - darkDust.scale = 0.5f + Main.rand.NextFloat(); - darkDust.fadeIn = 0.5f; - } - if (Main.rand.NextBool(6)) - { - Vector2 darkDustRotate2 = Vector2.UnitY.RotatedByRandom(MathHelper.TwoPi); - Dust darkDust2 = Main.dust[Dust.NewDust(npc.Center - darkDustRotate2 * 30f, 0, 0, DustID.Granite, 0f, 0f, 0, default, 1f)]; - darkDust2.position = npc.Center - darkDustRotate2 * 20f * npc.scale; - darkDust2.velocity = Vector2.Zero; - darkDust2.scale = 0.5f + Main.rand.NextFloat(); - darkDust2.fadeIn = 0.5f; - darkDust2.noLight = true; - } - - if (npc.ai[1] >= duration) - { - int type = ProjectileID.AncientDoomProjectile; - int damage = npc.GetProjectileDamage(type); - - kill = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int totalProjectiles = phase3 ? 6 : phase2 ? 5 : 4; + int totalProjectiles = Main.getGoodWorld ? 9 : (Main.npc[(int)npc.ai[0]].type == NPCID.CultistBoss && !phase3) ? 8 : death ? 5 : 4; float radians = MathHelper.TwoPi / totalProjectiles; Vector2 spinningPoint = new Vector2(0f, -splitProjVelocity); for (int k = 0; k < totalProjectiles; k++) diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs index ddaa634383..8fba6d9d83 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DeerclopsAI.cs @@ -24,6 +24,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static float borderScalar = 0f; public static Vector2 lastDeerclopsPosition; + // Vanilla values + public static int DebrisDamage = 18; // 72 + + // Rev+ exclusive + public static int IceSpikeDamage = 16; // 64 (buffed from 52) + public static int HandDamage = 13; // 52 (buffed from 40) + public static bool BuffedDeerclopsAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -34,16 +41,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = (float)npc.life / (float)npc.lifeMax; // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Projectile types and damage int rubble = ProjectileID.DeerclopsRangedProjectile; - int rubbleDamage = npc.GetProjectileDamage(rubble); int iceSpike = ProjectileID.DeerclopsIceSpike; - int iceSpikeDamage = npc.GetProjectileDamage(iceSpike); int shadowHand = ProjectileID.InsanityShadowHostile; - int shadowHandDamage = npc.GetProjectileDamage(shadowHand); if (npc.target.WithinBounds(Main.player.Length) && Main.player[npc.target].dead) { @@ -64,7 +67,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float resistDamageAmount = MathHelper.Clamp((distanceFromTarget - IncreaseDRTriggerDistance) / (MaxDRIncreaseDistance - IncreaseDRTriggerDistance), 0f, 1f); npc.localAI[3] = MathHelper.Lerp(0f, 30f, resistDamageAmount); float dustAndDRScalar = Utils.Remap(npc.localAI[3], 0f, 30f, 0f, 1f); - calamityGlobalNPC.DR = MathHelper.Lerp(0.05f, 0.9f, dustAndDRScalar); + calamityGlobalNPC.DR = MathHelper.Lerp(0f, 0.9f, dustAndDRScalar); if (borderDelay > 0f) borderDelay -= 1f; @@ -129,7 +132,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn Shadow Hands if the player enters the shadows if (Main.netMode != NetmodeID.MultiplayerClient && hasTargetBeenInRange) - SpawnBorderShadowHands(npc, lifeRatio, shadowHand, shadowHandDamage, death); + SpawnBorderShadowHands(npc, lifeRatio, shadowHand, HandDamage, death); // AI states switch ((int)npc.ai[0]) @@ -171,14 +174,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool useFrontIceSpikeAttack = Math.Abs(distanceFromTarget2.X) >= Math.Abs(distanceFromTarget2.Y) * distanceCheckMultiplier || distanceFromTarget2.Length() < 48f; bool useEitherIceSpikeAttack = distanceFromTarget2.Y <= (float)(100 + targetData.Height) && distanceFromTarget2.Y >= -200f; - // Can only use ice spikes a maximum of twice in a row before doing something else - float iceSpikeAttackLimit = 2f; + // Can only use ice spikes a maximum of three times in a row before doing something else + float iceSpikeAttackLimit = 3f; bool doNotUseIceSpikes = calamityGlobalNPC.newAI[1] >= iceSpikeAttackLimit; if (!doNotUseIceSpikes) { // Deerclops must be this close to its target on the X axis to do the ice spike attack // This distance increases at lower HP because the ice spikes get bigger - float iceSpikesDistanceGateValue = 120f + MathHelper.Lerp(0f, 120f, 1f - lifeRatio); + float iceSpikesDistanceGateValue = 120f + MathHelper.Lerp(0f, 60f, 1f - lifeRatio); if (Math.Abs(distanceFromTarget2.X) < iceSpikesDistanceGateValue && useEitherIceSpikeAttack && npc.velocity.Y == 0f && npc.localAI[1] >= 2f) { npc.velocity.X = 0f; @@ -206,9 +209,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Can only use rubble a maximum of thrice in a row before doing something else - // This also takes into account the ice spike limit - float rubbleAttackLimit = 3f; + // Can only use rubble and ice spikes a maximum of four times in a row before doing something else + float rubbleAttackLimit = 4f; bool doNotUseRubble = calamityGlobalNPC.newAI[1] >= rubbleAttackLimit; float rubbleGateValue = death ? 160f : 200f; if (!doNotUseRubble) @@ -272,7 +274,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; haltMovement = true; - MakeSpikesForward(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); + MakeSpikesForward(npc, 1, targetData, iceSpike, IceSpikeDamage, lifeRatio, death); float iceSpikePhaseGateValue = 80f; if (npc.ai[1] >= iceSpikePhaseGateValue) @@ -316,7 +318,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses rubbleLimit = rubbleStart; for (int rubbleIndex = rubbleStart; rubbleIndex < rubbleLimit && rubbleIndex < numRubble; rubbleIndex++) - ShootRubbleUp(npc, ref sourceTileCoords, numRubble, distancedByThisManyTiles, rubbleIndex, rubble, rubbleDamage, lifeRatio, death); + ShootRubbleUp(npc, ref sourceTileCoords, numRubble, distancedByThisManyTiles, rubbleIndex, rubble, DebrisDamage, lifeRatio, death); } if (npc.ai[1] >= 60f) @@ -357,7 +359,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 actualVelocity = spinningPoint.RotatedBy(radians * k); float velocityMultiplier = 1f - k * velocityMultIncrement; - Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, HandDamage, 0f, Main.myPlayer); } } } @@ -377,7 +379,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; haltMovement = true; npc.TargetClosest(); - MakeSpikesBothSides(npc, 1, targetData, iceSpike, iceSpikeDamage, lifeRatio, death); + MakeSpikesBothSides(npc, 1, targetData, iceSpike, IceSpikeDamage, lifeRatio, death); float doubleIceSpikePhaseGateValue = 90f; if (npc.ai[1] >= doubleIceSpikePhaseGateValue) @@ -408,17 +410,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.TargetClosest(); if (Main.netMode != NetmodeID.MultiplayerClient) { - int totalProjectiles = (death ? 11 : 9) + (int)MathHelper.Lerp(0f, 7f, 1f - lifeRatio); + int totalProjectiles = (death ? 20 : 16) + (int)MathHelper.Lerp(0f, 7f, 1f - lifeRatio); float velocityMultIncrement = ((totalProjectiles + 1) / (float)totalProjectiles) - 1f; - float randomRadialOffset = MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 360f : 270f, 1f - lifeRatio)); + float randomRadialOffset = Main.rand.NextFloat(MathHelper.ToRadians(MathHelper.Lerp(0f, death ? 360f : 270f, 1f - lifeRatio))); float radians = MathHelper.TwoPi / totalProjectiles + randomRadialOffset; - float velocity = (death ? 10.5f : 8f) + MathHelper.Lerp(0f, 4f, 1f - lifeRatio); + float velocity = 12f + MathHelper.Lerp(0f, 4f, 1f - lifeRatio); Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 actualVelocity = spinningPoint.RotatedBy(radians * k); - float velocityMultiplier = 1f - k * velocityMultIncrement; - Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, shadowHandDamage, 0f, Main.myPlayer); + float velocityMultiplier = 1f - (k * velocityMultIncrement * 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), Main.player[npc.target].Center + Vector2.Normalize(actualVelocity) * 550f, actualVelocity * velocityMultiplier * -1f, shadowHand, HandDamage, 0f, Main.myPlayer); } } } @@ -580,7 +582,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - private static void SpawnBorderShadowHands(NPC npc, float lifeRatio, int shadowHand, int shadowHandDamage, bool death) + private static void SpawnBorderShadowHands(NPC npc, float lifeRatio, int shadowHand, int HandDamage, bool death) { int shadowHandSpawnRate = death ? 15 : 20; npc.localAI[2] += 1f; @@ -603,12 +605,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 spawnPosition = npc.Center + (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (playerDistanceFromDeerclops + minShadowHandSpawnDistanceFromPlayer); float shadowHandVelocity = death ? 6f : 5f; Vector2 spawnVelocity = (player.Center - spawnPosition).SafeNormalize(Vector2.UnitY) * shadowHandVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition, spawnVelocity, shadowHand, shadowHandDamage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnPosition, spawnVelocity, shadowHand, HandDamage, 0f, Main.myPlayer); } } } - private static void ShootRubbleUp(NPC npc, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, int whichOne, int rubble, int rubbleDamage, float lifeRatio, bool death) + private static void ShootRubbleUp(NPC npc, ref Point sourceTileCoords, int howMany, int distancedByThisManyTiles, int whichOne, int rubble, int DebrisDamage, float lifeRatio, bool death) { // Loop to spawn rubble // The rubble attempts are used to offset the Y coordinates of the rubble spawns to make sure they can spawn in non-solid tiles @@ -620,13 +622,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int posY = sourceTileCoords.Y + rubbleSpawnAttempts; if (WorldGen.ActiveAndWalkableTile(posX, posY)) { - SpawnRubble(npc, posX, posY, howMany, whichOne, rubble, rubbleDamage, lifeRatio, death); + SpawnRubble(npc, posX, posY, howMany, whichOne, rubble, DebrisDamage, lifeRatio, death); break; } } } - private static void SpawnRubble(NPC npc, int posX, int posY, int howMany, int whichOne, int rubble, int rubbleDamage, float lifeRatio, bool death) + private static void SpawnRubble(NPC npc, int posX, int posY, int howMany, int whichOne, int rubble, int DebrisDamage, float lifeRatio, bool death) { Vector2 rubbleVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * npc.direction) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); int ai1_FrameToUse = Main.rand.Next(Main.projFrames[rubble] * 4); @@ -634,10 +636,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float delay = death ? 24f : 30f; float ai2_DelayBeforeGoingUp = (whichOne + 1) * delay; float velocityMultiplier = MathHelper.Lerp(0.01f, 0.015f, 1f - lifeRatio); - Projectile.NewProjectile(npc.GetSource_FromAI(), new Vector2(posX * 16 + 8, posY * 16 - 8), rubbleVelocity * velocityMultiplier, rubble, rubbleDamage, 0f, Main.myPlayer, 0f, ai1_FrameToUse, ai2_DelayBeforeGoingUp); + Projectile.NewProjectile(npc.GetSource_FromAI(), new Vector2(posX * 16 + 8, posY * 16 - 8), rubbleVelocity * velocityMultiplier, rubble, DebrisDamage, 0f, Main.myPlayer, 0f, ai1_FrameToUse, ai2_DelayBeforeGoingUp); } - private static void MakeSpikesForward(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) + private static void MakeSpikesForward(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int IceSpikeDamage, float lifeRatio, bool death) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -666,12 +668,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = iceSpikeStart; i < iceSpikeLimit && i < numIceSpikes; i++) { int xOffset = (int)Math.Round(i * xOffsetMult * iceSpikeScaleIncrease); - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, i, xOffset, iceSpike, IceSpikeDamage, lifeRatio, death); } } } - private static void MakeSpikesBothSides(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) + private static void MakeSpikesBothSides(NPC npc, int AISLOT_PhaseCounter, NPCAimedTarget targetData, int iceSpike, int IceSpikeDamage, float lifeRatio, bool death) { if (Main.netMode == NetmodeID.MultiplayerClient) return; @@ -699,13 +701,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int iceSpikeIndex = iceSpikeStart; iceSpikeIndex >= 0 && iceSpikeIndex < iceSpikeLimit && iceSpikeIndex < numIceSpikes; iceSpikeIndex++) { int xOffset = (int)Math.Round(iceSpikeIndex * xOffsetMult * iceSpikeScaleIncrease); - TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); - TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, iceSpikeDamage, lifeRatio, death); + TryMakingSpike(npc, ref sourceTileCoords, npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, IceSpikeDamage, lifeRatio, death); + TryMakingSpike(npc, ref sourceTileCoords, -npc.direction, numIceSpikes, -iceSpikeIndex, xOffset, iceSpike, IceSpikeDamage, lifeRatio, death); } } } - private static void TryMakingSpike(NPC npc, ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset, int iceSpike, int iceSpikeDamage, float lifeRatio, bool death) + private static void TryMakingSpike(NPC npc, ref Point sourceTileCoords, int dir, int howMany, int whichOne, int xOffset, int iceSpike, int IceSpikeDamage, float lifeRatio, bool death) { int posX = sourceTileCoords.X + xOffset * dir; int posY = FindBestY(npc, ref sourceTileCoords, posX); @@ -714,7 +716,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 iceSpikeSpawnPos = new Vector2(posX * 16 + 8, posY * 16 - 8); Vector2 iceSpikeVelocity = new Vector2(0f, -1f).RotatedBy((float)(whichOne * dir) * 0.7f * ((float)Math.PI / 4f / (float)howMany)); float iceSpikeScale = 0.1f + Main.rand.NextFloat() * 0.1f + (float)xOffset * 1.1f / (float)howMany; - Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, iceSpikeDamage, 0f, Main.myPlayer, 0f, iceSpikeScale); + Projectile.NewProjectile(npc.GetSource_FromAI(), iceSpikeSpawnPos, iceSpikeVelocity, iceSpike, IceSpikeDamage, 0f, Main.myPlayer, 0f, iceSpikeScale); } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs index 2d1b34725c..78436ec1da 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DestroyerAI.cs @@ -27,14 +27,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float PhaseTransitionTelegraphTime = 180f; public const float GroundTelegraphStartGateValue = FlightPhaseResetGateValue - PhaseTransitionTelegraphTime; public const float FlightTelegraphStartGateValue = FlightPhaseGateValue - PhaseTransitionTelegraphTime; - private const int OneInXChanceToFireLaser = 200; public const float ProbeLaserGateValue_Mechdusa = 360f; public const float ProbeLaserGateValue_Rev = 240f; - public const float ProbeLaserGateValue_BossRush = 150f; public const float ProbeLaserGateValue = 120f; public const float ProbeLaserTelegraphTime = 60f; + // Vanilla values + public static int ProbeLaserDamage = 22; // 88 + + // Rev+ exclusive + public static int LaserDamage = 25; // 100 (buffed); Applies to all Rev+ lasers + public static bool BuffedDestroyerAI(NPC npc, Mod mod) { int mechdusaCurvedSpineSegmentIndex = 0; @@ -67,8 +71,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = calamityGlobalNPC.newAI[1] < DRIncreaseTime; @@ -122,13 +125,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool increaseSpeed = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance200Tiles; bool increaseSpeedMore = Vector2.Distance(player.Center, npc.Center) > CalamityGlobalNPC.CatchUpDistance350Tiles; - float enrageScale = bossRush ? 1f : 0f; - if (Main.IsItDay() || bossRush) - { - calamityGlobalNPC.CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - // Phase for flying at the player bool flyAtTarget = (calamityGlobalNPC.newAI[3] >= FlightPhaseGateValue && startFlightPhase) || hasSpawnDR; @@ -151,8 +147,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Check if other segments are still alive, if not, die - // Check for Oblivion too, since having a max power Destroyer during that fight would be turbo cancer - bool oblivionAlive = false; if (npc.type > NPCID.TheDestroyer) { bool shouldDespawn = true; @@ -179,27 +173,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.active = false; } } - else - { - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - } // Total segment variable int totalSegments = Main.getGoodWorld ? 100 : 80; // Calculate aggression based on how many broken segments there are float brokenSegmentAggressionMultiplier = 1f; - if (npc.type == NPCID.TheDestroyer && !oblivionAlive) + if (npc.type == NPCID.TheDestroyer) { int numProbeSegments = 0; for (int i = 0; i < Main.maxNPCs; i++) @@ -225,71 +205,42 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Increase velocity based on distance float velocityMultiplier = increaseSpeedMore ? 2f : increaseSpeed ? 1.5f : 1f; + noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - // If Oblivion is alive, don't fly, don't spit laser spreads, use the default vanilla no fly zone, reduce segment count to 60, use base speed and use base turn speed - if (oblivionAlive) + float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); + float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); + float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); + + segmentVelocity += segmentVelocityBoost; + speed += speedBoost; + turnSpeed += turnSpeedBoost; + + if (flyAtTarget) { - calamityGlobalNPC.newAI[3] = 0f; - totalSegments = Main.getGoodWorld ? 75 : 60; - spitLaserSpreads = false; - noFlyZoneBoxHeight = 2000; + float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; + speed *= speedMultiplier; } - else + + segmentVelocity *= velocityMultiplier; + speed *= velocityMultiplier; + turnSpeed *= velocityMultiplier; + + segmentVelocity *= brokenSegmentAggressionMultiplier; + speed *= brokenSegmentAggressionMultiplier; + turnSpeed *= brokenSegmentAggressionMultiplier; + + if (Main.getGoodWorld) { - noFlyZoneBoxHeight -= death ? 400 : (int)(400f * (1f - lifeRatio)); - - float segmentVelocityBoost = death ? (flyAtTarget ? 4.5f : 6f) * (1f - lifeRatio) : (flyAtTarget ? 3f : 4f) * (1f - lifeRatio); - float speedBoost = death ? (flyAtTarget ? 0.1125f : 0.15f) * (1f - lifeRatio) : (flyAtTarget ? 0.075f : 0.1f) * (1f - lifeRatio); - float turnSpeedBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - - segmentVelocity += segmentVelocityBoost; - speed += speedBoost; - turnSpeed += turnSpeedBoost; - - segmentVelocity += 5f * enrageScale; - speed += 0.05f * enrageScale; - turnSpeed += 0.075f * enrageScale; - - if (flyAtTarget) - { - float speedMultiplier = phase5 ? 1.8f : phase4 ? 1.65f : 1.5f; - speed *= speedMultiplier; - } - - segmentVelocity *= velocityMultiplier; - speed *= velocityMultiplier; - turnSpeed *= velocityMultiplier; - - segmentVelocity *= brokenSegmentAggressionMultiplier; - speed *= brokenSegmentAggressionMultiplier; - turnSpeed *= brokenSegmentAggressionMultiplier; - - if (Main.getGoodWorld) - { - segmentVelocity *= 1.2f; - speed *= 1.2f; - turnSpeed *= 1.2f; - } + segmentVelocity *= 1.2f; + speed *= 1.2f; + turnSpeed *= 1.2f; } bool probeLaunched = npc.ai[2] == 1f; if (npc.type == NPCID.TheDestroyerBody) { - // Enrage, fire more cyan lasers - if (enrageScale > 0f && !bossRush) - { - if (calamityGlobalNPC.newAI[2] < 480f) - calamityGlobalNPC.newAI[2] += 1f; - } - else - { - if (calamityGlobalNPC.newAI[2] > 0f) - calamityGlobalNPC.newAI[2] -= 1f; - } - - // Regenerate Probes in Master Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) - // This doesn't happen if Oblivion is alive - if (death && probeLaunched && !oblivionAlive) + // Regenerate Probes in Death Mode if the number of Probes is less than 40 and the number of living NPCs is less than the segment count + 40 (this limit is here just in case) + if (death && probeLaunched) { npc.localAI[2] += 1f; if (npc.localAI[2] >= 600f) @@ -340,13 +291,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (j == totalSegments) type = NPCID.TheDestroyerTail; - int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI); - Main.npc[segment].ai[3] = npc.whoAmI; - Main.npc[segment].realLife = npc.whoAmI; - Main.npc[segment].ai[1] = index; - Main.npc[index].ai[0] = segment; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment); - index = segment; + int segment = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + npc.height), type, npc.whoAmI); + Main.npc[segment].ai[3] = npc.whoAmI; + Main.npc[segment].realLife = npc.whoAmI; + Main.npc[segment].ai[1] = index; + Main.npc[index].ai[0] = segment; + Main.npc[index].Calamity().newAI[0] = -90f - Main.npc[index].ai[0] * (death ? 8f : 3f); // This controls the delay between laser shots + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segment); + index = segment; } } @@ -377,7 +329,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (calamityGlobalNPC.newAI[0] % 30f == 0f) { - float velocity = bossRush ? 6f : death ? 5.333f : 5f; + float velocity = death ? 5.333f : 5f; int type = ProjectileID.DeathLaser; switch (calamityGlobalNPC.destroyerLaserColor) { @@ -393,18 +345,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses type = ModContent.ProjectileType(); break; } - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -415,7 +355,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 100f, perturbedSpeed, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 100f, perturbedSpeed, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 1200; } } @@ -441,28 +381,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set laser color and type if (calamityGlobalNPC.destroyerLaserColor == -1 && !probeLaunched) { - if (Main.rand.NextBool(death ? OneInXChanceToFireLaser / (phase5 ? 4 : phase4 ? 3 : 2) : OneInXChanceToFireLaser)) + int random = phase3 ? 4 : phase2 ? 3 : 2; + switch (Main.rand.Next(random)) { - int random = phase3 ? 4 : phase2 ? 3 : 2; - switch (Main.rand.Next(random)) - { - case 0: - case 1: - calamityGlobalNPC.destroyerLaserColor = 0; - break; - case 2: - calamityGlobalNPC.destroyerLaserColor = 1; - break; - case 3: - calamityGlobalNPC.destroyerLaserColor = 2; - break; - } - - if (calamityGlobalNPC.newAI[2] > 0f || bossRush) + case 0: + case 1: + calamityGlobalNPC.destroyerLaserColor = 0; + break; + case 2: + calamityGlobalNPC.destroyerLaserColor = 1; + break; + case 3: calamityGlobalNPC.destroyerLaserColor = 2; - - npc.SyncDestroyerLaserColor(); + break; } + + npc.SyncDestroyerLaserColor(); } if (probeLaunched && ableToFireLaser) @@ -472,12 +406,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Laser rate of fire - float shootProjectileTime = death ? (phase5 ? 120f : phase4 ? 150f : 180f) : 450f; - float bodySegmentTime = npc.ai[0] * (death ? 20f : 30f); - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float laserTimerIncrement = (calamityGlobalNPC.newAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; + float shootProjectileTime = death ? (phase5 ? 180f : phase4 ? 270f : 360f) : 450f; if (ableToFireLaser) - calamityGlobalNPC.newAI[0] += laserTimerIncrement; + calamityGlobalNPC.newAI[0] += 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -500,7 +431,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } - if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - LaserTelegraphTime) + if (calamityGlobalNPC.newAI[0] == shootProjectileTime - LaserTelegraphTime) { Particle telegraph = new DestroyerReticleTelegraph( npc, @@ -511,7 +442,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses GeneralParticleHandler.SpawnParticle(telegraph); } - if (calamityGlobalNPC.newAI[0] == shootProjectileGateValue - SparkTelegraphTime) + if (calamityGlobalNPC.newAI[0] == shootProjectileTime - SparkTelegraphTime) { Particle spark = new DestroyerSparkTelegraph( npc, @@ -525,43 +456,40 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shoot lasers // Shoot nothing if probe has been launched - if (calamityGlobalNPC.newAI[0] >= shootProjectileGateValue && ableToFireLaser) + if (calamityGlobalNPC.newAI[0] >= shootProjectileTime && ableToFireLaser) { + int numProbeSegments = 0; + for (int i = 0; i < Main.maxNPCs; i++) + { + if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) + numProbeSegments++; + } + float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); + float laserShootTimeBonus = (int)MathHelper.Lerp(0f, shootProjectileTime - LaserTelegraphTime, 1f - lerpAmount); + // Controls the fire rate getting slower as health lowers if (!death) { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) + if (npc.localAI[3] == 0f && phase3) { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; + npc.localAI[3] = 1f; + npc.SyncVanillaLocalAI(); + laserShootTimeBonus -= npc.ai[0] * 2f; + } + else if (npc.localAI[3] == 1f && startFlightPhase) + { + npc.localAI[3] = 2f; + npc.SyncVanillaLocalAI(); + laserShootTimeBonus -= npc.ai[0] * 2f; } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - calamityGlobalNPC.newAI[0] = laserShootTimeBonus; - npc.SyncExtraAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); } + calamityGlobalNPC.newAI[0] = laserShootTimeBonus; + npc.SyncExtraAI(); + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); if (Collision.CanHit(npc.position, npc.width, npc.height, player.position, player.width, player.height)) { - if (death) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)totalSegments, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - calamityGlobalNPC.newAI[0] = laserShootTimeBonus; - npc.SyncExtraAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - // Laser speed - float projectileSpeed = (death ? 4.5f : 3.5f) + Main.rand.NextFloat() * 1.5f; - projectileSpeed += enrageScale; + float projectileSpeed = death ? 5f : 4f; // Set projectile damage and type int projectileType = ProjectileID.DeathLaser; @@ -584,23 +512,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 projectileVelocity = (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 100f; - // Shoot projectile - int damage = npc.GetProjectileDamage(projectileType); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 1200; } @@ -742,9 +656,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.type == NPCID.TheDestroyerBody) { float shootProjectileTime = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 270f : 450f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; + float telegraphGateValue = shootProjectileTime - LaserTelegraphTime; if (calamityGlobalNPC.newAI[0] > telegraphGateValue) { switch (calamityGlobalNPC.destroyerLaserColor) @@ -770,8 +682,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Despawn - bool oblivionFightDespawn = (oblivionAlive && lifeRatio < 0.8f) && npc.localAI[3] == 1f; - if (player.dead || oblivionFightDespawn) + if ((player.dead || Main.IsItDay()) && !BossRushEvent.BossRushActive) { shouldFly = false; npc.velocity.Y += 2f; @@ -1034,12 +945,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Force the fucker to turn around in ground phase in Master - // Turns slower if Oblivion is alive, for fairness + // Force the fucker to turn around in ground phase in Death if (npc.type == NPCID.TheDestroyer && death && !flyAtTarget) { if (npc.Distance(player.Center) > 2000f) - npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? speed : turnSpeed); + npc.velocity += (player.Center - npc.Center).SafeNormalize(Vector2.UnitY) * turnSpeed; } if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) @@ -1060,689 +970,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (calamityGlobalNPC.newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 0f)) calamityGlobalNPC.newAI[1] += 1f; - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = segmentVelocity * 0.25f; - float minimalDamageVelocity = segmentVelocity * 0.5f; - if (npc.type == NPCID.TheDestroyer) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - - return false; - } - - public static bool VanillaDestroyerAI(NPC npc, Mod mod) - { - int num = 0; - int num2 = 10; - if (NPC.IsMechQueenUp && npc.type != NPCID.TheDestroyer) - { - int num3 = (int)npc.ai[1]; - while (num3 > 0 && num3 < Main.maxNPCs) - { - if (Main.npc[num3].active && Main.npc[num3].type >= NPCID.TheDestroyer && Main.npc[num3].type <= NPCID.TheDestroyerTail) - { - num++; - if (Main.npc[num3].type == NPCID.TheDestroyer) - break; - - if (num >= num2) - { - num = 0; - break; - } - - num3 = (int)Main.npc[num3].ai[1]; - continue; - } - - num = 0; - break; - } - } - - npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.Calamity().newAI[1] < DRIncreaseTime; - - if (npc.ai[3] > 0f) - npc.realLife = (int)npc.ai[3]; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.type >= NPCID.TheDestroyer && npc.type <= NPCID.TheDestroyerTail) - { - if (npc.type == NPCID.TheDestroyer || (npc.type != NPCID.TheDestroyer && Main.npc[(int)npc.ai[1]].alpha < 128)) - { - if (npc.alpha != 0) - { - for (int i = 0; i < 2; i++) - { - int num4 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TheDestroyer, 0f, 0f, 100, default(Color), 2f); - Main.dust[num4].noGravity = true; - Main.dust[num4].noLight = true; - } - } - - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - } - - if (npc.type > NPCID.TheDestroyer) - { - bool flag = false; - if (npc.ai[1] <= 0f) - flag = true; - else if (Main.npc[(int)npc.ai[1]].life <= 0) - flag = true; - - if (flag) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - } - } - - int destroyerSegmentsCount = NPC.GetDestroyerSegmentsCount(); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.ai[0] == 0f && npc.type == NPCID.TheDestroyer) - { - npc.ai[3] = npc.whoAmI; - npc.realLife = npc.whoAmI; - int num5 = 0; - int num6 = npc.whoAmI; - for (int j = 0; j <= destroyerSegmentsCount; j++) - { - int num7 = NPCID.TheDestroyerBody; - if (j == destroyerSegmentsCount) - num7 = NPCID.TheDestroyerTail; - - num5 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), num7, npc.whoAmI); - Main.npc[num5].ai[3] = npc.whoAmI; - Main.npc[num5].realLife = npc.whoAmI; - Main.npc[num5].ai[1] = num6; - Main.npc[num6].ai[0] = num5; - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num5); - num6 = num5; - } - } - } - - if (npc.type == NPCID.TheDestroyerBody) - { - bool probeLaunched = npc.ai[2] == 1f; - bool ableToFireLaser = npc.Calamity().destroyerLaserColor != -1; - - if (npc.Calamity().destroyerLaserColor == -1 && !probeLaunched && Main.rand.NextBool(OneInXChanceToFireLaser)) - { - npc.Calamity().destroyerLaserColor = 0; - npc.SyncDestroyerLaserColor(); - } - - if (probeLaunched && ableToFireLaser) - { - npc.Calamity().destroyerLaserColor = -1; - npc.SyncDestroyerLaserColor(); - } - - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - - float laserTimerIncrement = (npc.localAI[0] > shootProjectileGateValue - LaserTelegraphTime) ? 1f : 2f; - if (ableToFireLaser) - npc.localAI[0] += laserTimerIncrement; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - // Sync newAI every 20 frames for the new telegraph - if (npc.localAI[0] % 20f == 10f && ableToFireLaser) - npc.SyncVanillaLocalAI(); - } - - Color telegraphColor = Color.Transparent; - switch (npc.Calamity().destroyerLaserColor) - { - case 0: - telegraphColor = Color.Red; - break; - case 1: - telegraphColor = Color.Green; - break; - case 2: - telegraphColor = Color.Cyan; - break; - } - - if (npc.localAI[0] == shootProjectileGateValue - LaserTelegraphTime) - { - Particle telegraph = new DestroyerReticleTelegraph( - npc, - telegraphColor, - 1.5f, - 0.15f, - (int)LaserTelegraphTime); - GeneralParticleHandler.SpawnParticle(telegraph); - } - - if (npc.localAI[0] == shootProjectileGateValue - SparkTelegraphTime) - { - Particle spark = new DestroyerSparkTelegraph( - npc, - telegraphColor * 2f, - Color.White, - 3f, - 30, - Main.rand.NextFloat(MathHelper.ToRadians(3f)) * Main.rand.NextBool().ToDirectionInt()); - GeneralParticleHandler.SpawnParticle(spark); - } - - if (npc.localAI[0] >= shootProjectileGateValue && ableToFireLaser) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == npc.type && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - float lerpAmount = MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f); - float laserShootTimeBonus = (int)MathHelper.Lerp(0f, (shootProjectileTime + bodySegmentTime * lerpAmount) - LaserTelegraphTime, 1f - lerpAmount); - npc.localAI[0] = laserShootTimeBonus; - npc.SyncVanillaLocalAI(); - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float laserVelocity = (Main.masterMode ? 3.5f : Main.expertMode ? 3f : 2.5f) + Main.rand.NextFloat() * 1.5f; - Vector2 vector = npc.Center; - float num8 = Main.player[npc.target].Center.X - vector.X + (float)Main.rand.Next(-2, 3); - float num9 = Main.player[npc.target].Center.Y - vector.Y + (float)Main.rand.Next(-2, 3); - float num10 = (float)Math.Sqrt(num8 * num8 + num9 * num9); - num10 = laserVelocity / num10; - num8 *= num10; - num9 *= num10; - num8 += (float)Main.rand.Next(-2, 3) * 0.05f; - num9 += (float)Main.rand.Next(-2, 3) * 0.05f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 laserVelocityActual = new Vector2(num8, num9); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num12 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector + laserVelocityActual.SafeNormalize(Vector2.UnitY) * 100f, laserVelocityActual, type, damage, 0f, Main.myPlayer, 1f, 0f); - Main.projectile[num12].timeLeft = 1200; - } - - npc.netUpdate = true; - } - - npc.Calamity().destroyerLaserColor = -1; - npc.SyncDestroyerLaserColor(); - } - } - - if (npc.type == NPCID.TheDestroyer) - { - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - } - else - { - if (npc.life > Main.npc[(int)npc.ai[1]].life) - npc.life = Main.npc[(int)npc.ai[1]].life; - } - - // Calculate aggression based on how many broken segments there are - float brokenSegmentAggressionMultiplier = 1f; - if (npc.type == NPCID.TheDestroyer) - { - int numProbeSegments = 0; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.TheDestroyerBody && Main.npc[i].ai[2] == 0f) - numProbeSegments++; - } - brokenSegmentAggressionMultiplier += (1f - MathHelper.Clamp(numProbeSegments / (float)destroyerSegmentsCount, 0f, 1f)) * 0.25f; - } - - int num13 = (int)(npc.position.X / 16f) - 1; - int num14 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num15 = (int)(npc.position.Y / 16f) - 1; - int num16 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num13 < 0) - num13 = 0; - - if (num14 > Main.maxTilesX) - num14 = Main.maxTilesX; - - if (num15 < 0) - num15 = 0; - - if (num16 > Main.maxTilesY) - num16 = Main.maxTilesY; - - bool flag2 = false; - if (!flag2) - { - Vector2 vector2 = default(Vector2); - for (int k = num13; k < num14; k++) - { - for (int l = num15; l < num16; l++) - { - if (Main.tile[k, l] != null && ((Main.tile[k, l].HasUnactuatedTile && (Main.tileSolid[Main.tile[k, l].TileType] || (Main.tileSolidTop[Main.tile[k, l].TileType] && Main.tile[k, l].TileFrameY == 0))) || Main.tile[k, l].LiquidAmount > 64)) - { - vector2.X = k * 16; - vector2.Y = l * 16; - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - break; - } - } - } - } - } - - if (!flag2) - { - if (npc.type != NPCID.TheDestroyerBody || npc.ai[2] != 1f) - { - Vector3 lightColor = Color.Red.ToVector3(); - - // Light colors - Vector3 groundColor = new Vector3(0.3f, 0.1f, 0.05f); - Vector3 segmentColor = groundColor; - Vector3 telegraphColor = groundColor; - - // Telegraph for the laser breath and body lasers - float telegraphProgress = 0f; - if (npc.Calamity().destroyerLaserColor != -1) - { - if (npc.type == NPCID.TheDestroyerBody) - { - float shootProjectileTime = Main.masterMode ? 500f : Main.expertMode ? 700f : 900f; - float bodySegmentTime = npc.ai[0] * 30f; - float shootProjectileGateValue = bodySegmentTime + shootProjectileTime; - float telegraphGateValue = shootProjectileGateValue - LaserTelegraphTime; - if (npc.localAI[0] > telegraphGateValue) - telegraphProgress = MathHelper.Clamp((npc.localAI[0] - telegraphGateValue) / LaserTelegraphTime, 0f, 1f); - } - } - - Lighting.AddLight(npc.Center, Vector3.Lerp(segmentColor, telegraphColor * 2f, telegraphProgress)); - } - - npc.localAI[1] = 1f; - if (npc.type == NPCID.TheDestroyer) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num17 = 1000; - int height = (num17 * 2) - (Main.masterMode ? 700 : Main.expertMode ? 400 : 0); - bool flag3 = true; - if (npc.position.Y > Main.player[npc.target].position.Y) - { - for (int m = 0; m < Main.maxPlayers; m++) - { - if (Main.player[m].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[m].position.X - num17, (int)Main.player[m].position.Y - num17, num17 * 2, height); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - - if (flag3) - flag2 = true; - } - } - } - else - npc.localAI[1] = 0f; - - float num18 = (Main.masterMode ? 24f : Main.expertMode ? 20f : 16f) * brokenSegmentAggressionMultiplier; - if (Main.IsItDay() || Main.player[npc.target].dead) - { - flag2 = false; - npc.velocity.Y += 1f; - if ((double)npc.position.Y > Main.worldSurface * 16D) - { - npc.velocity.Y += 1f; - num18 *= 2f; - } - - if ((double)npc.position.Y > Main.rockLayer * 16D) - { - for (int n = 0; n < Main.maxNPCs; n++) - { - if (Main.npc[n].aiStyle == npc.aiStyle) - Main.npc[n].active = false; - } - } - } - - float num19 = 0.1f; - float num20 = 0.15f; - if (Main.expertMode) - { - num19 = Main.masterMode ? 0.2f : 0.15f; - num20 = Main.masterMode ? 0.3f : 0.225f; - } - - if (Main.getGoodWorld) - { - num19 *= 1.2f; - num20 *= 1.2f; - } - - num19 *= brokenSegmentAggressionMultiplier; - num20 *= brokenSegmentAggressionMultiplier; - - Vector2 vector3 = npc.Center; - float num21 = Main.player[npc.target].Center.X; - float num22 = Main.player[npc.target].Center.Y; - num21 = (int)(num21 / 16f) * 16; - num22 = (int)(num22 / 16f) * 16; - vector3.X = (int)(vector3.X / 16f) * 16; - vector3.Y = (int)(vector3.Y / 16f) * 16; - num21 -= vector3.X; - num22 -= vector3.Y; - float num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - int num24 = (int)(44f * npc.scale); - try - { - vector3 = npc.Center; - num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; - num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; - } - catch - { - } - - if (num > 0) - { - float num25 = (float)num24 - (float)num24 * (((float)num - 1f) * 0.1f); - if (num25 < 0f) - num25 = 0f; - - if (num25 > (float)num24) - num25 = num24; - - num22 = Main.npc[(int)npc.ai[1]].Center.Y + num25 - vector3.Y; - } - - npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; - num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - if (num > 0) - num24 = num24 / num2 * num; - - num23 = (num23 - (float)num24) / num23; - num21 *= num23; - num22 *= num23; - npc.velocity = Vector2.Zero; - npc.position.X += num21; - npc.position.Y += num22; - num21 = Main.npc[(int)npc.ai[1]].Center.X - vector3.X; - num22 = Main.npc[(int)npc.ai[1]].Center.Y - vector3.Y; - npc.rotation = (float)Math.Atan2(num22, num21) + MathHelper.PiOver2; - } - else - { - if (!flag2) - { - npc.velocity.Y += 0.15f; - if (Main.masterMode && npc.velocity.Y > 0f) - npc.velocity.Y += 0.05f; - - if (npc.velocity.Y > num18) - npc.velocity.Y = num18; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > num19; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num19 * 1.1f; - else - npc.velocity.X += num19 * 1.1f; - } - else if (npc.velocity.Y == num18) - { - if (slowXVelocity) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num19 * 0.9f; - else - npc.velocity.X -= num19 * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - if (npc.soundDelay == 0) - { - float num26 = num23 / 40f; - if (num26 < 10f) - num26 = 10f; - - if (num26 > 20f) - num26 = 20f; - - npc.soundDelay = (int)num26; - SoundEngine.PlaySound(SoundID.WormDig, npc.Center); - } - - num23 = (float)Math.Sqrt(num21 * num21 + num22 * num22); - float num27 = Math.Abs(num21); - float num28 = Math.Abs(num22); - float num29 = num18 / num23; - num21 *= num29; - num22 *= num29; - if (((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f)) && ((npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f))) - { - if (npc.velocity.X < num21) - npc.velocity.X += num20; - else if (npc.velocity.X > num21) - npc.velocity.X -= num20; - - if (npc.velocity.Y < num22) - npc.velocity.Y += num20; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num20; - } - - if ((npc.velocity.X > 0f && num21 > 0f) || (npc.velocity.X < 0f && num21 < 0f) || (npc.velocity.Y > 0f && num22 > 0f) || (npc.velocity.Y < 0f && num22 < 0f)) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19; - - if (npc.velocity.Y < num22) - npc.velocity.Y += num19; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num19; - - if ((double)Math.Abs(num22) < (double)num18 * 0.2 && ((npc.velocity.X > 0f && num21 < 0f) || (npc.velocity.X < 0f && num21 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num19 * 2f; - else - npc.velocity.Y -= num19 * 2f; - } - - if ((double)Math.Abs(num21) < (double)num18 * 0.2 && ((npc.velocity.Y > 0f && num22 < 0f) || (npc.velocity.Y < 0f && num22 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num19 * 2f; - else - npc.velocity.X -= num19 * 2f; - } - } - else if (num27 > num28) - { - if (npc.velocity.X < num21) - npc.velocity.X += num19 * 1.1f; - else if (npc.velocity.X > num21) - npc.velocity.X -= num19 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num19; - else - npc.velocity.Y -= num19; - } - } - else - { - if (npc.velocity.Y < num22) - npc.velocity.Y += num19 * 1.1f; - else if (npc.velocity.Y > num22) - npc.velocity.Y -= num19 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num18 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num19; - else - npc.velocity.X -= num19; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - if (npc.type == NPCID.TheDestroyer) - { - if (flag2) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - } - - if (NPC.IsMechQueenUp && npc.type == NPCID.TheDestroyer) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector4 = new Vector2(0f, 100f); - Vector2 spinningpoint = mechQueenCenter + vector4; - float num30 = nPC.velocity.X * 0.025f; - spinningpoint = spinningpoint.RotatedBy(num30, mechQueenCenter); - npc.position = spinningpoint - npc.Size / 2f + nPC.velocity; - npc.velocity.X = 0f; - npc.velocity.Y = 0f; - npc.rotation = num30 * 0.75f + (float)Math.PI; - } - - // 10 seconds of resistance to prevent spawn killing - if (npc.Calamity().newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || npc.Calamity().newAI[1] > 0f)) - npc.Calamity().newAI[1] += 1f; - - // Calculate contact damage based on velocity - float minimalContactDamageVelocity = num18 * 0.25f; - float minimalDamageVelocity = num18 * 0.5f; - if (npc.type == NPCID.TheDestroyer) - { - if (npc.velocity.Length() <= minimalContactDamageVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageVelocity) / minimalDamageVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - return false; } public static bool BuffedProbeAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool oblivionAlive = npc.ai[1] == 1f; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1753,8 +986,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Type == NPCTargetType.Player) targetDead = Main.player[npc.target].dead; - float velocity = bossRush ? 12f : death ? 8.4f : 7.2f; - float acceleration = bossRush ? 0.1f : death ? 0.07f : 0.06f; + float velocity = death ? 8.4f : 7.2f; + float acceleration = death ? 0.07f : 0.06f; float deceleration = 1f - acceleration; if (targetDead) @@ -1784,12 +1017,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < Main.maxNPCs; i++) { - if (death && !bossRush && npc.ai[1] == 0f) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - npc.ai[1] = 1f; - } - if (i != npc.whoAmI && Main.npc[i].active && Main.npc[i].type == npc.type) { Vector2 otherProbeDist = Main.npc[i].Center - npc.Center; @@ -1862,27 +1089,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((npc.justHit && !death) || targetDead) npc.localAI[0] = 0f; - float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : bossRush ? ProbeLaserGateValue_BossRush : ProbeLaserGateValue_Rev; + float laserGateValue = NPC.IsMechQueenUp ? ProbeLaserGateValue_Mechdusa : ProbeLaserGateValue_Rev; if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= laserGateValue) { npc.localAI[0] = 0f; if (targetData.Type != 0 && Collision.CanHit(npc.position, npc.width, npc.height, targetData.Position, targetData.Width, targetData.Height)) { int type = ProjectileID.PinkLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - int totalProjectiles = oblivionAlive ? 2 : death ? 3 : 1; + int totalProjectiles = death ? 3 : 1; Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; if (NPC.IsMechQueenUp) { @@ -1904,7 +1118,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } Vector2 laserVelocity = projectileVelocity * velocityMultiplier; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 50f, laserVelocity, type, ProbeLaserDamage.CalculateMechDamage(), 0f, Main.myPlayer); } npc.netUpdate = true; @@ -1918,12 +1132,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (targetData.Center.X - npc.Center.X > 0f) { - npc.spriteDirection = -1; + npc.spriteDirection = 1; npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); } else { - npc.spriteDirection = 1; + npc.spriteDirection = -1; npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; } @@ -1940,173 +1154,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaProbeAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target <= Main.maxPlayers || Main.player[npc.target].dead) - CalamityUtils.CalamityTargeting(npc, default); - - NPCAimedTarget targetData = npc.GetTargetData(); - bool targetDead = false; - if (targetData.Type == NPCTargetType.Player) - targetDead = Main.player[npc.target].dead; - - float velocity = Main.zenithWorld ? 3f : Main.expertMode ? 7.2f : 6f; - float acceleration = Main.expertMode ? 0.06f : 0.05f; - float deceleration = 1f - acceleration; - - if (targetDead || Main.IsItDay()) - { - Vector2 destination = npc.Center - Vector2.UnitY; - Vector2 idealVelocity = npc.SafeDirectionTo(destination) * velocity * 0.5f; - idealVelocity.X *= npc.direction; - idealVelocity.Y *= 2.5f; - npc.SimpleFlyMovement(idealVelocity, acceleration); - npc.EncourageDespawn(10); - } - else if (npc.Distance(targetData.Center) > 400f) - { - Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; - npc.SimpleFlyMovement(idealVelocity, acceleration); - } - else - { - if (npc.Distance(targetData.Center) < 160f) - { - Vector2 idealVelocity = npc.SafeDirectionTo(targetData.Center) * velocity; - npc.SimpleFlyMovement(-idealVelocity, acceleration); - } - else - npc.velocity *= deceleration; - } - - if (npc.ai[3] != 0f) - { - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 vector2 = new Vector2(26f * npc.ai[3], 0f); - int num9 = (int)npc.ai[2]; - if (num9 < 0 || num9 >= Main.maxNPCs) - { - num9 = NPC.FindFirstNPC(NPCID.TheDestroyer); - npc.ai[2] = num9; - npc.netUpdate = true; - } - - if (num9 > -1) - { - NPC nPC2 = Main.npc[num9]; - if (!nPC2.active || nPC2.type != NPCID.TheDestroyer) - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - else - { - Vector2 spinningpoint = nPC2.Center + vector2; - spinningpoint = spinningpoint.RotatedBy(nPC2.rotation, nPC2.Center); - npc.Center = spinningpoint; - npc.velocity = nPC.velocity; - npc.dontTakeDamage = true; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - { - npc.dontTakeDamage = false; - if (npc.ai[3] > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - else - npc.dontTakeDamage = false; - - npc.localAI[0] += 1f; - if (npc.ai[3] != 0f) - npc.localAI[0] += 2f; - - if ((npc.justHit && !Main.masterMode) || targetDead) - npc.localAI[0] = 0f; - - float num10 = ProbeLaserGateValue; - if (NPC.IsMechQueenUp) - num10 = ProbeLaserGateValue_Mechdusa; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] >= num10) - { - npc.localAI[0] = 0f; - if (targetData.Type != 0 && Collision.CanHit(npc, targetData)) - { - int type = ProjectileID.PinkLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (targetData.Center - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; - if (NPC.IsMechQueenUp) - { - Vector2 v = targetData.Center - npc.Center - targetData.Velocity * 20f; - projectileVelocity = v.SafeNormalize(Vector2.UnitY) * 8f; - } - - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); - } - } - - int num13 = (int)npc.Center.X; - int num14 = (int)npc.Center.Y; - num13 /= 16; - num14 /= 16; - if (WorldGen.InWorld(num13, num14) && !WorldGen.SolidTile(num13, num14)) - Lighting.AddLight((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f), 0.3f, 0.1f, 0.05f); - - if (targetData.Center.X - npc.Center.X > 0f) - { - npc.spriteDirection = -1; - npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X); - } - else - { - npc.spriteDirection = 1; - npc.rotation = (float)Math.Atan2(targetData.Center.Y - npc.Center.Y, targetData.Center.X - npc.Center.X) + MathHelper.Pi; - } - - if (NPC.IsMechQueenUp && npc.ai[2] == 0f) - { - Vector2 center = npc.GetTargetData().Center; - Vector2 v2 = center - npc.Center; - int num28 = 120; - if (v2.Length() < (float)num28) - npc.Center = center - v2.SafeNormalize(Vector2.UnitY) * num28; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs index 744526387f..a6c99486c7 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/DukeFishronAI.cs @@ -11,6 +11,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class DukeFishronAI { + // Vanilla values + public static float Phase2ContactDamageMult = 1.436f; // 201 + public static float Phase3ContactDamageMult = 1.315f; // 184 + public static bool BuffedDukeFishronAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -19,9 +23,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool masterModeSurprise = lifeRatio >= 0.9f && death; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool deathModeSurprise = lifeRatio >= 0.9f && death; bool phase2 = lifeRatio < (death ? 0.6f : 0.7f); bool phase3 = lifeRatio < (death ? 0.3f : 0.4f); bool phase4 = lifeRatio < (death ? 0.1f : 0.2f); @@ -30,15 +33,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool charging = npc.ai[3] < 10f; // Adjust stats - int setDamage = npc.defDamage; + npc.damage = npc.defDamage; if (phase3AI) { - setDamage = (int)Math.Round(setDamage * 1.32); + npc.damage = (int)Math.Round(npc.defDamage * Phase3ContactDamageMult); npc.defense = 0; } else if (phase2AI) { - setDamage = (int)Math.Round(setDamage * 1.44); + npc.damage = (int)Math.Round(npc.defDamage * Phase2ContactDamageMult); npc.defense = (int)Math.Round(npc.defDefense * 0.8); } else @@ -106,7 +109,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int teleportPhaseTimer = 30; - int bubbleSpinPhaseTimer = bossRush ? 45 : death ? 90 : 120; + int bubbleSpinPhaseTimer = death ? 90 : 120; int bubbleSpinPhaseDivisor = death ? 3 : 4; float bubbleSpinBubbleVelocity = death ? 8f : 7f; float bubbleSpinPhaseVelocity = 20f; @@ -144,21 +147,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Enrage variable - bool enrage = !bossRush && + bool enrage = !BossRushEvent.BossRushActive && (player.position.Y < 800f || player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (Main.maxTilesX * 16 - 6400))); - calamityGlobalNPC.CurrentlyEnraged = !bossRush && enrage; + calamityGlobalNPC.CurrentlyEnraged = enrage; // Make him always able to take damage npc.dontTakeDamage = false; // Increased DR during phase transitions - calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (bossRush ? 0.99f : 0.625f) : 0.15f; + calamityGlobalNPC.DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? 0.625f : 0.15f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; // Enrage - if (enrage || bossRush) + if (enrage) { bubbleBelchPhaseTimer = 20; bubbleBelchPhaseDivisor = 1; @@ -172,11 +175,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bubbleSpinPhaseDivisor = 1; bubbleSpinBubbleVelocity = 15f; - if (!bossRush) - { - setDamage *= 2; - npc.defense = npc.defDefense * 3; - } + npc.damage *= 2; + npc.defense = npc.defDefense * 3; } if (death) @@ -188,11 +188,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeVelocity += 3f; } - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) chargeTime += Main.rand.Next(5, 66); // Spawn cthulhunadoes in phase 3 - if (phase3AI && ((!phase4 && !masterModeSurprise) || Main.getGoodWorld)) + if (phase3AI && ((!phase4 && !deathModeSurprise) || Main.getGoodWorld)) { calamityGlobalNPC.newAI[0] += 1f; float timeGateValue = 600f; @@ -215,7 +215,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - npc.ai[0] = masterModeSurprise ? 9f : -1f; + npc.ai[0] = deathModeSurprise ? 9f : -1f; npc.netUpdate = true; } } @@ -228,15 +228,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses rateOfRotation = 0.01f; Vector2 rotationVector = player.Center - npc.Center; - if (!player.dead && bossRush && phase4) - { - // Rotate to show direction of predictive charge - if (npc.ai[0] == 10f) - { - rateOfRotation = 0.1f; - rotationVector = Vector2.Normalize(player.Center + player.velocity * 20f - npc.Center) * chargeVelocity; - } - } float rotationSpeed = (float)Math.Atan2(rotationVector.Y, rotationVector.X); if (npc.spriteDirection == 1) @@ -268,7 +259,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn effects if (npc.ai[0] == -1f) { - // Avoid cheap bullshit + // Disable contact damage while spawning npc.damage = 0; // Velocity @@ -326,9 +317,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase 1 else if (npc.ai[0] == 0f && !player.dead) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -353,7 +341,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + if (npc.ai[2] >= idlePhaseTimer || Main.zenithWorld) { int attackPicker = 0; switch ((int)npc.ai[3]) @@ -444,9 +432,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge else if (npc.ai[0] == 1f) { - // Set damage - npc.damage = setDamage; - // Accelerate npc.velocity *= 1.01f; @@ -477,9 +462,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Bubble belch else if (npc.ai[0] == 2f) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -525,9 +507,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Sharknado spawn else if (npc.ai[0] == 3f) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -564,9 +543,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Transition to phase 2 else if (npc.ai[0] == 4f) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -589,9 +565,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase 2 else if (npc.ai[0] == 5f && !player.dead) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity if (npc.ai[1] == 0f) npc.ai[1] = 300 * Math.Sign((npc.Center - player.Center).X); @@ -616,7 +589,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + if (npc.ai[2] >= idlePhaseTimer || Main.zenithWorld) { int phase2AttackPicker = 0; switch ((int)npc.ai[3]) @@ -714,9 +687,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge else if (npc.ai[0] == 6f) { - // Set damage - npc.damage = setDamage; - // Accelerate npc.velocity *= 1.01f; @@ -747,9 +717,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Bubble spin else if (npc.ai[0] == 7f) { - // Set damage - npc.damage = 0; - // Play sounds and spawn bubbles if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); @@ -763,7 +730,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 phase2BubbleSharkronDirection = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + npc.Center; int phase2Bubbles = NPC.NewNPC(npc.GetSource_FromAI(), (int)phase2BubbleSharkronDirection.X, (int)phase2BubbleSharkronDirection.Y + 45, NPCID.DetonatingBubble); Main.npc[phase2Bubbles].target = npc.target; - Main.npc[phase2Bubbles].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (CalamityWorld.LegendaryMode ? (Main.rand.NextFloat() + 0.5f) : 1f); + Main.npc[phase2Bubbles].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * npc.direction) * bubbleSpinBubbleVelocity * (Main.getGoodWorld ? (Main.rand.NextFloat() + 0.5f) : 1f); Main.npc[phase2Bubbles].netUpdate = true; Main.npc[phase2Bubbles].ai[3] = Main.rand.Next(80, 121) / 100f; @@ -792,9 +759,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn cthulhunado else if (npc.ai[0] == 8f) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity npc.velocity *= 0.98f; npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); @@ -819,9 +783,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Transition to phase 3 else if (npc.ai[0] == 9f) { - // Avoid cheap bullshit - npc.damage = 0; - // Alpha adjustments if (npc.ai[2] < phaseTransitionTimer - 90) { @@ -864,9 +825,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase 3 else if (npc.ai[0] == 10f && !player.dead) { - // Avoid cheap bullshit - npc.damage = 0; - // Alpha if (npc.alpha < 255) { @@ -903,7 +861,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase switch npc.ai[2] += 1f; - if (npc.ai[2] >= idlePhaseTimer || CalamityWorld.LegendaryMode) + if (npc.ai[2] >= idlePhaseTimer || Main.zenithWorld) { int phase3AttackPicker = 0; if (phase4) @@ -949,7 +907,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Go back to normalcy after dropping below 90% HP - if (!masterModeSurprise && !phase3) + if (!deathModeSurprise && !phase3) phase3AttackPicker = 3; // Set velocity for charge @@ -960,7 +918,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; // Velocity and rotation - npc.velocity = Vector2.Normalize(player.Center + (bossRush && phase4 ? player.velocity * 20f : Vector2.Zero) - npc.Center) * chargeVelocity; + npc.velocity = Vector2.Normalize(player.Center - npc.Center) * chargeVelocity; npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); // Direction @@ -998,9 +956,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge else if (npc.ai[0] == 11f) { - // Set damage - npc.damage = setDamage; - // Accelerate npc.velocity *= 1.01f; @@ -1054,7 +1009,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Pause before teleport else if (npc.ai[0] == 12f) { - // Avoid cheap bullshit + // Disable contact damage during the teleporting phase npc.damage = 0; // Alpha @@ -1147,7 +1102,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 velocityVector = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); float inertia = 30f; - float velocity = 23f; + float velocity = 20f; npc.velocity = (npc.velocity * inertia + velocityVector * velocity) / (inertia + 1f); npc.scale = npc.ai[3]; @@ -1234,986 +1189,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaDukeFishronAI(NPC npc, Mod mod) - { - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - - double damageScale = expertMode ? 1.2 : 1D; - float phase2LifeRatio = masterMode ? 0.6f : 0.5f; - float phase3LifeRatio = masterMode ? 0.25f : 0.15f; - bool flag = npc.life <= npc.lifeMax * phase2LifeRatio; - bool flag2 = expertMode && npc.life <= npc.lifeMax * phase3LifeRatio; - bool flag3 = npc.ai[0] > 4f; - bool flag4 = npc.ai[0] > 9f; - bool flag5 = npc.ai[3] < 10f; - - int setDamage = npc.defDamage; - if (flag4) - { - setDamage = (int)Math.Round(setDamage * 1.1 * damageScale); - npc.defense = 0; - } - else if (flag3) - { - setDamage = (int)Math.Round(setDamage * 1.2 * damageScale); - npc.defense = (int)Math.Round(npc.defDefense * 0.8); - } - else - npc.defense = npc.defDefense; - - int num2 = (masterMode ? 30 : expertMode ? 40 : 60); - float num3 = (masterMode ? 0.65f : expertMode ? 0.55f : 0.45f); - float num4 = (masterMode ? 9.5f : expertMode ? 8.5f : 7.5f); - if (flag4) - { - num3 = masterMode ? 0.8f : 0.7f; - num4 = masterMode ? 13f : 12f; - num2 = masterMode ? 20 : 30; - } - else if (flag3 && flag5) - { - num3 = (masterMode ? 0.7f : expertMode ? 0.6f : 0.5f); - num4 = (masterMode ? 12f : expertMode ? 10f : 8f); - num2 = (masterMode ? 35 : expertMode ? 40 : 20); - } - else if (flag5 && !flag3 && !flag4) - num2 = masterMode ? 25 : 30; - - int num5 = (masterMode ? 25 : expertMode ? 28 : 30); - float num6 = (masterMode ? 18f : expertMode ? 17f : 16f); - if (flag4) - { - num5 = masterMode ? 20 : 25; - num6 = masterMode ? 29f : 27f; - } - else if (flag5 && flag3) - { - num5 = (masterMode ? 24 : expertMode ? 27 : 30); - if (expertMode) - num6 = masterMode ? 24f : 21f; - } - - int num7 = masterMode ? 40 : 80; - int num8 = masterMode ? 2 : 4; - float num9 = masterMode ? 0.5f : 0.3f; - float num10 = masterMode ? 8f : 5f; - int num11 = masterMode ? 60 : 90; - int num12 = 180; - int num13 = 180; - int num14 = 30; - int num15 = masterMode ? 60 : 120; - int num16 = masterMode ? 2 : 4; - float num17 = masterMode ? 9f : 6f; - float num18 = 20f; - float num19 = MathHelper.TwoPi / (float)(num15 / 2); - int num20 = masterMode ? 50 : 75; - Vector2 center = npc.Center; - Player player = Main.player[npc.target]; - if (npc.target < 0 || npc.target == Main.maxPlayers || player.dead || !player.active || Vector2.Distance(player.Center, center) > 5600f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - player = Main.player[npc.target]; - npc.netUpdate = true; - } - - if (player.dead || Vector2.Distance(player.Center, center) > 5600f) - { - npc.velocity.Y -= 0.4f; - npc.EncourageDespawn(10); - if (npc.ai[0] > 4f) - npc.ai[0] = 5f; - else - npc.ai[0] = 0f; - - npc.ai[2] = 0f; - } - - bool enrage = player.position.Y < 800f || (double)player.position.Y > Main.worldSurface * 16.0 || (player.position.X > 6400f && player.position.X < (float)(Main.maxTilesX * 16 - 6400)); - - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && enrage; - - // Increased DR during phase transitions - npc.Calamity().DR = (npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f) ? (BossRushEvent.BossRushActive ? 0.99f : 0.625f) : 0.15f; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = npc.ai[0] == -1f || npc.ai[0] == 4f || npc.ai[0] == 9f; - - if (enrage) - { - num2 = masterMode ? 5 : 10; - setDamage *= 2; - npc.defense = npc.defDefense * 2; - num6 += (masterMode ? 12f : 6f); - } - - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - npc.alpha = 255; - npc.rotation = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -1f; - npc.netUpdate = true; - } - } - - float num21 = (float)Math.Atan2(player.Center.Y - center.Y, player.Center.X - center.X); - if (npc.spriteDirection == 1) - num21 += (float)Math.PI; - - if (num21 < 0f) - num21 += MathHelper.TwoPi; - - if (num21 > MathHelper.TwoPi) - num21 -= MathHelper.TwoPi; - - if (npc.ai[0] == -1f) - num21 = 0f; - - if (npc.ai[0] == 3f) - num21 = 0f; - - if (npc.ai[0] == 4f) - num21 = 0f; - - if (npc.ai[0] == 8f) - num21 = 0f; - - float num22 = 0.04f; - if (npc.ai[0] == 1f || npc.ai[0] == 6f) - num22 = 0f; - - if (npc.ai[0] == 7f) - num22 = 0f; - - if (npc.ai[0] == 3f) - num22 = 0.01f; - - if (npc.ai[0] == 4f) - num22 = 0.01f; - - if (npc.ai[0] == 8f) - num22 = 0.01f; - - if (npc.rotation < num21) - { - if ((double)(num21 - npc.rotation) > Math.PI) - npc.rotation -= num22; - else - npc.rotation += num22; - } - - if (npc.rotation > num21) - { - if ((double)(npc.rotation - num21) > Math.PI) - npc.rotation += num22; - else - npc.rotation -= num22; - } - - if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) - npc.rotation = num21; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - - if (npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num21 - num22 && npc.rotation < num21 + num22) - npc.rotation = num21; - - if (npc.ai[0] != -1f && npc.ai[0] < 9f) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[0] == -1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - int num23 = Math.Sign(player.Center.X - center.X); - if (num23 != 0) - { - npc.direction = num23; - npc.spriteDirection = -npc.direction; - } - - if (npc.ai[2] > 20f) - { - npc.velocity.Y = -2f; - npc.alpha -= 5; - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - - if (npc.ai[2] == (float)(num11 - 30)) - { - int num24 = 36; - for (int i = 0; i < num24; i++) - { - Vector2 vector = (Vector2.Normalize(npc.velocity) * new Vector2((float)npc.width / 2f, npc.height) * 0.75f * 0.5f).RotatedBy((float)(i - (num24 / 2 - 1)) * MathHelper.TwoPi / (float)num24) + npc.Center; - Vector2 vector2 = vector - npc.Center; - int num25 = Dust.NewDust(vector + vector2, 0, 0, DustID.DungeonWater, vector2.X * 2f, vector2.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num25].noGravity = true; - Main.dust[num25].noLight = true; - Main.dust[num25].velocity = Vector2.Normalize(vector2) * 3f; - } - - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num20) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 0f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector3 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - if (npc.velocity.X < vector3.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector3.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector3.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector3.X < 0f) - npc.velocity.X -= num3; - } - - if (npc.velocity.Y < vector3.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector3.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector3.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector3.Y < 0f) - npc.velocity.Y -= num3; - } - - int num26 = Math.Sign(player.Center.X - center.X); - if (num26 != 0) - { - if (npc.ai[2] == 0f && num26 != npc.direction) - npc.rotation += (float)Math.PI; - - npc.direction = num26; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num27 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - num27 = 1; - break; - case 10: - npc.ai[3] = 1f; - num27 = 2; - break; - case 11: - npc.ai[3] = 0f; - num27 = 3; - break; - } - - if (enrage && num27 == 2) - num27 = 3; - - if (flag) - num27 = 4; - - switch (num27) - { - case 1: - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num26 != 0) - { - npc.direction = num26; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 3f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - if (enrage) - npc.ai[2] = num11 - 40; - break; - - case 4: - npc.ai[0] = 4f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 1f) - { - // Set damage - npc.damage = setDamage; - - int num28 = 7; - for (int j = 0; j < num28; j++) - { - Vector2 vector4 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(j - (num28 / 2 - 1)) * Math.PI / (double)(float)num28) + center; - Vector2 vector5 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num29 = Dust.NewDust(vector4 + vector5, 0, 0, DustID.DungeonWater, vector5.X * 2f, vector5.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num29].noGravity = true; - Main.dust[num29].noLight = true; - Main.dust[num29].velocity /= 4f; - Main.dust[num29].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector6 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num10; - if (npc.velocity.X < vector6.X) - { - npc.velocity.X += num9; - if (npc.velocity.X < 0f && vector6.X > 0f) - npc.velocity.X += num9; - } - else if (npc.velocity.X > vector6.X) - { - npc.velocity.X -= num9; - if (npc.velocity.X > 0f && vector6.X < 0f) - npc.velocity.X -= num9; - } - - if (npc.velocity.Y < vector6.Y) - { - npc.velocity.Y += num9; - if (npc.velocity.Y < 0f && vector6.Y > 0f) - npc.velocity.Y += num9; - } - else if (npc.velocity.Y > vector6.Y) - { - npc.velocity.Y -= num9; - if (npc.velocity.Y > 0f && vector6.Y < 0f) - npc.velocity.Y -= num9; - } - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % (float)num8 == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector7 = Vector2.Normalize(player.Center - center) * (npc.width + 20) / 2f + center; - NPC.NewNPC(npc.GetSource_FromAI(), (int)vector7.X, (int)vector7.Y + 45, NPCID.DetonatingBubble); - } - } - - int num30 = Math.Sign(player.Center.X - center.X); - if (num30 != 0) - { - npc.direction = num30; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num7) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num11 - 30)) - SoundEngine.PlaySound(SoundID.Zombie9, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) - { - Vector2 vector8 = npc.rotation.ToRotationVector2() * (Vector2.UnitX * npc.direction) * (npc.width + 20) / 2f + center; - Vector2 sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? 12f : 8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); - sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? 12f : 8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer); - if (masterMode) - { - sharknadoBoltVelocity = new Vector2(npc.direction * 2, masterMode ? -12f : -8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); - sharknadoBoltVelocity = new Vector2(npc.direction * -2, masterMode ? -12f : -8f); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector8, sharknadoBoltVelocity, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 0f, -1f); - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num12 - 60)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num12) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 5f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector9 = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - if (npc.velocity.X < vector9.X) - { - npc.velocity.X += num3; - if (npc.velocity.X < 0f && vector9.X > 0f) - npc.velocity.X += num3; - } - else if (npc.velocity.X > vector9.X) - { - npc.velocity.X -= num3; - if (npc.velocity.X > 0f && vector9.X < 0f) - npc.velocity.X -= num3; - } - - if (npc.velocity.Y < vector9.Y) - { - npc.velocity.Y += num3; - if (npc.velocity.Y < 0f && vector9.Y > 0f) - npc.velocity.Y += num3; - } - else if (npc.velocity.Y > vector9.Y) - { - npc.velocity.Y -= num3; - if (npc.velocity.Y > 0f && vector9.Y < 0f) - npc.velocity.Y -= num3; - } - - int num31 = Math.Sign(player.Center.X - center.X); - if (num31 != 0) - { - if (npc.ai[2] == 0f && num31 != npc.direction) - npc.rotation += (float)Math.PI; - - npc.direction = num31; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num32 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - num32 = 1; - break; - case 6: - npc.ai[3] = 1f; - num32 = 2; - break; - case 7: - npc.ai[3] = 0f; - num32 = 3; - break; - } - - if (flag2) - num32 = 4; - - if (enrage && num32 == 2) - num32 = 3; - - switch (num32) - { - case 1: - npc.ai[0] = 6f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num31 != 0) - { - npc.direction = num31; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.velocity = Vector2.Normalize(player.Center - center) * num18; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num31 != 0) - { - npc.direction = num31; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - npc.ai[0] = 7f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 8f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 4: - npc.ai[0] = 9f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 6f) - { - // Set damage - npc.damage = setDamage; - - int num33 = 7; - for (int k = 0; k < num33; k++) - { - Vector2 vector10 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(k - (num33 / 2 - 1)) * Math.PI / (double)(float)num33) + center; - Vector2 vector11 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num34 = Dust.NewDust(vector10 + vector11, 0, 0, DustID.DungeonWater, vector11.X * 2f, vector11.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num34].noGravity = true; - Main.dust[num34].noLight = true; - Main.dust[num34].velocity /= 4f; - Main.dust[num34].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 2f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 7f) - { - // Set damage - npc.damage = 0; - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (npc.ai[2] % (float)num16 == 0f) - { - SoundEngine.PlaySound(SoundID.NPCDeath19, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 vector12 = Vector2.Normalize(npc.velocity) * (npc.width + 20) / 2f + center; - int num35 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector12.X, (int)vector12.Y + 45, NPCID.DetonatingBubble); - Main.npc[num35].target = npc.target; - Main.npc[num35].velocity = Vector2.Normalize(npc.velocity).RotatedBy(MathHelper.PiOver2 * (float)npc.direction) * num17; - Main.npc[num35].netUpdate = true; - Main.npc[num35].ai[3] = (float)Main.rand.Next(80, 121) / 100f; - } - } - - npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); - npc.rotation -= num19 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num15) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 8f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num11 - 30)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num11 - 30)) - Projectile.NewProjectile(npc.GetSource_FromAI(), center, Vector2.Zero, ProjectileID.SharknadoBolt, 0, 0f, Main.myPlayer, 1f, npc.target + 1, (enrage || masterMode) ? 1 : 0); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num11) - { - npc.ai[0] = 5f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 9f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] < (float)(num13 - 90)) - { - if (Collision.SolidCollision(npc.position, npc.width, npc.height)) - npc.alpha += 15; - else - npc.alpha -= 15; - - if (npc.alpha < 0) - npc.alpha = 0; - - if (npc.alpha > 150) - npc.alpha = 150; - } - else if (npc.alpha < 255) - { - npc.alpha += 4; - if (npc.alpha > 255) - npc.alpha = 255; - } - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num13 - 60)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num13) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 10f && !player.dead) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha < 255) - { - npc.alpha += 25; - if (npc.alpha > 255) - npc.alpha = 255; - } - - if (npc.ai[1] == 0f) - npc.ai[1] = 360 * Math.Sign((center - player.Center).X); - - Vector2 desiredVelocity = Vector2.Normalize(player.Center + new Vector2(npc.ai[1], -200f) - center - npc.velocity) * num4; - npc.SimpleFlyMovement(desiredVelocity, num3); - int num36 = Math.Sign(player.Center.X - center.X); - if (num36 != 0) - { - if (npc.ai[2] == 0f && num36 != npc.direction) - { - npc.rotation += (float)Math.PI; - for (int l = 0; l < npc.oldPos.Length; l++) - npc.oldPos[l] = Vector2.Zero; - } - - npc.direction = num36; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num2) - { - int num37 = 0; - switch ((int)npc.ai[3]) - { - case 0: - case 2: - case 3: - case 5: - case 6: - case 7: - num37 = 1; - break; - case 1: - case 4: - case 8: - num37 = 2; - break; - } - - switch (num37) - { - case 1: - npc.ai[0] = 11f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity = Vector2.Normalize(player.Center - center) * num6; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (num36 != 0) - { - npc.direction = num36; - if (npc.spriteDirection == 1) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - break; - - case 2: - npc.ai[0] = 12f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - - case 3: - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - break; - } - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 11f) - { - // Set damage - npc.damage = setDamage; - - npc.alpha -= 25; - if (npc.alpha < 0) - npc.alpha = 0; - - int num38 = 7; - for (int m = 0; m < num38; m++) - { - Vector2 vector13 = (Vector2.Normalize(npc.velocity) * new Vector2((float)(npc.width + 50) / 2f, npc.height) * 0.75f).RotatedBy((double)(m - (num38 / 2 - 1)) * Math.PI / (double)(float)num38) + center; - Vector2 vector14 = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); - int num39 = Dust.NewDust(vector13 + vector14, 0, 0, DustID.DungeonWater, vector14.X * 2f, vector14.Y * 2f, 100, default(Color), 1.4f); - Main.dust[num39].noGravity = true; - Main.dust[num39].noLight = true; - Main.dust[num39].velocity /= 4f; - Main.dust[num39].velocity -= npc.velocity; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num5) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 12f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.alpha < 255) - { - npc.alpha += 17; - if (npc.alpha > 255) - npc.alpha = 255; - } - - npc.velocity *= 0.98f; - npc.velocity.Y = MathHelper.Lerp(npc.velocity.Y, 0f, 0.02f); - if (npc.ai[2] == (float)(num14 / 2)) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] == (float)(num14 / 2)) - { - if (npc.ai[1] == 0f) - npc.ai[1] = 300 * Math.Sign((center - player.Center).X); - - Vector2 vector15 = player.Center + new Vector2(0f - npc.ai[1], -200f); - Vector2 vector17 = (npc.Center = vector15); - center = vector17; - int num40 = Math.Sign(player.Center.X - center.X); - if (num40 != 0) - { - if (npc.ai[2] == 0f && num40 != npc.direction) - { - npc.rotation += (float)Math.PI; - for (int n = 0; n < npc.oldPos.Length; n++) - npc.oldPos[n] = Vector2.Zero; - } - - npc.direction = num40; - if (npc.spriteDirection != -npc.direction) - npc.rotation += (float)Math.PI; - - npc.spriteDirection = -npc.direction; - } - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num14) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - if (npc.ai[3] >= 9f) - npc.ai[3] = 0f; - - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 13f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Zombie20, npc.Center); - - npc.velocity = npc.velocity.RotatedBy((0f - num19) * (float)npc.direction); - npc.rotation -= num19 * (float)npc.direction; - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num15) - { - npc.ai[0] = 10f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] += 1f; - npc.netUpdate = true; - } - } - - // Make him always able to take damage - npc.dontTakeDamage = false; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs index 8794a125ec..7aade7a6d2 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EaterOfWorldsAI.cs @@ -14,50 +14,38 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static class EaterOfWorldsAI { private const float ProjectileTelegraphDuration = 30f; - private const int TotalMasterModeWorms = 4; + private const int TotalDeathModeWorms = 4; public const float DRIncreaseTime = 600f; + // Rev+ exclusive + public static float HeadDamageMult = 1.25f; // 60 (buffed from 48) + public static float BodyDamageMult = 1.5f; // 30 (buffed from 20) + public static float TailDamageMult = 1.5f; // 26 (buffed from 17) + public static int FireballDamage = 12; // 48; Applies to both Cursed Flames and (Death) Shadowflame fireballs + public static bool BuffedEaterofWorldsAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + + // Set contact damage + npc.damage = (int)Math.Round(npc.defDamage * (npc.type == NPCID.EaterofWorldsHead ? HeadDamageMult : npc.type == NPCID.EaterofWorldsBody ? BodyDamageMult : TailDamageMult)); // Causes it to split far more in death mode - if ((((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && death) || CalamityWorld.LegendaryMode) + if ((((npc.ai[2] % 2f == 0f && npc.type == NPCID.EaterofWorldsBody) || npc.type == NPCID.EaterofWorldsHead) && death) || Main.getGoodWorld) { calamityGlobalNPC.DR = 0.5f; npc.defense = npc.defDefense * 2; } - if (CalamityWorld.LegendaryMode && npc.type == NPCID.EaterofWorldsHead) + if (Main.getGoodWorld && npc.type == NPCID.EaterofWorldsHead) npc.reflectsProjectiles = true; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - bool enrage = true; - int targetTileX = (int)Main.player[npc.target].Center.X / 16; - int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); - if (tile.WallType == WallID.EbonstoneUnsafe) - enrage = false; - - float enrageScale = 0f; - if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) - { - calamityGlobalNPC.CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; - } - if (!Main.player[npc.target].ZoneCorrupt || bossRush) - { - calamityGlobalNPC.CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - // Total body segments float totalSegments = GetEaterOfWorldsSegmentsCountRevDeath(); @@ -78,7 +66,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Boost velocity by 50% phase bool phase4 = lifeRatio < (death ? 0.5f : 0.2f); - // Go fucking crazy in Master Mode + // Go fucking crazy in Death Mode bool phase5 = lifeRatio < 0.1f && death; bool phase6 = lifeRatio < 0.05f && death; @@ -111,7 +99,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) { Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); - Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); + Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, DustID.CorruptGibs, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); dust.noGravity = true; dust.velocity *= 0.3f; } @@ -122,13 +110,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (phase2) { - float timer = enrageScale > 0f ? 90f : 120f; + float timer = 120f; float shootBoost = lifeRatio * 90f; timer += shootBoost; - if (enrageScale >= 2f) - timer = 60f; - float showTelegraphGateValue = timer - ProjectileTelegraphDuration; if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) @@ -151,21 +136,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY).ToRotation().AngleTowards(npc.velocity.ToRotation(), MathHelper.PiOver4) == npc.velocity.ToRotation()) { calamityGlobalNPC.newAI[0] = 0f; - Vector2 cursedFlameDirection = npc.Center; - float targetXDirection = Main.player[npc.target].Center.X - cursedFlameDirection.X; - float targetYDirection = Main.player[npc.target].Center.Y - cursedFlameDirection.Y; - float projSpeed = 7f + enrageScale * 2f; - float flameTargetDistance = (float)Math.Sqrt(targetXDirection * targetXDirection + targetYDirection * targetYDirection); - flameTargetDistance = projSpeed / flameTargetDistance; - targetXDirection *= flameTargetDistance; - targetYDirection *= flameTargetDistance; - targetYDirection += npc.velocity.Y * 0.5f; - targetXDirection += npc.velocity.X * 0.5f; - cursedFlameDirection.X -= targetXDirection; - cursedFlameDirection.Y -= targetYDirection; - + Vector2 cursedFlameDirection = Utils.DirectionTo(npc.Center, Main.player[npc.target].Center) * 7f + (npc.velocity * 0.5f); int type = (death && phase3) ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; - Projectile.NewProjectile(npc.GetSource_FromAI(), cursedFlameDirection.X, cursedFlameDirection.Y, targetXDirection, targetYDirection, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + npc.velocity, cursedFlameDirection, type, FireballDamage, 0f, Main.myPlayer); } } @@ -201,7 +174,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.type == NPCID.EaterofWorldsHead) { // Amount of segments to spawn. - int segmentSpawnAmount = (int)(death ? (totalSegments / TotalMasterModeWorms) : totalSegments); + int segmentSpawnAmount = (int)(death ? (totalSegments / TotalDeathModeWorms) : totalSegments); // Spawn additional worms of reduced length in Master Mode. if (death) @@ -209,7 +182,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 additionalWormSpawnLocation = new Vector2(spawnX, spawnY); int randomXLimit = 80; int randomYLimit = 80; - for (int i = 1; i < TotalMasterModeWorms; i++) + for (int i = 1; i < TotalDeathModeWorms; i++) { additionalWormSpawnLocation += new Vector2((Main.rand.Next(randomXLimit + 1) + randomXLimit) * (Main.rand.NextBool() ? -1f : 1f), Main.rand.Next(randomYLimit + 1) + randomYLimit); int wormHead = NPC.NewNPC(npc.GetSource_FromAI(), (int)additionalWormSpawnLocation.X, (int)additionalWormSpawnLocation.Y, NPCID.EaterofWorldsHead, npc.whoAmI + segmentSpawnAmount * i + 1); @@ -356,10 +329,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!inTiles && npc.type == NPCID.EaterofWorldsHead) { Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int noFlyZone = death ? (800 - (phase5 ? 400 : 200)) : 900; - noFlyZone -= (int)(enrageScale * 200f); - if (noFlyZone < 100) - noFlyZone = 100; + int noFlyZone = death ? (phase5 ? 400 : 600) : 900; bool freeMoveAnyway = true; for (int k = 0; k < Main.maxPlayers; k++) @@ -380,32 +350,32 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Velocity and acceleration - float velocityScale = (death ? 4.8f : 2.4f) * enrageScale; + float velocityScale = death ? 4.8f : 2.4f; float velocityBoost = velocityScale * (1f - lifeRatio); - float accelerationScale = (death ? 0.06f : 0.03f) * enrageScale; + float accelerationScale = death ? 0.06f : 0.03f; float accelerationBoost = accelerationScale * (1f - lifeRatio); float segmentVelocity = 12f + velocityBoost; float segmentAcceleration = 0.15f + accelerationBoost; if (phase6) { - segmentVelocity += 2.4f * (enrageScale + 1f); - segmentAcceleration += 0.12f * (enrageScale + 1f); + segmentVelocity += 2.4f; + segmentAcceleration += 0.12f; } else if (phase5) { - segmentVelocity += 1.8f * (enrageScale + 1f); - segmentAcceleration += 0.09f * (enrageScale + 1f); + segmentVelocity += 1.8f; + segmentAcceleration += 0.09f; } else if (phase4) { - segmentVelocity += 1.2f * (enrageScale + 1f); - segmentAcceleration += 0.06f * (enrageScale + 1f); + segmentVelocity += 1.2f; + segmentAcceleration += 0.06f; } else if (phase3) { - segmentVelocity += 0.6f * (enrageScale + 1f); - segmentAcceleration += 0.03f * (enrageScale + 1f); + segmentVelocity += 0.6f; + segmentAcceleration += 0.03f; } if (death) @@ -542,13 +512,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses targetPosY *= timeToReachTarget; // Despawn - bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && Main.player[npc.target].dead; - if (shouldDespawn && !bossRush) + bool shouldDespawn = npc.type == NPCID.EaterofWorldsHead && (Main.player[npc.target].dead || !Main.player[npc.target].ZoneCorrupt || !Main.player[npc.target].ZoneCrimson) && !BossRushEvent.BossRushActive; + if (shouldDespawn) { bool everyoneDead = true; - for (int i = 0; i < Main.maxPlayers; i++) + foreach (Player p in Main.ActivePlayers) { - if (Main.player[i].active && !Main.player[i].dead) + if (!p.dead && p.ZoneCorrupt) { everyoneDead = false; break; @@ -569,13 +539,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.life = 0; if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, segmentAmt); segmentAmt = attachedSegments; } if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI, 0f, 0f, 0f, 0, 0, 0); + NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); } targetPosX = 0f; targetPosY = segmentVelocity; @@ -654,7 +624,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float pushDistanceLowerLimit = 14f - numHeads; float pushDistanceUpperLimit = 140f - numHeads * 10f; float pushDistance = MathHelper.Lerp(pushDistanceLowerLimit, pushDistanceUpperLimit, 1f - lifeRatio) * npc.scale; - float pushVelocity = 0.25f + enrageScale * 0.125f; + float pushVelocity = 0.25f; for (int i = 0; i < Main.maxNPCs; i++) { if (Main.npc[i].active) @@ -706,38 +676,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (calamityGlobalNPC.newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || calamityGlobalNPC.newAI[1] > 0f)) calamityGlobalNPC.newAI[1] += 1f; - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float minimalContactDamageHeadVelocity = segmentVelocity * 0.25f; - float minimalDamageHeadVelocity = segmentVelocity * 0.5f; - float minimalContactDamageBodyVelocity = segmentVelocity * 0.4f; - float minimalDamageBodyVelocity = segmentVelocity * 0.8f; - if (npc.type == NPCID.EaterofWorldsHead) - { - if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - if (npc.type == NPCID.EaterofWorldsHead || (npc.type != NPCID.EaterofWorldsHead && Main.npc[(int)npc.ai[1]].alpha >= 85)) { if (npc.alpha > 0 && npc.life > 0) @@ -773,554 +711,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaEaterofWorldsAI(NPC npc, Mod mod) - { - if (Main.netMode != NetmodeID.MultiplayerClient && Main.expertMode) - { - if (npc.type == NPCID.EaterofWorldsBody && ((double)(npc.position.Y / 16f) < Main.worldSurface || Main.getGoodWorld)) - { - int num7 = (int)(npc.Center.X / 16f); - int num8 = (int)(npc.Center.Y / 16f); - if (WorldGen.InWorld(num7, num8) && Main.tile[num7, num8].WallType == WallID.None) - { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.localAI[1] += 1f; - else - npc.localAI[1] -= 1f; - - int vileSpitGateValue = Main.masterMode ? 600 : 900; - if (Main.getGoodWorld) - vileSpitGateValue = (int)(vileSpitGateValue * 0.5f); - - Vector2 vileSpitShootLocation = npc.Center + npc.velocity; - if (npc.localAI[1] >= vileSpitGateValue) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vileSpitShootLocation.X, (int)vileSpitShootLocation.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); - - npc.localAI[1] = 0f; - } - - if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) - { - Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); - Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); - dust.noGravity = true; - dust.velocity *= 0.3f; - } - } - } - else if (npc.type == NPCID.EaterofWorldsHead) - { - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - npc.localAI[1] += 1f; - else - npc.localAI[1] -= 1f; - - int vileSpitGateValue = Main.masterMode ? 45 : 90; - vileSpitGateValue += (int)((float)npc.life / (float)npc.lifeMax * 300f); - - Vector2 vileSpitShootLocation = npc.Center + npc.velocity; - if (npc.localAI[1] >= vileSpitGateValue) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Collision.CanHitLine(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - NPC.NewNPC(npc.GetSource_FromAI(), (int)vileSpitShootLocation.X, (int)vileSpitShootLocation.Y, NPCID.VileSpitEaterOfWorlds, 0, 0f, 1f); - - npc.localAI[1] = 0f; - } - - if (npc.localAI[1] > vileSpitGateValue - ProjectileTelegraphDuration) - { - Vector2 dustCenter = vileSpitShootLocation + Main.rand.NextVector2CircularEdge(5f, 5f); - Dust dust = Dust.NewDustDirect(dustCenter, 1, 1, 18, npc.velocity.X * 0.1f, npc.velocity.Y * 0.1f, 80, default, 2f); - dust.noGravity = true; - dust.velocity *= 0.3f; - } - } - } - - npc.realLife = -1; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Main.player[npc.target].dead) - npc.EncourageDespawn(300); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if ((npc.type == NPCID.EaterofWorldsHead || npc.type == NPCID.EaterofWorldsBody) && npc.ai[0] == 0f) - { - if (npc.type == NPCID.EaterofWorldsHead) - { - npc.ai[2] = GetEaterOfWorldsSegmentsCountVanilla(); - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - else if (npc.type == NPCID.EaterofWorldsBody && npc.ai[2] > 0f) - { - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - else - { - npc.ai[0] = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.position.Y + (float)npc.height), npc.type + 1, npc.whoAmI); - Main.npc[(int)npc.ai[0]].CopyInteractions(npc); - } - - Main.npc[(int)npc.ai[0]].ai[1] = npc.whoAmI; - Main.npc[(int)npc.ai[0]].ai[2] = npc.ai[2] - 1f; - npc.netUpdate = true; - } - - if (!Main.npc[(int)npc.ai[1]].active && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsHead && !Main.npc[(int)npc.ai[0]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsTail && !Main.npc[(int)npc.ai[1]].active) - { - npc.life = 0; - npc.HitEffect(); - npc.checkDead(); - npc.active = false; - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - return false; - } - - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsHead; - int num38 = npc.whoAmI; - float num39 = (float)npc.life / (float)npc.lifeMax; - float num40 = npc.ai[0]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num39); - npc.ai[0] = num40; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - npc.whoAmI = num38; - npc.alpha = 0; - } - - if (npc.type == NPCID.EaterofWorldsBody && (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != npc.aiStyle)) - { - npc.type = NPCID.EaterofWorldsTail; - int num41 = npc.whoAmI; - float num42 = (float)npc.life / (float)npc.lifeMax; - float num43 = npc.ai[1]; - npc.SetDefaultsKeepPlayerInteraction(npc.type); - npc.life = (int)((float)npc.lifeMax * num42); - npc.ai[1] = num43; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - npc.whoAmI = num41; - npc.alpha = 0; - } - - if (!npc.active && Main.dedServ) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - } - - int num44 = (int)(npc.position.X / 16f) - 1; - int num45 = (int)((npc.position.X + (float)npc.width) / 16f) + 2; - int num46 = (int)(npc.position.Y / 16f) - 1; - int num47 = (int)((npc.position.Y + (float)npc.height) / 16f) + 2; - if (num44 < 0) - num44 = 0; - - if (num45 > Main.maxTilesX) - num45 = Main.maxTilesX; - - if (num46 < 0) - num46 = 0; - - if (num47 > Main.maxTilesY) - num47 = Main.maxTilesY; - - bool flag2 = false; - - if (!flag2) - { - Vector2 vector2 = default(Vector2); - for (int num48 = num44; num48 < num45; num48++) - { - for (int num49 = num46; num49 < num47; num49++) - { - if (Main.tile[num48, num49] == null || ((!Main.tile[num48, num49].HasUnactuatedTile || (!Main.tileSolid[Main.tile[num48, num49].TileType] && (!Main.tileSolidTop[Main.tile[num48, num49].TileType] || Main.tile[num48, num49].TileFrameY != 0))) && Main.tile[num48, num49].LiquidAmount <= 64)) - continue; - - vector2.X = num48 * 16; - vector2.Y = num49 * 16; - if (npc.position.X + (float)npc.width > vector2.X && npc.position.X < vector2.X + 16f && npc.position.Y + (float)npc.height > vector2.Y && npc.position.Y < vector2.Y + 16f) - { - flag2 = true; - if (Main.rand.NextBool(100) && Main.tile[num48, num49].HasUnactuatedTile && Main.tileSolid[Main.tile[num48, num49].TileType]) - WorldGen.KillTile(num48, num49, fail: true, effectOnly: true); - } - } - } - } - - if (!flag2 && npc.type == NPCID.EaterofWorldsHead) - { - Rectangle rectangle = new Rectangle((int)npc.position.X, (int)npc.position.Y, npc.width, npc.height); - int num50 = Main.masterMode ? 750 : 1000; - bool flag3 = true; - for (int num51 = 0; num51 < Main.maxPlayers; num51++) - { - if (Main.player[num51].active) - { - Rectangle rectangle2 = new Rectangle((int)Main.player[num51].position.X - num50, (int)Main.player[num51].position.Y - num50, num50 * 2, num50 * 2); - if (rectangle.Intersects(rectangle2)) - { - flag3 = false; - break; - } - } - } - - if (flag3) - flag2 = true; - } - - float num52 = 10f; - float num53 = 0.07f; - if (Main.expertMode) - { - num52 = Main.masterMode ? 15f : 12f; - num53 = Main.masterMode ? 0.2f : 0.15f; - } - - if (Main.getGoodWorld) - { - num52 += 4f; - num53 += 0.05f; - } - - Vector2 vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - float num55 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2); - float num56 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2); - num55 = (int)(num55 / 16f) * 16; - num56 = (int)(num56 / 16f) * 16; - vector5.X = (int)(vector5.X / 16f) * 16; - vector5.Y = (int)(vector5.Y / 16f) * 16; - num55 -= vector5.X; - num56 -= vector5.Y; - float num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - if (npc.ai[1] > 0f && npc.ai[1] < (float)Main.npc.Length) - { - try - { - vector5 = new Vector2(npc.position.X + (float)npc.width * 0.5f, npc.position.Y + (float)npc.height * 0.5f); - num55 = Main.npc[(int)npc.ai[1]].position.X + (float)(Main.npc[(int)npc.ai[1]].width / 2) - vector5.X; - num56 = Main.npc[(int)npc.ai[1]].position.Y + (float)(Main.npc[(int)npc.ai[1]].height / 2) - vector5.Y; - } - catch - { - } - - npc.rotation = (float)Math.Atan2(num56, num55) + MathHelper.PiOver2; - num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - int num69 = npc.width; - num69 = (int)((float)num69 * npc.scale); - - if (Main.getGoodWorld) - num69 = 62; - - num68 = (num68 - (float)num69) / num68; - num55 *= num68; - num56 *= num68; - npc.velocity = Vector2.Zero; - npc.position.X += num55; - npc.position.Y += num56; - } - else - { - if (!flag2) - { - npc.velocity.Y += 0.11f; - if (Main.masterMode && npc.velocity.Y > 0f) - npc.velocity.Y += 0.07f; - - if (npc.velocity.Y > num52) - npc.velocity.Y = num52; - - // This bool exists to stop the strange wiggle behavior when worms are falling down - bool slowXVelocity = Math.Abs(npc.velocity.X) > num53; - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.4) - { - if (npc.velocity.X < 0f) - npc.velocity.X -= num53 * 1.1f; - else - npc.velocity.X += num53 * 1.1f; - } - else if (npc.velocity.Y == num52) - { - if (slowXVelocity) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53; - } - else - npc.velocity.X = 0f; - } - else if (npc.velocity.Y > 4f) - { - if (slowXVelocity) - { - if (npc.velocity.X < 0f) - npc.velocity.X += num53 * 0.9f; - else - npc.velocity.X -= num53 * 0.9f; - } - else - npc.velocity.X = 0f; - } - } - else - { - if (npc.soundDelay == 0) - { - float num70 = num68 / 40f; - if (num70 < 10f) - num70 = 10f; - - if (num70 > 20f) - num70 = 20f; - - npc.soundDelay = (int)num70; - SoundEngine.PlaySound(SoundID.WormDig, npc.Center); - } - - num68 = (float)Math.Sqrt(num55 * num55 + num56 * num56); - float num71 = Math.Abs(num55); - float num72 = Math.Abs(num56); - float num73 = num52 / num68; - num55 *= num73; - num56 *= num73; - bool flag4 = false; - if (npc.type == NPCID.EaterofWorldsHead && ((!Main.player[npc.target].ZoneCorrupt && !Main.player[npc.target].ZoneCrimson) || Main.player[npc.target].dead)) - flag4 = true; - - if (flag4) - { - bool flag5 = true; - for (int num74 = 0; num74 < Main.maxPlayers; num74++) - { - if (Main.player[num74].active && !Main.player[num74].dead && Main.player[num74].ZoneCorrupt) - flag5 = false; - } - - if (flag5) - { - if (Main.netMode != NetmodeID.MultiplayerClient && (double)(npc.position.Y / 16f) > (Main.rockLayer + (double)Main.maxTilesY) / 2.0) - { - npc.active = false; - int num75 = (int)npc.ai[0]; - while (num75 > 0 && num75 < Main.maxNPCs && Main.npc[num75].active && Main.npc[num75].aiStyle == npc.aiStyle) - { - int num76 = (int)Main.npc[num75].ai[0]; - Main.npc[num75].active = false; - npc.life = 0; - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num75); - - num75 = num76; - } - - if (Main.dedServ) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - } - - num55 = 0f; - num56 = num52; - } - } - - if ((npc.velocity.X > 0f && num55 > 0f) || (npc.velocity.X < 0f && num55 < 0f) || (npc.velocity.Y > 0f && num56 > 0f) || (npc.velocity.Y < 0f && num56 < 0f)) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53; - - if (npc.velocity.Y < num56) - npc.velocity.Y += num53; - else if (npc.velocity.Y > num56) - npc.velocity.Y -= num53; - - if ((double)Math.Abs(num56) < (double)num52 * 0.2 && ((npc.velocity.X > 0f && num55 < 0f) || (npc.velocity.X < 0f && num55 > 0f))) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num53 * 2f; - else - npc.velocity.Y -= num53 * 2f; - } - - if ((double)Math.Abs(num55) < (double)num52 * 0.2 && ((npc.velocity.Y > 0f && num56 < 0f) || (npc.velocity.Y < 0f && num56 > 0f))) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num53 * 2f; - else - npc.velocity.X -= num53 * 2f; - } - } - else if (num71 > num72) - { - if (npc.velocity.X < num55) - npc.velocity.X += num53 * 1.1f; - else if (npc.velocity.X > num55) - npc.velocity.X -= num53 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y += num53; - else - npc.velocity.Y -= num53; - } - } - else - { - if (npc.velocity.Y < num56) - npc.velocity.Y += num53 * 1.1f; - else if (npc.velocity.Y > num56) - npc.velocity.Y -= num53 * 1.1f; - - if ((double)(Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) < (double)num52 * 0.5) - { - if (npc.velocity.X > 0f) - npc.velocity.X += num53; - else - npc.velocity.X -= num53; - } - } - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) + MathHelper.PiOver2; - if (npc.type == NPCID.EaterofWorldsHead) - { - if (flag2) - { - if (npc.localAI[0] != 1f) - npc.netUpdate = true; - - npc.localAI[0] = 1f; - } - else - { - if (npc.localAI[0] != 0f) - npc.netUpdate = true; - - npc.localAI[0] = 0f; - } - - if (((npc.velocity.X > 0f && npc.oldVelocity.X < 0f) || (npc.velocity.X < 0f && npc.oldVelocity.X > 0f) || (npc.velocity.Y > 0f && npc.oldVelocity.Y < 0f) || (npc.velocity.Y < 0f && npc.oldVelocity.Y > 0f)) && !npc.justHit) - npc.netUpdate = true; - } - } - - // 10 seconds of resistance to prevent spawn killing - if (npc.Calamity().newAI[1] < DRIncreaseTime && ((npc.position - npc.oldPosition).Length() > 2f || npc.Calamity().newAI[1] > 0f)) - npc.Calamity().newAI[1] += 1f; - - // Calculate contact damage based on velocity - // This worm requires more velocity to deal damage with the body because it doesn't have spikes or metal bits or etc. - float minimalContactDamageHeadVelocity = num52 * 0.25f; - float minimalDamageHeadVelocity = num52 * 0.5f; - float minimalContactDamageBodyVelocity = num52 * 0.4f; - float minimalDamageBodyVelocity = num52 * 0.8f; - if (npc.type == NPCID.EaterofWorldsHead) - { - if (npc.velocity.Length() <= minimalContactDamageHeadVelocity) - { - npc.damage = (int)Math.Round(npc.defDamage * 0.5); - } - else - { - float velocityDamageScalar = MathHelper.Clamp((npc.velocity.Length() - minimalContactDamageHeadVelocity) / minimalDamageHeadVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp((float)Math.Round(npc.defDamage * 0.5), npc.defDamage, velocityDamageScalar); - } - } - else - { - float bodyAndTailVelocity = (npc.position - npc.oldPosition).Length(); - if (bodyAndTailVelocity <= minimalContactDamageBodyVelocity) - { - npc.damage = 0; - } - else - { - float velocityDamageScalar = MathHelper.Clamp((bodyAndTailVelocity - minimalContactDamageBodyVelocity) / minimalDamageBodyVelocity, 0f, 1f); - npc.damage = (int)MathHelper.Lerp(0f, npc.defDamage, velocityDamageScalar); - } - } - - if (npc.type == NPCID.EaterofWorldsHead || (npc.type != NPCID.EaterofWorldsHead && Main.npc[(int)npc.ai[1]].alpha >= 85)) - { - if (npc.alpha > 0 && npc.life > 0) - { - for (int num80 = 0; num80 < 2; num80++) - { - int num81 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.Demonite, 0f, 0f, 100, default, 2f); - Main.dust[num81].noGravity = true; - Main.dust[num81].noLight = true; - } - } - - if ((npc.position - npc.oldPosition).Length() > 2f) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - } - else if (npc.type > NPCID.EaterofWorldsHead && npc.alpha > 0) - { - npc.alpha -= 42; - if (npc.alpha < 0) - npc.alpha = 0; - } - - return false; - } - public static int GetEaterOfWorldsSegmentsCountRevDeath() { - return CalamityWorld.LegendaryMode ? 100 : - (CalamityWorld.death || BossRushEvent.BossRushActive) ? ((Main.masterMode || BossRushEvent.BossRushActive) ? 60 : 57) : - ((Main.masterMode || BossRushEvent.BossRushActive) ? 68 : 62); - } - - public static int GetEaterOfWorldsSegmentsCountVanilla() - { - return (Main.masterMode || BossRushEvent.BossRushActive) ? 75 : Main.expertMode ? 70 : 65; + return Main.getGoodWorld ? 100 : (CalamityWorld.death || BossRushEvent.BossRushActive) ? 57 : 62; } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs index 778d63ffa4..5a5ab61042 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EmpressofLightAI.cs @@ -12,13 +12,33 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class EmpressofLightAI { + // NOTE: This is applied to all difficulties, in CalamityPlayerHitHurt + public static float EverlastingRainbowTrailDamageMult = 0.75f; + + // Vanilla values + public static float DashDamageMult = 1.5f; // 165 + public static int PrismaticBoltDamage = 30; // 120 + public static int EverlastingRainbowDamage = 30; // 120 + public static int EtherealLanceDamage = 30; // 120 + public static int SunDanceDamage = 35; // 140 + public static int Phase2PrismaticBoltDamage = 35; // 140 + public static int Phase2EverlastingRainbowDamage = 35; // 140 + public static int Phase2EtherealLanceDamage = 35; // 140 + public static int Phase2SunDanceDamage = 40; // 160 + + // Vanilla sets her defDamage to 184 (80 * 2 * 1.15) in Expert Mode + // However, some weird contraption in her Expert AI that knocks her base contact damage to the intended value of 110 + // This hasn't been found anywhere so our solution for now is avoid using defDamage altogether + public static int ContactDamageCorrection = Main.masterMode ? 248 : 110; + + public static int CalculateDamageForEnrage(this int damage) => NPC.ShouldEmpressBeEnraged() ? damage * 2 : damage; + public static bool BuffedEmpressofLightAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); // Difficulty bools. - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Rotation npc.rotation = npc.velocity.X * 0.005f; @@ -34,6 +54,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); bool phase3 = lifeRatio <= phase3LifeRatio; + int boltDamage = (phase2 ? Phase2PrismaticBoltDamage : PrismaticBoltDamage).CalculateDamageForEnrage(); + int rainbowDamage = (phase2 ? Phase2EverlastingRainbowDamage : EverlastingRainbowDamage).CalculateDamageForEnrage(); + int lanceDamage = (phase2 ? Phase2EtherealLanceDamage : EtherealLanceDamage).CalculateDamageForEnrage(); + int sunDanceDamage = (phase2 ? Phase2SunDanceDamage : SunDanceDamage).CalculateDamageForEnrage(); + bool shouldBeInPhase2ButIsStillInPhase1 = lifeRatio <= phase2LifeRatio && !phase2; if (shouldBeInPhase2ButIsStillInPhase1) calamityGlobalNPC.DR = 0.99f; @@ -44,9 +69,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.life == npc.lifeMax && dayTimeEnrage && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) npc.ai[3] += 2f; - npc.Calamity().CurrentlyEnraged = !bossRush && dayTimeEnrage; - - int projectileDamageMultiplier = dayTimeEnrage ? 2 : 1; + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && dayTimeEnrage; Vector2 rainbowStreakDistance = new Vector2(-250f, -350f); Vector2 everlastingRainbowDistance = new Vector2(0f, -450f); @@ -354,7 +377,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); NPCAimedTarget targetData5 = npc.GetTargetData(); bool despawnFlag = false; - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !BossRushEvent.BossRushActive) { if (!Main.dayTime) despawnFlag = true; @@ -399,14 +422,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] < 60f) AI_120_HallowBoss_DoMagicEffect(npc.Center + randomStreakOffset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - int streakSpawnFrequency = CalamityWorld.LegendaryMode ? 1 : 2; + int streakSpawnFrequency = Main.getGoodWorld ? 1 : 2; if (phase3) streakSpawnFrequency *= 2; if ((int)npc.ai[1] % streakSpawnFrequency == 0 && npc.ai[1] < 60f) { int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = boltDamage; float ai3 = npc.ai[1] / 60f; Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -10f : -8f).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); @@ -418,21 +441,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); if (phase3) { - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, -rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); - if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj2].extraUpdates += 1; - Main.projectile[proj2].netUpdate = true; - } - } - - if (Main.rand.NextBool(60) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + randomStreakOffset, -rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); } } @@ -540,7 +552,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = lanceDamage; Vector2 v3 = targetHoverPos - spawnLocation; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -614,15 +626,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] % 42f == 0f && npc.ai[1] < 42f) { float projRotation = MathHelper.TwoPi * Main.rand.NextFloat(); - float totalProjectiles = CalamityWorld.LegendaryMode ? 30f : death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); + float totalProjectiles = Main.getGoodWorld ? 30f : death ? (dayTimeEnrage ? 22f : 15f) : (dayTimeEnrage ? 18f : 13f); int projIndex = 0; bool inversePhase2SpreadPattern = Main.rand.NextBool(); for (float i = 0f; i < 1f; i += 1f / totalProjectiles) { int projectileType = ProjectileID.HallowBossLastingRainbow; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = rainbowDamage; int projectileType2 = ProjectileID.HallowBossRainbowStreak; - int projectileDamage2 = npc.GetProjectileDamage(projectileType2) * projectileDamageMultiplier; + int projectileDamage2 = boltDamage; float projRotationMultiplier = i; Vector2 spinningpoint = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 + MathHelper.TwoPi * projRotationMultiplier + projRotation); @@ -630,7 +642,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float initialVelocity = death ? 2f : 1.75f; if (dayTimeEnrage && projIndex % 2 == 0) initialVelocity *= 2f; - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) initialVelocity *= 1.5f; // Given that maxAddedVelocity = 2 @@ -676,7 +688,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = 0; // Increase durability. - calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (bossRush ? 0.99f : 0.575f); + calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : 0.575f; int totalSunDances = phase2 ? 2 : 3; float sunDanceGateValue = dayTimeEnrage ? 35f : death ? 40f : 50f; @@ -693,7 +705,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] % sunDanceGateValue == 0f && npc.ai[1] < totalSunDancePhaseTime) { int projectileType = ProjectileID.FairyQueenSunDance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = sunDanceDamage; int sunDanceExtension = (int)(npc.ai[1] / sunDanceGateValue); int targetFloatDirection = (targetData2.Center.X > npc.Center.X) ? 1 : 0; @@ -813,7 +825,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = lanceDamage; for (float i = 0f; i <= 1f; i += 1f / totalProjectiles) { @@ -895,7 +907,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((npc.ai[1] - 1f) % rainbowStreakGateValue == 0f) { int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = boltDamage; float ai3 = (npc.ai[1] - chargeGateValue - 1f) / chargeDuration; Vector2 rainbowStreakVelocity = new Vector2(0f, death ? -5f : -4f).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); @@ -912,11 +924,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, rainbowStreakVelocity, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, ai3); - if (Main.rand.NextBool(30) && CalamityWorld.LegendaryMode) - { + if (Main.getGoodWorld) Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; - } } // Spawn extra homing Rainbow Streaks per player. @@ -936,7 +945,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == chargeGateValue + chargeDuration) npc.velocity *= 0.45f; - npc.damage = (int)Math.Round(npc.defDamage * (dayTimeEnrage ? 3D : 1.5)); + // Unlike other temporary damage boosts from bosses, vanilla Empress AI increases damage as defDamage while dashing, so we don't need to account for it + npc.damage = (int)Math.Round(ContactDamageCorrection.CalculateDamageForEnrage() * DashDamageMult); } else { @@ -1065,7 +1075,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } int projectileType = ProjectileID.FairyQueenLance; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = lanceDamage; Vector2 v = straightLanceSpawnPredict - straightLanceSpawnDirection; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -1142,27 +1152,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((int)npc.ai[1] % stationaryStreakSpawnFrequency == 0 && shouldSpawnStreaks) { int projectileType = ProjectileID.HallowBossRainbowStreak; - int projectileDamage = npc.GetProjectileDamage(projectileType) * projectileDamageMultiplier; + int projectileDamage = boltDamage; Vector2 vector = new Vector2(0f, (death ? -24f : -22f) - (phase3 ? ((death ? 6f : 4f) * streakHomeTime) : 0f)).RotatedBy(MathHelper.TwoPi * streakHomeTime); if (Main.netMode != NetmodeID.MultiplayerClient) { - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, streakHomeTime); if (phase3) { int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projRandomOffset, -vector, projectileType, projectileDamage, 0f, Main.myPlayer, npc.target, 1f - streakHomeTime); - if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) { Main.projectile[proj2].extraUpdates += 1; Main.projectile[proj2].netUpdate = true; } } - - if (Main.rand.NextBool(15) && CalamityWorld.LegendaryMode) - { - Main.projectile[proj].extraUpdates += 1; - Main.projectile[proj].netUpdate = true; - } } // Spawn extra homing Rainbow Streaks per player. @@ -1211,7 +1215,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool shouldDespawn = false; if (!trueDespawnFlag) { - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !bossRush) + if (npc.AI_120_HallowBoss_IsGenuinelyEnraged() && !BossRushEvent.BossRushActive) { if (!Main.dayTime) shouldDespawn = true; @@ -1293,1054 +1297,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaEmpressofLightAI(NPC npc, Mod mod) - { - CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - Vector2 stopMovingLocation = new Vector2(-250f, -350f); - Vector2 stopMovingLocation3 = new Vector2(0f, -450f); - Vector2 stopMovingLocation4 = new Vector2(0f, -450f); - Vector2 stopMovingLocation5 = new Vector2(-80f, -500f); - - // Rotation - npc.rotation = npc.velocity.X * 0.005f; - - // Reset DR every frame - calamityGlobalNPC.DR = 0.15f; - - bool phase2 = npc.AI_120_HallowBoss_IsInPhase2(); - bool expertMode = Main.expertMode; - bool masterMode = Main.masterMode; - bool expertModePhase2 = phase2 && expertMode; - bool masterModePhase2 = phase2 && masterMode; - float phase2LifeRatio = masterMode ? 0.7f : expertMode ? 0.6f : 0.5f; - float phase3LifeRatio = masterMode ? 0.3f : 0.15f; - bool genuinePhase2 = npc.life / (float)npc.lifeMax <= phase2LifeRatio; - bool phase3 = npc.life / (float)npc.lifeMax <= phase3LifeRatio && expertMode; - - bool shouldBeInPhase2ButIsStillInPhase1 = npc.life / (float)npc.lifeMax <= phase2LifeRatio && !phase2; - if (shouldBeInPhase2ButIsStillInPhase1) - calamityGlobalNPC.DR = 0.99f; - - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = shouldBeInPhase2ButIsStillInPhase1 || npc.ai[0] == 6f; - - bool enraged = NPC.ShouldEmpressBeEnraged(); - if (npc.life == npc.lifeMax && enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - calamityGlobalNPC.CurrentlyEnraged = !BossRushEvent.BossRushActive && enraged; - - int projectileDamageMultiplier = enraged ? 2 : 1; - - bool becomeVisible = true; - - float moveSpeed = masterMode ? 0.6f : expertMode ? 0.55f : 0.5f; - float desiredVelocity = masterMode ? 14.4f : expertMode ? 13.2f : 12f; - float stopMovingDistance = 40f; - float despawnDistance = 6400f; - int lanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenLance); - int rainbowStreakDamage = npc.GetProjectileDamage(ProjectileID.HallowBossRainbowStreak); - int lastingRainbowDamage = npc.GetProjectileDamage(ProjectileID.HallowBossLastingRainbow); - int sunDanceDamage = npc.GetProjectileDamage(ProjectileID.FairyQueenSunDance); - - lanceDamage *= projectileDamageMultiplier; - rainbowStreakDamage *= projectileDamageMultiplier; - lastingRainbowDamage *= projectileDamageMultiplier; - sunDanceDamage *= projectileDamageMultiplier; - - if (enraged) - expertMode = true; - - bool takeDamage = true; - int reducedAttackCooldown = 0; - if (phase2) - reducedAttackCooldown += 15; - if (expertMode) - reducedAttackCooldown += 5; - - // Variables for dust visuals on spawn and in phase 3 - float playSpawnSoundTime = 10f; - float stopSpawningDustTime = 150f; - float spawnTime = 180f; - - // Do visual stuff in phase 3 - float maxOpacity = phase3 ? 0.7f : 1f; - int minAlpha = 255 - (int)(255 * maxOpacity); - if (phase3) - { - if (calamityGlobalNPC.newAI[0] == playSpawnSoundTime) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - if (calamityGlobalNPC.newAI[0] > playSpawnSoundTime && calamityGlobalNPC.newAI[0] < stopSpawningDustTime) - CreateSpawnDust(npc, false); - - calamityGlobalNPC.newAI[0] += 1f; - if (calamityGlobalNPC.newAI[0] >= stopSpawningDustTime) - { - calamityGlobalNPC.newAI[0] = playSpawnSoundTime + 1f; - npc.SyncExtraAI(); - } - } - - switch ((int)npc.ai[0]) - { - case 0: - - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - npc.velocity = new Vector2(0f, 5f); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + new Vector2(0f, -80f), Vector2.Zero, ProjectileID.HallowBossDeathAurora, 0, 0f, Main.myPlayer); - } - - if (npc.ai[1] == playSpawnSoundTime) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - npc.velocity *= 0.95f; - if (npc.ai[1] > playSpawnSoundTime && npc.ai[1] < stopSpawningDustTime) - CreateSpawnDust(npc); - - npc.ai[1] += 1f; - becomeVisible = false; - takeDamage = false; - npc.Opacity = MathHelper.Clamp(npc.ai[1] / spawnTime, 0f, 1f); - if (npc.ai[1] >= spawnTime) - { - if (enraged && !npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - npc.ai[3] += 2f; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - break; - - case 1: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float phaseTime = (phase2 ? 20f : 45f); - if (masterMode) - phaseTime /= 2f; - if (Main.getGoodWorld) - phaseTime /= 2f; - if (phaseTime < 10f) - phaseTime = 10f; - - if (npc.ai[1] <= 10f) - { - if (npc.ai[1] == 0f) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - NPCAimedTarget targetData = npc.GetTargetData(); - if (targetData.Invalid) - { - npc.ai[0] = 13f; - npc.ai[1] = 0f; - npc.ai[2] += 1f; - npc.velocity /= 4f; - npc.netUpdate = true; - break; - } - - Vector2 center = targetData.Center; - npc.DirectionTo(center); - center += new Vector2(0f, -300f); - if (npc.Distance(center) > 200f) - center -= npc.DirectionTo(center) * 100f; - - Vector2 distanceFromTarget = center - npc.Center; - float lerpValue = Utils.GetLerpValue(100f, 600f, distanceFromTarget.Length(), clamped: true); - float movementVelocity = distanceFromTarget.Length(); - if (movementVelocity > 18f) - movementVelocity = 18f; - - npc.velocity = Vector2.Lerp(distanceFromTarget.SafeNormalize(Vector2.Zero) * movementVelocity, distanceFromTarget / 6f, lerpValue); - - npc.netUpdate = true; - } - - if (npc.velocity.Length() > 16f && npc.ai[1] > 10f) - npc.velocity /= 2f; - - npc.velocity *= 0.92f; - npc.ai[1] += 1f; - if (!(npc.ai[1] >= phaseTime)) - break; - - int phaseIncrement = (int)npc.ai[2]; - int phase = 2; - int phaseDivisor = 0; - if (!phase2) - { - int num38 = phaseDivisor++; - int num39 = phaseDivisor++; - int num40 = phaseDivisor++; - int num41 = phaseDivisor++; - int num42 = phaseDivisor++; - int num43 = phaseDivisor++; - int num44 = phaseDivisor++; - int num45 = phaseDivisor++; - int num46 = phaseDivisor++; - int num47 = phaseDivisor++; - if (phaseIncrement % phaseDivisor == num38) - phase = 2; - - if (phaseIncrement % phaseDivisor == num39) - phase = 8; - - if (phaseIncrement % phaseDivisor == num40) - phase = 6; - - if (phaseIncrement % phaseDivisor == num41) - phase = 8; - - if (phaseIncrement % phaseDivisor == num42) - phase = 5; - - if (phaseIncrement % phaseDivisor == num43) - phase = 2; - - if (phaseIncrement % phaseDivisor == num44) - phase = 8; - - if (phaseIncrement % phaseDivisor == num45) - phase = 4; - - if (phaseIncrement % phaseDivisor == num46) - phase = 8; - - if (phaseIncrement % phaseDivisor == num47) - phase = 5; - - if (genuinePhase2) - phase = 10; - } - - if (phase2) - { - int num48 = phaseDivisor++; - int num49 = phaseDivisor++; - int num50 = phaseDivisor++; - int num51 = -1; - if (expertMode) - num51 = phaseDivisor++; - - int num52 = phaseDivisor++; - int num53 = phaseDivisor++; - int num54 = phaseDivisor++; - int num55 = phaseDivisor++; - int num56 = phaseDivisor++; - int num57 = phaseDivisor++; - if (phaseIncrement % phaseDivisor == num48) - phase = 7; - - if (phaseIncrement % phaseDivisor == num49) - phase = phase3 ? 8 : 2; - - if (phaseIncrement % phaseDivisor == num50) - phase = 8; - - if (phaseIncrement % phaseDivisor == num52) - phase = 5; - - if (phaseIncrement % phaseDivisor == num53) - phase = 2; - - if (phaseIncrement % phaseDivisor == num54) - phase = phase3 ? 4 : 6; - - if (phaseIncrement % phaseDivisor == num54) - phase = phase3 ? 7 : 6; - - if (phaseIncrement % phaseDivisor == num55) - phase = 4; - - if (phaseIncrement % phaseDivisor == num56) - phase = 8; - - if (phaseIncrement % phaseDivisor == num51) - phase = 11; - - if (phaseIncrement % phaseDivisor == num57) - phase = 12; - } - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - NPCAimedTarget targetData2 = npc.GetTargetData(); - bool transitionToEnrage = false; - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - { - if (!Main.dayTime) - transitionToEnrage = true; - - if (Main.dayTime && Main.time >= 53400D) - transitionToEnrage = true; - } - - if (targetData2.Invalid || npc.Distance(targetData2.Center) > despawnDistance || transitionToEnrage) - phase = 13; - - if (phase == 8 && targetData2.Center.X > npc.Center.X) - phase = 9; - - if (expertMode && phase != 5 && phase != 12) - npc.velocity = npc.DirectionFrom(targetData2.Center).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * (float)(targetData2.Center.X > npc.Center.X).ToDirectionInt()) * 20f; - - npc.ai[0] = phase; - npc.ai[1] = 0f; - - int oneInXChance = masterMode ? 3 : 4; - if (phase3) - oneInXChance--; - - float numPhaseIncrements = expertMode ? (Main.rand.NextBool(oneInXChance) ? 2f : 1f) : 1f; - npc.ai[2] += numPhaseIncrements; - npc.netUpdate = true; - - break; - } - - case 2: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item164, npc.Center); - - float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; - Vector2 offset = new Vector2(-55f, -30f); - NPCAimedTarget targetData11 = npc.GetTargetData(); - Vector2 targetCenter = (targetData11.Invalid ? npc.Center : targetData11.Center); - if (npc.Distance(targetCenter + stopMovingLocation) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetCenter + stopMovingLocation).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if (npc.ai[1] < 60f) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int rainbowStreakGateValue = 3; - if (expertMode) - rainbowStreakGateValue = 2; - if (phase3) - rainbowStreakGateValue *= 2; - - if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && npc.ai[1] < 60f) - { - float ai3 = npc.ai[1] / 60f; - Vector2 rainbowStreakVelocity = new Vector2(0f, -6f - (masterMode ? (ai3 * 4f) : expertMode ? (ai3 * 2f) : 0f)).RotatedBy(MathHelper.PiOver2 * Main.rand.NextFloatDirection()); - if (expertModePhase2) - rainbowStreakVelocity = new Vector2(0f, -10f - (masterMode ? (ai3 * 5f) : expertMode ? (ai3 * 2.5f) : 0f)).RotatedBy(MathHelper.TwoPi * Main.rand.NextFloat()); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai3); - if (phase3) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - ai3); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num92 = (int)(npc.ai[1] / (float)rainbowStreakGateValue); - for (int num93 = 0; num93 < Main.maxPlayers; num93++) - { - if (npc.Boss_CanShootExtraAt(num93, num92 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, num93, ai3); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - /*case 3: - { - npc.ai[1] += 1f; - NPCAimedTarget targetData8 = npc.GetTargetData(); - Vector2 vector23 = (targetData8.Invalid ? npc.Center : targetData8.Center); - if (npc.Distance(vector23 + vector2) > num3) - npc.SimpleFlyMovement(npc.DirectionTo(vector23 + vector2).SafeNormalize(Vector2.Zero) * num2, num); - - if ((int)npc.ai[1] % 180 == 0) - { - Vector2 vector24 = new Vector2(0f, -100f); - Projectile.NewProjectile(npc.GetSource_FromAI(), targetData8.Center + vector24, Vector2.Zero, ProjectileID.HallowBossDeathAurora, num5, 0f, Main.myPlayer); - } - - if (npc.ai[1] >= 120f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - }*/ - - case 4: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = 20 - reducedAttackCooldown; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - float lanceGateValue = masterMode ? 75f : 100f; - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - int radialSpawnOffset = masterMode ? 6 : expertMode ? 5 : 4; - int lanceSpawnGateValue = masterMode ? 3 : 4; - if ((int)npc.ai[1] % lanceSpawnGateValue == 0 && npc.ai[1] < lanceGateValue) - { - int lanceAmount = phase3 ? 2 : 1; - for (int i = 0; i < lanceAmount; i++) - { - int num85 = (int)npc.ai[1] / lanceSpawnGateValue; - radialSpawnOffset += (masterMode ? 3 : 2) * i; - Vector2 radialOffset = Vector2.UnitX.RotatedBy((float)Math.PI / (float)(radialSpawnOffset * 2) + (float)num85 * ((float)Math.PI / (float)radialSpawnOffset) + 0f); - if (masterMode) - radialOffset.X += (radialOffset.X > 0f ? -0.5f : 0.5f); - else if (!expertMode) - radialOffset.X += (radialOffset.X > 0f ? 0.5f : -0.5f); - - radialOffset = radialOffset.SafeNormalize(Vector2.UnitY); - float lanceSpawnDistance = 300f; - if (expertMode) - lanceSpawnDistance = 450f; - - Vector2 targetCenter = targetData.Center; - if (npc.Distance(targetCenter) > 2400f) - continue; - - if (Vector2.Dot(targetData.Velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) - radialOffset *= -1f; - - int targetVelocityOffset = 90; - Vector2 vector31 = targetCenter + targetData.Velocity * targetVelocityOffset; - Vector2 vector32 = targetCenter + radialOffset * lanceSpawnDistance - targetData.Velocity * 30f; - if (vector32.Distance(targetCenter) < lanceSpawnDistance) - { - Vector2 vector33 = targetCenter - vector32; - if (vector33 == Vector2.Zero) - vector33 = radialOffset; - - vector32 = targetCenter - vector33.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; - } - - Vector2 v3 = vector31 - vector32; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - int num88 = (int)(npc.ai[1] / (float)lanceSpawnGateValue); - for (int num89 = 0; num89 < Main.maxPlayers; num89++) - { - if (!npc.Boss_CanShootExtraAt(num89, num88 % 3, 3, 2400f)) - continue; - - Player player2 = Main.player[num89]; - targetCenter = player2.Center; - if (Vector2.Dot(player2.velocity.SafeNormalize(Vector2.UnitY), radialOffset) > 0f) - radialOffset *= -1f; - - Vector2 vector34 = targetCenter + player2.velocity * targetVelocityOffset; - vector32 = targetCenter + radialOffset * lanceSpawnDistance - player2.velocity * 30f; - if (vector32.Distance(targetCenter) < lanceSpawnDistance) - { - Vector2 vector35 = targetCenter - vector32; - if (vector35 == Vector2.Zero) - vector35 = radialOffset; - - vector32 = targetCenter - vector35.SafeNormalize(Vector2.UnitY) * lanceSpawnDistance; - } - - v3 = vector34 - vector32; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector32, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, v3.ToRotation(), npc.ai[1] / lanceGateValue); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lanceGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 5: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item163, npc.Center); - - float extraPhaseTime = masterMode ? 22f : 30f; - extraPhaseTime -= (float)reducedAttackCooldown; - - Vector2 offset = new Vector2(55f, -30f); - Vector2 lastingRainbowInitialSpawnLocation = npc.Center + offset; - - float lastingRainbowGateValue = 42f; - if (npc.ai[1] < lastingRainbowGateValue) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 3, Utils.GetLerpValue(0f, lastingRainbowGateValue, npc.ai[1], clamped: true), npc); - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation4) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if ((int)npc.ai[1] % (int)lastingRainbowGateValue == 0 && npc.ai[1] < lastingRainbowGateValue) - { - float lastingRainbowRandomRotation = MathHelper.TwoPi * Main.rand.NextFloat(); - float numLastingRainbows = 13f; - for (float i = 0f; i < 1f; i += 1f / numLastingRainbows) - { - float ai1 = i; - Vector2 lastingRainbowVelocity = Vector2.UnitY.RotatedBy(MathHelper.PiOver2 + MathHelper.TwoPi * ai1 + lastingRainbowRandomRotation); - Vector2 lastingRainbowSpawnLocation = lastingRainbowInitialSpawnLocation + lastingRainbowVelocity.RotatedBy(-MathHelper.PiOver2) * 30f; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 10f : 8f), ProjectileID.HallowBossLastingRainbow, lastingRainbowDamage, 0f, Main.myPlayer, 0f, ai1); - - if (phase3) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lastingRainbowSpawnLocation, lastingRainbowVelocity * (masterMode ? 12f : 10f), ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, ai1); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lastingRainbowGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 6: - { - // Avoid cheap bullshit. - npc.damage = 0; - - // Increase durability. - calamityGlobalNPC.DR = shouldBeInPhase2ButIsStillInPhase1 ? 0.99f : (BossRushEvent.BossRushActive ? 0.99f : 0.575f); - - float extraPhaseTime = (masterMode ? 105 : expertMode ? 120 : 135) - reducedAttackCooldown; - Vector2 offset = new Vector2(0f, -100f); - Vector2 sunDanceSpawnLocation = npc.Center + offset; - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation5) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation5).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.3f, moveSpeed * 0.7f); - - float phaseGateValue = masterMode ? 120f : 180f; - int sunDanceGateValue = 60; - if ((int)npc.ai[1] % sunDanceGateValue == 0 && npc.ai[1] < phaseGateValue) - { - int sunDanceSpawnOffset = (int)npc.ai[1] / sunDanceGateValue; - int targetLocationX = ((targetData.Center.X > npc.Center.X) ? 1 : 0); - float numSunDancePetals = masterMode ? 9f : expertMode ? 8f : 6f; - float sunDanceIncrement = 1f / numSunDancePetals; - for (float i = 0f; i < 1f; i += sunDanceIncrement) - { - float radialOffset = (i + sunDanceIncrement * 0.5f + (float)sunDanceSpawnOffset * sunDanceIncrement * 0.5f) % 1f; - float ai = MathHelper.TwoPi * (radialOffset + (float)targetLocationX); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), sunDanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenSunDance, sunDanceDamage, 0f, Main.myPlayer, ai, npc.whoAmI); - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= phaseGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 7: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = masterMode ? 34f : expertMode ? 40f : 20f; - float lanceGateValue = masterMode ? 34f : expertMode ? 40f : 60f; - float totalLanceWalls = expertMode ? 6f : 4f; - float lancePhaseTime = lanceGateValue * totalLanceWalls; - - extraPhaseTime -= (float)reducedAttackCooldown; - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 vector25 = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(vector25 + stopMovingLocation4) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(vector25 + stopMovingLocation4).SafeNormalize(Vector2.Zero) * desiredVelocity * 0.4f, moveSpeed); - - if ((float)(int)npc.ai[1] % lanceGateValue == 0f && npc.ai[1] < lancePhaseTime) - { - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - Main.rand.NextFloat(); - int lanceWallType = (int)npc.ai[1] / (int)lanceGateValue; - float numLances = phase3 ? (masterMode ? 18f : 15f) : 13f; - float distanceBetweenLances = phase3 ? (masterMode ? 125f : 135f) : 150f; - float lanceWallLength = numLances * distanceBetweenLances; - Vector2 lanceSpawnOffset = targetData.Center; - if (npc.Distance(lanceSpawnOffset) <= 3200f) - { - Vector2 vector26 = Vector2.Zero; - Vector2 lanceDirection = Vector2.UnitY; - float num77 = 0.4f; - float num78 = 1.4f; - float num79 = 1f; - if (expertMode) - { - numLances += 5f; - distanceBetweenLances += 50f; - lanceWallLength *= (masterMode ? 0.75f : 0.5f); - } - - switch (lanceWallType) - { - case 0: - lanceSpawnOffset += new Vector2((0f - lanceWallLength) / 2f, 0f) * num79; - vector26 = new Vector2(0f, lanceWallLength); - lanceDirection = Vector2.UnitX; - break; - case 1: - lanceSpawnOffset += new Vector2(lanceWallLength / 2f, distanceBetweenLances / 2f) * num79; - vector26 = new Vector2(0f, lanceWallLength); - lanceDirection = -Vector2.UnitX; - break; - case 2: - lanceSpawnOffset += new Vector2(0f - lanceWallLength, 0f - lanceWallLength) * num77 * num79; - vector26 = new Vector2(lanceWallLength * num78, 0f); - lanceDirection = new Vector2(1f, 1f); - break; - case 3: - lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, (0f - lanceWallLength) * num77) * num79; - vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); - lanceDirection = new Vector2(-1f, 1f); - break; - case 4: - lanceSpawnOffset += new Vector2(0f - lanceWallLength, lanceWallLength) * num77 * num79; - vector26 = new Vector2(lanceWallLength * num78, 0f); - lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); - break; - case 5: - lanceSpawnOffset += new Vector2(lanceWallLength * num77 + distanceBetweenLances / 2f, lanceWallLength * num77) * num79; - vector26 = new Vector2((0f - lanceWallLength) * num78, 0f); - lanceDirection = lanceSpawnOffset.DirectionTo(targetData.Center); - break; - } - - for (float lance = 0f; lance <= 1f; lance += 1f / numLances) - { - Vector2 origin = lanceSpawnOffset + vector26 * (lance - 0.5f); - Vector2 lanceRotation = lanceDirection; - if (expertMode) - { - Vector2 predictionVector = targetData.Velocity * 20f * lance; - Vector2 value2 = origin.DirectionTo(targetData.Center + predictionVector); - lanceRotation = Vector2.Lerp(lanceDirection, value2, 0.75f).SafeNormalize(Vector2.UnitY); - } - - float ai2 = lance; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), origin, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, lanceRotation.ToRotation(), ai2); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lancePhaseTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 8: - case 9: - { - float extraPhaseTime = 20 - reducedAttackCooldown; - float startDashTime = 40f; - float playDashSoundTime = 20f; - float endDashTime = phase3 ? 75f : 90f; - int dashStartDistance = phase3 ? 750 : 550; - int dashVelocity = phase3 ? 80 : 50; - float dashAcceleration = phase3 ? 0.08f : 0.05f; - - int dashDirection = (npc.ai[0] != 8f ? 1 : -1); - AI_120_HallowBoss_DoMagicEffect(npc.Center, 5, Utils.GetLerpValue(startDashTime, endDashTime, npc.ai[1], clamped: true), npc); - - if (npc.ai[1] <= startDashTime) - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == playDashSoundTime) - SoundEngine.PlaySound(SoundID.Item160, npc.Center); - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 destination = (targetData.Invalid ? npc.Center : targetData.Center) + new Vector2(dashDirection * -dashStartDistance, 0f); - npc.SimpleFlyMovement(npc.DirectionTo(destination).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed * 2f); - if (npc.ai[1] == startDashTime) - npc.velocity *= 0.3f; - } - else if (npc.ai[1] <= endDashTime) - { - npc.velocity = Vector2.Lerp(value2: new Vector2(dashDirection * dashVelocity, 0f), value1: npc.velocity, amount: dashAcceleration); - if (npc.ai[1] == endDashTime) - npc.velocity *= 0.7f; - - npc.damage = (int)Math.Round(npc.defDamage * (enraged ? 3D : 1.5)); - } - else - { - // Avoid cheap bullshit. - npc.damage = 0; - - npc.velocity *= 0.92f; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= endDashTime + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 10: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = 20 - reducedAttackCooldown; - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item161, npc.Center); - - takeDamage = !(npc.ai[1] >= 30f) || !(npc.ai[1] <= 170f); - npc.velocity *= 0.95f; - if (npc.ai[1] == 90f) - { - if (npc.ai[3] == 0f) - npc.ai[3] = 1f; - - if (npc.ai[3] == 2f) - npc.ai[3] = 3f; - - npc.Center = npc.GetTargetData().Center + new Vector2(0f, -250f); - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 180f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 11: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - SoundEngine.PlaySound(SoundID.Item162, npc.Center); - - float extraPhaseTime = 20 - reducedAttackCooldown; - float lanceGateValue = masterMode ? 75f : 100f; - if (npc.ai[1] >= 6f && npc.ai[1] < 54f) - { - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(-55f, -20f), 2, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - AI_120_HallowBoss_DoMagicEffect(npc.Center + new Vector2(55f, -20f), 4, Utils.GetLerpValue(0f, lanceGateValue, npc.ai[1], clamped: true), npc); - } - - NPCAimedTarget targetData = npc.GetTargetData(); - Vector2 targetLocation = (targetData.Invalid ? npc.Center : targetData.Center); - if (npc.Distance(targetLocation + stopMovingLocation3) > stopMovingDistance) - npc.SimpleFlyMovement(npc.DirectionTo(targetLocation + stopMovingLocation3).SafeNormalize(Vector2.Zero) * desiredVelocity, moveSpeed); - - if ((int)npc.ai[1] % 3 == 0 && npc.ai[1] < lanceGateValue) - { - int numLances = phase3 ? 2 : 1; - for (int i = 0; i < numLances; i++) - { - // Spawn another lance in the opposite location - bool oppositeLance = i == 1; - - Vector2 vector13 = oppositeLance ? targetData.Velocity : -targetData.Velocity; - vector13.SafeNormalize(-Vector2.UnitY); - float lanceSpawnOffset = 100f; - Vector2 targetCenter = targetData.Center; - if (npc.Distance(targetCenter) > 2400f) - continue; - - int targetVelocityOffset = 90; - Vector2 vector14 = targetCenter + (oppositeLance ? -targetData.Velocity : targetData.Velocity) * targetVelocityOffset; - Vector2 lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; - if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) - { - Vector2 vector16 = targetCenter - lanceSpawnLocation; - if (vector16 == Vector2.Zero) - vector16 = vector13; - - lanceSpawnLocation = targetCenter - vector16.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; - } - - Vector2 rotationVector = vector14 - lanceSpawnLocation; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); - - if (Main.netMode == NetmodeID.MultiplayerClient) - continue; - - int rotationIndex = (int)(npc.ai[1] / 3f); - for (int l = 0; l < Main.maxPlayers; l++) - { - if (!npc.Boss_CanShootExtraAt(l, rotationIndex % 3, 3, 2400f)) - continue; - - Player player = Main.player[l]; - vector13 = oppositeLance ? player.velocity : -player.velocity; - vector13.SafeNormalize(-Vector2.UnitY); - lanceSpawnOffset = 100f; - targetCenter = player.Center; - targetVelocityOffset = 90; - Vector2 lanceDestination = targetCenter + (oppositeLance ? -player.velocity : player.velocity) * targetVelocityOffset; - lanceSpawnLocation = targetCenter + vector13 * lanceSpawnOffset; - if (lanceSpawnLocation.Distance(targetCenter) < lanceSpawnOffset) - { - Vector2 vector18 = targetCenter - lanceSpawnLocation; - if (vector18 == Vector2.Zero) - vector18 = vector13; - - lanceSpawnLocation = targetCenter - vector18.SafeNormalize(Vector2.UnitY) * lanceSpawnOffset; - } - - rotationVector = lanceDestination - lanceSpawnLocation; - Projectile.NewProjectile(npc.GetSource_FromAI(), lanceSpawnLocation, Vector2.Zero, ProjectileID.FairyQueenLance, lanceDamage, 0f, Main.myPlayer, rotationVector.ToRotation(), npc.ai[1] / lanceGateValue); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= lanceGateValue + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 12: - { - // Avoid cheap bullshit. - npc.damage = 0; - - float extraPhaseTime = (masterMode ? 30f : expertMode ? 60f : 90f) - (float)reducedAttackCooldown; - Vector2 offset = new Vector2(-55f, -30f); - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -12f); - } - - npc.velocity *= 0.95f; - bool shootRainbowStreaks = npc.ai[1] < 60f && npc.ai[1] >= 10f; - if (shootRainbowStreaks) - AI_120_HallowBoss_DoMagicEffect(npc.Center + offset, 1, Utils.GetLerpValue(0f, 60f, npc.ai[1], clamped: true), npc); - - int rainbowStreakGateValue = 6; - if (expertMode) - rainbowStreakGateValue = 4; - if (phase3) - rainbowStreakGateValue *= 2; - - float radialOffset = (npc.ai[1] - 10f) / 50f; - if ((int)npc.ai[1] % rainbowStreakGateValue == 0 && shootRainbowStreaks) - { - Vector2 rainbowStreakVelocity = (rainbowStreakVelocity = new Vector2(0f, -20f - (phase3 ? ((masterMode ? 10f : 5f) * radialOffset) : 0f)).RotatedBy(MathHelper.TwoPi * radialOffset)); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, radialOffset); - if (phase3) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, -rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, npc.target, 1f - radialOffset); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num24 = (int)(npc.ai[1] % (float)rainbowStreakGateValue); - for (int j = 0; j < Main.maxPlayers; j++) - { - if (npc.Boss_CanShootExtraAt(j, num24 % 3, 3, 2400f)) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + offset, rainbowStreakVelocity, ProjectileID.HallowBossRainbowStreak, rainbowStreakDamage, 0f, Main.myPlayer, j, radialOffset); - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 60f + extraPhaseTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - break; - } - - case 13: - { - // Avoid cheap bullshit. - npc.damage = 0; - - if (npc.ai[1] == 0f) - { - SoundEngine.PlaySound(SoundID.Item165, npc.Center); - npc.velocity = new Vector2(0f, -7f); - } - - npc.velocity *= 0.95f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - NPCAimedTarget targetData = npc.GetTargetData(); - becomeVisible = false; - bool turnInvisible = false; - bool despawn = false; - if (!turnInvisible) - { - if (npc.AI_120_HallowBoss_IsGenuinelyEnraged()) - { - if (!Main.dayTime) - despawn = true; - - if (Main.dayTime && Main.time >= 53400D) - despawn = true; - } - - turnInvisible = turnInvisible || despawn; - } - - if (!turnInvisible) - { - bool noValidTarget = targetData.Invalid || npc.Distance(targetData.Center) > despawnDistance; - turnInvisible = turnInvisible || noValidTarget; - } - - npc.alpha = Utils.Clamp(npc.alpha + turnInvisible.ToDirectionInt() * 5, 0, 255); - bool flag10 = npc.alpha == 0 || npc.alpha == 255; - int totalDust = 5; - for (int i = 0; i < totalDust; i++) - { - float num19 = MathHelper.Lerp(1.3f, 0.7f, npc.Opacity); - Color newColor = Main.hslToRgb(Main.rand.NextFloat(), 1f, 0.5f); - int num20 = Dust.NewDust(npc.position - npc.Size * 0.5f, npc.width * 2, npc.height * 2, DustID.RainbowMk2, 0f, 0f, 0, newColor); - Main.dust[num20].position = npc.Center + Main.rand.NextVector2Circular(npc.width, npc.height); - Main.dust[num20].velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[num20].noGravity = true; - Main.dust[num20].scale = 0.9f + Main.rand.NextFloat() * 1.2f; - Main.dust[num20].fadeIn = 0.4f + Main.rand.NextFloat() * 1.2f * num19; - Main.dust[num20].velocity += Vector2.UnitY * -2f; - Main.dust[num20].scale = 0.35f; - if (num20 != Main.maxDust) - { - Dust dust = Dust.CloneDust(num20); - dust.scale /= 2f; - dust.fadeIn *= 0.85f; - dust.color = new Color(255, 255, 255, 255); - } - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 20f && flag10)) - break; - - if (npc.alpha == 255) - { - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, npc.whoAmI); - - return false; - } - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - break; - } - } - - npc.dontTakeDamage = !takeDamage; - - if (phase3) - npc.defense = (int)Math.Round(npc.defDefense * 0.8); - else if (phase2) - npc.defense = (int)Math.Round(npc.defDefense * 1.2); - else - npc.defense = npc.defDefense; - - if ((npc.localAI[0] += 1f) >= 44f) - npc.localAI[0] = 0f; - - if (becomeVisible) - npc.alpha = Utils.Clamp(npc.alpha - 5, minAlpha, 255); - - Lighting.AddLight(npc.Center, Vector3.One * npc.Opacity); - - return false; - } - private static void CreateSpawnDust(NPC npc, bool useAI = true) { int spawnDustAmount = 2; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs index 4d6bd4d2b2..a5cd8b3f9e 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/EyeOfCthulhuAI.cs @@ -14,6 +14,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { private const float ProjectileOffset = 50f; + // Rev+ exclusive + public static float Phase1ContactDamageMult = 1.333f; // 40 (buffed from 30) + public static float Phase2ContactDamageMult = 1.6f; // 48 (buffed from 36) + public static float Phase3ContactDamageMult = 1.8f; // 54 (buffed from 40) + public static int BloodShotDamage = 8; // 32 + public static bool BuffedEyeofCthulhuAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -23,8 +29,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Phases float phase2LifeRatio = death ? 0.75f : 0.6f; @@ -40,16 +45,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lineUpDist = death ? 15f : 20f; + // Set contact damage + npc.damage = (int)Math.Round(npc.defDamage * (phase3 ? Phase3ContactDamageMult : phase2 ? Phase2ContactDamageMult : Phase1ContactDamageMult)); + // Servant and projectile velocity, the projectile velocity is multiplied by 2 float servantAndProjectileVelocity = death ? 10f : 6f; - - float enrageScale = bossRush ? 2.25f : death ? 0.5f : 0f; - if (Main.IsItDay()) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 2f; - } - npc.reflectsProjectiles = false; // Get a target @@ -118,31 +118,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool charge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= 320f; // 20 tile distance - if (dead) + if ((dead || Main.IsItDay()) && !BossRushEvent.BossRushActive) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) npc.timeLeft = 10; + return false; } else if (npc.ai[0] == 0f) { if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = 0; - - float hoverSpeed = 7f; - float hoverAcceleration = 0.15f; - hoverSpeed += 5f * enrageScale; - hoverAcceleration += 0.1f * enrageScale; - - if (death) - { - hoverSpeed += 7f * (1f - lifeRatio); - hoverAcceleration += 0.15f * (1f - lifeRatio); - } + float hoverSpeed = death ? 9.5f + 7f * (1f - lifeRatio) : 7f; + float hoverAcceleration = death ? 0.2f + 0.15f * (1f - lifeRatio) : 0.15f; if (Main.getGoodWorld) { @@ -192,7 +182,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (spawnServant) { - int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu, 0, 0f, 0f, enrageScale); + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); Main.npc[eye].velocity = servantSpawnVelocity; if (Main.dedServ && eye < Main.maxNPCs) @@ -201,8 +191,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { int projType = ProjectileID.BloodNautilusShot; - int projDamage = npc.GetProjectileDamage(projType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; } } @@ -217,13 +206,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[1] == 1f) { - // Set damage - npc.damage = npc.defDamage; - npc.rotation = eyeRotation; float additionalVelocityPerCharge = 2f; - float chargeSpeed = 8f + npc.ai[3] * additionalVelocityPerCharge; - chargeSpeed += 5f * enrageScale; + float chargeSpeed = (death ? 10.5f : 8f) + npc.ai[3] * additionalVelocityPerCharge; if (death) chargeSpeed += 10f * (1f - lifeRatio); if (Main.getGoodWorld) @@ -236,9 +221,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[1] == 2f) { - // Set damage - npc.damage = npc.defDamage; - int chargeDelay = death ? (75 - (int)Math.Round(30f * (1f - lifeRatio))) : 95; if (Main.getGoodWorld) chargeDelay -= 30; @@ -248,9 +230,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) { - // Avoid cheap bullshit - npc.damage = 0; - float decelerationScalar = death ? ((lifeRatio - phase2LifeRatio) / (1f - phase2LifeRatio)) : 1f; if (decelerationScalar < 0f) decelerationScalar = 0f; @@ -276,9 +255,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float numCharges = death ? 4f : 3f; if (npc.ai[3] >= numCharges) { - // Avoid cheap bullshit - npc.damage = 0; - npc.ai[1] = 0f; npc.ai[3] = 0f; } @@ -289,9 +265,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase2) { - // Avoid cheap bullshit - npc.damage = 0; - npc.ai[0] = 1f; npc.ai[1] = 0f; npc.ai[2] = 0f; @@ -304,9 +277,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { - // Avoid cheap bullshit - npc.damage = 0; - if (Main.getGoodWorld) npc.reflectsProjectiles = true; @@ -338,36 +308,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; if (Main.netMode != NetmodeID.MultiplayerClient) { - int spawnType = NPCID.ServantofCthulhu; - if (death) - { - int maxBloodServants = 2; - bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; - if (spawnBloodServant) - spawnType = ModContent.NPCType(); - } - - int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScale); + int servantSpawn = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); Main.npc[servantSpawn].velocity.X = servantSpawnVelocity.X; Main.npc[servantSpawn].velocity.Y = servantSpawnVelocity.Y; if (Main.dedServ && servantSpawn < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, servantSpawn); - - if (CalamityWorld.LegendaryMode) - { - int type = ProjectileID.BloodNautilusShot; - Vector2 projectileVelocity = Main.rand.NextVector2CircularEdge(15f, 15f); - int numProj = 3; - int spread = 20; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, 15, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 600; - } - } } for (int n = 0; n < 10; n++) @@ -416,27 +362,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { npc.defense = 0; - int setDamage = (int)Math.Round(npc.defDamage * (phase3 ? 1.4 : 1.2)); - int reducedSetDamage = (int)Math.Round(setDamage * 0.5); if (npc.ai[1] == 0f & phase3) npc.ai[1] = 5f; if (npc.ai[1] == 0f) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - - float hoverSpeed = 5.5f + 3f * (phase2LifeRatio - lifeRatio); - float hoverAcceleration = 0.06f + 0.02f * (phase2LifeRatio - lifeRatio); - hoverSpeed += 4f * enrageScale; - hoverAcceleration += 0.04f * enrageScale; - - if (death) - { - hoverSpeed += 5.5f * (phase2LifeRatio - lifeRatio); - hoverAcceleration += 0.06f * (phase2LifeRatio - lifeRatio); - } + float hoverSpeed = (death ? 7.5f : 5.5f) + (death ? 8.5f : 3f) * (phase2LifeRatio - lifeRatio); + float hoverAcceleration = (death ? 0.08f : 0.06f) + (death ? 0.08f : 0.02f) * (phase2LifeRatio - lifeRatio); Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * 400f; float distanceFromHoverDestination = npc.Distance(hoverDestination); @@ -480,14 +413,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.BloodNautilusShot; - int damage = npc.GetProjectileDamage(type); int numProj = 3; int spread = 10; float rotation = MathHelper.ToRadians(spread); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, damage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * ProjectileOffset, perturbedSpeed, type, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; } } @@ -505,17 +437,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 1f) { - // Set damage - npc.damage = setDamage; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); npc.rotation = eyeRotation; float additionalVelocityPerCharge = 3f; - float chargeSpeed = 10f + (3.5f * (phase2LifeRatio - lifeRatio)) + npc.ai[3] * additionalVelocityPerCharge; - chargeSpeed += 4f * enrageScale; - if (death) - chargeSpeed += 6.5f * (phase2LifeRatio - lifeRatio); + float chargeSpeed = (death ? 12f : 10f) + ((death ? 10f : 3.5f) * (phase2LifeRatio - lifeRatio)) + npc.ai[3] * additionalVelocityPerCharge; if (npc.ai[3] == 1f) chargeSpeed *= 1.15f; if (npc.ai[3] == 2f) @@ -530,9 +456,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 2f) { - // Set damage - npc.damage = setDamage; - int phase2ChargeDelay = death ? (70 - (int)Math.Round(25f * (phase2LifeRatio - lifeRatio))) : 85; float slowDownGateValue = phase2ChargeDelay * (death ? 0.9f : 0.75f); @@ -540,9 +463,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; if (npc.ai[2] >= slowDownGateValue) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - float decelerationScalar = death ? ((lifeRatio - phase3LifeRatio) / (phase2LifeRatio - phase3LifeRatio)) : 1f; if (decelerationScalar < 0f) decelerationScalar = 0f; @@ -565,9 +485,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float numCharges = death ? 4f : 3f; if (npc.ai[3] >= numCharges) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - npc.ai[1] = 0f; npc.ai[3] = 0f; npc.ForceNetUpdate(false); @@ -581,9 +498,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if ((npc.ai[3] == 4f & phase3) && npc.Center.Y > Main.player[npc.target].Center.Y) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - npc.ai[1] = 0f; npc.ai[2] = 0f; npc.ai[3] = 0f; @@ -591,12 +505,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (Main.netMode != NetmodeID.MultiplayerClient) { - // Set damage - npc.damage = setDamage; - float speedBoost = death ? 10f * (phase3LifeRatio - lifeRatio) : 7f * (phase3LifeRatio - lifeRatio); - float finalChargeSpeed = 18f + speedBoost; - finalChargeSpeed += 10f * enrageScale; + float finalChargeSpeed = (death ? 23f : 18f) + speedBoost; Vector2 eyeChargeDirection = npc.Center; float targetX = Main.player[npc.target].Center.X - eyeChargeDirection.X; @@ -662,9 +572,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 4f) { - // Set damage - npc.damage = setDamage; - if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); @@ -676,9 +583,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] >= lineUpDistControl) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -699,9 +603,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float maxCharges = death ? (finalPhaseDeath ? 0f : penultimatePhaseDeath ? 1f : 2f) : finalPhaseRev ? 2f : 3f; if (npc.ai[3] >= maxCharges) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - npc.ai[1] = 0f; npc.ai[3] = 0f; } @@ -712,14 +613,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 5f) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - float offset = death ? 540f : 600f; float speedBoost = death ? 15f * (phase3LifeRatio - lifeRatio) : 5f * (phase3LifeRatio - lifeRatio); float accelerationBoost = death ? 0.425f * (phase3LifeRatio - lifeRatio) : 0.125f * (phase3LifeRatio - lifeRatio); - float hoverSpeed = 8f + speedBoost; - float hoverAcceleration = 0.25f + accelerationBoost; + float hoverSpeed = (death ? 10f : 8f) + speedBoost; + float hoverAcceleration = (death ? 0.3125f : 0.25f) + accelerationBoost; bool horizontalCharge = calamityGlobalNPC.newAI[0] == 1f || calamityGlobalNPC.newAI[0] == 3f; float timeGateValue = horizontalCharge ? (110f - (death ? 60f * (phase3LifeRatio - lifeRatio) : 0f)) : (95f - (death ? 55f * (phase3LifeRatio - lifeRatio) : 0f)); @@ -730,9 +628,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hoverAcceleration += velocityScalar * 0.0025f; } - hoverSpeed += enrageScale * 4f; - hoverAcceleration += enrageScale * 0.125f; - Vector2 eyeLineUpChargeDirection = npc.Center; float lineUpChargeTargetX = Main.player[npc.target].Center.X - eyeLineUpChargeDirection.X; float lineUpChargeTargetY = Main.player[npc.target].Center.Y + offset - eyeLineUpChargeDirection.Y; @@ -759,54 +654,36 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 servantSpawnVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * servantAndProjectileVelocity; Vector2 servantSpawnCenter = npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset; - int spawnType = NPCID.ServantofCthulhu; - bool spawnServant = false; - float enrageScaleToPass = enrageScale; - if (death) - { - int maxBloodServants = 2; - bool spawnBloodServant = NPC.CountNPCS(ModContent.NPCType()) < maxBloodServants; - if (spawnBloodServant) - { - spawnType = ModContent.NPCType(); - spawnServant = true; - enrageScaleToPass += 0.5f; - } - else - { - int maxServants = death ? 1 : 2; - spawnServant = (penultimatePhaseDeath || finalPhaseRev) ? false : NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; - } - } - else - { - int maxServants = death ? (finalPhaseDeath ? 1 : penultimatePhaseDeath ? 2 : 3) : (finalPhaseRev ? 2 : 4); - spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; - } + int maxServants = death ? (finalPhaseDeath ? 1 : penultimatePhaseDeath ? 2 : 3) : (finalPhaseRev ? 2 : 4); + bool spawnServant = NPC.CountNPCS(NPCID.ServantofCthulhu) < maxServants; if (spawnServant) + { SoundEngine.PlaySound(SoundID.NPCDeath13, servantSpawnCenter); + for (int m = 0; m < 10; m++) + Dust.NewDust(servantSpawnCenter, 20, 20, DustID.Blood, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); + } + if (Main.netMode != NetmodeID.MultiplayerClient) { if (spawnServant) { - int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, spawnType, 0, 0f, 0f, enrageScaleToPass); + int eye = NPC.NewNPC(npc.GetSource_FromAI(), (int)servantSpawnCenter.X, (int)servantSpawnCenter.Y, NPCID.ServantofCthulhu); Main.npc[eye].velocity.X = servantSpawnVelocity.X; Main.npc[eye].velocity.Y = servantSpawnVelocity.Y; if (Main.dedServ && eye < Main.maxNPCs) NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, eye); } - else if (!CalamityWorld.LegendaryMode) + else if (!Main.getGoodWorld) { int projType = ProjectileID.BloodNautilusShot; - int projDamage = npc.GetProjectileDamage(projType); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, projDamage, 0f, Main.myPlayer); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + servantSpawnVelocity.SafeNormalize(Vector2.UnitY) * ProjectileOffset, servantSpawnVelocity * 2f, projType, BloodShotDamage, 0f, Main.myPlayer); Main.projectile[proj].timeLeft = 600; } - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) { int type = ProjectileID.BloodNautilusShot; Vector2 projectileVelocity = servantSpawnVelocity * 3f; @@ -821,12 +698,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } } - - if (spawnServant) - { - for (int m = 0; m < 10; m++) - Dust.NewDust(servantSpawnCenter, 20, 20, DustID.Blood, servantSpawnVelocity.X * 0.4f, servantSpawnVelocity.Y * 0.4f, 0, default, 1f); - } } float requiredDistanceForHorizontalCharge = 160f; @@ -871,14 +742,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 6f) { - // Set damage - npc.damage = setDamage; - if (Main.netMode != NetmodeID.MultiplayerClient) { float speedBoost = death ? 15f * (phase3LifeRatio - lifeRatio) : 5f * (phase3LifeRatio - lifeRatio); - float chargeSpeed = 18f + speedBoost; - chargeSpeed += 10f * enrageScale; + float chargeSpeed = (death ? 23f : 18f) + speedBoost; npc.velocity = npc.SafeDirectionTo(Main.player[npc.target].Center) * chargeSpeed; npc.ai[1] = 7f; @@ -888,9 +755,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 7f) { - // Set damage - npc.damage = setDamage; - if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); @@ -902,9 +766,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] >= lineUpDistControl) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; - npc.velocity *= 0.95f; if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; @@ -917,8 +778,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lineUpDistNetUpdate = lineUpDistControl + 13f; if (npc.ai[2] >= lineUpDistNetUpdate) { - // Deal less damage overall while not charging - npc.damage = reducedSetDamage; npc.ForceNetUpdate(false); npc.ai[2] = 0f; @@ -929,823 +788,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - // If you think for a fucking second that I'm going to refactor this... - public static bool VanillaEyeofCthulhuAI(NPC npc, Mod mod) - { - Lighting.AddLight(npc.Center, 0.5f, 0.5f, 0.5f); - - bool flag2 = false; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.2 : 0.12)) - flag2 = true; - - bool flag3 = false; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.08 : 0.04)) - flag3 = true; - - float num4 = Main.masterMode ? 15f : 20f; - if (flag3) - num4 = Main.masterMode ? 8f : 10f; - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - bool dead = Main.player[npc.target].dead; - float num5 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num6 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num7 = (float)Math.Atan2(num6, num5) + MathHelper.PiOver2; - if (num7 < 0f) - num7 += MathHelper.TwoPi; - else if ((double)num7 > MathHelper.TwoPi) - num7 -= MathHelper.TwoPi; - - float num8 = 0f; - if (npc.ai[0] == 0f && npc.ai[1] == 0f) - num8 = 0.02f; - - if (npc.ai[0] == 0f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num8 = 0.05f; - - if (npc.ai[0] == 3f && npc.ai[1] == 0f) - num8 = 0.05f; - - if (npc.ai[0] == 3f && npc.ai[1] == 2f && npc.ai[2] > 40f) - num8 = 0.08f; - - if (npc.ai[0] == 3f && npc.ai[1] == 4f && npc.ai[2] > num4) - num8 = 0.15f; - - if (npc.ai[0] == 3f && npc.ai[1] == 5f) - num8 = 0.05f; - - if (Main.expertMode) - num8 *= (Main.masterMode ? 2f : 1.5f); - - if (flag3 && Main.expertMode) - num8 = 0f; - - if (npc.rotation < num7) - { - if ((double)(num7 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num8; - else - npc.rotation += num8; - } - else if (npc.rotation > num7) - { - if ((double)(npc.rotation - num7) > MathHelper.Pi) - npc.rotation += num8; - else - npc.rotation -= num8; - } - - if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) - npc.rotation = num7; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num7 - num8 && npc.rotation < num7 + num8) - npc.rotation = num7; - - if (Main.rand.NextBool(5)) - { - int num9 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num9].velocity.X *= 0.5f; - Main.dust[num9].velocity.Y *= 0.1f; - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num10 = 5f; - float num11 = 0.04f; - if (Main.expertMode) - { - num11 = Main.masterMode ? 0.2f : 0.15f; - num10 = Main.masterMode ? 9f : 7f; - } - - if (Main.getGoodWorld) - { - num11 += 0.05f; - num10 += 1f; - } - - Vector2 vector = npc.Center; - float num12 = Main.player[npc.target].Center.X - vector.X; - float num13 = Main.player[npc.target].Center.Y - 200f - vector.Y; - float num14 = (float)Math.Sqrt(num12 * num12 + num13 * num13); - float num15 = num14; - num14 = num10 / num14; - num12 *= num14; - num13 *= num14; - if (npc.velocity.X < num12) - { - npc.velocity.X += num11; - if (npc.velocity.X < 0f && num12 > 0f) - npc.velocity.X += num11; - } - else if (npc.velocity.X > num12) - { - npc.velocity.X -= num11; - if (npc.velocity.X > 0f && num12 < 0f) - npc.velocity.X -= num11; - } - - if (npc.velocity.Y < num13) - { - npc.velocity.Y += num11; - if (npc.velocity.Y < 0f && num13 > 0f) - npc.velocity.Y += num11; - } - else if (npc.velocity.Y > num13) - { - npc.velocity.Y -= num11; - if (npc.velocity.Y > 0f && num13 < 0f) - npc.velocity.Y -= num11; - } - - npc.ai[2] += 1f; - float num16 = Main.masterMode ? 400f : 600f; - if (Main.expertMode) - num16 *= 0.35f; - - if (npc.ai[2] >= num16) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.netUpdate = true; - } - else if ((npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num15 < 500f) || (Main.expertMode && num15 < (Main.masterMode ? 750f : 500f))) - { - if (!Main.player[npc.target].dead) - npc.ai[3] += 1f; - - float num17 = Main.masterMode ? 70f : 110f; - if (Main.expertMode) - num17 *= 0.4f; - - if (Main.getGoodWorld) - num17 *= 0.8f; - - if (npc.ai[3] >= num17) - { - npc.ai[3] = 0f; - npc.rotation = num7; - float num18 = 5f; - if (Main.expertMode) - num18 = 6f; - if (Main.masterMode) - num18 = 9f; - - float num19 = Main.player[npc.target].Center.X - vector.X; - float num20 = Main.player[npc.target].Center.Y - vector.Y; - float num21 = (float)Math.Sqrt(num19 * num19 + num20 * num20); - num21 = num18 / num21; - Vector2 vector2 = vector; - Vector2 vector3 = default(Vector2); - vector3.X = num19 * num21; - vector3.Y = num20 * num21; - vector2.X += vector3.X * 10f; - vector2.Y += vector3.Y * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num22 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector2.X, (int)vector2.Y, NPCID.ServantofCthulhu); - Main.npc[num22].velocity.X = vector3.X; - Main.npc[num22].velocity.Y = vector3.Y; - if (Main.dedServ && num22 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num22); - } - - SoundEngine.PlaySound(SoundID.NPCHit1, vector2); - for (int m = 0; m < 10; m++) - Dust.NewDust(vector2, 20, 20, DustID.Blood, vector3.X * 0.4f, vector3.Y * 0.4f); - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num7; - float num23 = 6f; - if (Main.expertMode) - num23 = 7f; - if (Main.masterMode) - num23 = 9f; - - if (Main.getGoodWorld) - num23 += 1f; - - Vector2 vector4 = npc.Center; - float num24 = Main.player[npc.target].Center.X - vector4.X; - float num25 = Main.player[npc.target].Center.Y - vector4.Y; - float num26 = (float)Math.Sqrt(num24 * num24 + num25 * num25); - num26 = num23 / num26; - npc.velocity.X = num24 * num26; - npc.velocity.Y = num25 * num26; - npc.ai[1] = 2f; - npc.ForceNetUpdate(false); - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - if (npc.ai[2] >= 40f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity *= 0.98f; - if (Main.expertMode) - npc.velocity *= 0.985f; - if (Main.masterMode) - npc.velocity *= 0.99f; - - if (Main.getGoodWorld) - npc.velocity *= 0.99f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - int num27 = 150; - if (Main.expertMode) - num27 = 100; - if (Main.masterMode) - num27 = 80; - - if (Main.getGoodWorld) - num27 -= 15; - - if (npc.ai[2] >= (float)num27) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num7; - if (npc.ai[3] >= (Main.masterMode ? 4f : 3f)) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - float num28 = 0.5f; - if (Main.expertMode) - num28 = 0.65f; - if (Main.masterMode) - num28 = 0.75f; - - if ((float)npc.life < (float)npc.lifeMax * num28) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ForceNetUpdate(false); - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[0] == 1f || npc.ai[3] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - npc.ai[1] += 1f; - if (Main.getGoodWorld) - npc.reflectsProjectiles = true; - - int num29 = 20; - if (Main.getGoodWorld && npc.life < npc.lifeMax / 3) - num29 = 10; - - if (Main.expertMode && npc.ai[1] % (float)num29 == 0f) - { - float num30 = Main.masterMode ? 8f : 5f; - Vector2 vector5 = npc.Center; - float num31 = Main.rand.Next(-200, 200); - float num32 = Main.rand.Next(-200, 200); - if (Main.getGoodWorld) - { - num31 *= 3f; - num32 *= 3f; - } - - float num33 = (float)Math.Sqrt(num31 * num31 + num32 * num32); - num33 = num30 / num33; - Vector2 vector6 = vector5; - Vector2 vector7 = default(Vector2); - vector7.X = num31 * num33; - vector7.Y = num32 * num33; - vector6.X += vector7.X * 10f; - vector6.Y += vector7.Y * 10f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num34 = NPC.NewNPC(npc.GetSource_FromAI(), (int)vector6.X, (int)vector6.Y, NPCID.ServantofCthulhu); - Main.npc[num34].velocity.X = vector7.X; - Main.npc[num34].velocity.Y = vector7.Y; - if (Main.dedServ && num34 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num34); - } - - for (int n = 0; n < 10; n++) - Dust.NewDust(vector6, 20, 20, DustID.Blood, vector7.X * 0.4f, vector7.Y * 0.4f); - } - - if (npc.ai[1] >= 100f) - { - if (npc.ai[3] == 1f) - { - npc.ai[3] = 0f; - npc.ai[1] = 0f; - } - else - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num35 = 0; num35 < 2; num35++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 8); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num36 = 0; num36 < 20; num36++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - npc.defense = 0; - if (Main.expertMode) - { - if (flag2) - npc.defense = -(Main.masterMode ? 10 : 15); - if (flag3) - npc.defense = -(Main.masterMode ? 20 : 30); - } - - double phase2DamageMultiplier = 1.5; - npc.damage = (int)Math.Round(npc.defDamage * phase2DamageMultiplier); - int reducedSetDamage = (int)Math.Round(npc.damage * 0.5); - - if (npc.ai[1] == 0f && flag2) - npc.ai[1] = 5f; - - if (npc.ai[1] == 0f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - float num39 = Main.masterMode ? 8f : 6f; - float num40 = Main.masterMode ? 0.1f : 0.07f; - Vector2 vector8 = npc.Center; - float num41 = Main.player[npc.target].Center.X - vector8.X; - float num42 = Main.player[npc.target].Center.Y - 120f - vector8.Y; - float num43 = (float)Math.Sqrt(num41 * num41 + num42 * num42); - float distanceVelocityIncrease = Main.masterMode ? 1.5f : 1f; - float distanceAccelerationIncrease = Main.masterMode ? 0.08f : 0.05f; - if (num43 > 400f && Main.expertMode) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - if (num43 > 600f) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - if (num43 > 800f) - { - num39 += distanceVelocityIncrease; - num40 += distanceAccelerationIncrease; - } - } - } - - if (Main.getGoodWorld) - { - num39 += 1f; - num40 += 0.1f; - } - - num43 = num39 / num43; - num41 *= num43; - num42 *= num43; - if (npc.velocity.X < num41) - { - npc.velocity.X += num40; - if (npc.velocity.X < 0f && num41 > 0f) - npc.velocity.X += num40; - } - else if (npc.velocity.X > num41) - { - npc.velocity.X -= num40; - if (npc.velocity.X > 0f && num41 < 0f) - npc.velocity.X -= num40; - } - - if (npc.velocity.Y < num42) - { - npc.velocity.Y += num40; - if (npc.velocity.Y < 0f && num42 > 0f) - npc.velocity.Y += num40; - } - else if (npc.velocity.Y > num42) - { - npc.velocity.Y -= num40; - if (npc.velocity.Y > 0f && num42 < 0f) - npc.velocity.Y -= num40; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 120f : 200f)) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.45 : 0.35)) - npc.ai[1] = 3f; - - npc.netUpdate = true; - } - - if (Main.expertMode && flag3) - { - npc.netUpdate = true; - npc.ai[1] = 3f; - npc.ai[2] = 0f; - npc.ai[3] -= 1000f; - } - } - else if (npc.ai[1] == 1f) - { - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - npc.rotation = num7; - float num44 = Main.masterMode ? 8f : 6.8f; - if (Main.expertMode && npc.ai[3] == 1f) - num44 *= 1.15f; - - if (Main.expertMode && npc.ai[3] == 2f) - num44 *= 1.3f; - - if (Main.getGoodWorld) - num44 *= 1.2f; - - Vector2 vector9 = npc.Center; - float num45 = Main.player[npc.target].Center.X - vector9.X; - float num46 = Main.player[npc.target].Center.Y - vector9.Y; - float num47 = (float)Math.Sqrt(num45 * num45 + num46 * num46); - num47 = num44 / num47; - npc.velocity.X = num45 * num47; - npc.velocity.Y = num46 * num47; - npc.ai[1] = 2f; - npc.ForceNetUpdate(false); - } - else if (npc.ai[1] == 2f) - { - float num48 = 40f; - npc.ai[2] += 1f; - if (Main.expertMode) - num48 = 50f; - if (Main.masterMode) - num48 = 60f; - - if (npc.ai[2] >= num48) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.velocity *= 0.97f; - if (Main.expertMode) - npc.velocity *= 0.98f; - if (Main.masterMode) - npc.velocity *= 0.99f; - - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - int num49 = 130; - if (Main.expertMode) - num49 = 90; - if (Main.masterMode) - num49 = 80; - - if (npc.ai[2] >= (float)num49) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num7; - if (npc.ai[3] >= 3f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient && (double)npc.life < (double)npc.lifeMax * (Main.masterMode ? 0.6 : 0.5)) - { - npc.ai[1] = 3f; - npc.ai[3] += Main.rand.Next(1, 4); - } - - npc.ForceNetUpdate(false); - } - else - npc.ai[1] = 1f; - } - } - else if (npc.ai[1] == 3f) - { - if (npc.ai[3] == 4f && flag2 && npc.Center.Y > Main.player[npc.target].Center.Y) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.ForceNetUpdate(false); - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num50 = Main.masterMode ? 24f : 20f; - Vector2 vector10 = npc.Center; - float num51 = Main.player[npc.target].Center.X - vector10.X; - float num52 = Main.player[npc.target].Center.Y - vector10.Y; - float num53 = Math.Abs(Main.player[npc.target].velocity.X) + Math.Abs(Main.player[npc.target].velocity.Y) / 4f; - num53 += 10f - num53; - if (num53 < 5f) - num53 = 5f; - - if (num53 > 15f) - num53 = 15f; - - if (npc.ai[2] == -1f && !flag3) - { - num53 *= 4f; - num50 *= 1.3f; - } - - if (flag3) - num53 *= 2f; - - num51 -= Main.player[npc.target].velocity.X * num53; - num52 -= Main.player[npc.target].velocity.Y * num53 / 4f; - num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - if (flag3) - { - num51 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - num52 *= 1f + (float)Main.rand.Next(-10, 11) * 0.01f; - } - - float num54 = (float)Math.Sqrt(num51 * num51 + num52 * num52); - float num55 = num54; - num54 = num50 / num54; - npc.velocity.X = num51 * num54; - npc.velocity.Y = num52 * num54; - npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; - if (flag3) - { - npc.velocity.X += (float)Main.rand.Next(-50, 51) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.1f; - float num56 = Math.Abs(npc.velocity.X); - float num57 = Math.Abs(npc.velocity.Y); - if (npc.Center.X > Main.player[npc.target].Center.X) - num57 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num56 *= -1f; - - npc.velocity.X = num57 + npc.velocity.X; - npc.velocity.Y = num56 + npc.velocity.Y; - npc.velocity = npc.velocity.SafeNormalize(Vector2.UnitY); - npc.velocity *= num50; - npc.velocity.X += (float)Main.rand.Next(-20, 21) * 0.1f; - npc.velocity.Y += (float)Main.rand.Next(-20, 21) * 0.1f; - } - else if (num55 < 100f) - { - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num58 = Math.Abs(npc.velocity.X); - float num59 = Math.Abs(npc.velocity.Y); - if (npc.Center.X > Main.player[npc.target].Center.X) - num59 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num58 *= -1f; - - npc.velocity.X = num59; - npc.velocity.Y = num58; - } - } - else if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - float num60 = (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y)) / 2f; - float num61 = num60; - if (npc.Center.X > Main.player[npc.target].Center.X) - num61 *= -1f; - - if (npc.Center.Y > Main.player[npc.target].Center.Y) - num60 *= -1f; - - npc.velocity.X = num61; - npc.velocity.Y = num60; - } - - npc.ai[1] = 4f; - npc.ForceNetUpdate(false); - } - } - else if (npc.ai[1] == 4f) - { - if (npc.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); - - float num62 = num4; - npc.ai[2] += 1f; - if (npc.ai[2] == num62 && Vector2.Distance(npc.position, Main.player[npc.target].position) < 200f) - npc.ai[2] -= 1f; - - if (npc.ai[2] >= num62) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.velocity *= 0.95f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float num63 = num62 + 13f; - if (npc.ai[2] >= num63) - { - npc.ForceNetUpdate(false); - - npc.ai[3] += 1f; - npc.ai[2] = 0f; - if (npc.ai[3] >= 5f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - if (npc.target >= 0 && Main.getGoodWorld && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, npc.width, npc.height)) - { - SoundEngine.PlaySound(SoundID.ForceRoarPitched, npc.Center); - npc.ai[0] = 2f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 1f; - npc.netUpdate = true; - } - } - else - npc.ai[1] = 3f; - } - } - else if (npc.ai[1] == 5f) - { - // Deal less damage while not charging - npc.damage = reducedSetDamage; - - float num64 = 600f; - float num65 = Main.masterMode ? 12f : 9f; - float num66 = Main.masterMode ? 0.4f : 0.3f; - Vector2 vector11 = npc.Center; - float num67 = Main.player[npc.target].Center.X - vector11.X; - float num68 = Main.player[npc.target].Center.Y + num64 - vector11.Y; - float num69 = (float)Math.Sqrt(num67 * num67 + num68 * num68); - num69 = num65 / num69; - num67 *= num69; - num68 *= num69; - if (npc.velocity.X < num67) - { - npc.velocity.X += num66; - if (npc.velocity.X < 0f && num67 > 0f) - npc.velocity.X += num66; - } - else if (npc.velocity.X > num67) - { - npc.velocity.X -= num66; - if (npc.velocity.X > 0f && num67 < 0f) - npc.velocity.X -= num66; - } - - if (npc.velocity.Y < num68) - { - npc.velocity.Y += num66; - if (npc.velocity.Y < 0f && num68 > 0f) - npc.velocity.Y += num66; - } - else if (npc.velocity.Y > num68) - { - npc.velocity.Y -= num66; - if (npc.velocity.Y > 0f && num68 < 0f) - npc.velocity.Y -= num66; - } - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 40f : 70f)) - { - npc.ai[1] = 3f; - npc.ai[2] = -1f; - npc.ai[3] = Main.rand.Next(-3, 1); - npc.netUpdate = true; - } - } - - if (flag3 && npc.ai[1] == 5f) - npc.ai[1] = 3f; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs index e75fd3ccdd..fcbbdc7270 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/GolemAI.cs @@ -1,5 +1,7 @@ using System; using CalamityMod.Events; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; using CalamityMod.World; using Microsoft.Xna.Framework; using Terraria; @@ -11,6 +13,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class GolemAI { + // Rev+ exclusive + public static int FireballDamage = 24; // 96 (modified to be always at maximum Expert damage and does not scale) + public static int LaserDamage = 29; // 116 (modified to be always at maximum Expert damage and does not scale) + public static int InfernoBoltDamage = 35; // 140 + public static bool BuffedGolemAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -22,8 +29,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float lifeRatio = npc.life / (float)npc.lifeMax; // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; bool phase2 = lifeRatio < 0.75f; bool phase3 = lifeRatio < 0.5f; bool phase4 = lifeRatio < 0.25f; @@ -32,13 +38,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[0] = 1f; - int numFists = death ? 2 : 1; - for (int i = 0; i < numFists; i++) - { - float fistPunchTimeOffset = i * 30f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0, 0f, fistPunchTimeOffset); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0, 0f, fistPunchTimeOffset); - } + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft, 0); + NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight, 0); NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); } @@ -51,8 +52,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Enrage if the target isn't inside the temple - // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy - bool enrage = true; + // Turbo enrage if target isn't inside the temple and it's For the Worthy + bool enrage = !BossRushEvent.BossRushActive; bool turboEnrage = false; if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) { @@ -63,15 +64,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; - if (bossRush || Main.getGoodWorld) + if (Main.getGoodWorld) enrage = true; - npc.Calamity().CurrentlyEnraged = !bossRush && (enrage || turboEnrage); + npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && (enrage || turboEnrage); bool reduceFallSpeed = npc.velocity.Y > 0f && Collision.SolidCollision(npc.position + Vector2.UnitY * 1.1f * npc.velocity.Y, npc.width, npc.height); @@ -89,10 +90,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool headAlive = NPC.AnyNPCs(NPCID.GolemHead); bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (headAlive || leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; - - // Phase 2, check for free head - bool freeHeadAlive = NPC.AnyNPCs(NPCID.GolemHeadFree); + npc.dontTakeDamage = headAlive || leftFistAlive || rightFistAlive; // Distance required for despawning int despawnDistance = turboEnrage ? 7500 : enrage ? 6000 : 4500; @@ -177,50 +175,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Avoid cheap bullshit npc.damage = 0; - // Laser fire when head is dead - if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode) && npc.ai[2] == 0f) - { - npc.localAI[1] += 1f; - - float divisor = 15f - - (phase2 ? 4f : 0f) - - (phase3 ? 3f : 0f) - - (phase4 ? 2f : 0f); - - if (enrage) - divisor = 5f; - - if (turboEnrage && Main.getGoodWorld) - divisor = 2f; - - Vector2 projectileFirePos = new Vector2(npc.Center.X, npc.Center.Y - 60f); - if (npc.localAI[1] % divisor == 0f && (Vector2.Distance(Main.player[npc.target].Center, projectileFirePos) > 160f || !freeHeadAlive)) - { - float laserSpeed = turboEnrage ? 16f : enrage ? 12f : 6f; - float laserTargetXDist = Main.player[npc.target].Center.X - projectileFirePos.X; - float laserTargetYDist = Main.player[npc.target].Center.Y - projectileFirePos.Y; - float laserTargetDistance = (float)Math.Sqrt(laserTargetXDist * laserTargetXDist + laserTargetYDist * laserTargetYDist); - - laserTargetDistance = laserSpeed / laserTargetDistance; - laserTargetXDist *= laserTargetDistance; - laserTargetYDist *= laserTargetDistance; - - Vector2 laserVelocity = new Vector2(laserTargetXDist, laserTargetYDist); - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[bodyLaser].extraUpdates += 1; - } - } - - if (npc.localAI[1] >= 15f) - npc.localAI[1] = 0f; - } - // Delay before jumping if (npc.ai[2] == 0f) { @@ -230,7 +184,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] > 0f) { - npc.ai[1] += (death ? 2f : 1f); + npc.ai[1] += death ? 1.5f : 1f; if (Main.getGoodWorld) npc.ai[1] += 100f; @@ -244,11 +198,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 6f; if (!rightFistAlive) npc.ai[1] += 6f; - if (!headAlive) - npc.ai[1] += 6f; } } - if (npc.ai[1] >= 300f) + bool canJump = (!headAlive || Main.npc[NPC.FindFirstNPC(NPCID.GolemHead)].ai[0] <= 1f) && (!NPC.AnyNPCs(NPCID.GolemHeadFree) || Main.npc[NPC.FindFirstNPC(NPCID.GolemHeadFree)].ai[0] != 3); + if (npc.ai[1] >= 300f && canJump) { npc.ai[1] = -20f; npc.frameCounter = 0D; @@ -262,164 +215,30 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - if (death) + if (npc.ai[3] == 0f) + npc.ai[3] = (death ? !leftFistAlive && !rightFistAlive : !headAlive) ? Main.rand.Next(1, 2+1) : 1f; + + switch ((int)npc.ai[3]) { - float straightUpJumpHeight = 640f; - if (npc.ai[3] == 0f) - npc.ai[3] = (!headAlive && npc.Bottom.Y - straightUpJumpHeight > Main.player[npc.target].Top.Y) ? Main.rand.Next(3) + 1f : (!leftFistAlive && !rightFistAlive) ? Main.rand.Next(2) + 1f : 1f; + default: + case 0: + case 1: + NormalJump(canJump); + break; - switch ((int)npc.ai[3]) - { - default: - case 0: - case 1: - NormalJump(); - break; - - // Jump directly above the target's head and slam down - case 2: - - npc.noTileCollide = true; - - npc.ai[2] += 1f; - float jumpVelocity = 26f; - if (enrage) - jumpVelocity *= 1.25f; - if (turboEnrage) - jumpVelocity *= 1.25f; - - float minJumpTime = 15f; - float maxJumpTime = 45f; - if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - - Vector2 center = npc.Center; - if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) - center = Main.player[npc.target].Center; - - center.Y -= 480f; - if (npc.velocity.Y == 0f) - { - npc.velocity = center - npc.Center; - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= jumpVelocity; - - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - - float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; - if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) - speedMult += distanceBelowTarget * multiplier; - - float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; - if (speedMult > speedMultLimit) - speedMult = speedMultLimit; - - if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y *= speedMult; - } - else - npc.velocity.Y *= 0.95f; - - break; - - // Jump straight up and create a wall of lasers on both sides - case 3: - - npc.velocity.Y = (((!freeHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f); - - npc.noTileCollide = true; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 2f; - - float jumpDuration = (float)Math.Floor(straightUpJumpHeight / Math.Abs(npc.velocity.Y)); - npc.ai[3] = jumpDuration; - - npc.netUpdate = true; - - break; - } - } - else - { - if (npc.ai[3] == 0f) - npc.ai[3] = !headAlive ? Main.rand.Next(2) + 1f : 1f; - - switch ((int)npc.ai[3]) - { - default: - case 0: - case 1: - NormalJump(); - break; - - // Jump directly above the target's head and slam down - case 2: - - npc.noTileCollide = true; - - npc.ai[2] += 1f; - float jumpVelocity = 21f; - if (enrage) - jumpVelocity *= 1.25f; - if (turboEnrage) - jumpVelocity *= 1.25f; - - float minJumpTime = 15f; - float maxJumpTime = 45f; - if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - - Vector2 center = npc.Center; - if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) - center = Main.player[npc.target].Center; - - center.Y -= 480f; - if (npc.velocity.Y == 0f) - { - npc.velocity = center - npc.Center; - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= jumpVelocity; - - float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); - float speedMult = 1f; - - float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; - if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) - speedMult += distanceBelowTarget * multiplier; - - float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; - if (speedMult > speedMultLimit) - speedMult = speedMultLimit; - - if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y *= speedMult; - } - else - npc.velocity.Y *= 0.95f; - - break; - } + // Jump directly above the target's head and slam down + case 2: + SlamJump(canJump); + break; } - void NormalJump() + void NormalJump(bool jump) { - float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityX = (death ? 9f : 6f) + velocityBoost; + if (!jump) + return; + + float velocityBoost = (death ? 5f : 3.8f) * (1f - (lifeRatio / 2)); + float velocityX = (death ? 6f : 4f) + velocityBoost; if (enrage) velocityX *= 1.5f; @@ -432,8 +251,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); float speedMult = 1f; - float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; - if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage || CalamityWorld.LegendaryMode)) + float multiplier = turboEnrage ? 0.00275f : enrage ? 0.0025f : 0.00175f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage)) speedMult += distanceBelowTarget * multiplier; float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; @@ -441,7 +260,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses speedMult = speedMultLimit; if (Main.player[npc.target].position.Y < npc.Bottom.Y) - npc.velocity.Y = ((((!freeHeadAlive && !headAlive) || turboEnrage || CalamityWorld.LegendaryMode) ? -15.1f : -12.1f) + (enrage ? -4f : 0f)) * speedMult; + npc.velocity.Y = ((turboEnrage ? -15.5f : -11.75f) + (enrage ? -4f : 0f)) * speedMult; else npc.velocity.Y = 1f; @@ -453,6 +272,60 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; npc.SyncExtraAI(); } + + void SlamJump(bool jump) + { + npc.noTileCollide = true; + + npc.ai[2] += 1f; + float jumpVelocity = death ? 26f : 21f; + if (enrage) + jumpVelocity *= 1.25f; + if (turboEnrage) + jumpVelocity *= 1.25f; + + float minJumpTime = 15f; + float maxJumpTime = 45f; + if ((npc.ai[2] >= minJumpTime && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= jumpVelocity) || npc.ai[2] >= maxJumpTime || !jump) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.ai[2] = 1f; + npc.velocity.Y = -3f; + npc.netUpdate = true; + } + + if (!jump) + return; + + Vector2 center = npc.Center; + if (!Main.player[npc.target].dead && Main.player[npc.target].active && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) <= despawnDistance) + center = Main.player[npc.target].Center; + + center.Y -= 480f; + if (npc.velocity.Y == 0f) + { + npc.velocity = center - npc.Center; + npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); + npc.velocity *= jumpVelocity; + + float distanceBelowTarget = npc.position.Y - (Main.player[npc.target].position.Y + 80f); + float speedMult = 1f; + + float multiplier = turboEnrage ? 0.0025f : enrage ? 0.002f : 0.0015f; + if (distanceBelowTarget > 0f && ((!leftFistAlive && !rightFistAlive) || turboEnrage)) + speedMult += distanceBelowTarget * multiplier; + + float speedMultLimit = turboEnrage ? 3.25f : enrage ? 3f : 2.5f; + if (speedMult > speedMultLimit) + speedMult = speedMultLimit; + + if (Main.player[npc.target].position.Y < npc.Bottom.Y) + npc.velocity.Y *= speedMult; + } + else + npc.velocity.Y *= 0.95f; + } } } @@ -496,7 +369,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Fireball explosion when head is detached - if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage || CalamityWorld.LegendaryMode)) + if (Main.netMode != NetmodeID.MultiplayerClient && (!headAlive || turboEnrage)) { for (int i = 0; i < 10; i++) { @@ -518,29 +391,29 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Main.dust[fiery2].velocity.X *= 2f; } - float projectileVelocity = death ? 11.25f : 7.5f; + float projectileVelocity = death ? 7.5f : 4.75f; if (enrage) projectileVelocity *= 1.5f; if (turboEnrage) projectileVelocity *= 1.25f; int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); + int damage = FireballDamage; Vector2 destination = new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center; destination.Normalize(); destination *= projectileVelocity; int totalFireballsPerSide = 3; - int totalIterations = (turboEnrage && Main.getGoodWorld) ? 11 : death ? 25 : 35; + int totalIterations = turboEnrage ? 11 : death ? 40 : 60; float rotation = MathHelper.ToRadians(90); for (int i = 0; i < totalIterations; i++) { - // Spawn projectiles 0, 1, 2, 22, 23, and 24 (in non-master) + // Spawn projectiles 0, 1, 2, 22, 23, and 24 if (i < totalFireballsPerSide || i >= totalIterations - totalFireballsPerSide) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(totalIterations - 1))); int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.UnitY * (npc.height / 2 * 0.8f) * npc.scale + Vector2.Normalize(perturbedSpeed) * (npc.width / 3) * npc.scale, perturbedSpeed, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = enrage ? 480 : 240; - if (turboEnrage && Main.getGoodWorld) + Main.projectile[proj].timeLeft = enrage ? 480 : 150; // The difference is meant to be this stark. + if (turboEnrage) Main.projectile[proj].extraUpdates += 1; } } @@ -554,97 +427,55 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.damage = npc.defDamage; // Velocity when falling - if (npc.ai[2] == 2f) + if ((npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) || npc.ai[2] == 1f) { - // Do not collide with tiles while doing this crazy shit - npc.noTileCollide = true; + npc.velocity.X *= npc.ai[2] == 1f ? 0.5f : 0.8f; - float laserShootGateValue = death ? 6f : 9f; - if (npc.ai[3] % laserShootGateValue == 0f) + if (npc.Bottom.Y < Main.player[npc.target].position.Y || npc.ai[2] == 1f) { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - Vector2 fireFrom = new Vector2(npc.Center.X, npc.Center.Y - 60f); - int projectileAmt = 2; - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - Vector2 laserVelocity = Vector2.UnitY * npc.velocity.Y * (turboEnrage ? 2f : enrage ? 1f : 0.5f); - for (int i = 0; i < projectileAmt; i++) - { - int totalProjectiles = 2; - float radians = MathHelper.TwoPi / totalProjectiles; - for (int j = 0; j < totalProjectiles; j++) - { - Vector2 projVelocity = laserVelocity.RotatedBy(radians * j + MathHelper.PiOver2); - int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[bodyLaser].timeLeft = enrage ? 720 : 360; - if (turboEnrage && Main.getGoodWorld) - Main.projectile[bodyLaser].extraUpdates += 1; - } - } - } - } + float fallSpeedBoost = death ? 0.9f * (1f - (lifeRatio / 2)) : 0.75f * (1f - (lifeRatio / 2)); + float fallSpeed = (death ? 0.3f : 0.2f) + fallSpeedBoost; + if (enrage) + fallSpeed *= 2f; - npc.ai[3] -= 1f; - if (npc.ai[3] <= 0f) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.ForceNetUpdate(); + npc.velocity.Y += fallSpeed; } } else { - if ((npc.position.X < Main.player[npc.target].position.X && npc.position.X + npc.width > Main.player[npc.target].position.X + Main.player[npc.target].width) || npc.ai[2] == 1f) - { - npc.velocity.X *= npc.ai[2] == 1f ? 0.5f : 0.8f; + float velocityChangeBoost = death ? 0.16f * (1f - (lifeRatio / 2)) : 0.12f * (1f - (lifeRatio / 2)); + float velocityXChange = (death ? 0.285f : 0.2f) + velocityChangeBoost; + if (npc.direction < 0) + npc.velocity.X -= velocityXChange; + else if (npc.direction > 0) + npc.velocity.X += velocityXChange; - if (npc.Bottom.Y < Main.player[npc.target].position.Y || npc.ai[2] == 1f) - { - float fallSpeedBoost = death ? 1.2f * (1f - lifeRatio) : 0.8f * (1f - lifeRatio); - float fallSpeed = (death ? 0.3f : 0.2f) + fallSpeedBoost; - if (enrage) - fallSpeed *= 2f; + float velocityBoost = death ? 5.75f * (1f - (lifeRatio / 2)) : 4f * (1f - (lifeRatio / 2)); + float velocityXCap = (death ? 6f : 4f) + velocityBoost; + if (enrage) + velocityXCap *= 3f; - npc.velocity.Y += fallSpeed; - } - } - else - { - float velocityChangeBoost = death ? 0.18f * (1f - lifeRatio) : 0.12f * (1f - lifeRatio); - float velocityXChange = (death ? 0.3f : 0.2f) + velocityChangeBoost; - if (npc.direction < 0) - npc.velocity.X -= velocityXChange; - else if (npc.direction > 0) - npc.velocity.X += velocityXChange; + float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; + int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; + bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; - float velocityBoost = death ? 6f * (1f - lifeRatio) : 4f * (1f - lifeRatio); - float velocityXCap = (death ? 9f : 6f) + velocityBoost; - if (enrage) - velocityXCap *= 3f; + if (slowDown) + velocityXCap *= (enrage ? 0.2f : 0.5f); - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - int directionRelativeToTarget = playerLocation < 0 ? 1 : -1; - bool slowDown = directionRelativeToTarget != calamityGlobalNPC.newAI[1]; - - if (slowDown) - velocityXCap *= (enrage ? 0.2f : 0.5f); - - if (npc.velocity.X < -velocityXCap) - npc.velocity.X = -velocityXCap; - if (npc.velocity.X > velocityXCap) - npc.velocity.X = velocityXCap; - } - - CustomGravity(npc.ai[2] == 1f); + if (npc.velocity.X < -velocityXCap) + npc.velocity.X = -velocityXCap; + if (npc.velocity.X > velocityXCap) + npc.velocity.X = velocityXCap; } + + CustomGravity(npc.ai[2] == 1f); } } void CustomGravity(bool isSlamming) { - float gravity = turboEnrage ? (Main.getGoodWorld ? 1.15f : 0.85f) : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; - float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? (Main.getGoodWorld ? 40f : 30f) : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; + float gravity = turboEnrage ? 0.85f : enrage ? 0.75f : (!leftFistAlive && !rightFistAlive) ? 0.45f : 0.3f; + float maxFallSpeed = reduceFallSpeed ? 12f : turboEnrage ? 30f : enrage ? 25f : (!leftFistAlive && !rightFistAlive) ? 15f : 10f; if (isSlamming && !reduceFallSpeed) { gravity *= 4f; @@ -699,14 +530,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses NPC golem = Main.npc[NPC.golemBoss]; Player player = Main.player[npc.target]; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Enrage if the target isn't inside the temple - // Turbo enrage if target isn't inside the temple and it's Boss Rush or For the Worthy - bool enrage = true; + // Turbo enrage if target isn't inside the temple and it's For the Worthy + bool enrage = !BossRushEvent.BossRushActive; bool turboEnrage = false; - if (player.Center.Y > Main.worldSurface * 16.0) + if (player.Center.Y > Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive) { int targetTilePosX = (int)player.Center.X / 16; int targetTilePosY = (int)player.Center.Y / 16; @@ -715,15 +545,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; - if (bossRush || Main.getGoodWorld) + if (Main.getGoodWorld) enrage = true; - float aggression = turboEnrage ? (Main.getGoodWorld ? 4f : 3f) : enrage ? 2f : death ? 1.7f : 1f; + float aggression = turboEnrage ? 3f : enrage ? 2f : death ? 1.7f : 1f; Vector2 fistCenter = golem.Center + golem.velocity + new Vector2(0f, -9f * npc.scale); fistCenter.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; @@ -891,54 +721,20 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } float maxPunchDistance = 700f; - int explosionLimit = 2; if (death) { if (npc.life < npc.lifeMax / 2) - { maxPunchDistance += MathHelper.Lerp(-175f, 75f, Main.rand.NextFloat()); - explosionLimit++; - } if (npc.life < npc.lifeMax / 4) - { maxPunchDistance += MathHelper.Lerp(-175f, 75f, Main.rand.NextFloat()); - explosionLimit++; - } } if (distanceFromRestPosition > maxPunchDistance || npc.collideX || npc.collideY) { // Avoid cheap bullshit npc.damage = 0; - npc.noTileCollide = true; npc.ai[0] = 0f; - - if (death) - { - int type = ProjectileID.InfernoHostileBlast; - bool shootExplosion = true; - int numExplosions = 0; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == type) - { - numExplosions++; - if (numExplosions >= explosionLimit) - { - shootExplosion = false; - break; - } - } - } - - if (shootExplosion) - { - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 0f, 0f, 1f); - } - } } } else @@ -1019,21 +815,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Count body parts bool leftFistAlive = NPC.AnyNPCs(NPCID.GolemFistLeft); bool rightFistAlive = NPC.AnyNPCs(NPCID.GolemFistRight); - npc.dontTakeDamage = (leftFistAlive || rightFistAlive) && !CalamityWorld.LegendaryMode; + npc.dontTakeDamage = leftFistAlive || rightFistAlive; // Stay in position on top of body npc.Center = Main.npc[NPC.golemBoss].Center - new Vector2(3f, 57f) * npc.scale; + npc.velocity = Main.npc[NPC.golemBoss].velocity; // Enrage if the target isn't inside the temple - bool enrage = true; + bool enrage = !BossRushEvent.BossRushActive; bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive) { int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; @@ -1042,12 +838,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; - if (bossRush || Main.getGoodWorld) + if (Main.getGoodWorld) enrage = true; // Alpha @@ -1086,7 +882,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses headFireballTargetY *= headFireballTargetDist; int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); + int damage = FireballDamage; int fireballAmount = death ? 2 : 1; Vector2 fireballVelocity = new Vector2(headFireballTargetX, headFireballTargetY); @@ -1115,10 +911,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.localAI[1] = 0f; + // Timer for special laser attack + npc.ai[3]++; + if (npc.ai[3] >= 600f && Main.npc[NPC.golemBoss].velocity.Y == 0f && MathF.Abs(Main.npc[NPC.golemBoss].velocity.X) < 0.5f) + { + npc.ai[0] = 2f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = 0f; + npc.localAI[1] = (Main.player[npc.target].Center.X > npc.Center.X).ToDirectionInt(); + npc.netUpdate = true; + } + // Fireballs npc.ai[1] += 1f; - float openMouthGateValue = 20f - (death ? 15f * (1f - lifeRatio) : 10f * (1f - lifeRatio)); - float shootFireballGateValue = 120f - (death ? 90f * (1f - lifeRatio) : 60f * (1f - lifeRatio)); + float openMouthGateValue = 20f - (death ? 15f * (1f - (lifeRatio / 2)) : 10f * (1f - (lifeRatio / 2))); + float shootFireballGateValue = 120f - (death ? 75f * (1f - (lifeRatio / 2)) : 50f * (1f - (lifeRatio / 2))); if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) npc.localAI[0] = 1f; else @@ -1138,21 +946,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses fireballFistsDedTargetY *= fireballFistsDedTargetDist; int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); + int damage = FireballDamage; - int fireballAmount = death ? 3 : 1; + int fireballAmount = death ? 2 : 1; Vector2 fireballVelocity = new Vector2(fireballFistsDedTargetX, fireballFistsDedTargetY); for (int i = 0; i < fireballAmount; i++) { int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos, fireballVelocity * (1f / (i + 1)), type, damage, 0f, Main.myPlayer); - Main.projectile[proj].timeLeft = 450; + Main.projectile[proj].timeLeft = 225; } npc.netUpdate = true; } // Lasers - float shootBoost2 = death ? 5f * (1f - lifeRatio) : 3f * (1f - lifeRatio); + float shootBoost2 = death ? 4.5f * (1f - (lifeRatio / 2)) : 2.75f * (1f - (lifeRatio / 2)); npc.ai[2] += 1f + shootBoost2; if (enrage) npc.ai[2] += 4f; @@ -1162,7 +970,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; int projType = ProjectileID.EyeBeam; - int dmg = npc.GetProjectileDamage(projType); + int dmg = LaserDamage; if (npc.localAI[1] == 0f) { @@ -1188,7 +996,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int bodyLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); Main.projectile[bodyLaser].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage) Main.projectile[bodyLaser].extraUpdates += 1; npc.netUpdate = true; @@ -1217,7 +1025,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileFirePos + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, projType, dmg, 0f, Main.myPlayer); Main.projectile[extraLasers].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage) Main.projectile[extraLasers].extraUpdates += 1; npc.netUpdate = true; @@ -1226,13 +1034,63 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - // Laser fire if arms are dead - if ((!leftFistAlive && !rightFistAlive) || death || CalamityWorld.LegendaryMode) + // Special laser spread attack + else if (npc.ai[0] == 2f || npc.ai[0] == 3f) { - npc.ai[0] = 1f; - return false; + int telegraphTime = 60; + int endTime = 120; + Vector2 spawnLocation = new Vector2(npc.Center.X + (30f * npc.scale * npc.localAI[1]), npc.Center.Y - 22f * npc.scale); + if (npc.ai[1] == 1f) + { + SparkleParticle eyeTele = new(spawnLocation, Vector2.Zero, Color.Yellow, Color.White, 1.25f * npc.scale, telegraphTime, MathHelper.Pi * 0.02f, needed: true); + GeneralParticleHandler.SpawnParticle(eyeTele); + } + + npc.ai[1]++; + if (npc.ai[1] >= telegraphTime && npc.ai[1] < endTime && npc.ai[1] % 2f == 0f) + { + // Manually plays the sound at a slower rate (the sound from the lasers is disabled by setting ai[1]) + if (npc.ai[1] % 10f == 0f) + SoundEngine.PlaySound(SoundID.Item33, spawnLocation); + + float laserFireAngle = MathHelper.ToRadians((npc.ai[1] - telegraphTime + 20) * (death ? 2.45f : 2f)); + Vector2 laserVelocity = Vector2.UnitY.RotatedBy(laserFireAngle * -npc.localAI[1]) * (death ? 15f : 12f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int extraLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, ProjectileID.EyeBeam, LaserDamage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[extraLasers].timeLeft = enrage ? 600 : 300; + if (turboEnrage) + Main.projectile[extraLasers].extraUpdates += 1; + + npc.netUpdate = true; + } + } + + // Do another attack in the opposite direction in Death Mode + if (death && npc.ai[0] == 2f && npc.ai[1] >= endTime) + { + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.localAI[1] = -npc.localAI[1]; + npc.netUpdate = true; + } + + if (npc.ai[1] >= endTime + 30) + { + npc.ai[0] = 1f; + npc.ai[1] = 0f; + npc.netUpdate = true; + } } - npc.ai[0] = 0f; + + // Laser fire if arms are dead + if ((!leftFistAlive && !rightFistAlive) || death || Main.getGoodWorld) + { + if (npc.ai[0] <= 1f) + npc.ai[0] = 1f; + } + else + npc.ai[0] = 0f; return false; } @@ -1253,10 +1111,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Die if body is gone if (NPC.golemBoss < 0) { - calamityGlobalNPC.DR = 0.25f; - calamityGlobalNPC.unbreakableDR = false; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = false; - if (Main.netMode != NetmodeID.MultiplayerClient) npc.StrikeInstantKill(); @@ -1264,20 +1118,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Percent life remaining - float lifeRatio = npc.life / (float)npc.lifeMax; float golemLifeRatio = Main.npc[NPC.golemBoss].life / (float)Main.npc[NPC.golemBoss].lifeMax; + float PosDelay = 270f; // Phases - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool phase2 = lifeRatio < 0.7f || golemLifeRatio < 0.85f || death; - bool phase3 = lifeRatio < 0.55f || golemLifeRatio < 0.7f || death; - bool phase4 = lifeRatio < 0.4f || golemLifeRatio < 0.55f || death; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool phase2 = golemLifeRatio < 0.66f; + bool phase3 = golemLifeRatio < 0.33f; // Enrage if the target isn't inside the temple - bool enrage = true; + bool enrage = !BossRushEvent.BossRushActive; bool turboEnrage = false; - if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0) + if (Main.player[npc.target].Center.Y > Main.worldSurface * 16.0 && !BossRushEvent.BossRushActive) { int targetTilePosX = (int)Main.player[npc.target].Center.X / 16; int targetTilePosY = (int)Main.player[npc.target].Center.Y / 16; @@ -1286,106 +1138,100 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (tile.WallType == WallID.LihzahrdBrickUnsafe) enrage = false; else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; } else - turboEnrage = bossRush || Main.getGoodWorld; + turboEnrage = Main.getGoodWorld; - if (bossRush || Main.getGoodWorld) + if (Main.getGoodWorld) enrage = true; - if (turboEnrage) - { - calamityGlobalNPC.DR = 0.9999f; - calamityGlobalNPC.unbreakableDR = true; - calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; - } - // Float through tiles or not - bool canPassThroughTiles = false; - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase3 || turboEnrage) + npc.noTileCollide = !Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1) || phase2 || turboEnrage; + + // Immediately trigger the laser spread attack at phase transition thresholds + if (phase2 && npc.ai[0] == 0f || phase3 && npc.ai[0] == 1f) { - npc.noTileCollide = true; - canPassThroughTiles = true; + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[2] = 0f; + npc.ai[3] = PosDelay; + calamityGlobalNPC.newAI[3] = 0; + npc.netUpdate = true; + npc.SyncExtraAI(); } - else - npc.noTileCollide = false; // Move to new location + float maxDistanceDiagonal = 360f; + float maxDistanceStraight = 480f; if (npc.ai[3] <= 0f) { - npc.ai[3] = 400f; - - float maxDistance = 400f; - - // Four corners around target - if (phase3 || turboEnrage) + npc.ai[3] = PosDelay; + calamityGlobalNPC.newAI[3] += phase2 ? 1 : 0; + if (calamityGlobalNPC.newAI[3] >= 7) { - if (calamityGlobalNPC.newAI[1] == -maxDistance) + calamityGlobalNPC.newAI[3] = 0; + npc.ai[0] = 3f; + npc.ai[1] = 0f; + npc.ai[3] = PosDelay; + } + + // Four positions around target + if (!(phase3 || turboEnrage)) + { + if (phase2) { - switch ((int)calamityGlobalNPC.newAI[0]) + // 0 is top left, then goes counter-clockwise + switch ((int)(calamityGlobalNPC.newAI[3] % 4)) { case 0: - case 400: - calamityGlobalNPC.newAI[0] = -maxDistance; + calamityGlobalNPC.newAI[0] = -maxDistanceDiagonal; + calamityGlobalNPC.newAI[1] = -maxDistanceDiagonal; break; - case -400: - calamityGlobalNPC.newAI[1] = maxDistance; + case 1: + calamityGlobalNPC.newAI[0] = -maxDistanceDiagonal; + calamityGlobalNPC.newAI[1] = maxDistanceDiagonal; break; - default: + case 2: + calamityGlobalNPC.newAI[0] = maxDistanceDiagonal; + calamityGlobalNPC.newAI[1] = maxDistanceDiagonal; + break; + case 3: + calamityGlobalNPC.newAI[0] = maxDistanceDiagonal; + calamityGlobalNPC.newAI[1] = -maxDistanceDiagonal; break; } } + + // Above target else { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - case -400: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 400: - calamityGlobalNPC.newAI[1] = -maxDistance; - break; - default: - break; - } + calamityGlobalNPC.newAI[0] = Main.rand.NextFloat(-150f, 150f); + calamityGlobalNPC.newAI[1] = -maxDistanceStraight * 0.85f; } } - // Above target - else if (phase2) - { - switch ((int)calamityGlobalNPC.newAI[0]) - { - case 0: - calamityGlobalNPC.newAI[0] = maxDistance; - break; - case 400: - calamityGlobalNPC.newAI[0] = -maxDistance; - break; - case -400: - calamityGlobalNPC.newAI[0] = 0f; - break; - default: - break; - } - } - else - { - calamityGlobalNPC.newAI[0] = 0f; - calamityGlobalNPC.newAI[1] = -maxDistance; - } - npc.netSpam = 5; npc.SyncExtraAI(); npc.ForceNetUpdate(); } - npc.ai[3] -= 1f + - (turboEnrage ? 1f : phase2 ? 0.5f : 0f) + - (turboEnrage ? 1f : phase3 ? 0.5f : 0f) + - (turboEnrage ? 2f : phase4 ? 1f : 0f); + float positioningInc = enrage ? 6f : phase3 ? 2.5f : phase2 ? 1.8f : 1f; + npc.ai[3] -= positioningInc; + + // Move in a circle around the player in final phase + if (phase3 || turboEnrage) + { + float spinSpeedMult = enrage ? 2.5f : death ? 1.35f : 1.2f; + calamityGlobalNPC.newAI[0] = maxDistanceStraight * MathF.Sin(MathHelper.ToRadians(npc.ai[2] * spinSpeedMult)); + calamityGlobalNPC.newAI[1] = maxDistanceStraight * MathF.Cos(MathHelper.ToRadians(npc.ai[2] * spinSpeedMult)); + } + // Always move above the player during laser spread attack + if (npc.ai[0] == 3f) + { + calamityGlobalNPC.newAI[0] = 0f; + calamityGlobalNPC.newAI[1] = -maxDistanceStraight * 0.8f; + } float offsetX = calamityGlobalNPC.newAI[0]; float offsetY = calamityGlobalNPC.newAI[1]; @@ -1393,136 +1239,110 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity and acceleration float velocity = (turboEnrage ? 15f : 10f) + - (turboEnrage ? 7.5f : phase2 ? 5f : 0f) + - (turboEnrage ? 7.5f : phase3 ? 5f : 0f); + (turboEnrage ? 7.5f : phase2 ? 10f : 0f) + + (turboEnrage ? 7.5f : phase3 ? 15f : 0f); if (enrage) velocity = (phase3 || turboEnrage) ? 35f : 25f; - float acceleration = phase3 ? 0f : turboEnrage ? 6f : enrage ? 4.8f : phase2 ? 1.2f : 0.8f; + float acceleration = npc.ai[0] == 3f ? 1.5f : phase2 ? 0f : turboEnrage ? 5f : enrage ? 3f : 0.3f; // How far Golem's Head is from where it's supposed to be Vector2 distanceFromDestination = destination - npc.Center; - // Whether Golem can fire projectiles - bool canFireProjectiles = distanceFromDestination.Length() < 120f || enrage; + bool canFireProjectiles = (Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 160f && npc.ai[0] != 3f) || enrage; - CalamityUtils.SmoothMovement(npc, 80f, distanceFromDestination, velocity, acceleration, !phase3); + // Ensure the free head stays still during the attack + if (npc.ai[0] == 3f && npc.ai[1] >= 60f) + npc.velocity = Vector2.Zero; + else + CalamityUtils.SmoothMovement(npc, 80f, distanceFromDestination, velocity, acceleration, !phase2 || npc.ai[0] == 3f); - if (death && calamityGlobalNPC.newAI[2] < 120f) + // Laser spread attack, followed by lingering flame bolts + if (npc.ai[0] == 3f) { - calamityGlobalNPC.newAI[2] += 1f; + int telegraphTime = 60; + int laserEndTime = 120; + int fireballStartTime = 160; - if (calamityGlobalNPC.newAI[2] % 15f == 0f) + npc.ai[1]++; + // Grrrrr stop incrementing the damn timer + npc.ai[3] = PosDelay; + // Laser spread + if (npc.ai[1] >= telegraphTime && npc.ai[1] < laserEndTime && npc.ai[1] % 2f == 0f) { + // Manually plays the sound at a slower rate (the sound from the lasers is disabled by setting ai[1]) + if (npc.ai[1] % 10f == 0f) + SoundEngine.PlaySound(SoundID.Item33, npc.Center); + + for (int i = -1; i <= 1; i += 2) + { + Vector2 spawnLocation = new Vector2(npc.Center.X + 14f * npc.scale * i, npc.Center.Y - 20f * npc.scale); + float laserFireAngle = MathHelper.ToRadians((npc.ai[1] - telegraphTime + 20) * (death ? 2.1f : 2f)); + Vector2 laserVelocity = -Vector2.UnitY.RotatedBy(laserFireAngle * i) * (death ? 15f : 12f); + if (Main.netMode != NetmodeID.MultiplayerClient) + { + int spreadLasers = Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, ProjectileID.EyeBeam, LaserDamage, 0f, Main.myPlayer, 0f, 1f); + Main.projectile[spreadLasers].timeLeft = enrage ? 600 : 300; + if (turboEnrage) + Main.projectile[spreadLasers].extraUpdates += 1; + + npc.netUpdate = true; + } + } + } + // Sets the mouth to be open for the upcoming flame bolts + if (npc.ai[1] > laserEndTime) + npc.localAI[0] = 1f; + + // Flame bolts + if (npc.ai[1] >= fireballStartTime && npc.ai[1] % 30 == 10f) + { + Vector2 spawnLocation = npc.Center + Vector2.UnitY * 20f * npc.scale; + Vector2 fireBoltVelocity = Utils.DirectionTo(spawnLocation, Main.player[npc.target].Center) * (enrage ? 30f : death ? 16f : 12f); + + int type = ModContent.ProjectileType(); + int damage = InfernoBoltDamage; + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnLocation, fireBoltVelocity, type, damage, 0f, Main.myPlayer, Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y); + } + + // Death fires 2 bolts, Rev fires just 1 + if (npc.ai[1] >= fireballStartTime + (death ? 40 : 10)) + { + npc.ai[0] = phase3 ? 2f : 1f; + npc.ai[1] = 0f; + if (phase3) + calamityGlobalNPC.newAI[2] = Main.rand.Next(120); // Used as a random start point for phase 3 circling + npc.ai[2] = calamityGlobalNPC.newAI[2]; + npc.localAI[0] = 0f; + // Needs to be done to properly put it in the top left corner afterwards in phase 2 + calamityGlobalNPC.newAI[0] = -maxDistanceDiagonal; npc.netUpdate = true; npc.SyncExtraAI(); } - - return false; - } - - // Fireballs - if (canFireProjectiles) - npc.ai[1] += 1f; - - float combinedLifeRatio = (lifeRatio + golemLifeRatio) * 0.5f; - float openMouthGateValue = 20f - (death ? 15f * (1f - combinedLifeRatio) : 10f * (1f - combinedLifeRatio)); - float shootFireballGateValue = 240f - (death ? 180f * (1f - combinedLifeRatio) : 120f * (1f - combinedLifeRatio)); - if (npc.ai[1] < openMouthGateValue || npc.ai[1] > shootFireballGateValue - openMouthGateValue) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (canPassThroughTiles && !phase3) - npc.ai[1] = openMouthGateValue; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] >= shootFireballGateValue) - { - npc.ai[1] = 0f; - - Vector2 freeHeadCenter = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); - float freeHeadSpeed = turboEnrage ? 24f : enrage ? 18f : 6f; - if (death) - freeHeadSpeed *= 1.25f; - - float freeHeadTargetX = Main.player[npc.target].Center.X - freeHeadCenter.X; - float freeHeadTargetY = Main.player[npc.target].Center.Y - freeHeadCenter.Y; - float freeHeadTargetDist = (float)Math.Sqrt(freeHeadTargetX * freeHeadTargetX + freeHeadTargetY * freeHeadTargetY); - - freeHeadTargetDist = freeHeadSpeed / freeHeadTargetDist; - freeHeadTargetX *= freeHeadTargetDist; - freeHeadTargetY *= freeHeadTargetDist; - - int projectileType = (phase3 || death) ? ProjectileID.InfernoHostileBolt : ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(projectileType); - float ai0 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.X : 0f; - float ai1 = projectileType == ProjectileID.InfernoHostileBolt ? Main.player[npc.target].Center.Y : 0f; - float ai2 = projectileType == ProjectileID.InfernoHostileBolt ? 1f : 0f; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadCenter.X, freeHeadCenter.Y, freeHeadTargetX, freeHeadTargetY, projectileType, damage, 0f, Main.myPlayer, ai0, ai1, ai2); - if (projectileType == ProjectileID.InfernoHostileBolt) - { - Main.projectile[proj].timeLeft = 300; - Main.projectile[proj].netUpdate = true; - } - else - Main.projectile[proj].timeLeft = 450; - - npc.netUpdate = true; } // Lasers - if (canFireProjectiles) - npc.ai[2] += 1f; + npc.ai[2] += 1f; - float laserGateValue = 300f - (death ? 240f * (1f - combinedLifeRatio) : 180f * (1f - combinedLifeRatio)); - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] >= laserGateValue) + int laserGateValue = (int)(PosDelay / positioningInc); + if (canFireProjectiles && Main.netMode != NetmodeID.MultiplayerClient && ((npc.ai[2] - calamityGlobalNPC.newAI[2]) % (laserGateValue / 2) == 0f)) { - npc.ai[2] = 0f; - int numLasers = 2; - bool leftLaserIsFast = Main.rand.NextBool(); for (int i = 0; i < numLasers; i++) { Vector2 freeHeadProjSpawn = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); - if (i == 0) - freeHeadProjSpawn.X -= 14f * npc.scale; - else if (i == 1) - freeHeadProjSpawn.X += 14f * npc.scale; + freeHeadProjSpawn.X += 14f * npc.scale * (i == 1).ToDirectionInt(); - float freeHeadProjSpeed = 5f + (death ? 5f * (1f - combinedLifeRatio) : 3f * (1f - combinedLifeRatio)); - if (death) - { - if (i == 0) - { - if (leftLaserIsFast) - freeHeadProjSpeed *= 1.25f; - else - freeHeadProjSpeed *= 0.75f; - } - else - { - if (!leftLaserIsFast) - freeHeadProjSpeed *= 1.25f; - else - freeHeadProjSpeed *= 0.75f; - } - } + float freeHeadProjSpeed = 7f + (5f * (1f - golemLifeRatio)); + Vector2 laserVelocity = Main.player[npc.target].Center - freeHeadProjSpawn; + laserVelocity = laserVelocity.SafeNormalize(Vector2.UnitY) * freeHeadProjSpeed; - float freeHeadProjTargetX = Main.player[npc.target].Center.X - freeHeadProjSpawn.X; - float freeHeadProjTargetY = Main.player[npc.target].Center.Y - freeHeadProjSpawn.Y; - float freeHeadProjTargetDist = (float)Math.Sqrt(freeHeadProjTargetX * freeHeadProjTargetX + freeHeadProjTargetY * freeHeadProjTargetY); - - freeHeadProjTargetDist = freeHeadProjSpeed / freeHeadProjTargetDist; - freeHeadProjTargetX *= freeHeadProjTargetDist; - freeHeadProjTargetY *= freeHeadProjTargetDist; - - Vector2 laserVelocity = new Vector2(freeHeadProjTargetX, freeHeadProjTargetY); int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); + int damage = LaserDamage; int freeHeadLaser = Projectile.NewProjectile(npc.GetSource_FromAI(), freeHeadProjSpawn + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); Main.projectile[freeHeadLaser].timeLeft = enrage ? 600 : 300; - if (turboEnrage && Main.getGoodWorld) + if (turboEnrage) Main.projectile[freeHeadLaser].extraUpdates += 1; } } @@ -1547,966 +1367,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaGolemAI(NPC npc, Mod mod) - { - NPC.golemBoss = npc.whoAmI; - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 0.5f; - if (Main.masterMode) - enrageScale += 0.5f; - if (Main.getGoodWorld) - enrageScale += 2f; - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16D) - { - enrageScale *= 2f; - npc.Calamity().CurrentlyEnraged = true; - } - - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 84, (int)npc.Center.Y - 9, NPCID.GolemFistLeft); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X + 78, (int)npc.Center.Y - 9, NPCID.GolemFistRight); - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X - 3, (int)npc.Center.Y - 57, NPCID.GolemHead); - } - - if (npc.target >= 0 && Main.player[npc.target].dead) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead) - npc.noTileCollide = true; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - bool flag = false; - bool flag2 = false; - bool flag3 = false; - npc.dontTakeDamage = false; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemHead) - flag = true; - - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistLeft) - flag2 = true; - - if (Main.npc[i].active && Main.npc[i].type == NPCID.GolemFistRight) - flag3 = true; - } - - npc.dontTakeDamage = flag; - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && npc.velocity.Y > 0f) - { - for (int j = (int)(npc.position.X / 16f); (float)j < (npc.position.X + (float)npc.width) / 16f; j++) - { - for (int k = (int)(npc.position.Y / 16f); (float)k < (npc.position.Y + (float)npc.width) / 16f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.dedServ) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - npc.position += npc.netOffset; - if (!Main.getGoodWorld) - { - if (!flag2) - { - int num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); - Main.dust[num2].alpha += Main.rand.Next(100); - Main.dust[num2].velocity *= 0.2f; - Main.dust[num2].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num2].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - num2 = Dust.NewDust(new Vector2(npc.Center.X - 80f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); - if (!Main.rand.NextBool(20)) - { - Main.dust[num2].noGravity = true; - Main.dust[num2].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num2].velocity.Y -= 1f; - } - } - } - - if (!flag3) - { - int num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Smoke, 0f, 0f, 100); - Main.dust[num3].alpha += Main.rand.Next(100); - Main.dust[num3].velocity *= 0.2f; - Main.dust[num3].velocity.Y -= 0.5f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num3].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; - if (Main.rand.NextBool(10)) - { - num3 = Dust.NewDust(new Vector2(npc.Center.X + 62f * npc.scale, npc.Center.Y - 9f), 8, 8, DustID.Torch); - if (!Main.rand.NextBool(20)) - { - Main.dust[num3].noGravity = true; - Main.dust[num3].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[num3].velocity.Y -= 1f; - } - } - } - } - - npc.position -= npc.netOffset; - if (npc.noTileCollide && !Main.player[npc.target].dead) - { - if (npc.velocity.Y > 0f && npc.Bottom.Y > Main.player[npc.target].Top.Y) - npc.noTileCollide = false; - else if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].Center, 1, 1) && !Collision.SolidTiles(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - } - - if (npc.ai[0] == 0f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - float num4 = 1f; - if (npc.ai[1] > 0f) - { - if (!flag2) - num4 += 2f; - - if (!flag3) - num4 += 2f; - - if (!flag) - num4 += 2f; - - if (npc.life < npc.lifeMax) - num4 += 1f; - - if (npc.life < npc.lifeMax / 2) - num4 += 4f; - - if (npc.life < npc.lifeMax / 3) - num4 += 8f; - - num4 *= enrageScale; - if (Main.getGoodWorld) - num4 += 100f; - } - - npc.ai[1] += num4; - if (npc.ai[1] >= 300f) - { - npc.ai[1] = -20f; - npc.frameCounter = 0D; - } - else if (npc.ai[1] == -1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - - if (!flag) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.velocity.X = 4 * npc.direction; - if (npc.life < npc.lifeMax) - { - npc.velocity.Y = -12.1f * (enrageScale + 9f) / 10f; - if ((double)npc.velocity.Y < -19.1) - npc.velocity.Y = -19.1f; - } - else - npc.velocity.Y = -12.1f; - - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - } - } - else if (npc.ai[0] == 1f) - { - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - npc.ai[0] = 0f; - for (int l = (int)npc.position.X - 20; l < (int)npc.position.X + npc.width + 40; l += 20) - { - for (int m = 0; m < 4; m++) - { - int num5 = Dust.NewDust(new Vector2(npc.position.X - 20f, npc.position.Y + (float)npc.height), npc.width + 20, 4, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Main.dust[num5].velocity *= 0.2f; - } - - int num6 = Gore.NewGore(npc.GetSource_FromAI(), new Vector2(l - 20, npc.position.Y + (float)npc.height - 8f), default(Vector2), Main.rand.Next(61, 64)); - Main.gore[num6].velocity *= 0.4f; - } - } - else - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.X < Main.player[npc.target].position.X && npc.position.X + (float)npc.width > Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - { - npc.velocity.X *= 0.9f; - if (npc.Bottom.Y < Main.player[npc.target].position.Y) - npc.velocity.Y += 0.2f * (enrageScale + 1f) / 2f; - } - else - { - if (npc.direction < 0) - npc.velocity.X -= 0.2f; - else if (npc.direction > 0) - npc.velocity.X += 0.2f; - - float num7 = 3f; - if (npc.life < npc.lifeMax) - num7 += 1f; - - if (npc.life < npc.lifeMax / 2) - num7 += 1f; - - if (npc.life < npc.lifeMax / 4) - num7 += 1f; - - num7 *= (enrageScale + 1f) / 2f; - if (npc.velocity.X < 0f - num7) - npc.velocity.X = 0f - num7; - - if (npc.velocity.X > num7) - npc.velocity.X = num7; - } - } - } - - if (npc.target <= 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - int num8 = 3000; - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) + Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)num8) - npc.active = false; - } - - return false; - } - - public static bool VanillaGolemFistAI(NPC npc, Mod mod) - { - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 0f; - } - - Player player = Main.player[npc.target]; - NPC nPC = Main.npc[NPC.golemBoss]; - Vector2 vector = nPC.Center + nPC.velocity + new Vector2(0f, -9f * npc.scale); - vector.X += (float)((npc.type == NPCID.GolemFistLeft) ? -84 : 78) * npc.scale; - Vector2 vector2 = vector - npc.Center; - float num2 = vector2.Length(); - if (npc.ai[0] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = true; - float num3 = 14f; - if (npc.life < npc.lifeMax / 2) - num3 += 3f; - - if (npc.life < npc.lifeMax / 4) - num3 += 3f; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - num3 += 8f; - - num3 *= (enrageScale + 3f) / 4f; - if (num3 > 32f) - num3 = 32f; - - float x = vector2.X; - float y = vector2.Y; - float num4 = num2; - if (num4 < 12f + num3) - { - npc.rotation = 0f; - npc.velocity.X = x; - npc.velocity.Y = y; - float num5 = enrageScale; - npc.ai[1] += num5; - if (npc.life < npc.lifeMax / 2) - npc.ai[1] += num5; - - if (npc.life < npc.lifeMax / 4) - npc.ai[1] += num5; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - npc.ai[1] += 10f * num5; - - if (npc.ai[1] >= 60f) - { - if ((npc.type == NPCID.GolemFistLeft && npc.Center.X + 100f > Main.player[npc.target].Center.X) || (npc.type == NPCID.GolemFistRight && npc.Center.X - 100f < Main.player[npc.target].Center.X)) - { - npc.ai[1] = 0f; - npc.ai[0] = 1f; - } - else - npc.ai[1] = 0f; - } - } - else - { - num4 = num3 / num4; - npc.velocity.X = x * num4; - npc.velocity.Y = y * num4; - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - } - } - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[1] += 1f; - npc.Center = vector; - npc.rotation = 0f; - npc.velocity = Vector2.Zero; - if (npc.ai[1] <= 15f) - { - for (int i = 0; i < 1; i++) - { - Vector2 vector3 = Main.rand.NextVector2Circular(80f, 80f); - Vector2 vector4 = vector3 * -1f * 0.05f; - Vector2 vector5 = Main.rand.NextVector2Circular(20f, 20f); - Dust dust = Dust.NewDustPerfect(npc.Center + vector4 + vector3 + vector5, 228, vector4); - dust.fadeIn = 1.5f; - dust.scale = 0.5f; - if (Main.getGoodWorld) - dust.noLight = true; - - dust.noGravity = true; - } - } - - if (npc.ai[1] >= 30f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - npc.collideX = false; - npc.collideY = false; - npc.ai[0] = 2f; - npc.ai[1] = 0f; - float num6 = 12f; - if (npc.life < npc.lifeMax / 2) - num6 += 4f; - - if (npc.life < npc.lifeMax / 4) - num6 += 4f; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax) - num6 += 10f; - - num6 *= (enrageScale + 3f) / 4f; - if (num6 > 48f) - num6 = 48f; - - Vector2 vector6 = npc.Center; - float num7 = Main.player[npc.target].Center.X - vector6.X; - float num8 = Main.player[npc.target].Center.Y - vector6.Y; - float num9 = (float)Math.Sqrt(num7 * num7 + num8 * num8); - num9 = num6 / num9; - npc.velocity.X = num7 * num9; - npc.velocity.Y = num8 * num9; - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - } - } - else if (npc.ai[0] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld) - { - for (int j = (int)(npc.position.X / 16f) - 1; (float)j < (npc.position.X + (float)npc.width) / 16f + 1f; j++) - { - for (int k = (int)(npc.position.Y / 16f) - 1; (float)k < (npc.position.Y + (float)npc.width) / 16f + 1f; k++) - { - if (Main.tile[j, k].TileType == TileID.Torches) - { - Main.tile[j, k].Get().HasTile = false; - if (Main.dedServ) - NetMessage.SendTileSquare(-1, j, k); - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[1] == 1f) - SoundEngine.PlaySound(SoundID.Item14, npc.Center); - - if (Main.rand.NextBool()) - { - Vector2 vector7 = npc.velocity * 0.5f; - Vector2 vector8 = Main.rand.NextVector2Circular(20f, 20f); - Dust.NewDustPerfect(npc.Center + vector7 + vector8, 306, vector7, 0, Main.OurFavoriteColor).scale = 2f; - } - - if (Math.Abs(npc.velocity.X) > Math.Abs(npc.velocity.Y)) - { - if (npc.velocity.X > 0f && npc.Center.X > player.Center.X) - npc.noTileCollide = false; - - if (npc.velocity.X < 0f && npc.Center.X < player.Center.X) - npc.noTileCollide = false; - } - else - { - if (npc.velocity.Y > 0f && npc.Center.Y > player.Center.Y) - npc.noTileCollide = false; - - if (npc.velocity.Y < 0f && npc.Center.Y < player.Center.Y) - npc.noTileCollide = false; - } - - if (num2 > 700f || npc.collideX || npc.collideY) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.noTileCollide = true; - npc.ai[0] = 0f; - } - } - else - { - if (npc.ai[0] != 3f) - return false; - - // Set damage - npc.damage = npc.defDamage; - - npc.noTileCollide = true; - float num10 = 0.4f; - Vector2 vector9 = npc.Center; - float num11 = Main.player[npc.target].Center.X - vector9.X; - float num12 = Main.player[npc.target].Center.Y - vector9.Y; - float num13 = (float)Math.Sqrt(num11 * num11 + num12 * num12); - num13 = 12f / num13; - num11 *= num13; - num12 *= num13; - if (npc.velocity.X < num11) - { - npc.velocity.X += num10; - if (npc.velocity.X < 0f && num11 > 0f) - npc.velocity.X += num10 * 2f; - } - else if (npc.velocity.X > num11) - { - npc.velocity.X -= num10; - if (npc.velocity.X > 0f && num11 < 0f) - npc.velocity.X -= num10 * 2f; - } - - if (npc.velocity.Y < num12) - { - npc.velocity.Y += num10; - if (npc.velocity.Y < 0f && num12 > 0f) - npc.velocity.Y += num10 * 2f; - } - else if (npc.velocity.Y > num12) - { - npc.velocity.Y -= num10; - if (npc.velocity.Y > 0f && num12 < 0f) - npc.velocity.Y -= num10 * 2f; - } - - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X); - if (npc.type == NPCID.GolemFistLeft) - npc.rotation = (float)Math.Atan2(-npc.velocity.Y, -npc.velocity.X); - } - - return false; - } - - public static bool VanillaGolemHeadAI(NPC npc, Mod mod) - { - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - npc.noTileCollide = true; - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - float num707 = 100f; - Vector2 vector89 = npc.Center; - float num708 = Main.npc[NPC.golemBoss].Center.X - vector89.X; - float num709 = Main.npc[NPC.golemBoss].Center.Y - vector89.Y; - num709 -= 57f * npc.scale; - num708 -= 3f * npc.scale; - float num710 = (float)Math.Sqrt(num708 * num708 + num709 * num709); - if (num710 < num707) - { - npc.rotation = 0f; - npc.velocity.X = num708; - npc.velocity.Y = num709; - } - else - { - num710 = num707 / num710; - npc.velocity.X = num708 * num710; - npc.velocity.Y = num709 * num710; - npc.rotation = npc.velocity.X * 0.1f; - } - - if (npc.alpha > 0) - { - npc.alpha -= 10; - if (npc.alpha < 0) - npc.alpha = 0; - - npc.ai[1] = 30f; - } - - if (npc.ai[0] == 0f) - { - npc.ai[1] += 1f; - int num711 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num711 - 20)) - { - npc.ai[1] += 2f * (enrageScale - 1f) / 3f; - npc.localAI[0] = 1f; - } - else - { - npc.ai[1] += 1f * (enrageScale - 1f) / 2f; - npc.localAI[0] = 0f; - } - - if (npc.ai[1] >= (float)num711) - { - npc.ai[1] = 0f; - Vector2 vector90 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); - float num712 = 8f; - float num713 = Main.player[npc.target].Center.X - vector90.X; - float num714 = Main.player[npc.target].Center.Y - vector90.Y; - float num715 = (float)Math.Sqrt(num713 * num713 + num714 * num714); - num715 = num712 / num715; - num713 *= num715; - num714 *= num715; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector90.X, vector90.Y, num713, num714, type, damage, 0f, Main.myPlayer); - } - } - else if (npc.ai[0] == 1f) - { - Vector2 vector91 = new Vector2(npc.Center.X, npc.Center.Y + 10f * npc.scale); - if (Main.player[npc.target].Center.X < npc.Center.X - (float)npc.width) - { - npc.localAI[1] = -1f; - vector91.X -= 40f * npc.scale; - } - else if (Main.player[npc.target].Center.X > npc.Center.X + (float)npc.width) - { - npc.localAI[1] = 1f; - vector91.X += 40f * npc.scale; - } - else - npc.localAI[1] = 0f; - - float num719 = (enrageScale + 3f) / 4f; - npc.ai[1] += num719; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - npc.ai[1] += num719; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.ai[1] += num719; - - int num720 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num720 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (npc.ai[1] >= (float)num720) - { - npc.ai[1] = 0f; - float num721 = 8f; - float num722 = Main.player[npc.target].Center.X - vector91.X; - float num723 = Main.player[npc.target].Center.Y - vector91.Y; - float num724 = (float)Math.Sqrt(num722 * num722 + num723 * num723); - num724 = num721 / num724; - num722 *= num724; - num723 *= num724; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector91.X, vector91.Y, num722, num723, type, damage, 0f, Main.myPlayer); - } - - npc.ai[2] += num719; - if (npc.life < npc.lifeMax / 3) - npc.ai[2] += num719; - - if (npc.life < npc.lifeMax / 4) - npc.ai[2] += num719; - - if (npc.life < npc.lifeMax / 5) - npc.ai[2] += num719; - - if (npc.ai[2] > (float)(60 + Main.rand.Next(600))) - { - npc.ai[2] = 0f; - - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - - if (npc.localAI[1] == 0f) - { - for (int num730 = 0; num730 < 2; num730++) - { - vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); - if (num730 == 0) - vector91.X -= 18f * npc.scale; - else - vector91.X += 18f * npc.scale; - - float num731 = 11f; - float num732 = Main.player[npc.target].Center.X - vector91.X; - float num733 = Main.player[npc.target].Center.Y - vector91.Y; - float num734 = (float)Math.Sqrt(num732 * num732 + num733 * num733); - num734 = num731 / num734; - num732 *= num734; - num733 *= num734; - - Vector2 laserVelocity = new Vector2(num732, num733); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num735 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num735].timeLeft = 300; - } - } - } - else if (npc.localAI[1] != 0f) - { - vector91 = new Vector2(npc.Center.X, npc.Center.Y - 22f * npc.scale); - if (npc.localAI[1] == -1f) - vector91.X -= 30f * npc.scale; - else if (npc.localAI[1] == 1f) - vector91.X += 30f * npc.scale; - - float num736 = 12f; - float num737 = Main.player[npc.target].Center.X - vector91.X; - float num738 = Main.player[npc.target].Center.Y - vector91.Y; - float num739 = (float)Math.Sqrt(num737 * num737 + num738 * num738); - num739 = num736 / num739; - num737 *= num739; - num738 *= num739; - - Vector2 laserVelocity = new Vector2(num737, num738); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num740 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector91 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num740].timeLeft = 300; - } - } - } - } - - if (npc.life < npc.lifeMax / 2) - npc.ai[0] = 1f; - else - npc.ai[0] = 0f; - - return false; - } - - public static bool VanillaGolemHeadFreeAI(NPC npc, Mod mod) - { - bool flag37 = false; - float enrageScale = npc.GetMyBalance(); - if (Main.expertMode) - enrageScale += 1f; - if (Main.masterMode) - enrageScale += 1f; - if (Main.getGoodWorld) - enrageScale += 3f; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - if ((!Main.player[npc.target].ZoneLihzhardTemple && !Main.player[npc.target].ZoneJungle) || (double)Main.player[npc.target].Center.Y < Main.worldSurface * 16.0) - enrageScale *= 2f; - - if (!Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].Center, 1, 1)) - { - npc.noTileCollide = true; - flag37 = true; - } - else if (npc.noTileCollide && Collision.SolidTiles(npc.position, npc.width, npc.height)) - npc.noTileCollide = false; - - if (NPC.golemBoss < 0) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.StrikeInstantKill(); - - return false; - } - - float num742 = 7f; - float num743 = 0.05f; - Vector2 vector92 = npc.Center; - float num744 = Main.player[npc.target].Center.X - vector92.X; - float num745 = Main.player[npc.target].Center.Y - vector92.Y - 300f; - float num746 = (float)Math.Sqrt(num744 * num744 + num745 * num745); - num746 = num742 / num746; - num744 *= num746; - num745 *= num746; - if (npc.velocity.X < num744) - { - npc.velocity.X += num743; - if (npc.velocity.X < 0f && num744 > 0f) - npc.velocity.X += num743; - } - else if (npc.velocity.X > num744) - { - npc.velocity.X -= num743; - if (npc.velocity.X > 0f && num744 < 0f) - npc.velocity.X -= num743; - } - - if (npc.velocity.Y < num745) - { - npc.velocity.Y += num743; - if (npc.velocity.Y < 0f && num745 > 0f) - npc.velocity.Y += num743; - } - else if (npc.velocity.Y > num745) - { - npc.velocity.Y -= num743; - if (npc.velocity.Y > 0f && num745 < 0f) - npc.velocity.Y -= num743; - } - - float num747 = (enrageScale + 4f) / 5f; - npc.ai[1] += num747; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.8) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.6) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) - npc.ai[1] += num747; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) - npc.ai[1] += num747; - - int num748 = 300; - if (npc.ai[1] < 20f || npc.ai[1] > (float)(num748 - 20)) - npc.localAI[0] = 1f; - else - npc.localAI[0] = 0f; - - if (flag37) - npc.ai[1] = 20f; - - if (npc.ai[1] >= (float)num748) - { - npc.ai[1] = 0f; - Vector2 vector93 = new Vector2(npc.Center.X, npc.Center.Y + 20f * npc.scale); - float num749 = 8f; - - int type = ProjectileID.Fireball; - int damage = npc.GetProjectileDamage(type); - - float num752 = Main.player[npc.target].Center.X - vector93.X; - float num753 = Main.player[npc.target].Center.Y - vector93.Y; - float num754 = (float)Math.Sqrt(num752 * num752 + num753 * num753); - num754 = num749 / num754; - num752 *= num754; - num753 *= num754; - if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), vector93.X, vector93.Y, num752, num753, type, damage, 0f, Main.myPlayer); - } - - float num756 = enrageScale; - npc.ai[2] += num756; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.25) - npc.ai[2] += num756; - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax / 1.5) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 2) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 3) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 4) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 5) - npc.ai[2] += num756; - - if (Main.npc[NPC.golemBoss].life < Main.npc[NPC.golemBoss].lifeMax / 6) - npc.ai[2] += num756; - - if (npc.ai[2] > (float)(100 + Main.rand.Next(4800))) - { - npc.ai[2] = 0f; - for (int num757 = 0; num757 < 2; num757++) - { - Vector2 vector94 = new Vector2(npc.Center.X, npc.Center.Y - 20f * npc.scale); - switch (num757) - { - case 0: - vector94.X -= 14f * npc.scale; - break; - case 1: - vector94.X += 14f * npc.scale; - break; - } - - float num758 = 11f; - int type = ProjectileID.EyeBeam; - int damage = npc.GetProjectileDamage(type); - - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.5) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.4) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.3) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.2) - num758 += 0.25f; - if ((double)Main.npc[NPC.golemBoss].life < (double)Main.npc[NPC.golemBoss].lifeMax * 0.1) - num758 += 0.25f; - - float num761 = Main.player[npc.target].Center.X; - float num762 = Main.player[npc.target].Center.Y; - num761 -= vector94.X; - num762 -= vector94.Y; - float num763 = (float)Math.Sqrt(num761 * num761 + num762 * num762); - num763 = num758 / num763; - num761 *= num763; - num762 *= num763; - - Vector2 laserVelocity = new Vector2(num761, num762); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num764 = Projectile.NewProjectile(npc.GetSource_FromAI(), vector94 + laserVelocity.SafeNormalize(Vector2.UnitY) * 40f, laserVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[num764].timeLeft = 300; - } - } - } - - if (!Main.getGoodWorld) - { - npc.position += npc.netOffset; - int num765 = Main.rand.Next(2) * 2 - 1; - Vector2 vector95 = npc.Bottom + new Vector2((float)(num765 * 22) * npc.scale, -22f * npc.scale); - Dust dust5 = Dust.NewDustPerfect(vector95, 228, (MathHelper.PiOver2 + -MathHelper.PiOver2 * (float)num765 + Main.rand.NextFloatDirection() * MathHelper.PiOver4).ToRotationVector2() * (2f + Main.rand.NextFloat())); - Dust dust = dust5; - dust.velocity += npc.velocity; - dust5.noGravity = true; - dust5 = Dust.NewDustPerfect(npc.Bottom + new Vector2(Main.rand.NextFloatDirection() * 6f * npc.scale, (Main.rand.NextFloat() * -4f - 8f) * npc.scale), 228, Vector2.UnitY * (2f + Main.rand.NextFloat())); - dust5.fadeIn = 0f; - dust5.scale = 0.7f + Main.rand.NextFloat() * 0.5f; - dust5.noGravity = true; - dust = dust5; - dust.velocity += npc.velocity; - npc.position -= npc.netOffset; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs index b41e77b6e9..d9d895141c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/KingSlimeAI.cs @@ -15,6 +15,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static readonly SoundStyle SpawnCrystalSound = new SoundStyle("CalamityMod/Sounds/Custom/KingSlimeJewelSpawn"); + // Death exclusive + public static float SapphireJewelContactDamageMult = 1.5f; // 144 + public static bool BuffedKingSlimeAI(NPC npc, Mod mod) { // Percent life remaining @@ -33,8 +36,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses teleportScale *= teleportScaleSpeed; } - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Phases based on life percentage @@ -75,7 +77,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.defense = npc.defDefense; if (blueCrystalAlive) { - setDamage = (int)Math.Round(setDamage * 1.5); + setDamage = (int)Math.Round(setDamage * SapphireJewelContactDamageMult); npc.defense *= 2; } @@ -241,7 +243,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Faster fall if (npc.velocity.Y > 0f) { - float fallSpeedBonus = (bossRush ? 0.2f : death ? 0.15f : 0f) + (!redCrystalAlive ? 0.1f : 0f); + float fallSpeedBonus = (death ? 0.15f : 0f) + (!redCrystalAlive ? 0.1f : 0f); npc.velocity.Y += fallSpeedBonus; } @@ -290,6 +292,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; } + // Slow down dramatically while teleporting + if (npc.ai[1] == 5f || npc.ai[1] == 6f) + { + if (Math.Abs(npc.velocity.X) > 0.1f) + { + npc.velocity.X *= 0.8f; + if (Math.Abs(npc.velocity.X) <= 0.1f) + npc.velocity.X = 0f; + } + } + // Teleport if (npc.ai[1] == 5f) { @@ -430,7 +443,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (!teleporting) { - npc.ai[0] += (bossRush ? 15f : MathHelper.Lerp(1f, 8f, 1f - lifeRatio)); + npc.ai[0] += MathHelper.Lerp(1f, 8f, 1f - lifeRatio); if (npc.ai[0] >= 0f) { // Set damage @@ -452,8 +465,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (deathModeRapidHops) npc.ai[1] = 2f; - float bossRushJumpSpeedMult = 1.5f; - // Jump type if (npc.ai[1] == 3f) { @@ -489,9 +500,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) npc.velocity.X *= 1.4f; - if (bossRush) - npc.velocity.X *= bossRushJumpSpeedMult; - npc.noTileCollide = true; } else if (npc.ai[0] >= -30f) @@ -512,13 +520,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) { - npc.velocity.X += (bossRush ? 0.4f : death ? 0.25f : 0.2f) * npc.direction; + npc.velocity.X += (death ? 0.25f : 0.2f) * npc.direction; if (death) npc.velocity.X += 0.3f * npc.direction; } else { - npc.velocity.X *= bossRush ? 0.9f : death ? 0.92f : 0.93f; + npc.velocity.X *= death ? 0.92f : 0.93f; if (death) npc.velocity.X *= 0.9f; } @@ -543,7 +551,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; // Adjust size based on HP - float maxScale = death ? (Main.getGoodWorld ? 6f : 2.5f) : (Main.getGoodWorld ? 3f : 1.5f); + float maxScale = Main.getGoodWorld ? 3f : death ? 2.5f : 1.5f; float minScale = death ? 0.5f : 0.75f; float maxScaledValue = maxScale - minScale; @@ -609,7 +617,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; } - if (((Main.raining && Main.hardMode) || bossRush) && Main.rand.NextBool(50)) + if ((Main.raining && Main.hardMode) && Main.rand.NextBool(50)) npcType = NPCID.RainbowSlime; if (death) @@ -631,13 +639,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.rand.NextBool(100)) npcType = NPCID.Pinky; - if (CalamityWorld.LegendaryMode) + if (Main.zenithWorld) npcType = NPCID.RainbowSlime; - int spawnZoneWidth = npc.width - 32; - int spawnZoneHeight = npc.height - 32; - int x = (int)(npc.position.X + Main.rand.Next(spawnZoneWidth)); - int y = (int)(npc.position.Y + Main.rand.Next(spawnZoneHeight)); + int offset = 16; + int spawnZoneWidth = npc.width - offset * 2; + int spawnZoneHeight = npc.height - offset * 2; + int x = (int)(npc.position.X + offset + Main.rand.Next(spawnZoneWidth)); + int y = (int)(npc.position.Y + offset + Main.rand.Next(spawnZoneHeight)); int slimeSpawns = NPC.NewNPC(npc.GetSource_FromAI(), x, y, npcType); Main.npc[slimeSpawns].SetDefaults(npcType); Main.npc[slimeSpawns].velocity.X = Main.rand.Next(-15, 16) * 0.1f; @@ -653,367 +662,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - // If you think for a fucking second that I'm going to refactor this... - public static bool VanillaKingSlimeAI(NPC npc, Mod mod) - { - float num236 = 1f; - float num237 = 1f; - bool flag6 = false; - bool flag7 = false; - bool flag8 = false; - float num238 = 2f; - if (Main.getGoodWorld) - { - num238 -= 1f - (float)npc.life / (float)npc.lifeMax; - num237 *= num238; - } - - npc.aiAction = 0; - if (npc.ai[3] == 0f && npc.life > 0) - npc.ai[3] = npc.lifeMax; - - if (npc.localAI[3] == 0f) - { - npc.localAI[3] = 1f; - flag6 = true; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = -100f; - - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - } - - int num239 = 3000; - if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) - { - CalamityUtils.CalamityTargeting(npc, default); - - if (Main.player[npc.target].dead || Vector2.Distance(npc.Center, Main.player[npc.target].Center) > (float)num239) - { - npc.EncourageDespawn(10); - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] != 5f) - { - npc.netUpdate = true; - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - npc.localAI[1] = Main.maxTilesX * 16; - npc.localAI[2] = Main.maxTilesY * 16; - } - } - } - - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && npc.ai[2] >= 300f && npc.ai[1] < 5f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 0f; - npc.ai[0] = 0f; - npc.ai[1] = 5f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - Point point3 = npc.Center.ToTileCoordinates(); - Point point4 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector30 = Main.player[npc.target].Center - npc.Center; - int num240 = 10; - int num241 = 0; - int num242 = 7; - int num243 = 0; - bool flag9 = false; - if (npc.localAI[0] >= 360f || vector30.Length() > 2000f) - { - if (npc.localAI[0] >= 360f) - npc.localAI[0] = 360f; - - flag9 = true; - num243 = 100; - } - - while (!flag9 && num243 < 100) - { - num243++; - int num244 = Main.rand.Next(point4.X - num240, point4.X + num240 + 1); - int num245 = Main.rand.Next(point4.Y - num240, point4.Y + 1); - if ((num245 >= point4.Y - num242 && num245 <= point4.Y + num242 && num244 >= point4.X - num242 && num244 <= point4.X + num242) || (num245 >= point3.Y - num241 && num245 <= point3.Y + num241 && num244 >= point3.X - num241 && num244 <= point3.X + num241) || Main.tile[num244, num245].HasUnactuatedTile) - continue; - - int num246 = num245; - int num247 = 0; - if (Main.tile[num244, num246].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num246].TileType] && !Main.tileSolidTop[Main.tile[num244, num246].TileType]) - { - num247 = 1; - } - else - { - for (; num247 < 150 && num246 + num247 < Main.maxTilesY; num247++) - { - int num248 = num246 + num247; - if (Main.tile[num244, num248].HasUnactuatedTile && Main.tileSolid[Main.tile[num244, num248].TileType] && !Main.tileSolidTop[Main.tile[num244, num248].TileType]) - { - num247--; - break; - } - } - } - - num245 += num247; - bool flag10 = true; - if (flag10 && Main.tile[num244, num245].LiquidType == LiquidID.Lava) - flag10 = false; - - if (flag10 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - flag10 = false; - - if (flag10) - { - npc.localAI[1] = num244 * 16 + 8; - npc.localAI[2] = num245 * 16 + 16; - flag9 = true; - break; - } - } - - if (num243 >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - } - } - } - - if (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 160f) - { - npc.ai[2]++; - if (Main.netMode != NetmodeID.MultiplayerClient) - npc.localAI[0]++; - } - else if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0]--; - if (npc.localAI[0] < 0f) - npc.localAI[0] = 0f; - } - - if (npc.timeLeft < 10 && (npc.ai[0] != 0f || npc.ai[1] != 0f)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - flag7 = false; - } - - Dust dust; - if (npc.ai[1] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - flag7 = true; - npc.aiAction = 1; - npc.ai[0]++; - num236 = MathHelper.Clamp((60f - npc.ai[0]) / 60f, 0f, 1f); - num236 = 0.5f + num236 * 0.5f; - if (npc.ai[0] >= 60f) - flag8 = true; - - if (npc.ai[0] == 60f) - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, 734); - - if (npc.ai[0] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[1] = 6f; - npc.ai[0] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 120f) - { - npc.ai[1] = 6f; - npc.ai[0] = 0f; - } - - if (!flag8) - { - for (int num249 = 0; num249 < 10; num249++) - { - int num250 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num250].noGravity = true; - dust = Main.dust[num250]; - dust.velocity *= 0.5f; - } - } - } - else if (npc.ai[1] == 6f) - { - // Avoid cheap bullshit - npc.damage = 0; - - flag7 = true; - npc.aiAction = 0; - npc.ai[0]++; - num236 = MathHelper.Clamp(npc.ai[0] / 30f, 0f, 1f); - num236 = 0.5f + num236 * 0.5f; - if (npc.ai[0] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[0] = -15f; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[0] >= 60f) - { - npc.ai[1] = 0f; - npc.ai[0] = -15f; - - CalamityUtils.CalamityTargeting(npc, default); - } - - for (int num251 = 0; num251 < 10; num251++) - { - int num252 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 150, new Color(78, 136, 255, 80), 2f); - Main.dust[num252].noGravity = true; - dust = Main.dust[num252]; - dust.velocity *= 2f; - } - } - - npc.dontTakeDamage = (npc.hide = flag8); - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if (!flag7) - { - npc.ai[0] += (MathHelper.Lerp(1f, 13f, 1f - npc.life / (float)npc.lifeMax)); - if (npc.ai[0] >= 0f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - - if (npc.ai[1] == 3f) - { - npc.velocity.Y = -13f; - npc.velocity.X += (Main.masterMode ? 5.25f : 3.5f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 140f : 180f); - npc.ai[1] = 0f; - } - else if (npc.ai[1] == 2f) - { - npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6.75f : 4.5f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 80f : 100f); - npc.ai[1] += 1f; - } - else - { - npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 6f : 4f) * (float)npc.direction; - npc.ai[0] = -(Main.masterMode ? 80f : 100f); - npc.ai[1] += 1f; - } - } - else if (npc.ai[0] >= -30f) - { - npc.aiAction = 1; - } - } - } - else if (npc.target < Main.maxPlayers) - { - float num253 = Main.masterMode ? 4.5f : 3f; - if (Main.getGoodWorld) - num253 = 6f; - - if ((npc.direction == 1 && npc.velocity.X < num253) || (npc.direction == -1 && npc.velocity.X > 0f - num253)) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X += (Main.masterMode ? 0.3f : 0.2f) * (float)npc.direction; - else - npc.velocity.X *= (Main.masterMode ? 0.86f : 0.93f); - } - } - - int num254 = Dust.NewDust(npc.position, npc.width, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 255, new Color(0, 80, 255, 80), npc.scale * 1.2f); - Main.dust[num254].noGravity = true; - dust = Main.dust[num254]; - dust.velocity *= 0.5f; - if (npc.life <= 0) - return false; - - float num255 = (float)npc.life / (float)npc.lifeMax; - num255 = num255 * 0.5f + 0.75f; - num255 *= num236; - num255 *= num237; - if (num255 != npc.scale || flag6) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = num255; - npc.width = (int)(98f * npc.scale); - npc.height = (int)(92f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - int num256 = (int)((double)npc.lifeMax * 0.05); - if (!((float)(npc.life + num256) < npc.ai[3])) - return false; - - npc.ai[3] = npc.life; - int num257 = Main.rand.Next(1, 4); - for (int num258 = 0; num258 < num257; num258++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num259 = 1; - - int chanceForSpikedSlime = Main.masterMode ? 2 : 4; - if (Main.expertMode && Main.rand.NextBool(chanceForSpikedSlime)) - num259 = NPCID.SlimeSpiked; - - int num260 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num259); - Main.npc[num260].SetDefaults(num259); - Main.npc[num260].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num260].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num260].ai[0] = -1000 * Main.rand.Next(3); - Main.npc[num260].ai[1] = 0f; - if (Main.dedServ && num260 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num260); - } - - return false; - } - public static void GetPlaceToTeleportTo(NPC npc) { CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs index 15a895165c..f6c6d16f79 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/MoonLordAI.cs @@ -17,12 +17,25 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static readonly SoundStyle DeathrayChargeSound = new("CalamityMod/Sounds/Custom/MoonLordLaserCharge"); + // Vanilla values + public static int BoltDamage = 30; // 120 + public static int EyeDamage = 30; // 120 + public static int SphereDamage = 40; // 160 + public static int DeathrayDamage = 75; // 300 + + public static int TrueEyeBoltDamage = 35; // 140 + public static int TrueEyeEyeDamage = 35; // 140 + public static int TrueEyeDeathrayDamage = 50; // 200 + public static int TrueEyeSphereDamage = 55; // 220 + + // Vanilla values (GFB) + public static int MoonBoulderDamage = 70; // 280 + public static bool BuffedMoonLordAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; int aggressionLevel = 4; if (npc.type == NPCID.MoonLordCore || npc.type == NPCID.MoonLordHand || npc.type == NPCID.MoonLordHead) @@ -45,9 +58,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (bossRush) - aggressionLevel = 5; - if (Main.getGoodWorld) aggressionLevel = 6; @@ -773,7 +783,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (attackTimer == 180f && Main.netMode != NetmodeID.MultiplayerClient) { int projectileType = ProjectileID.PhantasmalDeathray; - int damage = npc.GetProjectileDamage(projectileType); npc.TargetClosest(false); Vector2 deathrayRotationSpeed = Main.player[npc.target].Center - npc.Center; @@ -784,7 +793,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses deathrayRotationDirection = 1f; deathrayRotationSpeed = deathrayRotationSpeed.RotatedBy(-(double)deathrayRotationDirection * MathHelper.TwoPi / 6f); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayRotationSpeed.X, deathrayRotationSpeed.Y, projectileType, damage, 0f, Main.myPlayer, deathrayRotationDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayRotationSpeed.X, deathrayRotationSpeed.Y, projectileType, DeathrayDamage, 0f, Main.myPlayer, deathrayRotationDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); npc.ai[2] = (deathrayRotationSpeed.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * deathrayRotationDirection; npc.netUpdate = true; } @@ -811,7 +820,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[1] < 0f) { npc.localAI[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient && Main.getGoodWorld && Main.remixWorld) + if (Main.netMode != NetmodeID.MultiplayerClient && Main.zenithWorld) { for (int k = 0; k < 30; k++) { @@ -933,8 +942,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 boltVelocity = Vector2.Normalize(v4) * velocity; int type = ProjectileID.PhantasmalBolt; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltDirection.X, npc.Center.Y + boltDirection.Y, boltVelocity.X, boltVelocity.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltDirection.X, npc.Center.Y + boltDirection.Y, boltVelocity.X, boltVelocity.Y, type, BoltDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1166,10 +1174,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 handAttackDirection = Vector2.Normalize(handAttackRotation) * velocity; float ai = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * handFaceDirection; int type = ProjectileID.PhantasmalEye; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), handAttackMovement, handAttackDirection, type, damage, 0f, Main.myPlayer, 0f, ai); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), handAttackMovement, handAttackDirection, type, EyeDamage, 0f, Main.myPlayer, 0f, ai, aggressionLevel); Main.projectile[proj].timeLeft = 1200; - Main.projectile[proj].Calamity().lineColor = bossRush ? 1 : aggressionLevel; } } else @@ -1291,8 +1297,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses sphereFireDirection.Y += (finalSphereHandSpeed - 4.5f) * 1f; sphereFireDirection *= 1.2f; int type = ProjectileID.PhantasmalSphere; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, sphereFireDirection.X, sphereFireDirection.Y, type, damage, 1f, Main.myPlayer, 0f, npc.whoAmI); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, sphereFireDirection.X, sphereFireDirection.Y, type, SphereDamage, 1f, Main.myPlayer, 0f, npc.whoAmI); Main.projectile[proj].timeLeft = 1200; } @@ -1533,8 +1538,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 boltShootSpeed = Vector2.Normalize(v) * velocity; int type = ProjectileID.PhantasmalBolt; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltShootDirection.X, npc.Center.Y + boltShootDirection.Y, boltShootSpeed.X, boltShootSpeed.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + boltShootDirection.X, npc.Center.Y + boltShootDirection.Y, boltShootSpeed.X, boltShootSpeed.Y, type, BoltDamage, 0f, Main.myPlayer, 0f, 0f); } } @@ -1779,14 +1783,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float velocity = death ? 9f : 8f; Vector2 freeEyeBoltVel = Vector2.Normalize(v8) * velocity; int type = ProjectileID.PhantasmalBolt; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeBoltDirection.X, npc.Center.Y + freeEyeBoltDirection.Y, freeEyeBoltVel.X, freeEyeBoltVel.Y, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeBoltDirection.X, npc.Center.Y + freeEyeBoltDirection.Y, freeEyeBoltVel.X, freeEyeBoltVel.Y, type, TrueEyeBoltDamage, 0f, Main.myPlayer, 0f, 0f); } } else if (npc.ai[0] == 2f || npc.ai[0] == 4f) { int type = ProjectileID.PhantasmalSphere; - int damage = npc.GetProjectileDamage(type); if (secondAttackTimer < 15f) { @@ -1861,12 +1863,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + freeEyeRotation.X, npc.Center.Y + freeEyeRotation.Y, trueEyeSphereDirection.X, trueEyeSphereDirection.Y, type, 0, 0f, Main.myPlayer, 30f, npc.whoAmI); Main.projectile[proj].timeLeft = 1200; - if (CalamityWorld.LegendaryMode) + if (Main.zenithWorld) { for (int k = 0; k < 3; k++) { if (!WorldGen.SolidTile((int)(npc.Center.X / 16f), (int)(npc.Center.Y / 16f))) - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-1599, 1600) * 0.01f, (float)Main.rand.Next(-1599, 1) * 0.01f, ProjectileID.MoonBoulder, 70, 10f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, (float)Main.rand.Next(-1599, 1600) * 0.01f, (float)Main.rand.Next(-1599, 1) * 0.01f, ProjectileID.MoonBoulder, MoonBoulderDamage, 10f); } } } @@ -1922,7 +1924,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (trueEyeSphereProj.type == type && trueEyeSphereProj.ai[1] == npc.whoAmI && trueEyeSphereProj.ai[0] != -1f) { trueEyeSphereProj.ai[0] = -1f; - trueEyeSphereProj.damage = damage; + trueEyeSphereProj.damage = TrueEyeSphereDamage; trueEyeSphereProj.velocity = trueEyeSphereVelocity; trueEyeSphereProj.netUpdate = true; } @@ -2001,8 +2003,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 trueEyeEyeSpeed = Vector2.Normalize(trueEyeDirection) * velocity; float ai3 = (MathHelper.TwoPi * (float)Main.rand.NextDouble() - MathHelper.Pi) / 30f + 0.0174532924f * npc.ai[2]; int type = ProjectileID.PhantasmalEye; - int damage = npc.GetProjectileDamage(type); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), trueEyeEyeDirection, trueEyeEyeSpeed, type, damage, 0f, Main.myPlayer, 0f, ai3); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), trueEyeEyeDirection, trueEyeEyeSpeed, type, TrueEyeEyeDamage, 0f, Main.myPlayer, 0f, ai3); Main.projectile[proj].timeLeft = 1200; } } @@ -2074,8 +2075,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses deathrayTargetDist = deathrayTargetDist.RotatedBy(-(double)deathraySweepDirection * MathHelper.TwoPi / 6f); int type = ProjectileID.PhantasmalDeathray; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayTargetDist.X, deathrayTargetDist.Y, type, damage, 0f, Main.myPlayer, deathraySweepDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X, npc.Center.Y, deathrayTargetDist.X, deathrayTargetDist.Y, type, TrueEyeDeathrayDamage, 0f, Main.myPlayer, deathraySweepDirection * MathHelper.TwoPi / calamityGlobalNPC.newAI[1], npc.whoAmI); npc.ai[2] = (deathrayTargetDist.ToRotation() + MathHelper.Pi + MathHelper.TwoPi) * deathraySweepDirection; npc.netUpdate = true; } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs index b228164acb..8093a7ec60 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/PlanteraAI.cs @@ -27,12 +27,27 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float StopChargeGateValue = BeginChargeSlowDownGateValue - 30f; public const float MovementVelocityMultiplierForSlowAttacks = 0.5f; + // Vanilla values + public static float Phase2ContactDamageMult = 1.4f; // 140 + public static int PinkSeedDamage = 19; // 76 + public static int PoisonSeedDamage = 24; // 96 + public static int ThornBallDamage = 27; // 108 + + // Expert AI has uses a magic number which we have to correct for + public static int ContactDamageCorrection = Main.masterMode ? 150 : 100; + + // Rev+ exclusive + public static int ThornBallSpikeDamage = 22; // 88 + public static int GasBulbDamage = 27; // 108 + public static int PinkCloudDamage = 22; // 88 + public static int GreenCloudDamage = 24; // 96 + public static float DashDamageMult = 1.25f; // 175 + public static bool BuffedPlanteraAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -51,16 +66,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool vomitFreeTentacles = lifeRatio < 0.25f && death; bool phase4 = lifeRatio < 0.2f; - // Contact damage values for phase 2 - int setDamage = (int)Math.Round(npc.defDamage * 1.4); - int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + npc.damage = (int)Math.Round(ContactDamageCorrection * (phase2 ? Phase2ContactDamageMult : 1f)); // Variables and target - bool enrage = bossRush; + bool enrage = false; bool despawn = false; // Check for Jungle - bool surface = !bossRush && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; + bool surface = !BossRushEvent.BossRushActive && Main.player[npc.target].position.Y < Main.worldSurface * 16.0; // Tentacle limits int maxTentaclesAfterFirstTentaclePhase = death ? 4 : 2; @@ -121,22 +134,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses hookPositionY /= numHooksSpawned; // Velocity and acceleration - float velocity = bossRush ? 12f : phase4 ? 7f : phase3 ? 6.5f : phase2 ? 6f : 4f; - float acceleration = bossRush ? 0.12f : phase3 ? 0.06f : 0.04f; - float chargeLineUpVelocity = bossRush ? 20f : phase4 ? 12f : phase3 ? 10f : 8f; - float chargeLineUpAcceleration = bossRush ? 0.8f : phase4 ? 0.6f : phase3 ? 0.5f : 0.4f; - float chargeVelocity = bossRush ? 30f : phase4 ? 22f : phase3 ? 20f : 18f; - float chargeDeceleration = bossRush ? 0.85f : phase4 ? 0.92f : phase3 ? 0.95f : 0.96f; + float velocity = phase4 ? 7f : phase3 ? 6.5f : phase2 ? 6f : 4f; + float acceleration = phase3 ? 0.06f : 0.04f; + float chargeLineUpVelocity = phase4 ? 12f : phase3 ? 10f : 8f; + float chargeLineUpAcceleration = phase4 ? 0.6f : phase3 ? 0.5f : 0.4f; + float chargeVelocity = phase4 ? 22f : phase3 ? 20f : 18f; + float chargeDeceleration = phase4 ? 0.92f : phase3 ? 0.95f : 0.96f; // Enrage if target is on the surface - if (!bossRush && (surface || Main.player[npc.target].position.Y > Main.UnderworldLayer * 16)) + if (!BossRushEvent.BossRushActive && (surface || Main.player[npc.target].position.Y > Main.UnderworldLayer * 16)) { enrage = true; velocity += 8f; acceleration = 0.15f; } - npc.Calamity().CurrentlyEnraged = !bossRush && enrage; + npc.Calamity().CurrentlyEnraged = enrage; // Movement relative to the target and hook positions Vector2 npcCenterAccountingForHooks = new Vector2(hookPositionX, hookPositionY); @@ -214,7 +227,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool shootPoisonSeed = npc.ai[1] % 9f == 0f && !shootThornBall; float projectileSpeed = 14f; int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - int damage = npc.GetProjectileDamage(projectileType); + int damage = shootThornBall ? ThornBallDamage : shootPoisonSeed ? PoisonSeedDamage : PinkSeedDamage; Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; @@ -302,8 +315,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int totalProjectiles = death ? 36 : 30; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float velocity2 = CalamityWorld.LegendaryMode ? 10f : 5f; + float velocity2 = Main.getGoodWorld ? 10f : 5f; Vector2 spinningPoint = new Vector2(0f, -velocity2); for (int k = 0; k < totalProjectiles; k++) { @@ -321,7 +333,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float ai0 = Main.rand.Next(3); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * randomSpeed, type, damage, 0f, Main.myPlayer, ai0); + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * randomSpeed, type, GreenCloudDamage, 0f, Main.myPlayer, ai0); } } @@ -368,7 +380,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float projectileSpeed = 9f; int projectileType = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(projectileType); Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; @@ -382,7 +393,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? npc.Center : spawnOffset, projectileVelocity * projectileSpeed, projectileType, GasBulbDamage, 0f, Main.myPlayer); } } @@ -391,11 +402,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down and return to normal behavior if (npc.ai[3] <= BeginChargeSlowDownGateValue) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - npc.velocity *= chargeDeceleration; - float timeToDecelerateDecrement = bossRush ? 2f : phase4 ? 1.5f : 1f; + float timeToDecelerateDecrement = phase4 ? 1.5f : 1f; npc.ai[3] -= timeToDecelerateDecrement; if (npc.ai[3] <= StopChargeGateValue) { @@ -428,14 +436,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Emit spore gas in phase 3 else if (npc.ai[3] <= BeginChargeGateValue) { - // Set damage - npc.damage = setDamage; - + npc.damage = (int)Math.Round(ContactDamageCorrection * Phase2ContactDamageMult * DashDamageMult); float sporeGasDashGateValue = death ? 6f : 9f; if (phase3 && npc.ai[3] % sporeGasDashGateValue == 0f) { int projectileType = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(projectileType); float randomVelocityMultiplier = secondCharge ? 0.05f : death ? 0.3f : 0.2f; Vector2 projectileVelocity = npc.velocity * Main.rand.NextVector2CircularEdge(randomVelocityMultiplier, randomVelocityMultiplier); Vector2 spawnOffset = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 30f; @@ -450,7 +455,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float ai0 = Main.rand.Next(3); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, ai0); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity, projectileType, GasBulbDamage, 0f, Main.myPlayer, ai0); } npc.ai[3] -= 1f; @@ -461,9 +466,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Move a specified distance away from the target and charge once that distance is reached else { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - // Line up before charging if (npc.Calamity().newAI[0] == 0f) { @@ -503,9 +505,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] -= timeToLineUpChargeDecrement; if (npc.ai[3] <= BeginChargeGateValue) { - // Set damage - npc.damage = setDamage; - // Charge npc.ai[3] = BeginChargeGateValue; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * chargeVelocity; @@ -523,8 +522,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int totalProjectiles = secondCharge ? 6 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - float velocity2 = CalamityWorld.LegendaryMode ? 10f : 5f; + float velocity2 = Main.getGoodWorld ? 10f : 5f; Vector2 spinningPoint = new Vector2(0f, -velocity2); for (int k = 0; k < totalProjectiles; k++) { @@ -542,7 +540,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float ai0 = Main.rand.Next(3); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * randomSpeed, type, damage, 0f, Main.myPlayer, ai0); + Projectile.NewProjectile(npc.GetSource_FromAI(), spawnOffset, projectileVelocity * randomSpeed, type, GasBulbDamage, 0f, Main.myPlayer, ai0); } } @@ -554,9 +552,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else { - // Avoid cheap bullshit - npc.damage = phase2 ? reducedSetDamage : 0; - // Velocity ranges from 4 to 7.2, Acceleration ranges from 0.04 to 0.072, non-enraged phase 1 // Velocity ranges from 7 to 12.6, Acceleration ranges from 0.07 to 0.126, non-enraged phase 2 // Velocity ranges from 9 to 16.2, Acceleration ranges from 0.07 to 0.126, non-enraged phase 3 @@ -676,10 +671,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - bool shootPoisonSeed = (CalamityWorld.LegendaryMode || Main.rand.NextBool(death ? 2 : 4)) && !shootThornBall; + bool shootPoisonSeed = (Main.getGoodWorld || Main.rand.NextBool(death ? 2 : 4)) && !shootThornBall; int projectileType = shootThornBall ? ProjectileID.ThornBall : shootPoisonSeed ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; float projectileSpeed = death ? 16f : 14f; - int damage = npc.GetProjectileDamage(projectileType); + int damage = shootThornBall ? ThornBallDamage : shootPoisonSeed ? PoisonSeedDamage : PinkSeedDamage; Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); Vector2 spawnOffset = npc.Center + projectileVelocity * 70f; @@ -730,8 +725,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 2f; int totalTentacles = death ? 12 : 8; if (Main.getGoodWorld) - totalTentacles += 6; - if (CalamityWorld.LegendaryMode) totalTentacles *= 2; for (int i = 0; i < totalTentacles; i++) @@ -793,8 +786,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[3] >= shootProjectileGateValue) { float projectileSpeed = 14f; - if (bossRush) - projectileSpeed += 4f; Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); @@ -806,7 +797,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses numProj++; int type = ProjectileID.PoisonSeedPlantera; - int damage = npc.GetProjectileDamage(type); + int damage = PoisonSeedDamage; float rotation = MathHelper.ToRadians(spread); bool vomitTentacles = vomitFreeTentacles && NPC.CountNPCS(ModContent.NPCType()) < maxTentaclesAfterFirstTentaclePhase; if (vomitTentacles) @@ -818,7 +809,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (shootPinkSeed) { type = ProjectileID.SeedPlantera; - damage = npc.GetProjectileDamage(type); + damage = PinkSeedDamage; } else type = ProjectileID.PoisonSeedPlantera; @@ -870,7 +861,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (shootThornBall) { type = ProjectileID.ThornBall; - damage = npc.GetProjectileDamage(type); + damage = ThornBallDamage; Vector2 spawnOffset = npc.Center + projectileVelocity * 50f; if (Main.netMode != NetmodeID.MultiplayerClient) @@ -968,7 +959,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPlanterasHookAI(NPC npc, Mod mod) { // Variables - bool enrage = BossRushEvent.BossRushActive; + bool enrage = false; bool despawn = false; bool death = CalamityWorld.death || enrage; @@ -989,7 +980,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses despawn = true; // Enrage if Plantera's target is on the surface - if (!enrage && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > Main.UnderworldLayer * 16) | despawn)) + if (!enrage && !BossRushEvent.BossRushActive && ((Main.player[Main.npc[NPC.plantBoss].target].position.Y < Main.worldSurface * 16.0 || Main.player[Main.npc[NPC.plantBoss].target].position.Y > Main.UnderworldLayer * 16) | despawn)) { npc.localAI[0] -= 4f; enrage = true; @@ -1176,8 +1167,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float extendTime = 180f; if (planteraIsCharging) { - npc.damage = 0; - if (npc.localAI[0] > 0f) { npc.localAI[0] = 0f; @@ -1186,7 +1175,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.localAI[0] < extendTime) { - npc.damage = npc.defDamage; npc.localAI[0] += 1f; if (npc.localAI[0] >= extendTime) npc.SyncExtraAI(); @@ -1297,382 +1285,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaPlanteraAI(NPC npc, Mod mod) - { - bool flag39 = false; - bool flag40 = false; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (Main.player[npc.target].dead) - { - flag40 = true; - flag39 = true; - } - else if (Main.netMode != NetmodeID.MultiplayerClient && npc.target >= 0 && npc.target < Main.maxPlayers) - { - int despawnDistance = 4800; - if (npc.timeLeft < NPC.activeTime && Vector2.Distance(npc.Center, Main.player[npc.target].Center) < (float)despawnDistance) - npc.timeLeft = NPC.activeTime; - } - - NPC.plantBoss = npc.whoAmI; - if (npc.localAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] = 1f; - int hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - hook = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasHook, npc.whoAmI); - } - - int[] array2 = new int[3]; - float num775 = 0f; - float num776 = 0f; - int num777 = 0; - for (int num778 = 0; num778 < Main.maxNPCs; num778++) - { - if (Main.npc[num778].active && Main.npc[num778].aiStyle == NPCAIStyleID.PlanteraHook) - { - num775 += Main.npc[num778].Center.X; - num776 += Main.npc[num778].Center.Y; - array2[num777] = num778; - num777++; - if (num777 > 2) - break; - } - } - - num775 /= (float)num777; - num776 /= (float)num777; - float num779 = 2.5f; - float num780 = 0.025f; - if (npc.life < npc.lifeMax / 2) - { - num779 = 5f; - num780 = 0.05f; - } - - if (npc.life < npc.lifeMax / 4) - num779 = 7f; - - if (!Main.player[npc.target].ZoneJungle || (double)Main.player[npc.target].position.Y < Main.worldSurface * 16.0 || Main.player[npc.target].position.Y > (float)(Main.UnderworldLayer * 16)) - { - flag39 = true; - num779 += 8f; - num780 = 0.15f; - } - - npc.Calamity().CurrentlyEnraged = !BossRushEvent.BossRushActive && flag39; - - if (Main.expertMode) - { - num779 += (Main.masterMode ? 2f : 1f); - num779 *= (Main.masterMode ? 1.2f : 1.1f); - num780 += (Main.masterMode ? 0.02f : 0.01f); - num780 *= (Main.masterMode ? 1.2f : 1.1f); - } - - if (Main.getGoodWorld) - { - num779 *= 1.15f; - num780 *= 1.15f; - } - - Vector2 vector97 = new Vector2(num775, num776); - float num781 = Main.player[npc.target].Center.X - vector97.X; - float num782 = Main.player[npc.target].Center.Y - vector97.Y; - bool phase1MoveAway = npc.life > npc.lifeMax / 2 && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 480f && Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - bool adjustProjectileShootLocation = Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 80f; - if (flag40) - { - num782 *= -1f; - num781 *= -1f; - num779 += 8f; - } - else if (phase1MoveAway) - { - num782 *= -1f; - num781 *= -1f; - num779 *= 1.5f; - num780 *= 2f; - } - - float num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); - int num784 = 500; - if (flag39) - num784 += 350; - - if (Main.expertMode) - num784 += (Main.masterMode ? 300 : 150); - - if (num783 >= (float)num784) - { - num783 = (float)num784 / num783; - num781 *= num783; - num782 *= num783; - } - - num775 += num781; - num776 += num782; - vector97 = npc.Center; - num781 = num775 - vector97.X; - num782 = num776 - vector97.Y; - num783 = (float)Math.Sqrt(num781 * num781 + num782 * num782); - if (num783 < num779) - { - num781 = npc.velocity.X; - num782 = npc.velocity.Y; - } - else - { - num783 = num779 / num783; - num781 *= num783; - num782 *= num783; - } - - if (npc.velocity.X < num781) - { - npc.velocity.X += num780; - if (npc.velocity.X < 0f && num781 > 0f) - npc.velocity.X += num780 * 2f; - } - else if (npc.velocity.X > num781) - { - npc.velocity.X -= num780; - if (npc.velocity.X > 0f && num781 < 0f) - npc.velocity.X -= num780 * 2f; - } - - if (npc.velocity.Y < num782) - { - npc.velocity.Y += num780; - if (npc.velocity.Y < 0f && num782 > 0f) - npc.velocity.Y += num780 * 2f; - } - else if (npc.velocity.Y > num782) - { - npc.velocity.Y -= num780; - if (npc.velocity.Y > 0f && num782 < 0f) - npc.velocity.Y -= num780 * 2f; - } - - Vector2 vector98 = npc.Center; - float num785 = Main.player[npc.target].Center.X - vector98.X; - float num786 = Main.player[npc.target].Center.Y - vector98.Y; - npc.rotation = (float)Math.Atan2(num786, num785) + MathHelper.PiOver2; - if (npc.life > npc.lifeMax / 2) - { - npc.defense = 36; - if (flag39) - npc.defense *= 2; - - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.9) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.8) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.7) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - npc.localAI[1] += 1f; - - if (flag39) - npc.localAI[1] += 3f; - - if (Main.expertMode) - npc.localAI[1] += (Main.masterMode ? 2f : 1f); - - if (Main.expertMode && npc.justHit && Main.rand.NextBool()) - npc.localAI[3] = (Main.masterMode ? 2f : 1f); - - if (Main.getGoodWorld) - npc.localAI[1] += 1f; - - if (!(npc.localAI[1] > 80f)) - return false; - - npc.localAI[1] = 0f; - bool flag41 = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (npc.localAI[3] > 0f) - { - flag41 = true; - npc.localAI[3] = 0f; - } - - if (flag41) - { - Vector2 vector99 = npc.Center; - float num788 = 15f; - if (Main.expertMode) - num788 = Main.masterMode ? 19f : 17f; - - float num789 = Main.player[npc.target].Center.X - vector99.X; - float num790 = Main.player[npc.target].Center.Y - vector99.Y; - float num791 = (float)Math.Sqrt(num789 * num789 + num790 * num790); - num791 = num788 / num791; - num789 *= num791; - num790 *= num791; - int type = Main.masterMode ? ProjectileID.PoisonSeedPlantera : ProjectileID.SeedPlantera; - int maxValue2 = 4; - int thornBallChance = 8; - if (Main.expertMode) - { - maxValue2 = 2; - thornBallChance = Main.masterMode ? 5 : 6; - } - - if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(maxValue2) && !Main.masterMode) - { - npc.localAI[1] = -30f; - type = ProjectileID.PoisonSeedPlantera; - } - else if ((double)npc.life < npc.lifeMax * 0.8 && Main.rand.NextBool(thornBallChance)) - { - bool shootThornBall = true; - int numThornBalls = 0; - int thornBallLimit = 3; - for (int i = 0; i < Main.maxProjectiles; i++) - { - if (Main.projectile[i].active && Main.projectile[i].type == ProjectileID.ThornBall) - { - numThornBalls++; - if (numThornBalls >= thornBallLimit) - { - shootThornBall = false; - break; - } - } - } - - npc.localAI[1] = shootThornBall ? -120f : -30f; - type = shootThornBall ? ProjectileID.ThornBall : ProjectileID.PoisonSeedPlantera; - } - else if (Main.masterMode) - npc.localAI[1] = -30f; - - int damage = npc.GetProjectileDamage(type); - if (flag39) - damage *= 2; - - Vector2 projectileVelocity = new Vector2(num789, num790); - int num794 = Projectile.NewProjectile(npc.GetSource_FromAI(), adjustProjectileShootLocation ? vector99 : vector99 + projectileVelocity.SafeNormalize(Vector2.UnitY) * 70f, projectileVelocity, type, damage, 0f, Main.myPlayer); - if (type != ProjectileID.ThornBall) - Main.projectile[num794].timeLeft = 300; - } - - return false; - } - - npc.defense = 10; - int setDamage = (int)Math.Round(npc.defDamage * 1.4); - if (flag39) - { - npc.defense *= 4; - setDamage *= 2; - } - - npc.damage = setDamage; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - if (npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - int num796 = Main.masterMode ? 12 : 8; - if (Main.getGoodWorld) - num796 += 6; - - for (int num797 = 0; num797 < num796; num797++) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - - if (Main.expertMode) - { - for (int num799 = 0; num799 < Main.maxNPCs; num799++) - { - if (Main.npc[num799].active && Main.npc[num799].aiStyle == NPCAIStyleID.PlanteraHook) - { - for (int num800 = 0; num800 < num796 / 2 - 1; num800++) - { - int num801 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - Main.npc[num801].ai[3] = num799 + 1; - } - } - } - } - } - else if (Main.expertMode && Main.rand.NextBool(Main.masterMode ? 50 : 60)) - { - int num802 = 0; - for (int num803 = 0; num803 < Main.maxNPCs; num803++) - { - if (Main.npc[num803].active && Main.npc[num803].type == NPCID.PlanterasTentacle && Main.npc[num803].ai[3] == 0f) - num802++; - } - - if (num802 < (Main.masterMode ? 12 : 8) && Main.rand.Next((num802 + 1) * 10) <= 1) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PlanterasTentacle, npc.whoAmI); - } - } - - if (npc.localAI[2] == 0f) - { - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 378, npc.scale); - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 379, npc.scale); - Gore.NewGore(npc.GetSource_FromAI(), new Vector2(npc.position.X + (float)Main.rand.Next(npc.width), npc.position.Y + (float)Main.rand.Next(npc.height)), npc.velocity, 380, npc.scale); - npc.localAI[2] = 1f; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - if ((double)npc.life < (double)npc.lifeMax * 0.4) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.3) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.localAI[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - npc.localAI[1] += 1f; - - if (npc.localAI[1] >= (Main.masterMode ? 200f : Main.expertMode ? 275f : 350f)) - { - float num805 = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; - Vector2 vector100 = npc.Center; - float num806 = Main.player[npc.target].Center.X - vector100.X; - float num807 = Math.Abs(num806 * 0.2f); - float num808 = Main.player[npc.target].Center.Y - vector100.Y; - if (num808 > 0f) - num807 = 0f; - - num808 -= num807; - float num809 = (float)Math.Sqrt(num806 * num806 + num808 * num808); - num809 = num805 / num809; - num806 *= num809; - num808 *= num809; - int num810 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.Spore); - Main.npc[num810].velocity.X = num806; - Main.npc[num810].velocity.Y = num808; - Main.npc[num810].netUpdate = true; - npc.localAI[1] = 0f; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs index eb52a49218..b695a3093d 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenBeeAI.cs @@ -15,6 +15,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class QueenBeeAI { + // Vanilla values + public static int StingerDamage = 11; // 44; Also applies to GFB stinger replacements + + // Death exclusive + public static int BeenadeDamage = 15; // 90 + public static int BeenadeBeeDamage = 12; // 72 + public static bool BuffedQueenBeeAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); @@ -23,10 +30,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - bool enrage = true; + bool enrage = !BossRushEvent.BossRushActive; int targetTileX = (int)Main.player[npc.target].Center.X / 16; int targetTileY = (int)Main.player[npc.target].Center.Y / 16; @@ -36,22 +42,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float maxEnrageScale = 2f; float enrageScale = death ? 0.5f : 0f; - if (((npc.position.Y / 16f) < Main.worldSurface && enrage) || bossRush) + if ((npc.position.Y / 16f) < Main.worldSurface && enrage) { - calamityGlobalNPC.CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; + calamityGlobalNPC.CurrentlyEnraged = true; + enrageScale += 1f; } - if (!Main.player[npc.target].ZoneJungle || bossRush) + if (!Main.player[npc.target].ZoneJungle && enrage) { - calamityGlobalNPC.CurrentlyEnraged = !bossRush; - enrageScale += 0.5f; + calamityGlobalNPC.CurrentlyEnraged = true; + enrageScale += 1f; } if (Main.getGoodWorld) - enrageScale += ((CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 1f : 0.5f); - - if (bossRush) - enrageScale = 2f; + enrageScale += 0.5f; if (enrageScale > maxEnrageScale) enrageScale = maxEnrageScale; @@ -141,12 +144,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool immuneToSlowingDebuffs = npc.ai[0] == 0f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; // Always start in enemy spawning phase @@ -252,9 +253,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (death) chargeAmt = phase6 ? 1 : phase5 ? 3 : phase4 ? 2 : 1; - int masterModeChargeLimit = death ? (phase5 ? 2 : 1) : (phase5 ? 3 : 2); - if (death && chargeAmt > masterModeChargeLimit) - chargeAmt = masterModeChargeLimit; + int deathChargeLimit = phase5 ? 3 : 2; + if (death && chargeAmt > deathChargeLimit) + chargeAmt = deathChargeLimit; // Switch to a random phase if chargeAmt has been exceeded if (npc.ai[1] > (2 * chargeAmt) && npc.ai[1] % 2f == 0f) @@ -747,7 +748,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 stingerVelocity = new Vector2(stingerTargetX, stingerTargetY); int type = Main.zenithWorld ? (phase3 ? ModContent.ProjectileType() : ProjectileID.FlamingWood) : ProjectileID.QueenBeeStinger; - int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation, stingerVelocity, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation, stingerVelocity, type, StingerDamage, 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; @@ -756,7 +757,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses int numExtraStingers = death ? (phase6 ? 4 : 2) : (phase6 ? 2 : 1); for (int i = 0; i < numExtraStingers; i++) { - projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * MathHelper.Lerp(0.75f, 1f, i / (float)numExtraStingers), type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); + projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + Main.rand.NextVector2CircularEdge(16f, 16f) * (i + 1), stingerVelocity * MathHelper.Lerp(0.75f, 1f, i / (float)numExtraStingers), type, StingerDamage, 0f, Main.myPlayer, 0f, (Main.zenithWorld && phase3) ? Main.player[npc.target].position.Y : 0f); Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; } @@ -879,7 +880,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (i % 2f != 0f) perturbedSpeed *= 0.8f; - int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, Main.zenithWorld ? 25 : npc.GetProjectileDamage(type), 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); + int projectile = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 10f, perturbedSpeed, type, StingerDamage, 0f, Main.myPlayer, 0f, Main.player[npc.target].position.Y); Main.projectile[projectile].timeLeft = 1200; Main.projectile[projectile].extraUpdates = 1; @@ -950,9 +951,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 beenadeSpawnLocation = npc.Center + new Vector2(20f * npc.direction, -40f); SoundEngine.PlaySound(SoundID.Item76, beenadeSpawnLocation); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(npc.GetSource_FromAI(), beenadeSpawnLocation, Vector2.UnitX * 6f * npc.direction, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), beenadeSpawnLocation, Vector2.UnitX * 6f * npc.direction, type, BeenadeDamage, 0f, Main.myPlayer); } } @@ -961,580 +961,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaQueenBeeAI(NPC npc, Mod mod) - { - if (Main.expertMode) - { - int num643 = (int)(20f * (1f - (float)npc.life / (float)npc.lifeMax)); - npc.defense = npc.defDefense + num643; - } - - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - bool enrage = true; - int targetTileX = (int)Main.player[npc.target].Center.X / 16; - int targetTileY = (int)Main.player[npc.target].Center.Y / 16; - - Tile tile = Framing.GetTileSafely(targetTileX, targetTileY); - if (tile.WallType == WallID.HiveUnsafe) - enrage = false; - - bool dead4 = Main.player[npc.target].dead; - float num644 = 0f; - if ((double)(npc.position.Y / 16f) < Main.worldSurface && enrage) - num644 += 1f; - - if (!Main.player[npc.target].ZoneJungle) - num644 += 1f; - - npc.Calamity().CurrentlyEnraged = num644 > 0f; - - if (Main.getGoodWorld) - num644 += 0.5f; - - float num645 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (npc.ai[0] != 5f) - { - if (npc.timeLeft < 60) - npc.timeLeft = 60; - - if (num645 > 3000f) - { - npc.ai[0] = 4f; - npc.netUpdate = true; - } - } - - if (dead4) - { - npc.ai[0] = 5f; - npc.netUpdate = true; - } - - if (npc.ai[0] == 5f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.Y *= 0.98f; - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - if (npc.position.X < (float)(Main.maxTilesX * 8)) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X -= 0.08f; - } - else - { - if (npc.velocity.X < 0f) - npc.velocity.X *= 0.98f; - else - npc.localAI[0] = 1f; - - npc.velocity.X += 0.08f; - } - - npc.EncourageDespawn(10); - } - else if (npc.ai[0] == -1f) - { - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - float num646 = npc.ai[1]; - int num647; - do - { - num647 = Main.rand.Next(3); - switch (num647) - { - case 1: - num647 = 2; - break; - case 2: - num647 = 3; - break; - } - } - while ((float)num647 == num646); - - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ai[0] = num647; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - else if (npc.ai[0] == 0f) - { - // Charging distance from player - int chargeDistanceX = Main.masterMode ? 425 : 600; - if (Main.expertMode) - { - int chargeDistanceReduction = Main.masterMode ? 25 : 50; - if ((double)npc.life < (double)npc.lifeMax * 0.1) - chargeDistanceX -= chargeDistanceReduction * 6; - else if ((double)npc.life < (double)npc.lifeMax * 0.25) - chargeDistanceX -= chargeDistanceReduction * 3; - else if ((double)npc.life < (double)npc.lifeMax * 0.5) - chargeDistanceX -= chargeDistanceReduction * 2; - else if ((double)npc.life < (double)npc.lifeMax * 0.75) - chargeDistanceX -= chargeDistanceReduction; - } - chargeDistanceX -= (int)(100f * num644); - - int num648 = Main.masterMode ? 1 : 2; - if (Main.expertMode) - { - if (npc.life < npc.lifeMax / 2 && !Main.masterMode) - num648++; - - if (npc.life < npc.lifeMax / 3) - num648++; - - if (npc.life < npc.lifeMax / 5) - num648++; - } - - num648 += (int)(1f * num644); - if (npc.ai[1] > (float)(2 * num648) && npc.ai[1] % 2f == 0f) - { - npc.ai[0] = -1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - return false; - } - - if (npc.ai[1] % 2f == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float chargeDistanceY = 20f; - chargeDistanceY += 20f * num644; - - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - float distanceFromTargetY = Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y); - if (distanceFromTargetY < chargeDistanceY && distanceFromTargetX >= chargeDistanceX) - { - // Set damage - npc.damage = npc.defDamage; - - npc.localAI[0] = 1f; - npc.ai[1] += 1f; - npc.ai[2] = 0f; - npc.netUpdate = true; - float num650 = 12f; - if (Main.expertMode) - { - num650 = Main.masterMode ? 20f : 16f; - float chargeVelocityIncrease = Main.masterMode ? 1.5f : 2f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num650 += chargeVelocityIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num650 += chargeVelocityIncrease; - } - - num650 += 7f * num644; - Vector2 vector82 = npc.Center; - float num651 = Main.player[npc.target].Center.X - vector82.X; - float num652 = Main.player[npc.target].Center.Y - vector82.Y; - float num653 = (float)Math.Sqrt(num651 * num651 + num652 * num652); - num653 = num650 / num653; - npc.velocity.X = num651 * num653; - npc.velocity.Y = num652 * num653; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - SoundEngine.PlaySound(SoundID.Zombie125, npc.Center); - - return false; - } - - npc.localAI[0] = 0f; - float num654 = Main.masterMode ? 16f : 12f; - float num655 = Main.masterMode ? 0.3f : 0.15f; - if (Main.expertMode) - { - float chargeLineUpVelocityIncrease = Main.masterMode ? 0.5f : 1f; - float chargeLineUpAccelerationIncrease = Main.masterMode ? 0.025f : 0.05f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - { - num654 += chargeLineUpVelocityIncrease; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - { - num654 += chargeLineUpVelocityIncrease; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - { - num654 += chargeLineUpVelocityIncrease * 2f; - num655 += chargeLineUpAccelerationIncrease; - } - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - { - num654 += chargeLineUpVelocityIncrease * 2f; - num655 += chargeLineUpAccelerationIncrease * 2f; - } - } - - num654 += 3f * num644; - num655 += 0.5f * num644; - - // Velocity calculations - if (npc.Center.Y < Main.player[npc.target].Center.Y - chargeDistanceY) - npc.velocity.Y += num655; - else if (npc.Center.Y > Main.player[npc.target].Center.Y + chargeDistanceY) - npc.velocity.Y -= num655; - else - npc.velocity.Y *= 0.7f; - - if (npc.velocity.Y < -num654) - npc.velocity.Y = -num654; - if (npc.velocity.Y > num654) - npc.velocity.Y = num654; - - float distanceXMax = 100f; - float distanceXMin = 20f; - if (distanceFromTargetX > chargeDistanceX + distanceXMax) - npc.velocity.X += 0.15f * npc.direction; - else if (distanceFromTargetX < chargeDistanceX + distanceXMin) - npc.velocity.X -= 0.15f * npc.direction; - else - npc.velocity.X *= 0.7f; - - if (npc.velocity.X < -16f) - npc.velocity.X = -16f; - if (npc.velocity.X > 16f) - npc.velocity.X = 16f; - - // Face the correct direction - float playerLocation2 = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation2 < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - return false; - } - - // Set damage - npc.damage = npc.defDamage; - - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - - int num657 = 1; - if (npc.Center.X < Main.player[npc.target].Center.X) - num657 = -1; - - bool flag34 = false; - if (npc.direction == num657 && Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) > (float)chargeDistanceX) - { - npc.ai[2] = 1f; - flag34 = true; - } - - if (Math.Abs(npc.Center.Y - Main.player[npc.target].Center.Y) > (float)chargeDistanceX * 1.5f) - { - npc.ai[2] = 1f; - flag34 = true; - } - - if (num644 > 0f && flag34) - npc.velocity *= 0.5f; - - if (npc.ai[2] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - npc.localAI[0] = 0f; - - npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); - float num658 = Main.masterMode ? 0.2f : 0.1f; - if (Main.expertMode) - { - float velocityMultiplier = Main.masterMode ? 0.925f : 0.9f; - float velocityGateValueIncrease = Main.masterMode ? 0.025f : 0.05f; - if (npc.life < npc.lifeMax / 2) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - - if (npc.life < npc.lifeMax / 3) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - - if (npc.life < npc.lifeMax / 5) - { - npc.velocity *= velocityMultiplier; - num658 += velocityGateValueIncrease; - } - } - - if (num644 > 0f) - npc.velocity *= 0.7f; - - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < num658) - { - npc.ai[2] = 0f; - npc.ai[1] += 1f; - npc.netUpdate = true; - } - } - else - npc.localAI[0] = 1f; - } - else if (npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float num659 = Main.masterMode ? 14f : 12f; - float num660 = 0.14f; - if (Main.expertMode) - num660 = Main.masterMode ? 0.3f : 0.2f; - - bool canHitTarget = Collision.CanHit(npc.Center, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - float distanceAboveTarget = !canHitTarget ? 0f : 320f; - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * distanceAboveTarget; - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num659; - - if (Vector2.Distance(npc.Center, hoverDestination) < 200f && canHitTarget) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - return false; - } - - npc.SimpleFlyMovement(idealVelocity, num660); - } - else if (npc.ai[0] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.localAI[0] = 0f; - - float num672 = Main.masterMode ? 16f : 14f; - float num673 = Main.masterMode ? 0.15f : 0.1f; - - Vector2 beeSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - Vector2 beeSpawnCollisionLocation = new Vector2(beeSpawnLocation.X, beeSpawnLocation.Y - 30f); - bool canHitTarget = Collision.CanHit(beeSpawnCollisionLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 320f); - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num672; - - npc.ai[1] += (Main.masterMode ? 2f : 1f); - if (Main.expertMode) - { - int num667 = 0; - for (int num668 = 0; num668 < Main.maxPlayers; num668++) - { - if (Main.player[num668].active && !Main.player[num668].dead && (npc.Center - Main.player[num668].Center).Length() < 1000f) - num667++; - } - - npc.ai[1] += num667 / 2; - float beeTimerIncrease = Main.masterMode ? 0.125f : 0.25f; - if ((double)npc.life < (double)npc.lifeMax * 0.75) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - npc.ai[1] += beeTimerIncrease; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - npc.ai[1] += beeTimerIncrease; - } - - bool flag35 = false; - int num669 = (int)(40f - 18f * num644); - if (npc.ai[1] > (float)num669) - { - npc.ai[1] = 0f; - npc.ai[2]++; - flag35 = true; - } - - if (Collision.CanHit(beeSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height) && flag35) - { - SoundEngine.PlaySound(SoundID.NPCHit18, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num670 = Main.rand.Next(NPCID.Bee, NPCID.BeeSmall + 1); - int num671 = NPC.NewNPC(npc.GetSource_FromAI(), (int)beeSpawnLocation.X, (int)beeSpawnLocation.Y, num670); - Vector2 beeVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - Main.npc[num671].velocity = beeVelocity; - Main.npc[num671].velocity *= 5f; - Main.npc[num671].CanBeReplacedByOtherNPCs = true; - Main.npc[num671].localAI[0] = 60f; - Main.npc[num671].netUpdate = true; - } - } - - // Velocity calculations if target is too far away - if (Vector2.Distance(beeSpawnLocation, hoverDestination) > 400f || !canHitTarget) - npc.SimpleFlyMovement(idealVelocity, num673); - else - npc.velocity *= (Main.masterMode ? 0.8f : 0.9f); - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float maxBees = Main.masterMode ? 8f : 5f; - if (npc.ai[2] > maxBees) - { - npc.ai[0] = -1f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float playerLocation = npc.Center.X - Main.player[npc.target].Center.X; - npc.direction = playerLocation < 0 ? 1 : -1; - npc.spriteDirection = npc.direction; - - float num674 = 12f; - float num675 = 0.1f; - if (Main.expertMode) - { - num675 = Main.masterMode ? 0.2f : 0.15f; - num674 = Main.masterMode ? 16f : 14f; - } - num675 += 0.2f * num644; - num674 += 6f * num644; - - Vector2 stingerSpawnLocation = new Vector2(npc.Center.X + (Main.rand.Next(20) * npc.direction), npc.position.Y + npc.height * 0.8f); - bool canHitTarget = Collision.CanHit(new Vector2(stingerSpawnLocation.X, stingerSpawnLocation.Y - 30f), 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - Vector2 hoverDestination = Main.player[npc.target].Center - Vector2.UnitY * (!canHitTarget ? 0f : 300f); - Vector2 idealVelocity = npc.SafeDirectionTo(hoverDestination) * num674; - - npc.ai[1] += 1f; - int num679 = 40; - if (Main.masterMode) - num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 10 : ((npc.life < npc.lifeMax / 3) ? 15 : ((npc.life >= npc.lifeMax / 2) ? 25 : 20))); - else if (Main.expertMode) - num679 = (((double)npc.life < (double)npc.lifeMax * 0.1) ? 15 : ((npc.life < npc.lifeMax / 3) ? 25 : ((npc.life >= npc.lifeMax / 2) ? 35 : 30))); - - num679 -= (int)((Main.masterMode ? 3f : 5f) * num644); - if (npc.ai[1] % (float)num679 == (float)(num679 - 1) && npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && Collision.CanHit(stingerSpawnLocation, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - SoundEngine.PlaySound(SoundID.Item17, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num680 = Main.masterMode ? 11f : 8f; - float stingerVelocityIncrease = Main.masterMode ? 1f : 2f; - if (Main.expertMode) - num680 += stingerVelocityIncrease; - - if (Main.expertMode && (double)npc.life < (double)npc.lifeMax * 0.1) - num680 += stingerVelocityIncrease * 1.5f; - - num680 += 7f * num644; - int num681 = (int)(12f - 5f * num644); - int num682 = (int)(6f - 2f * num644); - if (num681 < 1) - num681 = 1; - - if (num682 < 1) - num682 = 1; - - float num683 = Main.player[npc.target].Center.X - stingerSpawnLocation.X + (float)Main.rand.Next(-num681, num681 + 1); - float num684 = Main.player[npc.target].Center.Y - stingerSpawnLocation.Y + (float)Main.rand.Next(-num682, num682 + 1); - float num685 = (float)Math.Sqrt(num683 * num683 + num684 * num684); - num685 = num680 / num685; - num683 *= num685; - num684 *= num685; - int type = ProjectileID.QueenBeeStinger; - int num688 = Projectile.NewProjectile(npc.GetSource_FromAI(), stingerSpawnLocation.X, stingerSpawnLocation.Y, num683, num684, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - Main.projectile[num688].timeLeft = 300; - } - } - - if (Vector2.Distance(stingerSpawnLocation, hoverDestination) > 40f || !canHitTarget) - npc.SimpleFlyMovement(idealVelocity, num675); - - float num689 = Main.masterMode ? 16f : 20f; - num689 -= 5f * num644; - if (npc.ai[1] > (float)num679 * num689) - { - npc.ai[0] = -1f; - npc.ai[1] = 3f; - npc.netUpdate = true; - } - } - else if (npc.ai[0] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.localAI[0] = 1f; - float num690 = 14f; - float num691 = 14f; - Vector2 vector88 = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY); - vector88 *= num690; - npc.velocity = (npc.velocity * num691 + vector88) / (num691 + 1f); - if (npc.velocity.X < 0f) - npc.direction = -1; - else - npc.direction = 1; - - npc.spriteDirection = npc.direction; - if (num645 < 2000f) - { - npc.ai[0] = -1f; - npc.localAI[0] = 0f; - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs index 9e895f7809..2949c7af76 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/QueenSlimeAI.cs @@ -12,11 +12,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class QueenSlimeAI { + // Vanilla values + public static int SmallGelDamage = Main.masterMode ? 20 : 17; // 68 + public static int SpikeDamage = Main.masterMode ? 20 : 17; // 68 + public static int LargeGelDamage = 30; // 120 + public static int SlamDamage = 40; // 160 + public static bool BuffedQueenSlimeAI(NPC npc, Mod mod) { // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -58,6 +63,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + // Slow down dramatically while teleporting + if (npc.ai[0] == 1f || npc.ai[0] == 2f) + { + if (Math.Abs(npc.velocity.X) > 0.1f) + { + npc.velocity.X *= 0.8f; + if (Math.Abs(npc.velocity.X) <= 0.1f) + npc.velocity.X = 0f; + } + } + // Teleport float teleportGateValue = death ? 300f : 600f; if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !phase2 && npc.ai[3] >= teleportGateValue && npc.ai[0] == 0f && npc.velocity.Y == 0f) @@ -197,9 +213,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses break; npc.ai[1] += 1f; - int idleTime = bossRush ? 20 : death ? 30 : 40; + int idleTime = death ? 30 : 40; if (phase2) - idleTime = bossRush ? 40 : death ? 60 : 80; + idleTime = death ? 60 : 80; if (phase4) idleTime /= 2; @@ -261,7 +277,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = 0f; npc.ai[1] += 1f; - float teleportEndTime = bossRush ? 10f : death ? 15f : 20f; + float teleportEndTime = death ? 15f : 20f; slimeScale = MathHelper.Clamp(npc.ai[1] / teleportEndTime, 0f, 1f); slimeScale = 0.5f + slimeScale * 0.5f; if (npc.ai[1] >= teleportEndTime && Main.netMode != NetmodeID.MultiplayerClient) @@ -301,7 +317,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = 0f; npc.ai[1] += 1f; - float teleportTime = bossRush ? 20f : death ? 30f : 40f; + float teleportTime = death ? 30f : 40f; slimeScale = MathHelper.Clamp((teleportTime - npc.ai[1]) / teleportTime, 0f, 1f); slimeScale = 0.5f + slimeScale * 0.5f; @@ -322,7 +338,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float gelVelocity = death ? 20f : 16f; int type = ProjectileID.QueenSlimeGelAttack; - int damage = npc.GetProjectileDamage(type); if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -330,11 +345,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 spinningpoint = new Vector2(gelVelocity, 0f); - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) spinningpoint *= Main.rand.NextFloat() + 0.5f; spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)numGelProjectiles, Vector2.Zero); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, LargeGelDamage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } } @@ -377,7 +392,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Faster fall if (npc.velocity.Y > 0f) - npc.velocity.Y += bossRush ? 0.1f : death ? 0.05f : 0f; + npc.velocity.Y += death ? 0.05f : 0f; npc.rotation = 0f; if (npc.velocity.Y == 0f) @@ -389,7 +404,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.velocity.X > -0.1 && npc.velocity.X < 0.1) npc.velocity.X = 0f; - float timerIncrement = bossRush ? 7f : death ? 6f : 5f; + float timerIncrement = death ? 6f : 5f; npc.ai[1] += timerIncrement; if (lifeRatio < 0.85f) npc.ai[1] += timerIncrement; @@ -417,7 +432,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 3f) { npc.velocity.Y = -13f * speedMult; - npc.velocity.X += (bossRush ? 7f : death ? 6f : 5.5f) * npc.direction; + npc.velocity.X += (death ? 6f : 5.5f) * npc.direction; npc.ai[1] = 0f; npc.ai[2] = 0f; if (npc.timeLeft > 10) @@ -431,15 +446,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[2] == 2f) { - npc.velocity.Y = -(bossRush ? 10f : death ? 8f : 6f) * speedMult; - npc.velocity.X += (bossRush ? 8.5f : death ? 7.5f : 7f) * npc.direction; + npc.velocity.Y = -(death ? 8f : 6f) * speedMult; + npc.velocity.X += (death ? 7.5f : 7f) * npc.direction; npc.ai[1] = -40f; npc.ai[2] += 1f; } else { - npc.velocity.Y = -(bossRush ? 12f : death ? 10f : 8f) * speedMult; - npc.velocity.X += (bossRush ? 7.5f : death ? 6.5f : 6f) * npc.direction; + npc.velocity.Y = -(death ? 10f : 8f) * speedMult; + npc.velocity.X += (death ? 6.5f : 6f) * npc.direction; npc.ai[1] = -40f; npc.ai[2] += 1f; } @@ -454,16 +469,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.target >= Main.maxPlayers) break; - float jumpVelocity = bossRush ? 9f : death ? 7f : 4.5f; + float jumpVelocity = death ? 7f : 4.5f; if (Main.getGoodWorld) jumpVelocity = 12f; if ((npc.direction == 1 && npc.velocity.X < jumpVelocity) || (npc.direction == -1 && npc.velocity.X > 0f - jumpVelocity)) { if ((npc.direction == -1 && npc.velocity.X < 0.1) || (npc.direction == 1 && npc.velocity.X > -0.1)) - npc.velocity.X += (bossRush ? 1f : death ? 0.45f : 0.3f) * npc.direction; + npc.velocity.X += (death ? 0.45f : 0.3f) * npc.direction; else - npc.velocity.X *= bossRush ? 0.8f : death ? 0.85f : 0.91f; + npc.velocity.X *= death ? 0.85f : 0.91f; } if (!Main.player[npc.target].dead) @@ -510,8 +525,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.QueenSlimeSmash; - int damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, SlamDamage, 0f, Main.myPlayer); // Line of explosions in Master Mode if (death) @@ -527,7 +541,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); if (i != maxSmashesPerSide) - Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, damage, 0f, Main.myPlayer, -expandDelay); + Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, SlamDamage, 0f, Main.myPlayer, -expandDelay); extraSmashPosition -= Vector2.UnitX * smashSpawnDistanceOffset; } @@ -538,7 +552,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float projectileVelocity = death ? 18f : 12f; type = ProjectileID.QueenSlimeMinionBlueSpike; - damage = npc.GetProjectileDamage(type); Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y - 100f) - npc.Center).SafeNormalize(Vector2.UnitY); destination *= projectileVelocity; int numProj = 20; @@ -546,7 +559,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, SpikeDamage, 0f, Main.myPlayer, 0f, -2f); } if (phase5) @@ -556,7 +569,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, SpikeDamage, 0f, Main.myPlayer, 0f, -2f); } } } @@ -613,8 +626,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set damage npc.damage = npc.defDamage; - npc.velocity.Y += bossRush ? 2f : death ? 1.75f : 1.5f; - float slamVelocity = bossRush ? 15.99f : death ? 15.5f : 15f; + npc.velocity.Y += death ? 1.75f : 1.5f; + float slamVelocity = death ? 15.5f : 15f; if (Main.getGoodWorld) { npc.velocity.Y += 1f; @@ -636,7 +649,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 fireFrom = npc.Center; int projectileAmt = 2; int type = ProjectileID.QueenSlimeMinionBlueSpike; - int damage = npc.GetProjectileDamage(type); Vector2 velocityIncrease = death ? (Vector2.UnitY * 4f) : Vector2.Zero; for (int i = 0; i < projectileAmt; i++) { @@ -645,7 +657,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int j = 0; j < totalProjectiles; j++) { Vector2 projVelocity = (npc.velocity + velocityIncrease).RotatedBy(radians * j + MathHelper.PiOver2); - Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); + Projectile.NewProjectile(npc.GetSource_FromAI(), fireFrom, projVelocity, type, SpikeDamage, 0f, Main.myPlayer, 0f, -1f); } } } @@ -690,7 +702,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.velocity = center - npc.Center; npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= bossRush ? 30f : death ? 27.3f : 24f; + npc.velocity *= death ? 27.3f : 24f; } else npc.velocity.Y *= 0.95f; @@ -722,11 +734,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (phase5) numGelProjectiles += 6; if (Main.getGoodWorld) - numGelProjectiles = 20; + numGelProjectiles = 15; float projectileVelocity = death ? 12f : 10.5f; int type = ProjectileID.QueenSlimeGelAttack; - int damage = npc.GetProjectileDamage(type); if (phase2) { Vector2 destination = (new Vector2(npc.Center.X, npc.Center.Y + 100f) - npc.Center).SafeNormalize(Vector2.UnitY); @@ -734,11 +745,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float rotation = MathHelper.ToRadians(120); for (int i = 0; i < numGelProjectiles; i++) { - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) destination *= Main.rand.NextFloat() + 0.5f; Vector2 perturbedSpeed = destination.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numGelProjectiles - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, damage, 0f, Main.myPlayer, 0f, -2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, perturbedSpeed, type, LargeGelDamage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } } @@ -748,11 +759,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 spinningpoint = new Vector2(projectileVelocity, 0f); - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) spinningpoint *= Main.rand.NextFloat() + 0.5f; spinningpoint = spinningpoint.RotatedBy((-j) * MathHelper.TwoPi / numGelProjectiles, Vector2.Zero); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, damage, 0f, Main.myPlayer, 0f, -2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, LargeGelDamage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } } @@ -770,7 +781,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses foreach (int t in targets) { Vector2 velocity2 = (Main.player[t].Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileVelocity; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, damage, 0f, Main.myPlayer, 0f, -2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, velocity2, type, LargeGelDamage, 0f, Main.myPlayer, 0f, -2f); Main.projectile[proj].timeLeft = 900; } } @@ -860,7 +871,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float slimeSpawnHealthGateValue = CalamityWorld.LegendaryMode ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f; + float slimeSpawnHealthGateValue = Main.zenithWorld ? 0.01f : phase3 ? 0.04f : phase2 ? 0.03f : 0.025f; if (death) slimeSpawnHealthGateValue *= 0.5f; @@ -870,8 +881,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; npc.localAI[0] = npc.life; - int x = (int)(npc.position.X + Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + Main.rand.Next(npc.height - 32)); + + int offset = 16; + int x = (int)(npc.position.X + offset + Main.rand.Next(npc.width - offset * 2)); + int y = (int)(npc.position.Y + offset + Main.rand.Next(npc.height - offset * 2)); int random = Main.rand.Next(2); if (phase2) @@ -905,752 +918,16 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool VanillaQueenSlimeAI(NPC npc, Mod mod) - { - float num3 = 1f; - bool flag = false; - bool flag2 = npc.life <= npc.lifeMax / 2; - if (npc.localAI[0] == 0f) - { - npc.ai[1] = -100f; - npc.localAI[0] = npc.lifeMax; - - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - Lighting.AddLight(npc.Center, 1f, 0.7f, 0.9f); - int num4 = 500; - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) - { - CalamityUtils.CalamityTargeting(npc, default); - - if (Main.player[npc.target].dead || Math.Abs(npc.Center.X - Main.player[npc.target].Center.X) / 16f > (float)num4) - { - npc.EncourageDespawn(10); - if (Main.player[npc.target].Center.X < npc.Center.X) - npc.direction = 1; - else - npc.direction = -1; - } - } - - if (!Main.player[npc.target].dead && npc.timeLeft > 10 && !flag2 && npc.ai[3] >= 300f && npc.ai[0] == 0f && npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[0] = 2f; - npc.ai[1] = 0f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.netUpdate = true; - - CalamityTargetingParameters options = CalamityTargetingParameters.Defaults; - options.faceTarget = false; - CalamityUtils.CalamityTargeting(npc, options); - - Point point = npc.Center.ToTileCoordinates(); - Point point2 = Main.player[npc.target].Center.ToTileCoordinates(); - Vector2 vector = Main.player[npc.target].Center - npc.Center; - int num5 = 10; - int num6 = 0; - int num7 = 7; - int num8 = 0; - bool flag3 = false; - if (npc.ai[3] >= 360f || vector.Length() > 2000f) - { - if (npc.ai[3] > 360f) - npc.ai[3] = 360f; - - flag3 = true; - num8 = 100; - } - - while (!flag3 && num8 < 100) - { - num8++; - int num9 = Main.rand.Next(point2.X - num5, point2.X + num5 + 1); - int num10 = Main.rand.Next(point2.Y - num5, point2.Y + 1); - if ((num10 >= point2.Y - num7 && num10 <= point2.Y + num7 && num9 >= point2.X - num7 && num9 <= point2.X + num7) || (num10 >= point.Y - num6 && num10 <= point.Y + num6 && num9 >= point.X - num6 && num9 <= point.X + num6) || Main.tile[num9, num10].HasUnactuatedTile) - continue; - - int num11 = num10; - int i = 0; - if (Main.tile[num9, num11].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num11].TileType] && !Main.tileSolidTop[Main.tile[num9, num11].TileType]) - { - i = 1; - } - else - { - for (; i < 150 && num11 + i < Main.maxTilesY; i++) - { - int num12 = num11 + i; - if (Main.tile[num9, num12].HasUnactuatedTile && Main.tileSolid[Main.tile[num9, num12].TileType] && !Main.tileSolidTop[Main.tile[num9, num12].TileType]) - { - i--; - break; - } - } - } - - num10 += i; - bool flag4 = true; - if (flag4 && Main.tile[num9, num10].LiquidType == LiquidID.Lava) - flag4 = false; - - if (flag4 && !Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0)) - flag4 = false; - - if (flag4) - { - npc.localAI[1] = num9 * 16 + 8; - npc.localAI[2] = num10 * 16 + 16; - flag3 = true; - break; - } - } - - if (num8 >= 100) - { - Vector2 bottom = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)].Bottom; - npc.localAI[1] = bottom.X; - npc.localAI[2] = bottom.Y; - npc.ai[3] = 0f; - } - } - } - - if (!flag2 && (!Collision.CanHitLine(npc.Center, 0, 0, Main.player[npc.target].Center, 0, 0) || Math.Abs(npc.Top.Y - Main.player[npc.target].Bottom.Y) > 320f)) - { - npc.ai[3] += (Main.masterMode ? 3f : Main.expertMode ? 2f : 1.5f); - } - else - { - float num13 = npc.ai[3]; - npc.ai[3] -= 1f; - if (npc.ai[3] < 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient && num13 > 0f) - npc.netUpdate = true; - - npc.ai[3] = 0f; - } - } - - if (npc.timeLeft <= 10 && ((flag2 && npc.ai[0] != 0f) || (!flag2 && npc.ai[0] != 3f))) - { - if (flag2) - npc.ai[0] = 0f; - else - npc.ai[0] = 3f; - - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - npc.noTileCollide = false; - npc.noGravity = false; - if (flag2) - { - npc.localAI[3] += 1f; - if (npc.localAI[3] >= 24f) - npc.localAI[3] = 0f; - - if (npc.ai[0] == 4f && npc.ai[2] == 1f) - npc.localAI[3] = 6f; - - if (npc.ai[0] == 5f && npc.ai[2] != 1f) - npc.localAI[3] = 7f; - } - - switch ((int)npc.ai[0]) - { - case 0: - { - // Avoid cheap bullshit - npc.damage = 0; - - if (flag2) - { - QueenSlime_FlyMovement_Vanilla(npc); - } - else - { - npc.noTileCollide = false; - npc.noGravity = false; - if (npc.velocity.Y == 0f) - { - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - } - } - - if (npc.timeLeft <= 10 || (!flag2 && npc.velocity.Y != 0f)) - break; - - npc.ai[1] += 1f; - int num18 = 60; - if (flag2) - num18 = 120; - if (Main.masterMode) - num18 /= 2; - - if (!(npc.ai[1] > (float)num18)) - break; - - npc.ai[1] = 0f; - if (flag2) - { - Player player = Main.player[npc.target]; - int num19 = Main.rand.Next(2); - if (num19 != 1) - npc.ai[0] = 4f; - else - npc.ai[0] = 5f; - - if (npc.ai[0] == 4f) - { - npc.ai[2] = 1f; - if (player != null && player.active && !player.dead && (player.Bottom.Y < npc.Bottom.Y || Math.Abs(player.Center.X - npc.Center.X) > 250f)) - { - npc.ai[0] = 5f; - npc.ai[2] = 0f; - } - } - } - else - { - switch (Main.rand.Next(3)) - { - default: - npc.ai[0] = 3f; - break; - case 1: - npc.ai[0] = 4f; - break; - case 2: - npc.ai[0] = 5f; - break; - } - } - - npc.netUpdate = true; - break; - } - - case 1: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += (Main.masterMode ? 2f : 1f); - num3 = MathHelper.Clamp(npc.ai[1] / 30f, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; - if (npc.ai[1] >= 30f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 60f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - - CalamityUtils.CalamityTargeting(npc, default); - } - - Color newColor2 = NPC.AI_121_QueenSlime_GetDustColor(); - newColor2.A = 150; - for (int num27 = 0; num27 < 10; num27++) - { - int num28 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor2, 1.5f); - Main.dust[num28].noGravity = true; - Main.dust[num28].velocity *= 2f; - } - - break; - } - - case 2: - - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation = 0f; - npc.ai[1] += (Main.masterMode ? 2f : 1f); - num3 = MathHelper.Clamp((60f - npc.ai[1]) / 60f, 0f, 1f); - num3 = 0.5f + num3 * 0.5f; - - if (npc.ai[1] >= 60f) - flag = true; - - if (npc.ai[1] == 60f) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.Center + new Vector2(-40f, -npc.height / 2), npc.velocity, GoreID.QueenSlimeCrown); - - if (Main.masterMode) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num14 = 10; - if (Main.getGoodWorld) - num14 = 15; - - float gelVelocity = 12f; - int type = ProjectileID.QueenSlimeGelAttack; - for (int j = 0; j < num14; j++) - { - Vector2 spinningpoint = new Vector2(gelVelocity, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - SoundEngine.PlaySound(SoundID.Item155, npc.Center); - } - } - - if (npc.ai[1] >= 60f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.Bottom = new Vector2(npc.localAI[1], npc.localAI[2]); - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.ai[1] >= 120f) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - } - - if (!flag) - { - Color newColor = NPC.AI_121_QueenSlime_GetDustColor(); - newColor.A = 150; - for (int n = 0; n < 10; n++) - { - int num26 = Dust.NewDust(npc.position + Vector2.UnitX * -20f, npc.width + 40, npc.height, DustID.TintableDust, npc.velocity.X, npc.velocity.Y, 50, newColor, 1.5f); - Main.dust[num26].noGravity = true; - Main.dust[num26].velocity *= 0.5f; - } - } - break; - - case 3: - npc.rotation = 0f; - if (npc.velocity.Y == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.X *= 0.8f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - npc.ai[1] += 4f; - if ((double)npc.life < (double)npc.lifeMax * 0.8) - npc.ai[1] += 4f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - npc.ai[1] += 4f; - - if (!(npc.ai[1] >= 0f)) - break; - - // Set damage - npc.damage = npc.defDamage; - - npc.netUpdate = true; - - CalamityUtils.CalamityTargeting(npc, default); - - if (npc.ai[2] == 3f) - { - npc.velocity.Y = -13f; - npc.velocity.X += 3.5f * (float)npc.direction; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - if (npc.timeLeft > 10) - npc.ai[0] = 0f; - else - npc.ai[1] = -60f; - } - else if (npc.ai[2] == 2f) - { - npc.velocity.Y = -6f; - npc.velocity.X += 4.5f * (float)npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - else - { - npc.velocity.Y = -8f; - npc.velocity.X += 4f * (float)npc.direction; - npc.ai[1] = -40f; - npc.ai[2] += 1f; - } - - if (Main.expertMode) - { - npc.velocity.X *= 1.5f; - npc.velocity.Y *= 1.25f; - } - - if (Main.masterMode) - { - npc.velocity.X *= 1.3f; - npc.velocity.Y *= 1.1f; - } - } - else - { - if (npc.target >= Main.maxPlayers) - break; - - float num20 = Main.masterMode ? 5f : 3f; - if (Main.getGoodWorld) - num20 = 7f; - - if ((npc.direction == 1 && npc.velocity.X < num20) || (npc.direction == -1 && npc.velocity.X > 0f - num20)) - { - if ((npc.direction == -1 && (double)npc.velocity.X < 0.1) || (npc.direction == 1 && (double)npc.velocity.X > -0.1)) - npc.velocity.X += 0.2f * (float)npc.direction; - else - npc.velocity.X *= 0.93f; - } - } - break; - - case 4: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - if (npc.ai[2] == 1f) - { - npc.noTileCollide = false; - npc.noGravity = false; - int num21 = 30; - if (flag2) - num21 = 10; - - if (Main.getGoodWorld) - num21 = 0; - - Player player2 = Main.player[npc.target]; - if (npc.velocity.Y == 0f) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - SoundEngine.PlaySound(SoundID.Item167, npc.Center); - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.QueenSlimeSmash; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Bottom, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - - if (Main.masterMode) - { - float expandDelay = 0f; - int maxSmashes = 10; - float maxSmashOffset = maxSmashes * 100f; - Vector2 extraSmashPosition = npc.Bottom + Vector2.UnitX * maxSmashOffset; - int maxSmashesPerSide = maxSmashes / 2; - float maxExpandDelay = 20f * maxSmashesPerSide; - float smashSpawnDistanceOffset = 200f; - for (int i = 0; i < maxSmashes + 1; i++) - { - expandDelay = MathHelper.Lerp(0f, maxExpandDelay, Math.Abs(i - maxSmashesPerSide) / (float)maxSmashesPerSide); - if (i != maxSmashesPerSide) - Projectile.NewProjectile(npc.GetSource_FromAI(), extraSmashPosition, Vector2.Zero, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -expandDelay); - - extraSmashPosition -= Vector2.UnitX * smashSpawnDistanceOffset; - } - } - } - - for (int l = 0; l < 20; l++) - { - int num22 = Dust.NewDust(npc.Bottom - new Vector2(npc.width / 2, 30f), npc.width, 30, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor()); - Main.dust[num22].noGravity = true; - Main.dust[num22].velocity.Y = -5f + Main.rand.NextFloat() * -3f; - Main.dust[num22].velocity.X *= 7f; - } - } - else if (npc.ai[1] >= (float)num21) - { - for (int m = 0; m < 4; m++) - { - Vector2 vector3 = npc.Bottom - new Vector2(Main.rand.NextFloatDirection() * 16f, Main.rand.Next(8)); - int num23 = Dust.NewDust(vector3, 2, 2, DustID.Smoke, npc.velocity.X, npc.velocity.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.4f); - Main.dust[num23].position = vector3; - Main.dust[num23].noGravity = true; - Main.dust[num23].velocity.Y = npc.velocity.Y * 0.9f; - Main.dust[num23].velocity.X = (Main.rand.NextBool() ? (-10f) : 10f) + Main.rand.NextFloatDirection() * 3f; - } - } - - npc.velocity.X *= 0.8f; - float num24 = npc.ai[1]; - npc.ai[1] += 1f; - if (npc.ai[1] >= (float)num21) - { - if (num24 < (float)num21) - npc.netUpdate = true; - - if (flag2 && npc.ai[1] > (float)(num21 + 120)) - { - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.velocity.Y *= 0.8f; - npc.netUpdate = true; - break; - } - - // Set damage - npc.damage = npc.defDamage; - - npc.velocity.Y += 1f; - float num25 = 14f; - if (Main.getGoodWorld) - { - npc.velocity.Y += 1f; - num25 = 15.99f; - } - - if (npc.velocity.Y == 0f) - npc.velocity.Y = 0.01f; - - if (npc.velocity.Y >= num25) - npc.velocity.Y = num25; - } - else - npc.velocity.Y *= 0.8f; - - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 30f)) - break; - - if (npc.ai[1] >= 60f) - { - npc.ai[1] = 60f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.velocity.Y = -3f; - npc.netUpdate = true; - } - } - - Player player3 = Main.player[npc.target]; - Vector2 center = npc.Center; - if (!player3.dead && player3.active && Math.Abs(npc.Center.X - player3.Center.X) / 16f <= (float)num4) - center = player3.Center; - - center.Y -= 384f; - if (npc.velocity.Y == 0f) - { - npc.velocity = center - npc.Center; - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero); - npc.velocity *= (Main.masterMode ? 28f : Main.expertMode ? 24f : 20f); - } - else - npc.velocity.Y *= 0.95f; - - break; - } - - case 5: - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.rotation *= 0.9f; - npc.noTileCollide = true; - npc.noGravity = true; - if (flag2) - npc.ai[3] = 0f; - - if (npc.ai[2] == 1f) - { - npc.ai[1] += 1f; - if (!(npc.ai[1] >= 10f)) - break; - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int num14 = 10; - if (Main.getGoodWorld) - num14 = 15; - - int num15 = num14; - if (!flag2) - num15 = 6; - - int type = ProjectileID.QueenSlimeGelAttack; - for (int j = 0; j < num15; j++) - { - Vector2 spinningpoint = new Vector2(Main.masterMode ? 10.5f : 9f, 0f); - spinningpoint = spinningpoint.RotatedBy((float)(-j) * MathHelper.TwoPi / (float)num14, Vector2.Zero); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, spinningpoint, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); - } - } - - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - break; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[1] == 0f) - { - CalamityUtils.CalamityTargeting(npc, default); - - npc.netUpdate = true; - } - - npc.ai[1] += 1f; - if (npc.ai[1] >= 50f) - { - npc.ai[1] = 50f; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[1] = 0f; - npc.ai[2] = 1f; - npc.netUpdate = true; - } - } - - float num16 = 100f; - for (int k = 0; k < 4; k++) - { - Vector2 vector2 = npc.Center + Main.rand.NextVector2CircularEdge(num16, num16); - if (!flag2) - vector2 += new Vector2(0f, 20f); - - Vector2 v = vector2 - npc.Center; - v = v.SafeNormalize(Vector2.Zero) * -8f; - int num17 = Dust.NewDust(vector2, 2, 2, DustID.Smoke, v.X, v.Y, 40, NPC.AI_121_QueenSlime_GetDustColor(), 1.8f); - Main.dust[num17].position = vector2; - Main.dust[num17].noGravity = true; - Main.dust[num17].alpha = 250; - Main.dust[num17].velocity = v; - Main.dust[num17].customData = npc; - } - - if (flag2) - QueenSlime_FlyMovement_Vanilla(npc); - - break; - } - } - - npc.dontTakeDamage = (npc.hide = flag); - if (num3 != npc.scale) - { - npc.position.X += npc.width / 2; - npc.position.Y += npc.height; - npc.scale = num3; - npc.width = (int)(114f * npc.scale); - npc.height = (int)(100f * npc.scale); - npc.position.X -= npc.width / 2; - npc.position.Y -= npc.height; - } - - if (npc.life <= 0) - return false; - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - if (npc.localAI[0] >= (float)(npc.lifeMax / 2) && npc.life < npc.lifeMax / 2) - { - npc.localAI[0] = npc.life; - npc.ai[0] = 0f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.netUpdate = true; - } - - int num29 = (int)((float)npc.lifeMax * 0.02f); - if (flag2) - num29 = (int)((float)npc.lifeMax * 0.015f); - - if (!((float)(npc.life + num29) < npc.localAI[0])) - return false; - - npc.localAI[0] = npc.life; - int num30 = Main.rand.Next(Main.masterMode ? 2 : 1, Main.masterMode ? 4 : 3); - for (int num31 = 0; num31 < num30; num31++) - { - int x = (int)(npc.position.X + (float)Main.rand.Next(npc.width - 32)); - int y = (int)(npc.position.Y + (float)Main.rand.Next(npc.height - 32)); - int num32 = NPCID.QueenSlimeMinionBlue; - switch (Main.rand.Next(3)) - { - case 0: - num32 = NPCID.QueenSlimeMinionBlue; - break; - case 1: - num32 = NPCID.QueenSlimeMinionPink; - break; - case 2: - num32 = NPCID.QueenSlimeMinionPurple; - break; - } - - int num33 = NPC.NewNPC(npc.GetSource_FromAI(), x, y, num32); - Main.npc[num33].SetDefaults(num32); - Main.npc[num33].velocity.X = (float)Main.rand.Next(-15, 16) * 0.1f; - Main.npc[num33].velocity.Y = (float)Main.rand.Next(-30, 1) * 0.1f; - Main.npc[num33].ai[0] = -500 * Main.rand.Next(3); - Main.npc[num33].ai[1] = 0f; - if (Main.dedServ && num33 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num33); - } - - return false; - } - public static void QueenSlime_FlyMovement(NPC npc) { // Difficulty bools - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; npc.noTileCollide = true; npc.noGravity = true; - float flyVelocity = bossRush ? 24f : death ? 21f : 16f; - float flyAcceleration = bossRush ? 0.3f : death ? 0.18f : 0.12f; + float flyVelocity = death ? 21f : 16f; + float flyAcceleration = death ? 0.18f : 0.12f; float flyDistanceY = death ? 350f : 450f; Vector2 desiredVelocity = npc.Center; @@ -1713,75 +990,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = -0.5f; } - public static void QueenSlime_FlyMovement_Vanilla(NPC npc) + public static bool BuffedQueenSlimeCrystalSlimeAI(NPC npc, Mod mod) { - npc.noTileCollide = true; - npc.noGravity = true; - float num = Main.masterMode ? 18f : Main.expertMode ? 15f : 12f; - float num2 = Main.masterMode ? 0.12f : Main.expertMode ? 0.1f : 0.085f; - float num3 = 250f; - Vector2 desiredVelocity = npc.Center; - if (npc.timeLeft > 10) - { - if (!Collision.CanHit(npc, Main.player[npc.target])) - { - bool flag = false; - Vector2 center = Main.player[npc.target].Center; - for (int i = 0; i < 16; i++) - { - float num4 = 16 * i; - Point point = (center + new Vector2(0f, 0f - num4)).ToTileCoordinates(); - if (WorldGen.SolidOrSlopedTile(point.X, point.Y)) - { - desiredVelocity = center + new Vector2(0f, 0f - num4 + 16f) - npc.Center; - flag = true; - break; - } - } + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; - if (!flag) - desiredVelocity = center - npc.Center; - } - else - desiredVelocity = Main.player[npc.target].Center + new Vector2(0f, 0f - num3) - npc.Center; - } - else - desiredVelocity = npc.Center + new Vector2(500f * (float)npc.direction, 0f - num3) - npc.Center; - - float num5 = desiredVelocity.Length(); - if (Math.Abs(desiredVelocity.X) < 40f) - desiredVelocity.X = npc.velocity.X; - - float num6 = num - 2f; - if (num5 > 100f && ((npc.velocity.X < 0f - num6 && desiredVelocity.X > 0f) || (npc.velocity.X > num6 && desiredVelocity.X < 0f))) - num2 *= 2f; - - if (num5 < 40f) - { - desiredVelocity = npc.velocity; - } - else if (num5 < 80f) - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= num * 0.65f; - } - else - { - desiredVelocity = desiredVelocity.SafeNormalize(Vector2.UnitY); - desiredVelocity *= num; - } - - npc.SimpleFlyMovement(desiredVelocity, num2); - npc.rotation = npc.velocity.X * 0.1f; - if (npc.rotation > 0.5f) - npc.rotation = 0.5f; - - if (npc.rotation < -0.5f) - npc.rotation = -0.5f; - } - - public static bool QueenSlimeCrystalSlimeAI(NPC npc, Mod mod) - { if (npc.localAI[0] > 0f) npc.localAI[0] -= 1f; @@ -1814,7 +1026,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses vector6 *= 1.5f; int type = ProjectileID.QueenSlimeMinionBlueSpike; - Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f), type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), center, vector6 * (death ? 0.8f : 0.5f), type, SpikeDamage, 0f, Main.myPlayer); npc.localAI[0] = 25f; if (num22 > 4) break; @@ -1843,8 +1055,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses num20 *= num21; npc.localAI[0] = 50f; int type = ProjectileID.QueenSlimeMinionBlueSpike; - Vector2 spikeVelocity = new Vector2(num19, num20) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); - Projectile.NewProjectile(npc.GetSource_FromAI(), center, spikeVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Vector2 spikeVelocity = new Vector2(num19, num20) * (death ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center, spikeVelocity, type, SpikeDamage, 0f, Main.myPlayer); } } } @@ -1901,7 +1113,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; - npc.ai[0] += (Main.masterMode ? 16f : Main.expertMode ? 10f : 7f); + npc.ai[0] += (death ? 16f : Main.expertMode ? 10f : 7f); float num33 = -1000f; @@ -1924,14 +1136,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (num34 == 3) { npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.velocity.X += (death ? 9 : Main.expertMode ? 6 : 3) * npc.direction; npc.ai[0] = -200f; npc.ai[3] = npc.position.X; } else { npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.velocity.X += (death ? 6 : Main.expertMode ? 4 : 2) * npc.direction; npc.ai[0] = -120f; if (num34 == 1) npc.ai[0] += num33; @@ -1959,8 +1171,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - public static bool QueenSlimeBouncySlimeAI(NPC npc, Mod mod) + public static bool BuffedQueenSlimeBouncySlimeAI(NPC npc, Mod mod) { + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + if (npc.localAI[0] > 0f) npc.localAI[0] -= 1f; @@ -1996,8 +1210,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[0] = 30f; int type = ProjectileID.QueenSlimeMinionPinkBall; - Vector2 pinkBallVelocity = new Vector2(num24, num25) * ((Main.masterMode || BossRushEvent.BossRushActive) ? 0.8f : 0.5f); - Projectile.NewProjectile(npc.GetSource_FromAI(), center2, pinkBallVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer); + Vector2 pinkBallVelocity = new Vector2(num24, num25) * (death ? 0.8f : 0.5f); + Projectile.NewProjectile(npc.GetSource_FromAI(), center2, pinkBallVelocity, type, SmallGelDamage, 0f, Main.myPlayer); } } } @@ -2054,7 +1268,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) npc.velocity.X = 0f; - npc.ai[0] += (Main.masterMode ? 11f : Main.expertMode ? 7f : 5f); + npc.ai[0] += (death ? 11f : Main.expertMode ? 7f : 5f); float num33 = -500f; @@ -2077,14 +1291,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (num34 == 3) { npc.velocity.Y = -8f; - npc.velocity.X += (Main.masterMode ? 9 : Main.expertMode ? 6 : 3) * npc.direction; + npc.velocity.X += (death ? 9 : Main.expertMode ? 6 : 3) * npc.direction; npc.ai[0] = -200f; npc.ai[3] = npc.position.X; } else { npc.velocity.Y = -6f; - npc.velocity.X += (Main.masterMode ? 6 : Main.expertMode ? 4 : 2) * npc.direction; + npc.velocity.X += (death ? 6 : Main.expertMode ? 4 : 2) * npc.direction; npc.ai[0] = -120f; if (num34 == 1) npc.ai[0] += num33; diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs index 7634c94155..4d20d1977f 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronAI.cs @@ -18,12 +18,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float HandSwipeDistance = 960f; // 60 tiles public const float HandSwipeDistance_Master = 1280f; // 80 tiles + // Vanilla values + public static float SpinDamageMult = 1.3f; // 91 + public static int SkullDamage = 17; // 68; Also applies to crossbones + + // Rev+ exclusive + public static int ShadowflameDamage = 20; // 80 + public static bool BuffedSkeletronAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -56,6 +62,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Set defense npc.defense = npc.defDefense; + npc.damage = npc.defDamage; npc.reflectsProjectiles = false; @@ -139,7 +146,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Daytime enrage - if (Main.IsItDay() && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) + if (Main.IsItDay() && !BossRushEvent.BossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) { npc.ai[1] = 2f; SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); @@ -157,38 +164,38 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool handsDead = numHandsAlive == 0; int numProj = Main.getGoodWorld ? 22 : death ? 5 : 3; float spread = Main.getGoodWorld ? 180 : 60; - float headSpinVelocityMult = bossRush ? (phase3 ? 18f : 9f) : (phase3 ? 12f : 4.5f); + float headSpinVelocityMult = phase3 ? 12f : 4.5f; switch (numHandsAlive) { case 0: numProj = Main.getGoodWorld ? 36 : death ? 9 : 7; spread = Main.getGoodWorld ? 180 : death ? 90 : 82; - headSpinVelocityMult = bossRush ? (phase3 ? 18f : 12f) : (phase3 ? 12f : 6f); + headSpinVelocityMult = phase3 ? 12f : 6f; break; case 1: numProj = Main.getGoodWorld ? 27 : death ? 7 : 5; spread = Main.getGoodWorld ? 150 : death ? 76 : 68; - headSpinVelocityMult = bossRush ? (phase3 ? 15f : 10f) : (phase3 ? 11.5f : 5f); + headSpinVelocityMult = phase3 ? 11.5f : 5f; break; case 2: numProj = Main.getGoodWorld ? 18 : death ? 6 : 4; spread = Main.getGoodWorld ? 140 : death ? 70 : 62; - headSpinVelocityMult = bossRush ? (phase3 ? 13.5f : 9f) : (phase3 ? 11f : 4.5f); + headSpinVelocityMult = phase3 ? 11f : 4.5f; break; case 3: numProj = Main.getGoodWorld ? 15 : death ? 5 : 3; spread = Main.getGoodWorld ? 130 : death ? 64 : 56; - headSpinVelocityMult = bossRush ? (phase3 ? 12f : 8f) : (phase3 ? 10.5f : 4f); + headSpinVelocityMult = phase3 ? 10.5f : 4f; break; case 4: numProj = Main.getGoodWorld ? 12 : death ? 4 : 3; spread = Main.getGoodWorld ? 120 : 56; - headSpinVelocityMult = bossRush ? (phase3 ? 10f : 7f) : (phase3 ? 10f : 3.5f); + headSpinVelocityMult = phase3 ? 10f : 3.5f; break; } @@ -207,11 +214,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity used to move Skeletron away from the target before charging float moveAwayVelocity = headSpinVelocityMult; if (!phase3) - moveAwayVelocity *= (bossRush ? 1.5f : 2f); + moveAwayVelocity *= 2f; // Hand DR, scale DR up if the hands are still alive as Skeletron's HP lowers npc.chaseable = handsDead; - float minDR = 0.05f; + float minDR = 0f; float maxDR = 0.9999f; calamityGlobalNPC.DR = !handsDead ? (float)Math.Sqrt(MathHelper.Lerp(minDR, maxDR, respawnHands ? (respawnHandsLifeRatio - lifeRatio) / respawnHandsLifeRatio : 2f - lifeRatio / respawnHandsLifeRatio)) : minDR; calamityGlobalNPC.unbreakableDR = !handsDead; @@ -241,7 +248,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); // Inverse parabolic projectile spreads Vector2 baseVel = npc.SafeDirectionTo(Main.player[npc.target].Center) * (death ? 6f : 5f); @@ -251,7 +257,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float offset = MathHelper.ToRadians(MathHelper.Lerp(-spread * 0.5f, spread * 0.5f, i / (numProj - 1f))); float velocityMult = MathHelper.Lerp(0.5f, 1.5f, MathF.Abs(centralCount - i) / centralCount); - Projectile shot = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), firingPos, baseVel.RotatedBy(offset) * velocityMult, type, damage, 0f, Main.myPlayer, -2f); + Projectile shot = Projectile.NewProjectileDirect(npc.GetSource_FromAI(), firingPos, baseVel.RotatedBy(offset) * velocityMult, type, SkullDamage, 0f, Main.myPlayer, -2f); shot.timeLeft = 600; } @@ -272,13 +278,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // If hands are dead: 7 seconds // If hands are not dead: 14 seconds // If hands are dead in phase 2: 4.7 seconds - npc.ai[3] += 1f + (((phase2 && handsDead) || bossRush || phase4) ? 0.5f : 0f) - ((handsDead || bossRush) ? 0f : 0.5f); + npc.ai[3] += 1f + (((phase2 && handsDead) || phase4) ? 0.5f : 0f) - (handsDead ? 0f : 0.5f); // Dust to show teleport int ai3 = (int)npc.ai[3]; // 0 to 30, and -60 - bool emitDust = false; - if (ai3 >= teleportGateValue && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) + if (npc.localAI[0] == 1f && calamityGlobalNPC.newAI[2] == 0f && calamityGlobalNPC.newAI[3] == 0f) { if (Main.netMode != NetmodeID.MultiplayerClient) { @@ -312,6 +317,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } + // Teleport location telegraph if (calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) { for (int m = 0; m < 5; m++) @@ -322,24 +328,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (ai3 >= teleportGateValue + 90) - { - emitDust = true; - } - else if (ai3 >= teleportGateValue + 30) - { - if (Main.rand.Next(teleportGateValue + 10, ai3 + 1) >= teleportGateValue + 25) - emitDust = true; - } - - if (emitDust) - { - int dust = Dust.NewDust(npc.position, npc.width, npc.height, dustType, 0f, 0f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - } - // Teleport - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[3] >= teleportGateValue + 120 && (!(npc.ai[1] == 1f && phase3) || death)) + if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 0f && npc.ai[1] != 1f && calamityGlobalNPC.newAI[2] != 0f && calamityGlobalNPC.newAI[3] != 0f) { // Teleport dust for (int m = 0; m < 30; m++) @@ -351,10 +341,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // New location npc.Center = new Vector2(calamityGlobalNPC.newAI[2], calamityGlobalNPC.newAI[3]); - - // Do not set velocity to zero during charge attacks - if (npc.ai[1] != 1f) - npc.velocity = Vector2.Zero; + npc.velocity = Vector2.Zero; npc.ai[3] = -60f; calamityGlobalNPC.newAI[2] = calamityGlobalNPC.newAI[3] = 0f; @@ -366,7 +353,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Skull shooting if ((handsDead || death) && npc.ai[1] == 0f && !phase4) { - float skullProjFrequency = bossRush ? 15f : phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; + float skullProjFrequency = phase2 ? (48f - (death ? 17.5f * (1f - lifeRatio) : 0f)) : 60f; if (Main.getGoodWorld) skullProjFrequency *= 0.8f; skullProjFrequency = (float)Math.Ceiling(skullProjFrequency); @@ -379,22 +366,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Collision.CanHit(skullFiringPos, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { float skullProjSpeed = phase2 ? (5f + (death ? 3f * (1f - lifeRatio) : 0f)) : 4f; - int spread2 = bossRush ? 100 : 50; + int spread2 = 50; Vector2 skullProjDirection = new Vector2(skullProjTargetX + Main.rand.Next(-spread2, spread2 + 1) * 0.01f, skullProjTargetY + Main.rand.Next(-spread2, spread2 + 1) * 0.01f).SafeNormalize(Vector2.UnitY); skullProjDirection *= skullProjSpeed; skullProjDirection += npc.velocity; skullFiringPos += skullProjDirection * 5f; int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -1f); + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, SkullDamage, 0f, Main.myPlayer, -1f); Main.projectile[skullProjectile].timeLeft = 600; if (death && handsDead) { skullProjDirection = new Vector2(skullProjTargetX, skullProjTargetY).SafeNormalize(Vector2.UnitY); skullProjDirection *= skullProjSpeed * 2f; - int skullProjectile2 = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, damage, 0f, Main.myPlayer, -2f); + int skullProjectile2 = Projectile.NewProjectile(npc.GetSource_FromAI(), skullFiringPos, skullProjDirection, type, SkullDamage, 0f, Main.myPlayer, -2f); Main.projectile[skullProjectile2].timeLeft = 600; } @@ -406,9 +392,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Float above target if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = 0; - calamityGlobalNPC.newAI[1] += 1f; float chargePhaseChangeRateBoost = phase5 ? (death ? 24f : 8f) : phase4 ? (death ? 6f : 4f) : ((death ? 4.5f : 3f) * ((1f - lifeRatio) / (1f - phase4LifeRatio))); if (!handsDead) @@ -422,11 +405,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = chargePhaseGateValue; float forcedMoveAwayTime = death ? 15f : 45f; - float canChargeDistance = phase3 ? 480f : 320f; // 20 tile distance, 30 tile distance in phase 3 + float canChargeDistance = 320f; // 20 tile distance bool hasMovedForcedDistance = npc.localAI[2] >= forcedMoveAwayTime; bool canCharge = Vector2.Distance(Main.player[npc.target].Center, npc.Center) >= canChargeDistance; bool charge = npc.ai[2] >= chargePhaseGateValue && canCharge; - bool forceCharge = npc.ai[2] > chargePhaseGateValue + 120f * chargePhaseChangeRate; + bool forceCharge = npc.ai[2] > chargePhaseGateValue + 120f; if (charge || forceCharge) { npc.localAI[2] += 1f; @@ -434,6 +417,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.ai[2] = 0f; npc.ai[1] = 1f; + npc.localAI[0] = 1f; npc.localAI[1] = chargePhaseGateValue; npc.localAI[2] = 0f; calamityGlobalNPC.newAI[1] = 0f; @@ -450,20 +434,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float headXTopSpeed = headXAcceleration * 100f; float deceleration = Main.getGoodWorld ? 0.83f : death ? 0.86f : 0.89f; - if (bossRush) - { - headYAcceleration *= 1.25f; - headXAcceleration *= 1.25f; - } - float moveAwayGateValue = chargePhaseGateValue - (5f + chargePhaseChangeRate); bool moveAwayBeforeCharge = npc.ai[2] >= moveAwayGateValue; if (moveAwayBeforeCharge) { if (!canCharge || !hasMovedForcedDistance) { - float phase5Multiplier = 1.33f; - float maxVelocity = (npc.ai[2] - moveAwayGateValue) * (moveAwayVelocity * 0.008f); + float phase5Multiplier = 1.2f; + float maxVelocity = (npc.ai[2] - moveAwayGateValue) * (moveAwayVelocity * 0.002f); if (phase5) maxVelocity *= phase5Multiplier; @@ -474,7 +452,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses maxVelocity = maxVelocityCap; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * -maxVelocity; - npc.SyncMotionToServer(); } @@ -497,7 +474,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Force net updates every frame during this movement to avoid despawning in multiplayer // I'm doing this because npc.ai[2] changes every frame and that's used to calculate Skeletron's velocity here npc.ForceNetUpdate(); - return false; } @@ -542,9 +518,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spin charge else if (npc.ai[1] == 1f) { - // Set damage - npc.damage = npc.defDamage; - if (Main.getGoodWorld) { npc.reflectsProjectiles = true; @@ -572,7 +545,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - if (CalamityWorld.LegendaryMode) + if (Main.zenithWorld) { if (!NPC.AnyNPCs(NPCID.DiabolistWhite)) { @@ -599,7 +572,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } - npc.defense -= 10; + npc.defense = npc.defDefense - 10; + npc.damage = (int)Math.Round(npc.defDamage * SpinDamageMult); float phaseChangeRateBoost = phase3 ? 0f : 1f - (lifeRatio - phase3LifeRatio) / (1f - phase3LifeRatio); npc.ai[2] += 1f + phaseChangeRateBoost; @@ -623,8 +597,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float shadowFlameProjectileSpeed = death ? 6f : 4f; Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * shadowFlameProjectileSpeed; int type = ProjectileID.Shadowflames; - int damage = npc.GetProjectileDamage(type); - int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + int shadowFlameProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, ShadowflameDamage, 0f, Main.myPlayer, 0f, 1f); Main.projectile[shadowFlameProjectile].timeLeft = 600; } } @@ -682,15 +655,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float skullProjSpeed = phase5 ? (6f + (death ? 2f * ((phase5LifeRatio - lifeRatio) / phase5LifeRatio) : 0f)) : 4f; Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); for (int k = 0; k < chargeSkullAmt + 1; k++) { Vector2 perturbedSpeed = initialProjectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, k / (float)(chargeSkullAmt - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, SkullDamage, 0f, Main.myPlayer, -1f); Main.projectile[proj].timeLeft = 600; if (death) { - int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, damage, 0f, Main.myPlayer, -2f); + int proj2 = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center - perturbedSpeed.SafeNormalize(Vector2.UnitY) * 5f, perturbedSpeed, type, SkullDamage, 0f, Main.myPlayer, -2f); Main.projectile[proj2].timeLeft = 600; } } @@ -719,12 +691,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float headSpinTargetDist = (float)Math.Sqrt(headSpinTargetX * headSpinTargetX + headSpinTargetY * headSpinTargetY); // Increase speed while charging - npc.damage = (int)Math.Round(npc.defDamage * 1.3); - if (!phase3) { float velocityBoost = MathHelper.Lerp(0f, 3f, (1f - lifeRatio) / (1f - phase3LifeRatio)); - if (handsDead || bossRush) + if (handsDead) headSpinVelocityMult += velocityBoost; } @@ -752,7 +722,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] < altDashPhaseTime) { if (npc.Center.Distance(Main.player[npc.target].Center) > altDashStopDistance || npc.ai[2] == 1f + phaseChangeRateBoost) - npc.velocity = headSpinVelocity.SafeNormalize(Vector2.UnitY) * headSpinVelocityMult + npc.Center.DirectionTo(Main.player[npc.target].Center + (bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero)) * 2f; + npc.velocity = headSpinVelocity.SafeNormalize(Vector2.UnitY) * headSpinVelocityMult + npc.Center.DirectionTo(Main.player[npc.target].Center) * 2f; else npc.ai[2] = altDashPhaseTime; } @@ -795,9 +765,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - // Avoid cheap bullshit - npc.damage = 0; - npc.velocity.Y += 0.1f; if (npc.velocity.Y < 0f) npc.velocity.Y *= 0.95f; @@ -830,8 +797,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -924,9 +890,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 0f || npc.ai[2] == 3f) { - // Avoid cheap bullshit - npc.damage = 0; - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f && npc.timeLeft > 10) npc.timeLeft = 10; @@ -1050,9 +1013,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[2] == 1f) { - // Avoid cheap bullshit - npc.damage = 0; - Vector2 handCurrentPosition = npc.Center; float handDrawbackXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handCurrentPosition.X; float handDrawbackYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handCurrentPosition.Y; @@ -1068,9 +1028,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Top.Y < Main.npc[(int)npc.ai[1]].Top.Y - 200f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[2] = 2f; npc.ai[3] = 0f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * handSwipeVelocity; @@ -1079,9 +1036,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[2] == 2f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[3] += 1f; if (npc.ai[3] >= handSwipeDuration || Vector2.Distance(Main.npc[(int)npc.ai[1]].Center, npc.Center) > handSwipeDistance || cancelSlap) { @@ -1099,8 +1053,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float skullProjSpeed = handSwipeVelocity * (phase3 ? 0.6f : 0.2f); Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, SkullDamage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); Main.projectile[skullProjectile].timeLeft = 600; } } @@ -1109,9 +1062,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[2] == 4f) { - // Avoid cheap bullshit - npc.damage = 0; - Vector2 handStrikeCurrentPos = npc.Center; float handStrikeXPos = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - handStrikeCurrentPos.X; float handStrikeYPos = Main.npc[(int)npc.ai[1]].Top.Y + 230f - handStrikeCurrentPos.Y; @@ -1127,9 +1077,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[2] = 5f; npc.ai[3] = 0f; npc.velocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * handSwipeVelocity; @@ -1138,9 +1085,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[2] == 5f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[3] += 1f; if (npc.ai[3] >= handSwipeDuration || Vector2.Distance(Main.npc[(int)npc.ai[1]].Center, npc.Center) > handSwipeDistance || cancelSlap) { @@ -1158,8 +1102,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float skullProjSpeed = handSwipeVelocity * (phase3 ? 0.6f : 0.2f); Vector2 initialProjectileVelocity = npc.Center.DirectionTo(Main.player[npc.target].Center) * skullProjSpeed; int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, damage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); + int skullProjectile = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center, initialProjectileVelocity, type, SkullDamage, 0f, Main.myPlayer, -(phase3 ? 2f : 1f)); Main.projectile[skullProjectile].timeLeft = 600; } } @@ -1211,605 +1154,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } } } - - public static bool VanillaSkeletronAI(NPC npc, Mod mod) - { - npc.reflectsProjectiles = false; - npc.defense = npc.defDefense; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - npc.ai[0] = 1f; - int num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num148].ai[0] = -1f; - Main.npc[num148].ai[1] = npc.whoAmI; - Main.npc[num148].target = npc.target; - Main.npc[num148].netUpdate = true; - num148 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)npc.Center.Y, NPCID.SkeletronHand, npc.whoAmI); - Main.npc[num148].ai[0] = 1f; - Main.npc[num148].ai[1] = npc.whoAmI; - Main.npc[num148].ai[3] = 150f; - Main.npc[num148].target = npc.target; - Main.npc[num148].netUpdate = true; - } - - if (Main.netMode == NetmodeID.MultiplayerClient && npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 2000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 2000f) - npc.ai[1] = 3f; - } - - if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - int numHands = 0; - int maxHands = 2; - if (Main.expertMode) - { - for (int num150 = 0; num150 < Main.maxNPCs; num150++) - { - if (Main.npc[num150].active && Main.npc[num150].type == NPCID.SkeletronHand) - numHands++; - } - - npc.defense += numHands * (Main.masterMode ? 15 : 10); - npc.Calamity().CurrentlyIncreasingDefenseOrDR = numHands > 0; - npc.chaseable = numHands == 0; - if ((numHands < maxHands || (double)npc.life < (double)npc.lifeMax * 0.75 || Main.masterMode) && npc.ai[1] == 0f) - { - float num151 = 80f; - if (numHands == 0 || Main.masterMode) - num151 /= 2f; - - if (Main.getGoodWorld) - num151 *= 0.8f; - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % num151 == 0f) - { - Vector2 center3 = npc.Center; - float num152 = Main.player[npc.target].Center.X - center3.X; - float num153 = Main.player[npc.target].Center.Y - center3.Y; - float num154 = (float)Math.Sqrt(num152 * num152 + num153 * num153); - if (Collision.CanHit(center3, 1, 1, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - float num155 = 3f; - if (numHands == 0 || Main.masterMode) - num155 += 2f; - - float num156 = Main.player[npc.target].Center.X - center3.X + (float)Main.rand.Next(-5, 6); - float num157 = Main.player[npc.target].Center.Y - center3.Y + (float)Main.rand.Next(-5, 6); - float num158 = (float)Math.Sqrt(num156 * num156 + num157 * num157); - num158 = num155 / num158; - num156 *= num158; - num157 *= num158; - Vector2 vector19 = new Vector2(num156 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f, num157 * 1f + (float)Main.rand.Next(-50, 51) * 0.01f).SafeNormalize(Vector2.UnitY); - vector19 *= num155; - vector19 += npc.velocity; - num156 = vector19.X; - num157 = vector19.Y; - int type = ProjectileID.Skull; - center3 += vector19 * 5f; - int num160 = Projectile.NewProjectile(npc.GetSource_FromAI(), center3.X, center3.Y, num156, num157, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, -1f); - Main.projectile[num160].timeLeft = 300; - } - } - } - } - - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] += 1f; - float chargeGateValue = Main.masterMode ? (600f - (maxHands - numHands) * 200f) : 800f; - if (npc.ai[2] >= chargeGateValue) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - - npc.rotation = npc.velocity.X / 15f; - float accelerationY = Main.getGoodWorld ? 0.05f : Main.masterMode ? 0.04f : Main.expertMode ? 0.03f : 0.02f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.093f : Main.masterMode ? 0.088f : Main.expertMode ? 0.076f : 0.064f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.83f : Main.masterMode ? 0.86f : Main.expertMode ? 0.89f : 0.92f; - - if (npc.position.Y > Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - 250f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.player[npc.target].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.player[npc.target].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < 0f - maxVelocityX) - npc.velocity.X = 0f - maxVelocityX; - } - } - else if (npc.ai[1] == 1f) - { - if (Main.getGoodWorld) - { - if (numHands > 0) - { - npc.reflectsProjectiles = true; - } - else if (Main.netMode != NetmodeID.MultiplayerClient && npc.ai[2] % 200f == 0f && NPC.CountNPCS(NPCID.DarkCaster) < 6) - { - int num165 = 1; - for (int num166 = 0; num166 < num165; num166++) - { - int num167 = 1000; - for (int num168 = 0; num168 < num167; num168++) - { - int num169 = (int)(npc.Center.X / 16f) + Main.rand.Next(-50, 51); - int num170; - for (num170 = (int)(npc.Center.Y / 16f) + Main.rand.Next(-50, 51); num170 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num169, num170); num170++) - { - } - - num170--; - if (!WorldGen.SolidTile(num169, num170)) - { - int num171 = NPC.NewNPC(npc.GetSource_FromAI(), num169 * 16 + 8, num170 * 16, NPCID.DarkCaster); - if (Main.dedServ && num171 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num171); - - break; - } - } - } - } - } - - npc.defense -= 10; - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - - float idlePhaseGateValue = Main.masterMode ? (300f - (maxHands - numHands) * 100f) : 400f; - if (npc.ai[2] >= idlePhaseGateValue) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector20 = npc.Center; - float num172 = Main.player[npc.target].Center.X - vector20.X; - float num173 = Main.player[npc.target].Center.Y - vector20.Y; - float num174 = (float)Math.Sqrt(num172 * num172 + num173 * num173); - float num175 = 3f; - npc.damage = (int)Math.Round(npc.defDamage * 1.3); - if (Main.expertMode) - { - num175 = Main.masterMode ? (5f - numHands * 0.5f) : 3.5f; - if (num174 > 150f) - num175 *= 1.05f; - - if (num174 > 200f) - num175 *= 1.1f; - - if (num174 > 250f) - num175 *= 1.1f; - - if (num174 > 300f) - num175 *= 1.1f; - - if (num174 > 350f) - num175 *= 1.1f; - - if (num174 > 400f) - num175 *= 1.1f; - - if (num174 > 450f) - num175 *= 1.1f; - - if (num174 > 500f) - num175 *= 1.1f; - - if (num174 > 550f) - num175 *= 1.1f; - - if (num174 > 600f) - num175 *= 1.1f; - - switch (numHands) - { - case 0: - num175 *= 1.1f; - break; - case 1: - num175 *= 1.05f; - break; - } - } - - if (Main.getGoodWorld) - num175 *= 1.3f; - - num174 = num175 / num174; - npc.velocity.X = num172 * num174; - npc.velocity.Y = num173 * num174; - } - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - - npc.Calamity().CurrentlyEnraged = true; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - npc.rotation += (float)npc.direction * 0.3f; - Vector2 vector21 = npc.Center; - float num176 = Main.player[npc.target].Center.X - vector21.X; - float num177 = Main.player[npc.target].Center.Y - vector21.Y; - float num178 = (float)Math.Sqrt(num176 * num176 + num177 * num177); - num178 = 8f / num178; - npc.velocity.X = num176 * num178; - npc.velocity.Y = num177 * num178; - } - else if (npc.ai[1] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - npc.EncourageDespawn(50); - } - - if (npc.ai[1] != 2f && npc.ai[1] != 3f && (numHands != 0 || !Main.expertMode)) - { - int num179 = Dust.NewDust(new Vector2(npc.Center.X - 15f - npc.velocity.X * 5f, npc.position.Y + (float)npc.height - 2f), 30, 10, DustID.Blood, (0f - npc.velocity.X) * 0.2f, 3f, 0, default(Color), 2f); - Main.dust[num179].noGravity = true; - Main.dust[num179].velocity.X *= 1.3f; - Main.dust[num179].velocity.X += npc.velocity.X * 0.4f; - Main.dust[num179].velocity.Y += 2f + npc.velocity.Y; - for (int num180 = 0; num180 < 2; num180++) - { - num179 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + 120f), npc.width, 60, DustID.Blood, npc.velocity.X, npc.velocity.Y, 0, default(Color), 2f); - Main.dust[num179].noGravity = true; - Dust dust = Main.dust[num179]; - dust.velocity -= npc.velocity; - Main.dust[num179].velocity.Y += 5f; - } - } - - return false; - } - - public static bool VanillaSkeletronHandAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float accelerationY = Main.getGoodWorld ? 0.1f : Main.masterMode ? 0.09f : Main.expertMode ? 0.08f : 0.07f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.16f : Main.masterMode ? 0.14f : Main.expertMode ? 0.12f : 0.1f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.81f : Main.masterMode ? 0.84f : Main.expertMode ? 0.87f : 0.9f; - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - else - { - npc.ai[3] += 1f; - if (Main.expertMode) - npc.ai[3] += 0.5f; - if (Main.masterMode) - npc.ai[3] += 0.5f; - - if (npc.ai[3] >= 300f) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float accelerationY = Main.getGoodWorld ? 0.07f : Main.masterMode ? 0.06f : Main.expertMode ? 0.05f : 0.04f; - float maxVelocityY = accelerationY * 100f; - float accelerationX = Main.getGoodWorld ? 0.13f : Main.masterMode ? 0.11f : Main.expertMode ? 0.09f : 0.07f; - float maxVelocityX = accelerationX * 100f; - float deceleration = Main.getGoodWorld ? 0.88f : Main.masterMode ? 0.9f : Main.expertMode ? 0.92f : 0.94f; - - if (Main.expertMode) - { - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= accelerationY; - if (npc.velocity.Y > maxVelocityY) - npc.velocity.Y = maxVelocityY; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += accelerationY; - if (npc.velocity.Y < -maxVelocityY) - npc.velocity.Y = -maxVelocityY; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= accelerationX; - if (npc.velocity.X > maxVelocityX) - npc.velocity.X = maxVelocityX; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += accelerationX; - if (npc.velocity.X < -maxVelocityX) - npc.velocity.X = -maxVelocityX; - } - } - - Vector2 vector22 = npc.Center; - float num181 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector22.X; - float num182 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector22.Y; - float num183 = (float)Math.Sqrt(num181 * num181 + num182 * num182); - npc.rotation = (float)Math.Atan2(num182, num181) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 vector23 = npc.Center; - float num184 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector23.X; - float num185 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector23.Y; - float num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); - npc.rotation = (float)Math.Atan2(num185, num184) + MathHelper.PiOver2; - npc.velocity.X *= 0.95f; - npc.velocity.Y -= 0.1f; - if (Main.expertMode) - { - npc.velocity.Y -= (Main.masterMode ? 0.09f : 0.06f); - if (npc.velocity.Y < -13f) - npc.velocity.Y = -13f; - } - else if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector23 = npc.Center; - num184 = Main.player[npc.target].Center.X - vector23.X; - num185 = Main.player[npc.target].Center.Y - vector23.Y; - num186 = (float)Math.Sqrt(num184 * num184 + num185 * num185); - num186 = ((!Main.expertMode) ? (18f / num186) : ((Main.masterMode ? 24f : 21f) / num186)); - npc.velocity.X = num184 * num186; - npc.velocity.Y = num185 * num186; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 3f; - } - } - else if (npc.ai[2] == 4f) - { - // Avoid cheap bullshit - npc.damage = 0; - - Vector2 vector24 = npc.Center; - float num187 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector24.X; - float num188 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector24.Y; - float num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); - npc.rotation = (float)Math.Atan2(num188, num187) + MathHelper.PiOver2; - npc.velocity.Y *= 0.95f; - npc.velocity.X += 0.1f * (0f - npc.ai[0]); - if (Main.expertMode) - { - npc.velocity.X += (Main.masterMode ? 0.1f : 0.07f) * (0f - npc.ai[0]); - if (npc.velocity.X < -12f) - npc.velocity.X = -12f; - else if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - } - else if (npc.velocity.X < -8f) - npc.velocity.X = -8f; - else if (npc.velocity.X > 8f) - npc.velocity.X = 8f; - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 5f; - vector24 = npc.Center; - num187 = Main.player[npc.target].Center.X - vector24.X; - num188 = Main.player[npc.target].Center.Y - vector24.Y; - num189 = (float)Math.Sqrt(num187 * num187 + num188 * num188); - num189 = ((!Main.expertMode) ? (17f / num189) : ((Main.masterMode ? 25f : 22f) / num189)); - npc.velocity.X = num187 * num189; - npc.velocity.Y = num188 * num189; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) - { - // Avoid cheap bullshit - npc.damage = 0; - - npc.ai[2] = 0f; - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs index 8d032b1f72..fc48a09a9c 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/SkeletronPrimeAI.cs @@ -17,12 +17,19 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class SkeletronPrimeAI { + // Vanilla values + public static int SpinDamageMult = 2; // 158 + public static int LaserDamage = 25; // 100 + + // Rev+ exclusive + public static int SkullDamage = 22; // 88 + public static int RocketDamage = 30; // 120 + public static bool BuffedSkeletronPrimeAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -37,119 +44,42 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spawn arms if (calamityGlobalNPC.newAI[1] == 0f) { + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); calamityGlobalNPC.newAI[1] = 1f; if (Main.netMode != NetmodeID.MultiplayerClient) { - // Spawn second head in Master Mode - // The main head owns the Saw and the Laser in Master Mode - if (death) - { - int head = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType(), npc.whoAmI); - Main.npc[head].ai[0] = npc.whoAmI; - Main.npc[head].target = npc.target; - Main.npc[head].netUpdate = true; - npc.ai[0] = head; + int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; - int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - Main.npc[arm].ai[3] = 150f; + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); + Main.npc[arm].ai[0] = -1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].ai[3] = 150f; + Main.npc[arm].netUpdate = true; - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", Main.npc[head].TypeName), 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[head].GetTypeNetName()), new Color(175, 75, 255)); - } - else - { - int arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); - Main.npc[arm].ai[0] = -1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].ai[3] = 150f; - Main.npc[arm].netUpdate = true; - - arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); - Main.npc[arm].ai[0] = 1f; - Main.npc[arm].ai[1] = npc.whoAmI; - Main.npc[arm].target = npc.target; - Main.npc[arm].netUpdate = true; - Main.npc[arm].ai[3] = 150f; - } + arm = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); + Main.npc[arm].ai[0] = 1f; + Main.npc[arm].ai[1] = npc.whoAmI; + Main.npc[arm].target = npc.target; + Main.npc[arm].netUpdate = true; + Main.npc[arm].ai[3] = 150f; } npc.netUpdate = true; npc.SyncExtraAI(); } - if (death) - { - if (!Main.npc[(int)npc.ai[0]].active || Main.npc[(int)npc.ai[0]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.life = 0; - npc.HitEffect(); - npc.active = false; - npc.netUpdate = true; - } - else - { - // Link the HP of both heads - if (npc.life > Main.npc[(int)npc.ai[0]].life) - npc.life = Main.npc[(int)npc.ai[0]].life; - - // Push away from the lead head if too close, pull closer if too far, if Mechdusa isn't real - if (!NPC.IsMechQueenUp) - { - float pushVelocity = 0.25f; - if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) < 80f * npc.scale) - { - if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X) - npc.velocity.X -= pushVelocity; - else - npc.velocity.X += pushVelocity; - - if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y) - npc.velocity.Y -= pushVelocity; - else - npc.velocity.Y += pushVelocity; - } - else if (Vector2.Distance(npc.Center, Main.npc[(int)npc.ai[0]].Center) > 240f * npc.scale) - { - if (npc.position.X < Main.npc[(int)npc.ai[0]].position.X) - npc.velocity.X += pushVelocity; - else - npc.velocity.X -= pushVelocity; - - if (npc.position.Y < Main.npc[(int)npc.ai[0]].position.Y) - npc.velocity.Y += pushVelocity; - else - npc.velocity.Y -= pushVelocity; - } - } - } - } - // Check if arms are alive bool cannonAlive = false; bool laserAlive = false; @@ -179,76 +109,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.chaseable = allArmsDead; npc.defense = npc.defDefense; + npc.damage = npc.defDamage; // Phases bool phase2 = lifeRatio < 0.66f; - bool spawnDestroyer = lifeRatio < 0.75f && death && !bossRush && npc.localAI[2] == 0f; bool phase3 = lifeRatio < 0.33f; - bool spawnRetinazer = lifeRatio < 0.5f && death && !bossRush && npc.localAI[2] == 1f; - - // Spawn The Destroyer in Master Mode (just like Oblivion from Avalon) - if (spawnDestroyer) - { - Player destroyerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, destroyerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int destroyer = NPC.NewNPC(NPC.GetBossSpawnSource(destroyerSpawnPlayer.whoAmI), (int)destroyerSpawnPlayer.Center.X, (int)destroyerSpawnPlayer.Center.Y + 810, NPCID.TheDestroyer, 1); - if (destroyer != Main.maxNPCs) - { - Main.npc[destroyer].target = destroyerSpawnPlayer.whoAmI; - Main.npc[destroyer].timeLeft *= 20; - Main.npc[destroyer].localAI[3] = 1f; - Main.npc[destroyer].SyncVanillaLocalAI(); - string typeName = Main.npc[destroyer].TypeName; - if (Main.dedServ && destroyer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, destroyer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Language.GetTextValue("Announcement.HasAwoken", typeName), 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(NetworkText.FromKey("Announcement.HasAwoken", Main.npc[destroyer].GetTypeNetName()), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 1f; - npc.SyncVanillaLocalAI(); - } - - // Spawn Retinazer in Master Mode (just like Oblivion from Avalon) - if (spawnRetinazer) - { - Player retinazerSpawnPlayer = Main.player[Player.FindClosest(npc.position, npc.width, npc.height)]; - SoundEngine.PlaySound(SoundID.Roar, retinazerSpawnPlayer.Center); - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int retinazer = NPC.NewNPC(NPC.GetBossSpawnSource(retinazerSpawnPlayer.whoAmI), (int)retinazerSpawnPlayer.Center.X, (int)retinazerSpawnPlayer.Center.Y - 810, NPCID.Retinazer, 1); - if (retinazer != Main.maxNPCs) - { - Main.npc[retinazer].target = retinazerSpawnPlayer.whoAmI; - Main.npc[retinazer].timeLeft *= 20; - Main.npc[retinazer].localAI[3] = 1f; - Main.npc[retinazer].SyncVanillaLocalAI(); - string typeName = Main.npc[retinazer].TypeName; - if (Main.dedServ && retinazer < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, retinazer); - - AchievementsHelper.CheckMechaMayhem(); - - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText(Lang.misc[48].Value, 175, 75); - else if (Main.dedServ) - ChatHelper.BroadcastChatMessage(Lang.misc[48].ToNetworkText(), new Color(175, 75, 255)); - } - } - - npc.localAI[2] = 2f; - npc.SyncVanillaLocalAI(); - } // Despawn if (npc.ai[1] != 3f) @@ -265,7 +130,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Activate daytime enrage - if (Main.IsItDay() && !bossRush && npc.ai[1] != 3f && npc.ai[1] != 2f) + if (Main.IsItDay() && !BossRushEvent.BossRushActive && npc.ai[1] != 3f && npc.ai[1] != 2f) { // Heal if (Main.netMode != NetmodeID.MultiplayerClient) @@ -288,45 +153,28 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses bool immuneToSlowingDebuffs = npc.ai[1] == 5f; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; npc.buffImmune[ModContent.BuffType()] = immuneToSlowingDebuffs; - npc.buffImmune[BuffID.Slow] = immuneToSlowingDebuffs; npc.buffImmune[BuffID.Webbed] = immuneToSlowingDebuffs; bool normalLaserRotation = npc.localAI[1] % 2f == 0f; - // Prevents cheap hits - bool canUseAttackInMaster = npc.position.Y < Main.player[npc.target].position.Y - 350f; - // Float near player if (npc.ai[1] == 0f || npc.ai[1] == 4f) { - // Avoid unfair bullshit - npc.damage = 0; - // Start other phases; if arms are dead, start with spin phase - bool otherHeadChargingOrSpinning = Main.npc[(int)npc.ai[0]].ai[1] == 5f || Main.npc[(int)npc.ai[0]].ai[1] == 1f; - if (phase2 || CalamityWorld.LegendaryMode || allArmsDead || death) + if (phase2 || Main.getGoodWorld || allArmsDead) { // Start spin phase after 1.5 seconds npc.ai[2] += phase3 ? 1.5f : 1f; - if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f)) && (!otherHeadChargingOrSpinning || !death || phase3) && (canUseAttackInMaster || !death)) + if (npc.ai[2] >= (90f - (death ? 15f * (1f - lifeRatio) : 0f))) { bool shouldSpinAround = npc.ai[1] == 4f && npc.position.Y < Main.player[npc.target].position.Y - 320f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) < 600f && Vector2.Distance(Main.player[npc.target].Center, npc.Center) > 400f; - bool shouldCharge = death && !phase2 && !allArmsDead && !CalamityWorld.LegendaryMode; - if (shouldCharge) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.netUpdate = true; - } - else if (shouldSpinAround || npc.ai[1] != 4f) + if (shouldSpinAround || npc.ai[1] != 4f) { if (shouldSpinAround) { @@ -336,6 +184,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] = 0f; npc.ai[1] = shouldSpinAround ? 5f : 1f; + CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); npc.netUpdate = true; } } @@ -346,7 +195,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else npc.rotation = npc.velocity.X / 15f; - float acceleration = bossRush ? 0.2f : (death ? (0.12f + 0.05f * (1f - lifeRatio)) : 0.1f); + float acceleration = death ? (0.12f + 0.05f * (1f - lifeRatio)) : 0.1f; float accelerationMult = 1f; if (!cannonAlive) { @@ -427,8 +276,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Spinning if (npc.ai[1] == 1f) { - npc.defense *= 2; - npc.damage = npc.defDamage * 2; + npc.defense = npc.defDefense * 2; + npc.damage = npc.defDamage * SpinDamageMult; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; @@ -439,21 +288,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 24 : death ? 15 : 12; + int totalProjectiles = death ? 15 : 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } float velocity = 3f; double angleA = radians * 0.5; @@ -463,7 +300,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; @@ -497,7 +334,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float headTargetY = Main.player[npc.target].Center.Y - headPosition.Y; float headTargetDistance = (float)Math.Sqrt(headTargetX * headTargetX + headTargetY * headTargetY); - float speed = bossRush ? 12f : death ? 8f : 6f; + float speed = death ? 8f : 6f; if (phase2) speed += 0.5f; if (phase3) @@ -596,9 +433,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Despawning if (npc.ai[1] == 3f) { - // Avoid unfair bullshit - npc.damage = 0; - if (NPC.IsMechQueenUp) { int mechdusaBossDespawning = NPC.FindFirstNPC(NPCID.Retinazer); @@ -642,16 +476,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fly around in a circle if (npc.ai[1] == 5f) { - // Avoid unfair bullshit - npc.damage = 0; - npc.ai[2] += 1f; npc.rotation = npc.velocity.X / 50f; - float skullSpawnDivisor = bossRush ? 9f : death ? 15f - (float)Math.Round(3f * (1f - lifeRatio)) : 15f; + float skullSpawnDivisor = death ? 15f - (float)Math.Round(3f * (1f - lifeRatio)) : 15f; float totalSkulls = 12f; - int skullSpread = bossRush ? 250 : death ? 125 : 100; + int skullSpread = death ? 125 : 100; // Spin for about 3 seconds // Decreasing this number will INCREASE how fast he moves while spinning @@ -706,27 +537,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses enragedHeadSkullTargetY = value.Y; int type = ProjectileID.Skull; - int damage = npc.GetProjectileDamage(type); - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - if (npc.localAI[0] % 3f == 0f) - { - int probeLimit = death ? 3 : 2; - if (NPC.CountNPCS(NPCID.Probe) < probeLimit) - NPC.NewNPC(npc.GetSource_FromAI(), (int)headCenter.X, (int)headCenter.Y + 30, NPCID.Probe); - } - - int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, damage, 0f, Main.myPlayer, -3f, 0f); + int enragedSkulls = Projectile.NewProjectile(npc.GetSource_FromAI(), headCenter.X, headCenter.Y + 30f, enragedHeadSkullTargetX, enragedHeadSkullTargetY, type, SkullDamage.CalculateMechDamage(), 0f, Main.myPlayer, -3f, 0f); Main.projectile[enragedSkulls].timeLeft = 480; Main.projectile[enragedSkulls].tileCollide = false; } @@ -755,13 +567,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Fly overhead and spit missiles if (npc.ai[1] == 6f) { - // Avoid unfair bullshit - npc.damage = 0; - npc.rotation = npc.velocity.X / 15f; - float flightVelocity = bossRush ? 29f : death ? 25f : 18f; - float flightAcceleration = bossRush ? 1.12f : death ? 0.96f : 0.6f; + float flightVelocity = death ? 25f : 18f; + float flightAcceleration = death ? 0.96f : 0.6f; Vector2 destination = new Vector2(Main.player[npc.target].Center.X, Main.player[npc.target].Center.Y - 420f); npc.SimpleFlyMovement((destination - npc.Center).SafeNormalize(Vector2.UnitY) * flightVelocity, flightAcceleration); @@ -770,8 +579,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[3] += 1f; if (Vector2.Distance(npc.Center, destination) < 80f || npc.ai[2] > 0f || npc.localAI[3] > 120f) { - float missileSpawnDivisor = death ? 10f : 12f; - float totalMissiles = death ? 12f : 10f; + float missileSpawnDivisor = 12f; + float totalMissiles = 10f; npc.ai[2] += 1f; if (npc.ai[2] % missileSpawnDivisor == 0f) { @@ -781,20 +590,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 velocity = (-Vector2.UnitY * 3f).RotatedByRandom(MathHelper.Pi / 8f); int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 30f, velocity.X, velocity.Y, type, damage, 0f, Main.myPlayer, npc.target, 1f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center.X + Main.rand.Next(npc.width / 2), npc.Center.Y + 30f, velocity.X, velocity.Y, type, RocketDamage.CalculateMechDamage(), 0f, Main.myPlayer, npc.target, 1f); Main.projectile[proj].timeLeft = 540; } @@ -822,8 +619,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeLaserAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -876,13 +672,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); } - // Avoid cheap bullshit - npc.damage = 0; - bool normalLaserRotation = npc.localAI[1] % 2f == 0f; // Movement - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -986,26 +779,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] >= 48f) { npc.localAI[0] = 0f; - float laserSpeed = bossRush ? 5f : 4f; + float laserSpeed = 4f; int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } laserArmTargetDist = laserSpeed / laserArmTargetDist; laserArmTargetX *= laserArmTargetDist; laserArmTargetY *= laserArmTargetDist; Vector2 laserVelocity = new Vector2(laserArmTargetX, laserArmTargetY); - Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(npc.GetSource_FromAI(), laserArmPosition + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); } } } @@ -1053,21 +834,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.localAI[0] >= 120f) { npc.localAI[0] = 0f; - int totalProjectiles = bossRush ? 32 : death ? 24 : 16; + int totalProjectiles = death ? 24 : 16; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } float velocity = 3f; double angleA = radians * 0.5; @@ -1077,7 +846,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int k = 0; k < totalProjectiles; k++) { Vector2 laserFireDirection = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserFireDirection.SafeNormalize(Vector2.UnitY) * 100f, laserFireDirection, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; } npc.localAI[1] += 1f; @@ -1090,8 +859,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeCannonAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1142,9 +910,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SyncExtraAI(); } - // Avoid cheap bullshit - npc.damage = 0; - bool fireSlower = false; if (laserAlive) { @@ -1204,7 +969,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } // Movement - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!laserAlive) { @@ -1290,18 +1055,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } float rocketSpeed = 10f; cannonArmTargetDist = rocketSpeed / cannonArmTargetDist; @@ -1309,7 +1062,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses cannonArmTargetY *= cannonArmTargetDist; Vector2 rocketVelocity = new Vector2(cannonArmTargetX, cannonArmTargetY); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition + rocketVelocity.SafeNormalize(Vector2.UnitY) * 40f, rocketVelocity, type, damage, 0f, Main.myPlayer, npc.target, 2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), cannonArmPosition + rocketVelocity.SafeNormalize(Vector2.UnitY) * 40f, rocketVelocity, type, RocketDamage.CalculateMechDamage(), 0f, Main.myPlayer, npc.target, 2f); Main.projectile[proj].timeLeft = 540; } } @@ -1337,27 +1090,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item62, npc.Center); npc.localAI[0] = 0f; int type = ProjectileID.RocketSkeleton; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } float rocketSpeed = 10f; Vector2 cannonSpreadTargetDist = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * rocketSpeed; - int numProj = bossRush ? 5 : 3; - float rotation = MathHelper.ToRadians(bossRush ? 15 : 9); + int numProj = 3; + float rotation = MathHelper.ToRadians(9); for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = cannonSpreadTargetDist.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 40f, perturbedSpeed, type, damage, 0f, Main.myPlayer, npc.target, 2f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 40f, perturbedSpeed, type, RocketDamage.CalculateMechDamage(), 0f, Main.myPlayer, npc.target, 2f); Main.projectile[proj].timeLeft = 600; } } @@ -1369,8 +1110,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeViceAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1428,13 +1168,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses sawAlive = true; } - // Avoid cheap bullshit - npc.damage = 0; - // Return to the head if (npc.ai[2] == 99f) { - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1524,7 +1261,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1614,10 +1351,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) { - // Set damage - npc.damage = npc.defDamage; - - float chargeVelocity = bossRush ? 20f : 16f; + float chargeVelocity = 16f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -1640,9 +1374,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge 4 times (more if arms are dead) else if (npc.ai[2] == 2f) { - // Set damage - npc.damage = npc.defDamage; - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) { float chargeAmt = 4f; @@ -1682,10 +1413,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) { - // Set damage - npc.damage = npc.defDamage; - - float chargeVelocity = bossRush ? 17.5f : 14f; + float chargeVelocity = 14f; if (!cannonAlive) chargeVelocity += 1f; if (!laserAlive) @@ -1708,9 +1436,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge 4 times (more if arms are dead) else if (npc.ai[2] == 5f && npc.Center.X < Main.player[npc.target].Center.X - 100f) { - // Set damage - npc.damage = npc.defDamage; - float chargeAmt = 4f; if (!cannonAlive) chargeAmt += 1f; @@ -1737,8 +1462,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public static bool BuffedPrimeSawAI(NPC npc, Mod mod) { - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -1792,15 +1516,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses viceAlive = true; } - // Min saw damage - int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); - - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - if (npc.ai[2] == 99f) { - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1886,7 +1604,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.netUpdate = true; } - float acceleration = bossRush ? 0.6f : death ? 0.375f : 0.25f; + float acceleration = death ? 0.375f : 0.25f; float accelerationMult = 1f; if (!cannonAlive) { @@ -1970,10 +1688,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) { - // Set damage - npc.damage = npc.defDamage; - - float chargeVelocity = bossRush ? 27.5f : 22f; + float chargeVelocity = 22f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -1995,9 +1710,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[2] == 2f) { - // Set damage - npc.damage = npc.defDamage; - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) npc.ai[2] = 3f; } @@ -2006,10 +1718,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.ai[2] == 4f) { - // Set damage - npc.damage = npc.defDamage; - - float chargeVelocity = bossRush ? 13.5f : 11f; + float chargeVelocity = 11f; if (!cannonAlive) chargeVelocity += 1.5f; if (!laserAlive) @@ -2027,7 +1736,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses sawArmOtherChargeTargetX *= sawArmOtherChargeTargetDist; sawArmOtherChargeTargetY *= sawArmOtherChargeTargetDist; - float acceleration = bossRush ? 0.3f : death ? 0.125f : 0.08f; + float acceleration = death ? 0.125f : 0.08f; float deceleration = death ? 0.6f : 0.8f; if (npc.velocity.X > sawArmOtherChargeTargetX) @@ -2084,1477 +1793,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaSkeletronPrimeAI(NPC npc, Mod mod) - { - npc.defense = npc.defDefense; - if (npc.ai[3] != 0f) - NPC.mechQueen = npc.whoAmI; - - npc.reflectsProjectiles = false; - if (npc.ai[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - npc.ai[0] = 1f; - int num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeCannon, npc.whoAmI); - Main.npc[num495].ai[0] = -1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeSaw, npc.whoAmI); - Main.npc[num495].ai[0] = 1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeVice, npc.whoAmI); - Main.npc[num495].ai[0] = -1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].ai[3] = 150f; - Main.npc[num495].netUpdate = true; - num495 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, NPCID.PrimeLaser, npc.whoAmI); - Main.npc[num495].ai[0] = 1f; - Main.npc[num495].ai[1] = npc.whoAmI; - Main.npc[num495].target = npc.target; - Main.npc[num495].netUpdate = true; - Main.npc[num495].ai[3] = 150f; - } - - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - { - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - if (Main.player[npc.target].dead || Math.Abs(npc.position.X - Main.player[npc.target].position.X) > 6000f || Math.Abs(npc.position.Y - Main.player[npc.target].position.Y) > 6000f) - npc.ai[1] = 3f; - } - - if (Main.IsItDay() && npc.ai[1] != 3f && npc.ai[1] != 2f) - { - npc.ai[1] = 2f; - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - - if (npc.ai[1] == 0f) - { - npc.damage = 0; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (Main.masterMode ? 300f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 1f; - npc.netUpdate = true; - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation = npc.velocity.X / 15f; - - float num496 = 0.1f; - float num497 = 2f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.94f : Main.expertMode ? 0.96f : 0.98f; - int num500 = 200; - int num501 = 500; - float num502 = 0f; - int num503 = ((!(Main.player[npc.target].Center.X < npc.Center.X)) ? 1 : (-1)); - if (NPC.IsMechQueenUp) - { - num502 = -450f * (float)num503; - num500 = 300; - num501 = 350; - } - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.05f : 0.03f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.player[npc.target].position.Y - (float)num500) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.player[npc.target].position.Y - (float)num501) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.player[npc.target].Center.X + 100f + num502) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.player[npc.target].Center.X - 100f + num502) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < 0f - num499) - npc.velocity.X = 0f - num499; - } - } - else if (npc.ai[1] == 1f) - { - npc.defense *= 2; - npc.damage = npc.defDamage * 2; - - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - npc.ai[2] += 1f; - if (npc.ai[2] == 2f) - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - - if (npc.ai[2] >= (Main.masterMode ? 300f : 400f)) - { - npc.ai[2] = 0f; - npc.ai[1] = 0f; - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - } - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += (float)npc.direction * 0.3f; - - Vector2 vector54 = npc.Center; - float num504 = Main.player[npc.target].Center.X - vector54.X; - float num505 = Main.player[npc.target].Center.Y - vector54.Y; - float num506 = (float)Math.Sqrt(num504 * num504 + num505 * num505); - float num507 = 5f; - if (Main.expertMode) - { - num507 = Main.masterMode ? 7f : 6f; - if (num506 > 150f) - num507 *= (Main.masterMode ? 1.075f : 1.05f); - - float additionalMultiplier = Main.masterMode ? 1.15f : 1.1f; - if (num506 > 200f) - num507 *= additionalMultiplier; - - if (num506 > 250f) - num507 *= additionalMultiplier; - - if (num506 > 300f) - num507 *= additionalMultiplier; - - if (num506 > 350f) - num507 *= additionalMultiplier; - - if (num506 > 400f) - num507 *= additionalMultiplier; - - if (num506 > 450f) - num507 *= additionalMultiplier; - - if (num506 > 500f) - num507 *= additionalMultiplier; - - if (num506 > 550f) - num507 *= additionalMultiplier; - - if (num506 > 600f) - num507 *= additionalMultiplier; - } - - if (NPC.IsMechQueenUp) - { - float num508 = (NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody] ? 0.6f : 0.75f); - num507 *= num508; - } - - num506 = num507 / num506; - npc.velocity.X = num504 * num506; - npc.velocity.Y = num505 * num506; - if (NPC.IsMechQueenUp) - { - float num509 = Vector2.Distance(npc.Center, Main.player[npc.target].Center); - if (num509 < 0.1f) - num509 = 0f; - - if (num509 < num507) - npc.velocity = npc.velocity.SafeNormalize(Vector2.Zero) * num509; - } - } - else if (npc.ai[1] == 2f) - { - npc.damage = 1000; - npc.defense = 9999; - - npc.Calamity().CurrentlyEnraged = true; - npc.Calamity().CurrentlyIncreasingDefenseOrDR = true; - - if (NPC.IsMechQueenUp) - npc.rotation = npc.rotation.AngleLerp(npc.velocity.X / 15f * 0.5f, 0.75f); - else - npc.rotation += (float)npc.direction * 0.3f; - - Vector2 vector55 = npc.Center; - float num510 = Main.player[npc.target].Center.X - vector55.X; - float num511 = Main.player[npc.target].Center.Y - vector55.Y; - float num512 = (float)Math.Sqrt(num510 * num510 + num511 * num511); - float num513 = 10f; - num513 += num512 / 100f; - if (num513 < 8f) - num513 = 8f; - - if (num513 > 32f) - num513 = 32f; - - num512 = num513 / num512; - npc.velocity.X = num510 * num512; - npc.velocity.Y = num511 * num512; - } - else - { - if (npc.ai[1] != 3f) - return false; - - if (NPC.IsMechQueenUp) - { - int num514 = NPC.FindFirstNPC(NPCID.Retinazer); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); - - num514 = NPC.FindFirstNPC(NPCID.Spazmatism); - if (num514 >= 0) - Main.npc[num514].EncourageDespawn(5); - - if (!NPC.AnyNPCs(NPCID.Retinazer) && !NPC.AnyNPCs(NPCID.Spazmatism)) - { - num514 = NPC.FindFirstNPC(NPCID.TheDestroyer); - if (num514 >= 0) - Main.npc[num514].Transform(NPCID.TheDestroyerTail); - - npc.EncourageDespawn(5); - } - - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - if (npc.velocity.Y > 13f) - npc.velocity.Y = 13f; - } - else - { - npc.EncourageDespawn(500); - npc.velocity.Y += 0.1f; - if (npc.velocity.Y < 0f) - npc.velocity.Y *= 0.95f; - - npc.velocity.X *= 0.95f; - } - } - - return false; - } - - public static bool VanillaPrimeLaserAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.damage = 0; - - if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float num496 = 0.07f; - float num497 = 6f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.11f : 0.09f; - num497 = Main.masterMode ? 8f : 7f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - npc.localAI[0] += 3f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 600f : 800f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.1f; - float num497 = 3f; - float num498 = 0.14f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.2f : 0.17f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 180f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector68 = npc.Center; - float num559 = Main.player[npc.target].Center.X - vector68.X; - float num560 = Main.player[npc.target].Center.Y - vector68.Y; - float num561 = (float)Math.Sqrt(num559 * num559 + num560 * num560); - npc.rotation = (float)Math.Atan2(num560, num559) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 80f : Main.expertMode ? 140f : 200f)) - { - npc.localAI[0] = 0f; - float num562 = 8f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num561 = num562 / num561; - num559 *= num561; - num560 *= num561; - Vector2 laserVelocity = new Vector2(num559, num560); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector68 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - else - { - if (npc.ai[2] != 1f) - return false; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 150f : Main.expertMode ? 175f : 200f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector69 = npc.Center; - float num566 = Main.player[npc.target].Center.X - 350f - vector69.X; - float num567 = Main.player[npc.target].Center.Y - 20f - vector69.Y; - float num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); - num568 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num568; - num566 *= num568; - num567 *= num568; - - float num496 = 0.1f; - float num498 = 0.03f; - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num498 = Main.masterMode ? 0.05f : 0.04f; - } - - if (npc.velocity.X > num566) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num496; - } - - if (npc.velocity.X < num566) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num496; - } - - if (npc.velocity.Y > num567) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num498; - } - - if (npc.velocity.Y < num567) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num498; - } - - vector69 = npc.Center; - num566 = Main.player[npc.target].Center.X - vector69.X; - num567 = Main.player[npc.target].Center.Y - vector69.Y; - num568 = (float)Math.Sqrt(num566 * num566 + num567 * num567); - npc.rotation = (float)Math.Atan2(num567, num566) - MathHelper.PiOver2; - if (Main.netMode == NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 40f : Main.expertMode ? 60f : 80f)) - { - npc.localAI[0] = 0f; - float num569 = 10f; - - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num568 = num569 / num568; - num566 *= num568; - num567 *= num568; - Vector2 laserVelocity = new Vector2(num566, num567); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector69 + laserVelocity.SafeNormalize(Vector2.UnitY) * 100f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - - return false; - } - - public static bool VanillaPrimeCannonAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - npc.damage = 0; - - if (npc.ai[2] == 0f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - float num496 = 0.07f; - float num497 = 6f; - float num498 = 0.1f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.11f : 0.09f; - num497 = Main.masterMode ? 8f : 7f; - num498 = Main.masterMode ? 0.15f : 0.12f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - npc.localAI[0] += 2f; - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 100f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 120f * npc.ai[0]) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 700f : Main.expertMode ? 900f : 1100f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.04f; - float num497 = 3f; - float num498 = 0.2f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.06f : 0.05f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.28f : 0.24f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 150f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 200f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X + 160f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector66 = npc.Center; - float num545 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector66.X; - float num546 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector66.Y; - float num547 = (float)Math.Sqrt(num545 * num545 + num546 * num546); - npc.rotation = (float)Math.Atan2(num546, num545) + MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 60f : Main.expertMode ? 100f : 140f)) - { - npc.localAI[0] = 0f; - float num548 = 12f; - int num549 = 0; - int num550 = ProjectileID.BombSkeletronPrime; - num547 = num548 / num547; - num545 = (0f - num545) * num547; - num546 = (0f - num546) * num547; - vector66.X += num545 * 4f; - vector66.Y += num546 * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector66.X, vector66.Y, num545, num546, num550, num549, 0f, Main.myPlayer); - } - } - } - else - { - if (npc.ai[2] != 1f) - return false; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.localAI[0] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - Vector2 vector67 = npc.Center; - float num552 = Main.npc[(int)npc.ai[1]].Center.X - vector67.X; - float num553 = Main.npc[(int)npc.ai[1]].position.Y - vector67.Y; - num553 = Main.player[npc.target].Center.Y - 80f - vector67.Y; - float num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); - num554 = (Main.masterMode ? 8f : Main.expertMode ? 7f : 6f) / num554; - num552 *= num554; - num553 *= num554; - - float num496 = 0.04f; - float num498 = 0.08f; - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.08f : 0.06f; - num498 = Main.masterMode ? 0.12f : 0.1f; - } - - if (npc.velocity.X > num552) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num496; - } - - if (npc.velocity.X < num552) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num496; - } - - if (npc.velocity.Y > num553) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num498; - } - - if (npc.velocity.Y < num553) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num498; - } - - vector67 = npc.Center; - num552 = Main.player[npc.target].Center.X - vector67.X; - num553 = Main.player[npc.target].Center.Y - vector67.Y; - num554 = (float)Math.Sqrt(num552 * num552 + num553 * num553); - npc.rotation = (float)Math.Atan2(num553, num552) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[0] += 1f; - if (npc.localAI[0] > (Main.masterMode ? 20f : Main.expertMode ? 30f : 40f)) - { - npc.localAI[0] = 0f; - float num555 = 10f; - int num556 = 0; - int num557 = ProjectileID.BombSkeletronPrime; - num554 = num555 / num554; - num552 *= num554; - num553 *= num554; - vector67.X += num552 * 4f; - vector67.Y += num553 * 4f; - Projectile.NewProjectile(npc.GetSource_FromAI(), vector67.X, vector67.Y, num552, num553, num557, num556, 0f, Main.myPlayer); - } - } - } - - return false; - } - - public static bool VanillaPrimeViceAI(NPC npc, Mod mod) - { - npc.spriteDirection = -(int)npc.ai[0]; - Vector2 vector61 = npc.Center; - float num530 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector61.X; - float num531 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector61.Y; - float num532 = (float)Math.Sqrt(num530 * num530 + num531 * num531); - if (npc.ai[2] != 99f) - { - if (num532 > 800f) - npc.ai[2] = 99f; - } - else if (num532 < 400f) - npc.ai[2] = 0f; - - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - // Avoid cheap bullshit - npc.damage = 0; - - if (npc.ai[2] == 99f) - { - float num496 = 0.1f; - float num497 = 8f; - float num498 = 0.5f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 11f : 9.5f; - num498 = Main.masterMode ? 0.6f : 0.55f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - if (Main.player[npc.target].dead) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; - } - else - { - Vector2 vector62 = npc.Center; - float num533 = Main.player[npc.target].Center.X - vector62.X; - float num534 = Main.player[npc.target].Center.Y - vector62.Y; - float num535 = (float)Math.Sqrt(num533 * num533 + num534 * num534); - num535 = (Main.masterMode ? 16f : Main.expertMode ? 14f : 12f) / num535; - num533 *= num535; - num534 *= num535; - npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - if (Math.Abs(npc.velocity.X) + Math.Abs(npc.velocity.Y) < 2f) - { - npc.rotation = (float)Math.Atan2(num534, num533) - MathHelper.PiOver2; - npc.velocity.X = num533; - npc.velocity.Y = num534; - npc.netUpdate = true; - } - else - npc.velocity *= deceleration; - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.1f; - float num497 = 3f; - float num498 = 0.2f; - float num499 = 8f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.28f : 0.24f; - num499 = Main.masterMode ? 11f : 9.5f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 300f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 230f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 250f) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= (deceleration - 0.02f); - - npc.velocity.X -= (num498 * 1.5f); - if (npc.velocity.X > num499 + 1f) - npc.velocity.X = num499 + 1f; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= (deceleration - 0.02f); - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector63 = npc.Center; - float num536 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector63.X; - float num537 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector63.Y; - float num538 = (float)Math.Sqrt(num536 * num536 + num537 * num537); - npc.rotation = (float)Math.Atan2(num537, num536) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - float deceleration = Main.masterMode ? 0.8f : Main.expertMode ? 0.85f : 0.9f; - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - Vector2 vector64 = npc.Center; - float num539 = Main.npc[(int)npc.ai[1]].Center.X - 280f * npc.ai[0] - vector64.X; - float num540 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector64.Y; - float num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); - npc.rotation = (float)Math.Atan2(num540, num539) + MathHelper.PiOver2; - npc.velocity.X = (npc.velocity.X * 5f + Main.npc[(int)npc.ai[1]].velocity.X) / 6f; - npc.velocity.X += 0.5f; - npc.velocity.Y -= 0.5f; - if (npc.velocity.Y < -9f) - npc.velocity.Y = -9f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 280f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector64 = npc.Center; - num539 = Main.player[npc.target].Center.X - vector64.X; - num540 = Main.player[npc.target].Center.Y - vector64.Y; - num541 = (float)Math.Sqrt(num539 * num539 + num540 * num540); - num541 = (Main.masterMode ? 24f : Main.expertMode ? 22f : 20f) / num541; - npc.velocity.X = num539 * num541; - npc.velocity.Y = num540 * num541; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - { - float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; - if (npc.ai[3] >= numCharges) - { - npc.ai[2] = 3f; - npc.ai[3] = 0f; - } - else - { - npc.ai[2] = 1f; - npc.ai[3] += 1f; - } - } - } - else if (npc.ai[2] == 4f) - { - Vector2 vector65 = npc.Center; - float num542 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector65.X; - float num543 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector65.Y; - float num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); - npc.rotation = (float)Math.Atan2(num543, num542) + MathHelper.PiOver2; - npc.velocity.Y = (npc.velocity.Y * 5f + Main.npc[(int)npc.ai[1]].velocity.Y) / 6f; - npc.velocity.X += 0.5f; - if (npc.velocity.X > 12f) - npc.velocity.X = 12f; - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 500f || npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X + 500f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 5f; - vector65 = npc.Center; - num542 = Main.player[npc.target].Center.X - vector65.X; - num543 = Main.player[npc.target].Center.Y - vector65.Y; - num544 = (float)Math.Sqrt(num542 * num542 + num543 * num543); - num544 = (Main.masterMode ? 20f : Main.expertMode ? 18.5f : 17f) / num544; - npc.velocity.X = num542 * num544; - npc.velocity.Y = num543 * num544; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 5f && npc.Center.X < Main.player[npc.target].Center.X - 100f) - { - // Set damage - npc.damage = npc.defDamage; - - float numCharges = Main.masterMode ? 2f : Main.expertMode ? 3f : 4f; - if (npc.ai[3] >= numCharges) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - } - else - { - npc.ai[2] = 4f; - npc.ai[3] += 1f; - } - } - - return false; - } - - public static bool VanillaPrimeSawAI(NPC npc, Mod mod) - { - Vector2 vector56 = npc.Center; - float num515 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector56.X; - float num516 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector56.Y; - float num517 = (float)Math.Sqrt(num515 * num515 + num516 * num516); - if (npc.ai[2] != 99f) - { - if (num517 > 800f) - npc.ai[2] = 99f; - } - else if (num517 < 400f) - npc.ai[2] = 0f; - - npc.spriteDirection = -(int)npc.ai[0]; - if (!Main.npc[(int)npc.ai[1]].active || Main.npc[(int)npc.ai[1]].aiStyle != NPCAIStyleID.SkeletronPrimeHead) - { - npc.ai[2] += 10f; - if (npc.ai[2] > 50f || !Main.dedServ) - { - npc.life = -1; - npc.HitEffect(); - npc.active = false; - } - } - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - CalamityUtils.CalamityTargeting(npc, CalamityTargetingParameters.BossDefaults); - - // Min saw damage - int reducedSetDamage = (int)Math.Round(npc.defDamage * 0.5); - - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - - if (npc.ai[2] == 99f) - { - float num496 = 0.1f; - float num497 = 8f; - float num498 = 0.5f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.14f : 0.12f; - num497 = Main.masterMode ? 11f : 9.5f; - num498 = Main.masterMode ? 0.6f : 0.55f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - else if (npc.ai[2] == 0f || npc.ai[2] == 3f) - { - if (Main.npc[(int)npc.ai[1]].ai[1] == 3f) - npc.EncourageDespawn(10); - - if (Main.npc[(int)npc.ai[1]].ai[1] != 0f) - { - if (Main.player[npc.target].dead) - { - npc.velocity.Y += 0.1f; - if (npc.velocity.Y > 16f) - npc.velocity.Y = 16f; - } - else - { - Vector2 vector57 = npc.Center; - float num518 = Main.player[npc.target].Center.X - vector57.X; - float num519 = Main.player[npc.target].Center.Y - vector57.Y; - float num520 = (float)Math.Sqrt(num518 * num518 + num519 * num519); - num520 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num520; - num518 *= num520; - num519 *= num520; - npc.rotation = (float)Math.Atan2(num519, num518) - MathHelper.PiOver2; - - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; - if (npc.velocity.X > num518) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= acceleration; - } - - if (npc.velocity.X < num518) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += acceleration; - } - - if (npc.velocity.Y > num519) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= acceleration; - } - - if (npc.velocity.Y < num519) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += acceleration; - } - } - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - } - else - { - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 180f : Main.expertMode ? 240f : 300f)) - { - npc.target = Main.npc[(int)npc.ai[1]].target; - npc.ai[2] += 1f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - float num496 = 0.04f; - float num497 = 3f; - float num498 = 0.3f; - float num499 = 12f; - float deceleration = Main.masterMode ? 0.92f : Main.expertMode ? 0.94f : 0.96f; - - if (Main.expertMode) - { - num496 = Main.masterMode ? 0.06f : 0.05f; - num497 = Main.masterMode ? 5f : 4f; - num498 = Main.masterMode ? 0.4f : 0.35f; - num499 = Main.masterMode ? 16f : 14f; - } - - if (npc.position.Y > Main.npc[(int)npc.ai[1]].position.Y + 320f) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= num496; - if (npc.velocity.Y > num497) - npc.velocity.Y = num497; - } - else if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y + 260f) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += num496; - if (npc.velocity.Y < -num497) - npc.velocity.Y = -num497; - } - - if (npc.Center.X > Main.npc[(int)npc.ai[1]].Center.X) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= num498; - if (npc.velocity.X > num499) - npc.velocity.X = num499; - } - - if (npc.Center.X < Main.npc[(int)npc.ai[1]].Center.X - 250f) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += num498; - if (npc.velocity.X < -num499) - npc.velocity.X = -num499; - } - } - - Vector2 vector58 = npc.Center; - float num521 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector58.X; - float num522 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector58.Y; - float num523 = (float)Math.Sqrt(num521 * num521 + num522 * num522); - npc.rotation = (float)Math.Atan2(num522, num521) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 1f) - { - Vector2 vector59 = npc.Center; - float num524 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector59.X; - float num525 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector59.Y; - float num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); - npc.rotation = (float)Math.Atan2(num525, num524) + MathHelper.PiOver2; - - float deceleration = Main.masterMode ? 0.85f : Main.expertMode ? 0.9f : 0.95f; - npc.velocity.X *= deceleration; - npc.velocity.Y -= 0.1f; - if (npc.velocity.Y < -8f) - npc.velocity.Y = -8f; - - if (npc.position.Y < Main.npc[(int)npc.ai[1]].position.Y - 200f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] = 2f; - vector59 = npc.Center; - num524 = Main.player[npc.target].Center.X - vector59.X; - num525 = Main.player[npc.target].Center.Y - vector59.Y; - num526 = (float)Math.Sqrt(num524 * num524 + num525 * num525); - num526 = (Main.masterMode ? 26f : Main.expertMode ? 24f : 22f) / num526; - npc.velocity.X = num524 * num526; - npc.velocity.Y = num525 * num526; - npc.netUpdate = true; - } - } - else if (npc.ai[2] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - if (npc.position.Y > Main.player[npc.target].position.Y || npc.velocity.Y < 0f) - npc.ai[2] = 3f; - } - else if (npc.ai[2] == 4f) - { - // Set damage - npc.damage = npc.defDamage; - - Vector2 vector60 = npc.Center; - float num527 = Main.player[npc.target].Center.X - vector60.X; - float num528 = Main.player[npc.target].Center.Y - vector60.Y; - float num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); - num529 = (Main.masterMode ? 9f : Main.expertMode ? 8f : 7f) / num529; - num527 *= num529; - num528 *= num529; - - float deceleration = Main.masterMode ? 0.93f : Main.expertMode ? 0.95f : 0.97f; - float acceleration = Main.masterMode ? 0.07f : Main.expertMode ? 0.06f : 0.05f; - - if (npc.velocity.X > num527) - { - if (npc.velocity.X > 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X -= acceleration; - } - - if (npc.velocity.X < num527) - { - if (npc.velocity.X < 0f) - npc.velocity.X *= deceleration; - - npc.velocity.X += acceleration; - } - - if (npc.velocity.Y > num528) - { - if (npc.velocity.Y > 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y -= acceleration; - } - - if (npc.velocity.Y < num528) - { - if (npc.velocity.Y < 0f) - npc.velocity.Y *= deceleration; - - npc.velocity.Y += acceleration; - } - - npc.ai[3] += 1f; - if (npc.ai[3] >= (Main.masterMode ? 400f : Main.expertMode ? 500f : 600f)) - { - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - vector60 = npc.Center; - num527 = Main.npc[(int)npc.ai[1]].Center.X - 200f * npc.ai[0] - vector60.X; - num528 = Main.npc[(int)npc.ai[1]].position.Y + 230f - vector60.Y; - num529 = (float)Math.Sqrt(num527 * num527 + num528 * num528); - npc.rotation = (float)Math.Atan2(num528, num527) + MathHelper.PiOver2; - } - else if (npc.ai[2] == 5f && ((npc.velocity.X > 0f && npc.Center.X > Main.player[npc.target].Center.X) || (npc.velocity.X < 0f && npc.Center.X < Main.player[npc.target].Center.X))) - npc.ai[2] = 0f; - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs index e77b34c8f2..5cbbaedfe1 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/TwinsAI.cs @@ -13,12 +13,37 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { public static class TwinsAI { + // Vanilla values + public static float RapidFireDamageMult = 0.75f; // 80 (buffed) + public static float RetinazerPhase2ContactDamageMult = 1.5f; // 114 + public static float SpazmatismPhase2ContactDamageMult = 1.5f; // 127 + public static int FlamethrowerDamage = 27; // 108; Applies to both flamethrower types + public static int FireballDamage = 22; // 88; Applies to both fireball types + + // Rev+ exclusive + public static int LaserDamage = 21; // 84 (buffed) + public static int RedLaserDamage = 27; // 108 (buffed) + public static int HomingDartDamage = 27; // 108 + + public static int CalculateMechDamage(this int damage) + { + // Reduce mech boss projectile damage depending on the new ore progression changes + if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) + { + double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; + double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; + if (!NPC.downedMechBossAny) + damage = (int)(damage * firstMechMultiplier); + else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) + damage = (int)(damage * secondMechMultiplier); + } + return damage; + } + public static bool BuffedRetinazerAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -28,13 +53,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -71,37 +89,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType()) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) npc.timeLeft = Main.npc[i].timeLeft - 1; } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - - // Foveanator spawn - if (!oblivionAlive && death && calamityGlobalNPC.newAI[0] == 0f && Main.netMode != NetmodeID.MultiplayerClient && !bossRush) - { - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.Center.X, (int)npc.Center.Y, ModContent.NPCType()); - calamityGlobalNPC.newAI[0] = 1f; - npc.SyncExtraAI(); - } - - bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); - // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.4f : 0.25f; // Movement variables @@ -112,16 +106,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Phase duration variables float phase1MaxLaserPhaseDurationDecrease = death ? 120f : 300f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1f : 2f; - phase1MaxAccelerationIncrease = death ? 0.0125f : 0.025f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxLaserPhaseDurationDecrease = death ? 60f : 150f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -141,8 +125,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !spazAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if ((Main.player[npc.target].dead || Main.IsItDay()) && !BossRushEvent.BossRushActive) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -156,13 +139,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = 0; - - float maxVelocity = 8.25f; - float acceleration = 0.115f; - maxVelocity += 4f * enrageScale; - acceleration += 0.05f * enrageScale; + float maxVelocity = (death ? 9.45f : 8.25f); + float acceleration = (death ? 0.13f : 0.115f); if (death) { @@ -199,7 +177,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.SimpleFlyMovement(idealVelocity * maxVelocity, acceleration); float phaseGateValue = death ? (300f - phase1MaxLaserPhaseDurationDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))) : 450f; - float laserGateValue = oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f; + float laserGateValue = 30f; if (NPC.IsMechQueenUp) { phaseGateValue = 900f; @@ -234,23 +212,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { - float laserSpeed = 10.5f; - laserSpeed += 3f * enrageScale; + float laserSpeed = death ? 11.4f : 10.5f; int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - + int damage = LaserDamage.CalculateMechDamage(); Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer); } @@ -260,13 +225,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 1f) { - // Set damage - npc.damage = npc.defDamage; - npc.rotation = hoverRotation; - float chargeSpeed = 15f; - chargeSpeed += 10f * enrageScale; + float chargeSpeed = death ? 18f : 15f; if (death) chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); if (Main.getGoodWorld) @@ -278,16 +239,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[1] == 2f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[2] += 1f; float decelerateGateValue = (death ? 36f : 32f) + (death ? 6f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); if (npc.ai[2] >= decelerateGateValue) { - // Avoid cheap bullshit - npc.damage = 0; - float decelerationMultiplier = (death ? 0.84f : 0.92f) - (death ? 0.16f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); npc.velocity *= decelerationMultiplier; @@ -300,7 +255,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; float delayBeforeChargingAgain = (death ? 48f : 56f) - (death ? 3f * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 0f); - if (npc.ai[2] >= delayBeforeChargingAgain + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= delayBeforeChargingAgain) { npc.ai[3] += 1f; npc.ai[2] = 0f; @@ -308,8 +263,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = hoverRotation; float totalCharges = death ? 6f : 5f; - if (foveanatorAlive) - totalCharges -= 1f; if (npc.ai[3] >= totalCharges) { @@ -343,9 +296,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { - // Avoid cheap bullshit - npc.damage = 0; - if (NPC.IsMechQueenUp) npc.reflectsProjectiles = true; @@ -372,31 +322,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses SoundEngine.PlaySound(SoundID.Item33, npc.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { - bool shootLaser = npc.ai[1] % 20f == 0f; - int type = shootLaser ? ProjectileID.DeathLaser : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int type = ProjectileID.DeathLaser; - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 6f : 7f); - int numProj = shootLaser ? 6 : 2; - int spread = shootLaser ? 20 : 80; - float rotation = MathHelper.ToRadians(spread); - float offset = shootLaser ? 90f : 50f; - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * offset, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } + Vector2 projectileVelocity = npc.rotation.ToRotationVector2() * 7f; + float offset = 90f; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + Vector2.Normalize(projectileVelocity) * offset, projectileVelocity, type, LaserDamage.CalculateMechDamage(), 0f, Main.myPlayer); } } } @@ -450,7 +380,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.chaseable = !spazInPhase1; - int setDamage = (int)Math.Round(npc.defDamage * 1.5); + npc.damage = (int)Math.Round(npc.defDamage * RetinazerPhase2ContactDamageMult); npc.defense = npc.defDefense + 10; calamityGlobalNPC.DR = spazInPhase1 ? 0.9999f : 0.2f; calamityGlobalNPC.unbreakableDR = spazInPhase1; @@ -460,13 +390,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = 0; - - float maxVelocity = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.175f + (death ? 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - maxVelocity += 4.5f * enrageScale; - acceleration += 0.075f * enrageScale; + float maxVelocity = death ? 10.85f + 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; + float acceleration = death ? 0.1975f + 0.05f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.175f; if (Main.getGoodWorld) { @@ -474,7 +399,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center - Vector2.UnitY * distanceFromTarget; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -516,30 +441,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] >= (spazAlive ? (oblivionAlive ? 76f : foveanatorAlive ? 64f : 52f) : foveanatorAlive ? 39f : 26f)) + if (npc.localAI[1] >= (spazAlive ? 52f : 26f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; float laserSpeed = 10f; - laserSpeed += enrageScale; int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, RedLaserDamage.CalculateMechDamage(), 0f, Main.myPlayer); } } } @@ -548,13 +460,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { if (npc.ai[1] == 1f) { - // Avoid cheap bullshit - npc.damage = 0; - - float maxVelocity = 9.5f + (death ? 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.25f + (death ? 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - maxVelocity += 4.5f * enrageScale; - acceleration += 0.15f * enrageScale; + float maxVelocity = death ? 10.85f + 3f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 9.5f; + float acceleration = death ? 0.295f + 0.075f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0.25f; if (Main.getGoodWorld) { @@ -562,7 +469,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 420f; + float distanceFromTarget = 420f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -573,27 +480,15 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { npc.localAI[1] += 1f + (death ? (phase2LifeRatio - lifeRatio) / phase2LifeRatio : 0f); - if (npc.localAI[1] > (spazAlive ? (oblivionAlive ? 30f : foveanatorAlive ? 25f : 20f) : foveanatorAlive ? 15f : 10f)) + if (npc.localAI[1] > (spazAlive ? 20f : 10f)) { if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) { npc.localAI[1] = 0f; float laserSpeed = 9f; - laserSpeed += enrageScale; int type = ProjectileID.DeathLaser; - int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } + int damage = (int)Math.Round(RedLaserDamage.CalculateMechDamage() * RapidFireDamageMult); Vector2 laserVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); @@ -619,14 +514,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge else if (npc.ai[1] == 2f) { - // Set damage - npc.damage = setDamage; - // Set rotation and velocity npc.rotation = hoverRotation; - float chargeSpeed = 22f + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - chargeSpeed += 10f * enrageScale; + float chargeSpeed = (death ? 25f : 22f) + (death ? 8f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (!spazAlive) chargeSpeed += 2f; if (Main.getGoodWorld) @@ -639,9 +530,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (npc.ai[1] == 3f) { - // Set damage - npc.damage = setDamage; - npc.ai[2] += 1f; float chargeTime = spazAlive ? 45f : 30f; @@ -649,14 +537,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses chargeTime = spazAlive ? 90f : 60f; if (death) chargeTime -= chargeTime * 0.25f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio); - chargeTime -= chargeTime / 5 * enrageScale; + chargeTime -= chargeTime * (death ? 0.06f : 0f); // Slow down if (npc.ai[2] >= chargeTime) { - // Avoid cheap bullshit - npc.damage = 0; - npc.velocity *= 0.93f; if (Math.Abs(npc.velocity.X) < 0.1) @@ -670,7 +555,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[3] % 3f == 0f) { - float fireRate = spazAlive ? 13f : foveanatorAlive ? 11f : 9f; + float fireRate = spazAlive ? 13f : 9f; if (npc.ai[2] % fireRate == 0f) { SoundEngine.PlaySound(SoundID.Item33, npc.Center); @@ -678,7 +563,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float laserDartSpeed = (death ? 9f : 6f) * (spazAlive ? 1f : 1.5f); int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); + int damage = HomingDartDamage.CalculateMechDamage(); // Reduce mech boss projectile damage depending on the new ore progression changes if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) @@ -700,7 +585,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge four times float chargeGateValue = 30f; - chargeGateValue -= chargeGateValue / 4 * enrageScale; + chargeGateValue -= chargeGateValue * (death ? 0.07f : 0f); if (npc.ai[2] >= chargeTime + chargeGateValue) { npc.ai[2] = 0f; @@ -735,14 +620,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 4f) { - // Avoid cheap bullshit - npc.damage = 0; - float chargeLineUpDistance = spazAlive ? 600f : 500f; - float chargeSpeed = 18f + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAcceleration = 0.45f + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - chargeSpeed += 6f * enrageScale; - chargeAcceleration += 0.15f * enrageScale; + float chargeSpeed = (death ? 19.8f : 18f) + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = (death ? 0.495f : 0.45f) + (death ? 0.15f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (spazAlive) { @@ -779,8 +659,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) @@ -790,13 +669,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses CalamityUtils.CalamityTargeting(npc, options); } - float enrageScale = bossRush ? 0.5f : death ? 0.3f : 0f; - if (Main.IsItDay() || bossRush) - { - npc.Calamity().CurrentlyEnraged = !bossRush; - enrageScale += 1f; - } - // Percent life remaining float lifeRatio = npc.life / (float)npc.lifeMax; @@ -838,29 +710,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { for (int i = 0; i < Main.maxNPCs; i++) { - if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism || Main.npc[i].type == ModContent.NPCType()) && Main.npc[i].timeLeft - 1 > npc.timeLeft) + if (i != npc.whoAmI && Main.npc[i].active && (Main.npc[i].type == NPCID.Retinazer || Main.npc[i].type == NPCID.Spazmatism) && Main.npc[i].timeLeft - 1 > npc.timeLeft) npc.timeLeft = Main.npc[i].timeLeft - 1; } } - // Check for Oblivion in Master Mode - bool oblivionAlive = false; - if (death && !bossRush && npc.localAI[3] == 1f) - { - for (int i = 0; i < Main.maxNPCs; i++) - { - if (Main.npc[i].active && (Main.npc[i].type == ModContent.NPCType() || Main.npc[i].type == NPCID.SkeletronPrime)) - { - oblivionAlive = true; - break; - } - } - } - - bool foveanatorAlive = NPC.AnyNPCs(ModContent.NPCType()); - // Phase HP ratios - float phase2LifeRatio = oblivionAlive ? 0.5f : death ? 0.85f : 0.7f; + float phase2LifeRatio = death ? 0.85f : 0.7f; float finalPhaseLifeRatio = death ? 0.3f : 0.15f; // Movement variables @@ -872,17 +728,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float phase1MaxCursedFlamePhaseDurationDecrease = death ? 80f : 200f; float phase1MaxChargesDecrease = death ? 2f : 4f; - // If Oblivion is alive reduce aggression of all attacks - if (oblivionAlive) - { - phase1MaxSpeedIncrease = death ? 1.125f : 2.25f; - phase1MaxAccelerationIncrease = death ? 0.0375f : 0.075f; - phase1MaxChargeSpeedIncrease = death ? 1.5f : 3f; - - phase1MaxCursedFlamePhaseDurationDecrease = death ? 40f : 100f; - phase1MaxChargesDecrease = death ? 1f : 2f; - } - // Phase checks bool phase2 = lifeRatio < phase2LifeRatio; bool finalPhase = lifeRatio < finalPhaseLifeRatio; @@ -902,8 +747,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.reflectsProjectiles = false; // Despawn - bool oblivionFightDespawn = ((oblivionAlive && lifeRatio < 0.8f) || (oblivionAlive && !retAlive && lifeRatio < 0.95f)) && npc.localAI[3] == 1f; - if (Main.player[npc.target].dead || oblivionFightDespawn) + if ((Main.player[npc.target].dead || Main.IsItDay()) && !BossRushEvent.BossRushActive) { npc.velocity.Y -= 0.04f; if (npc.timeLeft > 10) @@ -919,14 +763,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Cursed fireball phase if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = 0; - // Velocity - float maxVelocity = 12f; - float acceleration = 0.4f; - maxVelocity += 6f * enrageScale; - acceleration += 0.2f * enrageScale; + float maxVelocity = death ? 13.8f : 12f; + float acceleration = death ? 0.46f : 0.4f; if (death) { @@ -940,7 +779,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses acceleration *= 1.15f; } - float distanceFromTarget = oblivionAlive ? 480f : 400f; + float distanceFromTarget = 400f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; float distanceFromDestination = (destination - npc.Center).Length(); Vector2 idealVelocity = (destination - npc.Center).SafeNormalize(Vector2.UnitX * direction); @@ -983,30 +822,17 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 0.4f; } - if (npc.ai[3] >= (oblivionAlive ? 60f : foveanatorAlive ? 45f : 30f)) + if (npc.ai[3] >= 30f) { npc.ai[3] = 0f; if (Main.netMode != NetmodeID.MultiplayerClient) { - float cursedFireballSpeed = 15f; - cursedFireballSpeed += 3f * enrageScale; + float cursedFireballSpeed = death ? 15.9f : 15f; int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } Vector2 fireballVelocity = ((Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * cursedFireballSpeed) + new Vector2(Main.rand.Next(-10, 11), Main.rand.Next(-10, 11)) * 0.05f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer); } } } @@ -1015,16 +841,10 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charging phase else if (npc.ai[1] == 1f) { - // Set damage - npc.damage = npc.defDamage; - // Rotation and velocity npc.rotation = hoverRotation; - float chargeSpeed = 18f; - chargeSpeed += 8f * enrageScale; - if (death) - chargeSpeed += phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)); + float chargeSpeed = death ? 20.4f + phase1MaxChargeSpeedIncrease * ((1f - lifeRatio) / (1f - phase2LifeRatio)) : 18f; if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -1034,17 +854,11 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } else if (npc.ai[1] == 2f) { - // Set damage - npc.damage = npc.defDamage; - npc.ai[2] += 1f; float timeBeforeSlowDown = death ? 30f : 10f; if (npc.ai[2] >= timeBeforeSlowDown) { - // Avoid cheap bullshit - npc.damage = 0; - // Slow down npc.velocity *= 0.8f; @@ -1058,7 +872,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge 8 times float chargeTime = death ? 45f : 25f; - if (npc.ai[2] >= chargeTime + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime) { // Reset AI array and go to cursed fireball phase npc.ai[3] += 1f; @@ -1066,7 +880,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = hoverRotation; - float totalCharges = foveanatorAlive ? 6f : 8f; + float totalCharges = 8f; if (death) totalCharges -= (float)Math.Round(phase1MaxChargesDecrease * ((1f - lifeRatio) / (1f - phase2LifeRatio))); @@ -1100,9 +914,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Transition phase else if (npc.ai[0] == 1f || npc.ai[0] == 2f) { - // Avoid cheap bullshit - npc.damage = 0; - if (NPC.IsMechQueenUp) npc.reflectsProjectiles = true; @@ -1131,21 +942,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = npc.ai[1] % 20f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * (oblivionAlive ? 12f : 16f) + Main.rand.NextVector2CircularEdge(3f, 3f); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, 1f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer, 0f, 1f); Main.projectile[proj].tileCollide = false; } } @@ -1204,8 +1003,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.chaseable = !retInPhase1; // Increase defense and damage - int setDamage = (int)Math.Round(npc.defDamage * 1.5); - int reducedSetDamage = (int)Math.Round(setDamage * 0.5); + npc.damage = (int)Math.Round(npc.defDamage * SpazmatismPhase2ContactDamageMult); npc.defense = npc.defDefense + 18; calamityGlobalNPC.DR = retInPhase1 ? 0.9999f : 0.2f; calamityGlobalNPC.unbreakableDR = retInPhase1; @@ -1217,13 +1015,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Shadowflamethrower phase if (npc.ai[1] == 0f) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - - float maxVelocity = 6.2f + (death ? 2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float acceleration = 0.1f + (death ? 0.03f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - maxVelocity += 3f * enrageScale; - acceleration += 0.06f * enrageScale; + float maxVelocity = (death ? 7.1f : 6.2f) + (death ? 2f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float acceleration = (death ? 0.118f : 0.1f) + (death ? 0.03f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); float distanceFromTarget = 180f; Vector2 destination = Main.player[npc.target].Center + Vector2.UnitX * distanceFromTarget * direction; @@ -1234,7 +1027,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { // Boost speed if too far from target if (distanceFromDestination > distanceFromTarget) - maxVelocity += MathHelper.Lerp(0f, oblivionAlive ? 3f : death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); + maxVelocity += MathHelper.Lerp(0f, death ? 8f : 6f, MathHelper.Clamp((distanceFromDestination - distanceFromTarget) / 1000f, 0f, 1f)); if (Main.getGoodWorld) { @@ -1275,36 +1068,22 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[3] += 1f; npc.localAI[1] = 0f; - float flamethrowerSpeed = foveanatorAlive ? 5f : 6f; - flamethrowerSpeed += 3f * enrageScale; + float flamethrowerSpeed = death ? 6.9f : 6f; float timeForFlamethrowerToReachMaxVelocity = 60f; float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); flamethrowerSpeed = MathHelper.Lerp(0.1f, flamethrowerSpeed, flamethrowerSpeedScalar); int type = npc.ai[3] % 2f == 0f ? ModContent.ProjectileType() : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } Vector2 flamethrowerVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * flamethrowerSpeed + npc.velocity * 0.5f; if (NPC.IsMechQueenUp) flamethrowerVelocity = (npc.rotation + MathHelper.PiOver2).ToRotationVector2() * flamethrowerSpeed + npc.velocity * 0.5f; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 25f, flamethrowerVelocity, type, FlamethrowerDamage.CalculateMechDamage(), 0f, Main.myPlayer); if (death && npc.ai[3] % 30f == 0f) { type = npc.ai[3] % 60f == 0f ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; - damage = npc.GetProjectileDamage(type); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity * 2f, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity * 2f, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer); } } } @@ -1332,17 +1111,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Charge if (npc.ai[1] == 1f) { - // Set damage - npc.damage = setDamage; - // Play charge sound SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); // Set rotation and velocity npc.rotation = hoverRotation; - float chargeSpeed = 18f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - chargeSpeed += 16f * enrageScale; + float chargeSpeed = (death ? 22.8f : 18f) + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (Main.getGoodWorld) chargeSpeed *= 1.2f; @@ -1355,9 +1130,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (npc.ai[1] == 2f) { - // Set damage - npc.damage = setDamage; - npc.ai[2] += retAlive ? 1f : 1.25f; float chargeTime = 30f - (death ? 10f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); @@ -1365,9 +1137,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down if (npc.ai[2] >= chargeTime) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - float deceleration = 0.85f - (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); npc.velocity *= deceleration; @@ -1380,14 +1149,14 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.rotation = npc.velocity.ToRotation() - MathHelper.PiOver2; // Charges 5 times - if (npc.ai[2] >= (chargeTime * 1.6f) + (oblivionAlive ? 15f : 0f)) + if (npc.ai[2] >= chargeTime * 1.6f) { npc.ai[3] += 1f; npc.ai[2] = 0f; npc.rotation = hoverRotation; - float totalCharges = foveanatorAlive ? 4f : 5f; + float totalCharges = 5f; if (npc.ai[3] >= totalCharges) { npc.ai[1] = 0f; @@ -1402,9 +1171,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Crazy charge else if (npc.ai[1] == 3f) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - // Reset AI array and go to shadowflamethrower phase or fireball phase if ret is dead float secondFastCharge = 4f; if (npc.ai[3] >= (retAlive ? secondFastCharge : secondFastCharge + 1f)) @@ -1423,14 +1189,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else if (Main.netMode != NetmodeID.MultiplayerClient) { // Velocity - float spazmatismPhase3ChargeSpeed = 20f + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - spazmatismPhase3ChargeSpeed += 10f * enrageScale; + float spazmatismPhase3ChargeSpeed = (death ? 23f : 20f) + (death ? 6f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (npc.ai[2] == -1f || (!retAlive && npc.ai[3] == secondFastCharge)) spazmatismPhase3ChargeSpeed *= 1.3f; if (Main.getGoodWorld) spazmatismPhase3ChargeSpeed *= 1.2f; - Vector2 distanceVector = Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center; + Vector2 distanceVector = Main.player[npc.target].Center - npc.Center; npc.velocity = distanceVector.SafeNormalize(Vector2.UnitY) * spazmatismPhase3ChargeSpeed; if (retAlive) @@ -1456,20 +1221,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float projectileSpeed = spazmatismPhase3ChargeSpeed * 0.5f; int type = (!retAlive && npc.ai[3] % 2f == 0f) ? ModContent.ProjectileType() : ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center + ((!retAlive && bossRush) ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; int numProj = 3; int spread = 15; float rotation = MathHelper.ToRadians(spread); @@ -1477,7 +1230,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses for (int i = 0; i < numProj; i++) { Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 25f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 25f, perturbedSpeed, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer); } } @@ -1489,9 +1242,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Crazy charge else if (npc.ai[1] == 4f) { - // Set damage - npc.damage = setDamage; - if (npc.ai[2] == 0f) SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); @@ -1505,9 +1255,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Slow down if (npc.ai[2] >= spazmatismRetDeadChargeSpeed) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - npc.velocity *= 0.93f; if (Math.Abs(npc.velocity.X) < 0.1) npc.velocity.X = 0f; @@ -1536,14 +1283,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Get in position for charge else if (npc.ai[1] == 5f) { - // Avoid cheap bullshit - npc.damage = reducedSetDamage; - float chargeLineUpDistance = retAlive ? 600f : 500f; - float chargeSpeed = 16f + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - float chargeAcceleration = 0.4f + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); - chargeSpeed += 5.333f * enrageScale; - chargeAcceleration += 0.133f * enrageScale; + float chargeSpeed = (death ? 17.5f : 16f) + (death ? 5f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); + float chargeAcceleration = (death ? 0.44f : 0.4f) + (death ? 0.1f * ((phase2LifeRatio - lifeRatio) / phase2LifeRatio) : 0f); if (retAlive) { @@ -1564,7 +1306,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[2] += 1f; // Fire shadowflames and cursed fireballs - float fireRate = retAlive ? 30f : foveanatorAlive ? 25f : 20f; + float fireRate = retAlive ? 30f : 20f; if (npc.ai[2] % fireRate == 0f) { npc.ai[3] += 1f; @@ -1572,21 +1314,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float projectileSpeed = 16f; int type = npc.ai[3] % 2f == 0f ? ProjectileID.CursedFlameHostile : ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert; - double secondMechMultiplier = CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center + (!retAlive && bossRush ? Main.player[npc.target].velocity * 20f : Vector2.Zero) - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 25f, projectileVelocity, type, damage, 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); + Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * projectileSpeed; + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 25f, projectileVelocity, type, FireballDamage.CalculateMechDamage(), 0f, Main.myPlayer, 0f, retAlive ? 0f : 1f); } } @@ -1605,1314 +1335,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaRetinazerAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - } - - float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; - - bool dead2 = Main.player[npc.target].dead; - float num412 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num413 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num414 = (float)Math.Atan2(num413, num412) + MathHelper.PiOver2; - if (num414 < 0f) - num414 += MathHelper.TwoPi; - else if ((double)num414 > MathHelper.TwoPi) - num414 -= MathHelper.TwoPi; - - float num415 = 0.1f; - if (npc.rotation < num414) - { - if ((double)(num414 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num415; - else - npc.rotation += num415; - } - else if (npc.rotation > num414) - { - if ((double)(npc.rotation - num414) > MathHelper.Pi) - npc.rotation += num415; - else - npc.rotation -= num415; - } - - if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) - npc.rotation = num414; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num414 - num415 && npc.rotation < num414 + num415) - npc.rotation = num414; - - if (Main.rand.NextBool(5)) - { - int num416 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num416].velocity.X *= 0.5f; - Main.dust[num416].velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead2 && npc.timeLeft < 10) - { - for (int num417 = 0; num417 < Main.maxNPCs; num417++) - { - if (num417 != npc.whoAmI && Main.npc[num417].active && (Main.npc[num417].type == NPCID.Retinazer || Main.npc[num417].type == NPCID.Spazmatism)) - npc.DiscourageDespawn(Main.npc[num417].timeLeft - 1); - } - } - - Vector2 vector41 = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter = nPC.GetMechQueenCenter(); - Vector2 vector42 = new Vector2(-150f, -250f); - vector42 *= 0.75f; - float num418 = nPC.velocity.X * 0.025f; - vector41 = mechQueenCenter + vector42; - vector41 = vector41.RotatedBy(num418, mechQueenCenter); - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead2) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num419 = 7f; - float num420 = 0.1f; - if (Main.expertMode) - { - num419 = Main.masterMode ? 9.5f : 8.25f; - num420 = Main.masterMode ? 0.13f : 0.115f; - } - - if (Main.getGoodWorld) - { - num419 *= 1.15f; - num420 *= 1.15f; - } - - int num421 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num421 = -1; - - Vector2 vector43 = npc.Center; - float num422 = Main.player[npc.target].Center.X + (float)(num421 * 300) - vector43.X; - float num423 = Main.player[npc.target].Center.Y - 300f - vector43.Y; - if (NPC.IsMechQueenUp) - { - num419 = 14f; - num422 = vector41.X; - num423 = vector41.Y; - num422 -= vector43.X; - num423 -= vector43.Y; - } - - float num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); - float num425 = num424; - if (NPC.IsMechQueenUp) - { - if (num424 > num419) - { - num424 = num419 / num424; - num422 *= num424; - num423 *= num424; - } - - float num426 = 60f; - npc.velocity.X = (npc.velocity.X * (num426 - 1f) + num422) / num426; - npc.velocity.Y = (npc.velocity.Y * (num426 - 1f) + num423) / num426; - } - else - { - num424 = num419 / num424; - num422 *= num424; - num423 *= num424; - if (npc.velocity.X < num422) - { - npc.velocity.X += num420; - if (npc.velocity.X < 0f && num422 > 0f) - npc.velocity.X += num420; - } - else if (npc.velocity.X > num422) - { - npc.velocity.X -= num420; - if (npc.velocity.X > 0f && num422 < 0f) - npc.velocity.X -= num420; - } - - if (npc.velocity.Y < num423) - { - npc.velocity.Y += num420; - if (npc.velocity.Y < 0f && num423 > 0f) - npc.velocity.Y += num420; - } - else if (npc.velocity.Y > num423) - { - npc.velocity.Y -= num420; - if (npc.velocity.Y > 0f && num423 < 0f) - npc.velocity.Y -= num420; - } - } - - int num427 = 600; - int num428 = 60; - if (NPC.IsMechQueenUp) - { - num427 = 1200; - num428 = ((!NPC.npcsFoundForCheckActive[NPCID.TheDestroyerBody]) ? 90 : 120); - } - - if (Main.expertMode) - num428 = (int)(num428 * 0.8f); - - if (Main.masterMode) - num427 /= 2; - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num427) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - else if (npc.position.Y + (float)npc.height < Main.player[npc.target].position.Y && num425 < (Main.masterMode ? 720f : Main.expertMode ? 560f : 400f)) - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - - if (Main.expertMode) - npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 2.5f : 1.5f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - npc.ai[3] += 0.5f; - } - - if (npc.ai[3] >= (float)num428) - { - npc.ai[3] = 0f; - vector43 = npc.Center; - num422 = Main.player[npc.target].Center.X - vector43.X; - num423 = Main.player[npc.target].Center.Y - vector43.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num429 = Main.expertMode ? 10.5f : 9f; - int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num424 = (float)Math.Sqrt(num422 * num422 + num423 * num423); - num424 = num429 / num424; - num422 *= num424; - num423 *= num424; - int inaccuracy = Main.masterMode ? 3 : Main.expertMode ? 6 : 9; - num422 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; - num423 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.08f; - - Vector2 laserVelocity = new Vector2(num422, num423); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector43 + laserVelocity.SafeNormalize(Vector2.UnitY) * 90f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num414; - float num432 = 12f; - if (Main.expertMode) - num432 = Main.masterMode ? 18f : 15f; - - if (Main.getGoodWorld) - num432 += 2f; - - Vector2 vector44 = npc.Center; - float num433 = Main.player[npc.target].Center.X - vector44.X; - float num434 = Main.player[npc.target].Center.Y - vector44.Y; - float num435 = (float)Math.Sqrt(num433 * num433 + num434 * num434); - num435 = num432 / num435; - npc.velocity.X = num433 * num435; - npc.velocity.Y = num434 * num435; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - float decelerateGateValue = Main.masterMode ? 38f : Main.expertMode ? 32f : 25f; - if (npc.ai[2] >= decelerateGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.92f : 0.96f; - npc.velocity *= decelerationMultiplier; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float delayBeforeChargingAgain = Main.masterMode ? 47f : Main.expertMode ? 56f : 70f; - if (npc.ai[2] >= delayBeforeChargingAgain) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num414; - float numCharges = Main.masterMode ? 6f : Main.expertMode ? 5f : 4f; - if (npc.ai[3] >= numCharges) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (npc.life < npc.lifeMax * phase2LifeRatio) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - - npc.ai[1] += 1f; - if (Main.masterMode && npc.ai[2] >= 0.2f) - { - if (npc.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 7f; - int numProj = 3; - int spread = 10; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 90f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - } - } - } - } - - if (npc.ai[1] >= 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num436 = 0; num436 < 2; num436++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 143); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num437 = 0; num437 < 20; num437++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - // Avoid cheap bullshit - npc.damage = 0; - - npc.defense = npc.defDefense + 10; - npc.HitSound = SoundID.NPCHit4; - - if (npc.ai[1] == 0f) - { - float num438 = 8f; - float num439 = 0.15f; - if (Main.expertMode) - { - num438 = Main.masterMode ? 11f : 9.5f; - num439 = Main.masterMode ? 0.2f : 0.175f; - } - - if (Main.getGoodWorld) - { - num438 *= 1.15f; - num439 *= 1.15f; - } - - Vector2 vector45 = npc.Center; - float num440 = Main.player[npc.target].Center.X - vector45.X; - float num441 = Main.player[npc.target].Center.Y - 420f - vector45.Y; - if (NPC.IsMechQueenUp) - { - num438 = 14f; - num440 = vector41.X; - num441 = vector41.Y; - num440 -= vector45.X; - num441 -= vector45.Y; - } - - float num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); - if (NPC.IsMechQueenUp) - { - if (num442 > num438) - { - num442 = num438 / num442; - num440 *= num442; - num441 *= num442; - } - - npc.velocity.X = (npc.velocity.X * 4f + num440) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num441) / 5f; - } - else - { - num442 = num438 / num442; - num440 *= num442; - num441 *= num442; - if (npc.velocity.X < num440) - { - npc.velocity.X += num439; - if (npc.velocity.X < 0f && num440 > 0f) - npc.velocity.X += num439; - } - else if (npc.velocity.X > num440) - { - npc.velocity.X -= num439; - if (npc.velocity.X > 0f && num440 < 0f) - npc.velocity.X -= num439; - } - - if (npc.velocity.Y < num441) - { - npc.velocity.Y += num439; - if (npc.velocity.Y < 0f && num441 > 0f) - npc.velocity.Y += num439; - } - else if (npc.velocity.Y > num441) - { - npc.velocity.Y -= num439; - if (npc.velocity.Y > 0f && num441 < 0f) - npc.velocity.Y -= num439; - } - } - - int num443 = 300; - if (NPC.IsMechQueenUp) - num443 = 1200; - - if (Main.masterMode) - num443 = (int)(num443 * 0.8f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num443) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - vector45 = npc.Center; - num440 = Main.player[npc.target].Center.X - vector45.X; - num441 = Main.player[npc.target].Center.Y - vector45.Y; - npc.rotation = (float)Math.Atan2(num441, num440) - MathHelper.PiOver2; - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 7f : Main.expertMode ? 6f : 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 180f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 0f; - float num444 = Main.expertMode ? 10f : 8.5f; - int type = ProjectileID.DeathLaser; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num442 = (float)Math.Sqrt(num440 * num440 + num441 * num441); - num442 = num444 / num442; - num440 *= num442; - num441 *= num442; - - Vector2 laserVelocity = new Vector2(num440, num441); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector45 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - - return false; - } - - int num447 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num447 = -1; - - float num448 = 8f; - float num449 = 0.2f; - if (Main.expertMode) - { - num448 = Main.masterMode ? 11f : 9.5f; - num449 = Main.masterMode ? 0.3f : 0.25f; - } - - if (Main.getGoodWorld) - { - num448 *= 1.15f; - num449 *= 1.15f; - } - - Vector2 vector46 = npc.Center; - float num450 = Main.player[npc.target].Center.X + (num447 * 420f) - vector46.X; - float num451 = Main.player[npc.target].Center.Y - vector46.Y; - float num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); - num452 = num448 / num452; - num450 *= num452; - num451 *= num452; - if (npc.velocity.X < num450) - { - npc.velocity.X += num449; - if (npc.velocity.X < 0f && num450 > 0f) - npc.velocity.X += num449; - } - else if (npc.velocity.X > num450) - { - npc.velocity.X -= num449; - if (npc.velocity.X > 0f && num450 < 0f) - npc.velocity.X -= num449; - } - - if (npc.velocity.Y < num451) - { - npc.velocity.Y += num449; - if (npc.velocity.Y < 0f && num451 > 0f) - npc.velocity.Y += num449; - } - else if (npc.velocity.Y > num451) - { - npc.velocity.Y -= num449; - if (npc.velocity.Y > 0f && num451 < 0f) - npc.velocity.Y -= num449; - } - - vector46 = npc.Center; - num450 = Main.player[npc.target].Center.X - vector46.X; - num451 = Main.player[npc.target].Center.Y - vector46.Y; - npc.rotation = (float)Math.Atan2(num451, num450) - MathHelper.PiOver2; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, Main.masterMode ? 6f : Main.expertMode ? 5.25f : 3.75f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 60f && Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[1] = 0f; - float num453 = 9f; - int type = ProjectileID.DeathLaser; - int damage = (int)Math.Round(npc.GetProjectileDamage(type) * 0.75); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num452 = (float)Math.Sqrt(num450 * num450 + num451 * num451); - num452 = num453 / num452; - num450 *= num452; - num451 *= num452; - - Vector2 laserVelocity = new Vector2(num450, num451); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector46 + laserVelocity.SafeNormalize(Vector2.UnitY) * 120f, laserVelocity, type, damage, 0f, Main.myPlayer); - } - } - - npc.ai[2] += 1f; - float rapidLaserPhaseGateValue = Main.masterMode ? 120f : Main.expertMode ? 150f : 180f; - if (npc.ai[2] >= rapidLaserPhaseGateValue) - { - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.aggroRatio = -1f; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - public static bool VanillaSpazmatismAI(NPC npc, Mod mod) - { - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - { - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - } - - float phase2LifeRatio = Main.masterMode ? 0.6f : 0.4f; - - bool dead3 = Main.player[npc.target].dead; - float num456 = npc.Center.X - Main.player[npc.target].position.X - (float)(Main.player[npc.target].width / 2); - float num457 = npc.position.Y + (float)npc.height - 59f - Main.player[npc.target].position.Y - (float)(Main.player[npc.target].height / 2); - float num458 = (float)Math.Atan2(num457, num456) + MathHelper.PiOver2; - if (num458 < 0f) - num458 += MathHelper.TwoPi; - else if ((double)num458 > MathHelper.TwoPi) - num458 -= MathHelper.TwoPi; - - float num459 = 0.15f; - if (NPC.IsMechQueenUp && npc.ai[0] == 3f && npc.ai[1] == 0f) - num459 *= 0.25f; - - if (npc.rotation < num458) - { - if ((double)(num458 - npc.rotation) > MathHelper.Pi) - npc.rotation -= num459; - else - npc.rotation += num459; - } - else if (npc.rotation > num458) - { - if ((double)(npc.rotation - num458) > MathHelper.Pi) - npc.rotation += num459; - else - npc.rotation -= num459; - } - - if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) - npc.rotation = num458; - - if (npc.rotation < 0f) - npc.rotation += MathHelper.TwoPi; - else if ((double)npc.rotation > MathHelper.TwoPi) - npc.rotation -= MathHelper.TwoPi; - - if (npc.rotation > num458 - num459 && npc.rotation < num458 + num459) - npc.rotation = num458; - - if (Main.rand.NextBool(5)) - { - int num460 = Dust.NewDust(new Vector2(npc.position.X, npc.position.Y + (float)npc.height * 0.25f), npc.width, (int)((float)npc.height * 0.5f), DustID.Blood, npc.velocity.X, 2f); - Main.dust[num460].velocity.X *= 0.5f; - Main.dust[num460].velocity.Y *= 0.1f; - } - - if (Main.netMode != NetmodeID.MultiplayerClient && !Main.IsItDay() && !dead3 && npc.timeLeft < 10) - { - for (int num461 = 0; num461 < Main.maxNPCs; num461++) - { - if (num461 != npc.whoAmI && Main.npc[num461].active && (Main.npc[num461].type == NPCID.Retinazer || Main.npc[num461].type == NPCID.Spazmatism)) - npc.DiscourageDespawn(Main.npc[num461].timeLeft - 1); - } - } - - Vector2 vector47 = Vector2.Zero; - if (NPC.IsMechQueenUp) - { - NPC nPC2 = Main.npc[NPC.mechQueen]; - Vector2 mechQueenCenter2 = nPC2.GetMechQueenCenter(); - Vector2 vector48 = new Vector2(150f, -250f); - vector48 *= 0.75f; - float num462 = nPC2.velocity.X * 0.025f; - vector47 = mechQueenCenter2 + vector48; - vector47 = vector47.RotatedBy(num462, mechQueenCenter2); - } - - npc.reflectsProjectiles = false; - if (Main.IsItDay() || dead3) - { - npc.velocity.Y -= 0.04f; - npc.EncourageDespawn(10); - return false; - } - - if (npc.ai[0] == 0f) - { - if (npc.ai[1] == 0f) - { - // Avoid cheap bullshit - npc.damage = 0; - - float num463 = 12f; - float num464 = 0.4f; - if (Main.expertMode) - { - num463 = Main.masterMode ? 13.2f : 12.6f; - num464 = Main.masterMode ? 0.48f : 0.44f; - } - - if (Main.getGoodWorld) - { - num463 *= 1.15f; - num464 *= 1.15f; - } - - int num465 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num465 = -1; - - Vector2 vector49 = npc.Center; - float num466 = Main.player[npc.target].Center.X + (float)(num465 * 400) - vector49.X; - float num467 = Main.player[npc.target].Center.Y - vector49.Y; - if (NPC.IsMechQueenUp) - { - num463 = 14f; - num466 = vector47.X; - num467 = vector47.Y; - num466 -= vector49.X; - num467 -= vector49.Y; - } - - float num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); - float num469 = num468; - if (NPC.IsMechQueenUp) - { - if (num468 > num463) - { - num468 = num463 / num468; - num466 *= num468; - num467 *= num468; - } - - npc.velocity.X = (npc.velocity.X * 4f + num466) / 5f; - npc.velocity.Y = (npc.velocity.Y * 4f + num467) / 5f; - } - else - { - num468 = num463 / num468; - num466 *= num468; - num467 *= num468; - if (npc.velocity.X < num466) - { - npc.velocity.X += num464; - if (npc.velocity.X < 0f && num466 > 0f) - npc.velocity.X += num464; - } - else if (npc.velocity.X > num466) - { - npc.velocity.X -= num464; - if (npc.velocity.X > 0f && num466 < 0f) - npc.velocity.X -= num464; - } - - if (npc.velocity.Y < num467) - { - npc.velocity.Y += num464; - if (npc.velocity.Y < 0f && num467 > 0f) - npc.velocity.Y += num464; - } - else if (npc.velocity.Y > num467) - { - npc.velocity.Y -= num464; - if (npc.velocity.Y > 0f && num467 < 0f) - npc.velocity.Y -= num464; - } - } - - int num470 = 600; - if (NPC.IsMechQueenUp) - num470 = 1200; - - if (Main.masterMode) - num470 = (int)(num470 * 0.75f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num470) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - else - { - if (!Main.player[npc.target].dead) - { - npc.ai[3] += 1f; - - if (Main.expertMode) - npc.ai[3] += MathHelper.Lerp(0f, Main.masterMode ? 1.8f : 1.2f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - npc.ai[3] += 0.4f; - } - - if (npc.ai[3] >= 60f) - { - npc.ai[3] = 0f; - vector49 = npc.Center; - num466 = Main.player[npc.target].Center.X - vector49.X; - num467 = Main.player[npc.target].Center.Y - vector49.Y; - if (Main.netMode != NetmodeID.MultiplayerClient) - { - float num471 = Main.expertMode ? 14f : 12f; - int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - num468 = (float)Math.Sqrt(num466 * num466 + num467 * num467); - num468 = num471 / num468; - num466 *= num468; - num467 *= num468; - int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; - num466 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; - num467 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.05f; - - Vector2 fireballVelocity = new Vector2(num466, num467); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector49 + fireballVelocity.SafeNormalize(Vector2.UnitY) * 50f, fireballVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.rotation = num458; - float num474 = 13f; - - if (Main.expertMode) - num474 += MathHelper.Lerp(0f, Main.masterMode ? 11.2f : 5.6f, 1f - (npc.life / (float)npc.lifeMax - phase2LifeRatio) / (1f - phase2LifeRatio)); - - if (Main.getGoodWorld) - num474 *= 1.2f; - - Vector2 vector50 = npc.Center; - float num475 = Main.player[npc.target].Center.X - vector50.X; - float num476 = Main.player[npc.target].Center.Y - vector50.Y; - float num477 = (float)Math.Sqrt(num475 * num475 + num476 * num476); - num477 = num474 / num477; - npc.velocity.X = num475 * num477; - npc.velocity.Y = num476 * num477; - npc.ai[1] = 2f; - } - else if (npc.ai[1] == 2f) - { - // Set damage - npc.damage = npc.defDamage; - - npc.ai[2] += 1f; - float decelerateGateValue = Main.masterMode ? 12f : Main.expertMode ? 10f : 8f; - if (npc.ai[2] >= decelerateGateValue) - { - // Avoid cheap bullshit - npc.damage = 0; - - float decelerationMultiplier = Main.masterMode ? 0.78f : Main.expertMode ? 0.85f : 0.9f; - npc.velocity *= decelerationMultiplier; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - float delayBeforeChargingAgain = Main.masterMode ? 28f : Main.expertMode ? 34f : 42f; - if (npc.ai[2] >= delayBeforeChargingAgain) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num458; - float numCharges = Main.masterMode ? 6f : Main.expertMode ? 8f : 10f; - if (npc.ai[3] >= numCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - } - } - - if (npc.life < npc.lifeMax * phase2LifeRatio) - { - npc.ai[0] = 1f; - npc.ai[1] = 0f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - - CalamityTargetingParameters options = CalamityTargetingParameters.BossDefaults; - options.finishThemOff = true; - CalamityUtils.CalamityTargeting(npc, options); - - npc.netUpdate = true; - } - - return false; - } - - if (npc.ai[0] == 1f || npc.ai[0] == 2f) - { - // Avoid cheap bullshit - npc.damage = 0; - - if (NPC.IsMechQueenUp) - npc.reflectsProjectiles = true; - - if (npc.ai[0] == 1f) - { - npc.ai[2] += 0.005f; - if ((double)npc.ai[2] > 0.5) - npc.ai[2] = 0.5f; - } - else - { - npc.ai[2] -= 0.005f; - if (npc.ai[2] < 0f) - npc.ai[2] = 0f; - } - - npc.rotation += npc.ai[2]; - - npc.ai[1] += 1f; - if (Main.masterMode && npc.ai[2] >= 0.2f) - { - if (npc.ai[1] % 10f == 0f) - { - if (Main.netMode != NetmodeID.MultiplayerClient) - { - int type = ProjectileID.CursedFlameHostile; - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * 16f + Main.rand.NextVector2CircularEdge(3f, 3f); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f, projectileVelocity, type, damage, 0f, Main.myPlayer); - Main.projectile[proj].tileCollide = false; - } - } - } - - if (npc.ai[1] >= 100f) - { - npc.ai[0] += 1f; - npc.ai[1] = 0f; - if (npc.ai[0] == 3f) - { - npc.ai[2] = 0f; - } - else - { - SoundEngine.PlaySound(SoundID.NPCHit1, npc.Center); - for (int num478 = 0; num478 < 2; num478++) - { - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 144); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 7); - Gore.NewGore(npc.GetSource_FromAI(), npc.position, new Vector2((float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f), 6); - } - - for (int num479 = 0; num479 < 20; num479++) - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - } - } - - Dust.NewDust(npc.position, npc.width, npc.height, DustID.Blood, (float)Main.rand.Next(-30, 31) * 0.2f, (float)Main.rand.Next(-30, 31) * 0.2f); - - npc.velocity *= 0.98f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - - return false; - } - - npc.HitSound = SoundID.NPCHit4; - int setDamage = (int)Math.Round(npc.defDamage * 1.5); - int reducedSetDamage = (int)Math.Round(setDamage * 0.5); - npc.defense = npc.defDefense + 18; - - if (npc.ai[1] == 0f) - { - // Bites your fucking ass - npc.damage = reducedSetDamage; - - float num480 = 4f; - float num481 = Main.masterMode ? 0.12f : 0.1f; - int num482 = 1; - if (npc.Center.X < Main.player[npc.target].position.X + (float)Main.player[npc.target].width) - num482 = -1; - - Vector2 vector51 = npc.Center; - int flamethrowerDistance = 180; - float num483 = Main.player[npc.target].Center.X + (float)(num482 * flamethrowerDistance) - vector51.X; - float num484 = Main.player[npc.target].Center.Y - vector51.Y; - float num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - if (!NPC.IsMechQueenUp) - { - if (num485 > flamethrowerDistance) - num480 += MathHelper.Lerp(0f, Main.masterMode ? 8f : 6f, MathHelper.Clamp((num485 - flamethrowerDistance) / 1000f, 0f, 1f)); - - if (Main.getGoodWorld) - { - num480 *= 1.15f; - num481 *= 1.15f; - } - - num485 = num480 / num485; - num483 *= num485; - num484 *= num485; - if (npc.velocity.X < num483) - { - npc.velocity.X += num481; - if (npc.velocity.X < 0f && num483 > 0f) - npc.velocity.X += num481; - } - else if (npc.velocity.X > num483) - { - npc.velocity.X -= num481; - if (npc.velocity.X > 0f && num483 < 0f) - npc.velocity.X -= num481; - } - - if (npc.velocity.Y < num484) - { - npc.velocity.Y += num481; - if (npc.velocity.Y < 0f && num484 > 0f) - npc.velocity.Y += num481; - } - else if (npc.velocity.Y > num484) - { - npc.velocity.Y -= num481; - if (npc.velocity.Y > 0f && num484 < 0f) - npc.velocity.Y -= num481; - } - } - - int num486 = 400; - if (NPC.IsMechQueenUp) - num486 = 1200; - - if (Main.masterMode) - num486 = (int)(num486 * 0.8f); - - npc.ai[2] += 1f; - if (npc.ai[2] >= (float)num486) - { - npc.ai[1] = 1f; - npc.ai[2] = 0f; - npc.ai[3] = 0f; - npc.netUpdate = true; - } - - if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - { - npc.localAI[2] += 1f; - if (npc.localAI[2] > 22f) - { - npc.localAI[2] = 0f; - SoundEngine.PlaySound(SoundID.Item34, npc.Center); - } - - if (Main.netMode != NetmodeID.MultiplayerClient) - { - npc.localAI[1] += 1f; - - npc.localAI[1] += MathHelper.Lerp(0f, 5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio); - - if (npc.localAI[1] > 8f) - { - npc.localAI[1] = 0f; - float num487 = 6f + (Main.expertMode ? MathHelper.Lerp(0f, Main.masterMode ? 3f : 1.5f, 1f - (npc.life / (float)npc.lifeMax) / phase2LifeRatio) : 0f); - float timeForFlamethrowerToReachMaxVelocity = 60f; - float flamethrowerSpeedScalar = MathHelper.Clamp(npc.ai[2] / timeForFlamethrowerToReachMaxVelocity, 0f, 1f); - num487 = MathHelper.Lerp(0.1f, num487, flamethrowerSpeedScalar); - int type = ModContent.ProjectileType(); - int damage = npc.GetProjectileDamage(type); - - // Reduce mech boss projectile damage depending on the new ore progression changes - if (CalamityServerConfig.Instance.EarlyHardmodeProgressionRework && !BossRushEvent.BossRushActive) - { - double firstMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkFirstMechStatMultiplier_Classic; - double secondMechMultiplier = Main.expertMode ? CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Expert : CalamityGlobalNPC.EarlyHardmodeProgressionReworkSecondMechStatMultiplier_Classic; - if (!NPC.downedMechBossAny) - damage = (int)(damage * firstMechMultiplier); - else if ((!NPC.downedMechBoss1 && !NPC.downedMechBoss2) || (!NPC.downedMechBoss2 && !NPC.downedMechBoss3) || (!NPC.downedMechBoss3 && !NPC.downedMechBoss1)) - damage = (int)(damage * secondMechMultiplier); - } - - vector51 = npc.Center; - num483 = Main.player[npc.target].Center.X - vector51.X; - num484 = Main.player[npc.target].Center.Y - vector51.Y; - num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - num485 = num487 / num485; - num483 *= num485; - num484 *= num485; - int inaccuracy = Main.masterMode ? 10 : Main.expertMode ? 15 : 20; - num484 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; - num483 += (float)Main.rand.Next(-inaccuracy, inaccuracy + 1) * 0.01f; - num484 += npc.velocity.Y * 0.5f; - num483 += npc.velocity.X * 0.5f; - - if (NPC.IsMechQueenUp) - { - Vector2 vector52 = (npc.rotation + (float)Math.PI / 2f).ToRotationVector2() * num487 + npc.velocity * 0.5f; - num483 = vector52.X; - num484 = vector52.Y; - vector51 = npc.Center - vector52 * 3f; - } - - Vector2 flamethrowerVelocity = new Vector2(num483, num484); - Projectile.NewProjectile(npc.GetSource_FromAI(), vector51 + flamethrowerVelocity.SafeNormalize(Vector2.UnitY) * 50f, flamethrowerVelocity, type, damage, 0f, Main.myPlayer); - } - } - } - - if (NPC.IsMechQueenUp) - { - num480 = 14f; - num483 = Main.player[npc.target].position.X + (float)(Main.player[npc.target].width / 2) - vector51.X; - num484 = Main.player[npc.target].position.Y + (float)(Main.player[npc.target].height / 2) - 300f - vector51.Y; - num483 = vector47.X; - num484 = vector47.Y; - num483 -= vector51.X; - num484 -= vector51.Y; - num485 = (float)Math.Sqrt(num483 * num483 + num484 * num484); - if (num485 > num480) - { - num485 = num480 / num485; - num483 *= num485; - num484 *= num485; - } - - int num490 = 60; - npc.velocity.X = (npc.velocity.X * (float)(num490 - 1) + num483) / (float)num490; - npc.velocity.Y = (npc.velocity.Y * (float)(num490 - 1) + num484) / (float)num490; - } - } - else if (npc.ai[1] == 1f) - { - // Set damage - npc.damage = setDamage; - - SoundEngine.PlaySound(SoundID.ForceRoar, npc.Center); - npc.rotation = num458; - float num491 = 14f; - if (Main.expertMode) - num491 += 2.5f; - if (Main.masterMode) - num491 += 3.5f; - - Vector2 vector53 = npc.Center; - float num492 = Main.player[npc.target].Center.X - vector53.X; - float num493 = Main.player[npc.target].Center.Y - vector53.Y; - float num494 = (float)Math.Sqrt(num492 * num492 + num493 * num493); - num494 = num491 / num494; - npc.velocity.X = num492 * num494; - npc.velocity.Y = num493 * num494; - npc.ai[1] = 2f; - } - else - { - if (npc.ai[1] != 2f) - return false; - - // Set damage - npc.damage = setDamage; - - npc.ai[2] += 1f; - if (Main.expertMode) - npc.ai[2] += 0.5f; - if (Main.masterMode) - npc.ai[2] += 0.5f; - - if (npc.ai[2] >= 50f) - { - // Bites your fucking ass - npc.damage = reducedSetDamage; - - npc.velocity *= 0.93f; - if ((double)npc.velocity.X > -0.1 && (double)npc.velocity.X < 0.1) - npc.velocity.X = 0f; - - if ((double)npc.velocity.Y > -0.1 && (double)npc.velocity.Y < 0.1) - npc.velocity.Y = 0f; - } - else - npc.rotation = (float)Math.Atan2(npc.velocity.Y, npc.velocity.X) - MathHelper.PiOver2; - - if (npc.ai[2] >= 80f) - { - npc.ai[3] += 1f; - npc.ai[2] = 0f; - npc.rotation = num458; - float numCharges = Main.masterMode ? Main.rand.Next(4, 7) : 6f; - if (npc.ai[3] >= numCharges) - { - npc.ai[1] = 0f; - npc.ai[3] = 0f; - } - else - npc.ai[1] = 1f; - - // Due to the random number of charges in Master Mode - if (Main.masterMode) - npc.netUpdate = true; - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs index 9b0df45190..e1fe967125 100644 --- a/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs +++ b/NPCs/VanillaNPCAIOverrides/Bosses/WallOfFleshAI.cs @@ -16,12 +16,18 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses public const float TotalLasersPerBarrage = 3f; public const float EnragedLaserFiringDuration = 300f; + // Rev+ exclusive + public static int LaserDamage = 15; // 60 (modified to be always at maximum Expert damage and does not scale) + public static int SickleDamage = 22; // 88 + + // Death exclusive + public static int FireballDamage = 18; // 108 + public static bool BuffedWallofFleshAI(NPC npc, Mod mod) { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Despawn if (npc.position.X < 160f || npc.position.X > ((Main.maxTilesX - 10) * 16)) @@ -88,9 +94,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.ai[1] += 1f; if (phase3) npc.ai[1] += 1f; - if (bossRush) - npc.ai[1] += 3f; - if (CalamityWorld.LegendaryMode) + if (Main.getGoodWorld) npc.ai[1] += 9f; if (npc.ai[1] > 2700f) @@ -122,8 +126,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses Vector2 projectileVelocity = (Main.player[npc.target].Center - npc.Center).SafeNormalize(Vector2.UnitY) * npc.velocity.Length(); Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * 50f; - int damage = npc.GetProjectileDamage(ProjectileID.DemonSickle); - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, damage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, ProjectileID.DemonSickle, SickleDamage, 0f, Main.myPlayer, 0f, projectileVelocity.Length() * 3f); Main.projectile[proj].timeLeft = 600; Main.projectile[proj].tileCollide = false; @@ -134,7 +137,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ProjectileID.Fireball; - damage = npc.GetProjectileDamage(type); int numProj = 3; int spread = 15; float rotation = MathHelper.ToRadians(spread); @@ -143,7 +145,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { Vector2 randomVelocity = Main.rand.NextVector2CircularEdge(fireballVelocity, fireballVelocity); Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, j / (float)(numProj - 1))) + randomVelocity; - Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(npc.GetSource_FromAI(), npc.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 50f, perturbedSpeed, type, FireballDamage, 0f, Main.myPlayer); } } } @@ -252,9 +254,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses float timeBeforeEnrage = death ? (150f - 130f * (1f - lifeRatio)) : 600f; float speedMult = 1f; - if (bossRush) - timeBeforeEnrage *= 0.25f; - if (calamityGlobalNPC.newAI[0] < timeBeforeEnrage) { if (distanceFromTarget > halfAverageScreenWidth) @@ -304,24 +303,21 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses calamityGlobalNPC.CurrentlyEnraged = distanceFromTarget > halfAverageScreenWidth || npc.ai[3] == 1f; - if (bossRush) - speedMult += 0.2f; - - float masterModeVelocityBoost = 0f; + float deathModeVelocityBoost = 0f; if (death) { float velocityBoostStartDistance = distanceBeforeSlowingDown; float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); - masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); + deathModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); } // NOTE: Max velocity is 8 in Expert Mode // NOTE: Max velocity is 9 in For The Worthy float velocityBoost = 4f * (1f - lifeRatio); - float velocityX = (bossRush ? 7f : death ? 3.5f : 2f) + masterModeVelocityBoost + velocityBoost; + float velocityX = (death ? 3.5f : 2f) + deathModeVelocityBoost + velocityBoost; velocityX *= speedMult; if (death) @@ -439,9 +435,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Range of 64 to 268 chance *= 2; - if (bossRush) - chance /= 4; - else if (death) + if (death) chance /= 2; if (chance < 2) @@ -548,8 +542,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; CalamityUtils.CalamityTargeting(npc, default); float acceleration = death ? 0.15f : 0.12f; @@ -558,13 +551,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.defense = npc.defDefense; if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) { - npc.damage = death ? 180 : 120; + npc.damage = npc.defDamage * 2; npc.defense = 30; acceleration += death ? 0.1f : 0.08f; } else if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) { - npc.damage = death ? 135 : 90; + npc.damage = (int)Math.Round(npc.defDamage * 1.5f); npc.defense = 20; acceleration += death ? 0.05f : 0.04f; } @@ -702,8 +695,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { CalamityGlobalNPC calamityGlobalNPC = npc.Calamity(); - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Avoid cheap bullshit npc.damage = 0; @@ -730,9 +722,9 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses // Velocity, direction, and position bool shouldFireLasers = true; float phase2LifeRatio = 0.5f; - bool masterModeDetach = lifeRatio < phase2LifeRatio && death; + bool deathModeDetach = lifeRatio < phase2LifeRatio && death; bool canHit = Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height); - if (!masterModeDetach) + if (!deathModeDetach) { npc.position.X = Main.npc[Main.wofNPCIndex].position.X; npc.direction = Main.npc[Main.wofNPCIndex].direction; @@ -814,8 +806,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses } Vector2 eyeLocation = npc.Center; - float predictionAmount = MathHelper.Lerp(0f, 20f, (float)Math.Sqrt(1f - lifeRatio)); - Vector2 lookAt = Main.player[npc.target].Center + (bossRush ? (Main.player[npc.target].velocity * predictionAmount) : Vector2.Zero); + Vector2 lookAt = Main.player[npc.target].Center; float eyeTargetX = lookAt.X - eyeLocation.X; float eyeTargetY = lookAt.Y - eyeLocation.Y; float wallVelocity = (float)Math.Sqrt(eyeTargetX * eyeTargetX + eyeTargetY * eyeTargetY); @@ -832,7 +823,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { npc.rotation = 0f; - if (!masterModeDetach) + if (!deathModeDetach) shouldFireLasers = false; } } @@ -843,7 +834,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses else { npc.rotation = 0f; - if (!masterModeDetach) + if (!deathModeDetach) shouldFireLasers = false; } @@ -880,7 +871,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses npc.localAI[1] = 0f; } } - else if (npc.localAI[1] > 45f && (canHit || masterModeDetach) && !charging) + else if (npc.localAI[1] > 45f && (canHit || deathModeDetach) && !charging) { npc.localAI[1] = 0f; npc.localAI[2] += 1f; @@ -891,14 +882,13 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses { float velocity = (fireEnragedLasers ? 3f : 4f) + shootBoost; int projectileType = ProjectileID.EyeLaser; - int damage = npc.GetProjectileDamage(projectileType); bool targetTooClose = npc.Distance(Main.player[npc.target].Center) < 160f; float projectileOffset = targetTooClose ? 60f : 150f; Vector2 projectileVelocity = (lookAt - npc.Center).SafeNormalize(Vector2.UnitY) * velocity; Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileOffset; - int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, damage, 0f, Main.myPlayer, 1f, 0f); + int proj = Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, projectileType, LaserDamage, 0f, Main.myPlayer, 1f, 0f); Main.projectile[proj].timeLeft = 900; if (!canHit) @@ -909,626 +899,5 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses return false; } - - public static bool VanillaWallofFleshAI(NPC npc, Mod mod) - { - if (npc.position.X < 160f || npc.position.X > (float)((Main.maxTilesX - 10) * 16)) - npc.active = false; - - if (npc.localAI[0] == 0f) - { - npc.localAI[0] = 1f; - Main.wofDrawAreaBottom = -1; - Main.wofDrawAreaTop = -1; - } - - if (Main.getGoodWorld && Main.netMode != NetmodeID.MultiplayerClient && Main.rand.NextBool(180) && NPC.CountNPCS(NPCID.FireImp) < 4) - { - int num349 = 1; - for (int num350 = 0; num350 < num349; num350++) - { - int num351 = 1000; - for (int num352 = 0; num352 < num351; num352++) - { - int num353 = (int)(npc.Center.X / 16f); - int num354 = (int)(npc.Center.Y / 16f); - if (npc.target >= 0) - { - num353 = (int)(Main.player[npc.target].Center.X / 16f); - num354 = (int)(Main.player[npc.target].Center.Y / 16f); - } - - num353 += Main.rand.Next(-50, 51); - for (num354 += Main.rand.Next(-50, 51); num354 < Main.maxTilesY - 10 && !WorldGen.SolidTile(num353, num354); num354++) - { - } - - num354--; - if (!WorldGen.SolidTile(num353, num354)) - { - int num355 = NPC.NewNPC(npc.GetSource_FromAI(), num353 * 16 + 8, num354 * 16, 24); - if (Main.dedServ && num355 < Main.maxNPCs) - NetMessage.SendData(MessageID.SyncNPC, -1, -1, null, num355); - - break; - } - } - } - } - - npc.ai[1] += 1f; - if (npc.ai[2] == 0f) - { - if (Main.masterMode) - npc.ai[1] += 2f; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - npc.ai[1] += 1f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - npc.ai[1] += 1f; - - if (npc.ai[1] > 2700f) - npc.ai[2] = 1f; - } - - int num356 = Main.masterMode ? 30 : 60; - if (npc.ai[2] > 0f && npc.ai[1] > (float)num356) - { - int num357 = 3; - if ((double)npc.life < (double)npc.lifeMax * 0.3) - num357++; - - npc.ai[2] += 1f; - npc.ai[1] = 0f; - if (npc.ai[2] > (float)num357) - npc.ai[2] = 0f; - - if (Main.netMode != NetmodeID.MultiplayerClient && NPC.CountNPCS(NPCID.LeechHead) < 10) - { - int num358 = NPC.NewNPC(npc.GetSource_FromAI(), (int)(npc.Center.X), (int)(npc.Center.Y + 20f), NPCID.LeechHead, 1); - int leechVelocity = Main.masterMode ? 12 : 8; - Main.npc[num358].velocity.X = npc.direction * leechVelocity; - } - } - - npc.localAI[3] += 1f; - if (npc.localAI[3] >= (float)(600 + Main.rand.Next(1000))) - { - npc.localAI[3] = -Main.rand.Next(200); - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); - } - - int num359 = Main.UnderworldLayer + 10; - int num360 = num359 + 70; - Main.wofNPCIndex = npc.whoAmI; - int num361 = (int)(npc.position.X / 16f); - int num362 = (int)((npc.position.X + (float)npc.width) / 16f); - int num363 = (int)(npc.Center.Y / 16f); - int num364 = 0; - int num365 = num363 + 7; - while (num364 < 15 && num365 > Main.UnderworldLayer) - { - num365++; - if (num365 > Main.maxTilesY - 10) - { - num365 = Main.maxTilesY - 10; - break; - } - - if (num365 < num359) - continue; - - for (int num366 = num361; num366 <= num362; num366++) - { - try - { - if (WorldGen.InWorld(num366, num365, 2) && (WorldGen.SolidTile(num366, num365) || Main.tile[num366, num365].LiquidAmount > 0)) - num364++; - } - catch - { - num364 += 15; - } - } - } - - num365 += 4; - if (Main.wofDrawAreaBottom == -1) - { - Main.wofDrawAreaBottom = num365 * 16; - } - else if (Main.wofDrawAreaBottom > num365 * 16) - { - Main.wofDrawAreaBottom--; - if (Main.wofDrawAreaBottom < num365 * 16) - Main.wofDrawAreaBottom = num365 * 16; - } - else if (Main.wofDrawAreaBottom < num365 * 16) - { - Main.wofDrawAreaBottom++; - if (Main.wofDrawAreaBottom > num365 * 16) - Main.wofDrawAreaBottom = num365 * 16; - } - - num364 = 0; - num365 = num363 - 7; - while (num364 < 15 && num365 < Main.maxTilesY - 10) - { - num365--; - if (num365 <= 10) - { - num365 = 10; - break; - } - - if (num365 > num360) - continue; - - if (num365 < num359) - { - num365 = num359; - break; - } - - for (int num367 = num361; num367 <= num362; num367++) - { - try - { - if (WorldGen.InWorld(num367, num365, 2) && (WorldGen.SolidTile(num367, num365) || Main.tile[num367, num365].LiquidAmount > 0)) - num364++; - } - catch - { - num364 += 15; - } - } - } - - num365 -= 4; - if (Main.wofDrawAreaTop == -1) - { - Main.wofDrawAreaTop = num365 * 16; - } - else if (Main.wofDrawAreaTop > num365 * 16) - { - Main.wofDrawAreaTop--; - if (Main.wofDrawAreaTop < num365 * 16) - Main.wofDrawAreaTop = num365 * 16; - } - else if (Main.wofDrawAreaTop < num365 * 16) - { - Main.wofDrawAreaTop++; - if (Main.wofDrawAreaTop > num365 * 16) - Main.wofDrawAreaTop = num365 * 16; - } - - Main.wofDrawAreaTop = (int)MathHelper.Clamp(Main.wofDrawAreaTop, (float)num359 * 16f, (float)num360 * 16f); - Main.wofDrawAreaBottom = (int)MathHelper.Clamp(Main.wofDrawAreaBottom, (float)num359 * 16f, (float)num360 * 16f); - if (Main.wofDrawAreaTop > Main.wofDrawAreaBottom - 160) - Main.wofDrawAreaTop = Main.wofDrawAreaBottom - 160; - else if (Main.wofDrawAreaBottom < Main.wofDrawAreaTop + 160) - Main.wofDrawAreaBottom = Main.wofDrawAreaTop + 160; - - float num368 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2 - npc.height / 2; - if (npc.position.Y > num368 + 1f) - npc.velocity.Y = -1f; - else if (npc.position.Y < num368 - 1f) - npc.velocity.Y = 1f; - - npc.velocity.Y = 0f; - npc.position.Y = num368; - - float targetPosition = Main.player[npc.target].Center.X; - float npcPosition = npc.Center.X; - - // Slow down if close - float distanceFromTarget; - if (npc.velocity.X < 0f) - distanceFromTarget = npcPosition - targetPosition; - else - distanceFromTarget = targetPosition - npcPosition; - - float distanceBeforeSlowingDown = 640f; - float speedMult = 1f; - - if (distanceFromTarget < distanceBeforeSlowingDown) - speedMult += (distanceFromTarget - distanceBeforeSlowingDown) * 0.002f; - - speedMult = MathHelper.Clamp(speedMult, 0.4f, 1f); - - float masterModeVelocityBoost = 0f; - if (Main.masterMode) - { - float velocityBoostStartDistance = distanceBeforeSlowingDown; - float velocityBoostMaxDistance = velocityBoostStartDistance * 1.5f; - float distanceFromTargetX = Math.Abs(npc.Center.X - Main.player[npc.target].Center.X); - float lerpAmount = MathHelper.Clamp((distanceFromTargetX - velocityBoostStartDistance) / velocityBoostMaxDistance, 0f, 1f); - masterModeVelocityBoost = MathHelper.Lerp(0f, 8f, lerpAmount); - } - - float num369 = (Main.expertMode ? 3.5f : 2.5f) + masterModeVelocityBoost; - if (!Main.expertMode) - { - // 4.7 is the max in classic - if ((double)npc.life < (double)npc.lifeMax * 0.75) - num369 += 0.4f; - - if ((double)npc.life < (double)npc.lifeMax * 0.5) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.25) - num369 += 0.6f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num369 += 0.7f; - } - else - { - // 6.5 is the max in expert - if ((double)npc.life < (double)npc.lifeMax * 0.8) - num369 += 0.3f; - - if ((double)npc.life < (double)npc.lifeMax * 0.6) - num369 += 0.3f; - - if ((double)npc.life < (double)npc.lifeMax * 0.4) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.2) - num369 += 0.5f; - - if ((double)npc.life < (double)npc.lifeMax * 0.1) - num369 += 0.7f; - - if ((double)npc.life < (double)npc.lifeMax * 0.05) - num369 += 0.7f; - - // 8.3 is the max in master - if (Main.masterMode) - { - if ((double)npc.life < (double)npc.lifeMax * 0.025) - num369 += 0.9f; - - if ((double)npc.life < (double)npc.lifeMax * 0.01) - num369 += 0.9f; - } - } - - if (Main.getGoodWorld) - { - num369 *= 1.1f; - num369 += 0.2f; - } - - num369 *= speedMult; - - if (npc.velocity.X == 0f) - { - npc.TargetClosest(); - if (Main.player[npc.target].dead) - { - float num370 = float.PositiveInfinity; - int num371 = 0; - for (int num372 = 0; num372 < Main.maxPlayers; num372++) - { - Player player = Main.player[npc.target]; - if (player.active) - { - float num373 = npc.Distance(player.Center); - if (num370 > num373) - { - num370 = num373; - num371 = ((npc.Center.X < player.Center.X) ? 1 : (-1)); - } - } - } - - npc.direction = num371; - } - - npc.velocity.X = npc.direction; - } - - if (npc.velocity.X < 0f) - { - npc.velocity.X = -num369; - npc.direction = -1; - } - else - { - npc.velocity.X = num369; - npc.direction = 1; - } - - if (Main.player[npc.target].dead || !Main.player[npc.target].gross) - npc.TargetClosest_WOF(); - - if (Main.player[npc.target].dead) - { - npc.localAI[1] += 1f / 180f; - if (npc.localAI[1] >= 1f) - { - SoundEngine.PlaySound(SoundID.NPCDeath10, npc.Center); - npc.life = 0; - npc.active = false; - if (Main.netMode != NetmodeID.MultiplayerClient) - NetMessage.SendData(MessageID.DamageNPC, -1, -1, null, npc.whoAmI, -1f); - - return false; - } - } - else - npc.localAI[1] = MathHelper.Clamp(npc.localAI[1] - 1f / 30f, 0f, 1f); - - npc.spriteDirection = npc.direction; - Vector2 vector38 = npc.Center; - float num374 = Main.player[npc.target].Center.X - vector38.X; - float num375 = Main.player[npc.target].Center.Y - vector38.Y; - float num376 = (float)Math.Sqrt(num374 * num374 + num375 * num375); - float num377 = num376; - num374 *= num376; - num375 *= num376; - if (npc.direction > 0) - { - if (Main.player[npc.target].Center.X > npc.Center.X) - npc.rotation = (float)Math.Atan2(0f - num375, 0f - num374) + MathHelper.Pi; - else - npc.rotation = 0f; - } - else if (Main.player[npc.target].Center.X < npc.Center.X) - npc.rotation = (float)Math.Atan2(num375, num374) + MathHelper.Pi; - else - npc.rotation = 0f; - - if (Main.expertMode && Main.netMode != NetmodeID.MultiplayerClient) - { - int chanceToSpawnHungry = (int)(1f + (float)npc.life / (float)npc.lifeMax * 10f); - chanceToSpawnHungry *= chanceToSpawnHungry; - if (chanceToSpawnHungry < 400) - chanceToSpawnHungry = (chanceToSpawnHungry * 19 + 400) / 20; - - if (chanceToSpawnHungry < 60) - chanceToSpawnHungry = (chanceToSpawnHungry * 3 + 60) / 4; - - if (chanceToSpawnHungry < 20) - chanceToSpawnHungry = (chanceToSpawnHungry + 20) / 2; - - chanceToSpawnHungry = (int)((double)chanceToSpawnHungry * (Main.masterMode ? 0.5 : 0.7)); - if (chanceToSpawnHungry < 2) - chanceToSpawnHungry = 2; - - if (Main.rand.NextBool(chanceToSpawnHungry)) - { - int maxHungriesBasedOnHP = (int)Math.Round(MathHelper.Lerp(Main.masterMode ? 2f : 1f, Main.masterMode ? 8f : 4f, npc.life / (float)npc.lifeMax)); - if (NPC.CountNPCS(NPCID.TheHungry) < maxHungriesBasedOnHP) - { - int hungryCount = 0; - int maxHungries = 10; - float[] hungryArray = new float[maxHungries]; - for (int i = 0; i < Main.maxNPCs; i++) - { - if (hungryCount < maxHungries && Main.npc[i].active && Main.npc[i].type == NPCID.TheHungry) - { - hungryArray[hungryCount] = Main.npc[i].ai[0]; - hungryCount++; - } - } - - int maxValue = 1 + hungryCount * 2; - if (Main.masterMode) - maxValue /= 2; - if (maxValue < 2) - maxValue = 2; - - if (hungryCount < maxHungries && Main.rand.Next(maxValue) <= 1) - { - int ai0 = -1; - for (int i = 0; i < 1000; i++) - { - int randomHungryLocation = Main.rand.Next(maxHungries); - float hungryLocation = (float)randomHungryLocation * 0.1f - 0.05f; - bool spawnHungry = true; - for (int j = 0; j < hungryCount; j++) - { - if (hungryLocation == hungryArray[j]) - { - spawnHungry = false; - break; - } - } - - if (spawnHungry) - { - ai0 = randomHungryLocation; - break; - } - } - - if (ai0 >= 0) - NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num368, NPCID.TheHungry, npc.whoAmI, (float)ai0 * 0.1f - 0.05f); - } - } - } - } - - if (Main.netMode != NetmodeID.MultiplayerClient && npc.localAI[0] == 1f) - { - npc.localAI[0] = 2f; - float num386 = (npc.Center.Y + (float)Main.wofDrawAreaTop) / 2f; - int num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num386, NPCID.WallofFleshEye, npc.whoAmI, 1f); - float num388 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; - num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num388, NPCID.WallofFleshEye, npc.whoAmI, -1f); - float num389 = (npc.Center.Y + (float)Main.wofDrawAreaBottom) / 2f; - int maxHungries = Main.masterMode ? 16 : 11; - float maxOffset = Main.masterMode ? (0.2f / 3f) : 0.1f; - for (int i = 0; i < maxHungries; i++) - num387 = NPC.NewNPC(npc.GetSource_FromAI(), (int)npc.position.X, (int)num389, NPCID.TheHungry, npc.whoAmI, i * maxOffset - 0.05f); - } - - return false; - } - - public static bool VanillaWallofFleshEyeAI(NPC npc, Mod mod) - { - if (Main.wofNPCIndex < 0) - { - npc.active = false; - return false; - } - - npc.realLife = Main.wofNPCIndex; - if (Main.npc[Main.wofNPCIndex].life > 0) - npc.life = Main.npc[Main.wofNPCIndex].life; - - // Get a target - if (npc.target < 0 || npc.target == Main.maxPlayers || Main.player[npc.target].dead || !Main.player[npc.target].active) - npc.target = Main.npc[Main.wofNPCIndex].target; - - // Avoid cheap bullshit - npc.damage = 0; - - npc.position.X = Main.npc[Main.wofNPCIndex].position.X; - npc.direction = Main.npc[Main.wofNPCIndex].direction; - npc.spriteDirection = npc.direction; - float num391 = (Main.wofDrawAreaBottom + Main.wofDrawAreaTop) / 2; - num391 = ((!(npc.ai[0] > 0f)) ? ((num391 + (float)Main.wofDrawAreaBottom) / 2f) : ((num391 + (float)Main.wofDrawAreaTop) / 2f)); - num391 -= (float)(npc.height / 2); - if (npc.position.Y > num391 + 1f) - { - npc.velocity.Y = -1f; - } - else if (npc.position.Y < num391 - 1f) - { - npc.velocity.Y = 1f; - } - else - { - npc.velocity.Y = 0f; - npc.position.Y = num391; - } - - if (npc.velocity.Y > 5f) - npc.velocity.Y = 5f; - - if (npc.velocity.Y < -5f) - npc.velocity.Y = -5f; - - Vector2 vector39 = npc.Center; - float num392 = Main.player[npc.target].Center.X - vector39.X; - float num393 = Main.player[npc.target].Center.Y - vector39.Y; - float num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); - float num395 = num394; - num392 *= num394; - num393 *= num394; - bool flag27 = true; - if (npc.direction > 0) - { - if (Main.player[npc.target].Center.X > npc.Center.X) - { - npc.rotation = (float)Math.Atan2(0f - num393, 0f - num392) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - flag27 = false; - } - } - else if (Main.player[npc.target].Center.X < npc.Center.X) - { - npc.rotation = (float)Math.Atan2(num393, num392) + MathHelper.Pi; - } - else - { - npc.rotation = 0f; - flag27 = false; - } - - if (Main.netMode == NetmodeID.MultiplayerClient) - return false; - - int num396 = 4; - npc.localAI[1] += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.75) - { - npc.localAI[1] += 1f; - num396++; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) - { - npc.localAI[1] += 1f; - num396++; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) - { - npc.localAI[1] += 1f; - num396 += 2; - } - - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - { - npc.localAI[1] += 2f; - num396 += 3; - } - - if (Main.expertMode) - { - npc.localAI[1] += 0.5f; - num396++; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - { - npc.localAI[1] += 2f; - num396 += 3; - } - } - - if (npc.localAI[2] == 0f) - { - if (npc.localAI[1] > 600f) - { - npc.localAI[2] = 1f; - npc.localAI[1] = 0f; - } - } - else - { - if (!(npc.localAI[1] > 45f) || !Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height)) - return false; - - npc.localAI[1] = 0f; - npc.localAI[2] += 1f; - if (npc.localAI[2] >= (float)num396) - npc.localAI[2] = 0f; - - if (flag27) - { - float num397 = 4f; - int type = ProjectileID.EyeLaser; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.5) - num397 += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.25) - num397 += 1f; - if ((double)Main.npc[Main.wofNPCIndex].life < (double)Main.npc[Main.wofNPCIndex].lifeMax * 0.1) - num397 += 1f; - - num392 = Main.player[npc.target].Center.X - npc.Center.X; - num393 = Main.player[npc.target].Center.Y - npc.Center.Y; - num394 = (float)Math.Sqrt(num392 * num392 + num393 * num393); - num394 = num397 / num394; - num392 *= num394; - num393 *= num394; - - bool targetTooClose = npc.Distance(Main.player[npc.target].Center) < 160f; - float projectileOffset = targetTooClose ? 60f : 150f; - Vector2 projectileVelocity = new Vector2(num392, num393); - Vector2 projectileSpawn = npc.Center + projectileVelocity.SafeNormalize(Vector2.UnitY) * projectileOffset; - Projectile.NewProjectile(npc.GetSource_FromAI(), projectileSpawn, projectileVelocity, type, npc.GetProjectileDamage(type), 0f, Main.myPlayer, 1f, 0f); - } - } - - return false; - } } } diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs index 12cb14f419..f9db3ad02d 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/RevengeanceAndDeathAI.cs @@ -6790,15 +6790,8 @@ PrepareToShoot: int projType = ProjectileID.SandBallFalling; - // 2 to 3 in Rev, 3 to 5 in Death, if FTW is also enabled, 8 to 13 (random chance for 10x the amount) - int projAmt = CalamityWorld.revenge ? Main.rand.Next(CalamityWorld.death ? 3 : 2, CalamityWorld.death ? 6 : 4) : 1; - if (Main.getGoodWorld) - { - projAmt = Main.rand.Next(8, 14); - if (Main.rand.NextBool(1000) || Main.zenithWorld) - projAmt = Main.rand.Next(80, 131); - } - + // In FTW, can fire 8 sand balls (100 in stupid meme seed) + int projAmt = Main.zenithWorld ? 100 : Main.getGoodWorld ? 8 : 1; for (int i = 0; i < projAmt; i++) { // Adjust the velocity to make it a shotgun-like spread @@ -9685,13 +9678,8 @@ PrepareToShoot: if (npc.ai[0] != -1f) { npc.TargetClosest(true); - float acceleration = Main.masterMode ? 0.25f : Main.expertMode ? 0.2f : 0.1f; - float velocity = Main.masterMode ? 6f : Main.expertMode ? 5f : 3f; - if (CalamityWorld.death) - { - acceleration *= 1.25f; - velocity *= 1.25f; - } + float acceleration = CalamityWorld.death ? 0.25f : Main.expertMode ? 0.2f : 0.1f; + float velocity = CalamityWorld.death ? 6.25f : Main.expertMode ? 5f : 3f; // Simple movement AI. You shouldn't need any help from comments to parse this. if (npc.Center.X < Main.player[npc.target].position.X) diff --git a/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs index 2573731e44..f167f0e5c5 100644 --- a/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs +++ b/NPCs/VanillaNPCAIOverrides/RegularEnemies/SlimeAI.cs @@ -12,10 +12,6 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { public static class SlimeAI { - public const float SpikedSlimeSpikeBarrageGateValue = 30f; - public const float SpikedSlimeSpikeGateValue = 50f; - public const float SpikedSlimeSpikeTelegraphTime = 30f; - public static void ChooseRandomItem(out int dropItem) { // Use a fallback of -1. @@ -105,7 +101,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies if (npc.type == NPCID.SpikedJungleSlime) { projectileShootType = ProjectileID.JungleSpike; - projectileShootSpeedFactor *= 1.5f; + projectileShootSpeedFactor *= 0.6f; } ref float jumpDelay = ref npc.ai[0]; @@ -184,7 +180,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies if (Main.netMode != NetmodeID.MultiplayerClient && projectileShootCountdown <= 0f) { var source = npc.GetSource_FromAI(); - if (Main.expertMode && distanceFromTarget < 120f) + if (distanceFromTarget < 120f) { for (int i = 0; i < 5; i++) { @@ -196,12 +192,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies if (CalamityWorld.death) Main.projectile[proj].extraUpdates += 1; - projectileShootCountdown = SpikedSlimeSpikeBarrageGateValue; + projectileShootCountdown = 30f; } } else { - Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * (npc.type == NPCID.SpikedJungleSlime ? 10f : 100f)) * projectileShootSpeedFactor * (CalamityWorld.death ? 3.25f : CalamityWorld.revenge ? 5.5f : 4.5f); + Vector2 velocity = npc.SafeDirectionTo(Main.player[npc.target].Center - Vector2.UnitY * 100f) * projectileShootSpeedFactor * (CalamityWorld.death ? 3.25f : CalamityWorld.revenge ? 5.5f : 4.5f); int proj = Projectile.NewProjectile(source, npc.Center, velocity, projectileShootType, 9, 0f, Main.myPlayer); if (CalamityWorld.death) { @@ -209,43 +205,12 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies Main.projectile[proj].timeLeft = 1200; } - projectileShootCountdown = SpikedSlimeSpikeGateValue; + projectileShootCountdown = 50f; } } } else - projectileShootCountdown = SpikedSlimeSpikeGateValue; - - if (npc.type == NPCID.SpikedIceSlime) - { - // Emit dust from center when about to shoot - if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime) - { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 135, 0f, 0f, 100, default, 3f); - dust.noGravity = true; - dust.velocity *= 0f; - } - } - else if (npc.type == NPCID.SpikedJungleSlime) - { - // Emit dust from center when about to shoot - if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime) - { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 61, 0f, 0f, 0, default, 3f); - dust.noGravity = true; - dust.velocity *= 0f; - } - } - else if (npc.type == NPCID.SlimeSpiked) - { - // Emit dust from center when about to shoot - if (projectileShootCountdown <= SpikedSlimeSpikeTelegraphTime) - { - Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, 4, 0f, 0f, 0, new Color(78, 136, 255, 150), 1.5f); - dust.noGravity = true; - dust.velocity *= 0f; - } - } + projectileShootCountdown = 50f; } // Decrement the target reset counter. @@ -407,7 +372,7 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies { // Move up if tiles are hit on the Y axis. if (npc.collideY) - npc.velocity.Y = -(CalamityWorld.death ? 4f : CalamityWorld.revenge ? 3f : 2f); + npc.velocity.Y = -(CalamityWorld.death ? 4f : 3f); if (npc.velocity.Y < 0f && npc.ai[3] == npc.position.X) { @@ -418,8 +383,8 @@ namespace CalamityMod.NPCs.VanillaNPCAIOverrides.RegularEnemies if (npc.velocity.Y > 0f) npc.ai[3] = npc.position.X; - float riseSpeed = CalamityWorld.death ? 0.6f : CalamityWorld.revenge ? 0.55f : 0.5f; - float maxRiseSpeed = CalamityWorld.death ? 6f : CalamityWorld.revenge ? 5f : 4f; + float riseSpeed = CalamityWorld.death ? 0.6f : 0.55f; + float maxRiseSpeed = CalamityWorld.death ? 6f : 5f; if (isLavaSlime) { riseSpeed += 0.2f; diff --git a/NPCs/Yharon/Yharon.cs b/NPCs/Yharon/Yharon.cs index 93ae4067f9..8304c47e1a 100644 --- a/NPCs/Yharon/Yharon.cs +++ b/NPCs/Yharon/Yharon.cs @@ -56,11 +56,9 @@ namespace CalamityMod.NPCs.Yharon private int invincibilityCounter = 0; private int fastChargeTelegraphTime = 120; - private const float ai2GateValue = 0.55f; - public const int Phase2InvincibilityTime = 300; - - public static float normalDR = 0.22f; - public static float EnragedDR = 0.9f; + private const float AI2GateValue = 0.55f; + private const int Phase2InvincibilityTime = 300; + private const float EnragedDR = 0.9f; public static readonly SoundStyle RoarSound = new("CalamityMod/Sounds/Custom/Yharon/YharonRoar"); public static readonly SoundStyle ShortRoarSound = new("CalamityMod/Sounds/Custom/Yharon/YharonRoarShort"); @@ -99,11 +97,19 @@ namespace CalamityMod.NPCs.Yharon } } + public static int FlareDamage = 66; // 264; FlareBomb, FlareDust, FlareDust2 + public static int FireballDamage = 66; // 264 + public static int TornadoDamage = 85; // 340; Flarenado, Infernado, Infernado2 + public static int BordernadoDamage = 125; // 500; SkyFlareRevenge + + // GFB exclusive + public static int VortexDamage = 85; // 340 + public override void SetDefaults() { NPC.Calamity().canBreakPlayerDefense = true; + NPC.damage = 210; // 420 NPC.npcSlots = 50f; - NPC.GetNPCDamage(); NPC.width = 200; NPC.height = 200; NPC.defense = 90; @@ -111,9 +117,8 @@ namespace CalamityMod.NPCs.Yharon NPC.knockBackResist = 0f; NPC.aiStyle = -1; AIType = -1; - NPC.value = Item.buyPrice(2, 50, 0, 0); + NPC.value = Item.buyPrice(platinum: 2, gold: 50); NPC.boss = true; - NPC.DR_NERD(normalDR); NPC.noGravity = true; NPC.noTileCollide = true; @@ -123,9 +128,6 @@ namespace CalamityMod.NPCs.Yharon NPC.Calamity().VulnerableToHeat = false; NPC.Calamity().VulnerableToCold = true; NPC.Calamity().VulnerableToSickness = true; - - // Scale HP in Master - CalamityGlobalNPC.AdjustMasterModeStatScaling(NPC, true); } public override void SetBestiary(BestiaryDatabase database, BestiaryEntry bestiaryEntry) @@ -201,13 +203,9 @@ namespace CalamityMod.NPCs.Yharon CalamityWorld.StopRain(); // Variables - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool masterMode = Main.masterMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; - - float pie = (float)Math.PI; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; CalamityGlobalNPC.yharon = NPC.whoAmI; CalamityGlobalNPC.yharonP2 = -1; @@ -217,15 +215,15 @@ namespace CalamityMod.NPCs.Yharon // Start phase 2 or not if (startSecondAI) { - Yharon_AI2(expertMode, masterMode, revenge, death, bossRush, pie, lifeRatio, calamityGlobalNPC, setDamage); + Yharon_AI2(expertMode, revenge, death, lifeRatio, calamityGlobalNPC, setDamage); return; } // Phase booleans - float phase2GateValue = revenge ? 0.9f : expertMode ? 0.85f : 0.75f; + float phase2GateValue = revenge ? 0.9f : expertMode ? 0.85f : 0.8f; bool phase2Check = death || lifeRatio <= phase2GateValue; - bool phase3Check = lifeRatio <= (death ? 0.8f : revenge ? 0.75f : expertMode ? 0.7f : 0.625f); - bool phase4Check = lifeRatio <= ai2GateValue; + bool phase3Check = lifeRatio <= (death ? 0.8f : revenge ? 0.75f : expertMode ? 0.7f : 0.65f); + bool phase4Check = lifeRatio <= AI2GateValue; bool phase1Change = NPC.ai[0] > -1f; bool phase2Change = NPC.ai[0] > 5f; bool phase3Change = NPC.ai[0] > 12f; @@ -256,7 +254,7 @@ namespace CalamityMod.NPCs.Yharon float reduceSpeedChargeDistance = 540f; int chargeTime = expertMode ? 40 : 45; float chargeSpeed = expertMode ? 28f : 26f; - float fastChargeVelocityMultiplier = bossRush ? 2f : 1.5f; + float fastChargeVelocityMultiplier = 1.5f; bool playFastChargeRoarSound = NPC.localAI[1] == fastChargeTelegraphTime * 0.5f; bool doFastCharge = NPC.localAI[1] > fastChargeTelegraphTime; @@ -275,8 +273,8 @@ namespace CalamityMod.NPCs.Yharon if (revenge) { - int chargeTimeDecrease = bossRush ? 6 : death ? 4 : 2; - float velocityMult = bossRush ? 1.15f : death ? 1.1f : 1.05f; + int chargeTimeDecrease = death ? 4 : 2; + float velocityMult = death ? 1.1f : 1.05f; phaseSwitchTimer -= chargeTimeDecrease; acceleration *= velocityMult; velocity *= velocityMult; @@ -285,17 +283,17 @@ namespace CalamityMod.NPCs.Yharon } float reduceSpeedFlareBombDistance = 570f; - int flareBombPhaseTimer = bossRush ? 30 : death ? 40 : 60; + int flareBombPhaseTimer = death ? 40 : 60; int flareBombSpawnDivisor = flareBombPhaseTimer / 20; - float flareBombPhaseAcceleration = bossRush ? 1f : death ? 0.92f : 0.8f; - float flareBombPhaseVelocity = bossRush ? 16f : death ? 14f : 12f; + float flareBombPhaseAcceleration = death ? 0.92f : 0.8f; + float flareBombPhaseVelocity = death ? 14f : 12f; int fireTornadoPhaseTimer = 90; int newPhaseTimer = 180; - int flareDustPhaseTimer = bossRush ? 160 : death ? 200 : 240; - int flareDustPhaseTimer2 = bossRush ? 80 : death ? 100 : 120; + int flareDustPhaseTimer = death ? 200 : 240; + int flareDustPhaseTimer2 = death ? 100 : 120; float spinTime = flareDustPhaseTimer / 2; @@ -306,12 +304,12 @@ namespace CalamityMod.NPCs.Yharon float spinPhaseVelocity = 25f; float spinPhaseRotation = MathHelper.TwoPi * 3 / spinTime; - float increasedIdleTimeAfterBulletHell = (masterMode ? 120f : 180f) + phaseSwitchTimer; + float increasedIdleTimeAfterBulletHell = (death ? 120f : 180f) + phaseSwitchTimer; bool moveSlowerAfterBulletHell = NPC.ai[2] < 0f; bool slowChargeAfterBulletHell = NPC.ai[2] == -1f; if (moveSlowerAfterBulletHell) { - float reducedMovementMultiplier = MathHelper.Lerp(0.1f, masterMode ? 1f : 0.75f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, death ? 1f : 0.75f, (NPC.ai[2] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); acceleration *= reducedMovementMultiplier; velocity *= reducedMovementMultiplier; chargeSpeed *= reducedMovementMultiplier; @@ -370,12 +368,12 @@ namespace CalamityMod.NPCs.Yharon enraged = false; if (Main.netMode != NetmodeID.MultiplayerClient) { - safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f)); + safeBox.X = (int)(player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : revenge ? 3000f : 3500f)); safeBox.Y = (int)Main.topWorld; - safeBox.Width = Main.zenithWorld ? 3000 : Main.getGoodWorld ? 2000 : bossRush ? 4000 : revenge ? 6000 : 7000; + safeBox.Width = Main.zenithWorld ? 3000 : Main.getGoodWorld ? 2000 : revenge ? 6000 : 7000; safeBox.Height = Main.maxTilesY * 16; - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); - Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : bossRush ? 2000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X + (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), player.Center.X - (Main.zenithWorld ? 1500f : Main.getGoodWorld ? 1000f : revenge ? 3000f : 3500f), player.Center.Y + 100f, 0f, 0f, ModContent.ProjectileType(), 0, 0f, Main.myPlayer); } // Force Yharon to send a sync packet so that the arena gets sent immediately @@ -403,7 +401,7 @@ namespace CalamityMod.NPCs.Yharon // Set DR based on protection boost (aka enrage) bool chargeTelegraph = (NPC.ai[0] == 0f || NPC.ai[0] == 6f || NPC.ai[0] == 13f) && NPC.localAI[1] > 0f; bool bulletHell = NPC.ai[0] == 8f || NPC.ai[0] == 15f; - calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = protectionBoost; // Increased DR during phase transitions @@ -411,17 +409,17 @@ namespace CalamityMod.NPCs.Yharon { if (phase3Change) { - calamityGlobalNPC.DR = phase4Check ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase4Check ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase4Check; } else if (phase2Change) { - calamityGlobalNPC.DR = phase3Check ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase3Check ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase3Check; } else if (phase1Change) { - calamityGlobalNPC.DR = phase2Check ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase2Check ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase2Check; } } @@ -444,7 +442,7 @@ namespace CalamityMod.NPCs.Yharon // Rotation float npcRotation = (float)Math.Atan2(player.Center.Y - NPC.Center.Y, player.Center.X - NPC.Center.X); if (NPC.spriteDirection == 1) - npcRotation += pie; + npcRotation += MathHelper.Pi; if (npcRotation < 0f) npcRotation += MathHelper.TwoPi; if (npcRotation > MathHelper.TwoPi) @@ -552,7 +550,7 @@ namespace CalamityMod.NPCs.Yharon Vector2 distanceFromDestination = destination - NPC.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; - if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance) + if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance && NPC.localAI[1] <= fastChargeTelegraphTime * 0.5f) NPC.SimpleFlyMovement(desiredVelocity, acceleration); else NPC.velocity *= 0.98f; @@ -561,12 +559,12 @@ namespace CalamityMod.NPCs.Yharon if (phaseSwitchFaceDirection != 0) { if (NPC.ai[2] == 0f && phaseSwitchFaceDirection != NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection != -NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -613,7 +611,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -660,7 +658,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = phaseSwitchFaceDirection; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -677,7 +675,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(7, pie); + ChargeDust(7); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -717,8 +715,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.target, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, Vector2.Zero, type, FlareDamage, 0f, Main.myPlayer, NPC.target, 1f); } } @@ -728,7 +725,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirection; if (NPC.spriteDirection != -NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -804,7 +801,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(14, pie); + ChargeDust(14); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -833,7 +830,7 @@ namespace CalamityMod.NPCs.Yharon Vector2 distanceFromDestination = destination - NPC.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; - if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance) + if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance && NPC.localAI[1] <= fastChargeTelegraphTime * 0.5f) NPC.SimpleFlyMovement(desiredVelocity, acceleration); else NPC.velocity *= 0.98f; @@ -842,12 +839,12 @@ namespace CalamityMod.NPCs.Yharon if (playerFaceDirectionFurtherPhases != 0) { if (NPC.ai[2] == 0f && playerFaceDirectionFurtherPhases != NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection != -NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -897,7 +894,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -924,7 +921,7 @@ namespace CalamityMod.NPCs.Yharon NPC.Center = center; int type = ModContent.ProjectileType(); - int damage = Main.zenithWorld ? NPC.GetProjectileDamage(type) : 0; + int damage = Main.zenithWorld ? VortexDamage : 0; float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f; int extraTime = Main.zenithWorld ? 300 : 0; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); @@ -990,7 +987,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1008,7 +1005,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1027,7 +1024,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(7, pie); + ChargeDust(7); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -1061,7 +1058,7 @@ namespace CalamityMod.NPCs.Yharon { int ringReduction = (int)MathHelper.Lerp(0f, 14f, NPC.ai[2] / flareDustPhaseTimer); int totalProjectiles = 38 - ringReduction; // 36 for first ring, 22 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, false); + DoFlareDustBulletHell(0, flareDustSpawnDivisor, FlareDamage, totalProjectiles, 0f, 0f, false); } } @@ -1132,7 +1129,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(14, pie); + ChargeDust(14); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -1164,10 +1161,9 @@ namespace CalamityMod.NPCs.Yharon Vector2 projectileVelocity = NPC.velocity; projectileVelocity.Normalize(); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float finalVelocity = 12f; float projectileAcceleration = 1.1f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, finalVelocity, projectileAcceleration); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, projectileVelocity, type, FlareDamage, 0f, Main.myPlayer, finalVelocity, projectileAcceleration); } } @@ -1200,7 +1196,7 @@ namespace CalamityMod.NPCs.Yharon Vector2 distanceFromDestination = destination - NPC.Center; Vector2 desiredVelocity = Vector2.Normalize(distanceFromDestination - NPC.velocity) * velocity; - if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance) + if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance && NPC.localAI[1] <= fastChargeTelegraphTime * 0.5f) NPC.SimpleFlyMovement(desiredVelocity, acceleration); else NPC.velocity *= 0.98f; @@ -1209,12 +1205,12 @@ namespace CalamityMod.NPCs.Yharon if (playerFaceDirectionFurtherPhases != 0) { if (NPC.ai[2] == 0f && playerFaceDirectionFurtherPhases != NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection != -NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1267,7 +1263,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1294,7 +1290,7 @@ namespace CalamityMod.NPCs.Yharon NPC.Center = center; int type = ModContent.ProjectileType(); - int damage = Main.zenithWorld ? NPC.GetProjectileDamage(type) : 0; + int damage = Main.zenithWorld ? VortexDamage : 0; float bulletHellVortexDuration = flareDustPhaseTimer + teleportPhaseTimer - 15f; int extraTime = Main.zenithWorld ? 300 : 0; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); @@ -1360,7 +1356,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1378,7 +1374,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirectionFurtherPhases; if (NPC.spriteDirection == 1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1404,7 +1400,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(7, pie); + ChargeDust(7); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -1437,7 +1433,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - DoFlareDustBulletHell(1, flareDustPhaseTimer, NPC.GetProjectileDamage(ModContent.ProjectileType()), 8, 12f, 3.6f, false); + DoFlareDustBulletHell(1, flareDustPhaseTimer, FlareDamage, 8, 13f, 3.6f, false); } } @@ -1511,7 +1507,7 @@ namespace CalamityMod.NPCs.Yharon // Set damage NPC.damage = setDamage; - ChargeDust(14, pie); + ChargeDust(14); NPC.ai[2] += 1f; if (NPC.ai[2] >= chargeTime) @@ -1543,10 +1539,9 @@ namespace CalamityMod.NPCs.Yharon Vector2 projectileVelocity = NPC.velocity; projectileVelocity.Normalize(); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); float finalVelocity = 15f; float projectileAcceleration = 1.11f; - Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, projectileVelocity, type, damage, 0f, Main.myPlayer, finalVelocity, projectileAcceleration); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, projectileVelocity, type, FlareDamage, 0f, Main.myPlayer, finalVelocity, projectileAcceleration); } } @@ -1590,8 +1585,7 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, Vector2.Zero, type, damage, 0f, Main.myPlayer, NPC.target, 1f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), fromMouth, Vector2.Zero, type, FlareDamage, 0f, Main.myPlayer, NPC.target, 1f); } } @@ -1601,7 +1595,7 @@ namespace CalamityMod.NPCs.Yharon NPC.direction = playerFaceDirection; if (NPC.spriteDirection != -NPC.direction) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.spriteDirection = -NPC.direction; } @@ -1620,16 +1614,14 @@ namespace CalamityMod.NPCs.Yharon } #region AI2 - public void Yharon_AI2(bool expertMode, bool masterMode, bool revenge, bool death, bool bossRush, float pie, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage) + public void Yharon_AI2(bool expertMode, bool revenge, bool death, float lifeRatio, CalamityGlobalNPC calamityGlobalNPC, int contactDamage) { CalamityGlobalNPC.yharonP2 = NPC.whoAmI; - float phase2GateValue = revenge ? 0.44f : expertMode ? 0.385f : 0.275f; + float phase2GateValue = revenge ? 0.45f : expertMode ? 0.35f : 0.3f; bool phase2 = death || lifeRatio <= phase2GateValue; - float phase3GateValue = death ? 0.358f : revenge ? 0.275f : expertMode ? 0.22f : 0.138f; - bool phase3 = lifeRatio <= phase3GateValue; - float phase4GateValue = death ? 0.165f : 0.11f; - bool phase4 = lifeRatio <= phase4GateValue && revenge; + bool phase3 = lifeRatio <= (death ? 0.35f : revenge ? 0.3f : expertMode ? 0.2f : 0.15f); + bool phase4 = lifeRatio <= (death ? 0.2f : 0.15f) && revenge; if (NPC.ai[0] != 5f && NPC.ai[0] != 8f) { @@ -1723,7 +1715,7 @@ namespace CalamityMod.NPCs.Yharon // Set DR based on protection boost (aka enrage) bool bulletHell = NPC.ai[0] == 5f; NPC.dontTakeDamage = bulletHell; - calamityGlobalNPC.DR = protectionBoost ? EnragedDR : normalDR; + calamityGlobalNPC.DR = protectionBoost ? EnragedDR : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = protectionBoost; // Increased DR during phase transitions @@ -1733,21 +1725,21 @@ namespace CalamityMod.NPCs.Yharon { case 1: - calamityGlobalNPC.DR = phase2 ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase2 ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase2; break; case 2: - calamityGlobalNPC.DR = phase3 ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase3 ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase3; break; case 3: - calamityGlobalNPC.DR = phase4 ? (bossRush ? 0.99f : 0.7f) : normalDR; + calamityGlobalNPC.DR = phase4 ? 0.7f : 0f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = phase4; break; @@ -1755,27 +1747,27 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[0] == 9f) { - calamityGlobalNPC.DR = bossRush ? 0.99f : 0.7f; + calamityGlobalNPC.DR = 0.7f; calamityGlobalNPC.CurrentlyIncreasingDefenseOrDR = true; } } float reduceSpeedChargeDistance = 500f; float reduceSpeedFireballSpitChargeDistance = 800f; - float phaseSwitchTimer = bossRush ? 28f : expertMode ? 30f : 32f; + float phaseSwitchTimer = expertMode ? 30f : 32f; float acceleration = expertMode ? 0.92f : 0.9f; float velocity = expertMode ? 14.5f : 14f; float chargeTime = expertMode ? 32f : 35f; float chargeSpeed = expertMode ? 32f : 30f; - float fastChargeVelocityMultiplier = bossRush ? 2f : 1.5f; + float fastChargeVelocityMultiplier = 1.5f; fastChargeTelegraphTime = protectionBoost ? 60 : (100 - secondPhasePhase * 10); bool playFastChargeRoarSound = NPC.localAI[1] == fastChargeTelegraphTime * 0.5f; bool doFastChargeTelegraph = NPC.localAI[1] <= fastChargeTelegraphTime; float fireballBreathTimer = 60f; float fireballBreathPhaseTimer = fireballBreathTimer + 80f; - float fireballBreathPhaseVelocity = expertMode ? 32f : 30f; + float fireballBreathPhaseVelocity = expertMode ? 28f : 25f; float splittingFireballBreathTimer = 40f; float splittingFireballBreathPhaseVelocity = 22f; @@ -1785,31 +1777,31 @@ namespace CalamityMod.NPCs.Yharon float splittingFireballBreathYVelocityTimer = 40f; float splittingFireballBreathPhaseTimer = splittingFireballBreathTimer + splittingFireballBreathTimer2 + splittingFireballBreathYVelocityTimer; - int spinPhaseTimer = secondPhasePhase == 4 ? (bossRush ? 80 : death ? 100 : 120) : (bossRush ? 120 : death ? 150 : 180); + int spinPhaseTimer = secondPhasePhase == 4 ? (death ? 100 : 120) : (death ? 150 : 180); int flareDustSpawnDivisor = spinPhaseTimer / 10; - int flareDustSpawnDivisor2 = spinPhaseTimer / 20 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); + int flareDustSpawnDivisor2 = spinPhaseTimer / 15 + (secondPhasePhase == 4 ? spinPhaseTimer / 60 : 0); - float increasedIdleTimeAfterBulletHell = (masterMode ? 120f : 180f) + phaseSwitchTimer; + float increasedIdleTimeAfterBulletHell = (death ? 120f : 180f) + phaseSwitchTimer; bool moveSlowerAfterBulletHell = NPC.ai[1] < 0f; bool slowChargeAfterBulletHell = NPC.ai[1] == -1f; if (moveSlowerAfterBulletHell) { - float reducedMovementMultiplier = MathHelper.Lerp(0.1f, masterMode ? 1f : 0.75f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); + float reducedMovementMultiplier = MathHelper.Lerp(0.1f, death ? 1f : 0.75f, (NPC.ai[1] + increasedIdleTimeAfterBulletHell) / increasedIdleTimeAfterBulletHell); acceleration *= reducedMovementMultiplier; velocity *= reducedMovementMultiplier; chargeSpeed *= reducedMovementMultiplier; } - float flareSpawnDecelerationTimer = bossRush ? 60f : death ? 75f : 90f; - int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (ai2GateValue - lifeRatio)) : 0; - float flareSpawnPhaseTimer = (bossRush ? 120f : death ? 150f : 180f) - flareSpawnPhaseTimerReduction; + float flareSpawnDecelerationTimer = death ? 75f : 90f; + int flareSpawnPhaseTimerReduction = revenge ? (int)(flareSpawnDecelerationTimer * (AI2GateValue - lifeRatio)) : 0; + float flareSpawnPhaseTimer = (death ? 150f : 180f) - flareSpawnPhaseTimerReduction; float teleportPhaseTimer = 45f; if (revenge) { - float chargeTimeDecrease = bossRush ? 6f : death ? 4f : 2f; - float velocityMult = bossRush ? 1.15f : death ? 1.1f : 1.05f; + float chargeTimeDecrease = death ? 4f : 2f; + float velocityMult = death ? 1.1f : 1.05f; acceleration *= velocityMult; velocity *= velocityMult; chargeTime -= chargeTimeDecrease; @@ -1846,7 +1838,7 @@ namespace CalamityMod.NPCs.Yharon if (!targetDead) { - if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance) + if (Vector2.Distance(NPC.Center, destination) > reduceSpeedChargeDistance && NPC.localAI[1] <= fastChargeTelegraphTime * 0.5f) NPC.SimpleFlyMovement(desiredVelocity, acceleration); else NPC.velocity *= 0.98f; @@ -2005,7 +1997,7 @@ namespace CalamityMod.NPCs.Yharon float amount = 0.04f; if (NPC.spriteDirection == -1) - newRotation += pie; + newRotation += MathHelper.Pi; if (amount != 0f) NPC.rotation = NPC.rotation.AngleTowards(newRotation, amount); @@ -2025,19 +2017,13 @@ namespace CalamityMod.NPCs.Yharon if (Main.netMode != NetmodeID.MultiplayerClient) { - if (CalamityWorld.LegendaryMode && revenge) - { - if (!NPC.AnyNPCs(ModContent.NPCType())) - NPC.SpawnOnPlayer(NPC.FindClosestPlayer(), ModContent.NPCType()); - } - float bulletHellTeleportLocationDistance = 540f; Vector2 teleportLocation = -Vector2.UnitY * bulletHellTeleportLocationDistance * (targetData.velocity.Y >= 0f).ToDirectionInt(); Vector2 center = targetData.Center + teleportLocation; NPC.Center = center; int type = ModContent.ProjectileType(); - int damage = Main.zenithWorld ? NPC.GetProjectileDamage(type) : 0; + int damage = Main.zenithWorld ? VortexDamage : 0; float bulletHellVortexDuration = spinPhaseTimer + 15f; int extraTime = Main.zenithWorld ? 300 : 0; Projectile.NewProjectile(NPC.GetSource_FromAI(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, bulletHellVortexDuration + extraTime, NPC.whoAmI); @@ -2068,7 +2054,7 @@ namespace CalamityMod.NPCs.Yharon float amount = 0.04f; if (NPC.spriteDirection == -1) - newRotation += pie; + newRotation += MathHelper.Pi; if (amount != 0f) NPC.rotation = NPC.rotation.AngleTowards(newRotation, amount); @@ -2145,7 +2131,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = vector.ToRotation(); if (NPC.spriteDirection == -1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.velocity = vector * chargeSpeed; @@ -2177,7 +2163,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = vector.ToRotation(); if (NPC.spriteDirection == -1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.velocity = vector * chargeSpeed * fastChargeVelocityMultiplier; @@ -2196,7 +2182,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] == 1f) SoundEngine.PlaySound(ShortRoarSound, NPC.Center); - ChargeDust(7, pie); + ChargeDust(7); NPC.ai[1] += 1f; if (NPC.ai[1] >= chargeTime) @@ -2244,7 +2230,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = vector.ToRotation(); if (NPC.spriteDirection == -1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.velocity = vector * fireballBreathPhaseVelocity; @@ -2253,6 +2239,9 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] >= fireballBreathTimer) { + // Set damage once charge starts + NPC.damage = setDamage; + if (NPC.ai[1] % (expertMode ? 6f : 8f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { float xOffset = 30f; @@ -2260,12 +2249,8 @@ namespace CalamityMod.NPCs.Yharon Vector2 projectileVelocity = NPC.velocity; projectileVelocity.Normalize(); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_FromAI(), position, projectileVelocity, type, damage, 0f, Main.myPlayer); + Projectile.NewProjectile(NPC.GetSource_FromAI(), position, projectileVelocity, type, FlareDamage, 0f, Main.myPlayer); } - - if (Math.Abs(targetData.Center.X - NPC.Center.X) > 700f && Math.Abs(NPC.velocity.X) < chargeSpeed) - NPC.velocity.X += Math.Sign(NPC.velocity.X) * 0.5f; } if (NPC.ai[1] >= fireballBreathPhaseTimer) @@ -2308,7 +2293,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = yharonFireballMoveDirection.ToRotation(); if (NPC.spriteDirection == -1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; NPC.velocity = yharonFireballMoveDirection * splittingFireballBreathPhaseVelocity; SoundEngine.PlaySound(FireSound, NPC.Center); @@ -2323,9 +2308,8 @@ namespace CalamityMod.NPCs.Yharon int yharonFireballTimer = (int)(NPC.ai[1] - splittingFireballBreathTimer + 1f); int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); if (yharonFireballTimer <= splittingFireballBreathTimer2 && yharonFireballTimer % splittingFireballBreathDivisor == 0 && Main.netMode != NetmodeID.MultiplayerClient) - Projectile.NewProjectile(NPC.GetSource_FromAI(), position, NPC.velocity, type, damage, 0f, Main.myPlayer, 0f, 0f); + Projectile.NewProjectile(NPC.GetSource_FromAI(), position, NPC.velocity, type, FireballDamage, 0f, Main.myPlayer, 0f, 0f); } if (NPC.ai[1] > splittingFireballBreathPhaseTimer - splittingFireballBreathYVelocityTimer) @@ -2365,17 +2349,17 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] % flareDustSpawnDivisor2 == 0f) { int totalProjectiles = secondPhasePhase == 4 ? 12 : 10; - float projectileVelocity = secondPhasePhase == 4 ? 16f : 12f; + float projectileVelocity = secondPhasePhase == 4 ? 17f : 13f; float radialOffset = secondPhasePhase == 4 ? 2.8f : 3.2f; if (NPC.localAI[3] == 0f) { - DoFlareDustBulletHell(1, spinPhaseTimer, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, projectileVelocity, radialOffset, true); + DoFlareDustBulletHell(1, spinPhaseTimer, FlareDamage, totalProjectiles, projectileVelocity, radialOffset, true); } else { int ringReduction = (int)MathHelper.Lerp(0f, 12f, NPC.ai[1] / spinPhaseTimer); int totalProjectiles2 = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor2, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles2, 0f, 0f, true); + DoFlareDustBulletHell(0, flareDustSpawnDivisor2, FlareDamage, totalProjectiles2, 0f, 0f, true); } } } @@ -2385,7 +2369,7 @@ namespace CalamityMod.NPCs.Yharon { int ringReduction = (int)MathHelper.Lerp(0f, 12f, NPC.ai[1] / spinPhaseTimer); int totalProjectiles = 38 - ringReduction; // 36 for first ring, 24 for last ring - DoFlareDustBulletHell(0, flareDustSpawnDivisor, NPC.GetProjectileDamage(ModContent.ProjectileType()), totalProjectiles, 0f, 0f, true); + DoFlareDustBulletHell(0, flareDustSpawnDivisor, FlareDamage, totalProjectiles, 0f, 0f, true); } } @@ -2450,7 +2434,7 @@ namespace CalamityMod.NPCs.Yharon { SoundEngine.PlaySound(ShortRoarSound, NPC.Center); - DoFireRing(expertMode ? 300 : 180, NPC.GetProjectileDamage(ModContent.ProjectileType()), NPC.target, 1f); + DoFireRing(expertMode ? 300 : 180, FlareDamage, NPC.target, 1f); } } @@ -2480,7 +2464,7 @@ namespace CalamityMod.NPCs.Yharon if (NPC.ai[1] == 1f) SoundEngine.PlaySound(ShortRoarSound, NPC.Center); - ChargeDust(14, pie); + ChargeDust(14); NPC.ai[1] += 1f; if (NPC.ai[1] >= chargeTime) @@ -2545,7 +2529,7 @@ namespace CalamityMod.NPCs.Yharon NPC.rotation = vector.ToRotation(); if (NPC.spriteDirection == -1) - NPC.rotation += pie; + NPC.rotation += MathHelper.Pi; if (NPC.ai[2] == 120f) { @@ -2604,10 +2588,10 @@ namespace CalamityMod.NPCs.Yharon case 4: rotationSpeed = 0.01f; - facingAngle = pie; + facingAngle = MathHelper.Pi; if (NPC.spriteDirection == 1) - facingAngle += pie; + facingAngle += MathHelper.Pi; break; case 6: @@ -2615,13 +2599,13 @@ namespace CalamityMod.NPCs.Yharon facingAngle = 0f; if (NPC.spriteDirection == -1) - facingAngle -= pie; + facingAngle -= MathHelper.Pi; break; } if (NPC.spriteDirection == -1) - facingAngle += pie; + facingAngle += MathHelper.Pi; if (rotationSpeed != 0f) NPC.rotation = NPC.rotation.AngleTowards(facingAngle, rotationSpeed); @@ -2629,13 +2613,13 @@ namespace CalamityMod.NPCs.Yharon #endregion #region Charge Dust - private void ChargeDust(int dustAmt, float pie) + private void ChargeDust(int dustAmt) { for (int i = 0; i < dustAmt; i++) { Vector2 dustRotate = Vector2.Normalize(NPC.velocity) * new Vector2((NPC.width + 50) / 2f, NPC.height) * 0.75f; - dustRotate = dustRotate.RotatedBy((i - (dustAmt / 2 - 1)) * (double)pie / (float)dustAmt) + NPC.Center; - Vector2 dustVel = ((float)(Main.rand.NextDouble() * pie) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); + dustRotate = dustRotate.RotatedBy((i - (dustAmt / 2 - 1)) * MathHelper.Pi / (float)dustAmt) + NPC.Center; + Vector2 dustVel = ((float)(Main.rand.NextDouble() * MathHelper.Pi) - MathHelper.PiOver2).ToRotationVector2() * Main.rand.Next(3, 8); int chargeDust = Dust.NewDust(dustRotate + dustVel, 0, 0, DustID.CopperCoin, dustVel.X * 2f, dustVel.Y * 2f, 100, default, 1.4f); Main.dust[chargeDust].noGravity = true; Main.dust[chargeDust].noLight = true; @@ -3004,7 +2988,7 @@ namespace CalamityMod.NPCs.Yharon // Equipment normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); - normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); + normalOnly.Add(DropHelper.PerPlayer(ModContent.ItemType())); } // Trophy (always directly from boss, never in bag) @@ -3024,7 +3008,7 @@ namespace CalamityMod.NPCs.Yharon npcLoot.AddConditionalPerPlayer(() => !DownedBossSystem.downedYharon, ModContent.ItemType(), desc: DropHelper.FirstKillText); } - public override void BossLoot(ref string name, ref int potionType) + public override void BossLoot(ref int potionType) { potionType = ModContent.ItemType(); } @@ -3059,21 +3043,12 @@ namespace CalamityMod.NPCs.Yharon for (int i = 0; i < 4; i++) { int type = ModContent.ProjectileType(); - int damage = NPC.GetProjectileDamage(type); - Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, damage, 0f, Main.myPlayer, 360, NPC.whoAmI); + Projectile.NewProjectile(NPC.GetSource_Death(), NPC.Center, Vector2.Zero, type, VortexDamage, 0f, Main.myPlayer, 360, NPC.whoAmI); } } } #endregion - #region On Hit Player - public override void OnHitPlayer(Player target, Player.HurtInfo hurtInfo) - { - if (hurtInfo.Damage > 0) - target.AddBuff(ModContent.BuffType(), 180); - } - #endregion - #region HP Bar Cooldown Slot and Stats public override bool? DrawHealthBar(byte hbPosition, ref float scale, ref Vector2 position) { @@ -3090,7 +3065,6 @@ namespace CalamityMod.NPCs.Yharon public override void ApplyDifficultyAndPlayerScaling(int numPlayers, float balance, float bossAdjustment) { NPC.lifeMax = (int)(NPC.lifeMax * 0.8f * balance * bossAdjustment); - NPC.damage = (int)(NPC.damage * NPC.GetExpertDamageMultiplier()); } #endregion @@ -3119,7 +3093,7 @@ namespace CalamityMod.NPCs.Yharon bool doTelegraphFlightAnimation = NPC.localAI[1] < fastChargeTelegraphTime * 0.5f || NPC.localAI[1] > fastChargeTelegraphTime - (fastChargeTelegraphTime / 6f); bool doTelegraphRoarAnimation = NPC.localAI[1] > fastChargeTelegraphTime - fastChargeTelegraphTime * 0.4f && NPC.localAI[1] < fastChargeTelegraphTime - fastChargeTelegraphTime * 0.2f; - bool phase4 = startSecondAI && lifeRatio <= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.165f : 0.11f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive); + bool phase4 = startSecondAI && lifeRatio <= ((CalamityWorld.death || BossRushEvent.BossRushActive) ? 0.2f : 0.15f) && (CalamityWorld.revenge || BossRushEvent.BossRushActive); if (doTelegraphFlightAnimation) { NPC.frameCounter += phase4 ? 2D : 1D; diff --git a/Packets/Players/ExaltationDirectionSyncPacket.cs b/Packets/Players/ExaltationDirectionSyncPacket.cs new file mode 100644 index 0000000000..1a1c483d76 --- /dev/null +++ b/Packets/Players/ExaltationDirectionSyncPacket.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.CalPlayer; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Packets +{ + public sealed class ExaltationDirectionSyncPacket : CalamityPacket + { + public static ExaltationDirectionSyncPacket Instance { get; private set; } + + public override byte MessageType => (byte)CalamityModMessageType.ExaltationDirection; + + public static void Send(CalamityPlayer playerToSync, int toClient = -1, int ignoreClient = -1) + { + if (playerToSync is null) + return; + + var packet = Instance.CreateBasePacket(); + packet.WriteWhoAmI(playerToSync); + packet.Write(playerToSync.InvertExaltationLineRotationDirections); + packet.Send(toClient, ignoreClient); + } + + public override void HandlePacket(in BinaryReader packet, int sender) + { + var player = packet.ReadCalamityPlayer(); + var invertDir = packet.ReadBoolean(); + + if (player is null) + return; + + player.InvertExaltationLineRotationDirections = invertDir; + + if (Main.dedServ) + Send(player, ignoreClient: sender); + } + } +} diff --git a/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs index 3ba126974b..c153053208 100644 --- a/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs +++ b/Packets/TileEntities/TEUpdateCodebreakerContainedStuffPacket.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Packets packet.Write(codeBreaker.InputtedCellCount); packet.Write(codeBreaker.InitialCellCountBeforeDecrypting); packet.Write(codeBreaker.HeldSchematicID); - packet.Write(codeBreaker.ContainsBloodSample); + packet.Write(codeBreaker.ContainsBloodyVein); packet.Send(toClient, ignoreClient); } @@ -35,7 +35,7 @@ namespace CalamityMod.Packets int cellCount = packet.ReadInt32(); int cellCountBeforeDecrypting = packet.ReadInt32(); int schematicID = packet.ReadInt32(); - bool containsBloodSample = packet.ReadBoolean(); + bool containsBloodyVein = packet.ReadBoolean(); // Verify to ensure that the tile entity is a valid one. if (codeBreaker is null) @@ -44,7 +44,7 @@ namespace CalamityMod.Packets codeBreaker.InputtedCellCount = cellCount; codeBreaker.InitialCellCountBeforeDecrypting = cellCountBeforeDecrypting; codeBreaker.HeldSchematicID = schematicID; - codeBreaker.ContainsBloodSample = containsBloodSample; + codeBreaker.ContainsBloodyVein = containsBloodyVein; } } } diff --git a/Particles/FlameExplosion.cs b/Particles/FlameExplosion.cs index 6403703253..cb484bc753 100644 --- a/Particles/FlameExplosion.cs +++ b/Particles/FlameExplosion.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Particles private float OriginalScale; private float FinalScale; + private float baseOpacity; private float opacity; private Vector2 Squish; private Color BaseColor; @@ -31,6 +32,7 @@ namespace CalamityMod.Particles Lifetime = lifeTime; Squish = squish; Rotation = rotation; + baseOpacity = opacity; } public override void Update() @@ -38,7 +40,7 @@ namespace CalamityMod.Particles float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress); - opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2); + opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) * baseOpacity; Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); diff --git a/Particles/GeneralParticleHandler.cs b/Particles/GeneralParticleHandler.cs index 5edab9f428..415b7653c4 100644 --- a/Particles/GeneralParticleHandler.cs +++ b/Particles/GeneralParticleHandler.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; +using CalamityMod.Graphics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -28,6 +29,27 @@ namespace CalamityMod.Particles private static List batchedNonPremultipliedParticles; private static List batchedAdditiveBlendParticles; + private static ManagedRenderTarget PixelationTarget_AlphaBlend; + private static ManagedRenderTarget PixelationTarget_NonPremultiplied; + private static ManagedRenderTarget PixelationTarget_AdditiveBlend; + + /// + /// Whether or not the system is currently rendering any pixelated prticles to the render target or not. + /// + private static bool CurrentlyRendering { get; set; } + + /// + /// The resolution ratio at which pixelated particles should draw.
+ /// 0.5f will draw at half resolution, 0.25f will draw at quarter resolution, etc. + ///
+ private const float PixelationResolution = 0.5f; + + /// + /// Creates a render target at half the screen's dimensions. + /// This is done due to the fact that when the target itself drawn, it needs to be drawn at double the original scale in order to pixelate its contents + /// + private static RenderTarget2D CreatePixelTarget(int width, int height) => new(Main.instance.GraphicsDevice, (int)(width * PixelationResolution), (int)(height * PixelationResolution)); + public override void PostSetupContent() { Type baseParticleType = typeof(Particle); @@ -49,6 +71,8 @@ namespace CalamityMod.Particles texturePath = instance.Texture; particleTextures[ID] = ModContent.Request(texturePath, AssetRequestMode.ImmediateLoad).Value; }); + + On_Main.CheckMonoliths += DrawToTarget; } public override void Load() @@ -62,6 +86,13 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles = []; batchedNonPremultipliedParticles = []; batchedAdditiveBlendParticles = []; + + Main.QueueMainThreadAction(() => + { + PixelationTarget_AlphaBlend = new(true, CreatePixelTarget); + PixelationTarget_NonPremultiplied = new(true, CreatePixelTarget); + PixelationTarget_AdditiveBlend = new(true, CreatePixelTarget); + }); } public override void Unload() @@ -75,6 +106,8 @@ namespace CalamityMod.Particles batchedAlphaBlendParticles = null; batchedNonPremultipliedParticles = null; batchedAdditiveBlendParticles = null; + + On_Main.CheckMonoliths -= DrawToTarget; } /// @@ -135,6 +168,90 @@ namespace CalamityMod.Particles particlesToKill.Add(particle); } + private static void DrawToTarget(On_Main.orig_CheckMonoliths orig) + { + if (Main.gameMenu) + { + orig(); + return; + } + + List pixelatedAlphaBlendParticles = []; + List pixelatedNonPremultipliedParticles = []; + List pixelatedAdditiveBlendParticles = []; + + // Add each particle to their respective lists. + foreach (Particle particle in particles) + { + if (particle != null && particle.Pixelate) + { + pixelatedAlphaBlendParticles.AddWithCondition(particle, !particle.UseAdditiveBlend && !particle.UseHalfTransparency); + pixelatedNonPremultipliedParticles.AddWithCondition(particle, !particle.UseAdditiveBlend && particle.UseHalfTransparency); + pixelatedAdditiveBlendParticles.AddWithCondition(particle, particle.UseAdditiveBlend && !particle.UseHalfTransparency); + } + } + + CurrentlyRendering = true; + + Matrix pixelationMatrix = Main.GameViewMatrix.TransformationMatrix + * Matrix.CreateScale(PixelationResolution / Main.GameViewMatrix.Zoom.X, PixelationResolution / Main.GameViewMatrix.Zoom.Y, 1f) + * Matrix.CreateTranslation(Main.GameViewMatrix.Translation.X * PixelationResolution, Main.GameViewMatrix.Translation.Y * PixelationResolution, 0f); + + DrawParticlesToRenderTarget(PixelationTarget_AlphaBlend, pixelatedAlphaBlendParticles, BlendState.AlphaBlend, pixelationMatrix); + DrawParticlesToRenderTarget(PixelationTarget_NonPremultiplied, pixelatedNonPremultipliedParticles, BlendState.NonPremultiplied, pixelationMatrix); + DrawParticlesToRenderTarget(PixelationTarget_AdditiveBlend, pixelatedAdditiveBlendParticles, BlendState.Additive, pixelationMatrix); + + Main.instance.GraphicsDevice.SetRenderTarget(null); + CurrentlyRendering = false; + + orig(); + } + + private static void DrawParticlesToRenderTarget(RenderTarget2D target, List particles, BlendState blendStateToUse, Matrix pixelationMatrix) + { + target.SwapTo(); + + if (particles.Count > 0) + { + Main.spriteBatch.Begin(SpriteSortMode.Deferred, blendStateToUse, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, pixelationMatrix); + + foreach (Particle particle in particles) + { + if (particle.UseCustomDraw) + { + particle.CustomDraw(Main.spriteBatch); + } + else + { + Color lightColor = particle.Color; + if (particle.AffectedByLight) + lightColor = particle.Color.MultiplyRGB(Lighting.GetColor((particle.Position / 16).ToPoint())); + + Rectangle frame = particleTextures[particle.Type].Frame(1, particle.FrameVariants, 0, particle.Variant); + Main.spriteBatch.Draw(particleTextures[particle.Type], particle.Position - Main.screenPosition, frame, lightColor, particle.Rotation, frame.Size() * 0.5f, particle.Scale, SpriteEffects.None, 0f); + } + } + + Main.spriteBatch.End(); + } + } + + private static void DrawPixelatedParticles() + { + DrawScaledTarget(PixelationTarget_AlphaBlend, Main.spriteBatch, BlendState.AlphaBlend); + DrawScaledTarget(PixelationTarget_NonPremultiplied, Main.spriteBatch, BlendState.NonPremultiplied); + DrawScaledTarget(PixelationTarget_AdditiveBlend, Main.spriteBatch, BlendState.Additive); + } + + private static void DrawScaledTarget(ManagedRenderTarget targetToDraw, SpriteBatch spriteBatch, BlendState blendState) + { + const float inversePixelationScale = 1f / PixelationResolution; + + spriteBatch.Begin(SpriteSortMode.Deferred, blendState, SamplerState.PointClamp, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + spriteBatch.Draw(targetToDraw, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, inversePixelationScale, SpriteEffects.None, 0f); + spriteBatch.End(); + } + public static void DrawAllParticles(SpriteBatch sb) { if (Main.dedServ) @@ -155,6 +272,9 @@ namespace CalamityMod.Particles if (particle == null) continue; + if (particle.Pixelate) + continue; + if (particle.UseAdditiveBlend) batchedAdditiveBlendParticles.Add(particle); else if (particle.UseHalfTransparency) @@ -233,6 +353,9 @@ namespace CalamityMod.Particles batchedNonPremultipliedParticles.Clear(); batchedAdditiveBlendParticles.Clear(); + // Draw all pixelated particles. + DrawPixelatedParticles(); + sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.Transform); } diff --git a/Particles/MiniFlower.png b/Particles/MiniFlower.png new file mode 100644 index 0000000000..793d007ecd Binary files /dev/null and b/Particles/MiniFlower.png differ diff --git a/Particles/Particle.cs b/Particles/Particle.cs index 41665cfd2d..0681436106 100644 --- a/Particles/Particle.cs +++ b/Particles/Particle.cs @@ -57,10 +57,17 @@ namespace CalamityMod.Particles public virtual int FrameVariants => 1; public int Variant = 0; public virtual string Texture => ""; + + /// + /// Whether or not your particle should be drawn slightly pixelated to match Terraria's pixel size. + /// + public virtual bool Pixelate => false; + /// /// Set this to true to disable default particle drawing, thus calling Particle.CustomDraw() instead. /// public virtual bool UseCustomDraw => false; + /// /// Use this method if you want to handle the particle drawing yourself. Only called if Particle.UseCustomDraw is set to true. /// diff --git a/Particles/RoundedStar.png b/Particles/RoundedStar.png new file mode 100644 index 0000000000..f88faa5601 Binary files /dev/null and b/Particles/RoundedStar.png differ diff --git a/Particles/RoundedStarParticle.cs b/Particles/RoundedStarParticle.cs new file mode 100644 index 0000000000..fbb55e8e3b --- /dev/null +++ b/Particles/RoundedStarParticle.cs @@ -0,0 +1,82 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using CalamityMod.Particles; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Particles +{ + public class RoundedStarParticle : Particle + { + public override string Texture => "CalamityMod/Particles/RoundedStar"; + + public float RotationSpeed; + public float Deceleration; + + public bool UseSpiralAI; + private int OwnerIndex; + private float InitialRadius; + private float OrbitalAngle; + + public override bool UseCustomDraw => true; + public RoundedStarParticle(Vector2 position, Vector2 velocity, Color color, float scale, int lifetime, float rotationSpeed, float deceleration, bool useSpiralAI, Vector2 spiralTarget, int ownerIndex) + { + Position = position; + Velocity = velocity; + Color = color; + Scale = scale; + Lifetime = lifetime; + RotationSpeed = rotationSpeed; + Deceleration = deceleration; + UseSpiralAI = useSpiralAI; + OwnerIndex = ownerIndex; + + if (UseSpiralAI) + { + // Store the initial radius and angle relative to the player + Vector2 directionToPlayer = Position - Main.player[OwnerIndex].Center; + InitialRadius = directionToPlayer.Length(); + OrbitalAngle = directionToPlayer.ToRotation(); + } + } + + public override void Update() + { + if (UseSpiralAI) + { + OrbitalAngle += RotationSpeed; + + float fadeScale = 1f - (Time / (float)Lifetime); + float currentRadius = InitialRadius * fadeScale; + + Vector2 playerCenter = Main.player[OwnerIndex].Center; + + Vector2 newRelativePosition = OrbitalAngle.ToRotationVector2() * currentRadius; + + // Update the particle's position. + Position = playerCenter + newRelativePosition; + } + else + { + // If not using the spiral AI, apply deceleration + Velocity *= Deceleration; + Position += Velocity; + } + + Rotation += RotationSpeed; + Time++; + if (Time >= Lifetime) + Kill(); + } + + public override void CustomDraw(SpriteBatch spriteBatch) + { + float fade = 1f - (Time / (float)Lifetime); + float scaleFade = Scale * fade; + + Texture2D tex = ModContent.Request(Texture).Value; + spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * fade, Rotation, tex.Size() / 2f, Scale, SpriteEffects.None, 0f); + } + } +} diff --git a/Particles/SquishyLightParticle.cs b/Particles/SquishyLightParticle.cs index ab80277fa6..39b1e87178 100644 --- a/Particles/SquishyLightParticle.cs +++ b/Particles/SquishyLightParticle.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Particles public override bool UseCustomDraw => true; public override bool SetLifetime => true; - public float Opacity; public float SquishStrenght; public float MaxSquish; diff --git a/Physics/Rope.cs b/Physics/Rope.cs new file mode 100644 index 0000000000..746495c53a --- /dev/null +++ b/Physics/Rope.cs @@ -0,0 +1,229 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.Physics; + +internal class Rope +{ + /// + /// A 0-1 interpolant which dictates a dampning factor for velocity integration increments. + /// + private float MovementSpeedDampingCoefficient + { + get; + set; + } + + /// + /// A timer that increments in respond to wind, assuming wind response is enabled in the . + /// + private float WindTime + { + get; + set; + } + + /// + /// The set of segments that compose this rope. + /// + public RopeSegment[] Segments + { + get; + set; + } + + /// + /// The set of positions that compose this rope. + /// + public Vector2[] SegmentPositions + { + get; + private set; + } + + /// + /// The desired distance between each segment on the rope. + /// + public float DistancePerSegment + { + get; + set; + } + + /// + /// The gravity force to exert on the rope when updating. + /// + public Vector2 Gravity + { + get; + set; + } + + /// + /// The amount of steps to perform when constraining tiles to their desired lengths. Higher values equate to greater accuracy, but reduced performance. + /// + public int ConstraintSteps + { + get; + private set; + } + + /// + /// Sets of settings that dictate how this rope should behave. + /// + public RopeSettings Settings + { + get; + set; + } + + /// + /// Whether this rope should collide with tiles or not. + /// + public bool InteractWithTiles => Settings.TileColliderArea is not null; + + public Rope(Vector2 start, Vector2 end, int segmentCount, float distancePerSegment, Vector2 gravity, RopeSettings settings, int constraintSteps = 10) + { + Segments = new RopeSegment[segmentCount]; + SegmentPositions = new Vector2[segmentCount]; + for (var i = 0; i < segmentCount; i++) + { + var segmentPos = Vector2.Lerp(start, end, i / (segmentCount - 1f)); + Segments[i] = new RopeSegment(segmentPos); + } + + Segments[0].FixedInPlace = settings.StartIsFixed; + Segments[^1].FixedInPlace = settings.EndIsFixed; + RecalculateSegmentPositions(); + + DistancePerSegment = distancePerSegment; + Gravity = gravity; + ConstraintSteps = constraintSteps; + + Settings = settings; + } + + /// + /// Recalculates the cache based on positions. + /// + private void RecalculateSegmentPositions() + { + for (var i = 0; i < Segments.Length; i++) + SegmentPositions[i] = Segments[i].Position; + } + + /// + /// Moves a given position around, obeying tile interaction rules if this rope requires them. + /// + /// The position vector to move. + /// The base velocity to consider. + private void Move(ref Vector2 position, Vector2 baseVelocity) + { + // Apply standard Eulerian integration if tile interactions are not required. + if (!InteractWithTiles || Settings.TileColliderArea is null) + { + position += baseVelocity; + return; + } + + // If tile interactions *are* required, handle them before moving forward. + var width = (int)Settings.TileColliderArea.Value.X; + var height = (int)Settings.TileColliderArea.Value.Y; + var newVelocity = Collision.noSlopeCollision(position, baseVelocity, width, height + 2, true, true); + newVelocity = Collision.noSlopeCollision(position, newVelocity, width, height, true, true); + var finalVelocity = baseVelocity; + if (Math.Abs(baseVelocity.X) > Math.Abs(newVelocity.X)) + finalVelocity.X = 0f; + if (Math.Abs(baseVelocity.Y) > Math.Abs(newVelocity.Y)) + finalVelocity.Y = 0f; + + position += finalVelocity; + } + + /// + /// Updates this rope, making it move around. + /// + public void Update() + { + for (var i = 0; i < Segments.Length; i++) + { + var movementStep = (Segments[i].Position - Segments[i].OldPosition) * (1f - MovementSpeedDampingCoefficient); + if (movementStep.Length() < 0.02f) + movementStep = Vector2.Zero; + + Segments[i].OldPosition = Segments[i].Position; + + if (!Segments[i].FixedInPlace) + Move(ref Segments[i].Position, movementStep + Gravity); + } + + for (var i = 0; i < ConstraintSteps; i++) + Constrain(); + + RecalculateSegmentPositions(); + + if (Settings.RespondToEntityMovement) + HandleEntityMovementResponse(); + if (Settings.RespondToWind) + HandleWindResponse(); + } + + /// + /// Makes this rope respond to the movement of entities. + /// + private void HandleEntityMovementResponse() + { + for (var i = 0; i < Segments.Length; i++) + { + ref RopeSegment ropeSegment = ref Segments[i]; + if (ropeSegment.FixedInPlace) + continue; + + foreach (var player in Main.ActivePlayers) + { + float playerProximityInterpolant = Utils.GetLerpValue(37f, 10f, player.Distance(ropeSegment.Position), true); + ropeSegment.Position += player.velocity * playerProximityInterpolant / Settings.Mass * 0.08f; + } + } + } + + /// + /// Makes this entity respond to wind. + /// + private void HandleWindResponse() + { + WindTime += Main.windSpeedCurrent / 60f; + if (MathF.Abs(WindTime) >= 4000f) + WindTime = 0f; + + var windSpeed = Math.Clamp(Main.WindForVisuals * 2f, -1.3f, 1.3f); + var windWave = MathF.Cos(WindTime * 3.42f + Segments[0].Position.Length() * 0.06f); + var wind = Vector2.UnitX * (windWave + Main.windSpeedCurrent) * -0.2f; + + Segments[^1].Position += wind * Utils.GetLerpValue(0.3f, 0.75f, windSpeed, true) / Settings.Mass; + } + + /// + /// Constrains segments on this rope, conserving their overall length. + /// + public void Constrain() + { + for (var i = 0; i < Segments.Length - 1; i++) + { + // Determine how much each segment has to move in order to return to its desired resting distance. + var segmentLength = Segments[i].Position.Distance(Segments[i + 1].Position); + var distanceFromIdealLength = segmentLength - DistancePerSegment; + Vector2 correctiveForce = (Segments[i].Position - Segments[i + 1].Position).SafeNormalize(Vector2.Zero) * distanceFromIdealLength; + + var pinned = Segments[i].FixedInPlace; + var nextPinned = Segments[i + 1].FixedInPlace; + correctiveForce *= pinned || nextPinned ? 1f : 0.5f; + + if (!pinned) + Move(ref Segments[i].Position, -correctiveForce); + if (!nextPinned) + Move(ref Segments[i + 1].Position, correctiveForce); + } + } +} diff --git a/Physics/RopeHandle.cs b/Physics/RopeHandle.cs new file mode 100644 index 0000000000..4b5c03570f --- /dev/null +++ b/Physics/RopeHandle.cs @@ -0,0 +1,73 @@ +using System.Collections.Generic; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; + +namespace CalamityMod.Physics; + +// Yes, I was silently reading over the Nightshade dev channels when learning about this. +// So, thanks Tomat and 1-3 for the idea! -Lucille +/// +/// A handle that contains a reference to a given globally managed rope instance. +/// +public readonly struct RopeHandle +{ + /// + /// The value used to identify this handle's associated rope managed by the central system. + /// + private readonly int Identifier; + + /// + /// The rope associated with this handle. + /// + private readonly Rope Rope => ModContent.GetInstance().Ropes[Identifier]!; + + /// + /// The set of all positions maintained by the underlying rope. + /// + public readonly IEnumerable Positions => Rope.SegmentPositions; + + /// + /// The amount of segments this rope has. + /// + public int SegmentCount => Rope.Segments.Length; + + /// + /// The starting position of the underlying rope. + /// + public ref Vector2 Start => ref Rope.Segments[0].Position; + + /// + /// The ending position of the underlying rope. + /// + public ref Vector2 End => ref Rope.Segments[^1].Position; + + /// + /// The gravity associated with the rope. + /// + public Vector2 Gravity + { + get => Rope.Gravity; + set => Rope.Gravity = value; + } + + internal RopeHandle(int identifier) => Identifier = identifier; + + /// + /// Forces this rope to settle by performing a series of constrained updates. + /// + public void Settle() + { + for (var i = 0; i < 20; i++) + Rope.Update(); + } + + /// + /// Indicates that the rope associated with this handle should be returned back to the pool. + /// + public void Dispose() + { + var chunkIndex = Identifier / RopeManagerSystem.BitsPerChunk; + var bitIndex = Identifier % RopeManagerSystem.BitsPerChunk; + ModContent.GetInstance().ToggleActivityIndex(chunkIndex, bitIndex); + } +} diff --git a/Physics/RopeManagerSystem.cs b/Physics/RopeManagerSystem.cs new file mode 100644 index 0000000000..0192cd3c48 --- /dev/null +++ b/Physics/RopeManagerSystem.cs @@ -0,0 +1,132 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using BitOperations = System.Numerics.BitOperations; + +namespace CalamityMod.Physics; + +public sealed class RopeManagerSystem : ModSystem +{ + /// + /// The set of all maintained ropes in the world. + /// + internal readonly Rope[] Ropes = new Rope[MaxRopeCount]; + + /// + /// The internal binary mappings that determine whether ropes are active or not. + /// + internal readonly ulong[] ActivityBitChunks = new ulong[(int)Math.Ceiling((double)MaxRopeCount / BitsPerChunk)]; + + /// + /// The maximum amount of ropes to maintain across the world. + /// + public const int MaxRopeCount = 2048; + + /// + /// The amount of bits contained within each chunk in the array. + /// + public const int BitsPerChunk = sizeof(ulong) * 8; + + public override void ClearWorld() + { + for (var i = 0; i < ActivityBitChunks.Length; i++) + ActivityBitChunks[i] = 0uL; + } + + public override void PostUpdateWorld() + { + for (var i = 0; i < Ropes.Length; i++) + { + var bitIndex = i % BitsPerChunk; + var active = (ActivityBitChunks[i / BitsPerChunk] >> bitIndex & 1) == 1; + if (active) + Ropes[i].Update(); + } + } + + /// + /// Toggles a given activity index. + /// + /// The index of the to toggle. + /// The bit index in the chunk to toggle. + internal void ToggleActivityIndex(int chunkIndex, int bitIndex) => ActivityBitChunks[chunkIndex] ^= 1uL << bitIndex; + + /// + /// Attempts to find and return the first available index for a new rope. + /// + private int? SelectFirstAvailableIndex() + { + for (var i = 0; i < ActivityBitChunks.Length; i++) + { + // This comment can be deleted later if it's deemed a bit too verbose. I'm half doing it for myself to test my understanding, half doing it for any future readers who might + // not immediately understand what the bit operations do here. -Lucille + + // As a simplified example, assume the following for the activity bits, where zero means inactive and one means active: + // 0110 1111 + + // This means the first four indices are occupied, but the fifth index is free. Note that in this case bits are counted from right to left. + // In order to find the first new index, we simply need to count the amount of ones until the first zero. + // Conveniently, BitOperations.TrailingZeroCount exists for this purpose. We just need to invert the binary in order to convert the ones into zeroes. + var offset = BitOperations.TrailingZeroCount(~ActivityBitChunks[i]); + + // Check if the index offset is equal to the amount of bits in the chunk. + // If so, that means that every single bit is a one, and that there's no available index in the chunk to use. + var allBitsAreOccupied = offset == BitsPerChunk; + if (allBitsAreOccupied) + continue; + + return offset + i * BitsPerChunk; + } + + // No valid index found across the activity bit chunks. Return null. + return null; + } + + /// + /// Requests a new rope, returning a handle to it, or null if for some reason the rope couldn't be created. + /// + public RopeHandle? RequestNew(Vector2 start, Vector2 end, int segmentCount, float distancePerSegment, Vector2 gravity, RopeSettings settings, int constraintSteps = 10) + { + var index = SelectFirstAvailableIndex(); + if (index is null) + return null; + + // Mark the newly selected index as active by toggling its activity state on. + ToggleActivityIndex(index.Value / BitsPerChunk, index.Value % BitsPerChunk); + + Ropes[index.Value] = new Rope(start, end, segmentCount, distancePerSegment, gravity, settings, constraintSteps); + + return new RopeHandle(index.Value); + } + + /// + /// Calculates the overall segment length of a rope based on the horizontal span between its two end points and a desired sag distance. + /// + public static float CalculateSegmentLength(float ropeSpan, float sag, int iterations = 12) + { + // A rope at rest is defined via a catenary curve, which exists in the following mathematical form: + // y(x) = a * cosh(x / a) + + // Furthermore, the length of a rope, given the horizontal width w for a rope, is defined as follows: + // L = 2a * sinh(w / 2a) + + // In order to use the above equation, the value of a must be determined for the catenary that this rope will form. + // To do so, a numerical solution will need to be found based on the known width and sag values. + + // Suppose the two supports are at equal height at distances -w/2 and w/2. + // From this, sag (which will be denoted with h) can be defined in the following way: h = y(w/2) - y(0) + // Reducing this results in the following equation: + + // h = a(cosh(w / 2a) - 1) + // a(cosh(w / 2a) - 1) - h = 0 + // This can be used to numerically find a. + var initialGuessA = sag; + var a = (float)CalamityUtils.IterativelySearchForRoot(x => + { + return x * (Math.Cosh(ropeSpan / (x * 2D)) - 1D) - sag; + }, initialGuessA, iterations); + + // Now that a is known, it's just a matter of plugging it back into the original equation to find L. + return MathF.Sinh(ropeSpan / a * 0.5f) * a * 2f; + } +} diff --git a/Physics/RopeSegment.cs b/Physics/RopeSegment.cs new file mode 100644 index 0000000000..81cb8708de --- /dev/null +++ b/Physics/RopeSegment.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Physics; + +/// +/// A representation of a rope segment, containing physical data such as position, velocity, etc., as well as a value which determines whether the rope is fixed in place and not subject to standard physics. +/// +public struct RopeSegment +{ + /// + /// The current position of this segment. + /// + public Vector2 Position; + + /// + /// The previous position of this segment. + /// + public Vector2 OldPosition; + + /// + /// Whether this segment is fixed in place and not subject to standard physics, such as gravity. + /// + public bool FixedInPlace; + + public RopeSegment(Vector2 position) + { + Position = position; + OldPosition = position; + } +} diff --git a/Physics/RopeSettings.cs b/Physics/RopeSettings.cs new file mode 100644 index 0000000000..133e1bc4f0 --- /dev/null +++ b/Physics/RopeSettings.cs @@ -0,0 +1,11 @@ +using Microsoft.Xna.Framework; + +namespace CalamityMod.Physics; + +public readonly record struct RopeSettings(bool StartIsFixed, bool EndIsFixed, bool RespondToEntityMovement, bool RespondToWind, Vector2? TileColliderArea, float Mass = 1f) +{ + public RopeSettings() : this(false, false, false, false, null, 1f) + { + + } +} diff --git a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs index 5d6e660d58..cf7e6014d3 100644 --- a/Projectiles/BaseProjectiles/BaseMinionProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseMinionProjectile.cs @@ -140,6 +140,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void SetStaticDefaults() { Main.projFrames[Type] = AnimationFrames; + // IMPORTANT: Setting Main.projPet disables projectile damage! If you are making a charging minion, be sure to override the MinionContactDamage hook Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; diff --git a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs similarity index 80% rename from Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs rename to Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs index 73c7b4c53b..9be0eb5191 100644 --- a/Projectiles/BaseProjectiles/BaseCustomMeleeSwingProjectile.cs +++ b/Projectiles/BaseProjectiles/BaseSwordHoldoutProjectile.cs @@ -12,6 +12,10 @@ using Terraria.GameContent.Prefixes; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; +using Terraria.Audio; +using System; +using System.IO; +using CalamityMod.Projectiles.Summon; namespace CalamityMod.Projectiles.BaseProjectiles { @@ -160,6 +164,24 @@ namespace CalamityMod.Projectiles.BaseProjectiles /// public virtual float RotateInStartup { get; set; } = 0.5f; + /// + /// Speed at which the projectile should rotate to match the mouse angle during Cooldown. + /// Set to 0 to disable. + /// Defaults to 0.5f + /// + public virtual float RotateInCooldown { get; set; } = 0.5f; + + /// + /// What sound to use when the sword begins the actual swing (after startup frames) + /// + public virtual SoundStyle? UseSound {get; set;} = null; + /// + /// The length (from the player) of the projectile's line collision. + /// This helps to prevent blindspots. + /// Defaults to 0 + /// + public virtual float lineCollisionLength { get; set; } = 0; + #endregion #region Fields @@ -169,6 +191,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles ///
public Vector2 angle { get; set; } = Vector2.Zero; /// + /// The projectile's center based on offset to the player the previous update + /// Can be used for effects that stay consistent in motion + /// + public Vector2 oldPlayerOffset { get; set; } + /// /// Internal timer for the projectile's entire lifespan /// public int timer { get; set; } = 0; @@ -250,10 +277,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles #endregion #region Overrides - public override void SetStaticDefaults() - { - ProjectileDestroyExceptionsList.List.Add(Projectile.type); - } /// /// DO NOT OVERRIDE IN MOST SITUATIONS /// use Defaults() instead. @@ -264,8 +287,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles Projectile.timeLeft = swingTime * 2; if (UsesBaseItem) { - Projectile.width = BaseItem.width; - Projectile.height = BaseItem.height; + Projectile.width = Projectile.height = Math.Max(BaseItem.height,BaseItem.width); } Projectile.friendly = true; Projectile.penetrate = -1; @@ -278,8 +300,6 @@ namespace CalamityMod.Projectiles.BaseProjectiles ProjectileID.Sets.TrailingMode[Projectile.type] = 2; ProjectileID.Sets.TrailCacheLength[Projectile.type] = 100; Defaults(); - - } /// /// DO NOT OVERRIDE IN MOST SITUATIONS @@ -301,8 +321,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles player.direction = -1; Projectile.spriteDirection = -1 * (int)player.gravDir; } + if (AlternateSwings && player.GetModPlayer().swingNum % 2 == 0) + { + Projectile.spriteDirection *= -1; + } swingTime = Main.player[Projectile.owner].HeldItem.useTime; Spawn(source); + StartupTime *= Projectile.MaxUpdates; + CooldownTime *= Projectile.MaxUpdates; + swingTime *= Projectile.MaxUpdates; if (useMeleeSpeed) { var speed = Main.player[Projectile.owner].GetAttackSpeed(); @@ -328,6 +355,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles baseScale = Projectile.scale; ExistsTime = swingTime + StartupTime + CooldownTime; Projectile.timeLeft = ExistsTime * 2; + Projectile.netUpdate = true; } /// @@ -338,11 +366,15 @@ namespace CalamityMod.Projectiles.BaseProjectiles public override void AI() { var player = Main.player[Projectile.owner]; + Projectile.gfxOffY = player.gfxOffY; var modplayer = player.GetModPlayer(); - float adust = MathHelper.ToRadians(45 + 180); + float adust = MathHelper.ToRadians(225); if (timer < StartupTime || timer > StartupTime + swingTime) { - angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInStartup); + if (inStartup) + angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInStartup); + if (inCooldown) + angle = Vector2.Lerp(angle, (player.Center - Main.MouseWorld).SafeNormalize(Vector2.One), RotateInCooldown); if (angle.X < 0) { player.direction = 1; @@ -362,23 +394,29 @@ namespace CalamityMod.Projectiles.BaseProjectiles if (AfterImageLength > 0) { oldProjectileRot.Add(Projectile.rotation); - oldProjectilePos.Add(Projectile.Center); + oldProjectilePos.Add(Projectile.Center + new Vector2(0, Projectile.gfxOffY)); if (oldProjectileRot.Count > AfterImageLength) { oldProjectileRot.RemoveAt(0); oldProjectilePos.RemoveAt(0); } } - var angle2 = (AlternateSwings && (modplayer.swingNum % 2 == 1 ? false : true) ? SwingFunction() : -SwingFunction()); + if (inSwing && swingTimer == 1 && UseSound != null) + { + SoundEngine.PlaySound((SoundStyle)UseSound,player.Center); + } + var angle2 = (AlternateSwings && (modplayer.swingNum % 2 == 1 ? false : true) ? SwingFunction() : SwingFunction()); Projectile.Center = armCenter - (angle * OffsetDistance * (1 + (Projectile.scale - 1) * 0.75f)).RotatedBy(Projectile.spriteDirection * angle2); Projectile.rotation = angle.RotatedBy(Projectile.spriteDirection * angle2).ToRotation() + adust; AdditionalAI(); - - player.itemTime = ExistsTime + 1 - timer; + oldPlayerOffset = Projectile.Center - player.Center; + player.itemTime = ExistsTime + 2 - timer; + player.itemAnimation = ExistsTime + 2 - timer; if (timer > ExistsTime) { - Projectile.Kill(); player.itemTime = 0; + player.itemAnimation = 0; + Projectile.Kill(); } timer++; if (timer >= StartupTime && timer < StartupTime + swingTime) @@ -403,11 +441,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles var col = Projectile.Opacity * (i / (float)AfterImageLength) * 0.1f; if (Projectile.spriteDirection == 1) { - Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, oldScale[i], SpriteEffects.None, 0); } else { - Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, 1, SpriteEffects.FlipHorizontally, 0); + Main.EntitySpriteDraw(texture, oldProjectilePos[i] - Main.screenPosition, null, Color.White * col, oldProjectileRot[i], texture.Size() / 2, oldScale[i], SpriteEffects.FlipHorizontally, 0); } } } @@ -427,7 +465,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["fireColor"].SetValue(trailColors[2].ToVector3()); - GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue((AlternateSwings && modplayer.swingNum % 2 == 1) ^ Projectile.spriteDirection == -1 ? false : true); + GameShaders.Misc["CalamityMod:ExobladeSlash"].Shader.Parameters["flipped"].SetValue(Projectile.spriteDirection == -1 ? false : true); GameShaders.Misc["CalamityMod:ExobladeSlash"].Apply(); var positionsToUse = Projectile.oldPos.Take((int)MathHelper.Min(trailLength,swingTimer)).ToArray(); @@ -452,6 +490,21 @@ namespace CalamityMod.Projectiles.BaseProjectiles hitbox.Location = (center - new Vector2(hitbox.Width / 2, hitbox.Height / 2)).ToPoint(); } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (lineCollisionLength > 0) + { + var player = Main.player[Projectile.owner]; + var armcenter = player.Center - new Vector2(5 * player.direction, 2); + var swordDir = armcenter.DirectionTo(Projectile.Center); + var collisionline = new Vector2(lineCollisionLength / 2f, 0).RotatedBy(swordDir.ToRotation())*Projectile.scale; + bool c = Collision.CheckAABBvLineCollision(targetHitbox.Location.ToVector2(), targetHitbox.Size(), Projectile.Center, Projectile.Center + collisionline); + if (c && !float.IsNaN(collisionline.X) && !float.IsNaN(collisionline.Y)) + return true; + } + return base.Colliding(projHitbox, targetHitbox); + } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { modifiers.HitDirectionOverride = ((Main.player[Projectile.owner].DirectionTo(target.Center)).X >= 0 ? 1 : -1); @@ -461,6 +514,32 @@ namespace CalamityMod.Projectiles.BaseProjectiles { return inSwing; } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.WriteVector2(angle); + writer.Write(swingTime); + writer.Write(StartupTime); + writer.Write(CooldownTime); + writer.Write(timer); + writer.Write(swingTimer); + writer.Write(ExistsTime); + writer.Write(baseScale); + writer.Write(Projectile.scale); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + angle = reader.ReadVector2(); + swingTime = reader.Read(); + StartupTime = reader.Read(); + CooldownTime = reader.Read(); + timer = reader.Read(); + swingTimer = reader.Read(); + ExistsTime = reader.Read(); + baseScale = reader.ReadSingle(); + Projectile.scale = reader.ReadSingle(); + } #endregion #region Helper Methods @@ -485,7 +564,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles return; } amount += 1; - if (timer % (swingTime / amount) == 0 && timer > 0 && timer < swingTime - swingTime / amount / 2) + if (swingTimer % (swingTime / amount) == 0 && swingTimer > 0 && swingTimer < swingTime - swingTime / amount / 2) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.rotation + negate * MathHelper.ToRadians(45 - negate * 90)).ToRotationVector2() * velocity, type, (int)(Projectile.damage * damagemod), Projectile.knockBack, Projectile.owner, ai0); } diff --git a/Projectiles/BaseProjectiles/BaseWormProjectile.cs b/Projectiles/BaseProjectiles/BaseWormProjectile.cs new file mode 100644 index 0000000000..65a276480f --- /dev/null +++ b/Projectiles/BaseProjectiles/BaseWormProjectile.cs @@ -0,0 +1,294 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.BaseProjectiles +{ + /// + /// Implementation to make ModProjectile worms much easier to make. + /// Modified version of BaseWormNPC to function on a ModProjectile instead of ModNPC + /// + public abstract class BaseWormProjectile : ModProjectile + { + #region Abstracts / Commonly Overridden Fields + /// + /// The amount of segments of this worm. This does not include the head + /// + public abstract int SegmentCount { get; } + /// + /// A list of the offsets to the next segment in the worm from this segment + /// DOES include the head + /// + public abstract List SegmentTypePositionOffsets { get; } + /// + /// A list of all textures for the segments to draw with + /// does NOT include the head + /// + public abstract List SegmentTextures { get; } + /// + /// Offsets for drawing each segment + /// + public List SegmentTypeDrawOffsets = new List(); + + /// + /// How far through the current animation this worm is + /// + public float AnimationFrame = 0; + /// + /// The active animation for the worm + /// + public WormAnimation ActiveAnimation = null; + #endregion + #region Segments + /// + /// The textures for each segment type of this worm. Works like getting a texture from TextureAssets + /// + public List> SegmentTextureAssets + { + get + { + if (internalTexAssets.Count == 0) + for (var i = 0; i < SegmentTextures.Count; i++) + { + internalTexAssets.Add(ModContent.Request(SegmentTextures[i])); + if (SegmentTypeDrawOffsets.Count <= i) + { + SegmentTypeDrawOffsets.Add(Vector2.Zero); + } + } + return internalTexAssets; + } + } + + /// + /// Internal list that stores the textureassets. + /// Use SegmentTextureAssets to get the data stored here. + /// + private List> internalTexAssets = new List>(); + + public List Segments = new(); + + public enum SegmentFollowLogic + { + Regular = 0, //Traditional worm segment logic + Exact = 1, //Follows the path the head took exactly + // In the future, add a segment logic that supports solid tile collisions and forces applied to *any* segment + } + + /// + /// Which type of segment following logic this worm should currently use + /// + public SegmentFollowLogic SegmentFollowType; + + /// + /// How rigid the segment should be when using default segment logic + /// + public float SegmentRigidity = 0.2f; + + /// + /// The points used by ExactSegmentLogic to exactly follow the head + /// + private List segmentPoints = new List(); + + /// + /// Updates the positions of the segments based on the value set in SegmentFollowType + /// + public void UpdateSegments() + { + Projectile.position += Projectile.velocity; //Update this segment's movement so that all other segments use this as the base. This is undone at the end of the method. + if (ActiveAnimation is not null) + { + ActiveAnimation.ApplyAnimationFrame(Projectile, AnimationFrame); + AnimationFrame++; + if (AnimationFrame > ActiveAnimation.AnimationKeyframes.Keys.Max()) + { + AnimationFrame = 0; + ActiveAnimation = null; + } + } + else + { + if (segmentPoints.Count < 1 || segmentPoints[0].Distance(Projectile.Center) > 8) + { + segmentPoints.Insert(0, Projectile.Center); + } + while (segmentPoints.Count > 300) + { + segmentPoints.RemoveAt(segmentPoints.Count - 1); + } + switch (SegmentFollowType) + { + case (SegmentFollowLogic.Regular): + RegularSegmentLogic(); + break; + case (SegmentFollowLogic.Exact): + ExactSegmentLogic(); + break; + } + } + Projectile.position -= Projectile.velocity; + + } + + private void RegularSegmentLogic() + { + for (int i = 0; i < Segments.Count; i++) + { + float segmentDistance = SegmentTypePositionOffsets[0]; + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + { + aheadSeg = Segments[i - 1]; + segmentDistance = SegmentTypePositionOffsets[Segments[i - 1].segmentType + 1]; + } + segmentDistance *= Projectile.scale; + Vector2 nexSegDir = aheadSeg.Center - thisSeg.Center; + if (aheadSeg.rotation != thisSeg.rotation) + { + nexSegDir = nexSegDir.RotatedBy(MathHelper.WrapAngle(aheadSeg.rotation - thisSeg.rotation) * SegmentRigidity); + nexSegDir = nexSegDir.MoveTowards((aheadSeg.rotation - thisSeg.rotation).ToRotationVector2(), 1f); + } + thisSeg.rotation = nexSegDir.ToRotation() + MathHelper.PiOver2; + thisSeg.Center = aheadSeg.Center - nexSegDir.SafeNormalize(Vector2.Zero) * segmentDistance; + + } + } + + private void ExactSegmentLogic() + { + float dist = 40f; + int segmentPointInUse = 0; + for (int i = 0; i < Segments.Count; i++) + { + var thisSeg = Segments[i]; + var aheadSeg = new BaseWormSegment(this); + if (i != 0) + aheadSeg = Segments[i - 1]; + bool hasMoved = false; + while (segmentPointInUse < segmentPoints.Count) + { + if (segmentPointInUse == 0) + { + if (aheadSeg.Center.Distance(segmentPoints[0]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[0]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + else + { + if (aheadSeg.Center.Distance(segmentPoints[segmentPointInUse]) >= dist) + { + thisSeg.Center = aheadSeg.Center + aheadSeg.Center.DirectionTo(segmentPoints[segmentPointInUse]) * dist; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + else + { + segmentPointInUse++; + } + } + } + if (!hasMoved && segmentPointInUse >= segmentPoints.Count) + { + thisSeg.Center = segmentPoints[segmentPoints.Count - 1]; + Segments[i].velocity = Segments[i].Center.DirectionTo(aheadSeg.Center); + Segments[i].rotation = Segments[i].velocity.ToRotation() + MathHelper.PiOver2; + hasMoved = true; + break; + } + } + } + #endregion + + #region Defaults + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 1600; //100 tiles offscreen + } + public override void SetDefaults() + { + for (var i = 0; i < SegmentCount - 1; i++) + { + Segments.Add(new BaseWormSegment(this, 0)); + } + Segments.Add(new BaseWormSegment(this, 1)); + } + #endregion + + #region Draw + public override bool PreDraw(ref Color lightColor) + { + for (int i = Segments.Count - 1; i >= 0; i--) + { + DrawSegment(ref lightColor, Segments[i]); + } + Main.spriteBatch.Draw(TextureAssets.Projectile[Type].Value, Projectile.Center - Main.screenPosition, null, lightColor * Projectile.Opacity, Projectile.rotation, TextureAssets.Projectile[Type].Value.Size() / 2, Projectile.scale, SpriteEffects.None, 1); + return false; + } + + public virtual void DrawSegment(ref Color lightColor, BaseWormSegment segment) + { + var color = Lighting.GetColor(segment.Center.ToTileCoordinates()); + if (!SegmentTextureAssets.IndexInRange(segment.segmentType)) + { + return; + } + var tex = SegmentTextureAssets[segment.segmentType].Value; + Main.spriteBatch.Draw(tex, segment.Center - Main.screenPosition, null, color *segment.Opacity, segment.rotation, tex.Size() / 2 + (SegmentTypeDrawOffsets[segment.segmentType]), Projectile.scale, SpriteEffects.None, 1); + } + #endregion + + #region Netcode + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(AnimationFrame); + } + public override void ReceiveExtraAI(BinaryReader reader) + { + AnimationFrame = reader.ReadSingle(); + } + #endregion + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + for (var i = 0; i < Segments.Count; i++) + { + var prevSeg = new BaseWormSegment(this); + if (i != 0) + { + prevSeg = Segments[i - 1]; + } + float cpoint = 0; + if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), prevSeg.Center, Segments[i].Center, 16, ref cpoint)) + { + return true; + } + } + return base.Colliding(projHitbox, targetHitbox); + } + } +} diff --git a/Projectiles/Boss/ApolloChargeTelegraph.cs b/Projectiles/Boss/ApolloChargeTelegraph.cs index b038018e4c..ea5ebbe5b6 100644 --- a/Projectiles/Boss/ApolloChargeTelegraph.cs +++ b/Projectiles/Boss/ApolloChargeTelegraph.cs @@ -37,12 +37,11 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - Projectile.timeLeft = bossRush ? 45 : death ? 60 : revenge ? 68 : expertMode ? 75 : 90; + Projectile.timeLeft = death ? 60 : revenge ? 68 : expertMode ? 75 : 90; if (Main.getGoodWorld) Projectile.timeLeft /= 2; } @@ -78,13 +77,12 @@ namespace CalamityMod.Projectiles.Boss } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Determine opacity - float telegraphTotalTime = bossRush ? 45f : death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; + float telegraphTotalTime = death ? 60f : revenge ? 68f : expertMode ? 75f : 90f; if (Main.getGoodWorld) telegraphTotalTime *= 0.5f; diff --git a/Projectiles/Boss/ApolloFireball.cs b/Projectiles/Boss/ApolloFireball.cs index 569a7b3921..ba04dae241 100644 --- a/Projectiles/Boss/ApolloFireball.cs +++ b/Projectiles/Boss/ApolloFireball.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -35,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; CooldownSlot = ImmunityCooldownID.Bosses; - Projectile.timeLeft = BossRushEvent.BossRushActive ? 48 : timeLeft; + Projectile.timeLeft = timeLeft; } public override void SendExtraAI(BinaryWriter writer) @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.tileCollide = true; int fadeInTime = 3; - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - ((BossRushEvent.BossRushActive ? 48 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); Lighting.AddLight(Projectile.Center, 0f, 0.6f * Projectile.Opacity, 0f); @@ -127,14 +128,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || Projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.CursedInferno, 180); - } - public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); @@ -164,7 +157,7 @@ namespace CalamityMod.Projectiles.Boss } // Plasma bolts - int totalProjectiles = BossRushEvent.BossRushActive ? 6 : 4; + int totalProjectiles = 4; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 0.5f; @@ -175,7 +168,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, Apollo.BoltDamage, 0f, Main.myPlayer); } } diff --git a/Projectiles/Boss/ApolloRocket.cs b/Projectiles/Boss/ApolloRocket.cs index 6b95f59bbb..65c5918527 100644 --- a/Projectiles/Boss/ApolloRocket.cs +++ b/Projectiles/Boss/ApolloRocket.cs @@ -118,10 +118,9 @@ namespace CalamityMod.Projectiles.Boss } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Light Lighting.AddLight(Projectile.Center, 0.2f, 1f, 0f); @@ -131,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; // Set AI to stop homing, start accelerating - float stopHomingDistance = bossRush ? 120f : death ? 160f : revenge ? 180f : expertMode ? 200f : 240f; + float stopHomingDistance = death ? 160f : revenge ? 180f : expertMode ? 200f : 240f; if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 480) { Projectile.ai[0] = 1f; @@ -144,7 +143,7 @@ namespace CalamityMod.Projectiles.Boss // Home in on target float scaleFactor = Projectile.velocity.Length(); - float inertia = bossRush ? 6f : death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; + float inertia = death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; distanceFromTarget.Normalize(); distanceFromTarget *= scaleFactor; Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); @@ -152,8 +151,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= scaleFactor; // Fly away from other rockets - float pushForce = bossRush ? 0.07f : death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; - float pushDistance = bossRush ? 120f : death ? 100f : revenge ? 90f : expertMode ? 80f : 60f; + float pushForce = death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; + float pushDistance = death ? 100f : revenge ? 90f : expertMode ? 80f : 60f; for (int k = 0; k < Main.maxProjectiles; k++) { Projectile otherProj = Main.projectile[k]; @@ -179,14 +178,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.CursedInferno, 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); diff --git a/Projectiles/Boss/AresDeathBeamStart.cs b/Projectiles/Boss/AresDeathBeamStart.cs index 76c213e5bf..a42cd03c9b 100644 --- a/Projectiles/Boss/AresDeathBeamStart.cs +++ b/Projectiles/Boss/AresDeathBeamStart.cs @@ -91,14 +91,13 @@ namespace CalamityMod.Projectiles.Boss } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Telegraph duration for deathray spiral - float deathrayTelegraphDuration = bossRush ? AresBody.deathrayTelegraphDuration_BossRush : death ? AresBody.deathrayTelegraphDuration_Death : - revenge ? AresBody.deathrayTelegraphDuration_Rev : expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; + float deathrayTelegraphDuration = death ? AresBody.deathrayTelegraphDuration_Death : revenge ? AresBody.deathrayTelegraphDuration_Rev : + expertMode ? AresBody.deathrayTelegraphDuration_Expert : AresBody.deathrayTelegraphDuration_Normal; Time = Main.npc[OwnerIndex].Calamity().newAI[2] - deathrayTelegraphDuration; } @@ -106,12 +105,11 @@ namespace CalamityMod.Projectiles.Boss public override void UpdateLaserMotion() { // Declare difficulty modes. - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - float angularSlowdownDivisor = bossRush ? 300f : death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; + float angularSlowdownDivisor = death ? 320f : revenge ? 330f : expertMode ? 340f : 360f; float angularVelocity = MathHelper.TwoPi * Time / Lifetime / angularSlowdownDivisor; if (Main.npc[OwnerIndex].ai[3] % 2f == 0f) angularVelocity *= -1f; diff --git a/Projectiles/Boss/AresDeathBeamTelegraph.cs b/Projectiles/Boss/AresDeathBeamTelegraph.cs index 52458b6833..77e04e94a5 100644 --- a/Projectiles/Boss/AresDeathBeamTelegraph.cs +++ b/Projectiles/Boss/AresDeathBeamTelegraph.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Boss public const float deathrayTelegraphDuration_Expert = 120f; public const float deathrayTelegraphDuration_Rev = 105f; public const float deathrayTelegraphDuration_Death = 90f; - public const float deathrayTelegraphDuration_BossRush = 60f; public const float TelegraphFadeTime = 15f; public const float TelegraphWidth = 2400f; @@ -48,13 +47,12 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - Projectile.timeLeft = (int)(bossRush ? deathrayTelegraphDuration_BossRush : death ? deathrayTelegraphDuration_Death : - revenge ? deathrayTelegraphDuration_Rev : expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal); + Projectile.timeLeft = (int)(death ? deathrayTelegraphDuration_Death : revenge ? deathrayTelegraphDuration_Rev : + expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal); } public override void SendExtraAI(BinaryWriter writer) @@ -106,13 +104,12 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - float TelegraphTotalTime = bossRush ? deathrayTelegraphDuration_BossRush : death ? deathrayTelegraphDuration_Death : - revenge ? deathrayTelegraphDuration_Rev : expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal; + float TelegraphTotalTime = death ? deathrayTelegraphDuration_Death : revenge ? deathrayTelegraphDuration_Rev : + expertMode ? deathrayTelegraphDuration_Expert : deathrayTelegraphDuration_Normal; if (TelegraphDelay >= TelegraphTotalTime) return true; diff --git a/Projectiles/Boss/AresGaussNukeProjectile.cs b/Projectiles/Boss/AresGaussNukeProjectile.cs index e657cca25b..ce9f32c87a 100644 --- a/Projectiles/Boss/AresGaussNukeProjectile.cs +++ b/Projectiles/Boss/AresGaussNukeProjectile.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; Projectile.timeLeft = timeLeft; - if (Main.getGoodWorld) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } @@ -72,10 +72,9 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) - MathHelper.PiOver2; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Spawn effects if (Projectile.localAI[0] == 0f) @@ -101,7 +100,7 @@ namespace CalamityMod.Projectiles.Boss // Gauss sparks if (Main.myPlayer == Projectile.owner) { - int totalProjectiles = bossRush ? 18 : 12; + int totalProjectiles = 12; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = Projectile.velocity.Length(); @@ -112,7 +111,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + Vector2.Normalize(Projectile.velocity) * -6f, type, (int)Math.Round(Projectile.damage * 0.5), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + Vector2.Normalize(Projectile.velocity) * -6f, type, AresGaussNuke.SparkDamage, 0f, Main.myPlayer); } } } @@ -124,8 +123,15 @@ namespace CalamityMod.Projectiles.Boss int target = Player.FindClosest(Projectile.Center, 1, 1); Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; + // Instant explode upon collision with the target + if (CalamityUtils.CircularHitboxCollision(Projectile.Center, 45f, Main.player[target].Hitbox)) + { + Projectile.Kill(); + return; + } + // Set AI to stop homing, start accelerating - float stopHomingDistance = bossRush ? 260f : death ? 280f : revenge ? 290f : expertMode ? 300f : 320f; + float stopHomingDistance = death ? 280f : revenge ? 290f : expertMode ? 300f : 320f; if ((distanceFromTarget.Length() < stopHomingDistance && Projectile.ai[0] != -1f) || Projectile.ai[0] == 1f) { Projectile.ai[0] = 1f; @@ -138,7 +144,7 @@ namespace CalamityMod.Projectiles.Boss // Home in on target float scaleFactor = Projectile.velocity.Length(); - float inertia = bossRush ? 6f : death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; + float inertia = death ? 8f : revenge ? 9f : expertMode ? 10f : 12f; distanceFromTarget.Normalize(); distanceFromTarget *= scaleFactor; Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); @@ -176,10 +182,8 @@ namespace CalamityMod.Projectiles.Boss Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Projectiles/Boss/AresGaussNukeProjectileGlow").Value, Projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, drawStart, texture.Width, height)), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 45f, targetHitbox); - - // Explodes on contact - public override void ModifyHitPlayer(Player target, ref Player.HurtModifiers modifiers) => Projectile.Kill(); + // Does not do damage by itself, only through the explosion + public override bool? CanDamage() => false; public override void OnKill(int timeLeft) { @@ -201,7 +205,7 @@ namespace CalamityMod.Projectiles.Boss // Explosion waves for (int i = 0; i < 3; i++) { - Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + Projectile explosion = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), i == 2 ? Projectile.damage : 0, 0f, Main.myPlayer); if (explosion.whoAmI.WithinBounds(Main.maxProjectiles)) { // Make the max explosion radius decrease over time, creating a ring effect. diff --git a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs index 2c7d2d2db3..1d60927f9f 100644 --- a/Projectiles/Boss/AresGaussNukeProjectileBoom.cs +++ b/Projectiles/Boss/AresGaussNukeProjectileBoom.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; @@ -29,6 +30,8 @@ namespace CalamityMod.Projectiles.Boss } public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + private List PlayersHit = new List() { -1 }; + public override void SetStaticDefaults() { ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; @@ -48,6 +51,8 @@ namespace CalamityMod.Projectiles.Boss public override void PostAI() => Lighting.AddLight(Projectile.Center, 0.2f, 0.1f, 0f); - public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius * Projectile.scale * 0.4f, target.Hitbox) && Projectile.timeLeft > 6; + public override bool CanHitPlayer(Player target) => CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius * Projectile.scale * 0.4f, target.Hitbox) && Projectile.timeLeft > 6 && !PlayersHit.Contains(target.whoAmI); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => PlayersHit.Add(target.whoAmI); } } diff --git a/Projectiles/Boss/AresLaserBeamStart.cs b/Projectiles/Boss/AresLaserBeamStart.cs index fd96c14180..46f236d723 100644 --- a/Projectiles/Boss/AresLaserBeamStart.cs +++ b/Projectiles/Boss/AresLaserBeamStart.cs @@ -228,14 +228,6 @@ namespace CalamityMod.Projectiles.Boss return false; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 150); - } - public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; } } diff --git a/Projectiles/Boss/AresPlasmaBolt.cs b/Projectiles/Boss/AresPlasmaBolt.cs index dc9c8a14e0..923848fd8f 100644 --- a/Projectiles/Boss/AresPlasmaBolt.cs +++ b/Projectiles/Boss/AresPlasmaBolt.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 18; Projectile.height = 18; Projectile.hostile = true; @@ -70,14 +69,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || Projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.CursedInferno, 90); - } - public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/AresPlasmaFireball.cs b/Projectiles/Boss/AresPlasmaFireball.cs index e1611af3ba..669e1333c7 100644 --- a/Projectiles/Boss/AresPlasmaFireball.cs +++ b/Projectiles/Boss/AresPlasmaFireball.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.Sounds; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -26,7 +27,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 36; Projectile.height = 36; Projectile.hostile = true; @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; CooldownSlot = ImmunityCooldownID.Bosses; - Projectile.timeLeft = BossRushEvent.BossRushActive ? 96 : timeLeft; + Projectile.timeLeft = timeLeft; } public override void SendExtraAI(BinaryWriter writer) @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Boss } int fadeInTime = 3; - Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - ((BossRushEvent.BossRushActive ? 96 : timeLeft) - fadeInTime)) / (float)fadeInTime), 0f, 1f); + Projectile.Opacity = MathHelper.Clamp(1f - ((Projectile.timeLeft - (timeLeft - fadeInTime)) / (float)fadeInTime), 0f, 1f); Lighting.AddLight(Projectile.Center, 0f, 0.6f * Projectile.Opacity, 0f); @@ -126,14 +126,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => Projectile.Opacity == 1f; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || Projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.CursedInferno, 180); - } - public override bool PreDraw(ref Color lightColor) { lightColor.R = (byte)(255 * Projectile.Opacity); @@ -163,7 +155,7 @@ namespace CalamityMod.Projectiles.Boss } // Plasma bolts - int totalProjectiles = BossRushEvent.BossRushActive ? 12 : 8; + int totalProjectiles = 8; // Reduce the total amount of projectiles by half if Ares Plasma Arm is shooting them and in deathray phase and not the last mech if (Projectile.ai[0] == -1f) @@ -179,7 +171,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, AresPlasmaFlamethrower.BoltDamage, 0f, Main.myPlayer); } } diff --git a/Projectiles/Boss/AresTeslaOrb.cs b/Projectiles/Boss/AresTeslaOrb.cs index 4878f29a10..3c9e9676bc 100644 --- a/Projectiles/Boss/AresTeslaOrb.cs +++ b/Projectiles/Boss/AresTeslaOrb.cs @@ -149,12 +149,11 @@ namespace CalamityMod.Projectiles.Boss return null; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; - float detachDistance = bossRush ? 1600f : death ? 1360f : revenge ? 1280f : expertMode ? 1200f : 960f; + float detachDistance = death ? 1360f : revenge ? 1280f : expertMode ? 1200f : 960f; foreach (Projectile p in Main.ActiveProjectiles) { if (p.type != Projectile.type || p.ai[0] != Identity + 1f || Main.npc[CalamityGlobalNPC.draedonExoMechPrime].Calamity().newAI[0] == (float)AresBody.Phase.Deathrays) diff --git a/Projectiles/Boss/ArtemisLaser.cs b/Projectiles/Boss/ArtemisLaser.cs index 454670d01a..197657c4fe 100644 --- a/Projectiles/Boss/ArtemisLaser.cs +++ b/Projectiles/Boss/ArtemisLaser.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Boss if (Velocity != Vector2.Zero) { Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; - Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Projectile.velocity = Velocity; Velocity = Vector2.Zero; Projectile.netUpdate = true; } @@ -195,14 +195,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || TelegraphDelay <= TelegraphTotalTime) - return; - - target.AddBuff(ModContent.BuffType(), 90); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), Projectile.Size.Length() * 0.5f, targetHitbox); diff --git a/Projectiles/Boss/ArtemisSpinLaserbeam.cs b/Projectiles/Boss/ArtemisSpinLaserbeam.cs index 08b27e1575..3bf0879995 100644 --- a/Projectiles/Boss/ArtemisSpinLaserbeam.cs +++ b/Projectiles/Boss/ArtemisSpinLaserbeam.cs @@ -151,7 +151,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/AstralFlame.cs b/Projectiles/Boss/AstralFlame.cs index 99629bc81a..b3c3cdd0de 100644 --- a/Projectiles/Boss/AstralFlame.cs +++ b/Projectiles/Boss/AstralFlame.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 50; Projectile.height = 50; Projectile.hostile = true; @@ -33,17 +32,16 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 600; - if (Main.getGoodWorld) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } public override void AI() { // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; Projectile.frameCounter++; if (Projectile.frameCounter > 4) @@ -104,8 +102,8 @@ namespace CalamityMod.Projectiles.Boss // Move away from other flames if (Projectile.ai[0] >= 60f) { - float pushForce = bossRush ? 0.07f : death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; - float pushDistance = bossRush ? 180f : death ? 150f : revenge ? 135f : expertMode ? 120f : 90f; + float pushForce = death ? 0.06f : revenge ? 0.055f : expertMode ? 0.05f : 0.04f; + float pushDistance = death ? 150f : revenge ? 135f : expertMode ? 120f : 90f; for (int k = 0; k < Main.maxProjectiles; k++) { Projectile otherProj = Main.projectile[k]; @@ -150,7 +148,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 75); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/AstralGodRay.cs b/Projectiles/Boss/AstralGodRay.cs index bca3fb8b44..1dabcb8439 100644 --- a/Projectiles/Boss/AstralGodRay.cs +++ b/Projectiles/Boss/AstralGodRay.cs @@ -103,7 +103,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 75); + target.AddBuff(ModContent.BuffType(), 120); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/AstralLaser.cs b/Projectiles/Boss/AstralLaser.cs index f81ffeeeac..af2e96b9ad 100644 --- a/Projectiles/Boss/AstralLaser.cs +++ b/Projectiles/Boss/AstralLaser.cs @@ -101,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.timeLeft >= 85) - target.AddBuff(ModContent.BuffType(), 45); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Boss/AstralShot2.cs b/Projectiles/Boss/AstralShot2.cs index 82f15bd2a2..2281798333 100644 --- a/Projectiles/Boss/AstralShot2.cs +++ b/Projectiles/Boss/AstralShot2.cs @@ -37,11 +37,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 1f) { Projectile.extraUpdates = 2; - bool bossRush = BossRushEvent.BossRushActive; - float maxVelocity = bossRush ? 3.75f : 3f; + float maxVelocity = 3f; if (Projectile.velocity.Length() < maxVelocity) { - Projectile.velocity *= bossRush ? 1.02f : 1.015f; + Projectile.velocity *= 1.015f; if (Projectile.velocity.Length() > maxVelocity) { Projectile.velocity.Normalize(); @@ -78,7 +77,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 45); + target.AddBuff(ModContent.BuffType(), 60); } public override Color? GetAlpha(Color lightColor) diff --git a/Projectiles/Boss/BirbAura.cs b/Projectiles/Boss/BirbAura.cs index bf325251d8..d3e0fc4f53 100644 --- a/Projectiles/Boss/BirbAura.cs +++ b/Projectiles/Boss/BirbAura.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.tileCollide = false; Projectile.timeLeft = 1200; + Projectile.Calamity().DealsDefenseDamage = true; } public override void SendExtraAI(BinaryWriter writer) diff --git a/Projectiles/Boss/BirbAuraFlare.cs b/Projectiles/Boss/BirbAuraFlare.cs index cb17ddd3fd..7b77bda05b 100644 --- a/Projectiles/Boss/BirbAuraFlare.cs +++ b/Projectiles/Boss/BirbAuraFlare.cs @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Boss float y = projTileX * 16 + 900; Vector2 laserVelocity = new Vector2(x, 160f) - new Vector2(x, y); int type = ModContent.ProjectileType(); - int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + int damage = Dragonfolly.LightningDamage; if (Projectile.ai[0] >= 2f) { x += 1000f; diff --git a/Projectiles/Boss/BrimstoneBall.cs b/Projectiles/Boss/BrimstoneBall.cs index 8009e83729..a171fbf0b7 100644 --- a/Projectiles/Boss/BrimstoneBall.cs +++ b/Projectiles/Boss/BrimstoneBall.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/BrimstoneBarrage.cs b/Projectiles/Boss/BrimstoneBarrage.cs index b69a56ddd3..59e57349d3 100644 --- a/Projectiles/Boss/BrimstoneBarrage.cs +++ b/Projectiles/Boss/BrimstoneBarrage.cs @@ -36,20 +36,8 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.localAI[0]); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.localAI[0] = reader.ReadSingle(); - } - public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - int target = Player.FindClosest(Projectile.Center, 1, 1); float targetDist; @@ -60,7 +48,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < Projectile.ai[2]) { - Projectile.velocity *= bossRush ? 1.0125f : 1.01f; + Projectile.velocity *= 1.01f; if (Projectile.velocity.Length() > Projectile.ai[2]) { Projectile.velocity.Normalize(); @@ -120,14 +108,6 @@ namespace CalamityMod.Projectiles.Boss trailDust.scale = Main.rand.NextFloat(0.2f, 0.6f); } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - - if (Projectile.ai[0] == 0f) - Projectile.damage = NPC.AnyNPCs(ModContent.NPCType()) ? Projectile.GetProjectileDamage(ModContent.NPCType()) : Projectile.GetProjectileDamage(ModContent.NPCType()); - } - Lighting.AddLight(Projectile.Center, 0.75f * Projectile.Opacity, 0f, 0f); time++; } @@ -142,7 +122,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 0f || Main.zenithWorld) target.AddBuff(ModContent.BuffType(), 180); else - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(ref Color lightColor) @@ -153,8 +133,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/BrimstoneFire.cs b/Projectiles/Boss/BrimstoneFire.cs index 2fb7384d2e..52038731eb 100644 --- a/Projectiles/Boss/BrimstoneFire.cs +++ b/Projectiles/Boss/BrimstoneFire.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 240); // Cook you up (still scales with player size in case it's manipulated) int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); diff --git a/Projectiles/Boss/BrimstoneHellblast.cs b/Projectiles/Boss/BrimstoneHellblast.cs index a0abed02ee..dee61c274d 100644 --- a/Projectiles/Boss/BrimstoneHellblast.cs +++ b/Projectiles/Boss/BrimstoneHellblast.cs @@ -103,8 +103,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } @@ -122,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 0f || Main.zenithWorld) target.AddBuff(ModContent.BuffType(), 180); else - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/BrimstoneHellblast2.cs b/Projectiles/Boss/BrimstoneHellblast2.cs index 81d2d736db..36f5a082d3 100644 --- a/Projectiles/Boss/BrimstoneHellblast2.cs +++ b/Projectiles/Boss/BrimstoneHellblast2.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Boss // Cal Clone bullet hell projectiles accelerate after a certain time has passed if (Projectile.ai[0] == 2f && (Main.expertMode || BossRushEvent.BossRushActive) && Projectile.timeLeft < 1260) { - if (Projectile.velocity.Length() < (BossRushEvent.BossRushActive ? 12.5f : 10f)) + if (Projectile.velocity.Length() < 10f) Projectile.velocity *= 1.005f; } @@ -84,8 +84,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } @@ -103,7 +107,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.ai[0] == 0f || Main.zenithWorld) target.AddBuff(ModContent.BuffType(), 180); else - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/BrimstoneHellfireball.cs b/Projectiles/Boss/BrimstoneHellfireball.cs index c35f3e1f66..ce7f33d38b 100644 --- a/Projectiles/Boss/BrimstoneHellfireball.cs +++ b/Projectiles/Boss/BrimstoneHellfireball.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; @@ -83,7 +82,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 240); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/BrimstoneMonster.cs b/Projectiles/Boss/BrimstoneMonster.cs index f97ab9edf4..94fdc5611a 100644 --- a/Projectiles/Boss/BrimstoneMonster.cs +++ b/Projectiles/Boss/BrimstoneMonster.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Boss internal static readonly float CircularHitboxRadius = 170f; public static int MinimumDamagePerFrame = 4; - public static int MaximumDamagePerFrame = 16; + public static int MaximumDamagePerFrame = 14; public static float AdrenalineLossPerFrame = 0.04f; public static float SpeedToForceMaxDamage = 25f; @@ -284,7 +284,7 @@ namespace CalamityMod.Projectiles.Boss if (Colliding(Projectile.Hitbox, player.Hitbox) == false) return false; - // Applies Vulnerability Hex and/or the effects of Supreme Cirrus' HAGE faces. + // Applies Vulnerability Hex and/or the effects of Supreme Permafrost's HAGE faces. OnHitPlayer_Internal(player); // Check the player's speed. If they are moving fast enough, damage them more severely; this prevents trying to rush straight through the vortex. @@ -341,17 +341,17 @@ namespace CalamityMod.Projectiles.Boss { target.AddBuff(ModContent.BuffType(), 360, true); - // Remove all positive buffs from the player if they're hit by HAGE while Cirrus is alive. + // Remove all positive buffs from the player if they're hit by HAGE while Permafrost is alive. if (CalamityGlobalNPC.SCal != -1) { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) { for (int l = 0; l < Player.MaxBuffs; l++) { int buffType = target.buffType[l]; - if (target.buffTime[l] > 0 && AmalgamBuffList.Includes(buffType)) + if (target.buffTime[l] > 0 && CalamityBuffSets.BuffedByAmalgam[buffType]) { target.DelBuff(l); l--; @@ -407,8 +407,8 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - bool isCirrus = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus; - if (isCirrus) + bool isPermafrost = CalamityGlobalNPC.SCal != -1 && Main.npc[CalamityGlobalNPC.SCal].active && Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost; + if (isPermafrost) { Texture2D hageTex = ModContent.Request("CalamityMod/Projectiles/Boss/BrimstoneMonsterII").Value; lightColor.B = (byte)(255 * Projectile.Opacity); diff --git a/Projectiles/Boss/BrimstoneRay.cs b/Projectiles/Boss/BrimstoneRay.cs index 860895fc39..2bf79eff7a 100644 --- a/Projectiles/Boss/BrimstoneRay.cs +++ b/Projectiles/Boss/BrimstoneRay.cs @@ -114,17 +114,15 @@ namespace CalamityMod.Projectiles.Boss Vector2 dustSpawnPos = Projectile.Center + Projectile.velocity * (Projectile.localAI[1] - 14f); // Fire brimstone darts along the laser - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Main.npc[(int)Projectile.ai[1]].ai[1] == 210f && Projectile.owner == Main.myPlayer && Main.npc[(int)Projectile.ai[1]].ai[0] == 5) { Vector2 velocity = Projectile.velocity; velocity.Normalize(); - float distanceBetweenProjectiles = Main.zenithWorld ? 360 : bossRush ? 72f : 144f; + float distanceBetweenProjectiles = Main.zenithWorld ? 360 : 144f; Vector2 fireFrom = new Vector2(Main.npc[(int)Projectile.ai[1]].Center.X + (Main.npc[(int)Projectile.ai[1]].spriteDirection > 0 ? 34f : -34f), Main.npc[(int)Projectile.ai[1]].Center.Y - 74f) + velocity * distanceBetweenProjectiles; int projectileAmt = (int)(Projectile.localAI[1] / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(Projectile.damage * 0.6); float projectileVelocityToPass = 12f; for (int i = 0; i < projectileAmt; i++) @@ -134,10 +132,8 @@ namespace CalamityMod.Projectiles.Boss for (int j = 0; j < totalProjectiles; j++) { Vector2 projVelocity = Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, projVelocity, type, damage, 0f, Main.myPlayer, death ? 2f : 1f, 0f, projectileVelocityToPass); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), fireFrom, projVelocity, type, BrimstoneElemental.DartDamage, 0f, Main.myPlayer, death ? 2f : 1f, 0f, projectileVelocityToPass); Main.projectile[proj].tileCollide = true; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Main.projectile[proj].extraUpdates += 1; } fireFrom += velocity * distanceBetweenProjectiles; } @@ -235,7 +231,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 240); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/BrimstoneWave.cs b/Projectiles/Boss/BrimstoneWave.cs index a524d96893..2e5f49310d 100644 --- a/Projectiles/Boss/BrimstoneWave.cs +++ b/Projectiles/Boss/BrimstoneWave.cs @@ -87,8 +87,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } diff --git a/Projectiles/Boss/CrimulanSpike.cs b/Projectiles/Boss/CrimulanSpike.cs index 233db11b4a..619f104cac 100644 --- a/Projectiles/Boss/CrimulanSpike.cs +++ b/Projectiles/Boss/CrimulanSpike.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 20; Projectile.height = 20; Projectile.hostile = true; diff --git a/Projectiles/Boss/DarkEnergyBall.cs b/Projectiles/Boss/DarkEnergyBall.cs index ad7fa65911..69a37de561 100644 --- a/Projectiles/Boss/DarkEnergyBall.cs +++ b/Projectiles/Boss/DarkEnergyBall.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/DarkEnergyBall2.cs b/Projectiles/Boss/DarkEnergyBall2.cs index 17076168fc..d0de4c0066 100644 --- a/Projectiles/Boss/DarkEnergyBall2.cs +++ b/Projectiles/Boss/DarkEnergyBall2.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.Opacity = 0f; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/DesertScourgeSpit.cs b/Projectiles/Boss/DesertScourgeSpit.cs index a7e4915e0e..7f66e9cd0f 100644 --- a/Projectiles/Boss/DesertScourgeSpit.cs +++ b/Projectiles/Boss/DesertScourgeSpit.cs @@ -25,12 +25,10 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 16; Projectile.height = 16; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Projectile.scale = 2f; Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 900 : 600; + Projectile.timeLeft = 600; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; } @@ -65,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.alpha < 0) Projectile.alpha = 0; - int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); + int sandyDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.YellowTorch, 0f, 0f, 100, default, 1f); Main.dust[sandyDust].noGravity = true; Main.dust[sandyDust].velocity *= 0f; } diff --git a/Projectiles/Boss/DestroyerElectricLaser.cs b/Projectiles/Boss/DestroyerElectricLaser.cs index 5a30ce18b1..0b9e4572dd 100644 --- a/Projectiles/Boss/DestroyerElectricLaser.cs +++ b/Projectiles/Boss/DestroyerElectricLaser.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/DeusMine.cs b/Projectiles/Boss/DeusMine.cs index 83a4612665..d440cb096b 100644 --- a/Projectiles/Boss/DeusMine.cs +++ b/Projectiles/Boss/DeusMine.cs @@ -135,7 +135,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Main.myPlayer, 1f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, AstrumDeusBody.LaserDamage, 0f, Main.myPlayer, 1f, 0f); } } } @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.timeLeft > MaxTimeLeft - FadeTime || (Projectile.timeLeft < FadeTime && Projectile.ai[0] == 0f)) return; - target.AddBuff(ModContent.BuffType(), 75); + target.AddBuff(ModContent.BuffType(), 120); } } } diff --git a/Projectiles/Boss/DoGBeam.cs b/Projectiles/Boss/DoGBeam.cs index 6be31c977f..50ffd783ae 100644 --- a/Projectiles/Boss/DoGBeam.cs +++ b/Projectiles/Boss/DoGBeam.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 960; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } diff --git a/Projectiles/Boss/DoGBeamPortal.cs b/Projectiles/Boss/DoGBeamPortal.cs index dca2e08b29..830b80d8a0 100644 --- a/Projectiles/Boss/DoGBeamPortal.cs +++ b/Projectiles/Boss/DoGBeamPortal.cs @@ -84,10 +84,9 @@ namespace CalamityMod.Projectiles.Boss } // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool expertMode = Main.expertMode || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool death = CalamityWorld.death || bossRush; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Lighting.AddLight(Projectile.Center, 0f, 0.95f, 1.15f); @@ -102,7 +101,7 @@ namespace CalamityMod.Projectiles.Boss double deg = Projectile.ai[1]; double rad = deg * (Math.PI / 180); - double dist = bossRush ? 360D : death ? 400D : revenge ? 420D : expertMode ? 440D : 480D; + double dist = death ? 400D : revenge ? 420D : expertMode ? 440D : 480D; Projectile.position.X = player.Center.X - (int)(Math.Cos(rad) * dist) - Projectile.width / 2; Projectile.position.Y = player.Center.Y - (int)(Math.Sin(rad) * dist) - Projectile.height / 2; Projectile.ai[1] += 1f; diff --git a/Projectiles/Boss/DoGDeath.cs b/Projectiles/Boss/DoGDeath.cs index b1ff1dcefa..4245e1eeb9 100644 --- a/Projectiles/Boss/DoGDeath.cs +++ b/Projectiles/Boss/DoGDeath.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Boss // If an old velocity is in reserve, set the true velocity to it and make it as "taken" by setting it to <0,0> if (OldVelocity != Vector2.Zero) { - Projectile.velocity = OldVelocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Projectile.velocity = OldVelocity; OldVelocity = Vector2.Zero; Projectile.netUpdate = true; } diff --git a/Projectiles/Boss/DoGWingdings.cs b/Projectiles/Boss/DoGWingdings.cs index c30a8365fb..bac601f122 100644 --- a/Projectiles/Boss/DoGWingdings.cs +++ b/Projectiles/Boss/DoGWingdings.cs @@ -1,6 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Fonts; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using ReLogic.Graphics; using System; using System.IO; @@ -15,18 +15,8 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public static DynamicSpriteFont Wingdings = null; - public string dialogue; - public override void SetStaticDefaults() - { - if (System.Environment.OSVersion.Platform == PlatformID.Win32NT) - { - Wingdings = CalamityMod.Instance.Assets.Request("Fonts/Wingdings", AssetRequestMode.ImmediateLoad).Value; - } - } - public override void SetDefaults() { Projectile.width = 28; @@ -100,10 +90,10 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { // Do not draw if the font isn't loaded or text is Cyrillic or Chinese - if (Wingdings == null || System.Environment.OSVersion.Platform != PlatformID.Win32NT || GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive || GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) + if (FontAssetSystem.Fonts["Wingdings"] == null || System.Environment.OSVersion.Platform != PlatformID.Win32NT || GameCulture.FromCultureName(GameCulture.CultureName.Chinese).IsActive || GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) return false; // Otherwise identical drawcode to CombatText - Vector2 stringSize = Wingdings.MeasureString(dialogue); + Vector2 stringSize = FontAssetSystem.Fonts["Wingdings"].MeasureString(dialogue); Vector2 origin = new Vector2(stringSize.X * 0.5f, stringSize.Y * 0.5f); Color cyan = Color.Cyan; float scale = Projectile.scale; @@ -146,11 +136,11 @@ namespace CalamityMod.Projectiles.Boss { float finalYPos = Projectile.position.Y - Main.screenPosition.Y; finalYPos = (float)Main.screenHeight - finalYPos; - Main.spriteBatch.DrawString(Wingdings, dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, finalYPos + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.DrawString(FontAssetSystem.Fonts["Wingdings"], dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, finalYPos + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } else { - Main.spriteBatch.DrawString(Wingdings, dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, Projectile.position.Y - Main.screenPosition.Y + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); + Main.spriteBatch.DrawString(FontAssetSystem.Fonts["Wingdings"], dialogue.ToUpper(), new Vector2(Projectile.position.X - Main.screenPosition.X + xOffset + origin.X, Projectile.position.Y - Main.screenPosition.Y + yOffset + origin.Y), color, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); } } return false; diff --git a/Projectiles/Boss/FlareBomb.cs b/Projectiles/Boss/FlareBomb.cs index 0d9d4a4d21..515af26689 100644 --- a/Projectiles/Boss/FlareBomb.cs +++ b/Projectiles/Boss/FlareBomb.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 64; Projectile.height = 66; Projectile.hostile = true; diff --git a/Projectiles/Boss/FlareDust.cs b/Projectiles/Boss/FlareDust.cs index 24a4917bfb..665620b277 100644 --- a/Projectiles/Boss/FlareDust.cs +++ b/Projectiles/Boss/FlareDust.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 64; Projectile.height = 66; Projectile.scale = 1.5f; @@ -82,14 +81,14 @@ namespace CalamityMod.Projectiles.Boss float earlyTimeProjSpeed = Projectile.localAI[0] / 120f; if (earlyTimeProjSpeed > 1f) earlyTimeProjSpeed = 1f; - distance += MathHelper.Lerp(1f, 9f, earlyTimeProjSpeed); + distance += MathHelper.Lerp(1f, 11f, earlyTimeProjSpeed); if (Projectile.timeLeft < 380) { float longTimeProjSpeed = (Projectile.localAI[0] - 300f) / 240f; if (longTimeProjSpeed > 1f) longTimeProjSpeed = 1f; - distance += MathHelper.Lerp(1f, 9f, longTimeProjSpeed); + distance += MathHelper.Lerp(1f, 11f, longTimeProjSpeed); } double rad = MathHelper.ToRadians(Projectile.ai[1]); @@ -216,10 +215,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - if (Projectile.ai[0] == 3f) - target.AddBuff(ModContent.BuffType(), 160); - else - target.AddBuff(ModContent.BuffType(), 60); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Boss/FlareDust2.cs b/Projectiles/Boss/FlareDust2.cs index a2252c2bca..c6e34661ec 100644 --- a/Projectiles/Boss/FlareDust2.cs +++ b/Projectiles/Boss/FlareDust2.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 64; Projectile.height = 66; Projectile.scale = 1.5f; diff --git a/Projectiles/Boss/Flarenado.cs b/Projectiles/Boss/Flarenado.cs index e8e1ce6b58..f1c0368464 100644 --- a/Projectiles/Boss/Flarenado.cs +++ b/Projectiles/Boss/Flarenado.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Boss center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - int tornadoSpeed = 10; + int tornadoSpeed = 15; int breakThreshold = 300; Projectile.localAI[1] += 1f; bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; @@ -128,13 +128,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[1] == breakThreshold && Main.zenithWorld) { Projectile.velocity.X = Main.rand.NextBool() ? -tornadoSpeed : tornadoSpeed; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Projectile.velocity.X *= 1.5f; } if (Projectile.timeLeft == 480) - Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + Projectile.damage = Yharon.TornadoDamage; } public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 480; @@ -159,7 +156,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.timeLeft <= 480) - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Boss/FoveanatorEnergyBomb.cs b/Projectiles/Boss/FoveanatorEnergyBomb.cs deleted file mode 100644 index 246e80bfb4..0000000000 --- a/Projectiles/Boss/FoveanatorEnergyBomb.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Events; -using CalamityMod.NPCs; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FoveanatorEnergyBomb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - private const int TotalXFrames = 2; - private const int TotalYFrames = 8; - private const int ExplodeFrames = 6; - private const int ExplodeDamageStartFrame = 3; - private const int FrameTimer = 6; - - public int frameX = 0; - public int frameY = 0; - - public int CurrentFrame - { - get => frameX * TotalYFrames + frameY; - set - { - frameX = value / TotalYFrames; - frameY = value % TotalYFrames; - } - } - - private const int TimeLeft = 300; - private const int SlowDownTime = TimeLeft / 2; - private const int ExplosionDuration = FrameTimer * ExplodeFrames; - - private const float ExplodeDistance = 50f; - - public override void SetDefaults() - { - Projectile.width = 133; - Projectile.height = 142; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = TimeLeft; - } - - public override void AI() - { - // If moving, decelerate. - if (Projectile.velocity.Length() > 0f && Projectile.timeLeft <= SlowDownTime) - Projectile.velocity *= 0.95f; - - // Get a target and calculate distance from it. - int target = Player.FindClosest(Projectile.Center, 1, 1); - float distanceFromTarget = Projectile.Distance(Main.player[target].Center); - - // Explode when within a certain distance of the target. - if (distanceFromTarget <= ExplodeDistance && Projectile.timeLeft > ExplosionDuration) - Projectile.timeLeft = ExplosionDuration; - - bool explode = Projectile.timeLeft <= ExplosionDuration; - - // Stop immediately if explosion is triggered. - if (explode && Projectile.velocity.Length() > 0f) - Projectile.velocity = Vector2.Zero; - - // Reset the frame counter and frameY when explosion is triggered. - if (Projectile.timeLeft == ExplosionDuration) - { - Projectile.frameCounter = 0; - frameY = 0; - } - - // Explosion noise when actually exploding. - if (frameY == ExplodeDamageStartFrame && explode && Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 1f; - SoundEngine.PlaySound(DeusMine.ExplodeSound, Projectile.Center); - } - - Projectile.frameCounter++; - if (Projectile.frameCounter % FrameTimer == 0) - { - CurrentFrame++; - - // Non-explosion uses the left side of the sheet, explosion uses the right side of the sheet. - frameX = explode ? 1 : 0; - - // Kill the projectile when the explosion animation is done. - if (explode && frameY >= ExplodeFrames) - { - if (Projectile.ai[0] > 0f) - { - if (Projectile.owner == Main.myPlayer) - { - float laserSpeed = 2f; - int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(Projectile.damage * 0.85); - Vector2 laserVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed; - Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + laserVelocity.SafeNormalize(Vector2.UnitY) * 16f, laserVelocity, type, damage, 0f, Main.myPlayer); - - if (Projectile.ai[0] == 2f) - { - Vector2 projectileVelocity = (Main.player[target].Center - Projectile.Center).SafeNormalize(Vector2.UnitY) * laserSpeed * 0.75f; - int numProj = 2; - int spread = 30; - float rotation = MathHelper.ToRadians(spread); - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = projectileVelocity.RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromAI(), Projectile.Center + perturbedSpeed.SafeNormalize(Vector2.UnitY) * 16f, perturbedSpeed, type, damage, 0f, Main.myPlayer); - } - } - } - } - - Projectile.Kill(); - - return; - } - } - - // Explosion has brighter light. - Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f); - float divisor = explode ? 128f : 255f; - Lighting.AddLight(Projectile.Center, lightColor.R / divisor, lightColor.G / divisor, lightColor.B / divisor); - } - - public override bool PreDraw(ref Color lightColor) => false; - - public override void PostDraw(Color lightColor) - { - if (Projectile.frameCounter < 5) - return; - - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); - - Texture2D texture = TextureAssets.Projectile[Type].Value; - Vector2 position = Projectile.Center - Main.screenPosition; - Vector2 origin = texture.Size() / new Vector2(TotalXFrames, TotalYFrames) * 0.5f; - Rectangle frame = texture.Frame(TotalXFrames, TotalYFrames, frameX, frameY); - Main.EntitySpriteDraw(texture, position, frame, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None); - } - - public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= ExplosionDuration && frameY >= ExplodeDamageStartFrame; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplodeDistance, targetHitbox); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.timeLeft <= ExplosionDuration) - target.AddBuff(BuffID.Frostburn, 180); - } - } -} diff --git a/Projectiles/Boss/FoveanatorEnergyBomb.png b/Projectiles/Boss/FoveanatorEnergyBomb.png deleted file mode 100644 index 4e2a8120cb..0000000000 Binary files a/Projectiles/Boss/FoveanatorEnergyBomb.png and /dev/null differ diff --git a/Projectiles/Boss/FoveanatorFlamethrower.cs b/Projectiles/Boss/FoveanatorFlamethrower.cs deleted file mode 100644 index 6583bef428..0000000000 --- a/Projectiles/Boss/FoveanatorFlamethrower.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FoveanatorFlamethrower : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/FireProj"; - - public static int Lifetime => 180; - public static int Fadetime => 160; - public ref float Time => ref Projectile.ai[0]; - public int MistType = -1; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 10; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.MaxUpdates = 3; - Projectile.timeLeft = Lifetime; - CooldownSlot = ImmunityCooldownID.Bosses; - } - - public override void AI() - { - Time++; - if (Time < Fadetime && Main.rand.NextBool(6)) - { - Vector2 cinderPos = Projectile.Center + Main.rand.NextVector2Circular(60f, 60f) * Utils.Remap(Time, 0f, Lifetime, 0.5f, 1f); - float cinderSize = Utils.GetLerpValue(6f, 12f, Time, true); - Dust cinder = Dust.NewDustDirect(cinderPos, 4, 4, Main.rand.NextBool() ? (int)CalamityDusts.BlueCosmilite : (int)CalamityDusts.PurpleCosmilite, Projectile.velocity.X * 0.25f, Projectile.velocity.Y * 0.25f); - if (Main.rand.NextBool(3)) - { - cinder.scale *= 2f; - cinder.velocity *= 2f; - } - cinder.noGravity = true; - cinder.scale *= cinderSize * 1.2f; - cinder.velocity += Projectile.velocity * Utils.Remap(Time, 0f, Fadetime * 0.75f, 1f, 0.1f) * Utils.Remap(Time, 0f, Fadetime * 0.1f, 0.1f, 1f); - } - - if (MistType == -1) - MistType = Main.rand.Next(3); - - Color lightColor = Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f); - Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); - } - - // Keeping the flames in place when hitting a block - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.velocity = oldVelocity * 0.95f; - Projectile.position -= Projectile.velocity; - Time++; - Projectile.timeLeft--; - return false; - } - - // Cannot hit the player if fading out - public override bool CanHitPlayer(Player target) => Time <= Fadetime; - - // Expanding hitbox - public override void ModifyDamageHitbox(ref Rectangle hitbox) - { - int size = (int)Utils.Remap(Time, 0f, Fadetime, 8f, 32f); - - // Shrinks again after fading - if (Time > Fadetime) - size = (int)Utils.Remap(Time, Fadetime, Lifetime, 32f, 0f); - - hitbox.Inflate(size, size); - } - - // Anti-wall hacking checks - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => projHitbox.Intersects(targetHitbox) && Collision.CanHit(Projectile.Center, 0, 0, targetHitbox.Center.ToVector2(), 0, 0) ? null : false; - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.Frostburn, 300); - - // Cook you up (still scales with player size in case it's manipulated) - int smokeCount = 4 + (int)MathHelper.Clamp(target.width * 0.1f, 0f, 20f); - for (int i = 0; i < smokeCount; i++) - { - Vector2 smokePos = target.Center + Main.rand.NextVector2Circular(target.width * 0.5f, target.height * 0.5f); - Vector2 smokeVel = Vector2.UnitY * Main.rand.NextFloat(-2.4f, -0.8f) * MathHelper.Clamp(target.height * 0.1f, 1f, 10f); - Particle smoke = new MediumMistParticle(smokePos, smokeVel, Color.Lerp(new Color(50, 50, 255), new Color(200, 50, 255), Main.DiscoR / 255f), Color.DarkMagenta, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); - GeneralParticleHandler.SpawnParticle(smoke); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D fire = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D mist = ModContent.Request("CalamityMod/Particles/MediumMist").Value; - - // The conga line of colors to sift through - Color color1 = new Color(50, 50, 255, 200); - Color color2 = new Color(50, 0, 225, 70); - Color color3 = new Color(200, 50, 255, 100); - Color color4 = new Color(150, 15, 85, 100); - float length = ((Time > Fadetime - 10f) ? 0.1f : 0.15f); - float vOffset = Math.Min(Time, 20f); - float timeRatio = Utils.GetLerpValue(0f, Lifetime, Time); - float fireSize = Utils.Remap(timeRatio, 0.2f, 0.5f, 0.25f, 1f); - - if (timeRatio >= 1f) - return false; - - for (float j = 1f; j >= 0f; j -= length) - { - // Color - Color fireColor = ((timeRatio < 0.1f) ? Color.Lerp(Color.Transparent, color1, Utils.GetLerpValue(0f, 0.1f, timeRatio)) : - ((timeRatio < 0.2f) ? Color.Lerp(color1, color2, Utils.GetLerpValue(0.1f, 0.2f, timeRatio)) : - ((timeRatio < 0.35f) ? color2 : - ((timeRatio < 0.7f) ? Color.Lerp(color2, color3, Utils.GetLerpValue(0.35f, 0.7f, timeRatio)) : - ((timeRatio < 0.85f) ? Color.Lerp(color3, color4, Utils.GetLerpValue(0.7f, 0.85f, timeRatio)) : - Color.Lerp(color4, Color.Transparent, Utils.GetLerpValue(0.85f, 1f, timeRatio))))))); - fireColor *= (1f - j) * Utils.GetLerpValue(0f, 0.2f, timeRatio, true); - Color innerColor = Color.Lerp(fireColor, Color.Black, 0.3f); - - // Positions and rotations - Vector2 firePos = Projectile.Center - Main.screenPosition - Projectile.velocity * vOffset * j; - float mainRot = -j * MathHelper.PiOver2 - Main.GlobalTimeWrappedHourly * (j + 1f) * 2f / length; - float trailRot = MathHelper.PiOver4 - mainRot; - - // Draw one backtrail - Vector2 trailOffset = Projectile.velocity * vOffset * length * 0.5f; - Main.EntitySpriteDraw(fire, firePos - trailOffset, null, innerColor * 0.25f, trailRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); - - // Draw the main fire - Main.EntitySpriteDraw(fire, firePos, null, innerColor, mainRot, fire.Size() * 0.5f, fireSize, SpriteEffects.None); - - // Draw the masking smoke - Main.spriteBatch.SetBlendState(BlendState.Additive); - Rectangle frame = mist.Frame(1, 3, 0, MistType); - Main.EntitySpriteDraw(mist, firePos, frame, Color.Lerp(fireColor, Color.White, 0.3f), mainRot, frame.Size() * 0.5f, fireSize, SpriteEffects.None); - Main.EntitySpriteDraw(mist, firePos, frame, fireColor, mainRot, frame.Size() * 0.5f, fireSize * 3f, SpriteEffects.None); - Main.spriteBatch.SetBlendState(BlendState.AlphaBlend); - } - - return false; - } - } -} diff --git a/Projectiles/Boss/FoveanatorLaser.cs b/Projectiles/Boss/FoveanatorLaser.cs deleted file mode 100644 index fc73073e84..0000000000 --- a/Projectiles/Boss/FoveanatorLaser.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.NPCs.TownNPCs; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Boss -{ - public class FoveanatorLaser : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Boss"; - - private const int FadeOutTime = 30; - - private const float Acceleration = 1.05f; - private const float MaxVelocity = 24f; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.hostile = true; - Projectile.ignoreWater = true; - Projectile.Opacity = 0f; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter > 4) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } - if (Projectile.frame > 3) - Projectile.frame = 0; - - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= Acceleration; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= MaxVelocity; - } - } - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - - Color lightColor = Color.Lerp(new Color(25, 25, 128), new Color(100, 25, 128), Main.DiscoR / 255f); - Lighting.AddLight(Projectile.Center, lightColor.R / 255f, lightColor.G / 255f, lightColor.B / 255f); - - if (Projectile.timeLeft < FadeOutTime) - { - Projectile.Opacity -= 1f / FadeOutTime; - } - else if (Projectile.Opacity < 1f) - { - Projectile.Opacity += 0.25f; - if (Projectile.Opacity > 1f) - Projectile.Opacity = 1f; - } - } - - public override bool PreDraw(ref Color lightColor) - { - lightColor.R = (byte)(255 * Projectile.Opacity); - lightColor.G = (byte)(255 * Projectile.Opacity); - lightColor.B = (byte)(255 * Projectile.Opacity); - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override bool CanHitPlayer(Player target) => Projectile.timeLeft >= FadeOutTime; - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.timeLeft >= FadeOutTime) - target.AddBuff(BuffID.Frostburn, 90); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.Center, Projectile.velocity, Projectile.width, Projectile.height); - SoundEngine.PlaySound(SoundID.Item10, Projectile.position); - return true; - } - } -} diff --git a/Projectiles/Boss/FoveanatorLaser.png b/Projectiles/Boss/FoveanatorLaser.png deleted file mode 100644 index 543c692773..0000000000 Binary files a/Projectiles/Boss/FoveanatorLaser.png and /dev/null differ diff --git a/Projectiles/Boss/FrostMist.cs b/Projectiles/Boss/FrostMist.cs index dc8229123f..14f0fba566 100644 --- a/Projectiles/Boss/FrostMist.cs +++ b/Projectiles/Boss/FrostMist.cs @@ -128,7 +128,6 @@ namespace CalamityMod.Projectiles.Boss return; target.AddBuff(BuffID.Frostburn, 180, true); - target.AddBuff(BuffID.Chilled, 90, true); } } } diff --git a/Projectiles/Boss/GolemInfernoBlast.cs b/Projectiles/Boss/GolemInfernoBlast.cs new file mode 100644 index 0000000000..24c308ac5b --- /dev/null +++ b/Projectiles/Boss/GolemInfernoBlast.cs @@ -0,0 +1,56 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class GolemInfernoBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + private const int Lifetime = 900; + private const float Radius = 200f; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 170; // Doesn't matter because circular hitbox + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.timeLeft = Lifetime; + Projectile.Calamity().DealsDefenseDamage = true; + } + + public override void AI() + { + // Visual effects + for (int i = 0; i < 4; i++) + { + Vector2 spawn = Projectile.Center + Main.rand.NextVector2Circular(Radius, Radius); + HealingPlus test = new HealingPlus(spawn, 1f, Vector2.Zero, Color.Orange, Color.OrangeRed, 2) { Rotation = Main.rand.NextFloat(MathHelper.TwoPi) }; + GeneralParticleHandler.SpawnParticle(test); + } + + if (Projectile.timeLeft % 3 == 0) + { + FlameExplosion blast = new(Projectile.Center, Vector2.Zero, Color.Orange, Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.1f, 0.17f, 15, 0.7f); + GeneralParticleHandler.SpawnParticle(blast); + } + + for (int i = 0; i < 3; i++) + { + float randomMult = Main.rand.NextFloat(0.35f, 0.9f); + Vector2 dustSpawn = Projectile.Center + Main.rand.NextVector2CircularEdge(Radius, Radius) * randomMult; + Vector2 dustVel = Utils.DirectionTo(Projectile.Center, dustSpawn) * Utils.Remap(randomMult, 0.35f, 0.9f, 6f, 1f); + Dust fire = Dust.NewDustPerfect(dustSpawn, DustID.InfernoFork, dustVel, Scale: 1.25f); + fire.noGravity = true; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + public override bool CanHitPlayer(Player target) => Projectile.timeLeft < Lifetime - 30; + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 360); + } +} diff --git a/Projectiles/Boss/GolemInfernoBolt.cs b/Projectiles/Boss/GolemInfernoBolt.cs new file mode 100644 index 0000000000..0b61d5b2b6 --- /dev/null +++ b/Projectiles/Boss/GolemInfernoBolt.cs @@ -0,0 +1,50 @@ +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Boss +{ + public class GolemInfernoBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Boss"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 12; + Projectile.hostile = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + } + + public override void AI() + { + if (Projectile.ai[2] == 0f) + { + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + Projectile.ai[2] = 1f; + } + + bool hasReachedX = (Projectile.velocity.X < 0f && Projectile.Center.X < Projectile.ai[0]) || (Projectile.velocity.X > 0f && Projectile.Center.X > Projectile.ai[0]); + bool hasReachedY = (Projectile.velocity.Y < 0f && Projectile.Center.Y < Projectile.ai[1]) || (Projectile.velocity.Y > 0f && Projectile.Center.Y > Projectile.ai[1]); + + if (hasReachedX && hasReachedY) + Projectile.Kill(); + + // Add visual effects + MediumMistParticle mist = new(Projectile.Center, Main.rand.NextVector2Circular(3f, 3f), Color.Gray, Color.DarkGray, 0.5f, 192f); + GeneralParticleHandler.SpawnParticle(mist); + Dust.NewDustPerfect(Projectile.Center, DustID.InfernoFork, Main.rand.NextVector2Circular(2f, 2f), Scale: 1.75f); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 360); + public override void OnKill(int timeLeft) + { + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); + } + } +} diff --git a/Projectiles/Boss/GreatSandBlast.cs b/Projectiles/Boss/GreatSandBlast.cs index b7fa0c573f..86ac452813 100644 --- a/Projectiles/Boss/GreatSandBlast.cs +++ b/Projectiles/Boss/GreatSandBlast.cs @@ -22,12 +22,12 @@ namespace CalamityMod.Projectiles.Boss { Projectile.width = 10; Projectile.height = 10; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) Projectile.scale = 2f; Projectile.hostile = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 900 : 600; + Projectile.timeLeft = Main.getGoodWorld ? 900 : 600; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; } diff --git a/Projectiles/Boss/HolyBlast.cs b/Projectiles/Boss/HolyBlast.cs index 4b2b1d3666..9fcca7cfd2 100644 --- a/Projectiles/Boss/HolyBlast.cs +++ b/Projectiles/Boss/HolyBlast.cs @@ -1,11 +1,7 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; -using CalamityMod.Graphics.Primitives; -using CalamityMod.NPCs; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.TownNPCs; using CalamityMod.Particles; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -13,7 +9,6 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; -using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; @@ -22,6 +17,7 @@ namespace CalamityMod.Projectiles.Boss public class HolyBlast : ModProjectile, ILocalizedModType { public bool started = false; + public int FireDamage = 0; private const int TimeLeft = 120; private const int AccelerationTime = 60; @@ -36,10 +32,6 @@ namespace CalamityMod.Projectiles.Boss Main.projFrames[Type] = 4; } - public override void OnSpawn(IEntitySource source) - { - } - public override void SetDefaults() { Projectile.Calamity().DealsDefenseDamage = true; @@ -52,6 +44,17 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } + public override void OnSpawn(IEntitySource source) + { + FireDamage = Providence.FireDamage.CalculateProvidenceDamage(); + + if (source is EntitySource_Parent { Entity: NPC parent }) + { + if (parent.type == ModContent.NPCType()) + FireDamage = ProfanedGuardianCommander.FireDamage; + } + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(Projectile.localAI[0]); @@ -64,7 +67,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 320, 20); + ProvUtils.ApplyGFBDamage(Projectile, 180, 20); Lighting.AddLight(Projectile.Center, 0.9f, 0.7f, 0f); @@ -111,8 +114,7 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(ShootSound, Projectile.Center); } - if (Math.Abs(Projectile.velocity.X) > 0.2) - Projectile.spriteDirection = -Projectile.direction; + Projectile.direction = Projectile.spriteDirection = (Math.Abs(Projectile.velocity.X) > 0.2).ToDirectionInt(); GeneralParticleHandler.SpawnParticle(new GlowOrbParticle(Projectile.Center + new Vector2(Main.rand.NextFloat(50), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, false, 20, Main.rand.NextFloat(1f, 2f), ProvUtils.GetProjectileColor(255))); GeneralParticleHandler.SpawnParticle(new MediumMistParticle(Projectile.Center + new Vector2(40, 0).RotatedBy(Vector2.Zero.AngleTo(-Projectile.velocity)) + new Vector2(Main.rand.NextFloat(20), 0).RotatedByRandom(MathHelper.TwoPi), Projectile.velocity.RotatedBy(Math.PI) * 0.6f, Color.LightSlateGray, Color.DarkSlateGray, Main.rand.NextFloat(1f, 3f), 150f)); @@ -128,12 +130,11 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = ProvUtils.StandardAI() ? Terraria.GameContent.TextureAssets.Projectile[Type].Value : ModContent.Request("CalamityMod/Projectiles/Boss/HolyBlastNight").Value; - int framing = texture.Height / Main.projFrames[Type]; - int y6 = framing * Projectile.frame; - Vector2 sc = Vector2.One; - Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, sc, texture); + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Projectile.DrawBackglow(ProvUtils.GetProjectileColor(lightColor, true), 4f, texture, effects: sp); - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, framing / 2f), sc, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } @@ -158,7 +159,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { int totalProjectiles = !ProvUtils.StandardAI() ? 8 : 6; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) totalProjectiles *= 2; float radians = MathHelper.TwoPi / totalProjectiles; @@ -169,7 +170,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + additionalVelocity, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2 + additionalVelocity, type, FireDamage, 0f, Projectile.owner); } } @@ -200,7 +201,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 320); + ProvUtils.ApplyDebuffs(target, 180); } } } diff --git a/Projectiles/Boss/HolyBomb.cs b/Projectiles/Boss/HolyBomb.cs index cb0933c919..f3dfbf99bc 100644 --- a/Projectiles/Boss/HolyBomb.cs +++ b/Projectiles/Boss/HolyBomb.cs @@ -2,12 +2,14 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +18,7 @@ namespace CalamityMod.Projectiles.Boss public class HolyBomb : ModProjectile, ILocalizedModType { float SquishAnimation = 1f; + public int FireDamage = 0; public new string LocalizationCategory => "Projectiles.Boss"; public override void SetStaticDefaults() @@ -35,9 +38,19 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } + public override void OnSpawn(IEntitySource source) + { + FireDamage = Providence.FireDamage.CalculateProvidenceDamage(); + + if (source is EntitySource_Parent { Entity: NPC parent }) + { + if (parent.type == ModContent.NPCType()) + FireDamage = ProfanedGuardianDefender.FireDamage; + } + } public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); @@ -62,7 +75,7 @@ namespace CalamityMod.Projectiles.Boss SquishAnimation = 0f; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, velocityY, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, 0f, velocityY, ModContent.ProjectileType(), FireDamage, Projectile.knockBack, Projectile.owner, 0f, 0f); } if (Projectile.ai[1] == 0f) @@ -129,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 160); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyBurnOrb.cs b/Projectiles/Boss/HolyBurnOrb.cs index 64c20b7f63..693c5353ec 100644 --- a/Projectiles/Boss/HolyBurnOrb.cs +++ b/Projectiles/Boss/HolyBurnOrb.cs @@ -42,9 +42,6 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); - if (Projectile.ai[0] == 0f && BossRushEvent.BossRushActive) - Projectile.velocity *= 1.25f; - if (!started) { Color cl = ProvUtils.GetProjectileColor(255); @@ -60,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.timeLeft = 160; } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) { if (Projectile.velocity.Length() < 12f && Projectile.ai[1] == 0f) { diff --git a/Projectiles/Boss/HolyFire.cs b/Projectiles/Boss/HolyFire.cs index 3385962d35..b64fc8f3e2 100644 --- a/Projectiles/Boss/HolyFire.cs +++ b/Projectiles/Boss/HolyFire.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 80, 20); + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); @@ -93,12 +93,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.01f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); @@ -109,12 +109,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 velocity = new Vector2(0.05f, 0f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) velocity *= Main.rand.NextFloat(1f, 2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f); @@ -131,7 +131,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 80); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyFire2.cs b/Projectiles/Boss/HolyFire2.cs index 3c191e8a20..b72f9b7df6 100644 --- a/Projectiles/Boss/HolyFire2.cs +++ b/Projectiles/Boss/HolyFire2.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); @@ -50,16 +50,12 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame > 3) Projectile.frame = 0; - float maxVelocity = Projectile.ai[0] == 0f ? 7f : (Main.masterMode || BossRushEvent.BossRushActive) ? 13f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; + float maxVelocity = Projectile.ai[0] == 0f ? 7f : CalamityWorld.death ? 11f : CalamityWorld.revenge ? 10f : Main.expertMode ? 9f : 7f; if (Math.Abs(Projectile.velocity.X) < maxVelocity) Projectile.velocity.X *= 1.05f; int playerTracker = Player.FindClosest(Projectile.Center, 1, 1); - // Natural damage is removed from GFB - if (Projectile.ai[1] == 0f && !Main.zenithWorld) - Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); - Projectile.ai[1] += 1f; if (Projectile.ai[1] < 180f && Projectile.ai[1] > 60f) { @@ -130,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 80); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/HolyFlare.cs b/Projectiles/Boss/HolyFlare.cs index d07046f83a..85d5c1a5bb 100644 --- a/Projectiles/Boss/HolyFlare.cs +++ b/Projectiles/Boss/HolyFlare.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 120, 20); + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.35f, 0.275f, 0f); diff --git a/Projectiles/Boss/HolySpear.cs b/Projectiles/Boss/HolySpear.cs index 00a92cabf5..a2d60a83e6 100644 --- a/Projectiles/Boss/HolySpear.cs +++ b/Projectiles/Boss/HolySpear.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 120, 20); + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.45f * Projectile.Opacity, 0.35f * Projectile.Opacity, 0f); diff --git a/Projectiles/Boss/HomingGasBulb.cs b/Projectiles/Boss/HomingGasBulb.cs index 2c080802a1..58c661a17a 100644 --- a/Projectiles/Boss/HomingGasBulb.cs +++ b/Projectiles/Boss/HomingGasBulb.cs @@ -2,6 +2,7 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Events; using CalamityMod.NPCs.TownNPCs; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (Projectile.localAI[0] == 0f) { @@ -49,14 +50,14 @@ namespace CalamityMod.Projectiles.Boss int closestPlayer = (int)Player.FindClosest(Projectile.Center, 1, 1); Vector2 velocity = Main.player[closestPlayer].Center - Projectile.Center; Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= (masterMode ? 0f : 30f)) + if (Projectile.ai[0] >= (death ? 0f : 30f)) { - if (Projectile.ai[0] < (masterMode ? 210f : 150f)) + if (Projectile.ai[0] < (death ? 210f : 150f)) { float scaleFactor2 = Projectile.velocity.Length(); velocity.Normalize(); velocity *= scaleFactor2; - Projectile.velocity = (Projectile.velocity * 24f + velocity) / 25f; + Projectile.velocity = (Projectile.velocity * 22f + velocity) / (death ? 12f : 15f); // Tracking strength Projectile.velocity.Normalize(); Projectile.velocity *= scaleFactor2; } @@ -67,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss } } - if (Projectile.ai[0] % (masterMode ? 10f : 20f) == 0f) + if (Projectile.ai[0] % (death ? 10f : 20f) == 0f) { int dustType = 73; int totalDust = 12; @@ -89,7 +90,8 @@ namespace CalamityMod.Projectiles.Boss { int type = ModContent.ProjectileType(); float ai0 = Main.rand.Next(3); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Normalize(Projectile.velocity) * 0.2f, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer, ai0); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Normalize(Projectile.velocity) * 0.2f, type, PlanteraAI.PinkCloudDamage, 0f, Main.myPlayer, ai0); + Main.projectile[proj].timeLeft = 180; } } } diff --git a/Projectiles/Boss/HomingGasBulbSporeGas.cs b/Projectiles/Boss/HomingGasBulbSporeGas.cs index d467e3eeb4..2fbf24928d 100644 --- a/Projectiles/Boss/HomingGasBulbSporeGas.cs +++ b/Projectiles/Boss/HomingGasBulbSporeGas.cs @@ -40,10 +40,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.ai[1] += 1f; - if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 900f)) + if (Projectile.ai[1] > (Main.getGoodWorld ? 600f : 900f)) { Projectile.localAI[0] += 10f; - Projectile.damage = 0; } if (Projectile.localAI[0] > 255f) @@ -55,25 +54,23 @@ namespace CalamityMod.Projectiles.Boss float lightValues = (255 - Projectile.alpha) * 0.6f / 255f; Lighting.AddLight(Projectile.Center, lightValues, 0f, lightValues); - Projectile.alpha = (int)(100.0 + Projectile.localAI[0] * 0.7); Projectile.rotation += Projectile.velocity.X * 0.02f; Projectile.rotation += Projectile.direction * 0.002f; - if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 2f : 0.5f)) + if (Projectile.velocity.Length() > (Main.getGoodWorld ? 2f : 0.5f)) Projectile.velocity *= 0.985f; + + if (Projectile.timeLeft <= 40) + { + Projectile.Opacity = Utils.GetLerpValue(0, 40, Projectile.timeLeft); + } } - public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 900f) && Projectile.ai[1] > 120f; + public override bool CanHitPlayer(Player target) => Projectile.Opacity > 0.8f; public override Color? GetAlpha(Color lightColor) { - if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 900f)) - { - byte b2 = (byte)((26f - (Projectile.ai[1] - (CalamityWorld.LegendaryMode ? 600f : 900f))) * 10f); - byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); - return new Color(b2, b2, b2, a2); - } - return new Color(255, 255, 255, Projectile.alpha); + return lightColor; } public override bool PreDraw(ref Color lightColor) @@ -93,7 +90,7 @@ namespace CalamityMod.Projectiles.Boss default: break; } - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1, texture); + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor * Projectile.Opacity, 1, texture); return false; } @@ -102,7 +99,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - if (Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 900f) && Projectile.ai[1] > 120f) + if (Projectile.ai[1] <= (Main.getGoodWorld ? 600f : 900f) && Projectile.ai[1] > 120f) target.AddBuff(BuffID.Poisoned, 240); } } diff --git a/Projectiles/Boss/HomingLaserDart.cs b/Projectiles/Boss/HomingLaserDart.cs index dc93ed2c2b..fd55783718 100644 --- a/Projectiles/Boss/HomingLaserDart.cs +++ b/Projectiles/Boss/HomingLaserDart.cs @@ -193,14 +193,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(BuffID.OnFire, 180); - } - public override Color? GetAlpha(Color lightColor) => new Color(255, 50, 50, Projectile.alpha); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/IceBlast.cs b/Projectiles/Boss/IceBlast.cs index 5d27626298..2e152db191 100644 --- a/Projectiles/Boss/IceBlast.cs +++ b/Projectiles/Boss/IceBlast.cs @@ -92,7 +92,6 @@ namespace CalamityMod.Projectiles.Boss return; target.AddBuff(BuffID.Frostburn, 120, true); - target.AddBuff(BuffID.Chilled, 60, true); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/IceBomb.cs b/Projectiles/Boss/IceBomb.cs index ce60e05cb7..548dc997ad 100644 --- a/Projectiles/Boss/IceBomb.cs +++ b/Projectiles/Boss/IceBomb.cs @@ -78,13 +78,12 @@ namespace CalamityMod.Projectiles.Boss int totalProjectiles = 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - int damage = (int)Math.Round(Projectile.damage * 0.75); float velocity = 1f; Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { Vector2 vector255 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector255, type, damage, 0f, Projectile.owner, 1f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vector255, type, Cryogen.IceRainDamage, 0f, Projectile.owner, 1f, 0f); } } @@ -97,14 +96,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - if (Projectile.ai[0] >= 120f) - { - target.AddBuff(BuffID.Frostburn, 180, true); - target.AddBuff(BuffID.Chilled, 90, true); - - if (!target.Calamity().gState) - target.AddBuff(ModContent.BuffType(), 60); - } + target.AddBuff(BuffID.Frostburn, 180, true); } } } diff --git a/Projectiles/Boss/IceRain.cs b/Projectiles/Boss/IceRain.cs index 53674d6619..e2c4acdebe 100644 --- a/Projectiles/Boss/IceRain.cs +++ b/Projectiles/Boss/IceRain.cs @@ -106,7 +106,6 @@ namespace CalamityMod.Projectiles.Boss return; target.AddBuff(BuffID.Frostburn, 120, true); - target.AddBuff(BuffID.Chilled, 60, true); } } } diff --git a/Projectiles/Boss/IchorBlob.cs b/Projectiles/Boss/IchorBlob.cs index 479fb920eb..2281985e4c 100644 --- a/Projectiles/Boss/IchorBlob.cs +++ b/Projectiles/Boss/IchorBlob.cs @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.localAI[1] <= 900f && Projectile.localAI[1] > 120f) - target.AddBuff(BuffID.Ichor, 240); + target.AddBuff(BuffID.Ichor, 360); } } } diff --git a/Projectiles/Boss/IchorShot.cs b/Projectiles/Boss/IchorShot.cs index f1e2338a03..5933ef2afd 100644 --- a/Projectiles/Boss/IchorShot.cs +++ b/Projectiles/Boss/IchorShot.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(BuffID.Ichor, 180); + target.AddBuff(BuffID.Ichor, 240); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/Infernado.cs b/Projectiles/Boss/Infernado.cs index 691c909e79..884a3aa3af 100644 --- a/Projectiles/Boss/Infernado.cs +++ b/Projectiles/Boss/Infernado.cs @@ -112,7 +112,7 @@ namespace CalamityMod.Projectiles.Boss center.Y += 2f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), center, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, 11f, Projectile.ai[1] - 1f); } - int tornadoSpeed = 10; + int tornadoSpeed = 15; int breakThreshold = 300; Projectile.localAI[1] += 1f; bool breakapart = Main.zenithWorld && Projectile.localAI[1] >= breakThreshold; @@ -130,13 +130,10 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.localAI[1] == breakThreshold && Main.zenithWorld) { Projectile.velocity.X = Main.rand.NextBool() ? -tornadoSpeed : tornadoSpeed; - - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) - Projectile.velocity.X *= 1.5f; } if (Projectile.timeLeft == 600) - Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + Projectile.damage = Yharon.TornadoDamage; } public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 600; @@ -161,7 +158,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.timeLeft <= 600) - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/Infernado2.cs b/Projectiles/Boss/Infernado2.cs index c73d5dc424..7b2c97c25d 100644 --- a/Projectiles/Boss/Infernado2.cs +++ b/Projectiles/Boss/Infernado2.cs @@ -130,7 +130,7 @@ namespace CalamityMod.Projectiles.Boss } if (Projectile.timeLeft == 720) - Projectile.damage = Projectile.GetProjectileDamage(ModContent.NPCType()); + Projectile.damage = Yharon.TornadoDamage; } public override bool CanHitPlayer(Player target) => Projectile.timeLeft <= 720; @@ -155,7 +155,7 @@ namespace CalamityMod.Projectiles.Boss return; if (Projectile.timeLeft <= 720) - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/InfernadoRevenge.cs b/Projectiles/Boss/InfernadoRevenge.cs index d193737273..bcd9d4b570 100644 --- a/Projectiles/Boss/InfernadoRevenge.cs +++ b/Projectiles/Boss/InfernadoRevenge.cs @@ -75,6 +75,7 @@ namespace CalamityMod.Projectiles.Boss Main.spriteBatch.EnterShaderRegion(); GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); + GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(1f); GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Images/Misc/Perlin")); Vector2[] drawPoints = new Vector2[5]; Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; @@ -112,7 +113,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 150); + target.AddBuff(ModContent.BuffType(), 180); } } } diff --git a/Projectiles/Boss/MoltenBlast.cs b/Projectiles/Boss/MoltenBlast.cs index 457affed38..19d312fc7d 100644 --- a/Projectiles/Boss/MoltenBlast.cs +++ b/Projectiles/Boss/MoltenBlast.cs @@ -2,6 +2,7 @@ using System.IO; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.NPCs; +using CalamityMod.NPCs.ProfanedGuardians; using CalamityMod.NPCs.Providence; using CalamityMod.Particles; using CalamityMod.World; @@ -9,6 +10,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +18,8 @@ namespace CalamityMod.Projectiles.Boss { public class MoltenBlast : ModProjectile, ILocalizedModType { + public int BlobDamage = 0; + private const int TimeLeft = 90; private const int AccelerationTime = 60; private const float Acceleration = 1.05f; @@ -39,6 +43,17 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } + public override void OnSpawn(IEntitySource source) + { + BlobDamage = Providence.BlobDamage.CalculateProvidenceDamage(); + + if (source is EntitySource_Parent { Entity: NPC parent }) + { + if (parent.type == ModContent.NPCType()) + BlobDamage = ProfanedGuardianDefender.BlobDamage; + } + } + public override void SendExtraAI(BinaryWriter writer) { writer.Write(Projectile.localAI[0]); @@ -53,7 +68,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 160, 20); + ProvUtils.ApplyGFBDamage(Projectile, 120, 20); Lighting.AddLight(Projectile.Center, 0.45f, 0.35f, 0f); @@ -153,10 +168,10 @@ namespace CalamityMod.Projectiles.Boss for (int b = 0; b < blobAmt; b++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f) + additionalBlobVelocity; - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) velocity *= 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), BlobDamage, 0f, Projectile.owner); } } @@ -171,7 +186,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 160); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/MoltenBlob.cs b/Projectiles/Boss/MoltenBlob.cs index 9c3698fe8f..07160d9da1 100644 --- a/Projectiles/Boss/MoltenBlob.cs +++ b/Projectiles/Boss/MoltenBlob.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 12; Projectile.height = 12; Projectile.hostile = true; @@ -37,7 +36,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - ProvUtils.ApplyGFBDamage(Projectile, 80, 10); + ProvUtils.ApplyGFBDamage(Projectile, 120, 10); Lighting.AddLight(Projectile.Center, 0.3f, 0.225f, 0f); @@ -143,7 +142,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 80); + ProvUtils.ApplyDebuffs(target, 120); } } } diff --git a/Projectiles/Boss/MushBombFall.cs b/Projectiles/Boss/MushBombFall.cs index 61adeb46bc..19339c838f 100644 --- a/Projectiles/Boss/MushBombFall.cs +++ b/Projectiles/Boss/MushBombFall.cs @@ -76,8 +76,8 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); - float velocityYLimit = Projectile.ai[0] == 1f ? 1f : BossRushEvent.BossRushActive ? 12f : CalamityWorld.death ? 6f : 5f; - float velocityYIncrement = Projectile.ai[0] == 1f ? 0.1f : BossRushEvent.BossRushActive ? 0.24f : CalamityWorld.death ? 0.12f : 0.1f; + float velocityYLimit = Projectile.ai[0] == 1f ? 1f : CalamityWorld.death ? 6f : 5f; + float velocityYIncrement = Projectile.ai[0] == 1f ? 0.1f : CalamityWorld.death ? 0.12f : 0.1f; if (Projectile.velocity.Y < velocityYLimit) Projectile.velocity.Y += velocityYIncrement; diff --git a/Projectiles/Boss/MushBombGround.cs b/Projectiles/Boss/MushBombGround.cs index c2eacefa36..ca844bdb13 100644 --- a/Projectiles/Boss/MushBombGround.cs +++ b/Projectiles/Boss/MushBombGround.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Boss Lighting.AddLight(Projectile.Center, 0f, 0.15f, 0.3f); float xVelocityMultiplier = 1.025f; - float xVelocityLimit = BossRushEvent.BossRushActive ? 24f : 12f; + float xVelocityLimit = 12f; if (Math.Abs(Projectile.velocity.X) < xVelocityLimit) Projectile.velocity.X *= xVelocityMultiplier; } diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index b1fcb344fb..74b72f6f9a 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -80,14 +80,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 180); - } - public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); diff --git a/Projectiles/Boss/OldDukeToothBallSpike.cs b/Projectiles/Boss/OldDukeToothBallSpike.cs index 6640ed68aa..16bfa07763 100644 --- a/Projectiles/Boss/OldDukeToothBallSpike.cs +++ b/Projectiles/Boss/OldDukeToothBallSpike.cs @@ -63,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 360); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs b/Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs similarity index 78% rename from Projectiles/Boss/CirrusPhotonRipperProjectile.cs rename to Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs index c7363796be..c0994c21f9 100644 --- a/Projectiles/Boss/CirrusPhotonRipperProjectile.cs +++ b/Projectiles/Boss/PermafrostAbsoluteZeroProjectile.cs @@ -9,13 +9,13 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusPhotonRipperProjectile : ModProjectile, ILocalizedModType + public class PermafrostAbsoluteZeroProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Melee/PhotonRipperProjectile"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/AbsoluteZero"; - public NPC Cirrus => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; + public NPC Permafrost => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; public const float ZeroChargeDamageRatio = 0.36f; public const float ToothDamageRatio = 0.1666667f; public const int ToothShootRate = 5; // One chainsaw tooth is emitted every this many frames. @@ -44,36 +44,33 @@ namespace CalamityMod.Projectiles.Boss public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Texture2D glowmaskTexture = ModContent.Request("CalamityMod/Projectiles/Melee/PhotonRipperGlowmask").Value; - Rectangle glowmaskRectangle = glowmaskTexture.Frame(1, 6, 0, Projectile.frame); Vector2 origin = texture.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); - Main.EntitySpriteDraw(glowmaskTexture, drawPosition, glowmaskRectangle, Color.HotPink, Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } public override void AI() { - // Die if Cirrus disappears. - if (Cirrus is null || !Cirrus.active) + // Die if Permafrost disappears. + if (Permafrost is null || !Permafrost.active) { Projectile.Kill(); return; } - // Die if Cirrus shouldn't be using it. - int cirrusBulletHellCounter = Cirrus.ModNPC().bulletHellCounter2; - if (!(cirrusBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && - !(cirrusBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) + // Die if Permafrost shouldn't be using it. + int permafrostBulletHellCounter = Permafrost.ModNPC().bulletHellCounter2; + if (!(permafrostBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && + !(permafrostBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) { Projectile.Kill(); return; } - Projectile.damage = SupremeCalamitas.CirrusPhotonRipperDamage; + Projectile.damage = SupremeCalamitas.PermafrostAbsoluteZeroDamage; DetermineDamage(); PlayChainsawSounds(); @@ -81,14 +78,14 @@ namespace CalamityMod.Projectiles.Boss // Determines the owner's position whilst incorporating their fullRotation field. // It uses vector transformation on a Z rotation matrix based on said rotation under the hood. // This is essentially just the pure mathematical definition of the RotatedBy method. - Vector2 cirrusRotatedPosition = Cirrus.Center; - float rotation = Cirrus.rotation; - Vector2 vector = Cirrus.Bottom + new Vector2(0f, Cirrus.gfxOffY); + Vector2 permafrostRotatedPosition = Permafrost.Center; + float rotation = Permafrost.rotation; + Vector2 vector = Permafrost.Bottom + new Vector2(0f, Permafrost.gfxOffY); Vector2 vector2 = new Vector2(0f, -4f) + new Vector2(0f, 4f).RotatedBy(rotation); - cirrusRotatedPosition.Y += Cirrus.gfxOffY; - cirrusRotatedPosition = vector + (cirrusRotatedPosition - vector).RotatedBy(rotation) + vector2; - HandleMovement(cirrusRotatedPosition); - DetermineVisuals(cirrusRotatedPosition); + permafrostRotatedPosition.Y += Permafrost.gfxOffY; + permafrostRotatedPosition = vector + (permafrostRotatedPosition - vector).RotatedBy(rotation) + vector2; + HandleMovement(permafrostRotatedPosition); + DetermineVisuals(permafrostRotatedPosition); EmitPrettyDust(); if (Time % ToothShootRate == ToothShootRate - 1f) @@ -129,7 +126,7 @@ namespace CalamityMod.Projectiles.Boss } } - public void DetermineVisuals(Vector2 cirrusRotatedPosition) + public void DetermineVisuals(Vector2 permafrostRotatedPosition) { float directionAngle = Projectile.velocity.ToRotation(); Projectile.rotation = directionAngle; @@ -146,8 +143,8 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.spriteDirection != oldDirection) Projectile.rotation -= MathHelper.Pi; - // Positioning close to the Cirrus' arm. - Projectile.position = cirrusRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; + // Positioning close to the Permafrost's arm. + Projectile.position = permafrostRotatedPosition - Projectile.Size * 0.5f + directionAngle.ToRotationVector2() * 30f; // Update the position a tiny bit every frame at random to make it look like the saw is vibrating. // It is reset on the next frame. @@ -164,9 +161,9 @@ namespace CalamityMod.Projectiles.Boss } } - public void HandleMovement(Vector2 cirrusRotatedPosition) + public void HandleMovement(Vector2 permafrostRotatedPosition) { - Vector2 idealAimDirection = (Main.player[Cirrus.target].Center - cirrusRotatedPosition).SafeNormalize(Vector2.UnitX * Cirrus.direction); + Vector2 idealAimDirection = (Main.player[Permafrost.target].Center - permafrostRotatedPosition).SafeNormalize(Vector2.UnitX * Permafrost.direction); float angularAimVelocity = 0.03f; float directionAngularDisparity = Projectile.velocity.AngleBetween(idealAimDirection) / MathHelper.Pi; @@ -179,7 +176,7 @@ namespace CalamityMod.Projectiles.Boss else Projectile.velocity = idealAimDirection; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Cirrus.direction); + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX * Permafrost.direction); } public void EmitPrettyDust() @@ -213,7 +210,7 @@ namespace CalamityMod.Projectiles.Boss return; float shootReach = MathHelper.SmoothStep(Projectile.width * 1.8f, Projectile.width * 5.3f + 16f, ChargeUpPower); - float distanceFromTarget = Cirrus.Distance(Main.player[Cirrus.target].Center); + float distanceFromTarget = Permafrost.Distance(Main.player[Permafrost.target].Center); // If the distance to the mouse is less than the base reach, reach only to mouse. // This way the player can more directly control the crystals if they want. @@ -227,7 +224,7 @@ namespace CalamityMod.Projectiles.Boss shootReach = 72f; } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Cirrus.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Permafrost.Center, Projectile.velocity, ModContent.ProjectileType(), (int)ToothDamage, 0f, Projectile.owner, shootReach, Projectile.whoAmI, Projectile.ai[2]); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Boss/CirrusBlast.cs b/Projectiles/Boss/PermafrostBlast.cs similarity index 98% rename from Projectiles/Boss/CirrusBlast.cs rename to Projectiles/Boss/PermafrostBlast.cs index 37c926aaa8..006e71ce8e 100644 --- a/Projectiles/Boss/CirrusBlast.cs +++ b/Projectiles/Boss/PermafrostBlast.cs @@ -12,7 +12,7 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusBlast : BaseLaserbeamProjectile, ILocalizedModType + public class PermafrostBlast : BaseLaserbeamProjectile, ILocalizedModType { // Modified clone of Seraphim's Laser public new string LocalizationCategory => "Projectiles.Boss"; diff --git a/Projectiles/Boss/CirrusBlaster.cs b/Projectiles/Boss/PermafrostBlaster.cs similarity index 90% rename from Projectiles/Boss/CirrusBlaster.cs rename to Projectiles/Boss/PermafrostBlaster.cs index ab60a0adc6..553ba53539 100644 --- a/Projectiles/Boss/CirrusBlaster.cs +++ b/Projectiles/Boss/PermafrostBlaster.cs @@ -7,11 +7,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusBlaster : ModProjectile, ILocalizedModType + public class PermafrostBlaster : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Alcohol/OddMushroom"; + public override string Texture => "CalamityMod/Items/Accessories/PermafrostsConcoction"; public static readonly SoundStyle SANSCharge = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterCharge"); public static readonly SoundStyle SANSFire = new("CalamityMod/Sounds/Custom/Ravager/GasterBlasterFire"); public Vector2 storedVelocity; @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Boss { Projectile.ai[0] = 90f; if (Projectile.owner == Main.myPlayer) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, storedVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[1], Projectile.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, storedVelocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, Projectile.ai[1], Projectile.whoAmI); SoundEngine.PlaySound(SANSFire, Projectile.Center); // Funny Gaster Blaster sounds #2 } diff --git a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs b/Projectiles/Boss/PermafrostColdheartIcicle.cs similarity index 81% rename from Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs rename to Projectiles/Boss/PermafrostColdheartIcicle.cs index 9a06af2a88..808004ddb1 100644 --- a/Projectiles/Boss/CirrusPhotonRipperPrismTooth.cs +++ b/Projectiles/Boss/PermafrostColdheartIcicle.cs @@ -1,5 +1,5 @@ using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Graphics.Primitives; using CalamityMod.NPCs.SupremeCalamitas; using Microsoft.Xna.Framework; @@ -12,15 +12,15 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusPhotonRipperPrismTooth : ModProjectile, ILocalizedModType + public class PermafrostColdheartIcicle : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Projectiles/Melee/PrismTooth"; + public override string Texture => "CalamityMod/Items/ColdheartIcicle"; public const int Lifetime = 80; - public NPC Cirrus => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; + public NPC Permafrost => Main.npc.IndexInRange((int)Projectile.ai[2]) ? Main.npc[(int)Projectile.ai[2]] : null; public ref float ShootReach => ref Projectile.ai[0]; @@ -48,17 +48,17 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - // Die if Cirrus disappears. - if (Cirrus is null || !Cirrus.active) + // Die if Permafrost disappears. + if (Permafrost is null || !Permafrost.active) { Projectile.Kill(); return; } - // Die if Cirrus shouldn't be using it. - int cirrusBulletHellCounter = Cirrus.ModNPC().bulletHellCounter2; - if (!(cirrusBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && - !(cirrusBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && cirrusBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) + // Die if Permafrost shouldn't be using it. + int permafrostBulletHellCounter = Permafrost.ModNPC().bulletHellCounter2; + if (!(permafrostBulletHellCounter > SupremeCalamitas.SecondBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.ThirdBulletHellEndValue) && + !(permafrostBulletHellCounter > SupremeCalamitas.FourthBulletHellEndValue && permafrostBulletHellCounter < SupremeCalamitas.FifthBulletHellEndValue)) { Projectile.Kill(); return; @@ -82,13 +82,13 @@ namespace CalamityMod.Projectiles.Boss // In this context, the velocity is simply the initial direction as a unit vector- it does not actually influence movement in any way. positionOffset = positionOffset.RotatedBy(Projectile.velocity.ToRotation() - MathHelper.PiOver2); - Vector2 cirrusRotatedPosition = Cirrus.Center; - float rotation = Cirrus.rotation; - Vector2 vector = Cirrus.Bottom + new Vector2(0f, Cirrus.gfxOffY); + Vector2 permafrostRotatedPosition = Permafrost.Center; + float rotation = Permafrost.rotation; + Vector2 vector = Permafrost.Bottom + new Vector2(0f, Permafrost.gfxOffY); Vector2 vector2 = new Vector2(0f, -4f) + new Vector2(0f, 4f).RotatedBy(rotation); - cirrusRotatedPosition.Y += Cirrus.gfxOffY; - cirrusRotatedPosition = vector + (cirrusRotatedPosition - vector).RotatedBy(rotation) + vector2; - Projectile.Center = cirrusRotatedPosition + Projectile.velocity * 42f + positionOffset; + permafrostRotatedPosition.Y += Permafrost.gfxOffY; + permafrostRotatedPosition = vector + (permafrostRotatedPosition - vector).RotatedBy(rotation) + vector2; + Projectile.Center = permafrostRotatedPosition + Projectile.velocity * 42f + positionOffset; Projectile.Opacity = Utils.GetLerpValue(0f, 12f, Time, true) * Utils.GetLerpValue(Lifetime, Lifetime - 12f, Lifetime - Projectile.timeLeft, true); // Destroy trees within the range of the past 20 oldPos positions. @@ -127,11 +127,11 @@ namespace CalamityMod.Projectiles.Boss AchievementsHelper.CurrentlyMining = false; } - public override Color? GetAlpha(Color lightColor) => Color.HotPink; + public override Color? GetAlpha(Color lightColor) => Color.Cyan; internal float WidthFunction(float completionRatio) => Projectile.scale * 24f * (1f - Utils.GetLerpValue(0.7f, 1f, completionRatio, true)) + 1f; - internal Color ColorFunction(float completionRatio) => Color.HotPink * Projectile.Opacity; + internal Color ColorFunction(float completionRatio) => Color.Cyan * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { @@ -163,6 +163,6 @@ namespace CalamityMod.Projectiles.Boss // Prevent the crystals from utilizing velocity. Their movement is entirely dependant on Center setting. public override bool ShouldUpdatePosition() => false; - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 300); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Frozen, 300); } } diff --git a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs b/Projectiles/Boss/PermafrostMeat.cs similarity index 55% rename from Projectiles/Boss/CirrusVolatileVodkaBottle.cs rename to Projectiles/Boss/PermafrostMeat.cs index 753d43bf97..d234a31fab 100644 --- a/Projectiles/Boss/CirrusVolatileVodkaBottle.cs +++ b/Projectiles/Boss/PermafrostMeat.cs @@ -12,11 +12,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class CirrusVolatileVodkaBottle : ModProjectile, ILocalizedModType + public class PermafrostMeat : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - public override string Texture => "CalamityMod/Items/Potions/Alcohol/CirrusVodka"; + public override string Texture => "CalamityMod/Items/Potions/DeliciousMeat"; public override void SetDefaults() { @@ -34,9 +34,14 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.ai[0] == 0f) { - SoundEngine.PlaySound(SoundID.Item106, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f, Pitch = 0.3f }, Projectile.position); Projectile.ai[0] = 1f; } + if (Projectile.ai[1] == 0) + { + Projectile.aiStyle = -1; + Projectile.tileCollide = false; + } } public override bool PreDraw(ref Color lightColor) @@ -48,11 +53,11 @@ namespace CalamityMod.Projectiles.Boss public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Shatter, Projectile.Center); + SoundEngine.PlaySound(SoundID.NPCDeath43 with { Volume = SoundID.NPCDeath43.Volume * 0.35f }, Projectile.position); for (int i = 0; i < 10; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 0, default, 1.2f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1.2f); Main.dust[dust].velocity *= 3f; if (Main.rand.NextBool()) { @@ -63,32 +68,33 @@ namespace CalamityMod.Projectiles.Boss for (int i = 0; i < 20; i++) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.BlueCosmilite, 0f, 0f, 0, default, 1.7f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1.7f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 5f; - dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.PurpleCosmilite, 0f, 0f, 0, default, 1f); + dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.IceGolem, 0f, 0f, 0, default, 1f); Main.dust[dust].velocity *= 2f; } - if (Projectile.owner == Main.myPlayer) + if (Projectile.ai[2] == 0) { - int totalProjectiles = 3; - float radians = MathHelper.TwoPi / totalProjectiles; - int type = ModContent.ProjectileType(); - float velocity = 8f; - double angleA = radians * 0.5; - double angleB = MathHelper.ToRadians(90f) - angleA; - float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); - Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); - for (int k = 0; k < totalProjectiles; k++) + if (Projectile.owner == Main.myPlayer) { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Vector2.Normalize(velocity2) * 10f, velocity2, type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer); - if (proj.WithinBounds(Main.maxProjectiles)) + int totalProjectiles = 3; + float radians = MathHelper.TwoPi / totalProjectiles; + float velocity = 8f; + double angleA = radians * 0.5; + double angleB = MathHelper.ToRadians(90f) - angleA; + float velocityX2 = (float)(velocity * Math.Sin(angleA) / Math.Sin(angleB)); + Vector2 spinningPoint = Main.rand.NextBool() ? new Vector2(0f, -velocity) : new Vector2(-velocityX2, -velocity); + for (int k = 0; k < totalProjectiles; k++) { - Main.projectile[proj].DamageType = DamageClass.Default; - Main.projectile[proj].friendly = false; - Main.projectile[proj].hostile = true; + Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); + int proj = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Vector2.Normalize(velocity2) * 10f, velocity2, Type, (int)Math.Round(Projectile.damage * 0.8), 0f, Main.myPlayer, ai2: 1); + if (proj.WithinBounds(Main.maxProjectiles)) + { + Main.projectile[proj].tileCollide = false; + Main.projectile[proj].aiStyle = -1; + } } } } @@ -97,7 +103,6 @@ namespace CalamityMod.Projectiles.Boss public override void OnHitPlayer(Player target, Player.HurtInfo info) { Projectile.Kill(); - target.AddBuff(ModContent.BuffType(), 54000); } } } diff --git a/Projectiles/Boss/PhantomBlast.cs b/Projectiles/Boss/PhantomBlast.cs index 8069efd309..b0083c28d1 100644 --- a/Projectiles/Boss/PhantomBlast.cs +++ b/Projectiles/Boss/PhantomBlast.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 18; Projectile.height = 18; Projectile.hostile = true; @@ -111,13 +110,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[killGhostDust2].velocity *= 2f; } } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Boss/PhantomBlast2.cs b/Projectiles/Boss/PhantomBlast2.cs index f581c4a065..e801a4083e 100644 --- a/Projectiles/Boss/PhantomBlast2.cs +++ b/Projectiles/Boss/PhantomBlast2.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 18; Projectile.height = 18; Projectile.hostile = true; @@ -111,13 +110,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[killGhostDust2].velocity *= 2f; } } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 180); - } } } diff --git a/Projectiles/Boss/PhantomGhostShot.cs b/Projectiles/Boss/PhantomGhostShot.cs index 61f6e7a116..f11f34fd13 100644 --- a/Projectiles/Boss/PhantomGhostShot.cs +++ b/Projectiles/Boss/PhantomGhostShot.cs @@ -66,14 +66,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } - public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, Projectile.alpha); diff --git a/Projectiles/Boss/PhantomHookShot.cs b/Projectiles/Boss/PhantomHookShot.cs index 32d119dd72..e8f110184e 100644 --- a/Projectiles/Boss/PhantomHookShot.cs +++ b/Projectiles/Boss/PhantomHookShot.cs @@ -66,14 +66,6 @@ namespace CalamityMod.Projectiles.Boss } } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 80); - } - public override Color? GetAlpha(Color lightColor) { return new Color(100, 250, 250, Projectile.alpha); diff --git a/Projectiles/Boss/PhantomMine.cs b/Projectiles/Boss/PhantomMine.cs index fcadc0e03b..ddc7a8bf6c 100644 --- a/Projectiles/Boss/PhantomMine.cs +++ b/Projectiles/Boss/PhantomMine.cs @@ -14,7 +14,6 @@ namespace CalamityMod.Projectiles.Boss public new string LocalizationCategory => "Projectiles.Boss"; public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 30; Projectile.height = 30; Projectile.hostile = true; @@ -39,7 +38,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= Projectile.ai[0]; } - if (CalamityWorld.LegendaryMode && CalamityWorld.revenge) + if (Main.getGoodWorld) { if (Projectile.velocity.Length() >= Projectile.ai[0]) { @@ -98,17 +97,5 @@ namespace CalamityMod.Projectiles.Boss Main.dust[phantomDust2].velocity *= 2f; } } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - if (Projectile.velocity.Length() >= Projectile.ai[0]) - { - target.AddBuff(ModContent.BuffType(), 120); - target.AddBuff(ModContent.BuffType(), 180); - } - } } } diff --git a/Projectiles/Boss/PhantomShot.cs b/Projectiles/Boss/PhantomShot.cs index 0cc7f9eed7..82aee0921a 100644 --- a/Projectiles/Boss/PhantomShot.cs +++ b/Projectiles/Boss/PhantomShot.cs @@ -67,13 +67,5 @@ namespace CalamityMod.Projectiles.Boss { return new Color(100, 250, 250, Projectile.alpha); } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 80); - } } } diff --git a/Projectiles/Boss/PhantomShot2.cs b/Projectiles/Boss/PhantomShot2.cs index fc48efce2d..352a950538 100644 --- a/Projectiles/Boss/PhantomShot2.cs +++ b/Projectiles/Boss/PhantomShot2.cs @@ -67,13 +67,5 @@ namespace CalamityMod.Projectiles.Boss { return new Color(250, 100, 100, Projectile.alpha); } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0) - return; - - target.AddBuff(ModContent.BuffType(), 120); - } } } diff --git a/Projectiles/Boss/PlagueStingerGoliath.cs b/Projectiles/Boss/PlagueStingerGoliath.cs index 0f064415ea..dfa96ab31d 100644 --- a/Projectiles/Boss/PlagueStingerGoliath.cs +++ b/Projectiles/Boss/PlagueStingerGoliath.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/PlagueStingerGoliathV2.cs b/Projectiles/Boss/PlagueStingerGoliathV2.cs index cba5fae545..70a5a75a2c 100644 --- a/Projectiles/Boss/PlagueStingerGoliathV2.cs +++ b/Projectiles/Boss/PlagueStingerGoliathV2.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/ProvidenceCrystal.cs b/Projectiles/Boss/ProvidenceCrystal.cs index b77439580e..de4bf7114b 100644 --- a/Projectiles/Boss/ProvidenceCrystal.cs +++ b/Projectiles/Boss/ProvidenceCrystal.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.width = 160; Projectile.height = 160; Projectile.ignoreWater = true; - Projectile.timeLeft = BossRushEvent.BossRushActive ? 1500 : CalamityWorld.death ? 2100 : 3600; + Projectile.timeLeft = CalamityWorld.death ? 2100 : 3600; Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.penetrate = -1; diff --git a/Projectiles/Boss/ProvidenceCrystalShard.cs b/Projectiles/Boss/ProvidenceCrystalShard.cs index a745f81594..4f99f0d4d1 100644 --- a/Projectiles/Boss/ProvidenceCrystalShard.cs +++ b/Projectiles/Boss/ProvidenceCrystalShard.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; diff --git a/Projectiles/Boss/ProvidenceHolyRay.cs b/Projectiles/Boss/ProvidenceHolyRay.cs index 7ca90e54b2..4f73827498 100644 --- a/Projectiles/Boss/ProvidenceHolyRay.cs +++ b/Projectiles/Boss/ProvidenceHolyRay.cs @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Boss } if (projScale == 1f) - ProvUtils.ApplyGFBDamage(Projectile, 400, 20); + ProvUtils.ApplyGFBDamage(Projectile, 240, 20); Projectile.scale = (float)Math.Sin(Projectile.localAI[0] * MathHelper.Pi / (scissorLasers ? 100f : 180f)) * 10f * projScale; if (Projectile.scale > projScale) @@ -240,7 +240,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || target.creativeGodMode) return; - ProvUtils.ApplyDebuffs(target, 400); + ProvUtils.ApplyDebuffs(target, 240); } public override bool CanHitPlayer(Player target) => Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/QueenBeenade.cs b/Projectiles/Boss/QueenBeenade.cs index 4a2ff25994..952687ebf8 100644 --- a/Projectiles/Boss/QueenBeenade.cs +++ b/Projectiles/Boss/QueenBeenade.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -126,7 +127,7 @@ namespace CalamityMod.Projectiles.Boss { float speedX = (float)Main.rand.Next(-35, 36) * 0.02f; float speedY = (float)Main.rand.Next(-35, 36) * 0.02f; - Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, new Vector2(speedX, speedY), type, (int)Math.Round(Projectile.damage * 0.85), 0f, Main.myPlayer, 0f, minVelocity, maxVelocity); + Projectile.NewProjectile(Projectile.GetSource_Death(), Projectile.Center, new Vector2(speedX, speedY), type, QueenBeeAI.BeenadeBeeDamage, 0f, Main.myPlayer, 0f, minVelocity, maxVelocity); } } } diff --git a/Projectiles/Boss/QueenBeenadeBee.cs b/Projectiles/Boss/QueenBeenadeBee.cs index 489609310c..905267966e 100644 --- a/Projectiles/Boss/QueenBeenadeBee.cs +++ b/Projectiles/Boss/QueenBeenadeBee.cs @@ -47,15 +47,14 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = Projectile.velocity.X * 0.1f; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; // Get a target and calculate distance from it int target = Player.FindClosest(Projectile.Center, 1, 1); Vector2 distanceFromTarget = Main.player[target].Center - Projectile.Center; // Set AI to stop homing, start accelerating - float stopHomingDistance = bossRush ? 80f : 120f; + float stopHomingDistance = 120f; if (distanceFromTarget.Length() < stopHomingDistance || Projectile.ai[0] == 1f || Projectile.timeLeft < 120) { Projectile.ai[0] = 1f; @@ -79,7 +78,7 @@ namespace CalamityMod.Projectiles.Boss // Home in on target float scaleFactor = Projectile.velocity.Length(); - float inertia = bossRush ? 12f : 16f; + float inertia = 16f; distanceFromTarget.Normalize(); distanceFromTarget *= scaleFactor; Projectile.velocity = (Projectile.velocity * inertia + distanceFromTarget) / (inertia + 1f); @@ -87,8 +86,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.velocity *= scaleFactor; // Fly away from other bees - float pushForce = bossRush ? 0.06f : 0.05f; - float pushDistance = bossRush ? 90f : 60f; + float pushForce = 0.05f; + float pushDistance = 60f; for (int k = 0; k < Main.maxProjectiles; k++) { Projectile otherProj = Main.projectile[k]; diff --git a/Projectiles/Boss/RavagerFlame.cs b/Projectiles/Boss/RavagerFlame.cs index 69f81fa5da..1cb0daf453 100644 --- a/Projectiles/Boss/RavagerFlame.cs +++ b/Projectiles/Boss/RavagerFlame.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.extraUpdates = BossRushEvent.BossRushActive ? 2 : 1; + Projectile.extraUpdates = 1; } public override void AI() diff --git a/Projectiles/Boss/ScavengerNuke.cs b/Projectiles/Boss/RavagerNuke.cs similarity index 83% rename from Projectiles/Boss/ScavengerNuke.cs rename to Projectiles/Boss/RavagerNuke.cs index 6406bf212b..09a008f4ff 100644 --- a/Projectiles/Boss/ScavengerNuke.cs +++ b/Projectiles/Boss/RavagerNuke.cs @@ -7,11 +7,12 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.GameContent; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Boss { - public class ScavengerNuke : ModProjectile, ILocalizedModType + public class RavagerNuke : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/Ravager/RavagerMissileExplosion"); @@ -22,7 +23,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 44; Projectile.height = 44; Projectile.hostile = true; @@ -35,8 +35,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { - bool bossRush = BossRushEvent.BossRushActive; - bool revenge = CalamityWorld.revenge || bossRush; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; if (Projectile.timeLeft < 180) Projectile.tileCollide = true; @@ -52,8 +51,8 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; - float inertia = bossRush ? 70f : revenge ? 90f : 110f; - float scaleFactor12 = bossRush ? 20f : revenge ? 16f : 12f; + float inertia = revenge ? 90f : 110f; + float scaleFactor12 = revenge ? 16f : 12f; if (Projectile.alpha > 0) Projectile.alpha -= 10; @@ -153,20 +152,26 @@ namespace CalamityMod.Projectiles.Boss Color finalColor = Color.Lerp(Color.White, Color.Red, (float)Math.Abs(Math.Sin((timeToStartWarning - Projectile.timeLeft) * (MathHelper.Pi * 7f / 180f)))); Color warningColor; finalColor.A = (byte)(255 - Projectile.alpha); + float colorTransitionRatio = MathHelper.Clamp((timeToStartWarning - Projectile.timeLeft) / (float)timeToStartWarning, 0f, 1f); if (Projectile.timeLeft <= timeToStartWarning) - { - float colorTransitionRatio = (timeToStartWarning - Projectile.timeLeft) / (float)timeToStartWarning; warningColor = Color.Lerp(initialColor, finalColor, colorTransitionRatio); - } else warningColor = initialColor; float strength = Utils.GetLerpValue(0, timeToStartWarning / 1.5f, timeToStartWarning - Projectile.timeLeft, true); - Rectangle frame = TextureAssets.Projectile[Type].Value.Frame(1, 5, 0, Projectile.frame); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, 5, 0, Projectile.frame); SpriteEffects sp = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Projectile.DrawProjectileWithBackglow(new Color(64, 255, 255) * strength, Projectile.GetAlpha(warningColor), 4.5f, null, frame, sp); + Projectile.DrawBackglow(new Color(64, 255, 255) * strength, 4.5f, null, frame, sp); + + Main.spriteBatch.EnterShaderRegion(BlendState.AlphaBlend); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(colorTransitionRatio * 0.45f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(warningColor); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, sp); + Main.spriteBatch.ExitShaderRegion(); return false; } } diff --git a/Projectiles/Boss/ScavengerNuke.png b/Projectiles/Boss/RavagerNuke.png similarity index 100% rename from Projectiles/Boss/ScavengerNuke.png rename to Projectiles/Boss/RavagerNuke.png diff --git a/Projectiles/Boss/RedLightning.cs b/Projectiles/Boss/RedLightning.cs index 7f2f6405fa..8a241ad463 100644 --- a/Projectiles/Boss/RedLightning.cs +++ b/Projectiles/Boss/RedLightning.cs @@ -175,7 +175,7 @@ IL_25092: if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 90); + target.AddBuff(ModContent.BuffType(), 120); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Boss/RedLightningFeather.cs b/Projectiles/Boss/RedLightningFeather.cs index 4941a9ffe3..d663afad52 100644 --- a/Projectiles/Boss/RedLightningFeather.cs +++ b/Projectiles/Boss/RedLightningFeather.cs @@ -129,7 +129,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0 || Projectile.Opacity != 1f) return; - target.AddBuff(ModContent.BuffType(), 40); + target.AddBuff(ModContent.BuffType(), 60); } } } diff --git a/Projectiles/Boss/SCalBrimstoneFireblast.cs b/Projectiles/Boss/SCalBrimstoneFireblast.cs index 17595f148b..7fdd5e45b1 100644 --- a/Projectiles/Boss/SCalBrimstoneFireblast.cs +++ b/Projectiles/Boss/SCalBrimstoneFireblast.cs @@ -3,12 +3,15 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using static Humanizer.In; @@ -20,6 +23,7 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneFireblastImpact"); + public int DartDamage = 0; public bool withinRange = false; public bool setLifetime = false; public override void SetStaticDefaults() @@ -41,6 +45,19 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } + public override void OnSpawn(IEntitySource source) + { + DartDamage = SupremeCalamitas.DartDamage; + + if (source is EntitySource_Parent { Entity: NPC parent }) + { + if (parent.type == ModContent.NPCType()) + DartDamage = Cryogen.IceRainDamage; + else if (parent.type == ModContent.NPCType()) + DartDamage = CalamitasClone.DartDamage; + } + } + public override void AI() { Projectile.frameCounter++; @@ -168,8 +185,13 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } @@ -192,16 +214,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(ImpactSound, Projectile.Center); // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; if (Projectile.ai[2] == 0f) { if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = bossRush ? 20 : death ? 16 : revenge ? 14 : expertMode ? 12 : 8; + int totalProjectiles = death ? 16 : revenge ? 14 : expertMode ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 8f; @@ -209,7 +230,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, DartDamage, 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); } } diff --git a/Projectiles/Boss/SCalBrimstoneGigablast.cs b/Projectiles/Boss/SCalBrimstoneGigablast.cs index 4ac7522311..4cc65df873 100644 --- a/Projectiles/Boss/SCalBrimstoneGigablast.cs +++ b/Projectiles/Boss/SCalBrimstoneGigablast.cs @@ -3,12 +3,14 @@ using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; using CalamityMod.Events; using CalamityMod.NPCs; +using CalamityMod.NPCs.CalClone; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; using CalamityMod.Particles; @@ -19,6 +21,7 @@ namespace CalamityMod.Projectiles.Boss { public new string LocalizationCategory => "Projectiles.Boss"; public static readonly SoundStyle ImpactSound = new("CalamityMod/Sounds/Custom/SCalSounds/BrimstoneGigablastImpact"); + public int DartDamage = 0; public bool withinRange = false; public bool setLifetime = false; public override void SetStaticDefaults() @@ -40,6 +43,17 @@ namespace CalamityMod.Projectiles.Boss CooldownSlot = ImmunityCooldownID.Bosses; } + public override void OnSpawn(IEntitySource source) + { + DartDamage = SupremeCalamitas.DartDamage; + + if (source is EntitySource_Parent { Entity: NPC parent }) + { + if (parent.type == ModContent.NPCType()) + DartDamage = CalamitasClone.DartDamage; + } + } + public override void AI() { Projectile.frameCounter++; @@ -153,8 +167,12 @@ namespace CalamityMod.Projectiles.Boss { if (Main.npc[CalamityGlobalNPC.SCal].active) { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) + if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().permafrost) + { + lightColor.G = (byte)(255 * Projectile.Opacity); lightColor.B = (byte)(255 * Projectile.Opacity); + lightColor.R = 0; + } } } @@ -177,16 +195,15 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(ImpactSound, Projectile.Center); // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; if (Projectile.ai[2] == 0f) { if (Projectile.owner == Main.myPlayer) { - int totalProjectiles = bossRush ? 44 : death ? 36 : revenge ? 32 : expertMode ? 28 : 20; + int totalProjectiles = death ? 36 : revenge ? 32 : expertMode ? 28 : 20; float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); float velocity = 6.5f; @@ -194,7 +211,7 @@ namespace CalamityMod.Projectiles.Boss for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, (int)Math.Round(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity2, type, DartDamage, 0f, Projectile.owner, 0f, Projectile.ai[1], velocity * 1.5f); } } diff --git a/Projectiles/Boss/SCalRitualDrama.cs b/Projectiles/Boss/SCalRitualDrama.cs index 22850fc1e5..ba195b1b8b 100644 --- a/Projectiles/Boss/SCalRitualDrama.cs +++ b/Projectiles/Boss/SCalRitualDrama.cs @@ -1,5 +1,6 @@ using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.NPCs.Cryogen; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.Particles; using CalamityMod.Skies; @@ -98,12 +99,12 @@ namespace CalamityMod.Projectiles.Boss NPC scal = CalamityUtils.SpawnBossBetter(spawnPosition, ModContent.NPCType()); if (Projectile.ai[1] == 1) { - scal.ModNPC().cirrus = true; + scal.ModNPC().permafrost = true; } } // Make a laugh sound and create a burst of brimstone dust. - SoundStyle SpawnSound = Projectile.ai[1] == 1 ? SoundID.Item107 : SupremeCalamitas.SpawnSound; + SoundStyle SpawnSound = Projectile.ai[1] == 1 ? Cryogen.DeathSound : SupremeCalamitas.SpawnSound; SoundEngine.PlaySound(SpawnSound, Projectile.Center); // Make a sudden screen shake. @@ -112,19 +113,19 @@ namespace CalamityMod.Projectiles.Boss // Generate a dust explosion at the ritual's position. for (int i = 0; i < 90; i++) { - Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? (int)CalamityDusts.PurpleCosmilite : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); + Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1 ? DustID.IceGolem : (int)CalamityDusts.Brimstone, new Vector2(30, 30).RotatedByRandom(100) * Main.rand.NextFloat(0.05f, 1.2f)); spawnDust.noGravity = true; spawnDust.scale = Main.rand.NextFloat(1.2f, 2.3f); } for (int i = 0; i < 40; i++) { Vector2 sparkVel = new Vector2(20, 20).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.1f); - GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, true, true); + GlowOrbParticle orb = new GlowOrbParticle(Projectile.Center + sparkVel * 2, sparkVel, false, 120, Main.rand.NextFloat(1.55f, 2.75f), Projectile.ai[1] == 1 ? Color.Cyan : Color.Red, true, true); GeneralParticleHandler.SpawnParticle(orb); } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Cyan : Color.Red, new Vector2(2f, 2f), 0, 0f, 2.7f, 60); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Magenta : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Projectile.ai[1] == 1 ? Color.Cyan : new Color(121, 21, 77), new Vector2(2f, 2f), 0, 0f, 2.1f, 60); GeneralParticleHandler.SpawnParticle(pulse2); } } diff --git a/Projectiles/Boss/SandPoisonCloud.cs b/Projectiles/Boss/SandPoisonCloud.cs index 6db2345c81..2b5d10c0b6 100644 --- a/Projectiles/Boss/SandPoisonCloud.cs +++ b/Projectiles/Boss/SandPoisonCloud.cs @@ -84,7 +84,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 240, true); + target.AddBuff(BuffID.Venom, 180); } } } diff --git a/Projectiles/Boss/SandPoisonCloudOldDuke.cs b/Projectiles/Boss/SandPoisonCloudOldDuke.cs index aba5827d69..ec90cc8009 100644 --- a/Projectiles/Boss/SandPoisonCloudOldDuke.cs +++ b/Projectiles/Boss/SandPoisonCloudOldDuke.cs @@ -92,7 +92,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 240, true); + target.AddBuff(ModContent.BuffType(), 480, true); } } } diff --git a/Projectiles/Boss/SirenSong.cs b/Projectiles/Boss/SirenSong.cs index 8a343083b5..bf58180b67 100644 --- a/Projectiles/Boss/SirenSong.cs +++ b/Projectiles/Boss/SirenSong.cs @@ -78,13 +78,5 @@ namespace CalamityMod.Projectiles.Boss CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || Projectile.Opacity != 1f) - return; - - target.AddBuff(BuffID.Dazed, 120); - } } } diff --git a/Projectiles/Boss/SkyFlareRevenge.cs b/Projectiles/Boss/SkyFlareRevenge.cs index 7cb58e9c83..0856f46a52 100644 --- a/Projectiles/Boss/SkyFlareRevenge.cs +++ b/Projectiles/Boss/SkyFlareRevenge.cs @@ -75,8 +75,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { int type = ModContent.ProjectileType(); - int damage = Projectile.GetProjectileDamage(ModContent.NPCType()); - int nado = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, damage, 4f, Main.myPlayer, 16f, 50f); + int nado = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, type, Yharon.BordernadoDamage, 4f, Main.myPlayer, 16f, 50f); Main.projectile[nado].Bottom = Projectile.Center; Main.projectile[nado].netUpdate = true; } diff --git a/Projectiles/Boss/SporeGasPlantera.cs b/Projectiles/Boss/SporeGasPlantera.cs index f1527b37fd..f84715fe34 100644 --- a/Projectiles/Boss/SporeGasPlantera.cs +++ b/Projectiles/Boss/SporeGasPlantera.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 32; Projectile.height = 32; Projectile.hostile = true; @@ -50,7 +49,7 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { Projectile.ai[1] += 1f; - if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 900f)) + if (Projectile.ai[1] > (Main.getGoodWorld ? 600f : 900f)) { Projectile.localAI[0] += 10f; Projectile.damage = 0; @@ -69,17 +68,17 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += Projectile.velocity.X * 0.02f; Projectile.rotation += Projectile.direction * 0.002f; - if (Projectile.velocity.Length() > (CalamityWorld.LegendaryMode ? 4f : 2f)) + if (Projectile.velocity.Length() > (Main.getGoodWorld ? 4f : 2f)) Projectile.velocity *= 0.985f; } - public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 900f) && Projectile.ai[1] > 120f; + public override bool CanHitPlayer(Player target) => Projectile.ai[1] <= (Main.getGoodWorld ? 600f : 900f) && Projectile.ai[1] > 120f; public override Color? GetAlpha(Color lightColor) { - if (Projectile.ai[1] > (CalamityWorld.LegendaryMode ? 600f : 900f)) + if (Projectile.ai[1] > (Main.getGoodWorld ? 600f : 900f)) { - byte b2 = (byte)((26f - (Projectile.ai[1] - (CalamityWorld.LegendaryMode ? 600f : 900f))) * 10f); + byte b2 = (byte)((26f - (Projectile.ai[1] - (Main.getGoodWorld ? 600f : 900f))) * 10f); byte a2 = (byte)(Projectile.alpha * (b2 / 255f)); return new Color(b2, b2, b2, a2); } @@ -112,7 +111,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - if (Projectile.ai[1] <= (CalamityWorld.LegendaryMode ? 600f : 900f) && Projectile.ai[1] > 120f) + if (Projectile.ai[1] <= (Main.getGoodWorld ? 600f : 900f) && Projectile.ai[1] > 120f) target.AddBuff(BuffID.Poisoned, 480); } } diff --git a/Projectiles/Boss/SupremeCataclysmFist.cs b/Projectiles/Boss/SupremeCataclysmFist.cs index edb9e872bf..0ed0cb59ab 100644 --- a/Projectiles/Boss/SupremeCataclysmFist.cs +++ b/Projectiles/Boss/SupremeCataclysmFist.cs @@ -43,10 +43,9 @@ namespace CalamityMod.Projectiles.Boss public override void AI() { // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // The Orb if (Projectile.ai[2] >= 3) @@ -281,13 +280,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => (Projectile.Opacity >= 1f || Projectile.ai[2] >= 3); - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || Projectile.Opacity != 1f) - return; - - target.AddBuff(ModContent.BuffType(), 240, true); - } public override bool OnTileCollide(Vector2 oldVelocity) { SoundStyle b = new("CalamityMod/Sounds/Custom/Kickball"); diff --git a/Projectiles/Boss/SupremeCatastropheSlash.cs b/Projectiles/Boss/SupremeCatastropheSlash.cs index afa91f3d53..1939353905 100644 --- a/Projectiles/Boss/SupremeCatastropheSlash.cs +++ b/Projectiles/Boss/SupremeCatastropheSlash.cs @@ -26,8 +26,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; - // These never naturally use rotations, so this shouldn't be an issue. Projectile.width = 100; Projectile.height = 60; @@ -46,10 +44,9 @@ namespace CalamityMod.Projectiles.Boss Time++; // Difficulty modes - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Decide frames. Projectile.frameCounter++; diff --git a/Projectiles/Boss/THanosSideLaser.cs b/Projectiles/Boss/THanosSideLaser.cs index 89b47ae15d..d3d797b890 100644 --- a/Projectiles/Boss/THanosSideLaser.cs +++ b/Projectiles/Boss/THanosSideLaser.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Boss if (Velocity != Vector2.Zero) { Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; - Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Projectile.velocity = Velocity; Velocity = Vector2.Zero; Projectile.netUpdate = true; } diff --git a/Projectiles/Boss/ThanatosBeamStart.cs b/Projectiles/Boss/ThanatosBeamStart.cs index 1169549444..f2c2441310 100644 --- a/Projectiles/Boss/ThanatosBeamStart.cs +++ b/Projectiles/Boss/ThanatosBeamStart.cs @@ -107,10 +107,9 @@ namespace CalamityMod.Projectiles.Boss return; // Difficulty modes. Used during the firing of the perpendicular lasers. - bool bossRush = BossRushEvent.BossRushActive; - bool death = CalamityWorld.death || bossRush; - bool revenge = CalamityWorld.revenge || bossRush; - bool expertMode = Main.expertMode || bossRush; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; + bool revenge = CalamityWorld.revenge || BossRushEvent.BossRushActive; + bool expertMode = Main.expertMode || BossRushEvent.BossRushActive; // Spawn dust at the end of the beam. int dustType = (int)CalamityDusts.Brimstone; @@ -137,7 +136,7 @@ namespace CalamityMod.Projectiles.Boss } // Periodically fire beams along the laser perpendicular to its direction. - float laserFireRate = (CalamityWorld.LegendaryMode && revenge) ? 60f : expertMode ? 80f : 160f; + float laserFireRate = Main.getGoodWorld ? 60f : expertMode ? 80f : 160f; if (Main.npc[OwnerIndex].Calamity().newAI[2] % laserFireRate == 0f) { // Play a laser sound to go with the beams. @@ -146,19 +145,18 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.owner == Main.myPlayer) { Vector2 beamDirection = Projectile.velocity.SafeNormalize(Vector2.UnitY); - float distanceBetweenProjectiles = bossRush ? 160f : death ? 256f : revenge ? 288f : 320f; + float distanceBetweenProjectiles = death ? 256f : revenge ? 288f : 320f; Vector2 laserFirePosition = Main.npc[OwnerIndex].Center + beamDirection * distanceBetweenProjectiles; int laserCount = (int)(LaserLength / distanceBetweenProjectiles); int type = ModContent.ProjectileType(); - int damage = Projectile.GetProjectileDamage(Main.npc[OwnerIndex].type); for (int i = 0; i < laserCount; i++) { int totalProjectiles = 2; float radians = MathHelper.TwoPi / totalProjectiles; for (int j = 0; j < totalProjectiles; j++) { - Vector2 projVelocity = (CalamityWorld.LegendaryMode && revenge) ? new Vector2(Main.rand.Next(-12, 12), Main.rand.Next(-12, 12)) : Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserFirePosition, projVelocity, type, damage, 0f, Main.myPlayer, 0f, -1f); + Vector2 projVelocity = Main.getGoodWorld ? new Vector2(Main.rand.Next(-12, 12), Main.rand.Next(-12, 12)) : Projectile.velocity.RotatedBy(radians * j + MathHelper.PiOver2) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserFirePosition, projVelocity, type, ThanatosHead.LaserDamage, 0f, Main.myPlayer, 0f, -1f); } laserFirePosition += beamDirection * distanceBetweenProjectiles; } @@ -242,7 +240,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 300); } public override bool CanHitPlayer(Player target) => OwnerIsValid && Projectile.scale >= 0.5f; diff --git a/Projectiles/Boss/ThanatosLaser.cs b/Projectiles/Boss/ThanatosLaser.cs index 75739ff077..c0bbc975d5 100644 --- a/Projectiles/Boss/ThanatosLaser.cs +++ b/Projectiles/Boss/ThanatosLaser.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 22; Projectile.height = 22; Projectile.hostile = true; @@ -99,7 +98,7 @@ namespace CalamityMod.Projectiles.Boss if (Velocity != Vector2.Zero) { Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; - Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Projectile.velocity = Velocity; Velocity = Vector2.Zero; Projectile.netUpdate = true; } @@ -162,7 +161,7 @@ namespace CalamityMod.Projectiles.Boss if (Velocity != Vector2.Zero) { Projectile.extraUpdates = Main.getGoodWorld ? 4 : 3; - Projectile.velocity = Velocity * (BossRushEvent.BossRushActive ? 1.25f : 1f); + Projectile.velocity = Velocity; Velocity = Vector2.Zero; Projectile.netUpdate = true; } @@ -240,14 +239,6 @@ namespace CalamityMod.Projectiles.Boss public override bool CanHitPlayer(Player target) => TelegraphDelay > TelegraphTotalTime; - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (info.Damage <= 0 || TelegraphDelay <= TelegraphTotalTime) - return; - - target.AddBuff(ModContent.BuffType(), 90); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { return CalamityUtils.CircularHitboxCollision(projHitbox.Center(), Projectile.Size.Length() * 0.5f, targetHitbox); diff --git a/Projectiles/Boss/ThornBallSpike.cs b/Projectiles/Boss/ThornBallSpike.cs index 790a4288bb..e60fdf23eb 100644 --- a/Projectiles/Boss/ThornBallSpike.cs +++ b/Projectiles/Boss/ThornBallSpike.cs @@ -56,7 +56,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 120); public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); diff --git a/Projectiles/Boss/ToxicCloud.cs b/Projectiles/Boss/ToxicCloud.cs index c1c879d50c..f0286ca08f 100644 --- a/Projectiles/Boss/ToxicCloud.cs +++ b/Projectiles/Boss/ToxicCloud.cs @@ -36,8 +36,7 @@ namespace CalamityMod.Projectiles.Boss { Lighting.AddLight(Projectile.Center, 0.1f, 0.7f, 0f); - bool bossRush = BossRushEvent.BossRushActive; - if (Projectile.velocity.Length() < (bossRush ? 6.25f : 5f)) + if (Projectile.velocity.Length() < 5f) Projectile.velocity *= 1.01f; Projectile.ai[0] += 1f; @@ -88,9 +87,7 @@ namespace CalamityMod.Projectiles.Boss if (info.Damage <= 0) return; - target.AddBuff(BuffID.Poisoned, 240); - target.AddBuff(BuffID.Venom, 240); - target.AddBuff(ModContent.BuffType(), 240); + target.AddBuff(ModContent.BuffType(), 480); } } } diff --git a/Projectiles/Boss/UnstableCrimulanGlob.cs b/Projectiles/Boss/UnstableCrimulanGlob.cs index 71ac79c0a2..2a49abbf7c 100644 --- a/Projectiles/Boss/UnstableCrimulanGlob.cs +++ b/Projectiles/Boss/UnstableCrimulanGlob.cs @@ -14,16 +14,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 30; Projectile.height = 30; Projectile.hostile = true; Projectile.penetrate = 1; Projectile.Opacity = 0.8f; Projectile.tileCollide = false; - Projectile.timeLeft = BossRushEvent.BossRushActive ? 640 : CalamityWorld.death ? 490 : CalamityWorld.revenge ? 440 : Main.expertMode ? 390 : 240; + Projectile.timeLeft = CalamityWorld.death ? 490 : CalamityWorld.revenge ? 440 : Main.expertMode ? 390 : 240; - if (Main.getGoodWorld) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } @@ -51,7 +50,7 @@ namespace CalamityMod.Projectiles.Boss { if (Projectile.velocity.Length() < 15f && (Main.expertMode || BossRushEvent.BossRushActive)) { - float velocityMult = BossRushEvent.BossRushActive ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; + float velocityMult = CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; Projectile.velocity *= velocityMult; } } diff --git a/Projectiles/Boss/UnstableEbonianGlob.cs b/Projectiles/Boss/UnstableEbonianGlob.cs index 89b77b7a77..6a1cc8636b 100644 --- a/Projectiles/Boss/UnstableEbonianGlob.cs +++ b/Projectiles/Boss/UnstableEbonianGlob.cs @@ -14,16 +14,15 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 30; Projectile.height = 30; Projectile.hostile = true; Projectile.penetrate = 1; Projectile.Opacity = 0.8f; Projectile.tileCollide = false; - Projectile.timeLeft = BossRushEvent.BossRushActive ? 780 : CalamityWorld.death ? 600 : CalamityWorld.revenge ? 540 : Main.expertMode ? 480 : 300; + Projectile.timeLeft = CalamityWorld.death ? 600 : CalamityWorld.revenge ? 540 : Main.expertMode ? 480 : 300; - if (Main.getGoodWorld) + if (Main.zenithWorld) Projectile.extraUpdates = 1; } @@ -34,7 +33,7 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.velocity.Length() < 12f && (Main.expertMode || BossRushEvent.BossRushActive || Projectile.ai[0] == 1f)) { - float velocityMult = BossRushEvent.BossRushActive ? 1.025f : CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; + float velocityMult = CalamityWorld.death ? 1.015f : CalamityWorld.revenge ? 1.0125f : Main.expertMode ? 1.01f : 1.005f; if (Projectile.ai[0] == 1f) velocityMult += 0.02f; diff --git a/Projectiles/Boss/YharonBulletHellVortex.cs b/Projectiles/Boss/YharonBulletHellVortex.cs index 4fde90ccdf..906fe2c972 100644 --- a/Projectiles/Boss/YharonBulletHellVortex.cs +++ b/Projectiles/Boss/YharonBulletHellVortex.cs @@ -31,6 +31,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.timeLeft = 60000; + Projectile.Calamity().DealsDefenseDamage = true; } public override void SendExtraAI(BinaryWriter writer) @@ -62,7 +63,7 @@ namespace CalamityMod.Projectiles.Boss Projectile.hostile = true; Projectile.width = Projectile.height = (int)(408f * Projectile.scale); float inertia = 5f; - float speed = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 10.7f : 5.35f; + float speed = 5.35f; float minDist = 160f; if (victim >= 0 && Main.player[victim].active && !Main.player[victim].dead) { @@ -79,7 +80,7 @@ namespace CalamityMod.Projectiles.Boss } // Fly away from other vortices - float pushForce = (CalamityWorld.LegendaryMode && CalamityWorld.revenge) ? 0.1f : 0.05f; + float pushForce = 0.05f; for (int k = 0; k < Main.maxProjectiles; k++) { Projectile otherProj = Main.projectile[k]; diff --git a/Projectiles/Boss/YharonFireball.cs b/Projectiles/Boss/YharonFireball.cs index 2f8648e584..b7b87e1de4 100644 --- a/Projectiles/Boss/YharonFireball.cs +++ b/Projectiles/Boss/YharonFireball.cs @@ -11,8 +11,8 @@ namespace CalamityMod.Projectiles.Boss public class YharonFireball : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Boss"; - private float speedX = -1f; - private float speedX2 = -2f; + private float speedX = -3f; + private float speedX2 = -5f; public override void SetStaticDefaults() { @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; @@ -95,13 +94,13 @@ namespace CalamityMod.Projectiles.Boss { for (int x = 0; x < 3; x++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX, -6f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); - speedX += 1f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX, -50f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + speedX += 3f; } for (int x = 0; x < 2; x++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX2, -6f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); - speedX2 += 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, speedX2, -75f, ModContent.ProjectileType(), Projectile.damage, 0f, Main.myPlayer); + speedX2 += 10f; } } Projectile.ExpandHitboxBy(144); diff --git a/Projectiles/Boss/YharonFireball2.cs b/Projectiles/Boss/YharonFireball2.cs index df9e249e70..96b9044f0d 100644 --- a/Projectiles/Boss/YharonFireball2.cs +++ b/Projectiles/Boss/YharonFireball2.cs @@ -29,10 +29,10 @@ namespace CalamityMod.Projectiles.Boss public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 34; Projectile.height = 34; Projectile.hostile = true; + Projectile.Opacity = 0.25f; Projectile.alpha = 255; Projectile.penetrate = -1; Projectile.timeLeft = 3600; @@ -60,21 +60,43 @@ namespace CalamityMod.Projectiles.Boss if (Projectile.frame >= Main.projFrames[Type]) Projectile.frame = 0; - if (Projectile.ai[0] < TimeBeforeFalling) + if (Projectile.velocity.Y >= -16f) { - Projectile.ai[0] += 1f; - Projectile.velocity.Y -= 0.1f; - if (Projectile.velocity.Y < MaxUpwardVelocity) - Projectile.velocity.Y = MaxUpwardVelocity; + if (Projectile.Opacity < 1f) + { + Projectile.Opacity = 1f; + SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); + int dustAmount = 36; + + for (int i = 0; i < dustAmount; i++) + { + Vector2 dustSpawnPosition = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.5f; + dustSpawnPosition = dustSpawnPosition.RotatedBy((double)((float)(i - (dustAmount / 2 - 1)) * MathHelper.TwoPi / (float)dustAmount), default) + Projectile.Center; + Vector2 dustVelocity = dustSpawnPosition - Projectile.Center; + + int dust = Dust.NewDust(dustSpawnPosition + dustVelocity, 0, 0, DustID.Pixie, dustVelocity.X, dustVelocity.Y); + Main.dust[dust].noGravity = true; + Main.dust[dust].noLight = true; + Main.dust[dust].velocity = dustVelocity; + } + } + } + + if (Projectile.velocity.Y < -1f) + { + // 129 frames to get from -50 to -1 + Projectile.velocity.Y *= 0.97f; } else { - Projectile.velocity.X *= 0.8f; + // 85 frames to get from -1 to 16 Projectile.velocity.Y += 0.2f; - if (Projectile.velocity.Y > MaxDownwardVelocity) - Projectile.velocity.Y = MaxDownwardVelocity; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; } + Projectile.velocity.X *= 0.995f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Projectile.localAI[0] == 0f) @@ -83,6 +105,13 @@ namespace CalamityMod.Projectiles.Boss SoundEngine.PlaySound(FireballSound, Projectile.Center); } + if (Projectile.ai[0] >= 2f) + { + Projectile.alpha -= 25; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + } + if (Main.rand.NextBool(16)) { Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Pixie, 0f, 0f, 200, default, 1f); @@ -91,6 +120,7 @@ namespace CalamityMod.Projectiles.Boss } } + public override bool CanHitPlayer(Player target) => Projectile.velocity.Y >= -16f; public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2503d9aba1..6e944b0b01 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -13,10 +13,15 @@ using CalamityMod.Events; using CalamityMod.ExtraTextures; using CalamityMod.Items.Accessories; using CalamityMod.Items.Ammo; +using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.Armor.Daedalus; +using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.NPCs; using CalamityMod.NPCs.NormalNPCs; using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; using CalamityMod.Projectiles.Healing; @@ -115,7 +120,7 @@ namespace CalamityMod.Projectiles /// If true, this projectile is able to spawn lightning while using Arc Flash Ring.
/// This is set to false when lightning is procced, and is reset to true when the cooldown ends. ///
- public bool spawnArcFlash = true; + public bool showArcFlash = true; /// Cooldown variable for Arc Flash Ring's lightning. Primarily used for lingering projectiles and minions. public int arcFlashCooldown = 0; @@ -189,21 +194,6 @@ namespace CalamityMod.Projectiles ///
public int timesPierced = 0; - /// - /// If this projectile uses point-blank damage, this gets set to , then is decremented every frame.
- /// If it reaches 0, this projectile can no longer deal point-blank damage. - ///
- public int pointBlankShotDuration = 0; - /// - /// If this projectile uses point-blank damage, this value is incremented on every update by the distance the projectile traveled on that update.
- /// If it exceeds , this projectile can no longer deal point-blank damage. - ///
- public float pointBlankShotDistanceTravelled = 0f; - /// Constant variable which stores how many frames a projectile is allowed to deal point-blank damage. - public const int DefaultPointBlankDuration = 18; - /// Constant variable which stores the maximum distance a projectile can travel to deal point-blank damage, in pixels. - public const float PointBlankShotDistanceLimit = 240f; // 15 tiles - // Empress of Light variables private const float EmpressRainbowStreakSpreadOutCutoff = 140f; private const int EmpressLastingRainbowTotalDuration = 660; @@ -219,6 +209,11 @@ namespace CalamityMod.Projectiles /// A temporary flat amount subtracted from the projectile's damage when hitting the player. Resets to 0 if drops to 0. public int flatDR = 0; + /// Timer for how long a projectile's damage is reduced by the value in . + public int multiplicativeDRTimer = 0; + /// A temporary multiplicative amount of damage reduction when hitting the player. Resets to 0 if drops to 0. + public float multiplicativeDR = 0; + /// If true, this projectile is a hook which has spawned a flower on it from Bloom Stone. Used to prevent spawning multiple flowers. public bool hookCanSpawnFlower = false; @@ -259,10 +254,6 @@ namespace CalamityMod.Projectiles /// Cooldown variable used to prevent projectiles from spawning orbs while in The Transformer's aura. public int TransformerTimer = 0; - // Note: Although this was intended for fishing line colors, I use this as an AI variable a lot because vanilla only has 4 that sometimes are already in use. ~Ben - // TODO -- uses of this variable are undocumented and unstable. Remove it from the API surface. - public int lineColor = 0; - /// /// There are several NPCs in Calamity which do not take damage from minions in certain circumstances.
/// If true, this variable allows a projectile that deals summon damage to bypass this mechanic. @@ -289,7 +280,6 @@ namespace CalamityMod.Projectiles public int BloodstoneOrbValue = 0; #region On Spawn - public override void OnSpawn(Projectile projectile, IEntitySource source) { // TODO -- it would be nice to move frame one hacks here, but this runs in the middle of NewProjectile @@ -301,18 +291,50 @@ namespace CalamityMod.Projectiles if (sourceItem != null) extorterBoost = true; - if (source is EntitySource_Parent { Entity: NPC npc }) - { - if (!npc.friendly) - ParentNPCIndex = npc.whoAmI; - } - // Whenever the player has Daawnlight Spirit Origin, any ranged projectile will have the capacity to infintely supercrit. if (Main.player[projectile.owner].Calamity().spiritOrigin && projectile.CountsAsClass()) { projectile.CritChance += Main.player[projectile.owner].Calamity().spiritOriginCritBoost; projectile.Calamity().supercritHits = -1; } + + if (source is EntitySource_Parent { Entity: NPC npc }) + { + if (!npc.friendly) + ParentNPCIndex = npc.whoAmI; + } + // + // SPECIFIC PROJECTILE BALANCE CHANGES + // + else if (source is EntitySource_Parent { Entity: Projectile parent }) + { + // Nerf Crystal bullet shard damage by 45% + // Vanilla crystal shards deal 50% of the bullet's damage which is absurd, this nerfs them to 27.5% + if (parent.type == ProjectileID.CrystalBullet && projectile.type == ProjectileID.CrystalShard) + projectile.damage = (int)(projectile.damage * 0.55f); + + // Nerf Mushroom Spear mushroom damage by 50% + if (parent.type == ProjectileID.MushroomSpear && projectile.type == ProjectileID.Mushroom) + projectile.damage /= 2; + + // Nerf Luminite Arrow trail damage by 50% + if (parent.type == ProjectileID.MoonlordArrow && projectile.type == ProjectileID.MoonlordArrowTrail) + projectile.damage /= 2; + + // Nerf Cursed Dart flame damage by 50% + if (parent.type == ProjectileID.CursedDart && projectile.type == ProjectileID.CursedDartFlame) + projectile.damage /= 2; + } + + if (source is EntitySource_OnHit e) + { + // Nerf Orichalcum armor's set bonus petal damage by 25% + if (e.Context == "SetBonus_Orichalcum") + projectile.damage = (int)(projectile.damage * 0.75f); + // Nerf Spectre armor's set bonus soul damage by 50% + if (e.Context == "SetBonus_GhostHurt") + projectile.damage /= 2; + } } public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) => binaryWriter.Write(ParentNPCIndex); public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) => ParentNPCIndex = binaryReader.ReadInt32(); @@ -343,6 +365,8 @@ namespace CalamityMod.Projectiles #region Pre AI public override bool PreAI(Projectile projectile) { + if (projectile.bobber && projectile.type != ModContent.ProjectileType() && RunFishingMinigames(projectile)) + return false; #region Vanilla Summons AI Changes // @@ -371,12 +395,6 @@ namespace CalamityMod.Projectiles #endregion - if (!Main.player[projectile.owner].ActiveItem().IsAir && !Main.player[projectile.owner].ActiveItem().Calamity().canFirePointBlankShots) - pointBlankShotDuration = 0; - - if (pointBlankShotDuration > 0) - pointBlankShotDuration--; - // Reduce secondary yoyo damage if the player has Yoyo Glove // Brief behavior documentation of yoyo AI: ai[0, 1] are the x, y co-ords and localAI[0] is the airtime in frames // All secondary yoyos are spawned with ai[0] of 1 which tells then tell its AI to do secondary yoyo AI @@ -416,10 +434,6 @@ namespace CalamityMod.Projectiles projectile.Kill(); } - // Chlorophyte Crystal AI rework. - if (projectile.type == ProjectileID.CrystalLeaf) - return ChlorophyteCrystalAI.DoChlorophyteCrystalAI(projectile); - if (projectile.minion && ExplosiveEnchantCountdown > 0) { ExplosiveEnchantCountdown--; @@ -481,10 +495,10 @@ namespace CalamityMod.Projectiles // Accelerate if fired in a spread from Skeletron in Rev+ if (revSkeletronAcceleratingSkull) { - float maxVelocity = (Main.masterMode || BossRushEvent.BossRushActive) ? 20f : CalamityWorld.death ? 18f : 15f; + float maxVelocity = CalamityWorld.death ? 18f : 15f; if (projectile.velocity.Length() < maxVelocity) { - float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + float acceleration = 1.015f; projectile.velocity *= acceleration; if (projectile.velocity.Length() > maxVelocity) { @@ -523,7 +537,7 @@ namespace CalamityMod.Projectiles num133 = Player.FindClosest(projectile.Center, 1, 1); projectile.ai[1] += 1f; float homingStartTime = revSkeletronPrimeHomingSkull ? 10f : 30f; - float homingEndTime = (Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f; + float homingEndTime = CalamityWorld.death ? 105f : 90f; if (revSkeletronPrimeHomingSkull) homingEndTime += 60f; @@ -544,7 +558,7 @@ namespace CalamityMod.Projectiles } float maxVelocity = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 18f : 15f; - float acceleration = (Main.masterMode || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; + float acceleration = (CalamityWorld.death || BossRushEvent.BossRushActive) ? 1.02f : 1.015f; if (projectile.velocity.Length() < maxVelocity) projectile.velocity *= acceleration; @@ -697,11 +711,6 @@ namespace CalamityMod.Projectiles { if (projectile.localAI[0] == 0f) { - if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) - projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); - if (!CalamityPlayer.areThereAnyDamnBosses) - projectile.damage = (int)Math.Round(projectile.damage * 0.65); - SoundEngine.PlaySound(SoundID.Item17, projectile.Center); projectile.localAI[0] = 1f; for (int i = 0; i < 8; i++) @@ -730,11 +739,6 @@ namespace CalamityMod.Projectiles { if (projectile.localAI[0] == 0f) { - if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) - projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); - if (!CalamityPlayer.areThereAnyDamnBosses) - projectile.damage = (int)Math.Round(projectile.damage * 0.65); - SoundEngine.PlaySound(SoundID.Item171, projectile.Center); projectile.localAI[0] = 1f; for (int i = 0; i < 8; i++) @@ -1014,119 +1018,16 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.Sharknado) - { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - - int num535 = 10; - int num536 = 15; - float num537 = 1f; - int num538 = 150; - int num539 = 42; - - if (projectile.velocity.X != 0f) - projectile.direction = (projectile.spriteDirection = -Math.Sign(projectile.velocity.X)); - - projectile.frameCounter++; - if (projectile.frameCounter > 2) - { - projectile.frame++; - projectile.frameCounter = 0; - } - - if (projectile.frame >= 6) - projectile.frame = 0; - - if (projectile.localAI[0] == 0f && Main.myPlayer == projectile.owner) - { - projectile.localAI[0] = 1f; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.scale = ((float)(num535 + num536) - projectile.ai[1]) * num537 / (float)(num536 + num535); - projectile.width = (int)((float)num538 * projectile.scale); - projectile.height = (int)((float)num539 * projectile.scale); - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.netUpdate = true; - } - - if (projectile.ai[1] != -1f) - { - projectile.scale = ((float)(num535 + num536) - projectile.ai[1]) * num537 / (float)(num536 + num535); - projectile.width = (int)((float)num538 * projectile.scale); - projectile.height = (int)((float)num539 * projectile.scale); - } - - int maxAlpha = 150; - int minAlpha = 60; - if (projectile.timeLeft > FishronSharknadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) - { - maxAlpha = 220; - minAlpha = 180; - } - - if (!Collision.SolidCollision(projectile.position, projectile.width, projectile.height)) - { - projectile.alpha -= 30; - if (projectile.alpha < minAlpha) - projectile.alpha = minAlpha; - } - else - { - projectile.alpha += 30; - if (projectile.alpha > maxAlpha) - projectile.alpha = maxAlpha; - } - - if (projectile.ai[0] > 0f) - projectile.ai[0]--; - - if (projectile.ai[0] == 1f && projectile.ai[1] > 0f && projectile.owner == Main.myPlayer) - { - projectile.netUpdate = true; - Vector2 center4 = projectile.Center; - center4.Y -= (float)num539 * projectile.scale / 2f; - float num540 = ((float)(num535 + num536) - projectile.ai[1] + 1f) * num537 / (float)(num536 + num535); - center4.Y -= (float)num539 * num540 / 2f; - center4.Y += 2f; - Projectile.NewProjectile(projectile.GetSource_FromAI(), center4, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, 10f, projectile.ai[1] - 1f); - int num541 = 4; - - if ((int)projectile.ai[1] % num541 == 0 && projectile.ai[1] != 0f) - { - int num542 = NPCID.Sharkron; - int num543 = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center4.X, (int)center4.Y, num542); - Main.npc[num543].velocity = projectile.velocity; - Main.npc[num543].netUpdate = true; - } - } - - if (projectile.ai[0] <= 0f) - { - float num544 = MathHelper.Pi / 30f; - float num545 = (float)projectile.width / 5f; - float num546 = (float)(Math.Cos(num544 * (0f - projectile.ai[0])) - 0.5) * num545; - projectile.position.X -= num546 * (float)(-projectile.direction); - projectile.ai[0]--; - num546 = (float)(Math.Cos(num544 * (0f - projectile.ai[0])) - 0.5) * num545; - projectile.position.X += num546 * (float)(-projectile.direction); - } - - return false; - } - // Larger cthulhunadoes else if (projectile.type == ProjectileID.Cthulunado) { - projectile.damage = projectile.GetProjectileDamage(NPCID.DukeFishron); - if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; + bool death = CalamityWorld.death || BossRushEvent.BossRushActive; int num606 = 16; int num607 = 16; - float segmentScale = masterMode ? 2.5f : 2f; + float segmentScale = death ? 2.5f : 2f; int segmentWidth = 150; int segmentHeight = 42; @@ -1202,12 +1103,12 @@ namespace CalamityMod.Projectiles float segmentSpawnDelay = 10f; Projectile.NewProjectile(projectile.GetSource_FromThis(), center, projectile.velocity, projectile.type, projectile.damage, projectile.knockBack, projectile.owner, segmentSpawnDelay, projectile.ai[1] - 1f); - int sharkronSpawnGateValue = masterMode ? 2 : 3; + int sharkronSpawnGateValue = death ? 2 : 3; if ((int)projectile.ai[1] % sharkronSpawnGateValue == 0 && projectile.ai[1] != 0f) { int sharkron = NPC.NewNPC(projectile.GetSource_FromAI(), (int)center.X, (int)center.Y, NPCID.Sharkron2); Main.npc[sharkron].velocity = projectile.velocity; - Main.npc[sharkron].scale = masterMode ? 2f : 1.5f; + Main.npc[sharkron].scale = 1.5f; Main.npc[sharkron].netUpdate = true; Main.npc[sharkron].ai[2] = projectile.width; Main.npc[sharkron].ai[3] = -1.5f; @@ -1765,7 +1666,7 @@ namespace CalamityMod.Projectiles int maxHealAmount = 20; // If the target has more than 250 max life, incorporate their total life into the max amount to heal. - // This is done so that more powerful NPCs, such as Cirrus, do not take an eternity to receive meaningful healing benefits + // This is done so that more powerful NPCs do not take an eternity to receive meaningful healing benefits // from the Nurse. if (npcToHeal.lifeMax > 250) maxHealAmount = (int)Math.Max(maxHealAmount, npcToHeal.lifeMax * 0.05f); @@ -2083,7 +1984,6 @@ namespace CalamityMod.Projectiles if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; if (projectile.type == ProjectileID.DeerclopsIceSpike) @@ -2092,9 +1992,9 @@ namespace CalamityMod.Projectiles float dustVelocityMultiplier = 0.75f; int numDust = 5; int numDust2 = 5; - int fadeInTime = 50; - int fadeOutGateValue = masterMode ? 120 : death ? 90 : 65; - float killGateValue = masterMode ? 130f : death ? 100f : 75f; + int fadeInTime = 25; + int fadeOutGateValue = death ? 90 : 65; + float killGateValue = death ? 100f : 75f; int maxFrames = 5; bool fadeIn = projectile.ai[0] < (float)fadeInTime; @@ -2127,7 +2027,7 @@ namespace CalamityMod.Projectiles if (fadeIn) { - projectile.Opacity += 0.02f; + projectile.Opacity += 0.04f; if (projectile.Opacity > 1f) projectile.Opacity = 1f; @@ -2186,7 +2086,7 @@ namespace CalamityMod.Projectiles if (projectile.ai[0] == projectile.ai[2]) { projectile.velocity *= 100f; - projectile.velocity *= (masterMode ? 20f : death ? 16f : 12f) + Main.rand.NextFloat() * 2f; + projectile.velocity *= (death ? 16f : 12f) + Main.rand.NextFloat() * 2f; } } else @@ -2265,7 +2165,7 @@ namespace CalamityMod.Projectiles if (projectile.velocity.Y > 16f) projectile.velocity.Y = 16f; - if (CalamityWorld.LegendaryMode && projectile.velocity.Length() > 4f) + if (Main.getGoodWorld && projectile.velocity.Length() > 4f) projectile.velocity *= 0.985f; return false; @@ -2313,126 +2213,17 @@ namespace CalamityMod.Projectiles } } - else if (projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && masterMode) - { - int num = (int)(projectile.Center.X / 16f); - int num2 = (int)(projectile.Center.Y / 16f); - if (WorldGen.InWorld(num, num2) && projectile.tileCollide) - { - Tile tile = Main.tile[num, num2]; - if (tile != null && tile.HasTile && (TileID.Sets.Platforms[tile.TileType] || tile.TileType == TileID.PlanterBox)) - { - projectile.Kill(); - return false; - } - } - - bool masterModeSkeletronPrimeHomingBomb = projectile.ai[0] == -1f; - bool masterModeSkeletronPrimeFallingBomb = projectile.ai[0] == -2f; - - int target = 0; - target = Player.FindClosest(projectile.Center, 1, 1); - - if (projectile.Hitbox.Intersects(Main.player[target].Hitbox)) - { - projectile.Kill(); - return false; - } - - if (projectile.timeLeft < SkeletronPrime2.BombTimeLeft / 2 && projectile.timeLeft > 3) - projectile.tileCollide = true; - - if (masterModeSkeletronPrimeHomingBomb) - { - projectile.ai[1] += 1f; - float homingStartTime = 20f; - float homingEndTime = death ? 140f : 110f; - - if (Vector2.Distance(projectile.Center, Main.player[target].Center) < 192f && projectile.ai[1] < homingEndTime) - projectile.ai[1] = homingEndTime; - - if (projectile.ai[1] < homingEndTime && projectile.ai[1] > homingStartTime) - { - float num134 = projectile.velocity.Length(); - Vector2 vector24 = Main.player[target].Center - projectile.Center; - vector24.Normalize(); - vector24 *= num134; - float inertia = death ? 25f : 30f; - projectile.velocity = (projectile.velocity * (inertia - 1f) + vector24) / inertia; - projectile.velocity.Normalize(); - projectile.velocity *= num134; - } - - float maxVelocity = death ? 18f : 15f; - float acceleration = 1.02f; - if (projectile.velocity.Length() < maxVelocity) - projectile.velocity *= acceleration; - } - else - { - if (projectile.velocity.Y > 10f) - projectile.velocity.Y = 10f; - } - - if (projectile.localAI[0] == 0f) - { - projectile.localAI[0] = 1f; - SoundEngine.PlaySound(SoundID.Item10, projectile.Center); - } - - projectile.frameCounter++; - if (projectile.frameCounter > 3) - { - projectile.frame++; - projectile.frameCounter = 0; - } - - if (projectile.frame > 1) - projectile.frame = 0; - - if (projectile.owner == Main.myPlayer && projectile.timeLeft <= 3) - { - projectile.tileCollide = false; - projectile.ai[2] = 0f; - projectile.alpha = 255; - } - else if (Main.rand.NextBool()) - { - int num28 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100); - Main.dust[num28].scale = 0.1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num28].fadeIn = 1.5f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[num28].noGravity = true; - Main.dust[num28].position = projectile.Center + new Vector2(0f, -projectile.height / 2).RotatedBy(projectile.rotation) * 1.1f; - int num29 = 6; - Dust dust8 = Dust.NewDustDirect(projectile.position, projectile.width, projectile.height, num29, 0f, 0f, 100); - dust8.scale = 1f + (float)Main.rand.Next(5) * 0.1f; - dust8.noGravity = true; - dust8.position = projectile.Center + new Vector2(0f, -projectile.height / 2 - 6).RotatedBy(projectile.rotation) * 1.1f; - } - - if (masterModeSkeletronPrimeFallingBomb) - { - projectile.ai[2] += 1f; - if (projectile.ai[2] > 60f) - projectile.velocity.Y += 0.2f; - } - - projectile.rotation += projectile.velocity.X * 0.1f; - - return false; - } - else if (projectile.type == ProjectileID.RocketSkeleton && projectile.ai[1] >= 1f) { bool primeCannonProjectile = projectile.ai[1] == 2f; bool homeIn = false; - float homingTime = masterMode ? 80f : 140f; + float homingTime = 140f; float spreadOutCutoffTime = 510f; float homeInCutoffTime = spreadOutCutoffTime - homingTime; - float minAcceleration = masterMode ? 0.072f : 0.08f; - float maxAcceleration = masterMode ? 0.108f : 0.12f; - float homingVelocity = masterMode ? 22.5f : 25f; - float maxVelocity = masterMode ? 13.5f : 15f; + float minAcceleration = 0.08f; + float maxAcceleration = 0.12f; + float homingVelocity = 25f; + float maxVelocity = 15f; if (!primeCannonProjectile) { @@ -2461,7 +2252,7 @@ namespace CalamityMod.Projectiles projectile.velocity = Vector2.SmoothStep(projectile.velocity, velocity, amount); // Stop homing when within a certain distance of the target - if (Vector2.Distance(projectile.Center, Main.player[playerIndex].Center) < (masterMode ? 192f : 96f) && projectile.timeLeft > homeInCutoffTime) + if (Vector2.Distance(projectile.Center, Main.player[playerIndex].Center) < 96f && projectile.timeLeft > homeInCutoffTime) projectile.timeLeft = (int)homeInCutoffTime; } @@ -2539,7 +2330,7 @@ namespace CalamityMod.Projectiles projectile.alpha = 0; projectile.ai[0] += 1f; - if (projectile.ai[0] >= (masterMode ? 60f : 120f)) + if (projectile.ai[0] >= 120f) { if (projectile.velocity.Length() < 18f) projectile.velocity *= 1.01f; @@ -2577,7 +2368,7 @@ namespace CalamityMod.Projectiles { if (projectile.owner == Main.myPlayer) { - int totalProjectiles = masterMode ? 12 : 8; + int totalProjectiles = death ? 12 : 8; float radians = MathHelper.TwoPi / totalProjectiles; int type = ProjectileType(); float velocity = 1f; @@ -2585,7 +2376,7 @@ namespace CalamityMod.Projectiles for (int k = 0; k < totalProjectiles; k++) { Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center + Vector2.Normalize(velocity2) * 16f, velocity2, type, (int)Math.Round(projectile.damage * 0.8), 0f, Main.myPlayer); + Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center + Vector2.Normalize(velocity2) * 16f, velocity2, type, PlanteraAI.ThornBallSpikeDamage, 0f, Main.myPlayer); } } @@ -2618,9 +2409,9 @@ namespace CalamityMod.Projectiles else { int closestPlayer = Player.FindClosest(projectile.Center, 1, 1); - float homingSpeed = (masterMode ? 9f : 7.5f) + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; + float homingSpeed = 7.5f + Vector2.Distance(Main.player[closestPlayer].Center, projectile.Center) * 0.01f; Vector2 homingVelocity = Vector2.Normalize(Main.player[closestPlayer].Center - projectile.Center) * homingSpeed; - int inertia = masterMode ? 150 : 200; + int inertia = 200; projectile.velocity.X = (projectile.velocity.X * (inertia - 1) + homingVelocity.X) / inertia; if (projectile.velocity.Length() > 16f) @@ -2642,110 +2433,6 @@ namespace CalamityMod.Projectiles return false; } - else if (projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f) - { - if (projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item20, projectile.position); - projectile.localAI[0] += 1f; - } - - bool killX = false; - bool killY = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - killX = true; - - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - killX = true; - - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - killY = true; - - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - killY = true; - - if (killX && killY) - projectile.Kill(); - - for (int i = 0; i < 10; i++) - { - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, projectile.velocity.X * 0.2f, projectile.velocity.Y * 0.2f, 100, default, 1.6f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.3f; - Main.dust[dust].velocity += projectile.velocity * 0.1f; - if (Main.getGoodWorld) - Main.dust[dust].noLight = true; - } - - Particle theSpark = new AltSparkParticle(projectile.Center, projectile.velocity * 0.06f + projectile.velocity * 0.1f, false, 40, 1f, new Color(255, 255, 100)); - GeneralParticleHandler.SpawnParticle(theSpark); - - return false; - } - - else if (projectile.type == ProjectileID.InfernoHostileBlast && projectile.ai[2] > 0f) - { - if (projectile.localAI[0] == 0f) - { - SoundEngine.PlaySound(SoundID.Item74, projectile.position); - projectile.localAI[0] += 1f; - } - - projectile.ai[0] += 1f; - - float totalDust = 20f; - if (projectile.ai[0] > 540f) - totalDust -= (projectile.ai[0] - 180f) / 2f; - - if (totalDust <= 0f) - { - totalDust = 0f; - projectile.Kill(); - } - - float maxDustVelocityX = 10f; - float maxDustVelocityY = 10f; - float minDustSpeed = 3f; - float maxDustSpeed = 8f; - - for (int i = 0; i < (int)totalDust; i++) - { - float dustVelocityX = Main.rand.NextFloat(-maxDustVelocityX, maxDustVelocityX); - float dustVelocityY = Main.rand.NextFloat(-maxDustVelocityY, maxDustVelocityY); - float randomDustSpeed = Main.rand.NextFloat(minDustSpeed, maxDustSpeed); - float velocityLength = (float)Math.Sqrt(dustVelocityX * dustVelocityX + dustVelocityY * dustVelocityY); - velocityLength = randomDustSpeed / velocityLength; - dustVelocityX *= velocityLength; - dustVelocityY *= velocityLength; - Vector2 dustVelocity = new Vector2(dustVelocityX, dustVelocityY); - Vector2 dustPosition = projectile.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)); - int dust = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.IchorTorch, 0f, 0f, 100, default, 1.8f); - Main.dust[dust].noGravity = true; - Main.dust[dust].position = dustPosition; - Main.dust[dust].velocity = dustVelocity; - if (Main.getGoodWorld) - Main.dust[dust].noLight = true; - } - - float maxSparkVelocityX = 10f; - float maxSparkVelocityY = 10f; - float minSparkSpeed = 3f; - float maxSparkSpeed = 7f; - - float sparkVelocityX = Main.rand.NextFloat(-maxSparkVelocityX, maxSparkVelocityX); - float sparkVelocityY = Main.rand.NextFloat(-maxSparkVelocityY, maxSparkVelocityY); - float randSparkSpeed = Main.rand.NextFloat(minSparkSpeed, maxSparkSpeed); - float sparkLength = (float)Math.Sqrt(sparkVelocityX * sparkVelocityX + sparkVelocityY * sparkVelocityY); - sparkLength = randSparkSpeed / sparkLength; - sparkVelocityX *= sparkLength; - sparkVelocityY *= sparkLength; - - Particle theSpark = new AltSparkParticle(projectile.Center, new Vector2(sparkVelocityX, sparkVelocityY), false, 40, 1f, new Color(255, 255, 100)); - GeneralParticleHandler.SpawnParticle(theSpark); - - return false; - } - else if (projectile.type == ProjectileID.AncientDoomProjectile) { if (projectile.velocity.Length() < 6f) @@ -2792,7 +2479,7 @@ namespace CalamityMod.Projectiles projectile.velocity *= scaleFactor2; // Fly away from other Ice Mists in Master - if (masterMode) + if (death) { float pushForce = 0.06f; float pushDistance = 120f; @@ -2821,7 +2508,7 @@ namespace CalamityMod.Projectiles } } - if (projectile.ai[0] % (masterMode ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) + if (projectile.ai[0] % (death ? 30f : 60f) == 0f && Main.netMode != NetmodeID.MultiplayerClient) { Vector2 vector50 = projectile.rotation.ToRotationVector2(); Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, vector50, projectile.type, projectile.damage, projectile.knockBack, projectile.owner); @@ -2973,7 +2660,7 @@ namespace CalamityMod.Projectiles return false; } - float velocityLimit = (death ? 28f : 24f) / MathHelper.Clamp(lineColor * 0.75f, 1f, 3f); + float velocityLimit = (death ? 28f : 24f) / MathHelper.Clamp(projectile.ai[2] * 0.75f, 1f, 3f); if (projectile.velocity.Length() < velocityLimit) projectile.velocity *= 1.01f; } @@ -3165,6 +2852,727 @@ namespace CalamityMod.Projectiles } #endregion + #region Fishing Minigames + // All these fields are exclusively used for fishing minigames, so I declared them in this region for organization + /// + /// Reel state of bobber.
+ /// ai[0] in bobber AI. + ///
+ private float isReelingIn = 0; + /// + /// How long you have to catch a fish when bitten.
+ /// ai[1] in bobber AI. + ///
+ private float CatchTime = 0; + /// + /// How long until a fish bites.
+ /// LocalAI[1] in bobber AI. + ///
+ private float TimerToCatch = 0; + /// Item ID of hooked item for fishing minigames. + public int CaughtItemID = -1; + /// What this does depends on the fishing minigame. Used to store data between updates. + public float PersistentFishingData = -1; + /// + public Vector2 PersistentFishingDataVector2 = Vector2.Zero; + public bool RunFishingMinigames(Projectile projectile) + { + var owner = Main.player[projectile.owner]; + var cplayer = owner.Calamity(); + + //Make sure Victide Snail actually fishes when using a minigame rod + foreach (var item in Main.ActiveProjectiles) + { + if (item.type == ModContent.ProjectileType() && item.owner == projectile.owner) + item.ModProjectile().PlayerFishingTimer = 600; + } + #region Utilities + void SmallSplashAtOffset(Vector2 offset) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + void SmallDustAtOffset(Vector2 offset, int dustID) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f) + offset, projectile.width + 12, 24, dustID); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + void Splash() + { + for (int i = 0; i < 100; i++) + { + int num = Dust.NewDust(new Vector2(projectile.position.X - 6f, projectile.position.Y - 10f), projectile.width + 12, 24, Dust.dustWater()); + Main.dust[num].velocity.Y -= 4f; + Main.dust[num].velocity.X *= 2.5f; + Main.dust[num].scale = 0.8f; + Main.dust[num].alpha = 100; + Main.dust[num].noGravity = true; + } + + SoundEngine.PlaySound(SoundID.SplashWeak, projectile.Center); + } + void ReelTheBobberChecks() + { + if (projectile.localAI[1] == 1) + { + if (Main.netMode != NetmodeID.MultiplayerClient) + { + NPC.SpawnOnPlayer(owner.whoAmI, 370); + } + projectile.ai[0] = 2f; + } + else if (projectile.localAI[1] < 1) + { + Point point = default(Point); + point = new Point((int)projectile.position.X, (int)projectile.position.Y); + int num = (int)(0f - projectile.localAI[1]); + if (num == 618) + { + point.Y += 64; + } + if (Main.netMode == NetmodeID.MultiplayerClient) + { + NetMessage.SendData(MessageID.FishOutNPC, -1, -1, null, point.X / 16, point.Y / 16, num); + } + else + { + if (num == 682) + { + NPC.unlockedSlimeRedSpawn = true; + } + NPC.NewNPC(new EntitySource_FishedOut(owner), point.X, point.Y, num); + projectile.ai[0] = 2f; + WorldGen.CheckAchievement_RealEstateAndTownSlimes(); + } + } + else if (Main.rand.NextBool(7) && !owner.accFishingLine) + { + projectile.ai[0] = 2f; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + } + else + { + projectile.ai[1] = projectile.localAI[1]; + } + projectile.netUpdate = true; + } + + Vector2 GetWaterLine() + { + Vector2 FoundWaterline = projectile.Center; + var tilePos = projectile.Center.ToTileCoordinates(); + if (Main.tile[tilePos.X, tilePos.Y].LiquidAmount > 0) + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y - i].LiquidAmount > 0) + continue; + FoundWaterline.Y = (tilePos.Y - i + 1) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y - i + 1].LiquidAmount / 255f) * 16f; + break; + } + } + else + { + for (var i = 0; i < 1000; i++) + { + if (i <= 0 || i >= Main.maxTilesY || Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount == 0) + continue; + FoundWaterline.Y = (tilePos.Y + i) * 16f; + FoundWaterline.Y += (1 - Main.tile[tilePos.X, tilePos.Y + i].LiquidAmount / 255f) * 16f; + break; + } + } + return FoundWaterline; + } + #endregion + //Doze's notes on bobber AI + + //ai[0] - Bobber state. 0: thrown/idle/bitten, 1: reeling in, 2: snapped + //ai[1] - Amount of time to reel in the bobber once a bite happens. Is negative and counts up + //When reeled in, this becomes the value of localAI[1] (ID of item/NPC) + //At 0, the bobber is just floating waiting for a bite + //localAI[1] - The timer for fish to try and bite the hook. When it exceeds 660, it resets to 0. + //If ai[1] is not 0, this is set to the item ID of the hooked item/NPC + //If hooking an NPC, this is set to the NPC ID but negative. Still need to find how this gets treated upon reeling in. + switch (owner.Calamity().SelectedFishingMinigame) + { + case CalamityPlayer.FishingMinigames.WulfrumRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (isReelingIn != projectile.ai[0]) + return false; + + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) + TimerToCatch++; + var speedup = Math.Min(owner.Calamity().consecutiveCaughtFish * 5, 25); + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 160 - owner.HeldItem.fishingPole; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + } + if (TimerToCatch >= 160 - owner.HeldItem.fishingPole && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 4); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedUp) + { + playerDir = 3; + } + if (owner.Calamity().pressedLeft) + { + playerDir = 2; + } + if (owner.Calamity().pressedDown) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.PiOver2) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + return false; + } + + + case CalamityPlayer.FishingMinigames.RiftReeler: + { + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + TimerToCatch = 300; + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] == 0) + { + owner.Calamity().ShouldHideControls = true; + if (owner.Calamity().pressedUp) + projectile.velocity.Y -= 0.125f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.125f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.125f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.125f; + } + projectile.velocity *= 0.975f; + + if (Waterline.Y <= projectile.Center.Y && projectile.ai[0] == 0 && !(projectile.lavaWet && !owner.accLavaFishing)) + { + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = projectile.Center + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 201)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount > 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Smoke); + if (Main.rand.NextBool(3)) + { + Dust.NewDustPerfect(PersistentFishingDataVector2, DustID.Torch); + } + var particle = new HeavySmokeParticle(PersistentFishingDataVector2, Vector2.One.RotatedByRandom(6.28) * Main.rand.NextFloat(1f, 4f), Color.Lerp(Color.DarkOrange, Color.DarkGray, Main.rand.NextFloat()), 15, 0.2f, 1); + GeneralParticleHandler.SpawnParticle(particle); + } + + //When in lava, give the bobber a particle over it to show its location + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.FeralDoubleRod: + if (projectile.ai[0] == 0) + { + if (projectile.wet) //Fishing in water + { + + projectile.extraUpdates = 0; + if (cplayer.mouseRight && projectile.ai[1] == 0) + { + projectile.localAI[1] += 2; + owner.lifeRegenCount -= 60; // -0.5 health per tick + } + } + else //Attached to an enemy + { + if (PersistentFishingData >= 0 && Main.npc[(int)PersistentFishingData].active && projectile.Distance(Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2) < 128) + { + projectile.Center = Main.npc[(int)PersistentFishingData].Center + PersistentFishingDataVector2; + projectile.velocity = Vector2.Zero; + if (cplayer.mouseRight && projectile.ai[1] == 0 && owner.miscCounter % 10 == 0) + { + owner.lifeRegenCount -= 600; // -5 health per 10 ticks + var projID = Projectile.NewProjectile(projectile.GetSource_FromThis(), Main.npc[(int)PersistentFishingData].Center, Vector2.Zero, ModContent.ProjectileType(), (int)owner.GetBestClassDamage().ApplyTo(owner.HeldItem.fishingPole + owner.fishingSkill + owner.ChooseAmmo(owner.HeldItem).bait), 0f, owner.whoAmI, Main.npc[(int)PersistentFishingData].whoAmI); + if (Main.projectile.IndexInRange(projID)) + { + Main.projectile[projID].ArmorPenetration = 100; //This should ignore almost all armor + } + } + projectile.timeLeft++; + + projectile.extraUpdates = 0; + return true; + } + else if (PersistentFishingData >= 0) + { + PersistentFishingData = -1; + projectile.velocity.Y -= 3; + } + foreach (var item in Main.ActiveNPCs) + { + if (item.friendly || item.dontTakeDamage) + continue; + if (projectile.Colliding(projectile.Hitbox, item.Hitbox)) + { + PersistentFishingDataVector2 = projectile.Center - item.Center; + PersistentFishingData = item.whoAmI; + break; + } + } + if (PersistentFishingData == -1) + projectile.extraUpdates = 1; + else + projectile.extraUpdates = 0; + + } + } + else if (projectile.ai[0] == 1) + projectile.extraUpdates = 3; + break; + + + case CalamityPlayer.FishingMinigames.NavyFishingRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (isReelingIn != projectile.ai[0]) + return false; + var waterline = GetWaterLine(); + var AdjustedOwnerWaterline = waterline; + if (AdjustedOwnerWaterline.Y < owner.Center.Y) + AdjustedOwnerWaterline.Y = owner.Center.Y; + if (AdjustedOwnerWaterline.Y >= projectile.Center.Y) + { + projectile.velocity.Y += 0.4f; + } + else + { + projectile.velocity.Y -= 0.1f; + } + projectile.velocity *= 0.975f; + if (CatchTime < 0) + CatchTime++; + if (projectile.wet || (projectile.lavaWet && owner.accLavaFishing) || projectile.honeyWet) + TimerToCatch++; + var speedup = 15; + var totalTime = 60 - speedup; + if (TimerToCatch + 90 >= 300 && CatchTime >= 0) + { + if (PersistentFishingData == 0) + PersistentFishingData = Main.rand.NextBool() ? 1 : -1; + var timer = TimerToCatch - 300; + SmallSplashAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0)); + + SmallDustAtOffset(new Vector2(200 * PersistentFishingData * (timer / 90f), 0), DustID.BlueCrystalShard); + } + if (TimerToCatch >= 300 && CatchTime >= 0) + { + PersistentFishingData = 0; + projectile.FishingCheck(); + if (projectile.ai[1] < 0) + { + CatchTime = -totalTime * 4; + CaughtItemID = (int)projectile.localAI[1]; + } + TimerToCatch = 0; + } + if (CatchTime < 0 && CatchTime % totalTime == 0) + { + Splash(); + PersistentFishingData = Main.rand.Next(0, 2); + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(PersistentFishingData * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 45 - speedup, 0.04f, Color.Blue, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + if (CatchTime < 0 && CatchTime % totalTime == -15) + { + var playerDir = -1; + if (owner.Calamity().pressedLeft) + { + playerDir = 1; + } + if (owner.Calamity().pressedRight) + { + playerDir = 0; + } + if (playerDir == PersistentFishingData) + { + + } + else + { + + if (playerDir >= 0) + { + var particle = new CustomSpark(projectile.Center, Vector2.UnitX.RotatedBy(playerDir * MathHelper.Pi) * 10, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 15, 0.04f, Color.Red, new(1, 2), shrinkSpeed: -0.2f); + GeneralParticleHandler.SpawnParticle(particle); + } + else + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 15, 0.06f, Color.Red, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + TimerToCatch = 0; + CatchTime = 0; + CaughtItemID = -1; + PersistentFishingData = 0; + owner.Calamity().consecutiveCaughtFish = 0; + } + } + if (CatchTime == -1) + { + projectile.localAI[1] = CaughtItemID; + ReelTheBobberChecks(); + owner.Calamity().consecutiveCaughtFish++; + if (projectile.ai[0] == 2) + return false; + isReelingIn = 1; + CatchTime = (float)CaughtItemID; + TimerToCatch = 0; + } + if (projectile.ai[0] == 0) + { + + + projectile.ai[1] = CatchTime; + projectile.localAI[1] = TimerToCatch; + if (CaughtItemID != -1 && isReelingIn == 0) + { + projectile.localAI[1] = 0; + projectile.ai[1] = 0; + } + projectile.ai[0] = isReelingIn; + } + if (projectile.ai[0] == 0) + return true; + break; + } + + + case CalamityPlayer.FishingMinigames.TheDevourerOfCods: + var fishToEat = TheDevourerofCods.FishToEat; + if (projectile.ai[1] < -1) + { + //Coonsuming a fish provides/increases the player's food buffs. + if (fishToEat.Contains((int)projectile.localAI[1])) + { + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + SoundEngine.PlaySound(SoundID.Item2, projectile.Center); + //If the player doesn't have Ex. Stuffed, either give them Plenty Satisfied or inrease existing Plenty Satisfied duration + if (!owner.HasBuff(BuffID.WellFed3)) + { + + if (owner.HasBuff(BuffID.WellFed2)) + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed2); + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) + { + owner.buffTime[bIndex] += 300; + } + } + else + { + + owner.AddBuff(BuffID.WellFed2, 300); + } + } + else //If the player DOES have Ex. Stuffed, increase the duration of it + { + var bIndex = owner.FindBuffIndex(BuffID.WellFed3); + if (owner.buffTime[bIndex] < CalamityUtils.MinutesToFrames(24)) //Requires fishing once per day if you'd like to keep free ExStuffed forever + { + owner.buffTime[bIndex] += 300; + } + } + } + else //If the hooked item isn't consumable, make it stay hooked forever. + { + projectile.ai[1] = -30; + } + } + + return false; + + + case CalamityPlayer.FishingMinigames.HeronRod: + { + if (CatchTime < 0 || (isReelingIn == 1 && CaughtItemID > 0)) + { + owner.Calamity().ShouldHideControls = true; + } + if (PersistentFishingData == -1) + { + PersistentFishingData = 1; + TimerToCatch = 300; + } + var Waterline = GetWaterLine(); + if (Waterline.Y >= projectile.Center.Y) + { + projectile.velocity.Y += 0.4f; + } + else if (projectile.ai[0] <= 0) + { + projectile.velocity.Y -= 0.1f; + } + if (projectile.ai[0] <= 1) + { + owner.Calamity().ShouldHideControls = true; + } + projectile.velocity *= 0.975f; + if (projectile.wet) + projectile.velocity *= 0.99f; + + //When in lava, give the bobber a particle over it to show its location + if (projectile.lavaWet) + { + var particle = new CustomSpark(projectile.Center, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 2, 0.01f, Color.DarkGray, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + if (projectile.ai[0] == 0) + { + + if (owner.Calamity().pressedUp && projectile.velocity.Y < 0) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedUp && Waterline.Y < projectile.Center.Y) + projectile.velocity.Y -= 0.3f; + if (owner.Calamity().pressedDown) + projectile.velocity.Y += 0.25f; + if (owner.Calamity().pressedLeft) + projectile.velocity.X -= 0.25f; + if (owner.Calamity().pressedRight) + projectile.velocity.X += 0.25f; + if (Waterline.Y <= projectile.Center.Y - 8) + TimerToCatch -= Main.rand.Next(1, 5); + if (TimerToCatch <= 0) + { + projectile.FishingCheck(); + if (projectile.ai[1] < 0 && !(projectile.lavaWet && !owner.accLavaFishing)) + { + + CaughtItemID = (int)projectile.localAI[1]; + projectile.ai[1] = 0; + projectile.localAI[1] = 0; + for (var i = 0; i < 1000; i++) + { + var vectorToCheck = Waterline + new Vector2(Main.rand.Next(-200, 201), Main.rand.Next(-200, 32)); + var tileCoordsToCheck = vectorToCheck.ToSafeTileCoordinates(); + if (new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight).Contains((int)vectorToCheck.X, (int)vectorToCheck.Y) && !Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].IsTileSolid() && Main.tile[tileCoordsToCheck.X, tileCoordsToCheck.Y].LiquidAmount == 0) + { + if (projectile.localAI[2] >= 1) + { + int customSonarText = (int)(projectile.localAI[2] - 1); + if (Main.popupText[customSonarText].sonar) + { + Main.popupText[customSonarText].position = vectorToCheck - FontAssets.MouseText.Value.MeasureString(Main.popupText[customSonarText].name) / 2f; + } + } + PersistentFishingDataVector2 = vectorToCheck; + TimerToCatch = 600; + break; + } + } + } + } + if (PersistentFishingDataVector2 != Vector2.Zero && owner.miscCounter % 15 == 0) + { + + var particle = new CustomSpark(PersistentFishingDataVector2, Vector2.Zero, "CalamityMod/Particles/HighResHollowCircleHardEdge", false, 25, 0.02f, Color.Green, Vector2.One); + GeneralParticleHandler.SpawnParticle(particle); + } + List<(Vector2, int)> validRifts = new(); + + foreach (var item in Main.ActiveProjectiles) + { + if (item.bobber && projectile.type != ModContent.ProjectileType() && item.owner == projectile.owner && item.ai[0] == 0 && item.Calamity().PersistentFishingDataVector2 != Vector2.Zero) + { + validRifts.Add((item.Calamity().PersistentFishingDataVector2, item.whoAmI)); + } + } + foreach (var item in validRifts) + { + if (projectile.Distance(item.Item1) < 16) + { + projectile.localAI[1] = Main.projectile[item.Item2].Calamity().CaughtItemID; + projectile.ai[0] = -1; + Main.projectile[item.Item2].Calamity().PersistentFishingDataVector2 = PersistentFishingDataVector2; + Main.projectile[item.Item2].Calamity().CaughtItemID = CaughtItemID; + break; + } + + } + } + if (projectile.ai[0] == -1 && (Waterline.Y <= projectile.Center.Y || projectile.velocity.Length() < 0.5f)) + { + ReelTheBobberChecks(); + if (projectile.ai[0] < 2) + projectile.ai[0] = 1; + } + if (projectile.ai[0] == 0) + return true; + break; + } + + } + return false; + } + #endregion + #region AI public override void AI(Projectile projectile) { @@ -3179,97 +3587,6 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.Nail && Main.expertMode) projectile.damage /= 2; - // Nerf all these Master Mode enemy projectiles - if (Main.masterMode && !CalamityPlayer.areThereAnyDamnBosses) - { - switch (projectile.type) - { - case ProjectileID.DemonSickle: - case ProjectileID.HarpyFeather: - case ProjectileID.JavelinHostile: - case ProjectileID.SalamanderSpit: - case ProjectileID.SkeletonBone: - case ProjectileID.IceSpike: - case ProjectileID.JungleSpike: - case ProjectileID.PinkLaser: - case ProjectileID.FrostBlastHostile: - case ProjectileID.GoldenShowerHostile: - case ProjectileID.RainNimbus: - case ProjectileID.FlamingArrow: - case ProjectileID.BulletDeadeye: - case ProjectileID.CannonballHostile: - case ProjectileID.UnholyTridentHostile: - case ProjectileID.FrostBeam: - case ProjectileID.CursedFlameHostile: - case ProjectileID.Stinger: - case ProjectileID.BloodNautilusTears: - case ProjectileID.RockGolemRock: - case ProjectileID.IcewaterSpit: - case ProjectileID.RocketSkeleton: - case ProjectileID.SniperBullet: - case ProjectileID.DrManFlyFlask: - case ProjectileID.DesertDjinnCurse: - case ProjectileID.InfernoHostileBlast: - case ProjectileID.InfernoHostileBolt: - case ProjectileID.Shadowflames: - case ProjectileID.ShadowBeamHostile: - case ProjectileID.PaladinsHammerHostile: - case ProjectileID.LostSoulHostile: - case ProjectileID.RuneBlast: - case ProjectileID.DandelionSeed: - case ProjectileID.SandnadoHostile: - case ProjectileID.SandnadoHostileMark: - case ProjectileID.SnowBallHostile: - case ProjectileID.EyeLaser: - case ProjectileID.Nail: - case ProjectileID.BrainScramblerBolt: - case ProjectileID.GigaZapperSpear: - case ProjectileID.MartianWalkerLaser: - case ProjectileID.RayGunnerLaser: - case ProjectileID.MartianTurretBolt: - case ProjectileID.NebulaSphere: - case ProjectileID.NebulaLaser: - case ProjectileID.NebulaBolt: - case ProjectileID.StardustJellyfishSmall: - case ProjectileID.StardustSoldierLaser: - case ProjectileID.Twinkle: - case ProjectileID.VortexAcid: - case ProjectileID.VortexLaser: - case ProjectileID.VortexLightning: - case ProjectileID.VortexVortexLightning: - case ProjectileID.FlamingWood: - case ProjectileID.GreekFire1: - case ProjectileID.GreekFire2: - case ProjectileID.GreekFire3: - case ProjectileID.FlamingScythe: - case ProjectileID.OrnamentHostile: - case ProjectileID.OrnamentHostileShrapnel: - case ProjectileID.PineNeedleHostile: - case ProjectileID.FrostShard: - case ProjectileID.FrostWave: - case ProjectileID.Missile: - case ProjectileID.Present: - case ProjectileID.Spike: - case ProjectileID.SaucerDeathray: - case ProjectileID.SaucerLaser: - case ProjectileID.SaucerMissile: - case ProjectileID.SaucerScrap: - case ProjectileID.DD2GoblinBomb: - case ProjectileID.DD2JavelinHostile: - case ProjectileID.DD2JavelinHostileT3: - case ProjectileID.DD2DarkMageBolt: - case ProjectileID.DD2DrakinShot: - case ProjectileID.DD2OgreSmash: - case ProjectileID.DD2OgreSpit: - case ProjectileID.DD2OgreStomp: - case ProjectileID.DD2LightningBugZap: - case ProjectileID.DD2BetsyFireball: - case ProjectileID.DD2BetsyFlameBreath: - projectile.damage = (int)Math.Round(projectile.damage * CalamityGlobalNPC.MasterModeEnemyDamageMultiplier); - break; - } - } - // Nerf several Hardmode enemy projectiles because they deal way too much damage if (!CalamityPlayer.areThereAnyDamnBosses) { @@ -3287,6 +3604,8 @@ namespace CalamityMod.Projectiles case ProjectileID.FrostBeam: case ProjectileID.CursedFlameHostile: case ProjectileID.Stinger: + case ProjectileID.BloodShot: + case ProjectileID.BloodNautilusShot: case ProjectileID.BloodNautilusTears: case ProjectileID.RockGolemRock: case ProjectileID.IcewaterSpit: @@ -3319,22 +3638,19 @@ namespace CalamityMod.Projectiles if (NPC.downedMoonlord) { - if (BuffedDungeonProjectilesList.Includes(projectile.type)) + if (CalamityProjectileSets.IsBuffedDungeonProjectile[projectile.type]) { // ai[1] being set to 1 is done only by the Calamity usages of these projectiles in Skeletron and Skeletron Prime boss fights bool isSkeletronBossProjectile = (projectile.type == ProjectileID.RocketSkeleton || projectile.type == ProjectileID.Shadowflames) && projectile.ai[1] > 0f; - // These projectiles will not be buffed if Golem fires them - bool isGolemBossProjectile = (projectile.type == ProjectileID.InfernoHostileBolt || projectile.type == ProjectileID.InfernoHostileBlast) && projectile.ai[2] > 0f; - - if (!isSkeletronBossProjectile && !isGolemBossProjectile) + if (!isSkeletronBossProjectile) projectile.damage += 30; } } if (DownedBossSystem.downedDoG && (Main.pumpkinMoon || Main.snowMoon || Main.eclipse)) { - if (EventProjectileBuffList.Includes(projectile.type)) + if (CalamityProjectileSets.IsBuffedEventProjectile[projectile.type]) projectile.damage += 15; } @@ -3398,6 +3714,18 @@ namespace CalamityMod.Projectiles break; } + // Makes flares from Firestorm Cannon ignore gravity + // Spectralstorm Cannon uses a custom flare projectile + if (projectile.aiStyle == ProjAIStyleID.Flare && projectile.ai[2] == 1f && projectile.localAI[0] == 0f) + projectile.localAI[1]--; + + // Hack to allow Desert Tiger minion to fall through platforms while attacking + if (projectile.type >= ProjectileID.StormTigerTier1 && projectile.type <= ProjectileID.StormTigerTier3) + { + if (projectile.ai[0] == 5f) + projectile.tileCollide = false; + } + // Jack O Lantern Launcher projectile tweak if (projectile.type == ProjectileID.JackOLantern) { @@ -3410,6 +3738,7 @@ namespace CalamityMod.Projectiles } } + #region Flail Extendo Hacks // Very hacky solution for making Dao of Pow's flail throw travel farther and faster if (projectile.type == ProjectileID.TheDaoofPow) { @@ -3440,6 +3769,22 @@ namespace CalamityMod.Projectiles } } } + // And Flower Pow! + if (projectile.type == ProjectileID.FlowerPow) + { + if (projectile.ai[0] == 1f) + { + if (projectile.ai[1] > 0f) + { + projectile.ai[2]++; + if (projectile.ai[2] <= 5f) // When ai[1] reaches 12, it starts returning, so this makes it take an extra 5 frames to return + projectile.ai[1]--; + } + else + projectile.velocity *= 1.33f; + } + } + #endregion // Starfury stars never collide with tiles if (projectile.type == ProjectileID.Starfury) @@ -3465,18 +3810,30 @@ namespace CalamityMod.Projectiles projectile.ai[0]--; // Acceleration for certain lasers - if ((projectile.type == ProjectileID.EyeLaser || projectile.type == ProjectileID.DeathLaser || projectile.type == ProjectileID.FrostBeam) && projectile.ai[0] == 1f) + if ((projectile.type == ProjectileID.EyeLaser || projectile.type == ProjectileID.DeathLaser) && projectile.ai[0] == 1f) { if (projectile.velocity.Length() < AcceleratingBossLaserVelocityCap) projectile.velocity *= 1.0025f; } + // Sharknado is more translucent before dealing damage + if (projectile.type == ProjectileID.Sharknado) + { + if (projectile.timeLeft > FishronCthulhunadoTotalDuration - FishronTornadoTimeBeforeDealingDamage) + { + if (projectile.alpha < 200) + projectile.alpha = 200; + if (projectile.alpha > 220) + projectile.alpha = 220; + } + } + // Accelerate for 1.5 seconds to full velocity if (projectile.type == ProjectileID.HallowBossLastingRainbow && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { int spreadOutTime = 90; if (projectile.timeLeft > EmpressLastingRainbowTotalDuration - spreadOutTime) - projectile.velocity *= ((Main.masterMode || BossRushEvent.BossRushActive) ? 1.017078f : 1.015525f); + projectile.velocity *= 1.015525f; } // Zapinator lasers cannot trigger their damage multiplier more than once @@ -3561,36 +3918,6 @@ namespace CalamityMod.Projectiles } } - if (projectile.type == ProjectileID.OrnamentFriendly && lineColor == 1) //spawned by Festive Wings - { - Vector2 center = projectile.Center; - float maxDistance = 460f; - bool homeIn = false; - - foreach (NPC n in Main.ActiveNPCs) - { - if (n.CanBeChasedBy(projectile, false)) - { - float extraDistance = (float)(n.width / 2) + (n.height / 2); - - bool canHit = Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1); - - if (Vector2.Distance(n.Center, projectile.Center) < (maxDistance + extraDistance) && canHit) - { - center = n.Center; - homeIn = true; - break; - } - } - } - - if (homeIn) - { - Vector2 moveDirection = projectile.SafeDirectionTo(center, Vector2.UnitY); - projectile.velocity = (projectile.velocity * 20f + moveDirection * 15f) / 21f; - } - } - if (!projectile.npcProj && !projectile.trap && projectile.friendly && projectile.damage > 0) { if (modPlayer.fungalSymbiote && player.HasBuff(BuffType())) @@ -3676,18 +4003,14 @@ namespace CalamityMod.Projectiles { if (Main.player[projectile.owner].miscCounter % 30 == 0 && projectile.FinalExtraUpdate()) { - if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < 15) + if (projectile.owner == Main.myPlayer && player.ownedProjectileCounts[ProjectileID.CrystalShard] < DaedalusHeadRogue.ShardCountLimit) { - // Daedalus Rogue Crystals: 2 x 25%, soft cap starts at 120 base damage - int crystalDamage = CalamityUtils.DamageSoftCap(projectile.damage * 0.25, 30); + int crystalDamage = CalamityUtils.DamageSoftCap(projectile.damage * DaedalusHeadRogue.ShardDamageRatio, DaedalusHeadRogue.ShardDamageSoftcap); - for (int i = 0; i < 2; i++) - { - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int shard = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileID.CrystalShard, crystalDamage, 0f, projectile.owner); - if (shard.WithinBounds(Main.maxProjectiles)) - Main.projectile[shard].DamageType = DamageClass.Generic; - } + Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); + int shard = Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, velocity, ProjectileID.CrystalShard, crystalDamage, 0f, projectile.owner); + if (shard.WithinBounds(Main.maxProjectiles)) + Main.projectile[shard].DamageType = DamageClass.Generic; } } } @@ -3837,17 +4160,17 @@ namespace CalamityMod.Projectiles confetti.velocity.Y += Main.rand.Next(-50, 51) * 0.05f; } } - // Support to help things like holdout swords work with Arc Flash Ring - if (!spawnArcFlash && projectile.numHits == 0) - spawnArcFlash = true; + // Support to help things like holdout swords look better with Arc Flash Ring + if (!showArcFlash && projectile.numHits == 0) + showArcFlash = true; // Cooldown for the arc flash so that long lasting projectiles (like dashing summons) can spawn multiple bolts if (arcFlashCooldown >= 0) arcFlashCooldown--; if (arcFlashCooldown == 0) - spawnArcFlash = true; + showArcFlash = true; if (conditionalHomingRange > 0f) { - CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 12f, 20f); + CalamityUtils.HomeInOnNPC(projectile, !projectile.tileCollide, conditionalHomingRange, 12f, 20f,true); } if (brimstoneBullets) { @@ -4009,28 +4332,27 @@ namespace CalamityMod.Projectiles if (flatDRTimer <= 0) flatDR = 0; } + if (projectile.FinalExtraUpdate() && multiplicativeDRTimer > 0) + { + multiplicativeDRTimer--; + if (multiplicativeDRTimer <= 0) + multiplicativeDR = 0; + } if (projectile.FinalExtraUpdate() && TransformerTimer > 0) { TransformerTimer--; } // Spawn Bloom Stone flower on landed hooks - // Should only spawn if: Projectile is a hook, hook is grappled to a tile, the player is wearing Bloom Stone, no flower has been spawned from this hook, no pollen exists + // Should only spawn if: Projectile is a hook, hook is grappled to a tile, the player is wearing Bloom Stone, no flower has been spawned from this hook if (projectile.aiStyle == ProjAIStyleID.Hook && projectile.ai[0] == 2f && - Main.player[projectile.owner].Calamity().bloomStone && !hookCanSpawnFlower && - !CalamityUtils.AnyOwnedProjectiles(ProjectileType(), projectile.owner)) + Main.player[projectile.owner].Calamity().bloomStone && !hookCanSpawnFlower) { hookCanSpawnFlower = true; if (Main.myPlayer == projectile.owner) Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileType(), 0, 0f, projectile.owner, projectile.whoAmI); } - // CIT 29JUN2024: Moved from PreAI to PostAI so that it is called every update instead of every frame. - // This makes the distance traveled increment more accurately for projectiles with extra updates, as previously projectiles with extra updates - // would add the distance traveled for the whole frame on the first update, making the distance checking much choppier. - if (pointBlankShotDistanceTravelled < PointBlankShotDistanceLimit) - pointBlankShotDistanceTravelled += projectile.velocity.Length(); - // optimization to remove conversion X/Y loop for irrelevant projectiles bool isConversionProjectile = projectile.type == ProjectileID.PurificationPowder || projectile.type == ProjectileID.VilePowder @@ -4111,31 +4433,46 @@ namespace CalamityMod.Projectiles { if (player.Calamity().bloomStoneHookVisuals) { - // Insert vine effect when spawning a hook + for (int i = 0; i < 8; i++) + { + Particle floweyFromHitGameUndertale = new CustomSpark(player.Center, Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f), + "CalamityMod/Particles/MiniFlower", false, Main.rand.Next(65, 78 + 1), Main.rand.NextFloat(1.8f, 2.8f), + Color.Lerp(Color.HotPink, Color.Plum, Main.rand.NextFloat(0, 0.65f)), new Vector2(1f, 1f), true, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi)); + GeneralParticleHandler.SpawnParticle(floweyFromHitGameUndertale); + + Dust pollenDust = Dust.NewDustPerfect(player.Center, DustType()); + pollenDust.noLightEmittence = true; + pollenDust.noGravity = true; + pollenDust.scale = Main.rand.NextFloat(0.9f, 1.4f); + pollenDust.color = Main.rand.NextBool() ? Color.Gold : Color.HotPink; + pollenDust.velocity = Utils.DirectionTo(player.Center, player.Calamity().mouseWorld).RotatedByRandom(0.6f) * Main.rand.NextFloat(4f, 11f); + pollenDust.fadeIn = -0.5f; + } } } public override void GrapplePullSpeed(Projectile projectile, Player player, ref float speed) { float mult = 1f; if (player.Calamity().reaverSpeed) - mult += 0.5f; + mult += ReaverHeadMobility.SetBonusHookBoost; + if (player.Calamity().tungstenArmorHookBoost) + mult += TungstenArmorSetChange.HookBoost; if (player.Calamity().bloomStone) mult += 0.5f; speed *= mult; - // Visual flowers while being pulled - if (player.Calamity().bloomStoneHookVisuals && player.miscCounter % 5 == 0 && player.velocity.Length() > 2f) + if (player.velocity.Length() > 2f) { - Vector2 spawnPos = player.Center + Main.rand.NextVector2Circular(20f, 20f); - CustomSprite flowey = new(spawnPos, Vector2.Zero, 12, "CalamityMod/Projectiles/Magic/GleamingBolt", 0.425f, Color.White * 0.75f, 0f, false); - GeneralParticleHandler.SpawnParticle(flowey); + player.Calamity().hookPullVisuals = 60; } } public override void GrappleRetreatSpeed(Projectile projectile, Player player, ref float speed) { float mult = 1f; if (player.Calamity().reaverSpeed) - mult += 0.5f; + mult += ReaverHeadMobility.SetBonusHookBoost; + if (player.Calamity().tungstenArmorHookBoost) + mult += TungstenArmorSetChange.HookBoost; if (player.Calamity().bloomStone) mult += 0.5f; speed *= mult; @@ -4170,10 +4507,11 @@ namespace CalamityMod.Projectiles projectile.damage = 1; } - // Heat Ray damage falloff - if (projectile.type == ProjectileID.HeatRay && projectile.numHits > 0) + // Super Star Shooter has damage falloff + if (projectile.type == ProjectileID.SuperStar) { - projectile.damage = (int)(projectile.damage * 0.9f); + if (projectile.numHits > 0) + projectile.damage = (int)(projectile.damage * 0.95f); if (projectile.damage < 1) projectile.damage = 1; } @@ -4195,7 +4533,9 @@ namespace CalamityMod.Projectiles else if (modPlayer.vampiricTalisman && projectile.Calamity().stealthStrike) { target.AddBuff(BuffType(), VampiricTalisman.ArmorCrunchDebuffTime); - target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); + + if (!modPlayer.nanotech) + target.AddBuff(BuffType(), VampiricTalisman.HeavyBleedingDebuffTime); } if (modPlayer.flamingItemEnchant && !projectile.minion && !projectile.npcProj && !projectile.Calamity().CreatedByPlayerDash) @@ -4263,6 +4603,7 @@ namespace CalamityMod.Projectiles public override void ModifyHitPlayer(Projectile projectile, Player target, ref Player.HurtModifiers modifiers) { modifiers.FinalDamage.Flat -= flatDR; + modifiers.FinalDamage *= 1f - multiplicativeDR; } #endregion @@ -4271,7 +4612,13 @@ namespace CalamityMod.Projectiles { if (BloodstoneOrbValue > 0) Projectile.NewProjectile(projectile.GetSource_OnHit(target), projectile.Center, projectile.velocity.SafeNormalize(Vector2.Zero) * Math.Min(((projectile.velocity.Length() * projectile.MaxUpdates) / 4f), 4f) * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), BloodstoneOrbValue, 0f, Main.player[projectile.owner].whoAmI); - + //Mana Burn + if (Main.player[projectile.owner].statMana < 0) + { + float burnRatio = (-Main.player[projectile.owner].statMana / 5000f); // -400 mana = +8% dmg, -700 mana = +14% dmg + target.Calamity().manaBurn += damageDone * burnRatio; + target.Calamity().playerManaBurnIntensity = -Main.player[projectile.owner].statMana / (float)Main.player[projectile.owner].statManaMax2; + } // Hyperius Overflow if (projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && projectile.type != ProjectileType() && target.Calamity().hyperiusMarked) { @@ -4297,18 +4644,15 @@ namespace CalamityMod.Projectiles // Implementation of shared static iframes. // If this projectile does not use static iframes, or is not registered to share them, then do nothing. - if (!projectile.usesIDStaticNPCImmunity || !SharedStaticIFrames.Includes(projectile.type)) - return; - - // Get the set of shared static iframe projectile types. - // If it's empty, then do nothing. - IList sharedWithProjectiles = SharedStaticIFrames.GetSharedStaticIFrames(projectile.type); - if (sharedWithProjectiles.Count <= 0) + if (!projectile.usesIDStaticNPCImmunity || CalamityProjectileSets.SharedIDStaticIFrames[projectile.type] == -1) return; // Apply the appropriate shared static iframes to all projectile types with which it is shared. - foreach (int projType in sharedWithProjectiles) - Projectile.perIDStaticNPCImmunity[projType][target.whoAmI] = Main.GameUpdateCount + (uint)projectile.idStaticNPCHitCooldown; + for (int proj = 0; proj < CalamityProjectileSets.SharedIDStaticIFrames.Length; proj++) + { + if (CalamityProjectileSets.SharedIDStaticIFrames[proj] == CalamityProjectileSets.SharedIDStaticIFrames[projectile.type]) + Projectile.perIDStaticNPCImmunity[proj][target.whoAmI] = Main.GameUpdateCount + (uint)projectile.idStaticNPCHitCooldown; + } } #endregion @@ -4318,7 +4662,6 @@ namespace CalamityMod.Projectiles if (projectile.hostile && (projectile.damage - flatDR <= 0)) return false; - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; switch (projectile.type) @@ -4327,8 +4670,8 @@ namespace CalamityMod.Projectiles case ProjectileID.DeerclopsIceSpike: if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { - float fadeInTime = 50f; - float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; + float fadeInTime = 25f; + float fadeOutGateValue = death ? 90f : 65f; return (projectile.ai[0] >= fadeInTime && projectile.ai[0] < fadeOutGateValue); } break; @@ -4339,9 +4682,9 @@ namespace CalamityMod.Projectiles return projectile.ai[0] > projectile.ai[2]; break; - // Additional slams in the Master Mode shockwave have a delay before expanding and dealing damage + // Additional slams in the Death Mode shockwave have a delay before expanding and dealing damage case ProjectileID.QueenSlimeSmash: - if (masterMode) + if (death) return projectile.ai[0] > 0f; break; @@ -4408,7 +4751,7 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.Skull && (projectile.ai[0] == -1f || projectile.ai[0] == -3f)) { - float homingTime = ((Main.masterMode || BossRushEvent.BossRushActive) ? 120f : CalamityWorld.death ? 105f : 90f); + float homingTime = CalamityWorld.death ? 105f : 90f; if (projectile.ai[0] == -3f) homingTime += 60f; @@ -4502,7 +4845,6 @@ namespace CalamityMod.Projectiles if (projectile.type == ProjectileID.DeerclopsIceSpike && (CalamityWorld.revenge || BossRushEvent.BossRushActive)) { - bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; bool death = CalamityWorld.death || BossRushEvent.BossRushActive; Texture2D texture = TextureAssets.Projectile[projectile.type].Value; @@ -4510,8 +4852,8 @@ namespace CalamityMod.Projectiles Vector2 origin12 = new Vector2(16f, value26.Height / 2); Color alpha5 = projectile.GetAlpha(lightColor); Vector2 vector39 = new Vector2(projectile.scale); - float fadeOutGateValue = masterMode ? 120f : death ? 90f : 65f; - float killGateValue = masterMode ? 130f : death ? 100f : 75f; + float fadeOutGateValue = death ? 90f : 65f; + float killGateValue = death ? 100f : 75f; float lerpValue5 = Utils.GetLerpValue(killGateValue, killGateValue - 50f, projectile.ai[0], clamped: true); vector39.Y *= lerpValue5; Vector4 vector40 = lightColor.ToVector4(); @@ -4578,13 +4920,6 @@ namespace CalamityMod.Projectiles shouldDrawBool = false; } - // Chlorophyte Crystal AI rework. - if (projectile.type == ProjectileID.CrystalLeaf) - { - ChlorophyteCrystalAI.DoChlorophyteCrystalDrawing(projectile); - shouldDrawBool = false; - } - if (Main.LocalPlayer.Calamity().trippy) OddMushroomProjectileDrawing(projectile); @@ -4734,9 +5069,7 @@ namespace CalamityMod.Projectiles #region Pre Kill public override bool PreKill(Projectile projectile, int timeLeft) { - bool masterRevSkeletronPrimeBomb = projectile.type == ProjectileID.BombSkeletronPrime && projectile.ai[0] < 0f && (Main.masterMode || BossRushEvent.BossRushActive); bool revQueenBeeBeeHive = projectile.type == ProjectileID.BeeHive && (CalamityWorld.revenge || BossRushEvent.BossRushActive) && (projectile.ai[2] == 1f || CalamityWorld.death); - bool revGolemInferno = projectile.type == ProjectileID.InfernoHostileBolt && projectile.ai[2] > 0f; if (revQueenBeeBeeHive) { @@ -4756,102 +5089,13 @@ namespace CalamityMod.Projectiles if (projectile.owner == Main.myPlayer) { - if (masterRevSkeletronPrimeBomb) - { - SoundEngine.PlaySound(SoundID.Item14, projectile.Center); - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.width = projectile.height = 22; - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - - for (int num951 = 0; num951 < 20; num951++) - { - int num952 = Dust.NewDust(projectile.position, projectile.width, projectile.height, DustID.Smoke, 0f, 0f, 100, default(Color), 1.5f); - Dust dust2 = Main.dust[num952]; - dust2.velocity *= 1.4f; - } - - int num950 = 6; - for (int num953 = 0; num953 < 10; num953++) - { - int num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 2.5f); - Main.dust[num954].noGravity = true; - Dust dust2 = Main.dust[num954]; - dust2.velocity *= 5f; - num954 = Dust.NewDust(projectile.position, projectile.width, projectile.height, num950, 0f, 0f, 100, default(Color), 1.5f); - dust2 = Main.dust[num954]; - dust2.velocity *= 3f; - } - - int num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); - Gore gore2 = Main.gore[num955]; - gore2.velocity *= 0.4f; - Main.gore[num955].velocity.X += 1f; - Main.gore[num955].velocity.Y += 1f; - num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num955]; - gore2.velocity *= 0.4f; - Main.gore[num955].velocity.X -= 1f; - Main.gore[num955].velocity.Y += 1f; - num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num955]; - gore2.velocity *= 0.4f; - Main.gore[num955].velocity.X += 1f; - Main.gore[num955].velocity.Y -= 1f; - num955 = Gore.NewGore(projectile.GetSource_FromAI(), projectile.position, default(Vector2), Main.rand.Next(61, 64)); - gore2 = Main.gore[num955]; - gore2.velocity *= 0.4f; - Main.gore[num955].velocity.X -= 1f; - Main.gore[num955].velocity.Y -= 1f; - - Vector2 vector76 = projectile.position; - projectile.position.X += projectile.width / 2; - projectile.position.Y += projectile.height / 2; - projectile.width = projectile.height = 128; - projectile.position.X -= projectile.width / 2; - projectile.position.Y -= projectile.height / 2; - projectile.Damage(); - projectile.position = vector76; - projectile.width = projectile.height = 22; - - if (Main.getGoodWorld && !Main.remixWorld) - { - int num1011 = 4; - Vector2 center3 = projectile.position; - int num1012 = num1011; - int num1013 = num1011; - int num1014 = (int)(center3.X / 16f - (float)num1012); - int num1015 = (int)(center3.X / 16f + (float)num1012); - int num1016 = (int)(center3.Y / 16f - (float)num1013); - int num1017 = (int)(center3.Y / 16f + (float)num1013); - if (num1014 < 0) - num1014 = 0; - - if (num1015 > Main.maxTilesX) - num1015 = Main.maxTilesX; - - if (num1016 < 0) - num1016 = 0; - - if (num1017 > Main.maxTilesY) - num1017 = Main.maxTilesY; - - bool wallSplode2 = projectile.ShouldWallExplode(center3, num1011, num1014, num1015, num1016, num1017); - projectile.ExplodeTiles(center3, num1011, num1014, num1015, num1016, num1017, wallSplode2); - } - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); - } - - else if (revQueenBeeBeeHive) + if (revQueenBeeBeeHive) { if (Main.netMode != NetmodeID.MultiplayerClient) { int beeAmt = Main.rand.Next(2, 5 + 1); int totalBeesAlive = NPC.CountNPCS(NPCID.Bee) + NPC.CountNPCS(NPCID.BeeSmall); - int finalBeeAmtToSpawn = NPC.AnyNPCs(NPCID.QueenBee) ? Math.Min(beeAmt, (Main.masterMode ? 9 : 15) - totalBeesAlive) : NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); + int finalBeeAmtToSpawn = NPC.AnyNPCs(NPCID.QueenBee) ? Math.Min(beeAmt, (CalamityWorld.death ? 9 : 15) - totalBeesAlive) : NPC.GetAvailableAmountOfNPCsToSpawnUpToSlot(beeAmt); for (int i = 0; i < finalBeeAmtToSpawn; i++) { int beeType = Main.rand.NextBool() ? NPCID.Bee : NPCID.BeeSmall; @@ -4859,7 +5103,7 @@ namespace CalamityMod.Projectiles { beeType = Main.rand.NextBool(3) ? NPCType() : NPCType(); } - else if (Main.masterMode || BossRushEvent.BossRushActive) + else if (CalamityWorld.death || BossRushEvent.BossRushActive) { switch (Main.rand.Next(12)) { @@ -4901,17 +5145,9 @@ namespace CalamityMod.Projectiles if (Main.netMode != NetmodeID.SinglePlayer) NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); } - - else if (revGolemInferno) - { - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ProjectileID.InfernoHostileBlast, projectile.damage, projectile.knockBack, projectile.owner, 0f, 0f, projectile.ai[2]); - - if (Main.netMode != NetmodeID.SinglePlayer) - NetMessage.SendData(MessageID.KillProjectile, -1, -1, null, projectile.identity, projectile.owner); - } } - if (masterRevSkeletronPrimeBomb || revQueenBeeBeeHive || revGolemInferno) + if (revQueenBeeBeeHive) { projectile.active = false; return false; @@ -4972,34 +5208,5 @@ namespace CalamityMod.Projectiles } } #endregion - - #region Life Steal - public static bool CanSpawnLifeStealProjectile(double healMultiplier, float healAmount) => healMultiplier > 0D && (int)healAmount > 0; - - public static void SpawnLifeStealProjectile(Projectile projectile, Player player, float healAmount, int healProjectileType, float distanceRequired, float cooldownMultiplier = 1f) - { - if (Main.LocalPlayer.moonLeech) - return; - - Main.LocalPlayer.lifeSteal -= healAmount * cooldownMultiplier; - - float lowestHealthCheck = 0f; - int healTarget = projectile.owner; - foreach (Player otherPlayer in Main.ActivePlayers) - { - if (!otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) - { - float playerDist = Vector2.Distance(projectile.Center, otherPlayer.Center); - if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) - { - lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; - healTarget = otherPlayer.whoAmI; - } - } - } - - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, healProjectileType, 0, 0f, projectile.owner, healTarget, healAmount); - } - #endregion } } diff --git a/Projectiles/CalamityGlobalProjectileTweaks.cs b/Projectiles/CalamityGlobalProjectileTweaks.cs index 76a983fc1c..e190ebfb24 100644 --- a/Projectiles/CalamityGlobalProjectileTweaks.cs +++ b/Projectiles/CalamityGlobalProjectileTweaks.cs @@ -18,8 +18,8 @@ namespace CalamityMod.Projectiles IProjectileTweak[] defenseDamage = Do(DefenseDamage); IProjectileTweak[] trueMelee = Do(TrueMelee, DefaultIDStaticIFrames); // All the tweaked true melee projectiles need to be changed from global to static as well IProjectileTweak[] trueMeleeNoSpeed = Do(TrueMeleeNoSpeed, DefaultIDStaticIFrames); - IProjectileTweak[] pointBlank = Do(PointBlank); - IProjectileTweak[] standardBulletTweaks = Do(PointBlank, ExtraUpdatesDelta(+2)); + IProjectileTweak[] defaultIFrames = Do(DefaultIDStaticIFrames); + IProjectileTweak[] standardBulletTweaks = Do(ExtraUpdatesDelta(+2)); IProjectileTweak[] standardChainsawTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5)); IProjectileTweak[] standardDrillTweaks = Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+25), LocalIFrames(5)); IProjectileTweak[] counterweightTweaks = Do(MaxUpdatesExact(2), DefaultIDStaticIFrames); @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles { ProjectileID.TerrarianBeam, Do(LocalIFrames(-1)) }, // Terrarian yoyo orbs // original: INF lifetime | 360px range | 16.5px/f top speed | 0 extra updates - { ProjectileID.TheEyeOfCthulhu, RebalanceYoyo(-1f, 480f, 36f, 1) }, // the yoyo, of course + { ProjectileID.TheEyeOfCthulhu, RebalanceYoyo(-1f, 480f, 36f, 1, 12) }, // the yoyo, of course // original: INF lifetime | 370px range | 16px/f top speed | 0 extra updates { ProjectileID.ValkyrieYoyo, RebalanceYoyo(-1f, 480f, 42f, 2, 12) }, @@ -117,23 +117,23 @@ namespace CalamityMod.Projectiles { ProjectileID.Anchor, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.Arkhalis, Do(TrueMeleeNoSpeed, ScaleExact(1.25f), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.Bee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, - { ProjectileID.BeeArrow, Do(PointBlank, ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, + { ProjectileID.BeeArrow, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.BlackCounterweight, counterweightTweaks }, { ProjectileID.BlueCounterweight, counterweightTweaks }, { ProjectileID.BlueMoon, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.Bullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, - { ProjectileID.BulletHighVelocity, Do(PointBlank, LocalIFrames(-1)) }, - { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(5), ScaleExact(1.5f)) }, + { ProjectileID.Bullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.BulletHighVelocity, Do(LocalIFrames(-1)) }, + { ProjectileID.ButchersChainsaw, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(7), ScaleExact(1.5f)) }, { ProjectileID.ChlorophyteChainsaw, standardChainsawTweaks }, { ProjectileID.ChlorophyteDrill, standardDrillTweaks }, { ProjectileID.ChlorophyteOrb, Do(NoPiercing) }, { ProjectileID.CobaltChainsaw, standardChainsawTweaks }, { ProjectileID.CobaltDrill, standardDrillTweaks }, { ProjectileID.CobaltNaginata, Do(TrueMelee, LocalIFrames(9)) }, - { ProjectileID.CrystalBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.CrystalBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.CrystalVileShardHead, Do(LocalIFrames(23)) }, { ProjectileID.CrystalVileShardShaft, Do(LocalIFrames(23)) }, - { ProjectileID.CursedBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.CursedBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.ClusterRocketI, Do(LocalIFrames(15)) }, { ProjectileID.ClusterFragmentsI, Do(IDStaticIFrames(15)) }, { ProjectileID.ClusterRocketII, Do(LocalIFrames(15)) }, @@ -142,30 +142,30 @@ namespace CalamityMod.Projectiles { ProjectileID.ClusterSnowmanRocketII, Do(LocalIFrames(15)) }, { ProjectileID.DangerousSpider, Do( ExtraUpdatesExact(2), LocalIFrames(45)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.DD2SquireSonicBoom, Do(PiercingExact(3), DefaultIDStaticIFrames) }, // Flying Dragon + { ProjectileID.DeadlySphere, Do(LocalIFrames(30)) }, { ProjectileID.EmeraldBolt, Do(NoPiercing) }, { ProjectileID.EmpressBlade, Do(LocalIFrames(30)) }, // Terraprisma { ProjectileID.EnchantedBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, - { ProjectileID.ExplosiveBullet, Do(PointBlank, ExtraUpdatesDelta(+2), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.ExplosiveBullet, Do(ExtraUpdatesDelta(+2), IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes { ProjectileID.FairyQueenRangedItemShot, Do(PiercingExact(7), ExtraUpdatesExact(1)) }, // Eventide Convert { ProjectileID.FlaironBubble, Do(ExtraUpdatesExact(1), TimeLeftExact(150), DefaultIDStaticIFrames) }, { ProjectileID.Flamarang, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, { ProjectileID.Flames, Do(IDStaticIFrames(5)) }, // Flamethrower AND Elf Melter flames { ProjectileID.FlamingJack, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FlowerPetal, Do(MaxUpdatesExact(4), LocalIFrames(10)) }, // Orichalcum armor - { ProjectileID.FlowerPow, Do(ExtraUpdatesExact(1)) }, { ProjectileID.FlyingKnife, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FrostBoltStaff, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.FruitcakeChakram, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.GiantBee, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GladiusStab, Do(TrueMelee, LocalIFrames(-1)) }, - { ProjectileID.GoldenBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.GoldenBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.GoldenShowerFriendly, Do(PiercingExact(2), DefaultIDStaticIFrames) }, { ProjectileID.GreenCounterweight, counterweightTweaks }, { ProjectileID.Hamdrax, standardDrillTweaks }, // Drax (never internally renamed since 1.1) - { ProjectileID.HeatRay, Do(InfinitePiercing, IDStaticIFrames(6)) }, // Due to the weapon's fast use speed, the lasers need to give less than 10 iframes + { ProjectileID.HellfireArrow, Do(ExtraUpdatesDelta(+2)) }, { ProjectileID.IceBoomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.IceSickle, Do(ExtraUpdatesExact(1)) }, - { ProjectileID.IchorBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.IchorBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.InfluxWaver, Do(ExtraUpdatesExact(1)) }, { ProjectileID.InfernoFriendlyBolt, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.InfernoFriendlyBlast, Do(ExtraUpdatesExact(2), DefaultIDStaticIFrames) }, @@ -182,14 +182,14 @@ namespace CalamityMod.Projectiles { ProjectileID.MythrilChainsaw, standardChainsawTweaks }, { ProjectileID.MythrilDrill, standardDrillTweaks }, { ProjectileID.MythrilHalberd, Do(TrueMelee, LocalIFrames(8)) }, - { ProjectileID.NanoBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.NanoBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.NebulaDrill, standardDrillTweaks }, { ProjectileID.NebulaLaser, Do(ExtraUpdatesDelta(-1)) }, { ProjectileID.OrichalcumChainsaw, standardChainsawTweaks }, { ProjectileID.OrichalcumDrill, standardDrillTweaks }, { ProjectileID.PalladiumChainsaw, standardChainsawTweaks }, { ProjectileID.PalladiumDrill, standardDrillTweaks }, - { ProjectileID.PartyBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.PartyBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.PoisonFang, Do(LocalIFrames(10)) }, { ProjectileID.PurpleCounterweight, counterweightTweaks }, { ProjectileID.QueenSlimeGelAttack, Do(NoPiercing) }, @@ -200,7 +200,6 @@ namespace CalamityMod.Projectiles { ProjectileID.RocketFireworkRed, Do(TimeLeftDelta(+45)) }, { ProjectileID.RocketFireworkYellow, Do(TimeLeftDelta(+45)) }, { ProjectileID.SawtoothShark, Do(TrueMeleeNoSpeed, ArmorPenetrationDelta(+15), LocalIFrames(6)) }, - { ProjectileID.ShadowBeamHostile, Do(ExtraUpdatesExact(1)) }, { ProjectileID.Shroomerang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.SolarFlareDrill, standardDrillTweaks }, { ProjectileID.StardustDrill, standardDrillTweaks }, @@ -214,7 +213,7 @@ namespace CalamityMod.Projectiles { ProjectileID.TitaniumDrill, standardDrillTweaks }, { ProjectileID.Trimarang, Do(ExtraUpdatesExact(1), DefaultIDStaticIFrames) }, { ProjectileID.TrueNightsEdge, Do(PiercingExact(4)) }, - { ProjectileID.VenomBullet, Do(PointBlank, ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, + { ProjectileID.VenomBullet, Do(ExtraUpdatesDelta(+2), DefaultIDStaticIFrames) }, { ProjectileID.VenomFang, Do(LocalIFrames(10)) }, { ProjectileID.VenomSpider, Do( ExtraUpdatesExact(2), LocalIFrames(45)) }, //Spider Staff spiders. It has Venom, Dangerous, and Jumping spiders. { ProjectileID.VortexDrill, standardDrillTweaks }, @@ -255,384 +254,356 @@ namespace CalamityMod.Projectiles { ProjectileID.VortexChainsaw, trueMeleeNoSpeed }, #endregion - #region CATEGORY 4: Point Blank support - { ProjectileID.Blizzard, Do(PointBlank, DefaultIDStaticIFrames) }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. - { ProjectileID.BlueFlare, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.BoneArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.CandyCorn, Do(PointBlank, IDStaticIFrames(7)) }, // Has an exception in Vanilla iframe code, uses 7 iframes - { ProjectileID.ChlorophyteArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.ChlorophyteBullet, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.CrimsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.CrystalDart, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.CursedArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.CursedDart, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.DD2PhoenixBowShot, pointBlank }, // Phantom Phoenix - { ProjectileID.EbonsandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.FireArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.Flare, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.FrostburnArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.Harpoon, pointBlank }, - { ProjectileID.Hellwing, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.HellfireArrow, Do(PointBlank, ExtraUpdatesDelta(+2)) }, - { ProjectileID.HolyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.IchorArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.JestersArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.MoonlordArrow, pointBlank }, // Luminite Arrow - { ProjectileID.PainterPaintball, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.PearlSandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.PhantasmArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.PoisonDartBlowgun, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.PulseBolt, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.SandBallGun, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.Seed, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.ShadowFlameArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.SnowBallFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.Stake, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.UnholyArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.VenomArrow, Do(PointBlank, DefaultIDStaticIFrames) }, - { ProjectileID.WoodenArrowFriendly, Do(PointBlank, DefaultIDStaticIFrames) }, - #endregion - - #region CATEGORY 5: Defense Damage support - { ProjectileID.BombSkeletronPrime, defenseDamage }, - { ProjectileID.CannonballHostile, defenseDamage }, + #region CATEGORY 4: Defense Damage support { ProjectileID.Cthulunado, defenseDamage }, // Duke Fishron's larger Sharknados - { ProjectileID.CultistBossFireBall, defenseDamage }, - { ProjectileID.CultistBossFireBallClone, defenseDamage }, - { ProjectileID.CultistBossIceMist, defenseDamage }, - { ProjectileID.CultistBossLightningOrbArc, defenseDamage }, - { ProjectileID.DD2BetsyFireball, defenseDamage }, { ProjectileID.DD2BetsyFlameBreath, defenseDamage }, { ProjectileID.DeerclopsIceSpike, defenseDamage }, - { ProjectileID.DeerclopsRangedProjectile, defenseDamage }, // Deerclops shadow hands - { ProjectileID.DemonSickle, defenseDamage }, - { ProjectileID.FairyQueenLance, defenseDamage }, // Empress of Light's lance walls { ProjectileID.FairyQueenSunDance, defenseDamage }, // Empress of Light's Sun Dance { ProjectileID.FlamingScythe, defenseDamage }, // Pumpking orange spinning scythes - { ProjectileID.FrostWave, defenseDamage }, // Ice Queen frost waves - { ProjectileID.HallowBossLastingRainbow, defenseDamage }, // Empress of Light's lingering rainbow trail hitboxes { ProjectileID.InfernoHostileBlast, defenseDamage }, // Diabolist inferno fork explosions - { ProjectileID.JavelinHostile, defenseDamage }, { ProjectileID.PaladinsHammerHostile, defenseDamage }, { ProjectileID.PhantasmalDeathray, defenseDamage }, { ProjectileID.PhantasmalSphere, defenseDamage }, - { ProjectileID.Present, defenseDamage }, // Falling present bombs in Frost Moon - { ProjectileID.RocketSkeleton, defenseDamage }, // Skeleton Commando rockets - { ProjectileID.RockGolemRock, defenseDamage }, - { ProjectileID.RuneBlast, defenseDamage }, // Rune Wizard shots { ProjectileID.SaucerDeathray, defenseDamage }, - { ProjectileID.SaucerMissile, defenseDamage }, { ProjectileID.Sharknado, defenseDamage }, - { ProjectileID.Skull, defenseDamage }, // Skeletron Expert+ skulls - { ProjectileID.SniperBullet, defenseDamage }, // Skeleton Sniper bullets - { ProjectileID.Spike, defenseDamage }, // Santank spike balls { ProjectileID.ThornBall, Do(Main.zenithWorld ? IgnoreWater : DontIgnoreWater, DefenseDamage) }, // Plantera bouncing thorn balls - { ProjectileID.UnholyTridentHostile, defenseDamage }, #endregion - #region CATEGORY 6: ID-Static Immunity Frame changes - {ProjectileID.AbigailCounter, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Ale, Do(DefaultIDStaticIFrames)}, - {ProjectileID.AmberBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.AmethystBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.AshBallFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BallofFire, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BallofFrost, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bananarang, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bat, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BeeHive, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Beenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BlackCat, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BloodArrow, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BloodButcherer, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BloodNautilusTears, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BloodWater, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BloodyMachete, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BombFish, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bone, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BoneArrowFromMerchant, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BoneDagger, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BookOfSkullsSkull, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BookStaffShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Boulder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BoulderStaffOfEarth, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BouncyBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BouncyBoulder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BouncyDynamite, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BouncyGrenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.BoxingGlove, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bubble, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Bunny, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CannonballFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CavelingGardener, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Celeb2Rocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Celeb2RocketExplosive, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Celeb2RocketExplosiveLarge, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Celeb2RocketLarge, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Celeb2Weapon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChainGuillotine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChainKnife, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChargedBlasterCannon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChargedBlasterLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChargedBlasterOrb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ChlorophytePartisan, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ClothiersCurse, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ClusterMineI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ClusterMineII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ClusterSnowmanFragmentsI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ClusterSnowmanFragmentsII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CoinPortal, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CopperCoin, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CorruptSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrimsandBallFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrimsonHeart, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrimsonSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalLeaf, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalLeafShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalPulse, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalPulse2, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalShard, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CrystalStorm, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CursedDartFlame, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CursedFlameFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.CursedFlare, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DD2PhoenixBow, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DemonScythe, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DiamondBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DirtBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DirtBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DirtSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DirtStickyBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DripplerFlailExtraBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DryadsWardCircle, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DryBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DryMine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DryRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.DrySnowmanRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Dynamite, Do(DefaultIDStaticIFrames)}, - {ProjectileID.EatersBite, Do(DefaultIDStaticIFrames)}, - {ProjectileID.EbonsandBallFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.EighthNote, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Electrosphere, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes - {ProjectileID.ElectrosphereMissile, Do(DefaultIDStaticIFrames)}, - {ProjectileID.EnchantedBeam, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Explosives, Do(DefaultIDStaticIFrames)}, - {ProjectileID.FallingStar, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Flairon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.FlamesTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.FlowerPowPetal, Do(DefaultIDStaticIFrames)}, - {ProjectileID.FrostArrow, Do(DefaultIDStaticIFrames)}, - {ProjectileID.FrostDaggerfish, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GasTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GelBalloon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Geode, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GeyserTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GoldCoin, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GolemFist, Do(DefaultIDStaticIFrames)}, - {ProjectileID.GreenLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Grenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HallowSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HallowStar, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HolyWater, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoneyBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoneyGrenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoneyMine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoneyRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoneySnowmanRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HornetStinger, Do(DefaultIDStaticIFrames)}, - {ProjectileID.HoundiusShootiusFireball, Do(DefaultIDStaticIFrames)}, - {ProjectileID.IceBlock, Do(DefaultIDStaticIFrames)}, - {ProjectileID.IceBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.IchorDart, Do(DefaultIDStaticIFrames)}, - {ProjectileID.JackOLantern, Do(DefaultIDStaticIFrames)}, - {ProjectileID.JavelinFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Landmine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LaserMachinegun, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LaserMachinegunLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LastPrism, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LastPrismLaser, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.LavaBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LavaMine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LavaRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LavaSnowmanRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Leaf, Do(DefaultIDStaticIFrames)}, - {ProjectileID.LifeCrystalBoulder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MagicMissile, Do(IDStaticIFrames(8))}, // Has an exception in Vanilla iframe code, uses 8 iframes - {ProjectileID.MagnetSphereBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MedusaHead, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MedusaHeadRay, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Meteor1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.Meteor2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.Meteor3, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.MinecartMechLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniBoulder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniMinotaur, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeMineI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeMineII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeRocketI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeRocketII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeSnowmanRocketI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniNukeSnowmanRocketII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniRetinaLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MiniSharkron, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MolotovCocktail, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MolotovFire, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MolotovFire2, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MolotovFire3, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MonkStaffT3_AltShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MudBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Mushroom, Do(DefaultIDStaticIFrames)}, - {ProjectileID.MushroomSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NailFriendly, Do(IDStaticIFrames(1))}, // Has an exception in Vanilla iframe code, uses 1 iframe - {ProjectileID.NebulaArcanumExplosionShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NebulaArcanumExplosionShotShard, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NebulaBlaze1, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.NebulaBlaze2, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.NettleBurstEnd, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NettleBurstLeft, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NettleBurstRight, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NightBeam, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NorthPoleSnowflake, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NorthPoleSpear, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NorthPoleWeapon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NurseSyringeHeal, Do(DefaultIDStaticIFrames)}, - {ProjectileID.NurseSyringeHurt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.OrnamentFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.OrnamentStar, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PaladinsHammerFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PaperAirplaneA, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PaperAirplaneB, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PartyGirlGrenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PearlSandBallFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PewMaticHornShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Phantasm, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PineNeedleFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PlatinumCoin, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PoisonDart, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PoisonDartTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PoisonedKnife, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PossessedHatchet, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PrincessWeapon, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ProximityMineI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ProximityMineII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ProximityMineIII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ProximityMineIV, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PureSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PurificationPowder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PurpleLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.PygmySpear, Do(DefaultIDStaticIFrames)}, - {ProjectileID.QuarterNote, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RainbowFlare, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketFireworksBoxBlue, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketFireworksBoxGreen, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketFireworksBoxRed, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketFireworksBoxYellow, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketIII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketIV, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketSnowmanI, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketSnowmanII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketSnowmanIII, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RocketSnowmanIV, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RollingCactus, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RollingCactusSpike, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RottenEgg, Do(DefaultIDStaticIFrames)}, - {ProjectileID.RubyBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SandBallFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SandSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SantaBombs, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SantankMountRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SapphireBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ScarabBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ScutlixLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ScutlixLaserFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SeedlerNut, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SeedlerThorn, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ShadowBeamFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ShadowFlameKnife, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ShellPileFalling, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ShimmerArrow, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ShimmerFlare, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Shuriken, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SiltBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SilverBullet, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SilverCoin, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SkyFracture, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SlushBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SnowSpray, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SolarCounter, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SolarFlareRay, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SoulDrain, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpearTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpelunkerFlare, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Spider, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpiderEgg, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpikyBall, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpikyBallTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SpiritFlame, Do(IDStaticIFrames(5))}, // Has an exception in Vanilla iframe code, uses 5 iframes - {ProjectileID.SporeGas, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SporeGas2, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SporeGas3, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SporeTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.SporeTrap2, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StarAnise, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StarCannonStar, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StardustCellMinion, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StardustGuardianExplosion, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StickyBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StickyDynamite, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StickyGrenade, Do(DefaultIDStaticIFrames)}, - {ProjectileID.StormTigerGem, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Stynger, Do(IDStaticIFrames(7))}, // Has an exception in Vanilla iframe code, uses 7 iframes - {ProjectileID.StyngerShrapnel, Do(DefaultIDStaticIFrames)}, - {ProjectileID.TentacleSpike, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ThornChakram, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ThrowingKnife, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ThunderSpear, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ThunderSpearShot, Do(DefaultIDStaticIFrames)}, - {ProjectileID.TiedEighthNote, Do(DefaultIDStaticIFrames)}, - {ProjectileID.TitaniumStormShard, Do(DefaultIDStaticIFrames)}, - {ProjectileID.TopazBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ToxicBubble, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ToxicCloud, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ToxicCloud2, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ToxicCloud3, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ToxicFlask, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Truffle, Do(DefaultIDStaticIFrames)}, - {ProjectileID.TruffleSpore, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Typhoon, Do(IDStaticIFrames(6))}, // Has an exception in Vanilla iframe code, uses 6 iframes - {ProjectileID.UFOLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.UFOMinion, Do(DefaultIDStaticIFrames)}, - {ProjectileID.UnholyTridentFriendly, Do(DefaultIDStaticIFrames)}, - {ProjectileID.UnholyWater, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VampireKnife, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VenomDartTrap, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ViciousPowder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VilePowder, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VilethornBase, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VilethornTip, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VortexBeater, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VortexBeaterRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VortexVortexLightning, Do(DefaultIDStaticIFrames)}, - {ProjectileID.VortexVortexPortal, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Waffle, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WandOfFrostingFrost, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WandOfSparkingSpark, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WaterBolt, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WaterStream, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Web, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WetBomb, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WetMine, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WetRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WetSnowmanRocket, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Wisp, Do(DefaultIDStaticIFrames)}, - {ProjectileID.WoodenBoomerang, Do(DefaultIDStaticIFrames)}, - {ProjectileID.Xenopopper, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ZapinatorLaser, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ZoologistStrikeGreen, Do(DefaultIDStaticIFrames)}, - {ProjectileID.ZoologistStrikeRed, Do(DefaultIDStaticIFrames)}, + #region CATEGORY 5: ID-Static Immunity Frame changes + { ProjectileID.AbigailCounter, defaultIFrames }, + { ProjectileID.Ale, defaultIFrames }, + { ProjectileID.AmberBolt, defaultIFrames }, + { ProjectileID.AmethystBolt, defaultIFrames }, + { ProjectileID.AshBallFalling, defaultIFrames }, + { ProjectileID.BallofFire, defaultIFrames }, + { ProjectileID.BallofFrost, defaultIFrames }, + { ProjectileID.Bananarang, defaultIFrames }, + { ProjectileID.Bat, defaultIFrames }, + { ProjectileID.BeeHive, defaultIFrames }, + { ProjectileID.Beenade, defaultIFrames }, + { ProjectileID.BlackCat, defaultIFrames }, + { ProjectileID.Blizzard, defaultIFrames }, // Blizzard Staff projectiles, re-used in Frostbite Blaster. + { ProjectileID.BloodArrow, defaultIFrames }, + { ProjectileID.BloodButcherer, defaultIFrames }, + { ProjectileID.BloodNautilusTears, defaultIFrames }, + { ProjectileID.BloodWater, defaultIFrames }, + { ProjectileID.BloodyMachete, defaultIFrames }, + { ProjectileID.BlueFlare, defaultIFrames }, + { ProjectileID.Bomb, defaultIFrames }, + { ProjectileID.BombFish, defaultIFrames }, + { ProjectileID.Bone, defaultIFrames }, + { ProjectileID.BoneArrow, defaultIFrames }, + { ProjectileID.BoneArrowFromMerchant, defaultIFrames }, + { ProjectileID.BoneDagger, defaultIFrames }, + { ProjectileID.BookOfSkullsSkull, defaultIFrames }, + { ProjectileID.BookStaffShot, defaultIFrames }, + { ProjectileID.Boulder, defaultIFrames }, + { ProjectileID.BoulderStaffOfEarth, defaultIFrames }, + { ProjectileID.BouncyBomb, defaultIFrames }, + { ProjectileID.BouncyBoulder, defaultIFrames }, + { ProjectileID.BouncyDynamite, defaultIFrames }, + { ProjectileID.BouncyGrenade, defaultIFrames }, + { ProjectileID.BoxingGlove, defaultIFrames }, + { ProjectileID.Bubble, defaultIFrames }, + { ProjectileID.Bunny, defaultIFrames }, + { ProjectileID.CandyCorn, Do(IDStaticIFrames(7)) }, // Has an exception in Vanilla iframe code, uses 7 iframes + { ProjectileID.CannonballFriendly, defaultIFrames }, + { ProjectileID.CavelingGardener, defaultIFrames }, + { ProjectileID.Celeb2Rocket, defaultIFrames }, + { ProjectileID.Celeb2RocketExplosive, defaultIFrames }, + { ProjectileID.Celeb2RocketExplosiveLarge, defaultIFrames }, + { ProjectileID.Celeb2RocketLarge, defaultIFrames }, + { ProjectileID.Celeb2Weapon, defaultIFrames }, + { ProjectileID.ChainGuillotine, defaultIFrames }, + { ProjectileID.ChainKnife, defaultIFrames }, + { ProjectileID.ChargedBlasterCannon, defaultIFrames }, + { ProjectileID.ChargedBlasterLaser, defaultIFrames }, + { ProjectileID.ChargedBlasterOrb, defaultIFrames }, + { ProjectileID.ChlorophyteArrow, defaultIFrames }, + { ProjectileID.ChlorophyteBullet, defaultIFrames }, + { ProjectileID.ChlorophytePartisan, defaultIFrames }, + { ProjectileID.ClothiersCurse, defaultIFrames }, + { ProjectileID.ClusterMineI, defaultIFrames }, + { ProjectileID.ClusterMineII, defaultIFrames }, + { ProjectileID.ClusterSnowmanFragmentsI, defaultIFrames }, + { ProjectileID.ClusterSnowmanFragmentsII, defaultIFrames }, + { ProjectileID.CoinPortal, defaultIFrames }, + { ProjectileID.CopperCoin, defaultIFrames }, + { ProjectileID.CorruptSpray, defaultIFrames }, + { ProjectileID.CrimsandBallFalling, defaultIFrames }, + { ProjectileID.CrimsandBallGun, defaultIFrames }, + { ProjectileID.CrimsonHeart, defaultIFrames }, + { ProjectileID.CrimsonSpray, defaultIFrames }, + { ProjectileID.CrystalDart, defaultIFrames }, + { ProjectileID.CrystalLeaf, defaultIFrames }, + { ProjectileID.CrystalLeafShot, defaultIFrames }, + { ProjectileID.CrystalPulse, defaultIFrames }, + { ProjectileID.CrystalPulse2, defaultIFrames }, + { ProjectileID.CrystalShard, defaultIFrames }, + { ProjectileID.CrystalStorm, defaultIFrames }, + { ProjectileID.CursedArrow, defaultIFrames }, + { ProjectileID.CursedDart, defaultIFrames }, + { ProjectileID.CursedDartFlame, defaultIFrames }, + { ProjectileID.CursedFlameFriendly, defaultIFrames }, + { ProjectileID.CursedFlare, defaultIFrames }, + { ProjectileID.DD2PhoenixBow, defaultIFrames }, + { ProjectileID.DemonScythe, defaultIFrames }, + { ProjectileID.DiamondBolt, defaultIFrames }, + { ProjectileID.DirtBall, defaultIFrames }, + { ProjectileID.DirtBomb, defaultIFrames }, + { ProjectileID.DirtSpray, defaultIFrames }, + { ProjectileID.DirtStickyBomb, defaultIFrames }, + { ProjectileID.DripplerFlailExtraBall, defaultIFrames }, + { ProjectileID.DryadsWardCircle, defaultIFrames }, + { ProjectileID.DryBomb, defaultIFrames }, + { ProjectileID.DryMine, defaultIFrames }, + { ProjectileID.DryRocket, defaultIFrames }, + { ProjectileID.DrySnowmanRocket, defaultIFrames }, + { ProjectileID.Dynamite, defaultIFrames }, + { ProjectileID.EatersBite, defaultIFrames }, + { ProjectileID.EbonsandBallFalling, defaultIFrames }, + { ProjectileID.EbonsandBallGun, defaultIFrames }, + { ProjectileID.EighthNote, defaultIFrames }, + { ProjectileID.Electrosphere, Do(IDStaticIFrames(8)) }, // Has an exception in Vanilla iframe code, uses 8 iframes + { ProjectileID.ElectrosphereMissile, defaultIFrames }, + { ProjectileID.EnchantedBeam, defaultIFrames }, + { ProjectileID.Explosives, defaultIFrames }, + { ProjectileID.FallingStar, defaultIFrames }, + { ProjectileID.FireArrow, defaultIFrames }, + { ProjectileID.Flairon, defaultIFrames }, + { ProjectileID.FlamesTrap, defaultIFrames }, + { ProjectileID.Flare, defaultIFrames }, + { ProjectileID.FlowerPowPetal, defaultIFrames }, + { ProjectileID.FrostArrow, defaultIFrames }, + { ProjectileID.FrostburnArrow, defaultIFrames }, + { ProjectileID.FrostDaggerfish, defaultIFrames }, + { ProjectileID.GasTrap, defaultIFrames }, + { ProjectileID.GelBalloon, defaultIFrames }, + { ProjectileID.Geode, defaultIFrames }, + { ProjectileID.GeyserTrap, defaultIFrames }, + { ProjectileID.GoldCoin, defaultIFrames }, + { ProjectileID.GolemFist, defaultIFrames }, + { ProjectileID.GreenLaser, defaultIFrames }, + { ProjectileID.Grenade, defaultIFrames }, + { ProjectileID.HallowSpray, defaultIFrames }, + { ProjectileID.HallowStar, defaultIFrames }, + { ProjectileID.Hellwing, defaultIFrames }, + { ProjectileID.HolyArrow, defaultIFrames }, + { ProjectileID.HeatRay, Do(DefaultIDStaticIFrames) }, + { ProjectileID.HolyWater, defaultIFrames }, + { ProjectileID.HoneyBomb, defaultIFrames }, + { ProjectileID.HoneyGrenade, defaultIFrames }, + { ProjectileID.HoneyMine, defaultIFrames }, + { ProjectileID.HoneyRocket, defaultIFrames }, + { ProjectileID.HoneySnowmanRocket, defaultIFrames }, + { ProjectileID.HornetStinger, defaultIFrames }, + { ProjectileID.HoundiusShootiusFireball, defaultIFrames }, + { ProjectileID.IceBlock, defaultIFrames }, + { ProjectileID.IceBolt, defaultIFrames }, + { ProjectileID.IchorArrow, defaultIFrames }, + { ProjectileID.IchorDart, defaultIFrames }, + { ProjectileID.JackOLantern, defaultIFrames }, + { ProjectileID.JavelinFriendly, defaultIFrames }, + { ProjectileID.JestersArrow, defaultIFrames }, + { ProjectileID.Landmine, defaultIFrames }, + { ProjectileID.LaserMachinegun, defaultIFrames }, + { ProjectileID.LaserMachinegunLaser, defaultIFrames }, + { ProjectileID.LastPrism, defaultIFrames }, + { ProjectileID.LastPrismLaser, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.LavaBomb, defaultIFrames }, + { ProjectileID.LavaMine, defaultIFrames }, + { ProjectileID.LavaRocket, defaultIFrames }, + { ProjectileID.LavaSnowmanRocket, defaultIFrames }, + { ProjectileID.Leaf, defaultIFrames }, + { ProjectileID.LifeCrystalBoulder, defaultIFrames }, + { ProjectileID.MagicMissile, Do(IDStaticIFrames(8)) }, // Has an exception in Vanilla iframe code, uses 8 iframes + { ProjectileID.MagnetSphereBolt, defaultIFrames }, + { ProjectileID.MedusaHead, defaultIFrames }, + { ProjectileID.MedusaHeadRay, defaultIFrames }, + { ProjectileID.Meteor1, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.Meteor2, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.Meteor3, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.MinecartMechLaser, defaultIFrames }, + { ProjectileID.MiniBoulder, defaultIFrames }, + { ProjectileID.MiniMinotaur, defaultIFrames }, + { ProjectileID.MiniNukeMineI, defaultIFrames }, + { ProjectileID.MiniNukeMineII, defaultIFrames }, + { ProjectileID.MiniNukeRocketI, defaultIFrames }, + { ProjectileID.MiniNukeRocketII, defaultIFrames }, + { ProjectileID.MiniNukeSnowmanRocketI, defaultIFrames }, + { ProjectileID.MiniNukeSnowmanRocketII, defaultIFrames }, + { ProjectileID.MiniRetinaLaser, defaultIFrames }, + { ProjectileID.MiniSharkron, defaultIFrames }, + { ProjectileID.MolotovCocktail, defaultIFrames }, + { ProjectileID.MolotovFire, defaultIFrames }, + { ProjectileID.MolotovFire2, defaultIFrames }, + { ProjectileID.MolotovFire3, defaultIFrames }, + { ProjectileID.MonkStaffT3_AltShot, defaultIFrames }, + { ProjectileID.MudBall, defaultIFrames }, + { ProjectileID.Mushroom, defaultIFrames }, + { ProjectileID.MushroomSpray, defaultIFrames }, + { ProjectileID.NailFriendly, Do(IDStaticIFrames(1)) }, // Has an exception in Vanilla iframe code, uses 1 iframe + { ProjectileID.NebulaArcanumExplosionShot, defaultIFrames }, + { ProjectileID.NebulaArcanumExplosionShotShard, defaultIFrames }, + { ProjectileID.NebulaBlaze1, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.NebulaBlaze2, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.NettleBurstEnd, defaultIFrames }, + { ProjectileID.NettleBurstLeft, defaultIFrames }, + { ProjectileID.NettleBurstRight, defaultIFrames }, + { ProjectileID.NightBeam, defaultIFrames }, + { ProjectileID.NorthPoleSnowflake, defaultIFrames }, + { ProjectileID.NorthPoleSpear, defaultIFrames }, + { ProjectileID.NorthPoleWeapon, defaultIFrames }, + { ProjectileID.NurseSyringeHeal, defaultIFrames }, + { ProjectileID.NurseSyringeHurt, defaultIFrames }, + { ProjectileID.OrnamentFriendly, defaultIFrames }, + { ProjectileID.OrnamentStar, defaultIFrames }, + { ProjectileID.PainterPaintball, defaultIFrames }, + { ProjectileID.PaladinsHammerFriendly, defaultIFrames }, + { ProjectileID.PaperAirplaneA, defaultIFrames }, + { ProjectileID.PaperAirplaneB, defaultIFrames }, + { ProjectileID.PartyGirlGrenade, defaultIFrames }, + { ProjectileID.PearlSandBallFalling, defaultIFrames }, + { ProjectileID.PearlSandBallGun, defaultIFrames }, + { ProjectileID.PewMaticHornShot, defaultIFrames }, + { ProjectileID.Phantasm, defaultIFrames }, + { ProjectileID.PhantasmArrow, defaultIFrames }, + { ProjectileID.PineNeedleFriendly, defaultIFrames }, + { ProjectileID.PlatinumCoin, defaultIFrames }, + { ProjectileID.PoisonDart, defaultIFrames }, + { ProjectileID.PoisonDartBlowgun, defaultIFrames }, + { ProjectileID.PoisonDartTrap, defaultIFrames }, + { ProjectileID.PoisonedKnife, defaultIFrames }, + { ProjectileID.PossessedHatchet, defaultIFrames }, + { ProjectileID.PrincessWeapon, defaultIFrames }, + { ProjectileID.ProximityMineI, defaultIFrames }, + { ProjectileID.ProximityMineII, defaultIFrames }, + { ProjectileID.ProximityMineIII, defaultIFrames }, + { ProjectileID.ProximityMineIV, defaultIFrames }, + { ProjectileID.PulseBolt, defaultIFrames }, + { ProjectileID.PureSpray, defaultIFrames }, + { ProjectileID.PurificationPowder, defaultIFrames }, + { ProjectileID.PurpleLaser, defaultIFrames }, + { ProjectileID.PygmySpear, defaultIFrames }, + { ProjectileID.QuarterNote, defaultIFrames }, + { ProjectileID.RainbowFlare, defaultIFrames }, + { ProjectileID.RocketFireworksBoxBlue, defaultIFrames }, + { ProjectileID.RocketFireworksBoxGreen, defaultIFrames }, + { ProjectileID.RocketFireworksBoxRed, defaultIFrames }, + { ProjectileID.RocketFireworksBoxYellow, defaultIFrames }, + { ProjectileID.RocketI, defaultIFrames }, + { ProjectileID.RocketII, defaultIFrames }, + { ProjectileID.RocketIII, defaultIFrames }, + { ProjectileID.RocketIV, defaultIFrames }, + { ProjectileID.RocketSnowmanI, defaultIFrames }, + { ProjectileID.RocketSnowmanII, defaultIFrames }, + { ProjectileID.RocketSnowmanIII, defaultIFrames }, + { ProjectileID.RocketSnowmanIV, defaultIFrames }, + { ProjectileID.RollingCactus, defaultIFrames }, + { ProjectileID.RollingCactusSpike, defaultIFrames }, + { ProjectileID.RottenEgg, defaultIFrames }, + { ProjectileID.RubyBolt, defaultIFrames }, + { ProjectileID.SandBallFalling, defaultIFrames }, + { ProjectileID.SandBallGun, defaultIFrames }, + { ProjectileID.SandSpray, defaultIFrames }, + { ProjectileID.SantaBombs, defaultIFrames }, + { ProjectileID.SantankMountRocket, defaultIFrames }, + { ProjectileID.SapphireBolt, defaultIFrames }, + { ProjectileID.ScarabBomb, defaultIFrames }, + { ProjectileID.ScutlixLaser, defaultIFrames }, + { ProjectileID.ScutlixLaserFriendly, defaultIFrames }, + { ProjectileID.Seed, defaultIFrames }, + { ProjectileID.SeedlerNut, defaultIFrames }, + { ProjectileID.SeedlerThorn, defaultIFrames }, + { ProjectileID.ShadowBeamFriendly, defaultIFrames }, + { ProjectileID.ShadowFlameArrow, defaultIFrames }, + { ProjectileID.ShadowFlameKnife, defaultIFrames }, + { ProjectileID.ShellPileFalling, defaultIFrames }, + { ProjectileID.ShimmerArrow, defaultIFrames }, + { ProjectileID.ShimmerFlare, defaultIFrames }, + { ProjectileID.Shuriken, defaultIFrames }, + { ProjectileID.SiltBall, defaultIFrames }, + { ProjectileID.SilverBullet, defaultIFrames }, + { ProjectileID.SilverCoin, defaultIFrames }, + { ProjectileID.SkyFracture, defaultIFrames }, + { ProjectileID.SlushBall, defaultIFrames }, + { ProjectileID.SnowBallFriendly, defaultIFrames }, + { ProjectileID.SnowSpray, defaultIFrames }, + { ProjectileID.SolarCounter, defaultIFrames }, + { ProjectileID.SolarFlareRay, defaultIFrames }, + { ProjectileID.SoulDrain, defaultIFrames }, + { ProjectileID.SpearTrap, defaultIFrames }, + { ProjectileID.SpelunkerFlare, defaultIFrames }, + { ProjectileID.Spider, defaultIFrames }, + { ProjectileID.SpiderEgg, defaultIFrames }, + { ProjectileID.SpikyBall, defaultIFrames }, + { ProjectileID.SpikyBallTrap, defaultIFrames }, + { ProjectileID.SpiritFlame, Do(IDStaticIFrames(5)) }, // Has an exception in Vanilla iframe code, uses 5 iframes + { ProjectileID.SporeGas, defaultIFrames }, + { ProjectileID.SporeGas2, defaultIFrames }, + { ProjectileID.SporeGas3, defaultIFrames }, + { ProjectileID.SporeTrap, defaultIFrames }, + { ProjectileID.SporeTrap2, defaultIFrames }, + { ProjectileID.Stake, defaultIFrames }, + { ProjectileID.StarAnise, defaultIFrames }, + { ProjectileID.StarCannonStar, defaultIFrames }, + { ProjectileID.StardustCellMinion, defaultIFrames }, + { ProjectileID.StardustGuardianExplosion, defaultIFrames }, + { ProjectileID.StickyBomb, defaultIFrames }, + { ProjectileID.StickyDynamite, defaultIFrames }, + { ProjectileID.StickyGrenade, defaultIFrames }, + { ProjectileID.StormTigerGem, defaultIFrames }, + { ProjectileID.Stynger, Do(IDStaticIFrames(7)) }, // Has an exception in Vanilla iframe code, uses 7 iframes + { ProjectileID.StyngerShrapnel, defaultIFrames }, + { ProjectileID.TentacleSpike, defaultIFrames }, + { ProjectileID.ThornChakram, defaultIFrames }, + { ProjectileID.ThrowingKnife, defaultIFrames }, + { ProjectileID.ThunderSpear, defaultIFrames }, + { ProjectileID.ThunderSpearShot, defaultIFrames }, + { ProjectileID.TiedEighthNote, defaultIFrames }, + { ProjectileID.TitaniumStormShard, defaultIFrames }, + { ProjectileID.TopazBolt, defaultIFrames }, + { ProjectileID.ToxicBubble, defaultIFrames }, + { ProjectileID.ToxicCloud, defaultIFrames }, + { ProjectileID.ToxicCloud2, defaultIFrames }, + { ProjectileID.ToxicCloud3, defaultIFrames }, + { ProjectileID.ToxicFlask, defaultIFrames }, + { ProjectileID.Truffle, defaultIFrames }, + { ProjectileID.TruffleSpore, defaultIFrames }, + { ProjectileID.Typhoon, Do(IDStaticIFrames(6)) }, // Has an exception in Vanilla iframe code, uses 6 iframes + { ProjectileID.UFOLaser, defaultIFrames }, + { ProjectileID.UFOMinion, defaultIFrames }, + { ProjectileID.UnholyArrow, defaultIFrames }, + { ProjectileID.UnholyTridentFriendly, defaultIFrames }, + { ProjectileID.UnholyWater, defaultIFrames }, + { ProjectileID.VampireKnife, defaultIFrames }, + { ProjectileID.VenomArrow, defaultIFrames }, + { ProjectileID.VenomDartTrap, defaultIFrames }, + { ProjectileID.ViciousPowder, defaultIFrames }, + { ProjectileID.VilePowder, defaultIFrames }, + { ProjectileID.VilethornBase, defaultIFrames }, + { ProjectileID.VilethornTip, defaultIFrames }, + { ProjectileID.VortexBeater, defaultIFrames }, + { ProjectileID.VortexBeaterRocket, defaultIFrames }, + { ProjectileID.VortexVortexLightning, defaultIFrames }, + { ProjectileID.VortexVortexPortal, defaultIFrames }, + { ProjectileID.Waffle, defaultIFrames }, + { ProjectileID.WandOfFrostingFrost, defaultIFrames }, + { ProjectileID.WandOfSparkingSpark, defaultIFrames }, + { ProjectileID.WaterBolt, defaultIFrames }, + { ProjectileID.WaterStream, defaultIFrames }, + { ProjectileID.Web, defaultIFrames }, + { ProjectileID.WetBomb, defaultIFrames }, + { ProjectileID.WetMine, defaultIFrames }, + { ProjectileID.WetRocket, defaultIFrames }, + { ProjectileID.WetSnowmanRocket, defaultIFrames }, + { ProjectileID.Wisp, defaultIFrames }, + { ProjectileID.WoodenArrowFriendly, defaultIFrames }, + { ProjectileID.WoodenBoomerang, defaultIFrames }, + { ProjectileID.Xenopopper, defaultIFrames }, + { ProjectileID.ZapinatorLaser, defaultIFrames }, + { ProjectileID.ZoologistStrikeGreen, defaultIFrames }, + { ProjectileID.ZoologistStrikeRed, defaultIFrames }, #endregion @@ -852,16 +823,6 @@ namespace CalamityMod.Projectiles internal static IProjectileTweak InfinitePiercing = new PiercingExactRule(-1); #endregion - #region Point Blank - internal class PointBlankRule : IProjectileTweak - { - public bool AppliesTo(Projectile proj) => true; - public void ApplyTweak(Projectile proj) - => proj.Calamity().pointBlankShotDuration = DefaultPointBlankDuration; - } - internal static IProjectileTweak PointBlank => new PointBlankRule(); - #endregion - #region Scale internal class ScaleDeltaRule : IProjectileTweak { diff --git a/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs new file mode 100644 index 0000000000..49af06b549 --- /dev/null +++ b/Projectiles/DraedonsArsenal/AqueousHunterDroneSummon.cs @@ -0,0 +1,428 @@ +using System; +using CalamityMod.Buffs.Summon; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AqueousHunterDroneSummon : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public int time = 0; + public ref float attackTimer => ref Projectile.ai[0]; + public ref float interactionTimer => ref Projectile.ai[1]; + public int interactionPoint = 600; // The time needed before shimps do their idle animation + public int cooldownGiven = 450; + public bool pressedRight => Projectile.ai[2] == 5; + public bool doingSpecialAttack = false; + public float moveSpeed = 30; // Lower is actually faster + public NPC targetedNPC; // The NPC being targeted + public float tailRot = 0; // Extra rotation on the tail + public float tailRecoil = 0; // Recoil for the tail after firing + public int facingDir = 0; + public Vector2 headPlace; + public Vector2 tailPlace; + public float lastFirePositionX; // Used for some of the movement + public Vector2 chillSpot; // Stored position for intro animation and some movement + public Vector2 spawnAnimStart; // Second stored position for the spawn animation + public Vector2 lastTargetCenter; + public int attackDowntime = 0; // Timer used for post attack effects + public int surpriseTimer = 0; // Used for the jump animation when surprized + public float slidingDirection = 0; // Value that lerps from left to right + public int animationClickTime = 70; // Time before body and tail click together in spawn anim + public bool doSpin = false; // If the shrimp will spin for it's attack + public float specialAttackfx = 0; // spinnning effect opacity mult + public override void SetStaticDefaults() + { + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + } + public override void SetDefaults() + { + Projectile.width = 1; + Projectile.height = 1; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.minionSlots = 4f; + Projectile.timeLeft = 18000; + Projectile.penetrate = -1; + Projectile.minion = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + Projectile.DamageType = DamageClass.Summon; + } + + public override void AI() + { + int shrimpNum = Owner.ownedProjectileCounts[Projectile.type]; + facingDir = Math.Sign(Projectile.velocity.X); + GrantBuffs(Owner); + if ((targetedNPC == null || targetedNPC.life <= 0 || !targetedNPC.CanBeChasedBy() || attackDowntime == 20) && attackDowntime < 30) + targetedNPC = Projectile.Center.MinionHoming(2000f, Owner); + + // All the stuff for the spawn animation + if (time < animationClickTime + 20) + { + if (time == 0) + { + chillSpot = Projectile.Center; + spawnAnimStart = Projectile.Center; + int chosenDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity.X = (chosenDir * 16); + tailRot = -2f * chosenDir; + attackTimer += 8 * Projectile.localAI[2]; + } + SpawnAnim(); + facingDir = Math.Sign(Projectile.velocity.X); + time++; + return; + } + + slidingDirection = MathHelper.Lerp(slidingDirection, Owner.direction, 0.03f); + + bool isSummonWeapon = Owner.HeldItem.DamageType.CountsAsClass(DamageClass.Summon); + if (Owner.Calamity().mouseRight && Owner.whoAmI == Main.myPlayer && !Main.mapFullscreen && !Main.blockMouse && Owner.Calamity().arsenalCooldown <= 0 && isSummonWeapon) + { + Projectile.ai[2] = 5; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == Projectile.type && p.owner == Projectile.owner) + { + p.ai[2] = 5; + } + } + } + + if (doingSpecialAttack) + { + SpecialAttack(); + } + else + { + specialAttackfx = MathHelper.Lerp(specialAttackfx, 0, 0.15f); + if (targetedNPC != null || attackDowntime > 0) + { + lastTargetCenter = (targetedNPC == null ? Owner.Center : targetedNPC.Center); + Attacking(); + } + else + { + Passive(); + CheckForSpecialAttack(); + } + } + + if (tailRecoil > 0) + tailRecoil = MathHelper.Lerp(tailRecoil, 0, 0.2f); + if (attackDowntime > 0) + attackDowntime--; + time++; + SetVisualPlacement(); + } + public void CheckForSpecialAttack() + { + if (pressedRight) + { + Projectile.ai[2] = 0; + doingSpecialAttack = true; + attackTimer = 0; + if (Projectile.velocity.Length() < 5) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 12; + else + Projectile.velocity *= 1.3f; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + } + public void SpecialAttack() + { + interactionTimer = 0; + int length = 33; + specialAttackfx = MathHelper.Lerp(specialAttackfx, 1, 0.2f); + + facingDir = Math.Sign(Projectile.Center.DirectionTo(Owner.Center).X); + Projectile.velocity *= 0.98f; + Projectile.rotation += ((MathHelper.TwoPi * 3) / length) * facingDir; + + tailRot = MathHelper.Lerp(tailRot, 0.75f * -facingDir, 0.2f); + for (int i = -1; i <= 1; i += 2) + { + bool noFall = !Main.rand.NextBool(5); + Vector2 vel = Vector2.UnitY.RotatedBy(Projectile.rotation * -5) * i; + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center + vel * 43 * specialAttackfx, dustStyle); + dust.scale = Main.rand.NextFloat(0.8f, 1.1f) + (noFall ? 0 : 0.5f); + dust.velocity = vel.RotatedBy(Main.rand.NextFloat(-0.2f, 0.2f) - MathHelper.PiOver4 * facingDir) * Main.rand.NextFloat(4, 5.5f); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 0.7f; + } + + if (attackTimer % 3 == 0) + { + int usedTimer = (int)(facingDir == -1 ? (length - attackTimer) : attackTimer); + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + Vector2 shootVel = (MathHelper.PiOver2 / 10 * (int)(usedTimer / 3 - 1)).ToRotationVector2().RotatedBy(-MathHelper.PiOver2 - MathHelper.PiOver4); + Vector2 shootPlace = Projectile.Center + shootVel * 10; + + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, attackTimer + 1); + } + attackTimer++; + if (attackTimer > length) + { + attackTimer = 8 * Projectile.localAI[2]; + doingSpecialAttack = false; + } + } + public void SpawnAnim() + { + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + headPlace = Projectile.Center + headDist; + if (time < animationClickTime) + { + tailRot += 0.05f * Projectile.direction; + Projectile.velocity *= 0.98f; + Projectile.Center -= Projectile.velocity; + spawnAnimStart = new Vector2(spawnAnimStart.X, Owner.Center.Y - 700); + + tailPlace = chillSpot + tailDist + (Vector2.UnitY * ((float)Math.Pow(time, 2.05f) * 0.085f) + Vector2.UnitX * (16 - Math.Abs(Projectile.velocity.X)) * 10 * Projectile.direction); + } + else + tailPlace = Projectile.Center + tailDist; + + if (time > animationClickTime - 40) + { + if (time == animationClickTime - 1) + { + Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.PiOver4 * Projectile.direction) * 3; + SoundStyle click = new("CalamityMod/Sounds/Item/DudFire"); + SoundEngine.PlaySound(click with { Pitch = 0.4f }, Projectile.Center); + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.6f, Pitch = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = -9; i <= 9; i++) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace + Main.rand.NextVector2Circular(5, 5), dustStyle); + dust.scale = Main.rand.NextFloat(0.7f, 1.3f); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.Pi * (Math.Sign(i) == 1 ? 0 : 1)) * Main.rand.NextFloat(1, 5); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = 0.1f; + if (i == -1) + i++; + } + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(tailPlace, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 0.4f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + if (time > animationClickTime - 1) + { + Projectile.velocity *= 0.97f; + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + else + { + Projectile.Center = Vector2.Lerp(spawnAnimStart, tailPlace, Utils.GetLerpValue(animationClickTime - 40, animationClickTime, time, true)); + } + } + } + public void Passive() + { + float sine = (float)Math.Sin((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi); + float sine2 = (float)Math.Sin(((time + Projectile.localAI[2] * 3) * 0.075f / MathHelper.Pi) * 2); + + TailRotationBasedOnMovement(); + + attackTimer = 8 * Projectile.localAI[2]; + + if (interactionTimer == interactionPoint) + { + chillSpot = Owner.Center + Main.rand.NextVector2CircularEdge(190, 190); + } + Projectile.rotation = Projectile.rotation.AngleLerp(0, 0.04f); + Vector2 destination = interactionTimer > interactionPoint ? (chillSpot + new Vector2(220 * sine, -90 + 130 * sine2)) : Owner.Center + new Vector2((-50 + -85 * Projectile.localAI[2]) * slidingDirection, -80 + 30 * sine); + + if (surpriseTimer == 0) + Projectile.velocity = (destination - Projectile.Center) / (moveSpeed + (interactionTimer > interactionPoint ? 20 : 0) - 9 + 9 * sine2); + else + surpriseTimer--; + if (interactionTimer > interactionPoint) + { + if (time % 25 == 0) + { + Particle spark2 = new CustomSpark(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Vector2.UnitY * 20, -Vector2.UnitY.RotatedByRandom(0.1f) * Main.rand.NextFloat(3.3f, 5.5f), "CalamityMod/Projectiles/Magic/MelterNote1", false, 32, Main.rand.NextFloat(1.2f, 1.3f), Color.Lerp(Color.Green, Color.Chartreuse, Main.rand.NextFloat(0, 0.7f)), new Vector2(1, 1), true, false, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (time % (480 + Projectile.localAI[2] * 120) == 0 && Owner.miscCounter != 0) + { + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.3f, Pitch = 0f + Projectile.localAI[2] * 0.1f * (Projectile.localAI[2] % 2 == 0 ? -1 : 1), MaxInstances = 10 }, Projectile.Center); + } + } + if (Owner.Center.Distance(Projectile.Center) > 450 && interactionTimer > interactionPoint && Owner.velocity.Length() > 5) + { + CombatText.NewText(Projectile.Hitbox, Effects.ArsenalEffects.ArsenalPlasmaColor, "!", true); + SoundEngine.PlaySound(AqueousHunterDrone.Surprise with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + Projectile.velocity = Projectile.Center.DirectionTo(Owner.Center); + surpriseTimer = 25; + interactionTimer = 0; + } + if (Projectile.velocity.Length() < 5) + interactionTimer++; + else if (interactionTimer > 0 && interactionTimer < interactionPoint) + interactionTimer -= 2; + } + public void Attacking() + { + interactionTimer = 0; + facingDir = Math.Sign(Projectile.Center.DirectionTo(lastTargetCenter).X); + if (tailRecoil > 1 && doSpin) // Little spin + { + Projectile.rotation += 0.35f * facingDir; + } + else + Projectile.rotation = (Projectile.rotation).AngleLerp(tailPlace.DirectionTo(lastTargetCenter).ToRotation() + (facingDir == -1 ? MathHelper.Pi : 0) + (MathHelper.PiOver4 * -facingDir), 0.18f); + if (Utils.Distance(Projectile.Center, lastTargetCenter) > 250 && Projectile.velocity.Length() < 15) + Projectile.velocity += tailPlace.DirectionTo(lastTargetCenter) * 0.3f; + else + Projectile.velocity *= 0.96f; + if (lastTargetCenter.Y - 80 < tailPlace.Y) + Projectile.velocity.Y -= 0.7f; + + Projectile.velocity *= 0.99f; + if (attackDowntime > 35) // Reposition to somewhere on the other side of the target + { + Projectile.velocity.X += 0.8f * Math.Sign(lastTargetCenter.X - lastFirePositionX); + TailRotationBasedOnMovement(); + } + else + { + CheckForSpecialAttack(); + tailRot = MathHelper.Lerp(tailRot, 0, 0.1f); + } + if (attackTimer > 60) // Fire the missiles + { + Vector2 shootVel = tailPlace.DirectionTo(lastTargetCenter); + Vector2 shootPlace = tailPlace + shootVel * 10; + + lastFirePositionX = Projectile.Center.X; + SoundEngine.PlaySound(AqueousHunterDrone.Fire with { Volume = 0.7f, Pitch = 0.0f, PitchVariance = 0.3f, MaxInstances = 10 }, Projectile.Center); + + for (int i = 0; i < 13; i++) + { + bool noFall = !Main.rand.NextBool(5); + float variance = Main.rand.NextFloat(-0.7f, 0.7f); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(tailPlace, dustStyle); + dust.scale = Main.rand.NextFloat(1.4f, 1.8f) - Math.Abs(variance); + dust.velocity = shootVel.RotatedBy(variance) * Main.rand.NextFloat(9, 9.5f) * (1 - Math.Abs(variance)); + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = noFall ? 0 : 1.1f; + } + + Particle bolt2 = new CustomPulse(shootPlace, shootVel * 0.2f, Effects.ArsenalEffects.ArsenalPlasmaColor, "CalamityMod/Particles/BloomRing", new Vector2(0.5f, 1f), shootVel.ToRotation(), 0f, 0.6f, 23); + GeneralParticleHandler.SpawnParticle(bolt2); + for (int i = 0; i < 2; i++) + { + Particle spark = new CustomSpark(shootPlace, shootVel * 0.2f, "CalamityMod/Particles/BloomCircle", false, 28, 0.6f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1f, 0.5f), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + } + + for (int i = -1; i <= 1; i++) + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), shootPlace, shootVel.RotatedBy(0.5f * i) * 8, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, 0, 0, 0); + + doSpin = Main.rand.NextBool(5); + if (doSpin) + SoundEngine.PlaySound((Main.rand.NextBool() ? AqueousHunterDrone.Sound1 : AqueousHunterDrone.Sound2) with { Volume = 0.4f, Pitch = 0.2f, MaxInstances = 10 }, Projectile.Center); + tailRecoil = 25f; + Projectile.velocity += shootVel * (doSpin ? -18 : -9); + attackTimer = 0; + attackDowntime = 60; + } + attackTimer++; + } + public void TailRotationBasedOnMovement() + { + float sine = (float)Math.Sin(time * 0.1f / MathHelper.Pi); + tailRot = (sine * 0.2f) + 1.2f * (float)Math.Pow(Utils.GetLerpValue(0, 12 * facingDir, Projectile.velocity.X, true), 1.5f) * facingDir; + } + public void SetVisualPlacement() + { + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.05f / MathHelper.Pi); + Vector2 shake = new Vector2(3 * sine * (facingDir), 7 * sine2); + Vector2 visualPlace = Projectile.Center + shake + Vector2.UnitY * (surpriseTimer > 20 ? Utils.GetLerpValue(25, 20, surpriseTimer) : 1 - (float)Math.Pow(Utils.GetLerpValue(20, 15, surpriseTimer, true), 2)) * -25; + Vector2 tailDist = new Vector2((30 - Math.Abs(tailRot) * 15) * (-facingDir), 7 - Math.Abs(tailRot) * 3).RotatedBy(Projectile.rotation); + Vector2 headDist = new Vector2(0, 0); + Vector2 recoilPlace = ((Projectile.rotation - (facingDir == -1 ? MathHelper.Pi : 0) - (MathHelper.PiOver4 * -facingDir)).ToRotationVector2() * -tailRecoil); + headPlace = visualPlace + headDist; + tailPlace = visualPlace + tailDist + recoilPlace; + } + public void GrantBuffs(Player player) + { + bool isCorrectProjectile = Projectile.type == ModContent.ProjectileType(); + player.AddBuff(ModContent.BuffType(), 3600); + if (isCorrectProjectile) + { + if (player.dead) + { + player.Calamity().aqueousHunterDrone = false; + } + if (player.Calamity().aqueousHunterDrone) + { + Projectile.timeLeft = 2; + } + } + } + public override bool MinionContactDamage() => false; + public override bool PreDraw(ref Color lightColor) + { + Texture2D head = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBody").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpBodyGlow").Value; + Texture2D tail = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTail").Value; + Texture2D glow2 = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/ShrimpTailGlow").Value; + Texture2D spin = ModContent.Request("CalamityMod/Particles/CircularSmearSmokey").Value; + Color drawColor = Projectile.GetAlpha(lightColor); + bool left = facingDir == -1; + float rotation = Projectile.rotation; + + // Tail + Main.EntitySpriteDraw(tail, tailPlace - Main.screenPosition, null, drawColor, rotation + tailRot, new Vector2(left ? tail.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition, null, Color.White, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + float sine = (float)Math.Sin(time * 0.35f / MathHelper.Pi); + float headFadeIn = (float)Math.Pow(Utils.GetLerpValue(0, animationClickTime - 25, time, true), 8); + // Head + Main.EntitySpriteDraw(head, headPlace - Main.screenPosition, null, drawColor * headFadeIn, rotation + sine * 0.1f, head.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(glow, headPlace - Main.screenPosition, null, Color.White * headFadeIn, rotation + sine * 0.1f, glow.Size() * 0.5f, Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + // Spin effect + Main.EntitySpriteDraw(spin, Vector2.Lerp(headPlace, tailPlace, 0f) - Main.screenPosition, null, Effects.ArsenalEffects.ArsenalPlasmaColor with { A = 0 } * specialAttackfx, rotation * 1.8f, spin.Size() * 0.5f, Projectile.scale * 0.53f * specialAttackfx, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + if (tailRecoil > 0) // Glowing on the gun after firing + { + float fade = Utils.GetLerpValue(0, 15, tailRecoil, true); + for (int i = 0; i < 12; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 12f).ToRotationVector2() * (2 + 2 * fade); + Main.EntitySpriteDraw(glow2, tailPlace - Main.screenPosition + vel, null, Color.White with { A = 0 } * fade, rotation + tailRot, new Vector2(left ? glow2.Height : 0, 0), Projectile.scale, left ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + } + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/AugerHoldout.cs b/Projectiles/DraedonsArsenal/AugerHoldout.cs new file mode 100644 index 0000000000..50ddab506d --- /dev/null +++ b/Projectiles/DraedonsArsenal/AugerHoldout.cs @@ -0,0 +1,274 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Cooldowns; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static Terraria.Player; + + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AugerHoldout : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float attackTimer => ref Projectile.ai[0]; + public Player Owner => Main.player[Projectile.owner]; + public float scaleFx = 1; + public int fireRate => Owner.itemAnimationMax; + public int time = 0; + public bool longSwing => swingCount >= 2; + public int cooldown => -Owner.itemAnimationMax * (Owner.Calamity().buffedAuger ? 2 : longSwing ? 3 : 1); + public float bladeRot = 0; // Rotation of the blade + public int swingCount = 0; // Increases at the start of a swing + public float bladefx = 0; // Scaling on the effects of the blade + // Both checks to make sure sounds/hitboxes only happen once per swing + public bool makeSound = true; + public bool makeHitbox = true; + public int cooldownGiven => (int)(400 / Owner.GetAttackSpeed()); // Cooldown is effected by melee speed, lines up perfectly so you do 10 swings and end in time for a big swing + public float pullFx = 1; // Scaling on the effects of the blade when it's buffed + public bool pressedRight = false; + // Spawns a hitbox to do damage, rather than dealing damage itself + // Theres many reasons this is better, but at the very least it prevents bloating this single projectile's code + public override bool? CanDamage() => false; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 100; + Projectile.friendly = true; + Projectile.DamageType = TrueMeleeDamageClass.Instance; + Projectile.timeLeft = 5; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public void Positioning(Vector2 toMouse) // Hand and holdout positioning + { + Owner.heldProj = Projectile.whoAmI; + Owner.itemTime = Owner.itemAnimation = 2; + Owner.itemRotation = (Projectile.velocity * Owner.direction).ToRotation(); + + Owner.ChangeDir(Math.Sign(toMouse.X)); + Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, (toMouse.ToRotation() + bladeRot * Owner.direction + MathHelper.PiOver2 * -Owner.direction) + (Owner.direction == -1 ? MathHelper.Pi : 0)); + Vector2 handPos = Owner.GetFrontHandPosition(CompositeArmStretchAmount.None, Owner.compositeFrontArm.rotation) + (Owner.compositeFrontArm.rotation + MathHelper.PiOver2).ToRotationVector2() * 9; + float armRotation = (Utils.DirectionTo(Owner.Center, handPos).ToRotation() - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f); + Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, armRotation); + Projectile.velocity = toMouse.RotatedBy(bladeRot * Owner.direction); + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = handPos; + } + public void OnSpawn() + { + if (time == 0) + { + scaleFx = Owner.Calamity().buffedAuger ? 1.5f : 1; + attackTimer = cooldown; + if (Owner.Calamity().buffedAuger) + { + swingCount = 1; + } + } + } + public override void AI() + { + if (!Owner.CantUseHoldout(false)) + Projectile.timeLeft = 5; + + Vector2 toMouse = Utils.DirectionTo(Owner.Center, Owner.ClampedMouseWorld()); + + Positioning(toMouse); + + if (Owner.Calamity().mouseRight) + pressedRight = true; + + #region Right Click + if (Projectile.ai[2] > 0) // Right click "gravity well" and buff + { + if (Projectile.ai[2] == 5) + { + time = 0; + attackTimer = 0; + swingCount = -1; + makeHitbox = true; + Projectile.ai[2]--; + pullFx = 5; + } + if (bladefx > 0) + bladefx = 0; + bladeRot = 0; + pullFx = MathHelper.Lerp(pullFx, 1, 0.12f); + + if (attackTimer > fireRate && makeHitbox) + { + Projectile magnetZone = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ModContent.ProjectileType(), 0, 0, Projectile.owner, 0, 0, 0); + + SoundStyle pull = new("CalamityMod/Sounds/Item/AugerPull"); + SoundEngine.PlaySound(pull with { Volume = 0.9f, Pitch = 0 }, Owner.ClampedMouseWorld()); + Owner.Calamity().buffedAuger = true; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + makeHitbox = false; + } + if (attackTimer >= fireRate * 2) + { + Projectile.Kill(); + return; + } + time++; + attackTimer++; + return; + } + #endregion + + OnSpawn(); + + if (scaleFx > 1 && !Owner.Calamity().buffedAuger) // Fade out the extra size from the big blade + scaleFx = MathHelper.Lerp(scaleFx, 1, 0.15f * Owner.GetAttackSpeed()); + + #region Not Swinging + if (attackTimer < 0) // When the sword isn't swinging + { + if ((pressedRight || Owner.Calamity().mouseRight) && !Owner.Calamity().buffedAuger && Owner.Calamity().arsenalCooldown <= 0) + Projectile.ai[2] = 5; + else + pressedRight = false; + if (longSwing && attackTimer == -1) + { + swingCount = 0; + } + attackTimer++; + time++; + + if (longSwing && attackTimer <= cooldown * 0.35f) + { + float lerp = Utils.GetLerpValue(cooldown, -1, attackTimer, true); + bladefx = MathHelper.Lerp(bladefx, 0, lerp); + } + else + { + if (!Main.mouseLeft && longSwing && !Owner.Calamity().buffedAuger) + { + Projectile.Kill(); + return; + } + + float lerp = Utils.GetLerpValue((longSwing ? cooldown * 0.35f : cooldown), -1, attackTimer, true); + bladefx = MathHelper.Lerp(bladefx, 1.5f, lerp); + } + if (attackTimer >= cooldown * 0.3f) + { + if (makeSound && Owner.Calamity().buffedAuger) // Windup Sound + { + SoundStyle windup = new("CalamityMod/Sounds/Item/AugerWindup"); + SoundEngine.PlaySound(windup with { Volume = 0.9f, Pitch = 0 }, Projectile.Center); + makeSound = false; + } + } + if (attackTimer == 0) // Reset a few things in prep for the next swing + { + pressedRight = false; + swingCount++; + makeSound = true; + makeHitbox = true; + } + else // Wind up animation in prep for the next swing + { + int swingDir = (swingCount % 2 != 0 ? 1 : -1); + float lerp = Utils.GetLerpValue(cooldown, -1, attackTimer, true); + bladeRot = MathHelper.Lerp(-MathHelper.Pi * swingDir, -MathHelper.PiOver4 * 3 * swingDir, CalamityUtils.EaseInOutExp(lerp, 2f, 2f)); + } + return; + } + #endregion + + if (attackTimer >= fireRate) // Once the swing is done, put it on cooldown + { + attackTimer = cooldown * (Owner.Calamity().buffedAuger ? 3 : 1); + if (Owner.Calamity().buffedAuger) + { + Owner.Calamity().buffedAuger = false; + } + } + else // Do the swing + { + #region Swinging + int swingDir = (swingCount % 2 != 0 ? -1 : 1); + float lerp = Utils.GetLerpValue(0, fireRate - 1, attackTimer, true); + bladeRot = MathHelper.Lerp(-MathHelper.PiOver4 * 3 * swingDir, MathHelper.Pi * swingDir, CalamityUtils.EaseInOutExp(lerp, 5f, 3f)); + + if (lerp > 0.5f) // Halfway through make the hitbox and sound + { + if (makeHitbox) + { + SoundStyle swing = Owner.Calamity().buffedAuger ? new("CalamityMod/Sounds/Item/AugerBigSlash") : swingCount % 2 != 0 ? new("CalamityMod/Sounds/Item/AugerSlash1") : new("CalamityMod/Sounds/Item/AugerSlash2"); + SoundEngine.PlaySound(swing with { Volume = Owner.Calamity().buffedAuger ? 1f : 0.7f, Pitch = -0.1f, MaxInstances = 2 }, Projectile.Center); + + int damage = Projectile.damage; + if (Owner.Calamity().buffedAuger) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + damage = (int)(damage * 2.5f); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + toMouse * 20 * (float)Math.Pow(scaleFx, 4), toMouse * 25, ModContent.ProjectileType(), damage, 0, Projectile.owner, 0, swingCount, Owner.Calamity().buffedAuger ? 5 : 0); + makeHitbox = false; + } + } + #endregion + } + time++; + attackTimer++; + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 3) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/AugerHoldout").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/AugerHoldoutGlow").Value; + Texture2D blade = ModContent.Request("CalamityMod/Particles/GlowBlade").Value; + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + float randSize = Main.rand.NextFloat(0.8f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Owner.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Owner.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float lerp = Utils.GetLerpValue(0, fireRate - 1, attackTimer, true); + float length = MathHelper.Lerp(0f, 0.1f, CalamityUtils.EaseInOutExp(lerp, 1f, 1f)); + float bladeRotation = drawRotation + MathHelper.PiOver2 * Owner.direction; + Vector2 bladePlaceAdjust = (bladeRotation - MathHelper.PiOver2).ToRotationVector2(); + for (int i = 0; i < 2; i++) // The actual energy blade + Main.EntitySpriteDraw(blade, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation, new Vector2(blade.Width / 2, blade.Height), new Vector2((i == 0 ? 0.2f : 0.1f) * randSize, 0.2f * bladefx) * Projectile.scale * 0.07f * bladefx * scaleFx, SpriteEffects.None); + for (int i = 0; i < 2; i++) // The glow at the "hilt" + Main.EntitySpriteDraw(bloom, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation, bloom.Size() / 2, (Projectile.ai[2] > 0 ? new Vector2(randSize, randSize * (i == 0 ? 1f : 0.9f)) * 0.1f : new Vector2(0.15f * bladefx * randSize, (i == 0 ? 0.1f : 0.05f))) * Projectile.scale * 0.9f * (Projectile.ai[2] > 0 ? pullFx : bladefx) * scaleFx, SpriteEffects.None); + + if (scaleFx > 1) // Extra blade tips for the improved slash + { + for (int b = -2; b <= 2; b++) + { + if (b == 0) b++; + for (int i = 0; i < 2; i++) + { + Main.EntitySpriteDraw(blade, drawPosition + bladePlaceAdjust * 20, null, (i == 0 ? Effects.ArsenalEffects.ArsenalGaussColor : Color.White) with { A = 0 }, bladeRotation + (MathHelper.PiOver4 * 0.55f * b), new Vector2(blade.Width / 2, blade.Height), new Vector2(0.65f * (i == 0 ? 0.1f : 0.05f), 0.09f * (i == 0 ? 1f : 0.9f) * (2 - Math.Abs(b * 0.5f))) * randSize * Projectile.scale * 0.2f * bladefx * (scaleFx - 1), SpriteEffects.None); + } + } + } + Vector2 placeAdjust = (drawRotation + MathHelper.PiOver2).ToRotationVector2() * 2.5f; + Main.EntitySpriteDraw(texture, drawPosition + placeAdjust, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The holdout + + Main.EntitySpriteDraw(glow, drawPosition + placeAdjust, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); // The glow + + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } + } +} diff --git a/Projectiles/DraedonsArsenal/AugerHoldout.png b/Projectiles/DraedonsArsenal/AugerHoldout.png new file mode 100644 index 0000000000..ec5c4b477a Binary files /dev/null and b/Projectiles/DraedonsArsenal/AugerHoldout.png differ diff --git a/Projectiles/DraedonsArsenal/AugerHoldoutGlow.png b/Projectiles/DraedonsArsenal/AugerHoldoutGlow.png new file mode 100644 index 0000000000..63a21f6979 Binary files /dev/null and b/Projectiles/DraedonsArsenal/AugerHoldoutGlow.png differ diff --git a/Projectiles/DraedonsArsenal/AugerPull.cs b/Projectiles/DraedonsArsenal/AugerPull.cs new file mode 100644 index 0000000000..4362c1686c --- /dev/null +++ b/Projectiles/DraedonsArsenal/AugerPull.cs @@ -0,0 +1,109 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AugerPull : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public int time = 0; + public float sine = 0; + public float shrink = 1; + public int strongTimer = 0; + public bool strong => strongTimer < 10; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 250; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.timeLeft = 90; + Projectile.penetrate = -1; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + + public override void AI() + { + if (strongTimer == 0) + { + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 1.1f, 0.7f, 30); + GeneralParticleHandler.SpawnParticle(bolt2); + for (int i = 0; i < 20; i++) + { + Vector2 dustVel2 = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(10f, 15.5f); + Dust dust2 = Dust.NewDustPerfect(Projectile.Center + dustVel2.SafeNormalize(Vector2.UnitX) * 360, ModContent.DustType(), -dustVel2 * 1.5f, 0, default, Main.rand.NextFloat(1.2f, 1.8f)); + dust2.noGravity = true; + dust2.fadeIn = 0.3f; + dust2.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1) && Vector2.Distance(target.Center, Projectile.Center) < 650) + { + Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); + target.velocity = moveDir * 20; + target.Center += moveDir * 3f; + } + } + } + + Vector2 dustVel = (Vector2.UnitX).RotatedByRandom(100) * Main.rand.NextFloat(3f, 8.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + dustVel.SafeNormalize(Vector2.UnitX) * 120, Effects.ArsenalEffects.ArsenalGaussDust, -dustVel, 0, default, Main.rand.NextFloat(0.5f, 1f)); + dust.noGravity = true; + dust.fadeIn = 0.05f; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + + if (Projectile.timeLeft > 2) + { + for (int i = 0; i < Main.maxNPCs; i++) + { + NPC target = Main.npc[i]; + if (target != null && target.CanBeMoved(true) && Collision.CanHit(Projectile.Center, 1, 1, target.Center, 1, 1)) + { + if (Vector2.Distance(target.Center, Projectile.Center) > 15 && Vector2.Distance(target.Center, Projectile.Center) < 300) + { + Vector2 moveDir = target.Center.DirectionTo(Projectile.Center).SafeNormalize(Vector2.UnitX); + target.velocity = Vector2.Lerp(target.velocity, moveDir * 18, 0.12f); + target.Center += moveDir * 2f; + } + } + } + } + + Projectile.rotation += 0.05f; + if (shrink > 0) + shrink -= 0.05f; + else + shrink = 1; + + if (!strong) + time++; + strongTimer++; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false; + public override bool PreDraw(ref Color lightColor) + { + float shrinkFade = Math.Min(Utils.GetLerpValue(1, 0.7f, shrink, true), Utils.GetLerpValue(0f, 0.3f, shrink, true)); + float sine = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.1f / MathHelper.Pi), 0.4f, 0.8f)); + float sine2 = Math.Abs(MathHelper.Lerp((float)Math.Sin(time * 0.3f / MathHelper.Pi), 0.4f, 0.8f)); + float fade = (float)Math.Pow(Utils.GetLerpValue(0, 10, Projectile.timeLeft, true), 3); + float areaScale = (strong ? 1f : 1) * fade; + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/GlowSquareParticleBig").Value; + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * (strong ? 0.5f : 0.3f) * shrinkFade; + + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver4 - MathHelper.PiOver2 * sine * 3, tex2.Size() / 2f, (areaScale + sine * 0.5f) * shrink, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition, null, drawColor, MathHelper.PiOver2 * sine2 * 3, tex2.Size() / 2f, (areaScale - sine2 * 0.5f) * (float)Math.Pow(shrink, 2), SpriteEffects.None, 0); + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/AugerSlash.cs b/Projectiles/DraedonsArsenal/AugerSlash.cs new file mode 100644 index 0000000000..6ead6c5d0c --- /dev/null +++ b/Projectiles/DraedonsArsenal/AugerSlash.cs @@ -0,0 +1,155 @@ +using System; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class AugerSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float time => ref Projectile.ai[0]; + public float fade = 1; + public int lifetime = 25; + public Player Owner => Main.player[Projectile.owner]; + public float scaleFx => Projectile.ai[2] == 5 ? 2 : 1; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 120; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = lifetime; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + fade = (float)Math.Pow(Utils.GetLerpValue(lifetime * 0.1f, lifetime * 0.5f, Projectile.timeLeft, true), 4); + if (Projectile.velocity.Length() > 0.1f) + Projectile.velocity *= 0.45f; + int dusts = (int)(30 * scaleFx); + if (time == 1) + { + for (int i = 0; i < dusts; i++) + { + float variance = Utils.GetLerpValue(0, dusts, i, true) * Main.rand.NextFloat(0.9f, 1f); + float rot = MathHelper.Lerp(-0.7f * scaleFx, 0.7f * scaleFx, variance) * Projectile.direction; + float swingDirScale = Projectile.ai[1] == 1 ? (1 - variance) : variance; + float scale = 0.4f + swingDirScale * 2f; + float rotScaling = 1 - Math.Abs(rot); + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (70 / scaleFx + 80 * (float)Math.Pow(rotScaling, 1.5f) * Main.rand.NextFloat(0.85f, 1f)) * scaleFx; + Vector2 finalDustVel = (vel * (float)Math.Pow(rotScaling, 1.5f) + (vel.RotatedBy(-MathHelper.PiOver2 * rot) * 1.5f)) * 0.03f; + Dust s = Dust.NewDustPerfect(Projectile.Center + vel - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 45 * scaleFx, ModContent.DustType(), finalDustVel / scaleFx); + s.scale = scale * scaleFx; + s.noGravity = true; + s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Math.Max(0, swingDirScale - 0.35f)); + s.fadeIn = 0.1f + swingDirScale; + } + } + + Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, 0.3f).ToVector3() * 0.7f); + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0) + { + Projectile.numHits -= 1; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.ai[2] == 5) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) + { + if (p.timeLeft > 2) + p.timeLeft = 2; + } + } + } + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = (Projectile.ai[2] == 5 ? 35 : 14); + target.MoveNPC(launchVel, launchPower, true); + + if (Projectile.ai[2] == 5) + modifiers.SetCrit(); + + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + float minMult = 0.3f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= (Projectile.ai[2] == 5 ? (1f + critDamage) : 1) * damageMult; + + if (Projectile.numHits == 0) + { + SoundStyle hit = new("CalamityMod/Sounds/Item/AugerHit"); + SoundEngine.PlaySound(hit with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 2 }, target.Center); + } + if (Projectile.numHits < 4) + { + for (int i = 0; i < (14 - Projectile.numHits * 2); i++) + { + float rot = Main.rand.NextFloat(-0.3f, 0.3f); + Dust s = Dust.NewDustPerfect(target.Center, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(rot) * (float)Math.Pow(scaleFx, 1.5f) * Main.rand.NextFloat(8, 12) * (1 - Math.Abs(rot))); + s.scale = Main.rand.NextFloat(1.6f, 1.9f) * (1 - Math.Abs(rot)); + s.noGravity = true; + s.color = Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor, Color.White, Main.rand.NextFloat(0, 0.4f)); + s.fadeIn = -0.5f; + if (i % 3 != 0) + { + Dust s2 = Dust.NewDustPerfect(target.Center, Effects.ArsenalEffects.ArsenalGaussDust, Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.6f) * (float)Math.Pow(scaleFx, 1.5f) * Main.rand.NextFloat(5, 10)); + s2.scale = Main.rand.NextFloat(0.9f, 1.4f); + s2.noGravity = true; + s2.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + } + } + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (Projectile.timeLeft <= 10) + return false; + Player Owner = Main.player[Projectile.owner]; + Vector2 start = (time < 2 ? Owner.Center : Projectile.Center); + float scale = (scaleFx > 1 ? 1.5f : 1); + float length = 135 * scale; + float size = 135 * scale; + float _ = float.NaN; + bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); + return (hit); + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D proj = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/AugerSlash").Value; + + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }; + float drawRotation = Projectile.velocity.ToRotation(); + + float lerp = 1 - (float)Math.Pow((Utils.GetLerpValue(lifetime, 0, time, true)), 2f); + float sizeLerp = (float)Math.Pow((Utils.GetLerpValue(lifetime, lifetime * 0.2f, time, true)), 5f); + Vector2 squash = new Vector2(1 + lerp * 0.5f, 1.25f - lerp * 1.1f) * 0.08f * sizeLerp; + Vector2 rotationPoint = new Vector2(proj.Width * 0.85f, proj.Height / 2); + Vector2 drawPosition = Projectile.Center - Main.screenPosition + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 105; + + SpriteEffects spfx = (Projectile.ai[1] != 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + if (Projectile.direction == -1) + spfx = (Projectile.ai[1] == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(proj, drawPosition, null, Color.White with { A = 0 } * sizeLerp, drawRotation, rotationPoint, squash * Projectile.scale * scaleFx, spfx); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/AugerSlash.png b/Projectiles/DraedonsArsenal/AugerSlash.png new file mode 100644 index 0000000000..c2643dcb63 Binary files /dev/null and b/Projectiles/DraedonsArsenal/AugerSlash.png differ diff --git a/Projectiles/DraedonsArsenal/AugerSlashAlt.png b/Projectiles/DraedonsArsenal/AugerSlashAlt.png new file mode 100644 index 0000000000..38d9b158cb Binary files /dev/null and b/Projectiles/DraedonsArsenal/AugerSlashAlt.png differ diff --git a/Projectiles/DraedonsArsenal/CountermeasureMittFinger.png b/Projectiles/DraedonsArsenal/CountermeasureMittFinger.png new file mode 100644 index 0000000000..4872bab1bc Binary files /dev/null and b/Projectiles/DraedonsArsenal/CountermeasureMittFinger.png differ diff --git a/Projectiles/DraedonsArsenal/CountermeasureMittFinger2.png b/Projectiles/DraedonsArsenal/CountermeasureMittFinger2.png new file mode 100644 index 0000000000..c5619e167a Binary files /dev/null and b/Projectiles/DraedonsArsenal/CountermeasureMittFinger2.png differ diff --git a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs new file mode 100644 index 0000000000..2ee3ebc154 --- /dev/null +++ b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.cs @@ -0,0 +1,557 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.Player; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + [PierceResistException] + public class CountermeasureMittHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + + public float offsetBase = 0; + public override float MaxOffsetLengthFromArm => offsetBase; + public override float RecoilResolveSpeed => 0.4f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => 0.5f; + public bool forcePalm => Projectile.ai[2] != 0; // If you're performing a palm blast or not + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float fireRate => ref Projectile.ai[1]; + public int time = 0; + + // Finger lerps and rotations + #region Fingers + public float rotSpeed = 0; + public float f1l => 0.02f * rotSpeed; // Finger Lerp Speed + public float f1r = 0; // Finger Rotation + public float f1x = 0; // Finger Effects Multiplier + public float f1d = -0.95f; // Finger Aim Direction + public SlotId AudSlot1; // Finger Laser Audio Slot + public float f2l => 0.016f * rotSpeed; + public float f2r = 0; + public float f2x = 0; + public float f2d = -0.95f; + public SlotId AudSlot2; + public float f3l => 0.012f * rotSpeed; + public float f3r = 0; + public float f3x = 0; + public float f3d = -0.95f; + public SlotId AudSlot3; + public float f4l => 0.008f * rotSpeed; + public float f4r = 0; + public float f4x = 0; + public float f4d = -0.95f; + public SlotId AudSlot4; + public float f5l => 0.004f * rotSpeed; + public float f5r = 0; + public float f5x = 0; + public float f5d = -0.95f; + public SlotId AudSlot5; + #endregion + + public int palmAnimTime = 20; // Animation length for the palm attack + public int cooldownGiven = 400; // Arsenal Cooldown from the palm attack + public int attackTime = 100; // Attack cycle length + public int attackCycles = 0; + public bool failedManaCheck = false; + public bool canHit = false; + public float alteredRotationRot = 0.7f; // Alteration to the holdout rotation so it's not directly to the mouse, changes with the attack cycle + public float alteredRotation => Projectile.rotation + (f2r * alteredRotationRot * -Projectile.direction); + public Vector2 palmBlastPos => Owner.Center + alteredRotation.ToRotationVector2() * 55 * Projectile.scale; + public int palmManaCost => HeldItem.mana * 30; + public int hitTimer = 0; + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = -1; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ArmorPenetration = 55; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 5; + } + public override void KillHoldoutLogic() + { + + } + public override bool? CanDamage() => null; + public override bool? CanHitNPC(NPC target) + { + return (canHit ? null : false); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (!canHit) return false; + float realRot = alteredRotation; + Vector2 handPos = Owner.GetBackHandPosition(CompositeArmStretchAmount.None, Owner.compositeBackArm.rotation) + (Owner.compositeBackArm.rotation + MathHelper.PiOver2).ToRotationVector2() * 9; + + // Every laser has collision for the single hitbox, so it works more like a large wide piercing single beam + float beamLength = 1500 * Projectile.scale; + float beamThickness = 20 * Projectile.scale; + float fingerLength = 6 * Projectile.scale; + float _ = float.NaN; + + bool colCheck = false; + + #region 5 Collision Line Checks + for (int t = 0; t < 5; t++) + { + float rot = t switch + { + 1 => f4r * Projectile.direction, + 2 => f3r * Projectile.direction, + 3 => f2r * Projectile.direction, + 4 => f1r * Projectile.direction, + _ => -f5r * 0.3f * Projectile.direction, + }; + float fx = t switch + { + 1 => f4x, 2 => f3x, 3 => f2x, 4 => f1x, _ => f5x, + }; + + Vector2 basePosition = handPos + alteredRotation.ToRotationVector2() * (t == 0 ? 2.5f : 3.3f) * Projectile.scale + (alteredRotation + rot).ToRotationVector2() * fingerLength + (alteredRotation + MathHelper.PiOver2 * -Projectile.direction).ToRotationVector2() * (t == 0 ? -3 : 3) * Projectile.scale; + if (fx > 0.2f) + colCheck = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), basePosition, basePosition + (realRot + rot).ToRotationVector2() * (fingerLength + beamLength), beamThickness, ref _); + if (colCheck) + t = 5; + } + #endregion + + return (colCheck); + } + public void EndSounds() + { + if (SoundEngine.TryGetActiveSound(AudSlot1, out var s1)) + s1?.Stop(); + if (SoundEngine.TryGetActiveSound(AudSlot2, out var s2)) + s2?.Stop(); + if (SoundEngine.TryGetActiveSound(AudSlot3, out var s3)) + s3?.Stop(); + if (SoundEngine.TryGetActiveSound(AudSlot4, out var s4)) + s4?.Stop(); + if (SoundEngine.TryGetActiveSound(AudSlot5, out var s5)) + s5?.Stop(); + } + public override void HoldoutAI() + { + if (hitTimer > 0) + hitTimer--; + + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, (alteredRotation + MathHelper.PiOver2 * -Projectile.direction) + (Owner.direction == -1 ? MathHelper.Pi : 0)); + + Vector2 handPos = Owner.GetBackHandPosition(CompositeArmStretchAmount.None, Owner.compositeBackArm.rotation) + (Owner.compositeBackArm.rotation + MathHelper.PiOver2).ToRotationVector2() * 4; + float armRotation = (Utils.DirectionTo(Owner.Center, handPos).ToRotation() - MathHelper.PiOver2) * Owner.gravDir + (Owner.gravDir == -1 ? MathHelper.Pi : 0f); + Owner.SetCompositeArmFront(true, FrontArmStretch, armRotation + ExtraFrontArmRotation * Projectile.direction); + + // Below you see the sacrifice of coding 5 individual fingers + if (time == 0 && forcePalm) + { + rotSpeed = 7f; + alteredRotationRot = 0; + } + if (time == 1) + rotSpeed = 0; + + if (forcePalm) alteredRotationRot = MathHelper.Lerp(alteredRotationRot, 0, 0.1f); + else if (shootingTimer > -10) alteredRotationRot = MathHelper.Lerp(alteredRotationRot, 0.7f, 0.1f); + + #region The Price of 5 Fingers + float fxPower = 5; + if (!forcePalm) + { + if (shootingTimer == 10) f1d *= -1; + if (shootingTimer == 20) f2d *= -1; + if (shootingTimer == 30) f3d *= -1; + if (shootingTimer == 40) f4d *= -1; + if (shootingTimer == 50) f5d *= -1; + if (attackCycles == 0) + { + if (shootingTimer == 10) f1x = fxPower; + if (shootingTimer == 20) f2x = fxPower; + if (shootingTimer == 30) f3x = fxPower; + if (shootingTimer == 40) f4x = fxPower; + if (shootingTimer == 50) f5x = fxPower; + } + } + + f1r = MathHelper.Lerp(f1r, f1d, f1l * rotSpeed); + f2r = MathHelper.Lerp(f2r, f2d * 0.775f, f2l * rotSpeed); + f3r = MathHelper.Lerp(f3r, f3d * 0.55f, f3l * rotSpeed); + f4r = MathHelper.Lerp(f4r, f4d * 0.325f, f4l * rotSpeed); + f5r = MathHelper.Lerp(f5r, f5d * 2.3f - 2, f5l * 4 * rotSpeed); + + float goalValue = (canHit ? 1 : 0); + float lerpPower = (forcePalm ? 0.35f : canHit ? 0.2f : 0.25f); + f1x = MathHelper.Lerp(f1x, (f1x > 0.05f ? goalValue : 0), lerpPower); + f2x = MathHelper.Lerp(f2x, (f2x > 0.05f ? goalValue : 0), lerpPower); + f3x = MathHelper.Lerp(f3x, (f3x > 0.05f ? goalValue : 0), lerpPower); + f4x = MathHelper.Lerp(f4x, (f4x > 0.05f ? goalValue : 0), lerpPower); + f5x = MathHelper.Lerp(f5x, (f5x > 0.05f ? goalValue : 0), lerpPower); + + float sine = (float)Math.Sin(time * 0.2f / MathHelper.Pi) * 0.1f; + float maxVol = 0.4f; + float minPitch = -0.8f; + if (SoundEngine.TryGetActiveSound(AudSlot1, out var f1s) && f1s.IsPlaying) + { + f1s.Position = Projectile.Center; + f1s.Pitch = Utils.Remap(f1x, 0.7f, 1, 0f + minPitch, 0f) + sine; + f1s.Volume = Utils.Remap(f1x, 0, 1, 0f, maxVol) * 100; + } + else if (f1x > 1) + { + SoundStyle beam = new("CalamityMod/Sounds/Item/MittWelding/Weld1"); + AudSlot1 = SoundEngine.PlaySound(beam with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(AudSlot2, out var f2s) && f2s.IsPlaying) + { + f2s.Position = Projectile.Center; + f2s.Pitch = Utils.Remap(f2x, 0.7f, 1, 0.2f + minPitch, 0.2f) + sine; + f2s.Volume = Utils.Remap(f2x, 0, 1, 0f, maxVol) * 100; + } + else if (f2x > 1) + { + SoundStyle beam = new("CalamityMod/Sounds/Item/MittWelding/Weld2"); + AudSlot2 = SoundEngine.PlaySound(beam with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(AudSlot3, out var f3s) && f3s.IsPlaying) + { + f3s.Position = Projectile.Center; + f3s.Pitch = Utils.Remap(f3x, 0.7f, 1, 0.4f + minPitch, 0.4f) + sine; + f3s.Volume = Utils.Remap(f3x, 0, 1, 0f, maxVol) * 100; + } + else if (f3x > 1) + { + SoundStyle beam = new("CalamityMod/Sounds/Item/MittWelding/Weld3"); + AudSlot3 = SoundEngine.PlaySound(beam with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(AudSlot4, out var f4s) && f4s.IsPlaying) + { + f4s.Position = Projectile.Center; + f4s.Pitch = Utils.Remap(f4x, 0.7f, 1, 0.6f + minPitch, 0.6f) + sine; + f4s.Volume = Utils.Remap(f4x, 0, 1, 0f, maxVol) * 100; + } + else if (f4x > 1) + { + SoundStyle beam = new("CalamityMod/Sounds/Item/MittWelding/Weld4"); + AudSlot4 = SoundEngine.PlaySound(beam with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + if (SoundEngine.TryGetActiveSound(AudSlot5, out var f5s) && f5s.IsPlaying) + { + f5s.Position = Projectile.Center; + f5s.Pitch = Utils.Remap(f5x, 0.7f, 1, 0.8f + minPitch, 0.8f) + sine; + f5s.Volume = Utils.Remap(f5x, 0, 1, 0f, maxVol) * 100; + } + else if (f5x > 1) + { + SoundStyle beam = new("CalamityMod/Sounds/Item/MittWelding/Weld5"); + AudSlot5 = SoundEngine.PlaySound(beam with { Volume = 0.01f, Pitch = 0, IsLooped = true }, Projectile.Center); + } + #endregion + + Lighting.AddLight(Projectile.Center, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, 0.3f).ToVector3() * MathHelper.Clamp((f1x + f2x + f3x + f4x + f5x - 4f) * 2f, 0f, 0.7f)); + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1, 0.1f); + + if (time == 0) + { + if (!forcePalm) + shootingTimer = -40; + if (Projectile.ai[2] != 0) + Projectile.ai[2] = palmAnimTime; + fireRate = attackTime; + OffsetLengthFromArm = offsetBase; + } + if (shootingTimer < 0) + { + canHit = false; + // Light cooldown before firing + if (rotSpeed > 0) + rotSpeed -= 0.05f; + + if (shootingTimer == -1 || forcePalm) + { + if ((!Main.mouseLeft && !forcePalm) || failedManaCheck) + { + EndSounds(); + Projectile.Kill(); + return; + } + + attackCycles = 0; + fireRate = attackTime; + } + + } + if (Owner.Calamity().mouseRight && Owner.Calamity().arsenalCooldown <= 0 && !forcePalm && !failedManaCheck) + { + Projectile.ai[2] = 5; + shootingTimer = 0; + } + if (forcePalm) + { + if (!Owner.CheckMana(HeldItem, palmManaCost, false, false)) + { + failedManaCheck = true; + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + Projectile.ai[2] = 0; + return; + } + rotSpeed = 5; + + f1d = -Math.Abs(f1d); f2d = -Math.Abs(f2d); f3d = -Math.Abs(f3d); f4d = -Math.Abs(f4d); f5d = -Math.Abs(f5d); + + if (shootingTimer <= palmAnimTime) + { + if (shootingTimer == 1) + { + SoundStyle aud = new("CalamityMod/Sounds/Item/MittReadyPalm"); + SoundEngine.PlaySound(aud with { Volume = 1f, Pitch = 0 }, Projectile.Center); + } + if (shootingTimer == (int)(palmAnimTime * 0.8f)) + { + SoundStyle aud = new("CalamityMod/Sounds/Item/MittThrust"); + SoundEngine.PlaySound(aud with { Volume = 1f, Pitch = 0 }, Projectile.Center); + } + if (shootingTimer == palmAnimTime) + { + Shoot(); + Projectile.ai[2] = 0; + shootingTimer = -30; + rotSpeed = 0; + } + Lighting.AddLight(palmBlastPos, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, 0.3f).ToVector3() * (float)Math.Pow(Utils.GetLerpValue(0, palmAnimTime, shootingTimer), 2)); + } + if (shootingTimer > palmAnimTime * 0.8f) + Projectile.scale *= 1.25f; + canHit = false; + } + else if (shootingTimer >= 0) + { + if (!Main.mouseLeft) + shootingTimer = fireRate; + + if (shootingTimer < fireRate && !failedManaCheck) + { + canHit = true; + if (time % 3 == 0) + { + if (Owner.CheckMana(HeldItem, -1, true, false)) + { + if (rotSpeed < 1.1f) + rotSpeed += 0.1f; + } + else + { + SoundEngine.PlaySound(SoundID.MaxMana with { Pitch = -0.5f }, Projectile.Center); + failedManaCheck = true; + } + } + } + else + { + if (attackCycles < 1 && !failedManaCheck) + { + attackCycles++; + shootingTimer = 0; + } + else + shootingTimer = -30; + } + } + + time++; + shootingTimer++; + } + public void Shoot() + { + bool hitAnything = false; + bool oneFx = true; + float damageMult = 25; + foreach (NPC npc in Main.ActiveNPCs) + { + if (!npc.dontTakeDamage && (Main.zenithWorld || Utils.Distance(npc.Center, palmBlastPos) <= (80 + Math.Max(npc.width / 2, npc.height / 2)))) + { + hitAnything = true; + Vector2 pos = Vector2.Lerp(npc.Center, Projectile.Center, 0.35f); + Vector2 vel = Vector2.Lerp(Projectile.Center.DirectionTo(npc.Center), alteredRotation.ToRotationVector2(), 0.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel, ModContent.ProjectileType(), (int)(Projectile.damage * damageMult), 0, Projectile.owner, 0, npc.whoAmI); + if (oneFx) + { + for (int i = 0; i < 25; i++) + { + Dust dust = Dust.NewDustPerfect(pos, Effects.ArsenalEffects.ArsenalLaserDust, vel.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.4f) * Main.rand.NextFloat(10f, 35f), 0, default, Main.rand.NextFloat(1f, 1.8f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + dust.fadeIn = 20; + } + for (int i = 0; i < 2; i++) + { + Particle pulse = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 1, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 20, 0.08f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + GeneralParticleHandler.SpawnParticle(pulse); + Particle pulse1 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 15, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 18, 0.06f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + GeneralParticleHandler.SpawnParticle(pulse1); + Particle pulse2 = new CustomSpark(pos, vel.SafeNormalize(Vector2.UnitX) * 25, "CalamityMod/Particles/HighResHollowCircleHardEdgeAlt", false, 16, 0.04f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(2f, 0.7f), shrinkSpeed: -0.1f); + GeneralParticleHandler.SpawnParticle(pulse2); + } + oneFx = false; + } + damageMult -= 6; + if (damageMult < 1) + damageMult = 1; + } + } + if (hitAnything && Owner.CheckMana(HeldItem, palmManaCost, true, false)) + { + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + + SoundStyle aud = new("CalamityMod/Sounds/Item/MittHit"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(aud with { Volume = 0.8f, Pitch = 0, MaxInstances = 2 }, Projectile.Center); + Owner.Calamity().GeneralScreenShakePower = 8f; + } + else + { + Owner.Calamity().arsenalCooldown = (int)(cooldownGiven / 10); + Owner.AddCooldown(ArsenalPower.ID, (int)(cooldownGiven / 10)); + + for (int i = 0; i < 15; i++) + { + Dust dust = Dust.NewDustPerfect(palmBlastPos, ModContent.DustType(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(4f, 7f), 0, default, Main.rand.NextFloat(0.7f, 0.85f)); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + } + for (int i = 0; i < 2; i++) + { + Particle bloom = new CustomSpark(palmBlastPos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 15, 0.5f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 1f), true, true); + GeneralParticleHandler.SpawnParticle(bloom); + } + SoundStyle aud = new("CalamityMod/Sounds/Item/MittFail"); + SoundEngine.PlaySound(aud with { Volume = 1f, Pitch = 0 }, Projectile.Center); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (hitTimer == 0) + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(target.Center, Effects.ArsenalEffects.ArsenalLaserDust, Owner.Center.DirectionTo(target.Center).RotatedByRandom(0.3f) * Main.rand.NextFloat(9f, 13f), 0, default, Main.rand.NextFloat(0.6f, 1.1f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + dust.fadeIn = 10; + } + hitTimer = Projectile.localNPCHitCooldown; + } + else + { + Dust dust = Dust.NewDustPerfect(target.Center, Effects.ArsenalEffects.ArsenalLaserDust, Owner.Center.DirectionTo(target.Center).RotatedByRandom(0.2f) * Main.rand.NextFloat(6f, 9f), 0, default, Main.rand.NextFloat(0.3f, 0.7f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalLaserColor; + dust.alpha = 100; + dust.fadeIn = 10; + modifiers.SourceDamage *= 0.2f; + } + } + public override bool PreDraw(ref Color lightColor) + { + Vector2 handPos = Owner.GetBackHandPosition(CompositeArmStretchAmount.None, Owner.compositeBackArm.rotation) + (Owner.compositeBackArm.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * Projectile.scale; + Projectile.Center = handPos; + + if (time < 2) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/CountermeasureMittHoldout").Value; + + Texture2D finger = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/CountermeasureMittFinger2").Value; + Texture2D laser = ModContent.Request("CalamityMod/Particles/BloomLineFade").Value; + Texture2D laser2 = ModContent.Request("CalamityMod/Particles/BloomLineThick").Value; + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D diamond = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + + Vector2 drawPosition = handPos - Main.screenPosition; + Vector2 vel = alteredRotation.ToRotationVector2(); + + float randSize = Main.rand.NextFloat(0.8f, 1.3f); + float fadeIn = (float)Math.Pow(Utils.GetLerpValue(0, palmAnimTime, shootingTimer), 2); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = alteredRotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + float exRot = (Projectile.direction == -1 ? MathHelper.PiOver2 : 0); + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + float thrustCuttoff = palmAnimTime * 0.8f; + float pullBack = MathHelper.Lerp(0.2f, 1f, (float)Math.Pow(Utils.GetLerpValue(thrustCuttoff, 0, shootingTimer, true), 4)); + float pushOut = MathHelper.Lerp(0.2f, 1.5f, (float)Math.Pow(Utils.GetLerpValue(thrustCuttoff, palmAnimTime, shootingTimer, true), 5)); + float thrustMult = (float)(forcePalm ? (shootingTimer <= thrustCuttoff ? pullBack : pushOut) : 1); + Vector2 thrustAddition = vel * 10 * thrustMult - vel * 10; + + Main.EntitySpriteDraw(texture, drawPosition + thrustAddition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + for (int i = 0; i < 5; i++) + { + float fingerLength = 3f * Projectile.scale; + Vector2 fingerScale = new Vector2(1f, 1f) * Projectile.scale; + Vector2 fingerOrgin = new Vector2(0, finger.Height / 2); + + float rot = i switch + { + 1 => f4r * Projectile.direction, + 2 => f3r * Projectile.direction, + 3 => f2r * Projectile.direction, + 4 => f1r * Projectile.direction, + _ => -f5r * 0.3f * Projectile.direction, + }; + float fx = i switch + { + 1 => f4x, 2 => f3x, 3 => f2x, 4 => f1x, _ => f5x, + }; + Color fingerColor = Color.Lerp(drawColor, Color.Black, (4 - i) * 0.2f); + if (i == 0) + { + fingerScale = new Vector2(0.9f, 1f) * Projectile.scale; + fingerLength = 1f * Projectile.scale; + fingerColor = drawColor; + } + + Vector2 basePosition = handPos + vel * (i == 0 ? 2.5f : 3.3f) * Projectile.scale + thrustAddition + (alteredRotation + rot).ToRotationVector2() * fingerLength + (alteredRotation + MathHelper.PiOver2 * -Projectile.direction).ToRotationVector2() * (i == 0 ? -3 : 3) * Projectile.scale; + Main.EntitySpriteDraw(finger, basePosition - Main.screenPosition, null, fingerColor, alteredRotation + rot, fingerOrgin, fingerScale, SpriteEffects.None); + + Vector2 velocity = (alteredRotation + rot).ToRotationVector2(); + Main.EntitySpriteDraw(laser, basePosition - Main.screenPosition + velocity * 545 * Projectile.scale, null, Effects.ArsenalEffects.ArsenalLaserColor with { A = 0 } * fx, velocity.ToRotation() + MathHelper.PiOver2, laser.Size() / 2, new Vector2(2.5f * randSize * fx, 55f) * Projectile.scale * 0.01f, SpriteEffects.FlipVertically); + Main.EntitySpriteDraw(laser2, basePosition - Main.screenPosition + velocity * 545 * Projectile.scale, null, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, 0.3f) with { A = 0 } * fx, velocity.ToRotation() + MathHelper.PiOver2, laser2.Size() / 2, new Vector2(0.4f * Math.Min(fx, 1), 55f) * Projectile.scale * 0.01f, SpriteEffects.FlipVertically); + + for (int y = 0; y < 2; y++) + Main.EntitySpriteDraw(bloom, basePosition - Main.screenPosition + velocity * 7 * Projectile.scale, null, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, y) with { A = 0 } * (fx - 1), velocity.ToRotation() + MathHelper.PiOver2, bloom.Size() / 2, new Vector2(2 + 0.05f * (fx + 25), 1) * Projectile.scale * MathHelper.Lerp(fx, 1, 0.7f) * (0.03f - 0.01f * y), SpriteEffects.FlipVertically); + } + if (forcePalm) + { + for (int y = 0; y < 8; y++) + Main.EntitySpriteDraw(bloom, palmBlastPos - Main.screenPosition + thrustAddition, null, Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, y * 0.1f) with { A = 0 } * fadeIn * 0.25f, alteredRotation, bloom.Size() / 2, new Vector2(1f, 1f) * Projectile.scale * (0.3f - 0.02f * y) * randSize, SpriteEffects.FlipVertically); + } + return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + behindNPCsAndTiles.Add(index); + } + } +} diff --git a/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.png b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.png new file mode 100644 index 0000000000..389b6646b7 Binary files /dev/null and b/Projectiles/DraedonsArsenal/CountermeasureMittHoldout.png differ diff --git a/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs new file mode 100644 index 0000000000..fd31cc8a9b --- /dev/null +++ b/Projectiles/DraedonsArsenal/CountermeasurePalmBlast.cs @@ -0,0 +1,93 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class CountermeasurePalmBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public float fade => (float)Math.Pow(Utils.GetLerpValue(0, 13, Projectile.timeLeft, true), 4); + public bool onSpawn = true; + private NPC targeted = null; + public override void SetDefaults() + { + Projectile.width = 150; + Projectile.height = 150; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.penetrate = -1; + Projectile.timeLeft = 15; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalLaserColor.ToVector3() * 0.5f); + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (Projectile.ai[1] != -5) + targeted = Main.npc[(int)Projectile.ai[1]]; + if (targeted == null || !targeted.active) + { + targeted = Projectile.Center.ClosestNPCAt(150); + Projectile.ai[1] = -5; + } + if (time == 0) + { + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 25; + targeted.MoveNPC(launchVel, launchPower, true); + + Particle bloom = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, "CalamityMod/Particles/BloomCircle", false, 12, 0.7f, Effects.ArsenalEffects.ArsenalLaserColor, new Vector2(1f, 3f), true, true, shrinkSpeed: -0.5f, extraRotation: MathHelper.PiOver2); + GeneralParticleHandler.SpawnParticle(bloom); + } + time++; + } + + public override bool? CanHitNPC(NPC target) => (target == targeted) ? null : false; + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + float minMult = 0.25f; + int hitsToMinMult = 7; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult + critDamage; + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 40; + target.MoveNPC(launchVel, launchPower, true); + } + public override bool PreDraw(ref Color lightColor) + { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Texture2D beam = ModContent.Request("CalamityMod/Particles/BloomLineFade").Value; + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + float completion = Utils.GetLerpValue(15, 0, time); + for (int i = 0; i < 6; i++) + { + Color orbColor = Color.Lerp(Effects.ArsenalEffects.ArsenalLaserColor, Color.White, i * 0.04f) with { A = 0 } * 0.8f; + float scale = Projectile.scale * (0.05f + i * 0.01f) * 3; + + Main.EntitySpriteDraw(beam, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation, new Vector2(beam.Width / 2, beam.Height), new Vector2(0.3f * fade, 2 * completion) * scale, SpriteEffects.None); + Main.EntitySpriteDraw(bloom, Projectile.Center - Main.screenPosition, null, orbColor, Projectile.rotation + MathHelper.PiOver2, bloom.Size() * 0.5f, new Vector2(0.5f, 1 + 2 * completion) * scale * 3 * fade, SpriteEffects.None); + } + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs b/Projectiles/DraedonsArsenal/GatlingLaserProj.cs deleted file mode 100644 index afe5e4399e..0000000000 --- a/Projectiles/DraedonsArsenal/GatlingLaserProj.cs +++ /dev/null @@ -1,165 +0,0 @@ -using System; -using CalamityMod.Items; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using Terraria; -using Terraria.Audio; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class GatlingLaserProj : ModProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - private SlotId gatlingLaserLoopID; - private bool fireLasers = false; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 24; - Projectile.height = 58; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Magic; - } - - public override void AI() - { - Projectile.frameCounter++; - if (Projectile.frameCounter >= 13) - { - Projectile.frameCounter = 10; - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.frame = 0; - } - - if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out var ShootingSound) && ShootingSound.IsPlaying) - ShootingSound.Position = Projectile.Center; - Player player = Main.player[Projectile.owner]; - Vector2 playerRotation = player.RotatedRelativePoint(player.MountedCenter, true); - if (Projectile.type == ModContent.ProjectileType()) - { - if (Projectile.ai[0] < 5f) - Projectile.ai[0] += 1f; - - if (Projectile.ai[0] > 4f) - Projectile.ai[0] = 2f; - - // The Gatling Laser shoots every other frame (effective use time of 2). - int fireRate = 2; - Projectile.ai[1] += 1f; - bool shootThisFrame = false; - if (Projectile.ai[1] >= fireRate) - { - Projectile.ai[1] = 0f; - shootThisFrame = true; - } - - if (Projectile.soundDelay <= 0) - { - Projectile.soundDelay = fireRate * 6; - if (Projectile.ai[0] != 1f) - { - fireLasers = true; - Projectile.soundDelay *= 6; - gatlingLaserLoopID = SoundEngine.PlaySound(GatlingLaser.FireLoopSound, Projectile.Center); - } - } - if (shootThisFrame && Main.myPlayer == Projectile.owner && fireLasers) - { - Item gatling = player.ActiveItem(); - - // This grabs the weapon's current damage, taking current charge level into account. - int currentDamage = player.GetWeaponDamage(gatling); - - bool stillInUse = !player.CantUseHoldout(); - - // This both checks if the player has sufficient mana and consumes it if they do. - // If this is false, the Gatling Laser stops functioning. - bool hasMana = player.CheckMana(gatling, -1, true, false); - - // Checks if the Gatling Laser has sufficient charge to fire. If this is false, it stops functioning. - CalamityGlobalItem modItem = gatling.Calamity(); - bool hasCharge = modItem.Charge >= GatlingLaser.HoldoutChargeUse; - - if (stillInUse && hasMana && hasCharge) - { - float scaleFactor = player.ActiveItem().shootSpeed * Projectile.scale; - Vector2 laserDirection = playerRotation; - Vector2 aimDirection = Main.screenPosition + new Vector2(Main.mouseX, Main.mouseY) - laserDirection; - if (player.gravDir == -1f) - { - aimDirection.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - laserDirection.Y; - } - Vector2 projVelocity = Vector2.Normalize(aimDirection); - if (float.IsNaN(projVelocity.X) || float.IsNaN(projVelocity.Y)) - { - projVelocity = -Vector2.UnitY; - } - projVelocity *= scaleFactor; - if (projVelocity.X != Projectile.velocity.X || projVelocity.Y != Projectile.velocity.Y) - { - Projectile.netUpdate = true; - } - Projectile.velocity = projVelocity; - int type = ModContent.ProjectileType(); - float velocity = 3f; - laserDirection = Projectile.Center; - Vector2 spinningpoint = Vector2.Normalize(Projectile.velocity) * velocity; - - double spread = Math.PI / 32D; - spinningpoint = spinningpoint.RotatedBy(Main.rand.NextDouble() * 2D * spread - spread); - - if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y)) - { - spinningpoint = -Vector2.UnitY; - } - Vector2 projVelocitySpread = new Vector2(spinningpoint.X, spinningpoint.Y); - if (projVelocitySpread.Length() > 5f) - { - projVelocitySpread.Normalize(); - projVelocitySpread *= 5f; - } - float SpeedX = projVelocitySpread.X + Main.rand.Next(-1, 2) * 0.005f; - float SpeedY = projVelocitySpread.Y + Main.rand.Next(-1, 2) * 0.005f; - float ai0 = Projectile.ai[0] - 2f; // 0, 1, or 2 - - // Use charge when firing a laser. - modItem.Charge -= GatlingLaser.HoldoutChargeUse; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserDirection.X, laserDirection.Y, SpeedX, SpeedY, type, currentDamage, Projectile.knockBack, Projectile.owner, ai0, 0f); - } - else - { - ActiveSound result; - if (SoundEngine.TryGetActiveSound(gatlingLaserLoopID, out result)) - result.Stop(); - - SoundEngine.PlaySound(GatlingLaser.FireEndSound, Projectile.Center); - Projectile.Kill(); - } - } - } - Projectile.position = player.RotatedRelativePoint(player.MountedCenter, true) - Projectile.Size / 2f; - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.spriteDirection = Projectile.direction; - Projectile.timeLeft = 2; - player.ChangeDir(Projectile.direction); - player.heldProj = Projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/DraedonsArsenal/GatlingLaserProj.png b/Projectiles/DraedonsArsenal/GatlingLaserProj.png deleted file mode 100644 index c4b477bdc8..0000000000 Binary files a/Projectiles/DraedonsArsenal/GatlingLaserProj.png and /dev/null differ diff --git a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs b/Projectiles/DraedonsArsenal/GatlingLaserShot.cs deleted file mode 100644 index f1292b9b35..0000000000 --- a/Projectiles/DraedonsArsenal/GatlingLaserShot.cs +++ /dev/null @@ -1,137 +0,0 @@ -using System; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using ReLogic.Utilities; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.DraedonsArsenal -{ - public class GatlingLaserShot : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Misc"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private int dust = 182; - private Player Owner => Main.player[Projectile.owner]; - - private int Time = 0; - - public override void SetDefaults() - { - Projectile.width = 2; - Projectile.height = 2; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.extraUpdates = 100; - Projectile.timeLeft = 600; - } - - public override void AI() - { - Time++; - Lighting.AddLight(Projectile.Center, 0.2f, 0f, 0f); - if (Projectile.timeLeft % 11 == 0 && Time > 15 && Time < 460) - { - SparkParticle spark = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 1.7f, Color.Red); - GeneralParticleHandler.SpawnParticle(spark); - } - if (Projectile.timeLeft % 4 == 0 && Time > 15 && Time < 460) - { - SparkParticle spark2 = new SparkParticle(Projectile.Center, Projectile.velocity * 0.01f, false, 6, 0.4f, Color.White); - GeneralParticleHandler.SpawnParticle(spark2); - } - } - - public override void OnKill(int timeLeft) - { - int height = 20; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = height; - Projectile.Center = Projectile.position; - Projectile.damage = 0; - - LaserBurst(2.4f, 4.2f); // 60 dusts - - int inc; - for (int i = 0; i < 100; i = inc + 1) - { - int gatlingDust = Dust.NewDust(Projectile.Center, 6, 6, dust, 0f, 0f, 100, default, 1f); - float dustVelX = Main.dust[gatlingDust].velocity.X; - float dustVelY = Main.dust[gatlingDust].velocity.Y; - - if (dustVelX == 0f && dustVelY == 0f) - dustVelX = 1f; - - float dustVelocity = (float)Math.Sqrt(dustVelX * dustVelX + dustVelY * dustVelY); - dustVelocity = 4f / dustVelocity; - dustVelX *= dustVelocity; - dustVelY *= dustVelocity; - - Dust dust2 = Main.dust[gatlingDust]; - dust2.velocity *= 0.5f; - dust2.velocity.X = dust2.velocity.X + dustVelX; - dust2.velocity.Y = dust2.velocity.Y + dustVelY; - dust2.scale = 0.66f; - dust2.noGravity = true; - - inc = i; - } - } - - private void LaserBurst(float speed1, float speed2) - { - float angleRandom = 0.05f; - - int inc; - for (int j = 0; j < 4; j = inc + 1) - { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 200, default, 0.9f); - Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - Main.dust[burstDust].noGravity = true; - - Dust dust2 = Main.dust[burstDust]; - dust2.velocity *= 3f; - dust2 = Main.dust[burstDust]; - - burstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 100, default, 0.66f); - Main.dust[burstDust].position = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * (float)Main.rand.NextDouble() * Projectile.width / 2f; - - dust2 = Main.dust[burstDust]; - dust2.velocity *= 2f; - - Main.dust[burstDust].noGravity = true; - Main.dust[burstDust].fadeIn = 1f; - Main.dust[burstDust].color = Color.Crimson * 0.5f; - - dust2 = Main.dust[burstDust]; - - inc = j; - } - for (int k = 0; k < 2; k = inc + 1) - { - float dustSpeed = Main.rand.NextFloat(speed1, speed2); - Vector2 dustVel = new Vector2(dustSpeed, 0.0f).RotatedBy(Projectile.velocity.ToRotation()); - dustVel = dustVel.RotatedBy(-angleRandom); - dustVel = dustVel.RotatedByRandom(2.0f * angleRandom); - - int moreBurstDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dust, dustVel.X, dustVel.Y, 0, default, 1.2f); - Main.dust[moreBurstDust].position = Projectile.Center + Vector2.UnitX.RotatedByRandom(MathHelper.Pi).RotatedBy(Projectile.velocity.ToRotation()) * Projectile.width / 3f; - Main.dust[moreBurstDust].noGravity = true; - - Dust dust2 = Main.dust[moreBurstDust]; - dust2.velocity *= 0.5f; - dust2 = Main.dust[moreBurstDust]; - - inc = k; - } - } - } -} diff --git a/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs similarity index 98% rename from Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs rename to Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs index 4e18c7eadf..e1c2f33af3 100644 --- a/Projectiles/DraedonsArsenal/HolofiberImmolatorHoldout.cs +++ b/Projectiles/DraedonsArsenal/HolofibreImmolatorHoldout.cs @@ -11,10 +11,10 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.DraedonsArsenal { - public class HolofiberImmolatorHoldout : BaseGunHoldoutProjectile + public class HolofibreImmolatorHoldout : BaseGunHoldoutProjectile { public new string LocalizationCategory => "Projectiles.Misc"; - public override int AssociatedItemID => ModContent.ItemType(); + public override int AssociatedItemID => ModContent.ItemType(); public override float MaxOffsetLengthFromArm => 15f; public override float OffsetXUpwards => -0f; public override float BaseOffsetY => -0f; @@ -167,8 +167,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal float fade = Utils.GetLerpValue(chargeMax / 3, chargeMax, CurrentChargingFrames, true); - Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolator").Value; - Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofiberImmolatorGlow").Value; + Texture2D texture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofibreImmolator").Value; + Texture2D glowTexture = ModContent.Request("CalamityMod/Items/Weapons/DraedonsArsenal/HolofibreImmolatorGlow").Value; Vector2 drawPosition = Projectile.Center - Main.screenPosition; Color drawColor = Projectile.GetAlpha(lightColor); float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); diff --git a/Projectiles/DraedonsArsenal/ImmolationArrow.cs b/Projectiles/DraedonsArsenal/ImmolationArrow.cs index 313f5887a1..ec64b427de 100644 --- a/Projectiles/DraedonsArsenal/ImmolationArrow.cs +++ b/Projectiles/DraedonsArsenal/ImmolationArrow.cs @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal collideWithTiles = false; SoundStyle sound2 = new("CalamityMod/Sounds/Item/ImmolatorPreExplode"); SoundEngine.PlaySound(sound2 with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); - SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + SoundEngine.PlaySound(HolofibreImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -195,7 +195,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } SoundStyle sound = new("CalamityMod/Sounds/Item/ImmolatorPreExplode"); SoundEngine.PlaySound(sound with { Volume = 0.3f, Pitch = 0.5f }, Projectile.Center); - SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); + SoundEngine.PlaySound(HolofibreImmolator.PlasmaSound with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.3f, -0.4f) }, Projectile.Center); } } public override void OnKill(int timeLeft) diff --git a/Projectiles/DraedonsArsenal/ImmolationSpray.cs b/Projectiles/DraedonsArsenal/ImmolationSpray.cs index d30ccaafbd..91349cf6b1 100644 --- a/Projectiles/DraedonsArsenal/ImmolationSpray.cs +++ b/Projectiles/DraedonsArsenal/ImmolationSpray.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - SoundEngine.PlaySound(HolofiberImmolator.PlasmaSound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + SoundEngine.PlaySound(HolofibreImmolator.PlasmaSound with { Volume = 0.5f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.8f); diff --git a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs index e925397619..3ccb38ab25 100644 --- a/Projectiles/DraedonsArsenal/MountedScannerSummon.cs +++ b/Projectiles/DraedonsArsenal/MountedScannerSummon.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.NeedsUUID[Type] = true; @@ -114,6 +115,5 @@ namespace CalamityMod.Projectiles.DraedonsArsenal SoundEngine.PlaySound(CommonCalamitySounds.LaserCannonSound, Projectile.Center); } } - public override bool? CanDamage() => false; } } diff --git a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs index 9501d9e619..d29fe0dceb 100644 --- a/Projectiles/DraedonsArsenal/PoleWarperSummon.cs +++ b/Projectiles/DraedonsArsenal/PoleWarperSummon.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal { public new string LocalizationCategory => "Projectiles.Misc"; public float AngularOffset = 0f; - public const float MaximumRepulsionSpeed = 13f; + public const float MaximumRepulsionSpeed = 11f; + public const float ChargeTime = 45f; public float Time { get => Projectile.ai[0]; @@ -25,6 +26,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 0; @@ -43,7 +45,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.minion = true; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = 20; Projectile.DamageType = DamageClass.Summon; } @@ -56,7 +58,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Projectile.localAI[0] = 1f; } GrantBuffs(player); - NPC potentialTarget = Projectile.Center.MinionHoming(1400f, player); + NPC potentialTarget = Projectile.Center.MinionHoming(2000f, player); // Teleport near the target if very far away from them. if (!Projectile.WithinRange(player.Center, 4200f)) @@ -72,7 +74,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal else { NPCMovement(potentialTarget); - if (Time % 60f < 35f) + if (Time % ChargeTime < 35f) { RepelMovement(); } @@ -130,22 +132,22 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } } - if (Time % 60f < 20f) + if (Time % ChargeTime < 20f) { float offsetAngle = AngularOffset * 0.5f + (!North).ToInt() * MathHelper.Pi; Vector2 destination = npc.Center + Vector2.UnitY.RotatedBy(offsetAngle) * 180f; Projectile.velocity = (Projectile.velocity * 4f + Projectile.SafeDirectionTo(destination) * 10f) / 5f; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 25f; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 30f; Projectile.rotation = Projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } - else if (Time % 60f < 35f) + else if (Time % ChargeTime < 35f) { Projectile.velocity *= 0.96f; Projectile.rotation += 0.05f; } - else if (Time % 60f == 35f) + else if (Time % ChargeTime == 35f) { - Projectile.velocity = Projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 29f; + Projectile.velocity = Projectile.SafeDirectionTo(npc.Center, -Vector2.UnitY) * 20f; Projectile.rotation = Projectile.AngleTo(npc.Center) + MathHelper.PiOver2; } } @@ -155,8 +157,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // This does not incorporate attraction on purpose. Doing so causes the minions to very easily become distracted. foreach (Projectile p in Main.ActiveProjectiles) { - if (p.type == Projectile.type && - Projectile.Distance(p.Center) < 40f) + if (p.type == Projectile.type && Projectile.Distance(p.Center) < 40f) { PoleWarperSummon otherPole = (PoleWarperSummon)p.ModProjectile; if (otherPole.North != North) @@ -173,6 +174,8 @@ namespace CalamityMod.Projectiles.DraedonsArsenal } } + public override bool MinionContactDamage() => true; + public override bool PreDraw(ref Color lightColor) { Texture2D tex = TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/DraedonsArsenal/ShrimpBody.png b/Projectiles/DraedonsArsenal/ShrimpBody.png new file mode 100644 index 0000000000..6a9768e1f1 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBody.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png new file mode 100644 index 0000000000..5ddf245160 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpBodyGlow.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs new file mode 100644 index 0000000000..b38c669e64 --- /dev/null +++ b/Projectiles/DraedonsArsenal/ShrimpPlasmaMissile.cs @@ -0,0 +1,181 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class ShrimpPlasmaMissile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public NPC closestNPC; + public Vector2 offset = Vector2.Zero; + public bool hitTile = false; + public float randomRate = 0; + public float randomSize = 0; + public override void SetStaticDefaults() + { + //ProjectileID.Sets.SummonTagDamageMultiplier[Type] = 0f; // The balance people will say if this is needed + } + public override void SetDefaults() + { + Projectile.width = Projectile.height = 10; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.DamageType = DamageClass.Summon; + Projectile.timeLeft = 300; + Projectile.extraUpdates = 3; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 15; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + if (time == 0) + { + randomRate = Main.rand.NextFloat(1, 3); + randomSize = Main.rand.NextFloat(1, 5); + } + float sine = (float)Math.Sin(time * 0.075f / MathHelper.Pi * randomRate); + + if (time > 0 && Projectile.numHits == 0) + { + if (Utils.Distance(Owner.Center, Projectile.Center) < 1400) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * -0.01f, "CalamityMod/Particles/BloomCircle", false, 12, 0.18f, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(0.3f, 1), true, true, 0, false, false, 0.3f, glowCenterScale: 0.5f); + GeneralParticleHandler.SpawnParticle(spark); + } + if (Projectile.ai[2] == 0) + { + if (time > 10) + { + if (closestNPC == null || closestNPC.life <= 0 || !closestNPC.CanBeChasedBy()) + closestNPC = Projectile.Center.ClosestNPCAt(900); + if (closestNPC != null) + { + Projectile.timeLeft++; + float distMult = ((float)Math.Pow(Utils.GetLerpValue(140, 80, Projectile.Center.Distance(closestNPC.Center), true), 3)); + CalamityUtils.HomeInOnSelectedNPC(Projectile, closestNPC, true, 0.2f + 0.3f * distMult, 8, 0.99f - 0.1f * distMult, accelerate: true); + } + } + } + else + { + Vector2 goalPosition = Owner.Calamity().mouseWorld + offset; + int fallTime = 300 - (int)Projectile.ai[2] * Projectile.extraUpdates; + offset = Vector2.UnitX * sine * 15 * randomSize; + if (time == fallTime) + { + Projectile.timeLeft = 600; + Projectile.extraUpdates = 6; + Projectile.scale = 1.5f; + } + if (time > fallTime) + { + float distMult = (float)Math.Pow(Utils.GetLerpValue(480, 340, time, true), 3); + + Vector2 moveTo = (goalPosition - Projectile.Center).SafeNormalize(Vector2.UnitX); + + if (Projectile.velocity.Y < 8) + Projectile.velocity.Y += 0.1f; + Projectile.velocity.X += moveTo.X * 0.5f; + Projectile.velocity.X *= 0.975f; + } + else + Projectile.timeLeft++; + } + + if (Main.rand.NextBool(5)) + { + int dustStyle = Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.5f, 0.7f); + dust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.3f); + dust.noGravity = false; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = -0.2f; + } + } + if (Collision.SolidCollision(Projectile.Center, 8, 8) && Projectile.numHits == 0 && Projectile.ai[2] > 0 && Projectile.Center.Y > Owner.Calamity().mouseWorld.Y && Projectile.scale > 1) + { + hitTile = true; + Projectile.numHits = 1; + Explode(); + } + time++; + } + public void Explode() + { + float lifetimeMult = (hitTile ? 5 : 1); + if (hitTile) + Projectile.localNPCHitCooldown = 8; + Projectile.extraUpdates = 0; + Projectile.timeLeft = (int)(12 * lifetimeMult); + Projectile.velocity = Vector2.Zero; + for (int i = 0; i < (int)(12 * Projectile.scale); i++) + { + bool noFall = !Main.rand.NextBool(5); + int dustStyle = noFall ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalPlasmaDust; + Dust dust = Dust.NewDustPerfect(Projectile.Center, dustStyle); + dust.scale = Main.rand.NextFloat(0.9f, 1.7f) * (noFall ? 2 : 0.75f) * Projectile.scale; + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.TwoPi) * Main.rand.NextFloat(6.4f, 7.5f) * (noFall ? 0.7f : 1.2f) * Projectile.scale; + dust.noGravity = noFall; + dust.color = Effects.ArsenalEffects.ArsenalPlasmaColor; + dust.fadeIn = (noFall ? 4.5f * Projectile.scale : 1f); + } + SoundEngine.PlaySound(AqueousHunterDrone.Hit with { Volume = 0.4f * Projectile.scale, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 30 }, Projectile.Center); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.95f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.1f * Projectile.scale, 14); + GeneralParticleHandler.SpawnParticle(bolt2); + + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.75f, "CalamityMod/Particles/WaterFoam", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.77f * Projectile.scale, (int)(10 * lifetimeMult)); + GeneralParticleHandler.SpawnParticle(bolt3); + + Particle spark = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(17 * lifetimeMult), 0.6f * Projectile.scale, Effects.ArsenalEffects.ArsenalPlasmaColor, new Vector2(1, 1), true, true, 0, false, false); + GeneralParticleHandler.SpawnParticle(spark); + if (hitTile) + { + Particle spark2 = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, (int)(20 * lifetimeMult), 0.6f * Projectile.scale * lifetimeMult, Effects.ArsenalEffects.ArsenalPlasmaColor * 0.35f, new Vector2(1, 1), true, true, 0, false, false, glowOpacity: 0.35f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (Projectile.scale > 1) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 2.5f; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.numHits == 0) + { + Explode(); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + { + float minMult = 0.5f; + int hitsToMinMult = 8; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * 0.5f; + } + } + public override bool? CanDamage() => ((time > 5 && Projectile.ai[2] == 0) || (Projectile.scale > 1)) ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * (Projectile.numHits > 0 ? 10 : 1) * Projectile.scale, targetHitbox); + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/ShrimpTail.png b/Projectiles/DraedonsArsenal/ShrimpTail.png new file mode 100644 index 0000000000..ea5481c028 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTail.png differ diff --git a/Projectiles/DraedonsArsenal/ShrimpTailGlow.png b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png new file mode 100644 index 0000000000..0d7d5e8d71 Binary files /dev/null and b/Projectiles/DraedonsArsenal/ShrimpTailGlow.png differ diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index 45174b4fd5..8dc8930a27 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -186,7 +186,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal Vector2 origin = frame.Size() * 0.5f; Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 92); return false; } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index fc95a46d89..e9a7232cdd 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -42,6 +42,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -237,8 +238,6 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void OnSpawn(IEntitySource source) => DoVFXPulse(); - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs index 526dcb0227..e5c35b3a87 100644 --- a/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs +++ b/Projectiles/DraedonsArsenal/StarSwallowerSummon.cs @@ -28,6 +28,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal public override void SetStaticDefaults() { Main.projFrames[Type] = 12; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -292,7 +293,5 @@ namespace CalamityMod.Projectiles.DraedonsArsenal fallThrough = Projectile.Bottom.Y < FallThroughYPoint - 120f; return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/DraedonsArsenal/VulcanFlash.png b/Projectiles/DraedonsArsenal/VulcanFlash.png new file mode 100644 index 0000000000..3fc2d1e1d9 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanFlash.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldout.cs b/Projectiles/DraedonsArsenal/VulcanHoldout.cs new file mode 100644 index 0000000000..c2805e2ff1 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanHoldout.cs @@ -0,0 +1,268 @@ +using System; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanHoldout : BaseGunHoldoutProjectile + { + public new string LocalizationCategory => "Projectiles.Misc"; + public override int AssociatedItemID => ModContent.ItemType(); + + public float offsetBase = 35; + public override float MaxOffsetLengthFromArm => offsetBase; + public override float RecoilResolveSpeed => 0.2f; + public override float OffsetXUpwards => 0f; + public override float BaseOffsetY => 0f; + public override float OffsetYDownwards => 0f; + public override float WeaponTurnSpeed => (shootingTimer < 0 ? 0 : 0.35f); + public bool firingSpear => Projectile.ai[2] == 5; + public ref float shootingTimer => ref Projectile.ai[0]; + public ref float fireRate => ref Projectile.ai[1]; + public int time = 0; + public int maxShots = 25; + public int shotsToFire = 0; + public bool playRampDown = false; + public int shotsFired = 0; + public float heatVis = 0; + public float flashVis1 = 0; + public float flashVis2 = 0; + public float spearVis = 1; + public int cooldownGiven = 180; + public bool failedManaCheck = false; + public int spearFakeCooldown = 0; + + + public override void KillHoldoutLogic() + { + + } + public override void HoldoutAI() + { + if (flashVis1 > 0) flashVis1 -= 0.2f; if (flashVis1 < 0) flashVis1 = 0; + if (flashVis2 > 0) flashVis2 -= 0.2f; if (flashVis2 < 0) flashVis2 = 0; + + if (time == 0) + { + if (Owner.Calamity().arsenalCooldown > 0) + spearVis = 0; + shootingTimer = -20; + fireRate = Owner.HeldItem.useAnimation; + shotsToFire = maxShots; + OffsetLengthFromArm = offsetBase; + } + if (shootingTimer < 0) + { + // Light cooldown after firing + if (shootingTimer == -20 || shootingTimer == -1) + { + if ((!Main.mouseLeft && !firingSpear) || failedManaCheck) + { + Projectile.Kill(); + return; + } + } + if (playRampDown) + { + SoundStyle sound = new("CalamityMod/Sounds/Item/VulcanRampDown"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound with { Volume = 0.9f, MaxInstances = -1 }, Projectile.Center); + playRampDown = false; + } + if (shootingTimer == -20) + { + SoundStyle sound2 = new("CalamityMod/Sounds/Item/VulcanRampUp"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.9f, MaxInstances = -1 }, Projectile.Center); + } + if (shootingTimer == -1) + { + if (!firingSpear) + shootingTimer = fireRate; + else + shootingTimer = 0; + shotsToFire = maxShots; + fireRate = Owner.HeldItem.useAnimation; + shotsFired = 0; + playRampDown = true; + } + Projectile.velocity = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + } + if (Owner.Calamity().mouseRight && Owner.Calamity().arsenalCooldown <= 0) + { + Projectile.ai[2] = 5; + } + if (firingSpear && time > 20 && spearFakeCooldown <= 0) + { + Shoot(true); + spearFakeCooldown = 5; + shotsToFire = maxShots; + Projectile.ai[2] = 0; + Owner.Calamity().arsenalCooldown = cooldownGiven; + Owner.AddCooldown(ArsenalPower.ID, cooldownGiven); + } + if (shootingTimer >= 0) + { + if (!Main.mouseLeft && !firingSpear) + shotsToFire = 0; + + if (!firingSpear) + { + if (shotsToFire <= 0) + shootingTimer = -50; + else if (shootingTimer >= fireRate) + { + if (Owner.CheckMana(HeldItem, -1, true, false)) + { + Shoot(false); + + if (shotsFired % 2 == 0) flashVis1 = 1; + else flashVis2 = 1; + + shootingTimer = -1; + if (shotsToFire > maxShots * 0.2f) + { + fireRate -= 1; + if (fireRate < 3) + fireRate = 3; + } + else if (fireRate < Owner.HeldItem.useAnimation) + fireRate += 1; + if (fireRate > Owner.HeldItem.useAnimation) + fireRate = Owner.HeldItem.useAnimation; + + } + else + { + failedManaCheck = true; + shotsToFire = 0; + } + + shotsToFire--; + shotsFired++; + if (shotsToFire <= 0) + { + shootingTimer = -50; + } + } + } + } + if (shotsFired > 0 && shotsToFire > 0) + { + heatVis = MathHelper.Lerp(heatVis, 1, 0.007f); + } + else + heatVis = MathHelper.Lerp(heatVis, 0, 0.085f); + + spearVis = Utils.GetLerpValue(cooldownGiven / 2, 0, Owner.Calamity().arsenalCooldown, true); + spearFakeCooldown--; + + time++; + shootingTimer++; + } + public void Shoot(bool isSpear) + { + if (isSpear) + { + Vector2 spearPos = GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * 12 - Projectile.velocity * 8; + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0f) * 6f; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + OffsetLengthFromArm -= 16; + SoundStyle sound = new("CalamityMod/Sounds/Item/GunShotHeavy"); + SoundEngine.PlaySound(sound with { Volume = 0.8f, Pitch = 0.8f }, Projectile.Center); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spearPos, shootVelocity, ModContent.ProjectileType(), Projectile.damage * 5, 0, Projectile.owner); + } + else + { + Owner.Calamity().GeneralScreenShakePower = 1f; + OffsetLengthFromArm -= 7; + SoundStyle sound = new("CalamityMod/Sounds/Item/VulcanShot"); + SoundEngine.PlaySound(sound with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0), MaxInstances = 1 }, Projectile.Center); + + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0f) * 6f; + Vector2 position = GunTipPosition + Projectile.velocity.RotatedBy(MathHelper.PiOver2 * (shotsFired % 2 == 0 ? -1 : 1)) * 4; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, shootVelocity, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner); + + for (int i = 0; i < 4; i++) + { + Dust dust = Dust.NewDustPerfect(position, Main.rand.NextBool(3) ? ModContent.DustType() : Effects.ArsenalEffects.ArsenalGaussDust, (shootVelocity * 4).RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.8f), 0, default, Main.rand.NextFloat(0.7f, 1.1f)); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + } + } + } + public override bool PreDraw(ref Color lightColor) + { + if (time < 2) + return false; + + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldout").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutGlow").Value; + Texture2D flash = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanFlash").Value; + Texture2D spear = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpear").Value; + Texture2D spearGlow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpearGlow").Value; + Texture2D heat = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip").Value; + if (Owner.Calamity().arsenalCooldown <= 0 && false) + { + texture = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutSpear").Value; + glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow").Value; + } + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + float randSize = Main.rand.NextFloat(0.9f, 1f); + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + int draws = 8; + + Vector2 spearPos = GunTipPosition + vel.RotatedBy(MathHelper.PiOver2 * Projectile.direction) * 12 - vel * 27 - Main.screenPosition; + for (int i = 0; i < draws; i++) + { + float fadeIn = Math.Min(Utils.GetLerpValue(0, 0.8f, spearVis), (float)Math.Pow(Utils.GetLerpValue(1, 0.8f, spearVis), 2)); + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 6 * (1 - spearVis); + Main.EntitySpriteDraw(spear, spearPos + offset, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * fadeIn * 0.5f, drawRotation, spear.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(spear, spearPos, null, Color.Lerp(Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }, drawColor, spearVis) * spearVis, drawRotation, spear.Size() * 0.5f, Projectile.scale, flipSprite); + } + Main.EntitySpriteDraw(spearGlow, spearPos, null, Color.White * spearVis, drawRotation, spearGlow.Size() * 0.5f, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + Main.EntitySpriteDraw(glow, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + for (int i = 0; i < draws; i++) + { + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 4 * heatVis; + Main.EntitySpriteDraw(heat, drawPosition + offset, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * heatVis * 0.35f, drawRotation, heat.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(heat, drawPosition, null, Color.White with { A = 0 } * heatVis * 0.3f, drawRotation, heat.Size() * 0.5f, Projectile.scale, flipSprite); + } + + float tipSeperation = 4; + // Tip flash 1 + if (flashVis1 > 0) + { + Vector2 position = GunTipPosition + vel * (12 + 30 * (1 - flashVis1)) + vel.RotatedBy(MathHelper.PiOver2) * tipSeperation - Main.screenPosition; + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(flash, position, null, Color.White with { A = 0 } * flashVis1, drawRotation, flash.Size() * 0.5f, new Vector2(0.5f + 2f * (1 - flashVis1), 1 - 0.8f * flashVis1) * Projectile.scale, flipSprite); + } + // Tip flash 1 + if (flashVis2 > 0) + { + Vector2 position = GunTipPosition + vel * (12 + 30 * (1 - flashVis2)) + vel.RotatedBy(-MathHelper.PiOver2) * tipSeperation - Main.screenPosition; + for (int i = 0; i < 3; i++) + Main.EntitySpriteDraw(flash, position, null, Color.White with { A = 0 } * flashVis2, drawRotation, flash.Size() * 0.5f, new Vector2(0.5f + 2f * (1 - flashVis2), 1 - 0.8f * flashVis2) * Projectile.scale, flipSprite); + } + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanHoldout.png b/Projectiles/DraedonsArsenal/VulcanHoldout.png new file mode 100644 index 0000000000..3df7e215ab Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldout.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png b/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png new file mode 100644 index 0000000000..5a1c73ba6c Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutGlow.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png b/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png new file mode 100644 index 0000000000..a6efb3b878 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutHeatedTip.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png b/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png new file mode 100644 index 0000000000..5a4cb9de3d Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutSpear.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png b/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png new file mode 100644 index 0000000000..3eaba56e73 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanHoldoutSpearGlow.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanProjectile.cs b/Projectiles/DraedonsArsenal/VulcanProjectile.cs new file mode 100644 index 0000000000..8f805e1a94 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanProjectile.cs @@ -0,0 +1,116 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float time => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 720; + Projectile.extraUpdates = 8; + Projectile.penetrate = 1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + if (time > 120 && Projectile.penetrate > 1) + Projectile.penetrate = 1; + + if (time > 60 && Projectile.extraUpdates > 2 && time % 4 == 0) + Projectile.extraUpdates--; + + if (Projectile.velocity.Length() < 5) + Projectile.velocity *= 1.01f; + if (targetDist < 1400) + { + if (true) + { + Particle trail = new CustomSpark(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 6, 0.15f, Effects.ArsenalEffects.ArsenalGaussColor * 0.9f, new Vector2(1f, 1f), true, true, glowCenterScale: 0.6f, glowOpacity: 0.8f, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(trail); + } + if (time % 17 == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(4, 4), Effects.ArsenalEffects.ArsenalGaussDust); + dust.velocity = Vector2.One.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(0.1f, 0.2f); + dust.scale = Main.rand.NextFloat(0.7f, 0.85f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = time % 9 != 0; + dust.fadeIn = 0.3f; + } + } + + time++; + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + impactDust(); + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 4; + target.MoveNPC(launchVel, launchPower, true); + } + + public override void OnKill(int timeLeft) + { + impactDust(); + } + public void impactDust() + { + for (int i = 0; i < 3; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(9f, 19f); + dust.scale = Main.rand.NextFloat(0.6f, 0.85f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D proj = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanProjectile").Value; + proj = ModContent.Request("CalamityMod/Particles/SquareRotated").Value; + + Texture2D square = ModContent.Request("CalamityMod/Particles/GlowSquareParticleThick").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }; + float drawRotation = Projectile.velocity.ToRotation(); + Vector2 rotationPoint = proj.Size() * 0.5f; + + int rate = 50; + + float shrink = Utils.GetLerpValue(rate - 1, 0, time % rate); + float fade = Math.Min((float)Math.Pow(Utils.GetLerpValue(0, rate * 0.8f, time % rate, true), 3), (float)Math.Pow(Utils.GetLerpValue(rate - 1, rate * 0.8f, time % 30, true), 3)); + float speed = Utils.GetLerpValue(2, 10, Projectile.extraUpdates); + Vector2 squash = new Vector2(1 + 2 * speed, 1 - 0.3f * speed); + + for (int i = 0; i < 2; i++) + Main.EntitySpriteDraw(square, drawPosition, null, drawColor * fade * (1 - speed), drawRotation + MathHelper.PiOver4, square.Size() * 0.5f, Projectile.scale * (0.05f + 0.2f * shrink), SpriteEffects.None); + + + Main.EntitySpriteDraw(proj, drawPosition, null, drawColor, drawRotation, rotationPoint, squash * Projectile.scale * 0.1f, SpriteEffects.None); + Main.EntitySpriteDraw(proj, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, squash * Projectile.scale * 0.06f, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanProjectile.png b/Projectiles/DraedonsArsenal/VulcanProjectile.png new file mode 100644 index 0000000000..f5adc1fd7f Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanProjectile.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanSpear.cs b/Projectiles/DraedonsArsenal/VulcanSpear.cs new file mode 100644 index 0000000000..3d9bc39047 --- /dev/null +++ b/Projectiles/DraedonsArsenal/VulcanSpear.cs @@ -0,0 +1,199 @@ +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.DraedonsArsenal +{ + public class VulcanSpear : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Misc"; + public ref float time => ref Projectile.ai[0]; + + public NPC targeted; + public bool stuckInGround = false; + public bool canDamage => (targeted == null && !stuckInGround); + public bool canStick = true; + public int stuckTimer = 420; + public Vector2 placementCenter; + Vector2 placementVelocity; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 35; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.timeLeft = 1200; + Projectile.extraUpdates = 30; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Player Owner = Main.player[Projectile.owner]; + float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Lighting.AddLight(Projectile.Center, Effects.ArsenalEffects.ArsenalGaussColor.ToVector3() * 0.5f); + if (targetDist < 1400 && canDamage) + { + if (time % 2 == 0) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 14, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 12, 0.065f, Effects.ArsenalEffects.ArsenalGaussColor, new Vector2(1f, 2.5f), true, true, glowCenterScale: 0.7f, shrinkSpeed: 0.4f); + GeneralParticleHandler.SpawnParticle(trail); + } + } + + if (!stuckInGround && targeted == null && Collision.SolidCollision(Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * 15, 6, 6)) + { + Projectile.extraUpdates = 0; + stuckInGround = true; + SoundStyle hitTile = new("CalamityMod/Sounds/NPCHit/ExoHit3"); + SoundEngine.PlaySound(hitTile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + //Get stuck in the ground and fade + } + if (targeted != null && (!targeted.active || targeted.life <= 0)) + targeted = null; + if (targeted != null) + { + Projectile.Center = targeted.Center - placementCenter; + } + else if (Projectile.numHits > 0) + { + Projectile.timeLeft = 1; + } + if (stuckInGround || targeted != null) + { + foreach (Projectile p in Main.ActiveProjectiles) + { + float dist = Utils.Distance(Projectile.Center, p.Center); + if (p.type == ModContent.ProjectileType() && dist <= 900 && p.ai[0] > 120) + { + if (p.velocity.Length() < 6) + p.velocity += p.Center.DirectionTo(Projectile.Center) * Utils.GetLerpValue(1500, 50, dist) * 0.9f; + else + p.velocity *= 0.9f; + if (p.ai[0] % 2 == 0) + p.timeLeft += p.MaxUpdates; + } + } + } + if (!canDamage && Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + time++; + if (Projectile.timeLeft == 35) + { + SoundStyle sound2 = new("CalamityMod/Sounds/Item/VulcanRampUp"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.9f, MaxInstances = 5, Pitch = -0.4f }, Projectile.Center); + } + } + public override void OnKill(int timeLeft) + { + SoundStyle die = new("CalamityMod/Sounds/NPCHit/ExoHit2"); + SoundEngine.PlaySound(die with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.4f, 0.5f), MaxInstances = 5 }, Projectile.Center); + SoundStyle sound2 = new("CalamityMod/Sounds/Item/NidhoggFire"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(sound2 with { Volume = 0.8f, MaxInstances = 5, Pitch = -0.1f }, Projectile.Center); + foreach (Projectile p in Main.ActiveProjectiles) + { + float dist = Utils.Distance(Projectile.Center, p.Center); + if (p.type == ModContent.ProjectileType() && dist <= 500) + { + NPC closeTarget = p.Center.ClosestNPCAt(800); + if (closeTarget != null) + p.velocity = p.Center.DirectionTo(closeTarget.Center) * 7; + else + p.velocity = Projectile.Center.DirectionTo(p.Center) * 7; + p.extraUpdates = 8; + p.ai[0] = 0; + p.penetrate = 5; + if (p.ai[1] < 4) // Pretty much just so gfb can't oneshot everything + { + p.damage = (int)(p.damage * 2f); + p.ai[1]++; + } + p.timeLeft = Main.rand.Next(100, 120 + 1); + } + } + Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleThick", Vector2.One, MathHelper.PiOver4, 0.1f, 0.7f, 15); + GeneralParticleHandler.SpawnParticle(bolt); + Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Effects.ArsenalEffects.ArsenalGaussColor, "CalamityMod/Particles/GlowSquareParticleBig", Vector2.One, 0, 0.3f, 1.15f, 10); + GeneralParticleHandler.SpawnParticle(bolt2); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + impactDust(); + + Vector2 launchVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + float launchPower = 12; + target.MoveNPC(launchVel, launchPower, true); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (target.life <= 0 && target.realLife == -1) + { + // Don't stick into dead enemies + Projectile.numHits--; + } + else if (targeted == null && !stuckInGround) + { + //Stick + Projectile.extraUpdates = 0; + SoundStyle hitTile = new("CalamityMod/Sounds/NPCHit/ExoHit1"); + SoundEngine.PlaySound(hitTile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.1f, 0.2f) }, Projectile.Center); + targeted = target; + placementCenter = targeted.Center - Projectile.Center; + } + } + public override bool? CanDamage() => canDamage ? null : false; + public override bool ShouldUpdatePosition() + { + return canDamage; + } + public void impactDust() + { + for (int i = 0; i < 7; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType()); + dust.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.15f) * Main.rand.NextFloat(12f, 19f); + dust.scale = Main.rand.NextFloat(0.8f, 1.35f); + dust.noGravity = true; + dust.color = Effects.ArsenalEffects.ArsenalGaussColor; + dust.noLightEmittence = true; + } + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D proj = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpear").Value; + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/DraedonsArsenal/VulcanSpearGlow").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Vector2 vel = Projectile.rotation.ToRotationVector2(); + + Color drawColor = Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 }; + float drawRotation = Projectile.velocity.ToRotation() + (Projectile.direction == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = proj.Size() * 0.5f; + SpriteEffects flipSprite = Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(proj, drawPosition, null, lightColor, drawRotation, rotationPoint, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(glow, drawPosition, null, Color.White, drawRotation, rotationPoint, Projectile.scale, flipSprite); + + int draws = 16; + for (int i = 0; i < draws; i++) + { + float fadeIn = (float)Math.Pow(Utils.GetLerpValue(300, 1, Projectile.timeLeft, true), 3); + Vector2 offset = (MathHelper.TwoPi / draws * i).ToRotationVector2() * 3 * fadeIn; + Main.EntitySpriteDraw(proj, Projectile.Center - Main.screenPosition + offset + Main.rand.NextVector2Circular(3, 3) * fadeIn, null, Effects.ArsenalEffects.ArsenalGaussColor with { A = 0 } * fadeIn * 0.5f, drawRotation, proj.Size() * 0.5f, Projectile.scale, flipSprite); + Main.EntitySpriteDraw(proj, Projectile.Center - Main.screenPosition, null, Color.White with { A = 0 } * fadeIn, drawRotation, proj.Size() * 0.5f, Projectile.scale, flipSprite); + } + + return false; + } + } +} diff --git a/Projectiles/DraedonsArsenal/VulcanSpear.png b/Projectiles/DraedonsArsenal/VulcanSpear.png new file mode 100644 index 0000000000..cfcab36090 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanSpear.png differ diff --git a/Projectiles/DraedonsArsenal/VulcanSpearGlow.png b/Projectiles/DraedonsArsenal/VulcanSpearGlow.png new file mode 100644 index 0000000000..c010c5ec95 Binary files /dev/null and b/Projectiles/DraedonsArsenal/VulcanSpearGlow.png differ diff --git a/Projectiles/Enemy/AnglerFlash.cs b/Projectiles/Enemy/AnglerFlash.cs new file mode 100644 index 0000000000..87b54e1de2 --- /dev/null +++ b/Projectiles/Enemy/AnglerFlash.cs @@ -0,0 +1,66 @@ +using System.IO; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Enemy +{ + public class AnglerFlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 100; + Projectile.height = 100; + Projectile.hostile = true; + Projectile.alpha = 255; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.timeLeft = 30; + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + } + + public override void AI() + { + if (Projectile.ai[0] == 0) + { + GeneralParticleHandler.SpawnParticle(new BloomParticle(Projectile.Center, Vector2.Zero, Color.LightCyan, 1, 3, 30, true)); + Projectile.ai[0] = 1; + } + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 100, targetHitbox); + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool? CanHitNPC(NPC target) + { + if (LazarusLampfish.PredatorList.Contains(target.type)) + { + return true; + } + return null; + } + } +} diff --git a/Projectiles/Enemy/EarthRockBig.cs b/Projectiles/Enemy/EarthRockBig.cs index 6d24b0c175..53a8b9b58c 100644 --- a/Projectiles/Enemy/EarthRockBig.cs +++ b/Projectiles/Enemy/EarthRockBig.cs @@ -12,7 +12,6 @@ namespace CalamityMod.Projectiles.Enemy public new string LocalizationCategory => "Projectiles.Enemy"; public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 32; Projectile.height = 32; Projectile.hostile = true; diff --git a/Projectiles/Enemy/GhostBellShock.cs b/Projectiles/Enemy/GhostBellShock.cs new file mode 100644 index 0000000000..aad4009344 --- /dev/null +++ b/Projectiles/Enemy/GhostBellShock.cs @@ -0,0 +1,262 @@ +using System.Collections.Generic; +using System.IO; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Graphics.Primitives; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Enemy +{ + public class GhostBellShock : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Enemy"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + // Max aura size not accounting for babies + public static int MaxDefaultRadius => 160; + + // How much does each baby boost the size of the aura + public static int RadiusBoostPerBaby => 10; + + // Stores the ring points + public List points = []; + + // Stores the bolts which connect from the center to the ring + public List> bolts = []; + + // Stores the bolts which connect to babies + public List> jellyBolts = []; + + // Generic timer + public ref float Timer => ref Projectile.ai[0]; + // The jelly + public ref float Parent => ref Projectile.ai[1]; + // Size of the aura + public ref float CurrentRadius => ref Projectile.ai[2]; + // How many valid babies exist + public ref float CurrentBabies => ref Projectile.localAI[0]; + + public override void SetDefaults() + { + Projectile.width = MaxDefaultRadius * 2; + Projectile.height = MaxDefaultRadius * 2; + Projectile.hostile = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.tileCollide = false; + Projectile.alpha = 255; + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + CurrentBabies = reader.ReadSingle(); + } + + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(CurrentBabies); + } + + public override void OnSpawn(IEntitySource source) + { + RecalculateLists(); + } + + public override void AI() + { + bool validOwner = true; + int impactMoment = GhostBell.ElectrifyingPhaseDischarge; + + NPC n = Main.npc[(int)Parent - 1]; + if (n == null || !n.active || n.life < 0) + { + validOwner = false; + } + else + { + Projectile.Center = n.Center; + } + // Recalculate the prims to animate the lightning + if (Projectile.ai[0] % 5 == 0) + { + RecalculateLists(); + } + // Scale the aura size. More babies increases the size of the aura + CurrentRadius = MathHelper.Lerp(0, MaxDefaultRadius + (CurrentBabies * RadiusBoostPerBaby), Utils.GetLerpValue(impactMoment, impactMoment + 10, Timer, true)); + if (Timer == 0 && CurrentBabies > 0) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound with { Pitch = 1f }, Projectile.Center); + } + Timer++; + float pitch = (CurrentBabies > 0 && Timer < impactMoment) ? 1f : 0.4f; + if (Timer % 10 == 0 && (Timer >= impactMoment || CurrentBabies > 0)) + { + SoundEngine.PlaySound(SoundID.DD2_LightningBugZap with { Pitch = pitch }, Projectile.Center); + } + if (Timer == impactMoment) + { + SoundEngine.PlaySound(CommonCalamitySounds.LightningSound, Projectile.Center); + } + if (CurrentBabies > 0 || Timer >= impactMoment) + Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(CurrentRadius, CurrentRadius), DustID.Electric); + // Become opaque + if (Timer < (40 + impactMoment) && validOwner) + { + if (Projectile.alpha > 0) + Projectile.alpha -= 20; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + } + // become transparent and die + else + { + Projectile.alpha += 20; + if (Projectile.alpha >= 255) + { + Projectile.Kill(); + } + } + } + + public void RecalculateLists() + { + int ringPoints = 60; // How many times can the ring bend + int boltPoints = 12; // How many times can a bolt bend + int minimumBolts = 6; // Minimum number of bolts + int maximumBolts = 12; // Maximum number of bolts + int minimumSplits = 0; // Minimum number of split bolts + int maximumSplits = 2; // Maximum number of split bolts + points.Clear(); + bolts.Clear(); + jellyBolts.Clear(); + for (int i = 0; i < ringPoints; i++) + { + // The radius of the aura. Randomized to be electricky + float rad = CurrentRadius + Main.rand.Next(-20, 20); + // Determinte the end point + // This creates a circle with the given radius + Vector2 end = Vector2.UnitY.RotatedBy(MathHelper.Lerp(0, MathHelper.TwoPi + MathHelper.ToRadians(15), (i + 1) / (float)ringPoints)) * rad; + points.Add(Projectile.Center + end); + + // Randomly create more electric bolts that connect from the center to the ring + if (Main.rand.NextBool(ringPoints / Main.rand.Next(minimumBolts, maximumBolts))) + { + List bolt = []; + Vector2 start = Projectile.Center; + Vector2 boltEnd = Projectile.Center + end.RotatedByRandom(MathHelper.PiOver4); + + bolt.Add(start); + for (int j = 0; j < boltPoints; j++) + { + Vector2 dest = Vector2.Lerp(start, boltEnd, (j + 1) / (float)boltPoints); + Vector2 dif = dest - start; + Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(10)); + bolt.Add(newPoint); + + // UNUSED code that occasionally gives bolts their own smaller bolts + /*if (Main.rand.NextBool(boltPoints / Main.rand.Next(minimumSplits + 1, maximumSplits + 1)) && j > boltPoints / 2) + { + Main.NewText("Made a bolt"); + List boltSplit = []; + boltSplit.Add(newPoint); + for (int k = 0; k < boltPoints; k++) + { + Vector2 destSplit = Vector2.Lerp(newPoint, Projectile.Center + end.RotatedBy(MathHelper.PiOver4), (k + 1) / (float)boltPoints); + Vector2 difSplit = destSplit - newPoint; + Vector2 newPointSplit = newPoint + difSplit.RotatedByRandom(MathHelper.ToRadians(10)); + boltSplit.Add(newPointSplit); + } + boltSplit.Add(Projectile.Center + end.RotatedBy(MathHelper.PiOver4)); + bolts.Add(boltSplit); + }*/ + } + bolt.Add(boltEnd); + bolts.Add(bolt); + } + + // Re-add the first point so that the trail can form a full circle + if (i == ringPoints - 1) + { + points.Add(points[0]); + } + } + + // Count how many baby jellies exist and tie lightning to them + CurrentBabies = 0; + foreach (NPC n in Main.ActiveNPCs) + { + if (n.type != ModContent.NPCType()) + continue; + if (n.Distance(Projectile.Center) > 400) + continue; + + CurrentBabies++; + + List bolt = []; + Vector2 start = Projectile.Center; + Vector2 boltEnd = n.Center; + + bolt.Add(start); + for (int i = 0; i < boltPoints; i++) + { + Vector2 dest = Vector2.Lerp(start, boltEnd, (i + 1) / (float)boltPoints); + Vector2 dif = dest - start; + Vector2 newPoint = start + dif.RotatedByRandom(MathHelper.ToRadians(4)); + bolt.Add(newPoint); + } + bolt.Add(boltEnd); + jellyBolts.Add(bolt); + } + + Projectile.netUpdate = true; + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + if (info.Damage <= 0) + return; + + target.AddBuff(ModContent.BuffType(), 60); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.alpha <= 0 && CalamityUtils.CircularHitboxCollision(Projectile.Center, CurrentRadius, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(); + GameShaders.Misc["CalamityMod:TeslaTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ZapTrail")); + float opacity = 0.6f; + float jellyOpacity = 0.2f; + if (Timer >= GhostBell.ElectrifyingPhaseDischarge) + { + // The aura + PrimitiveRenderer.RenderTrail(points, new((float completion) => 4, (float completion) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + PrimitiveRenderer.RenderTrail(points, new((float completion) => 1, (float completion) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + // Bolts inside of the aura + for (int i = 0; i < bolts.Count; i++) + { + List boltPoints = bolts[i]; + PrimitiveRenderer.RenderTrail(boltPoints, new((float completion) => 3, (float completion) => Color.Cyan * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + PrimitiveRenderer.RenderTrail(boltPoints, new((float completion) => 1, (float completion) => Color.White * Projectile.Opacity * opacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + } + } + // Harmless bolts connecting to babies + for (int i = 0; i < jellyBolts.Count; i++) + { + List boltPoints = jellyBolts[i]; + PrimitiveRenderer.RenderTrail(boltPoints, new((float completion) => 2, (float completion) => Color.Cyan * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + PrimitiveRenderer.RenderTrail(boltPoints, new((float completion) => 1, (float completion) => Color.White * jellyOpacity, smoothen: true, shader: GameShaders.Misc["CalamityMod:TeslaTrail"])); + } + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Enemy/MantisRing.cs b/Projectiles/Enemy/MantisRing.cs index 002314546d..b2096ae397 100644 --- a/Projectiles/Enemy/MantisRing.cs +++ b/Projectiles/Enemy/MantisRing.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { - Projectile.Calamity().DealsDefenseDamage = true; Projectile.knockBack = 3f; Projectile.width = 72; Projectile.height = 30; diff --git a/Projectiles/Enemy/PodobooSpitUltima.cs b/Projectiles/Enemy/PodobooSpitUltima.cs index 7deb4e24c0..f955aef998 100644 --- a/Projectiles/Enemy/PodobooSpitUltima.cs +++ b/Projectiles/Enemy/PodobooSpitUltima.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Enemy public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size / 2; int numPoints = 92; PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => overallOffset, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), numPoints); diff --git a/Projectiles/Enemy/SulphuricAcidMist.cs b/Projectiles/Enemy/SulphuricAcidMist.cs index f1f5d6b825..2ad2cea566 100644 --- a/Projectiles/Enemy/SulphuricAcidMist.cs +++ b/Projectiles/Enemy/SulphuricAcidMist.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Enemy return; if (Projectile.Opacity >= 0.9f) - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 300); } } } diff --git a/Projectiles/Enemy/TornadoHostile.cs b/Projectiles/Enemy/TornadoHostile.cs index ed74fd0215..002c255f37 100644 --- a/Projectiles/Enemy/TornadoHostile.cs +++ b/Projectiles/Enemy/TornadoHostile.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Enemy public override void SetDefaults() { + Projectile.Calamity().DealsDefenseDamage = true; Projectile.width = 10; Projectile.height = 10; Projectile.hostile = true; diff --git a/Projectiles/Environment/BarrelCactusProjectile.cs b/Projectiles/Environment/BarrelCactusProjectile.cs new file mode 100644 index 0000000000..1033ada1a9 --- /dev/null +++ b/Projectiles/Environment/BarrelCactusProjectile.cs @@ -0,0 +1,54 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Environment +{ + public class BarrelCactusProjectile : ModProjectile, ILocalizedModType + { //I tried, someone else figure it out I bet YuH could do it + public new string LocalizationCategory => "Projectiles.Misc"; + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 1; + } + + public override void SetDefaults() + { + Projectile.CloneDefaults(ProjectileID.RollingCactus); + + Projectile.width = 32; + Projectile.height = 32; + + Projectile.damage = 70; + Projectile.knockBack = 6f; + + Projectile.friendly = false; + Projectile.hostile = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = tex.Bounds; + Vector2 origin = frame.Size() * 0.5f; + + Main.EntitySpriteDraw( + tex, + Projectile.Center - Main.screenPosition, + frame, + lightColor, + Projectile.rotation, + origin, + Projectile.scale, + SpriteEffects.None, + 0); + + return false; + } + } +} diff --git a/Projectiles/Environment/BarrelCactusProjectile.png b/Projectiles/Environment/BarrelCactusProjectile.png new file mode 100644 index 0000000000..1530195e19 Binary files /dev/null and b/Projectiles/Environment/BarrelCactusProjectile.png differ diff --git a/Projectiles/Environment/LargeBarrelCactusProjectile.png b/Projectiles/Environment/LargeBarrelCactusProjectile.png new file mode 100644 index 0000000000..0848fd8154 Binary files /dev/null and b/Projectiles/Environment/LargeBarrelCactusProjectile.png differ diff --git a/Projectiles/Healing/AbsorberAura.cs b/Projectiles/Healing/AbsorberAura.cs index 91fb6286d8..3d3ea8922c 100644 --- a/Projectiles/Healing/AbsorberAura.cs +++ b/Projectiles/Healing/AbsorberAura.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) + if (player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/AltTransfusionTrail.cs b/Projectiles/Healing/AltTransfusionTrail.cs index cb362dbc53..48eec7e713 100644 --- a/Projectiles/Healing/AltTransfusionTrail.cs +++ b/Projectiles/Healing/AltTransfusionTrail.cs @@ -17,13 +17,11 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; - Projectile.penetrate = 1; - Projectile.timeLeft = 600; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 5; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Healing/BlueJellyAura.cs b/Projectiles/Healing/BlueJellyAura.cs index 1282ea8349..137e066c5a 100644 --- a/Projectiles/Healing/BlueJellyAura.cs +++ b/Projectiles/Healing/BlueJellyAura.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) + if (player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/FungalHeal.cs b/Projectiles/Healing/FungalHeal.cs index 1dcb6e2a4f..bcf3dcdf59 100644 --- a/Projectiles/Healing/FungalHeal.cs +++ b/Projectiles/Healing/FungalHeal.cs @@ -12,18 +12,16 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; - Projectile.penetrate = 1; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 300; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 3f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 4f, 15f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.BlueFairy, 0f, 0f, 100); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; diff --git a/Projectiles/Healing/GreenJellyAura.cs b/Projectiles/Healing/GreenJellyAura.cs index 3b41df93d3..7941337d59 100644 --- a/Projectiles/Healing/GreenJellyAura.cs +++ b/Projectiles/Healing/GreenJellyAura.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Healing for (int l = 0; l < Player.MaxBuffs; l++) { int buffID = player.buffType[l]; - if (player.buffTime[l] > 2 && DebuffsList.Includes(buffID)) + if (player.buffTime[l] > 2 && CalamityBuffSets.IsDebuff[buffID]) { player.buffTime[l] *= 0; } diff --git a/Projectiles/Healing/HydrothermicHealOrb.cs b/Projectiles/Healing/HydrothermicHealOrb.cs index e1df042f9f..fc4d2cbd1d 100644 --- a/Projectiles/Healing/HydrothermicHealOrb.cs +++ b/Projectiles/Healing/HydrothermicHealOrb.cs @@ -13,18 +13,16 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 8f, 15f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; diff --git a/Projectiles/Healing/IridescentExcaliburHeal.cs b/Projectiles/Healing/IridescentExcaliburHeal.cs deleted file mode 100644 index c71e6050d7..0000000000 --- a/Projectiles/Healing/IridescentExcaliburHeal.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class IridescentExcaliburHeal : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Healing"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.tileCollide = false; - Projectile.extraUpdates = 3; - } - - public override void AI() - { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 10f, 15f); - - Color dustColor = Color.White; - switch (Main.rand.Next(3)) - { - default: - case 0: - dustColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); - break; - - case 1: - dustColor = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB); - break; - - case 2: - dustColor = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1); - break; - } - - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 278, 0f, 0f, 100); - Main.dust[dust].color = dustColor; - Main.dust[dust].fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; - Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; - } - } -} diff --git a/Projectiles/Healing/ManaPolarizerHealOrb.cs b/Projectiles/Healing/ManaPolarizerHealOrb.cs index c2dbdacf55..a0a0bfcf7f 100644 --- a/Projectiles/Healing/ManaPolarizerHealOrb.cs +++ b/Projectiles/Healing/ManaPolarizerHealOrb.cs @@ -13,18 +13,16 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.penetrate = 1; Projectile.tileCollide = false; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 4f, 15f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.SpectreStaff, 0f, 0f, 100); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; diff --git a/Projectiles/Healing/ReaverHealOrb.cs b/Projectiles/Healing/ReaverHealOrb.cs deleted file mode 100644 index 23d5fb22c0..0000000000 --- a/Projectiles/Healing/ReaverHealOrb.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class ReaverHealOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Healing"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.tileCollide = false; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; - } - - public override void AI() - { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 5f, 15f); - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.GreenFairy, 0f, 0f, 100); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0f; - Main.dust[dust].position.X -= Projectile.velocity.X * 0.2f; - Main.dust[dust].position.Y += Projectile.velocity.Y * 0.2f; - } - } -} diff --git a/Projectiles/Healing/RoyalHeal.cs b/Projectiles/Healing/RoyalHeal.cs index 145c21fc49..fb596b3b52 100644 --- a/Projectiles/Healing/RoyalHeal.cs +++ b/Projectiles/Healing/RoyalHeal.cs @@ -13,18 +13,16 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; Projectile.tileCollide = false; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 5; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() { - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 18f, 10f); + Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 12f, 10f); int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PurificationPowder, 0f, 0f, 100); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0f; diff --git a/Projectiles/Healing/ShinobiHealOrb.cs b/Projectiles/Healing/ShinobiHealOrb.cs index 7a507a57a0..062146f90e 100644 --- a/Projectiles/Healing/ShinobiHealOrb.cs +++ b/Projectiles/Healing/ShinobiHealOrb.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Healing Projectile.width = Projectile.height = 20; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.penetrate = -1; Projectile.MaxUpdates = 5; Projectile.timeLeft = 120 * Projectile.MaxUpdates; } diff --git a/Projectiles/Healing/SilvaOrb.cs b/Projectiles/Healing/SilvaOrb.cs deleted file mode 100644 index 1d12d7230d..0000000000 --- a/Projectiles/Healing/SilvaOrb.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Healing -{ - public class SilvaOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Healing"; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 22; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; - Projectile.extraUpdates = 3; - Projectile.tileCollide = false; - } - - public override void AI() - { - Projectile.alpha -= 2; - if (Projectile.localAI[0] == 0f) - { - Projectile.scale += 0.05f; - if (Projectile.scale > 1.2f) - Projectile.localAI[0] = 1f; - } - else - { - Projectile.scale -= 0.05f; - if (Projectile.scale < 0.8f) - Projectile.localAI[0] = 0f; - } - - Projectile.HealingProjectile((int)Projectile.ai[1], (int)Projectile.ai[0], 6f, 15f); - return; - } - - public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha); - - public override void OnKill(int timeLeft) - { - for (int i = 0; i < 5; i++) - { - int silvaHeal = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, 0f, 0f, 0, new Color(Main.DiscoR, 203, 103), 1.5f); - Main.dust[silvaHeal].noGravity = true; - Main.dust[silvaHeal].velocity *= 0f; - } - } - } -} diff --git a/Projectiles/Healing/SilvaOrb.png b/Projectiles/Healing/SilvaOrb.png deleted file mode 100644 index 37597f4cad..0000000000 Binary files a/Projectiles/Healing/SilvaOrb.png and /dev/null differ diff --git a/Projectiles/Healing/TransfusionTrail.cs b/Projectiles/Healing/TransfusionTrail.cs index 55d1326d47..289be6034b 100644 --- a/Projectiles/Healing/TransfusionTrail.cs +++ b/Projectiles/Healing/TransfusionTrail.cs @@ -13,13 +13,11 @@ namespace CalamityMod.Projectiles.Healing public override void SetDefaults() { - Projectile.width = 4; - Projectile.height = 4; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.width = Projectile.height = 4; Projectile.friendly = true; Projectile.tileCollide = false; - Projectile.extraUpdates = 3; + Projectile.MaxUpdates = 4; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Magic/AnahitasArpeggioNote.cs b/Projectiles/Magic/AnahitasArpeggioNote.cs index 2c779ac44d..3d78d39107 100644 --- a/Projectiles/Magic/AnahitasArpeggioNote.cs +++ b/Projectiles/Magic/AnahitasArpeggioNote.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Weapons.Magic; using CalamityMod.NPCs; +using CalamityMod.Projectiles.Ranged; using CalamityMod.Systems; using Microsoft.Xna.Framework; +using ReLogic.Utilities; using System; using System.IO; using Terraria; @@ -22,7 +24,9 @@ namespace CalamityMod.Projectiles.Magic public int LingeringTime = 300; public int FadeOutTime = 20; public bool HasSetFadeOutVelocity = false; + public Vector2 ReleaseCenterPoint = Vector2.Zero; public float _randomReleaseRotationOffset; + public SlotId StupidEasterEggSlot; public Player Owner => Main.player[Projectile.owner]; @@ -63,8 +67,23 @@ namespace CalamityMod.Projectiles.Magic Projectile.localAI[0] = 0f; } + // Sound business if (Timer == 1f) - SoundEngine.PlaySound(new("CalamityMod/Sounds/Item/HarpLV" + Math.Clamp((int)NoteSequence + 1, 1, 6)), Owner.Center); + { + if (Main.zenithWorld) + { + if (NoteSequence == 0f) + StupidEasterEggSlot = SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GFB/SevenTrebleClefSouls"), Owner.Center); + } + else + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/HarpLV" + Math.Clamp((int)NoteSequence + 1, 1, 6)) with { Volume = 0.8f }, Owner.Center); + } + // They did not obey me + // Big shoutouts to NotRyo for making this Finale remix out of harp notes + if (Main.zenithWorld && NoteSequence == 0f && Timer % 2428f == 0f && AIState == 0f) + StupidEasterEggSlot = SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/GFB/SevenTrebleClefSouls"), Owner.Center); + if (SoundEngine.TryGetActiveSound(StupidEasterEggSlot, out var TrebleSoul) && TrebleSoul.IsPlaying) + TrebleSoul.Position = Owner.Center; if (Main.zenithWorld) Lighting.AddLight(Projectile.Center, 1.25f, 1.25f, 1.25f); @@ -114,12 +133,19 @@ namespace CalamityMod.Projectiles.Magic Vector2 mouse = Owner.ClampedMouseWorld(); Projectile.Center = mouse + musicNoteRotationOffset * 220f; + ReleaseCenterPoint = mouse; playerDirection = Projectile.Center - mouse; playerDirection.Normalize(); - playerDirection *= -9.2f; + playerDirection *= -13f; Projectile.velocity = playerDirection; - SoundEngine.PlaySound(AnahitasArpeggio.EndSound, Projectile.Center); + if (Main.zenithWorld) + { + if (SoundEngine.TryGetActiveSound(StupidEasterEggSlot, out var Flowey)) + Flowey?.Stop(); + } + else + SoundEngine.PlaySound(AnahitasArpeggio.EndSound with { Volume = 0.8f }, Projectile.Center); AIState = 2f; } } @@ -142,9 +168,18 @@ namespace CalamityMod.Projectiles.Magic // Slow down quickly if (Projectile.velocity.Length() > 0.5f) - Projectile.velocity *= 0.95f; + Projectile.velocity *= 0.925f; else + { Projectile.velocity = Vector2.Zero; + + // Makes the notes slowly follow the mouse and rotate + Vector2 centerPointDirection = (Owner.Calamity().mouseWorld - ReleaseCenterPoint).SafeNormalize(Vector2.Zero); + float distToMove = MathF.Min(2.75f, Vector2.Distance(Owner.Calamity().mouseWorld, ReleaseCenterPoint)); // The constant value is the maximum chase speed + ReleaseCenterPoint += centerPointDirection * distToMove; + Projectile.Center += centerPointDirection * distToMove; + Projectile.Center = ReleaseCenterPoint + Utils.DirectionTo(ReleaseCenterPoint, Projectile.Center).RotatedBy(MathHelper.Pi * 0.01f) * Vector2.Distance(ReleaseCenterPoint, Projectile.Center); + } } } @@ -202,7 +237,6 @@ namespace CalamityMod.Projectiles.Magic } public override void SendExtraAI(BinaryWriter writer) => writer.Write(_randomReleaseRotationOffset); - public override void ReceiveExtraAI(BinaryReader reader) => _randomReleaseRotationOffset = reader.ReadSingle(); } } diff --git a/Projectiles/Magic/ArtAttackStar.cs b/Projectiles/Magic/ArtAttackStar.cs index e1da468182..f9c7c7e233 100644 --- a/Projectiles/Magic/ArtAttackStar.cs +++ b/Projectiles/Magic/ArtAttackStar.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Magic Vector2 origin = texture.Size() * 0.5f; Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), 180); diff --git a/Projectiles/Magic/AstralachneaFang.cs b/Projectiles/Magic/AstralachneaFang.cs index cf5ed838f9..5619a355ec 100644 --- a/Projectiles/Magic/AstralachneaFang.cs +++ b/Projectiles/Magic/AstralachneaFang.cs @@ -49,7 +49,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + //Doze - I gave this long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + //Poison and Venom staff in vanilla do 30 seconds, so this should too as it's a spiritual successor to them. + target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(30)); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Magic/CauldronHoldout.cs b/Projectiles/Magic/CauldronHoldout.cs index 80d327c3ef..b499fdf008 100644 --- a/Projectiles/Magic/CauldronHoldout.cs +++ b/Projectiles/Magic/CauldronHoldout.cs @@ -75,11 +75,7 @@ namespace CalamityMod.Projectiles.Magic int projType = ModContent.ProjectileType(); int projDamage = Projectile.damage; float speedscale = 18f; - Vector2 shotSpeed = Vector2.Normalize(Projectile.velocity) * speedscale; - if (float.IsNaN(shotSpeed.X) || float.IsNaN(shotSpeed.Y)) - { - shotSpeed = -Vector2.UnitY; - } + Vector2 shotSpeed = Projectile.velocity.SafeNormalize(-Vector2.UnitY) * speedscale; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shotSpeed, projType, projDamage, Projectile.knockBack, player.whoAmI); for (int i = 0; i < 6; i++) diff --git a/Projectiles/Magic/CauldronProj.cs b/Projectiles/Magic/CauldronProj.cs index 21c716e995..a414b19b1c 100644 --- a/Projectiles/Magic/CauldronProj.cs +++ b/Projectiles/Magic/CauldronProj.cs @@ -98,8 +98,8 @@ namespace CalamityMod.Projectiles.Magic Main.EntitySpriteDraw(Glow.Value, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 90); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire, 90); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 90); } } diff --git a/Projectiles/Magic/CauldronProjSmall.cs b/Projectiles/Magic/CauldronProjSmall.cs index 1ae7f52f9a..20ae6b8292 100644 --- a/Projectiles/Magic/CauldronProjSmall.cs +++ b/Projectiles/Magic/CauldronProjSmall.cs @@ -58,13 +58,6 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Pitch = 0.8f, Volume = 0.6f }, Projectile.Center); - Projectile.ExpandHitboxBy(46); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.damage /= 2; - Projectile.Damage(); for (int i = 0; i < 10; i++) { int size = 10; @@ -86,8 +79,8 @@ namespace CalamityMod.Projectiles.Magic public override bool? CanDamage() => Projectile.velocity.Y < 0f ? false : null; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire3, 90); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.OnFire, 90); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire3, 90); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.OnFire, 90); } } diff --git a/Projectiles/Magic/DeathValleyDusterProjectile.cs b/Projectiles/Magic/DeathValleyDusterProjectile.cs index 0fd107a6bf..33520aff80 100644 --- a/Projectiles/Magic/DeathValleyDusterProjectile.cs +++ b/Projectiles/Magic/DeathValleyDusterProjectile.cs @@ -10,6 +10,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; using System.Collections.Generic; +using CalamityMod.Items.Placeables.FurnitureMarnite; namespace CalamityMod.Projectiles.Magic { public class DeathValleyDusterProjectile : ModProjectile, ILocalizedModType @@ -34,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.extraUpdates = 4; + Projectile.extraUpdates = 7; Projectile.timeLeft = 400; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -60,7 +61,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 600); + player.AddBuff(ModContent.BuffType(), 720); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; @@ -141,7 +142,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.rotation += Main.rand.NextFloat(0.01f, 0.18f) * (float)Projectile.direction * Projectile.Opacity * rotDirection; - if (Projectile.timeLeft <= 45) { Projectile.extraUpdates = 1; @@ -152,15 +152,37 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 3.5f; + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 3 }, Projectile.Center); + for (int i = 0; i < 14; i++) + { + float range = Main.rand.NextFloat(-0.5f, 0.5f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(range) * Main.rand.NextFloat(45, 50) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 5; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(15, 25 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } + modifiers.SourceDamage *= damageMult; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Projectile.numHits >= 3 && Projectile.timeLeft > 45) + if (Projectile.numHits >= 5 && Projectile.timeLeft > 45) { Projectile.timeLeft = 45; Projectile.velocity *= 0.4f; diff --git a/Projectiles/Magic/DivineRetributionSpear.cs b/Projectiles/Magic/DivineRetributionSpear.cs deleted file mode 100644 index f1b2dc7525..0000000000 --- a/Projectiles/Magic/DivineRetributionSpear.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class DivineRetributionSpear : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public Player Owner => Main.player[Projectile.owner]; - public ref float VelocityScale => ref Projectile.ai[0]; - public ref float Time => ref Projectile.ai[1]; - - public static float HomingSpeed => 20f; - public static float HomingTime => 15f; - public static float ReturnTime => 75f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 15; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 30; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Magic; - Projectile.penetrate = 1; - Projectile.timeLeft = 210; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - - Time++; - Projectile.Opacity = Utils.GetLerpValue(0f, 18f, Projectile.timeLeft, true); - Lighting.AddLight(Projectile.Center, Color.Gold.ToVector3() * 0.7f * Projectile.Opacity); - - if (Time % 2f == 1f) - { - Vector2 dustOffset = (Vector2.UnitY * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.05f) * 16f).RotatedBy(Projectile.velocity.ToRotation()); - Dust dust = Dust.NewDustPerfect(Projectile.Center + dustOffset, ModContent.DustType()); - dust.noGravity = true; - dust.noLightEmittence = true; - dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; - dust.scale = Main.rand.NextFloat(0.4f, 0.6f); - } - - NPC potentialTarget = Projectile.Center.ClosestNPCAt(Time >= ReturnTime ? 480f : 320f); - if (potentialTarget != null && Time >= HomingTime) - { - Vector2 idealVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * HomingSpeed * VelocityScale; - Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; - Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); - return; - } - else if (Owner.active && !Owner.dead && Time >= ReturnTime) - { - Vector2 idealVelocity = Projectile.SafeDirectionTo(Owner.MountedCenter) * HomingSpeed * VelocityScale * (1.2f - Utils.GetLerpValue(800f, 160f, Vector2.Distance(Projectile.Center, Owner.MountedCenter), true)); - Projectile.velocity = (Projectile.velocity * 29f + idealVelocity) / 30f; - Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 3f); - } - if (!Owner.active || Owner.dead || (Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 240f && Time >= ReturnTime)) - { - Projectile.timeLeft--; - if (!Owner.active || Owner.dead || Vector2.Distance(Projectile.Center, Owner.MountedCenter) <= 80f) - { - if (Projectile.timeLeft > 30) - Projectile.timeLeft = 30; - } - } - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D spear = TextureAssets.Projectile[Type].Value; - Vector2 drawPos = Projectile.Center - Main.screenPosition; - - float cLerp = Utils.GetLerpValue(210, 160, Projectile.timeLeft, true); - Color baseColor = Color.Lerp(Color.Goldenrod, new Color(255, 255, 150), cLerp) * Projectile.Opacity; - Color glowColor = Color.Lerp(Color.OrangeRed, Color.Orange, cLerp) * Projectile.Opacity; - - float squish = MathHelper.Clamp(Projectile.velocity.Length() * 0.04f, 0, 0.2f); - Vector2 scale = new Vector2(1f + squish, 1f - squish); - - Main.spriteBatch.EnterShaderRegion(BlendState.Additive); - if (CalamityClientConfig.Instance.Afterimages) - { - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - float completionRatio = i / (float)Projectile.oldPos.Length; - Vector2 trailPos = Projectile.oldPos[i] + Projectile.Size * 0.5f - Main.screenPosition; - - Color trailColor = Color.Lerp(glowColor, Color.Black, completionRatio) * 0.35f; - Vector2 trailScale = scale * MathHelper.Lerp(1f, 0.15f, completionRatio); - - Main.EntitySpriteDraw(spear, trailPos, null, trailColor, Projectile.oldRot[i], spear.Size() * 0.5f, trailScale, SpriteEffects.None); - } - } - - for (int i = 0; i < 8; i++) - { - Vector2 offset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Main.EntitySpriteDraw(spear, drawPos + offset, null, Color.Lerp(baseColor, glowColor, 0.8f) * 0.5f, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); - } - Main.spriteBatch.ExitShaderRegion(); - - Main.EntitySpriteDraw(spear, drawPos, null, baseColor, Projectile.rotation, spear.Size() * 0.5f, scale, SpriteEffects.None); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - - public override void OnKill(int timeLeft) - { - Projectile.ExpandHitboxBy(96); - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); - SoundEngine.PlaySound(SoundID.Item74, Projectile.Center); - for (int i = 0; i < 9; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Main.rand.NextVector2CircularEdge(5f, 5f)); - dust.noGravity = true; - dust.noLightEmittence = true; - dust.color = Main.rand.NextBool() ? Color.Orange : Color.Goldenrod; - dust.scale = Main.rand.NextFloat(0.8f, 1.4f); - } - } - } -} diff --git a/Projectiles/Magic/DivineRetributionSpear.png b/Projectiles/Magic/DivineRetributionSpear.png deleted file mode 100644 index c8b7e089ab..0000000000 Binary files a/Projectiles/Magic/DivineRetributionSpear.png and /dev/null differ diff --git a/Projectiles/Magic/EvergladeSprayProjectile.cs b/Projectiles/Magic/EvergladeSprayProjectile.cs index dbd85e0838..0cf2d5e24f 100644 --- a/Projectiles/Magic/EvergladeSprayProjectile.cs +++ b/Projectiles/Magic/EvergladeSprayProjectile.cs @@ -17,11 +17,11 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 4; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 6; + Projectile.penetrate = 3; Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Magic; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; // 6 effective, 18 total + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() diff --git a/Projectiles/Magic/FabBolt.cs b/Projectiles/Magic/FabBolt.cs deleted file mode 100644 index 75521fc686..0000000000 --- a/Projectiles/Magic/FabBolt.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Magic -{ - public class FabBolt : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public bool FadingOut - { - get => Projectile.ai[0] == 1f; - set => Projectile.ai[0] = value.ToInt(); - } - - public override void SetStaticDefaults() - { - ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = 23; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.extraUpdates = 2; - Projectile.penetrate = 12; - Projectile.timeLeft = 90 * Projectile.extraUpdates; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 0; - } - - public override void AI() - { - if (FadingOut) - { - Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.27f); - if (Projectile.Opacity <= 0.05f) - Projectile.Kill(); - } - else - Projectile.velocity *= 1.004f; - Projectile.rotation = Projectile.velocity.ToRotation(); - - // Emit light. - Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.45f); - } - - internal Color ColorFunction(float completionRatio) - { - float fadeToEnd = MathHelper.Lerp(0.25f, 0.5f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - fadeToEnd *= 1f - Utils.GetLerpValue(0.35f, 0f, completionRatio, true); - Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, Projectile.identity % 2); - return Color.Lerp(Color.White, endColor, fadeToEnd) * Projectile.Opacity * 0.7f; - } - - internal float WidthFunction(float completionRatio) - { - float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.GetLerpValue(0f, 0.2f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 22f, expansionCompletion) * Projectile.Opacity; - } - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 80); - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (!FadingOut && Projectile.penetrate < 2) - { - FadingOut = true; - Projectile.velocity *= 0.1f; - Projectile.extraUpdates = 0; - Projectile.netUpdate = true; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (!FadingOut) - { - FadingOut = true; - Projectile.velocity *= 0.1f; - Projectile.extraUpdates = 0; - Projectile.netUpdate = true; - } - return false; - } - - public override bool? CanDamage() - { - if (FadingOut) - return false; - return null; - } - } -} diff --git a/Projectiles/Magic/FabRay.cs b/Projectiles/Magic/FabRay.cs deleted file mode 100644 index 6afbdea101..0000000000 --- a/Projectiles/Magic/FabRay.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Magic -{ - public class FabRay : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Magic"; - - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 54; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Magic; - Projectile.ignoreWater = true; - Projectile.penetrate = 70; - Projectile.extraUpdates = 3; - Projectile.timeLeft = 60 * Projectile.extraUpdates; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 0.2f, 0.01f, 0.1f); - Projectile.ai[0] += 1f; - Projectile.Opacity = Utils.GetLerpValue(0f, 10f * Projectile.MaxUpdates, Projectile.timeLeft, true); - - int shootRate = Projectile.npcProj ? 40 : 12; - if (Projectile.owner == Main.myPlayer && Projectile.ai[0] % shootRate == 0f) - { - NPC potentialTarget = Projectile.Center.ClosestNPCAt(180f, false); - if (potentialTarget != null) - { - Vector2 shootVelocity = Projectile.SafeDirectionTo(potentialTarget.Center) * 13f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (p.WithinBounds(Main.maxProjectiles)) - { - if (Projectile.hostile) - { - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - Main.projectile[p].DamageType = DamageClass.Default; - } - } - } - - for (int i = 0; i < Projectile.oldPos.Length / 4; i += 3) - { - potentialTarget = Projectile.oldPos[i].ClosestNPCAt(280f, false); - if (potentialTarget != null) - { - Vector2 shootVelocity = (potentialTarget.Center - Projectile.oldPos[i]).SafeNormalize(Vector2.UnitY) * 13f; - int p = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.oldPos[i] - shootVelocity * 2.5f, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - if (p.WithinBounds(Main.maxProjectiles)) - { - if (Projectile.hostile) - { - Main.projectile[p].hostile = true; - Main.projectile[p].friendly = false; - Main.projectile[p].DamageType = DamageClass.Default; - } - } - break; - } - } - } - - // Emit light. - if (!Projectile.hostile) - Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.7f); - } - - internal Color ColorFunction(float completionRatio) - { - float fadeToEnd = MathHelper.Lerp(0.65f, 1f, (float)Math.Cos(-Main.GlobalTimeWrappedHourly * 3f) * 0.5f + 0.5f); - float fadeOpacity = Utils.GetLerpValue(1f, 0.64f, completionRatio, true) * Projectile.Opacity; - Color endColor = Color.Lerp(Color.Cyan, Color.HotPink, (float)Math.Sin(completionRatio * MathHelper.Pi * 1.6f - Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 0.5f); - return Color.Lerp(Color.White, endColor, fadeToEnd) * fadeOpacity; - } - - internal float WidthFunction(float completionRatio) - { - float expansionCompletion = 1f - (float)Math.Pow(1f - Utils.GetLerpValue(0f, 0.3f, completionRatio, true), 2D); - return MathHelper.Lerp(0f, 32f * Projectile.Opacity, expansionCompletion); - } - - internal Vector2 OffsetFunction(float completionRatio) => Projectile.Size * 0.5f; - - public override bool PreDraw(ref Color lightColor) - { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 32); - return false; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.penetrate--; - if (Projectile.penetrate <= 0) - { - Projectile.Kill(); - } - else - { - if (Projectile.velocity.X != oldVelocity.X) - { - Projectile.velocity.X = -oldVelocity.X; - } - if (Projectile.velocity.Y != oldVelocity.Y) - { - Projectile.velocity.Y = -oldVelocity.Y; - } - } - return false; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (Projectile.hostile) - target.AddBuff(ModContent.BuffType(), 54000); - } - } -} diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 8fdd57539f..caa9485d19 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < 6; i++) { Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/HadalUrnHoldout.cs b/Projectiles/Magic/HadalUrnHoldout.cs index 1a806f98cf..af45bffc98 100644 --- a/Projectiles/Magic/HadalUrnHoldout.cs +++ b/Projectiles/Magic/HadalUrnHoldout.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.damage = player.ActiveItem() is null ? 0 : player.GetWeaponDamage(player.ActiveItem()); if (Projectile.ai[0] > 0f) { - Projectile.ai[0] -= 1f; + Projectile.ai[0]--; } if (Main.myPlayer == Projectile.owner) { @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Magic } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shotSpeed, projType, projDamage, Projectile.knockBack, player.whoAmI, ai); } - Projectile.ai[0] = 16; + Projectile.ai[0] = player.HeldItem.useTime; } else { diff --git a/Projectiles/Magic/HeliumFlashHoldout.cs b/Projectiles/Magic/HeliumFlashHoldout.cs index c26c976f60..db956457ef 100644 --- a/Projectiles/Magic/HeliumFlashHoldout.cs +++ b/Projectiles/Magic/HeliumFlashHoldout.cs @@ -152,7 +152,7 @@ namespace CalamityMod.Projectiles.Magic // Full charge effects if (CurrentChargingFrames == HeliumFlash.FullChargeFrames) { - SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundStyle fire = new("CalamityMod/Sounds/Item/HeliumFlashReady"); SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = 0f }, Projectile.Center); for (int i = 0; i < 18; i++) { diff --git a/Projectiles/Magic/KeelhaulBubble.cs b/Projectiles/Magic/KeelhaulBubble.cs index a01363c641..53f62bc727 100644 --- a/Projectiles/Magic/KeelhaulBubble.cs +++ b/Projectiles/Magic/KeelhaulBubble.cs @@ -16,6 +16,12 @@ namespace CalamityMod.Projectiles.Magic public override void OnKill(int timeLeft) { + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() || p.type == ModContent.ProjectileType()) + p.Kill(); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y - 80f, 0f, 0f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); } diff --git a/Projectiles/Magic/KeelhaulGeyserBottom.cs b/Projectiles/Magic/KeelhaulGeyserBottom.cs index 632c9c9e08..dbe61a5152 100644 --- a/Projectiles/Magic/KeelhaulGeyserBottom.cs +++ b/Projectiles/Magic/KeelhaulGeyserBottom.cs @@ -1,7 +1,10 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { + [PierceResistExceptionAttribute(true)] public class KeelhaulGeyserBottom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; @@ -19,14 +22,21 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.timeLeft = 180; - Projectile.alpha = 90; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.timeLeft = 900; + Projectile.alpha = 255; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { + if (Projectile.alpha > 90) + { + Projectile.alpha -= 10; + if (Projectile.alpha < 90) + Projectile.alpha = 90; + } + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { diff --git a/Projectiles/Magic/KeelhaulGeyserTop.cs b/Projectiles/Magic/KeelhaulGeyserTop.cs index 69aeb8f78b..db17a5ca70 100644 --- a/Projectiles/Magic/KeelhaulGeyserTop.cs +++ b/Projectiles/Magic/KeelhaulGeyserTop.cs @@ -1,7 +1,10 @@ -using Terraria; +using CalamityMod.NPCs; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Projectiles.Magic { + [PierceResistExceptionAttribute(true)] public class KeelhaulGeyserTop : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; @@ -19,14 +22,21 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.timeLeft = 180; - Projectile.alpha = 90; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; + Projectile.timeLeft = 900; + Projectile.alpha = 255; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; } public override void AI() { + if (Projectile.alpha > 90) + { + Projectile.alpha -= 10; + if (Projectile.alpha < 90) + Projectile.alpha = 90; + } + Projectile.frameCounter++; if (Projectile.frameCounter > 6) { diff --git a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs index 4bc6077cae..49748b34ad 100644 --- a/Projectiles/Magic/MadAlchemistsCocktailAlt.cs +++ b/Projectiles/Magic/MadAlchemistsCocktailAlt.cs @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 360); + target.AddBuff(ModContent.BuffType(), 480); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Magic/NebulaCloudCore.cs b/Projectiles/Magic/NebulaCloudCore.cs index d48efbeab7..531bbd6f31 100644 --- a/Projectiles/Magic/NebulaCloudCore.cs +++ b/Projectiles/Magic/NebulaCloudCore.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Projectiles.Magic public class NebulaCloudCore : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Magic"; - private const float IntendedVelocity = 4f; + private const float IntendedVelocity = 6f; public override void SetStaticDefaults() { @@ -28,12 +28,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.height = 32; Projectile.friendly = true; Projectile.alpha = 255; - Projectile.penetrate = 4; + Projectile.penetrate = 3; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Magic; Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8 * Projectile.MaxUpdates; // 8 effective, 24 total + Projectile.localNPCHitCooldown = 10 * Projectile.MaxUpdates; // 10 effective, 30 total } public override void AI() @@ -351,12 +351,10 @@ namespace CalamityMod.Projectiles.Magic int totalProjectiles = Main.rand.Next(6, 9); float radians = MathHelper.TwoPi / totalProjectiles; int type = ModContent.ProjectileType(); - float velocity = Main.rand.Next(70, 101) * 0.1f; - Vector2 spinningPoint = new Vector2(0f, -velocity); for (int k = 0; k < totalProjectiles; k++) { - Vector2 velocity2 = spinningPoint.RotatedBy(radians * k); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Utils.RandomVector2(Main.rand, -30f, 30f), velocity2, type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Projectile.owner); + Vector2 velocity = -Vector2.UnitY.RotatedBy(radians * k) * Main.rand.NextFloat(7f, 10f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(30f, 30f), velocity, type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Projectile.owner); } } } diff --git a/Projectiles/Magic/NebulaNova.cs b/Projectiles/Magic/NebulaNova.cs index 84830b3f48..db975c183e 100644 --- a/Projectiles/Magic/NebulaNova.cs +++ b/Projectiles/Magic/NebulaNova.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.timeLeft = TotalXFrames * TotalYFrames * FrameTimer; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 30; } public override void AI() diff --git a/Projectiles/Magic/NebulousCataclysm_Held.cs b/Projectiles/Magic/NebulousCataclysm_Held.cs index d29dbbe09e..7c83485dc5 100644 --- a/Projectiles/Magic/NebulousCataclysm_Held.cs +++ b/Projectiles/Magic/NebulousCataclysm_Held.cs @@ -60,9 +60,8 @@ namespace CalamityMod.Projectiles.Magic Projectile.ai[0] = 0f; bool shoot = CurrentFrame == ShootFrame && Projectile.ai[0] == 0f; - bool ableToShoot = true; + bool ableToShoot = false; bool weaponInUse = !Owner.CantUseHoldout(); - int manaCost = (int)(30f * Owner.manaCost); Vector2 halvedSize = Projectile.Size / 2f; Vector2 staffOffset = halvedSize + new Vector2(24f, 24f); @@ -72,43 +71,21 @@ namespace CalamityMod.Projectiles.Magic if (weaponInUse) { - if (Owner.statMana < manaCost) - { - if (Owner.manaFlower) - { - Owner.QuickMana(); - if (Owner.statMana >= manaCost) - { - Owner.manaRegenDelay = (int)Owner.maxRegenDelay; - Owner.statMana -= manaCost; - } - else - { - Projectile.Kill(); - ableToShoot = false; - } - } - else - { - Projectile.Kill(); - ableToShoot = false; - } - } + if (Owner.CheckMana(Owner.HeldItem.mana)) + ableToShoot = true; else - { - if (Owner.statMana >= manaCost) - { - Owner.statMana -= manaCost; - Owner.manaRegenDelay = (int)Owner.maxRegenDelay; - } - } + Projectile.Kill(); if (ableToShoot) SoundEngine.PlaySound(SoundID.Item117, Projectile.Center); } + else + Projectile.Kill(); if (Main.myPlayer == Projectile.owner && ableToShoot) { + Owner.CheckMana(Owner.HeldItem.mana, true); + int projectileType = ModContent.ProjectileType(); float coreVelocity = 8f; int weaponDamage = Owner.GetWeaponDamage(Owner.ActiveItem()); diff --git a/Projectiles/Magic/OmicronHoldout.cs b/Projectiles/Magic/OmicronHoldout.cs index a476798def..6e3eed8973 100644 --- a/Projectiles/Magic/OmicronHoldout.cs +++ b/Projectiles/Magic/OmicronHoldout.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Magic if (Owner.Calamity().mouseRight && PostFireCooldown <= 0) { - if (Owner.CheckMana(Owner.ActiveItem(), (int)(HeldItem.mana * Owner.manaCost) * 16, true, false)) + if (Owner.CheckMana(Owner.ActiveItem(), (int)(HeldItem.mana * Owner.manaCost) * 13, true)) { PostFireCooldown = 100; Shoot(true); @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Magic } else if (ShootingTimer >= FireRate) { - if (Owner.CheckMana(Owner.ActiveItem(), -1, true, false) && PostFireCooldown <= 0) + if (Owner.CheckMana(Owner.ActiveItem(), -1, true) && PostFireCooldown <= 0) { MaxFireRateShots++; diff --git a/Projectiles/Magic/PhotosyntheticSolarBeam.cs b/Projectiles/Magic/PhotosyntheticSolarBeam.cs index fb6fd037ed..7196a21283 100644 --- a/Projectiles/Magic/PhotosyntheticSolarBeam.cs +++ b/Projectiles/Magic/PhotosyntheticSolarBeam.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Magic public override Texture2D LaserMiddleTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayMid", AssetRequestMode.ImmediateLoad).Value; public override Texture2D LaserEndTexture => ModContent.Request("CalamityMod/ExtraTextures/Lasers/UltimaRayEnd", AssetRequestMode.ImmediateLoad).Value; - public ref float ShardCooldown => ref Projectile.ai[1]; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public override void SetDefaults() { @@ -28,7 +27,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.ignoreWater = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 12; + Projectile.localNPCHitCooldown = -1; Projectile.tileCollide = false; Projectile.timeLeft = (int)Lifetime; } @@ -42,11 +41,11 @@ namespace CalamityMod.Projectiles.Magic for (int i = 0; i < starPoints; i++) { float angle = MathHelper.TwoPi * i / starPoints; - for (int j = 0; j < 12; j++) + for (int j = 0; j < 6; j++) { - float starSpeed = MathHelper.Lerp(1f, 7f, j / 12f); - Color dustColor = Color.Lerp(Color.White, Color.YellowGreen, j / 12f); - float dustScale = MathHelper.Lerp(1.6f, 0.85f, j / 12f); + float starSpeed = MathHelper.Lerp(1f, 7f, j / 6f); + Color dustColor = Color.Lerp(Color.White, Color.YellowGreen, j / 6f); + float dustScale = MathHelper.Lerp(1.6f, 0.85f, j / 6f); Dust terraMagic = Dust.NewDustPerfect(Projectile.Center, 107); terraMagic.velocity = angle.ToRotationVector2() * starSpeed; @@ -56,7 +55,7 @@ namespace CalamityMod.Projectiles.Magic } } - int ovalPoints = 42; + int ovalPoints = 30; for (int i = 0; i < ovalPoints; i++) { float angle = MathHelper.TwoPi * i / ovalPoints; @@ -66,9 +65,6 @@ namespace CalamityMod.Projectiles.Magic terraMagic.noGravity = true; } } - - if (ShardCooldown > 0f) - ShardCooldown--; } public override void DetermineScale() => Projectile.scale = Projectile.timeLeft / Lifetime * MaxScale; @@ -89,18 +85,7 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (ShardCooldown > 0f) - return; - - // The "Center" of the laser is actually the start of it in this context. - // Collision is done separately. This might have a slight offset due to collision - // boxes, but that should be negligible. - float lengthFromStart = Projectile.Distance(target.Center); - - int totalShards = (int)MathHelper.Lerp(1, 3, MathHelper.Clamp(lengthFromStart / MaxLaserLength * 1.5f, 0f, 1f)); - int shardType = ModContent.ProjectileType(); - int shardDamage = (int)(Projectile.damage * 0.5); - for (int i = 0; i < totalShards; i++) + for (int i = 0; i < 2; i++) { int tries = 0; Vector2 spawnOffset; @@ -111,11 +96,8 @@ namespace CalamityMod.Projectiles.Magic } while (Collision.SolidCollision((target.Center + spawnOffset).ToTileCoordinates().ToVector2(), 4, 4) && tries < 10); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), shardType, shardDamage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center + spawnOffset, Main.rand.NextVector2CircularEdge(6f, 6f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); } - - ShardCooldown = 3f; - Projectile.netUpdate = true; } } } diff --git a/Projectiles/Magic/PlagueFang.cs b/Projectiles/Magic/PlagueFang.cs index 443df05763..adc787da24 100644 --- a/Projectiles/Magic/PlagueFang.cs +++ b/Projectiles/Magic/PlagueFang.cs @@ -78,7 +78,10 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + //Doze - I gave this long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + //Poison and Venom staff in vanilla do 30 seconds, so this should too as it's a spiritual successor to them. + target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(30)); } } } diff --git a/Projectiles/Magic/PrimordialAncientExplosion.cs b/Projectiles/Magic/PrimordialAncientExplosion.cs index 8b4f5a9c1a..0f24414cb2 100644 --- a/Projectiles/Magic/PrimordialAncientExplosion.cs +++ b/Projectiles/Magic/PrimordialAncientExplosion.cs @@ -28,6 +28,9 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 40, true); + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.95f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/PrimordialAncientProjectile.cs b/Projectiles/Magic/PrimordialAncientProjectile.cs index 6eac8df489..b8d71258ae 100644 --- a/Projectiles/Magic/PrimordialAncientProjectile.cs +++ b/Projectiles/Magic/PrimordialAncientProjectile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Particles; +using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -37,10 +38,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.tileCollide = false; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 8; Projectile.timeLeft = 430; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 40 * Projectile.extraUpdates; + Projectile.localNPCHitCooldown = -1; } public override void AI() { @@ -71,7 +72,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 840); + player.AddBuff(ModContent.BuffType(), 1080); int Dusts = 8; float radians = MathHelper.TwoPi / Dusts; @@ -190,7 +191,6 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(SandCloud); } - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(5) ? 86 : 287, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.3f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); @@ -203,48 +203,81 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 0.05f; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 9 }, Projectile.Center); + for (int i = 0; i < 6; i++) + { + float range = Main.rand.NextFloat(-0.3f, 0.3f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.Center.DirectionTo(target.Center).RotatedBy(range) * Main.rand.NextFloat(35, 40) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 5; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(25, 35 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + modifiers.SourceDamage *= damageMult * 0.03f; } public override void OnKill(int timeLeft) { Lighting.AddLight(Projectile.Center, Color.Purple.ToVector3() * 2); if (Projectile.ai[1] == 1) { - Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Purple, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.82f, 11); + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 8f; + + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Purple, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.2f * 2f, 0.6f * 2.5f, 17); GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0f, 0.74f, 11); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f * 2f, 0.5f * 2.5f, 17); GeneralParticleHandler.SpawnParticle(orb2); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 1.5f, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MineralMortarExplode"); SoundEngine.PlaySound(explo with { Volume = 0.9f }, Projectile.Center); + SoundStyle explo2 = new("CalamityMod/Sounds/Item/EarthMeteor"); + SoundEngine.PlaySound(explo2 with { Volume = 0.9f, Pitch = -0.3f }, Projectile.Center); Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Lerp(Color.Purple, Color.White, 0.5f) * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f * 2.3f, 18); GeneralParticleHandler.SpawnParticle(bolt2); - Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Peru * 0.55f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f, 30); + Particle bolt3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Peru * 0.55f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.4f, 23); GeneralParticleHandler.SpawnParticle(bolt3); - Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PeachPuff * 0.55f, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.3f * 1.35f, 30); + Particle bolt4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.PeachPuff * 0.55f, "CalamityMod/Particles/SmokeExplosion", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 0.4f * 1.35f, 18); GeneralParticleHandler.SpawnParticle(bolt4); for (int i = 0; i < 140; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 86 : 287, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.8f, 1.3f); - if (dust.type == 86) + if (Main.rand.NextBool(5)) { - dust.noGravity = true; - dust.fadeIn = 0.5f; - dust.velocity *= 2; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 86 : 287, new Vector2(21, 21).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + if (dust.type == 86) + { + dust.noGravity = true; + dust.fadeIn = 0.5f; + dust.velocity *= 2; + } + dust.alpha = 100; + } + else + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(9, 33)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(25, 55 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 23, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); } - dust.alpha = 100; } for (int i = 0; i < 30; i++) { diff --git a/Projectiles/Magic/PrimordialEarthExplosion.cs b/Projectiles/Magic/PrimordialEarthExplosion.cs index 7a2fc6d42f..3fc8e0e945 100644 --- a/Projectiles/Magic/PrimordialEarthExplosion.cs +++ b/Projectiles/Magic/PrimordialEarthExplosion.cs @@ -28,6 +28,9 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + Vector2 launchVel = Utils.DirectionTo(Projectile.Center, target.Center); + target.MoveNPC(launchVel, 20, true); + if (Projectile.numHits > 0) Projectile.damage = (int)(Projectile.damage * 0.9f); if (Projectile.damage < 1) diff --git a/Projectiles/Magic/PrimordialEarthProjectile.cs b/Projectiles/Magic/PrimordialEarthProjectile.cs index 6a5a77c9ef..83cd70b476 100644 --- a/Projectiles/Magic/PrimordialEarthProjectile.cs +++ b/Projectiles/Magic/PrimordialEarthProjectile.cs @@ -35,7 +35,7 @@ namespace CalamityMod.Projectiles.Magic Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Magic; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 9; Projectile.timeLeft = 132; // NOTE: Do not change this. Specific timing is needed for the weapon to function properly. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.Magic if (buffList[playerIndex] == false) { buffList[playerIndex] = true; - player.AddBuff(ModContent.BuffType(), 720); + player.AddBuff(ModContent.BuffType(), 840); int Dusts = 12; float radians = MathHelper.TwoPi / Dusts; @@ -135,7 +135,6 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(SandCloud); } - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + new Vector2(25, 25).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f) * Projectile.scale, Main.rand.NextBool(8) ? 262 : 287, -Projectile.velocity * Main.rand.NextFloat(0.1f, 1.3f)); dust2.noGravity = true; dust2.scale = Main.rand.NextFloat(0.4f, 0.7f); @@ -148,36 +147,71 @@ namespace CalamityMod.Projectiles.Magic } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.95f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.25f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + if (Projectile.numHits == 0) + { + damageMult += 0.5f; + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = 0.9f, Pitch = -0.4f + i * 0.25f, MaxInstances = 6 }, Projectile.Center); + for (int i = 0; i < 9; i++) + { + float range = Main.rand.NextFloat(-0.3f, 0.3f); + float power = 1 - Math.Abs(range); + Vector2 vel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(range) * Main.rand.NextFloat(35, 40) * power; + MediumMistParticle SandCloud = new MediumMistParticle(Projectile.Center, vel, Color.Peru, Color.PeachPuff, Main.rand.NextFloat(1.7f, 2.3f), 120f, Main.rand.NextFloat(0.03f, -0.03f)); + GeneralParticleHandler.SpawnParticle(SandCloud); + for (int b = 0; b < 6; b++) + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, vel.RotatedByRandom(0.4f) * Main.rand.NextFloat(0.4f, 0.9f) * power, "CalamityMod/Particles/SmallSmoke", false, Main.rand.Next(25, 35 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 7, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); + } + } + } + modifiers.SourceDamage *= damageMult; } public override void OnKill(int timeLeft) { if (Projectile.ai[1] == 1) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, Projectile.knockBack * 1.5f, Projectile.owner); + Player Owner = Main.player[Projectile.owner]; + Owner.Calamity().GeneralScreenShakePower = 5f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.5f), 0, Projectile.owner); SoundStyle explo = new("CalamityMod/Sounds/Item/MagicRockImpact"); SoundEngine.PlaySound(explo with { Volume = 0.75f }, Projectile.Center); - //Particle bolt = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold * 0.3f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 1.86f, 15); - //GeneralParticleHandler.SpawnParticle(bolt); Particle bolt2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold * 0.55f, "CalamityMod/Particles/BloomRing", Vector2.One, Main.rand.NextFloat(-10f, 10f), 0f, 2.56f, 15); GeneralParticleHandler.SpawnParticle(bolt2); + + Particle orb = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Gold, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.1f, 0.4f * 1.5f, 17); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.05f, 0.3f * 1.5f, 17); + GeneralParticleHandler.SpawnParticle(orb2); } for (int i = 0; i < 65; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 262 : 287, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); - dust.noGravity = false; - dust.scale = Main.rand.NextFloat(0.8f, 1.3f); - if (dust.type == 262) + if (Main.rand.NextBool(4)) { - dust.noGravity = true; - dust.fadeIn = 0.5f; - dust.velocity *= 2; + Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(6) ? 262 : 287, new Vector2(7, 7).RotatedByRandom(100) * Main.rand.NextFloat(0.1f, 1.3f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + if (dust.type == 262) + { + dust.noGravity = true; + dust.fadeIn = 0.5f; + dust.velocity *= 2; + } + dust.alpha = 100; + } + else + { + Color clr = Color.Lerp((Main.rand.NextBool() ? Color.Peru : Color.PeachPuff), Color.Black, Main.rand.NextFloat(0.25f, 0.45f)); + Particle sand = new CustomSpark(Projectile.Center, (Vector2.One * Main.rand.NextFloat(6, 15)).RotatedByRandom(MathHelper.TwoPi), "CalamityMod/Particles/SmallSmoke", true, Main.rand.Next(20, 45 + 1), Projectile.scale * Main.rand.NextFloat(0.08f, 0.14f) * 8, clr, new Vector2(1, Main.rand.NextFloat(0.2f, 2f)), false, extraRotation: Main.rand.NextFloat(-4, 4), spin: Main.rand.NextFloat(-0.8f, 0.8f), affectedByLight: true); + GeneralParticleHandler.SpawnParticle(sand); } - dust.alpha = 100; } for (int i = 0; i < 9; i++) { diff --git a/Projectiles/Magic/SHPB.cs b/Projectiles/Magic/SHPB.cs index b05ce18c1f..00e47bcca7 100644 --- a/Projectiles/Magic/SHPB.cs +++ b/Projectiles/Magic/SHPB.cs @@ -378,9 +378,9 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(endColor, Color.White, deathInterpolant); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PlasmaBallWidthFunction, PlasmaBallColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); } } diff --git a/Projectiles/Magic/SHPL.cs b/Projectiles/Magic/SHPL.cs index c667a63398..055311f127 100644 --- a/Projectiles/Magic/SHPL.cs +++ b/Projectiles/Magic/SHPL.cs @@ -137,10 +137,10 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(startColor, bodyColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { // Render the main trail for the body for the laser. - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(LaserWidthFunction, LaserColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), Projectile.oldPos.Length * 2); // Render a smaller, pure white trail in the same position to represent condensed energy in the core of the laser. diff --git a/Projectiles/Magic/SHPS.cs b/Projectiles/Magic/SHPS.cs index 9ce66fce0c..bd02542b8b 100644 --- a/Projectiles/Magic/SHPS.cs +++ b/Projectiles/Magic/SHPS.cs @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Magic return Color.Lerp(Color.White, tipColor, completion); } - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { // Render the main trail for the body for the soul. GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); @@ -242,7 +242,7 @@ namespace CalamityMod.Projectiles.Magic // Render a smaller, pure white trail in the same position to represent the glowing white core of the soul. Vector2[] soulCoreLength = Projectile.oldPos.Take(8).ToArray(); - GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(soulCoreLength, new(SoulCoreWidthFunction, SoulCoreColorFunction, (_) => Projectile.Size * 0.5f, true, true, GameShaders.Misc["CalamityMod:ImpFlameTrail"]), soulCoreLength.Length * 2); } } diff --git a/Projectiles/Magic/SHPV.cs b/Projectiles/Magic/SHPV.cs index bb9a52caa4..454e42905e 100644 --- a/Projectiles/Magic/SHPV.cs +++ b/Projectiles/Magic/SHPV.cs @@ -87,17 +87,29 @@ namespace CalamityMod.Projectiles.Magic { if (Timer % 5 == 0f) { - if (Owner.HeldItem.ModItem is SHPC shpc && shpc.storedSoulpower > 0) + if (Owner.HeldItem.ModItem is SHPC shpc) { SoundEngine.PlaySound(CommonCalamitySounds.ELRFireSound, Owner.Center); Vector2 laserPos = TipPosition + Vector2.UnitY.RotatedBy(Projectile.rotation) * Main.rand.NextFloat(-7f, 7f); Vector2 laserVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) * 20f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), 3f, Projectile.owner, SoulColors[0]); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), laserPos, laserVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.35f), 3f, Projectile.owner, SoulColors[0]); if (ConsumeSoul) { SoulColors.RemoveAt(0); - shpc.storedSoulpower--; + if (shpc.storedSoulpower > 0) + shpc.storedSoulpower--; + else if (SHPC.FindSoulForAmmo(Owner) != -1) + { + int soulType = SHPC.FindSoulForAmmo(Owner); + Owner.ConsumeItem(soulType); + shpc.storedSoulType = soulType; + shpc.storedSoulpower = SHPC.ShotsPerSoul; + } + else + { + SoulColors.Clear(); + } } ConsumeSoul = !ConsumeSoul; } diff --git a/Projectiles/Magic/Shadowbolt.cs b/Projectiles/Magic/Shadowbolt.cs index 1207adf6cd..d41828d09c 100644 --- a/Projectiles/Magic/Shadowbolt.cs +++ b/Projectiles/Magic/Shadowbolt.cs @@ -75,10 +75,10 @@ namespace CalamityMod.Projectiles.Magic if (reflectionTimer <= 0) { SoundStyle bounce = new("CalamityMod/Sounds/Item/ShadowboltReflect"); - SoundEngine.PlaySound(bounce with { Volume = 0.6f, Pitch = 0f }, platPosWall); + SoundEngine.PlaySound(bounce with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, platPosWall); for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; - Projectile.velocity = (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 5; + Projectile.velocity = (targetCenter - platPosCenter).SafeNormalize(Vector2.UnitX) * 12; reflecting = false; hasReboundOffPlat = true; time = 10; @@ -121,13 +121,13 @@ namespace CalamityMod.Projectiles.Magic GeneralParticleHandler.SpawnParticle(blastRing); SoundStyle wall = new("CalamityMod/Sounds/Item/ShadowboltWallHit"); - SoundEngine.PlaySound(wall with { Volume = 0.5f, Pitch = 0f }, platPosWall); + SoundEngine.PlaySound(wall with { Volume = 0.5f, Pitch = 0f, MaxInstances = -1 }, platPosWall); reflecting = true; Projectile.extraUpdates = 0; } } - if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 90)) + if (!hasReboundOffPlat && Projectile.numHits == 0 && !hasSetPlatSpawn && (Collision.SolidCollision(Projectile.Center, 20, 20) || time > 70)) { hasSetPlatSpawn = true; spawnPlat = true; @@ -151,6 +151,8 @@ namespace CalamityMod.Projectiles.Magic { if (time == 14) { + SoundEngine.PlaySound(SoundID.Item72 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = -1 }, Projectile.Center); + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.15f); for (int i = 0; i < 2; i++) { Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.3f, 0.75f, 12, true); @@ -176,7 +178,7 @@ namespace CalamityMod.Projectiles.Magic } if (time > 22 && time % 3 == 0) { - Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * 0.1f, false, 18, 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), Color.Lerp(Color.Indigo, Color.Orchid, 0.25f), new Vector2(0.7f, 1f), true, false, 0.3f); + Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 10, -Projectile.velocity * 0.1f, false, 18, 0.05f * (hasReboundOffPlat ? 1.1f : 0.5f), Color.Lerp(Color.Indigo, Color.Orchid, 0.25f), new Vector2(0.7f, 2f), true, false, 0.3f); GeneralParticleHandler.SpawnParticle(spark); } if (time > 30 && Main.rand.NextBool(12)) diff --git a/Projectiles/Magic/ShiftingSandsProj.cs b/Projectiles/Magic/ShiftingSandsProj.cs index 60f9c2608a..f5ca2df035 100644 --- a/Projectiles/Magic/ShiftingSandsProj.cs +++ b/Projectiles/Magic/ShiftingSandsProj.cs @@ -21,122 +21,170 @@ namespace CalamityMod.Projectiles.Magic Projectile.width = 18; Projectile.height = 18; Projectile.friendly = true; - Projectile.penetrate = 5; + Projectile.penetrate = 3; Projectile.DamageType = DamageClass.Magic; - Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.tileCollide = false; + Projectile.localNPCHitCooldown = 12; } public override void AI() { - if (Projectile.soundDelay == 0 && Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y) > 2f) - { - Projectile.soundDelay = 10; - SoundEngine.PlaySound(SoundID.Item20, Projectile.Center); - } - int sand = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.UnusedBrown, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[sand]; - dust.velocity *= 0.3f; - dust.position.X = Projectile.Center.X + 4f + (float)Main.rand.Next(-4, 5); - dust.position.Y = Projectile.Center.Y + (float)Main.rand.Next(-4, 5); - dust.noGravity = true; + int maxVelocity = 32; + Player player = Main.player[Projectile.owner]; + int height = Main.maxTilesY * 16; + int heightRatio = 0; - if (Main.myPlayer == Projectile.owner && Projectile.ai[0] <= 0f) + if (Projectile.ai[0] >= 0f) + heightRatio = (int)(Projectile.ai[1] / (float)height); + + bool notBeingChanneled = Projectile.ai[0] == -1f || Projectile.ai[0] == -2f; + if (Projectile.penetrate == 1 && Projectile.ai[0] >= 0f && heightRatio == 0) { - Player player = Main.player[Projectile.owner]; - if (player.channel) + Projectile.ai[1] += height; + heightRatio = 1; + Projectile.netUpdate = true; + } + if (Projectile.penetrate == 1 && Projectile.ai[0] == -1f) + { + Projectile.ai[0] = -2f; + Projectile.netUpdate = true; + } + if (heightRatio > 0 || Projectile.ai[0] == -2f) + Projectile.localAI[0] += 1f; + + if (Main.myPlayer == Projectile.owner) + { + if (Projectile.ai[0] >= 0f) { - float speed = 18f; - float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - Projectile.Center.X; - float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - Projectile.Center.Y; - if (player.gravDir == -1f) + if (player.channel && player.HeldItem.shoot == Projectile.type) { - mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - Projectile.Center.Y; - } - Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); - float mouseDist = mouseVec.Length(); - if (Projectile.ai[0] < 0f) - { - Projectile.ai[0] += 1f; - } - if (mouseDist > speed) - { - mouseDist = speed / mouseDist; - mouseVec.X *= mouseDist; - mouseVec.Y *= mouseDist; - int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(Projectile.velocity.X * 1000f); - int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(Projectile.velocity.Y * 1000f); - if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) + Vector2 channelPos = Main.MouseWorld; + player.LimitPointToPlayerReachableArea(ref channelPos); + if (Projectile.ai[0] != channelPos.X || Projectile.ai[1] != channelPos.Y) { Projectile.netUpdate = true; + Projectile.ai[0] = channelPos.X; + Projectile.ai[1] = channelPos.Y + (float)(height * heightRatio); } - Projectile.velocity.X = mouseVec.X; - Projectile.velocity.Y = mouseVec.Y; } else { - int mouseSpeedX = (int)(mouseVec.X * 1000f); - int projSpeedX = (int)(Projectile.velocity.X * 1000f); - int mouseSpeedY = (int)(mouseVec.Y * 1000f); - int projSpeedY = (int)(Projectile.velocity.Y * 1000f); - if (mouseSpeedX != projSpeedX || mouseSpeedY != projSpeedY) + Projectile.netUpdate = true; + Projectile.ai[0] = -1f; + Projectile.ai[1] = -1f; + NPC homeTarget = ClosestNPCAtMagicMissileStyle(Projectile.Center, 800f); + if (homeTarget != null) { + int targetIndex = homeTarget.whoAmI; + if (targetIndex != -1) + Projectile.ai[1] = targetIndex; + } + else if (Projectile.velocity.Length() < 2f) + Projectile.velocity = Projectile.DirectionFrom(player.Center) * maxVelocity; + else + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.Zero) * maxVelocity; + } + } + + if (notBeingChanneled && Projectile.ai[1] == -1f) + { + NPC homeTarget = ClosestNPCAtMagicMissileStyle(Projectile.Center, 800f); + if (homeTarget != null) + { + int targetIndex = homeTarget.whoAmI; + if (targetIndex != -1) + { + Projectile.ai[1] = targetIndex; Projectile.netUpdate = true; } - Projectile.velocity.X = mouseVec.X; - Projectile.velocity.Y = mouseVec.Y; } } - else if (Projectile.ai[0] <= 0f) - { - Projectile.Calamity().conditionalHomingRange = 750f; - Projectile.netUpdate = true; - float speed = 12f; - Vector2 projCenter = Projectile.Center; - float mouseDistX = (float)Main.mouseX + Main.screenPosition.X - projCenter.X; - float mouseDistY = (float)Main.mouseY + Main.screenPosition.Y - projCenter.Y; - if (player.gravDir == -1f) - { - mouseDistY = Main.screenPosition.Y + (float)Main.screenHeight - (float)Main.mouseY - projCenter.Y; - } - Vector2 mouseVec = new Vector2(mouseDistX, mouseDistY); - float mouseDist = mouseVec.Length(); - if (mouseDist <= 2f || Projectile.ai[0] < 0f) - { - projCenter = player.Center; - mouseVec = Projectile.Center - projCenter; - mouseDist = mouseVec.Length(); - } - mouseDist = speed / mouseDist; - mouseVec.X *= mouseDist; - mouseVec.Y *= mouseDist; - Projectile.velocity.X = mouseVec.X; - Projectile.velocity.Y = mouseVec.Y; - if (Projectile.velocity.X == 0f && Projectile.velocity.Y == 0f) - { - Projectile.Kill(); - } - Projectile.ai[0] = 1f; - } } - if (Projectile.velocity.X != 0f || Projectile.velocity.Y != 0f) - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - if (Projectile.velocity.Y > 16f) - { - Projectile.velocity.Y = 16f; - } - } - public override bool PreDraw(ref Color lightColor) + Vector2 targetVector = Vector2.Zero; + float chaseLerp = 1f; + if (Projectile.ai[0] > 0f && Projectile.ai[1] > 0f) + targetVector = new Vector2(Projectile.ai[0], Projectile.ai[1] % height); + + if (notBeingChanneled && Projectile.ai[1] >= 0f) + { + Projectile.tileCollide = false; + NPC target = Main.npc[(int)Projectile.ai[1]]; + if (target.CanBeChasedBy()) + { + targetVector = target.Center; + float invFineL = Utils.GetLerpValue(0f, 100f, Projectile.Distance(targetVector), true) * Utils.GetLerpValue(600f, 400f, Projectile.Distance(targetVector), true); + chaseLerp = MathHelper.Lerp(0f, 0.2f, Utils.GetLerpValue(200f, 20f, 1f - invFineL, true)); + } + else + { + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; + } + } + + if (targetVector != Vector2.Zero) + { + if (Projectile.Distance(targetVector) >= 64f) + { + Vector2 distanceVector = targetVector - Projectile.Center; + Vector2 moveVelocity = distanceVector.SafeNormalize(Vector2.Zero); + float velocityMult = Math.Min(maxVelocity, distanceVector.Length()); + moveVelocity *= velocityMult; + if (Projectile.velocity.Length() < 4f) + Projectile.velocity += Projectile.velocity.RotatedBy(MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * 4f; + + Projectile.velocity = Vector2.Lerp(Projectile.velocity, moveVelocity, chaseLerp); + } + else + { + Projectile.velocity *= 0.3f; + Projectile.velocity += (targetVector - Projectile.Center) * 0.3f; + } + + if (Projectile.timeLeft < 60) + Projectile.timeLeft = 60; + } + + if (notBeingChanneled && Projectile.ai[1] < 0f) + { + if (Projectile.velocity.Length() != maxVelocity) + Projectile.velocity = Projectile.velocity.MoveTowards(Projectile.velocity.SafeNormalize(Vector2.UnitY) * maxVelocity, 4f); + + if (Projectile.timeLeft > 300) + Projectile.timeLeft = 300; + } + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + } + private NPC ClosestNPCAtMagicMissileStyle(Vector2 origin, float maxDistanceToCheck = 800f) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; + NPC closestTarget = null; + float distance = maxDistanceToCheck; + + for (int i = 0; i < Main.npc.Length; i++) + { + if (Main.npc[i].CanBeChasedBy() && Projectile.localNPCImmunity[i] == 0) + { + float extraDistance = (Main.npc[i].width / 2) + (Main.npc[i].height / 2); + if (Vector2.Distance(origin, Main.npc[i].Center) < distance) + { + distance = Vector2.Distance(origin, Main.npc[i].Center); + closestTarget = Main.npc[i]; + } + } + } + return closestTarget; + } + public override bool OnTileCollide(Vector2 oldVelocity) => Projectile.ai[0] < 0f; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.ai[0] == -1f) + { + Projectile.ai[1] = -1f; + Projectile.netUpdate = true; + } } public override void OnKill(int timeLeft) @@ -151,10 +199,10 @@ namespace CalamityMod.Projectiles.Magic Projectile.Damage(); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); int dustAmt = 36; - for (int index = 0; index < dustAmt; index++) + for (int i = 0; i < dustAmt; i++) { Vector2 dustPos = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustPos = dustPos.RotatedBy((double)((float)(index - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + dustPos = dustPos.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; Vector2 dustVel = dustPos - Projectile.Center; int sand = Dust.NewDust(dustPos + dustVel, 0, 0, DustID.UnusedBrown, dustVel.X * 1.5f, dustVel.Y * 1.5f, 100, default, 1.2f); Main.dust[sand].noGravity = true; @@ -162,5 +210,11 @@ namespace CalamityMod.Projectiles.Magic Main.dust[sand].velocity = dustVel; } } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + return false; + } } } diff --git a/Projectiles/Magic/Snowball.cs b/Projectiles/Magic/Snowball.cs index 451b62000a..e62ac2ff5b 100644 --- a/Projectiles/Magic/Snowball.cs +++ b/Projectiles/Magic/Snowball.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Magic Projectile.DamageType = DamageClass.Magic; Projectile.coldDamage = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; Projectile.coldDamage = true; } diff --git a/Projectiles/Magic/SylvBolt.cs b/Projectiles/Magic/SylvBolt.cs new file mode 100644 index 0000000000..de43d1b0f9 --- /dev/null +++ b/Projectiles/Magic/SylvBolt.cs @@ -0,0 +1,155 @@ +using System; +using CalamityMod.Graphics.Primitives; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +namespace CalamityMod.Projectiles.Magic +{ + public class SylvBolt : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Magic"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + /// + /// The color hue interpolant for this bolt. + /// + public ref float HueInterpolant => ref Projectile.ai[0]; + + /// + /// How many natural frames have elapsed so far throughout the duration of this bolt's life. Extra updates do not affect this timer. + /// + public int Time + { + get => (int)Projectile.ai[1]; + set => Projectile.ai[1] = value; + } + + /// + /// Whether this bolt is vanishing due to the a collision. + /// + public bool Vanishing + { + get => Projectile.ai[2] == 1f; + set => Projectile.ai[2] = value.ToInt(); + } + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 23; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.extraUpdates = 2; + Projectile.penetrate = 12; + Projectile.timeLeft = Projectile.extraUpdates * 90; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; + } + + public override void AI() + { + Projectile.velocity *= 1.004f; + if (Vanishing) + Vanish(); + + if (Projectile.FinalExtraUpdate()) + Time++; + + Projectile.scale = Utils.GetLerpValue(0f, 7f, Time, true); + + CreateMagicDust(); + + // Emit light. + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.45f); + } + + /// + /// Makes this bolt vanish. + /// + private void Vanish() + { + Projectile.Opacity = MathHelper.Lerp(Projectile.Opacity, 0f, 0.24f); + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + if (Projectile.Opacity <= 0.1f) + Projectile.Kill(); + } + + /// + /// Idly emits magic dust off this bolt. + /// + private void CreateMagicDust() + { + if (Main.rand.NextBool(4)) + { + Dust magic = Dust.NewDustPerfect(Projectile.Center, 264); + magic.color = ColorFunction(0f); + magic.scale *= 0.56f; + magic.noGravity = true; + } + } + + /// + /// The function responsible for dictating the color of this bolt. + /// + internal Color ColorFunction(float completionRatio) + { + float opacity = (1f - completionRatio) * Projectile.Opacity; + return CalamityUtils.MulticolorLerp(HueInterpolant, new Color(255, 193, 255), Color.White, new Color(127, 242, 255)) * opacity; + } + + /// + /// The function responsible for dictating the width of this bolt. + /// + internal float WidthFunction(float completionRatio) + { + float tip = 1f - MathF.Pow(1f - Utils.GetLerpValue(0.05f, 0.2f, completionRatio * Projectile.Opacity, true), 2f); + return tip * Projectile.Opacity * Projectile.scale * 22f; + } + + public override bool PreDraw(ref Color lightColor) + { + MiscShaderData boltShader = GameShaders.Misc["CalamityMod:SylvestaffProjectile"]; + + boltShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: boltShader), 80); + return false; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (!Vanishing && Projectile.penetrate < 2) + { + Vanishing = true; + Projectile.velocity *= 0.02f; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (!Vanishing) + { + Vanishing = true; + Projectile.velocity = Vector2.Zero; + Projectile.extraUpdates = 0; + Projectile.netUpdate = true; + } + return false; + } + + public override bool? CanDamage() => !Vanishing; + } +} diff --git a/Projectiles/Magic/SylvRay.cs b/Projectiles/Magic/SylvRay.cs new file mode 100644 index 0000000000..84bcfc66b4 --- /dev/null +++ b/Projectiles/Magic/SylvRay.cs @@ -0,0 +1,217 @@ +using System; +using System.IO; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Magic; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SylvRay : ModProjectile, ILocalizedModType + { + /// + /// The position from which this ray's glow effect appears. + /// + public Vector2 GlowCenter + { + get; + set; + } + + /// + /// How many natural frames have elapsed so far throughout the duration of this ray's life. Extra updates do not affect this timer. + /// + public int Time + { + get => (int)Projectile.ai[0]; + set => Projectile.ai[0] = value; + } + + public new string LocalizationCategory => "Projectiles.Magic"; + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 54; + ProjectileID.Sets.TrailingMode[Projectile.type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 4; + Projectile.height = 4; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Magic; + Projectile.ignoreWater = true; + Projectile.penetrate = 70; + Projectile.extraUpdates = 3; + Projectile.timeLeft = 60 * Projectile.extraUpdates; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void SendExtraAI(BinaryWriter writer) => writer.WriteVector2(GlowCenter); + + public override void ReceiveExtraAI(BinaryReader reader) => GlowCenter = reader.ReadVector2(); + + public override void AI() + { + if (Projectile.FinalExtraUpdate()) + Time++; + + Projectile.Opacity = Utils.GetLerpValue(0f, Projectile.MaxUpdates * 10f, Projectile.timeLeft, true); + Projectile.scale = Utils.GetLerpValue(1f, 9.5f, Time, true) * Projectile.Opacity; + + if (GlowCenter == Vector2.Zero) + GlowCenter = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.Zero) * 74f; + + HandleBoltFiring(); + CreateGlowyDust(); + + Lighting.AddLight(Projectile.Center, Vector3.One * Projectile.Opacity * 0.7f); + } + + /// + /// Handles the firing of bolts across this ray. + /// + private void HandleBoltFiring() + { + int shootRate = Sylvestaff.RayBoltShootRate; + if (Time % shootRate == 0 && Projectile.FinalExtraUpdate()) + { + int trailSearchPositions = 13; + for (int i = 0; i < trailSearchPositions; i += 3) + TryToFireBolt(Projectile.oldPos[i] + Projectile.Size * 0.5f, i / (float)trailSearchPositions); + } + } + + /// + /// Attempts to fire a given bolt projectile from a given position at the closest enemy to said position, assuming one exists. + /// + private void TryToFireBolt(Vector2 searchPosition, float hue) + { + NPC potentialTarget = searchPosition.ClosestNPCAt(Sylvestaff.RayBoltTargetingRange, false); + if (potentialTarget is null) + return; + + SoundEngine.PlaySound(Sylvestaff.BounceSound with { MaxInstances = 12, Volume = 0.4f, Pitch = 0.4f }, Projectile.Center); + + float shootSpeed = Projectile.velocity.Length(); + Vector2 shootVelocity = (potentialTarget.Center - searchPosition).SafeNormalize(Vector2.UnitY) * shootSpeed; + if (Projectile.owner == Main.myPlayer) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), searchPosition, shootVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, hue); + + float burstSpeed = Main.rand.NextFloat(1f, 3f); + for (int i = 0; i < 4; i++) + { + Dust magicBurst = Dust.NewDustPerfect(searchPosition, 264); + magicBurst.velocity = Projectile.velocity.RotatedBy(MathHelper.TwoPi * i / 4f + MathHelper.PiOver4).SafeNormalize(Vector2.Zero) * burstSpeed; + magicBurst.color = Color.White; + magicBurst.noLight = true; + magicBurst.noGravity = true; + } + } + + /// + /// Emits dust particles at the glow center of this ray, to help sell the notion that it's appearing from a concentrated ball of queer magic energy. + /// + private void CreateGlowyDust() + { + if (Time <= 9 && Main.rand.NextBool()) + { + Color colorAccent = Main.rand.NextBool() ? Color.HotPink : Color.Aqua; + + Dust transMagic = Dust.NewDustPerfect(GlowCenter, 264); + transMagic.velocity = Main.rand.NextVector2Circular(4.6f, 4.6f) + Projectile.velocity * 0.25f; + transMagic.color = Color.Lerp(Color.White, colorAccent, Main.rand.NextFloat(0.23f)); + transMagic.scale *= 1.1f; + transMagic.fadeIn = 0.75f; + transMagic.noGravity = true; + } + } + + /// + /// The function responsible for dictating the color of this ray. + /// + internal Color ColorFunction(float completionRatio) + { + float opacity = MathF.Pow(Utils.GetLerpValue(1f, 0.64f, completionRatio, true), 3f) * Projectile.Opacity; + float colorInterpolant = MathF.Cos(MathHelper.Pi * completionRatio - Main.GlobalTimeWrappedHourly * 7.2f) * 0.5f + 0.5f; + + Color pink = new Color(255, 147, 255); + Color blue = new Color(109, 224, 255); + Color baseColor = CalamityUtils.MulticolorLerp(colorInterpolant, pink, Color.White, blue, Color.White); + + return baseColor * opacity; + } + + /// + /// The function responsible for dictating the width of this ray. + /// + internal float WidthFunction(float completionRatio) + { + float expansionCompletion = 1f - MathF.Pow(1f - Utils.GetLerpValue(0f, 0.3f, completionRatio, true), 2f); + float undulation = MathF.Cos(MathHelper.Pi * completionRatio * 5f - Main.GlobalTimeWrappedHourly * 23f) * 2.4f; + float maxWidth = undulation + 32f; + + return MathHelper.Lerp(0f, Projectile.scale * maxWidth, expansionCompletion); + } + + /// + /// The function responsible for dictating the render offset of this ray. + /// + internal Vector2 OffsetFunction(float completionRatio) => Projectile.Size * 0.5f; + + /// + /// Renders the front-glow for this ray, to help make it look like it has a defined origin of concentrated magic. + /// + private void RenderFrontGlow() + { + float glowAnimationProgress = Utils.GetLerpValue(0f, 9.5f, Time, true); + float glowBump = CalamityUtils.Convert01To010(glowAnimationProgress); + float glowRotation = Projectile.velocity.ToRotation(); + Vector2 glowScale = new Vector2(1f + glowBump * 0.8f, 1f) * glowBump; + + Vector2 startingPosition = GlowCenter - Main.screenPosition; + Texture2D lightTexture = ModContent.Request("CalamityMod/ExtraTextures/BloomCirclePinpoint").Value; + Main.spriteBatch.Draw(lightTexture, startingPosition, null, ColorFunction(0f) with { A = 0 }, glowRotation, lightTexture.Size() * 0.5f, glowScale, 0, 0f); + Main.spriteBatch.Draw(lightTexture, startingPosition, null, ColorFunction(0f) with { A = 0 }, glowRotation, lightTexture.Size() * 0.5f, glowScale * 0.4f, 0, 0f); + } + + public override bool PreDraw(ref Color lightColor) + { + RenderFrontGlow(); + + MiscShaderData rayShader = GameShaders.Misc["CalamityMod:SylvestaffProjectile"]; + rayShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/ScarletDevilStreak")); + + PrimitiveRenderer.RenderTrail(Projectile.oldPos, new PrimitiveSettings(WidthFunction, ColorFunction, OffsetFunction, pixelate: false, shader: rayShader), 32); + return false; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.penetrate--; + if (Projectile.penetrate <= 0) + { + Projectile.Kill(); + } + else + { + SoundEngine.PlaySound(Sylvestaff.BounceSound, Projectile.Center); + + if (Projectile.velocity.X != oldVelocity.X) + Projectile.velocity.X = -oldVelocity.X; + if (Projectile.velocity.Y != oldVelocity.Y) + Projectile.velocity.Y = -oldVelocity.Y; + } + return false; + } + } +} diff --git a/Projectiles/Magic/SylvestaffHoldout.cs b/Projectiles/Magic/SylvestaffHoldout.cs new file mode 100644 index 0000000000..3109ae5bff --- /dev/null +++ b/Projectiles/Magic/SylvestaffHoldout.cs @@ -0,0 +1,262 @@ +using System; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Physics; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Magic +{ + public class SylvestaffHoldout : ModProjectile, IPixelatedPrimitiveRenderer + { + public PixelationPrimitiveLayer LayerToRenderTo => PixelationPrimitiveLayer.BeforeProjectiles | PixelationPrimitiveLayer.AfterPlayers; + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + + /// + /// The left ribbon on this holdout. + /// + public RopeHandle? LeftRibbon; + + /// + /// The right ribbon on this holdout. + /// + public RopeHandle? RightRibbon; + + /// + /// The player owner of this holdout staff. + /// + public Player Owner => Main.player[Projectile.owner]; + + /// + /// A general purpose, ever-increment timer used by this holdout staff. + /// + public ref float Time => ref Projectile.ai[0]; + + /// + /// The point of attachment for ribbons on this staff. + /// + public Vector2 RibbonAttachPoint => Projectile.Center + Projectile.velocity * Projectile.scale * Projectile.width * 0.34f; + + /// + /// The length of ribbons attached to this staff. + /// + private static float RibbonLength => 70f; + + public override string Texture => ModContent.GetInstance().Texture; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 94; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Magic; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.timeLeft = 72000; + } + + public override void AI() + { + if (!Owner.channel) + Projectile.Kill(); + + if (LeftRibbon is null && RightRibbon is null) + InitializeRibbons(); + + AimTowardsMouse(); + HandleHoldoutLogic(); + OrientOwnerArms(); + FireAwesomeMagicRays(); + UpdateRibbon(LeftRibbon, Projectile.velocity.RotatedBy(-MathHelper.PiOver2)); + UpdateRibbon(RightRibbon, Projectile.velocity.RotatedBy(MathHelper.PiOver2)); + + Time++; + } + + /// + /// Initializes the ribbons attached to this staff. + /// + private void InitializeRibbons() + { + int ribbonSegmentCount = 12; + float distancePerSegment = RibbonLength / ribbonSegmentCount; + RopeSettings ribbonSettings = new RopeSettings() + { + StartIsFixed = true, + Mass = 0.72f, + RespondToEntityMovement = true, + RespondToWind = true + }; + LeftRibbon = ModContent.GetInstance().RequestNew(RibbonAttachPoint, Projectile.Center, ribbonSegmentCount, distancePerSegment, Vector2.Zero, ribbonSettings, 25); + RightRibbon = ModContent.GetInstance().RequestNew(RibbonAttachPoint, Projectile.Center, ribbonSegmentCount, distancePerSegment, Vector2.Zero, ribbonSettings, 25); + } + + /// + /// Handles all logic pertaining to making this staff act as a holdout projectile. + /// + private void HandleHoldoutLogic() + { + Vector2 center = Owner.MountedCenter + Vector2.UnitY * 7f + Projectile.velocity * Projectile.width * 0.31f; + + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Center = Owner.RotatedRelativePoint(center) - Vector2.UnitY * Owner.gfxOffY; + Projectile.spriteDirection = (Math.Cos(Projectile.rotation) > 0).ToDirectionInt(); + + // The staff is a holdout projectile; change the player's variables to reflect this. + Owner.ChangeDir(Projectile.spriteDirection); + Owner.SetDummyItemTime(2); + Owner.heldProj = Projectile.whoAmI; + + Projectile.rotation += MathHelper.PiOver4; + if (Projectile.spriteDirection == -1) + Projectile.rotation += MathHelper.PiOver2; + } + + /// + /// Orients the owner player's arm rotation to help make it look like they're actually holding the staff. + /// + private void OrientOwnerArms() + { + float baseRotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + float directionVerticality = MathF.Abs(Projectile.velocity.X); + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, baseRotation + Owner.direction * directionVerticality * MathHelper.PiOver4); + Owner.SetCompositeArmBack(true, Player.CompositeArmStretchAmount.Full, baseRotation + Owner.direction * directionVerticality * 0.33f); + } + + /// + /// Makes this staff aim towards the owner's mouse. + /// + private void AimTowardsMouse() + { + if (Main.myPlayer != Projectile.owner) + return; + + Vector2 idealDirection = Projectile.SafeDirectionTo(Main.MouseWorld); + Vector2 newDirection = Vector2.Lerp(Projectile.velocity, idealDirection, Sylvestaff.TurnSpeedInterpolant).SafeNormalize(Vector2.UnitX * Owner.direction); + if (Projectile.velocity != newDirection) + { + Projectile.velocity = newDirection; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + } + + /// + /// Updates a given ribbon. + /// + private void UpdateRibbon(RopeHandle? ribbon, Vector2 gravityDirection) + { + // Ensure that the handle is properly initialized before proceeding any further. + if (ribbon is not RopeHandle rope) + return; + + rope.Start = RibbonAttachPoint; + rope.Gravity = gravityDirection * 0.15f - Projectile.velocity * 0.4f; + } + + /// + /// Handles the firing of magic ray projectiles for this staff. + /// + private void FireAwesomeMagicRays() + { + Item heldItem = Owner.ActiveItem(); + if (heldItem is null) + return; + + if (Time % heldItem.useAnimation == heldItem.useAnimation - 1 && Owner.CheckMana(heldItem.mana, true)) + { + SoundEngine.PlaySound(Sylvestaff.FireSound, Projectile.Center); + if (Main.myPlayer == Projectile.owner) + { + int damage = Owner.GetWeaponDamage(heldItem); + Vector2 shootVelocity = Projectile.velocity * heldItem.shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, shootVelocity, ModContent.ProjectileType(), damage, heldItem.knockBack, Projectile.owner); + + // Apply a minor amount of recoil. + Projectile.velocity -= Projectile.velocity.RotatedBy(Projectile.spriteDirection * MathHelper.PiOver2) * Sylvestaff.StaffRecoilForce; + } + } + } + + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) + { + bool backLayer = layer == PixelationPrimitiveLayer.BeforeProjectiles; + RenderRibbon(LeftRibbon, -1, backLayer); + RenderRibbon(RightRibbon, 1, backLayer); + } + + /// + /// The function responsible for dictating the width of this staff's ribbons. + /// + private float RibbonWidthFunction(float completionRatio) => Projectile.scale * Utils.GetLerpValue(0f, 0.2f, completionRatio, true) * 3.6f; + + /// + /// The function responsible for dictating the color of this staff's ribbons. + /// + private Color RibbonColorFunction(float completionRatio) + { + Color light = Lighting.GetColor(RibbonAttachPoint.ToTileCoordinates()); + return Projectile.GetAlpha(light); + } + + /// + /// Renders one of this staff's ribbons. + /// + private void RenderRibbon(RopeHandle? ribbon, int direction, bool backLayer) + { + // Ensure that the handle is properly initialized before proceeding any further. + if (ribbon is not RopeHandle rope) + return; + + Vector2 forwardDirection = Projectile.velocity; + Vector2 sideDirection = forwardDirection.RotatedBy(MathHelper.PiOver2 * direction); + Vector2 attachmentPoint = RibbonAttachPoint; + Vector2[] ribbonPositions = [.. rope.Positions]; + int positionCount = ribbonPositions.Length; + for (int i = 0; i < ribbonPositions.Length; i++) + { + float completionRatio = i / (float)positionCount; + float wave = MathF.Cos(MathHelper.Pi * completionRatio * 1.5f - MathHelper.TwoPi * Time / 97f) * completionRatio; + + Vector2 backwardsOffset = forwardDirection * i * -RibbonLength / positionCount; + Vector2 sideWavyOffset = sideDirection * wave * RibbonLength * 0.5f; + Vector2 rigidPosition = attachmentPoint + backwardsOffset + sideWavyOffset; + + ribbonPositions[i] = Vector2.Lerp(ribbonPositions[i], rigidPosition, 0.76f); + } + + Vector2 intersectionPosition = Vector2.Transform((Projectile.Center - Main.screenPosition) * 0.5f, Main.GameViewMatrix.TransformationMatrix); + MiscShaderData ribbonShader = GameShaders.Misc["CalamityMod:SylvestaffRibbon"]; + ribbonShader.UseShaderSpecificData(new Vector4(intersectionPosition.X, intersectionPosition.Y, sideDirection.X, sideDirection.Y)); + ribbonShader.UseSaturation(backLayer ? -1f : 1f); + + PrimitiveSettings primitiveSettings = new PrimitiveSettings(RibbonWidthFunction, RibbonColorFunction, pixelate: true, shader: ribbonShader); + PrimitiveRenderer.RenderTrail(ribbonPositions, primitiveSettings, 33); + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request(Texture).Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() * 0.5f, Projectile.scale, direction, 0f); + return false; + } + + public override void OnKill(int timeLeft) + { + LeftRibbon?.Dispose(); + RightRibbon?.Dispose(); + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Magic/TearsofHeavenProjectile.cs b/Projectiles/Magic/TearsofHeavenProjectile.cs index c3c2809d12..695d4f8515 100644 --- a/Projectiles/Magic/TearsofHeavenProjectile.cs +++ b/Projectiles/Magic/TearsofHeavenProjectile.cs @@ -62,7 +62,8 @@ namespace CalamityMod.Projectiles.Magic public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(BuffID.OnFire3, 180); + target.AddBuff(BuffID.Frostburn2, 180); } } } diff --git a/Projectiles/Magic/ValkyrieRayBeam.cs b/Projectiles/Magic/ValkyrieRayBeam.cs index d1f2164ad8..a44f2244de 100644 --- a/Projectiles/Magic/ValkyrieRayBeam.cs +++ b/Projectiles/Magic/ValkyrieRayBeam.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Projectiles.Magic // The beam itself still stops on tiles, but its invisible "source" projectile ignores them. Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.localNPCHitCooldown = -1; // The beam lasts for only some frames and fades out over that time. Projectile.timeLeft = Lifetime; diff --git a/Projectiles/Magic/ValkyrieRayStaff.cs b/Projectiles/Magic/ValkyrieRayStaff.cs index 0fa15fb048..a84949c126 100644 --- a/Projectiles/Magic/ValkyrieRayStaff.cs +++ b/Projectiles/Magic/ValkyrieRayStaff.cs @@ -35,9 +35,9 @@ namespace CalamityMod.Projectiles.Magic // Calculate how quickly the staff should charge. Charge increases by some number close to 1 every frame. // Speed increasing reforges make this number greater than 1. Slowing reforges make it smaller than 1. if (Projectile.localAI[0] == 0f) - Projectile.localAI[0] = 47f / player.ActiveItem().useTime; + Projectile.localAI[0] = (ValkyrieRay.ChargeFrames + ValkyrieRay.CooldownFrames) / player.ActiveItem().useTime; - // Increment the timer for the staff. If the timer has passed 47, destroy it. + // Increment the timer for the staff. If the timer has passed the total time, destroy it. Projectile.ai[0] += Projectile.localAI[0]; int maxTime = ValkyrieRay.ChargeFrames + ValkyrieRay.CooldownFrames; if (Projectile.ai[0] > maxTime) @@ -127,8 +127,8 @@ namespace CalamityMod.Projectiles.Magic private void FiringEffects(Vector2 center) { - SoundEngine.PlaySound(SoundID.Item28, center); - SoundEngine.PlaySound(SoundID.Item60, center); + SoundEngine.PlaySound(SoundID.Item28 with { Volume = 0.7f }, center); + SoundEngine.PlaySound(SoundID.Item60 with { Volume = 0.7f }, center); int numDust = 36; int dustID = 73; for (int i = 0; i < numDust; ++i) diff --git a/Projectiles/Magic/VitriolicViperSpit.cs b/Projectiles/Magic/VitriolicViperSpit.cs index 3dbd357902..441f6044a2 100644 --- a/Projectiles/Magic/VitriolicViperSpit.cs +++ b/Projectiles/Magic/VitriolicViperSpit.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Magic } if (time > 3) - Projectile.Center += offset * direction; + Projectile.Center += offset * direction * Utils.GetLerpValue(3, 10, time, true); if (time > 3 && targetDist < 1400) { diff --git a/Projectiles/Magic/VoidVortexProj.cs b/Projectiles/Magic/VoidVortexProj.cs index c0a5cfbf3f..314b58ac56 100644 --- a/Projectiles/Magic/VoidVortexProj.cs +++ b/Projectiles/Magic/VoidVortexProj.cs @@ -145,9 +145,12 @@ namespace CalamityMod.Projectiles.Magic Projectile.ExpandHitboxBy(400); Projectile.Damage(); - for (int k = 0; k < 12; k++) + if (Main.myPlayer == Projectile.owner) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + for (int k = 0; k < 12; k++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, new Vector2(10, 10).RotatedByRandom(100) * Main.rand.NextFloat(0.4f, 0.55f), ModContent.ProjectileType(), Projectile.damage / 6, 0f, Main.myPlayer, 0f, 0f, 3f); + } } for (int k = 0; k < 40; k++) { diff --git a/Projectiles/Magic/VolterionHoldout.cs b/Projectiles/Magic/VolterionHoldout.cs index 9fae60413e..8d12d3b4d0 100644 --- a/Projectiles/Magic/VolterionHoldout.cs +++ b/Projectiles/Magic/VolterionHoldout.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; +using ReLogic.Utilities; using Terraria; using Terraria.Audio; using Terraria.GameContent; @@ -26,6 +27,7 @@ namespace CalamityMod.Projectiles.Magic public override string Texture => "CalamityMod/Projectiles/Magic/VolterionHoldout"; public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/VolterionFire") { Volume = 0.35f }; + public SlotId FireSoundSlot; public ref float FlashTimer => ref Projectile.ai[0]; @@ -46,9 +48,8 @@ namespace CalamityMod.Projectiles.Magic public override void KillHoldoutLogic() { - // Only times out if at the final frame (post-firing resting time) - bool noMana = !Owner.CheckMana(Owner.ActiveItem()) && Projectile.frame == 14; - if (HeldItem.type != Owner.ActiveItem().type || noMana) + // Override typical CantUseHoldout such that the weapon typically runs through the use animation while not channeled + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead || !Owner.active) { Projectile.Kill(); Projectile.netUpdate = true; @@ -74,7 +75,7 @@ namespace CalamityMod.Projectiles.Magic // Subtract a flat 42 from the use time because the firing animation consists of 14 frames at 20 FPS if (Projectile.frameCounter >= MathHelper.Clamp(Owner.ActiveItem().useAnimation - 42, 0f, Owner.ActiveItem().useAnimation)) { - if (Owner.CantUseHoldout()) + if (Owner.CantUseHoldout() || !Owner.CheckMana(Owner.ActiveItem())) Projectile.Kill(); Projectile.frame = 0; @@ -100,7 +101,9 @@ namespace CalamityMod.Projectiles.Magic if (Owner.CheckMana(Owner.ActiveItem(), -1, true)) { FlashTimer = 4f; - SoundEngine.PlaySound(FireSound, GunTipPosition); + FireSoundSlot = SoundEngine.PlaySound(FireSound, GunTipPosition); + if (Owner.Calamity().GeneralScreenShakePower < 3f) + Owner.Calamity().GeneralScreenShakePower = 3f; // Start from slightly behind the tip Vector2 offsetPos = GunTipPosition - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 18f; @@ -126,6 +129,9 @@ namespace CalamityMod.Projectiles.Magic Projectile.frameCounter = 0; } } + + if (SoundEngine.TryGetActiveSound(FireSoundSlot, out var currentSound) && currentSound.IsPlaying) + currentSound.Position = GunTipPosition; } // Muzzle flash can deal damage diff --git a/Projectiles/Magic/ThunderboltOrb.cs b/Projectiles/Magic/VolterionOrb.cs similarity index 100% rename from Projectiles/Magic/ThunderboltOrb.cs rename to Projectiles/Magic/VolterionOrb.cs diff --git a/Projectiles/Magic/ThunderboltShot.cs b/Projectiles/Magic/VolterionShot.cs similarity index 100% rename from Projectiles/Magic/ThunderboltShot.cs rename to Projectiles/Magic/VolterionShot.cs diff --git a/Projectiles/Magic/YharimsCrystalBeam.cs b/Projectiles/Magic/YharimsCrystalBeam.cs index d9a8f4bb10..2f72ac129f 100644 --- a/Projectiles/Magic/YharimsCrystalBeam.cs +++ b/Projectiles/Magic/YharimsCrystalBeam.cs @@ -312,7 +312,6 @@ namespace CalamityMod.Projectiles.Magic { switch (name) { - case "Fabsol": case "Ziggums": return 2f; case "Poly": diff --git a/Projectiles/Melee/AbyssBladeProjectile.cs b/Projectiles/Melee/AbyssBladeProjectile.cs index 1ea0f6191b..cb0d83bc3f 100644 --- a/Projectiles/Melee/AbyssBladeProjectile.cs +++ b/Projectiles/Melee/AbyssBladeProjectile.cs @@ -159,6 +159,7 @@ namespace CalamityMod.Projectiles.Melee GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.DodgerBlue, Color.MediumBlue, Main.rand.NextFloat(2.5f, 2.9f) - i * 0.55f, 14, Main.rand.NextFloat(-0.01f, 0.01f), 2.5f); GeneralParticleHandler.SpawnParticle(sparker); } + Projectile.ResetLocalNPCHitImmunity(); Projectile.penetrate = 1; Projectile.damage = (int)(startDamage * 2); // Launched blade deals 200% damage Time = 0; diff --git a/Projectiles/Melee/AncientStar.cs b/Projectiles/Melee/AncientStar.cs index d798f5435c..bc1885c66b 100644 --- a/Projectiles/Melee/AncientStar.cs +++ b/Projectiles/Melee/AncientStar.cs @@ -50,11 +50,6 @@ namespace CalamityMod.Projectiles.Melee } } - if (Projectile.timeLeft < MaxTime - 5) - { - Projectile.tileCollide = true; - } - if (Timer / MaxTime > 0.25f) { Projectile.velocity *= 0.95f; diff --git a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs index cf2aace6b5..ed61618cec 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_ParryHoldout.cs @@ -41,6 +41,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.noEnchantmentVisuals = true; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; + Projectile.timeLeft = (int)MaxTime; } public override bool? CanDamage() => Timer <= ParryTime && AlreadyParried == 0f; @@ -108,7 +109,7 @@ namespace CalamityMod.Projectiles.Melee { if (!initialized) //Initialization { - Projectile.timeLeft = (int)MaxTime; + //Projectile.timeLeft = (int)MaxTime; SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction diff --git a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs index 65c5cce750..854b5d2c48 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_SwungBlade.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Sounds; @@ -273,6 +274,15 @@ namespace CalamityMod.Projectiles.Melee float extraRotations = (direction.ToRotation() + MathHelper.PiOver4 > Projectile.velocity.ToRotation()) ? -MathHelper.TwoPi : 0f; Projectile.rotation = MathHelper.Lerp(Projectile.velocity.ToRotation(), direction.ToRotation() + extraRotations, orientateProperly); + if (ChanceMissed == 0f && Owner.controlUseTile && ThrowCompletion > 0.99f) + { + ArkoftheCosmos sword = (Owner.HeldItem.ModItem as ArkoftheCosmos); + Projectile parrier = Main.projectile.FirstOrDefault(p => p.active && p.owner == Owner.whoAmI && p.type == ProjectileType(), null); + if (sword is not null && parrier is null) + { + int parryID = Projectile.NewProjectile(Owner.GetSource_ItemUse(sword.Item), Owner.Center, Owner.DirectionTo(Projectile.Center), ModContent.ProjectileType(), 0, 0, Owner.whoAmI); + } + } } //Sharticles diff --git a/Projectiles/Melee/Blood.cs b/Projectiles/Melee/Blood.cs index d87e1880b7..da2bb26ee6 100644 --- a/Projectiles/Melee/Blood.cs +++ b/Projectiles/Melee/Blood.cs @@ -42,16 +42,6 @@ namespace CalamityMod.Projectiles.Melee CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 600f, 6f, 20f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int heal = (int)Math.Round(hit.Damage * 0.075); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.075)); } } diff --git a/Projectiles/Melee/BotanicSpear.cs b/Projectiles/Melee/BotanicSpear.cs index f42ce6103b..c6409abe97 100644 --- a/Projectiles/Melee/BotanicSpear.cs +++ b/Projectiles/Melee/BotanicSpear.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.height = 16; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; + Projectile.penetrate = 2; Projectile.tileCollide = false; Projectile.timeLeft = TimeLeft; Projectile.usesLocalNPCImmunity = true; diff --git a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs index 8c7e3ac1c3..4f6706afe6 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_DecaysRetort.cs @@ -25,9 +25,6 @@ namespace CalamityMod.Projectiles.Melee public const float LungeSpeed = 16; public ref float CanBounce => ref Projectile.localAI[0]; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -91,20 +88,14 @@ namespace CalamityMod.Projectiles.Melee Owner.velocity = direction.SafeNormalize(Vector2.UnitX * Owner.direction) * LungeSpeed; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); - - private void OnHitEffects(bool cannotLifesteal) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Projectile.ForceNetUpdate(); if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) return; - if (!cannotLifesteal) //trolled - { - Owner.HealPlayer(BrokenBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck - } + Owner.DoLifestealDirect(target, BrokenBiomeBlade.EvilAttunement_Lifesteal, 1.25f); //Idk if its too much or what but at the same time its close range as fuck // Bounce off float bounceStrength = LungeSpeed / 2f; diff --git a/Projectiles/Melee/CometQuasherHoldout.cs b/Projectiles/Melee/CometQuasherHoldout.cs index 8a5e54dcfd..bd253b4c53 100644 --- a/Projectiles/Melee/CometQuasherHoldout.cs +++ b/Projectiles/Melee/CometQuasherHoldout.cs @@ -222,7 +222,7 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, 0, 4); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0, Projectile.owner, 0, Main.rand.Next(3), 4); spawnBoom = false; } } diff --git a/Projectiles/Melee/CometQuasherMeteor.cs b/Projectiles/Melee/CometQuasherMeteor.cs index f9ab862f37..b195a428aa 100644 --- a/Projectiles/Melee/CometQuasherMeteor.cs +++ b/Projectiles/Melee/CometQuasherMeteor.cs @@ -87,11 +87,20 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - if (Projectile.Calamity().lineColor == 1) - tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value; - if (Projectile.Calamity().lineColor == 2) - tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3").Value; + Texture2D tex; + switch (Projectile.ai[1]) + { + case 0: + default: + tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + break; + case 1: + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor2").Value; + break; + case 2: + tex = ModContent.Request("CalamityMod/Projectiles/Melee/CometQuasherMeteor3").Value; + break; + } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], Color.White, 1, tex); return false; diff --git a/Projectiles/Melee/CosmicDischargeFlail.cs b/Projectiles/Melee/CosmicDischargeFlail.cs index df46b60a8a..d070b22adc 100644 --- a/Projectiles/Melee/CosmicDischargeFlail.cs +++ b/Projectiles/Melee/CosmicDischargeFlail.cs @@ -23,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; + Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 6 * Projectile.MaxUpdates; Projectile.coldDamage = true; - Projectile.extraUpdates = 1; } public override Color SpecialDrawColor => new Color(150, 255, 255); diff --git a/Projectiles/Melee/CosmicShivBlade.cs b/Projectiles/Melee/CosmicShivBlade.cs index 074d2769c8..1e2714859a 100644 --- a/Projectiles/Melee/CosmicShivBlade.cs +++ b/Projectiles/Melee/CosmicShivBlade.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Texture2D texture = TextureAssets.Projectile[Type].Value; Rectangle sourceRectangle = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Vector2 origin = sourceRectangle.Size() / 2f; float rotation = Projectile.rotation; diff --git a/Projectiles/Melee/DNA.cs b/Projectiles/Melee/DNA.cs deleted file mode 100644 index 671209f27b..0000000000 --- a/Projectiles/Melee/DNA.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class DNA : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public static int TotalSegments = 10; - - public override void SetDefaults() - { - Projectile.width = 22; - Projectile.height = 72; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 6; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.ai[1] == 0f) - { - Projectile.alpha -= 100; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.ai[1] = 1f; - - // This projectile normally does not move by itself, so this will manually move it one time only - // This is only for the first segment - if (Projectile.ai[0] == 0f) - { - Projectile.ai[0]++; - Projectile.position += Projectile.velocity; - } - - // Spawn the next segment - if (Main.myPlayer == Projectile.owner && Projectile.ai[0] < TotalSegments) - { - int nextSegment = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.velocity, Projectile.velocity, Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0] + 1f); - NetMessage.SendData(MessageID.SyncProjectile, -1, -1, null, nextSegment); - } - } - } - else // Begin fading out - { - int AlphaPerFrame = 15; - Projectile.alpha += AlphaPerFrame; - if (Projectile.alpha == AlphaPerFrame * 14) - { - for (int i = 0; i < 3; i++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f, 200, default, 1f); - dust.noGravity = true; - dust.velocity *= 0.5f; - } - } - - if (Projectile.alpha >= 255) - Projectile.Kill(); - } - if (Main.rand.NextBool(10)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.velocity.X * 0.005f, Projectile.velocity.Y * 0.005f); - } - - // This is essential for Vilethorn-type projectiles, as velocity is a stored parameter and isn't supposed to actually move the projectile - public override bool ShouldUpdatePosition() => false; - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); - - public override void OnKill(int timeLeft) - { - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch, Projectile.oldVelocity.X * 0.005f, Projectile.oldVelocity.Y * 0.005f); - } - } -} diff --git a/Projectiles/Melee/DNA.png b/Projectiles/Melee/DNA.png deleted file mode 100644 index 67167a046b..0000000000 Binary files a/Projectiles/Melee/DNA.png and /dev/null differ diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs index 16d5f599b0..4e5c1dd466 100644 --- a/Projectiles/Melee/DevilsDevastationHoldout.cs +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -64,6 +64,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = -1; Projectile.DamageType = TrueMeleeDamageClass.Instance; } + public override void OnSpawn(IEntitySource source) + { + base.OnSpawn(source); + // This is needed because EntitySource_ItemUse always sets Projectile.originalDamage to the item's damage, + // regardless of the value passed into the damage argument of NewProjectile. + // This results in continuous updating damage resetting the damage. + Projectile.originalDamage *= 15; + } public override void WhenSpawned() { IgnoreActiveAnimation = true; @@ -97,6 +105,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType(), 0, 0f, Owner.whoAmI, 1, 0); } Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); + strike.DamageType = DamageClass.Melee; SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center); diff --git a/Projectiles/Melee/DevilsSunriseCyclone.cs b/Projectiles/Melee/DevilsSunriseCyclone.cs index cab7c87dbf..4e5e3888ab 100644 --- a/Projectiles/Melee/DevilsSunriseCyclone.cs +++ b/Projectiles/Melee/DevilsSunriseCyclone.cs @@ -141,9 +141,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(HitSound, target.Center); target.AddBuff(ModContent.BuffType(), 180); // Heals on each hit - Player own = Main.player[Projectile.owner]; - if (!own.moonLeech) - own.HealPlayer(1); + Main.player[Projectile.owner].DoLifestealDirect(target, 1, 0.75f); // Start slicing the hit enemy if not doing so already if (State != 2f) diff --git a/Projectiles/Melee/DragonRageStaff.cs b/Projectiles/Melee/DragonRageStaff.cs index 29a8413530..5286f392d9 100644 --- a/Projectiles/Melee/DragonRageStaff.cs +++ b/Projectiles/Melee/DragonRageStaff.cs @@ -161,7 +161,7 @@ namespace CalamityMod.Projectiles.Melee { CalamityPlayer modPlayer = Main.player[Projectile.owner].Calamity(); modPlayer.dragonRageHits++; - if (modPlayer.dragonRageHits > 10 && modPlayer.dragonRageCooldown <= 0) + if (modPlayer.dragonRageHits >= 10 && modPlayer.dragonRageCooldown <= 0) { SpawnFireballs(); modPlayer.dragonRageHits = 0; diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index 8406697e38..e7800cc539 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -302,11 +302,11 @@ namespace CalamityMod.Projectiles.Melee spawnBoom = false; } - int healPower = Projectile.ai[1] == -1 ? 90 : 80; - int heal = (int)(MathHelper.Clamp(healPower - Projectile.numHits * 75, 1, healPower)); + int healPower = Projectile.ai[1] == -1 ? 60 : 50; + int heal = (int)(MathHelper.Clamp(healPower - Projectile.numHits * 35, 1, healPower)); if (Projectile.numHits < 10) { - Owner.HealPlayer(heal); + Owner.DoLifestealDirect(target, heal, 0.2f); } if (Projectile.numHits <= 2) diff --git a/Projectiles/Melee/EmpyreanKnife.cs b/Projectiles/Melee/EmpyreanKnife.cs index 26ee16b06f..89cf2d5927 100644 --- a/Projectiles/Melee/EmpyreanKnife.cs +++ b/Projectiles/Melee/EmpyreanKnife.cs @@ -78,29 +78,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int heal = (int)Math.Round(hit.Damage * 0.015); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - int heal = (int)Math.Round(info.Damage * 0.015); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.015), 0.75f); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/EssenceScythe.cs b/Projectiles/Melee/EssenceScythe.cs index f487a0cd93..0e922a90f5 100644 --- a/Projectiles/Melee/EssenceScythe.cs +++ b/Projectiles/Melee/EssenceScythe.cs @@ -23,16 +23,16 @@ namespace CalamityMod.Projectiles.Melee Projectile.width = 100; Projectile.height = 78; Projectile.aiStyle = ProjAIStyleID.Sickle; + AIType = ProjectileID.DeathSickle; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; - Projectile.alpha = 55; - Projectile.penetrate = 10; - Projectile.timeLeft = 300; Projectile.ignoreWater = true; - AIType = ProjectileID.DeathSickle; + Projectile.alpha = 55; + Projectile.penetrate = 5; + Projectile.timeLeft = 300; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 2; + Projectile.idStaticNPCHitCooldown = 3; } public override void AI() @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Melee Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ShadowbeamStaff, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); } - CalamityUtils.HomeInOnNPC(Projectile, true, 300f, 12f, 20f); + CalamityUtils.HomeInOnNPC(Projectile, true, 512f, 12f, 20f); } public override bool PreDraw(ref Color lightColor) @@ -78,11 +78,8 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - if (target.life <= 0 && target.lifeMax > 5) - { - if (Projectile.owner == Main.myPlayer) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 8, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); - } + if (target.life <= 0) + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), 8, 0f); } } } diff --git a/Projectiles/Melee/ExobladeProj.cs b/Projectiles/Melee/ExobladeProj.cs index 884824bdbe..90957183db 100644 --- a/Projectiles/Melee/ExobladeProj.cs +++ b/Projectiles/Melee/ExobladeProj.cs @@ -628,17 +628,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.NewProjectile(Projectile.GetSource_FromAI(), target.Center, Vector2.Zero, ModContent.ProjectileType(), explosionDamage, 0f, Projectile.owner); } - if (target.lifeMax <= 5 || Owner.lifeSteal <= 0) - return; - - int healAmt = (int)Math.Round(hit.Damage * 0.04); - if (healAmt > BalancingConstants.LifeStealCap) - healAmt = BalancingConstants.LifeStealCap; - - if (healAmt <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Owner, healAmt, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + Owner.DoLifestealDirect(target, (int)Math.Round(hit.Damage * 0.04), 0.4f); } } diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index c473cb8de7..0e9dd39a3d 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -263,8 +263,7 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 1f && Main.myPlayer == Projectile.owner && !AnyProjectiles(ProjectileType())) { Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI); - if (proj.ModProjectile is PhoenixsPrideFirewall fire) - fire.Scale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + (proj.ModProjectile as PhoenixsPrideFirewall).Scale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); } } diff --git a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs index 2f4a52d81d..90f305fa35 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs @@ -1,8 +1,10 @@ using CalamityMod.CalPlayer; using CalamityMod.Graphics.Primitives; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using System.IO; using Terraria; using Terraria.Graphics.Shaders; @@ -11,11 +13,11 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { - public class PhoenixsPrideFirewall : ModProjectile, ILocalizedModType + public class PhoenixsPrideFirewall : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public const int TornadoHeight = 480; + public const int MaxTornadoHeight = 270; public float Scale; // Size of the firewall, scales with NPC width public float fadeOut = 0f; // Used to control the firewall fading in and out at the start and end of its lifespan @@ -32,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.alpha = 255; Projectile.scale = Scale; - Projectile.timeLeft = 150; + Projectile.timeLeft = 180; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PhoenixAttunement_FlamePillarLocalIFrames; } @@ -40,20 +42,30 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { // Constantly follow its target - // Die if the target is no longer active + // Immediately start fading away if the target is no longer active if (!Target.active) { - Projectile.Kill(); - return; + Projectile.velocity *= 0.975f; + if (Projectile.timeLeft > 15) + Projectile.timeLeft = 15; } else - Projectile.Center = Target.Center + Target.velocity; + Projectile.velocity = (Projectile.velocity * 13f + (Target.Center - Projectile.Center).SafeNormalize(Vector2.Zero) * 24f) / 14f; // Fade in and out at the start and end of its lifespan - if (Projectile.timeLeft > 145) - fadeOut += 0.15f; + if (Projectile.timeLeft > 170) + fadeOut += 0.1f; if (Projectile.timeLeft < 15) fadeOut -= 0.05f; + + // Some smoke on the base + if (Projectile.timeLeft % 3 == 0) + { + MediumMistParticle smoke = new(Projectile.Center, Main.rand.NextVector2Circular(6f, 6f), Color.Orange, Color.DarkOrange, 1.1f, 170f); + GeneralParticleHandler.SpawnParticle(smoke); + SquareParticle spark = new(Projectile.Center, -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * 8f, true, 20, 0.9f, Color.White); + GeneralParticleHandler.SpawnParticle(spark); + } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) @@ -62,46 +74,29 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Bottom, - Projectile.Bottom - Vector2.UnitY * TornadoHeight, + Projectile.Bottom - Vector2.UnitY * MaxTornadoHeight, 72, ref _); } - public float WidthFunction(float completionRatio) => 50f * Scale * (completionRatio > 0.4f ? 1f : completionRatio * 2.5f); - - public override bool PreDraw(ref Color lightColor) + public float WidthFunction(float completionRatio) => MathF.Max(50f * Scale * (MathF.Pow(1f - completionRatio, 2) * 2.75f), 0.35f); + public Color ColorFunction(float completionRatio) => Color.Orange * (completionRatio > 0.1f ? 1f : completionRatio * 10f); + public void RenderPixelatedPrimitives(SpriteBatch spritebatch, PixelationPrimitiveLayer layer) { - Main.spriteBatch.EnterShaderRegion(); - GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(fadeOut); GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Images/Misc/Perlin")); - Vector2[] drawPoints = new Vector2[5]; - Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; + Vector2[] drawPoints = new Vector2[7]; + Vector2 upwardAscent = Vector2.UnitY * MaxTornadoHeight * fadeOut; Vector2 bottom = Projectile.Center; Vector2 top = bottom - upwardAscent; + // Offset is intentionally applied here instead of with an offset function in PrimitiveSettings to make it a bit choppier for (int i = 0; i < drawPoints.Length - 1; i++) - drawPoints[i] = Vector2.Lerp(top, bottom, i / (float)(drawPoints.Length - 1)); + drawPoints[i] = Vector2.Lerp(top + Vector2.UnitX * (MathF.Sin(Main.GameUpdateCount * 0.15f + i) * i * 6f), bottom, i / (float)(drawPoints.Length - 1)); drawPoints[drawPoints.Length - 1] = bottom; - PrimitiveRenderer.RenderTrail(drawPoints, new(WidthFunction, (_) => Color.Orange, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 80); - - Main.spriteBatch.ExitShaderRegion(); - - Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; - for (int i = 0; i < 90; i++) - { - float angle = MathHelper.TwoPi * i / (25f * Scale) + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; - Color drawColor = Color.White * 0.04f; - drawColor.A = 0; - Vector2 drawPosition = bottom + angle.ToRotationVector2() * 4f - Main.screenPosition; - - drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; - Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * fadeOut, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, 0.2f * Scale, SpriteEffects.None, 0); - } - - return false; + PrimitiveRenderer.RenderTrail(drawPoints, new(WidthFunction, ColorFunction, pixelate: true, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 80); } } } diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index c9eba67b70..75b3241061 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -97,10 +97,8 @@ namespace CalamityMod.Projectiles.Melee { if (targeted != null && target != targeted) modifiers.SourceDamage *= 0.3f; - } - public override bool? CanHitNPC(NPC target) - { - return null; + else + modifiers.SetCrit(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index d36e49c644..5332350457 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -217,13 +217,13 @@ namespace CalamityMod.Projectiles.Melee } if (EchoHammerPrep > 40) { - int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 10, Projectile.knockBack * 2.5f, Projectile.owner, 0f, Projectile.ai[1]); + int hammer = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), Projectile.damage * 9, Projectile.knockBack * 2.5f, Projectile.owner, 0f, Projectile.ai[1]); Main.projectile[hammer].localAI[0] = Math.Sign(Projectile.velocity.X); Main.projectile[hammer].netUpdate = true; Projectile.Kill(); } else - EchoHammerPrep += 0.2f; + EchoHammerPrep += 0.275f; } if (targetDist < 1400) diff --git a/Projectiles/Melee/GayBeam.cs b/Projectiles/Melee/GayBeam.cs deleted file mode 100644 index 5d016effdc..0000000000 --- a/Projectiles/Melee/GayBeam.cs +++ /dev/null @@ -1,470 +0,0 @@ -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using System.IO; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee -{ - public class GayBeam : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - private const int Alpha = 100; - - private const int TimeLeft = 600; - - private const int TrailLength = 36; - - private const int TotalAfterimages = 12; - - private const int AfterimageOffset = TrailLength / TotalAfterimages; - - private const float MaxVelocity = 24f; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.TrailCacheLength[Type] = TrailLength; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.timeLeft = TimeLeft; - Projectile.alpha = Alpha; - } - - 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.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(45f); - - if (Projectile.ai[2] == 0f) - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - - Color color = GetProjectileColor(); - switch ((int)Projectile.ai[0]) - { - case 0: // Red, normal beam - break; - - case 1: // Orange, curve back to player - - int player = (int)Player.FindClosest(Projectile.Center, 1, 1); - Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 360f && Projectile.ai[1] > 60f) - { - float homeSpeed = Projectile.velocity.Length(); - Vector2 vecToPlayer = Main.player[player].Center - Projectile.Center; - vecToPlayer = vecToPlayer.SafeNormalize(Vector2.UnitY); - vecToPlayer *= homeSpeed; - Projectile.velocity = (Projectile.velocity * 29f + vecToPlayer) / 30f; - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= homeSpeed; - } - - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.01f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 2: // Yellow, split after a certain time - - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 45f) - { - int numProj = 2; - float rotation = MathHelper.ToRadians(10); - if (Projectile.owner == Main.myPlayer) - { - for (int i = 0; i < numProj; i++) - { - Vector2 perturbedSpeed = Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.Lerp(-rotation, rotation, i / (float)(numProj - 1))); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, perturbedSpeed * MaxVelocity, Projectile.type, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner); - } - } - - Projectile.Kill(); - } - - break; - - case 3: // Lime, home in on player within certain distance - - float inertia = 30f; - float homingSpeed = MaxVelocity; - float minDist = 300f; - if (Main.player[Projectile.owner].active && !Main.player[Projectile.owner].dead) - { - if (Projectile.Distance(Main.player[Projectile.owner].Center) > minDist) - { - Vector2 moveDirection = Projectile.SafeDirectionTo(Main.player[Projectile.owner].Center, Vector2.UnitY); - Projectile.velocity = (Projectile.velocity * (inertia - 1f) + moveDirection * homingSpeed) / inertia; - } - } - else - { - if (Projectile.timeLeft > 30) - Projectile.timeLeft = 30; - } - - break; - - case 4: // Green, home in on enemies - - CalamityUtils.HomeInOnNPC(Projectile, false, 600f, MaxVelocity, 30f); - - break; - - case 5: // Turquoise, speed up and don't collide with tiles - - Projectile.tileCollide = false; - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.03f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 6: // Cyan, upon death create several turquoise swords - case 7: // Light Blue, slow down on hit - case 8: // Blue, bounce off of tiles and enemies - break; - - case 9: // Purple, speed up and slow down over and over - - if (Projectile.localAI[1] < 30f) - Projectile.velocity *= 0.95f; - else if (Projectile.localAI[1] < 60f) - Projectile.velocity *= 1.07f; - else if (Projectile.localAI[1] == 60f) - Projectile.localAI[1] = -1f; - Projectile.localAI[1] += 1f; - - break; - - case 10: // Fuschia, start slow then get faster - - if (Projectile.localAI[1] == 0f) - { - Projectile.velocity *= 0.1f; - Projectile.localAI[1] += 1f; - } - - if (Projectile.velocity.Length() < MaxVelocity) - { - Projectile.velocity *= 1.05f; - if (Projectile.velocity.Length() > MaxVelocity) - { - Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY); - Projectile.velocity *= MaxVelocity; - } - } - - break; - - case 11: // Hot Pink, split into fuschia while travelling - - if (Projectile.localAI[1] == 0f) - Projectile.velocity *= 0.333f; - - if (Projectile.localAI[1] >= 45f) - { - Projectile.localAI[1] = 0f; - if (Main.myPlayer == Projectile.owner) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Projectile.oldVelocity, Projectile.velocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, 10f, 0f); - } - Projectile.localAI[1] += 1f; - - break; - - default: - break; - } - - Projectile.ai[2] += MathHelper.Lerp(1f, 2f, Projectile.ai[0] / 11f); - if (Projectile.ai[2] > 7f) - { - Dust rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; - rainbow.velocity *= -0.25f; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1f, 1.25f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.noLightEmittence = true; - - rainbow = Main.dust[Dust.NewDust(new Vector2(Projectile.position.X - Projectile.velocity.X + 2f, Projectile.position.Y + 2f - Projectile.velocity.Y), 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha, default, 1.25f)]; - rainbow.velocity *= -0.25f; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(1f, 1.25f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.position -= Projectile.velocity * 0.5f; - rainbow.noLightEmittence = true; - - if (Projectile.localAI[0] == 0f) - { - Projectile.scale -= 0.02f; - Projectile.alpha += 5; - if (Projectile.alpha >= Alpha - 5) - { - Projectile.alpha = Alpha; - Projectile.localAI[0] = 1f; - } - } - else if (Projectile.localAI[0] == 1f) - { - Projectile.scale += 0.02f; - Projectile.alpha -= 5; - if (Projectile.alpha <= 0) - { - Projectile.alpha = 0; - Projectile.localAI[0] = 0f; - } - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 300); - - if (Projectile.ai[0] == 7f) - Projectile.velocity *= 0.5f; - else if (Projectile.ai[0] == 8f) - Projectile.velocity *= -1f; - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 300); - - if (Projectile.ai[0] == 7f) - Projectile.velocity *= 0.5f; - else if (Projectile.ai[0] == 8f) - Projectile.velocity *= -1f; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (Projectile.ai[0] == 8f) - { - if (Projectile.velocity.X != oldVelocity.X) - Projectile.velocity.X = -oldVelocity.X; - if (Projectile.velocity.Y != oldVelocity.Y) - Projectile.velocity.Y = -oldVelocity.Y; - - return false; - } - - return true; - } - - public Color TrailColor(float completionRatio) - { - float hue = (Main.GlobalTimeWrappedHourly * -0.62f + completionRatio * 1.5f) % 1f; - float brightness = MathHelper.SmoothStep(0.5f, 1f, Utils.GetLerpValue(0.3f, 0f, completionRatio, true)); - float opacity = Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * ((255 - Projectile.alpha) / 255f); - Color color = GetProjectileColor() * opacity; - color.A = (byte)(int)(Utils.GetLerpValue(0f, 0.2f, completionRatio) * 128); - return color; - } - - public float TrailWidth(float completionRatio) - { - float widthInterpolant = Utils.GetLerpValue(0f, 0.25f, completionRatio, true) * Utils.GetLerpValue(1.1f, 0.7f, completionRatio, true); - return MathHelper.SmoothStep(0f, 14f, widthInterpolant) * Projectile.scale; - } - - public override Color? GetAlpha(Color lightColor) => GetProjectileColor(); - - public override bool PreDraw(ref Color lightColor) - { - if (Projectile.timeLeft > TimeLeft - 5) - return false; - - Main.spriteBatch.EnterShaderRegion(); - - GameShaders.Misc["CalamityMod:ArtAttack"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); - GameShaders.Misc["CalamityMod:ArtAttack"].Apply(); - - PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidth, TrailColor, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:ArtAttack"]), TrailLength); - - Main.spriteBatch.ExitShaderRegion(); - - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - int frameHeight = texture.Height / Main.projFrames[Type]; - int frameY = frameHeight * Projectile.frame; - float scale = Projectile.scale; - Rectangle rectangle = new Rectangle(0, frameY, texture.Width, frameHeight); - Vector2 origin = rectangle.Size() / 2f; - Color alphaColor = Projectile.GetAlpha(lightColor); - - if (CalamityClientConfig.Instance.Afterimages) - { - Vector2 centerOffset = Projectile.Size / 2f; - int totalAfterimages = TotalAfterimages; - for (int i = 0; i < totalAfterimages; i++) - { - int arrayPos = i * AfterimageOffset; - float afterimageRot = Projectile.oldRot[arrayPos]; - SpriteEffects sfxForThisAfterimage = Projectile.oldSpriteDirection[arrayPos] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - Vector2 drawPos = Projectile.oldPos[arrayPos] + centerOffset - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - float colorAndSizeScalar = (float)(totalAfterimages - i) / (float)totalAfterimages; - Color color = alphaColor * colorAndSizeScalar; - float afterimageScale = scale * MathHelper.Lerp(0.5f, 1f, colorAndSizeScalar); - Main.spriteBatch.Draw(texture, drawPos, new Rectangle?(rectangle), color, afterimageRot, origin, afterimageScale, sfxForThisAfterimage, 0f); - } - } - else - { - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - spriteEffects = SpriteEffects.FlipHorizontally; - - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), rectangle, alphaColor, Projectile.rotation, origin, scale, spriteEffects, 0f); - } - - return false; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - - Color color = GetProjectileColor(); - switch ((int)Projectile.ai[0]) - { - case 0: // Red - case 1: // Orange - case 2: // Yellow - case 3: // Lime - case 4: // Green - case 5: // Turquoise - break; - - case 6: // Cyan - - for (int x = 0; x < 2; x++) - { - if (Projectile.owner == Main.myPlayer) - { - var source = Projectile.GetSource_FromThis(); - CalamityUtils.ProjectileBarrage(source, Projectile.Center, Projectile.Center, x == 1, 500f, 500f, 0f, 500f, MaxVelocity, Projectile.type, (int)Math.Round(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, false, 0f).ai[0] = 5f; - } - } - - break; - - case 7: // Light Blue - case 8: // Blue - case 9: // Purple - case 10: // Fuschia - case 11: // Hot Pink - default: - break; - } - - int totalDust = 60; - for (int i = 4; i < totalDust + 1; i++) - { - Vector2 oldVel = Projectile.oldVelocity * (totalDust / (float)i); - Dust rainbow = Main.dust[Dust.NewDust(Projectile.oldPosition - oldVel * 0.5f, 8, 8, DustID.RainbowMk2, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, Projectile.alpha)]; - rainbow.color = color; - rainbow.color.A = 100; - rainbow.scale = Main.rand.NextFloat(2.4f, 3.6f); - rainbow.fadeIn = Main.rand.NextFloat(0.4f, 1f); - rainbow.noGravity = true; - rainbow.velocity *= (Main.rand.NextBool() ? 0.05f : 0.5f); - } - } - - private Color GetProjectileColor() - { - Color rainbow = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, Alpha); - Color color = Color.White; - switch ((int)Projectile.ai[0]) - { - case 0: // Red - color = new Color(255, 0, 0, Alpha); - break; - case 1: // Orange - color = new Color(255, 128, 0, Alpha); - break; - case 2: // Yellow - color = new Color(255, 255, 0, Alpha); - break; - case 3: // Lime - color = new Color(128, 255, 0, Alpha); - break; - case 4: // Green - color = new Color(0, 255, 0, Alpha); - break; - case 5: // Turquoise - color = new Color(0, 255, 128, Alpha); - break; - case 6: // Cyan - color = new Color(0, 255, 255, Alpha); - break; - case 7: // Light Blue - color = new Color(0, 128, 255, Alpha); - break; - case 8: // Blue - color = new Color(0, 0, 255, Alpha); - break; - case 9: // Purple - color = new Color(128, 0, 255, Alpha); - break; - case 10: // Fuschia - color = new Color(255, 0, 255, Alpha); - break; - case 11: // Hot Pink - color = new Color(255, 0, 128, Alpha); - break; - default: - break; - } - return Color.Lerp(rainbow, color, (float)Math.Sqrt((MathF.Cos(Projectile.ai[2] / 90f) + 1f) * 0.5f)); - } - } -} diff --git a/Projectiles/Melee/GayBeam.png b/Projectiles/Melee/GayBeam.png deleted file mode 100644 index 50aac5b8b2..0000000000 Binary files a/Projectiles/Melee/GayBeam.png and /dev/null differ diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index a1cf5ba28d..df2af4e30b 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -234,7 +234,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(20 - Projectile.numHits * 12, 1, 20)); if (Projectile.numHits < 10) { - Owner.HealPlayer(heal); + Owner.DoLifestealDirect(target, heal, 0.5f); } if (target.CanBeMoved(true) || Main.zenithWorld || target.type == ModContent.NPCType() || (DownedBossSystem.downedCalamitas && DownedBossSystem.downedExoMechs)) diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index d184324240..1b9181626a 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -215,7 +215,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(5 - Projectile.numHits * 3, 1, 5)); if (Projectile.numHits < 5) { - Owner.HealPlayer(heal); + Owner.DoLifestealDirect(target, heal, 0.75f); } int points = 4; diff --git a/Projectiles/Melee/HellionSpike.cs b/Projectiles/Melee/HellionSpike.cs index 7955c988a0..bae234c799 100644 --- a/Projectiles/Melee/HellionSpike.cs +++ b/Projectiles/Melee/HellionSpike.cs @@ -21,11 +21,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.aiStyle = ProjAIStyleID.Beam; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; + Projectile.penetrate = 2; + Projectile.MaxUpdates = 2; Projectile.timeLeft = 600; AIType = ProjectileID.SporeCloud; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; + Projectile.localNPCHitCooldown = 8 * Projectile.MaxUpdates; } public override void AI() @@ -73,7 +74,7 @@ namespace CalamityMod.Projectiles.Melee var source = Projectile.GetSource_FromThis(); if (Projectile.owner == Main.myPlayer) { - Projectile petal = CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 10f, ProjectileID.FlowerPetal, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, true); + Projectile petal = CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, Main.rand.NextBool(), 800f, 800f, 0f, 800f, 24f, ProjectileID.FlowerPetal, (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.5f, Projectile.owner, false, 0f); if (petal.whoAmI.WithinBounds(Main.maxProjectiles)) { petal.DamageType = DamageClass.Melee; diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index 87e4127d6d..d95a2aad4c 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -424,7 +424,7 @@ namespace CalamityMod.Projectiles.Melee float minMult = 0.25f; int hitsToMinMult = 10; float damageMult = Utils.Remap(pierceReduction, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= (chargedSwing ? (3f * (GFBMulti) + critDamage) : 1) * damageMult; + modifiers.SourceDamage *= (chargedSwing ? (2.9f * GFBMulti + critDamage) : 1) * damageMult; } public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index ae4988b83b..0dba23aa5b 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -5,6 +5,7 @@ using CalamityMod.Items.Weapons.Melee; using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Boss; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -333,10 +334,29 @@ namespace CalamityMod.Projectiles.Melee for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType()) + bool isProviProj = (projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType() || + projectile.type == ModContent.ProjectileType()); + bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) || isProviProj; + if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 + Math.Max(projectile.width, projectile.height) && projectile.active && isAFireball) { - projectile.ai[2] = 5; - projectile.owner = Owner.whoAmI; + if (isProviProj) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projectile.Center, (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f, ModContent.ProjectileType(), (int)((Projectile.damage * 0.1) + projectile.damage), Projectile.knockBack, Projectile.owner, 0, 15, 5); + Particle orb2 = new CustomPulse(projectile.Center, Vector2.Zero, Color.Goldenrod, "CalamityMod/Particles/BloomRing", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0, 0.8f, 11); + GeneralParticleHandler.SpawnParticle(orb2); + if (projectile.type == ModContent.ProjectileType()) + projectile.active = false; + else + projectile.Kill(); + } + else + { + projectile.ai[2] = 5; + projectile.owner = Owner.whoAmI; + } } } } @@ -345,7 +365,8 @@ namespace CalamityMod.Projectiles.Melee for (int x = 0; x < Main.maxProjectiles; x++) { Projectile projectile = Main.projectile[x]; - if (Vector2.Distance(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 100 && projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10) + bool isAFireball = (projectile.active && projectile.type == ModContent.ProjectileType() && projectile.ai[0] != 10); + if (Vector2.Distance(Owner.Center + (new Vector2(60, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))), projectile.Center) <= 150 && isAFireball) { Vector2 launch = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -2.5f; projectile.velocity += launch; @@ -411,7 +432,7 @@ namespace CalamityMod.Projectiles.Melee } for (int i = 0; i < 4; i++) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0, target.whoAmI); + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, (new Vector2(0, -35).RotatedBy(MathHelper.ToRadians(45f))).RotatedBy(MathHelper.ToRadians(90f) * i), ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack, Projectile.owner, 0); } } } diff --git a/Projectiles/Melee/HolyColliderHolyFire.cs b/Projectiles/Melee/HolyColliderHolyFire.cs index fd51d02d91..d5b585955f 100644 --- a/Projectiles/Melee/HolyColliderHolyFire.cs +++ b/Projectiles/Melee/HolyColliderHolyFire.cs @@ -18,7 +18,7 @@ namespace CalamityMod.Projectiles.Melee public bool setStats = true; public static int statMax = 8; public int setStatTimer = statMax; - public int time = 0; + public ref float time => ref Projectile.ai[1]; public override void SetStaticDefaults() { Main.projFrames[Type] = 4; @@ -44,10 +44,13 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { Player Owner = Main.player[Projectile.owner]; - if (Projectile.ai[2] == 5 && time > 10 && Projectile.ai[0] != 10) + int hitTime = 13; // Time to pass before it can be launched + + if (Projectile.ai[2] == 5 && time >= hitTime && Projectile.ai[0] != 10) isLaunched = true; else Projectile.ai[2] = 0; + Projectile.scale = Utils.GetLerpValue(0, 40, Projectile.timeLeft, true); diff --git a/Projectiles/Melee/IllustriousKnife.cs b/Projectiles/Melee/IllustriousKnife.cs index 9f9b9c19d9..d66941830f 100644 --- a/Projectiles/Melee/IllustriousKnife.cs +++ b/Projectiles/Melee/IllustriousKnife.cs @@ -73,31 +73,7 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int heal = (int)Math.Round(hit.Damage * 0.015); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - - int heal = (int)Math.Round(info.Damage * 0.015); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), (int)Math.Round(hit.Damage * 0.015), 0.4f); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/IridescentExcaliburSlash.cs b/Projectiles/Melee/IridescentExcaliburSlash.cs deleted file mode 100644 index a91263e002..0000000000 --- a/Projectiles/Melee/IridescentExcaliburSlash.cs +++ /dev/null @@ -1,254 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Drawing; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Balancing; -using CalamityMod.Projectiles.Healing; - -namespace CalamityMod.Projectiles.Melee -{ - public class IridescentExcaliburSlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 1f; - float num6 = 1.2f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - Color color = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Color color3 = Color.Lerp(new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), amount); - Color color4 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * num3 * 0.5f; - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - - int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - - int heal = (int)Math.Round(info.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - } -} diff --git a/Projectiles/Melee/IridescentExcaliburSlash.png b/Projectiles/Melee/IridescentExcaliburSlash.png deleted file mode 100644 index 9a31d6718a..0000000000 Binary files a/Projectiles/Melee/IridescentExcaliburSlash.png and /dev/null differ diff --git a/Projectiles/Melee/IridescentExcaliburSlash2.cs b/Projectiles/Melee/IridescentExcaliburSlash2.cs deleted file mode 100644 index 54728381f9..0000000000 --- a/Projectiles/Melee/IridescentExcaliburSlash2.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Drawing; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; - -namespace CalamityMod.Projectiles.Melee -{ - public class IridescentExcaliburSlash2 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 0.8f; - float num6 = 1.1f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - Color color = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Color color3 = Color.Lerp(new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB), new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), amount); - Color color4 = new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * num3 * 0.5f; - color4.A = (byte)(((float)(int)color4.A * (1f - fromValue)) * 0.5f); - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(255 - Main.DiscoR, 255 - Main.DiscoG, 255 - Main.DiscoB) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - shineColor.A /= 2; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/IridescentExcaliburSlash3.cs b/Projectiles/Melee/IridescentExcaliburSlash3.cs deleted file mode 100644 index b370bdf8b5..0000000000 --- a/Projectiles/Melee/IridescentExcaliburSlash3.cs +++ /dev/null @@ -1,238 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using System; -using Terraria; -using Terraria.GameContent; -using Terraria.GameContent.Drawing; -using Terraria.Graphics.Shaders; -using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; - -namespace CalamityMod.Projectiles.Melee -{ - public class IridescentExcaliburSlash3 : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/IridescentExcaliburSlash"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 4; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.ownerHitCheck = true; - Projectile.ownerHitCheckDistance = 300f; - Projectile.usesOwnerMeleeHitCD = true; - Projectile.stopsDealingDamageAfterPenetrateHits = true; - Projectile.DamageType = DamageClass.Melee; - Projectile.penetrate = 3; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - Player player = Main.player[Projectile.owner]; - float num = Projectile.localAI[0] / Projectile.ai[1]; - float num2 = Projectile.ai[0]; - float num3 = Projectile.velocity.ToRotation(); - float num4 = (float)Math.PI * num2 * num + num3 + num2 * (float)Math.PI + player.fullRotation; - Projectile.rotation = num4; - float num5 = 0.6f; - float num6 = 1f; - - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter) - Projectile.velocity; - Projectile.scale = num6 + num * num5; - - float colorAIScale = Projectile.localAI[0] / Projectile.ai[1]; - float amount = Utils.Remap(colorAIScale, 0f, 0.6f, 0f, 1f) * Utils.Remap(colorAIScale, 0.6f, 1f, 1f, 0f); - Color rainbow = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - - float num8 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector2 = Projectile.Center + num8.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector3 = (num8 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() * 2f < Projectile.Opacity) - { - Dust dust2 = Dust.NewDustPerfect(Projectile.Center + num8.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector3 * 1f, 100, rainbow, 0.4f); - dust2.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust2.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector2, 43, vector3 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - float num10 = Projectile.rotation + Main.rand.NextFloatDirection() * MathHelper.PiOver2 * 0.7f; - Vector2 vector5 = Projectile.Center + num10.ToRotationVector2() * 84f * Projectile.scale; - Vector2 vector6 = (num10 + Projectile.ai[0] * MathHelper.PiOver2).ToRotationVector2(); - if (Main.rand.NextFloat() < Projectile.Opacity) - { - Dust dust4 = Dust.NewDustPerfect(Projectile.Center + num10.ToRotationVector2() * (Main.rand.NextFloat() * 80f * Projectile.scale + 20f * Projectile.scale), 278, vector6 * 1f, 100, rainbow, 0.4f); - dust4.fadeIn = 0.4f + Main.rand.NextFloat() * 0.15f; - dust4.noGravity = true; - } - - if (Main.rand.NextFloat() * 1.5f < Projectile.Opacity) - Dust.NewDustPerfect(vector5, 43, vector6 * 1f, 100, rainbow * Projectile.Opacity, 1.2f * Projectile.Opacity); - - Projectile.scale *= Projectile.ai[2]; - if (Projectile.localAI[0] >= Projectile.ai[1]) - Projectile.Kill(); - - // Enchantment visual bullshit - Vector2 boxPosition = Projectile.position; - int boxWidth = Projectile.width; - int boxHeight = Projectile.height; - for (float i = -MathHelper.PiOver4; i <= MathHelper.PiOver4; i += MathHelper.PiOver2) - { - Rectangle rect = Utils.CenteredRectangle(Projectile.Center + (Projectile.rotation + i).ToRotationVector2() * 70f * Projectile.scale, new Vector2(60f * Projectile.scale, 60f * Projectile.scale)); - Projectile.EmitEnchantmentVisualsAt(rect.TopLeft(), rect.Width, rect.Height); - } - } - - public override bool PreDraw(ref Color lightColor) - { - Vector2 vector = Projectile.Center - Main.screenPosition; - Texture2D asset = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = asset.Frame(1, 4); - Vector2 origin = rectangle.Size() / 2f; - float num = Projectile.scale * 1.1f; - SpriteEffects effects = ((!(Projectile.ai[0] >= 0f)) ? SpriteEffects.FlipVertically : SpriteEffects.None); - float num2 = Projectile.localAI[0] / Projectile.ai[1]; - float num3 = Utils.Remap(num2, 0f, 0.6f, 0f, 1f) * Utils.Remap(num2, 0.6f, 1f, 1f, 0f); - float num4 = 0.975f; - float amount = num3; - float fromValue = Lighting.GetColor(Projectile.Center.ToTileCoordinates()).ToVector3().Length() / (float)Math.Sqrt(3D); - fromValue = Utils.Remap(fromValue, 0.2f, 1f, 0f, 1f); - - Color color = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - Main.spriteBatch.Draw(asset, vector, rectangle, color * fromValue * num3, Projectile.rotation + Projectile.ai[0] * MathHelper.PiOver4 * -1f * (1f - num2), origin, num, effects, 0f); - Color color2 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - Color color3 = Color.Lerp(new Color(255 - (Math.Abs(128 - Main.DiscoR) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoG) * 2 - 1), 255 - (Math.Abs(128 - Main.DiscoB) * 2 - 1)), - new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1), amount); - - Color color4 = new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * num3 * 0.5f; - color4.A = (byte)((float)(int)color4.A * (1f - fromValue)); - Color color5 = color4 * fromValue * 0.5f; - Main.spriteBatch.Draw(asset, vector, rectangle, color5 * 0.15f, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color3 * fromValue * num3 * 0.3f, Projectile.rotation, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, rectangle, color2 * fromValue * num3 * 0.5f, Projectile.rotation, origin, num * num4, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.6f * num3, Projectile.rotation + Projectile.ai[0] * 0.01f, origin, num, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.5f * num3, Projectile.rotation + Projectile.ai[0] * -0.05f, origin, num * 0.8f, effects, 0f); - Main.spriteBatch.Draw(asset, vector, asset.Frame(1, 4, 0, 3), new Color(Math.Abs(128 - Main.DiscoR) * 2 - 1, Math.Abs(128 - Main.DiscoG) * 2 - 1, Math.Abs(128 - Main.DiscoB) * 2 - 1) * 0.4f * num3, Projectile.rotation + Projectile.ai[0] * -0.1f, origin, num * 0.6f, effects, 0f); - float num5 = num * 0.75f; - Texture2D value = TextureAssets.Extra[98].Value; - Color shineColor = color3 * Projectile.Opacity * 0.5f; - shineColor.A = 0; - Vector2 origin2 = value.Size() / 2f; - float num9 = Utils.GetLerpValue(0f, 0.5f, num2, clamped: true) * Utils.GetLerpValue(1f, 0.5f, num2, clamped: true); - Vector2 vector3 = new Vector2((Vector2.One * num5).X * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).X) * num9; - Vector2 vector2 = new Vector2((Vector2.One * num5).Y * 0.5f, (new Vector2(0f, Utils.Remap(num2, 0f, 1f, 3f, 0f)) * num5).Y) * num9; - shineColor *= num9; - for (float num6 = 0f; num6 < 12f; num6 += 1f) - { - float num7 = Projectile.rotation + Projectile.ai[0] * num6 * -MathHelper.TwoPi * 0.025f + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]; - Vector2 drawpos = vector + num7.ToRotationVector2() * ((float)asset.Width * 0.5f - 6f) * num; - float num8 = num6 / 12f; - - Color color6 = new Color(255, 255, 255, 0) * num3 * num8 * 0.5f; - color6 *= num9; - Main.EntitySpriteDraw(value, drawpos, null, shineColor, MathHelper.PiOver2 + num7, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, shineColor, 0f + num7, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, MathHelper.PiOver2 + num7, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos, null, color6, 0f + num7, origin2, vector2 * 0.6f, SpriteEffects.None); - } - - Vector2 drawpos2 = vector + (Projectile.rotation + Utils.Remap(num2, 0f, 0.6f, 0f, 0.95504415f) * Projectile.ai[0]).ToRotationVector2() * ((float)asset.Width * 0.5f - 4f) * num; - Color color7 = new Color(255, 255, 255, 0) * num3 * 0.5f; - color7 *= num9; - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, shineColor, 0f + Projectile.rotation, origin2, vector2, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, MathHelper.PiOver2 + Projectile.rotation, origin2, vector3 * 0.6f, SpriteEffects.None); - Main.EntitySpriteDraw(value, drawpos2, null, color7, 0f + Projectile.rotation, origin2, vector2 * 0.6f, SpriteEffects.None); - - return false; - } - - public override void CutTiles() - { - Vector2 startPoint = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - Vector2 endPoint = (Projectile.rotation + MathHelper.PiOver4).ToRotationVector2() * 60f * Projectile.scale; - float projectileSize = 60f * Projectile.scale; - Utils.PlotTileLine(Projectile.Center + startPoint, Projectile.Center + endPoint, projectileSize, DelegateMethods.CutTiles); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.HitDirectionOverride = (Main.player[Projectile.owner].Center.X < target.Center.X) ? 1 : -1; - - Vector2 positionInWorld = Main.rand.NextVector2FromRectangle(target.Hitbox); - ParticleOrchestraSettings particleOrchestraSettings = default(ParticleOrchestraSettings); - particleOrchestraSettings.PositionInWorld = positionInWorld; - ParticleOrchestraSettings settings = particleOrchestraSettings; - switch (Main.rand.Next(5)) - { - default: - case 0: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.NightsEdge, settings, Projectile.owner); - break; - - case 1: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueNightsEdge, settings, Projectile.owner); - break; - - case 2: - settings.MovementVector = Projectile.velocity; - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TerraBlade, settings, Projectile.owner); - break; - - case 3: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.Excalibur, settings, Projectile.owner); - break; - - case 4: - ParticleOrchestrator.RequestParticleSpawn(clientOnly: false, ParticleOrchestraType.TrueExcalibur, settings, Projectile.owner); - break; - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float coneLength = 94f * Projectile.scale; - float scale = MathHelper.TwoPi / 25f * Projectile.ai[0]; - float maximumAngle = MathHelper.PiOver4; - float coneRotation = Projectile.rotation + scale; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation, maximumAngle)) - return true; - - float rotation = Utils.Remap(Projectile.localAI[0], Projectile.ai[1] * 0.3f, Projectile.ai[1] * 0.5f, 1f, 0f); - if (rotation > 0f) - { - float coneRotation2 = coneRotation - MathHelper.PiOver4 * Projectile.ai[0] * rotation; - if (targetHitbox.IntersectsConeSlowMoreAccurate(Projectile.Center, coneLength, coneRotation2, maximumAngle)) - return true; - } - - return false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 600); - target.AddBuff(ModContent.BuffType(), 60); - } - } -} diff --git a/Projectiles/Melee/JudgementProj.cs b/Projectiles/Melee/JudgementProj.cs index 583ad48e1e..9065cf775f 100644 --- a/Projectiles/Melee/JudgementProj.cs +++ b/Projectiles/Melee/JudgementProj.cs @@ -1,4 +1,5 @@ using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -26,7 +27,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 9; + Projectile.extraUpdates = 14; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.scale += 0.0026f; hitboxSize += 0.4525f; Projectile.velocity *= 0.995f; - // Spawn 3 - if (time % 50 == 0 && time > 10) + // Spawn 2 + if (time % 85 == 0 && time > 10) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.2f), 3f, Projectile.owner, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 0.8f, hitboxSize * 0.8f) - Projectile.velocity * 2, (-Projectile.velocity * 3).RotatedByRandom(0.9f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35f), 3f, Projectile.owner, 0f); } } else @@ -80,7 +81,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, ModContent.DustType()); trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; @@ -102,11 +103,10 @@ namespace CalamityMod.Projectiles.Melee { Texture2D tex = ModContent.Request(Texture).Value; float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade), 1 + (0.45f * waveFade)) * Projectile.scale, SpriteEffects.None, 0); + for (int i = 0; i < 5; i++) + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * 9 * i, null, mainColor with { A = 0 } * fadeOut * 0.6f, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (0.2f * waveFade) + 0.01f * i, 1 + (0.45f * waveFade) - 0.06f * i) * Projectile.scale, SpriteEffects.None, 0); return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Melee/LaceratorSaw.png b/Projectiles/Melee/LaceratorSaw.png new file mode 100644 index 0000000000..4963c7e8f2 Binary files /dev/null and b/Projectiles/Melee/LaceratorSaw.png differ diff --git a/Projectiles/Melee/LaserFountain.cs b/Projectiles/Melee/LaserFountain.cs deleted file mode 100644 index 1df4e4245f..0000000000 --- a/Projectiles/Melee/LaserFountain.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -namespace CalamityMod.Projectiles.Melee -{ - public class LaserFountain : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 4; - Projectile.height = 4; - Projectile.friendly = true; - Projectile.alpha = 255; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft = 60; - Projectile.DamageType = DamageClass.Melee; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; - } - - public override void AI() - { - Projectile.localAI[0] += 1f; - float SpeedX = (float)Main.rand.Next(-15, 15); - float SpeedY = (float)Main.rand.Next(-20, -10); - if (Projectile.localAI[0] >= 12f) - { - if (Projectile.owner == Main.myPlayer) - { - int damage = (int)Main.player[Projectile.owner].GetTotalDamage().ApplyTo(350f); - int laserShot = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, SpeedX, SpeedY, ModContent.ProjectileType(), damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - if (laserShot.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[laserShot].DamageType = DamageClass.Melee; - Main.projectile[laserShot].aiStyle = ProjAIStyleID.Arrow; - } - } - Projectile.localAI[0] = 0f; - } - } - } -} diff --git a/Projectiles/Melee/LucreciaDNATrailCreator.cs b/Projectiles/Melee/LucreciaDNATrailCreator.cs new file mode 100644 index 0000000000..1e77fd0d0b --- /dev/null +++ b/Projectiles/Melee/LucreciaDNATrailCreator.cs @@ -0,0 +1,117 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaDNATrailCreator : ModProjectile, ILocalizedModType + { + private List oldPositionsLeft = new List(); + private List oldPositionsRight = new List(); + private int trailTimer = 0; + // The timer is initialized with a delay. It will reset to 6 after the first shot. + private int middleStreakTimer = 40; + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 200; + Projectile.height = 170; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.hostile = false; + Projectile.friendly = true; + Projectile.extraUpdates = 12; + Projectile.timeLeft = 2400; + Projectile.minion = true; // Scuffed but it prevents the projectile from being culled in a few situations + Projectile.alpha = 255; + } + + public override void AI() + { + Player owner = Main.player[Projectile.owner]; + trailTimer++; + + // Very volatile values... + float amplitude = 86f; + float frequency = 0.039f; + + // Makes a perpendicular/mirrored trail, AKA a double helix + Vector2 perpendicular = Vector2.Normalize(new Vector2(-Projectile.velocity.Y, Projectile.velocity.X)); + + // Calculate the sine wave value. + float sineWave = (float)Math.Cos(trailTimer * frequency); + + // Calculate offset based on the pattern of the sinewave and subtract the proj's dimensions to be accurate + Vector2 offsetLeft = (perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + Vector2 offsetRight = (-perpendicular * amplitude * sineWave) - new Vector2(Projectile.width, Projectile.height); + + oldPositionsLeft.Add(Projectile.Center + offsetLeft); + oldPositionsRight.Add(Projectile.Center + offsetRight); + + // The timer will now correctly decrease once per AI update. + middleStreakTimer--; + + if (middleStreakTimer <= 0) + { + // Reset the timer for the next shot. + middleStreakTimer = 6; + + // Spawn the main trail + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.MediumPurple * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(Projectile.Center + perpendicular, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.24f, Color.CornflowerBlue * 1.3f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.4f); + GeneralParticleHandler.SpawnParticle(spark2); + } + + + // Remove old positions after 120 + int maxTrailLength = 120; + if (oldPositionsLeft.Count > maxTrailLength) + oldPositionsLeft.RemoveAt(0); + if (oldPositionsRight.Count > maxTrailLength) + oldPositionsRight.RemoveAt(0); + } + + private float WidthFunction(float completionRatio) + { + return MathHelper.Lerp(12f, 0f, completionRatio); + } + + + private Color LeftColorFunction(float completionRatio) + { + Color baseColor = Color.MediumPurple * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + private Color RightColorFunction(float completionRatio) + { + Color baseColor = Color.CornflowerBlue * 1.3f; + + float alphaScaling = -4 * completionRatio * (completionRatio - 1); + return baseColor * alphaScaling; + } + + + public override bool PreDraw(ref Color lightColor) + { + MiscShaderData trailShader = GameShaders.Misc["CalamityMod:TrailStreak"]; + trailShader.SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); + + // Use the separate color functions for each trail + PrimitiveRenderer.RenderTrail(oldPositionsLeft, new PrimitiveSettings(WidthFunction, LeftColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + PrimitiveRenderer.RenderTrail(oldPositionsRight, new PrimitiveSettings(WidthFunction, RightColorFunction, (_) => Projectile.Size * 1f, pixelate: false, shader: trailShader)); + return false; + } + } +} diff --git a/Projectiles/Melee/LucreciaProj.cs b/Projectiles/Melee/LucreciaProj.cs new file mode 100644 index 0000000000..be57981ef4 --- /dev/null +++ b/Projectiles/Melee/LucreciaProj.cs @@ -0,0 +1,323 @@ +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using CalamityMod.CalPlayer; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Projectiles.Melee.Shortswords; +using System.Runtime.InteropServices; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaProj : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override bool useMeleeSpeed => true; + public override bool useMeleeSize => false; + public override int swingWidth => 310; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; + public override SoundStyle? UseSound => SoundID.Item71 with { Volume = 0.85f }; + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + public override int swingTime { get; set; } + public override bool AlternateSwings { get => base.AlternateSwings; set => base.AlternateSwings = value; } + public override float lineCollisionLength => 82; + + // Boolshit + public bool helixFired = false; + public bool gotEnergyThisSwing = false; + public bool trailFXTriggered = false; + public bool particlesSpawned = false; + public bool sparkTriggered = false; + + public int standardStartupTime = 8; + public int standardSwingTime = 14; + public int standardCooldownTime = 7; + private bool IsThrusting => Projectile.localAI[0] == 1; + public bool IsAlternateThrust { get; set; } + public int thrustStartupTime = 33; + public int thrustForwardTime = 7; + public int thrustCooldownTime = 17; + + public override void Defaults() + { + Projectile.extraUpdates = 6; + Projectile.noEnchantmentVisuals = true; + Projectile.Opacity = 0.2f; // Starting point, fades in quickly upon startup + Projectile.width = Projectile.height = 54; + } + + public override void Spawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + var calamityPlayer = player.Calamity(); + + // Store the base use time from the item + int baseUseTime = BaseItem.useTime; + + if (player.altFunctionUse == 2) + { + // Check for energy before the projectile exists + if (calamityPlayer.lucreciaEnergy < 100) + { + Projectile.Kill(); + return; + } + + IsAlternateThrust = true; + + // Scale all time vars correctly + StartupTime = (int)(thrustStartupTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(thrustForwardTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(thrustCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + Projectile.DamageType = DamageClass.Melee; + Projectile.width = Projectile.height = 36; + useMeleeSize = true; + UseSound = SoundID.DD2_JavelinThrowersAttack; + OffsetDistance = -30; + RotateInStartup = 0.8f; + RotateInCooldown = 1f; + Projectile.knockBack = 15f; + + calamityPlayer.lucreciaEnergy = 0; // Remove energy for startup + } + else + { + IsAlternateThrust = false; + + // Scale all time vars correctly + StartupTime = (int)(standardStartupTime * (float)player.itemAnimationMax / baseUseTime); + CooldownTime = (int)(standardSwingTime * (float)player.itemAnimationMax / baseUseTime); + swingTime = (int)(standardCooldownTime * (float)player.itemAnimationMax / baseUseTime); + + OffsetDistance = 36; + RotateInStartup = 0.8f; + RotateInCooldown = 0; + } + + if (AlternateSwings) + modplayer.swingNum = (modplayer.swingNum + 1) % 2; + } + + public override void AdditionalAI() + { + if (IsAlternateThrust) + { + if (inStartup) + { + trailFXTriggered = false; // Reset bool just in case + Projectile.Opacity += 0.01f; // Fade in + + // Pullback + float eased = MathF.Pow(StartupCompletion, 0.3f); + OffsetDistance = (int)MathHelper.Lerp(44, 34, eased); + Projectile.scale = baseScale * MathHelper.Lerp(1f, 0.85f, eased); + + + if (!sparkTriggered && Projectile.scale < 0.96f) // Right before thrusting forward + { + // Won't happen again this right-click + sparkTriggered = true; + + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.AntiqueWhite, Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) * 0.3f, 2f, 8, Projectile.velocity.ToRotation() + (Main.rand.NextBool() ? -0.25f : 0.25f), 1f); + GeneralParticleHandler.SpawnParticle(sparker); + } + } + + else if (inCooldown) + { + Projectile.Opacity -= 0.0135f; + + // During cooldown, pull back slightly + Projectile.scale = baseScale * MathHelper.Lerp(1.6f, 1.55f, CooldownCompletion); + OffsetDistance = (int)MathHelper.Lerp(68, 42, CooldownCompletion); + } + + else if (inSwing) + { + // Thrust forward + OffsetDistance = (int)MathHelper.Lerp(34, 68, SwingCompletion); + Main.player[Projectile.owner].Calamity().GeneralScreenShakePower = 3.5f; + + // Scaling adjustments + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var eased = MathF.Pow(t, 0.125f); + Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 1.6f, eased); + + // VFX vars + Player player = Main.player[Projectile.owner]; + Vector2 mousePosition = Main.MouseWorld; + Vector2 fireDirection = Vector2.Normalize(mousePosition - player.Center); + + // Fire the bigass projectile + if (!trailFXTriggered) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center, fireDirection * 5, ModContent.ProjectileType(), Projectile.damage * 8, Projectile.knockBack, Projectile.owner, 0f, 0f); + + SoundStyle swish = new("CalamityMod/Sounds/Custom/MeatySlash"); + SoundEngine.PlaySound(swish with { Volume = 0.45f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/OmicronBeam"); + SoundEngine.PlaySound(projectile with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.15f, 0.2f) }, Projectile.Center); + } + + trailFXTriggered = true; + + // Some sparks from the blade + if (!particlesSpawned) + { + for (int i = 0; i < 6; i++) + { + Vector2 particleOrigin = Projectile.Center; + Vector2 particleSpeed = fireDirection.RotatedByRandom(MathHelper.ToRadians(46f)) * Main.rand.NextFloat(20f, 37f); + Particle sparks = new CritSpark(particleOrigin, particleSpeed, Color.Lerp(Color.CornflowerBlue, Color.MediumPurple, Main.rand.NextFloat(0f, 1f)), Color.NavajoWhite * 0.7f, Main.rand.NextFloat(0.9f, 2f), Main.rand.Next(38, 50), 0.1f, 1.5f, hueShift: 0.01f); + GeneralParticleHandler.SpawnParticle(sparks); + } + particlesSpawned = true; + } + + } + } + + else // Primary + { + if (inStartup) + { + AfterImageLength = 0; + + Projectile.Opacity += 0.01f; // Fade in + gotEnergyThisSwing = false; + helixFired = false; + Projectile.scale = baseScale * MathHelper.Lerp(0.625f, 0.8f, StartupCompletion); + } + + else if (inCooldown) + { + AfterImageLength = 0; + + helixFired = false; + Projectile.Opacity -= 0.09f; + Projectile.scale = baseScale * MathHelper.Lerp(0.85f, 0.625f, CooldownCompletion); + } + + else if (inSwing) + { + if (!helixFired) + { + helixFired = true; + var player = Main.player[Projectile.owner]; + var mousePosition = Main.MouseWorld; + var fireDirection = Vector2.Normalize(mousePosition - player.Center); + var helixSpeed = 12f; + var helixVelocity = fireDirection * helixSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), player.Center + fireDirection * 3, helixVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltFire"); + SoundEngine.PlaySound(projectile with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + AfterImageLength = 30; + + var t = MathHelper.Clamp(SwingCompletion, 0f, 1f); + var parabola = 1f - MathF.Pow(t - 0.5f, 2f) * 4f; + OffsetDistance = (int)MathHelper.Lerp(36 * 1f, 36 * 1.435f, parabola); + var upPhase = t <= 0.5f ? t / 0.5f : (1f - t) / 0.5f; + var eased = MathF.Pow(upPhase, 2.6f); + Projectile.scale = baseScale * MathHelper.Lerp(0.8f, 1.4f, eased); + + } + } + base.AdditionalAI(); + } + + public override float SwingFunction() + { + var player = Main.player[Projectile.owner]; + + if (IsAlternateThrust) + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + + if (inStartup) + { + return 0f; + } + + if (timer < StartupTime + swingTime) + { + return 0f; + } + + else + return 0f; // Just retract and fade out without moving the angle + } + + else // Primary swing + { + var modplayer = player.GetModPlayer(); + float swingDirection = Projectile.spriteDirection; + if (modplayer.swingNum == 1) + swingDirection *= -1; + + var parabolicFactorPrimary = 1f - MathF.Pow(SwingCompletion - 0.5f, 2f) * 4f; + parabolicFactorPrimary = MathHelper.Clamp(parabolicFactorPrimary, 0f, 1f); + Projectile.localAI[0] = parabolicFactorPrimary; + + var startAnglePrimary = -swingWidth / 2.15f; + var endAnglePrimary = swingWidth / 2.15f; + var trueAnglePrimary = MathHelper.Lerp(startAnglePrimary, endAnglePrimary, SwingCompletion); + + return MathHelper.ToRadians(trueAnglePrimary * -swingDirection); + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Add energy for the primary attack + if (!IsAlternateThrust && !gotEnergyThisSwing) + { + gotEnergyThisSwing = true; + var player = Main.player[Projectile.owner]; + var modPlayer = player.Calamity(); + + // +22 energy on hit + modPlayer.lucreciaEnergy += 22; + modPlayer.lucreciaEnergy = Math.Min(modPlayer.lucreciaEnergy, Lucrecia.MaxEnergy); + + // On-hit cut FX + int points = 2; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f)).RotatedByRandom(100); + + var modplayer = player.GetModPlayer(); + Color useColor = modplayer.swingNum == 1 ? Color.CornflowerBlue : Color.MediumPurple; // Alternate each swing + + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Particle spark = new GlowSparkParticle((target.Center + velocity * 7.5f), velocity * 0.5f, false, 9, 0.05f, useColor, new Vector2(0.5f, 0.4f), true, false); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + + public override bool PreDraw(ref Color lightColor) + { + // Draw fullbright + lightColor = Color.White; + return base.PreDraw(ref lightColor); + } + } +} diff --git a/Projectiles/Melee/LucreciaSmallProjectile.cs b/Projectiles/Melee/LucreciaSmallProjectile.cs new file mode 100644 index 0000000000..a86b802a74 --- /dev/null +++ b/Projectiles/Melee/LucreciaSmallProjectile.cs @@ -0,0 +1,155 @@ +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Melee +{ + public class LucreciaSmallProjectile : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static float MaxWidth = 30; + public ref float Time => ref Projectile.ai[0]; + + public static Asset TrailTex; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 13; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 19; + Projectile.height = 22; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; + Projectile.alpha = 255; + Projectile.timeLeft = 420; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 12; + } + + public override void AI() + { + // Little bit of ambient lighting as it travels + Lighting.AddLight(Projectile.Center, Color.WhiteSmoke.ToVector3() * 0.4f); + + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.velocity *= 1.01f; + Projectile.scale = Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + if (Projectile.FinalExtraUpdate()) + Time++; + + // CRUCIAL so that oldPos isnt initialized incorrectly when drawing + if (Projectile.localAI[0] == 0f) + { + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + Projectile.oldPos[i] = Projectile.position; + } + Projectile.localAI[0] = 1f; + } + } + + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + for (int i = 0; i < 6; i++) + { + float variance = Main.rand.NextFloat(-0.6f, 0.6f); + int dustStyle = ModContent.DustType(); + Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle); + dust2.scale = Main.rand.NextFloat(1.2f, 1.6f) - Math.Abs(variance); + dust2.velocity = (Projectile.velocity * 1.5f).RotatedBy(variance) * Main.rand.NextFloat(1.2f, 1.5f) * (1 - Math.Abs(variance)); + dust2.noGravity = true; + dust2.color = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, Main.rand.NextFloat(0f, 1f)); + } + } + + public override void OnKill(int timeLeft) + { + SoundStyle projectile = new("CalamityMod/Sounds/Item/LucreciaBoltImpact"); + SoundEngine.PlaySound(projectile with { Volume = 0.9f, Pitch = Main.rand.NextFloat(-0.06f, 0.1f) }, Projectile.Center); + } + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, 0.5f) with { A = 0 } * Projectile.Opacity; + + public float TrailWidth(float completionRatio) + { + float width = Utils.GetLerpValue(1f, 0.4f, completionRatio, true) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completionRatio, true))); + + width *= Utils.GetLerpValue(0f, 0.1f, Projectile.timeLeft / 600f, true); + + return width * (MaxWidth * .265f); + } + public Color TrailColor(float completionRatio) + { + Color baseColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + return baseColor * 0.2f; + } + + public float MiniTrailWidth(float completionRatio) => TrailWidth(completionRatio) * 5.5f; + public Color MiniTrailColor(float completionRatio) => Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, completionRatio); + + public override bool PreDraw(ref Color lightColor) + { + if (Projectile.timeLeft > 412) + return false; + + Color mainColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f) % 1); + Color secondaryColor = Color.Lerp(Color.MediumPurple, Color.CornflowerBlue, ((float)Main.timeForVisualEffects * 0.5f + Projectile.whoAmI * 0.12f + 0.2f) % 1); + + Main.spriteBatch.EnterShaderRegion(); + + if (TrailTex == null) + TrailTex = Request("CalamityMod/ExtraTextures/Trails/BasicTrail"); + + GameShaders.Misc["CalamityMod:ExobladePierce"].SetShaderTexture(TrailTex); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseImage2("Images/Extra_189"); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].Apply(); + + Vector2 offset = Projectile.Size * 0.5f; + + // Apply the offset to the projectile's old position + Vector2[] oldPosWithOffset = Projectile.oldPos.Select(p => p - offset).ToArray(); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(TrailWidth, TrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + GameShaders.Misc["CalamityMod:ExobladePierce"].UseColor(mainColor); + GameShaders.Misc["CalamityMod:ExobladePierce"].UseSecondaryColor(secondaryColor); + + PrimitiveRenderer.RenderTrail(oldPosWithOffset, new(MiniTrailWidth, MiniTrailColor, (_) => Projectile.Size * 1f, shader: GameShaders.Misc["CalamityMod:ExobladePierce"]), 30); + + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Melee/MaceFlails/BallOFuguProj.cs b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs index afbe2c194e..304031057f 100644 --- a/Projectiles/Melee/MaceFlails/BallOFuguProj.cs +++ b/Projectiles/Melee/MaceFlails/BallOFuguProj.cs @@ -70,12 +70,18 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails if (SpikeCount > 0) { SoundEngine.PlaySound(BallOFugu.BlowSound, Projectile.Center); - Particle BlowParticle = new CustomPulse(Projectile.Center, Vector2.Zero, SpikeColor, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(0, MathHelper.TwoPi), 0f, 0.05f + 0.005f * SpikeCount, 12); - GeneralParticleHandler.SpawnParticle(BlowParticle); + + for (int i = -4; i < 5; i++) + { + Vector2 maxScale = new Vector2(Main.rand.NextFloat(1f, 1.2f), Main.rand.NextFloat(0.6f, 0.75f)) * (i % 2 == 0 ? 1f : 1.35f); + float rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(30f * i); + CustomPulse spike = new CustomPulse(Projectile.Center, Vector2.One, SpikeColor, "CalamityMod/Particles/BlastCone", maxScale, rotation, 1f, 0.5f, 12); + GeneralParticleHandler.SpawnParticle(spike); + } for (int i = 0; i < SpikeCount; i++) { - Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(6f, 7.2f); + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(MathHelper.ToRadians(105f)) * Main.rand.NextFloat(6f, 7.2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * SpikeDamage), Projectile.knockBack * SpikeKnockback, Projectile.owner); } } diff --git a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs index d1da4b4c20..c24c63a25c 100644 --- a/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs +++ b/Projectiles/Melee/MaceFlails/TumbleweedFlail.cs @@ -29,6 +29,8 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails public override float RetractAcceleration => 4f; public static float MaxAuraTime = 60f; + private bool hasDetached = false; + private int detachDelay = 0; public ref float AuraScale => ref Projectile.ai[2]; @@ -54,6 +56,13 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails sand.velocity = CurrentFlailState == FlailState.Spinning ? Main.rand.NextVector2Unit() * 1.5f : Projectile.velocity * 0.25f; } + // Force the flail to stay in launch state for a few frames after detaching to prevent spam-click abuse at point-blank + if (detachDelay > 0) + { + detachDelay--; + CurrentFlailState = detachDelay == 0 ? FlailState.ForcedRetracting : FlailState.LaunchingForward; + } + if (CurrentFlailState == FlailState.Spinning) { Projectile.ownerHitCheck = false; // Dust aura can hit through walls @@ -94,7 +103,21 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails Main.EntitySpriteDraw(Aura, position, null, drawColor, Main.GlobalTimeWrappedHourly * 0.5f + (i * i * 0.03f), Aura.Size() * 0.5f, AuraScale - (i * 0.03f), SpriteEffects.None, 0); } } - return base.PreDraw(ref lightColor); + + if (hasDetached) + { + DrawChain(); + return false; + } + else + return base.PreDraw(ref lightColor); + } + + public override bool? CanDamage() + { + if (hasDetached) + return false; + return base.CanDamage(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -123,7 +146,11 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails if (Projectile.owner == Main.myPlayer) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity, ModContent.ProjectileType(), (int)(Projectile.damage * LaunchDamage), Projectile.knockBack, Projectile.owner, CurrentFlailState == FlailState.LaunchingForward ? 0f : 1f); - Projectile.Kill(); + hasDetached = true; + if ((CurrentFlailState == FlailState.LaunchingForward || CurrentFlailState == FlailState.Ricochet) && StateTimer < 6) + detachDelay = 6; + else + CurrentFlailState = FlailState.ForcedRetracting; } } } diff --git a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs index 43b21f426c..408eca4e75 100644 --- a/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs +++ b/Projectiles/Melee/MaceFlails/UrchinMaceProj.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails // This flail only runs through one state (spin), thereby making most parameters unnecessary to fill out public override int AssociatedItemID => ModContent.ItemType(); public override int SpinIFrames => 15; - public override float SpinHitboxRadius => 64f; + public override float SpinHitboxRadius => 56f; public override float SpinVerticalFactor => 1f; // This flail moves circular public override float LaunchSpeed => 22f; @@ -134,17 +134,17 @@ namespace CalamityMod.Projectiles.Melee.MaceFlails Texture2D whirlpoolTexture = TextureAssets.Projectile[ModContent.ProjectileType()].Value; float WindupProgress = MathHelper.Clamp(StateTimer, 0, MaxWindup) / MaxWindup; - float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f; + float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 1.6f; float whirlpoolOpacity = WindupProgress * 0.2f + MathF.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f; float whirlpoolRotation = StateTimer * 0.34f * Owner.direction; SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; - Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0); - Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity, whirlpoolRotation, whirlpoolTexture.Size() / 2f, whirlpoolScale, flip, 0); + Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity * 0.3f, whirlpoolRotation * 1.2f, whirlpoolTexture.Size() * 0.5f, whirlpoolScale, flip); + Main.EntitySpriteDraw(whirlpoolTexture, Owner.MountedCenter - Main.screenPosition, null, Lighting.GetColor((int)Owner.MountedCenter.X / 16, (int)Owner.MountedCenter.Y / 16) * whirlpoolOpacity, whirlpoolRotation, whirlpoolTexture.Size() * 0.5f, whirlpoolScale, flip); Vector2 handleOrigin = new Vector2(0, maceTexture.Height); float maceRotation = Projectile.rotation + MathHelper.PiOver4; - Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(maceTexture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), maceRotation, handleOrigin, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index b336a0b32d..1ec5cb2f5f 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Melee int heal = (int)(MathHelper.Clamp(7 - Projectile.numHits * 5, 1, 7)); if (Projectile.numHits < 5) { - Owner.HealPlayer(heal); + Owner.DoLifestealDirect(target, heal); } Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); diff --git a/Projectiles/Melee/MantisClawHoldout.cs b/Projectiles/Melee/MantisClawHoldout.cs index 190f752a77..41b861553a 100644 --- a/Projectiles/Melee/MantisClawHoldout.cs +++ b/Projectiles/Melee/MantisClawHoldout.cs @@ -1,21 +1,14 @@ -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using CalamityMod.Items.BaseItems; -using Terraria.ModLoader; +using System; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using CalamityMod.Balancing; +using Terraria; using Terraria.Audio; -using CalamityMod.Items.Weapons.Melee; -using System; -using CalamityMod.Particles; -using Terraria.DataStructures; -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -23,7 +16,7 @@ namespace CalamityMod.Projectiles.Melee { bool AnimationCooldown = false; - float JetDamageMultiplier => 7.5f; + float JetDamageMultiplier => 6.5f; int SlashSpeed => 6; int BlastChargeUses => 3; @@ -37,6 +30,12 @@ namespace CalamityMod.Projectiles.Melee public float BubbleSize = 0f; public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Items/Weapons/Melee/MantisClaws"; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.DamageType = DamageClass.Melee; + } public override void ResetStyle() { if (AnimationCooldown) @@ -71,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(20, 0).RotatedBy(Projectile.rotation), - Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * JetDamageMultiplier), 7, Owner.whoAmI); + Owner.DirectionTo(Owner.Calamity().mouseWorld) * 30, ModContent.ProjectileType(), (int)(Projectile.damage * JetDamageMultiplier), 7, Owner.whoAmI, 0f, 40f); for (int i = 0; i < 9; i++) { @@ -129,7 +128,7 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().mouseWorldListener = true; // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 4f, Owner.whoAmI); + Projectile slash = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.DirectionTo(Owner.Calamity().mouseWorld) * 6f, ModContent.ProjectileType(), Projectile.damage, 2f, Owner.whoAmI); slash.rotation = Owner.AngleTo(Owner.Calamity().mouseWorld) + MathHelper.ToRadians(Main.rand.NextFloat(-25, 25)); } diff --git a/Projectiles/Melee/MantisClawJet.cs b/Projectiles/Melee/MantisClawJet.cs index 87821016d3..5e9bee31aa 100644 --- a/Projectiles/Melee/MantisClawJet.cs +++ b/Projectiles/Melee/MantisClawJet.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = TimerCap; - Projectile.knockBack = 2; Projectile.tileCollide = false; Projectile.width = 20; Projectile.height = 20; @@ -47,7 +46,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.extraUpdates = 5; Projectile.DamageType = DamageClass.Melee; - Projectile.ai[1] = 40; } public override void OnSpawn(IEntitySource source) @@ -64,16 +62,10 @@ namespace CalamityMod.Projectiles.Melee Projectile.ai[0]++; } - public override bool? CanDamage() - { - return true; - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { Player owner = Main.player[Projectile.owner]; - if (Main.rand.Next(100) < owner.GetWeaponCrit(owner.ActiveItem()) + 20) - modifiers.SetCrit(); + modifiers.SetCrit(); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/MantisClawSlash.cs b/Projectiles/Melee/MantisClawSlash.cs index bdf5b9b823..a0783efbce 100644 --- a/Projectiles/Melee/MantisClawSlash.cs +++ b/Projectiles/Melee/MantisClawSlash.cs @@ -1,51 +1,37 @@ -using CalamityMod.Projectiles.Typeless; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using CalamityMod.Items.BaseItems; -using Terraria.ModLoader; -using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; -using CalamityMod.Balancing; -using Terraria.Audio; -using CalamityMod.Items.Weapons.Melee; -using System; -using CalamityMod.Particles; +using Terraria; using Terraria.DataStructures; -using System.Collections.Generic; -using CalamityMod.Graphics.Primitives; -using Terraria.Graphics.Shaders; -using CalamityMod.Buffs.DamageOverTime; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { public class MantisClawSlash : ModProjectile, ILocalizedModType { - public int TimerCap => 20; - public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Particles/SlashSmear"; + private const int TimerCap = 20; Color startColor; Color endColor; + int dir = 1; public override void SetDefaults() { Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = TimerCap; - Projectile.knockBack = 2; Projectile.tileCollide = false; Projectile.width = 256; Projectile.height = 256; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.DamageType = DamageClass.Melee; + Projectile.DamageType = TrueMeleeDamageClass.Instance; } - int dir = 1; - public override void OnSpawn(IEntitySource source) { Projectile.scale = 0f; @@ -53,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) dir = -1; - // i cherry picked five specific colors to make a similar but different palette to the claws themselves + // I cherry picked five specific colors to make a similar but different palette to the claws themselves // of those five, the projectile lerps between two, randomly chosen when the projectile is spawned List ColorList = [ @@ -89,23 +75,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f) * dir); Projectile.ai[1]++; - Projectile.ai[0] = MathHelper.Lerp(Projectile.ai[0], MathHelper.TwoPi * dir, 0.15f); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - } - - public override bool? CanDamage() - { - return true; - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { @@ -116,7 +90,6 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, tex.Frame(), Color.Lerp(startColor, endColor, Projectile.ai[1] / TimerCap).MultiplyRGBA(new Color(255, 255, 255, 0f)), Projectile.rotation - (dir == -1 ? MathHelper.ToRadians(-135f) : MathHelper.ToRadians(180f)) + Projectile.ai[0], tex.Size() / 2, MathHelper.Lerp(0.6f, 1f, i) * Projectile.scale, dir == 1 ? SpriteEffects.None : SpriteEffects.FlipVertically); } - return false; } } diff --git a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs index fb19dc0660..cc6e39ef9c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs +++ b/Projectiles/Melee/MendedBiomeBlade_DecaysRetortDash.cs @@ -24,15 +24,13 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 8; + Projectile.width = Projectile.height = 80; Projectile.tileCollide = false; Projectile.friendly = true; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 60; Projectile.timeLeft = 20; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index 7a7fc8cb16..68bc6ca463 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -61,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; - float bladeLength = 100 * Projectile.scale; + float bladeLength = 105 * Projectile.scale; float bladeWidth = 20 * Projectile.scale; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); } @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Melee //Manage position and rotation - Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.5f; + Projectile.scale = 1 + Empowerment / maxEmpowerment * 1.85f; oldDirection = direction; direction = direction.RotatedBy(MathHelper.Clamp(Empowerment * 1.1f / maxEmpowerment, 0.45f, 1f) * MathHelper.PiOver4 * 0.20f); @@ -222,6 +222,8 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= MathHelper.Lerp(1f, TrueBiomeBlade.HolyAttunement_ThrowDamageBoost, Empowerment / maxEmpowerment); else modifiers.SourceDamage *= MathHelper.Lerp(TrueBiomeBlade.HolyAttunement_BaseSwingDamageMult, TrueBiomeBlade.HolyAttunement_FullSwingDamageMult, Empowerment / maxEmpowerment); + + modifiers.HitDirectionOverride = (Owner.Center.X > target.Center.X).ToDirectionInt(); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs index d2ada56839..a9e9b8c3b8 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 102; Projectile.scale = Scale; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; Projectile.hide = true; } diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs index 56033def56..966f0d858e 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueDecaysRetort.cs @@ -30,9 +30,6 @@ namespace CalamityMod.Projectiles.Melee private Vector2 PowerLungeStart; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -140,10 +137,7 @@ namespace CalamityMod.Projectiles.Melee Owner.GiveUniversalIFrames(TrueBiomeBlade.EvilAttunement_SlashIFrames); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(Main.player[Projectile.owner].moonLeech); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(Main.player[Projectile.owner].moonLeech); - - private void OnHitEffects(bool cannotLifesteal) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (ChargedUp) return; @@ -153,10 +147,7 @@ namespace CalamityMod.Projectiles.Melee if (Main.myPlayer != Owner.whoAmI || CanBounce == 0f) return; - if (!cannotLifesteal) //trolled - { - Owner.HealPlayer(TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck - } + Owner.DoLifestealDirect(target, TrueBiomeBlade.EvilAttunement_Lifesteal); //Idk if its too much or what but at the same time its close range as fuck // Bounce off float bounceStrength = LungeSpeed / 2f; diff --git a/Projectiles/Melee/MirrorBladeProjectile.cs b/Projectiles/Melee/MirrorBladeProjectile.cs new file mode 100644 index 0000000000..b2710900a3 --- /dev/null +++ b/Projectiles/Melee/MirrorBladeProjectile.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + + public class MirrorBladeProjectile : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public Player Owner => Main.player[Projectile.owner]; + public override int swingWidth => 200; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 10; + public override int OffsetDistance => 90; + public override bool drawSwordTrail => false; + public override Color[] trailColors => new Color[] { Color.Red, Color.MediumPurple, Color.Purple }; public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + public override bool AlternateSwings => true; + public bool SpawnShards = true; + + public override bool useMeleeSpeed => true; + + public override int swingTime { get; set; } = 8; + + public override SoundStyle? UseSound => SoundID.Item71 with {Volume = 0.9f}; + + public List reflectedProjectiles = new List() { }; + + public override void Defaults() + { + Projectile.extraUpdates = 3; + } + + public override void Spawn(IEntitySource source) + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 15; + CooldownTime = 15; + swingTime -= StartupTime + CooldownTime; + modplayer.swingNum = (modplayer.swingNum + 1) % 2; + Projectile.timeLeft = 600; + + } + + public override void AdditionalAI() + { + if (inStartup) + { + Projectile.scale = baseScale * MathHelper.Lerp(0.75f, 1f, StartupCompletion); + } + else if (inCooldown) + { + Projectile.Opacity = 1; + Projectile.scale = baseScale * MathHelper.Lerp(1, 0.75f, CooldownCompletion); + } + else + { + Projectile.Opacity = 1; + } + if (!inStartup && !inCooldown) + foreach (var proj in Main.ActiveProjectiles) + { + if (proj.Hitbox.Intersects(Projectile.Hitbox) && proj.hostile && !reflectedProjectiles.Contains(proj.whoAmI)) + { + reflectedProjectiles.Add(proj.whoAmI); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), proj.Center, proj.velocity * -1, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact,Projectile.Center); + } + } + + Lighting.AddLight(Main.player[Projectile.owner].Center, 0.96f, 0.91f, 1f); + } + + public override float SwingFunction() + { + if (inStartup) + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * 0.7f, -swingWidth * 0.4f, 1 - MathF.Pow(StartupCompletion, 0.5f))); + if (inCooldown) + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.5f, (360 - swingWidth * 0.4f), MathF.Pow(CooldownCompletion, 0.5f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * .5f, (swingWidth * 0.5f), SwingCompletion)); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + + //Ensures only two shards spawn on enemy hits. If you're wondering why this is needed, turn this off and fight Storm Weaver + if (SpawnShards) + { + for (var i = 0; i < 2; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); + + SpawnShards = false; + } + + int slashCreatorID = ModContent.ProjectileType(); + int damage = (int)(Projectile.damage * MirrorBlade.SlashProjectileDamageMultiplier); + float knockback = Projectile.knockBack * MirrorBlade.SlashProjectileDamageMultiplier; + if (Owner.ownedProjectileCounts[slashCreatorID] < MirrorBlade.SlashProjectileLimit) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, slashCreatorID, damage, knockback, Projectile.owner, target.whoAmI, Projectile.rotation, 1f); + Owner.ownedProjectileCounts[slashCreatorID]++; + } + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.3f }, Projectile.Center); + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact,Projectile.Center); + } + public override float trailOffset => 28; + public override float trailWidth(float completion) + { + return 60; + } + public override int trailLength => 40; + public override bool PreDraw(ref Color lightColor) + { + lightColor = Color.White; + return base.PreDraw(ref lightColor); + } + } +} diff --git a/Projectiles/Melee/MirrorBladeProjectile.png b/Projectiles/Melee/MirrorBladeProjectile.png new file mode 100644 index 0000000000..56f94280f2 Binary files /dev/null and b/Projectiles/Melee/MirrorBladeProjectile.png differ diff --git a/Projectiles/Melee/MirrorBladeSlash.cs b/Projectiles/Melee/MirrorBladeSlash.cs new file mode 100644 index 0000000000..e080247f46 --- /dev/null +++ b/Projectiles/Melee/MirrorBladeSlash.cs @@ -0,0 +1,91 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MirrorBladeSlash : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public override string Texture => "CalamityMod/Projectiles/Melee/ExobeamSlash"; + + public override void SetDefaults() + { + Projectile.width = 24; + Projectile.height = 512; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = 2; + Projectile.Opacity = 1f; + Projectile.timeLeft = 35; + Projectile.MaxUpdates = 2; + Projectile.scale = 0.75f; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + Projectile.rotation = Projectile.velocity.ToRotation(); + Projectile.Opacity = Projectile.timeLeft / 35f; + if (Projectile.timeLeft == 34) + { + Vector2 vel = new Vector2(0.1f, 0.1f).RotatedByRandom(100); + VoidSparkParticle spark2 = new VoidSparkParticle(Projectile.Center, vel, false, 9, Main.rand.NextFloat(0.25f, 0.35f), Main.rand.NextBool() ? Color.Silver : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark2); + + for (int j = -1; j <= 1; j += 2) + { + for (int i = 0; i < 5; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), vel.SafeNormalize(Vector2.UnitX).RotatedByRandom(0.1f) * Main.rand.NextFloat(2f, 12.5f) * j); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(1.2f, 1.7f); + dust.color = Main.rand.NextBool() ? Color.SteelBlue : Color.BlueViolet; + dust.noLightEmittence = true; + dust.fadeIn = 1; + } + } + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.67f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(ModContent.BuffType(), 120); + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); + + public override bool ShouldUpdatePosition() => true; + + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Projectile.ai[2] == 0f ? Color.Blue : Color.White, Projectile.ai[2] == 0f ? Color.DarkBlue : Color.White, Projectile.identity / 7f % 1f) * Projectile.Opacity; + + public override bool PreDraw(ref Color lightColor) + { + return false; + } + } +} diff --git a/Projectiles/Melee/MirrorBladeSlashCreator.cs b/Projectiles/Melee/MirrorBladeSlashCreator.cs new file mode 100644 index 0000000000..dfbda1c746 --- /dev/null +++ b/Projectiles/Melee/MirrorBladeSlashCreator.cs @@ -0,0 +1,62 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class MirrorBladeSlashCreator : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + + public float SlashDirection + { + get + { + if (Projectile.ai[1] > MathHelper.Pi) + return Main.rand.NextFloatDirection(); + + return Projectile.ai[1] + Main.rand.NextFloatDirection() * 0.2f; + } + } + + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.ignoreWater = false; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 36; + Projectile.MaxUpdates = 2; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (Projectile.timeLeft % MirrorBlade.SlashCreationRate == 0) + { + if (Main.myPlayer == Projectile.owner) + { + float maxOffset = Target.width * 0.4f; + if (maxOffset > 300f) + maxOffset = 300f; + + Vector2 spawnOffset = SlashDirection.ToRotationVector2() * Main.rand.NextFloatDirection() * maxOffset; + Vector2 sliceVelocity = spawnOffset.SafeNormalize(Vector2.UnitY) * 0.1f; + + int damage = Projectile.damage; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Target.Center + spawnOffset, sliceVelocity, ModContent.ProjectileType(), damage, 0f, Projectile.owner, 0f, 0f, Projectile.ai[2]); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/MirrorBlast.cs b/Projectiles/Melee/MirrorBlast.cs index bcf7c10932..98cc282745 100644 --- a/Projectiles/Melee/MirrorBlast.cs +++ b/Projectiles/Melee/MirrorBlast.cs @@ -1,6 +1,12 @@ using System; +using System.Collections.Generic; +using System.IO; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Steamworks; using Terraria; +using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -9,55 +15,216 @@ namespace CalamityMod.Projectiles.Melee public class MirrorBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; + public bool isShard = true; + + public int shardShield = 0; + + public bool isShield => shardShield > 0; + + private bool hasSpawned = false; + + public int shardNum = -1; + + private Player player => Main.player[Projectile.owner]; public override void SetStaticDefaults() { - ProjectileID.Sets.TrailCacheLength[Type] = 10; - ProjectileID.Sets.TrailingMode[Type] = 1; + Main.projFrames[Type] = 3; } public override void SetDefaults() { - Projectile.width = 12; - Projectile.height = 12; + Projectile.width = 16; + Projectile.height = 16; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Melee; Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.timeLeft = 1800; + Projectile.extraUpdates = 0; + Projectile.noEnchantmentVisuals = true; + Projectile.tileCollide = false; } + public override void SendExtraAI(BinaryWriter writer) + { + writer.Write(isShard); + writer.Write(hasSpawned); + writer.Write(shardNum); + writer.Write(shardShield); + } + + public override void ReceiveExtraAI(BinaryReader reader) + { + isShard = reader.ReadBoolean(); + hasSpawned = reader.ReadBoolean(); + shardNum = reader.Read(); + shardShield = reader.Read(); + } + public override bool? CanDamage() + { + return !isShard; + } + + public override bool? CanHitNPC(NPC target) + { + if (target.Calamity().DR > 0.9f) { + return false; + } + return base.CanHitNPC(target); + } public override void AI() { - int playerOwner = (int)Player.FindClosest(Projectile.Center, 1, 1); - Projectile.ai[1] += 1f; - if (Projectile.ai[1] < 110f && Projectile.ai[1] > 30f) + if (!hasSpawned) { - float scaleFactor = Projectile.velocity.Length(); - Vector2 projDirection = Main.player[playerOwner].Center - Projectile.Center; - projDirection.Normalize(); - projDirection *= scaleFactor; - Projectile.velocity = (Projectile.velocity * 24f + projDirection) / 25f; - Projectile.velocity.Normalize(); - Projectile.velocity *= scaleFactor; + shardNum = player.ownedProjectileCounts[Projectile.type]; + hasSpawned = true; + shardNum = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner) + { + (proj.ModProjectile as MirrorBlast).shardNum++; + } + } + } + if (isShield) + { + if (shardNum > 10 || Projectile.timeLeft < 2) + { + shardShield = 0; + isShard = false; + Projectile.timeLeft = 1200; + Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; + return; + } + List positions = new List() //Hardcoded positions for the mirror shield shards so we can make it look nice + { + new(0,75), + new(10,65), + new(-10,65), + new(20,75), + new(-20,75), + new(30,65), + new(-30,65), + new(14,55), + new(-14,55), + new(0,45) + }; + Projectile.velocity = Vector2.Zero; + Projectile.Center = Vector2.Lerp(Projectile.Center, + player.Center + player.DirectionTo(player.Calamity().mouseWorld) + .RotatedBy(MathHelper.ToRadians(positions[shardNum - 1].X)) + * positions[shardNum - 1].Y, + 0.5f); + Projectile.rotation = Projectile.DirectionTo(player.Center).ToRotation() + MathHelper.PiOver2; + shardShield--; + } + else if (isShard) + { + Projectile.velocity = Vector2.Zero; + var shardCount = 0; + foreach (var proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Projectile.owner && (proj.ModProjectile as MirrorBlast).isShard) + { + shardCount++; + } + } + Projectile.Center = Vector2.Lerp(Projectile.Center, player.Center + new Vector2(0, MathHelper.Lerp(-90, -110, MathF.Sin(player.miscCounter / 300f * MathHelper.TwoPi + MathHelper.Pi * (shardNum % 2)))).RotatedBy(MathHelper.ToRadians(player.miscCounter / 300f * 360f + 360f / shardCount * shardNum)), 0.15f); + Projectile.rotation = Projectile.DirectionTo(player.Center).ToRotation() + MathHelper.PiOver2; + if (shardNum > 10 || Projectile.timeLeft < 2) + { + isShard = false; + Projectile.timeLeft = 1200; + Projectile.velocity = Projectile.DirectionTo(player.Center) * -20f; + } + } + else + { + float homingStrength = 0.025f; // Adjust this value for stronger or weaker homing + NPC target = FindClosestNPC(3200f); + if (target != null) + { + Vector2 direction = target.Center - Projectile.Center; + direction.Normalize(); + direction *= 40f; // Adjust speed as needed + Projectile.velocity = Vector2.Lerp(Projectile.velocity, direction, homingStrength); + + Particle smoke = new HeavySmokeParticle(Projectile.Center, Projectile.velocity * Main.rand.NextFloat(-0.2f, -0.6f), Color.Black, 7, Main.rand.NextFloat(0.35f, 0.4f), 1f, Main.rand.NextFloat(-0.2f, 0.2f), false); + GeneralParticleHandler.SpawnParticle(smoke); + if (Main.rand.NextBool(5)) + { + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); + trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); + trailDust.color = Main.rand.NextBool() ? Color.AliceBlue : Color.SkyBlue; + trailDust.noGravity = true; + } + } + Projectile.rotation = Projectile.velocity.ToRotation(); } - if (Projectile.velocity.Length() < 18f) + Lighting.AddLight(Projectile.Center, 0.96f*0.33f, 0.91f*0.33f, 0.33f); + if (Projectile.FinalExtraUpdate()) + Projectile.frameCounter++; + if (Projectile.frameCounter > 8) { - Projectile.velocity *= 1.02f; + Projectile.frame++; + Projectile.frameCounter = 0; } + if (Projectile.frame >= 3) + Projectile.frame = 0; + } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + public override void OnKill(int timeLeft) + { + if (!isShard) + { + SoundEngine.PlaySound(SoundID.Item27 with {Volume = 0.5f }, Projectile.position); + Particle Star = new CritSpark(Projectile.Center, Vector2.Zero, Color.WhiteSmoke, Color.BlueViolet, Main.rand.NextFloat(1.5f, 1.6f), 10, 0.1f, 3f); + GeneralParticleHandler.SpawnParticle(Star); - Lighting.AddLight(Projectile.Center, 0f, 0.35f, 0.35f); + for (int i = 0; i < 10; i++) + { + int dust = Dust.NewDust(Projectile.Center - Projectile.velocity / 2f, 0, 0, DustID.GemDiamond, 0f, 0f, 100, default, 1f); + Main.dust[dust].velocity *= 2f; + Main.dust[dust].noGravity = true; + } + } } public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 295) - return false; - - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); + Texture2D BlastTex = ModContent.Request("CalamityMod/Projectiles/Melee/MirrorBlast").Value; + Texture2D ShardTex = ModContent.Request("CalamityMod/Projectiles/Melee/MirrorShard").Value; + Point BlastTextureDim = new Point(60, 26); + Point ShardTextureDim = new Point(32, 14); + Texture2D UsedTex = isShard ? ShardTex : BlastTex; + Point UsedTextureDim = isShard ? ShardTextureDim : BlastTextureDim; + Vector2 origin = isShard ? ShardTextureDim.ToVector2() / 2f : BlastTextureDim.ToVector2() / 2f + new Vector2(14, 0); + Main.spriteBatch.Draw(UsedTex, Projectile.Center - Main.screenPosition, new Rectangle(0, UsedTextureDim.Y * Projectile.frame, UsedTextureDim.X, UsedTextureDim.Y), Color.White, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0f); return false; } + + private NPC FindClosestNPC(float maxRange) + { + NPC closestNPC = null; + float closestDistance = maxRange; + + foreach (NPC npc in Main.npc) + { + if (npc.CanBeChasedBy(this) && !npc.friendly) + { + float distance = Vector2.Distance(Projectile.Center, npc.Center); + if (distance < closestDistance) + { + closestDistance = distance; + closestNPC = npc; + } + } + } + + return closestNPC; + } } } diff --git a/Projectiles/Melee/MirrorBlast.png b/Projectiles/Melee/MirrorBlast.png index ae7a902f9a..07a4720957 100644 Binary files a/Projectiles/Melee/MirrorBlast.png and b/Projectiles/Melee/MirrorBlast.png differ diff --git a/Projectiles/Melee/MirrorShard.png b/Projectiles/Melee/MirrorShard.png new file mode 100644 index 0000000000..926658fff7 Binary files /dev/null and b/Projectiles/Melee/MirrorShard.png differ diff --git a/Projectiles/Melee/MonstrousKnife.cs b/Projectiles/Melee/MonstrousKnife.cs index 41b96a3f76..26a473b776 100644 --- a/Projectiles/Melee/MonstrousKnife.cs +++ b/Projectiles/Melee/MonstrousKnife.cs @@ -47,28 +47,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int heal = (int)Math.Round(hit.Damage * Main.rand.NextFloat(0.05f, 0.1f)); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - int heal = (int)Math.Round(info.Damage * Main.rand.NextFloat(0.05f, 0.1f)); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, 1, 3f); } } diff --git a/Projectiles/Melee/MurasamaSlash.cs b/Projectiles/Melee/MurasamaSlash.cs index 62c4e42c16..2b0d77c490 100644 --- a/Projectiles/Melee/MurasamaSlash.cs +++ b/Projectiles/Melee/MurasamaSlash.cs @@ -173,12 +173,15 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = newVelocity; } } - public override void ModifyDamageHitbox(ref Rectangle hitbox) + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { - int size = 60; - if (Slash3) - hitbox.Inflate(size, size); + Vector2 lineEnd = Main.player[Projectile.owner].Center + Projectile.velocity * (Slash3 ? 11.35f : 8.6f); + // The slash sprite is top-heavy, so make the width lean in a direction + float lineWidth = (Projectile.direction == 1 && projHitbox.Center.X > targetHitbox.Center.X) || (Projectile.direction == -1 && projHitbox.Center.X < targetHitbox.Center.X) ? 320f : 200f; + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Main.player[Projectile.owner].Center, lineEnd, lineWidth, ref _); } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (target.Organic()) diff --git a/Projectiles/Melee/NebulashFlail.cs b/Projectiles/Melee/NebulashFlail.cs index 04c51a2b4f..0e71521e37 100644 --- a/Projectiles/Melee/NebulashFlail.cs +++ b/Projectiles/Melee/NebulashFlail.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.DamageType = DamageClass.MeleeNoSpeed; Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 2; + Projectile.localNPCHitCooldown = 6; } public override Color SpecialDrawColor => new(255, 200, 0); public override int ExudeDustType => ModContent.DustType(); diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs index de9eff766d..f1f50f29b6 100644 --- a/Projectiles/Melee/OldLordClaymoreHoldout.cs +++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs @@ -239,6 +239,7 @@ namespace CalamityMod.Projectiles.Melee if ((useAnim > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) { Asset tex = ModContent.Request(Texture); + Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/OldLordClaymoreGlow"); Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; @@ -255,6 +256,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } return false; } diff --git a/Projectiles/Melee/OrderbringerBeam.cs b/Projectiles/Melee/OrderbringerBeam.cs index ea5a3dc017..2fc3736a21 100644 --- a/Projectiles/Melee/OrderbringerBeam.cs +++ b/Projectiles/Melee/OrderbringerBeam.cs @@ -1,9 +1,7 @@ -using System; -using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Terraria; -using Terraria.Audio; using Terraria.ID; using Terraria.ModLoader; @@ -30,7 +28,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 6; + Projectile.extraUpdates = 40; Projectile.timeLeft = 180; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; @@ -39,17 +37,16 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (time == 0) - { - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; - } + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; Player Owner = Main.player[Projectile.owner]; float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - if (Projectile.timeLeft % 3 == 0 && targetDist < 1400f) + if (Projectile.timeLeft % 12 == 0 && targetDist < 1400f) { - Particle spark = new SparkParticle(Projectile.Center - Projectile.velocity * 3, -Projectile.velocity * 0.05f, false, 17, 1.5f, mainColor * 0.7f); + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 23, 0.25f, mainColor * 0.75f, new Vector2(1f, 7.35f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); GeneralParticleHandler.SpawnParticle(spark); } time++; @@ -62,7 +59,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); + target.AddBuff(ModContent.BuffType(), 180); if (Projectile.numHits < 1) { Particle orb = new GlowSparkParticle(target.Center, Projectile.velocity.SafeNormalize(Vector2.UnitY), false, 12, 0.07f, mainColor, new Vector2(1.5f, 0.8f), true); diff --git a/Projectiles/Melee/OrderbringerWaveProj.cs b/Projectiles/Melee/OrderbringerWaveProj.cs index d38407612a..c75a37a4ae 100644 --- a/Projectiles/Melee/OrderbringerWaveProj.cs +++ b/Projectiles/Melee/OrderbringerWaveProj.cs @@ -1,14 +1,11 @@ using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using CalamityMod.Particles; -using Terraria.ModLoader; -using CalamityMod.Projectiles.Ranged; -using Microsoft.Xna.Framework.Graphics; -using System.ComponentModel; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee { @@ -32,21 +29,23 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 450; Projectile.DamageType = DamageClass.Melee; - Projectile.extraUpdates = 10; + Projectile.extraUpdates = 22; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } public override void AI() { - Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(100f)) * Projectile.scale) * 157; - Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-100f)) * Projectile.scale) * 157; + Vector2 topCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(125f)) * Projectile.scale) * 190; + Vector2 bottomCorner = Projectile.Center + (Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-125f)) * Projectile.scale) * 190; + + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; if (time == 0) { Projectile.scale = 0.0875f; - Projectile.velocity *= 0.9f; - mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + Projectile.velocity *= 1.25f; } Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; @@ -67,19 +66,20 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize, hitboxSize) - Projectile.velocity * 2, 66); - trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f) - (time < 150 ? 0 : time * 0.001f); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(hitboxSize * 1.25f, hitboxSize * 1.25f) - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 25, ModContent.DustType()); + trailDust.scale = Main.rand.NextFloat(1.6f, 1.95f) - (time < 150 ? 0 : time * 0.001f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.85f, 1.5f); - trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + trailDust.color = mainColor; trailDust.noGravity = true; + trailDust.fadeIn = 2f; } - if (time % 9 == 0) + if (time % 9 == 0 && time < 200) { - Particle orb = new GlowSparkParticle(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new GlowSparkParticle(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), false, 15, Main.rand.NextFloat(0.03f, 0.055f) * Utils.GetLerpValue(250, 150, time, true), mainColor, new Vector2(1, 0.8f), true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(orb2); + Particle spark = new CustomSpark(topCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(-170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(spark); + Particle spark2 = new CustomSpark(bottomCorner, Projectile.velocity.SafeNormalize(Vector2.UnitY).RotatedBy(MathHelper.ToRadians(170f)), "CalamityMod/Particles/BloomCircle", false, 18, 0.35f, mainColor * 0.75f, new Vector2(1f, 2.5f), true, true, shrinkSpeed: 0.2f, glowOpacity: 0.7f); + GeneralParticleHandler.SpawnParticle(spark2); } if (Main.rand.NextBool(12)) { @@ -90,25 +90,22 @@ namespace CalamityMod.Projectiles.Melee } } - fadeOut = Utils.GetLerpValue(0, 180, Projectile.timeLeft, true); - time++; } public override bool PreDraw(ref Color lightColor) { Texture2D tex = ModContent.Request(Texture).Value; - float waveFade = Utils.GetLerpValue(0, 300, Projectile.timeLeft); - for (int i = 1; i < 6; i++) // Weird for loop because of squash code - Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, mainColor with { A = 0 } * fadeOut, Projectile.rotation, tex.Size() / 2f, new Vector2(1 - (i * 0.2f * waveFade), 1 + (i * 0.35f * waveFade)) * Projectile.scale * 1.1f, SpriteEffects.None, 0); + float waveFade = (float)Math.Pow(Utils.GetLerpValue(0, 250, Projectile.timeLeft, true), 2); + float waveFade2 = (float)Math.Pow(Utils.GetLerpValue(0, 80, Projectile.timeLeft, true), 2); + for (int i = 1; i < 15; i++) // Weird for loop because of squash code + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 6f * i, null, mainColor with { A = 0 } * waveFade * (1 - 0.1f * i), Projectile.rotation, tex.Size() / 2f, new Vector2(1.1f * MathHelper.Lerp(waveFade2, 1, 0.3f), 0.6f + (1 - waveFade) * 0.8f) * Projectile.scale * 1.1f, SpriteEffects.None, 0); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 300); - if (damageMult < 1.3f && damageDone > 2) - damageMult += 0.325f; + target.AddBuff(ModContent.BuffType(), 300); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/PrismaticBreakerHoldout.cs b/Projectiles/Melee/PrismaticBreakerHoldout.cs index 7b0dc48d71..fb6c9c15e7 100644 --- a/Projectiles/Melee/PrismaticBreakerHoldout.cs +++ b/Projectiles/Melee/PrismaticBreakerHoldout.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Melee { StarTimer = 0f; SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.6f }, Projectile.Center); - for (int i = 0; i < 4; i++) + for (int i = 0; i < 3; i++) { float clampedChargeTime = MathHelper.Clamp(Timer / LaserChargeTime, 0f, 1f); float starOffset = MathHelper.Lerp(MathHelper.Pi / 6f, 0f, clampedChargeTime); diff --git a/Projectiles/Melee/PrismaticMagicCircle.cs b/Projectiles/Melee/PrismaticMagicCircle.cs index 760f51b0de..4693feba1e 100644 --- a/Projectiles/Melee/PrismaticMagicCircle.cs +++ b/Projectiles/Melee/PrismaticMagicCircle.cs @@ -75,10 +75,8 @@ namespace CalamityMod.Projectiles.Melee GameShaders.Misc["CalamityMod:ExoVortex"].Apply(); for (int i = 0; i < 6; i++) - { - Color portalColor = Color.Lerp(Main.DiscoColor, Color.White, (float)Math.Abs(Math.Sin(Main.GlobalTimeWrappedHourly * 2f))); Main.spriteBatch.Draw(howNoisy, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, howNoisy.Size() / 2f, squishScale, SpriteEffects.None, 0f); - } + Main.spriteBatch.ExitShaderRegion(); return false; } diff --git a/Projectiles/Melee/PrismaticRay.cs b/Projectiles/Melee/PrismaticRay.cs index 28d99875b9..237be73ecd 100644 --- a/Projectiles/Melee/PrismaticRay.cs +++ b/Projectiles/Melee/PrismaticRay.cs @@ -48,7 +48,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.timeLeft = 360; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 9; Projectile.hide = true; } @@ -100,7 +100,7 @@ namespace CalamityMod.Projectiles.Melee if (HitSoundCooldown == 0) { SoundEngine.PlaySound(HitSound, target.Center); - HitSoundCooldown = 10; + HitSoundCooldown = 9; } } diff --git a/Projectiles/Melee/PwnagehammerProj.cs b/Projectiles/Melee/PwnagehammerProj.cs index 3f656010c7..5235f02946 100644 --- a/Projectiles/Melee/PwnagehammerProj.cs +++ b/Projectiles/Melee/PwnagehammerProj.cs @@ -92,7 +92,8 @@ namespace CalamityMod.Projectiles.Melee else SoundEngine.PlaySound(UseSound with { Pitch = EmpoweredHammer * 0.1f - 0.2f }, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); + if (Main.myPlayer == Projectile.owner) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); return false; } diff --git a/Projectiles/Melee/RedtideWhirlpool.cs b/Projectiles/Melee/RedtideWhirlpool.cs index 0b983a87b8..56cfea6532 100644 --- a/Projectiles/Melee/RedtideWhirlpool.cs +++ b/Projectiles/Melee/RedtideWhirlpool.cs @@ -14,10 +14,15 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() { - Projectile.width = 60; - Projectile.height = 60; + Projectile.width = Projectile.height = 60; Projectile.friendly = true; Projectile.DamageType = DamageClass.Melee; Projectile.ignoreWater = true; @@ -42,29 +47,29 @@ namespace CalamityMod.Projectiles.Melee Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f)); dust.noGravity = true; } - - Vector2 trailOffset = Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(40f, 48f); - Dust trail = Dust.NewDustPerfect(Projectile.Center + trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); - trail.noGravity = true; - trail.scale = Main.rand.NextFloat(0.8f, 3f); - trail.alpha = Main.rand.Next(120, 180 + 1); - trail = Dust.NewDustPerfect(Projectile.Center - trailOffset, 176, Main.rand.NextVector2Circular(0.2f, 0.2f)); - trail.noGravity = true; - trail.scale = Main.rand.NextFloat(0.8f, 3f); - trail.alpha = Main.rand.Next(120, 180 + 1); } public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.3f, Projectile.rotation * 1.2f, texture.Size() * 0.5f, 1.2f, flip); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.4f, Projectile.rotation, texture.Size() * 0.5f, 1.6f, flip); - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.3f, Projectile.rotation * 1.2f, texture.Size() / 2f, 1.5f, flip, 0); - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.4f, Projectile.rotation, texture.Size() / 2f, 2f, flip, 0); - + // Custom afterimage + for (int i = 1; i < Projectile.oldPos.Length; i++) + { + float afterimageRot = Projectile.oldRot[i]; + Vector2 drawPos = Projectile.oldPos[i] + texture.Size() * 0.5f - Main.screenPosition; + float intensity = MathHelper.Lerp(0.01f, 0.1f, 1f - i / (float)Projectile.oldPos.Length); + + Main.EntitySpriteDraw(texture, drawPos, null, lightColor * intensity, afterimageRot, texture.Size() * 0.5f, 1.6f, flip); + } return false; } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 56f, targetHitbox); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/RespiteblockHoldout.cs b/Projectiles/Melee/RespiteblockHoldout.cs index d999e088e3..4ec0e55ed9 100644 --- a/Projectiles/Melee/RespiteblockHoldout.cs +++ b/Projectiles/Melee/RespiteblockHoldout.cs @@ -113,13 +113,7 @@ namespace CalamityMod.Projectiles.Melee SoundStyle fire = new("CalamityMod/Sounds/Item/WulfrumKnifeTileHit", 2); SoundEngine.PlaySound(fire with { Volume = 0.55f, Pitch = 0.3f }, Projectile.Center); - - if (player.moonLeech || player.lifeSteal <= 0f || target.lifeMax <= 5) - return; - - int heal = Main.rand.NextBool(4) ? 2 : 1; - player.lifeSteal -= heal; - player.HealPlayer(heal); + player.DoLifestealDirect(target, Main.rand.NextBool(4) ? 2 : 1, 0.75f); } public void PlayChainsawSounds() diff --git a/Projectiles/Melee/SeekingScorcherProj.cs b/Projectiles/Melee/SeekingScorcherProj.cs index 3ade299e4f..2d5274a83c 100644 --- a/Projectiles/Melee/SeekingScorcherProj.cs +++ b/Projectiles/Melee/SeekingScorcherProj.cs @@ -28,8 +28,9 @@ namespace CalamityMod.Projectiles.Melee public static float CrystalBounceDamageMult = 2f; // Exponential scaling for multiple bounces but capped at max bounces public static float CrystalBounceSpeedMult = 1.25f; public static int MaxBounces = 3; - public const float MaxNPCHomingRange = 1200f; // 75 tiles - public const float MaxAxeHomingRange = 800f; // 50 tiles + public const float MaxNPCHomingRange = 960f; // 60 tiles + up to 3x empowerment boosts + public const float MaxAxeHomingRange = 640f; // 40 tiles + up to 2x empowerment boosts + public const float BonusRangePerEmpowerment = 80f; // 5 tiles private List PreviousNPCs = new List() { -1 }; public Player Owner => Main.player[Projectile.owner]; @@ -126,6 +127,9 @@ namespace CalamityMod.Projectiles.Melee // Cause the axe that just hit to be empowered and counts as a bounce proj.damage = Math.Clamp((int)(proj.damage * CrystalBounceDamageMult), 0, (int)(proj.originalDamage * MathF.Pow(CrystalBounceDamageMult, MaxBounces))); proj.velocity = proj.velocity.RotatedBy(Main.rand.NextBool() ? MathHelper.ToRadians(Main.rand.NextFloat(108f, 162f)) : MathHelper.ToRadians(Main.rand.NextFloat(-162f, -108f))) * CrystalBounceSpeedMult; + if (proj.MaxUpdates < 5) + proj.MaxUpdates++; + proj.ai[1] -= 30f; proj.ai[2] = -1f; proj.netUpdate = true; @@ -230,6 +234,13 @@ namespace CalamityMod.Projectiles.Melee } } } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Projectile.numHits > 0) + Projectile.damage = (int)(Projectile.damage * 0.8f); + if (Projectile.damage < 1) + Projectile.damage = 1; + } public override void OnKill(int timeLeft) { @@ -263,7 +274,7 @@ namespace CalamityMod.Projectiles.Melee return; } - float range = MaxNPCHomingRange; + float range = MaxNPCHomingRange + BonusRangePerEmpowerment * (Projectile.MaxUpdates - 2); int targetNPC = -1; foreach (NPC target in Main.ActiveNPCs) { @@ -282,7 +293,7 @@ namespace CalamityMod.Projectiles.Melee { // Will only try to bounce towards nearby axes if there are nearby enemies as to not waste axe hits // The last usable pierce will never be spent on an axe since it would then just return to the player - float range2 = MaxAxeHomingRange; + float range2 = MaxAxeHomingRange + BonusRangePerEmpowerment * (Projectile.MaxUpdates - 2); int targetAxe = -1; foreach (Projectile proj in Main.ActiveProjectiles) { @@ -319,6 +330,7 @@ namespace CalamityMod.Projectiles.Melee { // Swiftly move back towards the player; also make it avoid naturally despawning Projectile.velocity = Projectile.SafeDirectionTo(Owner.Center) * Projectile.velocity.Length(); + Projectile.MaxUpdates = 2; Projectile.timeLeft = 2; // Delete the Projectile if it touches its owner or too far away. diff --git a/Projectiles/Melee/Shortswords/LucreciaProj.cs b/Projectiles/Melee/Shortswords/LucreciaProj.cs deleted file mode 100644 index 2517332b34..0000000000 --- a/Projectiles/Melee/Shortswords/LucreciaProj.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Projectiles.BaseProjectiles; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Melee.Shortswords -{ - public class LucreciaProj : BaseShortswordProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Melee/Lucrecia"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 28; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Melee; - Projectile.ownerHitCheck = true; - Projectile.timeLeft = 360; - Projectile.hide = true; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 8; - } - - public override Action EffectBeforePullback => (proj) => - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 10f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - }; - - - public override void SetVisualOffsets() - { - const int HalfSpriteWidth = 62 / 2; - const int HalfSpriteHeight = 62 / 2; - - int HalfProjWidth = Projectile.width / 2; - int HalfProjHeight = Projectile.height / 2; - - DrawOriginOffsetX = 0; - DrawOffsetX = -(HalfSpriteWidth - HalfProjWidth); - DrawOriginOffsetY = -(HalfSpriteHeight - HalfProjHeight); - } - - public override void ExtraBehavior() - { - if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.BoneTorch); - } - } -} diff --git a/Projectiles/Melee/SkytideDragoonHoldout.cs b/Projectiles/Melee/SkytideDragoonHoldout.cs index e362c1c7f4..3b227f0261 100644 --- a/Projectiles/Melee/SkytideDragoonHoldout.cs +++ b/Projectiles/Melee/SkytideDragoonHoldout.cs @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Melee if (fancySwing) // Call down the bolt { Owner.Calamity().GeneralScreenShakePower = 3f; - SoundStyle sound = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundStyle sound = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(sound with { Volume = 0.8f }, Projectile.Center); Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + new Vector2(0, -600), new Vector2(0, 10), ModContent.ProjectileType(), (int)(Projectile.damage * 9), Projectile.knockBack, Projectile.owner, 0, 0.5f); proj.timeLeft = 45; @@ -230,7 +230,7 @@ namespace CalamityMod.Projectiles.Melee else if (redirected) // Redirect the bolt { Owner.Calamity().GeneralScreenShakePower = 4.5f; - SoundStyle fire = new("CalamityMod/Sounds/Item/SkytiedBolt"); + SoundStyle fire = new("CalamityMod/Sounds/Item/SkytideBolt"); SoundEngine.PlaySound(fire with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundStyle fire2 = new("CalamityMod/Sounds/Item/AuricBulletHit"); SoundEngine.PlaySound(fire2 with { Volume = 0.5f, Pitch = 0.2f }, Projectile.Center); diff --git a/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs index 6c829928f4..3960a33083 100644 --- a/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs +++ b/Projectiles/Melee/Spears/BotanicPiercerProjectile.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Melee.Spears Projectile.penetrate = -1; Projectile.ownerHitCheck = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = 8; } public override float InitialSpeed => 3f; diff --git a/Projectiles/Melee/Spears/GildedProboscisProj.cs b/Projectiles/Melee/Spears/GildedProboscisProj.cs index 76bbf419ed..0d5cf451c9 100644 --- a/Projectiles/Melee/Spears/GildedProboscisProj.cs +++ b/Projectiles/Melee/Spears/GildedProboscisProj.cs @@ -1,58 +1,271 @@ -using CalamityMod.Balancing; -using System; +using System; +using CalamityMod.Balancing; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer.Dashes; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Healing; +using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Buffs.DamageOverTime; namespace CalamityMod.Projectiles.Melee.Spears { - public class GildedProboscisProj : BaseSpearProjectile + public class GildedProboscisProj : BaseSwordHoldoutProjectile, ILocalizedModType { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override void SetDefaults() + public new string LocalizationCategory => "Projectiles.Melee"; + public override bool useMeleeSpeed => false; + public override bool useMeleeSize => false; + public override int swingWidth => 360; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + + public override float lineCollisionLength => 196; + + bool isChannelable = false; + + int channelCharge = 0; + + public override void Defaults() { - Projectile.width = Projectile.height = 40; - Projectile.DamageType = TrueMeleeDamageClass.Instance; - Projectile.timeLeft = 90; - Projectile.friendly = true; - Projectile.hostile = false; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 4; + Projectile.width = Projectile.height = 138; + Projectile.extraUpdates = 5; //ExtraUpdates help make the VFX smoother + Projectile.noEnchantmentVisuals = true; + } + public override void Spawn(IEntitySource source) + { + //This sets variables for the spear in general, as well as the secondary attack + //The secondary attack is the "default" because it was coded first + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 20; + CooldownTime = 41; + swingTime -= StartupTime + CooldownTime; + modplayer.swingNum = 0; + OffsetDistance = 70; + angle = new Vector2(angle.X > 0 ? 1 : -1, 0); + if (player.dashDelay == -1) + { + angle = new Vector2(-MathF.Sign(player.velocity.X), 0 ); + } + RotateInStartup = 0; + RotateInCooldown = 0; + + UseSound = SoundID.DD2_BetsysWrathImpact; + //This adjusts variables for the primary attack + if (player.altFunctionUse == 0) + { + UseSound = SoundID.DD2_JavelinThrowersAttack; + isChannelable = true; + RotateInStartup = 0.5f; + OffsetDistance = 10; + } } - // These numbers sure are common, huh? yeah, they are - public override float InitialSpeed => 3f; - public override float ReelbackSpeed => 2.4f; - public override float ForwardSpeed => 0.8f; - public override void ExtraBehavior() + public override void AdditionalAI() { - if (Main.rand.NextBool(4)) + var player = Main.player[Projectile.owner]; + //Primary attack is a chargable spear stab + //The DPS is worse than the secondary due to being able to charge it while out of range + //The goal gameplay loop is for the primary to be used when getting up close, than the secondary to be used while close + #region Primary Attack + if (isChannelable) { - int dust = Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.RedTorch, Projectile.direction * 2, 0f, 150, default, 1f); - Main.dust[dust].noGravity = true; + //When channeling, the internal timer will not progress & the charge timer will go up + if (player.channel) + { + if (timer >= StartupTime - 1) + { + timer--; + Projectile.timeLeft++; + } + if (Projectile.FinalExtraUpdate() && channelCharge < CalamityUtils.SecondsToFrames(5)) + channelCharge++; + } + //Once not channeling, set the damage at the end of the startup + else + { + if (timer == StartupTime - 1) + Projectile.damage = (int)(Projectile.damage * 0.75 * (channelCharge / 60f)); //scales from 0x to 3.75x power + } + //Make the sprite rotation look right in game + Projectile.rotation -= (MathHelper.PiOver2) * (angle.X > 0 ? 1 : -1); + + //Adjust the offset distance (how close/far the weapon is held to the player) depending on charge during startup + //In cooldown or during the swing, these are based on how far completed the corresponding step is + if (inStartup) + { + OffsetDistance = (int)MathHelper.SmoothStep(40, 5, channelCharge / 300f); + } + if (inCooldown) + { + OffsetDistance = (int)MathHelper.SmoothStep(90, 60, MathF.Pow(CooldownCompletion, 1)); + + if (CooldownCompletion > 0.5f && Main.LocalPlayer.whoAmI == Projectile.owner && player.HeldItem.type == ModContent.ItemType() && Main.mouseRight) + { + player.itemAnimation = 1; + player.itemTime = 1; + Projectile.timeLeft = 1; + timer = StartupTime + swingTime + CooldownTime; + return; + } + } + + if (inSwing) + { + OffsetDistance = (int)MathHelper.Lerp(-40, 90, MathF.Pow(SwingCompletion, 1.7f)); + //Spawn the little sparks + var veloc = oldPlayerOffset - (Projectile.Center - Main.player[Projectile.owner].Center); + veloc.Normalize(); + if (swingTimer % 4 == 0) + { + for (int i2 = -1; i2 <= 1; i2 += 2) + { + int sparkLifetime = Main.rand.Next(15, 23); + + Vector2 sparkVel = Vector2.UnitY * -9f; + float maxRotationDeviance = 0.4f; + float rotationAngle = Main.rand.NextFloat(-maxRotationDeviance, maxRotationDeviance); + sparkVel = sparkVel.RotatedBy(rotationAngle) * Main.rand.NextFloat(0.3f, 1.0f); + + float sparkScale = Main.rand.NextFloat(0.007f, 0.015f); + + Vector2 compensatedSparkVel = angle.RotatedBy(i2 * -0.15f) * Main.rand.NextFloat(5, 10); + Vector2 pos = player.Center + angle.RotatedBy(MathHelper.Pi) * (OffsetDistance + Main.rand.NextFloat(30, 100)) * Projectile.scale + new Vector2(0, 10 * i2).RotatedByRandom(MathHelper.Pi - 0.2f); + + Particle spark = new GlowSparkParticle(pos, compensatedSparkVel, false, sparkLifetime, sparkScale, Main.rand.NextBool() ? Color.Red : Color.Gold, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + } + + } + //Spawn the large glow V + var sparkAngle = angle.RotatedBy(MathHelper.Pi); + int dir = MathF.Sign(sparkAngle.X); + var color = Color.Lerp(Color.Gold, Color.Crimson, SwingCompletion); + if (swingTimer % 2 == 0 || (swingTimer == swingTime - 1)) + for (int i = -1; i <= 1; i += 2) + { + Vector2 velocity = -sparkAngle.RotatedBy(i * -0.3f) * 10f; + Vector2 position = Projectile.Center + new Vector2(75, i * 22).RotatedBy(sparkAngle.ToRotation()); + Particle spark = new CustomSpark(position, velocity, "CalamityMod/Particles/BloomCircle", false, 10, 0.3f, color, new Vector2(0.3f, 3f), shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(spark); + } + } + return; } + #endregion + //The secondary attack is based on Byleth's side-special from Smash Ultimate + //It moves the player forward when used, and is meant to be the higher DPS option of the two + #region Secondary Attack + + //Sets the max dash velocity depending on keys + //Base of 12, 4 when holding against the dash & 20 when holding with the dash + var dashStrength = 12; + if ((player.direction == 1 && player.controlLeft) || (player.direction == -1 && player.controlRight)) + dashStrength -= 8; + if ((player.direction == 1 && player.controlRight) || (player.direction == -1 && player.controlLeft)) + dashStrength += 8; + if (inStartup) + { + //Scale % offset distance during startup + Projectile.scale = baseScale * MathHelper.Lerp(0.9f, 0.65f, MathF.Pow(StartupCompletion, 2f)); + OffsetDistance = (int)MathHelper.Lerp(60f, 40f, MathF.Pow(StartupCompletion, 2f)); + ref var vel = ref Main.player[Projectile.owner].velocity; + //accel for player during dash + if (StartupCompletion > 0.5f && -vel.X * angle.X < dashStrength) + vel.X -= angle.X; + } + else if (inCooldown) + { + //Scale & offset distance during cooldown + Projectile.scale = baseScale * MathHelper.Lerp(1, 0.9f, 1 - MathF.Pow(1 - CooldownCompletion, 2)); + OffsetDistance = (int)MathHelper.Lerp(70, 60, 1 - MathF.Pow(1 - CooldownCompletion, 2)); + ref var vel = ref Main.player[Projectile.owner].velocity; + //decel for player after dash + if (CooldownCompletion < 0.25f && -vel.X * angle.X > 5) + vel.X *= 0.9f; + } + else + { + //scale & offset for the damaging swing part of the anim + //This keeps "am" (short for animation) at 0 or 1 most of the time, with a quick but smooth transition + float am = MathHelper.Clamp(MathF.Pow((SwingCompletion - (0.5f - (1 / 3f))) * 3f, 3f), 0, 1); + if (float.IsNaN(am)) + am = 0; + Projectile.scale = baseScale * MathHelper.Lerp(0.65f, 1, am); + am = MathHelper.Clamp(MathF.Pow((SwingCompletion - (0.3f - (1 / 3f))) * 3f, 3f), 0, 1); + if (float.IsNaN(am)) + am = 0; + OffsetDistance = (int)MathHelper.Lerp(40, 70, am); + //accel for player during dash + ref var vel = ref Main.player[Projectile.owner].velocity; + if (-vel.X * angle.X < dashStrength) + vel.X -= angle.X; + + var veloc = oldPlayerOffset - (Projectile.Center - Main.player[Projectile.owner].Center); + veloc.Normalize(); + //Little sparks + for (var i = 0; i < 2; i++) + { + int sparkLifetime = Main.rand.Next(15, 23); + + Vector2 sparkVel = Vector2.UnitY * -9f; + float maxRotationDeviance = 0.4f; + float rotationAngle = Main.rand.NextFloat(-maxRotationDeviance, maxRotationDeviance); + sparkVel = sparkVel.RotatedBy(rotationAngle) * Main.rand.NextFloat(0.3f, 1.0f); + + float sparkScale = Main.rand.NextFloat(0.007f, 0.015f); + + Vector2 compensatedSparkVel = veloc * Main.rand.NextFloat(2, 5); + Particle spark = new GlowSparkParticle(Projectile.Center + new Vector2(-angle.X, Main.rand.NextFloat(-0.05f, 0.05f)).RotatedBy(Projectile.rotation) * Main.rand.NextFloat(50, 120) * Projectile.scale, compensatedSparkVel, false, sparkLifetime, sparkScale, Main.rand.NextBool() ? Color.Red : Color.Gold, new Vector2(0.5f, 1.3f)); + GeneralParticleHandler.SpawnParticle(spark); + + } + // Smoke/fire effect + Color[] smokeColor = { Color.Red, Color.Goldenrod, Color.Crimson }; + Vector2 smokePosition = Projectile.Center + new Vector2(-angle.X, Main.rand.NextFloat(-0.05f, 0.05f)).RotatedBy(Projectile.rotation) * 80 * Projectile.scale; + for (var i = 0; i < 3; i++) + { + Particle beam4 = new CustomSpark(smokePosition, smokePosition.DirectionTo(Main.player[Projectile.owner].Center), "CalamityMod/ExtraTextures/Trails/ScarletDevilStreak", false, 10, 0.6f * Projectile.scale, smokeColor[timer % 3], new Vector2(1f, 1), true, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(beam4); + } + } + Projectile.rotation -= (MathHelper.PiOver2) * angle.X; + #endregion + } + + public override float SwingFunction() + { + if (isChannelable) //Primary attack + { + if (inStartup && channelCharge >= CalamityUtils.SecondsToFrames(5)) + { + //shake when fully charged + return Main.rand.NextFloat(-0.025f, 0.025f); + } + return 0; //Primary attack should face the mouse direction directly + } + //Everything else is secondary attack + if (inStartup) + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.7f, swingWidth * 0.33f, MathF.Pow(StartupCompletion, 4f))); + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(-swingWidth * 0.2f, -swingWidth * 0.3f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.33f, -swingWidth * 0.2f, SwingCompletion)); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 240); - - int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + target.AddBuff(ModContent.BuffType(), 900); + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.002)); } } } diff --git a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs index 88f394f1cc..8d20e38bb7 100644 --- a/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs +++ b/Projectiles/Melee/Spears/HellionFlowerSpearProjectile.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override void SetDefaults() { Projectile.width = Projectile.height = 40; - Projectile.DamageType = DamageClass.Melee; //Dictates whether this is a melee-class weapon. + Projectile.DamageType = TrueMeleeDamageClass.Instance; Projectile.timeLeft = 90; Projectile.friendly = true; Projectile.hostile = false; @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Melee.Spears public override float ForwardSpeed => 0.8f; public override Action EffectBeforeReelback => (proj) => { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65), Projectile.knockBack * 0.85f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.85f, Projectile.owner); }; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Melee/StarofJudgement.cs b/Projectiles/Melee/StarofJudgement.cs index 7d8e9fb74c..fb825f10b1 100644 --- a/Projectiles/Melee/StarofJudgement.cs +++ b/Projectiles/Melee/StarofJudgement.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; using Microsoft.Xna.Framework.Graphics; using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; namespace CalamityMod.Projectiles.Melee { @@ -40,31 +41,37 @@ namespace CalamityMod.Projectiles.Melee { if (time == 0) { - Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); mainColor = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; + Projectile.scale = (Projectile.ai[2] == 1 ? 0.75f : 0.5f); if (Projectile.ai[2] == 1) { - Projectile.localNPCHitCooldown = 7; - Projectile.penetrate = 4; + Projectile.localNPCHitCooldown = -1; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } } Projectile.rotation += (Projectile.velocity.X + MathF.Abs(Projectile.velocity.Y) * Projectile.direction) * 0.01f; if (Projectile.ai[2] == 1) { - CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); - if (Main.rand.NextBool(4) && Projectile.numHits < 1) + if (time > 18) { - Particle spark = new GlowOrbParticle(Projectile.Center + Main.rand.NextVector2Circular(7, 7) - Projectile.velocity, -Projectile.velocity * Main.rand.NextFloat(0.5f, 0.8f), false, 13, 1f, mainColor * 0.5f); + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + } + else + Projectile.velocity = Projectile.velocity.RotatedBy(0.085f * Projectile.ai[1]); + if (time % 2 == 0) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); GeneralParticleHandler.SpawnParticle(spark); } } - else if (time > 15) + if (Projectile.ai[2] != 1 && time > 10) { CalamityUtils.HomeInOnNPC(Projectile, true, 700f * (Projectile.numHits > 1 ? 2 : 1), 20, 20f * (Projectile.numHits > 1 ? 5 : 1)); if (Main.rand.NextBool(3)) { - Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, 66); + Dust trailDust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(5, 5) - Projectile.velocity, ModContent.DustType()); trailDust.scale = Main.rand.NextFloat(0.7f, 0.85f); trailDust.velocity = -Projectile.velocity * Main.rand.NextFloat(0.3f, 0.5f); trailDust.color = Main.rand.NextBool() ? Color.MediumPurple : Color.MediumOrchid; @@ -84,18 +91,19 @@ namespace CalamityMod.Projectiles.Melee Vector2 rotationPoint = texture.Size() * 0.5f; CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true); Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); + Main.EntitySpriteDraw(texture, drawPosition, null, Color.White with { A = 0 }, drawRotation, rotationPoint, Projectile.scale * 0.8f, SpriteEffects.None); return false; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int buffType = Projectile.ai[2] == 1f ? ModContent.BuffType() : ModContent.BuffType(); - target.AddBuff(buffType, 60); + if (!target.CanBeChasedBy()) + Projectile.penetrate++; if (Projectile.ai[2] == 0) { Projectile.timeLeft = 180; time = 0; - Projectile.velocity *= 1.2f; + Projectile.velocity *= 1.1f; } } public override void OnKill(int timeLeft) diff --git a/Projectiles/Melee/StarofOrder.cs b/Projectiles/Melee/StarofOrder.cs new file mode 100644 index 0000000000..958b843c75 --- /dev/null +++ b/Projectiles/Melee/StarofOrder.cs @@ -0,0 +1,117 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class StarofOrder : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public ref float time => ref Projectile.ai[0]; + public Color mainColor; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.TrailCacheLength[Type] = 12; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + public override void SetDefaults() + { + Projectile.width = 44; + Projectile.height = 44; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = 4; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 7; + } + + public override void AI() + { + Player player = Main.player[Projectile.owner]; + mainColor = player.Calamity().lightRGB; + if (time == 0) + { + Projectile.scale = Main.rand.NextFloat(0.65f, 0.8f); + } + float sine = (float)Math.Sin(time * 0.575f * Projectile.scale / MathHelper.Pi); + + Projectile.rotation = 0.25f * sine; + if (time < 20) + { + Projectile.extraUpdates = 1; + Projectile.velocity = Projectile.velocity.RotatedBy(-Projectile.ai[1] * 0.05f); + } + else + { + Projectile.extraUpdates = 0; + CalamityUtils.HomeInOnNPC(Projectile, true, 900f, 25, MathHelper.Clamp(30 - time, 15, 30)); + } + if (time % 2 == 0 && Projectile.numHits < 1) + { + Particle spark = new CustomSpark(Projectile.Center, Projectile.velocity * 0.2f, "CalamityMod/Particles/BloomCircle", false, 13, 0.35f, mainColor * 0.75f, new Vector2(0.8f, 1.35f), true, false, shrinkSpeed: 0.3f); + GeneralParticleHandler.SpawnParticle(spark); + } + + time++; + } + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Color.Lerp(mainColor, Color.White, 0.2f) with { A = 0 }; + float drawRotation = Projectile.rotation; + Vector2 rotationPoint = texture.Size() * 0.5f; + //CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], drawColor * 0.5f, 1, texture, true, true); + bool roted = true; + for (int i = 0; i < 5; i++) + { + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, (roted ? 0 : MathHelper.PiOver2) + Projectile.rotation, rotationPoint, new Vector2(1 - 0.12f * i, 1 + 0.75f * i) * Projectile.scale * 0.2f * Main.rand.NextFloat(0.8f, 1.1f), SpriteEffects.None); + if (roted && i == 4) + { + i = -1; + roted = false; + } + } + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int buffType = ModContent.BuffType(); + target.AddBuff(buffType, 60); + + if (Projectile.ai[2] == 0) + { + Projectile.timeLeft = 180; + time = 0; + Projectile.velocity *= 1.2f; + } + } + public override void OnKill(int timeLeft) + { + int points = 4; + float radians = MathHelper.TwoPi / points; + Vector2 spinningPoint = Vector2.Normalize(new Vector2(-1f, -1f).RotatedBy(Projectile.rotation)); + for (int k = 0; k < points; k++) + { + Vector2 velocity = spinningPoint.RotatedBy(radians * k).RotatedBy(-0.45f); + Dust dust = Dust.NewDustPerfect(Projectile.Center + velocity * 2, ModContent.DustType(), velocity * 8); + dust.scale = 3.5f; + dust.color = mainColor; + dust.noGravity = true; + dust.fadeIn = 6f; + } + } + } +} diff --git a/Projectiles/Melee/StellarStrikerHoldout.cs b/Projectiles/Melee/StellarStrikerHoldout.cs index 715ba348bc..55223e03c3 100644 --- a/Projectiles/Melee/StellarStrikerHoldout.cs +++ b/Projectiles/Melee/StellarStrikerHoldout.cs @@ -220,7 +220,7 @@ namespace CalamityMod.Projectiles.Melee if (spawnBoom) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-550, 550), Main.rand.NextFloat(-750, -950)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 2.25f), Projectile.knockBack, Projectile.owner, 0, 0, 7); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, 7); spawnBoom = false; } diff --git a/Projectiles/Melee/TerratomereHoldoutProj.cs b/Projectiles/Melee/TerratomereHoldoutProj.cs index 4be39fcdda..a4ce26890d 100644 --- a/Projectiles/Melee/TerratomereHoldoutProj.cs +++ b/Projectiles/Melee/TerratomereHoldoutProj.cs @@ -277,19 +277,6 @@ namespace CalamityMod.Projectiles.Melee #endregion Drawing #region Hit Effects and Collision - - public void OnHitHealEffect(int damage) - { - int heal = (int)Math.Round(damage * 0.025); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); - } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float point = 0f; @@ -300,9 +287,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - - if (target.lifeMax > 5) - OnHitHealEffect(hit.Damage); + Owner.DoLifestealDirect(target, (int)Math.Round(hit.Damage * 0.025), 0.75f); // Create a slash creator on top of the hit target. int slashCreatorID = ModContent.ProjectileType(); @@ -312,12 +297,6 @@ namespace CalamityMod.Projectiles.Melee Owner.ownedProjectileCounts[slashCreatorID]++; } } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), Terratomere.TrueMeleeGlacialStateTime); - OnHitHealEffect(info.Damage); - } #endregion Hit Effects and Collision } } diff --git a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs index a562a8cc32..2bc10c3cc6 100644 --- a/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs +++ b/Projectiles/Melee/TheMutilatorHoldoutProjectile.cs @@ -42,6 +42,9 @@ namespace CalamityMod.Projectiles.Melee public override int StartupTime { get; set; } public override int CooldownTime { get; set; } + public override SoundStyle? UseSound => SoundID.Item1; + + public bool hasGivenBlood = false; public override void Spawn(IEntitySource source) diff --git a/Projectiles/Melee/TriactisHammerExplosion.cs b/Projectiles/Melee/TriactisHammerExplosion.cs index af160569b0..bafc5da605 100644 --- a/Projectiles/Melee/TriactisHammerExplosion.cs +++ b/Projectiles/Melee/TriactisHammerExplosion.cs @@ -84,7 +84,11 @@ namespace CalamityMod.Projectiles.Melee public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 640f, targetHitbox); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + modifiers.SourceDamage *= Utils.Remap(Projectile.numHits, 0, 10, 1f, 0.1f, true); + } internal float WidthFunction(float completionRatio) => MathHelper.Clamp(CalamityUtils.Convert01To010(completionRatio * 2), 0.2f, 1f) * 4f; internal Color ColorFunction(float completionRatio) => Color.White; diff --git a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs index 68dda29ff5..50216466a3 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_SwungBlade.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { - Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.DamageType = TrueMeleeNoSpeedDamageClass.Instance; Projectile.width = Projectile.height = 60; Projectile.width = Projectile.height = 60; Projectile.tileCollide = false; diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 47863bc102..cd19d30216 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -57,10 +57,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Spark); } - if (Owner.moonLeech) - return; - - Owner.HealPlayer(OmegaBiomeBlade.SuperPogoAttunementSliceLifesteal); + Owner.DoLifestealDirect(target, OmegaBiomeBlade.SuperPogoAttunementSliceLifesteal, 0.75f); } public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines diff --git a/Projectiles/Melee/UrchinSpikeFugu.cs b/Projectiles/Melee/UrchinSpikeFugu.cs index 3938a7e9cc..f96645ac3e 100644 --- a/Projectiles/Melee/UrchinSpikeFugu.cs +++ b/Projectiles/Melee/UrchinSpikeFugu.cs @@ -46,8 +46,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = (Projectile.velocity * 20f + idealVelocity) / 21f; Projectile.velocity = Projectile.velocity.MoveTowards(idealVelocity, 2f); } + else if (Time >= 48f) + Projectile.velocity *= 0.9f; - if (Main.rand.NextBool(8)) + int dustRate = (int)MathF.Max(Utils.Remap(Time, 0f, 12f, 20f, 4f), Utils.Remap(Time, 60f, 90f, 4f, 20f)); + if (Main.rand.NextBool(dustRate)) { Dust offTrail = Dust.NewDustPerfect(Projectile.Center, 171, Main.rand.NextVector2Circular(0.2f, 0.2f)); offTrail.noGravity = true; @@ -63,7 +66,7 @@ namespace CalamityMod.Projectiles.Melee internal Color ColorFunction(float completionRatio) => new Color(91, 62, 153) * Projectile.Opacity; public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); return true; } diff --git a/Projectiles/Melee/ViolenceThrownProjectile.cs b/Projectiles/Melee/ViolenceThrownProjectile.cs index db26da3a46..667cffc62e 100644 --- a/Projectiles/Melee/ViolenceThrownProjectile.cs +++ b/Projectiles/Melee/ViolenceThrownProjectile.cs @@ -199,7 +199,7 @@ namespace CalamityMod.Projectiles.Melee } public bool JavelinPreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); // Not cloning the points causes the below operations to be applied to the original oldPos value by reference // and thus causes it to be consistently added over and over, which is not intended behavior. @@ -419,7 +419,7 @@ namespace CalamityMod.Projectiles.Melee } public bool YoyoPreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Texture2D spearProjectile = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs index 738d7d071c..c88f451f81 100644 --- a/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs +++ b/Projectiles/Melee/Yoyos/BurningRevelationYoyo.cs @@ -206,7 +206,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos SoundStyle explode = new("CalamityMod/Sounds/Custom/Providence/ProvidenceHolyBlastImpact"); SoundEngine.PlaySound(explode with { Volume = 0.5f, Pitch = 0.3f * power }, Projectile.Center); - SoundStyle explode2 = new("CalamityMod/Sounds/Item/HeliumFlashReadyAlt"); + SoundStyle explode2 = new("CalamityMod/Sounds/Item/HeliumFlashReady"); SoundEngine.PlaySound(explode2 with { Volume = 0.7f, Pitch = 0.6f * power }, Projectile.Center); } } diff --git a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs index 43b61fd17b..8e5be19829 100644 --- a/Projectiles/Melee/Yoyos/LaceratorYoyo.cs +++ b/Projectiles/Melee/Yoyos/LaceratorYoyo.cs @@ -1,18 +1,32 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.NPCs; +using CalamityMod.Projectiles.Healing; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; +using CalamityMod.Particles; namespace CalamityMod.Projectiles.Melee.Yoyos { + // Although normally yoyos are automatically exempted from pierce resist, + // the damage logic for the buzzsaw briefly clobbers aiStyle, necessitating a manual pierce resist exception. + [PierceResistException] public class LaceratorYoyo : ModProjectile { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; + public float chargeProgress = 0; + private bool sawHit = false; + private bool spawnedBlood = false; + private int sawDir = 0; + public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; @@ -33,29 +47,93 @@ namespace CalamityMod.Projectiles.Melee.Yoyos Projectile.MaxUpdates = MaxUpdates; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6 * MaxUpdates; + } public override void AI() { + if (sawDir == 0) + sawDir = Projectile.velocity.X < 0 ? -1 : 1; + if (chargeProgress > 1) + chargeProgress = 1; + if (chargeProgress > 0) + { + // Handles damage logic for the buzzsaw visual + if (Main.player[Projectile.owner].miscCounter % 5 == 0 && Projectile.FinalExtraUpdate() && chargeProgress > 0.05f) + { + spawnedBlood = false; + Projectile.position = Projectile.Center; + Projectile.width = 196; + Projectile.height = 196; + Projectile.Center = Projectile.position; + Projectile.originalDamage = Projectile.damage; + Projectile.damage = (int)(Projectile.damage * MathHelper.Lerp(0, 0.75f, chargeProgress)); + sawHit = true; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.aiStyle = -1; + Projectile.Damage(); + Projectile.aiStyle = ProjAIStyleID.Yoyo; + Projectile.usesIDStaticNPCImmunity = false; + sawHit = false; + Projectile.damage = Projectile.originalDamage; + Projectile.position = Projectile.Center; + Projectile.width = 16; + Projectile.height = 16; + Projectile.Center = Projectile.position; + + } + if (chargeProgress > 0.05f) + { + float particleSize = 0.9f + 0.15f * (float)Math.Cos(Main.GlobalTimeWrappedHourly % 60f * MathHelper.TwoPi); + particleSize *= 0.5f; + var particlePos = Projectile.Center + new Vector2(0, 84).RotatedByRandom(MathHelper.TwoPi); + var particleVel = particlePos.DirectionTo(Projectile.Center).RotatedBy(-sawDir * MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(15f, 25f); + Particle blood = new CustomSpark(particlePos, particleVel, "CalamityMod/Particles/PearlParticleGlow", false, (int)MathHelper.Lerp(7, 17, chargeProgress), particleSize, Color.DarkRed, new Vector2(0.5f, 1), false, false, 0, false, false, 0f); + GeneralParticleHandler.SpawnParticle(blood); + } + chargeProgress -= 0.003f / Projectile.extraUpdates; + if (chargeProgress < 0) + chargeProgress = 0; + } + if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); - - if (Main.player[Projectile.owner].moonLeech) + if (sawHit) + { + Vector2 bloodpos = Projectile.Center + Projectile.DirectionTo(target.Center) * 84; + if (!spawnedBlood && Main.rand.NextBool() && chargeProgress > 0.2f && target.Hitbox.Contains(bloodpos.ToPoint())) + { + Projectile.NewProjectile(Projectile.GetSource_OnHit(target), bloodpos, Projectile.DirectionTo(target.Center).RotatedBy(sawDir * MathHelper.PiOver2 * 0.9f).RotatedByRandom(0.1f) * Main.rand.NextFloat(3f, 5f), ModContent.ProjectileType(), 4, 0f, Projectile.owner); + spawnedBlood = true; + } return; - - Player player = Main.player[Projectile.owner]; - player.lifeRegenTime += 2; + } + var baseYoyo = Main.projectile.First(x => x.active && x.type == ModContent.ProjectileType() && x.owner == Projectile.owner); + baseYoyo.ModProjectile().chargeProgress += (Main.player[Projectile.owner].yoyoGlove ? 0.05f : 0.1f); + target.AddBuff(ModContent.BuffType(), 180); } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) { + if (chargeProgress > 0) + { + var owner = Main.player[Projectile.owner]; + Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Melee/LaceratorSaw").Value; + Texture2D WindTexture = ModContent.Request("CalamityMod/Projectiles/Melee/BlazingPhantomBlade").Value; + float rot = MathHelper.TwoPi * 30 * sawDir * (owner.miscCounter / 300f); + var color = new Color(200, 200, 200); + var frame = WindTexture.Frame(1, 4, 0, 0); + Main.EntitySpriteDraw(WindTexture, Projectile.Center - Main.screenPosition + rot.ToRotationVector2() * 30, frame, color * MathF.Pow(chargeProgress, 0.5f) * 0.33f, rot - 0.2f * sawDir, new Vector2(frame.Width, frame.Height) * 0.5f, 1, sawDir == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + Main.EntitySpriteDraw(WindTexture, Projectile.Center - Main.screenPosition + (rot + MathHelper.Pi).ToRotationVector2() * 30, frame, color * MathF.Pow(chargeProgress, 0.5f) * 0.33f, (rot + MathHelper.Pi) - 0.2f * sawDir, new Vector2(frame.Width, frame.Height) * 0.5f, 1, sawDir == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None, 0); + color = new Color(255, 10, 10); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, color * MathF.Pow(chargeProgress, 0.5f) * 1f, rot, texture.Size() * 0.5f, 1, sawDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); + } CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.cs b/Projectiles/Melee/Yoyos/OzzathothYoyo.cs similarity index 91% rename from Projectiles/Melee/Yoyos/AzathothYoyo.cs rename to Projectiles/Melee/Yoyos/OzzathothYoyo.cs index 029bdbc52e..690d67df7f 100644 --- a/Projectiles/Melee/Yoyos/AzathothYoyo.cs +++ b/Projectiles/Melee/Yoyos/OzzathothYoyo.cs @@ -8,16 +8,16 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee.Yoyos { - public class AzathothYoyo : ModProjectile + public class OzzathothYoyo : ModProjectile { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 3; public override void SetStaticDefaults() { ProjectileID.Sets.YoyosLifeTimeMultiplier[Type] = -1f; - ProjectileID.Sets.YoyosMaximumRange[Type] = Azathoth.Reach; - ProjectileID.Sets.YoyosTopSpeed[Type] = Azathoth.Speed / MaxUpdates; + ProjectileID.Sets.YoyosMaximumRange[Type] = Ozzathoth.Reach; + ProjectileID.Sets.YoyosTopSpeed[Type] = Ozzathoth.Speed / MaxUpdates; ProjectileID.Sets.TrailCacheLength[Type] = 8; ProjectileID.Sets.TrailingMode[Type] = 1; diff --git a/Projectiles/Melee/Yoyos/AzathothYoyo.png b/Projectiles/Melee/Yoyos/OzzathothYoyo.png similarity index 100% rename from Projectiles/Melee/Yoyos/AzathothYoyo.png rename to Projectiles/Melee/Yoyos/OzzathothYoyo.png diff --git a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs index 83942f5fa5..b96f270a03 100644 --- a/Projectiles/Melee/Yoyos/QuagmireYoyo.cs +++ b/Projectiles/Melee/Yoyos/QuagmireYoyo.cs @@ -12,6 +12,7 @@ namespace CalamityMod.Projectiles.Melee.Yoyos { public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public const int MaxUpdates = 2; + public ref float Timer => ref Projectile.localAI[2]; public override void SetStaticDefaults() { @@ -34,19 +35,17 @@ namespace CalamityMod.Projectiles.Melee.Yoyos public override void AI() { + Timer++; if ((Projectile.position - Main.player[Projectile.owner].position).Length() > 3200f) //200 blocks Projectile.Kill(); if (Main.rand.NextBool(5 * MaxUpdates)) Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.owner == Main.myPlayer) { - if (Main.rand.NextBool(10 * MaxUpdates)) + if (Timer % (10 * MaxUpdates) == 0) { - Projectile spore = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f) + Vector2.UnitX.RotatedByRandom(MathHelper.Pi), ProjectileID.SporeGas + Main.rand.Next(3), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Projectile spore = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * Main.rand.NextFloat(0.15f, 0.35f) + Vector2.UnitX.RotatedByRandom(MathHelper.Pi), ProjectileID.SporeGas + Main.rand.Next(3), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); spore.DamageType = DamageClass.MeleeNoSpeed; - spore.usesLocalNPCImmunity = true; - spore.usesIDStaticNPCImmunity = false; - spore.localNPCHitCooldown = 30; } } } diff --git a/Projectiles/Ranged/AMR2.cs b/Projectiles/Ranged/AMR2.cs index 0e7a6fd955..bcf73a3b9a 100644 --- a/Projectiles/Ranged/AMR2.cs +++ b/Projectiles/Ranged/AMR2.cs @@ -13,7 +13,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.height = 4; Projectile.light = 0.5f; Projectile.alpha = 255; - Projectile.extraUpdates = 5; + Projectile.extraUpdates = 10; Projectile.scale = 1.18f; Projectile.tileCollide = false; Projectile.friendly = true; diff --git a/Projectiles/Ranged/AMRShot.cs b/Projectiles/Ranged/AMRShot.cs index d1c7e80d46..0b926f5740 100644 --- a/Projectiles/Ranged/AMRShot.cs +++ b/Projectiles/Ranged/AMRShot.cs @@ -24,18 +24,16 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { - float num107 = (float)Math.Sqrt(Projectile.velocity.X * Projectile.velocity.X + Projectile.velocity.Y * Projectile.velocity.Y); if (Projectile.alpha > 0) - Projectile.alpha -= (byte)(num107 * 0.9); + Projectile.alpha -= (int)(Projectile.velocity.Length() * 0.9f); if (Projectile.alpha < 0) Projectile.alpha = 0; - Projectile.rotation = (float)Math.Atan2(Projectile.velocity.Y, Projectile.velocity.X) + MathHelper.PiOver2; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override Color? GetAlpha(Color lightColor) @@ -76,12 +74,12 @@ namespace CalamityMod.Projectiles.Ranged if (crit) { var source = Projectile.GetSource_FromThis(); - extraProjectileAmt = 5; + extraProjectileAmt = 4; for (int x = 0; x < extraProjectileAmt; x++) { if (Projectile.owner == Main.myPlayer) { - fromRight = x > 3; + fromRight = x >= 2; CalamityUtils.ProjectileBarrage(source, Projectile.Center, targetPos, fromRight, 500f, 500f, 0f, 500f, 10f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15), Projectile.knockBack * 0.1f, Projectile.owner); } } diff --git a/Projectiles/Ranged/AnimosityBullet.cs b/Projectiles/Ranged/AnimosityBullet.cs index 546f2b7cf2..afced06a79 100644 --- a/Projectiles/Ranged/AnimosityBullet.cs +++ b/Projectiles/Ranged/AnimosityBullet.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = Main.zenithWorld ? 3 : 1; Projectile.extraUpdates = 2; Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { diff --git a/Projectiles/Ranged/AquaBlast.cs b/Projectiles/Ranged/AquaBlast.cs index 4a0a100b61..bc67355089 100644 --- a/Projectiles/Ranged/AquaBlast.cs +++ b/Projectiles/Ranged/AquaBlast.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = Lifetime; Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/Aquashard.cs b/Projectiles/Ranged/Aquashard.cs index 7aaa3c6e6a..2731b8fc06 100644 --- a/Projectiles/Ranged/Aquashard.cs +++ b/Projectiles/Ranged/Aquashard.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ArcherfishRing.cs b/Projectiles/Ranged/ArcherfishRing.cs index afbe1a3107..a2c7a234a2 100644 --- a/Projectiles/Ranged/ArcherfishRing.cs +++ b/Projectiles/Ranged/ArcherfishRing.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index 918ebc8a95..d2dc2ab678 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/AstralRound.cs b/Projectiles/Ranged/AstralRound.cs index 834728bd1c..8f89a2b96b 100644 --- a/Projectiles/Ranged/AstralRound.cs +++ b/Projectiles/Ranged/AstralRound.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.25f; Projectile.extraUpdates = 2; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Ranged/AstralSandgun.cs b/Projectiles/Ranged/AstralSandgun.cs index fca008bd42..44efefd7a5 100644 --- a/Projectiles/Ranged/AstralSandgun.cs +++ b/Projectiles/Ranged/AstralSandgun.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.friendly = true; Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; } diff --git a/Projectiles/Ranged/AstrealArrow.cs b/Projectiles/Ranged/AstrealArrow.cs index 4d72d5c9f0..0878dab0af 100644 --- a/Projectiles/Ranged/AstrealArrow.cs +++ b/Projectiles/Ranged/AstrealArrow.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/AuralisBullet.cs b/Projectiles/Ranged/AuralisBullet.cs index 9de76738f3..6051520954 100644 --- a/Projectiles/Ranged/AuralisBullet.cs +++ b/Projectiles/Ranged/AuralisBullet.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 10; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/AuricBullet.cs b/Projectiles/Ranged/AuricBullet.cs index 61d6186699..a88a7029c2 100644 --- a/Projectiles/Ranged/AuricBullet.cs +++ b/Projectiles/Ranged/AuricBullet.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 15; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.tileCollide = false; Projectile.ArmorPenetration = 50; Projectile.alpha = 255; diff --git a/Projectiles/Ranged/BallistaGreatArrow.cs b/Projectiles/Ranged/BallistaGreatArrow.cs index d9a48ebcd8..51e9c5e621 100644 --- a/Projectiles/Ranged/BallistaGreatArrow.cs +++ b/Projectiles/Ranged/BallistaGreatArrow.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged AIType = ProjectileID.WoodenArrowFriendly; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -41,23 +40,17 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 180); target.AddBuff(ModContent.BuffType(), 180); - } - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - if (Projectile.owner == Main.myPlayer) + for (int i = 0; i < 2; i++) // Burst into 2 shards upwards { - for (int i = -1; i < 2; i++) // Burst into 3 shards upwards - { - Vector2 baseVelocity = Vector2.UnitY * -12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top, baseVelocity.RotatedBy(MathHelper.ToRadians(10 * i)), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.25f, Projectile.owner); - } + Vector2 baseVelocity = Vector2.UnitY * -12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Top, baseVelocity.RotatedByRandom(MathHelper.Pi * 0.1f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack * 0.25f, Projectile.owner); } } + public override void OnKill(int timeLeft) => SoundEngine.PlaySound(SoundID.Item14, Projectile.position); + public override bool PreDraw(ref Color lightColor) { CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 2); diff --git a/Projectiles/Ranged/BarinadeArrow.cs b/Projectiles/Ranged/BarinadeArrow.cs index 8e5a2ad405..7d177158e3 100644 --- a/Projectiles/Ranged/BarinadeArrow.cs +++ b/Projectiles/Ranged/BarinadeArrow.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.extraUpdates = 2; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() { diff --git a/Projectiles/Ranged/BloodBoilerFire.cs b/Projectiles/Ranged/BloodBoilerFire.cs index 5a1869b20e..87e63d5d6e 100644 --- a/Projectiles/Ranged/BloodBoilerFire.cs +++ b/Projectiles/Ranged/BloodBoilerFire.cs @@ -198,7 +198,7 @@ namespace CalamityMod.Projectiles.Ranged { if (improvedHeal) { - BloodstoneHealOrb.Heal(player, 8); + BloodstoneHealOrb.Heal(player, 6); } Projectile.Kill(); diff --git a/Projectiles/Ranged/BloodClotFriendly.cs b/Projectiles/Ranged/BloodClotFriendly.cs index a72db98d46..caf1e8b0b1 100644 --- a/Projectiles/Ranged/BloodClotFriendly.cs +++ b/Projectiles/Ranged/BloodClotFriendly.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/BloodfireArrowProj.cs b/Projectiles/Ranged/BloodfireArrowProj.cs index 4ccc6336d3..fa3534bfaa 100644 --- a/Projectiles/Ranged/BloodfireArrowProj.cs +++ b/Projectiles/Ranged/BloodfireArrowProj.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 9; Projectile.timeLeft = 1200; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() @@ -117,12 +116,6 @@ namespace CalamityMod.Projectiles.Ranged Player player = Main.player[Projectile.owner]; player.lifeRegenTime += 2; - if (player.moonLeech) - return; - - if (target.lifeMax <= 5) - return; - float lifeRatio = (float)player.statLife / player.statLifeMax2; float averageHealAmount = MathHelper.Lerp(4.0f, 0.5f, lifeRatio); // Average heal increases from 1/2 to 4 HP based on missing health int guaranteedHeal = (int)averageHealAmount; @@ -130,11 +123,7 @@ namespace CalamityMod.Projectiles.Ranged float chanceOfOneMoreHP = averageHealAmount - guaranteedHeal; bool bonusHeal = Main.rand.NextFloat() < chanceOfOneMoreHP; int finalHeal = guaranteedHeal + (bonusHeal ? 1 : 0); - if (finalHeal > BalancingConstants.LifeStealCap) - finalHeal = BalancingConstants.LifeStealCap; - - if (finalHeal > 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], finalHeal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + player.SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, finalHeal, 0.5f); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/BloodfireBulletProj.cs b/Projectiles/Ranged/BloodfireBulletProj.cs index 5fddf998a1..3f13d793b9 100644 --- a/Projectiles/Ranged/BloodfireBulletProj.cs +++ b/Projectiles/Ranged/BloodfireBulletProj.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 12; Projectile.timeLeft = Lifetime; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.tileCollide = false; } diff --git a/Projectiles/Ranged/BoltArrow.cs b/Projectiles/Ranged/BoltArrow.cs index 69ea77610f..7750c3a0b1 100644 --- a/Projectiles/Ranged/BoltArrow.cs +++ b/Projectiles/Ranged/BoltArrow.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 180; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Electrified, 60); diff --git a/Projectiles/Ranged/BouncingShotgunPellet.cs b/Projectiles/Ranged/BouncingShotgunPellet.cs index eb59268856..c912fea852 100644 --- a/Projectiles/Ranged/BouncingShotgunPellet.cs +++ b/Projectiles/Ranged/BouncingShotgunPellet.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Projectiles.Ranged { public new string LocalizationCategory => "Projectiles.Ranged"; public override string Texture => "CalamityMod/Projectiles/Ranged/RealmRavagerBullet"; - private int bounce = 2; + private int bounce = 3; public override void SetDefaults() { Projectile.width = 4; @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; Projectile.timeLeft = 180; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -29,14 +28,42 @@ namespace CalamityMod.Projectiles.Ranged bounce--; if (bounce <= 0) Projectile.Kill(); - else + + Player owner = Main.player[Projectile.owner]; + + if (bounce == 1) + { + float npcDistCheck = 640f; // 40 tiles + int index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, owner.ClampedMouseWorld()); + if (currentNPCDist < npcDistCheck) + { + npcDistCheck = currentNPCDist; + index = n.whoAmI; + } + } + // If the index is not default, smart bounce in the direction of that enemy. + if (index != -1) + { + Projectile.velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, Main.npc[index], owner.ActiveItem().shootSpeed, 3); + } + return false; + } + else // Otherwise, use standard bouncing behavior. { if (Projectile.velocity.X != oldVelocity.X) + { Projectile.velocity.X = -oldVelocity.X; + } if (Projectile.velocity.Y != oldVelocity.Y) + { Projectile.velocity.Y = -oldVelocity.Y; - SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); - Projectile.damage /= 2; + } } return false; } diff --git a/Projectiles/Ranged/BrimstoneBolt.cs b/Projectiles/Ranged/BrimstoneBolt.cs index 70666e710f..1ff6ff8ae1 100644 --- a/Projectiles/Ranged/BrimstoneBolt.cs +++ b/Projectiles/Ranged/BrimstoneBolt.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 3; Projectile.extraUpdates = 2; Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Ranged/BubonicRoundProj.cs b/Projectiles/Ranged/BubonicRoundProj.cs index d591810015..23a22b4d46 100644 --- a/Projectiles/Ranged/BubonicRoundProj.cs +++ b/Projectiles/Ranged/BubonicRoundProj.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/BuzzkillHoldout.cs b/Projectiles/Ranged/BuzzkillHoldout.cs index 04c8fdb96e..c10454ba39 100644 --- a/Projectiles/Ranged/BuzzkillHoldout.cs +++ b/Projectiles/Ranged/BuzzkillHoldout.cs @@ -82,13 +82,16 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle ShootSound = new("CalamityMod/Sounds/Item/SawShot", 2) { PitchVariance = 0.1f, Volume = 0.4f + SawPower * 0.5f }; SoundEngine.PlaySound(ShootSound, GunTipPosition); - float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. - int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower); int sawLevel = (SawPower >= 1f).ToInt() + (SawPower >= 0.25f).ToInt(); + if (Main.myPlayer == Projectile.owner) + { + float sawDamageMult = MathHelper.Lerp(1f, 5f, SawPower) / 1.5f; // The damage must be divided by 1.5 to offset the holdout having 1.5x base damage. + int sawPierce = (int)MathHelper.Lerp(2f, 6f, SawPower); - Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel); - buzzsaw.penetrate = sawPierce; - buzzsaw.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + Projectile buzzsaw = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * Owner.ActiveItem().shootSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * sawDamageMult), (int)(Projectile.knockBack * (sawDamageMult / 2)), Main.myPlayer, sawLevel); + buzzsaw.penetrate = sawPierce; + buzzsaw.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); + } NoSawOnHoldout = true; OffsetLengthFromArm -= 4f + 12f * SawPower; diff --git a/Projectiles/Ranged/BuzzkillSaw.cs b/Projectiles/Ranged/BuzzkillSaw.cs index a9d383fd87..4a736dbb47 100644 --- a/Projectiles/Ranged/BuzzkillSaw.cs +++ b/Projectiles/Ranged/BuzzkillSaw.cs @@ -39,7 +39,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; // Saw pierce is set when the saw is spawned, due to it being dynamic based on charge. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/CardHeart.cs b/Projectiles/Ranged/CardHeart.cs index 368d219ab7..0ce2fd9a85 100644 --- a/Projectiles/Ranged/CardHeart.cs +++ b/Projectiles/Ranged/CardHeart.cs @@ -59,17 +59,7 @@ namespace CalamityMod.Projectiles.Ranged } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.01), 0.4f); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 6f0cbfa965..a61c09f6b7 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 6; Projectile.timeLeft = 360; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() @@ -57,7 +56,7 @@ namespace CalamityMod.Projectiles.Ranged if (Svant) Projectile.ArmorPenetration = 200; if (Infinity) - Projectile.ArmorPenetration = 25; + Projectile.ArmorPenetration = 20; } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.timeLeft == 2) @@ -73,10 +72,9 @@ namespace CalamityMod.Projectiles.Ranged if (!outOfTime) { SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); - int projectiles = 2; if (Projectile.owner == Main.myPlayer) { - for (int k = 0; k < projectiles; k++) + for (int k = 0; k < 2; k++) Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, -baseVel.RotatedByRandom(0.9f) * Main.rand.NextFloat(0.6f, 0.7f), ModContent.ProjectileType(), (int)(Projectile.damage * (Projectile.ai[2] > 0 ? 0.3f : 0.5f)), Projectile.knockBack * 0.8f, Main.myPlayer, 0, 0, Projectile.ai[2]); } for (int k = 0; k < 3; k++) diff --git a/Projectiles/Ranged/ChargedBlastSplit.cs b/Projectiles/Ranged/ChargedBlastSplit.cs index 9251ff639d..93e16f4165 100644 --- a/Projectiles/Ranged/ChargedBlastSplit.cs +++ b/Projectiles/Ranged/ChargedBlastSplit.cs @@ -57,12 +57,12 @@ namespace CalamityMod.Projectiles.Ranged if (Infinity) { Projectile.timeLeft = 340; - Projectile.ArmorPenetration = 25; + Projectile.ArmorPenetration = 20; } if (Svant) { Projectile.timeLeft = 640; - Projectile.ArmorPenetration = 100; + Projectile.ArmorPenetration = 200; } direction = Main.rand.NextBool(); homeSpeed = Main.rand.NextFloat(5, 8); diff --git a/Projectiles/Ranged/CinderArrowProj.cs b/Projectiles/Ranged/CinderArrowProj.cs index aa7d906b6b..2dee125be4 100644 --- a/Projectiles/Ranged/CinderArrowProj.cs +++ b/Projectiles/Ranged/CinderArrowProj.cs @@ -34,7 +34,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 2; Projectile.timeLeft = 600; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Ranged/ClamorRifleProj.cs b/Projectiles/Ranged/ClamorRifleProj.cs index ce6bb0907b..0ce05c97c7 100644 --- a/Projectiles/Ranged/ClamorRifleProj.cs +++ b/Projectiles/Ranged/ClamorRifleProj.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/CondemnationArrow.cs b/Projectiles/Ranged/CondemnationArrow.cs index a3f208088d..617e839429 100644 --- a/Projectiles/Ranged/CondemnationArrow.cs +++ b/Projectiles/Ranged/CondemnationArrow.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.extraUpdates = 2; Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ContagionArrow.cs b/Projectiles/Ranged/ContagionArrow.cs index 067c7820e3..cb75277d92 100644 --- a/Projectiles/Ranged/ContagionArrow.cs +++ b/Projectiles/Ranged/ContagionArrow.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/CorrodedShell.cs b/Projectiles/Ranged/CorrodedShell.cs index d70b68fad7..bd470fb368 100644 --- a/Projectiles/Ranged/CorrodedShell.cs +++ b/Projectiles/Ranged/CorrodedShell.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/DWArrow.cs b/Projectiles/Ranged/DWArrow.cs index 74f4fb6f83..6160c3f44e 100644 --- a/Projectiles/Ranged/DWArrow.cs +++ b/Projectiles/Ranged/DWArrow.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 5; Projectile.timeLeft = 600; Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/DragonsBreathFlames.cs b/Projectiles/Ranged/DragonsBreathFlames.cs index d6a65bac8e..cec31f3c36 100644 --- a/Projectiles/Ranged/DragonsBreathFlames.cs +++ b/Projectiles/Ranged/DragonsBreathFlames.cs @@ -229,7 +229,18 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(ModContent.BuffType(), 240); } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + Player Owner = Main.player[Projectile.owner]; + if (Time <= 1) + { + float _ = float.NaN; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Owner.Center, Projectile.width, ref _); + } + else + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.ai[1] == 1 ? 4 : Projectile.width + Time * 0.1f, targetHitbox); + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Projectile.numHits > 0) diff --git a/Projectiles/Ranged/DryadsTearMain.cs b/Projectiles/Ranged/DryadsTearMain.cs index 81766cb87a..48d0f4c787 100644 --- a/Projectiles/Ranged/DryadsTearMain.cs +++ b/Projectiles/Ranged/DryadsTearMain.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 5; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ElysianArrowProj.cs b/Projectiles/Ranged/ElysianArrowProj.cs index 6cf4dfc842..c823175f28 100644 --- a/Projectiles/Ranged/ElysianArrowProj.cs +++ b/Projectiles/Ranged/ElysianArrowProj.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 1200; Projectile.extraUpdates = 2; Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ElysianArrowRain.cs b/Projectiles/Ranged/ElysianArrowRain.cs index 8e9eefa522..908bf2bfd7 100644 --- a/Projectiles/Ranged/ElysianArrowRain.cs +++ b/Projectiles/Ranged/ElysianArrowRain.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; int numPoints = 46; diff --git a/Projectiles/Ranged/ExoCrystalArrow.cs b/Projectiles/Ranged/ExoCrystalArrow.cs index e51f5150fe..fb03247967 100644 --- a/Projectiles/Ranged/ExoCrystalArrow.cs +++ b/Projectiles/Ranged/ExoCrystalArrow.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/FeatherLarge.cs b/Projectiles/Ranged/FeatherLarge.cs index db3737de73..c0e0124b8d 100644 --- a/Projectiles/Ranged/FeatherLarge.cs +++ b/Projectiles/Ranged/FeatherLarge.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/FirestormCannonHoldout.cs b/Projectiles/Ranged/FirestormCannonHoldout.cs new file mode 100644 index 0000000000..9b1b5d20bc --- /dev/null +++ b/Projectiles/Ranged/FirestormCannonHoldout.cs @@ -0,0 +1,164 @@ +using System; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class FirestormCannonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 16f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.35f; + + public static readonly SoundStyle WarningSound = new SoundStyle("CalamityMod/Sounds/Item/FireImplosion") with { Volume = 0.75f }; + public static readonly SoundStyle OverheatSound = new("CalamityMod/Sounds/Item/HeliumFlashSteamRelease"); + public SlotId WarningSlot; + public ref float Timer => ref Projectile.ai[0]; + private int BuiltHeat => (Owner.ActiveItem().ModItem as FirestormCannon).BuiltUpHeat; + private bool displayOverheat = false; + private const int WarningTime = FirestormCannon.OverheatLevel - 100; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + public override void KillHoldoutLogic() + { + // What kills the holdout: + // Dead, CCed, Cursed, etc. + // Not holding the item + // Right-clicking (Can kill it early) (Does not work if in overheat state) + // Completely cooling while not firing + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type || + (Owner.Calamity().mouseRight && !displayOverheat) || (BuiltHeat == 0 && !Main.mouseLeft)) + { + if (SoundEngine.TryGetActiveSound(WarningSlot, out var warn)) + warn.Stop(); + + Projectile.Kill(); + } + } + + public override void HoldoutAI() + { + // Timer should only increment while firing and not overheated + if (Main.mouseLeft && Owner.Calamity().flareGunOverheat == 0) + Timer++; + else + Timer = 0; + + // Once holding the fire button down long enough, start actually firing + if (Timer >= 30) + { + // For some reason using ActiveItem() here breaks its functionality while being held on the cursor + (Owner.HeldItem.ModItem as FirestormCannon).BuiltUpHeat++; + + // Overheat yourself if you fire too long + if (BuiltHeat >= FirestormCannon.OverheatLevel) + { + WarningSlot = SoundEngine.PlaySound(OverheatSound, Owner.Center); + for (int e = 0; e < 7; e++) + { + Vector2 dustVel = -Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.Pi * 0.15f) * Main.rand.NextFloat(3.8f, 5.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Flare, dustVel, Scale: 1.5f); + dust.noGravity = true; + } + + // Overheat damage ignores defense and is undodgeable, also inflicts On Fire + Owner.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FlareGunOverheat").ToNetworkText(Owner.name)), FirestormCannon.OverheatDamage, 1, dodgeable: false, scalingArmorPenetration: 1f, knockback: 0f); + Owner.AddBuff(BuffID.OnFire, FirestormCannon.OverheatCooldown); + Owner.Calamity().flareGunOverheat = FirestormCannon.OverheatCooldown; + displayOverheat = true; + return; + } + + // Play a warning sound + if (BuiltHeat == WarningTime) + { + WarningSlot = SoundEngine.PlaySound(WarningSound, Owner.Center); + } + + // Controls the escalating firing speed + float firingLerp = Utils.GetLerpValue(0, 90, Timer - 30, true); + int firingFrequency = (int)MathHelper.Lerp(HeldItem.useTime, HeldItem.useTime / 2, firingLerp); + // Actually fire shtuff + if (Timer % firingFrequency == 0) + { + SoundEngine.PlaySound(SoundID.Item11 with { Volume = 0.8f }, Owner.Center); + if (Main.myPlayer == Projectile.owner) + { + Owner.PickAmmo(HeldItem, out int flareType, out _, out _, out _, out _, Main.rand.Next(100) >= 70); + Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.Pi * 0.04f * (1f + firingLerp * 0.5f)) * Owner.ActiveItem().shootSpeed; + Projectile flare = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, velocity, flareType, Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f, 1f); + flare.penetrate = 3; + flare.MaxUpdates = 2; + flare.timeLeft = 600; + flare.DamageType = DamageClass.Ranged; + flare.usesIDStaticNPCImmunity = false; + flare.usesLocalNPCImmunity = true; + flare.localNPCHitCooldown = 30 * 2; + } + } + } + + // Reset overheat draw color once the heat passes below the warning indicator + if (BuiltHeat < WarningTime) + displayOverheat = false; + // Draw smoke effect while overheated + if (displayOverheat && Main.rand.NextBool(3)) + { + HeavySmokeParticle smoke = new(GunTipPosition, -Vector2.UnitY * 7.5f, Color.DarkGray, 25, 0.4f, 0.75f); + GeneralParticleHandler.SpawnParticle(smoke); + } + // Constantly move the warning sound on top of the player + if (SoundEngine.TryGetActiveSound(WarningSlot, out var warning) && warning.IsPlaying) + warning.Position = Projectile.Center; + } + + // Pan-searing mechanic; reduces heat a bit + public override bool? CanDamage() => BuiltHeat >= 120 && Owner.Calamity().flareGunOverheat == 0; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.OnFire, 300); + (Owner.HeldItem.ModItem as FirestormCannon).BuiltUpHeat -= 6; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Color tintColor = displayOverheat ? Color.Black : + BuiltHeat >= WarningTime ? Color.Lerp(Color.Tomato, Color.White, MathF.Abs(MathF.Sin(Owner.miscCounter * MathHelper.Pi / 30f))) : Color.Tomato; + + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(Utils.GetLerpValue(0, WarningTime, BuiltHeat, true) * 0.45f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(tintColor); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + return false; + } + } +} diff --git a/Projectiles/Ranged/FlareBat.cs b/Projectiles/Ranged/FlareBat.cs index eec96dfc86..70e03eed6a 100644 --- a/Projectiles/Ranged/FlareBat.cs +++ b/Projectiles/Ranged/FlareBat.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.25f; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/Flash.cs b/Projectiles/Ranged/Flash.cs index a5eb54f88e..861de2d98c 100644 --- a/Projectiles/Ranged/Flash.cs +++ b/Projectiles/Ranged/Flash.cs @@ -23,73 +23,21 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.timeLeft = 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() { Lighting.AddLight(Projectile.Center, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f, (255 - Projectile.alpha) * 0.5f / 255f); Color dustColor = Projectile.ai[1] == 1f ? CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f) : default; - bool xflag = false; - bool yflag = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - yflag = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - yflag = true; - } - if (xflag && yflag) - { - Projectile.Kill(); - } - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - { - projTimer -= (Projectile.ai[0] - 180f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rand1 = (float)Main.rand.Next(-30, 31); - float rand2 = (float)Main.rand.Next(-30, 31); - float rand3 = (float)Main.rand.Next(9, 27); - float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); - randAdjust = rand3 / randAdjust; - rand1 *= randAdjust; - rand2 *= randAdjust; - int flashDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.PortalBoltTrail, 0f, 0f, 100, dustColor, 2f); - Dust dust = Main.dust[flashDust]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rand1; - dust.velocity.Y = rand2; - timerCounter++; - } - } + float randRot = Main.rand.NextFloat(MathHelper.TwoPi); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Confused, 300); + for (int i = 0; i < 4; i++) + { + Vector2 dustVel = Vector2.UnitX.RotatedBy(MathHelper.PiOver2 * i + randRot) * 3f; + Dust flashDust = Dust.NewDustPerfect(Projectile.Center, DustID.PortalBoltTrail, dustVel, 100, dustColor, 1.5f); + flashDust.noGravity = true; + } } } } diff --git a/Projectiles/Ranged/FlashRoundProj.cs b/Projectiles/Ranged/FlashRoundProj.cs index 097af310b5..bab429e622 100644 --- a/Projectiles/Ranged/FlashRoundProj.cs +++ b/Projectiles/Ranged/FlashRoundProj.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = -1; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/FlurrystormIceChunk.cs b/Projectiles/Ranged/FlurrystormIceChunk.cs index 33f031585d..39b2db16d6 100644 --- a/Projectiles/Ranged/FlurrystormIceChunk.cs +++ b/Projectiles/Ranged/FlurrystormIceChunk.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.coldDamage = true; Projectile.penetrate = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/FossilShard.cs b/Projectiles/Ranged/FossilShard.cs index 04c56abf8c..03a853f3db 100644 --- a/Projectiles/Ranged/FossilShard.cs +++ b/Projectiles/Ranged/FossilShard.cs @@ -23,11 +23,10 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.ai[1] != 1f) { - if (Projectile.velocity.Y <= 0f) - Projectile.velocity.Y = 0.1f; - Projectile.velocity.Y *= 1.05f; + if (Projectile.velocity.Y <= -2f) + Projectile.velocity.Y = -2f; } - + Projectile.velocity.Y += 0.025f; Projectile.rotation += Projectile.velocity.Y; } diff --git a/Projectiles/Ranged/FungiOrb.cs b/Projectiles/Ranged/FungiOrb.cs index b0917fb7a7..08be24b2b6 100644 --- a/Projectiles/Ranged/FungiOrb.cs +++ b/Projectiles/Ranged/FungiOrb.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/GodSlayerSlugProj.cs b/Projectiles/Ranged/GodSlayerSlugProj.cs index 5f40a1c0fc..42e5f8155c 100644 --- a/Projectiles/Ranged/GodSlayerSlugProj.cs +++ b/Projectiles/Ranged/GodSlayerSlugProj.cs @@ -50,7 +50,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.timeLeft = Lifetime; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void SendExtraAI(BinaryWriter writer) => writer.Write(Projectile.tileCollide); @@ -99,10 +98,9 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ai[1] = BlueNoCollideFrames; Projectile.tileCollide = false; - // Reduce damage, but remove piercing. Reset local iframes so the bullet, turned blue, may always strike again. Reset the point blank timer. - Projectile.damage = (int)(0.23f * Projectile.damage); + // Reduce damage, but remove piercing. Reset local iframes so the bullet, turned blue, may always strike again. + Projectile.damage = (int)(0.25f * Projectile.damage); Projectile.penetrate = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; diff --git a/Projectiles/Ranged/HailstormBulletProj.cs b/Projectiles/Ranged/HailstormBulletProj.cs index 17620c79fa..72f591fa25 100644 --- a/Projectiles/Ranged/HailstormBulletProj.cs +++ b/Projectiles/Ranged/HailstormBulletProj.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.coldDamage = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/HalleysComet.cs b/Projectiles/Ranged/HalleysComet.cs index be4ba1de28..1bed54d8eb 100644 --- a/Projectiles/Ranged/HalleysComet.cs +++ b/Projectiles/Ranged/HalleysComet.cs @@ -77,7 +77,10 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 450); + //Doze - I gave this long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + //Both Elf Melter and Flamethrower in vanilla do 20 seconds of their debuff. This is done to match. + target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20)); SoundEngine.PlaySound(HalleysInferno.Hit, Projectile.Center); // Dust emission on hit diff --git a/Projectiles/Ranged/HallowPointRoundProj.cs b/Projectiles/Ranged/HallowPointRoundProj.cs index 8d8ec76fec..02da6911c5 100644 --- a/Projectiles/Ranged/HallowPointRoundProj.cs +++ b/Projectiles/Ranged/HallowPointRoundProj.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Ranged // Invisible for the first few frames Projectile.alpha = 255; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/HellbornProj.cs b/Projectiles/Ranged/HellbornProj.cs index 132e147bf5..ff222b2b20 100644 --- a/Projectiles/Ranged/HellbornProj.cs +++ b/Projectiles/Ranged/HellbornProj.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 2; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; } diff --git a/Projectiles/Ranged/HighExplosivePeanutShell.cs b/Projectiles/Ranged/HighExplosivePeanutShell.cs deleted file mode 100644 index cefe2998ce..0000000000 --- a/Projectiles/Ranged/HighExplosivePeanutShell.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class HighExplosivePeanutShell : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - private const int Lifetime = 180; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 9; - ProjectileID.Sets.TrailingMode[Type] = 1; - } - - public override void SetDefaults() - { - Projectile.width = 16; - Projectile.height = 16; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.extraUpdates = 4; - Projectile.timeLeft = Lifetime; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.spriteDirection = 1; - - // Lighting - Lighting.AddLight(Projectile.Center, 0.75f, 0.65f, 0.08f); - - // Dirty dust, done dirt cheap - { - int dustID = 7; // wood flakes - float scale = Main.rand.NextFloat(1f, 1.4f); - Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, dustID); - d.noGravity = true; - d.scale = scale; - - // Dust velocity is a complicated flaking function taken from Holy Fire Bullets - d.velocity *= 0.2f; - float angleDeviation = 0.17f; - float angle = Main.rand.NextFloat(-angleDeviation, angleDeviation); - Vector2 sprayVelocity = Projectile.velocity.RotatedBy(angle) * 0.6f; - d.velocity += sprayVelocity; - } - } - - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override void OnKill(int timeLeft) - { - // Grenade Launcher + Lunar Flare sounds for maximum meaty explosion - SoundEngine.PlaySound(SoundID.Item62, Projectile.Center); - SoundEngine.PlaySound(SoundID.Item88, Projectile.Center); - - // Massively inflate the projectile's hitbox - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 140; - Projectile.position.X = Projectile.position.X - Projectile.width / 2; - Projectile.position.Y = Projectile.position.Y - Projectile.height / 2; - - // Allow infinite piercing and ignoring iframes for this one extra hit - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - - // Rocket III type explosion is now a utility for convenience - Projectile.LargeFieryExplosion(); - - // Deal damage again. The explosion deals half the damage of the direct hit. - Projectile.damage /= 2; - Projectile.Damage(); - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); - return true; // the projectile does indeed die on collision - } - } -} diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs index cbf2793e2f..37091f5516 100644 --- a/Projectiles/Ranged/HiveNuke.cs +++ b/Projectiles/Ranged/HiveNuke.cs @@ -182,7 +182,7 @@ namespace CalamityMod.Projectiles.Ranged { if (Main.zenithWorld) { - SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 12); + SoundStyle bees = new("CalamityMod/Sounds/Custom/BEES/bees", 13); SoundEngine.PlaySound(bees with { Volume = 1.5f }, Projectile.Center); SoundStyle fire = new("CalamityMod/Sounds/Item/TheHiveNuke"); SoundEngine.PlaySound(fire with { Volume = 0.35f }, Projectile.Center); diff --git a/Projectiles/Ranged/HolyFireBulletProj.cs b/Projectiles/Ranged/HolyFireBulletProj.cs index 3c3fdd2a79..f0ecc0e263 100644 --- a/Projectiles/Ranged/HolyFireBulletProj.cs +++ b/Projectiles/Ranged/HolyFireBulletProj.cs @@ -35,7 +35,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 7; Projectile.timeLeft = 600; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Ranged/HydraHead.cs b/Projectiles/Ranged/HydraHead.cs index f6439a1330..f40a49a417 100644 --- a/Projectiles/Ranged/HydraHead.cs +++ b/Projectiles/Ranged/HydraHead.cs @@ -147,7 +147,7 @@ namespace CalamityMod.Projectiles.Ranged //Calculation for damage and co Owner.PickAmmo(heldItem, out _, out float itemVelocity, out int itemDamage, out float itemKB, out _); int type = ModContent.ProjectileType(); - for (int i = 0; i < 3; i++) + for (int i = 0; i < Hydra.BulletsPerShot - 1; i++) { Vector2 spreadDirection = shootDirection.RotatedByRandom(MathHelper.ToRadians(Hydra.ShotSpread / 2f)); float spreadVelocity = itemVelocity * Main.rand.NextFloat(1f, 1.4f); diff --git a/Projectiles/Ranged/HydraHeadLaunch.cs b/Projectiles/Ranged/HydraHeadLaunch.cs index db6d8fc4aa..48edcc98f4 100644 --- a/Projectiles/Ranged/HydraHeadLaunch.cs +++ b/Projectiles/Ranged/HydraHeadLaunch.cs @@ -22,7 +22,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } //Normal hitbox size for explosion, rotated otherwise diff --git a/Projectiles/Ranged/HydrasBlood.cs b/Projectiles/Ranged/HydrasBlood.cs index ee78b8b6ae..c768f79f5d 100644 --- a/Projectiles/Ranged/HydrasBlood.cs +++ b/Projectiles/Ranged/HydrasBlood.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 5; Projectile.penetrate = 1; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox); diff --git a/Projectiles/Ranged/HyperiusBulletProj.cs b/Projectiles/Ranged/HyperiusBulletProj.cs index 777dee25c5..0b08d01060 100644 --- a/Projectiles/Ranged/HyperiusBulletProj.cs +++ b/Projectiles/Ranged/HyperiusBulletProj.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; AIType = ProjectileID.Bullet; Projectile.ignoreWater = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Ranged/IcicleArrowProj.cs b/Projectiles/Ranged/IcicleArrowProj.cs index 85a3f2a673..bb2953d0f9 100644 --- a/Projectiles/Ranged/IcicleArrowProj.cs +++ b/Projectiles/Ranged/IcicleArrowProj.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 1000; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ImpactRound.cs b/Projectiles/Ranged/ImpactRound.cs index 9dae2a8086..bd6a72442c 100644 --- a/Projectiles/Ranged/ImpactRound.cs +++ b/Projectiles/Ranged/ImpactRound.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/LeafArrow.cs b/Projectiles/Ranged/LeafArrow.cs index e5fb34f26e..800f0c3249 100644 --- a/Projectiles/Ranged/LeafArrow.cs +++ b/Projectiles/Ranged/LeafArrow.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/LunarBolt.cs b/Projectiles/Ranged/LunarBolt.cs index b7fa456499..b5883c7d61 100644 --- a/Projectiles/Ranged/LunarBolt.cs +++ b/Projectiles/Ranged/LunarBolt.cs @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.timeLeft = 180; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/M1GarandBulletCasing.cs b/Projectiles/Ranged/M1GarandBulletCasing.cs new file mode 100644 index 0000000000..50acf6549c --- /dev/null +++ b/Projectiles/Ranged/M1GarandBulletCasing.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class M1GarandBulletCasing : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Projectiles/Ranged/M1GarandBulletCasing"; + public int Time = 0; + public bool TouchedGrass = false; + + public override void SetDefaults() + { + Projectile.width = 6; + Projectile.height = 12; + Projectile.friendly = true; + Projectile.ignoreWater = false; + Projectile.DamageType = DamageClass.Ranged; + Projectile.penetrate = -1; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + public override void AI() + { + Projectile.scale = 1f; + Projectile.extraUpdates = 1; + Time++; + Player Owner = Main.player[Projectile.owner]; + if (!TouchedGrass) + { + if (Projectile.timeLeft <= 240) + Projectile.rotation += 0.04f * Projectile.direction; + else + Projectile.rotation = (new Vector2(0, -5 * Projectile.direction) + Projectile.velocity * -1.2f).ToRotation(); + + Projectile.velocity.Y += 0.087f; + Projectile.velocity.X *= 0.99f; + + if (Main.rand.NextBool(3)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity, 303, -Projectile.velocity.RotatedByRandom(0.1f) * Main.rand.NextFloat(0.2f, 1f), 140, default, Main.rand.NextFloat(0.35f, 0.5f)); + dust.noGravity = false; + dust.color = Color.White; + } + } + else + { + Projectile.velocity = Vector2.Zero; + } + Projectile.alpha = (int)(255 * Utils.GetLerpValue(60, 0, Projectile.timeLeft, true)); + if (Collision.SolidCollision(Projectile.Center - Projectile.velocity * 1.5f, 2, 2)) + Projectile.tileCollide = true; + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.damage = 0; + TouchedGrass = true; + Projectile.velocity = Vector2.Zero; + return false; + } + } +} diff --git a/Projectiles/Ranged/M1GarandBulletCasing.png b/Projectiles/Ranged/M1GarandBulletCasing.png new file mode 100644 index 0000000000..2e3aeeab4f Binary files /dev/null and b/Projectiles/Ranged/M1GarandBulletCasing.png differ diff --git a/Projectiles/Ranged/M1GarandEmptyClip.cs b/Projectiles/Ranged/M1GarandEmptyClip.cs new file mode 100644 index 0000000000..e04b8068b6 --- /dev/null +++ b/Projectiles/Ranged/M1GarandEmptyClip.cs @@ -0,0 +1,146 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class M1GarandEmptyClip : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + internal static readonly SoundStyle BlingSound = new("CalamityMod/Sounds/Custom/Ultrabling") { PitchVariance = 0.5f }; + internal static readonly SoundStyle BlingHitSound = new("CalamityMod/Sounds/Custom/UltrablingHit") { PitchVariance = 0.5f }; + private static Asset sheenAsset; + private static Asset bloomAsset; + + public static float UsedCoinGrabRangeMultiplier = 5f; + public static float ClipTossForce = 7.33f; + + public static float MaxIntraClipRicoshotDistance = 1000f; + + public static readonly float RicoshotSearchDistance = 2000f; + + public static float SuperpredictionRatio = 0.1f; + + public static float ClipBonus = 2.5f; + public static float ClipMulticlipBonus = 0.9f; // lmar + + internal static readonly int UpdateCount = 4; + internal static readonly int ClipLifetime = UpdateCount * CalamityUtils.SecondsToFrames(7); + + // Clips fade out for the last 30 frames of their existence. + private static readonly int FadeoutTime = UpdateCount * 30; + private static readonly float ForceFadeDistance = 2000f; + public static int CritDelayFrames = 22; + internal static int CritDelayTime => UpdateCount * CritDelayFrames; + internal ref float ShotFreezeTimer => ref Projectile.ai[1]; + internal static int RicochetPause = UpdateCount * 22; + public bool HasBeenShot => Projectile.localAI[0] > 0f; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 60; + ProjectileID.Sets.TrailingMode[Type] = 0; + Main.projFrames[Type] = 1; + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } + + public override void SetDefaults() + { + Projectile.width = 12; + Projectile.height = 14; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.MaxUpdates = UpdateCount; + Projectile.timeLeft = ClipLifetime; + // Draws very small otherwise + Projectile.scale = 1.5f; + } + + public override bool? CanDamage() => false; + + public override bool ShouldUpdatePosition() => ShotFreezeTimer <= 0; + + public override void AI() + { + if (ShotFreezeTimer > 0f) + { + --ShotFreezeTimer; + if (ShotFreezeTimer <= 0) + { + Projectile.Kill(); + return; + } + } + + Lighting.AddLight(Projectile.Center, Color.LightGray.ToVector3() * 0.2f); + + if (Main.rand.NextBool(10)) + { + Dust d = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke); + d.noGravity = true; + } + + Projectile.rotation = Projectile.velocity.X * 0.5f; + + if (Projectile.FinalExtraUpdate()) + { + float clipGravity = Player.defaultGravity / Projectile.MaxUpdates; + Projectile.velocity.Y += clipGravity / 1.75f; + } + + if (Projectile.timeLeft > FadeoutTime && Projectile.Center.Distance(Owner.MountedCenter) > ForceFadeDistance) + Projectile.timeLeft = FadeoutTime; + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + return base.OnTileCollide(oldVelocity); + } + // Pretty much all from ricoshot coins from here. + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, 1); + float fadingOpacity = Math.Clamp(Projectile.timeLeft / (float)FadeoutTime, 0f, 1f); + Color alphaColor = Projectile.GetAlpha(lightColor) * fadingOpacity; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, alphaColor, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + + int numUpdatesPassed = ClipLifetime - Projectile.timeLeft; + float x = Math.Clamp((float)numUpdatesPassed / CritDelayTime, 0f, 2f); + float sheenFunction = Math.Min(MathF.Pow(x + 0.1f, 10f), MathF.Pow(x - 2.1f, 10f)); + float sheenOpacity = Math.Clamp(sheenFunction, 0f, 2f); + + if (sheenOpacity > 0f) + { + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + + sheenAsset ??= ModContent.Request("CalamityMod/Particles/HalfStar"); + Texture2D shineTex = sheenAsset.Value; + + bloomAsset ??= ModContent.Request("CalamityMod/Particles/BloomCircle"); + Texture2D bloomTex = bloomAsset.Value; + + Vector2 shineScale = new Vector2(1f, 3f - sheenOpacity * 2f); + Color shineColor = Color.LightGray; + + Main.EntitySpriteDraw(bloomTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity * 0.3f, MathHelper.PiOver2, bloomTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(shineTex, Projectile.Center - Main.screenPosition, null, shineColor * sheenOpacity, MathHelper.PiOver2, shineTex.Size() / 2f, shineScale * Projectile.scale, SpriteEffects.None, 0); + + Main.spriteBatch.End(); + Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); + } + + return false; + } + } +} diff --git a/Projectiles/Ranged/M1GarandEmptyClip.png b/Projectiles/Ranged/M1GarandEmptyClip.png new file mode 100644 index 0000000000..c08f6def56 Binary files /dev/null and b/Projectiles/Ranged/M1GarandEmptyClip.png differ diff --git a/Projectiles/Ranged/M1GarandHoldout.cs b/Projectiles/Ranged/M1GarandHoldout.cs new file mode 100644 index 0000000000..6beff9770c --- /dev/null +++ b/Projectiles/Ranged/M1GarandHoldout.cs @@ -0,0 +1,357 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.ModLoader; +using System; + +namespace CalamityMod.Projectiles.Ranged +{ + public class M1GarandHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + + public ref float CurrentState => ref Projectile.ai[0]; + public ref float Timer => ref Projectile.ai[1]; + + private float muzzleFlashTimer; + private float flashVariant; + + private int pingAnimationTimer = 0; + private const int PingAnimationDuration = 120; + private bool shouldPing = false; + + public override float RecoilResolveSpeed => 0.13f; + public override float MaxOffsetLengthFromArm => 28f; + public override float BaseOffsetY => -4f; + public override float OffsetXUpwards => -6f; + public override float OffsetXDownwards => 0f; + public override float OffsetYUpwards => 0f; + public override float OffsetYDownwards => 0f; + + public override Vector2 GunTipPosition => (Projectile.Center + new Vector2(1.5f, -2.5f)) + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.425f; + public override string Texture => "CalamityMod/Projectiles/Ranged/M1GarandHoldout"; + + // Muzzle flash textures + public static Asset MuzzleFlash; + public static Asset GlowTexture; + + public static readonly SoundStyle FireSound = new("CalamityMod/Sounds/Item/WulfrumBlunderbussFire") { PitchVariance = 0.1f }; + public static readonly SoundStyle PingSound = new("CalamityMod/Sounds/Item/M1GarandPing"); + public static readonly SoundStyle ReloadSound = new("CalamityMod/Sounds/Item/M1GarandReload"); + + public override void Load() + { + MuzzleFlash = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandMuzzleFlash", AssetRequestMode.ImmediateLoad); + GlowTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandHoldoutGlow", AssetRequestMode.ImmediateLoad); + } + + public override void SetStaticDefaults() => Main.projFrames[Type] = 6; + + public override void KillHoldoutLogic() + { + // Only allow the projectile to kill if we're not reloading + if (CurrentState == 0 && HeldItem.type != Owner.ActiveItem().type) + { + Projectile.Kill(); + Projectile.netUpdate = true; + } + } + + public override void HoldoutAI() + { + // Decrements the timer which controls the duration of the flash + if (muzzleFlashTimer > 0f) + muzzleFlashTimer -= 1f; + + switch (CurrentState) + { + // Normal Firing State + case 0: + // Time between firing (as the player continues to hold) + if (Projectile.frame == 5) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= MathHelper.Clamp(Owner.ActiveItem().useAnimation - 18, 0f, Owner.ActiveItem().useAnimation)) + { + if (Owner.CantUseHoldout()) + Projectile.Kill(); + + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + } + // Begin firing + else if (Projectile.frame == 0) + { + if (Projectile.frameCounter != 1) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + return; + } + + Projectile.frameCounter++; + + // Check if the player has any shots left + if (Owner.Calamity().garandShots > 0) + { + // -- Firing Logic & FX -- + muzzleFlashTimer = 2f; + flashVariant = Main.rand.Next(3); + SoundEngine.PlaySound(FireSound, GunTipPosition); + + if (Owner.Calamity().garandShots == 1) + { + SoundEngine.PlaySound(PingSound, GunTipPosition); + shouldPing = true; + } + + OffsetLengthFromArm -= 3f; + + // Consume a shot + Owner.Calamity().garandShots--; + + Vector2 velocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * HeldItem.shootSpeed; + + // Eject bullet casing + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity.RotatedBy(Main.rand.NextFloat(2.5f, 2.65f) * -Projectile.direction) * 0.5f, ModContent.ProjectileType(), 0, 0, Projectile.owner); + + if (Owner.Calamity().garandShots == 0) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity.RotatedBy(Main.rand.NextFloat(1.175f, 1.25f) * -Projectile.direction) * 0.285f, ModContent.ProjectileType(), 0, 0, Projectile.owner); + + GenericSparkle sparker = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.PaleGoldenrod, Color.Gold * 0.25f, 1.25f, 5, Projectile.velocity.ToRotation() + Main.rand.NextFloat(-0.15f, 0.15f), 1f); + GeneralParticleHandler.SpawnParticle(sparker); + } + + // Direct smoke + for (int i = 0; i < 8; i++) + { + Particle smoke = new HeavySmokeParticle(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 7f * Main.rand.NextFloat(0.4f, 1.5f), Color.Gray, Main.rand.Next(30, 50), Main.rand.NextFloat(0.22f, 0.44f), 0.35f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + } + + // "Smoke" ring + Particle shootPulse = new DirectionalPulseRing(GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 4f, Color.Gray * 0.5f, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.1f, 0.475f, 18); + GeneralParticleHandler.SpawnParticle(shootPulse); + + // Shot starts from slightly behind the tip + Vector2 offsetPos = GunTipPosition - Projectile.velocity.SafeNormalize(Vector2.UnitY) * 18f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), offsetPos, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + else + { + OffsetLengthFromArm -= 1f; + CurrentState = 1; // Change state to reloading + Timer = 120; + } + } + // The firing animation + else if (Projectile.frame > 0) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + + } + } + break; + + // Reloading + case 1: + + Timer--; + + // Keep the player from switching weapons + Owner.channel = true; + + // The gun points slightly downwards during the first part + if (Timer <= 120 && Timer > 75) + { + Projectile.rotation += 0.15f * Projectile.spriteDirection; + } + // Lerp back to the normal pos + else if (Timer < 75 && Timer >= 64) + { + float progress = (75f - Timer) / (75f - 64f); + float lerpedOffset = MathHelper.Lerp(0.15f, 0f, progress); + Projectile.rotation += lerpedOffset * Projectile.spriteDirection; + } + else if (Timer == 39) + { + OffsetLengthFromArm -= 2f; + } + + // Hold frame 3 until this point + if (Timer > 40) + { + Projectile.frame = 3; + Projectile.frameCounter = 0; + } + + else if (Projectile.frame < Main.projFrames[Type] - 1) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= 3) + { + Projectile.frame++; + Projectile.frameCounter = 0; + } + } + + else + { + // Hold + Projectile.frame = Main.projFrames[Type] - 1; + } + + if (Timer == 110) + { + SoundEngine.PlaySound(ReloadSound, Projectile.Center); + } + + // Reload and cull the projectile + if (Timer <= 0) + { + Owner.Calamity().garandShots += 8; + Projectile.Kill(); + Projectile.netUpdate = true; + } + + break; + } + } + + // Can damage when firing. + public override bool? CanDamage() => muzzleFlashTimer > 0f; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.5f, 64f, targetHitbox); + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Math.Clamp(Projectile.frame, 0, Main.projFrames[Type] - 1)); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + float scale = Projectile.scale * Owner.gravDir; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), drawRotation, frame.Size() * 0.5f, scale, flipSprite); + + // Flash + if (muzzleFlashTimer > 0f) + { + Texture2D flashTex = MuzzleFlash.Value; + int flashFrameY = (int)flashVariant; + Vector2 flashPos = GunTipPosition + Vector2.UnitX.RotatedBy(Projectile.rotation) * MuzzleFlash.Width() * 0.5f - Main.screenPosition; + Rectangle flashFrame = flashTex.Frame(verticalFrames: 3, frameY: flashFrameY); + Main.EntitySpriteDraw(flashTex, flashPos, flashFrame, Color.White, drawRotation, flashFrame.Size() * 0.5f, scale * 0.8f, flipSprite); + } + + // PING! + if (shouldPing) + { + pingAnimationTimer++; + + if (pingAnimationTimer <= PingAnimationDuration) + { + Texture2D pingTexture = ModContent.Request("CalamityMod/Projectiles/Ranged/M1GarandPingText").Value; + Vector2 origin = pingTexture.Size() * 0.5f; + Vector2 pingDrawPosition; + + Vector2 finalPosition = Owner.Center + new Vector2(40f * -Owner.direction, -40f); + float progress = (float)pingAnimationTimer / PingAnimationDuration; + + if (pingAnimationTimer < 15) + { + float popOutProgress = (float)pingAnimationTimer / 15; + pingDrawPosition = Vector2.Lerp(Owner.Center, finalPosition, popOutProgress); + } + else + { + pingDrawPosition = finalPosition; + } + + pingDrawPosition -= Main.screenPosition; + + float stretchFactorY = 0f; + + if (progress < 0.25f) // Stretch Up + { + float stretchProgress = progress / 0.25f; + stretchFactorY = MathHelper.Lerp(-1.4f, 0.5f, (float)Math.Sin(stretchProgress * MathHelper.PiOver2)); + } + else if (progress < 0.5f) // Squash Down and overadjust + { + float squashProgress = (progress - 0.25f) / 0.3f; + stretchFactorY = MathHelper.Lerp(0.5f, -0.25f, squashProgress * squashProgress); + } + else if (progress < 0.8f) // Stretch up again at a slower pace to a bit above the normal scale + { + float stretchProgress = (progress - 0.6f) / 0.2f; + stretchFactorY = MathHelper.Lerp(-0.25f, 0f, stretchProgress * stretchProgress); + } + else // Return to normal + { + stretchFactorY = 0f; + } + + // Draw without any additions + Color drawColor = Color.White; + int fadeDuration = 30; + int fadeStartFrame = PingAnimationDuration - fadeDuration; + + // Fade out over 30 frames + if (pingAnimationTimer >= fadeStartFrame) + { + float fadeProgress = (float)(pingAnimationTimer - fadeStartFrame) / fadeDuration; + drawColor = Color.White * MathHelper.Lerp(1f, 0f, fadeProgress); + } + + float basePingDrawScale = 1f; + float stretchScaleY = 1f + stretchFactorY; + float stretchScaleX = 1f - (stretchFactorY * 0.5f); + + // Calculate scale to display with all factors combined + Vector2 finalPingScale = new Vector2(basePingDrawScale * stretchScaleX, basePingDrawScale * stretchScaleY); + Main.EntitySpriteDraw(pingTexture, pingDrawPosition, null, drawColor, Owner.direction == 1 ? -0.25f : 0.25f, origin, finalPingScale, SpriteEffects.None, 0f); + } + else + { + // Reset the flag and timer once the animation is complete. + shouldPing = false; + pingAnimationTimer = 0; + } + } + + return false; + } + + // Glowmask. + public override void PostDraw(Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(verticalFrames: Main.projFrames[Type], frameY: Math.Clamp(Projectile.frame, 0, Main.projFrames[Type] - 1)); + Texture2D glowTexture = GlowTexture.Value; + + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 origin = frame.Size() * 0.5f; + float scale = Projectile.scale * Owner.gravDir; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(glowTexture, drawPosition, frame, Color.White, drawRotation, origin, scale, flipSprite); + } + } +} diff --git a/Projectiles/Ranged/M1GarandHoldout.png b/Projectiles/Ranged/M1GarandHoldout.png new file mode 100644 index 0000000000..59767b1acd Binary files /dev/null and b/Projectiles/Ranged/M1GarandHoldout.png differ diff --git a/Projectiles/Ranged/M1GarandHoldoutGlow.png b/Projectiles/Ranged/M1GarandHoldoutGlow.png new file mode 100644 index 0000000000..fff673165b Binary files /dev/null and b/Projectiles/Ranged/M1GarandHoldoutGlow.png differ diff --git a/Projectiles/Ranged/M1GarandMuzzleFlash.png b/Projectiles/Ranged/M1GarandMuzzleFlash.png new file mode 100644 index 0000000000..30764d9ece Binary files /dev/null and b/Projectiles/Ranged/M1GarandMuzzleFlash.png differ diff --git a/Projectiles/Ranged/M1GarandPingText.png b/Projectiles/Ranged/M1GarandPingText.png new file mode 100644 index 0000000000..2d49dc5f35 Binary files /dev/null and b/Projectiles/Ranged/M1GarandPingText.png differ diff --git a/Projectiles/Ranged/MagnaShot.cs b/Projectiles/Ranged/MagnaShot.cs index 874aa255a4..4538ed3922 100644 --- a/Projectiles/Ranged/MagnaShot.cs +++ b/Projectiles/Ranged/MagnaShot.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; diff --git a/Projectiles/Ranged/MarksmanShot.cs b/Projectiles/Ranged/MarksmanShot.cs index f0ed4e0c90..38ff47a336 100644 --- a/Projectiles/Ranged/MarksmanShot.cs +++ b/Projectiles/Ranged/MarksmanShot.cs @@ -110,18 +110,25 @@ namespace CalamityMod.Projectiles.Ranged { // Assemble an array of the remaining coins. Projectile[] otherCoins = validCoins.Where((proj) => proj.whoAmI != struckCoin.whoAmI).ToArray(); - + RicoshotTarget nextCoin = Projectile.FindRicochetTarget(Projectile.Center, otherCoins, true); + RicochetOffCoin(nextCoin, struckCoin); // Ricochet off of this coin to the next target. // This coin (and potential further coins) may have already been recursively frozen. // As long as those coins have not yet been struck, they are valid targets. - RicoshotTarget nextTarget = Projectile.FindRicochetTarget(Projectile.Center, otherCoins, true); - RicochetOffCoin(nextTarget, struckCoin); - - // If the next target is another coin, freeze it to (almost) guarantee it will be hit. - if (nextTarget.type == RicoshotTargetType.Coin) + // If the next target is another coin/clip, freeze it. + if (nextCoin.type == RicoshotTargetType.Coin) { - Projectile nextCoin = Main.projectile[nextTarget.entityID]; - nextCoin.ai[1] = RicoshotCoin.RicochetPause; + Projectile nextCoinProj = Main.projectile[nextCoin.entityID]; + + // Use the correct RicochetPause value based on the projectile type + if (nextCoinProj.type == ModContent.ProjectileType()) + { + nextCoinProj.ai[1] = M1GarandEmptyClip.RicochetPause; + } + else + { + nextCoinProj.ai[1] = RicoshotCoin.RicochetPause; + } } } } @@ -142,18 +149,42 @@ namespace CalamityMod.Projectiles.Ranged if (NumRicochets == 0 && CalamityUtils.CanRicoshotCoinForceCrit(struckCoin)) cgp.forcedCrit = true; - // Apply bonus damage to the projectile. This is an additive multiplier between multiple coins. - float bonusDamageRatio = struckCoin.ai[0] switch + // Apply bonus damage to the projectile based on the projectile type. This is an additive multiplier between multiple coins/clips. + float bonusDamageRatio = 0f; + if (struckCoin.type == ModContent.ProjectileType()) { - 1f => NumRicochets > 0 ? RicoshotCoin.SilverMulticoinBonus : RicoshotCoin.SilverBonus, - 2f => NumRicochets > 0 ? RicoshotCoin.GoldMulticoinBonus : RicoshotCoin.GoldBonus, - _ => NumRicochets > 0 ? RicoshotCoin.CopperMulticoinBonus : RicoshotCoin.CopperBonus, - }; + bonusDamageRatio = struckCoin.ai[0] switch + { + 1f => NumRicochets > 0 ? RicoshotCoin.SilverMulticoinBonus : RicoshotCoin.SilverBonus, + 2f => NumRicochets > 0 ? RicoshotCoin.GoldMulticoinBonus : RicoshotCoin.GoldBonus, + _ => NumRicochets > 0 ? RicoshotCoin.CopperMulticoinBonus : RicoshotCoin.CopperBonus, + }; + } + else if (struckCoin.type == ModContent.ProjectileType()) + { + bonusDamageRatio = NumRicochets > 0 ? M1GarandEmptyClip.ClipMulticlipBonus : M1GarandEmptyClip.ClipBonus; + } + cgp.totalRicoshotDamageBonus += bonusDamageRatio; // Increment the ricochet count, relegating further coins to only give the multicoin bonus damage. NumRicochets++; + // If the target was valid, freeze the shot in place for a brief moment. + if (target.IsValid) + { + if (struckCoin.type == ModContent.ProjectileType()) + { + RicochetFreezeTimer = M1GarandEmptyClip.RicochetPause; + } + else + { + RicochetFreezeTimer = RicoshotCoin.RicochetPause; + } + } + + SoundEngine.PlaySound(RicoshotCoin.BlingHitSound, struckCoin.Center); + // If the target was valid, freeze the shot in place for a brief moment. if (target.IsValid) RicochetFreezeTimer = RicochetPause; diff --git a/Projectiles/Ranged/MegalodonShot.cs b/Projectiles/Ranged/MegalodonShot.cs index 9ecee22bea..08d42679d7 100644 --- a/Projectiles/Ranged/MegalodonShot.cs +++ b/Projectiles/Ranged/MegalodonShot.cs @@ -25,7 +25,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/MiniSharkron.cs b/Projectiles/Ranged/MiniSharkron.cs index 6f357a690c..07831fa91b 100644 --- a/Projectiles/Ranged/MiniSharkron.cs +++ b/Projectiles/Ranged/MiniSharkron.cs @@ -20,9 +20,9 @@ namespace CalamityMod.Projectiles.Ranged AIType = ProjectileID.MiniSharkron; Projectile.friendly = true; Projectile.alpha = 255; + Projectile.arrow = true; Projectile.ignoreWater = true; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/MistArrow.cs b/Projectiles/Ranged/MistArrow.cs index 60782c2b63..30bacffc92 100644 --- a/Projectiles/Ranged/MistArrow.cs +++ b/Projectiles/Ranged/MistArrow.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged AIType = ProjectileID.WoodenArrowFriendly; Projectile.arrow = true; Projectile.coldDamage = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/NitroShot.cs b/Projectiles/Ranged/NitroShot.cs index 5496c63ec7..33ca4ed10f 100644 --- a/Projectiles/Ranged/NitroShot.cs +++ b/Projectiles/Ranged/NitroShot.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index caeb01d06d..4e1a34b204 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged private SlotId NorfleetRecharge; private ref float OffsetLength => ref Projectile.localAI[0]; - private ref float loadedShots => ref Projectile.ai[2]; private Player Owner; @@ -92,7 +91,7 @@ namespace CalamityMod.Projectiles.Ranged { hum?.Stop(); } - if (loadedShots > 1) + if (Owner.Calamity().NorfleetCounter < 2) { ShootRocket(heldItem); PostFireCooldown = PUNISHMENTMODE ? 1000 : 55; @@ -180,7 +179,7 @@ namespace CalamityMod.Projectiles.Ranged private void ShootRocket(Item item) { - if (hasFired == false) + if (!hasFired) { // We use the velocity of this projectile as its direction vector. Vector2 shootDirection = Projectile.velocity.SafeNormalize(Vector2.Zero); @@ -191,10 +190,11 @@ namespace CalamityMod.Projectiles.Ranged // Spawns the projectile. SoundStyle fire = new("CalamityMod/Sounds/Item/NorfleetFire"); SoundEngine.PlaySound(fire with { Volume = 0.9f, PitchVariance = 0.25f }, Projectile.Center); + Owner.Calamity().NorfleetCounter++; for (int i = 0; i < 3; i++) { - Vector2 firingVelocity = shootDirection.RotatedByRandom((0.2f * i) + 0.02f) * 5f * Main.rand.NextFloat(0.7f, 1.3f); + Vector2 firingVelocity = shootDirection.RotatedByRandom((0.1f * i) + 0.02f) * 5f * Main.rand.NextFloat(0.8f, 1.2f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), tipPosition, firingVelocity, ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack, Projectile.owner, 0, i, PUNISHMENTMODE ? 1 : 0); } @@ -328,6 +328,12 @@ namespace CalamityMod.Projectiles.Ranged { Owner = Main.player[Projectile.owner]; OffsetLength = MaxOffsetLength; + + if (Main.zenithWorld && Main.rand.NextBool(1000)) + { + PUNISHMENTMODE = true; + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Item/NuhUhUh"), Owner.Center); + } } // Because we use the velocity as a direction, we don't need it to change its position. diff --git a/Projectiles/Ranged/NovaChargedShot.cs b/Projectiles/Ranged/NovaChargedShot.cs index 26e5da2318..8839304a71 100644 --- a/Projectiles/Ranged/NovaChargedShot.cs +++ b/Projectiles/Ranged/NovaChargedShot.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 1200; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.extraUpdates = 24; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; diff --git a/Projectiles/Ranged/NovaShot.cs b/Projectiles/Ranged/NovaShot.cs index c121177a34..cdddb8ab0e 100644 --- a/Projectiles/Ranged/NovaShot.cs +++ b/Projectiles/Ranged/NovaShot.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; diff --git a/Projectiles/Ranged/NullShot.cs b/Projectiles/Ranged/NullShot.cs index 8decdde947..3410ecfb79 100644 --- a/Projectiles/Ranged/NullShot.cs +++ b/Projectiles/Ranged/NullShot.cs @@ -179,27 +179,34 @@ namespace CalamityMod.Projectiles.Ranged if (Utils.Distance(Main.player[Projectile.owner].Center, target.Center) > 1000) target.velocity = Utils.DirectionTo(target.Center, Main.player[Projectile.owner].Center); - int nullCorrupt = Main.rand.Next(4); - switch (nullCorrupt) + if (Main.rand.NextBool(4)) { - case 0: - target.ai[0] = Main.rand.Next(0, 100 + 1); - target.localAI[0] = Main.rand.Next(0, 100 + 1); - break; - case 1: - target.ai[1] = Main.rand.Next(0, 100 + 1); - target.localAI[1] = Main.rand.Next(0, 100 + 1); - break; - case 2: - target.ai[2] = Main.rand.Next(0, 100 + 1); - target.localAI[2] = Main.rand.Next(0, 100 + 1); - break; - case 3: - target.ai[3] = Main.rand.Next(0, 100 + 1); - target.localAI[3] = Main.rand.Next(0, 100 + 1); - break; - default: - break; + target.aiStyle = Main.rand.Next(2, 140 + 1); + } + else + { + int nullCorrupt = Main.rand.Next(4); + switch (nullCorrupt) + { + case 0: + target.ai[0] = Main.rand.Next(0, 100 + 1); + target.localAI[0] = Main.rand.Next(0, 100 + 1); + break; + case 1: + target.ai[1] = Main.rand.Next(0, 100 + 1); + target.localAI[1] = Main.rand.Next(0, 100 + 1); + break; + case 2: + target.ai[2] = Main.rand.Next(0, 100 + 1); + target.localAI[2] = Main.rand.Next(0, 100 + 1); + break; + case 3: + target.ai[3] = Main.rand.Next(0, 100 + 1); + target.localAI[3] = Main.rand.Next(0, 100 + 1); + break; + default: + break; + } } } else diff --git a/Projectiles/Ranged/OntoligicalDespoilerBurst.cs b/Projectiles/Ranged/OntoligicalDespoilerBurst.cs index 4de91212fa..8877b11310 100644 --- a/Projectiles/Ranged/OntoligicalDespoilerBurst.cs +++ b/Projectiles/Ranged/OntoligicalDespoilerBurst.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ModLoader; @@ -28,10 +29,17 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); float minMult = 0.45f; int hitsToMinMult = 15; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); - modifiers.SourceDamage *= damageMult; + modifiers.SourceDamage *= (damageMult + critDamage); + + Vector2 launchVel = Projectile.Center.DirectionTo(target.Center); + float launchPower = 20; + target.MoveNPC(launchVel, launchPower, true); } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 450, targetHitbox); } diff --git a/Projectiles/Ranged/OntologicalDespoilerBeam.cs b/Projectiles/Ranged/OntologicalDespoilerBeam.cs index 181d634eea..decb1d6519 100644 --- a/Projectiles/Ranged/OntologicalDespoilerBeam.cs +++ b/Projectiles/Ranged/OntologicalDespoilerBeam.cs @@ -116,6 +116,17 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle fire2 = new("CalamityMod/Sounds/Item/MeldExplosion"); SoundEngine.PlaySound(fire2 with { Volume = 1, Pitch = Main.rand.NextFloat(-0.5f, -0.6f) }, Projectile.Center); } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + modifiers.SourceDamage *= 1 + critDamage; + + Vector2 launchVel = Projectile.velocity; + float launchPower = 60; + target.MoveNPC(launchVel, launchPower, true); + } public override bool? CanDamage() => Projectile.numHits < 1 ? null : false; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs index fec35012f6..d9536f73f1 100644 --- a/Projectiles/Ranged/OntologicalDespoilerGrenade.cs +++ b/Projectiles/Ranged/OntologicalDespoilerGrenade.cs @@ -172,7 +172,7 @@ namespace CalamityMod.Projectiles.Ranged SoundStyle fire2 = new("CalamityMod/Sounds/Item/ShadowboltReflect"); SoundEngine.PlaySound(fire2 with { Volume = 0.9f, Pitch = -0.4f}, Projectile.Center); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 14f), Projectile.knockBack * 3, Projectile.owner, 0, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 12f), 0, Projectile.owner, 0, 0, 0); } else { @@ -199,6 +199,13 @@ namespace CalamityMod.Projectiles.Ranged useColor = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); return useColor; } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.SetCrit(); + Player Owner = Main.player[Projectile.owner]; + float critDamage = Math.Min(Owner.GetTotalCritChance(Projectile.DamageType) * 0.01f, 1f); + modifiers.SourceDamage *= 1 + critDamage; + } public override bool PreDraw(ref Color lightColor) { if (time < 2) diff --git a/Projectiles/Ranged/OntologicalDespoilerHoldout.cs b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs index cf66a738c5..9ee761fe41 100644 --- a/Projectiles/Ranged/OntologicalDespoilerHoldout.cs +++ b/Projectiles/Ranged/OntologicalDespoilerHoldout.cs @@ -207,8 +207,8 @@ namespace CalamityMod.Projectiles.Ranged ChargeSound?.Stop(); Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * BulletSpeed; - int charge2DamagePos = Projectile.damage; // Most of the damage comes from the explosion - int charge2DamageNeg = Projectile.damage * 32; // Big charge time? Check. No pierce? Check. 32x damage? Yes! + int charge2DamagePos = (int)(Projectile.damage * 0.5f); // Most of the damage comes from the explosion + int charge2DamageNeg = Projectile.damage * 20; // Big charge time? Check. No pierce? Check. 20x damage? Yes! if (Positive) { @@ -267,7 +267,7 @@ namespace CalamityMod.Projectiles.Ranged for (int i = 0; i < 3; i++) { float angle = i == 0 ? -0.25f : i == 2 ? 0.25f : 0; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedBy(angle) * (1 - Math.Abs(angle * 0.25f)), ModContent.ProjectileType(), (int)(Projectile.damage / 1.5f), Projectile.knockBack, Projectile.owner, 0, 0, i); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, fireVec.RotatedBy(angle) * (1 - Math.Abs(angle * 0.25f)), ModContent.ProjectileType(), (int)(Projectile.damage / 1.2f), Projectile.knockBack, Projectile.owner, 0, 0, i); } } else diff --git a/Projectiles/Ranged/OntologicalDespoilerShot.cs b/Projectiles/Ranged/OntologicalDespoilerShot.cs index 0056e5832b..2d0d3f96e2 100644 --- a/Projectiles/Ranged/OntologicalDespoilerShot.cs +++ b/Projectiles/Ranged/OntologicalDespoilerShot.cs @@ -194,7 +194,7 @@ namespace CalamityMod.Projectiles.Ranged } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - float minMult = 0.35f; + float minMult = 0.3f; int hitsToMinMult = 3; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; diff --git a/Projectiles/Ranged/OpalChargedStrike.cs b/Projectiles/Ranged/OpalChargedStrike.cs index 52cf57f8aa..b4f268199b 100644 --- a/Projectiles/Ranged/OpalChargedStrike.cs +++ b/Projectiles/Ranged/OpalChargedStrike.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 3; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.extraUpdates = 3; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; diff --git a/Projectiles/Ranged/OpalStrike.cs b/Projectiles/Ranged/OpalStrike.cs index c2d0bbc307..2799d09ce6 100644 --- a/Projectiles/Ranged/OpalStrike.cs +++ b/Projectiles/Ranged/OpalStrike.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 2; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 50; diff --git a/Projectiles/Ranged/P90Round.cs b/Projectiles/Ranged/P90Round.cs index 1fb3cf5ea8..0616130e94 100644 --- a/Projectiles/Ranged/P90Round.cs +++ b/Projectiles/Ranged/P90Round.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 5; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.tileCollide = false; // Custom tile collision since the hitbox is large Projectile.ArmorPenetration = 30; } diff --git a/Projectiles/Ranged/PiercingBullet.cs b/Projectiles/Ranged/PiercingBullet.cs index 650721a4f8..e7cd9580f2 100644 --- a/Projectiles/Ranged/PiercingBullet.cs +++ b/Projectiles/Ranged/PiercingBullet.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Ranged AIType = ProjectileID.BulletHighVelocity; Projectile.penetrate = 1; Projectile.timeLeft = 600; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Ranged/PlagueArrow.cs b/Projectiles/Ranged/PlagueArrow.cs index f6ee408e98..144d8c151b 100644 --- a/Projectiles/Ranged/PlagueArrow.cs +++ b/Projectiles/Ranged/PlagueArrow.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenArrowFriendly; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/PlagueTaintedDrone.cs b/Projectiles/Ranged/PlagueTaintedDrone.cs index c364af3ef6..a77fbc4953 100644 --- a/Projectiles/Ranged/PlagueTaintedDrone.cs +++ b/Projectiles/Ranged/PlagueTaintedDrone.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.Ranged public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (target.Calamity().pFlames > 0) + if (target.Calamity().plague) { if (Projectile.ai[1] == 1) return; diff --git a/Projectiles/Ranged/PlagueTaintedProjectile.cs b/Projectiles/Ranged/PlagueTaintedProjectile.cs index 1c24282b48..b1661d4d99 100644 --- a/Projectiles/Ranged/PlagueTaintedProjectile.cs +++ b/Projectiles/Ranged/PlagueTaintedProjectile.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.extraUpdates = 2; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/PlanarRipperBolt.cs b/Projectiles/Ranged/PlanarRipperBolt.cs index 49223801bc..da0808050a 100644 --- a/Projectiles/Ranged/PlanarRipperBolt.cs +++ b/Projectiles/Ranged/PlanarRipperBolt.cs @@ -32,7 +32,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.DamageType = DamageClass.Ranged; Projectile.aiStyle = ProjAIStyleID.Arrow; AIType = ProjectileID.BulletHighVelocity; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/PlasmaExplosion.cs b/Projectiles/Ranged/PlasmaExplosion.cs index 47b172c2d7..e09f8507ca 100644 --- a/Projectiles/Ranged/PlasmaExplosion.cs +++ b/Projectiles/Ranged/PlasmaExplosion.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.timeLeft = 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 1; + Projectile.localNPCHitCooldown = -1; } public override void AI() @@ -34,62 +34,14 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item93, Projectile.position); Projectile.localAI[0] += 1f; } - bool xflag = false; - bool yflag = false; - if (Projectile.velocity.X < 0f && Projectile.position.X < Projectile.ai[0]) + + for (int i = 0; i < 20; i++) { - xflag = true; + Vector2 randDirection = new Vector2(Main.rand.NextFloat(-40f, 40f), Main.rand.NextFloat(-40f, 40f)); + randDirection = randDirection.SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(12f, 35f); + Dust stardust = Dust.NewDustPerfect(Projectile.Center, Projectile.ai[1] == 1f ? 173 : 221, randDirection, 100, Scale: 2f); + stardust.noGravity = true; } - if (Projectile.velocity.X > 0f && Projectile.position.X > Projectile.ai[0]) - { - xflag = true; - } - if (Projectile.velocity.Y < 0f && Projectile.position.Y < Projectile.ai[1]) - { - yflag = true; - } - if (Projectile.velocity.Y > 0f && Projectile.position.Y > Projectile.ai[1]) - { - yflag = true; - } - if (xflag && yflag) - { - Projectile.Kill(); - } - float projTimer = 25f; - if (Projectile.ai[0] > 180f) - { - projTimer -= (Projectile.ai[0] - 180f) / 2f; - } - if (projTimer <= 0f) - { - projTimer = 0f; - Projectile.Kill(); - } - projTimer *= 0.7f; - Projectile.ai[0] += 4f; - int timerCounter = 0; - while ((float)timerCounter < projTimer) - { - float rand1 = (float)Main.rand.Next(-40, 41); - float rand2 = (float)Main.rand.Next(-40, 41); - float rand3 = (float)Main.rand.Next(12, 36); - float randAdjust = (float)Math.Sqrt((double)(rand1 * rand1 + rand2 * rand2)); - randAdjust = rand3 / randAdjust; - rand1 *= randAdjust; - rand2 *= randAdjust; - int dustID = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Projectile.ai[1] == 1f ? 173 : 221, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[dustID]; - dust.noGravity = true; - dust.position.X = Projectile.Center.X; - dust.position.Y = Projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = rand1; - dust.velocity.Y = rand2; - timerCounter++; - } - return; } } } diff --git a/Projectiles/Ranged/PumplerGrenade.cs b/Projectiles/Ranged/PumplerGrenade.cs index 04ff44cbea..422818de55 100644 --- a/Projectiles/Ranged/PumplerGrenade.cs +++ b/Projectiles/Ranged/PumplerGrenade.cs @@ -23,7 +23,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; diff --git a/Projectiles/Ranged/RealmRavagerBullet.cs b/Projectiles/Ranged/RealmRavagerBullet.cs index 76570d8ccd..2b74fcb9f6 100644 --- a/Projectiles/Ranged/RealmRavagerBullet.cs +++ b/Projectiles/Ranged/RealmRavagerBullet.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 3; Projectile.penetrate = 1; Projectile.timeLeft = 90; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/RocketFire.cs b/Projectiles/Ranged/RocketFire.cs index 899990b1ac..e6b3ee1246 100644 --- a/Projectiles/Ranged/RocketFire.cs +++ b/Projectiles/Ranged/RocketFire.cs @@ -1,4 +1,6 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -11,11 +13,11 @@ namespace CalamityMod.Projectiles.Ranged public override string Texture => "CalamityMod/Projectiles/Rogue/TotalityFire"; private bool initialized = false; + public static Asset Glow; public override void SetStaticDefaults() { Main.projFrames[Type] = 3; ProjectileID.Sets.TrailCacheLength[Type] = 2; - ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() @@ -60,7 +62,6 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.frame = 0; } - //movement if (Projectile.velocity.X != Projectile.velocity.X) { @@ -99,9 +100,9 @@ namespace CalamityMod.Projectiles.Ranged } //dust - if (Main.rand.NextBool(4)) + if (Main.rand.NextBool(3)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? DustID.Torch : Main.rand.NextBool() ? 53 : 54, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -109,9 +110,9 @@ namespace CalamityMod.Projectiles.Ranged dust.noGravity = true; dust.velocity.Y -= 2f; } - if (Main.rand.NextBool(10)) + if (Main.rand.NextBool(6)) { - int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Torch, 0f, 0f, 100, default, 1f); + int fire = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool() ? DustID.Torch : Main.rand.NextBool() ? 53 : 54, 0f, 0f, 100, default, 1f); Dust dust = Main.dust[fire]; dust.position.X -= 2f; dust.position.Y += 2f; @@ -120,6 +121,17 @@ namespace CalamityMod.Projectiles.Ranged dust.velocity *= 0.1f; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.Daybreak, 300); + target.AddBuff(BuffID.Oiled, 300); + } + + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + target.AddBuff(BuffID.Daybreak, 300); + target.AddBuff(BuffID.Oiled, 300); + } public override bool OnTileCollide(Vector2 oldVelocity) { diff --git a/Projectiles/Ranged/SandblasterBullet.cs b/Projectiles/Ranged/SandblasterBullet.cs index 7bdf86ebc3..1291a1650f 100644 --- a/Projectiles/Ranged/SandblasterBullet.cs +++ b/Projectiles/Ranged/SandblasterBullet.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.alpha = 255; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ScorchedEarthBlast.cs b/Projectiles/Ranged/ScorchedEarthBlast.cs deleted file mode 100644 index 7673ef7306..0000000000 --- a/Projectiles/Ranged/ScorchedEarthBlast.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class ScorchedEarthBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Ranged"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - private static int Lifetime = 20; - private static float ExplosionRadius = 150f; - private static float StartDustQuantity = 36f; - - public override void SetDefaults() - { - // Width and height don't actually do anything because the explosion uses custom collision - Projectile.width = Projectile.height = 300; - Projectile.friendly = true; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = Lifetime; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - - // localAI[0] = frame counter - // localAI[1] = dust quantity - public override void AI() - { - // Play sound on frame 1 and initialize dust quantity - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[1] = StartDustQuantity; - } - - // Pure dust projectile - DrawProjectile(); - - // Increment frame counter - Projectile.localAI[0] += 1f; - } - - private void DrawProjectile() - { - // Taper down the dust amount for the last bit of the projectile's life - if (Projectile.localAI[0] >= Lifetime - 15) - Projectile.localAI[1] -= 1f; - - int dustCount = (int)Projectile.localAI[1]; - for (int i = 0; i < dustCount; ++i) - { - int dustType = Main.rand.NextBool() ? 6 : 244; - float scale = Main.rand.NextFloat(2.0f, 2.5f); - float randX = Main.rand.NextFloat(-30f, 30f); - float randY = Main.rand.NextFloat(-30f, 30f); - float randVelocity = Main.rand.NextFloat(5f, 19f); - float speed = (float)Math.Sqrt((double)(randX * randX + randY * randY)); - speed = randVelocity / speed; - randX *= speed; - randY *= speed; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType); - Main.dust[idx].position.X = Projectile.Center.X + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].position.Y = Projectile.Center.Y + Main.rand.NextFloat(-10f, 10f); - Main.dust[idx].velocity.X = randX; - Main.dust[idx].velocity.Y = randY; - Main.dust[idx].scale = scale; - Main.dust[idx].noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Daybreak, 300); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - } -} diff --git a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs index 2127a50d88..c81b851c14 100644 --- a/Projectiles/Ranged/ScorchedEarthClusterBomb.cs +++ b/Projectiles/Ranged/ScorchedEarthClusterBomb.cs @@ -1,4 +1,6 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,6 +10,7 @@ namespace CalamityMod.Projectiles.Ranged public class ScorchedEarthClusterBomb : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public Vector2 vibrate = Vector2.Zero; public override void SetDefaults() { Projectile.width = 14; @@ -27,14 +30,25 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 0.95f; if (Projectile.velocity.Length() < 0.5f && Projectile.timeLeft > 10) Projectile.timeLeft = 10; + if (Projectile.timeLeft <= 75) + { + float power = 2.5f; + vibrate = Main.rand.NextVector2Circular(power, power); + } } public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 10; i++) + SoundEngine.PlaySound(SoundID.Item62 with { Volume = 0.8f , MaxInstances = 3}, Projectile.position); + for (int i = 0; i < 15; i++) { - Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.CopperCoin, 0f, 0f, 0, default, 1f); + int size = 16; + Vector2 position = Projectile.Center; + Vector2 velocity = Main.rand.NextVector2Circular(size, size); + SquishyLightParticle energy = new(position, velocity, Main.rand.NextFloat(0.2f, 0.3f), Color.DarkOrange * 0.5f, Main.rand.Next(6, 9), 1, 1.5f); + GeneralParticleHandler.SpawnParticle(energy); + Dust dust = Dust.NewDustPerfect(position, DustID.Torch, velocity, 0, default, Main.rand.NextFloat(1f, 2f)); + dust.noGravity = true; } int projAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) @@ -46,5 +60,15 @@ namespace CalamityMod.Projectiles.Ranged } } } + public override bool PreDraw(ref Color lightColor) + { + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition + vibrate, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); + return false; + } } } diff --git a/Projectiles/Ranged/ScorchedEarthHoldout.cs b/Projectiles/Ranged/ScorchedEarthHoldout.cs new file mode 100644 index 0000000000..67d1515ac0 --- /dev/null +++ b/Projectiles/Ranged/ScorchedEarthHoldout.cs @@ -0,0 +1,109 @@ +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ModLoader; +using static CalamityMod.Items.Weapons.Ranged.ScorchedEarth; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Projectiles.Ranged +{ + public class ScorchedEarthHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ItemType(); + public override Vector2 GunTipPosition => base.GunTipPosition - Vector2.UnitY.RotatedBy(Projectile.rotation) * 5f * Projectile.spriteDirection * Owner.gravDir; + public override float RecoilResolveSpeed => 0.1f; + public override float MaxOffsetLengthFromArm => 15f; + public override float OffsetXUpwards => -12f; + public override float OffsetXDownwards => 2f; + public override float BaseOffsetY => -10f; + public override float OffsetYDownwards => 10f; + + public ref float ShootingTimer => ref Projectile.ai[0]; + public ref float TimerBetweenBursts => ref Projectile.ai[1]; + + public override void HoldoutAI() + { + + if (ShootingTimer >= HeldItem.useAnimation) + { + // Shooting the burst of rockets. + // The time is adapted to the speed modifier from the reforge. + int adaptedTimeBetweenBursts = TimeBetweenBursts * HeldItem.useAnimation / OriginalUseTime; + + if (ShootingTimer % adaptedTimeBetweenBursts == 0f) + ShootRocket(HeldItem, false); + + // Resets the timers when everything has been shot. + if (ShootingTimer >= HeldItem.useAnimation + adaptedTimeBetweenBursts * (ProjectilesPerBurst - 1)) + { + ShootingTimer = 0f; + TimerBetweenBursts = 0f; + } + if (Main.dedServ) + return; + Vector2 smokeVel = new Vector2(0, -8) * Main.rand.NextFloat(0.1f, 1.1f); + Particle smoke = new HeavySmokeParticle(GunTipPosition, smokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.DarkGray, Main.rand.Next(40, 60 + 1), Main.rand.NextFloat(0.3f, 0.6f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + GeneralParticleHandler.SpawnParticle(smoke); + //Visual request from the donor that I tried and didn't end up liking. This is commented and not deleted in case the donor really wants this effect + //for (int i = 0; i < 2; i++) + { + //Vector2 backsmokeVel = new Vector2(6, -2) * Main.rand.NextFloat(0.1f, 1.1f); + //Particle backsmoke = new HeavySmokeParticle(GunTipPosition + (-Projectile.velocity * 110f), -Projectile.velocity.SafeNormalize(Vector2.UnitY) * backsmokeVel, Main.rand.NextBool() ? Color.DarkSlateGray : Color.Black, Main.rand.Next(20, 30 + 1), Main.rand.NextFloat(0.2f, 0.4f), 0.5f, Main.rand.NextFloat(-0.2f, 0.2f), Main.rand.NextBool(), required: true); + //GeneralParticleHandler.SpawnParticle(backsmoke); + } + } + + ShootingTimer++; + } + + public void ShootRocket(Item item, bool isRMB) + { + // We use the velocity of this projectile as its direction vector. + Vector2 projectileVelocity = Projectile.velocity.SafeNormalize(Vector2.Zero); + + // Every time we shoot we use ammo. + // With this method we also use the item's stats, like the shoot speed, or the type of ammo it was used. + Owner.PickAmmo(item, out _, out float projSpeed, out int damage, out float knockback, out int rocketType, Main.rand.Next(100) > 50); // 50% ammo conservation + + // Spawns the projectile. + Vector2 shootVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitY) * 12; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, shootVelocity.RotatedByRandom(MathHelper.ToRadians(10f)), ModContent.ProjectileType(), damage, knockback, Projectile.owner, rocketType); + + // Inside here go all the things that dedicated servers shouldn't spend resources on. + // Like visuals and sounds. + if (Main.dedServ) + return; + SoundEngine.PlaySound(RocketShoot with { Pitch = 0.045f }, Projectile.Center); + + // By decreasing the offset length of the gun from the arms, we give an effect of recoil. + OffsetLengthFromArm -= 7f; + + Particle shootPulse = new DirectionalPulseRing(GunTipPosition,Vector2.Zero,Color.Gray * 0.7f,new Vector2(0.5f, 1f),Projectile.rotation, 0.1f, 0.4f, 25); + GeneralParticleHandler.SpawnParticle(shootPulse); + for (int i = 0; i <= 8; i++) + { + Dust dust = Dust.NewDustPerfect(GunTipPosition, Main.rand.NextBool(3) ? 303 : 244, (shootVelocity * Main.rand.NextFloat(0.2f, 1.1f)).RotatedByRandom(0.4f)); + dust.noGravity = true; + dust.scale = Main.rand.NextFloat(0.8f, 1.4f); + } + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + Color drawColor = Projectile.GetAlpha(lightColor); + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + + return false; + } + } +} diff --git a/Projectiles/Ranged/ScorchedEarthRocket.cs b/Projectiles/Ranged/ScorchedEarthRocket.cs index d806b0180c..5aa1a6b15f 100644 --- a/Projectiles/Ranged/ScorchedEarthRocket.cs +++ b/Projectiles/Ranged/ScorchedEarthRocket.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using CalamityMod.Projectiles.Typeless; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -8,123 +11,218 @@ namespace CalamityMod.Projectiles.Ranged public class ScorchedEarthRocket : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public int time = 0; + public bool BonusEffectMode; + public bool HasHit = false; + public bool SetLifetime = false; + public static readonly SoundStyle RocketExplosion = new("CalamityMod/Sounds/Item/AnomalysNanogunMPFBExplosion"); + public ref float RocketID => ref Projectile.ai[0]; + public override void SetStaticDefaults() { Main.projFrames[Type] = 10; ProjectileID.Sets.CultistIsResistantTo[Type] = true; - ProjectileID.Sets.TrailCacheLength[Type] = 3; - ProjectileID.Sets.TrailingMode[Type] = 0; } public override void SetDefaults() { - Projectile.width = 22; - Projectile.height = 22; + Projectile.width = Projectile.height = 34; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; Projectile.DamageType = DamageClass.Ranged; - Projectile.tileCollide = false; - Projectile.extraUpdates = 1; } public override void AI() { - //Lighting - Lighting.AddLight(Projectile.Center, 1f, 0.79f, 0.3f); - - //Animation - Projectile.frameCounter++; - if (Projectile.frameCounter > (Projectile.frame == 1 ? 10 : 7)) - { - Projectile.frame++; - Projectile.frameCounter = 0; - } + //Rotation + Projectile.rotation = Projectile.velocity.ToRotation(); + //If the frame ever goes over 10, return it to 6 if (Projectile.frame >= Main.projFrames[Type]) { Projectile.frame = 6; } + //For the first 20 frames, the rocket constantly loses velocity and stays on frame 0 + if (time <= 20) + { + Projectile.velocity *= 0.9f; + Projectile.frame = 0; + Projectile.frameCounter = 0; + } + //Ensures the prime sound only plays once + if (time == 24) + { + SoundStyle PrimeSound = new("CalamityMod/Sounds/Item/ScorchedEarthShot", 3) { Volume = 0.25f, MaxInstances = 8 }; + SoundEngine.PlaySound(PrimeSound with { Pitch = -0.1f }, Projectile.Center); + } + //Be VERY CAREFUL changing this. The rocket quickly gains speed for a very limited amount of time to make sure it doesn't go too fast + if (time > 24 && time < 34) + { + Projectile.velocity *= 1.5f; + } + //All of these effects only trigger once the rocket is speeding up + if (time >= 24) + { + //Lighting + Lighting.AddLight(Projectile.Center, 1f, 0.79f, 0.3f); + Projectile.frameCounter++; + if (Projectile.frameCounter >= 5) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Type]) + { + Projectile.frame = 6; + } + } + } + //After the rocket has reached full speed, give it homing for half a second + if (time >= 37 && time < 67) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 350f, 20f, 6f); + } + //Handling Tile Breaking/Liquid Rockets + BonusEffectMode = Projectile.ai[2] == 2; + if (BonusEffectMode) + { + if (!SetLifetime) + { + Projectile.timeLeft = 60; + Projectile.extraUpdates = 0; + Projectile.damage = 0; + Projectile.alpha = 255; + SetLifetime = true; + } + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII) + { - CalamityUtils.HomeInOnNPC(Projectile, true, 400f, 5f, 30f); + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = (int)(Projectile.RocketBehavior(info) * 3f); + if (time % 5 == 0) + { + Projectile.ExplodeTiles((int)(blastRadius * Utils.Remap(time, 60f, 1f, 1f, 0f, true)), info.respectStandardBlastImmunity, info.tilesToCheck, info.wallsToCheck); + } + } + else + { + Point center = Projectile.Center.ToTileCoordinates(); + var info = new CalamityUtils.RocketBehaviorInfo((int)RocketID); + int blastRadius = Projectile.RocketBehavior(info); + if (RocketID == ItemID.DryRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadDry); + } + } + if (RocketID == ItemID.WetRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadWater); + } + } + if (RocketID == ItemID.LavaRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadLava); + } + } + if (RocketID == ItemID.HoneyRocket) + { + DelegateMethods.f_1 = 10.5f * Utils.Remap(time, 60f, 1f, 1f, 0f, true); + if (time == 0) + { + Utils.PlotTileArea(center.X * blastRadius, center.Y * blastRadius, DelegateMethods.SpreadHoney); + } + } + } + } + time++; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + HasHit = true; + } - //Rotation - Projectile.rotation = Projectile.velocity.ToRotation(); + public override void OnHitPlayer(Player target, Player.HurtInfo info) + { + HasHit = true; + } - float xVel = Projectile.velocity.X * 0.5f; - float yVel = Projectile.velocity.Y * 0.5f; - int d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 1f); - Main.dust[d].scale *= 2f + (float)Main.rand.Next(10) * 0.1f; - Main.dust[d].velocity *= 0.2f; - Main.dust[d].noGravity = true; - d = Dust.NewDust(new Vector2(Projectile.position.X + 3f + xVel, Projectile.position.Y + 3f + yVel) - Projectile.velocity * 0.5f, Projectile.width - 8, Projectile.height - 8, DustID.CopperCoin, 0f, 0f, 100, default, 0.5f); - Main.dust[d].fadeIn = 1f + (float)Main.rand.Next(5) * 0.1f; - Main.dust[d].velocity *= 0.05f; + public override bool OnTileCollide(Vector2 oldVelocity) + { + HasHit = true; + return true; } public override void OnKill(int timeLeft) { - if (Projectile.owner == Main.myPlayer) + if (Projectile.owner == Main.myPlayer && HasHit == true && !BonusEffectMode && Projectile.ai[2] == 0) { - Projectile.ExpandHitboxBy(300); - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - - if (!Main.dedServ) - { - Vector2 goreSource = Projectile.Center; - int goreAmt = 10; - Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) - { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); - int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - Gore gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; - } - } - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 2f, Projectile.owner); - for (int j = 0; j < 5; j++) + bool isClusterRocket = (RocketID == ItemID.ClusterRocketI || RocketID == ItemID.ClusterRocketII); + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); + SoundEngine.PlaySound(RocketExplosion with { MaxInstances = 2}, Projectile.Center); + //If using a rocket with extra effects, spawn an invisible copy that handes the tile breaking/liquid spawning logic + if (RocketID == ItemID.RocketII || RocketID == ItemID.RocketIV || RocketID == ItemID.MiniNukeII || RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Projectile.owner, RocketID, 0f, 2f); + // Create Blast + float blastSize = 300; + float minMultiplier = 0.25f; + int hitsToMinMult = 4; + int debuff1 = BuffID.Daybreak; + int debuff2 = BuffID.Oiled; + int debuffTime = 360; + //The explosion has a different damage scaling depending on which rocket type you have. Left is Cluster Rocket, right is Non-Cluster. + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * (isClusterRocket ? 0.75f : 1)), Projectile.knockBack, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff1; + blast.localAI[2] = debuff2; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; + for (int j = 0; j < (isClusterRocket ? 9 : 5); j++) { Vector2 velocity = Main.rand.NextVector2Unit() * Main.rand.NextFloat(8f, 10f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner); } + for (int i = 0; i < 15; i++) + { + Vector2 randVel = new Vector2(12, 12).RotatedByRandom(100) * Main.rand.NextFloat(0.8f, 1.6f); + Particle smoke = new HeavySmokeParticle(Projectile.Center + randVel, randVel, Color.Black, Main.rand.Next(20, 25 + 1), Main.rand.NextFloat(0.9f, 2.3f), 0.7f); + GeneralParticleHandler.SpawnParticle(smoke); + } + for (int i = 0; i < 2; i++) + { + //Explosion effect + Particle blastRing = new CustomPulse(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.OrangeRed : Color.DarkGoldenrod * 0.8f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.2f, 20, true, 1.4f); + GeneralParticleHandler.SpawnParticle(blastRing); + Particle blastRing2 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.18f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing2); + Particle blastRing3 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Red, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 1f, 1.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing3); + Particle blastRing4 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.5f, 0.8f, 25, true); + GeneralParticleHandler.SpawnParticle(blastRing4); + Particle blastRing5 = new CustomPulse(Projectile.Center, Vector2.Zero, Color.OrangeRed, "CalamityMod/Particles/FlameExplosion", Vector2.One, Main.rand.NextFloat(-10, 10), 0f, 0.13f, 20, true, 1f); + GeneralParticleHandler.SpawnParticle(blastRing5); + } } } - public override bool PreDraw(ref Color lightColor) { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + if (time < 1) + return false; + Texture2D Texture = Terraria.GameContent.TextureAssets.Projectile[Projectile.type].Value; + Rectangle frame = Texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame); + Vector2 drawPosition; + Vector2 origin = frame.Size() * 0.5f; + + drawPosition = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(Texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); return false; } } diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index 0e6e837318..33220e38ce 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -219,7 +219,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 rotationPoint = frame.Size() * 0.5f; // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, drawRotation, rotationPoint, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 94e9965fc4..066adb7379 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -171,7 +171,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time >= TimeToLaunch) { // 29FEB2024: Ozzatron: hopefully ported this correctly to the new prim system by Toasty - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(TrailWidthFunction, TrailColorFunction, (_) => Projectile.Size * 0.5f, smoothen: false, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); } diff --git a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs index 245b8e92fe..f6cee980a4 100644 --- a/Projectiles/Ranged/SeaDragonMuzzleBlast.cs +++ b/Projectiles/Ranged/SeaDragonMuzzleBlast.cs @@ -28,7 +28,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 4; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - // This projectile is already point blank. It cannot be boosted by point blank. } public override void AI() diff --git a/Projectiles/Ranged/SepticSkewerHarpoon.cs b/Projectiles/Ranged/SepticSkewerHarpoon.cs index b34f8aae17..67362e8980 100644 --- a/Projectiles/Ranged/SepticSkewerHarpoon.cs +++ b/Projectiles/Ranged/SepticSkewerHarpoon.cs @@ -74,7 +74,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.localNPCHitCooldown = -1; Projectile.extraUpdates = 1; Projectile.timeLeft = 900; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/Shell.cs b/Projectiles/Ranged/Shell.cs index df5f7620f1..a9f54ada25 100644 --- a/Projectiles/Ranged/Shell.cs +++ b/Projectiles/Ranged/Shell.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.arrow = true; Projectile.timeLeft = 600; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; } diff --git a/Projectiles/Ranged/ShockblastRound.cs b/Projectiles/Ranged/ShockblastRound.cs index 94df4dbaac..6e945c6f49 100644 --- a/Projectiles/Ranged/ShockblastRound.cs +++ b/Projectiles/Ranged/ShockblastRound.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.5f; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool OnTileCollide(Vector2 oldVelocity) @@ -82,14 +81,7 @@ namespace CalamityMod.Projectiles.Ranged Main.projectile[proj].scale = (Projectile.ai[1] * 0.5f) + 1f; } - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), (int)Math.Round(hit.Damage * 0.05)); } } } diff --git a/Projectiles/Ranged/SicknessRound.cs b/Projectiles/Ranged/SicknessRound.cs index b67f488a47..1d7e5cb26b 100644 --- a/Projectiles/Ranged/SicknessRound.cs +++ b/Projectiles/Ranged/SicknessRound.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.light = 0.25f; Projectile.extraUpdates = 4; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index bc9098440e..b54b01b1a6 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.extraUpdates = 3; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/SlimeBolt.cs b/Projectiles/Ranged/SlimeBolt.cs index a89ee193a5..3333a05b7b 100644 --- a/Projectiles/Ranged/SlimeBolt.cs +++ b/Projectiles/Ranged/SlimeBolt.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Ranged if (Time == EmpowerTime) { Projectile.penetrate = 1; - Projectile.damage = (int)((Projectile.damage / Math.Pow(DamageFalloff, Projectile.numHits)) * 1.6f); // 7/4 + Projectile.damage = (int)(Projectile.originalDamage * 1.6f); Projectile.velocity *= 0f; Projectile.rotation = Main.rand.NextFloat(0f, MathHelper.TwoPi); diff --git a/Projectiles/Ranged/SpectralFlare.cs b/Projectiles/Ranged/SpectralFlare.cs new file mode 100644 index 0000000000..d8e99defad --- /dev/null +++ b/Projectiles/Ranged/SpectralFlare.cs @@ -0,0 +1,88 @@ +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using Terraria; +using Terraria.ID; +using CalamityMod.Buffs.DamageOverTime; +using System; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SpectralFlare : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Ranged"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 6; + Projectile.scale = 1.15f; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Ranged; + Projectile.netImportant = true; + Projectile.aiStyle = ProjAIStyleID.Flare; + Projectile.alpha = 255; + Projectile.penetrate = 3; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 600; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; + DrawOriginOffsetY = -10; + } + + public override bool PreAI() + { + if (Projectile.alpha > 0) + { + Projectile.alpha -= 80; + if (Projectile.alpha < 0) + Projectile.alpha = 0; + } + + float xVel = Projectile.ai[0]; + float yVel = Projectile.ai[1]; + if (xVel == 0f && yVel == 0f) + xVel = 1f; + float dist = MathF.Sqrt(xVel * xVel + yVel * yVel); + dist = 4f / dist; + xVel *= dist; + yVel *= dist; + + if (Projectile.alpha < 70) + { + Dust dust = Dust.NewDustDirect(Projectile.position - Vector2.UnitY * 2f, 7, 7, DustID.SpectreStaff, Projectile.velocity.X, Projectile.velocity.Y, Scale: 1.15f); + dust.noGravity = true; + dust.velocity *= 0.3f; + dust.position.X -= xVel; + dust.position.Y -= yVel; + dust.velocity.X -= xVel; + dust.velocity.Y -= yVel; + } + + if (Projectile.localAI[0] == 0f) + { + Projectile.ai[0] = Projectile.velocity.X; + Projectile.ai[1] = Projectile.velocity.Y; + + if (Projectile.localAI[1] == 1f) + { + Projectile.velocity.Y += 0.09f; + if (Projectile.velocity.Y > 16f) + Projectile.velocity.Y = 16f; + } + } + else + { + if (!Collision.SolidCollision(Projectile.position, Projectile.width, Projectile.height)) + { + Projectile.localAI[0] = 0f; + Projectile.localAI[1] = 1f; + } + + Projectile.damage = 0; + } + Projectile.rotation = MathF.Atan2(Projectile.ai[1], Projectile.ai[0]) + MathHelper.PiOver2; + + return false; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), Main.rand.NextBool(3) ? 600 : 300); + } +} diff --git a/Projectiles/Ranged/SpectralFlare.png b/Projectiles/Ranged/SpectralFlare.png new file mode 100644 index 0000000000..ecba14a897 Binary files /dev/null and b/Projectiles/Ranged/SpectralFlare.png differ diff --git a/Projectiles/Ranged/SpectralstormCannonHoldout.cs b/Projectiles/Ranged/SpectralstormCannonHoldout.cs new file mode 100644 index 0000000000..4f3e4e59d9 --- /dev/null +++ b/Projectiles/Ranged/SpectralstormCannonHoldout.cs @@ -0,0 +1,205 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Rogue; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Utilities; +using System; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Ranged +{ + public class SpectralstormCannonHoldout : BaseGunHoldoutProjectile + { + public override int AssociatedItemID => ModContent.ItemType(); + public override float MaxOffsetLengthFromArm => 16f; + public override float BaseOffsetY => -5f; + public override float OffsetYDownwards => 5f; + public override Vector2 GunTipPosition => Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation) * Projectile.width * 0.35f; + + public static readonly SoundStyle OverheatSound = new SoundStyle("CalamityMod/Sounds/Custom/AbilitySounds/OmegaBlueAbility") with { Pitch = -0.5f }; + public SlotId WarningSlot; + public ref float Timer => ref Projectile.ai[0]; + public ref float SoulTimer => ref Projectile.ai[1]; + private int BuiltHeat => (Owner.ActiveItem().ModItem as SpectralstormCannon).BuiltUpHeat; + private bool displayOverheat = false; + private const int WarningTime = SpectralstormCannon.OverheatLevel - 100; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.Ranged; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 15; + } + public override void KillHoldoutLogic() + { + // What kills the holdout: + // Dead, CCed, Cursed, etc. + // Not holding the item + // Right-clicking (Can kill it early) (Does not work if in overheat state) + // Completely cooling while not firing + if (Owner.CantUseHoldout(false) || HeldItem.type != Owner.ActiveItem().type || + (Owner.Calamity().mouseRight && !displayOverheat) || (BuiltHeat == 0 && !Main.mouseLeft)) + { + if (SoundEngine.TryGetActiveSound(WarningSlot, out var warn)) + warn.Stop(); + + Projectile.Kill(); + } + } + + public override void HoldoutAI() + { + // Timer should only increment while firing and not overheated + if (Owner.Calamity().flareGunOverheat == 0) + { + if (Main.mouseLeft) + { + Timer++; + SoulTimer = 0; + } + else + { + Timer = 0; + SoulTimer++; + } + } + else + { + Timer = 0; + SoulTimer = 0; + } + + // Once holding the fire button down long enough, start actually firing + if (Timer >= 30) + { + // For some reason using ActiveItem() here breaks its functionality while being held on the cursor + (Owner.HeldItem.ModItem as SpectralstormCannon).BuiltUpHeat++; + + // Overheat yourself if you fire too long + if (BuiltHeat >= SpectralstormCannon.OverheatLevel) + { + WarningSlot = SoundEngine.PlaySound(OverheatSound, Owner.Center); + for (int e = 0; e < 7; e++) + { + Vector2 dustVel = -Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.Pi * 0.15f) * Main.rand.NextFloat(3.8f, 5.5f); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.Flare, dustVel, Scale: 1.5f); + dust.noGravity = true; + } + + // Overheat damage ignores defense and is undodgeable, also inflicts Nightwither + Owner.Hurt(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.FlareGunOverheat").ToNetworkText(Owner.name)), SpectralstormCannon.OverheatDamage, 1, dodgeable: false, scalingArmorPenetration: 1f, knockback: 0f); + Owner.AddBuff(ModContent.BuffType(), SpectralstormCannon.OverheatCooldown); + Owner.Calamity().flareGunOverheat = SpectralstormCannon.OverheatCooldown; + displayOverheat = true; + // Spectralstorm Cannon's overheat immediately resets heat after triggered + (Owner.HeldItem.ModItem as SpectralstormCannon).BuiltUpHeat = 1; + + // Spawn a burst of souls on overheat + if (Main.myPlayer == Projectile.owner) + { + for (int i = 0; i < 25; i++) + { + Vector2 soulVel = Main.rand.NextVector2CircularEdge(1f, 1f) * Main.rand.NextFloat(4f, 7.5f); + Projectile soul = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, soulVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.15f), 0f, Projectile.owner); + soul.timeLeft = 250; + soul.DamageType = DamageClass.Ranged; + soul.frame = Main.rand.Next(4); + } + } + return; + } + + // Play a warning sound + if (BuiltHeat == WarningTime) + { + WarningSlot = SoundEngine.PlaySound(FirestormCannonHoldout.WarningSound, Owner.Center); + } + + // Controls the escalating firing speed + float firingLerp = Utils.GetLerpValue(0, 90, Timer - 30, true); + int firingFrequency = (int)MathHelper.Lerp(HeldItem.useTime, HeldItem.useTime / 2, firingLerp); + // Actually fire shtuff + if (Timer % firingFrequency == 0) + { + SoundEngine.PlaySound(SoundID.Item11 with { Volume = 0.8f }, Owner.Center); + if (Main.myPlayer == Projectile.owner) + { + Owner.PickAmmo(HeldItem, out _, out _, out _, out _, out _, Main.rand.Next(100) >= 70); + Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.Pi * 0.015f * (1f + firingLerp * 0.25f)) * Owner.ActiveItem().shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } + } + } + + // Fire souls while dissipating heat + if (SoulTimer % 8 == 4f) + { + if (SoulTimer % 16 == 4f) + SoundEngine.PlaySound(SoundID.Item103 with { Volume = 0.7f }, Owner.Center); + if (Main.myPlayer == Projectile.owner) + { + Vector2 velocity = Projectile.velocity.RotatedByRandom(MathHelper.Pi * 0.03f) * Owner.ActiveItem().shootSpeed * 0.8f; + Projectile soul = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), GunTipPosition, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 2f); + soul.DamageType = DamageClass.Ranged; + soul.frame = Main.rand.Next(4); + } + } + + // Reset overheat draw color once the overheat ends + if (Owner.Calamity().flareGunOverheat == 0) + displayOverheat = false; + // Draw smoke effect while overheated + if (displayOverheat && Main.rand.NextBool(3)) + { + HeavySmokeParticle smoke = new(GunTipPosition, -Vector2.UnitY * 7.5f, Color.DarkCyan, 25, 0.4f, 0.75f); + GeneralParticleHandler.SpawnParticle(smoke); + } + // Constantly move the warning sound on top of the player + if (SoundEngine.TryGetActiveSound(WarningSlot, out var warning) && warning.IsPlaying) + warning.Position = Projectile.Center; + } + + // Pan-searing mechanic; reduces heat a bit + public override bool? CanDamage() => BuiltHeat >= 120 && Owner.Calamity().flareGunOverheat == 0; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(BuffID.OnFire3, 300); + (Owner.HeldItem.ModItem as SpectralstormCannon).BuiltUpHeat -= 6; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D texture = TextureAssets.Projectile[Type].Value; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + float drawRotation = Projectile.rotation + (Projectile.spriteDirection == -1 ? MathHelper.Pi : 0f); + Vector2 rotationPoint = texture.Size() * 0.5f; + SpriteEffects flipSprite = (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Color tintColor = displayOverheat ? Color.Black : + BuiltHeat >= WarningTime ? Color.Lerp(Color.LightSalmon, Color.White, MathF.Abs(MathF.Sin(Owner.miscCounter * MathHelper.Pi / 30f))) : Color.LightSalmon; + float opacity = Utils.GetLerpValue(0, WarningTime, BuiltHeat, true); + + Projectile.DrawBackglow(Color.HotPink * opacity, 4f, null, null, (Projectile.spriteDirection * Owner.gravDir == -1) ? SpriteEffects.FlipVertically : SpriteEffects.None); + + CalamityUtils.EnterShaderRegion(Main.spriteBatch); + GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity((displayOverheat ? 1f : opacity) * 0.45f); + GameShaders.Misc["CalamityMod:BasicTint"].UseColor(tintColor); + GameShaders.Misc["CalamityMod:BasicTint"].Apply(); + + Main.EntitySpriteDraw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), drawRotation, rotationPoint, Projectile.scale * Owner.gravDir, flipSprite); + CalamityUtils.ExitShaderRegion(Main.spriteBatch); + return false; + } + } +} diff --git a/Projectiles/Ranged/SpeedBlasterShot.cs b/Projectiles/Ranged/SpeedBlasterShot.cs index 25f6e366d2..5a942152a9 100644 --- a/Projectiles/Ranged/SpeedBlasterShot.cs +++ b/Projectiles/Ranged/SpeedBlasterShot.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 2; Projectile.timeLeft = 150 * Projectile.MaxUpdates; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } diff --git a/Projectiles/Ranged/SproutingArrowMain.cs b/Projectiles/Ranged/SproutingArrowMain.cs index 4857e9db0d..af42a4fbfc 100644 --- a/Projectiles/Ranged/SproutingArrowMain.cs +++ b/Projectiles/Ranged/SproutingArrowMain.cs @@ -30,7 +30,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 80; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.ArmorPenetration = 8; Projectile.tileCollide = false; } @@ -59,7 +58,7 @@ namespace CalamityMod.Projectiles.Ranged float blastSize = 45; float minMultiplier = 0.4f; int hitsToMinMult = 4; - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), 0, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0, Projectile.owner, blastSize, minMultiplier, hitsToMinMult); blast.DamageType = DamageClass.Ranged; blast.ArmorPenetration = 8; @@ -97,7 +96,7 @@ namespace CalamityMod.Projectiles.Ranged GeneralParticleHandler.SpawnParticle(sparker); Projectile split1 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel1 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); Projectile split2 = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, vel2 * Main.rand.NextFloat(0.95f, 1.05f), ModContent.ProjectileType(), Projectile.damage * 2, 0f, Projectile.owner, 0f, hitDirect ? 1f : 0f); - if (Projectile.Calamity().conditionalHomingRange > 0f) // Allows the split arrows to home when using Arterial Assault as well + if (Projectile.Calamity().conditionalHomingRange > 0f) // Allows the split arrows to home if the main arrow homes { split1.Calamity().conditionalHomingRange = Projectile.Calamity().conditionalHomingRange; split2.Calamity().conditionalHomingRange = Projectile.Calamity().conditionalHomingRange; diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs deleted file mode 100644 index 304bdf7b2b..0000000000 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ /dev/null @@ -1,140 +0,0 @@ -using System; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.Localization; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Ranged -{ - public class StarfleetMK2Gun : ModProjectile - { - public override LocalizedText DisplayName => CalamityUtils.GetItemName(); - public override string Texture => "CalamityMod/Items/Weapons/Ranged/Starmada"; - - public override void SetDefaults() - { - Projectile.width = 122; - Projectile.height = 50; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.DamageType = DamageClass.Ranged; - Projectile.ignoreWater = true; - } - - public override void AI() - { - Lighting.AddLight(Projectile.Center, 32f / 255f, 208f / 255f, 255f / 255f); - Player player = Main.player[Projectile.owner]; - Projectile.ai[1]--; - if (Projectile.ai[0] >= 0f) - { - Projectile.ai[0] += 1f; - switch ((int)Projectile.ai[0]) - { - case 90: - case 180: - case 270: - case 360: - case 450: - Projectile.localAI[0] += 1f; - break; - case 540: - Projectile.localAI[0] += 1f; - Projectile.ai[0] = -1f; - SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int dustAmt = 36; - for (int d = 0; d < dustAmt; d++) - { - Vector2 source = Vector2.Normalize(Projectile.velocity) * 9f; - source = source.RotatedBy((d - (dustAmt / 2 - 1)) * MathHelper.TwoPi / dustAmt, default) + player.Center; - Vector2 dustVel = source - player.Center; - int index = Dust.NewDust(source + dustVel, 0, 0, DustID.FireworkFountain_Blue, 0f, 0f, 0, default, 4f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity = dustVel; - } - break; - } - } - int baseUseTime = 27; //Ranges from 27 to 15 use time - int modifier = 2; - bool timeToFire = false; - if (Projectile.ai[1] <= 0f) - { - Projectile.ai[1] = baseUseTime - modifier * Projectile.localAI[0]; - timeToFire = true; - } - bool canFire = !player.CantUseHoldout() && player.HasAmmo(player.ActiveItem()); - if (Projectile.soundDelay <= 0 && canFire) - { - Projectile.soundDelay = baseUseTime - modifier * (int)Projectile.localAI[0]; - if (Projectile.ai[0] != 1f) - SoundEngine.PlaySound(SoundID.Item92, Projectile.Center); - } - if (timeToFire && Main.myPlayer == Projectile.owner) - { - if (canFire) - { - int type = ProjectileID.StarCannonStar; - float shootSpeed = 16f; - int damage = player.GetWeaponDamage(player.ActiveItem()); - float knockBack = player.ActiveItem().knockBack; - player.PickAmmo(player.ActiveItem(), out type, out shootSpeed, out damage, out knockBack, out _); - for (int i = 0; i < 5; i++) - { - knockBack = player.GetWeaponKnockback(player.ActiveItem(), knockBack); - Vector2 playerPosition = player.RotatedRelativePoint(player.MountedCenter, true); - Projectile.velocity = Main.screenPosition - playerPosition; - Projectile.velocity.X += Main.mouseX; - Projectile.velocity.Y += Main.mouseY; - if (player.gravDir == -1f) - Projectile.velocity.Y = Main.screenHeight - Main.mouseY + Main.screenPosition.Y - playerPosition.Y; - Projectile.velocity.Normalize(); - float variation = (1f + Projectile.localAI[0]) * 3f; - Vector2 position = playerPosition + Utils.RandomVector2(Main.rand, -variation, variation); - Vector2 speed = Projectile.velocity * shootSpeed * Main.rand.NextFloat(0.6f, 1.2f); - type = Utils.SelectRandom(Main.rand, new int[] - { - ModContent.ProjectileType(), - ModContent.ProjectileType(), - ProjectileID.StarCannonStar, - ProjectileID.Starfury - }); - int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, damage, knockBack, Projectile.owner); - if (star.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[star].penetrate = 1; - Main.projectile[star].timeLeft = 300; - Main.projectile[star].DamageType = DamageClass.Ranged; - Main.projectile[star].netUpdate = true; - } - Projectile.netUpdate = true; - } - } - else - { - Projectile.Kill(); - } - } - Projectile.rotation = Projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(27f, -10f * Projectile.direction).RotatedBy(Projectile.rotation); - Projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; - if (Projectile.spriteDirection == -1) - Projectile.rotation += MathHelper.Pi; - Projectile.spriteDirection = Projectile.direction; - Projectile.timeLeft = 2; - player.ChangeDir(Projectile.direction); - player.heldProj = Projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2(Projectile.velocity.Y * Projectile.direction, Projectile.velocity.X * Projectile.direction); - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Ranged/StarmageddonStar.cs b/Projectiles/Ranged/StarmageddonStar.cs index 1f37ecea6d..207cf9d1f4 100644 --- a/Projectiles/Ranged/StarmageddonStar.cs +++ b/Projectiles/Ranged/StarmageddonStar.cs @@ -134,21 +134,31 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[starDust].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[starDust].position) * 1.25f; } - int type = Utils.SelectRandom(Main.rand, new int[] - { + int type = Utils.SelectRandom(Main.rand, + [ ModContent.ProjectileType(), ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury - }); + ]); - int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile starCenter = Projectile; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) + { + starCenter = p; + break; + } + } + Vector2 predictSpeed = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, Main.npc[(int)starCenter.ai[2]], 12f, 5); + int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, predictSpeed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; - Main.projectile[star].extraUpdates += 4; + Main.projectile[star].extraUpdates = 4; Main.projectile[star].penetrate = 1; Main.projectile[star].timeLeft = 300; Main.projectile[star].DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/StarmageddonStar2.cs b/Projectiles/Ranged/StarmageddonStar2.cs index 99b8d1a175..be24aa193a 100644 --- a/Projectiles/Ranged/StarmageddonStar2.cs +++ b/Projectiles/Ranged/StarmageddonStar2.cs @@ -134,21 +134,31 @@ namespace CalamityMod.Projectiles.Ranged Main.dust[starDust].velocity = Vector2.Normalize(position - speed * 3f - Main.dust[starDust].position) * 1.25f; } - int type = Utils.SelectRandom(Main.rand, new int[] - { + int type = Utils.SelectRandom(Main.rand, + [ ModContent.ProjectileType(), ModContent.ProjectileType(), ProjectileID.StarCannonStar, ProjectileID.Starfury - }); + ]); - int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, speed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); + Projectile starCenter = Projectile; + foreach (Projectile p in Main.ActiveProjectiles) + { + if (p.type == ModContent.ProjectileType() && p.owner == Projectile.owner) + { + starCenter = p; + break; + } + } + Vector2 predictSpeed = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(position, Main.npc[(int)starCenter.ai[2]], 12f, 5); + int star = Projectile.NewProjectile(Projectile.GetSource_FromThis(), position, predictSpeed, type, Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (star.WithinBounds(Main.maxProjectiles)) { if (type == ModContent.ProjectileType() || type == ModContent.ProjectileType()) Main.projectile[star].ai[0] = 1f; - Main.projectile[star].extraUpdates += 4; + Main.projectile[star].extraUpdates = 4; Main.projectile[star].penetrate = 1; Main.projectile[star].timeLeft = 300; Main.projectile[star].DamageType = DamageClass.Ranged; diff --git a/Projectiles/Ranged/SuperradiantBolt.cs b/Projectiles/Ranged/SuperradiantBolt.cs index 2ba1733524..e3eb6e744b 100644 --- a/Projectiles/Ranged/SuperradiantBolt.cs +++ b/Projectiles/Ranged/SuperradiantBolt.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 20); Texture2D glow = TextureAssets.Projectile[Type].Value; Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, glow.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Ranged/SuperradiantSaw.cs b/Projectiles/Ranged/SuperradiantSaw.cs index b6e808d15f..6099118d71 100644 --- a/Projectiles/Ranged/SuperradiantSaw.cs +++ b/Projectiles/Ranged/SuperradiantSaw.cs @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; // Saws only pierce a certain number of times before returning, and don't deal direct damage while returning Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() @@ -243,7 +242,10 @@ namespace CalamityMod.Projectiles.Ranged PierceBeforeReturn--; Projectile.numHits++; if (PierceBeforeReturn <= 0) + { + Projectile.localNPCHitCooldown = 20; Returning = true; + } } return false; @@ -290,15 +292,18 @@ namespace CalamityMod.Projectiles.Ranged { PierceBeforeReturn--; if (PierceBeforeReturn <= 0) + { + Projectile.localNPCHitCooldown = 20; Returning = true; + } } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { // The saw deals less damage while returning, to prevent its damage being too crazy - if (PierceBeforeReturn <= 0) - modifiers.SourceDamage *= 0.33f; + // The saw also deals less damage while homing + modifiers.SourceDamage *= Returning ? 0.2f : Empowered ? 0.75f : 1f; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/SuperradiantSawLingering.cs b/Projectiles/Ranged/SuperradiantSawLingering.cs index 2397d1ca85..3b2f14b333 100644 --- a/Projectiles/Ranged/SuperradiantSawLingering.cs +++ b/Projectiles/Ranged/SuperradiantSawLingering.cs @@ -40,7 +40,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs index 24ba2a20b3..ae4ec09ad5 100644 --- a/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs +++ b/Projectiles/Ranged/SuperradiantSlaughtererHoldout.cs @@ -59,7 +59,7 @@ namespace CalamityMod.Projectiles.Ranged public override void KillHoldoutLogic() { - if (HeldItem.type != Owner.ActiveItem().type) + if (HeldItem.type != Owner.ActiveItem().type || Owner.dead || !Owner.active) { Projectile.Kill(); Projectile.netUpdate = true; @@ -74,44 +74,42 @@ namespace CalamityMod.Projectiles.Ranged if (SoundEngine.TryGetActiveSound(ChargeIdle, out var Idle) && Idle.IsPlaying) Idle.Position = GunTipPosition; - // Handle the right-click dash (holds priority over left-click) + // Handle the right-click dash (only works when not used from left-click) if (Owner.Calamity().mouseRight && !Owner.HasCooldown(SuperradiantSawBoost.ID)) { - Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown); - Owner.Calamity().sBlasterDashActivated = true; - SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); - - // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) - float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); - float adjustedMouseDist = clampedMouseDist / 21f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); - - // Special case: right-clicking while not holding left-click - // This is to keep it friendly to use both fires at the same time, but end the animation early if not if (Projectile.ai[1] >= 2f) { + Owner.AddCooldown(SuperradiantSawBoost.ID, SuperradiantSlaughterer.DashCooldown); + SoundEngine.PlaySound(new SoundStyle("CalamityMod/Sounds/Custom/MeatySlash"), GunTipPosition); + + // Throws a lingering saw at the cursor that deals 3x damage (since the holdout already deals 2x) + float clampedMouseDist = MathHelper.Clamp(Vector2.Distance(GunTipPosition, Owner.Calamity().mouseWorld), 0f, 960f); + float adjustedMouseDist = clampedMouseDist / 21f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), GunTipPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * adjustedMouseDist, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5f), Projectile.knockBack, Projectile.owner); + + // End animation early NoSawOnHoldout = true; OffsetLengthFromArm -= 16f; Projectile.timeLeft = Owner.ActiveItem().useAnimation; KeepRefreshingLifetime = false; Idle?.Stop(); - } - // If moving, make particle effects when the dash activates - if (Owner.velocity != Vector2.Zero) - { - int particleAmt = 7; - for (int c = 0; c < particleAmt; c++) + // If moving, make particle effects when the dash activates + if (Owner.velocity != Vector2.Zero) { - Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1)); - Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f); - GeneralParticleHandler.SpawnParticle(spark); - } - for (int e = 0; e < particleAmt * 2; e++) - { - Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1)); - Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3)); - GeneralParticleHandler.SpawnParticle(spark2); + int particleAmt = 7; + for (int c = 0; c < particleAmt; c++) + { + Color sparkColor = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), c / (particleAmt - 1)); + Particle spark = new CritSpark(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(13f)) * Main.rand.NextFloat(-2.1f, -4.5f), Color.White, sparkColor, 2f, 45, 2.25f, 2f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int e = 0; e < particleAmt * 2; e++) + { + Color sparkColor2 = Color.Lerp(new Color(122, 240, 58), new Color(32, 186, 171), e / (particleAmt - 1)); + Particle spark2 = new NanoParticle(Owner.Center, Owner.velocity.RotatedByRandom(MathHelper.ToRadians(-MathHelper.PiOver4)) * Main.rand.NextFloat(2.5f, 4.5f), sparkColor2, 1f, 45, Main.rand.NextBool(3)); + GeneralParticleHandler.SpawnParticle(spark2); + } } } } diff --git a/Projectiles/Ranged/TelluricGlareArrow.cs b/Projectiles/Ranged/TelluricGlareArrow.cs index 5e6bb758a4..ad3d462b5e 100644 --- a/Projectiles/Ranged/TelluricGlareArrow.cs +++ b/Projectiles/Ranged/TelluricGlareArrow.cs @@ -43,7 +43,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = -1; // Can hit many enemies. Will explode extremely soon after hitting the first, though. Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool? CanDamage() => (Projectile.timeLeft < Lifetime - 4) ? null : false; @@ -167,7 +166,7 @@ namespace CalamityMod.Projectiles.Ranged public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); Vector2 overallOffset = Projectile.Size * 0.5f; overallOffset += Projectile.velocity * 1.4f; int numPoints = 92; diff --git a/Projectiles/Ranged/TheMaelstromShark.cs b/Projectiles/Ranged/TheMaelstromShark.cs index a9a4037ffe..5d9614fdd9 100644 --- a/Projectiles/Ranged/TheMaelstromShark.cs +++ b/Projectiles/Ranged/TheMaelstromShark.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.extraUpdates = 1; Projectile.Opacity = 0f; Projectile.DamageType = DamageClass.Ranged; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index c9daab4596..2ffa5f2ab5 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Ranged // 15NOV2024: Ozzatron: clamped mouse position unnecessary. All uses are direction only. public Vector2 MousePosition => Owner.Calamity().mouseWorld - Owner.MountedCenter; - public const float WeaponLength = 52f; + public const float WeaponLength = 62f; public const float MaxSightAngle = MathHelper.Pi * (2f / 3f); public Color ScopeColor => Color.White; diff --git a/Projectiles/Ranged/TorrentialArrow.cs b/Projectiles/Ranged/TorrentialArrow.cs index 885533921d..648535d215 100644 --- a/Projectiles/Ranged/TorrentialArrow.cs +++ b/Projectiles/Ranged/TorrentialArrow.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 10; Projectile.arrow = true; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/ToxicArrow.cs b/Projectiles/Ranged/ToxicArrow.cs index e010f3eb95..42160ce9af 100644 --- a/Projectiles/Ranged/ToxicArrow.cs +++ b/Projectiles/Ranged/ToxicArrow.cs @@ -19,7 +19,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 240; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/TyphoonArrow.cs b/Projectiles/Ranged/TyphoonArrow.cs index 0c15bffcfa..03721e4fec 100644 --- a/Projectiles/Ranged/TyphoonArrow.cs +++ b/Projectiles/Ranged/TyphoonArrow.cs @@ -17,7 +17,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.aiStyle = ProjAIStyleID.Arrow; Projectile.timeLeft = 600; AIType = ProjectileID.WoodenArrowFriendly; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/UltimaBolt.cs b/Projectiles/Ranged/UltimaBolt.cs index 2c321b7ad7..20dde73355 100644 --- a/Projectiles/Ranged/UltimaBolt.cs +++ b/Projectiles/Ranged/UltimaBolt.cs @@ -31,7 +31,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.arrow = true; Projectile.penetrate = 1; Projectile.timeLeft = 300; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/UniversalGenesisStar.cs b/Projectiles/Ranged/UniversalGenesisStar.cs index 9eabd1a422..decaa24f1d 100644 --- a/Projectiles/Ranged/UniversalGenesisStar.cs +++ b/Projectiles/Ranged/UniversalGenesisStar.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 180; Projectile.extraUpdates = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Ranged/UniversalGenesisStarcaller.cs b/Projectiles/Ranged/UniversalGenesisStarcaller.cs index fc22e9fde8..a2f2483888 100644 --- a/Projectiles/Ranged/UniversalGenesisStarcaller.cs +++ b/Projectiles/Ranged/UniversalGenesisStarcaller.cs @@ -26,7 +26,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.timeLeft = 600; Projectile.extraUpdates = 1; AIType = ProjectileID.Bullet; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() @@ -77,15 +76,11 @@ namespace CalamityMod.Projectiles.Ranged public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - SpawnStars(); - } - - private void SpawnStars() - { - // The patron said 10 blocks, but 10 blocks is like nothing... I'm sure they won't mind. + // The patron said 10 blocks, but 10 blocks is like nothing... I'm sure they won't mind int maxDistance = 480; // 30 blocks bool bossFound = false; int life = 0; + int index = -1; Vector2 targetVec = Projectile.Center; foreach (NPC npc in Main.ActiveNPCs) { @@ -94,7 +89,7 @@ namespace CalamityMod.Projectiles.Ranged if (npc.CanBeChasedBy(Projectile, false)) { float extraDist = (npc.width / 2) + (npc.height / 2); - //Calculate distance between target and the projectile to know if it's too far or not + // Calculate distance between target and the projectile to know if it's too far or not float targetDist = Vector2.Distance(npc.Center, Projectile.Center); if (targetDist < (maxDistance + extraDist) && (npc.IsABoss() || npc.life > life)) { @@ -102,16 +97,15 @@ namespace CalamityMod.Projectiles.Ranged bossFound = true; life = npc.life; targetVec = npc.Center; + index = npc.whoAmI; } } } - var source = Projectile.GetSource_FromThis(); - for (int n = 0; n < 2; n++) - { - Projectile star = CalamityUtils.ProjectileRain(source, targetVec, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner); - star.ai[0] = n; - } + Vector2 spawnPos = targetVec - new Vector2(Main.rand.NextFloat(-300f, 300f), Main.rand.NextFloat(500f, 800f)); + Vector2 velocity = index == -1 ? Utils.DirectionTo(spawnPos, Projectile.Center) * 29f : CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, Main.npc[index], 29f, 2); + velocity.X += Main.rand.NextFloat(-1f, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.65f), Projectile.knockBack, Projectile.owner); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Ranged/VanquisherArrowProj.cs b/Projectiles/Ranged/VanquisherArrowProj.cs index 30c1d474cd..31f5215ec9 100644 --- a/Projectiles/Ranged/VanquisherArrowProj.cs +++ b/Projectiles/Ranged/VanquisherArrowProj.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Dusts; +using CalamityMod.Graphics.Metaballs; using CalamityMod.Items.Ammo; using CalamityMod.Particles; using CalamityMod.Projectiles.Typeless; @@ -26,6 +27,8 @@ namespace CalamityMod.Projectiles.Ranged public float HomingTime = 0; public Color MainColor; public NPC targeted; + public int rotDir = 0; + public float rotSpeed = 0; public override void SetStaticDefaults() { ProjectileID.Sets.CultistIsResistantTo[Type] = true; @@ -43,7 +46,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 2; Projectile.timeLeft = 600; Projectile.extraUpdates = 7; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 15 * Projectile.extraUpdates; } @@ -64,6 +66,8 @@ namespace CalamityMod.Projectiles.Ranged if (Time == 0) { + rotDir = (Main.rand.NextBool() ? -1 : 1); + rotSpeed = Main.rand.NextFloat(0.8f, 1.1f); Projectile.scale = 0.014f; Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f; ProjectileSpeed = 30; @@ -96,41 +100,27 @@ namespace CalamityMod.Projectiles.Ranged { Projectile.timeLeft++; CalamityUtils.HomeInOnSelectedNPC(Projectile, targeted, true, 0.65f, 7, 0.98f, 0.95f, true); - //CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 12, 200f); } else if (Projectile.velocity.Length() < 7) Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.UnitX) * 7f, 0.04f); if (HomingTime > 1) { HomingTime--; - Projectile.velocity = Projectile.velocity.RotatedByRandom(0.09f); + Projectile.velocity = Projectile.velocity.RotatedBy(0.2f * rotDir * rotSpeed * Utils.GetLerpValue(15, 5, HomingTime, true)); } Time++; } - - public override void PostDraw(Color lightColor) - { - //Color color = Color.White; - //Rectangle frame = new Rectangle(0, 0, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Width, Terraria.GameContent.TextureAssets.Projectile[Type].Value.Height); - //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Ammo/VanquisherArrowGlow").Value, Projectile.Center - Main.screenPosition, frame, color, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); - } - - public override Color? GetAlpha(Color lightColor) - { - return lightColor; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - HomingTime = Main.rand.Next(10, 20 + 1) * Projectile.extraUpdates; + HomingTime = Main.rand.Next(12, 15 + 1) * Projectile.extraUpdates; target.AddBuff(ModContent.BuffType(), 180); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - // First hit is 30% damage + // First hit is 40% damage // Second hit is 100% base damage, it is the "Slash Hit" - modifiers.SourceDamage *= (Projectile.numHits == 0 ? 0.3f : 1f); + modifiers.SourceDamage *= (Projectile.numHits == 0 ? 0.4f : 1f); if (Projectile.damage < 1) Projectile.damage = 1; } diff --git a/Projectiles/Ranged/VeriumBoltProj.cs b/Projectiles/Ranged/VeriumBoltProj.cs index 3c62464ca2..8e2d75014e 100644 --- a/Projectiles/Ranged/VeriumBoltProj.cs +++ b/Projectiles/Ranged/VeriumBoltProj.cs @@ -29,7 +29,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Ranged/VernalBolt.cs b/Projectiles/Ranged/VernalBolt.cs index f548e85826..2cd58bc842 100644 --- a/Projectiles/Ranged/VernalBolt.cs +++ b/Projectiles/Ranged/VernalBolt.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.penetrate = 1; Projectile.extraUpdates = 1; Projectile.timeLeft = 180; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Ranged/VoidragonTentacle.cs b/Projectiles/Ranged/VoidragonTentacle.cs index cf7887c1db..5b41a1d3d8 100644 --- a/Projectiles/Ranged/VoidragonTentacle.cs +++ b/Projectiles/Ranged/VoidragonTentacle.cs @@ -24,7 +24,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.MaxUpdates = 3; Projectile.DamageType = DamageClass.Ranged; Projectile.extraUpdates = 1; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override void AI() diff --git a/Projectiles/Rogue/AuroradicalStar.cs b/Projectiles/Rogue/AuroradicalStar.cs index ce88e9d5ee..636d1ed595 100644 --- a/Projectiles/Rogue/AuroradicalStar.cs +++ b/Projectiles/Rogue/AuroradicalStar.cs @@ -12,11 +12,11 @@ namespace CalamityMod.Projectiles.Rogue public class AuroradicalStar : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - public int[] dustTypes = new int[] - { + public int[] dustTypes = + [ ModContent.DustType(), ModContent.DustType() - }; + ]; public override void SetStaticDefaults() { @@ -107,39 +107,26 @@ namespace CalamityMod.Projectiles.Rogue } } - public override bool PreDraw(ref Color lightColor) - { - CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - return false; - } - - public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffect(target.Center, target.width); + OnHitEffect(target); } - - private void OnHitEffect(Vector2 targetPos, int width) - { - if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) - { - Vector2 pos = new Vector2(targetPos.X + width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (targetPos - pos) / 40f; - int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25), Projectile.knockBack, Projectile.owner); - if (comet.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[comet].DamageType = RogueDamageClass.Instance; - Main.projectile[comet].Calamity().lineColor = Main.rand.Next(3); - } - } - } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 180); - OnHitEffect(target.Center, target.width); + OnHitEffect(target); + } + private void OnHitEffect(Entity target) + { + if (Projectile.Calamity().stealthStrike && Main.myPlayer == Projectile.owner) + { + Vector2 pos = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 meteorVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 20f, 3); + int comet = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, meteorVel, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), Projectile.knockBack, Projectile.owner); + if (comet.WithinBounds(Main.maxProjectiles)) + Main.projectile[comet].DamageType = RogueDamageClass.Instance; + } } public override void OnKill(int timeLeft) @@ -166,5 +153,12 @@ namespace CalamityMod.Projectiles.Rogue } } } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); + return false; + } + public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, Projectile.alpha); } } diff --git a/Projectiles/Rogue/BallisticPoisonBombProj.cs b/Projectiles/Rogue/BallisticPoisonBombProj.cs index f4d204e888..7300ceacc7 100644 --- a/Projectiles/Rogue/BallisticPoisonBombProj.cs +++ b/Projectiles/Rogue/BallisticPoisonBombProj.cs @@ -60,10 +60,9 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.ExpandHitboxBy(128); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - int spikeAmt = Main.rand.Next(3, 4+1); if (Projectile.owner == Main.myPlayer) { - for (int s = 0; s < spikeAmt; s++) + for (int s = 0; s < 3; s++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner); @@ -72,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue for (int c = 0; c < cloudAmt; c++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 10f, 200f, 0.01f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), 0f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), 0f, Projectile.owner, 0f, Projectile.Calamity().stealthStrike ? 1f : 0f); } } for (int d = 0; d < 5; d++) @@ -99,42 +98,13 @@ namespace CalamityMod.Projectiles.Rogue Vector2 goreSource = Projectile.Center; int goreAmt = 3; Vector2 source = new Vector2(goreSource.X - 24f, goreSource.Y - 24f); - for (int goreIndex = 0; goreIndex < goreAmt; goreIndex++) + for (int goreIndex = 1; goreIndex <= goreAmt; goreIndex++) { - float velocityMult = 0.33f; - if (goreIndex < (goreAmt / 3)) - { - velocityMult = 0.66f; - } - if (goreIndex >= (2 * goreAmt / 3)) - { - velocityMult = 1f; - } - Mod mod = ModContent.GetInstance(); + float velocityMult = 0.33f * goreIndex; int type = Main.rand.Next(61, 64); - int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); + int smoke = Gore.NewGore(Projectile.GetSource_Death(), source, Main.rand.NextVector2CircularEdge(2f, 2f), type, 1f); Gore gore = Main.gore[smoke]; gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y += 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X += 1f; - gore.velocity.Y -= 1f; - type = Main.rand.Next(61, 64); - smoke = Gore.NewGore(Projectile.GetSource_Death(), source, default, type, 1f); - gore = Main.gore[smoke]; - gore.velocity *= velocityMult; - gore.velocity.X -= 1f; - gore.velocity.Y -= 1f; } } } @@ -144,7 +114,6 @@ namespace CalamityMod.Projectiles.Rogue target.AddBuff(BuffID.Venom, 180); Projectile.Kill(); } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(BuffID.Venom, 180); diff --git a/Projectiles/Rogue/BloodsoakedCrashax.cs b/Projectiles/Rogue/BloodsoakedCrashax.cs index 090ef8dd38..c9bece2786 100644 --- a/Projectiles/Rogue/BloodsoakedCrashax.cs +++ b/Projectiles/Rogue/BloodsoakedCrashax.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue else { // Gravity - Projectile.velocity.Y += 0.11f; + Projectile.velocity.Y += 0.07f; // Cap velocity. speed = Projectile.velocity.Length(); @@ -104,16 +104,14 @@ namespace CalamityMod.Projectiles.Rogue private void OnHitEffects(int damage) { - grind += 5; //THE GRIND NEVER STOPS - if (grind > 15) - grind = 15; // except when it's too much + grind += 6; //THE GRIND NEVER STOPS + if (grind > 18) + grind = 18; // except when it's too much if (Projectile.Calamity().stealthStrike && Projectile.owner == Main.myPlayer) //stealth strike attack { int projID = ModContent.ProjectileType(); - int bloodDamage = Projectile.damage; - float bloodKB = 1f; - int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi)*4f, projID, bloodDamage, bloodKB, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); + int stealth = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * 4f, projID, (int)(Projectile.damage * 0.5f), 1f, Projectile.owner, 1f, 0.85f + Main.rand.NextFloat() * 1.15f); if (stealth.WithinBounds(Main.maxProjectiles)) { Main.projectile[stealth].DamageType = RogueDamageClass.Instance; @@ -127,7 +125,7 @@ namespace CalamityMod.Projectiles.Rogue float spreadAmount = MathHelper.ToRadians(360); for (var i = 0; i < orbAmount; i++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 20, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.One.RotatedByRandom(spreadAmount) * 2f * Main.rand.NextFloat(0.75f, 1.25f), ModContent.ProjectileType(), 10, 0f, Projectile.owner); } } diff --git a/Projectiles/Rogue/BlunderBoosterLightning.cs b/Projectiles/Rogue/BlunderBoosterLightning.cs index 29bd9d4098..a22183b817 100644 --- a/Projectiles/Rogue/BlunderBoosterLightning.cs +++ b/Projectiles/Rogue/BlunderBoosterLightning.cs @@ -14,6 +14,8 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public static int frameWidth = 12; public static int frameHeight = 26; + public int dir = 0; + public float intensity = 0; public override void SetStaticDefaults() { @@ -23,15 +25,17 @@ namespace CalamityMod.Projectiles.Rogue public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = 40; + Projectile.height = 40; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.penetrate = 1; - Projectile.timeLeft = 120; + Projectile.extraUpdates = 2; + Projectile.timeLeft = 290; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15; + Projectile.localNPCHitCooldown = -1; + Projectile.ArmorPenetration = 15; } public override void AI() @@ -49,43 +53,20 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.timeLeft < 55 && Projectile.ai[1] != 1f) - { - Projectile.tileCollide = true; - } - Projectile.ai[1]++; - if (Projectile.ai[1] >= 15f) - { - float minDist = 999f; - int index = -1; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - float dist = (Projectile.Center - npc.Center).Length(); - if (dist < minDist) - { - minDist = dist; - index = npc.whoAmI; - } - } - } - Vector2 velocityNew; - if (minDist < 999f && index != -1) - { - velocityNew = Main.npc[index].Center - Projectile.Center; - velocityNew.Normalize(); - velocityNew *= 2f; - Projectile.velocity += velocityNew; - if (Projectile.velocity.Length() > 10f) - { - Projectile.velocity.Normalize(); - Projectile.velocity *= 10f; - } - } + if (dir == 0) + { + Projectile.timeLeft -= Main.rand.Next(5, 20 + 1); + dir = Main.rand.NextBool() ? -1 : 1; + intensity = Main.rand.NextFloat(0.2f, 1.2f); } + + + if (Projectile.timeLeft < 190) + CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(1500), true, 0.65f * intensity, 8, 0.98f, 0.99f, true); + else + Projectile.velocity = Projectile.velocity.RotatedBy(0.04f * dir * intensity) * Main.rand.NextFloat(0.985f, 1f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs deleted file mode 100644 index 1222796e47..0000000000 --- a/Projectiles/Rogue/CircletMark.cs +++ /dev/null @@ -1,159 +0,0 @@ -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Rogue -{ - public class CircletMark : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Rogue"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = 14; - Projectile.height = 14; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.timeLeft = 900; - Projectile.ignoreWater = true; - Projectile.alpha = 255; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - } - - public override void AI() - { - Color newColor3 = new Color(255, 255, 255); - if (Projectile.soundDelay == 0) - { - Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); - } - if (Projectile.localAI[1] < 30f) - { - for (int i = 0; i < 1; i++) - { - float lerpvalue1 = -0.5f; - float lerpvalue2 = 0.9f; - float randomLerp = Main.rand.NextFloat(); - Vector2 dustMovement = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()), MathHelper.Lerp(lerpvalue1, lerpvalue2, randomLerp)); - dustMovement.X *= MathHelper.Lerp(2.2f, 0.6f, randomLerp); - dustMovement.X *= -1f; - Vector2 dustMovement2 = new Vector2(2f, 10f); - Vector2 position4 = Projectile.Center + new Vector2(60f, 200f) * dustMovement * 0.5f + dustMovement2; - Dust dust = Main.dust[Dust.NewDust(position4, 0, 0, DustID.Sandnado, 0f, 0f, 0, default, 0.5f)]; - dust.position = position4; - dust.customData = Projectile.Center + dustMovement2; - dust.fadeIn = 1f; - dust.scale = 0.3f; - if (dustMovement.X > -1.2f) - { - dust.velocity.X = 1f + Main.rand.NextFloat(); - } - dust.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; - } - } - if (Projectile.localAI[0] == 0f) - { - Projectile.localAI[0] = 0.8f; - Projectile.direction = 1; - Point projCenter = Projectile.Center.ToTileCoordinates(); - Projectile.Center = new Vector2((float)(projCenter.X * 16 + 8), (float)(projCenter.Y * 16 + 8)); - } - Projectile.rotation = Projectile.localAI[1] / 40f * 6.28318548f * (float)Projectile.direction; - if (Projectile.localAI[1] < 33f) - { - if (Projectile.alpha > 0) - { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; - } - } - if (Projectile.localAI[1] > 103f) - { - if (Projectile.alpha < 255) - { - Projectile.alpha += 16; - } - if (Projectile.alpha > 255) - { - Projectile.alpha = 255; - } - } - if (Projectile.alpha == 0) - { - Lighting.AddLight(Projectile.Center, newColor3.ToVector3() * 0.5f); - } - for (int j = 0; j < 2; j++) - { - if (Main.rand.NextBool(10)) - { - Vector2 dustVel = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust dusty = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1f)]; - dusty.noGravity = true; - dusty.noLight = true; - dusty.scale = Projectile.Opacity * Projectile.localAI[0]; - dusty.position = Projectile.Center; - dusty.velocity = dustVel * 2.5f; - } - } - for (int k = 0; k < 2; k++) - { - if (Main.rand.NextBool(10)) - { - Vector2 dustVel2 = Vector2.UnitY.RotatedBy((double)((float)k * 3.14159274f), default); - Dust dustier = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.Sandnado, 0f, 0f, 225, newColor3, 1.5f)]; - dustier.noGravity = true; - dustier.noLight = true; - dustier.scale = Projectile.Opacity * Projectile.localAI[0]; - dustier.position = Projectile.Center; - dustier.velocity = dustVel2 * 2.5f; - } - } - if (Projectile.localAI[1] < 33f || Projectile.localAI[1] > 87f) - { - Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; - } - Projectile.velocity = Vector2.Zero; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); - } - if (Projectile.localAI[1] >= 120f) - { - Projectile.Kill(); - return; - } - } - - public override bool PreDraw(ref Color lightColor) - { - Color originalColor = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - SpriteEffects spriteEffects = SpriteEffects.None; - if (Projectile.spriteDirection == -1) - { - spriteEffects = SpriteEffects.FlipHorizontally; - } - Vector2 drawPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D27 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangle = texture2D27.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Color alphaColor = Projectile.GetAlpha(originalColor); - Vector2 origin7 = rectangle.Size() / 2f; - Color sandyColor = Main.hslToRgb(0.25f, 1f, 1f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), sandyColor, 0f, origin7, new Vector2(1f, 5f) * Projectile.scale * 2f, spriteEffects, 0); - Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, Projectile.rotation, origin7, Projectile.scale, spriteEffects, 0); - Main.spriteBatch.Draw(texture2D27, drawPos, new Microsoft.Xna.Framework.Rectangle?(rectangle), alphaColor, 0f, origin7, new Vector2(1f, 8f) * Projectile.scale, spriteEffects, 0); - return false; - } - } -} diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 8ea5f2ff63..4ac2eb94bf 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -12,165 +12,121 @@ namespace CalamityMod.Projectiles.Rogue public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Projectiles/TornadoProj"; + public static float Lifetime = 900f; + public static float Fadetime = 120f; + + public ref float Time => ref Projectile.ai[0]; + public override void SetDefaults() { - Projectile.width = 10; - Projectile.height = 10; + Projectile.width = Projectile.height = 10; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.minion = true; Projectile.penetrate = -1; - Projectile.timeLeft = 1200; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 30; } public override void AI() { - //only 1 tornado can exist at a time - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 10f) - { - Projectile.localAI[1] = 0f; - int projCount = 0; - int oldestTornado = 0; - float tornadoAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) - { - projCount++; - if (proj.ai[0] > tornadoAge) - { - oldestTornado = projIndex; - tornadoAge = proj.ai[0]; - } - } - } - if (projCount > 1) - { - Main.projectile[oldestTornado].netUpdate = true; - Main.projectile[oldestTornado].ai[0] = 36000f; - return; - } - } - - float lifeSpan = 900f; if (Projectile.soundDelay == 0) { Projectile.soundDelay = -1; - SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item82, Projectile.Center); } - Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= lifeSpan) - { + + Time++; + if (Time >= Lifetime) Projectile.Kill(); - } - if (Projectile.localAI[0] >= 30f) + if (Projectile.numHits >= 30) { Projectile.damage = 0; - if (Projectile.ai[0] < lifeSpan - 120f) + if (Time < Lifetime - Fadetime) { - float aiDecrement = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + aiDecrement; + Time = Lifetime - Fadetime + Time % 60f; Projectile.netUpdate = true; } } - Point point8 = Projectile.Center.ToTileCoordinates(); - int sizeMod; - int sizeMod2; - Collision.ExpandVertically(point8.X, point8.Y, out sizeMod, out sizeMod2, 15, 15); - sizeMod++; - sizeMod2--; - Vector2 sizeModVector = new Vector2((float)point8.X, (float)sizeMod) * 16f + new Vector2(8f); - Vector2 sizeModVector2 = new Vector2((float)point8.X, (float)sizeMod2) * 16f + new Vector2(8f); - Vector2 centering = Vector2.Lerp(sizeModVector, sizeModVector2, 0.5f); - Vector2 sizeModPos = new Vector2(0f, sizeModVector2.Y - sizeModVector.Y); - sizeModPos.X = sizeModPos.Y * 0.2f; - Projectile.width = (int)(sizeModPos.X * 0.65f); - Projectile.height = (int)sizeModPos.Y; - Projectile.Center = centering; + + GetVerticallyExpandedPos(out Vector2 newTop, out Vector2 newBottom, out Vector2 newCenter, out Vector2 newSize); + Projectile.width = (int)(newSize.X * 0.65f); + Projectile.height = (int)newSize.Y; + Projectile.Center = newCenter; if (Projectile.owner == Main.myPlayer) { bool breakFlag = false; Vector2 playerCenter = Main.player[Projectile.owner].Center; - Vector2 top = Main.player[Projectile.owner].Top; + Vector2 playerTop = Main.player[Projectile.owner].Top; for (float i = 0f; i < 1f; i += 0.05f) { - Vector2 position2 = Vector2.Lerp(sizeModVector, sizeModVector2, i); - if (Collision.CanHitLine(position2, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(position2, 0, 0, top, 0, 0)) + Vector2 collisionPos = Vector2.Lerp(newTop, newBottom, i); + if (Collision.CanHitLine(collisionPos, 0, 0, playerCenter, 0, 0) || Collision.CanHitLine(collisionPos, 0, 0, playerTop, 0, 0)) { breakFlag = true; break; } } - if (!breakFlag && Projectile.ai[0] < lifeSpan - 120f) + if (!breakFlag && Time < Lifetime - Fadetime) { - float aiDecrement2 = Projectile.ai[0] % 60f; - Projectile.ai[0] = lifeSpan - 120f + aiDecrement2; + Time = Lifetime - Fadetime + Time % 60f; Projectile.netUpdate = true; } } - if (Projectile.ai[0] < lifeSpan - 120f) + if (Time < Lifetime - Fadetime) { - return; + float randFactor = Main.rand.NextFloat(); + Vector2 randomOffset = new Vector2(MathHelper.Lerp(0.1f, 1f, Main.rand.NextFloat()) * MathHelper.Lerp(-2.2f, -0.6f, randFactor), MathHelper.Lerp(-0.5f, 0.9f, randFactor)); + Vector2 fixedOffset = new Vector2(6f, 10f); + Vector2 dustPos = newCenter + newSize * randomOffset * 0.5f + fixedOffset; + Dust sand = Dust.NewDustDirect(dustPos, 0, 0, DustID.Sandnado); + sand.position = dustPos; + sand.customData = newCenter + fixedOffset; + sand.fadeIn = 1f; + sand.scale = 0.3f; + if (randomOffset.X > -1.2f) + sand.velocity.X = 1f + Main.rand.NextFloat(); + sand.velocity.Y = Main.rand.NextFloat() * -0.5f - 1f; } } public override bool PreDraw(ref Color lightColor) { - float aiTracker = Projectile.ai[0]; - float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); - if (aiTracker > 540f) - { - trackerClamp = MathHelper.Lerp(1f, 0f, (aiTracker - 540f) / 60f); - } - Point centerPoint = Projectile.Center.ToTileCoordinates(); - int sizeModding; - int sizeModding2; - Collision.ExpandVertically(centerPoint.X, centerPoint.Y, out sizeModding, out sizeModding2, 15, 15); - sizeModding++; - sizeModding2--; - float vectorMult = 0.2f; - Vector2 sizeModdingVector = new Vector2((float)centerPoint.X, (float)sizeModding) * 16f + new Vector2(8f); - Vector2 sizeModdingVector2 = new Vector2((float)centerPoint.X, (float)sizeModding2) * 16f + new Vector2(8f); - Vector2.Lerp(sizeModdingVector, sizeModdingVector2, 0.5f); - Vector2 sizeModdingPos = new Vector2(0f, sizeModdingVector2.Y - sizeModdingVector.Y); - sizeModdingPos.X = sizeModdingPos.Y * vectorMult; - new Vector2(sizeModdingVector.X - sizeModdingPos.X / 2f, sizeModdingVector.Y); - Texture2D texture2D23 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle drawRectangle = texture2D23.Frame(1, 1, 0, 0); - Vector2 smallRect = drawRectangle.Size() / 2f; - float aiTrackMult = -0.06283186f * aiTracker; - Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double)(aiTracker * 0.1f), default); + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + GetVerticallyExpandedPos(out Vector2 newTop, out Vector2 newBottom, out Vector2 newCenter, out Vector2 newSize); + + float TextureFadetime = Lifetime - 60f; + Color fullColor = new Color(212, 192, 100); + float colorMult = (Time > TextureFadetime ? MathHelper.Lerp(1f, 0f, (Time - TextureFadetime) / 60f) : MathHelper.Clamp(Time / 30f, 0f, 1f)); + float timedRotation = Time * MathHelper.Pi * -0.02f; + float incrementStorage = 0f; float increment = 5.1f; - Color sandYellow = new Color(225, 225, 100); - for (float k = (float)(int)sizeModdingVector2.Y; k > (float)(int)sizeModdingVector.Y; k -= increment) + for (float k = newBottom.Y; k > newTop.Y; k -= increment) { incrementStorage += increment; - float colorChanger = incrementStorage / sizeModdingPos.Y; - float incStorageMult = incrementStorage * 6.28318548f / -20f; - float lowerColorChanger = colorChanger - 0.15f; - Vector2 spinArea = spinningpoint.RotatedBy((double)incStorageMult, default); - Vector2 colorChangeVector = new Vector2(0f, colorChanger + 1f); - colorChangeVector.X = colorChangeVector.Y * vectorMult; - Color newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, colorChanger * 2f); - if (colorChanger > 0.5f) - { - newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, 2f - colorChanger * 2f); - } - newSandYellow.A = (byte)((float)newSandYellow.A * 0.5f); - newSandYellow *= trackerClamp; - spinArea *= colorChangeVector * 100f; - spinArea.Y = 0f; - spinArea.X = 0f; - spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); + float segmentHeight = incrementStorage / newSize.Y; + float addedRotation = incrementStorage * MathHelper.Pi * -0.1f; + float addedScale = segmentHeight - 0.15f; + Color drawColor = Color.Lerp(Color.Transparent, fullColor, (segmentHeight > 0.5f ? 2f - segmentHeight * 2f : segmentHeight * 2f)); + drawColor.A = (byte)((float)drawColor.A * 0.5f); + + Vector2 drawPos = new Vector2(newBottom.X, k) - Main.screenPosition; + Main.spriteBatch.Draw(tex, drawPos, null, drawColor * colorMult, timedRotation + addedRotation, tex.Size() * 0.5f, 1f + addedScale, SpriteEffects.None, 0); } return false; } + + public void GetVerticallyExpandedPos(out Vector2 newTop, out Vector2 newBottom, out Vector2 newCenter, out Vector2 newSize) + { + Point center = Projectile.Center.ToTileCoordinates(); + Collision.ExpandVertically(center.X, center.Y, out int topY, out int bottomY, 15, 15); + newTop = new Vector2(center.X, topY + 1) * 16f + new Vector2(8f); + newBottom = new Vector2(center.X, bottomY - 1) * 16f + new Vector2(8f); + newCenter = Vector2.Lerp(newTop, newBottom, 0.5f); + newSize = new Vector2(0f, newBottom.Y - newTop.Y); + newSize.X = newSize.Y * 0.2f; + } } } diff --git a/Projectiles/Rogue/CorpusAvertorProj.cs b/Projectiles/Rogue/CorpusAvertorProj.cs index 7c00bf1283..c0175b8285 100644 --- a/Projectiles/Rogue/CorpusAvertorProj.cs +++ b/Projectiles/Rogue/CorpusAvertorProj.cs @@ -79,29 +79,9 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - - int heal = (int)Math.Round(hit.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.05)); } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - - int heal = (int)Math.Round(info.Damage * 0.05); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.player[Projectile.owner].lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/CorpusAvertorStealth.cs b/Projectiles/Rogue/CorpusAvertorStealth.cs index 57b5178d67..9735ca9cc8 100644 --- a/Projectiles/Rogue/CorpusAvertorStealth.cs +++ b/Projectiles/Rogue/CorpusAvertorStealth.cs @@ -93,8 +93,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 180); - if (target.lifeMax > 5 && Projectile.numHits == 0 && Slash == 0f) - OnHitEffects(hit.Damage); + if (target.IsAnEnemy(false) && Projectile.numHits == 0 && Slash == 0f) + { + Player player = Main.player[Projectile.owner]; + player.SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.025)); + if (Main.LocalPlayer.team == player.team && player.team != 0) + Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); + } if (Projectile.numHits > 0 && !(target.life <= 0 && target.realLife == -1)) Projectile.damage = (int)(Projectile.damage * 0.9f); @@ -102,29 +107,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.damage = 1; } - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - target.AddBuff(ModContent.BuffType(), 180); - if (Projectile.numHits == 0 && Slash == 0f) - OnHitEffects(info.Damage); - } - - private void OnHitEffects(int damage) - { - Player player = Main.player[Projectile.owner]; - if (Main.LocalPlayer.team == player.team && player.team != 0) - { - Main.LocalPlayer.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(20f), true); - - int heal = (int)Math.Round(damage * 0.025); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.LocalPlayer, heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); - } - } + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index f8f7e01382..c3b7f5d28c 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -32,8 +32,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ai[0]++; if (Projectile.ai[0] >= 20f) { - Projectile.velocity.Y += 0.35f; - Projectile.velocity.X *= 0.97f; + if (CalamityUtils.ClosestNPCAt(Projectile.Center, 280f) == null) + { + Projectile.velocity.Y += 0.35f; + Projectile.velocity.X *= 0.97f; + } + else + CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 280f, 14f, 20f); } else { @@ -42,9 +47,6 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Y > 15f) Projectile.velocity.Y = 15f; - - if (Projectile.ai[0] >= 20f) - CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 280f, 14f, 20f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/DeepWounderProjectile.cs b/Projectiles/Rogue/DeepWounderProjectile.cs index 8575ee7ec5..fac6e2ac45 100644 --- a/Projectiles/Rogue/DeepWounderProjectile.cs +++ b/Projectiles/Rogue/DeepWounderProjectile.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - Projectile.rotation += (StuckTo == null ? 0.2f : 0.35f) * Projectile.direction; + Projectile.rotation += (StuckTo == null ? 0.3f : 0.6f) * Projectile.direction; if (Projectile.Calamity().stealthStrike) { @@ -64,11 +64,10 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 120); + target.AddBuff(ModContent.BuffType(), 120); target.AddBuff(ModContent.BuffType(), 120); if (Projectile.Calamity().stealthStrike) { - target.AddBuff(ModContent.BuffType(), 120); if (StuckTo == null) { StuckTo = target; diff --git a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs index 6788a60063..063e90bd0a 100644 --- a/Projectiles/Rogue/DoomsdayDeviceProjectile.cs +++ b/Projectiles/Rogue/DoomsdayDeviceProjectile.cs @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Rogue public int maxStealthHits = 5; // How many bounces the stealth strike has. This does not include the inital and final hit, so be sure to take those into account if you adjust this. public Color mainColor = Color.White; + public Color c1 = new Color(121, 240, 17); + public Color c2 = new Color(0, 208, 240); public NPC lastHitTarget; public override void SetDefaults() @@ -57,8 +59,8 @@ namespace CalamityMod.Projectiles.Rogue float rate = (Main.GlobalTimeWrappedHourly * 6); List eColors = new List() { - Color.Turquoise, - Color.Orchid + c1, + c2 }; int colorIndex = (int)(rate / 2 % eColors.Count); Color currentColor = eColors[colorIndex]; @@ -189,7 +191,7 @@ namespace CalamityMod.Projectiles.Rogue c.velocity = (MathHelper.TwoPi * i / 12f).ToRotationVector2().RotatedBy(Projectile.rotation) * 5.5f * (i % 2 == 0 ? 0.8f : 1f); c.scale = 0.7f * (i % 2 == 0 ? 2.2f : 1.8f); c.noGravity = true; - c.color = i % 2 == 0 ? Color.Turquoise : Color.Orchid; + c.color = i % 2 == 0 ? c1 : c2; c.noLightEmittence = true; } @@ -304,12 +306,12 @@ namespace CalamityMod.Projectiles.Rogue dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); dust2.velocity = (Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 * charge).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * finalHitMult; dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.Turquoise : Color.Orchid; + dust2.color = Main.rand.NextBool() ? c1 : c2; } - Particle pulse = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.2f, Color.Turquoise * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + Particle pulse = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.2f, c1 * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.175f * finalHitMult, Color.Orchid * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + Particle pulse2 = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.175f * finalHitMult, c2 * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); GeneralParticleHandler.SpawnParticle(pulse2); Owner.Calamity().GeneralScreenShakePower = 3; @@ -357,7 +359,7 @@ namespace CalamityMod.Projectiles.Rogue dust2.scale = Main.rand.NextFloat(1.5f, 1.7f) - Math.Abs(variance); dust2.velocity = (launchDir * 5 * charge).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance)) * finalHitMult; dust2.noGravity = true; - dust2.color = Main.rand.NextBool() ? Color.Turquoise : Color.Orchid; + dust2.color = Main.rand.NextBool() ? c1 : c2; } if (hasReachedFullCharge) @@ -365,9 +367,9 @@ namespace CalamityMod.Projectiles.Rogue SoundStyle soundExtra = new("CalamityMod/Sounds/Item/DoomsdayDeviceImpact"); SoundEngine.PlaySound(soundExtra with { Volume = 1f, Pitch = 0.35f + extraPitch, MaxInstances = 6 }, Projectile.Center); - Particle pulse = new CustomSpark(Projectile.Center, -launchDir * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.4f * finalHitMult, Color.Turquoise * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + Particle pulse = new CustomSpark(Projectile.Center, -launchDir * 3, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.4f * finalHitMult, c1 * 0.85f, new Vector2(3f, 1f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new CustomSpark(Projectile.Center, -launchDir * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.35f * finalHitMult, Color.Orchid * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); + Particle pulse2 = new CustomSpark(Projectile.Center, -launchDir * 2.5f, "CalamityMod/Particles/HollowCircleSoftEdge", false, 14, 0.35f * finalHitMult, c2 * 0.7f, new Vector2(2.5f, 2f), extraRotation: MathHelper.ToRadians(90), shrinkSpeed: 0.9f); GeneralParticleHandler.SpawnParticle(pulse2); } SoundStyle sound = new("CalamityMod/Sounds/Item/DoomsdayDeviceImpact"); diff --git a/Projectiles/Rogue/DuststormCloud.cs b/Projectiles/Rogue/DuststormCloud.cs index 9c4201d233..6a920352e8 100644 --- a/Projectiles/Rogue/DuststormCloud.cs +++ b/Projectiles/Rogue/DuststormCloud.cs @@ -4,7 +4,6 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - [PierceResistException(onlyForSingleHitbox: true)] public class DuststormCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; diff --git a/Projectiles/Rogue/DuststormCloudHitbox.cs b/Projectiles/Rogue/DuststormCloudHitbox.cs index 9629e274f1..2284071282 100644 --- a/Projectiles/Rogue/DuststormCloudHitbox.cs +++ b/Projectiles/Rogue/DuststormCloudHitbox.cs @@ -1,5 +1,6 @@ using System; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.NPCs; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -9,6 +10,7 @@ using Terraria.Utilities; namespace CalamityMod.Projectiles.Rogue { + [PierceResistExceptionAttribute(true)] public class DuststormCloudHitbox : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; @@ -25,15 +27,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.timeLeft = DuststormInABottle.CloudLifetime; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 12; } public override void AI() { if (Projectile.scale < (Projectile.ai[1] == 1 ? DuststormInABottle.MaxSizeStealth : DuststormInABottle.MaxSize)) { - Projectile.scale += (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowhRate : DuststormInABottle.GrowthRate); - Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowhRate : DuststormInABottle.GrowthRate)); + Projectile.scale += Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate; + Projectile.ExpandHitboxBy(1 + (Projectile.ai[1] == 1 ? DuststormInABottle.StealthGrowthRate : DuststormInABottle.GrowthRate)); } } diff --git a/Projectiles/Rogue/DuststormInABottleProj.cs b/Projectiles/Rogue/DuststormInABottleProj.cs index 7a012612b4..61d51c1462 100644 --- a/Projectiles/Rogue/DuststormInABottleProj.cs +++ b/Projectiles/Rogue/DuststormInABottleProj.cs @@ -68,11 +68,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, stealth ? velocity * 1.2f : velocity, ModContent.ProjectileType(), 0, 0, Projectile.owner, stealth ? 1f : 0f, (float)Main.rand.Next(-45, 1)); } int hitbox = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * 0.5f, Projectile.owner); - if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag and less iframes - { + if (hitbox.WithinBounds(Main.maxProjectiles) && Projectile.Calamity().stealthStrike) //Inherit stealth flag Main.projectile[hitbox].ai[1] = 1; - Main.projectile[hitbox].idStaticNPCHitCooldown = DuststormInABottle.StealthIframes; - } } } } diff --git a/Projectiles/Rogue/EclipsesFallMain.cs b/Projectiles/Rogue/EclipsesFallMain.cs index 3448ed80af..acae2f710c 100644 --- a/Projectiles/Rogue/EclipsesFallMain.cs +++ b/Projectiles/Rogue/EclipsesFallMain.cs @@ -49,18 +49,17 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSpears(target.Center); + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => SpawnSpears(target); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSpears(target); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => SpawnSpears(target.Center); - - private void SpawnSpears(Vector2 targetPos) + private void SpawnSpears(Entity target) { int spearAmt = Main.rand.Next(3, 4 + 1); // 3 or 4 spears - var source = Projectile.GetSource_FromThis(); for (int n = 0; n < spearAmt; n++) { - ; - CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); + Vector2 spawnPos = target.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); + Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, target, 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, ModContent.ProjectileType(), (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); } } diff --git a/Projectiles/Rogue/EclipsesStealth.cs b/Projectiles/Rogue/EclipsesStealth.cs index 29d036ba82..bdf017b9f2 100644 --- a/Projectiles/Rogue/EclipsesStealth.cs +++ b/Projectiles/Rogue/EclipsesStealth.cs @@ -19,8 +19,6 @@ namespace CalamityMod.Projectiles.Rogue public const float RainDamageMult = 0.2f; public const float ExplosionDamageMult = 0.5f; - // For more consistent DPS, always alternates between spawning 1 and 2 spears instead of picking randomly - private bool spawnTwoSpears = true; private bool changedTimeLeft = false; public override void SetStaticDefaults() @@ -77,19 +75,15 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.owner == Main.myPlayer) { Projectile.localAI[1] -= 1f; - - var source = Projectile.GetSource_FromThis(); if (Projectile.localAI[1] <= 0f) { // Set up the spear counter for next time. Used to be every 5 frames there was a 50% chance; now it's more reliable but slower. - Projectile.localAI[1] = Main.rand.Next(10, 13); // 10 to 12 frames between each spearfall + Projectile.localAI[1] = Main.rand.Next(8, 10+1); // 8 to 10 frames between each spearfall int type = ModContent.ProjectileType(); - // Used to be a 50% chance each spearfall for 1 or 2. Now is consistent. - int numSpears = spawnTwoSpears ? 2 : 1; - spawnTwoSpears = !spawnTwoSpears; - for (int i = 0; i < numSpears; ++i) - CalamityUtils.ProjectileRain(source, Projectile.Center, 400f, 100f, 500f, 800f, 29f, type, (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); + Vector2 spawnPos = Projectile.Center - new Vector2(Main.rand.NextFloat(-100f, 100f), Main.rand.NextFloat(500f, 800f)); + Vector2 spearVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, Main.npc[(int)Projectile.ai[1]], 29f, 2) + Vector2.UnitX * Main.rand.NextFloat(-6f, 6f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, spearVel, type, (int)(Projectile.damage * RainDamageMult), Projectile.knockBack * RainDamageMult, Projectile.owner); } } } diff --git a/Projectiles/Rogue/EradicatorProjectile.cs b/Projectiles/Rogue/EradicatorProjectile.cs index a81963a004..edc2e751bb 100644 --- a/Projectiles/Rogue/EradicatorProjectile.cs +++ b/Projectiles/Rogue/EradicatorProjectile.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.MaxUpdates = 2; Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 18; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; Projectile.DamageType = RogueDamageClass.Instance; } @@ -117,10 +117,10 @@ namespace CalamityMod.Projectiles.Rogue StealthStrikeGrind(spin); else { - // Fire lasers at up to 2 nearby targets every 8 frames for 40% damage. - // Stealth strike lasers have an intentionally lower ratio of 12%. + // Fire lasers at up to 2 nearby targets every 12 frames. + // Stealth strike lasers have an intentionally lower damage. double laserDamageRatio = Projectile.Calamity().stealthStrike ? 0.15D : 0.4D; - float laserFrames = Projectile.MaxUpdates * 8f; + float laserFrames = Projectile.MaxUpdates * 12f; CalamityUtils.MagnetSphereHitscan(Projectile, 300f, 6f, laserFrames, 2, ModContent.ProjectileType(), laserDamageRatio, true, Projectile.DamageType); } } @@ -130,14 +130,14 @@ namespace CalamityMod.Projectiles.Rogue // Spin extra fast to visually shred the enemy. Projectile.rotation += spinDir * RotationIncrement * 0.8f; - // Randomly fire lasers while grinding. Each laser only does 12% damage. + // Randomly fire lasers while grinding. randomLaserCharge += Main.rand.NextFloat(0.09f, 0.14f); if (randomLaserCharge >= 1f) { randomLaserCharge -= 1f; Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - int laserDamage = (int)(Projectile.damage * 0.12D); + int laserDamage = (int)(Projectile.damage * 0.15D); Projectile laser = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), laserDamage, 0f, Projectile.owner); if (laser.whoAmI.WithinBounds(Main.maxProjectiles)) { @@ -206,9 +206,7 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => OnHit(); - - private void OnHit() + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { // Non-stealth strikes do not stick on hit. if (!Projectile.Calamity().stealthStrike) diff --git a/Projectiles/Rogue/ExorcismProj.cs b/Projectiles/Rogue/ExorcismProj.cs index 1dea82d896..b300493f40 100644 --- a/Projectiles/Rogue/ExorcismProj.cs +++ b/Projectiles/Rogue/ExorcismProj.cs @@ -163,11 +163,12 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.velocity.Length() < storedStealthVel.Length()) Projectile.velocity += Utils.DirectionTo(Projectile.Center, Owner.Center) * 0.1f; Projectile.velocity *= 0.99f; - if (time == 180) // Reset iframes when it starts to come back + // CIT 26JUN2025: Removing its ability to deal damage again because it's overpowered + /*if (time == 180) { for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; - } + }*/ if (Projectile.timeLeft <= 240) { impaleDist = Vector2.One; // This is so the projectile stops dealing damage diff --git a/Projectiles/Rogue/FantasyTalismanProj.cs b/Projectiles/Rogue/FantasyTalismanProj.cs index 378c484662..382f3e0603 100644 --- a/Projectiles/Rogue/FantasyTalismanProj.cs +++ b/Projectiles/Rogue/FantasyTalismanProj.cs @@ -43,16 +43,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.StickyProjAI(4); if (Projectile.ai[0] == 1f) { - if (Projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 40 == 0) { - if (Main.rand.NextBool(8)) + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.3f), ProjectileID.SpectreWrath, 1000f, 4f); + if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.4f), ProjectileID.SpectreWrath, 1000f, 4f); - if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) - { - ghost.DamageType = RogueDamageClass.Instance; - ghost.penetrate = 1; - } + ghost.DamageType = RogueDamageClass.Instance; + ghost.penetrate = 1; } } } @@ -64,7 +61,7 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(12); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(9); public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { diff --git a/Projectiles/Rogue/FantasyTalismanStealth.cs b/Projectiles/Rogue/FantasyTalismanStealth.cs index 9be29c003d..35b90af917 100644 --- a/Projectiles/Rogue/FantasyTalismanStealth.cs +++ b/Projectiles/Rogue/FantasyTalismanStealth.cs @@ -45,16 +45,13 @@ namespace CalamityMod.Projectiles.Rogue Projectile.StickyProjAI(4); if (Projectile.ai[0] == 1f) { - if (Projectile.timeLeft % 4 == 0) + if (Projectile.timeLeft % 20 == 0) { - if (Main.rand.NextBool(3)) + Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.3f), ProjectileID.SpectreWrath, 1000f, 4f); + if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) { - Projectile ghost = CalamityUtils.SpawnOrb(Projectile, (int)(Projectile.damage * 0.2f), ProjectileID.SpectreWrath, 1000f, 4f); - if (ghost.whoAmI.WithinBounds(Main.maxProjectiles)) - { - ghost.DamageType = RogueDamageClass.Instance; - ghost.penetrate = 1; - } + ghost.DamageType = RogueDamageClass.Instance; + ghost.penetrate = 1; } } } @@ -66,7 +63,7 @@ namespace CalamityMod.Projectiles.Rogue return false; } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(9); + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => Projectile.ModifyHitNPCSticky(6); public override void OnKill(int timeLeft) { @@ -74,7 +71,7 @@ namespace CalamityMod.Projectiles.Rogue { for (int j = 0; j <= 3; j++) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(12f, 12f), ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f, 0f); } } } diff --git a/Projectiles/Rogue/FrostyFlareProj.cs b/Projectiles/Rogue/FrostyFlareProj.cs index a405ddaa85..2f812635cf 100644 --- a/Projectiles/Rogue/FrostyFlareProj.cs +++ b/Projectiles/Rogue/FrostyFlareProj.cs @@ -44,17 +44,18 @@ namespace CalamityMod.Projectiles.Rogue if (shoot) { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Projectile.Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 pos = Projectile.Center - new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 751)); + Vector2 vel = Utils.DirectionTo(pos, Projectile.Center) * 30f; + vel.X += Main.rand.NextFloat(-4f, 4f); + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); Main.projectile[shard].alpha = Projectile.alpha; } int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater); Main.dust[index2].noGravity = true; + + if (Projectile.ai[2] == 1f) + CalamityUtils.HomeInOnSelectedNPC(Projectile, CalamityUtils.ClosestNPCAt(Projectile.Center, 400f, false), false, 5f, 30f, 0.99f); } else { @@ -68,12 +69,10 @@ namespace CalamityMod.Projectiles.Rogue if (shoot) { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Main.npc[id].Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 pos = Projectile.Center - new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 751)); + Vector2 vel = Utils.DirectionTo(pos, Projectile.Center) * 30f; + vel.X += Main.rand.NextFloat(-4f, 4f); + int shard = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75f), Projectile.knockBack, Projectile.owner); Main.projectile[shard].alpha = Projectile.alpha; } } @@ -121,7 +120,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(BuffID.Frostburn2, 180); - target.AddBuff(ModContent.BuffType(), 30); } public override bool? CanDamage() => Projectile.ai[0] == 0f ? null : false; diff --git a/Projectiles/Rogue/FrostyFlareStealth.cs b/Projectiles/Rogue/FrostyFlareStealth.cs index 33bc7eb8a3..09d88e9a77 100644 --- a/Projectiles/Rogue/FrostyFlareStealth.cs +++ b/Projectiles/Rogue/FrostyFlareStealth.cs @@ -44,23 +44,12 @@ namespace CalamityMod.Projectiles.Rogue if (shoot) { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Projectile.Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int flare = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 pos = Projectile.Center - new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); + Vector2 vel = Utils.DirectionTo(pos, Projectile.Center) * 30f; + vel.X += Main.rand.NextFloat(-4f, 4f); + int flare = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Projectile.velocity / 4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), Projectile.knockBack, Projectile.owner, ai2: 1f); Main.projectile[flare].alpha = 150; } - if (Projectile.timeLeft % 10 == 0) - { - int snowflake = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, Projectile.velocity.X * 0f, Projectile.velocity.Y * 0f, ProjectileID.NorthPoleSnowflake, (int)(Projectile.damage * 0.25), Projectile.knockBack, Projectile.owner, 0f, Main.rand.Next(3)); - if (snowflake.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[snowflake].DamageType = RogueDamageClass.Instance; - Main.projectile[snowflake].timeLeft = 300; - } - } int index2 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.DungeonWater); Main.dust[index2].noGravity = true; @@ -77,12 +66,10 @@ namespace CalamityMod.Projectiles.Rogue if (shoot) { - Vector2 vel = new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 801)); - Vector2 pos = Main.npc[id].Center - vel; - vel.X += Main.rand.Next(-50, 51); - vel.Normalize(); - vel *= 30f; - int flare = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 pos = Projectile.Center - new Vector2(Main.rand.Next(-300, 301), Main.rand.Next(500, 751)); + Vector2 vel = CalamityUtils.CalculatePredictiveAimToTarget(pos, Main.npc[id], 30f); + vel.X += Main.rand.NextFloat(-4f, 4f); + int flare = Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, vel + Main.npc[id].velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.6f), Projectile.knockBack, Projectile.owner, ai2: 1f); Main.projectile[flare].alpha = 150; } } @@ -130,7 +117,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(BuffID.Frostburn2, 180); - target.AddBuff(ModContent.BuffType(), 30); } public override bool? CanDamage() => Projectile.ai[0] == 0f ? null : false; diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 5ba3bdc63f..40c9a6b8d6 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/Glaive"; private static int Lifetime = 180; - private static int ReboundTime = 45; + private static int ReboundTime = 40; + private List HitNPCs = []; + public ref float AIState => ref Projectile.ai[0]; // 0 - Going out. 1 - Returning. 2 - Stealth stuck to enemy. public override void SetStaticDefaults() { @@ -29,21 +32,18 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; DrawOffsetX = -10; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() { - // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. - if (Projectile.ai[1] == 1f) - Projectile.penetrate = Projectile.maxPenetrate = -1; - // Boomerang rotation - Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.rotation += 0.175f * Projectile.direction; // Boomerang sound if (Projectile.soundDelay == 0) @@ -54,16 +54,22 @@ namespace CalamityMod.Projectiles.Rogue // Returns after some number of frames in the air if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; + AIState = 1f; - if (Projectile.ai[0] != 0f) + if (AIState == 0f && Projectile.ai[1] >= 0) + { + if (Projectile.timeLeft % 10 == 0) + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[(int)Projectile.ai[1]].Center) * Projectile.velocity.Length(); + } + + if (AIState == 1f) { Projectile.tileCollide = false; float returnSpeed = Glaive.Speed * 1.6f; float acceleration = 1.4f; - if (Projectile.ai[1] == 1f) + if (Projectile.Calamity().stealthStrike) { returnSpeed *= Glaive.StealthSpeedMult; acceleration *= Glaive.StealthSpeedMult; @@ -114,6 +120,24 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Hitbox.Intersects(owner.Hitbox)) Projectile.Kill(); } + + if (AIState == 2f) + { + Projectile.tileCollide = false; + Projectile.velocity = Vector2.Zero; + if (Main.npc[(int)Projectile.ai[1]].active) + { + if (Projectile.FinalExtraUpdate()) + Projectile.Center += Main.npc[(int)Projectile.ai[1]].velocity; + } + else + AIState = 1f; + + if (Projectile.penetrate == -1) + { + AIState = 1f; + } + } } public override bool PreDraw(ref Color lightColor) @@ -124,11 +148,73 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (Projectile.Calamity().stealthStrike) + { + if (AIState != 2f) + { + HitNPCs.Add(target.whoAmI); + float maxDistance = 1000f; + float npcDistCompare = 1000f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) // Find an NPC to ricochet to + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || HitNPCs.Contains(n.whoAmI)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If you find an NPC, ricochet in their direction and reset iframes for them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If there are no new NPCs to ricochet to, try to go back to an already hit NPC + { + maxDistance = 1000f; + npcDistCompare = 1000f; + index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || n.whoAmI == target.whoAmI) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if ((currentNPCDist < npcDistCompare) && (Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1))) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + + // If this can find an NPC, ricochet back to them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If you still find no one new, stick to the hit NPC + { + Projectile.ai[1] = target.whoAmI; + AIState = 2f; + } + } + } + Projectile.timeLeft = Lifetime + ReboundTime * 3; + } // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. if (Projectile.penetrate == 1) { Projectile.penetrate = -1; - Projectile.ai[0] = 1f; + AIState = 1f; } } @@ -147,7 +233,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1f; + AIState = 1f; return false; } } diff --git a/Projectiles/Rogue/HeavenfallenEnergy.cs b/Projectiles/Rogue/HeavenfallenEnergy.cs index 74056c7f34..a9668c1d72 100644 --- a/Projectiles/Rogue/HeavenfallenEnergy.cs +++ b/Projectiles/Rogue/HeavenfallenEnergy.cs @@ -20,41 +20,31 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 8; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.timeLeft = 240; Projectile.DamageType = RogueDamageClass.Instance; } public override void AI() { - int constant = 14; int coolDust; Projectile.ai[0]++; if (Projectile.ai[0] % 2 == 0) { - if (Projectile.ai[0] % 4 == 0) - { - coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - } - else - { - coolDust = Dust.NewDust(Projectile.position, Projectile.width - constant * 2, Projectile.height - constant * 2, ModContent.DustType(), 0f, 0f, 100, default, 1.5f); - } + int dustType = Projectile.ai[0] % 4 == 0 ? ModContent.DustType() : ModContent.DustType(); + coolDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Alpha: 100, Scale: 1.5f); Main.dust[coolDust].noGravity = true; Main.dust[coolDust].velocity *= 0.1f; Main.dust[coolDust].velocity += Projectile.velocity * 0.5f; } float homingRange = raining ? 480f : 240f; - if (Projectile.ai[0] >= 15f || raining) CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, homingRange, 12f, 20f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - public override bool? CanDamage() => Projectile.ai[0] >= 15f || raining; } } diff --git a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs index aa6704c88a..caa3ce9873 100644 --- a/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs +++ b/Projectiles/Rogue/HeavenfallenStardiskBoomerang.cs @@ -36,8 +36,8 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 20f == 4f) // every 5 frames - CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 6, Projectile.knockBack * 0.5f, Projectile.owner); + if (Projectile.Calamity().stealthStrike && Projectile.timeLeft % 20f == 4f) + CalamityUtils.ProjectileRain(Projectile.GetSource_FromThis(), Projectile.Center, 400f, 100f, 500f, 800f, 29f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack * 0.5f, Projectile.owner); if (Projectile.alpha > 0) { @@ -136,7 +136,6 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 240); public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/HypothermiaChunk.cs b/Projectiles/Rogue/HypothermiaChunk.cs index bdedfa919b..9c8579400c 100644 --- a/Projectiles/Rogue/HypothermiaChunk.cs +++ b/Projectiles/Rogue/HypothermiaChunk.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 100; + Projectile.timeLeft = 480; Projectile.extraUpdates = 4; Projectile.ignoreWater = true; Projectile.DamageType = RogueDamageClass.Instance; @@ -59,16 +59,14 @@ namespace CalamityMod.Projectiles.Rogue } if (Projectile.owner == Main.myPlayer) { - int numSplits = Main.rand.NextBool() ? 4 : 3; - int type = ModContent.ProjectileType(); int shardDamage = (int)(Projectile.damage * 0.5f); float shardKB = Projectile.knockBack * 0.75f; - for (int i = 0; i < numSplits; ++i) + for (int i = 0; i < 4; ++i) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); int texID = Main.rand.Next(4); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, type, shardDamage, shardKB, Main.myPlayer, texID, 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), shardDamage, shardKB, Main.myPlayer, texID, 1f); } } } @@ -82,7 +80,6 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 300); - target.AddBuff(ModContent.BuffType(), 150); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/HypothermiaShard.cs b/Projectiles/Rogue/HypothermiaShard.cs index 054cdff67c..c736458032 100644 --- a/Projectiles/Rogue/HypothermiaShard.cs +++ b/Projectiles/Rogue/HypothermiaShard.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public class HypothermiaShard : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; - private float counter = 0f; + private int counter = 0; public override void SetDefaults() { Projectile.width = 6; @@ -18,7 +18,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.scale = 1f; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.alpha = 50; Projectile.penetrate = 1; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; @@ -29,18 +28,19 @@ namespace CalamityMod.Projectiles.Rogue { Lighting.AddLight(Projectile.Center, 0.1f, 0f, 0.5f); Projectile.rotation += Projectile.velocity.X * 0.2f; - counter += 0.25f; if (Main.rand.NextBool(10)) { - int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 318, 0f, 0f, 0, default, 0.8f); + int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, 318, 0f, 0f, Scale: 0.8f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.2f; } + Projectile.velocity *= 0.996f; - if (counter > 100f) + counter++; + if (counter > 400) { Projectile.scale -= 0.05f; - if ((double)Projectile.scale <= 0.2) + if (Projectile.scale <= 0.2f) { Projectile.scale = 0.2f; Projectile.Kill(); @@ -53,16 +53,14 @@ namespace CalamityMod.Projectiles.Rogue public override bool OnTileCollide(Vector2 oldVelocity) { if (Projectile.velocity.X != oldVelocity.X) - { Projectile.velocity.X = -oldVelocity.X; - } if (Projectile.velocity.Y != oldVelocity.Y) - { Projectile.velocity.Y = -oldVelocity.Y; - } return false; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override void OnKill(int timeLeft) { for (int k = 0; k < 3; k++) @@ -71,27 +69,26 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); - public override bool PreDraw(ref Color lightColor) { //Changes the texture of the projectile Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - if (Projectile.ai[0] == 1f) + switch (Projectile.ai[0]) { - texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard2").Value; + case 0: + texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + break; + case 1: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard2").Value; + break; + case 2: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard3").Value; + break; + case 3: + texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard4").Value; + break; } - if (Projectile.ai[0] == 2f) - { - texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard3").Value; - } - if (Projectile.ai[0] == 3f) - { - texture = ModContent.Request("CalamityMod/Projectiles/Rogue/HypothermiaShard4").Value; - } - Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, texture.Width, texture.Height)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, texture.Height / 2f), Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, texture.Size() / 2f, Projectile.scale, SpriteEffects.None); return false; } } diff --git a/Projectiles/Rogue/IcebreakerHammer.cs b/Projectiles/Rogue/IcebreakerHammer.cs index 3ab30014a9..e079d036ad 100644 --- a/Projectiles/Rogue/IcebreakerHammer.cs +++ b/Projectiles/Rogue/IcebreakerHammer.cs @@ -90,19 +90,6 @@ namespace CalamityMod.Projectiles.Rogue int ice = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.5), Projectile.knockBack, Projectile.owner, 0f, 0.85f + Main.rand.NextFloat() * 1.15f, 1f); if (ice.WithinBounds(Main.maxProjectiles)) Main.projectile[ice].DamageType = RogueDamageClass.Instance; - - int buffType = ModContent.BuffType(); - float radius = 112f; // 7 blocks - - foreach (Player player in Main.ActivePlayers) - { - Player owner = Main.player[Projectile.owner]; - if ((owner.team != player.team || player.team == 0) && player.hostile && owner.hostile && !player.dead && !player.buffImmune[buffType] && Vector2.Distance(Projectile.Center, player.Center) <= radius) - { - if (player.FindBuffIndex(buffType) == -1) - player.AddBuff(buffType, 60, false); - } - } } } } diff --git a/Projectiles/Rogue/InfernalKrisProjectile.cs b/Projectiles/Rogue/InfernalKrisProjectile.cs index ecc722a3bd..155ee6ef67 100644 --- a/Projectiles/Rogue/InfernalKrisProjectile.cs +++ b/Projectiles/Rogue/InfernalKrisProjectile.cs @@ -12,8 +12,7 @@ namespace CalamityMod.Projectiles.Rogue { public new string LocalizationCategory => "Projectiles.Rogue"; public override string Texture => "CalamityMod/Items/Weapons/Rogue/InfernalKris"; - - public static int spinTime = 280; + private bool hasSpawnedCinders = false; public override void SetStaticDefaults() { @@ -35,7 +34,7 @@ namespace CalamityMod.Projectiles.Rogue public override void AI() { - if (Projectile.timeLeft < spinTime) + if (Projectile.timeLeft < 280) { Projectile.rotation += 0.4f * Projectile.direction; @@ -56,59 +55,37 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Projectile.timeLeft < spinTime) - { - modifiers.SourceDamage *= 1.75f; - } - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4, 8) : Main.rand.Next(3, 6)); target.AddBuff(BuffID.OnFire, debuffTime); if (Projectile.Calamity().stealthStrike) - { - int sparkCount = Main.rand.Next(3, 7); - for (int i = 0; i < sparkCount; i++) - { - int sparkScatter = 1; - Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter - 2, sparkScatter + 2)); - - sparkVelocity.Normalize(); - sparkVelocity *= 3; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - } + StealthEffect(); } - public override void OnHitPlayer(Player target, Player.HurtInfo info) { int debuffTime = 60 * (Projectile.Calamity().stealthStrike ? Main.rand.Next(4, 8) : Main.rand.Next(3, 6)); target.AddBuff(BuffID.OnFire, debuffTime); if (Projectile.Calamity().stealthStrike) - { - int sparkCount = Main.rand.Next(3, 7); - for (int i = 0; i < sparkCount; i++) - { - int sparkScatter = 1; - Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter - 2, sparkScatter + 2)); - - sparkVelocity.Normalize(); - sparkVelocity *= 3; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); - SoundEngine.PlaySound(SoundID.Item74, Projectile.position); - } + StealthEffect(); } + private void StealthEffect() + { + hasSpawnedCinders = true; + int sparkCount = Main.rand.Next(4, 5 + 1); + for (int i = 0; i < sparkCount; i++) + { + Vector2 sparkVelocity = Main.rand.NextVector2Circular(1f, 3f); + sparkVelocity = sparkVelocity.SafeNormalize(Vector2.UnitY) * 3f; + + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0, 0); + } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0, 0); + SoundEngine.PlaySound(SoundID.Item74, Projectile.position); + } + public override bool PreDraw(ref Color lightColor) { @@ -167,13 +144,13 @@ namespace CalamityMod.Projectiles.Rogue public override void OnKill(int timeLeft) { - if (Projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike && !hasSpawnedCinders) { - int sparkCount = Main.rand.Next(3, 7); + int sparkCount = Main.rand.Next(4, 5+1); for (int i = 0; i < sparkCount; i++) { - int sparkScatter = 1; - Vector2 sparkVelocity = new Vector2(Main.rand.NextFloat(-sparkScatter, sparkScatter), Main.rand.NextFloat(-sparkScatter, sparkScatter)); + Vector2 sparkVelocity = Main.rand.NextVector2Circular(1f, 3f); + sparkVelocity = sparkVelocity.SafeNormalize(Vector2.UnitY) * 3f; if (Projectile.ai[0] != 0) { @@ -184,14 +161,9 @@ namespace CalamityMod.Projectiles.Rogue sparkVelocity.Y *= -1; } - sparkVelocity.X += Projectile.ai[0]; - sparkVelocity.Y += Projectile.ai[1]; - sparkVelocity.Normalize(); - sparkVelocity *= 3; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sparkVelocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0, 0); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4f), 0, Projectile.owner, 0, 0); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), 0, Projectile.owner, 0, 0); SoundEngine.PlaySound(SoundID.Item74, Projectile.position); } } diff --git a/Projectiles/Rogue/InfestedClawmerangProj.cs b/Projectiles/Rogue/InfestedClawmerangProj.cs index d7f2386bdb..e420a236a8 100644 --- a/Projectiles/Rogue/InfestedClawmerangProj.cs +++ b/Projectiles/Rogue/InfestedClawmerangProj.cs @@ -37,12 +37,8 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.timeLeft % 15 == 0 && Projectile.owner == Main.myPlayer) { - Vector2 vector62 = Main.player[Projectile.owner].Center - Projectile.Center; - Vector2 vector63 = vector62 * -1f; - vector63.Normalize(); - vector63 *= (float)Main.rand.Next(45, 65) * 0.1f; - vector63 = vector63.RotatedBy((Main.rand.NextDouble() - 0.5) * 1.5707963705062866, default); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, vector63.X, vector63.Y, ModContent.ProjectileType(), (int)(Projectile.damage * 0.1), Projectile.knockBack * 0.2f, Projectile.owner, -10f, 0f); + Vector2 sporeVel = Utils.DirectionFrom(Projectile.Center, Main.player[Projectile.owner].Center).RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(4.5f, 6.5f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, sporeVel, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), 1f, Projectile.owner, -10f, 1f); } } } diff --git a/Projectiles/Rogue/InkBombProjectile.cs b/Projectiles/Rogue/InkBombProjectile.cs index 7f9f6b90cc..aa11a82aa0 100644 --- a/Projectiles/Rogue/InkBombProjectile.cs +++ b/Projectiles/Rogue/InkBombProjectile.cs @@ -1,4 +1,4 @@ -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Accessories; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -10,6 +10,7 @@ namespace CalamityMod.Projectiles.Rogue public class InkBombProjectile : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public static readonly SoundStyle Explode = new("CalamityMod/Sounds/Custom/PlantyMushMine", 3); public override void SetDefaults() { Projectile.width = 14; @@ -49,10 +50,10 @@ namespace CalamityMod.Projectiles.Rogue private void CreateInk() { Player player = Main.player[Projectile.owner]; - SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int i = 0; i < 20; i++) + SoundEngine.PlaySound(SoundID.NPCHit25, Projectile.Center); + for (int i = 0; i < 4; i++) { - int damage = (int)player.GetTotalDamage().ApplyTo(22); + int damage = (int)player.GetTotalDamage().ApplyTo(InkBomb.InkDamage); int inkID = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(2f, 2f), ModContent.ProjectileType(), damage, 7, Projectile.owner, Main.rand.Next(3) + 1); Main.projectile[inkID].timeLeft += Main.rand.Next(-15, 15 + 1); diff --git a/Projectiles/Rogue/InkCloud.cs b/Projectiles/Rogue/InkCloud.cs index b45ad2b89a..7313d4b6e1 100644 --- a/Projectiles/Rogue/InkCloud.cs +++ b/Projectiles/Rogue/InkCloud.cs @@ -20,8 +20,8 @@ namespace CalamityMod.Projectiles.Rogue Projectile.tileCollide = true; Projectile.ignoreWater = true; Projectile.timeLeft = 100; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 15; Projectile.DamageType = RogueDamageClass.Instance; } @@ -37,7 +37,7 @@ namespace CalamityMod.Projectiles.Rogue { if (!target.friendly) { - target.AddBuff(BuffID.Confused, 300); + target.AddBuff(BuffID.Confused, 60); } } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Confused, 300); diff --git a/Projectiles/Rogue/LeonidCometSmall.cs b/Projectiles/Rogue/LeonidCometSmall.cs index 9bcf7cc54e..6835ca8f01 100644 --- a/Projectiles/Rogue/LeonidCometSmall.cs +++ b/Projectiles/Rogue/LeonidCometSmall.cs @@ -28,19 +28,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 255; } - public override bool PreDraw(ref Color lightColor) - { - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); - return false; - } - - public override void PostDraw(Color lightColor) - { - Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow").Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); - } - public override void AI() { Projectile.alpha -= 25; @@ -55,15 +42,10 @@ namespace CalamityMod.Projectiles.Rogue }); if (Main.rand.NextBool()) { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); + int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.3f); Main.dust[index].noGravity = true; } - if (Main.rand.NextBool()) - { - int index = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Smoke, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.6f); - Main.dust[index].noGravity = true; - } - int index1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), 1.2f); + int index1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f)); Main.dust[index1].noGravity = true; Main.dust[index1].velocity *= 2f; Main.dust[index1].velocity += Projectile.velocity; @@ -84,11 +66,14 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation += Projectile.velocity.X * 0.1f; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override void OnKill(int timeLeft) { if (Projectile.owner != Main.myPlayer) return; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 3, 0f, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage / 2, 0f, Projectile.owner); Projectile.ai[1] = -1f; Projectile.position = Projectile.Center; Projectile.width = Projectile.height = 40; @@ -124,8 +109,16 @@ namespace CalamityMod.Projectiles.Rogue } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, CalamityUtils.ColorSwap(LeonidProgenitor.blueColor, LeonidProgenitor.purpleColor, 1f), Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); + return false; + } + public override void PostDraw(Color lightColor) + { + Texture2D tex = ModContent.Request("CalamityMod/Items/Weapons/Rogue/LeonidProgenitorGlow").Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.White, Projectile.rotation, tex.Size() / 2, Projectile.scale, SpriteEffects.None, 0); + } } } diff --git a/Projectiles/Rogue/LeonidProgenitorBombshell.cs b/Projectiles/Rogue/LeonidProgenitorBombshell.cs index 507789ee06..606bf24ff4 100644 --- a/Projectiles/Rogue/LeonidProgenitorBombshell.cs +++ b/Projectiles/Rogue/LeonidProgenitorBombshell.cs @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.netUpdate = true; } } - Projectile.velocity.Y += 0.2f; + Projectile.velocity.Y += 0.2f / (float)Projectile.MaxUpdates; } Projectile.rotation += Projectile.velocity.X * 0.1f; } @@ -76,45 +76,35 @@ namespace CalamityMod.Projectiles.Rogue { int flash = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0f, 1f); if (flash.WithinBounds(Main.maxProjectiles)) - { Main.projectile[flash].DamageType = RogueDamageClass.Instance; - } - - Vector2 pos = new Vector2(Projectile.Center.X + Projectile.width * 0.5f + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); - Vector2 velocity = (Projectile.Center - pos) / 40f; - int dmg = Projectile.damage / 2; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, velocity, ModContent.ProjectileType(), dmg, Projectile.knockBack, Projectile.owner, 0f, 0.5f + (float)Main.rand.NextDouble() * 0.3f); } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 240); - StealthStrikeEffect(); + SpawnExtraProjectiles(target); } public override void OnHitPlayer(Player target, Player.HurtInfo info) { target.AddBuff(ModContent.BuffType(), 240); - StealthStrikeEffect(); + SpawnExtraProjectiles(target); } - private void StealthStrikeEffect() + private void SpawnExtraProjectiles(Entity target) { - if (!Projectile.Calamity().stealthStrike || Main.myPlayer != Projectile.owner) - return; - - Vector2 spinningpoint = new Vector2(0f, 6f); - float radian45 = MathHelper.ToRadians(45f); - int cometAmt = 5; - float cometSpread = -(radian45 * 2f) / (cometAmt - 1f); - for (int projIndex = 0; projIndex < cometAmt; ++projIndex) + Vector2 pos = new Vector2(target.Center.X + Main.rand.Next(-201, 201), Main.screenPosition.Y - 600f - Main.rand.Next(50)); + Vector2 meteorVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 20f, 3); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), pos, meteorVel, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f, 0.5f + Main.rand.NextFloat() * 0.3f); + + if (Projectile.Calamity().stealthStrike) { - int index2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, spinningpoint.RotatedBy((double)radian45 + (double)cometSpread * (double)projIndex, new Vector2()), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, -1f); - Projectile proj = Main.projectile[index2]; - for (int index3 = 0; index3 < Projectile.localNPCImmunity.Length; ++index3) + for (int i = 0; i < 5; i++) { - proj.localNPCImmunity[index3] = Projectile.localNPCImmunity[index3]; + Vector2 cometPos = new Vector2(target.Center.X + Main.rand.Next(-100, 101), target.Center.Y - 150f - Main.rand.Next(30)); + Vector2 cometVel = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(pos, target, 18f, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), cometPos, cometVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, -1f); } } } diff --git a/Projectiles/Rogue/LeviathanTooth.cs b/Projectiles/Rogue/LeviathanTooth.cs index 2851230620..c08c51506d 100644 --- a/Projectiles/Rogue/LeviathanTooth.cs +++ b/Projectiles/Rogue/LeviathanTooth.cs @@ -23,18 +23,13 @@ namespace CalamityMod.Projectiles.Rogue public bool canDamage = true; public bool canStick = true; public Vector2 vibrate = Vector2.Zero; - public int stuckTimer = 120; + public int stuckTimer = 180; public Vector2 placementCenter; float placementDistance; Vector2 placementVelocity; public Vector2 storedVelocity; public bool collideWithTiles = true; - - public bool jawline = true; // Tooth direction for the stealthstrike - public Vector2 startingVel; public bool toothDirection = false; - public Vector2 chomp = Vector2.Zero; - public bool chomping = true; public override void SetStaticDefaults() { ProjectileID.Sets.TrailCacheLength[Type] = 8; @@ -48,39 +43,42 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 2; + Projectile.extraUpdates = 3; Projectile.tileCollide = false; Projectile.timeLeft = 600; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; } public override void AI() { + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Red, Color.White, 0.85f).ToVector3() * 0.5f * Utils.GetLerpValue(255, 0, Projectile.alpha, true)); if (time == 0) { stuckTimer = Main.rand.Next(100, 120 + 1); - startingVel = Projectile.velocity; if (Projectile.ai[1] < 4) toothDirection = Main.rand.NextBool(); } if (!stuckInTarget && !stuckInGround) { - if (!Projectile.Calamity().stealthStrike) + if (Projectile.velocity.Length() > 5 && time > 30 && Projectile.numHits == 0) + Projectile.velocity *= 0.97f; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + if ((time % 2 == 0 || !canStick) && time > 5) { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if ((time % 2 == 0 || !canStick) && time > 15) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f)); - dust.noGravity = true; - } - if (time > 90 && canStick) - { - Projectile.velocity.Y += 0.03f; - if (Projectile.velocity.Y > 0) - Projectile.velocity.X *= 0.99f; - } + Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.3f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.4f) * (canStick ? 1 : 1.3f)); + dust.noGravity = true; + Particle blood = new CustomSpark(Projectile.Center, -Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedByRandom(canStick ? 0.3f : 0.1f) * Main.rand.NextFloat(5f, 8f), "CalamityMod/Particles/LargeBloom", + false, 8, Main.rand.NextFloat(0.055f, 0.07f), Color.Lerp(Color.DarkRed, Color.Black, Main.rand.NextFloat(0, 0.5f)) * 0.7f, new Vector2(0.7f, 1f), false, shrinkSpeed: 0.8f); + GeneralParticleHandler.SpawnParticle(blood); + } + if (time > 90 && canStick) + { + Projectile.velocity.Y += 0.03f; + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.99f; } } else if (stuckInTarget) @@ -107,7 +105,8 @@ namespace CalamityMod.Projectiles.Rogue vibrate = Vector2.Zero; canStick = false; collideWithTiles = true; - Projectile.velocity = storedVelocity * 1.3f; + Projectile.velocity = storedVelocity; + Projectile.extraUpdates = 4; stuckInTarget = false; for (int i = 0; i <= 7; i++) @@ -130,117 +129,33 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = storedVelocity.ToRotation() + MathHelper.PiOver2; } - if (Projectile.Calamity().stealthStrike) - { - collideWithTiles = false; - if (time > 15 && (Projectile.ai[1] == 4 ? Projectile.timeLeft > 60 : time < 40)) - { - for (int i = 0; i < (Projectile.ai[1] == 4 ? 2 : 1); i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 3 + Main.rand.NextVector2Circular(6, 6), 5, (-Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4).RotatedByRandom(0.5f) * Main.rand.NextFloat(0.1f, 0.8f), 100, default, Main.rand.NextFloat(0.8f, 1.6f)); - dust.noGravity = true; - } - } - if (Projectile.ai[1] == 4) - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; - int jawDir = jawline ? 1 : -1; - Vector2 spawnPos = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 170; - Vector2 jawVel = Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.ToRadians(90f * jawDir)) * 17; - if (time > 10 && Projectile.timeLeft >= 60) - { - if (time % 3 == 0) - { - Projectile tooth = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), spawnPos, jawVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack / 12, Projectile.owner, 0, 0, Projectile.velocity.X > 0 ? 1 : -1); - tooth.Calamity().stealthStrike = true; - tooth.timeLeft = 120; - tooth.extraUpdates = 0; - tooth.usesIDStaticNPCImmunity = true; - tooth.usesLocalNPCImmunity = false; - tooth.idStaticNPCHitCooldown = 5; - tooth.ai[1] = Main.rand.Next(1, 3 + 1); - jawline = !jawline; - } - if (time % 2 == 0) - { - Particle spark = new AltSparkParticle(Projectile.Center - Projectile.velocity * 0.5f, Projectile.velocity * 0.01f, false, 15, 1f, Color.DarkRed * 0.4f); - GeneralParticleHandler.SpawnParticle(spark); - } - if (Projectile.timeLeft == 60) - Projectile.velocity *= 0.5f; - } - else if (Projectile.timeLeft <= 60) - { - Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); - Projectile.velocity *= 0.95f; - } - } - else - { - Projectile.rotation = startingVel.ToRotation() + MathHelper.ToRadians(270f); - if (Projectile.timeLeft > 90) - { - Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, -startingVel.X * 1.3f, 0.045f); - Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, -startingVel.Y * 1.3f, 0.045f); - Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 120, 90, 255, 0)); - } - else - { - Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 30, 255, 0)); - Projectile.velocity *= 0.9f; - } - if (time > 40) - { - if (!chomping) - { - chomp.X = MathHelper.Lerp(chomp.X, startingVel.X * 3, 0.2f); - chomp.Y = MathHelper.Lerp(chomp.Y, startingVel.Y * 3, 0.2f); - } - else - { - chomp.X = MathHelper.Lerp(chomp.X, 0, 0.2f); - chomp.Y = MathHelper.Lerp(chomp.Y, 0, 0.2f); - } - if (time % 18 == 0) - chomping = !chomping; - } - - } - } - time++; - if (collideWithTiles && Collision.SolidCollision(Projectile.Center, 4, 4)) // Vanilla tile collision messes with velocity so we use this instead { canDamage = false; - if (Projectile.timeLeft > 180) - Projectile.timeLeft = 180; + Projectile.timeLeft = 180; stuckInGround = true; storedVelocity = Projectile.velocity.SafeNormalize(Vector2.UnitX); Projectile.velocity = Vector2.Zero; SoundStyle sound = new("CalamityMod/Sounds/NPCHit/RavagerRockPillarHit1"); SoundEngine.PlaySound(sound with { Volume = 0.25f, Pitch = Main.rand.NextFloat(-0.3f, -0.6f) }, Projectile.Center); collideWithTiles = false; - } - if (!Projectile.Calamity().stealthStrike) - Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); + Projectile.alpha = (int)(Utils.Remap(Projectile.timeLeft, 0, 60, 255, 0)); + time++; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.Calamity().stealthStrike) - modifiers.SourceDamage *= Projectile.ai[1] == 4 ? 0.6f : 0.5f; - else - modifiers.SourceDamage *= target == chosenTarget ? 1 : (canStick ? 0.2f : 0.5f); + modifiers.SourceDamage *= target == chosenTarget ? 1 : (canStick ? 0.2f : 0.5f); } public override bool? CanDamage() => canDamage ? null : false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (target == chosenTarget || Projectile.Calamity().stealthStrike) + if (target == chosenTarget) target.AddBuff(ModContent.BuffType(), 180); - if (!stuckInTarget && canStick && !Projectile.Calamity().stealthStrike) + if (!stuckInTarget && canStick) { if (Projectile.timeLeft < 400) Projectile.timeLeft = 400; @@ -266,10 +181,10 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[1] == 4) tex = ModContent.Request("CalamityMod/Projectiles/Melee/GreenWater").Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + vibrate + chomp, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, toothDirection ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + vibrate, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, toothDirection ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0); return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 18, targetHitbox); } } diff --git a/Projectiles/Rogue/LeviathanToothStealth.cs b/Projectiles/Rogue/LeviathanToothStealth.cs new file mode 100644 index 0000000000..d727b1a8a8 --- /dev/null +++ b/Projectiles/Rogue/LeviathanToothStealth.cs @@ -0,0 +1,201 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.NPCs; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.Player; + +namespace CalamityMod.Projectiles.Rogue +{ + [PierceResistException] + public class LeviathanToothStealth : ModProjectile, ILocalizedModType + { + public override string Texture => "CalamityMod/Projectiles/Rogue/LeviathanTooth"; + public new string LocalizationCategory => "Projectiles.Rogue"; + public ref float time => ref Projectile.ai[0]; + + public bool canDamage = false; + public bool isTopJaw = false; + public float topJawRot = 0; + public float bottomJawRot = 0; + public int jawSlamTime = 25; + public bool spawnedDust = false; + public int jawLength = 750; + public int hitTimer = 0; + public Player Owner => Main.player[Projectile.owner]; + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 8; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 2; + Projectile.height = 2; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.extraUpdates = 0; + Projectile.tileCollide = false; + Projectile.timeLeft = 180; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 8; + Projectile.ArmorPenetration = 25; + Projectile.noEnchantmentVisuals = true; + } + + public override void AI() + { + if (hitTimer > 0) + hitTimer--; + if (time == 0) + { + topJawRot = -MathHelper.PiOver4; + bottomJawRot = MathHelper.PiOver4; + } + topJawRot *= 0.95f; + bottomJawRot *= 0.95f; + float openingRot = 0.5f; + if (time <= 10) + { + float lerpValue = 1 - (float)Math.Pow(Utils.GetLerpValue(10, 0, time, true), 2); + topJawRot = MathHelper.Lerp(-MathHelper.PiOver4, -MathHelper.PiOver4 - openingRot, lerpValue); + bottomJawRot = MathHelper.Lerp(MathHelper.PiOver4, MathHelper.PiOver4 + openingRot, lerpValue); + } + else + { + float lerpValue = (float)Math.Pow(Utils.GetLerpValue(11, jawSlamTime, time, true), 4); + topJawRot = MathHelper.Lerp(-MathHelper.PiOver4 - openingRot, 0, lerpValue); + bottomJawRot = MathHelper.Lerp(MathHelper.PiOver4 + openingRot, 0, lerpValue); + } + + if (time < jawSlamTime * 1.5f) + { + Owner.direction = Projectile.direction; + if (time < jawSlamTime) + { + Projectile.Center = Owner.Center; + Projectile.velocity = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld) * 0.01f; + } + Owner.itemTime = Owner.itemAnimation = 2; + Vector2 toMouse = Owner.Center.DirectionTo(Owner.Calamity().mouseWorld); + Owner.SetCompositeArmFront(true, CompositeArmStretchAmount.Full, toMouse.ToRotation() + topJawRot * Owner.direction + MathHelper.PiOver2 * -Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0)); + Owner.SetCompositeArmBack(true, CompositeArmStretchAmount.Full, toMouse.ToRotation() + bottomJawRot * Owner.direction + MathHelper.PiOver2 * -Owner.direction + (Owner.direction == -1 ? MathHelper.Pi : 0)); + } + if (time == jawSlamTime) + { + Owner.Calamity().GeneralScreenShakePower = 5f; + Owner.Calamity().ConsumeStealthByAttacking(); + SoundStyle crunch = new("CalamityMod/Sounds/NPCKilled/PerfSmallDeath"); + for (int i = 0; i < 3; i++) + SoundEngine.PlaySound(crunch with { Volume = 0.4f, Pitch = -0.1f * i, MaxInstances = 3 }, Projectile.Center); + SoundStyle crunch2 = new("CalamityMod/Sounds/NPCHit/RavagerHurt3"); + for (int i = 0; i < 2; i++) + SoundEngine.PlaySound(crunch2 with { Volume = 0.8f, Pitch = -0.4f * i, MaxInstances = 2 }, Projectile.Center); + canDamage = true; + } + + Projectile.Opacity = (float)Math.Pow(Utils.GetLerpValue(0, 40, Projectile.timeLeft, true), 4); + if (Projectile.Opacity <= 0.4f) + canDamage = false; + time++; + spawnedDust = false; + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float damageMult = 1; + if (hitTimer != 0) + damageMult = 0.2f; + bool jawsJustSlammed = (time >= jawSlamTime && time <= jawSlamTime + 8); + modifiers.SourceDamage *= (jawsJustSlammed ? 12 : 1) * damageMult; + if (hitTimer == 0) + hitTimer = Projectile.localNPCHitCooldown; + + if (target.CanBeMoved(true)) + target.velocity *= 0.05f; + } + public override bool? CanDamage() => canDamage ? null : false; + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + } + + public override bool PreDraw(ref Color lightColor) + { + if (time == 0) + return false; + + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Vector2 startPoint = Projectile.Center; + int distance = jawLength; + int travelLength = 35; + Vector2 endPoint = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX) * distance; + Vector2 direction = Projectile.velocity.SafeNormalize(Vector2.UnitX); + + for (int t = -1; t <= 1; t += 2) + { + SpriteEffects spriteFx = (!isTopJaw) ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + Color drawColor = Projectile.GetAlpha(lightColor); + int toothNum = 0; + for (int i = 0; i < distance; i += travelLength) + { + if (((isTopJaw && Projectile.direction == -1) || (!isTopJaw && Projectile.direction == 1)) && i == 0) + i += (int)(travelLength * 0.5f); + + float jawRot = (isTopJaw ? topJawRot : bottomJawRot); + float scale = (Projectile.scale + 0.35f - 0.02f * toothNum); + float slamLerp = (float)Math.Pow(Utils.GetLerpValue(0, jawSlamTime * 1.5f, time, true), 4); + float sine = ((float)Math.Pow((float)Math.Sin((time + toothNum * 3) / 10), 4)) * slamLerp; + Vector2 drawPos = (startPoint + i * direction.RotatedBy(jawRot)) + direction.RotatedBy(MathHelper.PiOver2 * (isTopJaw ? 1 : -1)) * (-25 * scale - 65 * sine * scale); + Vector2 toMouse = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 finalDrawPos = drawPos + toMouse.RotatedBy(jawRot) * 5 * (1 - slamLerp) + Main.rand.NextVector2Circular(14, 14) * (time >= jawSlamTime ? Utils.GetLerpValue(jawSlamTime + 30, jawSlamTime, time, true) : 0); + float rotation = Projectile.velocity.ToRotation() + (jawRot) + (isTopJaw ? MathHelper.Pi : 0); + float toothOpacity = Math.Min((float)Math.Pow(Utils.GetLerpValue(0, toothNum, time, true), 3), Projectile.Opacity); + Main.EntitySpriteDraw(tex, finalDrawPos - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, toothOpacity) * toothOpacity, rotation, new Vector2(tex.Width / 2, tex.Height), new Vector2(1f, 1) * scale, spriteFx, 0); + toothNum++; + + if (!spawnedDust && toothNum > 1) + { + Dust dust = Dust.NewDustPerfect(finalDrawPos, 5, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.5f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), 100, default, Main.rand.NextFloat(1.1f, 1.9f) * scale); + dust.noGravity = true; + dust.alpha = (int)(255 * (1 - toothOpacity)); + Particle blood = new CustomSpark(finalDrawPos, (rotation.ToRotationVector2().RotatedBy(MathHelper.PiOver2)).RotatedByRandom(0.4f).RotatedBy(1.2f * (isTopJaw ? -1 : 1)) * Main.rand.NextFloat(5f, 8f), "CalamityMod/Particles/LargeBloom", + false, 8, Main.rand.NextFloat(0.065f, 0.08f) * scale, Color.Lerp(Color.DarkRed, Color.Black, Main.rand.NextFloat(0, 0.5f)) * 0.7f * toothOpacity, new Vector2(1f, 1f), false, shrinkSpeed: 0.9f); + GeneralParticleHandler.SpawnParticle(blood); + + Lighting.AddLight(finalDrawPos, Color.Lerp(Color.Red, Color.White, 0.85f).ToVector3() * 1.2f * toothOpacity); + } + } + isTopJaw = (t == -1); + } + spawnedDust = true; // Make sure effect spawning isn't happening based on frame rate + + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + if (!canDamage) + return false; + + Player Owner = Main.player[Projectile.owner]; + Vector2 start = Projectile.Center; + float length = jawLength; + float size = 165; + float _ = float.NaN; + bool hit = Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), start, start + Projectile.velocity.SafeNormalize(Vector2.UnitX) * length, size, ref _); + return (hit); + + return CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Calamity().stealthStrike ? 50 : 18, targetHitbox); + } + } +} diff --git a/Projectiles/Rogue/LostSoulFriendly.cs b/Projectiles/Rogue/LostSoulFriendly.cs index 1976f6b70e..3ed53a60cd 100644 --- a/Projectiles/Rogue/LostSoulFriendly.cs +++ b/Projectiles/Rogue/LostSoulFriendly.cs @@ -27,7 +27,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.extraUpdates = 1; Projectile.alpha = 150; - Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } public override bool? CanHitNPC(NPC target) => (Projectile.timeLeft < 210 || Projectile.ai[0] == 2f) && target.CanBeChasedBy(Projectile); @@ -54,7 +53,7 @@ namespace CalamityMod.Projectiles.Rogue // Reduce damage of projectiles if more than the cap are active public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (!Projectile.CountsAsClass()) + if (Projectile.DamageType == DamageClass.Generic) { int cap = 10; float capDamageFactor = 0.05f; diff --git a/Projectiles/Rogue/MangroveChakramProjectile.cs b/Projectiles/Rogue/MangroveChakramProjectile.cs index 81f4212305..4bed2c6456 100644 --- a/Projectiles/Rogue/MangroveChakramProjectile.cs +++ b/Projectiles/Rogue/MangroveChakramProjectile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0f); if (Main.rand.NextBool(5)) - Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.JungleSpore, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); + Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.ChlorophyteWeapon, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f); if (Projectile.Calamity().stealthStrike) { @@ -39,8 +39,8 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.timeLeft < 240) Projectile.Kill(); - Projectile.localAI[0] += Main.rand.Next(0, 3); - if (Projectile.localAI[0] >= 10f) + Projectile.localAI[0] += Main.rand.Next(1, 3); + if (Projectile.localAI[0] >= 20f) { Projectile.localAI[0] = 0f; Vector2 flowerSpawnPosition = Projectile.Center + Main.rand.NextVector2Square(-10f, 10f); @@ -58,7 +58,6 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Venom, 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Venom, 120); } } diff --git a/Projectiles/Rogue/MeteorFistProj.cs b/Projectiles/Rogue/MeteorFistProj.cs index cc694bad98..13e1a8b6f4 100644 --- a/Projectiles/Rogue/MeteorFistProj.cs +++ b/Projectiles/Rogue/MeteorFistProj.cs @@ -110,9 +110,6 @@ namespace CalamityMod.Projectiles.Rogue return false; } public override bool? CanDamage() => Projectile.numHits == 0 ? null : false; - - // Fuck off stupid Vile Spits - public override bool? CanHitNPC(NPC target) => NPCID.Sets.ProjectileNPC[target.type] ? false : null; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(BuffID.OnFire, 120); diff --git a/Projectiles/Rogue/PalladiumJavelinProjectile.cs b/Projectiles/Rogue/PalladiumJavelinProjectile.cs index 515e6f14b1..35653b5ee4 100644 --- a/Projectiles/Rogue/PalladiumJavelinProjectile.cs +++ b/Projectiles/Rogue/PalladiumJavelinProjectile.cs @@ -32,7 +32,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver4; //Stealth strike behavior - if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.Calamity().lineColor >= 2) + if (!Projectile.Calamity().stealthStrike || Projectile.owner != Main.myPlayer || Projectile.ai[2] >= 2) return; Projectile.localAI[0]++; if (Projectile.localAI[0] >= 12f) @@ -49,18 +49,13 @@ namespace CalamityMod.Projectiles.Rogue Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Palladium, 0f, 0f, 0, default, 1f); } - int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); - int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner); + int javelin = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); + int javelin2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.ToRadians(-3f)), Projectile.type, Projectile.damage, Projectile.knockBack, Projectile.owner, ai2: Projectile.ai[2] + 1); if (javelin.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[javelin].Calamity().lineColor = Projectile.Calamity().lineColor + 1; Main.projectile[javelin].Calamity().stealthStrike = true; - } if (javelin2.WithinBounds(Main.maxProjectiles)) - { - Main.projectile[javelin2].Calamity().lineColor = Projectile.Calamity().lineColor + 1; Main.projectile[javelin2].Calamity().stealthStrike = true; - } + Projectile.Kill(); } } diff --git a/Projectiles/Rogue/PenumbraBomb.cs b/Projectiles/Rogue/PenumbraBomb.cs index 3ecbfb63bd..ca892006b6 100644 --- a/Projectiles/Rogue/PenumbraBomb.cs +++ b/Projectiles/Rogue/PenumbraBomb.cs @@ -54,7 +54,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.alpha = 10; //Rotation Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); - Projectile.rotation = (Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi)) + (MathHelper.ToRadians(180) * Projectile.direction); + Projectile.rotation = Projectile.velocity.ToRotation() + (Projectile.spriteDirection == 1 ? 0f : MathHelper.Pi) + (MathHelper.ToRadians(180) * Projectile.direction); //Dust float dfreq = Projectile.Calamity().stealthStrike ? 8f : 4f; @@ -81,27 +81,24 @@ namespace CalamityMod.Projectiles.Rogue } public override void OnKill(int timeLeft) { - //Dark soul projectiles - int ad = Projectile.Calamity().stealthStrike ? 40 : 60; - float dmgMult = Projectile.Calamity().stealthStrike ? 0.08f : 0.15f; - int randrot = Main.rand.Next(-30, 31); - for (int i = 0; i < 360; i += ad) + // Dark soul projectiles + int projAmt = Projectile.Calamity().stealthStrike ? 8 : 6; + for (int i = 0; i < projAmt; i++) { - Vector2 SoulSpeed = new Vector2(13f, 13f).RotatedBy(MathHelper.ToRadians(i + randrot)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * dmgMult), 3f, Projectile.owner, 0f, 0f); + Vector2 SoulSpeed = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * i / projAmt) * 13f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, SoulSpeed, ModContent.ProjectileType(), (int)(Projectile.damage * 0.15f), 3f, Projectile.owner, 0f, 0f); } - //Dust + + // Dust int maxDust = Projectile.Calamity().stealthStrike ? 100 : 70; for (int i = 0; i < maxDust; i++) { Vector2 dustspeed = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-6f, 6f)); - int d = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); + Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, dustspeed.X, dustspeed.Y, 0, new Color(38, 30, 43), 1.6f); } + SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.width = 110; - Projectile.height = 110; - Projectile.position.X = Projectile.position.X - (Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (Projectile.height / 2); + Projectile.ExpandHitboxBy(110); Projectile.maxPenetrate = -1; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; @@ -115,7 +112,5 @@ namespace CalamityMod.Projectiles.Rogue CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(BuffID.Blackout, 300); } } diff --git a/Projectiles/Rogue/PenumbraSoul.cs b/Projectiles/Rogue/PenumbraSoul.cs index a942a55356..30bc73aab0 100644 --- a/Projectiles/Rogue/PenumbraSoul.cs +++ b/Projectiles/Rogue/PenumbraSoul.cs @@ -20,32 +20,26 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.height = 18; Projectile.width = 18; - Projectile.timeLeft = 150; Projectile.friendly = true; + Projectile.DamageType = RogueDamageClass.Instance; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.DamageType = RogueDamageClass.Instance; + Projectile.timeLeft = 240; Projectile.alpha = 80; - - Projectile.penetrate = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; Projectile.extraUpdates = 1; + DrawOffsetX = 1; + DrawOriginOffsetY = 4; } public override void AI() { Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - DrawOffsetX = 1; - DrawOriginOffsetY = 4; // Continuously trail dust int trailDust = 1; for (int i = 0; i < trailDust; ++i) { - int dustID = 54; //Used by Wraiths and other shadowy stuff - - int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); + int idx = Dust.NewDust(Projectile.position - Projectile.velocity, Projectile.width, Projectile.height, DustID.Wraith, 0f, 0f, 0, new Color(38, 30, 43)); Main.dust[idx].noGravity = true; Main.dust[idx].velocity += Projectile.velocity * 0.8f; } @@ -54,14 +48,20 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.ai[0] > 0f) Projectile.ai[0] -= 1f; - // Home in on nearby enemies if homing is enabled - if (Projectile.ai[1] == 0f) - HomingAI(); + // Home in on nearby enemies + CalamityUtils.HomeInOnNPC(Projectile, true, 400f, 12f, 35f); } - private void HomingAI() + public override void OnKill(int timeLeft) { - CalamityUtils.HomeInOnNPC(Projectile, true, 200f, 12f, 35f); + // Create a burst of dust + int dustAmt = Main.rand.Next(30, 41); + for (int i = 0; i < dustAmt; i++) + { + int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Wraith, 0f, 0f, 0, new Color(38, 30, 43), Main.rand.NextFloat(1f, 1.8f)); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= Main.rand.NextFloat(2f, 3.1f); + } } public override bool PreDraw(ref Color lightColor) @@ -69,48 +69,5 @@ namespace CalamityMod.Projectiles.Rogue CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); return false; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // Rapidly screech to a halt upon touching an enemy and disable homing. - Projectile.velocity *= 0.4f; - Projectile.ai[1] = 1f; - - // Fade out a bit with every hit - Projectile.alpha += 20; - if (Projectile.alpha > 255) - Projectile.alpha = 255; - - // Explode into dust (as if being shredded apart on contact) - int onHitDust = Main.rand.Next(6, 11); - for (int i = 0; i < onHitDust; ++i) - { - int dustID = 54; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); - - Main.dust[idx].noGravity = true; - float speed = Main.rand.NextFloat(1.4f, 2.6f); - Main.dust[idx].velocity *= speed; - float scale = Main.rand.NextFloat(1.0f, 1.8f); - Main.dust[idx].scale = scale; - } - } - - public override void OnKill(int timeLeft) - { - // Create a burst of dust - int killDust = Main.rand.Next(30, 41); - for (int i = 0; i < killDust; ++i) - { - int dustID = 54; - int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustID, 0f, 0f, 0, new Color(38, 30, 43)); - - Main.dust[idx].noGravity = true; - float speed = Main.rand.NextFloat(2.0f, 3.1f); - Main.dust[idx].velocity *= speed; - float scale = Main.rand.NextFloat(1.0f, 1.8f); - Main.dust[idx].scale = scale; - } - } } } diff --git a/Projectiles/Rogue/PlaguedFuelPackCloud.cs b/Projectiles/Rogue/PlaguedFuelPackCloud.cs index 24e2dfa9d1..5c968220db 100644 --- a/Projectiles/Rogue/PlaguedFuelPackCloud.cs +++ b/Projectiles/Rogue/PlaguedFuelPackCloud.cs @@ -6,32 +6,42 @@ using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { - [PierceResistException] public class PlaguedFuelPackCloud : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; + public int dir = 0; + public float intensity = 0; + public override void SetStaticDefaults() + { + ProjectileID.Sets.CultistIsResistantTo[Type] = true; + } public override void SetDefaults() { Projectile.width = 28; Projectile.height = 24; Projectile.friendly = true; Projectile.alpha = 0; - Projectile.penetrate = -1; - Projectile.tileCollide = true; + Projectile.penetrate = 1; + Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 120; + Projectile.timeLeft = 390; + Projectile.extraUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; + Projectile.localNPCHitCooldown = -1; Projectile.DamageType = RogueDamageClass.Instance; - Projectile.ArmorPenetration = 5; + Projectile.ArmorPenetration = 10; } public override void AI() { if (Projectile.timeLeft < 50) Projectile.alpha += 5; - if (Projectile.timeLeft < 75) - Projectile.velocity *= 0.95f; + if (dir == 0) + { + Projectile.timeLeft -= Main.rand.Next(5, 20 + 1); + dir = Main.rand.NextBool() ? -1 : 1; + intensity = Main.rand.NextFloat(0.2f, 1.2f); + } if (Main.rand.NextBool(150)) { @@ -40,6 +50,11 @@ namespace CalamityMod.Projectiles.Rogue Main.dust[dust].velocity *= 1.2f; Main.dust[dust].velocity.Y -= 0.15f; } + + if (Projectile.timeLeft < 290) + CalamityUtils.HomeInOnSelectedNPC(Projectile, Projectile.Center.ClosestNPCAt(1000), true, 0.65f * intensity, 6, 0.98f, 0.995f, true); + else + Projectile.velocity = Projectile.velocity.RotatedBy(0.006f * dir * intensity) * Main.rand.NextFloat(0.985f, 1f); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 240); diff --git a/Projectiles/Rogue/SacrificeProjectile.cs b/Projectiles/Rogue/SacrificeProjectile.cs index 2942d3ed40..a935577557 100644 --- a/Projectiles/Rogue/SacrificeProjectile.cs +++ b/Projectiles/Rogue/SacrificeProjectile.cs @@ -55,20 +55,8 @@ namespace CalamityMod.Projectiles.Rogue // Heal the player and disappear when touching them. if (Projectile.Hitbox.Intersects(Owner.Hitbox)) { - if (!Owner.moonLeech && AbleToHealOwner) - { - int heal = Projectile.Calamity().stealthStrike ? 40 : 3; - - if (Main.LocalPlayer.lifeSteal <= 0f) - { - Projectile.Kill(); - return; - } - - Main.LocalPlayer.lifeSteal -= heal; - Owner.HealPlayer(heal); - } - + if (AbleToHealOwner) + Owner.DoLifestealDirect(null, Projectile.Calamity().stealthStrike ? 40 : 3, 0.4f); Projectile.Kill(); } } diff --git a/Projectiles/Rogue/SamsaraSlicerProjectile.cs b/Projectiles/Rogue/SamsaraSlicerProjectile.cs index 1433f615a4..6d50d7f4ce 100644 --- a/Projectiles/Rogue/SamsaraSlicerProjectile.cs +++ b/Projectiles/Rogue/SamsaraSlicerProjectile.cs @@ -54,7 +54,6 @@ namespace CalamityMod.Projectiles.Rogue { width = 20; height = 20; - return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); } @@ -219,8 +218,6 @@ namespace CalamityMod.Projectiles.Rogue } else { - //Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); - Main.EntitySpriteDraw(ModContent.Request("CalamityMod/Items/Weapons/Rogue/SamsaraSlicerGlow").Value, Projectile.Center - Main.screenPosition + randVec, tex.Frame(), new Color(0f, 1f, 0f, 0f), Projectile.rotation, tex.Frame().Center(), 1f, SpriteEffects.None); } return false; diff --git a/Projectiles/Rogue/ScarletDevilProjectile.cs b/Projectiles/Rogue/ScarletDevilProjectile.cs index fa631e61cb..7193fa5ca1 100644 --- a/Projectiles/Rogue/ScarletDevilProjectile.cs +++ b/Projectiles/Rogue/ScarletDevilProjectile.cs @@ -131,14 +131,7 @@ namespace CalamityMod.Projectiles.Rogue SpawnOnStealthStrikeBullets(); // Give on-heal effects from stealth strikes. - int heal = (int)Math.Round(hit.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ProjectileID.VampireHeal, (int)Math.Round(hit.Damage * 0.005), 0.5f); } public override void OnHitPlayer(Player target, Player.HurtInfo info) @@ -150,16 +143,6 @@ namespace CalamityMod.Projectiles.Rogue // Spawn a bloom of bullets. SpawnOnStealthStrikeBullets(); - - // Give on-heal effects from stealth strikes. - int heal = (int)Math.Round(info.Damage * 0.01); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ProjectileID.VampireHeal, BalancingConstants.LifeStealRange); } internal float WidthFunction(float completionRatio) diff --git a/Projectiles/Rogue/ShinobiBladeProjectile.cs b/Projectiles/Rogue/ShinobiBladeProjectile.cs index 8ce4a2584a..60c026f0be 100644 --- a/Projectiles/Rogue/ShinobiBladeProjectile.cs +++ b/Projectiles/Rogue/ShinobiBladeProjectile.cs @@ -71,14 +71,8 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); } - if (target.life <= 0 && target.lifeMax > 5) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); - } - - public override void OnHitPlayer(Player target, Player.HurtInfo info) - { - if (target.statLife <= 0) - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], 10, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, 0f); + if (target.life <= 0) + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), 10, 0f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Rogue/ShockTeslaAura.cs b/Projectiles/Rogue/ShockTeslaAura.cs index da9583480a..999b7d269d 100644 --- a/Projectiles/Rogue/ShockTeslaAura.cs +++ b/Projectiles/Rogue/ShockTeslaAura.cs @@ -94,19 +94,9 @@ namespace CalamityMod.Projectiles.Rogue { target.AddBuff(BuffID.Electrified, 60); target.AddBuff(ModContent.BuffType(), 60); - - if (target.knockBackResist <= 0f) - return; - - // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); - Vector2 trueKnockback = target.Center - Projectile.Center; - trueKnockback.Normalize(); - target.velocity = trueKnockback * knockbackMultiplier; - } } + // CIT 2MAY2025: Replaced old manual knockback code with setting HitDirectionOverride + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { diff --git a/Projectiles/Rogue/SlickCaneProjectile.cs b/Projectiles/Rogue/SlickCaneProjectile.cs index ce965f114c..061241ef8a 100644 --- a/Projectiles/Rogue/SlickCaneProjectile.cs +++ b/Projectiles/Rogue/SlickCaneProjectile.cs @@ -80,7 +80,7 @@ namespace CalamityMod.Projectiles.Rogue { Player player = Main.player[Projectile.owner]; //Dont drop money from Dummies, WoF eyes and worm segments to make grinding money a bit harder and not give money from Dummies since that was apparently happening - if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !NeedsDebuffIconDisplayList.Includes(target.type)) + if (Projectile.owner == Main.myPlayer && target.IsAnEnemy(false) && !target.dontCountMe && !CalamityNPCSets.ForceDrawDebuffDisplay[target.type]) { float moneyValueToDrop = target.value / Main.rand.NextFloat(15f, 35f); // Maximum of 50 silver, not counting steath strikes diff --git a/Projectiles/Rogue/TalonSmallProj.cs b/Projectiles/Rogue/TalonSmallProj.cs index 017bdfe455..1694f4b37d 100644 --- a/Projectiles/Rogue/TalonSmallProj.cs +++ b/Projectiles/Rogue/TalonSmallProj.cs @@ -43,19 +43,18 @@ namespace CalamityMod.Projectiles.Rogue // spawn dust if (Main.rand.NextBool(5)) { - int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.UnusedBrown; + int dustType = Main.rand.NextBool() ? DustID.Chlorophyte : DustID.Ash; Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, dustType, Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, Scale: 0.9f); } - // freely spins instead of facing forwards - Projectile.rotation += 0.26f; + Projectile.rotation = Projectile.velocity.ToRotation(); Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt(); Projectile.ai[0]++; } private void ApplySineVelocity(Vector2 baseVelocity) { - float radians = Projectile.ai[1] * (float)Math.Sin(-MathHelper.PiOver2 + 0.25f * Projectile.ai[0]); + float radians = Projectile.ai[1] * (float)Math.Sin(-MathHelper.PiOver2 + 0.25f * Projectile.ai[0]) * 0.5f; Projectile.velocity = baseVelocity.RotatedBy(radians); } @@ -71,7 +70,9 @@ namespace CalamityMod.Projectiles.Rogue public override bool PreDraw(ref Color lightColor) { Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); + Color draw = Color.Lerp(lightColor, Color.White, 0.5f); + SpriteEffects sp = Projectile.ai[1] == -1 ? SpriteEffects.FlipVertically : SpriteEffects.None; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(draw), Projectile.rotation, tex.Size() / 2f, Projectile.scale, sp, 0); return false; } } diff --git a/Projectiles/Rogue/TotalMeltdown.cs b/Projectiles/Rogue/TotalMeltdown.cs index 48e2eb7e92..f439d9122b 100644 --- a/Projectiles/Rogue/TotalMeltdown.cs +++ b/Projectiles/Rogue/TotalMeltdown.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.penetrate = -1; Projectile.timeLeft = Main.projFrames[Type] * 5; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; + Projectile.localNPCHitCooldown = -1; } public override void AI() diff --git a/Projectiles/Rogue/TotalityFlask.cs b/Projectiles/Rogue/TotalityFlask.cs index 545f479c5b..e4ca68525c 100644 --- a/Projectiles/Rogue/TotalityFlask.cs +++ b/Projectiles/Rogue/TotalityFlask.cs @@ -79,7 +79,7 @@ namespace CalamityMod.Projectiles.Rogue Dust dust2 = Main.dust[index3]; dust2.velocity *= 3f; } - int tarAmt = Main.rand.Next(2, 4); + int tarAmt = Projectile.Calamity().stealthStrike ? 5 : Main.rand.Next(2, 3+1); for (int t = 0; t < tarAmt; t++) { Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); diff --git a/Projectiles/Rogue/TotalityTar.cs b/Projectiles/Rogue/TotalityTar.cs index 98d51d5ec5..c9b92c8d76 100644 --- a/Projectiles/Rogue/TotalityTar.cs +++ b/Projectiles/Rogue/TotalityTar.cs @@ -79,23 +79,16 @@ namespace CalamityMod.Projectiles.Rogue { SoundEngine.PlaySound(SoundID.Item74, Projectile.position); Vector2 vector2 = new Vector2(20f, 20f); - for (int index = 0; index < 3; ++index) + for (int i = 0; i < 3; ++i) Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.SpookyWood, 0.0f, 0.0f, 0, Color.Red, 1f); - for (int index1 = 0; index1 < 5; ++index1) + for (int j = 0; j < 5; ++j) { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); - Dust dust = Main.dust[index2]; - dust.velocity *= 1.4f; - } - for (int index1 = 0; index1 < 10; ++index1) - { - int index2 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); - Dust dust1 = Main.dust[index2]; - dust1.noGravity = true; - dust1.velocity *= 5f; - int index3 = Dust.NewDust(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 1.5f); - Dust dust2 = Main.dust[index3]; - dust2.velocity *= 3f; + Dust smoke = Dust.NewDustDirect(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Smoke, 0.0f, 0.0f, 100, new Color(), 1.5f); + smoke.velocity *= 1.4f; + + Dust fire = Dust.NewDustDirect(Projectile.Center - vector2 / 2f, (int)vector2.X, (int)vector2.Y, DustID.Torch, 0.0f, 0.0f, 100, new Color(), 2.5f); + fire.noGravity = true; + fire.velocity *= 5f; } int fireAmt = Main.rand.Next(2, 4); if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Rogue/ValariBoomerang.cs b/Projectiles/Rogue/ValariBoomerang.cs index 9db3525406..f285f7f0ae 100644 --- a/Projectiles/Rogue/ValariBoomerang.cs +++ b/Projectiles/Rogue/ValariBoomerang.cs @@ -145,7 +145,6 @@ namespace CalamityMod.Projectiles.Rogue Projectile.velocity.Y -= acceleration; } - // Delete the projectile if it touches its owner. if (Main.myPlayer == Projectile.owner) if (Projectile.Hitbox.Intersects(owner.Hitbox)) @@ -198,8 +197,6 @@ namespace CalamityMod.Projectiles.Rogue { OnHitEffects(target); target.AddBuff(BuffID.Frostburn2, 120); - if (Projectile.Calamity().stealthStrike) - target.AddBuff(ModContent.BuffType(), 45); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Rogue/WhitewaterProj.cs b/Projectiles/Rogue/WhitewaterProj.cs index cd84b2652d..35c966e664 100644 --- a/Projectiles/Rogue/WhitewaterProj.cs +++ b/Projectiles/Rogue/WhitewaterProj.cs @@ -164,7 +164,6 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Hitbox.Intersects(Owner.Hitbox)) { - Projectile.Kill(); if (Projectile.Calamity().stealthStrike) { foreach (Projectile p in Main.ActiveProjectiles) @@ -175,8 +174,9 @@ namespace CalamityMod.Projectiles.Rogue p.timeLeft = 30; } } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.3f), Projectile.knockBack, Projectile.owner, 0f, 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack, Projectile.owner, 0f, 0f); } + Projectile.Kill(); } } } diff --git a/Projectiles/Rogue/WhitewaterSpear.cs b/Projectiles/Rogue/WhitewaterSpear.cs index c16a59f091..c0967afa4f 100644 --- a/Projectiles/Rogue/WhitewaterSpear.cs +++ b/Projectiles/Rogue/WhitewaterSpear.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 5; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 20 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Rogue/WulfrumKnifeProj.cs b/Projectiles/Rogue/WulfrumKnifeProj.cs index 4f6a26f038..8265a8eec9 100644 --- a/Projectiles/Rogue/WulfrumKnifeProj.cs +++ b/Projectiles/Rogue/WulfrumKnifeProj.cs @@ -25,10 +25,26 @@ namespace CalamityMod.Projectiles.Rogue ProjectileID.Sets.TrailingMode[Type] = 0; } - public static int Lifetime = 950; + public static int Lifetime = 1200; public float LifetimeCompletion => MathHelper.Clamp((Lifetime - Projectile.timeLeft) / (float)Lifetime, 0f, 1f); public float StealthEffectOpacity => MathHelper.Clamp(1 - LifetimeCompletion, 0f, 1f); + public float StuckEnemyID + { + get { return Projectile.ai[0]; } + set { Projectile.ai[0] = value; } + } + public float StuckEnemyDistance + { + get { return Projectile.ai[1]; } + set { Projectile.ai[1] = value; } + } + public float StuckEnemyRotation + { + get { return Projectile.ai[2]; } + set { Projectile.ai[2] = value; } + } + public override void SetDefaults() { Projectile.width = 12; @@ -41,11 +57,42 @@ namespace CalamityMod.Projectiles.Rogue Projectile.extraUpdates = 5; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 1; + Projectile.stopsDealingDamageAfterPenetrateHits = true; } public override void AI() { + if (StuckEnemyID > 0) + { + Projectile.tileCollide = false; + if (!Main.npc[(int)StuckEnemyID-1].active) + { + Projectile.Kill(); + return; + } + Projectile.Center = Main.npc[(int)StuckEnemyID-1].Center + Vector2.UnitX.RotatedBy(StuckEnemyRotation) * StuckEnemyDistance; + return; + } + if (StuckEnemyID == -1) + { + var player = Main.player[Projectile.owner]; + Projectile.velocity = Projectile.DirectionTo(player.Center) * 10f; + Projectile.rotation = Projectile.velocity.ToRotation() - MathHelper.PiOver2; + if (Main.rand.NextBool(3)) + { + Vector2 dustCenter = Projectile.Center + Main.rand.NextVector2Circular(4f, 4f); + + Dust chust = Dust.NewDustPerfect(dustCenter, 15, -Projectile.velocity * Main.rand.NextFloat(0.2f, 0.1f), Scale: Main.rand.NextFloat(1.2f, 1.8f)); + chust.noGravity = true; + } + if (Projectile.Distance(player.Center) < 16) + { + player.Calamity().rogueStealth += player.Calamity().rogueStealthMax * 0.067f; + Projectile.Kill(); + } + return; + } Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; Projectile.velocity *= 0.998f; @@ -92,6 +139,10 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { SoundEngine.PlaySound(WulfrumKnife.TileHitSound, Projectile.Center); + Projectile.timeLeft = Lifetime; + StuckEnemyID = target.whoAmI+1; + StuckEnemyDistance = Projectile.Distance(target.Center); + StuckEnemyRotation = Projectile.DirectionFrom(target.Center).ToRotation(); } public override bool OnTileCollide(Vector2 oldVelocity) @@ -118,7 +169,7 @@ namespace CalamityMod.Projectiles.Rogue Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; float opacitey = StealthEffectOpacity; - if (Projectile.Calamity().stealthStrike) + if (Projectile.Calamity().stealthStrike && StuckEnemyID == 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); diff --git a/Projectiles/Summon/AmphibiansGuitarHoldout.cs b/Projectiles/Summon/AmphibiansGuitarHoldout.cs index 966171311f..0b2a688865 100644 --- a/Projectiles/Summon/AmphibiansGuitarHoldout.cs +++ b/Projectiles/Summon/AmphibiansGuitarHoldout.cs @@ -4,6 +4,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.GameContent; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -23,6 +24,7 @@ namespace CalamityMod.Projectiles.Summon private static readonly int MinionType = ModContent.ProjectileType(); + public override void SetStaticDefaults() => ProjectileID.Sets.MinionTargettingFeature[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 50; diff --git a/Projectiles/Summon/AmphibiansGuitarMinion.cs b/Projectiles/Summon/AmphibiansGuitarMinion.cs index ddfab3cd17..5f026779bb 100644 --- a/Projectiles/Summon/AmphibiansGuitarMinion.cs +++ b/Projectiles/Summon/AmphibiansGuitarMinion.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Summon SoundStyle spawnSound = new("CalamityMod/Sounds/Item/AmphibiansGuitarSummon"); SoundEngine.PlaySound(spawnSound with { Volume = 0.8f, Pitch = (GuitarSprite == 2 || GuitarSprite == 5) ? -0.15f : 0f }, Projectile.Center); - ShootTimer = GuitarSprite * 10f; + ShootTimer = GuitarSprite * 12f; _hasSpawned = true; } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon if (Target != null) { bool bigShot = ShootCount % 3 == 0; - if (ShootTimer > 80f && Main.myPlayer == Projectile.owner) + if (ShootTimer > 96f && Main.myPlayer == Projectile.owner) { for (int i = 0; i < (bigShot ? 3 : 1); i++) { @@ -76,7 +76,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.NewProjectile( Projectile.GetSource_FromThis(), Projectile.Center, - CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, 18f * (1f - Math.Abs(rot))).RotatedBy(rot), + CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, Target, (bigShot ? 36f : 25f) * (1f - Math.Abs(rot))).RotatedBy(rot), ProjectileType(), Projectile.damage, Projectile.knockBack, @@ -140,8 +140,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/AmphibiansGuitarProjectile.cs b/Projectiles/Summon/AmphibiansGuitarProjectile.cs index 5782e66785..535762ab1d 100644 --- a/Projectiles/Summon/AmphibiansGuitarProjectile.cs +++ b/Projectiles/Summon/AmphibiansGuitarProjectile.cs @@ -33,21 +33,20 @@ namespace CalamityMod.Projectiles.Summon Projectile.width = 54; Projectile.height = 44; Projectile.timeLeft = 150; - Projectile.localNPCHitCooldown = 20; Projectile.friendly = true; Projectile.tileCollide = false; + Projectile.penetrate = 1; Projectile.usesLocalNPCImmunity = true; - Projectile.penetrate = -1; - Projectile.extraUpdates = 0; + Projectile.localNPCHitCooldown = 20; } public override void AI() { if (time == 0) { - if (IsHatNote) - Projectile.penetrate = 1; if (Projectile.ai[2] == 5) - Projectile.extraUpdates = 1; + { + Projectile.penetrate = 3; + } } Projectile.scale = 1.6f * Utils.GetLerpValue(-5, 20, time, true); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; diff --git a/Projectiles/Summon/ApexShark.cs b/Projectiles/Summon/ApexShark.cs index e0063dc6e0..3bef24a545 100644 --- a/Projectiles/Summon/ApexShark.cs +++ b/Projectiles/Summon/ApexShark.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 8; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -239,6 +240,8 @@ namespace CalamityMod.Projectiles.Summon } + public override bool MinionContactDamage() => HitCooldown == 0; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Main.rand.NextBool(3)) @@ -253,14 +256,5 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; HitCooldown = 20; } - - public override bool? CanHitNPC(NPC target) - { - if (HitCooldown == 0) - { - return null; - } - return false; - } } } diff --git a/Projectiles/Summon/AquaticStarMinion.cs b/Projectiles/Summon/AquaticStarMinion.cs index f060849af8..62857a92d2 100644 --- a/Projectiles/Summon/AquaticStarMinion.cs +++ b/Projectiles/Summon/AquaticStarMinion.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -70,6 +71,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.ChargingMinionAI(1200f, 1500f, 2200f, 150f, 0, 24f, 15f, 4f, new Vector2(0f, -60f), 12f, 12f, false, false, 1); } + public override bool MinionContactDamage() => true; + + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = true; // Should always be able to fly through platforms + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); + } + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/AstrageldonSummon.cs b/Projectiles/Summon/AstrageldonSummon.cs index 795b62514b..c5a3c69c48 100644 --- a/Projectiles/Summon/AstrageldonSummon.cs +++ b/Projectiles/Summon/AstrageldonSummon.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -209,6 +210,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override bool OnTileCollide(Vector2 oldVelocity) => false; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Summon/AstralProbeSummon.cs b/Projectiles/Summon/AstralProbeSummon.cs index 64de6fe834..d9743cab03 100644 --- a/Projectiles/Summon/AstralProbeSummon.cs +++ b/Projectiles/Summon/AstralProbeSummon.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -150,8 +151,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - #endregion } } diff --git a/Projectiles/Summon/BabyBloodCrawler.cs b/Projectiles/Summon/BabyBloodCrawler.cs index c3b33c47d2..10fdd37bb7 100644 --- a/Projectiles/Summon/BabyBloodCrawler.cs +++ b/Projectiles/Summon/BabyBloodCrawler.cs @@ -9,12 +9,13 @@ namespace CalamityMod.Projectiles.Summon public class BabyBloodCrawler : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public static int bloodCooldown = 0; + public int bloodCooldown = 0; public float dust = 0f; public override void SetStaticDefaults() { Main.projFrames[Type] = 11; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -36,7 +37,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; Projectile.MaxUpdates = 2; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 33 * Projectile.MaxUpdates; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) @@ -53,19 +54,6 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - foreach (Projectile proj in Main.ActiveProjectiles) - { - // Short circuits to make the loop as fast as possible - if (proj.owner != Projectile.owner || !proj.minion || proj.Calamity().lineColor != 1) - continue; - if (proj.type == Projectile.type) - { - proj.Calamity().lineColor = 2; - } - } - if (Projectile.Calamity().lineColor == 0) - Projectile.Calamity().lineColor = 1; - if (dust == 0f) { int constant = 16; @@ -96,23 +84,20 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override bool OnTileCollide(Vector2 oldVelocity) => false; - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(target.Center); - - public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(target.Center); - - private void OnHitEffects(Vector2 targetPos) + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => OnHitEffects(target); + public override void OnHitPlayer(Player target, Player.HurtInfo info) => OnHitEffects(target); + private void OnHitEffects(Entity target) { if (bloodCooldown == 0) { - bloodCooldown = 17; - int projAmt = 2; - var source = Projectile.GetSource_FromThis(); - for (int n = 0; n < projAmt; n++) - { - CalamityUtils.ProjectileRain(source, targetPos, 400f, 100f, 400f, 700f, 29f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack * Main.rand.NextFloat(0.7f, 1f), Projectile.owner); - } + bloodCooldown = 15; + Vector2 spawnPos = target.Center + Vector2.UnitX * Main.rand.NextFloat(-100f, 100f) - Vector2.UnitY * Main.rand.NextFloat(400f, 700f); + Vector2 velocity = CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(spawnPos, target, 25f, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPos, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Summon/BelladonnaSpirit.cs b/Projectiles/Summon/BelladonnaSpirit.cs index 5d99e1cd20..d4cd8ae282 100644 --- a/Projectiles/Summon/BelladonnaSpirit.cs +++ b/Projectiles/Summon/BelladonnaSpirit.cs @@ -106,8 +106,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/BlackDragonHead.cs b/Projectiles/Summon/BlackDragonHead.cs index 3bca4cd7c6..875ad6599a 100644 --- a/Projectiles/Summon/BlackDragonHead.cs +++ b/Projectiles/Summon/BlackDragonHead.cs @@ -216,6 +216,8 @@ namespace CalamityMod.Projectiles.Summon } + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.ShadowFlame, 300); } } diff --git a/Projectiles/Summon/BlackHawkSummon.cs b/Projectiles/Summon/BlackHawkSummon.cs index a3b25021a1..93d42c501c 100644 --- a/Projectiles/Summon/BlackHawkSummon.cs +++ b/Projectiles/Summon/BlackHawkSummon.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; - Main.projFrames[Type] = 6; } public override void SetDefaults() @@ -299,9 +300,6 @@ namespace CalamityMod.Projectiles.Summon } } - //Does no contact damage - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/BloodSpit.cs b/Projectiles/Summon/BloodSpit.cs index 89167493d4..d3784b56ab 100644 --- a/Projectiles/Summon/BloodSpit.cs +++ b/Projectiles/Summon/BloodSpit.cs @@ -28,7 +28,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 6; Projectile.DamageType = DamageClass.Summon; - Projectile.Calamity().BloodstoneOrbValue = 20; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. + Projectile.Calamity().BloodstoneOrbValue = 12; //Bloodstone Orb lifesteal. May want to go back to regular lifesteal. } public override void AI() diff --git a/Projectiles/Summon/BrimstoneElementalMinion.cs b/Projectiles/Summon/BrimstoneElementalMinion.cs index 9def69225a..81f4e960a3 100644 --- a/Projectiles/Summon/BrimstoneElementalMinion.cs +++ b/Projectiles/Summon/BrimstoneElementalMinion.cs @@ -43,7 +43,7 @@ namespace CalamityMod.Projectiles.Summon bool isActive = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.brimstoneWaifu && !modPlayer.allWaifus && !modPlayer.brimstoneWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.brimElemental && !modPlayer.allElementals && !modPlayer.brimElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -52,9 +52,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.bWaifu = false; + modPlayer.brimEleBuff = false; } - if (modPlayer.bWaifu) + if (modPlayer.brimEleBuff) { Projectile.timeLeft = 2; } @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[brimDust].scale *= 1.15f; } } - bool passive = modPlayer.brimstoneWaifuVanity || modPlayer.allWaifusVanity; + bool passive = modPlayer.brimElementalVanity || modPlayer.allElementalsVanity; Projectile.frameCounter++; if (Projectile.frameCounter > 9) { @@ -210,7 +210,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.brimstoneWaifuVanity || modPlayer.allWaifusVanity) + if (modPlayer.brimElementalVanity || modPlayer.allElementalsVanity) { return false; } diff --git a/Projectiles/Summon/BrimstoneFireSummon.cs b/Projectiles/Summon/BrimstoneFireSummon.cs index d3399e3df5..5c72c4c722 100644 --- a/Projectiles/Summon/BrimstoneFireSummon.cs +++ b/Projectiles/Summon/BrimstoneFireSummon.cs @@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.extraUpdates = 3; Projectile.timeLeft = 50; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 9; + Projectile.idStaticNPCHitCooldown = 12; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/BrimstoneLaserSummon.cs b/Projectiles/Summon/BrimstoneLaserSummon.cs index 4e5fda6383..69c063bd29 100644 --- a/Projectiles/Summon/BrimstoneLaserSummon.cs +++ b/Projectiles/Summon/BrimstoneLaserSummon.cs @@ -16,26 +16,24 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = Projectile.height = 2; + Projectile.width = Projectile.height = 10; Projectile.aiStyle = ProjAIStyleID.Arrow; + AIType = ProjectileID.CursedBullet; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.alpha = 120; Projectile.timeLeft = 300; - AIType = ProjectileID.DeathLaser; + Projectile.extraUpdates = 2; Projectile.DamageType = DamageClass.Summon; } public override void AI() { Lighting.AddLight(Projectile.Center, Projectile.Opacity * 0.5f, Projectile.Opacity * 0.05f, Projectile.Opacity * 0.05f); - Projectile.velocity.X *= 1.05f; - Projectile.velocity.Y *= 1.05f; Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 120); - public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 120); public override Color? GetAlpha(Color lightColor) => new Color(250, 50, 50, Projectile.alpha); diff --git a/Projectiles/Summon/CalamarisLamentMinion.cs b/Projectiles/Summon/CalamarisLamentMinion.cs index dd9d517abe..057b2ccb67 100644 --- a/Projectiles/Summon/CalamarisLamentMinion.cs +++ b/Projectiles/Summon/CalamarisLamentMinion.cs @@ -54,13 +54,13 @@ namespace CalamityMod.Projectiles.Summon } else { - if (Main.rand.NextBool(600)) + if (Main.rand.NextBool(800)) { SoundStyle glubNoise = Main.rand.NextBool() ? SoundID.Zombie35 : SoundID.Zombie34; SoundStyle trollBirdChirpingSound = SoundID.Zombie16; - // 1/200th chance to do a bird chirping sound. - SoundEngine.PlaySound(Main.rand.NextBool(200) ? trollBirdChirpingSound : glubNoise, Projectile.Center); + // 1/2000th chance to do a bird chirping sound. + SoundEngine.PlaySound(Main.rand.NextBool(2000) ? trollBirdChirpingSound : glubNoise, Projectile.Center); } } diff --git a/Projectiles/Summon/CalamarisLamentProjectile.cs b/Projectiles/Summon/CalamarisLamentProjectile.cs index 56f317b73b..c4ad77518b 100644 --- a/Projectiles/Summon/CalamarisLamentProjectile.cs +++ b/Projectiles/Summon/CalamarisLamentProjectile.cs @@ -38,7 +38,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.ignoreWater = true; Projectile.usesLocalNPCImmunity = true; } - + public override bool? CanHitNPC(NPC target) + { + return target.CanBeChasedBy() ? null : false; + } public override void AI() { if (TargetShot is not null && TargetShot.active) diff --git a/Projectiles/Summon/Calamitamini.cs b/Projectiles/Summon/Calamitamini.cs index a7c0bfb1ec..f1c755a738 100644 --- a/Projectiles/Summon/Calamitamini.cs +++ b/Projectiles/Summon/Calamitamini.cs @@ -210,25 +210,23 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[1] > 0f) { - Projectile.ai[1] += (float)Main.rand.Next(1, 4); + Projectile.ai[1] += Main.rand.Next(2, 3+1); } - if (Projectile.ai[1] > 110f) + if (Projectile.ai[1] > 100f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; } if (Projectile.ai[0] == 0f) { - float projSpeed = 8f; + float projSpeed = 10f; int projType = ModContent.ProjectileType(); if (foundTarget && Projectile.ai[1] == 0f) { Projectile.ai[1] += 1f; if (Main.myPlayer == Projectile.owner && Collision.CanHitLine(Projectile.Center, Projectile.width, Projectile.height, targetVec, 0, 0)) { - Vector2 velocity = targetVec - Projectile.Center; - velocity.Normalize(); - velocity *= projSpeed; + Vector2 velocity = Utils.DirectionTo(Projectile.Center, targetVec) * projSpeed; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, projType, Projectile.damage, Projectile.knockBack, Projectile.owner); Projectile.netUpdate = true; } @@ -245,7 +243,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/Cataclymini.cs b/Projectiles/Summon/Cataclymini.cs index dabd888069..b67690cdcc 100644 --- a/Projectiles/Summon/Cataclymini.cs +++ b/Projectiles/Summon/Cataclymini.cs @@ -239,7 +239,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, yStart, texture.Width, frameHeight)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2(texture.Width / 2f, frameHeight / 2f), Projectile.scale, SpriteEffects.None, 0); return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/Catastromini.cs b/Projectiles/Summon/Catastromini.cs index 1766bdf8be..956f049214 100644 --- a/Projectiles/Summon/Catastromini.cs +++ b/Projectiles/Summon/Catastromini.cs @@ -35,6 +35,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.idStaticNPCHitCooldown = 8; Projectile.DamageType = DamageClass.Summon; } + public override bool MinionContactDamage() => Projectile.ai[0] == 2f; public override void AI() { diff --git a/Projectiles/Summon/CausticStaffProjectile.cs b/Projectiles/Summon/CausticStaffProjectile.cs index 79ad9f70d0..a5f79fccff 100644 --- a/Projectiles/Summon/CausticStaffProjectile.cs +++ b/Projectiles/Summon/CausticStaffProjectile.cs @@ -58,7 +58,7 @@ namespace CalamityMod.Projectiles.Summon switch ((int)Projectile.ai[0]) { case 0: - if (target.Calamity().marked <= 0) + if (target.Calamity().markedForDeath) target.AddBuff(ModContent.BuffType(), duration); break; case 1: diff --git a/Projectiles/Summon/CausticStaffSummon.cs b/Projectiles/Summon/CausticStaffSummon.cs index ca75b21aa9..501472f410 100644 --- a/Projectiles/Summon/CausticStaffSummon.cs +++ b/Projectiles/Summon/CausticStaffSummon.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -285,7 +286,5 @@ namespace CalamityMod.Projectiles.Summon } public override bool OnTileCollide(Vector2 oldVelocity) => false; - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/CelestialAxeMinion.cs b/Projectiles/Summon/CelestialAxeMinion.cs index 888c97d688..932f8ec4fb 100644 --- a/Projectiles/Summon/CelestialAxeMinion.cs +++ b/Projectiles/Summon/CelestialAxeMinion.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -75,6 +76,9 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Projectile.GetAlpha(lightColor), Projectile.rotation, tex.Size() / 2f, Projectile.scale, SpriteEffects.None, 0); return false; } + + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); diff --git a/Projectiles/Summon/CinderBlossom.cs b/Projectiles/Summon/CinderBlossom.cs index d594e5ff50..d6125c9863 100644 --- a/Projectiles/Summon/CinderBlossom.cs +++ b/Projectiles/Summon/CinderBlossom.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -89,7 +90,5 @@ namespace CalamityMod.Projectiles.Summon DelayBetweenShooting++; } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/CloudElementalMinion.cs b/Projectiles/Summon/CloudElementalMinion.cs index 2a8fa900b4..336fbb5feb 100644 --- a/Projectiles/Summon/CloudElementalMinion.cs +++ b/Projectiles/Summon/CloudElementalMinion.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.cloudWaifu && !modPlayer.allWaifus && !modPlayer.cloudWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.cloudElemental && !modPlayer.allElementals && !modPlayer.cloudElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -51,9 +51,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.cWaifu = false; + modPlayer.cloudEleBuff = false; } - if (modPlayer.cWaifu) + if (modPlayer.cloudEleBuff) { Projectile.timeLeft = 2; } @@ -85,7 +85,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } - if (!modPlayer.cloudWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.cloudElementalVanity && !modPlayer.allElementalsVanity) { float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; @@ -146,7 +146,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.cloudWaifuVanity || modPlayer.allWaifusVanity) + if (modPlayer.cloudElementalVanity || modPlayer.allElementalsVanity) { return false; } diff --git a/Projectiles/Summon/CorroslimeMinion.cs b/Projectiles/Summon/CorroslimeMinion.cs index 06d676e565..9fd7296ef8 100644 --- a/Projectiles/Summon/CorroslimeMinion.cs +++ b/Projectiles/Summon/CorroslimeMinion.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -80,6 +81,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/CosmicEnergySpiral.cs b/Projectiles/Summon/CosmicEnergySpiral.cs index bc06a90b67..14049b2ad4 100644 --- a/Projectiles/Summon/CosmicEnergySpiral.cs +++ b/Projectiles/Summon/CosmicEnergySpiral.cs @@ -221,7 +221,5 @@ namespace CalamityMod.Projectiles.Summon { return new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/CosmicViperSummon.cs b/Projectiles/Summon/CosmicViperSummon.cs index 747eb5e5c6..0dffeca8d7 100644 --- a/Projectiles/Summon/CosmicViperSummon.cs +++ b/Projectiles/Summon/CosmicViperSummon.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projFrames[Type] = 3; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; - Main.projFrames[Type] = 3; } public override void SetDefaults() @@ -69,12 +70,11 @@ namespace CalamityMod.Projectiles.Summon for (int dustIndex = 0; dustIndex < dustAmt; dustIndex++) { int dustType = Main.rand.NextBool(3) ? 56 : 242; - Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - rotate = rotate.RotatedBy((double)((float)(dustIndex - (dustAmt / 2 - 1)) * MathHelper.TwoPi / (float)dustAmt), default) + Projectile.Center; + Vector2 rotate = Vector2.Normalize(Projectile.velocity) * new Vector2(Projectile.width / 2f, Projectile.height) * 0.75f; + rotate = rotate.RotatedBy(dustIndex * MathHelper.TwoPi / (float)dustAmt) + Projectile.Center; Vector2 faceDirection = rotate - Projectile.Center; - int dusty = Dust.NewDust(rotate + faceDirection, 0, 0, dustType, faceDirection.X * 1.75f, faceDirection.Y * 1.75f, 100, default, 1.1f); - Main.dust[dusty].noGravity = true; - Main.dust[dusty].velocity = faceDirection; + Dust dusty = Dust.NewDustPerfect(Projectile.Center, dustType, faceDirection, 100, default, 1.1f); + dusty.noGravity = true; } // Construct a fake item to use with vanilla code for the sake of firing bullets. @@ -307,8 +307,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/CosmilampMinion.cs b/Projectiles/Summon/CosmilampMinion.cs index a3f6adb628..1d7269474d 100644 --- a/Projectiles/Summon/CosmilampMinion.cs +++ b/Projectiles/Summon/CosmilampMinion.cs @@ -148,8 +148,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation, origin, Projectile.scale, direction, 0); return false; } - - // The lamps themselves do not do damage, but they do store damage for the sake of shooting projectiles. - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/CrimslimeMinion.cs b/Projectiles/Summon/CrimslimeMinion.cs index 2ce626218e..934db01829 100644 --- a/Projectiles/Summon/CrimslimeMinion.cs +++ b/Projectiles/Summon/CrimslimeMinion.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -80,6 +81,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override bool PreDraw(ref Color lightColor) { Texture2D texture2D13 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/DaedalusGolem.cs b/Projectiles/Summon/DaedalusGolem.cs index dfcfa3f201..5a47080b5d 100644 --- a/Projectiles/Summon/DaedalusGolem.cs +++ b/Projectiles/Summon/DaedalusGolem.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 18; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -297,7 +298,5 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/DankCreeperMinion.cs b/Projectiles/Summon/DankCreeperMinion.cs index 98dadc21e2..4aedb83069 100644 --- a/Projectiles/Summon/DankCreeperMinion.cs +++ b/Projectiles/Summon/DankCreeperMinion.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -208,6 +209,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (Projectile.owner == Main.myPlayer) diff --git a/Projectiles/Summon/DazzlingStabber.cs b/Projectiles/Summon/DazzlingStabber.cs index b965693fe2..4322dbb52a 100644 --- a/Projectiles/Summon/DazzlingStabber.cs +++ b/Projectiles/Summon/DazzlingStabber.cs @@ -45,7 +45,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.tileCollide = false; Projectile.minion = true; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.localNPCHitCooldown = 28; Projectile.DamageType = DamageClass.Summon; } @@ -303,7 +303,9 @@ namespace CalamityMod.Projectiles.Summon } public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); - public override bool? CanDamage() => attackCooldown == 0 ? null : false; + + public override bool? CanDamage() => (attackCooldown == 0 ? base.CanDamage() : false); + public override bool PreDraw(ref Color lightColor) { Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/DeathstareEyeball.cs b/Projectiles/Summon/DeathstareEyeball.cs index 6ef2b94958..9cdbf33a3e 100644 --- a/Projectiles/Summon/DeathstareEyeball.cs +++ b/Projectiles/Summon/DeathstareEyeball.cs @@ -24,6 +24,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.NeedsUUID[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; @@ -169,7 +170,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(pupilTexture, pupilDrawPosition, null, Projectile.GetAlpha(lightColor), PupilAngle, pupilTexture.Size() * 0.5f, PupilScale, SpriteEffects.None); return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/DormantBrimseekerBab.cs b/Projectiles/Summon/DormantBrimseekerBab.cs index f26f66f14a..183b6108fc 100644 --- a/Projectiles/Summon/DormantBrimseekerBab.cs +++ b/Projectiles/Summon/DormantBrimseekerBab.cs @@ -26,12 +26,10 @@ namespace CalamityMod.Projectiles.Summon } public override void SetStaticDefaults() { - Main.projFrames[Type] = 8; - + Main.projPet[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 7; ProjectileID.Sets.TrailingMode[Type] = 2; - ProjectileID.Sets.MinionSacrificable[Type] = true; } @@ -153,6 +151,9 @@ namespace CalamityMod.Projectiles.Summon } Lighting.AddLight(Projectile.Center, Color.Red.ToVector3()); } + + public override bool MinionContactDamage() => true; + public override void PostDraw(Color lightColor) { if ((Projectile.ai[0] > 0f && Projectile.ai[0] <= MaxChargeTime && Projectile.velocity.Length() >= 8f) || SeekingTarget) diff --git a/Projectiles/Summon/EXPLODINGFROG.cs b/Projectiles/Summon/EXPLODINGFROG.cs index a54e7caea0..dc5e5ecb1f 100644 --- a/Projectiles/Summon/EXPLODINGFROG.cs +++ b/Projectiles/Summon/EXPLODINGFROG.cs @@ -1,6 +1,10 @@ -using CalamityMod.Buffs.DamageOverTime; +using System; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -11,8 +15,8 @@ namespace CalamityMod.Projectiles.Summon public class EXPLODINGFROG : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public const float MinExplodeDistance = 120f; - public const float ExplodeWaitTime = 45f; + public const float MinExplodeDistance = 96f; + public const float ExplodeWaitTime = 120f; public const float ExplosionAngleVariance = 0.8f; public override void SetStaticDefaults() { @@ -35,6 +39,11 @@ namespace CalamityMod.Projectiles.Summon public override void AI() { + if (Projectile.ai[1] == 0) + { + Projectile.ai[0] = 75; + Projectile.ai[1] = 1; + } if (Projectile.frameCounter++ > 5) { Projectile.frame++; @@ -46,39 +55,56 @@ namespace CalamityMod.Projectiles.Summon } Player player = Main.player[Projectile.owner]; bool canExplode = Projectile.Center.ClosestNPCAt(MinExplodeDistance) != null; - if (player.HasMinionAttackTargetNPC) + if (player.HasMinionAttackTargetNPC && !canExplode) { canExplode = Main.npc[player.MinionAttackTargetNPC].Distance(Projectile.Center) < MinExplodeDistance; } - if (canExplode) + if (Projectile.ai[0] < ExplodeWaitTime) Projectile.ai[0]++; if (Projectile.ai[0] >= ExplodeWaitTime) { - if (Main.myPlayer == Projectile.owner) + if (canExplode) { - // Goop projectiles - for (int i = 0; i < 3; i++) + if (Main.myPlayer == Projectile.owner) { + Vector2 rotOffset = -Vector2.UnitY; + if (player.HasMinionAttackTargetNPC && Main.npc[player.MinionAttackTargetNPC].Distance(Projectile.Center) < MinExplodeDistance + Math.Max(Main.npc[player.MinionAttackTargetNPC].width * 0.5f, Main.npc[player.MinionAttackTargetNPC].height * 0.5f)) + rotOffset = (Projectile.DirectionTo(Main.npc[player.MinionAttackTargetNPC].Center)); + else + { + var tar = Projectile.Center.ClosestNPCAt(MinExplodeDistance); + if (tar != null) + rotOffset = (Projectile.DirectionTo(tar.Center)); + } + // Goop projectiles + Vector2 direction = Vector2.Lerp(-Vector2.UnitY, rotOffset, 0.25f).SafeNormalize(-Vector2.UnitY); + for (int i = 0; i < 3; i++) + { + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, + (direction * Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, + (direction * Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + } Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + (direction * Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + (direction * Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, + (direction * Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), + ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, - new Vector2(0f, -Main.rand.NextFloat(6f, 10f)).RotatedByRandom(ExplosionAngleVariance), - ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + // WoF vomit sound. + SoundEngine.PlaySound(SoundID.NPCDeath13, Projectile.Center); + Projectile.ai[0] = 0; + + //do a little hop + if (Projectile.velocity.Length() < 0.1f) + Projectile.velocity.Y -= 5; } - // WoF vomit sound. - SoundEngine.PlaySound(SoundID.NPCDeath13, Projectile.Center); - Projectile.Kill(); } Projectile.velocity.Y += 0.5f; @@ -91,12 +117,55 @@ namespace CalamityMod.Projectiles.Summon public override bool? CanDamage() => false; // Don't die on tile collision - public override bool OnTileCollide(Vector2 oldVelocity) => false; + public override bool OnTileCollide(Vector2 oldVelocity) + { + Projectile.velocity *= 0.8f; + return false; + } public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { fallThrough = false; return true; } + private static Texture2D GlowOutline = null; + public static Texture2D GetGlowOutline() + { + if (GlowOutline == null) + { + var texture = ModContent.Request("CalamityMod/Projectiles/Summon/EXPLODINGFROG").Value; + GlowOutline = new Texture2D(Main.graphics.GraphicsDevice, texture.Width, texture.Height); + + var BaseArray = new Color[GlowOutline.Width * GlowOutline.Height]; + var ColorArray = new Color[GlowOutline.Width * GlowOutline.Height]; + texture.GetData(BaseArray); + for (var i = 0; i < BaseArray.Length; i++) + { + ColorArray[i] = new Color(255, 255, 255) * (((float)BaseArray[i].A) / 255f); + } + GlowOutline.SetData(ColorArray); + } + return GlowOutline; + } + + public void ApplyGlowOutline(Texture2D tex, Rectangle? frame = null, float rotationOffset = 0, float borderPixels = 1, float opacity = 1) + { + Color color = Color.GreenYellow; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(2, 0) * borderPixels, frame, color * opacity, Projectile.rotation - rotationOffset, new Vector2(frame.Value.Width,frame.Value.Height) *0.5f, Projectile.scale, (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, 2) * borderPixels, frame, color * opacity, Projectile.rotation - rotationOffset, new Vector2(frame.Value.Width, frame.Value.Height) * 0.5f, Projectile.scale, (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(-2, 0) * borderPixels, frame, color * opacity, Projectile.rotation - rotationOffset, new Vector2(frame.Value.Width, frame.Value.Height) * 0.5f, Projectile.scale, (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition + new Vector2(0, -2) * borderPixels, frame, color * opacity, Projectile.rotation - rotationOffset, new Vector2(frame.Value.Width, frame.Value.Height) * 0.5f, Projectile.scale, (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); + } + public override bool PreDraw(ref Color lightColor) + { + var tex = GetGlowOutline(); + var frame = tex.Frame(1, 5, 0, Projectile.frame); + ApplyGlowOutline(tex, frame, 0, MathF.Pow(Math.Clamp((Projectile.ai[0]-90)/(ExplodeWaitTime-90), 0, 1), 2),1); + + Lighting.AddLight(Projectile.Center, Color.GreenYellow.ToVector3()*(MathF.Pow(Math.Clamp((Projectile.ai[0] - 90) / (ExplodeWaitTime - 90), 0, 1), 2))); + tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor * Projectile.Opacity, Projectile.rotation, new Vector2(frame.Width, frame.Height) * 0.5f, Projectile.scale, (Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None), 0); + return false; + } } } diff --git a/Projectiles/Summon/EndoCooperBody.cs b/Projectiles/Summon/EndoCooperBody.cs index bab1116e24..487ec89ec1 100644 --- a/Projectiles/Summon/EndoCooperBody.cs +++ b/Projectiles/Summon/EndoCooperBody.cs @@ -351,12 +351,12 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition, frame, Color.LightSkyBlue, Projectile.rotation, Projectile.Size / 2, 1f, SpriteEffects.None, 0); } + public override bool MinionContactDamage() => AttackMode == 2; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { target.AddBuff(ModContent.BuffType(), 60); target.AddBuff(ModContent.BuffType(), 180); } - - public override bool? CanDamage() => AttackMode == 2; } } diff --git a/Projectiles/Summon/EndoHydraHead.cs b/Projectiles/Summon/EndoHydraHead.cs index cb231e8ac5..968be80d0a 100644 --- a/Projectiles/Summon/EndoHydraHead.cs +++ b/Projectiles/Summon/EndoHydraHead.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 5; + Main.projPet[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 0; ProjectileID.Sets.TrailCacheLength[Type] = 20; ProjectileID.Sets.MinionSacrificable[Type] = true; @@ -241,6 +242,5 @@ namespace CalamityMod.Projectiles.Summon 0); return false; } - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/EyeOfNightSummon.cs b/Projectiles/Summon/EyeOfNightSummon.cs index ffeccfa56a..d5e9b86981 100644 --- a/Projectiles/Summon/EyeOfNightSummon.cs +++ b/Projectiles/Summon/EyeOfNightSummon.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon public const int ShootRate = 60; public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -117,7 +118,5 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = (destination - Projectile.Center).SafeNormalize(Vector2.Zero) * flySpeed; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/FieryDraconid.cs b/Projectiles/Summon/FieryDraconid.cs index f93412f81f..995ee2a810 100644 --- a/Projectiles/Summon/FieryDraconid.cs +++ b/Projectiles/Summon/FieryDraconid.cs @@ -235,7 +235,7 @@ namespace CalamityMod.Projectiles.Summon modifiers.FinalDamage *= YharonsKindleStaff.ReboundRamDamageFactor; } - public override bool? CanDamage() => Projectile.localAI[0] > 1f; + public override bool MinionContactDamage() => Projectile.localAI[0] > 1f; public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Summon/FlarebatMinion.cs b/Projectiles/Summon/FlarebatMinion.cs index 66e1a5b87b..5231d03c3b 100644 --- a/Projectiles/Summon/FlarebatMinion.cs +++ b/Projectiles/Summon/FlarebatMinion.cs @@ -76,6 +76,14 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[0]++; } + // Teleport to the owner if abnormally far away + if (!Projectile.WithinRange(Owner.Center, 2000f)) + { + Projectile.position = Owner.Center; + Projectile.velocity *= 0.3f; + Projectile.netUpdate = true; + } + CurrentBehavior.Invoke(); Projectile.rotation = Projectile.rotation.AngleTowards(MathHelper.ToRadians(Projectile.velocity.X * 3f), 0.2f); Projectile.spriteDirection = MathF.Sign(Projectile.velocity.X); @@ -118,14 +126,14 @@ namespace CalamityMod.Projectiles.Summon // The first stage is redirecting towards the target. if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Vector2.Dot(Projectile.DirectionTo(Target.Center), Projectile.velocity.SafeNormalize(-Vector2.UnitY)) < 0.96f) { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.08f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 12f, 0f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(Target.Center).ToRotation(), 0.095f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(Target.Center), 6400f, 0f, 14f, 0f); } // When it's whithin a distnce and it hasn't dashed yet, it'll dash. else if (!AttackState.HasFlag(AttackBehaviorFlags.HasDashed) && Projectile.DistanceSQ(Target.Center) < 57600f) { - Projectile.velocity = Projectile.DirectionTo(Target.Center) * 15f; + Projectile.velocity = Projectile.DirectionTo(Target.Center) * 19f; AttackState |= AttackBehaviorFlags.HasDashed; Projectile.netUpdate = true; @@ -162,8 +170,8 @@ namespace CalamityMod.Projectiles.Summon // When it has arrived to it at a distance, reset the state and start over. if (AttackState.HasFlag(AttackBehaviorFlags.IsReturningToOwner)) { - Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.08f).ToRotationVector2() * - Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 12f, 0f); + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.DirectionTo(IdlePosition).ToRotation(), 0.095f).ToRotationVector2() * + Utils.Remap(Projectile.DistanceSQ(IdlePosition), 6400f, 0f, 14f, 0f); if (Projectile.DistanceSQ(IdlePosition) < 6400f) { diff --git a/Projectiles/Summon/FleshBallMinion.cs b/Projectiles/Summon/FleshBallMinion.cs index 3125b8f324..4de9b04216 100644 --- a/Projectiles/Summon/FleshBallMinion.cs +++ b/Projectiles/Summon/FleshBallMinion.cs @@ -125,6 +125,8 @@ namespace CalamityMod.Projectiles.Summon #endregion + public override bool MinionContactDamage() => true; + public override void OnSpawn(IEntitySource source) => IFrames = 30; // Prevent immediate death on tile collision, and slow down on tile collision. diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 90472d54b1..52e97c0270 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Type] = 4; ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionShot[Type] = true; //This marks it as a minion shot, which allows it to proc summon tag effects. } public override void SetDefaults() @@ -70,6 +71,8 @@ namespace CalamityMod.Projectiles.Summon float attackDistance = 100000f; bool canAttack = false; Projectile.ai[0] += 1f; + + NPC target = null; if (Projectile.ai[0] > 30f) { if (player.HasMinionAttackTargetNPC) @@ -82,14 +85,11 @@ namespace CalamityMod.Projectiles.Summon float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; + target = npc; } } } - if (!canAttack) + if (target.IsNullOrInactive()) { foreach (NPC npc in Main.ActiveNPCs) { @@ -100,60 +100,17 @@ namespace CalamityMod.Projectiles.Summon float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; + + target = npc; } } } } } - if (!canAttack) - { - projX = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; - projY = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; - } - float projVel = 0.16f; - Vector2 playerDirection = Projectile.Center; - float playerX = projX - playerDirection.X; - float playerY = projY - playerDirection.Y; - float playerDist = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerDist = 10f / playerDist; - playerX *= playerDist; - playerY *= playerDist; - if (Projectile.velocity.X < playerX) - { - Projectile.velocity.X = Projectile.velocity.X + projVel; - if (Projectile.velocity.X < 0f && playerX > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + projVel * 2f; - } - } - else if (Projectile.velocity.X > playerX) - { - Projectile.velocity.X = Projectile.velocity.X - projVel; - if (Projectile.velocity.X > 0f && playerX < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - projVel * 2f; - } - } - if (Projectile.velocity.Y < playerY) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVel; - if (Projectile.velocity.Y < 0f && playerY > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVel * 2f; - } - } - else if (Projectile.velocity.Y > playerY) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVel; - if (Projectile.velocity.Y > 0f && playerY < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVel * 2f; - } - } + if (!target.IsNullOrInactive()) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(target.Center) * 15, 0.1f); + else + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.Zero) * 15, 0.1f); } public override bool OnTileCollide(Vector2 oldVelocity) diff --git a/Projectiles/Summon/FrostBlossom.cs b/Projectiles/Summon/FrostBlossom.cs index c430427aad..9174f55597 100644 --- a/Projectiles/Summon/FrostBlossom.cs +++ b/Projectiles/Summon/FrostBlossom.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -88,7 +89,5 @@ namespace CalamityMod.Projectiles.Summon } } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/GammaHead.cs b/Projectiles/Summon/GammaHead.cs index c769643882..a521a54858 100644 --- a/Projectiles/Summon/GammaHead.cs +++ b/Projectiles/Summon/GammaHead.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -264,7 +265,5 @@ namespace CalamityMod.Projectiles.Summon return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/GastricBelcher.cs b/Projectiles/Summon/GastricBelcher.cs index 12856293d4..c4523cdeee 100644 --- a/Projectiles/Summon/GastricBelcher.cs +++ b/Projectiles/Summon/GastricBelcher.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -162,7 +163,7 @@ namespace CalamityMod.Projectiles.Summon //If farther than 200 pixels, move toward it if (targetDist > 200f) { - float speedMult = (targetDist > 400f) ? 12f : (targetDist > 250) ? 6f : 3f; + float speedMult = (targetDist > 400f) ? 16f : (targetDist > 250) ? 9f : 5f; vecToTarget *= speedMult; Projectile.velocity = (Projectile.velocity * 40f + vecToTarget) / 41f; } @@ -242,7 +243,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.ai[1] += Main.rand.Next(1, 4); } //Set the minion to be ready for attack - if (Projectile.ai[1] > 90f) + if (Projectile.ai[1] > 100f) { Projectile.ai[1] = 0f; Projectile.netUpdate = true; @@ -264,25 +265,23 @@ namespace CalamityMod.Projectiles.Summon //Increment the attack counter Projectile.ai[1]++; - int projType = ModContent.ProjectileType(); - //Calculate the general velocity Vector2 velocity = targetVec - Projectile.Center; velocity.Normalize(); //Add some inaccuracy for the vomit projectiles - float vomitSpeedMult = 16f; + float vomitSpeedMult = 20f; Vector2 vomitVel = velocity * vomitSpeedMult; vomitVel.Y += Main.rand.NextFloat(-30f, 30f) * 0.05f; vomitVel.X += Main.rand.NextFloat(-30f, 30f) * 0.05f; //Fire the vomit projectile - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vomitVel, projType, Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, vomitVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rand.Next(3), 0f); - //Fire 5 bubbles for every three attacks + //Fire 3 bubbles for every three attacks if (bubbleCounter++ % 3 == 2) { - for (int projCount = 0; projCount < 5; projCount++) + for (int projCount = 0; projCount < 3; projCount++) { //Add a shotgun spread to the bubbles float bubbleSpeedMult = 14f; @@ -298,9 +297,6 @@ namespace CalamityMod.Projectiles.Summon } } - //This minion does no contact damage - public override bool? CanDamage() => false; - public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; diff --git a/Projectiles/Summon/GastricBelcherVomit.cs b/Projectiles/Summon/GastricBelcherVomit.cs index f5c7e0265a..164a628baa 100644 --- a/Projectiles/Summon/GastricBelcherVomit.cs +++ b/Projectiles/Summon/GastricBelcherVomit.cs @@ -21,9 +21,9 @@ namespace CalamityMod.Projectiles.Summon Projectile.friendly = true; Projectile.width = Projectile.height = 18; Projectile.timeLeft = 300; - Projectile.penetrate = 3; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.penetrate = 2; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 30; Projectile.DamageType = DamageClass.Summon; } diff --git a/Projectiles/Summon/GhostFire.cs b/Projectiles/Summon/GhostFire.cs index d4f5d8136a..5517dc5ad6 100644 --- a/Projectiles/Summon/GhostFire.cs +++ b/Projectiles/Summon/GhostFire.cs @@ -36,7 +36,10 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } public override bool? CanDamage() => ableToHit ? (bool?)null : false; - + public override bool? CanHitNPC(NPC target) + { + return target.CanBeChasedBy() ? null : false; + } public override void AI() { Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Summon/HauntedDishes.cs b/Projectiles/Summon/HauntedDishes.cs index c37e9eca65..ece47484a5 100644 --- a/Projectiles/Summon/HauntedDishes.cs +++ b/Projectiles/Summon/HauntedDishes.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projFrames[Type] = 19; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; - Main.projFrames[Type] = 19; } public override void SetDefaults() @@ -566,8 +567,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) { fallThrough = false; diff --git a/Projectiles/Summon/HermitCrabMinion.cs b/Projectiles/Summon/HermitCrabMinion.cs index c40b5a5741..444d3c756a 100644 --- a/Projectiles/Summon/HermitCrabMinion.cs +++ b/Projectiles/Summon/HermitCrabMinion.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 9; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -359,6 +360,8 @@ namespace CalamityMod.Projectiles.Summon return true; } + public override bool MinionContactDamage() => true; + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/HerringAI.cs b/Projectiles/Summon/HerringAI.cs index 1c5e8e6087..54ae7836db 100644 --- a/Projectiles/Summon/HerringAI.cs +++ b/Projectiles/Summon/HerringAI.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -94,6 +95,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override bool OnTileCollide(Vector2 oldVelocity) => false; } } diff --git a/Projectiles/Summon/IceSentry.cs b/Projectiles/Summon/IceSentry.cs index 204cf095bf..83cce4898f 100644 --- a/Projectiles/Summon/IceSentry.cs +++ b/Projectiles/Summon/IceSentry.cs @@ -93,12 +93,10 @@ namespace CalamityMod.Projectiles.Summon rememberTarget = Collision.CanHit(Projectile.Center, 0, 0, npc.position, npc.width, npc.height); if (rememberTarget && Projectile.owner == Main.myPlayer) { - Vector2 speed = npc.Center - Projectile.Center; - speed.Normalize(); - speed *= 8f; + Vector2 iceSpeed = CalamityUtils.CalculatePredictiveAimToTarget(Projectile.Center, npc, 12f * (Utils.GetLerpValue(0f, 1000f, Vector2.Distance(Projectile.Center, npc.Center)) + 1)); if (Projectile.ai[1] >= 300f) - speed = speed.RotatedBy(MathHelper.ToRadians(Main.rand.Next(-5, 6))) * 1.5f + npc.velocity / 2f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, speed + npc.velocity / 2f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + iceSpeed = iceSpeed.RotatedByRandom(MathHelper.Pi * 0.025f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, iceSpeed, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } @@ -132,7 +130,6 @@ namespace CalamityMod.Projectiles.Summon if (possibleTarget > 0) { - //Main.NewText("new target acquired"); Projectile.ai[0] = possibleTarget; Projectile.ai[1] = 0f; Projectile.netUpdate = true; diff --git a/Projectiles/Summon/IgneousBlade.cs b/Projectiles/Summon/IgneousBlade.cs index 4bff9cf79d..f602fbbcd8 100644 --- a/Projectiles/Summon/IgneousBlade.cs +++ b/Projectiles/Summon/IgneousBlade.cs @@ -1,107 +1,207 @@ -using System.IO; +using System; +using System.IO; using CalamityMod.Buffs.Summon; -using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.Graphics; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon { + //Based off Virid Vanguard projectile code for circling and drawing logic public class IgneousBlade : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Summon"; - public bool Firing = false; + public enum AIState + { + CircleOwner, + TransitionToLaunch, + LaunchAtPos + } + + public int BladeIndex; + + public VertexStrip TrailDrawer; + + public Vector2 ChargeStartingPosition; + + public float BladeHoverOffsetAngle + { + get + { + float projectileCounts = Owner.ownedProjectileCounts[Type]; + if (projectileCounts <= 1f) + projectileCounts = 1f; + + return MathHelper.WrapAngle(MathHelper.TwoPi * BladeIndex / projectileCounts + MathHelper.TwoPi * (Owner.miscCounter % 60 / 60f)) * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); + } + } + + public AIState CurrentState + { + get => (AIState)Projectile.ai[0]; + set => Projectile.ai[0] = (int)value; + } + + public Player Owner => Main.player[Projectile.owner]; + + public ref float AITimer => ref Projectile.ai[1]; + + public ref float DistanceTimer => ref Projectile.ai[2]; + + public ref float BladeGleamInterpolant => ref Projectile.localAI[0]; + + public Vector2 ChargeTargetPos = Vector2.Zero; + public Vector2 ChargeStartPos = Vector2.Zero; + public override void SetStaticDefaults() { - ProjectileID.Sets.TrailingMode[Type] = 0; - ProjectileID.Sets.TrailCacheLength[Type] = 7; + ProjectileID.Sets.MinionSacrificable[Type] = true; + ProjectileID.Sets.TrailingMode[Type] = 2; + ProjectileID.Sets.TrailCacheLength[Type] = 45; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; } public override void SetDefaults() { - Projectile.width = 52; - Projectile.height = 86; + ProjectileID.Sets.MinionTargettingFeature[Type] = true; + + Projectile.width = 84; + Projectile.height = 84; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; - Projectile.minionSlots = 1f; - Projectile.timeLeft = 18000; + Projectile.timeLeft = 90000; Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 7; Projectile.tileCollide = false; - Projectile.timeLeft *= 5; Projectile.minion = true; + Projectile.minionSlots = 1f; Projectile.DamageType = DamageClass.Summon; + Projectile.stopsDealingDamageAfterPenetrateHits = true; } + public override void SendExtraAI(BinaryWriter writer) { - writer.Write(Firing); + writer.Write(BladeIndex); + writer.WriteVector2(ChargeStartingPosition); } + public override void ReceiveExtraAI(BinaryReader reader) { - Firing = reader.ReadBoolean(); + BladeIndex = reader.ReadInt32(); + ChargeStartingPosition = reader.ReadVector2(); } + + public override void AI() { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - bool isProperProjectile = Projectile.type == ModContent.ProjectileType(); - player.AddBuff(ModContent.BuffType(), 3600); - if (isProperProjectile) - { - if (player.dead) - { - modPlayer.igneousExaltation = false; - } - if (modPlayer.igneousExaltation) - { - Projectile.timeLeft = 2; - } - } + // Decide whether the minion should still exist. + HandleMinionBools(); - // Orbiting. 1 = Shooting - if (!Firing) + // Reset extra updates. + Projectile.MaxUpdates = 1; + + // Have the gleam interpolant dissipate. + BladeGleamInterpolant = MathHelper.Lerp(BladeGleamInterpolant, 0f, 0.1f); + if (BladeGleamInterpolant <= 0.02f) + BladeGleamInterpolant = 0f; + + switch (CurrentState) { - const float outwardPosition = 180f; - Projectile.Center = player.Center + Projectile.ai[0].ToRotationVector2() * outwardPosition + Vector2.UnitY * player.gfxOffY; - Projectile.rotation = Projectile.ai[0] + MathHelper.PiOver2 + MathHelper.PiOver4; - Projectile.ai[0] -= MathHelper.ToRadians(4f); + case AIState.CircleOwner: + CircleOwner(); + break; + case AIState.TransitionToLaunch: + ChargeTargetPos = Owner.Calamity().mouseWorld; + ChargeStartPos = Owner.Center; + CurrentState = AIState.LaunchAtPos; + AITimer = 0; + Projectile.penetrate = 50; + LaunchAtTargetPos(); + break; + case AIState.LaunchAtPos: + LaunchAtTargetPos(); + break; + } + if (CurrentState == AIState.CircleOwner) + { + if (Owner.HeldItem.type == ModContent.ItemType()) + AITimer++; + else + AITimer--; + AITimer = MathHelper.Clamp(AITimer, -IgneousExaltation.ChargeCooldown, 0); } else + AITimer++; + DistanceTimer++; + } + + public void CircleOwner() + { + Vector2 hoverDestination = Owner.Center + BladeHoverOffsetAngle.ToRotationVector2() * (DistanceTimer < 0 ? MathHelper.Lerp(200, 100, 1 - (-DistanceTimer) / IgneousExaltation.ChargeCooldown) : 100f); + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 24f); + Projectile.velocity *= 0.8f; + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 3200f)) { - if (Projectile.penetrate == -1) //limit penetration for worm memes - Projectile.penetrate = 3; + Projectile.Center = hoverDestination; + Projectile.netUpdate = true; + } - Projectile.ai[0]--; - if (Projectile.ai[0] == 1) - Projectile.Kill(); + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } - if (Projectile.ai[0] % 10f == 9f) - { - for (int i = 0; i < 20; i++) - { - float angle = MathHelper.TwoPi / 20f * i; - Dust dust = Dust.NewDustPerfect(Projectile.position + angle.ToRotationVector2().RotatedBy(Projectile.rotation) * new Vector2(14f, 21f), 6); - dust.velocity = angle.ToRotationVector2().RotatedBy(Projectile.rotation) * 2f; - dust.noGravity = true; - } - } + public void LaunchAtTargetPos() + { + Projectile.damage = Projectile.originalDamage; + if (Projectile.penetrate > 40) //First 10 hits do 2x damage + Projectile.damage *= 2; + int chargeTime = IgneousExaltation.ChargeDuration * 2; + int chargeLength = 2000; + float circleWidth = Math.Min(75, Owner.ownedProjectileCounts[Type] * 4); + var CurrentPlace = Vector2.Lerp(ChargeStartPos, ChargeStartPos + ChargeStartPos.DirectionTo(ChargeTargetPos) * chargeLength, MathF.Pow(AITimer / chargeTime, 3)); + Projectile.Center = CurrentPlace + BladeHoverOffsetAngle.ToRotationVector2() * Math.Max(MathHelper.Lerp(100f, 25f, AITimer / 10f), circleWidth); + Projectile.rotation = Projectile.AngleFrom(CurrentPlace) + MathHelper.PiOver2; + if (AITimer >= chargeTime) + { + Projectile.damage = Projectile.originalDamage; + AITimer = -IgneousExaltation.ChargeCooldown; + DistanceTimer = -IgneousExaltation.ChargeCooldown; + CurrentState = AIState.CircleOwner; + Projectile.penetrate = -1; } } + + public void HandleMinionBools() + { + Owner.AddBuff(ModContent.BuffType(), 3600); + if (Projectile.type == ModContent.ProjectileType()) + { + if (Owner.dead) + Owner.Calamity().igneousExaltation = false; + + if (Owner.Calamity().igneousExaltation) + Projectile.timeLeft = 2; + } + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Firing) - { + if (Projectile.penetrate >= 40 && CurrentState != AIState.CircleOwner) //The first 10 hits per launch can spawn blades if (Main.myPlayer == Projectile.owner) { - Projectile.ai[0] = 50; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 1; i++) { - Vector2 spawnPosition = target.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.ToRadians(8f)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Vector2.Normalize(target.Center - spawnPosition) * 24f, ModContent.ProjectileType(), + Vector2 spawnPosition = Projectile.Center - new Vector2(0f, 550f).RotatedByRandom(MathHelper.TwoPi); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnPosition, Vector2.Normalize(Projectile.Center - spawnPosition) * 24f, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } for (int i = 0; i < Main.rand.Next(28, 41); i++) @@ -113,44 +213,66 @@ namespace CalamityMod.Projectiles.Summon } Projectile.netUpdate = true; } - } + base.OnHitNPC(target, hit, damageDone); } - public override void OnKill(int timeLeft) + public Color TrailColorFunction(float completionRatio) { - for (int j = 0; j < 40; j++) - { - Dust dust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.Torch); - dust.velocity = Vector2.UnitY * Main.rand.NextFloat(3f, 5.5f) * Main.rand.NextBool().ToDirectionInt(); - dust.noGravity = true; - } + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + var redColor = new Color(166, 46, 61); + return Color.Lerp(redColor, new(64, 51, 66), MathHelper.Clamp(completionRatio * 1.4f, 0f, 1f)) * opacity; } + + public float TrailWidthFunction(float completionRatio) => Projectile.height * (1f - completionRatio) * 0.3f; + public override bool PreDraw(ref Color lightColor) { - if (Firing) + Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Vector2 origin = frame.Size() * 0.5f; + Vector2 drawPosition = Projectile.Center - Main.screenPosition; + SpriteEffects direction = Projectile.spriteDirection == 1 ^ Owner.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + + + // Draw the afterimage trail. + TrailDrawer ??= new(); + GameShaders.Misc["EmpressBlade"].UseImage0("Images/Extra_201"); + GameShaders.Misc["EmpressBlade"].UseImage1("Images/Extra_193"); + GameShaders.Misc["EmpressBlade"].UseShaderSpecificData(new Vector4(1f, 0f, 0f, 0.6f)); + GameShaders.Misc["EmpressBlade"].Apply(null); + TrailDrawer.PrepareStrip(Projectile.oldPos, Projectile.oldRot, TrailColorFunction, TrailWidthFunction, Projectile.Size * 0.5f - Main.screenPosition, Projectile.oldPos.Length, true); + TrailDrawer.DrawTrail(); + Main.pixelShader.CurrentTechnique.Passes[0].Apply(); + + // Draw the blade. + float outlineOpacity = 1; + float outlineWidth = 1; + if ((CurrentState == AIState.CircleOwner && AITimer < 0)) { - Texture2D texture = ModContent.Request("CalamityMod/Projectiles/Summon/IgneousBlade").Value; - - Rectangle rectangle = new Rectangle(0, 0, texture.Width, texture.Height); - - if (Lighting.NotRetro) - { - for (int i = 0; i < Projectile.oldPos.Length; i++) - { - Vector2 drawPos = Projectile.oldPos[i] + Projectile.Size / 2f - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY); - Color color = Color.Lerp(Color.White, Color.Red, i / (float)Projectile.oldPos.Length) * - ((Projectile.oldPos.Length - i) / (float)Projectile.oldPos.Length); - float scale = MathHelper.Lerp(Projectile.scale * 1.35f, Projectile.scale * 0.6f, i / (float)Projectile.oldPos.Length); - Main.EntitySpriteDraw(texture, drawPos, new Rectangle?(rectangle), color, - Projectile.rotation, - rectangle.Size() / 2f, scale, SpriteEffects.None, 0); - } - } - Main.EntitySpriteDraw(texture, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Rectangle?(rectangle), Color.White, - Projectile.rotation, - rectangle.Size() / 2f, 1.35f, SpriteEffects.None, 0); - return false; + outlineWidth = Math.Clamp(MathF.Pow(1 - (AITimer) / -IgneousExaltation.ChargeCooldown, 3), 0, 100); + outlineOpacity = 0.75f; } - return true; + var outlineTex = IgneousExaltation.GetBladeOutlineTex(); + float rotation = Projectile.rotation - MathHelper.PiOver4 * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, -2) * outlineWidth, frame, new Color(166, 46, 61) * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); + + // Draw the gleam at the tip of the blade. + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Vector2 shineScale = new Vector2(1.67f, 3f) * Projectile.scale; + shineScale *= MathHelper.Lerp(0.9f, 1.1f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.4f + Projectile.identity) * 0.5f + 0.5f); + + Vector2 lensFlareWorldPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.width * Projectile.scale * 0.88f; + Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Yellow, 0.23f) with { A = 0 } * BladeGleamInterpolant; + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, 0f, shineTex.Size() * 0.5f, shineScale * 0.6f, 0, 0); + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, MathHelper.PiOver2, shineTex.Size() * 0.5f, shineScale, 0, 0); + + // Reset textures for shaders, since they're only defined once at load-time in vanilla. + GameShaders.Misc["EmpressBlade"].UseImage0("Images/Extra_209"); + GameShaders.Misc["EmpressBlade"].UseImage1("Images/Extra_210"); + return false; } } } diff --git a/Projectiles/Summon/IgneousBladeStrike.cs b/Projectiles/Summon/IgneousBladeStrike.cs index 6762bec590..56459f6c93 100644 --- a/Projectiles/Summon/IgneousBladeStrike.cs +++ b/Projectiles/Summon/IgneousBladeStrike.cs @@ -1,6 +1,10 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Summon @@ -18,8 +22,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { Projectile.friendly = true; - Projectile.width = 86; - Projectile.height = 36; + Projectile.width = 50; + Projectile.height = 50; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.usesLocalNPCImmunity = true; @@ -27,6 +31,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 360; Projectile.alpha = 127; Projectile.DamageType = DamageClass.Summon; + Projectile.penetrate = 1; + Projectile.extraUpdates = 1; } public override void AI() @@ -44,5 +50,18 @@ namespace CalamityMod.Projectiles.Summon } SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); } + + public override bool PreDraw(ref Color lightColor) + { + + var AllWhiteTexture = IgneousExaltation.GetBladeOutlineTex(); + Main.spriteBatch.Draw(AllWhiteTexture, Projectile.Center + new Vector2(0,2) - Main.screenPosition, null, new Color(166, 46, 61), Projectile.rotation, AllWhiteTexture.Size()*0.5f, Projectile.scale * 1f, SpriteEffects.None, 1f); + Main.spriteBatch.Draw(AllWhiteTexture, Projectile.Center + new Vector2(2, 0) - Main.screenPosition, null, new Color(166, 46, 61), Projectile.rotation, AllWhiteTexture.Size() * 0.5f, Projectile.scale * 1f, SpriteEffects.None, 1f); + Main.spriteBatch.Draw(AllWhiteTexture, Projectile.Center + new Vector2(0, -2) - Main.screenPosition, null, new Color(166, 46, 61), Projectile.rotation, AllWhiteTexture.Size() * 0.5f, Projectile.scale * 1f, SpriteEffects.None, 1f); + Main.spriteBatch.Draw(AllWhiteTexture, Projectile.Center + new Vector2(-2, 0) - Main.screenPosition, null, new Color(166, 46, 61), Projectile.rotation, AllWhiteTexture.Size() * 0.5f, Projectile.scale * 1f, SpriteEffects.None, 1f); + var tex = TextureAssets.Projectile[Type].Value; + Main.spriteBatch.Draw(tex, Projectile.Center - Main.screenPosition, null, lightColor, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale * 1f, SpriteEffects.None, 1f); + return false; + } } } diff --git a/Projectiles/Summon/LiliesOfEternityBullet.cs b/Projectiles/Summon/LiliesOfEternityBullet.cs index 5cbe15d4d7..d87e226da0 100644 --- a/Projectiles/Summon/LiliesOfEternityBullet.cs +++ b/Projectiles/Summon/LiliesOfEternityBullet.cs @@ -60,9 +60,9 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); } } diff --git a/Projectiles/Summon/LiliesOfFinalityAriane.cs b/Projectiles/Summon/LiliesOfFinalityAriane.cs index 7139fe46db..ae5957be13 100644 --- a/Projectiles/Summon/LiliesOfFinalityAriane.cs +++ b/Projectiles/Summon/LiliesOfFinalityAriane.cs @@ -150,8 +150,6 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool? CanDamage() => false; - #endregion #region AI diff --git a/Projectiles/Summon/LiliesOfFinalityBullet.cs b/Projectiles/Summon/LiliesOfFinalityBullet.cs index 7dd9798613..19a527e5d2 100644 --- a/Projectiles/Summon/LiliesOfFinalityBullet.cs +++ b/Projectiles/Summon/LiliesOfFinalityBullet.cs @@ -64,9 +64,9 @@ namespace CalamityMod.Projectiles.Summon private Color PrimitiveColorFunction(float completionRatio) => Color.Lerp(Color.DarkGoldenrod, Color.LightGoldenrodYellow, completionRatio); - public void RenderPixelatedPrimitives(SpriteBatch spriteBatch) + public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, PixelationPrimitiveLayer layer) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(PrimitiveWidthFunction, PrimitiveColorFunction, (_) => Projectile.Size * 0.5f, pixelate: true, shader: GameShaders.Misc["CalamityMod:TrailStreak"])); } } diff --git a/Projectiles/Summon/LiliesOfFinalityElster.cs b/Projectiles/Summon/LiliesOfFinalityElster.cs index 3d52276011..5e67a36e07 100644 --- a/Projectiles/Summon/LiliesOfFinalityElster.cs +++ b/Projectiles/Summon/LiliesOfFinalityElster.cs @@ -146,8 +146,6 @@ namespace CalamityMod.Projectiles.Summon return true; } - public override bool? CanDamage() => false; - #endregion #region AI diff --git a/Projectiles/Summon/MechwormBody.cs b/Projectiles/Summon/MechwormBody.cs index b628517c67..dec72c4e7a 100644 --- a/Projectiles/Summon/MechwormBody.cs +++ b/Projectiles/Summon/MechwormBody.cs @@ -131,6 +131,7 @@ namespace CalamityMod.Projectiles.Summon projectile.ForceNetUpdate(false); projectile.extraUpdates = head.extraUpdates; + projectile.localNPCHitCooldown = head.localNPCHitCooldown; MechwormHead headModProj = head.ModProjectile(); if (headModProj.EndRiftGateUUID == -1) diff --git a/Projectiles/Summon/MechwormHead.cs b/Projectiles/Summon/MechwormHead.cs index bf954c8832..dbc9b6905e 100644 --- a/Projectiles/Summon/MechwormHead.cs +++ b/Projectiles/Summon/MechwormHead.cs @@ -180,6 +180,7 @@ namespace CalamityMod.Projectiles.Summon PortalAttackMovement(potentialTarget); UpdateAttackStates(); Projectile.extraUpdates = 1; + Projectile.localNPCHitCooldown = 30 * Projectile.MaxUpdates; } // Attacking movement can be canceled, so if it was, run the passive movement instead. else @@ -201,6 +202,7 @@ namespace CalamityMod.Projectiles.Summon private void PlayerFollowMovement(Player owner) { Projectile.extraUpdates = 0; + Projectile.localNPCHitCooldown = 30; // Reset the gate UUID from any previous teleports. if (EndRiftGateUUID != -1) @@ -316,7 +318,7 @@ namespace CalamityMod.Projectiles.Summon TeleportEndingPoint = target.Center - offset; } else - TeleportEndingPoint = Projectile.Center + Projectile.velocity * chargeTime / 2f; + TeleportEndingPoint = Projectile.Center + CalamityUtils.CalculatePredictiveAimToTargetMaxUpdates(Projectile.Center, target, Projectile.velocity.Length(), Projectile.MaxUpdates) * chargeTime / 2f; // On the starting frame of a teleport, spawn portals. if (Main.myPlayer == Projectile.owner) diff --git a/Projectiles/Summon/MidnightSunUFO.cs b/Projectiles/Summon/MidnightSunUFO.cs index c809587298..502494bb28 100644 --- a/Projectiles/Summon/MidnightSunUFO.cs +++ b/Projectiles/Summon/MidnightSunUFO.cs @@ -20,6 +20,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.TrailCacheLength[Type] = 4; ProjectileID.Sets.TrailingMode[Type] = 0; } @@ -39,8 +41,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.DamageType = DamageClass.Summon; } - public override bool? CanDamage() => false; - public override void AI() { Lighting.AddLight(Projectile.Center, Color.SkyBlue.ToVector3()); diff --git a/Projectiles/Summon/MiniGuardianAttack.cs b/Projectiles/Summon/MiniGuardianAttack.cs index 614db32a4d..539d17389d 100644 --- a/Projectiles/Summon/MiniGuardianAttack.cs +++ b/Projectiles/Summon/MiniGuardianAttack.cs @@ -155,7 +155,6 @@ namespace CalamityMod.Projectiles.Summon } // Turning (wtf is this) - // idk ask phup lmao if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Summon/MiniGuardianDefense.cs b/Projectiles/Summon/MiniGuardianDefense.cs index 5ec0668b23..c3ebe6bf20 100644 --- a/Projectiles/Summon/MiniGuardianDefense.cs +++ b/Projectiles/Summon/MiniGuardianDefense.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Summon playerDist = returnSpeed / playerDist; playerDestination *= playerDist; - // Turning (wtf is this) (idk ask phup lmao) + // Turning (wtf is this) if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Summon/MiniGuardianHealer.cs b/Projectiles/Summon/MiniGuardianHealer.cs index 92b2796588..53397e2946 100644 --- a/Projectiles/Summon/MiniGuardianHealer.cs +++ b/Projectiles/Summon/MiniGuardianHealer.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Summon playerDist = returnSpeed / playerDist; playerDestination *= playerDist; - // Turning (wtf is this) (idk ask phup lmao) + // Turning (wtf is this) if (Projectile.velocity.X < playerDestination.X) { Projectile.velocity.X += acceleration; diff --git a/Projectiles/Summon/MiniSandShark.cs b/Projectiles/Summon/MiniSandShark.cs index fd1ef345c5..8bf960074c 100644 --- a/Projectiles/Summon/MiniSandShark.cs +++ b/Projectiles/Summon/MiniSandShark.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnKill(int timeLeft) // When the projectile hits an enemy, it'll make a dust impact effect. { SoundEngine.PlaySound(SoundID.Item14, Projectile.position); - for (int dustIndex = 0; dustIndex < 36; dustIndex++) + for (int dustIndex = 0; dustIndex < 18; dustIndex++) { Dust.NewDust(Projectile.Center, Projectile.width, diff --git a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs index f7199ae813..6d8df9cdd5 100644 --- a/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs +++ b/Projectiles/Summon/MirrorofKalandraMinions/AtzirisDisfavor.cs @@ -79,7 +79,8 @@ namespace CalamityMod.Projectiles.Summon.MirrorofKalandraMinions // Repeating swing sound. if (Projectile.soundDelay <= 0) { - SoundEngine.PlaySound(CommonCalamitySounds.LouderSwingWoosh with { Pitch = -.8f, PitchVariance = 1f, Volume = .6f }, Projectile.Center); + SoundStyle swing = new SoundStyle("CalamityMod/Sounds/Custom/LoudSwingWoosh") with { Pitch = -.8f, PitchVariance = 1f, Volume = .6f }; + SoundEngine.PlaySound(swing, Projectile.Center); Projectile.soundDelay = 15; Projectile.netUpdate = true; } diff --git a/Projectiles/Summon/PhantomGuy.cs b/Projectiles/Summon/PhantomGuy.cs index a86a9b90d6..90f0b0cbae 100644 --- a/Projectiles/Summon/PhantomGuy.cs +++ b/Projectiles/Summon/PhantomGuy.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -229,7 +230,5 @@ namespace CalamityMod.Projectiles.Summon { return new Color(100, 250, 250, Projectile.alpha); } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/PinkButterfly.cs b/Projectiles/Summon/PinkButterfly.cs index 62400663b8..46df273110 100644 --- a/Projectiles/Summon/PinkButterfly.cs +++ b/Projectiles/Summon/PinkButterfly.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -245,7 +246,5 @@ namespace CalamityMod.Projectiles.Summon Main.EntitySpriteDraw(texture2D13, Projectile.Center - Main.screenPosition + new Vector2(0f, Projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Rectangle(0, y6, texture2D13.Width, framing)), Projectile.GetAlpha(lightColor), Projectile.rotation, new Vector2((float)texture2D13.Width / 2f, (float)framing / 2f), Projectile.scale, spriteEffects, 0); return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/PlaguebringerMK2.cs b/Projectiles/Summon/PlaguebringerMK2.cs index 45bb6d1396..01e795d795 100644 --- a/Projectiles/Summon/PlaguebringerMK2.cs +++ b/Projectiles/Summon/PlaguebringerMK2.cs @@ -14,7 +14,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; - ProjectileID.Sets.MinionTargettingFeature[Type] = true; + Main.projPet[Type] = true; + ProjectileID.Sets.MinionSacrificable[Type] = true; } public override void SetDefaults() @@ -128,7 +129,5 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/PowerfulRaven.cs b/Projectiles/Summon/PowerfulRaven.cs index 379971a921..369c4b346d 100644 --- a/Projectiles/Summon/PowerfulRaven.cs +++ b/Projectiles/Summon/PowerfulRaven.cs @@ -17,6 +17,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 5; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -61,6 +62,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.timeLeft = 2; } } + Projectile.MinionAntiClump(); NPC potentialTarget = Projectile.Center.MinionHoming(DistanceToCheck, player); @@ -148,5 +150,7 @@ namespace CalamityMod.Projectiles.Summon } Projectile.direction = Projectile.spriteDirection = (Projectile.velocity.X > 0).ToDirectionInt(); } + + public override bool MinionContactDamage() => true; } } diff --git a/Projectiles/Summon/PuffWarrior.cs b/Projectiles/Summon/PuffWarrior.cs index 91dc1aa0a2..887fc8d6bd 100644 --- a/Projectiles/Summon/PuffWarrior.cs +++ b/Projectiles/Summon/PuffWarrior.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 10; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -199,6 +200,8 @@ namespace CalamityMod.Projectiles.Summon } } + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { if (EnemyFailureCooldown > 0) diff --git a/Projectiles/Summon/PurpleButterfly.cs b/Projectiles/Summon/PurpleButterfly.cs index 790c60d81a..b7a03a55bc 100644 --- a/Projectiles/Summon/PurpleButterfly.cs +++ b/Projectiles/Summon/PurpleButterfly.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -87,6 +88,8 @@ namespace CalamityMod.Projectiles.Summon Projectile.ChargingMinionAI(1200f, 1500f, 2400f, 150f, 0, 25f, 20f, 9f, new Vector2(0f, -60f), 30f, 15f, true, true); } + public override bool MinionContactDamage() => true; + public override bool PreDraw(ref Color lightColor) { SpriteEffects spriteEffects = Projectile.spriteDirection == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; diff --git a/Projectiles/Summon/SageNeedle.cs b/Projectiles/Summon/SageNeedle.cs index 0efecc2a3b..ed7d521b44 100644 --- a/Projectiles/Summon/SageNeedle.cs +++ b/Projectiles/Summon/SageNeedle.cs @@ -36,19 +36,7 @@ namespace CalamityMod.Projectiles.Summon public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int totalSageSpirits = Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]; - - // A slightly-smoothened curve that's a little less potent than a linear curve. - // Has the potential to eventually surpass a linear curve, but this is infeasible, only happening - // at around 344 allocated slots. - float averageDamageMultiplier = (float)(Math.Pow(totalSageSpirits, 0.73D) + Math.Pow(totalSageSpirits, 1.1D)) * 0.5f; - - // 1 slot provides 25 DoT. - // 2 slots provide 48 DoT. - // 3 slots provide 70 DoT. - // 4 slots provide 92 DoT. - // 5 slots provide 114 DoT. - int sagePoisonDamage = (int)(50 * averageDamageMultiplier); + int sagePoisonDamage = (int)(SagePoison.debuffData.EnemyLostRegen * Main.player[Projectile.owner].ownedProjectileCounts[ModContent.ProjectileType()]); target.AddBuff(ModContent.BuffType(), 300); target.Calamity().sagePoisonDamage = sagePoisonDamage; } diff --git a/Projectiles/Summon/SageSpirit.cs b/Projectiles/Summon/SageSpirit.cs index c7925c58ac..c621a77e78 100644 --- a/Projectiles/Summon/SageSpirit.cs +++ b/Projectiles/Summon/SageSpirit.cs @@ -25,6 +25,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -191,8 +192,5 @@ namespace CalamityMod.Projectiles.Summon } } } - - // The spirit itself should not do direct damage. - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/SandElementalHealer.cs b/Projectiles/Summon/SandElementalHealer.cs index 8ec3c83484..408e4982e2 100644 --- a/Projectiles/Summon/SandElementalHealer.cs +++ b/Projectiles/Summon/SandElementalHealer.cs @@ -44,7 +44,7 @@ namespace CalamityMod.Projectiles.Summon Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandBoobWaifu && !modPlayer.allWaifus && !modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.rareSandElemental && !modPlayer.allElementals && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -55,9 +55,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.dWaifu = false; + modPlayer.rareSandEleBuff = false; } - if (modPlayer.dWaifu) + if (modPlayer.rareSandEleBuff) { Projectile.timeLeft = 2; } @@ -91,7 +91,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.spriteDirection = -Projectile.direction; } - if (!modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) { float lightScalar = (float)Main.rand.Next(90, 111) * 0.01f; lightScalar *= Main.essScale; @@ -160,7 +160,7 @@ namespace CalamityMod.Projectiles.Summon { Projectile.localAI[0] += 1f; } - if (Projectile.ai[0] == 0f && !modPlayer.sandBoobWaifuVanity && !modPlayer.allWaifusVanity) + if (Projectile.ai[0] == 0f && !modPlayer.rareSandElementalVanity && !modPlayer.allElementalsVanity) { int healProj = ModContent.ProjectileType(); if (Projectile.ai[1] == 0f && Projectile.localAI[0] >= 120f) @@ -189,7 +189,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (modPlayer.sandBoobWaifuVanity || modPlayer.allWaifusVanity) + if (modPlayer.rareSandElementalVanity || modPlayer.allElementalsVanity) { return false; } diff --git a/Projectiles/Summon/SandElementalMinion.cs b/Projectiles/Summon/SandElementalMinion.cs index 59c7f9c2bf..397f3481cd 100644 --- a/Projectiles/Summon/SandElementalMinion.cs +++ b/Projectiles/Summon/SandElementalMinion.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sandWaifu && !modPlayer.allWaifus && !modPlayer.sandWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.sandElemental && !modPlayer.allElementals && !modPlayer.sandElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -51,9 +51,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.sWaifu = false; + modPlayer.sandEleBuff = false; } - if (modPlayer.sWaifu) + if (modPlayer.sandEleBuff) { Projectile.timeLeft = 2; } @@ -68,7 +68,7 @@ namespace CalamityMod.Projectiles.Summon Main.dust[dust].scale *= 1.15f; } } - bool passive = modPlayer.sandWaifuVanity || modPlayer.allWaifusVanity; + bool passive = modPlayer.sandElementalVanity || modPlayer.allElementalsVanity; if (Math.Abs(Projectile.velocity.X) > 0.2f) { Projectile.spriteDirection = -Projectile.direction; diff --git a/Projectiles/Summon/SandnadoMinion.cs b/Projectiles/Summon/SandnadoMinion.cs index 4fcc69068f..d9f2fb1c4b 100644 --- a/Projectiles/Summon/SandnadoMinion.cs +++ b/Projectiles/Summon/SandnadoMinion.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 6; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -81,12 +82,12 @@ namespace CalamityMod.Projectiles.Summon { if (CheckForSpawning == false) { - int dustAmount = 75; - for (int dustIndex = 0; dustIndex < dustAmount; dustIndex++) + int dustAmount = 25; + for (int d = 0; d < dustAmount; d++) { - float angle = MathHelper.TwoPi / dustAmount * dustIndex; + float angle = MathHelper.TwoPi / dustAmount * d; Vector2 velocity = angle.ToRotationVector2() * Main.rand.NextFloat(5f, 6.5f); - Dust spawnDust = Dust.NewDustPerfect(Projectile.Center, 85, velocity); + Dust.NewDustPerfect(Projectile.Center, DustID.UnusedBrown, velocity); } CheckForSpawning = true; } @@ -165,8 +166,6 @@ namespace CalamityMod.Projectiles.Summon TimerForShooting++; } - public override bool? CanDamage() => false; - #endregion } } diff --git a/Projectiles/Summon/SarosAura.cs b/Projectiles/Summon/SarosAura.cs index e626a5ea77..61ad52487e 100644 --- a/Projectiles/Summon/SarosAura.cs +++ b/Projectiles/Summon/SarosAura.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.minionSlots = 8f; + Projectile.minionSlots = 6f; Projectile.penetrate = -1; Projectile.width = Projectile.height = 132; @@ -128,8 +128,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - #endregion } } diff --git a/Projectiles/Summon/SeashineSwordProj.cs b/Projectiles/Summon/SeashineSwordProj.cs index 61917656be..d8e21def52 100644 --- a/Projectiles/Summon/SeashineSwordProj.cs +++ b/Projectiles/Summon/SeashineSwordProj.cs @@ -316,6 +316,6 @@ namespace CalamityMod.Projectiles.Summon float _ = float.NaN; return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, tipPosition, 30 * Projectile.scale, ref _); } - public override bool? CanDamage() => (isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0) ? null : false; + public override bool? CanDamage() => isAttacking && attackTimer > bladeValue && Projectile.ai[0] != 0; } } diff --git a/Projectiles/Summon/SeekerSummonProj.cs b/Projectiles/Summon/SeekerSummonProj.cs index 19acb71cf0..c3dbaf6c1c 100644 --- a/Projectiles/Summon/SeekerSummonProj.cs +++ b/Projectiles/Summon/SeekerSummonProj.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 5; + Main.projPet[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; } @@ -159,5 +160,7 @@ namespace CalamityMod.Projectiles.Summon else if (Projectile.velocity.Length() < 28f) Projectile.velocity = Projectile.SafeDirectionTo(target.Center) * 29f; } + + public override bool MinionContactDamage() => true; } } diff --git a/Projectiles/Summon/SepulcherMinion.cs b/Projectiles/Summon/SepulcherMinion.cs index 61ce1510ae..88a2cc9289 100644 --- a/Projectiles/Summon/SepulcherMinion.cs +++ b/Projectiles/Summon/SepulcherMinion.cs @@ -693,6 +693,8 @@ namespace CalamityMod.Projectiles.Summon #endregion + public override bool MinionContactDamage() => true; + public override bool? CanHitNPC(NPC target) { if (target.type == ModContent.NPCType()) diff --git a/Projectiles/Summon/Shellfish.cs b/Projectiles/Summon/Shellfish.cs index c49d18530f..be18d29396 100644 --- a/Projectiles/Summon/Shellfish.cs +++ b/Projectiles/Summon/Shellfish.cs @@ -424,7 +424,7 @@ namespace CalamityMod.Projectiles.Summon return null; } - public override bool? CanDamage() => Projectile.ai[0] == 0f; + public override bool MinionContactDamage() => Projectile.ai[0] == 0f; public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { diff --git a/Projectiles/Summon/SilvaCrystal.cs b/Projectiles/Summon/SilvaCrystal.cs index 3cbe3f521a..9b76c93281 100644 --- a/Projectiles/Summon/SilvaCrystal.cs +++ b/Projectiles/Summon/SilvaCrystal.cs @@ -3,6 +3,7 @@ using CalamityMod.CalPlayer; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -38,6 +39,7 @@ namespace CalamityMod.Projectiles.Summon { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); + bool isMinion = Projectile.type == ModContent.ProjectileType(); if (!modPlayer.silvaSummon) { @@ -47,14 +49,11 @@ namespace CalamityMod.Projectiles.Summon if (isMinion) { if (player.dead) - { modPlayer.sCrystal = false; - } if (modPlayer.sCrystal) - { Projectile.timeLeft = 2; - } } + Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); if (player.gravDir == -1f) { @@ -65,36 +64,27 @@ namespace CalamityMod.Projectiles.Summon { Projectile.rotation = 0f; } - Projectile.position.X = (int)Projectile.position.X; - Projectile.position.Y = (int)Projectile.position.Y; + Projectile.velocity = Vector2.Zero; Projectile.alpha -= 5; if (Projectile.alpha < 0) - { Projectile.alpha = 0; - } if (Projectile.direction == 0) - { Projectile.direction = Main.player[Projectile.owner].direction; - } + if (Projectile.alpha == 0 && Main.rand.NextBool(15)) { - Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Top, 0, 0, DustID.RainbowMk2, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f)]; - silvaDust.velocity.X = 0f; + Vector2 dustSpawn = Projectile.Center + Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(26f, 30f); + Dust silvaDust = Dust.NewDustPerfect(dustSpawn, DustID.RainbowMk2, Vector2.UnitY * Main.rand.NextFloat(-2f, 2f), 100, new Color(Main.DiscoR, 203, 103), 0.5f); silvaDust.noGravity = true; silvaDust.fadeIn = 1f; - silvaDust.position = Projectile.Center + Vector2.UnitY.RotatedByRandom(6.2831854820251465) * (4f * Main.rand.NextFloat() + 26f); - silvaDust.scale = 0.5f; } + Projectile.localAI[0] += 1f; if (Projectile.localAI[0] >= 60f) - { Projectile.localAI[0] = 0f; - } if (Projectile.ai[0] < 0f) - { Projectile.ai[0] += 1f; - } if (Projectile.ai[0] == 0f) { int targetID = -1; @@ -116,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon { foreach (NPC target in Main.ActiveNPCs) { - if (target.CanBeChasedBy(Projectile, false)) + if (target.CanBeChasedBy(Projectile)) { float targetDistance = Projectile.Distance(target.Center); if (targetDistance < attackRange && Collision.CanHitLine(Projectile.Center, 0, 0, target.Center, 0, 0)) @@ -130,7 +120,7 @@ namespace CalamityMod.Projectiles.Summon if (targetID != -1) { Projectile.ai[0] = 1f; - Projectile.ai[1] = (float)targetID; + Projectile.ai[1] = targetID; Projectile.netUpdate = true; return; } @@ -138,7 +128,7 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.ai[0] > 0f) { int npcTrack = (int)Projectile.ai[1]; - if (!Main.npc[npcTrack].CanBeChasedBy(Projectile, false)) + if (!Main.npc[npcTrack].CanBeChasedBy(Projectile)) { Projectile.ai[0] = 0f; Projectile.ai[1] = 0f; @@ -154,49 +144,34 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; if (Projectile.owner == Main.myPlayer) { - Vector2 attackPos = Main.npc[npcTrack].position + Main.npc[npcTrack].Size * Utils.RandomVector2(Main.rand, 0f, 1f) - Projectile.Center; - int attackAmt; - for (int j = 0; j < 3; j = attackAmt + 1) + Vector2 attackPos = Main.npc[npcTrack].Center - Projectile.Center; + for (int j = 0; j < 3; j++) { - Vector2 finalAttackPos = Projectile.Center + attackPos; - if (j > 0) - { - finalAttackPos = Projectile.Center + attackPos.RotatedByRandom(0.78539818525314331) * (Main.rand.NextFloat() * 0.5f + 0.75f); - } - float x4 = Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), finalAttackPos, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, x4, (float)Projectile.whoAmI); - attackAmt = j; + Vector2 finalAttackPos = Projectile.Center + attackPos.RotatedByRandom(j > 0 ? MathHelper.Pi * 0.125f : 0f) * (j > 0 ? Main.rand.NextFloat(0.9f, 1.1f) : 1f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), finalAttackPos, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Main.rgbToHsl(new Color(Main.DiscoR, 203, 103)).X, Projectile.whoAmI); } return; } } } } + public override bool? CanDamage() => false; - public override Color? GetAlpha(Color lightColor) - { - return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 127 - Projectile.alpha / 2); - } - + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 127 - Projectile.alpha / 2); public override bool PreDraw(ref Color lightColor) { - Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Color colorAlpha = Projectile.GetAlpha(colorArea); - Vector2 halfRectangle = rectangular.Size() / 2f; - float scaleFactor = (float)Math.Cos((double)(6.28318548f * (Projectile.localAI[0] / 60f))) + 3f + 3f; - for (float k = 0f; k < 4f; k += 1f) + Texture2D tex = TextureAssets.Projectile[Type].Value; + Vector2 projPos = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + Color colorAlpha = Projectile.GetAlpha(colorArea) * 0.2f; + Vector2 origin = tex.Size() / 2f; + float scaleFactor = MathF.Cos(MathHelper.TwoPi * (Projectile.localAI[0] / 60f)) + 6f; + + for (int k = 0; k < 4; k++) { - SpriteBatch spritebatch = Main.spriteBatch; - double arg_F8BE_1 = (double)(k * MathHelper.PiOver2); - Vector2 center = default; - Main.EntitySpriteDraw(texture2D34, projPos + Vector2.UnitY.RotatedBy(arg_F8BE_1, center) * scaleFactor, new Microsoft.Xna.Framework.Rectangle?(rectangular), colorAlpha * 0.2f, Projectile.rotation, halfRectangle, Projectile.scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(tex, projPos + Vector2.UnitY.RotatedBy(k * MathHelper.PiOver2) * scaleFactor, null, colorAlpha, Projectile.rotation, origin, Projectile.scale, SpriteEffects.None, 0); } return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/SilvaCrystalExplosion.cs b/Projectiles/Summon/SilvaCrystalExplosion.cs index 70fcf7d03b..b118833432 100644 --- a/Projectiles/Summon/SilvaCrystalExplosion.cs +++ b/Projectiles/Summon/SilvaCrystalExplosion.cs @@ -1,6 +1,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -11,223 +12,162 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override string Texture => "CalamityMod/Projectiles/StarProj"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.MinionShot[Type] = true; - } - + public ref float OwnerCheck => ref Projectile.ai[1]; + public override void SetStaticDefaults() => ProjectileID.Sets.MinionShot[Type] = true; public override void SetDefaults() { Projectile.width = Projectile.height = 14; + Projectile.DamageType = DamageClass.Summon; Projectile.alpha = 255; Projectile.tileCollide = false; Projectile.ignoreWater = true; + Projectile.penetrate = -1; Projectile.timeLeft = 900; - Projectile.DamageType = DamageClass.Summon; } public override void AI() { - Color newColor2 = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); - int activeTimer = (int)Projectile.ai[1]; - if (activeTimer < 0 || activeTimer >= 1000 || (!Main.projectile[activeTimer].active && Main.projectile[activeTimer].type != ModContent.ProjectileType())) + Color colorToUse = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); + if (OwnerCheck < 0 || OwnerCheck >= 1000 || (!Main.projectile[(int)OwnerCheck].active && Main.projectile[(int)OwnerCheck].type != ModContent.ProjectileType())) { Projectile.ai[1] = -1f; } else { - DelegateMethods.v3_1 = newColor2.ToVector3() * 0.5f; - Utils.PlotTileLine(Projectile.Center, Main.projectile[activeTimer].Center, 8f, DelegateMethods.CastLight); + DelegateMethods.v3_1 = colorToUse.ToVector3() * 0.5f; + Utils.PlotTileLine(Projectile.Center, Main.projectile[(int)OwnerCheck].Center, 8f, DelegateMethods.CastLight); } + if (Projectile.localAI[0] == 0f) { - Projectile.localAI[0] = Main.rand.NextFloat() * 0.8f + 0.8f; - Projectile.direction = (Main.rand.Next(2) > 0) ? 1 : -1; + Projectile.localAI[0] = Main.rand.NextFloat(0.8f) + 0.8f; + Projectile.direction = Main.rand.NextBool() ? 1 : -1; } - Projectile.rotation = Projectile.localAI[1] / 20f * 6.28318548f * (float)Projectile.direction; + Projectile.rotation = Projectile.localAI[1] / 20f * MathHelper.TwoPi * Projectile.direction; if (Projectile.alpha > 0) { - Projectile.alpha -= 8; - } - if (Projectile.alpha < 0) - { - Projectile.alpha = 0; + Projectile.alpha -= 16; + if (Projectile.alpha < 0) + Projectile.alpha = 0; } if (Projectile.alpha == 0) - { - Lighting.AddLight(Projectile.Center, newColor2.ToVector3() * 0.5f); - } - int dustCount; - for (int i = 0; i < 2; i = dustCount + 1) + Lighting.AddLight(Projectile.Center, colorToUse.ToVector3() * 0.5f); + + for (int i = 0; i < 2; i++) { if (Main.rand.NextBool(10)) { - Vector2 silvaDustVel = Vector2.UnitY.RotatedBy((double)((float)i * 3.14159274f), default).RotatedBy((double)Projectile.rotation, default); - Dust silvaDust = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 silvaDustVel = Vector2.UnitY.RotatedBy(i * MathHelper.Pi + Projectile.rotation) * 2.5f; + Dust silvaDust = Dust.NewDustPerfect(Projectile.Center, DustID.RainbowMk2, silvaDustVel, 225, colorToUse, Projectile.Opacity * Projectile.localAI[0]); silvaDust.noGravity = true; silvaDust.noLight = true; - silvaDust.scale = Projectile.Opacity * Projectile.localAI[0]; - silvaDust.position = Projectile.Center; - silvaDust.velocity = silvaDustVel * 2.5f; } - dustCount = i; - } - for (int j = 0; j < 2; j = dustCount + 1) - { if (Main.rand.NextBool(10)) { - Vector2 silvaDustVel2 = Vector2.UnitY.RotatedBy((double)((float)j * 3.14159274f), default); - Dust silvaDust2 = Main.dust[Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 225, newColor2, 1.5f)]; + Vector2 silvaDustVel2 = Vector2.UnitY.RotatedBy(i * MathHelper.Pi) * 2.5f; + Dust silvaDust2 = Dust.NewDustPerfect(Projectile.Center, DustID.RainbowMk2, silvaDustVel2, 225, colorToUse, Projectile.Opacity * Projectile.localAI[0]); silvaDust2.noGravity = true; silvaDust2.noLight = true; - silvaDust2.scale = Projectile.Opacity * Projectile.localAI[0]; - silvaDust2.position = Projectile.Center; - silvaDust2.velocity = silvaDustVel2 * 2.5f; } - dustCount = j; } if (Main.rand.NextBool(10)) { - float dustVelMod = 1f + Main.rand.NextFloat() * 2f; - float fadeIn = 1f + Main.rand.NextFloat(); - float dustScale = 1f + Main.rand.NextFloat(); - Vector2 randVector = Utils.RandomVector2(Main.rand, -1f, 1f); - if (randVector != Vector2.Zero) - { - randVector.Normalize(); - } - randVector *= 20f + Main.rand.NextFloat() * 100f; + float dustVelMod = Main.rand.NextFloat(1f, 3f); + float fadeIn = Main.rand.NextFloat(1f, 2f); + float dustScale = Main.rand.NextFloat(1f, 2f); + Vector2 randVector = Main.rand.NextVector2Circular(1f, 1f).SafeNormalize(Vector2.Zero) * Main.rand.NextFloat(20, 120f); + Vector2 dustPos = Projectile.Center + randVector; Point dustCoords = dustPos.ToTileCoordinates(); - bool shouldSpawnDust = true; - if (!WorldGen.InWorld(dustCoords.X, dustCoords.Y, 0)) + if (WorldGen.InWorld(dustCoords.X, dustCoords.Y) && !WorldGen.SolidTile(dustCoords.X, dustCoords.Y)) { - shouldSpawnDust = false; - } - if (shouldSpawnDust && WorldGen.SolidTile(dustCoords.X, dustCoords.Y)) - { - shouldSpawnDust = false; - } - if (shouldSpawnDust) - { - Dust rainbowDust = Main.dust[Dust.NewDust(dustPos, 0, 0, DustID.RainbowMk2, 0f, 0f, 127, newColor2, 1f)]; + Dust rainbowDust = Dust.NewDustPerfect(dustPos, DustID.RainbowMk2, -Vector2.UnitY * Main.rand.NextFloat(1.6f, 7.5f), 127, colorToUse, dustScale); rainbowDust.noGravity = true; - rainbowDust.position = dustPos; - rainbowDust.velocity = -Vector2.UnitY * dustVelMod * (Main.rand.NextFloat() * 0.9f + 1.6f); rainbowDust.fadeIn = fadeIn; - rainbowDust.scale = dustScale; rainbowDust.noLight = true; + Dust rainbowDust2 = Dust.CloneDust(rainbowDust); - Dust dust = rainbowDust2; - dust.scale *= 0.65f; - dust = rainbowDust2; - dust.fadeIn *= 0.65f; + rainbowDust2.scale *= 0.65f; + rainbowDust2.fadeIn *= 0.65f; rainbowDust2.color = new Color(255, 255, 255, 255); } } Projectile.scale = Projectile.Opacity / 2f * Projectile.localAI[0]; Projectile.velocity = Vector2.Zero; - Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 30f) - { - Projectile.Kill(); - } - } - public override bool PreDraw(ref Color lightColor) - { - Color colorArea = Lighting.GetColor((int)((double)Projectile.position.X + (double)Projectile.width * 0.5) / 16, (int)(((double)Projectile.position.Y + (double)Projectile.height * 0.5) / 16.0)); - Vector2 projPos = Projectile.position + new Vector2((float)Projectile.width, (float)Projectile.height) / 2f + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; - Texture2D texture2D34 = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle rectangular = texture2D34.Frame(1, Main.projFrames[Type], 0, Projectile.frame); - Color colorAlpha = Projectile.GetAlpha(colorArea); - Vector2 halfRectangle = rectangular.Size() / 2f; - Color projColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); - Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, Projectile.rotation, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, projPos, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor, 0f, halfRectangle, Projectile.scale * 2f, SpriteEffects.None, 0); - if (Projectile.ai[1] != -1f && Projectile.Opacity > 0.3f) - { - Vector2 projDirection = Main.projectile[(int)Projectile.ai[1]].Center - Projectile.Center; - Vector2 projDistance = new Vector2(1f, projDirection.Length() / (float)texture2D34.Height); - float drawRotation = projDirection.ToRotation() + 1.57079637f; - float colorClamp = MathHelper.Distance(15f, Projectile.localAI[1]) / 20f; - colorClamp = MathHelper.Clamp(colorClamp, 0f, 1f); - if (colorClamp > 0f) - { - Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), projColor * colorClamp, drawRotation, halfRectangle, projDistance, SpriteEffects.None, 0); - Main.EntitySpriteDraw(texture2D34, projPos + projDirection / 2f, new Microsoft.Xna.Framework.Rectangle?(rectangular), colorAlpha * colorClamp, drawRotation, halfRectangle, projDistance / 2f, SpriteEffects.None, 0); - } - } - return false; + Projectile.localAI[1] += 1f; + if (Projectile.localAI[1] >= 15f) + Projectile.Kill(); } public override void OnKill(int timeLeft) { - Vector2 spinningpoint = new Vector2(0f, -3f).RotatedByRandom(3.1415927410125732); - float rando = (float)Main.rand.Next(7, 13); - Vector2 dustVel = new Vector2(2.1f, 2f); + Vector2 spinningpoint = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 3f; + int rando = Main.rand.Next(7, 12+1); + Vector2 dustVel = new Vector2(2.1f, 2f) * Main.rand.NextFloat(0.8f, 1.2f); Color newColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f); newColor.A = 255; - float dustCount; - for (float i = 0f; i < rando; i = dustCount + 1f) + + for (int i = 0; i < rando; i++) { - int dustID = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); - Main.dust[dustID].position = Projectile.Center; - Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * i / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = 2f; - Main.dust[dustID].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustID = Dust.NewDustPerfect(Projectile.Center, DustID.RainbowMk2, spinningpoint.RotatedBy(MathHelper.TwoPi * i / rando) * dustVel, 0, newColor, 2f); + dustID.noGravity = true; + dustID.fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning = Dust.CloneDust(dustID); - Dust dust = dustCloning; - dust.scale /= 2f; - dust = dustCloning; - dust.fadeIn /= 2f; - dustCloning.color = new Color(255, 255, 255, 255); - dustCount = i; + dustCloning.scale /= 2f; + dustCloning.fadeIn /= 2f; + dustCloning.color = Color.White; } - for (float j = 0f; j < rando; j = dustCount + 1f) + for (int j = 0; j < rando; j++) { - int dustID = Dust.NewDust(Projectile.Center, 0, 0, DustID.RainbowMk2, 0f, 0f, 0, newColor, 1f); - Main.dust[dustID].position = Projectile.Center; - Main.dust[dustID].velocity = spinningpoint.RotatedBy((double)(6.28318548f * j / rando), default) * dustVel * (0.8f + Main.rand.NextFloat() * 0.4f); - Dust dust = Main.dust[dustID]; - dust.velocity *= Main.rand.NextFloat() * 0.8f; - Main.dust[dustID].noGravity = true; - Main.dust[dustID].scale = Main.rand.NextFloat() * 1f; - Main.dust[dustID].fadeIn = Main.rand.NextFloat() * 2f; + Dust dustID = Dust.NewDustPerfect(Projectile.Center, DustID.RainbowMk2, spinningpoint.RotatedBy(MathHelper.TwoPi * j / rando) * dustVel * Main.rand.NextFloat(0.8f), 0, newColor, Main.rand.NextFloat()); + dustID.noGravity = true; + dustID.fadeIn = Main.rand.NextFloat() * 2f; + Dust dustCloning2 = Dust.CloneDust(dustID); - dust = dustCloning2; - dust.scale /= 2f; - dust = dustCloning2; - dust.fadeIn /= 2f; - dustCloning2.color = new Color(255, 255, 255, 255); - dustCount = j; + dustCloning2.scale /= 2f; + dustCloning2.fadeIn /= 2f; + dustCloning2.color = Color.White; } if (Main.myPlayer == Projectile.owner) { Projectile.friendly = true; - int width = Projectile.width; - int height2 = Projectile.height; - int penetrateClone = Projectile.penetrate; - Projectile.position = Projectile.Center; - Projectile.width = Projectile.height = 60; - Projectile.Center = Projectile.position; - Projectile.penetrate = -1; - Projectile.maxPenetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 10; + Projectile.ExpandHitboxBy(60); Projectile.Damage(); - Projectile.penetrate = penetrateClone; - Projectile.position = Projectile.Center; - Projectile.width = width; - Projectile.height = height2; - Projectile.Center = Projectile.position; } } - public override Color? GetAlpha(Color lightColor) + public override Color? GetAlpha(Color lightColor) => new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + public override bool PreDraw(ref Color lightColor) { - return new Color(255 - Projectile.alpha, 255 - Projectile.alpha, 255 - Projectile.alpha, 0); + Texture2D tex = TextureAssets.Projectile[Type].Value; + Vector2 projPos = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color projColor = Main.hslToRgb(Projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Color(255, 255, 255, 0)); + Vector2 origin = tex.Size() / 2f; + SpriteEffects sp = SpriteEffects.None; + + Main.EntitySpriteDraw(tex, projPos, null, projColor, Projectile.rotation, origin, Projectile.scale * 2f, sp); + Main.EntitySpriteDraw(tex, projPos, null, projColor, 0f, origin, Projectile.scale * 2f, sp); + + if (OwnerCheck != -1f && Projectile.Opacity > 0.3f) + { + Color colorArea = Lighting.GetColor((int)(Projectile.position.X + Projectile.width * 0.5) / 16, (int)((Projectile.position.Y + Projectile.height * 0.5) / 16.0)); + Color colorAlpha = Projectile.GetAlpha(colorArea); + + Vector2 projDirection = Main.projectile[(int)OwnerCheck].Center - Projectile.Center; + Vector2 projDistance = new Vector2(1f, projDirection.Length() / (float)tex.Height); + float drawRotation = projDirection.ToRotation() + MathHelper.PiOver2; + float colorClamp = MathHelper.Clamp(MathHelper.Distance(15f, Projectile.localAI[1]) / 20f, 0f, 1f); + if (colorClamp > 0f) + { + Main.EntitySpriteDraw(tex, projPos + projDirection / 2f, null, projColor * colorClamp, drawRotation, origin, projDistance, sp); + Main.EntitySpriteDraw(tex, projPos + projDirection / 2f, null, colorAlpha * colorClamp, drawRotation, origin, projDistance / 2f, sp); + } + } + return false; } } } diff --git a/Projectiles/Summon/SiriusMinion.cs b/Projectiles/Summon/SiriusMinion.cs index 8078ce92df..32bc089bd1 100644 --- a/Projectiles/Summon/SiriusMinion.cs +++ b/Projectiles/Summon/SiriusMinion.cs @@ -120,8 +120,6 @@ namespace CalamityMod.Projectiles.Summon public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - public override bool? CanDamage() => false; - #endregion } } diff --git a/Projectiles/Summon/SkeletalDragonMother.cs b/Projectiles/Summon/SkeletalDragonMother.cs index 533f5934b4..1d93cc03e1 100644 --- a/Projectiles/Summon/SkeletalDragonMother.cs +++ b/Projectiles/Summon/SkeletalDragonMother.cs @@ -138,5 +138,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.frame = 0; } } + + public override bool MinionContactDamage() => true; } } diff --git a/Projectiles/Summon/SmallSkeletonMinion.cs b/Projectiles/Summon/SmallSkeletonMinion.cs index 2cc5640838..d5be045715 100644 --- a/Projectiles/Summon/SmallSkeletonMinion.cs +++ b/Projectiles/Summon/SmallSkeletonMinion.cs @@ -15,9 +15,10 @@ namespace CalamityMod.Projectiles.Summon public int Variant; public override void SetStaticDefaults() { + Main.projFrames[Type] = 7; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; - Main.projFrames[Type] = 7; } public override void SetDefaults() @@ -171,6 +172,9 @@ namespace CalamityMod.Projectiles.Summon } return true; } + + public override bool MinionContactDamage() => true; + public override bool PreDraw(ref Color lightColor) { Rectangle frame = new Rectangle(Variant * Projectile.width, Projectile.frame * Projectile.height, Projectile.width, Projectile.height); diff --git a/Projectiles/Summon/SolarGod.cs b/Projectiles/Summon/SolarGod.cs index 890f7bbf8c..47b224fc2b 100644 --- a/Projectiles/Summon/SolarGod.cs +++ b/Projectiles/Summon/SolarGod.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -128,7 +129,5 @@ namespace CalamityMod.Projectiles.Summon } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/SolarPixie.cs b/Projectiles/Summon/SolarPixie.cs index 3ca4ff1c0f..b3c3595cc5 100644 --- a/Projectiles/Summon/SolarPixie.cs +++ b/Projectiles/Summon/SolarPixie.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Projectiles.Summon public new string LocalizationCategory => "Projectiles.Summon"; public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -129,7 +130,5 @@ namespace CalamityMod.Projectiles.Summon } public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/StellarTorusSummon.cs b/Projectiles/Summon/StellarTorusSummon.cs index 0be79f013e..8a178d4edc 100644 --- a/Projectiles/Summon/StellarTorusSummon.cs +++ b/Projectiles/Summon/StellarTorusSummon.cs @@ -32,6 +32,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 4; + Main.projPet[Type] = true; ProjectileID.Sets.DrawScreenCheckFluff[Type] = 12000; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; @@ -272,7 +273,5 @@ namespace CalamityMod.Projectiles.Summon return false; } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/StormjawBaby.cs b/Projectiles/Summon/StormjawBaby.cs index dfa4c71d3b..5c67d408c2 100644 --- a/Projectiles/Summon/StormjawBaby.cs +++ b/Projectiles/Summon/StormjawBaby.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projFrames[Type] = 10; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; - Main.projFrames[Type] = 10; } public override void SetDefaults() @@ -557,7 +558,5 @@ namespace CalamityMod.Projectiles.Summon Main.gore[index].velocity *= 0.1f; } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/TacticalPlagueJet.cs b/Projectiles/Summon/TacticalPlagueJet.cs index 0fad924ff2..854d66152b 100644 --- a/Projectiles/Summon/TacticalPlagueJet.cs +++ b/Projectiles/Summon/TacticalPlagueJet.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 3; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -59,8 +60,6 @@ namespace CalamityMod.Projectiles.Summon FalseGun.DamageType = DamageClass.Summon; } - public override bool? CanDamage() => false; - public override void AI() { Player player = Main.player[Projectile.owner]; diff --git a/Projectiles/Summon/TundraFlameBlossom.cs b/Projectiles/Summon/TundraFlameBlossom.cs index 8d7d4333ea..cfd486db17 100644 --- a/Projectiles/Summon/TundraFlameBlossom.cs +++ b/Projectiles/Summon/TundraFlameBlossom.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -109,8 +110,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.netUpdate = true; } - public override bool? CanDamage() => false; - #endregion } } diff --git a/Projectiles/Summon/Umbrella/MagicBullet.cs b/Projectiles/Summon/Umbrella/MagicBullet.cs index d65f48bb37..662122d206 100644 --- a/Projectiles/Summon/Umbrella/MagicBullet.cs +++ b/Projectiles/Summon/Umbrella/MagicBullet.cs @@ -49,11 +49,11 @@ namespace CalamityMod.Projectiles.Summon.Umbrella target.AddBuff(BuffID.BetsysCurse, 180); if (!target.ichor) target.AddBuff(BuffID.Ichor, 180); - if (target.Calamity().marked <= 0) + if (target.Calamity().markedForDeath) target.AddBuff(ModContent.BuffType(), 180); - if (target.Calamity().aCrunch <= 0) + if (target.Calamity().armorCrunch) target.AddBuff(ModContent.BuffType(), 180); - if (target.Calamity().wDeath <= 0) + if (target.Calamity().whisperingDeath) target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Summon/Umbrella/MagicBulletBig.cs b/Projectiles/Summon/Umbrella/MagicBulletBig.cs index 4c6080aca4..80d6243fe4 100644 --- a/Projectiles/Summon/Umbrella/MagicBulletBig.cs +++ b/Projectiles/Summon/Umbrella/MagicBulletBig.cs @@ -54,11 +54,11 @@ namespace CalamityMod.Projectiles.Summon.Umbrella target.AddBuff(BuffID.BetsysCurse, 180); if (!target.ichor) target.AddBuff(BuffID.Ichor, 180); - if (target.Calamity().marked <= 0) + if (target.Calamity().markedForDeath) target.AddBuff(ModContent.BuffType(), 180); - if (target.Calamity().aCrunch <= 0) + if (target.Calamity().armorCrunch) target.AddBuff(ModContent.BuffType(), 180); - if (target.Calamity().wDeath <= 0) + if (target.Calamity().whisperingDeath) target.AddBuff(ModContent.BuffType(), 180); } diff --git a/Projectiles/Summon/Umbrella/MagicHat.cs b/Projectiles/Summon/Umbrella/MagicHat.cs index 367a495d61..c75ea5de51 100644 --- a/Projectiles/Summon/Umbrella/MagicHat.cs +++ b/Projectiles/Summon/Umbrella/MagicHat.cs @@ -116,9 +116,6 @@ namespace CalamityMod.Projectiles.Summon.Umbrella // Glowmask effect public override Color? GetAlpha(Color lightColor) => new Color(200, 200, 200, 200); - // No contact damage - public override bool? CanDamage() => false; - // Draw over players public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) => overPlayers.Add(index); diff --git a/Projectiles/Summon/Urchin.png b/Projectiles/Summon/Urchin.png deleted file mode 100644 index d9f072c4f9..0000000000 Binary files a/Projectiles/Summon/Urchin.png and /dev/null differ diff --git a/Projectiles/Summon/UrchinSpike.cs b/Projectiles/Summon/UrchinSpike.cs deleted file mode 100644 index bb7dd11f81..0000000000 --- a/Projectiles/Summon/UrchinSpike.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class UrchinSpike : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public override void SetStaticDefaults() - { - ProjectileID.Sets.MinionShot[Type] = true; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 6; - Projectile.friendly = true; - Projectile.timeLeft = 600; - Projectile.aiStyle = ProjAIStyleID.Arrow; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Poisoned, 180); - } -} diff --git a/Projectiles/Summon/UrchinSpike.png b/Projectiles/Summon/UrchinSpike.png deleted file mode 100644 index 0d8e8c9ebf..0000000000 Binary files a/Projectiles/Summon/UrchinSpike.png and /dev/null differ diff --git a/Projectiles/Summon/VictideSeaSnail.cs b/Projectiles/Summon/VictideSeaSnail.cs deleted file mode 100644 index 64a6a06fbe..0000000000 --- a/Projectiles/Summon/VictideSeaSnail.cs +++ /dev/null @@ -1,231 +0,0 @@ -using System; -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Summon -{ - public class VictideSeaSnail : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Summon"; - public ref float DustTimer => ref Projectile.localAI[0]; - public ref float FireCooldown => ref Projectile.localAI[1]; - public ref float PeekingOut => ref Projectile.ai[0]; - public ref float PlayerStandStillTimer => ref Projectile.ai[1]; - - public const int frameTime = 6; - public const int timeToStandStillBeforePeekOut = 200; - - public bool CanComePeekOut => !Main.player[Projectile.owner].mount.Active && PlayerStandStillTimer >= timeToStandStillBeforePeekOut || Projectile.frame > 0; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.MinionSacrificable[Type] = true; - Main.projFrames[Type] = 7; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 30; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.minion = true; - Projectile.minionSlots = 0f; - Projectile.timeLeft = 18000; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft *= 5; - Projectile.DamageType = DamageClass.Summon; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - if (!modPlayer.victideSummoner) - { - for (int d = 0; d < 45; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - Projectile.active = false; - return; - } - - if (player.dead) - modPlayer.victideSnail = false; - - if (modPlayer.victideSnail) - Projectile.timeLeft = 2; - - //Create a burst of dust as it gets created - DustTimer++; - if (DustTimer <= 3) - { - int dustAmount = Main.rand.Next(40, 50); - for (int d = 0; d < dustAmount; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - } - - if (player.velocity.Length() == 0) - { - PlayerStandStillTimer++; - //pop out the shell - if (PlayerStandStillTimer == timeToStandStillBeforePeekOut) - { - DustTimer = 0; - float direction = Main.rand.NextBool() ? 1f : -1f; - Projectile.velocity = new Vector2(Main.rand.NextFloat(4f, 10f) * direction, Main.rand.NextFloat(-6f, 0f)); - } - - Projectile.velocity *= 0.98f; - Projectile.velocity.X *= 0.95f; - Projectile.velocity.Y = Math.Min(Projectile.velocity.Y + 0.1f, 14f); - Projectile.tileCollide = true; - - if (CanComePeekOut) - Projectile.rotation = Projectile.rotation.AngleTowards(0, MathHelper.PiOver4 * 0.14f); - - if (PeekingOut > 0) - { - Projectile.frameCounter++; - if (Projectile.frameCounter > frameTime) - { - Projectile.frameCounter = 0; - Projectile.frame = Math.Min(6, Projectile.frame + 1); - } - } - } - - //Go back, in the shell - if (player.velocity.Length() > 0 && CanComePeekOut) - { - Projectile.frameCounter++; - if (Projectile.frameCounter > frameTime) - { - Projectile.frameCounter = 0; - Projectile.frame--; - } - - if (Projectile.frame == 0) - { - PlayerStandStillTimer = 0f; - } - } - - if (!CanComePeekOut) - { - PeekingOut = 0f; - - if (player.velocity.Length() > 0) - PlayerStandStillTimer = 0f; - - Projectile.velocity = Vector2.Zero; - Projectile.tileCollide = false; - Vector2 desiredPosition = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; - //Round the result so it doesn't jitter. - desiredPosition = new Vector2((int)desiredPosition.X, (int)desiredPosition.Y); - - Projectile.rotation += MathHelper.PiOver4 * 0.2f; - - Projectile.Center = Projectile.Center.MoveTowards(desiredPosition, 7f + player.velocity.Length()); - } - - //Fire a projectile - if (Projectile.owner == Main.myPlayer) - { - if (FireCooldown > 0f) - { - FireCooldown--; - return; - } - - bool foundTarget = false; - float maxDist = 300f; - foreach (NPC npc in Main.ActiveNPCs) - { - if (npc.CanBeChasedBy(Projectile, false)) - { - if (Vector2.Distance(Projectile.Center, npc.Center) < maxDist && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) - { - foundTarget = true; - break; - } - } - } - - if (foundTarget) - { - int projAmt = Main.rand.Next(3, 7); - for (int u = 0; u < projAmt; u++) - { - Vector2 source = new Vector2(Projectile.Center.X - 4f, Projectile.Center.Y); - Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), source, velocity, ModContent.ProjectileType(), Projectile.damage, 1f, Projectile.owner); - } - - SoundEngine.PlaySound(SoundID.Item42, Projectile.position); - FireCooldown = 60f; - } - } - - if ((Projectile.Center - player.Center).Length() > 400) - { - DustTimer = 0; - Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f) * player.gravDir; - PlayerStandStillTimer = 0f; - Projectile.frame = 0; - } - } - - public override bool? CanDamage() => false; - - public override void OnKill(int timeLeft) - { - for (int d = 0; d < 45; d++) - { - Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); - dust.velocity *= 2f; - dust.scale *= 1.15f; - } - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - //Touches the ground - if (oldVelocity.Y >= 0) - { - PeekingOut = 1f; - } - return false; - } - - public override bool PreDraw(ref Color lightColor) - { - Player owner = Main.player[Projectile.owner]; - - Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = new Rectangle(0, 36 * Projectile.frame, 38, 34); - Vector2 origin = !CanComePeekOut ? new Vector2(15, 23) : frame.Size() / 2f; - - //Look at the player - SpriteEffects flipperoni = Math.Sign(Projectile.position.X - owner.position.X) > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, flipperoni, 0); - - return false; - } - } -} diff --git a/Projectiles/Summon/VileFeederSummon.cs b/Projectiles/Summon/VileFeederSummon.cs index d17ed5e292..8c6d8b632a 100644 --- a/Projectiles/Summon/VileFeederSummon.cs +++ b/Projectiles/Summon/VileFeederSummon.cs @@ -18,6 +18,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 3; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -39,16 +40,6 @@ namespace CalamityMod.Projectiles.Summon Projectile.localNPCHitCooldown = 60; } - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(Projectile.Calamity().lineColor); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - Projectile.Calamity().lineColor = reader.ReadInt32(); - } - public override void AI() { Player player = Main.player[Projectile.owner]; @@ -56,7 +47,7 @@ namespace CalamityMod.Projectiles.Summon if (spawnDust) { - Projectile.Calamity().lineColor = -1; + Projectile.ai[1] = -1; int dustAmt = 36; for (int d = 0; d < dustAmt; d++) { @@ -115,7 +106,7 @@ namespace CalamityMod.Projectiles.Summon { spawnDust = true; } - int npcIndex = Projectile.Calamity().lineColor; + int npcIndex = (int)Projectile.ai[1]; if (Projectile.localAI[0] >= 600000f) //tryna make it stay on there "forever" without glitching { breakAway = true; @@ -146,25 +137,19 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.owner == Main.myPlayer) { if (eaterCooldown > 0) - eaterCooldown -= Main.rand.Next(1, 3); + eaterCooldown--; if (eaterCooldown <= 0) { - int projNumber = Main.rand.Next(1, 3); - for (int index2 = 0; index2 < projNumber; index2++) - { - float xVector = (float)Main.rand.Next(-35, 36) * 0.02f; - float yVector = (float)Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, xVector, yVector, ModContent.ProjectileType(), (int)(Projectile.damage * 1.25f), Projectile.knockBack, Projectile.owner); - } - eaterCooldown = 80; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(7f, 7f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + eaterCooldown = Projectile.localNPCHitCooldown; } } } } + public override bool MinionContactDamage() => true; + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { Player player = Main.player[Projectile.owner]; @@ -209,7 +194,7 @@ namespace CalamityMod.Projectiles.Summon //let the projectile know it is sticking and the npc it is sticking too Projectile.ai[0] = 3f; - Projectile.Calamity().lineColor = npcIndex; + Projectile.ai[1] = npcIndex; //follow the NPC Projectile.velocity = (npc.Center - Projectile.Center) * 0.75f; @@ -222,7 +207,7 @@ namespace CalamityMod.Projectiles.Summon for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) { Projectile proj = Main.projectile[projIndex]; - if (projIndex != Projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == Projectile.type && proj.ai[0] == 3f && proj.Calamity().lineColor == npcIndex) + if (projIndex != Projectile.whoAmI && proj.active && proj.owner == Main.myPlayer && proj.type == Projectile.type && proj.ai[0] == 3f && proj.ai[1] == npcIndex) { array2[projCount++] = new Point(projIndex, proj.timeLeft); if (projCount >= array2.Length) diff --git a/Projectiles/Summon/ViridVanguardBlade.cs b/Projectiles/Summon/ViridVanguardBlade.cs index d8180d7698..12833d3ce9 100644 --- a/Projectiles/Summon/ViridVanguardBlade.cs +++ b/Projectiles/Summon/ViridVanguardBlade.cs @@ -1,7 +1,10 @@ using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.Summon; using CalamityMod.Items.Weapons.Summon; +using CalamityMod.Particles; using CalamityMod.Sounds; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -23,6 +26,10 @@ namespace CalamityMod.Projectiles.Summon HorizontalSlashes, VerticalPierceTeleport, RegularPierceSlashes, + ChargingCircle, + PhotonRipperZenithSlashes, + PhotonRipperZenithEndlag, + AxeCircle } public int BladeIndex; @@ -31,15 +38,15 @@ namespace CalamityMod.Projectiles.Summon public Vector2 ChargeStartingPosition; + public float BladeAngleForPhripperZenith = 0; + + public int CurrentViridCount => (int)MathHelper.Max(1, Owner.ownedProjectileCounts[Type]); + public float BladeHoverOffsetAngle { get { - float projectileCounts = Owner.ownedProjectileCounts[Type]; - if (projectileCounts <= 1f) - projectileCounts = 1f; - - return MathHelper.TwoPi * BladeIndex / projectileCounts + AITimer / 27f; + return MathHelper.TwoPi * BladeIndex / CurrentViridCount + Owner.Calamity().ViridVanguardRotation * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); } } @@ -49,14 +56,52 @@ namespace CalamityMod.Projectiles.Summon set => Projectile.ai[0] = (int)value; } + public static List ActiveAttackStateList = new() { ViridVanguardAIState.ChargingCircle, ViridVanguardAIState.PhotonRipperZenithSlashes, ViridVanguardAIState.PhotonRipperZenithEndlag }; + + public Player Owner => Main.player[Projectile.owner]; public ref float AITimer => ref Projectile.ai[1]; + public float ActiveTimer + { + get => Owner.Calamity().ViridVanguardActiveCooldown; + set => Owner.Calamity().ViridVanguardActiveCooldown = value; + } + + public bool IsAxe => BladeIndex % 2 == 0; + + public bool DrawAsAxe => IsInDotRange && CurrentState == ViridVanguardAIState.PhotonRipperZenithSlashes ? !ActiveAttacking : IsAxe; + + bool IsInDotRange = false; + + bool ActiveAttacking = false; + + Vector2 StoredAttackMousePos = Vector2.Zero; + public ref float BladeGleamInterpolant => ref Projectile.localAI[0]; + #region AI consts + public const int HorizontalSlashChargeTime = 14; + + public const float HorizontalSlashSpeed = 44f; + + public const int VerticalSlashChargeTime = 32; + + public const float VerticalSlashSpeed = 45f; + + public const float VerticalTeleportOffset = 850f; + + public const int PierceChargeAttackCycleTime = 44; + + public const float MaxTargetingDistance = 1550f; + + + #endregion + public override void SetStaticDefaults() { + ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; ProjectileID.Sets.TrailingMode[Type] = 2; ProjectileID.Sets.TrailCacheLength[Type] = 45; @@ -64,8 +109,8 @@ namespace CalamityMod.Projectiles.Summon public override void SetDefaults() { - Projectile.width = 84; - Projectile.height = 84; + Projectile.width = 120; + Projectile.height = 120; Projectile.netImportant = true; Projectile.friendly = true; Projectile.ignoreWater = true; @@ -91,6 +136,8 @@ namespace CalamityMod.Projectiles.Summon ChargeStartingPosition = reader.ReadVector2(); } + public override bool MinionContactDamage() => true; + public override void AI() { // Decide whether the minion should still exist. @@ -104,7 +151,7 @@ namespace CalamityMod.Projectiles.Summon if (BladeGleamInterpolant <= 0.02f) BladeGleamInterpolant = 0f; - NPC potentialTarget = Projectile.Center.MinionHoming(ViridVanguard.MaxTargetingDistance, Owner); + NPC potentialTarget = Projectile.Center.MinionHoming(MaxTargetingDistance, Owner); switch (CurrentState) { case ViridVanguardAIState.CircleOwner: @@ -119,24 +166,43 @@ namespace CalamityMod.Projectiles.Summon case ViridVanguardAIState.RegularPierceSlashes: DoBehavior_RegularPierceSlashes(potentialTarget); break; + case ViridVanguardAIState.ChargingCircle: + DoBehavior_PhotonRipperZenithStartup(potentialTarget); + break; + case ViridVanguardAIState.PhotonRipperZenithSlashes: + DoBehavior_PhotonRipperZenithActive(potentialTarget); + break; + case ViridVanguardAIState.PhotonRipperZenithEndlag: + DoBehavior_PhotonRipperZenithEndlag(potentialTarget); + break; + case ViridVanguardAIState.AxeCircle: + DoBehavior_AxeCircle(potentialTarget); + break; } AITimer++; + if (CurrentState == ViridVanguardAIState.PhotonRipperZenithEndlag) + Projectile.MaxUpdates = 1; } public void DoBehavior_CircleOwner(NPC potentialTarget) { + //Reset active cooldown if it's in the negative somehow + if (ActiveTimer < 0) + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + // Begin attacking if an enemy is nearby. + var viridAmount = 300f / CurrentViridCount; if (potentialTarget is not null) { - CurrentState = ViridVanguardAIState.HorizontalSlashes; + CurrentState = IsAxe ? ViridVanguardAIState.AxeCircle : ViridVanguardAIState.HorizontalSlashes; AITimer = 0f; Projectile.netUpdate = true; return; } - - Vector2 hoverDestination = Owner.Center + BladeHoverOffsetAngle.ToRotationVector2() * 200f; - Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 16f); + float hoverDistMult = MathHelper.Lerp(IsAxe ? 170 : 200, IsAxe ? 200 : 170, (MathF.Sin(AITimer * 0.06f) + 1) * 0.5f); + Vector2 hoverDestination = Owner.Center + BladeHoverOffsetAngle.ToRotationVector2() * hoverDistMult; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 20f); Projectile.velocity *= 0.8f; // Teleport to the owner if sufficiently far away. @@ -150,10 +216,35 @@ namespace CalamityMod.Projectiles.Summon Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; } + public void DoBehavior_AxeCircle(NPC potentialTarget) + { + // Begin attacking if an enemy is nearby. + var viridAmount = 300f / CurrentViridCount; + if (potentialTarget is null) + { + ReturnToIdleState(); + return; + } + var offset = MathHelper.TwoPi * MathF.Floor(BladeIndex * 0.5f) / MathF.Ceiling(CurrentViridCount * 0.5f) + Owner.Calamity().ViridVanguardRotation * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1); + Vector2 hoverDestination = Owner.Center + offset.ToRotationVector2() * 200f; + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, 32f); + Projectile.velocity *= 0.8f; + + // Teleport to the owner if sufficiently far away. + if (!Projectile.WithinRange(Owner.Center, 2500f)) + { + Projectile.Center = hoverDestination; + Projectile.netUpdate = true; + } + Owner.Calamity().ViridVanguardRotationToAdd = ViridVanguard.IdleCirclingSpeed * MathHelper.SmoothStep(1f, ViridVanguard.AxeCirclingSpeedMultiplier, AITimer / 150f); + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + public void DoBehavior_HorizontalSlashes(NPC target) { int hoverTime = 22; - int chargeTime = ViridVanguard.HorizontalSlashChargeTime; + int chargeTime = HorizontalSlashChargeTime; // Exit the attack state if the blade no longer has a valid target. if (target is null) @@ -193,15 +284,15 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.velocity = Vector2.UnitX * (target.Center.X > Projectile.Center.X).ToDirectionInt() * ViridVanguard.HorizontalSlashSpeed; + Projectile.velocity = Vector2.UnitX * (target.Center.X > Projectile.Center.X).ToDirectionInt() * HorizontalSlashSpeed; Projectile.netUpdate = true; } // Switch to the next attack state once enough charges have happened. - if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.HorizontalSlashAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.VerticalPierceTeleport; + CurrentState = ViridVanguardAIState.RegularPierceSlashes; Projectile.netUpdate = true; } } @@ -209,7 +300,7 @@ namespace CalamityMod.Projectiles.Summon public void DoBehavior_VerticalPierceTeleport(NPC target) { int hoverTime = 26; - int chargeTime = ViridVanguard.VerticalSlashChargeTime; + int chargeTime = VerticalSlashChargeTime; // Exit the attack state if the blade no longer has a valid target. if (target is null) @@ -246,30 +337,30 @@ namespace CalamityMod.Projectiles.Summon { SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.velocity = Vector2.UnitY * ViridVanguard.VerticalSlashSpeed; + Projectile.velocity = Vector2.UnitY * VerticalSlashSpeed; Projectile.netUpdate = true; } // Teleport above the target once sufficiently far below them. - if (wrappedAttackTimer >= hoverTime + 5f && Projectile.Center.Y > target.Center.Y + ViridVanguard.VerticalTeleportOffset) + if (wrappedAttackTimer >= hoverTime + 5f && Projectile.Center.Y > target.Center.Y + VerticalTeleportOffset) { Projectile.oldPos = new Vector2[Projectile.oldPos.Length]; - Projectile.Center = target.Center - Vector2.UnitY * ViridVanguard.VerticalTeleportOffset * 0.7f; + Projectile.Center = target.Center - Vector2.UnitY * VerticalTeleportOffset * 0.7f; Projectile.netUpdate = true; } // Switch to the next attack state once enough charges have happened. - if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= (hoverTime + chargeTime) * ViridVanguard.VerticalPierceAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.RegularPierceSlashes; + CurrentState = ViridVanguardAIState.HorizontalSlashes; Projectile.netUpdate = true; } } public void DoBehavior_RegularPierceSlashes(NPC target) { - int attackCycleTime = ViridVanguard.PierceChargeAttackCycleTime; + int attackCycleTime = PierceChargeAttackCycleTime; float upwardRiseTimeRatio = 0.4f; float pierceTimeRatio = 0.14f; @@ -282,14 +373,13 @@ namespace CalamityMod.Projectiles.Summon } // Initialize the starting position on the first frame. - int localAITimer = (int)AITimer + Projectile.identity; - if (localAITimer % attackCycleTime == 1f) + if (AITimer % attackCycleTime == 1f) { ChargeStartingPosition = Projectile.Center + Main.rand.NextVector2Circular(80f, 80f); Projectile.netUpdate = true; } - float attackCompletion = localAITimer / (float)attackCycleTime % 1f; + float attackCompletion = AITimer / (float)attackCycleTime % 1f; // Reset the trail point array if aiming at the target. if (attackCompletion < upwardRiseTimeRatio) @@ -319,21 +409,137 @@ namespace CalamityMod.Projectiles.Summon Projectile.velocity = Vector2.Zero; // Play a slice sound once ready to charge. - if (localAITimer % attackCycleTime == (int)(attackCycleTime * upwardRiseTimeRatio)) + if (AITimer % attackCycleTime == (int)(attackCycleTime * upwardRiseTimeRatio)) SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound with { Pitch = 1.6f, Volume = 0.27f }, Projectile.Center); // Switch to the next attack state once enough charges have happened. - if (localAITimer >= attackCycleTime * ViridVanguard.ChargesPerAttackCycle) + if (AITimer >= attackCycleTime * ViridVanguard.StabAmount) { AITimer = 0f; - CurrentState = ViridVanguardAIState.HorizontalSlashes; + CurrentState = ViridVanguardAIState.VerticalPierceTeleport; Projectile.netUpdate = true; } } + public void DoBehavior_PhotonRipperZenithStartup(NPC target) + { + Projectile.MaxUpdates = 2; + float completion = AITimer / (ViridVanguard.ActiveAttackStartup * (float)Projectile.MaxUpdates); + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + + Projectile.Center = Vector2.Lerp(Projectile.Center, hoverDestination, 0.04f).MoveTowards(hoverDestination, MathHelper.Lerp(16f, 64f, completion)); + Projectile.velocity *= 0.8f; + Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + ActiveTimer = -1; + IsInDotRange = false; + + if (completion >= 1f) + { + CurrentState = ViridVanguardAIState.PhotonRipperZenithSlashes; + Projectile.netUpdate = true; + } + + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + public void DoBehavior_PhotonRipperZenithActive(NPC target) + { + Projectile.MaxUpdates = 2; + Vector2 angleToMouse = Owner.DirectionTo(IsInDotRange ? StoredAttackMousePos : Owner.Calamity().mouseWorld); + + float dotResult = Vector2.Dot(angleToMouse, BladeAngleForPhripperZenith.ToRotationVector2()); + + if (dotResult < -0.5f) + { + IsInDotRange = false; + ActiveAttacking = false; + } + else if (!IsInDotRange) + { + IsInDotRange = true; + StoredAttackMousePos = Owner.Calamity().mouseWorld; + ActiveTimer--; + + if (ActiveTimer % 2 == 0) + { + ActiveAttacking = true; + Projectile.ResetLocalNPCHitImmunity(); + } + } + dotResult += 1f; + dotResult /= 2f; + if (!ActiveAttacking) + { + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * 116f; + Projectile.Center = hoverDestination; + Projectile.velocity *= 0.8f; + + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + if ((ActiveTimer < -2 * ViridVanguard.ActiveAttackSlashCount * CurrentViridCount || ActiveTimer > 0) && Projectile.FinalExtraUpdate()) + { + CurrentState = ViridVanguardAIState.PhotonRipperZenithEndlag; + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + AITimer = 0; + } + } + else + { + float distance = Owner.Distance(StoredAttackMousePos); + float endSize = MathHelper.Clamp(distance * 0.25f, 164f, 300f); + Vector2 hoverCenter = Vector2.Lerp(Owner.Center, Owner.Center + Owner.Center.DirectionTo(StoredAttackMousePos) * (distance > 164 ? distance - endSize : 0), dotResult); + Vector2 finalHoverDestination = hoverCenter + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(116f, endSize, dotResult); + Projectile.Center = finalHoverDestination; + Projectile.velocity *= 0.8f; + Projectile.rotation = Projectile.AngleFrom(hoverCenter) + MathHelper.PiOver2; + } + + Owner.Calamity().ViridVanguardRotationToAdd = ViridVanguard.ActiveAttackCirclingSpeedMultiplier * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + + } + public void DoBehavior_PhotonRipperZenithEndlag(NPC target) + { + + Projectile.MaxUpdates = 1; + float completion = 1 - AITimer / (ViridVanguard.ActiveAttackEndlag * (float)Projectile.MaxUpdates); + if (Owner.Calamity().ViridVanguardActiveAttackerThisFrame) + { + AITimer = 0; + ActiveTimer = ViridVanguard.ActiveAttackCooldown; + completion = 1; + } + Vector2 hoverDestination = Owner.Center + (BladeAngleForPhripperZenith * (Owner.Calamity().InvertExaltationLineRotationDirections ? -1 : 1)).ToRotationVector2() * MathHelper.Lerp(200f, 116f, completion); + Projectile.Center = hoverDestination; + Projectile.velocity *= 0.8f; + Owner.Calamity().ViridVanguardRotationToAdd = MathHelper.Lerp(1, ViridVanguard.ActiveAttackCirclingSpeedMultiplier, completion) * ViridVanguard.IdleCirclingSpeed; + BladeAngleForPhripperZenith += Owner.Calamity().ViridVanguardRotationToAdd / Projectile.MaxUpdates; + + if (completion <= 0f) + { + ReturnToIdleState(); + Owner.Calamity().ViridVanguardRotation += MathHelper.WrapAngle(BladeAngleForPhripperZenith - BladeHoverOffsetAngle); //This will cause the proper rotation to be kept on completion + Projectile.netUpdate = true; + } + + // Aim away from the target. + Projectile.rotation = Projectile.AngleFrom(Owner.Center) + MathHelper.PiOver2; + } + + public void BeginSuperEpicPhotonRipperZenithKnockoffAttack() + { + + if (CurrentState != ViridVanguardAIState.CircleOwner) + AITimer = 0f; + BladeAngleForPhripperZenith = BladeHoverOffsetAngle; + CurrentState = ViridVanguardAIState.ChargingCircle; + AITimer = 0f; + Projectile.netUpdate = true; + } public void ReturnToIdleState() { AITimer = 0f; + Projectile.extraUpdates = 0; CurrentState = ViridVanguardAIState.CircleOwner; Projectile.netUpdate = true; } @@ -344,28 +550,54 @@ namespace CalamityMod.Projectiles.Summon if (Projectile.type == ModContent.ProjectileType()) { if (Owner.dead) - Owner.Calamity().ViridVanguard = false; + Owner.Calamity().viridVanguard = false; - if (Owner.Calamity().ViridVanguard) + if (Owner.Calamity().viridVanguard) Projectile.timeLeft = 2; } } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.Calamity().sagePoisonDamage = (int)(SagePoison.debuffData.EnemyLostRegen * SagePoison.ViridVanguardPoisonMultiplier * CurrentViridCount); + target.AddBuff(ModContent.BuffType(), 60); + if (ActiveAttacking) + { + Vector2 vel = new Vector2(0.1f, 0.1f).RotatedByRandom(100); + VoidSparkParticle spark2 = new VoidSparkParticle(target.Center, vel, false, 9, Main.rand.NextFloat(0.25f, 0.35f), Main.rand.NextBool() ? Color.LimeGreen : Color.Goldenrod); + GeneralParticleHandler.SpawnParticle(spark2); + SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound with { Volume = CommonCalamitySounds.SwiftSliceSound.Volume * 0.3f, MaxInstances = 0 }, Projectile.Center); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + //Deals massively increased damage during the active attack + if (ActiveAttacking) + modifiers.SourceDamage *= ViridVanguard.ActiveAttackSlashDmgMult; + //when not using the active, deal the right amount of damage for the swords vs axes + else if (!ActiveAttackStateList.Contains(CurrentState)) + if (IsAxe) + modifiers.SourceDamage *= ViridVanguard.AxeDmgMult; + else + modifiers.SourceDamage *= ViridVanguard.SwordDmgMult; + } + public Color TrailColorFunction(float completionRatio) { - float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * 0.48f; + float opacity = (float)Math.Pow(Utils.GetLerpValue(1f, 0.45f, completionRatio, true), 4D) * Projectile.Opacity * (CurrentState == ViridVanguardAIState.CircleOwner ? 0.3f : 0.48f); return Color.Lerp(new(115, 196, 127), Color.Yellow, MathHelper.Clamp(completionRatio * 1.4f, 0f, 1f)) * opacity; } - public float TrailWidthFunction(float completionRatio) => Projectile.height * (1f - completionRatio) * 0.8f; + public float TrailWidthFunction(float completionRatio) => Projectile.height * (1f - completionRatio) * (DrawAsAxe ? 0.6f : 0.8f); public override bool PreDraw(ref Color lightColor) { Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Rectangle frame = texture.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Rectangle frame = texture.Frame(2, 1, DrawAsAxe ? 0 : 1, 0); Vector2 origin = frame.Size() * 0.5f; Vector2 drawPosition = Projectile.Center - Main.screenPosition; - SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + SpriteEffects direction = Projectile.spriteDirection == 1 ^ Owner.Calamity().InvertExaltationLineRotationDirections ? SpriteEffects.FlipHorizontally : SpriteEffects.None; // Draw the afterimage trail. TrailDrawer ??= new(); @@ -378,18 +610,34 @@ namespace CalamityMod.Projectiles.Summon Main.pixelShader.CurrentTechnique.Passes[0].Apply(); // Draw the blade. - Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), Projectile.rotation + 0.2f, origin, Projectile.scale, direction, 0); + float outlineOpacity = 1; + float outlineWidth = 1; + Color outlineColor = Color.LimeGreen; + if (!(ActiveAttackStateList.Contains(CurrentState) && ActiveTimer > 0)) + { + outlineWidth = Math.Clamp(MathF.Pow(1 - ActiveTimer / ViridVanguard.ActiveAttackCooldown, 3), 0, 1); + outlineOpacity = 0.75f; + } + var outlineTex = ViridVanguard.GetBladeOutlineTex(); + var rotation = Projectile.rotation + (DrawAsAxe ^ Owner.Calamity().InvertExaltationLineRotationDirections ? -0.2f : 0.2f); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, 2) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(-2, 0) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(outlineTex, drawPosition + new Vector2(0, -2) * outlineWidth, frame, outlineColor * outlineOpacity, rotation, origin, Projectile.scale, direction, 0); + Main.EntitySpriteDraw(texture, drawPosition, frame, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0); // Draw the gleam at the tip of the blade. - Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; - Vector2 shineScale = new Vector2(1.67f, 3f) * Projectile.scale; - shineScale *= MathHelper.Lerp(0.9f, 1.1f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.4f + Projectile.identity) * 0.5f + 0.5f); - - Vector2 lensFlareWorldPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.width * Projectile.scale * 0.88f; - Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Yellow, 0.23f) with { A = 0 } * BladeGleamInterpolant; - Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, 0f, shineTex.Size() * 0.5f, shineScale * 0.6f, 0, 0); - Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, MathHelper.PiOver2, shineTex.Size() * 0.5f, shineScale, 0, 0); + if (ActiveTimer <= 0) + { + Texture2D shineTex = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Vector2 shineScale = new Vector2(1.67f, 3f) * Projectile.scale; + shineScale *= MathHelper.Lerp(0.9f, 1.1f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.4f + Projectile.identity) * 0.5f + 0.5f); + Vector2 lensFlareWorldPosition = Projectile.Center + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * Projectile.width * Projectile.scale * 0.88f; + Color lensFlareColor = Color.Lerp(Color.LimeGreen, Color.Yellow, 0.23f) with { A = 0 } * BladeGleamInterpolant; + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, 0f, shineTex.Size() * 0.5f, shineScale * 0.6f, 0, 0); + Main.EntitySpriteDraw(shineTex, lensFlareWorldPosition - Main.screenPosition, null, lensFlareColor, MathHelper.PiOver2, shineTex.Size() * 0.5f, shineScale, 0, 0); + } // Reset textures for shaders, since they're only defined once at load-time in vanilla. GameShaders.Misc["EmpressBlade"].UseImage0("Images/Extra_209"); GameShaders.Misc["EmpressBlade"].UseImage1("Images/Extra_210"); diff --git a/Projectiles/Summon/ViridVanguardBlade.png b/Projectiles/Summon/ViridVanguardBlade.png index e2cbaf2040..6621e5b1c6 100644 Binary files a/Projectiles/Summon/ViridVanguardBlade.png and b/Projectiles/Summon/ViridVanguardBlade.png differ diff --git a/Projectiles/Summon/VoidConcentrationAura.cs b/Projectiles/Summon/VoidConcentrationAura.cs index 91487ce95c..1d9f07ff49 100644 --- a/Projectiles/Summon/VoidConcentrationAura.cs +++ b/Projectiles/Summon/VoidConcentrationAura.cs @@ -91,5 +91,7 @@ namespace CalamityMod.Projectiles.Summon return; timer++; } + + public override bool MinionContactDamage() => true; } } diff --git a/Projectiles/Summon/WaterElementalMinion.cs b/Projectiles/Summon/WaterElementalMinion.cs index 2e5ea2d82f..e04dd72736 100644 --- a/Projectiles/Summon/WaterElementalMinion.cs +++ b/Projectiles/Summon/WaterElementalMinion.cs @@ -40,7 +40,7 @@ namespace CalamityMod.Projectiles.Summon bool isMinion = Projectile.type == ModContent.ProjectileType(); Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.sirenWaifu && !modPlayer.allWaifus && !modPlayer.sirenWaifuVanity && !modPlayer.allWaifusVanity) + if (!modPlayer.waterElemental && !modPlayer.allElementals && !modPlayer.waterElementalVanity && !modPlayer.allElementalsVanity) { Projectile.active = false; return; @@ -49,9 +49,9 @@ namespace CalamityMod.Projectiles.Summon { if (player.dead) { - modPlayer.slWaifu = false; + modPlayer.waterEleBuff = false; } - if (modPlayer.slWaifu) + if (modPlayer.waterEleBuff) { Projectile.timeLeft = 2; } @@ -66,7 +66,7 @@ namespace CalamityMod.Projectiles.Summon } dust--; } - bool passive = modPlayer.sirenWaifuVanity || modPlayer.allWaifusVanity; + bool passive = modPlayer.waterElementalVanity || modPlayer.allElementalsVanity; if (!passive) Lighting.AddLight(Projectile.Center, 0f, 0.25f, 1.5f); diff --git a/Projectiles/Summon/WhiteDragonHead.cs b/Projectiles/Summon/WhiteDragonHead.cs index 421192a221..6a02f6f326 100644 --- a/Projectiles/Summon/WhiteDragonHead.cs +++ b/Projectiles/Summon/WhiteDragonHead.cs @@ -214,6 +214,8 @@ namespace CalamityMod.Projectiles.Summon return false; } + public override bool MinionContactDamage() => true; + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Frostburn2, 300); } } diff --git a/Projectiles/Summon/WitherBlossom.cs b/Projectiles/Summon/WitherBlossom.cs index 833562f02a..fdb893d419 100644 --- a/Projectiles/Summon/WitherBlossom.cs +++ b/Projectiles/Summon/WitherBlossom.cs @@ -20,6 +20,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { + Main.projPet[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -59,7 +60,5 @@ namespace CalamityMod.Projectiles.Summon } } } - - public override bool? CanDamage() => false; } } diff --git a/Projectiles/Summon/WulfrumDroid.cs b/Projectiles/Summon/WulfrumDroid.cs index cc8d4f7eee..eb1096612e 100644 --- a/Projectiles/Summon/WulfrumDroid.cs +++ b/Projectiles/Summon/WulfrumDroid.cs @@ -99,6 +99,7 @@ namespace CalamityMod.Projectiles.Summon public override void SetStaticDefaults() { Main.projFrames[Type] = 12; + Main.projPet[Type] = true; ProjectileID.Sets.MinionSacrificable[Type] = true; ProjectileID.Sets.MinionTargettingFeature[Type] = true; } @@ -118,6 +119,7 @@ namespace CalamityMod.Projectiles.Summon Projectile.minion = true; Projectile.DamageType = DamageClass.Summon; Initialized = 0f; + BuffModeBuffer = 15; } //Returns the npc if targetable, returns null if not @@ -164,15 +166,37 @@ namespace CalamityMod.Projectiles.Summon if (Owner.Calamity().mouseRight && Owner.HeldItem.type == ModContent.ItemType()) { - if (BuffModeBuffer > 0) + if (Owner.itemTime == Owner.itemTimeMax) + { + if (BuffModeBuffer == 15) + BuffModeBuffer--; + if (BuffModeBuffer == -15) + BuffModeBuffer++; + } + if (BuffModeBuffer < 15 && BuffModeBuffer >= 0) { BuffModeBuffer--; - Projectile.netUpdate = true; + if (BuffModeBuffer == 0) + BuffModeBuffer = -15; } + if (BuffModeBuffer > -15 && BuffModeBuffer <= 0) + { + BuffModeBuffer++; + if (BuffModeBuffer == 0) + BuffModeBuffer = 15; + } + Projectile.netUpdate = true; + } + + else if (BuffModeBuffer > 0 && BuffModeBuffer < 15) + { + BuffModeBuffer++; + } + else if (BuffModeBuffer < 0 && BuffModeBuffer > -15) + { + BuffModeBuffer--; } - else if (BuffModeBuffer < 15) - BuffModeBuffer = 15; bool buffMode = BuffModeBuffer <= 0; @@ -368,8 +392,7 @@ namespace CalamityMod.Projectiles.Summon { ShootTimer = ShootDelay; - // 1/3 chance to directly recharge the Rover Drive shield by 1 point - if (Main.rand.NextBool(3) && modPlayer.roverDrive && modPlayer.RoverDriveShieldDurability < RoverDrive.ShieldDurabilityMax) + if (modPlayer.roverDrive && modPlayer.RoverDriveShieldDurability < RoverDrive.ShieldDurabilityMax) { CalamityPlayer buffedCalPlayer = playerToBuff.Calamity(); buffedCalPlayer.RoverDriveShieldDurability++; @@ -508,8 +531,6 @@ namespace CalamityMod.Projectiles.Summon } } - public override bool? CanDamage() => false; - public override void SendExtraAI(BinaryWriter writer) { writer.Write(BuffModeBuffer); diff --git a/Projectiles/Turret/IceShot.cs b/Projectiles/Turret/IceShot.cs index bef1dc5cb2..8f970f9d8e 100644 --- a/Projectiles/Turret/IceShot.cs +++ b/Projectiles/Turret/IceShot.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Turret } public override void OnHitPlayer(Player target, Player.HurtInfo info) { - target.AddBuff(ModContent.BuffType(), 30); + target.AddBuff(BuffID.Frozen, 30); target.AddBuff(BuffID.Frostburn, 180); if (Projectile.hostile && Main.netMode == NetmodeID.MultiplayerClient) //hostile version pierces through players in multiplayer return; diff --git a/Projectiles/Turret/PlagueShot.cs b/Projectiles/Turret/PlagueShot.cs index 2fbf17f8ea..88ea01207f 100644 --- a/Projectiles/Turret/PlagueShot.cs +++ b/Projectiles/Turret/PlagueShot.cs @@ -86,7 +86,8 @@ namespace CalamityMod.Projectiles.Turret public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(TeslaCannon.FireSound with { Volume = 0.18f }, Projectile.Center); + SoundStyle fire = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + SoundEngine.PlaySound(fire with { Volume = 0.5f, Pitch = -0.3f }, Projectile.Center); if (Main.netMode != NetmodeID.MultiplayerClient) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0.4f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack * 0.16f, Main.myPlayer); diff --git a/Projectiles/Typeless/BabyCannonballProjectile.cs b/Projectiles/Typeless/BabyCannonballProjectile.cs index 15f00571b0..2dcca5f59d 100644 --- a/Projectiles/Typeless/BabyCannonballProjectile.cs +++ b/Projectiles/Typeless/BabyCannonballProjectile.cs @@ -31,7 +31,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.alpha = 255; Projectile.MaxUpdates = 3; - Projectile.timeLeft = 600; + Projectile.timeLeft = 150 * Projectile.MaxUpdates;; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = Projectile.MaxUpdates * 11; } diff --git a/Projectiles/Typeless/BatholithBangleProjectile.cs b/Projectiles/Typeless/BatholithBangleProjectile.cs index 8cb026e4c2..7c9026b3c8 100644 --- a/Projectiles/Typeless/BatholithBangleProjectile.cs +++ b/Projectiles/Typeless/BatholithBangleProjectile.cs @@ -127,17 +127,6 @@ namespace CalamityMod.Projectiles.Typeless float launchPower = 9; target.MoveNPC(launchVel, launchPower, true); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - bool hasCD = Owner.Calamity().cooldowns.TryGetValue(GenericBandCooldown.ID, out CooldownInstance bandCD); - - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > BatholithBangle.cooldown / 2) - { - Owner.Calamity().generalBandCooldown -= BatholithBangle.cooldown / 2; - if (hasCD) - bandCD.timeLeft -= BatholithBangle.cooldown / 2; - } - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f, targetHitbox); public override bool? CanDamage() { diff --git a/Projectiles/Typeless/BlackPearl.png b/Projectiles/Typeless/BlackPearl.png new file mode 100644 index 0000000000..5c7aaa722a Binary files /dev/null and b/Projectiles/Typeless/BlackPearl.png differ diff --git a/Projectiles/Typeless/BlazingStarHeal.cs b/Projectiles/Typeless/BlazingStarHeal.cs index 813cd82252..8b0043879c 100644 --- a/Projectiles/Typeless/BlazingStarHeal.cs +++ b/Projectiles/Typeless/BlazingStarHeal.cs @@ -83,7 +83,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 25); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); diff --git a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs index d782b2b97d..3082837b88 100644 --- a/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs +++ b/Projectiles/Typeless/BlazingStarThatDoesNotHeal.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Typeless public override bool PreDraw(ref Color lightColor) { - GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/FabstaffStreak")); + GameShaders.Misc["CalamityMod:TrailStreak"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/Trails/SylvestaffStreak")); PrimitiveRenderer.RenderTrail(Projectile.oldPos, new(WidthFunction, ColorFunction, (_) => Projectile.Size * 0.5f, shader: GameShaders.Misc["CalamityMod:TrailStreak"]), 8); Main.spriteBatch.EnterShaderRegion(BlendState.Additive); @@ -101,6 +101,8 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 60 * 5); + //Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(15)); } } diff --git a/Projectiles/Typeless/BloodBomb.cs b/Projectiles/Typeless/BloodBomb.cs index a1b97fc5f4..c0252c1c57 100644 --- a/Projectiles/Typeless/BloodBomb.cs +++ b/Projectiles/Typeless/BloodBomb.cs @@ -17,8 +17,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 20; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.timeLeft = 600; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; } public override void AI() diff --git a/Projectiles/Typeless/BloomStoneFlower.cs b/Projectiles/Typeless/BloomStoneFlower.cs index 596a08d25f..80e590b0d6 100644 --- a/Projectiles/Typeless/BloomStoneFlower.cs +++ b/Projectiles/Typeless/BloomStoneFlower.cs @@ -1,6 +1,9 @@ -using CalamityMod.Dusts; +using System; +using System.Collections.Generic; +using CalamityMod.Dusts; using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -15,57 +18,86 @@ namespace CalamityMod.Projectiles.Typeless public ref float HookIndex => ref Projectile.ai[0]; public ref float FlowerPart => ref Projectile.ai[1]; + + public ref float timer => ref Projectile.ai[2]; + public float fadeTime = 0; + public bool fadeOut = false; + public int maxTime = 5; public override void SetDefaults() { Projectile.width = Projectile.height = 30; - Projectile.scale = 1.2f; + Projectile.scale = 1f; Projectile.friendly = true; Projectile.tileCollide = false; Projectile.ignoreWater = true; - Projectile.timeLeft = 300; + Projectile.timeLeft = 150; } public override void AI() { + if (timer == 0) + Projectile.rotation = Main.rand.NextFloat(0, MathHelper.TwoPi); switch (FlowerPart) { case 0: Projectile hook = Main.projectile[(int)HookIndex]; if (!(hook.active && hook.aiStyle == ProjAIStyleID.Hook && hook.ai[0] == 2f)) { - Projectile.Kill(); - return; + fadeOut = true; } + float sine = (float)Math.Sin(timer * 0.01f); + Projectile.rotation += fadeTime * sine * 0.005f; + if (Projectile.scale > 1) + Projectile.scale = MathHelper.Lerp(Projectile.scale, 1, 0.15f); - Projectile.timeLeft = 5; - if (Vector2.DistanceSquared(Projectile.Center, Main.player[Projectile.owner].Center) < 1024f) + Projectile.timeLeft++; + if (!fadeOut && Vector2.DistanceSquared(Projectile.Center, Main.player[Projectile.owner].Center) < 4096f) { SoundEngine.PlaySound(SoundID.Item60, Projectile.Center); if (Main.myPlayer == Projectile.owner) { - for (int i = 0; i < 5; i++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2Circular(4f, 4f), Type, 0, 0f, Projectile.owner, 0f, 1f); + int dusts = 6; + int dir = Main.rand.NextBool() ? -1 : 1; + for (int i = 0; i < dusts; i++) + { + Projectile pollen = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (MathHelper.TwoPi / dusts * i).ToRotationVector2() * 3f, Type, 0, 0f, Projectile.owner, 0f, 1f); + pollen.localAI[0] = dir; + } + } - Projectile.Kill(); + fadeOut = true; + Projectile.scale = 2.5f; } + if ((fadeOut && Projectile.scale <= 1.05f) || (!fadeOut && fadeTime < maxTime)) + fadeTime += (fadeOut ? -0.2f : 1); + + if (fadeTime < 0 && fadeOut) + Projectile.Kill(); break; case 1: + if (timer == 0) + { + Projectile.scale = 1.8f; + Projectile.extraUpdates = 1; + } if (Projectile.width < 90) Projectile.ExpandHitboxBy(90); - Projectile.velocity *= 0.98f; - + Projectile.velocity = Projectile.velocity.RotatedBy(0.04f * Projectile.localAI[0]) * 1.001f; + Color mistColor = Color.Lerp(Color.HotPink, Color.Gold, Utils.GetLerpValue(100, 0, Projectile.timeLeft, true)); // Visual effect - if (Projectile.timeLeft % 10 == 0) + if (Projectile.timeLeft % 4 == 0) { - MediumMistParticle pollenCloud = new(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f), Color.Yellow, Color.Gold, 3f, 100f); + MediumMistParticle pollenCloud = new(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f), mistColor, mistColor, 3f * Projectile.scale, 100f); GeneralParticleHandler.SpawnParticle(pollenCloud); } if (Projectile.timeLeft % 4 == 0) { - Dust pollenDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), newColor: Color.Gold, Scale: 0.6f); + Dust pollenDust = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType(), newColor: mistColor, Scale: 0.6f * Projectile.scale); pollenDust.noLightEmittence = true; pollenDust.noGravity = true; } + if (Projectile.scale > 0.7f) + Projectile.scale -= 0.025f; // Check for buffing Player owner = Main.player[Projectile.owner]; @@ -75,12 +107,44 @@ namespace CalamityMod.Projectiles.Typeless continue; if (Projectile.Hitbox.Intersects(p.Hitbox)) - p.Calamity().bloomStoneDR = 360; + p.Calamity().bloomStoneBuffedHealRateTimer = 360; } + fadeTime++; break; } + timer++; } - public override bool PreDraw(ref Color lightColor) => FlowerPart == 0f; + public override bool PreDraw(ref Color lightColor) + { + if (FlowerPart == 0f) + { + Texture2D tex2 = ModContent.Request("CalamityMod/Particles/BigHeart").Value; + Texture2D tex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + int parts = 5; + float rot = 0; + float scaleFade = (float)Math.Pow(Utils.GetLerpValue(0, maxTime, fadeTime, true), 2); + for (int b = 0; b < 3; b++) + { + Color drawColor = Color.Lerp(Color.HotPink, Color.Plum, b * 0.3f) with { A = 0 }; + float scaleMult = (1 - 0.15f * b) * scaleFade; + for (int i = 0; i < parts; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / parts).ToRotationVector2(); + Main.EntitySpriteDraw(tex2, Projectile.Center - Main.screenPosition + vel.RotatedBy(Projectile.rotation * (float)Math.Pow(1.5f - scaleMult, 2) + rot) * 35 * scaleMult, null, drawColor * 0.3f, Projectile.rotation * (float)Math.Pow(1.5f - scaleMult, 2) + vel.ToRotation() + MathHelper.PiOver2 + rot, tex2.Size() / 2f, new Vector2(0.9f, 1.5f) * Projectile.scale * 0.15f * scaleMult, SpriteEffects.None, 0); + } + rot += MathHelper.PiOver4 * 0.5f; + } + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.Gold with { A = 0 }, Projectile.rotation, tex.Size() / 2f, Projectile.scale * 0.45f * scaleFade, SpriteEffects.None, 0); + + return false; + } + else return false; + } + public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) + { + overPlayers.Add(index); + } } } diff --git a/Projectiles/Typeless/BlunderBoosterAura.cs b/Projectiles/Typeless/BlunderBoosterAura.cs index 440c655f07..a083ecbb2e 100644 --- a/Projectiles/Typeless/BlunderBoosterAura.cs +++ b/Projectiles/Typeless/BlunderBoosterAura.cs @@ -66,23 +66,9 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 180); - - if (target.knockBackResist <= 0f) - return; - - // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); - Vector2 trueKnockback = target.Center - Projectile.Center; - trueKnockback.Normalize(); - target.velocity = trueKnockback * knockbackMultiplier; - } - } - + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 180); + // CIT 2MAY2025: Replaced old manual knockback code with setting HitDirectionOverride + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType(), 180); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.cs b/Projectiles/Typeless/ChlorophyteLifePulse.cs deleted file mode 100644 index 98e98e702e..0000000000 --- a/Projectiles/Typeless/ChlorophyteLifePulse.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Projectiles.VanillaProjectileOverrides; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ChlorophyteLifePulse : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - - public const int Lifetime = 60; - - public float LifetimeCompletion => 1f - Projectile.timeLeft / (float)Lifetime; - - public override void SetDefaults() - { - Projectile.width = 96; - Projectile.height = 96; - Projectile.friendly = true; - Projectile.tileCollide = false; - Projectile.ignoreWater = true; - Projectile.penetrate = -1; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 30; - Projectile.timeLeft = Lifetime; - } - - public override bool? CanHitNPC(NPC target) => !target.CountsAsACritter && !target.friendly && target.chaseable; - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Projectile.damage = (int)(Projectile.damage * 0.8f); - - public override void AI() - { - Projectile.Opacity = 1f - (float)Math.Pow(LifetimeCompletion, 1.56); - Projectile.scale = MathHelper.Lerp(0.5f, 6f, LifetimeCompletion); - - // Heal all members of the same team. - if (Projectile.timeLeft == (int)(Lifetime * 0.925f)) - { - Player owner = Main.player[Projectile.owner]; - List membersOfSameTeam = new List() - { - owner - }; - if (owner.team != 0) - membersOfSameTeam.AddRange(Main.player.Where(p => p.team == owner.team && p.active && !p.dead)); - - foreach (Player player in membersOfSameTeam) - { - if (player.Calamity().ChlorophyteHealDelay > 0) - continue; - - int healQuantity = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.AmountToHealPerPulse); - player.HealPlayer(healQuantity); - player.Calamity().ChlorophyteHealDelay = ChlorophyteArmorSetChange.DelayBetweenHeals; - } - } - } - - public override Color? GetAlpha(Color lightColor) - { - Color c1 = new Color(142, 255, 155, 0); - Color c2 = new Color(0, 142, 113, 92); - return Color.Lerp(c1, c2, 1f - Projectile.Opacity) * Projectile.Opacity * 0.67f; - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D texture = Terraria.GameContent.TextureAssets.Projectile[Type].Value; - Color drawColor = Projectile.GetAlpha(lightColor) * 0.4f; - for (int i = 0; i < 8; i++) - { - Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 4f; - Vector2 drawPosition = Projectile.Center - Main.screenPosition + drawOffset; - Main.EntitySpriteDraw(texture, drawPosition, null, drawColor, 0f, texture.Size() * 0.5f, Projectile.scale, 0, 0); - } - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.scale * 48f, targetHitbox); - - public override bool OnTileCollide(Vector2 oldVelocity) => false; - } -} diff --git a/Projectiles/Typeless/ChlorophyteLifePulse.png b/Projectiles/Typeless/ChlorophyteLifePulse.png deleted file mode 100644 index f51029ba21..0000000000 Binary files a/Projectiles/Typeless/ChlorophyteLifePulse.png and /dev/null differ diff --git a/Projectiles/Typeless/ClaretCannonProj.cs b/Projectiles/Typeless/ClaretCannonProj.cs index 12f7022009..01f9f28319 100644 --- a/Projectiles/Typeless/ClaretCannonProj.cs +++ b/Projectiles/Typeless/ClaretCannonProj.cs @@ -24,9 +24,9 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.alpha = 0; Projectile.penetrate = 1; - Projectile.timeLeft = 600; Projectile.DamageType = AverageDamageClass.Instance; - Projectile.extraUpdates = 1; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 120 * Projectile.MaxUpdates; Projectile.aiStyle = 0; } @@ -78,4 +78,4 @@ namespace CalamityMod.Projectiles.Typeless GeneralParticleHandler.SpawnParticle(bloodsplosion2); } } -} +} \ No newline at end of file diff --git a/Projectiles/Typeless/CryonicShield.cs b/Projectiles/Typeless/CryonicShield.cs index e3e6320565..c07289dd98 100644 --- a/Projectiles/Typeless/CryonicShield.cs +++ b/Projectiles/Typeless/CryonicShield.cs @@ -57,36 +57,20 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - - if (!modPlayer.CryoStoneVanity) + if (!player.Calamity().CryoStoneVanity) { target.AddBuff(BuffID.Frostburn2, 180); target.AddBuff(ModContent.BuffType(), 30); - - if (target.knockBackResist <= 0f) - return; - - // 12AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); - Vector2 trueKnockback = target.Center - Projectile.Center; - trueKnockback.Normalize(); - target.velocity = trueKnockback * knockbackMultiplier; - } } } - + // CIT 2MAY2025: Replaced old manual knockback code with setting HitDirectionOverride + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { Player player = Main.player[Projectile.owner]; CalamityPlayer modPlayer = player.Calamity(); if (!modPlayer.CryoStoneVanity) - { target.AddBuff(BuffID.Frostburn2, 180); - target.AddBuff(ModContent.BuffType(), 30); - } } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.Size.Length() * 0.5f, targetHitbox); diff --git a/Projectiles/Typeless/DirectStrike.cs b/Projectiles/Typeless/DirectStrike.cs index 7cdb417153..e56d3cd89a 100644 --- a/Projectiles/Typeless/DirectStrike.cs +++ b/Projectiles/Typeless/DirectStrike.cs @@ -34,7 +34,7 @@ namespace CalamityMod.Projectiles.Typeless } // If the target is moving VERY fast, direct strikes spawned on top of them can actually miss - // Setting a target will gaurentee hits on said target by teleporting the projectile onto them every frame + // Setting a target will guarantee hits on said target by teleporting the projectile onto them every frame if (!invalidTarget) Projectile.Center = Main.npc[(int)Projectile.ai[0]].Center; } @@ -51,7 +51,7 @@ namespace CalamityMod.Projectiles.Typeless if (projHitbox.Intersects(targetHitbox)) { NPC target = Main.npc[(int)Projectile.ai[0]]; - if (pushVelocity != Vector2.Zero && !invalidTarget && target.CanBeMoved(hasStongDisplacement)) + if (pushVelocity != Vector2.Zero && pushVelocity.X < 255f && !invalidTarget && target.CanBeMoved(hasStongDisplacement)) { target.velocity = (pushVelocity * (target.knockBackResist == 0 ? 0.5f : 1)); } diff --git a/Projectiles/Typeless/FlameLickedBarrage.cs b/Projectiles/Typeless/FlameLickedBarrage.cs index f94d416372..0169f45ec6 100644 --- a/Projectiles/Typeless/FlameLickedBarrage.cs +++ b/Projectiles/Typeless/FlameLickedBarrage.cs @@ -57,7 +57,9 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 90); + //Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(15)); } public override void OnHitPlayer(Player target, Player.HurtInfo info) diff --git a/Projectiles/Typeless/FlameLickedHellblast.cs b/Projectiles/Typeless/FlameLickedHellblast.cs index 944ca206b1..3e2e579ae4 100644 --- a/Projectiles/Typeless/FlameLickedHellblast.cs +++ b/Projectiles/Typeless/FlameLickedHellblast.cs @@ -89,7 +89,9 @@ namespace CalamityMod.Projectiles.Typeless public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - target.AddBuff(ModContent.BuffType(), 90); + //Doze - I gave all parry accessories long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time, and the scarcity of using the parry + //Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds + target.AddBuff(ModContent.BuffType(), CalamityUtils.SecondsToFrames(15)); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Typeless/FlashBolt.cs b/Projectiles/Typeless/FlashBolt.cs index 3f86de4862..dedd6b3d94 100644 --- a/Projectiles/Typeless/FlashBolt.cs +++ b/Projectiles/Typeless/FlashBolt.cs @@ -1,5 +1,9 @@ -using CalamityMod.Particles; +using System; +using CalamityMod.Dusts; +using CalamityMod.Particles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -12,9 +16,16 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public int time = 0; - public float colorValue = 0; - public float sizeMult = 1; + public int dir = 0; + bool setAltPlace = false; + public Vector2 altPlace; + public Player Owner => Main.player[Projectile.owner]; public bool invalidTarget => (Projectile.ai[0] < 0f || Projectile.ai[0] > 199f); + public bool simplify => Projectile.ai[1] > 0f; + public override void SetStaticDefaults() + { + ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + } public override void SetDefaults() { Projectile.width = 60; @@ -24,22 +35,20 @@ namespace CalamityMod.Projectiles.Typeless Projectile.ignoreWater = true; Projectile.DamageType = AverageDamageClass.Instance; Projectile.penetrate = 1; // Survives through its first hit by "cheating" and incrementing its own pierce counter - Projectile.extraUpdates = 75; - Projectile.timeLeft = 200; + Projectile.extraUpdates = 0; + Projectile.timeLeft = 2; } - public override void AI() { - Player Owner = Main.player[Projectile.owner]; + // If the target is dead, remove them as a target and hit anything + NPC target = (invalidTarget ? null : Main.npc[(int)Projectile.ai[0]]); + if (target == null || !target.active || target.life <= 0) + Projectile.ai[0] = -1; + // Visibility/Sound toggle on acc visibility bool visible = Owner.Calamity().arcFlashRingVisual; - colorValue = MathHelper.Lerp(colorValue, 50, 0.025f); - Color usedColor = Color.Lerp(Color.Cyan, Color.Orchid, Utils.GetLerpValue(0, 50, colorValue)); - - if (time == 0) + if (time == 0 && Projectile.ai[0] != -1 && !simplify) { - colorValue += Main.rand.Next(0, 20); - sizeMult = 1; if (visible) { SoundStyle fire = new("CalamityMod/Sounds/Item/ArcFlash"); @@ -47,71 +56,91 @@ namespace CalamityMod.Projectiles.Typeless } } - // If the target is dead, remove them as a target and hit anything - NPC target = (invalidTarget ? null : Main.npc[(int)Projectile.ai[0]]); - if (target == null || !target.active || target.life <= 0) - Projectile.ai[0] = -1; - - float targetDist = Vector2.Distance(Owner.Center, Projectile.Center); - - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (targetDist < 1400f) - { - Vector2 pos = Projectile.Center - Projectile.velocity * 15; - if (Projectile.timeLeft % 4 == 0) - { - Particle spark2 = new BoltParticle(pos, -Projectile.velocity * 0.05f, false, 30, 0.6f * sizeMult, usedColor * (visible ? 1 : 0.25f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(spark2); - } - if (Main.rand.NextBool(35)) - { - Particle spark2 = new BoltParticle(pos, Projectile.velocity.RotatedByRandom(0.6f) * Main.rand.NextFloat(0.3f, 1.9f), false, 23, Main.rand.NextFloat(0.2f, 0.25f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1.8f, 0.8f), true, true, false, 0.3f); - GeneralParticleHandler.SpawnParticle(spark2); - } - if (Main.rand.NextBool(10) && visible) - { - Particle spark2 = new CustomSpark(pos, Projectile.velocity * Main.rand.NextFloat(-0.4f, 0.4f), "CalamityMod/Particles/DrainLineBloom", false, 80, Main.rand.NextFloat(1.2f, 1.3f) * sizeMult, usedColor * (visible ? 1 : 0.3f), new Vector2(1, 4), true, true); - GeneralParticleHandler.SpawnParticle(spark2); - } - if (time % 5 == 0 && visible) - { - Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(5, 5).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.45f, 0.6f)); - dust.noGravity = true; - dust.color = usedColor; - } - } - if (Projectile.numHits > 0) - { - sizeMult *= 0.97f; - } time++; } + public override bool PreDraw(ref Color lightColor) + { + if (!setAltPlace) + { + NPC target = (invalidTarget ? null : Main.npc[(int)Projectile.ai[0]]); + if (target == null || !target.active || target.life <= 0) + Projectile.ai[0] = -1; + if (target != null && Projectile.ai[0] != -1) + { + float size = (Math.Min(target.width, target.height) * 0.35f) + 10; + altPlace = Projectile.Center + Main.rand.NextVector2Circular(size, size); + } + setAltPlace = true; + } + + if (simplify || !Owner.Calamity().arcFlashRingVisual) + return false; + + Texture2D tex = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + + if (dir == 0) + dir = Main.rand.NextBool() ? -1 : 1; + + int distance = (int)(600 + (altPlace.Y - Owner.Center.Y)); + int travelAmount = 10; + Vector2 currentPos = altPlace; + Vector2 lastPos = currentPos; + bool zap = false; // Swapping the direction of the bolt + Color drawColor = Color.White; + float lifeLerp = (Projectile.numHits == 0 ? 1 : (float)Math.Pow(Utils.GetLerpValue(-5, 15, Projectile.timeLeft, true), 3)); + int angleSwapTimer = 0; + int angleSwapMax = 7; + for (int i = 0; i < distance; i += travelAmount) + { + float angleLerp = Math.Min(Utils.GetLerpValue(angleSwapMax, 0, angleSwapTimer, true), Utils.GetLerpValue(0, angleSwapMax, angleSwapTimer, true)); + float endLerp = Utils.GetLerpValue(0, distance, i, true); + drawColor = Color.Lerp(Color.Cyan, Color.Orchid, endLerp); + Main.EntitySpriteDraw(tex, currentPos - Main.screenPosition, null, drawColor with { A = 0 }, lastPos.DirectionTo(currentPos).ToRotation() + MathHelper.PiOver2, new Vector2(tex.Width / 2, tex.Height / 2), new Vector2((2.5f - 1.5f * angleLerp) * lifeLerp * Math.Max(endLerp, 0.25f), 1 + 2f * angleLerp) * 0.2f, SpriteEffects.None); + lastPos = currentPos; + currentPos -= new Vector2(travelAmount * 1.5f * endLerp * dir * (zap ? -1 : 1) * lifeLerp, travelAmount); + angleSwapTimer++; + if (angleSwapTimer >= angleSwapMax) { zap = !zap; angleSwapTimer = 0; } + } + return false; + } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - // Stops the projectile from deleting itself, while maintaining the masquerade - Projectile.penetrate++; - - //colorValue = Main.rand.Next(0, 10); target.AddBuff(BuffID.Electrified, 180); - Projectile.timeLeft = 25; - Player Owner = Main.player[Projectile.owner]; - if (Owner.Calamity().arcFlashRingVisual && Projectile.numHits == 0) + if (!simplify) { - Vector2 pos = target.Center; - for (int i = 0; i < 10; i++) + // Stops the projectile from deleting itself, while maintaining the masquerade + Projectile.penetrate++; + + Projectile.timeLeft = 15; + if (Projectile.numHits == 0) { - Particle spark2 = new BoltParticle(pos, new Vector2(8, 8).RotatedByRandom(100) * Main.rand.NextFloat(0.3f, 1.9f), true, 13, Main.rand.NextFloat(0.2f, 0.3f) * sizeMult, Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid, new Vector2(1.8f, 0.8f), true, true, false, 0.8f); - GeneralParticleHandler.SpawnParticle(spark2); - Dust dust = Dust.NewDustPerfect(pos, 278, new Vector2(14, 14).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(0.8f, 0.9f)); - dust.noGravity = false; - dust.color = Main.rand.NextBool(5) ? Color.Cyan : Color.Orchid; + if (!setAltPlace) + { + if (target != null && Projectile.ai[0] != -1) + { + float size = (Math.Min(target.width, target.height) * 0.35f) + 10; + altPlace = Projectile.Center + Main.rand.NextVector2Circular(size, size); + } + setAltPlace = true; + } + Vector2 pos = altPlace; + if (Owner.Calamity().arcFlashRingVisual) + { + for (int i = 0; i < 10; i++) + { + Dust dust = Dust.NewDustPerfect(pos, ModContent.DustType(), new Vector2(18, 18).RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 1f), 0, default, Main.rand.NextFloat(1.3f, 1.5f) * 3); + dust.noGravity = true; + dust.color = Main.rand.NextBool(3) ? Color.Cyan : Color.Orchid; + dust.fadeIn = 7.5f; + } + Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.68f, 0.5f, 14); + GeneralParticleHandler.SpawnParticle(orb); + Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White * 0.8f, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.225f, 0.2f, 14); + GeneralParticleHandler.SpawnParticle(orb2); + } + Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Cyan * (Owner.Calamity().arcFlashRingVisual ? 1 : 0.6f), "CalamityMod/Particles/BloomRing", new Vector2(1, 1), 0, 0.3f, 0.95f, 10); + GeneralParticleHandler.SpawnParticle(pulse2); } - Particle pulse2 = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/HighResFoggyCircleHardEdge", new Vector2(1, 1), 0, 0f, 0.0715f, 10); - GeneralParticleHandler.SpawnParticle(pulse2); - Particle orb = new CustomPulse(pos, Vector2.Zero, Color.Orchid, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.78f, 0.5f, 14); - GeneralParticleHandler.SpawnParticle(orb); - Particle orb2 = new CustomPulse(pos, Vector2.Zero, Color.White, "CalamityMod/Particles/LargeBloom", new Vector2(1, 1), Main.rand.NextFloat(-10, 10), 0.325f, 0.2f, 14); - GeneralParticleHandler.SpawnParticle(orb2); } } public override bool? CanHitNPC(NPC target) @@ -120,7 +149,7 @@ namespace CalamityMod.Projectiles.Typeless return null; return false; } - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.numHits > 0 ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 60 * sizeMult, targetHitbox); + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.numHits > 0 ? false : base.Colliding(projHitbox, targetHitbox); public override bool? CanCutTiles() => false; } } diff --git a/Projectiles/Typeless/FungalClumpMinion.cs b/Projectiles/Typeless/FungalClumpMinion.cs index 5094d26e31..977f810951 100644 --- a/Projectiles/Typeless/FungalClumpMinion.cs +++ b/Projectiles/Typeless/FungalClumpMinion.cs @@ -231,20 +231,7 @@ namespace CalamityMod.Projectiles.Typeless } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Main.player[Projectile.owner].moonLeech) - return; - - int heal = (int)Math.Round(damageDone * 0.25); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange, BalancingConstants.LifeStealAccessoryCooldownMultiplier); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), 1, 2f); public override bool OnTileCollide(Vector2 oldVelocity) => false; diff --git a/Projectiles/Typeless/GhostlyBolt.cs b/Projectiles/Typeless/GhostlyBolt.cs index ceb42cf336..cddc5fef7a 100644 --- a/Projectiles/Typeless/GhostlyBolt.cs +++ b/Projectiles/Typeless/GhostlyBolt.cs @@ -18,10 +18,8 @@ namespace CalamityMod.Projectiles.Typeless Projectile.friendly = true; Projectile.alpha = 255; Projectile.penetrate = 1; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 6; - Projectile.timeLeft = 900; + Projectile.MaxUpdates = 2; + Projectile.timeLeft = 180 * Projectile.MaxUpdates; Projectile.ignoreWater = true; Projectile.tileCollide = false; } diff --git a/Projectiles/Typeless/HydrothermalSmoke.cs b/Projectiles/Typeless/HydrothermalSmoke.cs index 7d0236bda1..1fda4b4a77 100644 --- a/Projectiles/Typeless/HydrothermalSmoke.cs +++ b/Projectiles/Typeless/HydrothermalSmoke.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +11,7 @@ namespace CalamityMod.Projectiles.Typeless public new string LocalizationCategory => "Projectiles.Typeless"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public override void SetDefaults() { Projectile.width = 20; @@ -23,21 +25,13 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { + if (Projectile.timeLeft == 6) Projectile.Center = Main.player[Projectile.owner].Center; - int randomDust = Main.rand.Next(4); - if (randomDust == 3) + if (Main.rand.NextBool(6)) { - randomDust = 16; - } - else - { - randomDust = 127; - } - if (Main.rand.NextBool(4)) - { - int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, randomDust, 0f, 0f, 100, default, 1f); + int fieryDust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Flare, 0f, 0f, 100, default, 0.7f); if (Main.rand.NextBool(4)) { Main.dust[fieryDust].scale *= 0.35f; @@ -45,11 +39,13 @@ namespace CalamityMod.Projectiles.Typeless Main.dust[fieryDust].velocity *= 0f; } - Vector2 goreVec = Projectile.position; - if (Main.rand.NextBool(8) && !Main.dedServ) + + if (Main.rand.NextBool(9) && !Main.dedServ) { - int smoke = Gore.NewGore(Projectile.GetSource_FromAI(), goreVec, default, Main.rand.Next(375, 378), 0.75f); - Main.gore[smoke].behindTiles = true; + float upwardVariation = Main.rand.NextFloat(-4.5f, -8f); + MediumMistParticle mist = new MediumMistParticle(Projectile.position, -Projectile.velocity + new Vector2(0.5f, upwardVariation), // This velocity makes it slowly float upward + Main.rand.NextBool(3) ? Color.LightSteelBlue : Color.SteelBlue, Color.LightSlateGray, Main.rand.NextFloat(0.4f, 0.65f), 130); + GeneralParticleHandler.SpawnParticle(mist); } } diff --git a/Projectiles/Typeless/JewelSpike.cs b/Projectiles/Typeless/JewelSpike.cs index a2de1dd804..aec3719911 100644 --- a/Projectiles/Typeless/JewelSpike.cs +++ b/Projectiles/Typeless/JewelSpike.cs @@ -55,7 +55,7 @@ namespace CalamityMod.Projectiles.Typeless { if (Projectile.owner == Main.myPlayer) { - for (int index = 0; index < 3; ++index) + for (int index = 0; index < 2; ++index) { float SpeedX = -Projectile.velocity.X * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); float SpeedY = -Projectile.velocity.Y * Main.rand.NextFloat(0.4f, 0.7f) + Main.rand.NextFloat(-8f, 8f); diff --git a/Projectiles/Typeless/MagnusBeam.cs b/Projectiles/Typeless/MagnusBeam.cs index 3cb564ae69..627f636a66 100644 --- a/Projectiles/Typeless/MagnusBeam.cs +++ b/Projectiles/Typeless/MagnusBeam.cs @@ -117,15 +117,7 @@ namespace CalamityMod.Projectiles.Typeless Player player = Main.player[Projectile.owner]; player.statMana += 25; player.ManaEffect(25); - - int heal = (int)Math.Round(hit.Damage * 0.1); - if (heal > BalancingConstants.LifeStealCap) - heal = BalancingConstants.LifeStealCap; - - if (Main.LocalPlayer.lifeSteal <= 0f || heal <= 0 || target.lifeMax <= 5) - return; - - CalamityGlobalProjectile.SpawnLifeStealProjectile(Projectile, Main.player[Projectile.owner], heal, ModContent.ProjectileType(), BalancingConstants.LifeStealRange); + Main.player[Projectile.owner].SpawnLifeStealProjectile(target, Projectile, ModContent.ProjectileType(), (int)Math.Round(hit.Damage * 0.1), 0.75f); } public override void OnKill(int timeLeft) diff --git a/Projectiles/Typeless/NanoFlare.cs b/Projectiles/Typeless/NanoFlare.cs index 7d3096428b..cbe942d302 100644 --- a/Projectiles/Typeless/NanoFlare.cs +++ b/Projectiles/Typeless/NanoFlare.cs @@ -24,14 +24,12 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - //Dust for (int i = 0; i < 3; i++) { - int dint = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, 0, default, 0.75f); - Dust dust = Main.dust[dint]; - dust.velocity = Projectile.velocity * Main.rand.NextFloat(-0.3f, 0.3f); - dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); - dust.color = Color.Lerp(dust.color, Color.White, 0.3f); + Dust dint = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, DustID.TerraBlade, 0f, 0f, Scale: 0.75f); + dint.velocity = Projectile.velocity * Main.rand.NextFloat(-0.3f, 0.3f); + dint.color = Main.hslToRgb(Main.rand.NextFloat(0.2f, 0.6f), 0.9f, 0.5f); + dint.color = Color.Lerp(dint.color, Color.White, 0.3f); } } @@ -40,25 +38,15 @@ namespace CalamityMod.Projectiles.Typeless for (int i = 0; i < 20; i++) { Vector2 dspeed = new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-6f, 6f)); - int dint = Dust.NewDust(Projectile.Center, 1, 1, DustID.TerraBlade, dspeed.X, dspeed.Y, 0, default, 0.7f); - Dust dust = Main.dust[dint]; - dust.color = Main.hslToRgb((float)(0.40000000596046448 + Main.rand.NextDouble() * 0.20000000298023224), 0.9f, 0.5f); + Dust dust = Dust.NewDustDirect(Projectile.Center, 1, 1, DustID.TerraBlade, dspeed.X, dspeed.Y, 0, default, 0.7f); + dust.color = Main.hslToRgb(Main.rand.NextFloat(0.2f, 0.6f), 0.9f, 0.5f); dust.color = Color.Lerp(dust.color, Color.White, 0.3f); } SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); - Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2); - Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2); - Projectile.width = 60; - Projectile.height = 60; - Projectile.maxPenetrate = -1; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 10; - Projectile.Damage(); if (!Main.dedServ) { - Vector2 goreVec = new Vector2(Projectile.position.X + (float)(Projectile.width / 2) - 24f, Projectile.position.Y + (float)(Projectile.height / 2) - 24f); + Vector2 goreVec = new Vector2(Projectile.Center.X - 24f, Projectile.Center.Y - 24f); float smokeScale = 0.66f; for (int i = 0; i < 2; i++) { diff --git a/Projectiles/Typeless/NavyBobber.cs b/Projectiles/Typeless/NavyBobber.cs index 7d45038fbc..cf8952aa1a 100644 --- a/Projectiles/Typeless/NavyBobber.cs +++ b/Projectiles/Typeless/NavyBobber.cs @@ -1,4 +1,6 @@ -using Terraria; +using CalamityMod.Buffs.DamageOverTime; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Typeless @@ -14,6 +16,23 @@ namespace CalamityMod.Projectiles.Typeless Projectile.bobber = true; } + public override void PostAI() + { + foreach (var item in Main.ActiveNPCs) + { + if (!item.friendly && item.Distance(Projectile.Center) < 160) + { + item.AddBuff(ModContent.BuffType(), 180); + if (Main.rand.NextBool(10)) + { + Vector2 velocity = CalamityUtils.RandomVelocity(50f, 30f, 60f); + Projectile spark = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), item.Center, velocity, ModContent.ProjectileType(), 0, 0f, Projectile.owner); + spark.localNPCHitCooldown = -2; + spark.timeLeft = 30; + } + } + } + } public override bool PreDrawExtras() { Lighting.AddLight(Projectile.Center, 0f, 0.25f, 0.25f); diff --git a/Projectiles/Typeless/OmegaBlueTentacle.cs b/Projectiles/Typeless/OmegaBlueTentacle.cs index 6a575b5809..2d922d6811 100644 --- a/Projectiles/Typeless/OmegaBlueTentacle.cs +++ b/Projectiles/Typeless/OmegaBlueTentacle.cs @@ -175,24 +175,7 @@ namespace CalamityMod.Projectiles.Typeless modifiers.SetCrit(); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Projectile.owner == Main.myPlayer && Owner.lifeSteal > 0f && !Owner.moonLeech && target.lifeMax > 5) - { - int healAmount = 10 * damageDone / Projectile.damage; //should always be around max, less if enemy has defense/DR - if (healAmount > BalancingConstants.LifeStealCap) - healAmount = BalancingConstants.LifeStealCap; - - if (healAmount > 0) - { - Owner.lifeSteal -= healAmount; - if (Owner.Calamity().omegaBlueAbyssalMadness) // Always crits during Abyssal Madness, this makes it have same lifesteal delay - Owner.lifeSteal += healAmount / 2; - - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ProjectileID.SpiritHeal, 0, 0f, Projectile.owner, Projectile.owner, healAmount); - } - } - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => Owner.DoLifestealDirect(target, 10 * hit.Damage / Projectile.damage, 0.5f); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Typeless/PauldronDash.cs b/Projectiles/Typeless/PauldronDash.cs index efc5b8021d..c9e6c42619 100644 --- a/Projectiles/Typeless/PauldronDash.cs +++ b/Projectiles/Typeless/PauldronDash.cs @@ -80,7 +80,9 @@ namespace CalamityMod.Projectiles.Typeless if (visuals) { int dir = MathF.Sign(aimVel.X); - Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX); + if (dir == 0) + dir = Owner.direction; + Vector2 safeVel = aimVel.SafeNormalize(Vector2.UnitX * dir); float sparkscale2 = 0.35f * Math.Max(fxFade, 0.5f); for (int i = -1; i <= 1; i += 2) { @@ -100,7 +102,7 @@ namespace CalamityMod.Projectiles.Typeless } } - if (Owner.dead || (!isAlive && fxFade < 0.1f) || Owner.velocity == Vector2.Zero) + if (Owner.dead || (!isAlive && fxFade < 0.1f) || (Owner.velocity == Vector2.Zero && Owner.dashDelay != -1)) Projectile.Kill(); } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) diff --git a/Projectiles/Typeless/PinkPearl.png b/Projectiles/Typeless/PinkPearl.png new file mode 100644 index 0000000000..2689197f96 Binary files /dev/null and b/Projectiles/Typeless/PinkPearl.png differ diff --git a/Projectiles/Typeless/ProtolithBangleProjectile.cs b/Projectiles/Typeless/ProtolithBangleProjectile.cs index ca833e6d43..10fa2d402d 100644 --- a/Projectiles/Typeless/ProtolithBangleProjectile.cs +++ b/Projectiles/Typeless/ProtolithBangleProjectile.cs @@ -115,17 +115,6 @@ namespace CalamityMod.Projectiles.Typeless float launchPower = 6; target.MoveNPC(launchVel, launchPower, true); } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - bool hasCD = Owner.Calamity().cooldowns.TryGetValue(GenericBandCooldown.ID, out CooldownInstance bandCD); - - if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Owner.Calamity().generalBandCooldown > ProtolithBangle.cooldown / 2) - { - Owner.Calamity().generalBandCooldown -= ProtolithBangle.cooldown / 2; - if (hasCD) - bandCD.timeLeft -= ProtolithBangle.cooldown / 2; - } - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width * 0.5f * Projectile.scale, targetHitbox); public override bool? CanDamage() { diff --git a/Projectiles/Typeless/ReaverOrb.cs b/Projectiles/Typeless/ReaverOrb.cs deleted file mode 100644 index e2557bb25b..0000000000 --- a/Projectiles/Typeless/ReaverOrb.cs +++ /dev/null @@ -1,79 +0,0 @@ -using CalamityMod.CalPlayer; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class ReaverOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public int dust = 3; - - public override void SetDefaults() - { - Projectile.width = 48; - Projectile.height = 50; - Projectile.netImportant = true; - Projectile.friendly = true; - Projectile.ignoreWater = true; - Projectile.timeLeft = 18000; - Projectile.alpha = 50; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.timeLeft *= 5; - } - - public override void AI() - { - bool correctMinion = Projectile.type == ModContent.ProjectileType(); - Player player = Main.player[Projectile.owner]; - CalamityPlayer modPlayer = player.Calamity(); - if (!modPlayer.reaverExplore) - { - Projectile.active = false; - return; - } - if (correctMinion) - { - if (player.dead) - { - modPlayer.rOrb = false; - } - if (modPlayer.rOrb) - { - Projectile.timeLeft = 2; - } - } - dust--; - if (dust >= 0) - { - int dustAmt = 50; - for (int d = 0; d < dustAmt; d++) - { - int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.ChlorophyteWeapon, 0f, 0f, 0, default, 1f); - Main.dust[idx].velocity *= 2f; - Main.dust[idx].scale *= 1.15f; - } - } - - Lighting.AddLight(Projectile.Center, 0.5f, 2f, 0.5f); - - Projectile.Center = player.Center + Vector2.UnitY * (player.gfxOffY - 60f); - if (player.gravDir == -1f) - { - Projectile.position.Y += 120f; - Projectile.rotation = MathHelper.Pi; - } - else - { - Projectile.rotation = 0f; - } - Projectile.position.X = (int)Projectile.position.X; - Projectile.position.Y = (int)Projectile.position.Y; - } - - public override bool? CanDamage() => false; - } -} diff --git a/Projectiles/Typeless/ReaverOrb.png b/Projectiles/Typeless/ReaverOrb.png deleted file mode 100644 index 4832434cb8..0000000000 Binary files a/Projectiles/Typeless/ReaverOrb.png and /dev/null differ diff --git a/Projectiles/Typeless/RiftReelerBobber.cs b/Projectiles/Typeless/RiftReelerBobber.cs index f5b3defd39..45bd54bfb3 100644 --- a/Projectiles/Typeless/RiftReelerBobber.cs +++ b/Projectiles/Typeless/RiftReelerBobber.cs @@ -13,6 +13,11 @@ namespace CalamityMod.Projectiles.Typeless Projectile.height = 14; Projectile.aiStyle = ProjAIStyleID.Bobber; Projectile.bobber = true; + Projectile.friendly = true; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + Projectile.penetrate = -1; + Projectile.ArmorPenetration = 100; } public override bool PreDrawExtras() diff --git a/Projectiles/Typeless/SandBall.cs b/Projectiles/Typeless/SandBall.cs index 6a43186f50..4e9072fa7d 100644 --- a/Projectiles/Typeless/SandBall.cs +++ b/Projectiles/Typeless/SandBall.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Astral; using CalamityMod.Items.Placeables.SunkenSea; @@ -21,12 +22,121 @@ namespace CalamityMod.Projectiles.Typeless public override int DustType => 108; } + public class EutrophicSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallEutrophic"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Titanium; + } + + public class DunesandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Hive; + } + + public class PolypSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallPolyp"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Ice_Red; + } + + public class VolcanicSandBallFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallVolcanic"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.t_PearlWood; + } + + public class WhitePearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/WhitePearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Slush; + } + + public class PinkPearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/PinkPearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Ice_Pink; + } + + public class BlackPearlFalling : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/BlackPearl"; + public override bool Fired => false; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Lead; + } + public class AstralSandBallGun : SandBall { public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallAstral"; public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); public override int DustType => 108; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only one target but splits on impact into seeking mini sands + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + Projectile.localNPCHitCooldown = 10; + Projectile.usesLocalNPCImmunity = true; + Projectile.usesIDStaticNPCImmunity = false; + } + public override bool PreAI() + { + if (Projectile.ai[2] == 1) + { + Projectile.scale = 0.75f; + if (Projectile.ai[1] == 0) + { + Projectile.originalDamage = Projectile.damage; + Projectile.damage = 0; + } + if (Projectile.ai[1] == 30) + { + Projectile.Calamity().conditionalHomingRange = 600; + Projectile.damage = Projectile.originalDamage; + } + } + return base.PreAI(); + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (Projectile.ai[2] != 1) + { + for (var i = 0; i < 4; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.75f) * Main.rand.NextFloat(0.5f,0.75f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1); + } + } + + public override bool PreKill(int timeLeft) + { + if (Projectile.penetrate == 0) + Projectile.active = false; + return Projectile.active; + } + } public class EutrophicSandBallGun : SandBall @@ -35,6 +145,19 @@ namespace CalamityMod.Projectiles.Typeless public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); public override int DustType => 108; // Weirdly same dusts as Astral + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only one target and does 5 less damage, but inflicts a relatively long stun debuff + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 300); + } } public class SulphurousSandBallGun : SandBall @@ -43,6 +166,128 @@ namespace CalamityMod.Projectiles.Typeless public override int TileType => ModContent.TileType(); public override int ItemType => ModContent.ItemType(); // Uses normal sand dust + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one hits only two targets but inflicts Irradiated + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 2; + } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + target.AddBuff(ModContent.BuffType(), 150); + } + } + public class DuneSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallDune"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Sand; + + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one has much less velocity and no gravity for the first 3 seconds, pierces infinitely, and does 5 extra damage + public override void AI() + { + if (Projectile.ai[1] == 0 ) + { + Projectile.velocity *= 0.5f; + } + if (Main.rand.NextBool()) + { + int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType); + Main.dust[i].velocity.X *= 0.4f; + Main.dust[i].velocity.Y += Fired ? 0f : Projectile.velocity.Y * 0.5f; + } + + Projectile.ai[1]++; + Projectile.rotation += 0.1f; + if (Projectile.ai[1] >= 180f) + { + Projectile.ai[1] = 180f; + Projectile.velocity.Y += 0.2f; + } + if (Projectile.velocity.Y > 10f) + Projectile.velocity.Y = 10f; + + Point p = Projectile.Center.ToTileCoordinates(); + // Don't check out of bounds + if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) + return; + Tile placer = Main.tile[p.X, p.Y + 1]; + if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f) + Projectile.Kill(); + + } + } + public class PolypSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallPolyp"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => DustID.Sand; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one has a small homing range and can go through platforms + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = true; + return true; + } + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.penetrate = 1; + Projectile.Calamity().conditionalHomingRange = 160; + } + } + public class VolcanicSandBallGun : SandBall + { + public override string Texture => "CalamityMod/Projectiles/Typeless/SandBallVolcanic"; + public override int TileType => ModContent.TileType(); + public override int ItemType => ModContent.ItemType(); + public override int DustType => -1; + + //Doze: I'm giving our sandgun sands actual special effects because it's more interesting + //This one fires a shotgun of mini sands, but every sand deals less damage + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.localNPCHitCooldown = -1; + Projectile.usesLocalNPCImmunity = true; + Projectile.usesIDStaticNPCImmunity = false; + } + public override bool PreAI() + { + if (Projectile.ai[2] == 1) + { + if (Projectile.ai[1] == 0) + { + Projectile.scale = 0.75f; + Projectile.penetrate = 1; + Projectile.timeLeft = 30; + } + } else + { + if (Projectile.ai[1] == 0) + { + for (var i = 0; i < 5; i++) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedByRandom(0.5f) * 0.75f, ModContent.ProjectileType(), (int)(Projectile.damage * 0.5f), Projectile.knockBack, Projectile.owner, ai2: 1); + Projectile.damage = (int)(Projectile.damage * 0.5f); + + } + } + return base.PreAI(); + } + public override bool PreKill(int timeLeft) + { + if (Projectile.ai[2] == 1) //Baby sands should always vanish without placing blocks + Projectile.active = false; + return Projectile.active; + } } // All the setups go here to prevent mass blocks of copypasting @@ -80,7 +325,7 @@ namespace CalamityMod.Projectiles.Typeless // Using clones will not allow for custom dust types sadly public override void AI() { - if (Main.rand.NextBool()) + if (Main.rand.NextBool() && DustType >= 0) { int i = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustType); Main.dust[i].velocity.X *= 0.4f; @@ -96,21 +341,19 @@ namespace CalamityMod.Projectiles.Typeless } if (Projectile.velocity.Y > 10f) Projectile.velocity.Y = 10f; + } - Point p = Projectile.Center.ToTileCoordinates(); - // Don't check out of bounds - if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) - return; - Tile placer = Main.tile[p.X, p.Y + 1]; - if (placer.HasTile && TileID.Sets.Platforms[placer.TileType] && Projectile.ai[1] >= 60f) - Projectile.Kill(); + public override bool TileCollideStyle(ref int width, ref int height, ref bool fallThrough, ref Vector2 hitboxCenterFrac) + { + fallThrough = false; + return base.TileCollideStyle(ref width, ref height, ref fallThrough, ref hitboxCenterFrac); } public override void OnKill(int timeLeft) { Point p = Projectile.Center.ToTileCoordinates(); - // If the sand is dying outside the world border, cancel placing sand. - if (p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) + // If the sand is dying outside the world border, or having used all of it's pierce, cancel placing sand. + if ( p.X < 0 || p.X >= Main.maxTilesX || p.Y < 0 || p.Y >= Main.maxTilesY) return; Tile placer = Main.tile[p.X, p.Y]; diff --git a/Projectiles/Typeless/SandBallDune.png b/Projectiles/Typeless/SandBallDune.png new file mode 100644 index 0000000000..15c62d95a8 Binary files /dev/null and b/Projectiles/Typeless/SandBallDune.png differ diff --git a/Projectiles/Typeless/SandBallPolyp.png b/Projectiles/Typeless/SandBallPolyp.png new file mode 100644 index 0000000000..531e9d5fc8 Binary files /dev/null and b/Projectiles/Typeless/SandBallPolyp.png differ diff --git a/Projectiles/Typeless/SandBallVolcanic.png b/Projectiles/Typeless/SandBallVolcanic.png new file mode 100644 index 0000000000..8b5fa1bb6d Binary files /dev/null and b/Projectiles/Typeless/SandBallVolcanic.png differ diff --git a/Projectiles/Typeless/SandCloakVeil.cs b/Projectiles/Typeless/SandCloakVeil.cs index f31fb59353..53efb8d979 100644 --- a/Projectiles/Typeless/SandCloakVeil.cs +++ b/Projectiles/Typeless/SandCloakVeil.cs @@ -39,7 +39,7 @@ namespace CalamityMod.Projectiles.Typeless if (posDiff.Length() <= Radius) { BuffedPlayer.Calamity().getSandCloakAccelBoost = true; - BuffedPlayer.statDefense += 10; + BuffedPlayer.statDefense += SandCloak.SandVeilDefenseBoost; } else BuffedPlayer.Calamity().getSandCloakAccelBoost = false; diff --git a/Projectiles/Typeless/ScionsCurioMini.cs b/Projectiles/Typeless/ScionsCurioMini.cs new file mode 100644 index 0000000000..84f0569b10 --- /dev/null +++ b/Projectiles/Typeless/ScionsCurioMini.cs @@ -0,0 +1,258 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Items.Accessories; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class ScionsCurioMini : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public Player Owner => Main.player[Projectile.owner]; + public Color usedColor = Color.Chartreuse; + public ref float time => ref Projectile.ai[0]; + public ref float attackTimer => ref Projectile.ai[1]; + public ref float idleTimer => ref Projectile.localAI[0]; + + public float fxFade = 0; // The glow visuals multiplier + public float followSpeed = 12; // The speed it follows you, lower is faster + public float lerpDir = 0; + public float facing = 0; + public Vector2 savedPos; + public bool sharingSwineSecrets => idleTimer >= idleMax; + public int swineSecretTimer = 0; + public int swineText = 1; + public float actionSpeed = 1; + public int chosenSecret = 0; + public int idleMax = 18000; // 5 minutes + Vector2 goalPosition; + public List listNumbers = new List(); + public override void SetDefaults() + { + Projectile.width = 32; + Projectile.height = 38; + Projectile.ignoreWater = true; + Projectile.timeLeft = 300; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + if (Main.zenithWorld) idleMax = 301; + float rate = Main.GlobalTimeWrappedHourly * 5; + List eColors = new List() + { + Color.Chartreuse, + Color.LimeGreen + }; + + int colorIndex = (int)(rate / 2 % eColors.Count); + Color currentColor = eColors[colorIndex]; + Color nextColor = eColors[(colorIndex + 1) % eColors.Count]; + usedColor = Color.Lerp(Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f), Color.White, 0.7f); + + float sine = (float)Math.Sin(time * 0.1f * actionSpeed / MathHelper.Pi); + float sine2 = (float)Math.Sin(time * 0.15f * actionSpeed / MathHelper.Pi); + + Vector2 baseDestination = Owner.Center - Vector2.UnitY * (20 + 5 * sine2) - Vector2.UnitX * 30 * lerpDir; + + if (Owner.Calamity().scionsCurioGotHit) + { + if (attackTimer == 0) + savedPos = baseDestination; + if (attackTimer == 30) + { + float blastScale = 1.6f; + for (int g = 0; g < 17; g++) + { + int DustID = ModContent.DustType(); + Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID); + dust.scale = Main.rand.NextFloat(1.1f, 1.35f) * blastScale; + dust.velocity = new Vector2(9, 9).RotatedByRandom(100) * blastScale * Main.rand.NextFloat(0.4f, 0.9f) + Vector2.UnitY * -10; + dust.noGravity = false; + dust.color = Main.rand.NextBool() ? Color.Green : Color.Chartreuse; + dust.fadeIn = Main.rand.NextFloat(0.2f, 2f); + } + Particle blastvfx = new CustomPulse(Projectile.Center, Vector2.Zero, Color.Chartreuse * 0.9f, "CalamityMod/Particles/ShineExplosion1", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f * blastScale, 0.15f * blastScale, 10, true); + GeneralParticleHandler.SpawnParticle(blastvfx); + SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode with { Volume = 0.5f * blastScale, Pitch = Main.rand.NextFloat(0.5f, 0.7f), MaxInstances = 6 }, Projectile.Center); + + // Create Blast + float blastSize = 115 * blastScale; + float minMultiplier = 0.5f; + int hitsToMinMult = 5; + int debuff = ModContent.BuffType(); + int debuffTime = 300; + Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), ScionsCurio.postHitDamage, 7, (Owner != null ? Owner.whoAmI : -1), blastSize, minMultiplier, hitsToMinMult); + blast.localAI[0] = debuff; + blast.localAI[1] = debuffTime; + blast.timeLeft = 15; + blast.DamageType = DamageClass.Ranged; + attackTimer = -1; + Owner.Calamity().scionsCurioGotHit = false; + } + baseDestination = savedPos + new Vector2(4, 4).RotatedBy(sine2 * 0.02f); + attackTimer++; + } + + facing = Math.Sign(Projectile.Center.X == Owner.Center.X ? Owner.direction : Projectile.Center.DirectionTo(Owner.Center).X); + + Vector2 speakingDestination = Owner.Center - Vector2.UnitY * (10 + 3 * sine2) + Vector2.UnitX * 45 * lerpDir; + if (time == 0) + goalPosition = baseDestination; + goalPosition = Vector2.Lerp(goalPosition, swineSecretTimer > 0 ? speakingDestination : baseDestination, 0.08f); + lerpDir = MathHelper.Lerp(Owner.direction, facing, 0.04f); + + Projectile.velocity = (goalPosition - Projectile.Center) / (followSpeed * (swineSecretTimer > 0 ? 0.5f : 1)); + + Projectile.rotation = 0.2f * sine; + + if (Owner.Calamity().scionsCurioVisuals) + Lighting.AddLight(Projectile.Center, usedColor.ToVector3() * 0.3f); + + // Swine Secrets + int textSpeed = 5; + if (swineSecretTimer > 0) + { + if (swineSecretTimer % textSpeed == 0 && swineSecretTimer > 30) + { + int originalLength = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())).Length + 1; + string text = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())); + int charstoRemove = (text.Length - (int)swineText); + if (charstoRemove > -1) + { + text = text.Remove(swineText, charstoRemove); + if (swineSecretTimer >= 2) + text = text.Remove(0, swineText - 1); + } + if (swineText <= originalLength) + swineText++; + float textSpacing = Utils.Remap(originalLength, 5, 190, 20, 9, true); + Vector2 position = Owner.Center - (Vector2.UnitX * originalLength * (textSpacing / 2)) + (Vector2.UnitX * originalLength * textSpacing / originalLength * swineText); + CombatText.NewText(new Rectangle((int)position.X, (int)position.Y, 1, 1), usedColor, text, false, false); + } + if (swineSecretTimer % 6 == 0 && swineSecretTimer > 30) + { + SoundStyle snort = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(snort with { Volume = 0.6f, Pitch = Main.rand.NextFloat(-0.35f, 0.55f) }, Projectile.Center); + actionSpeed = Main.rand.NextFloat(0.5f, 1.5f); + } + swineSecretTimer--; + fxFade = MathHelper.Lerp(fxFade, 1, 0.08f); + if (swineSecretTimer == 0) + time = 120; + } + else + { + swineText = 1; + fxFade = MathHelper.Lerp(fxFade, 0, 0.08f); + } + + if (idleTimer % 90 == 0 && swineSecretTimer == 0 && idleTimer > idleMax - 300) + { + CombatText.NewText(Projectile.Hitbox, usedColor, CalamityUtils.GetTextValue("Misc.SwineSecret0"), false, true); + actionSpeed = 1.1f; + SoundStyle snort = new("CalamityMod/Sounds/Item/Swine", 2); + SoundEngine.PlaySound(snort with { Volume = 0.6f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); + } + + + actionSpeed = MathHelper.Lerp(actionSpeed, 1, 0.08f); + if (Owner.Calamity().scionsCurio) + Projectile.timeLeft++; + else + Projectile.Kill(); + if (Owner.dead) + Projectile.Kill(); + + time++; + if (sharingSwineSecrets && swineSecretTimer == 0) + { + int number = 0; + for (int i = 0; i < 1; i++) + { + int attemptNumber = Main.rand.Next(1, 40 + 1); + if (listNumbers.Contains(attemptNumber)) + { + if (listNumbers.Count >= 40) // Once all options have been exhausted, reset + { + listNumbers.Clear(); + listNumbers.Add(attemptNumber); + number = attemptNumber; + } + else + i--; + } + else + { + listNumbers.Add(attemptNumber); + number = attemptNumber; + } + } + chosenSecret = number; + int originalLength = CalamityUtils.GetTextValue(("Misc.SwineSecret" + chosenSecret.ToString())).Length; + swineSecretTimer = originalLength * textSpeed + 30; + idleTimer = idleMax - 300 - swineSecretTimer; + } + if (Owner.velocity.Length() < 2 && Owner.Calamity().scionsCurioVisuals) + idleTimer++; + else + { + idleTimer = 0; + } + } + public override bool PreDraw(ref Color lightColor) + { + Asset tex = ModContent.Request(Texture); + Texture2D bTexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Texture2D cTexture = ModContent.Request("CalamityMod/Particles/HalfStar").Value; + Color drawColor = usedColor * Utils.GetLerpValue(0, 100, time, true); + Color bodyColor = lightColor; + float drawMult = 1; + float attackFade = (float)Math.Pow(1 + (float)Math.Pow(Utils.GetLerpValue(0, 30, attackTimer, true), 4), 3); + + Vector2 shake = Main.rand.NextVector2Circular((attackFade - 1) * 5, (attackFade - 1) * 5); + + for (int i = 0; i < 18; i++) // Backglow + { + Vector2 drawOffset = (MathHelper.TwoPi * i / 18f).ToRotationVector2() * 2 * drawMult * attackFade; + if (attackFade > 1 || Owner.Calamity().scionsCurioVisuals) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + shake, null, Color.Lerp(drawColor, Color.Chartreuse, attackFade - 1) with { A = 0 } * 0.2f * drawMult, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, facing == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + + // Main body + if (Owner.Calamity().scionsCurioVisuals) + Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + shake, null, Color.Lerp(bodyColor, Color.Chartreuse with { A = 0 }, attackFade - 1), Projectile.rotation, tex.Size() * 0.5f, new Vector2(1f, 1f) * Projectile.scale, facing == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + // Eye Shine + for (int j = -1; j <= 1; j += 2) + { + for (int i = -4; i <= 4; i++) + { + Vector2 pos = (Vector2.UnitX * 3 * facing + Vector2.UnitY * -2).RotatedBy(Projectile.rotation); + float scale = 1; + if (i == 0) i++; + if (i > 0) + { + scale = 0.9f; + pos = (Vector2.UnitX * 10 * facing + Vector2.UnitY * -2).RotatedBy(Projectile.rotation); + } + Main.EntitySpriteDraw(cTexture, Projectile.Center - Main.screenPosition + pos + shake, null, Color.Lerp(Color.Red, Color.White, Math.Abs(i) * 0.05f) with { A = 0 } * 0.7f * fxFade, Projectile.rotation + (j == -1 ? MathHelper.PiOver2 : 0), cTexture.Size() * 0.5f, new Vector2(2f - 0.1f * Math.Abs(i), 1f + 0.4f * Math.Abs(i)) * Projectile.scale * 0.35f * scale * Main.rand.NextFloat(0.65f, 1.25f), SpriteEffects.None); + } + } + return false; + } + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Typeless/ScionsCurioMini.png b/Projectiles/Typeless/ScionsCurioMini.png new file mode 100644 index 0000000000..cd143eae5a Binary files /dev/null and b/Projectiles/Typeless/ScionsCurioMini.png differ diff --git a/Projectiles/Typeless/TeslaAura.cs b/Projectiles/Typeless/TeslaAura.cs index 9984be55a6..2215e6826c 100644 --- a/Projectiles/Typeless/TeslaAura.cs +++ b/Projectiles/Typeless/TeslaAura.cs @@ -67,19 +67,9 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(ModContent.BuffType(), 90); target.AddBuff(ModContent.BuffType(), 6); - - if (target.knockBackResist <= 0f) - return; - - // 07AUG2023: Ozzatron: TML was giving NaN knockback, probably due to 0 base knockback. Do not use hit.Knockback - if (CalamityGlobalNPC.ShouldAffectNPC(target)) - { - float knockbackMultiplier = MathHelper.Clamp(1f - target.knockBackResist, 0f, 1f); - Vector2 trueKnockback = target.Center - Projectile.Center; - trueKnockback.Normalize(); - target.velocity = trueKnockback * knockbackMultiplier; - } } + // CIT 2MAY2025: Replaced old manual knockback code with setting HitDirectionOverride + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) => modifiers.HitDirectionOverride = (target.Center.X > Projectile.Center.X).ToDirectionInt(); public override void OnHitPlayer(Player target, Player.HurtInfo info) { diff --git a/Projectiles/Typeless/VictideBarrier.cs b/Projectiles/Typeless/VictideBarrier.cs new file mode 100644 index 0000000000..7ee97c9e22 --- /dev/null +++ b/Projectiles/Typeless/VictideBarrier.cs @@ -0,0 +1,242 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Cooldowns; +using CalamityMod.Items.Armor.Victide; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.GameContent; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VictideBarrier : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Custom/BubblyBurst"); + + public static float ExplosionLifetime = 24f; + public static float MaxScale = 6f; + + public static float DashSpeed = 24f; // 24 tiles + public static float DashLifetime = 16f; + public static int DashSlamIFrames = 12; + private List NPCsHitBySlam = new List() { -1 }; + + public ref float ExplodeTimer => ref Projectile.ai[0]; + public ref float DashTimer => ref Projectile.ai[1]; + public ref float HealTimer => ref Projectile.ai[2]; + public Player Owner => Main.player[Projectile.owner]; + + public static Asset Shine; + public static Asset Explosion; + public override void Load() + { + Shine = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + Explosion = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion"); + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = (int)ExplosionLifetime; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void AI() + { + Projectile.rotation = MathHelper.ToRadians(Main.GlobalTimeWrappedHourly * 36f); + + if (ExplodeTimer > 0f) + { + float scaleLevel = PiecewiseAnimation(ExplodeTimer / ExplosionLifetime, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) }); + Projectile.scale = MathHelper.Lerp(1f, MaxScale, scaleLevel); + Projectile.Opacity = MathF.Sin(MathHelper.PiOver2 + MathHelper.PiOver2 * ExplodeTimer / ExplosionLifetime); + + if (ExplodeTimer == 1f) + { + SoundEngine.PlaySound(ExplosionSound, Projectile.Center); + + for (int i = 0; i < 5; i++) + { + Vector2 velocity = (MathHelper.TwoPi * i / 5f).ToRotationVector2() * Main.rand.NextFloat(10f, 12f) * (i % 2 == 0 ? 0.88f : 1f); + Particle bub = new VelChangingSpark(Projectile.Center, velocity.RotatedByRandom(MathHelper.Pi / 10f), Vector2.UnitY * -6f, "CalamityMod/Particles/BloomRing", Main.rand.Next(36, 42 + 1), Main.rand.NextFloat(0.1f, 0.25f), Main.rand.NextBool(3) ? Color.HotPink : Color.Turquoise, Vector2.One, shrinkSpeed: 0.08f); + GeneralParticleHandler.SpawnParticle(bub); + } + } + + if (ExplodeTimer == 6f) + { + for (int i = 0; i < 8; i++) + { + Vector2 smokeVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(2.5f, 5.5f); + float smokeScale = Main.rand.NextFloat(1.6f, 2f); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeVelocity, Color.PaleTurquoise, 18, smokeScale, 0.25f, Main.rand.NextFloat(-0.1f, 0.1f), true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } + + ExplodeTimer++; + } + else if (DashTimer > 0f) + { + Owner.mount?.Dismount(Owner); + Owner.RemoveAllGrapplingHooks(); + + Owner.velocity = Projectile.velocity; + Owner.ChangeDir(Math.Sign(Projectile.velocity.X) <= 0 ? -1 : 1); + + // Move the player to the projectile, allowing them to bypass platforms (but not tiles) + Owner.Center = Projectile.Center; + + // Custom ram effect, similar to the one used in CalamityPlayerDashEffects + Rectangle hitArea = new Rectangle((int)(Owner.position.X + Owner.velocity.X * 0.5 - 4f), (int)(Owner.position.Y + Owner.velocity.Y * 0.5 - 4), Owner.width + 8, Owner.height + 8); + foreach (NPC n in Main.ActiveNPCs) + { + // Ignore critters with the Guide to Critter Companionship + if (Owner.dontHurtCritters && NPCID.Sets.CountsAsCritter[n.type]) + continue; + + if (!n.dontTakeDamage && !n.friendly && !NPCsHitBySlam.Contains(n.whoAmI)) + { + if (hitArea.Intersects(n.getRect()) && (n.noTileCollide || Owner.CanHit(n))) + { + Projectile.NewProjectile(Owner.GetSource_FromThis(), n.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 0f, Owner.whoAmI, n.whoAmI); + Owner.GiveImmuneTimeForCollisionAttack(DashSlamIFrames); + NPCsHitBySlam.Add(n.whoAmI); + } + } + } + + // Dash trail effects + Color trailColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, DashTimer / DashLifetime); + if (DashTimer % 2f == 1f) + { + Particle trail = new CustomSpark(Projectile.Center - Projectile.velocity * 2f, Projectile.velocity * 0.5f, "CalamityMod/Particles/ForwardSmear", false, 12, 0.2f, trailColor, new Vector2(1f, Main.rand.NextFloat(1.2f, 1.35f)), fadeIn: true, extraRotation: MathHelper.ToRadians(180f)); + GeneralParticleHandler.SpawnParticle(trail); + } + for (int direction = -1; direction <= 1; direction += 2) + { + Vector2 sidePos = Projectile.Center - Projectile.velocity * 2f + Projectile.velocity.SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2 * direction) * Utils.Remap(DashTimer, 1f, DashLifetime, 48f, 24f); + Particle sideTrail = new CustomSpark(sidePos, Projectile.velocity * 0.5f, "CalamityMod/Particles/BloomCircle", false, 18, 0.3f, trailColor * 0.6f, new Vector2(1f, 2.5f), shrinkSpeed: 0.2f); + GeneralParticleHandler.SpawnParticle(sideTrail); + } + + DashTimer++; + } + else + { + // If the barrier set isn't on, unceremoniously disappear + if (!Owner.Calamity().victideBarrierSet || Owner.dead || !Owner.active) + { + Projectile.Kill(); + Owner.Calamity().victideBarrierHeal = 0; + return; + } + // Set to dash if cooldown is detected and also create an explosion in its place + if (Owner.HasCooldown(WardingWave.ID)) + { + DashTimer++; + Projectile.damage = (int)Owner.GetBestClassDamage().ApplyTo(VictideHeadBarrier.BarrierDamage); + Owner.Calamity().victideBarrierHeal = 0; + if (Projectile.owner == Main.myPlayer) + { + // Set dash velocity + Projectile.velocity = Owner.SafeDirectionTo(Main.MouseWorld) * DashSpeed; + Projectile.tileCollide = true; + + // Spawn explosion + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.MountedCenter, Vector2.Zero, Type, Projectile.damage, VictideHeadBarrier.BarrierExplosionKB, Projectile.owner, 1f); + } + } + + if (Owner.Calamity().victideBarrierHeal > 0) + { + HealTimer++; + if (HealTimer % VictideHeadBarrier.BarrierFramesPerHeal == VictideHeadBarrier.BarrierFramesPerHeal - 1) + { + Owner.Calamity().victideBarrierHeal--; + Owner.HealPlayer(1); + } + } + else + HealTimer = 0f; + + Lighting.AddLight(Owner.MountedCenter, Color.White.ToVector3() * 0.5f); + Projectile.Center = Owner.MountedCenter; + Projectile.timeLeft = (int)DashLifetime; + } + } + + public override void OnKill(int timeLeft) + { + if (DashTimer > 0f) + Owner.velocity *= 0.5f; + } + + // Explosion collision only (dash has a custom ram logic check effect) + public override bool? CanDamage() => ExplodeTimer > 0f ? null : false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20f * Projectile.scale, targetHitbox); + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + modifiers.HitDirectionOverride = (Owner.Center.X < target.Center.X).ToDirectionInt(); + modifiers.SourceDamage *= Utils.Remap(Projectile.numHits, 0, 10, 1f, 0.1f, true); + } + + public override bool PreDraw(ref Color lightColor) + { + if (DashTimer > 0f) + return false; + + Texture2D explosionTex = Explosion.Value; + Color barrierColor = Main.hslToRgb(0.6f + 0.1f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); + + if (ExplodeTimer > 0f) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Vector2 explosionPos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(explosionTex, explosionPos, null, barrierColor * Projectile.Opacity, Projectile.rotation, explosionTex.Size() * 0.5f, 0.02f * Projectile.scale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + Vector2 drawPos = Owner.Center + Vector2.UnitY * Owner.gfxOffY - Main.screenPosition; + Texture2D circleBase = TextureAssets.Projectile[Type].Value; + Color contrastingColor = Main.hslToRgb(0.6f + 0.1f * MathF.Cos(Main.GlobalTimeWrappedHourly * 2f), 1f, 0.5f); + + // Silly solution to making a clean circle over the player + Main.spriteBatch.EnterShaderRegion(); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseOpacity(0.5f); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseColor(barrierColor); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSecondaryColor(Color.Transparent); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].UseSaturation(0f); + GameShaders.Misc["CalamityMod:CircularAoETelegraph"].Apply(); + + Main.EntitySpriteDraw(circleBase, drawPos, null, Color.White, 0f, circleBase.Size() * 0.5f, 80f, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + + // Give it additional texture + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Main.EntitySpriteDraw(explosionTex, drawPos, null, contrastingColor * 0.3f, Projectile.rotation, explosionTex.Size() * 0.5f, 0.04f, SpriteEffects.None); + Texture2D shineTex = Shine.Value; + Main.EntitySpriteDraw(shineTex, drawPos, null, Color.HotPink * 0.5f, MathHelper.ToRadians(36f), shineTex.Size() * 0.5f, 0.45f, SpriteEffects.None); + Main.EntitySpriteDraw(shineTex, drawPos, null, Color.Orange * 0.3f, MathHelper.ToRadians(216f), shineTex.Size() * 0.5f, 0.55f, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + } +} diff --git a/Projectiles/Typeless/VictideBobber.cs b/Projectiles/Typeless/VictideBobber.cs new file mode 100644 index 0000000000..8c9c4113de --- /dev/null +++ b/Projectiles/Typeless/VictideBobber.cs @@ -0,0 +1,179 @@ +using System; +using CalamityMod.Items; +using CalamityMod.Items.SummonItems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VictideBobber : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/Summon/CnidarianJellyfishOnTheString"; + + public Player Owner => Main.player[Projectile.owner]; + public ref float ParentProjectile => ref Projectile.ai[2]; + public Projectile Parent => Main.projectile[(int)ParentProjectile]; + + public int stuckTimer; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 20; + Projectile.aiStyle = ProjAIStyleID.Bobber; + Projectile.bobber = true; + } + + public override bool PreAI() + { + // Snap if the snail is shelled, or just nowhere to be found + if (!Parent.active || Owner.ActiveItem().fishingPole <= 0 || Parent == null || Parent.frame < 6) + { + Projectile.Kill(); + return false; + } + return true; + } + + public override void AI() + { + // Automatic reeling + if (Projectile.ai[0] == 0f && Projectile.ai[1] < 0f && Main.rand.NextBool(40)) + { + Projectile.ai[0] = 1f; + Projectile.localAI[0] = 1f; + + // Consume bait as needed + int baitType = Owner.GetFishingConditions().BaitItemType; + int baitSlot = GetBaitSlot(Owner, baitType); + if (baitSlot != -1) + { + Item currentBait = Owner.inventory[baitSlot]; + bool consume = false; + + if (baitType == ItemID.TruffleWorm) + consume = true; + else if (baitType == ItemID.GoldWorm) + consume = Main.rand.NextBool(20); + else + { + float chanceMult = MathF.Max(1f, 1f + currentBait.bait / 6f); + if (Owner.accTackleBox) + chanceMult += 1f; + if (Main.rand.NextFloat() * chanceMult < 1f) + consume = true; + + // Junk (or Quest fish) default to no bait consumption + if (Projectile.localAI[1] > 0f) + { + Item dummyCatch = new Item(); + dummyCatch.SetDefaults((int)Projectile.localAI[1]); + if (dummyCatch.rare < 0) + consume = false; + } + } + if (CombinedHooks.CanConsumeBait(Owner, currentBait).GetValueOrDefault(consume)) + { + if (currentBait.type == ItemID.LadyBug || currentBait.type == ItemID.GoldLadyBug) + NPC.LadyBugKilled(Owner.Center, currentBait.type == ItemID.GoldLadyBug); + + currentBait.stack--; + if (currentBait.stack <= 0) + currentBait.SetDefaults(); + } + } + + // Summon Duke Fishron as this code otherwise only runs on player rod usage + if (baitType == ItemID.TruffleWorm) + { + Projectile.ai[0] = 2f; + CalamityUtils.SpawnBossUsingItem(Owner, NPCID.DukeFishron); + } + // Line snapping behaviour + else if (!Owner.accFishingLine && Main.rand.NextBool(7)) + Projectile.ai[0] = 2f; + // Return back items + else if (Projectile.localAI[1] > 0f) + { + Projectile.ai[1] = Projectile.localAI[1]; + Projectile.localAI[1] = 0f; + } + // Spawn enemies + else if (Projectile.localAI[1] < 0f) + { + int spawnType = (int)(-Projectile.localAI[1]); + Point spawnPos = new Point((int)Projectile.position.X, (int)Projectile.position.Y); + if (spawnType == NPCID.BloodNautilus) + spawnPos.Y += 64; + + if (Main.netMode == NetmodeID.MultiplayerClient) + NetMessage.SendData(MessageID.FishOutNPC, -1, -1, null, spawnPos.X / 16, spawnPos.Y / 16, spawnType); + else + { + Projectile.ai[0] = 2f; + NPC.NewNPC(new EntitySource_FishedOut(Owner), spawnPos.X, spawnPos.Y, spawnType); + + if (spawnType == NPCID.TownSlimeRed) + NPC.unlockedSlimeRedSpawn = true; + WorldGen.CheckAchievement_RealEstateAndTownSlimes(); + } + } + } + + // Anti-stuck auto reelback + if (Projectile.ai[0] == 0f && Projectile.localAI[1] == 0f && Projectile.velocity.Length() <= 0.2f) + { + stuckTimer++; + if (stuckTimer > 60) + Projectile.ai[0] = 1f; + } + } + + public static int GetBaitSlot(Player owner, int baitType) + { + // Ignore Bloodworm as the Old Duke summon method already manually consumes it + if (baitType == ModContent.ItemType()) + return -1; + + // Check ammo slots first + for (int i = 54; i < Main.InventorySlotsTotal; i++) + { + if (owner.inventory[i].type == baitType) + return i; + } + for (int j = 0; j < 54; j++) + { + if (owner.inventory[j].type == baitType) + return j; + } + return -1; + } + + // Anchor the bobber to the parent projectile, since the default is bound to the player + // Yes. This method is obsolete. No, there is no other way and I won't make another IL edit to remedy this fact. - Iris + public override void ModifyFishingLine(ref Vector2 lineOriginOffset, ref Color lineColor) + { + lineColor = Color.Cyan; + if (Parent.active) + { + Vector2 originalPos = Owner.MountedCenter + Vector2.UnitY * (Owner.gfxOffY - (Owner.gravDir == -1 ? 12f : 0f)); + lineOriginOffset = Parent.Center - originalPos + Vector2.UnitY * 13f; + + // How this is a thing is beyond me + lineOriginOffset.X -= 2f; + if (Owner.direction < 0) + lineOriginOffset.X += (Owner.MountedCenter.X - Parent.Center.X) * 2f; + } + } + + public override bool PreDrawExtras() + { + Lighting.AddLight(Projectile.Center, 0f, 0.2f, 0.2f); + return true; + } + } +} diff --git a/Projectiles/Typeless/VictideSeaSnail.cs b/Projectiles/Typeless/VictideSeaSnail.cs new file mode 100644 index 0000000000..94282c071c --- /dev/null +++ b/Projectiles/Typeless/VictideSeaSnail.cs @@ -0,0 +1,264 @@ +using System; +using CalamityMod.CalPlayer; +using CalamityMod.Items.Weapons.Summon; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VictideSeaSnail : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public ref float DustTimer => ref Projectile.localAI[0]; + public ref float CollisionTimer => ref Projectile.ai[0]; + public ref float PlayerStandStillTimer => ref Projectile.ai[1]; + public ref float PlayerFishingTimer => ref Projectile.ai[2]; + + public const int FrameTime = 6; // Switches frame every 6 frames (10 FPS) + public const int PeekCooldown = 150; + + public Player Owner => Main.player[Projectile.owner]; + public CalamityPlayer ModdedOwner => Owner.Calamity(); + + // Extra requirements so you don't break the bobber, or snail, or how would you fish underwater?? + public bool StandingStill => Owner.velocity.Length() == 0 && !Owner.pulley && !Owner.mount.Active && !Collision.DrownCollision(Owner.position, Owner.width, Owner.height, Owner.gravDir); + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 7; + } + + public override void SetDefaults() + { + Projectile.width = 38; + Projectile.height = 34; + Projectile.netImportant = true; + Projectile.friendly = true; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + } + + public override void AI() + { + if (!ModdedOwner.victideSnailSet) + { + for (int d = 0; d < 25; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + Projectile.active = false; + return; + } + + if (Owner.dead) + ModdedOwner.victideSnail = false; + + if (ModdedOwner.victideSnail) + Projectile.timeLeft = 2; + + //Create a burst of dust as it gets created, teleported, or popped out + DustTimer++; + if (DustTimer <= 3) + { + for (int d = 0; d < 25; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + } + + // Small amount of light + Lighting.AddLight(Projectile.Center, 0.5f, 0.25f, 0.5f); + + if (StandingStill) + { + PlayerStandStillTimer++; + if (PlayerStandStillTimer >= PeekCooldown) + { + // Pop out the shell when ready. This give a slight velocity boost outwards + if (PlayerStandStillTimer == PeekCooldown) + { + DustTimer = 0f; + Projectile.velocity = new Vector2(Main.rand.NextFloat(2f, 3.6f) * Owner.direction, Main.rand.NextFloat(-4f, 0f)); + } + + // Fall down into position + Projectile.velocity *= 0.98f; + Projectile.velocity.X *= 0.9f; + Projectile.velocity.Y = Math.Min(Projectile.velocity.Y + 0.1f, 14f); + Projectile.tileCollide = true; + + bool? collide = CollidingWithLiquidOrPlatform(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); + if (collide.HasValue) + { + CollisionTimer++; + // Bobs up and down if collided with liquids + Projectile.velocity.Y = collide.Value ? MathF.Sin(CollisionTimer * 0.05f) * 0.25f : 0f; + } + + Projectile.rotation = Projectile.rotation.AngleTowards(0, MathHelper.PiOver4 * 0.14f); + + if (CollisionTimer > 0f) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= FrameTime) + { + Projectile.frameCounter = 0; + Projectile.frame = Math.Min(6, Projectile.frame + 1); + } + } + } + else // keep this guy spinnin' + Projectile.rotation += MathHelper.PiOver4 * 0.2f; + } + else + { + // Slowly puts its head back into shell + if (Projectile.frame > 0) + { + Projectile.frameCounter++; + if (Projectile.frameCounter >= FrameTime) + { + Projectile.frameCounter = 0; + Projectile.frame--; + } + + if (Projectile.frame == 0) + { + CollisionTimer = 0f; + PlayerStandStillTimer = 0f; + PlayerFishingTimer = 0f; + } + } + // Return to resting position once shelled again + else + { + Projectile.velocity = Vector2.Zero; + Projectile.tileCollide = false; + + Vector2 desiredPosition = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 60f) * Owner.gravDir; + //Round the result so it doesn't jitter. + desiredPosition = new Vector2((int)desiredPosition.X, (int)desiredPosition.Y); + Projectile.Center = Projectile.Center.MoveTowards(desiredPosition, 7f + Owner.velocity.Length()); + Projectile.rotation += MathHelper.PiOver4 * 0.2f; + } + } + + // Teleport and reset everything if too far away (this range is deliberately very short) + if (Vector2.Distance(Projectile.Center, Owner.Center) > 240f) + { + Projectile.Center = Owner.Center + Vector2.UnitY * (Owner.gfxOffY - 60f) * Owner.gravDir; + DustTimer = 0f; + CollisionTimer = 0f; + PlayerStandStillTimer = 0f; + PlayerFishingTimer = 0f; + Projectile.frame = 0; + return; + } + + // Only does fishing stuff when it's fully popped out + if (Projectile.frame == 6) + { + // Give the player a grace period upon any input with the fishing rod + // This means you can't just AFK with the fishing rod held + if (Owner.itemAnimation > 0 && Owner.ActiveItem().fishingPole > 0) + PlayerFishingTimer = 600f; + else + PlayerFishingTimer = Math.Max(PlayerFishingTimer -1f, 0f); + + // Automatically casts bobbers one at a time + // This casts the same way the pole does to prevent position variance + int bobberType = ModContent.ProjectileType(); + if (Owner.ownedProjectileCounts[bobberType] < 1 && Owner.ActiveItem().fishingPole > 0 && Projectile.owner == Main.myPlayer && PlayerFishingTimer > 0f) + { + SoundEngine.PlaySound(SoundID.Item1, Projectile.Center); + + Vector2 velocity = Owner.SafeDirectionTo(Main.MouseWorld) * Owner.ActiveItem().shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, bobberType, 0, 0f, Projectile.owner, ai2: Projectile.whoAmI); + } + } + } + + public static bool? CollidingWithLiquidOrPlatform(Vector2 Position, Vector2 Velocity, int Width, int Height) + { + Rectangle Hitbox = new Rectangle((int)Position.X, (int)Position.Y, Width, Height); + Rectangle ProjectedHitbox = new Rectangle((int)(Position.X + Velocity.X), (int)(Position.Y + Velocity.Y), Width, Height); + + int xMin = Utils.Clamp((int)(Position.X / 16f) - 1, 0, Main.maxTilesX - 1); + int xMax = Utils.Clamp((int)((Position.X + (float)Width) / 16f) + 2, 0, Main.maxTilesX - 1); + int yMin = Utils.Clamp((int)(Position.Y / 16f) - 1, 0, Main.maxTilesY - 1); + int yMax = Utils.Clamp((int)((Position.Y + (float)Height) / 16f) + 2, 0, Main.maxTilesY - 1); + for (int i = xMin; i < xMax; i++) + { + for (int j = yMin; j < yMax; j++) + { + Tile tile = Main.tile[i, j]; + if (tile == null) + return null; + + if (tile.HasTile && (Main.tileSolid[tile.TileType] || Main.tileSolidTop[tile.TileType])) + { + Rectangle Target = new Rectangle(i * 16, j * 16 , 16, 16); + if (Hitbox.Intersects(Target) || ProjectedHitbox.Intersects(Target)) + return false; + } + if (tile.LiquidAmount > 0 && !tile.HasTile) + { + float LiquidDepth = (256 - tile.LiquidAmount) / 16f; + Rectangle Target = new Rectangle(i * 16, j * 16 + (int)LiquidDepth, 16, 16 - (int)LiquidDepth); + if (Hitbox.Intersects(Target)) + return true; + } + } + } + return null; + } + + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + for (int d = 0; d < 45; d++) + { + Dust dust = Dust.NewDustDirect(new Vector2(Projectile.position.X, Projectile.position.Y + 16f), Projectile.width, Projectile.height - 16, DustID.BubbleBurst_Purple, 0f, 0f, 0, default, 1f); + dust.velocity *= 2f; + dust.scale *= 1.15f; + } + } + + public override bool OnTileCollide(Vector2 oldVelocity) + { + // Touches the ground + if (oldVelocity.Y >= 0) + CollisionTimer = 1f; + return false; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + bool CanPeekOut = PlayerStandStillTimer >= PeekCooldown || Projectile.frame > 0; + Vector2 origin = !CanPeekOut ? new Vector2(15, 23) : frame.Size() * 0.5f; + + // Look at the player's direction + SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; + Main.EntitySpriteDraw(tex, Projectile.Center + Vector2.UnitY * 2f - Main.screenPosition, frame, lightColor, Projectile.rotation, origin, Projectile.scale, flip); + + // Fisbing Rod,,. + if (Owner.ownedProjectileCounts[ModContent.ProjectileType()] > 0) + { + Texture2D rod = Terraria.GameContent.TextureAssets.Item[ModContent.ItemType()].Value; + Main.EntitySpriteDraw(rod, Projectile.Center - Main.screenPosition + Vector2.UnitX * Owner.direction * 30f, null, lightColor, 0f, rod.Size() * 0.5f, Projectile.scale, flip); + } + return false; + } + } +} diff --git a/Projectiles/Summon/VictideSeaSnail.png b/Projectiles/Typeless/VictideSeaSnail.png similarity index 100% rename from Projectiles/Summon/VictideSeaSnail.png rename to Projectiles/Typeless/VictideSeaSnail.png diff --git a/Projectiles/Typeless/VictideSpirit.cs b/Projectiles/Typeless/VictideSpirit.cs new file mode 100644 index 0000000000..3b6ea32a18 --- /dev/null +++ b/Projectiles/Typeless/VictideSpirit.cs @@ -0,0 +1,319 @@ +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Armor.Victide; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using System; +using System.Collections.Generic; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class VictideSpirit : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + + public static Asset GlowTexture; + + public ref float SubmergedTimer => ref Projectile.ai[0]; + public ref float DustCounter => ref Projectile.ai[1]; + + public override void Load() => GlowTexture = ModContent.Request("CalamityMod/Particles/BloomCircle"); + + public override void SetStaticDefaults() + { + ProjectileID.Sets.TrailCacheLength[Type] = 20; + ProjectileID.Sets.TrailingMode[Type] = 2; + } + + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 42; + Projectile.friendly = true; + Projectile.tileCollide = false; + } + + public override void OnSpawn(IEntitySource source) + { + Projectile.rotation = MathHelper.PiOver2; + for (int i = 0; i < Projectile.oldPos.Length; i++) + Projectile.oldRot[i] = MathHelper.PiOver2; + + for (int i = 0; i < 3; i++) + { + Color squareColor = Color.Lerp(Color.Cyan, Color.RoyalBlue, i * 0.5f) * 0.6f; + float squareScale = 0.6f + i * 0.2f; + float squareRot = (i % 2 == 0 ? MathHelper.PiOver4 : 0f); + Particle square = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 18, squareScale, squareColor, Vector2.One, true, true, squareRot, true, glowOpacity: 0.5f, glowCenterScale: squareScale * 1.15f); + GeneralParticleHandler.SpawnParticle(square); + } + } + + public override void AI() + { + if (Main.myPlayer == Projectile.owner) + { + // Validate existence + bool hasCD = Owner.Calamity().cooldowns.TryGetValue(BubblyBurrow.ID, out CooldownInstance cd); + if (!hasCD) + { + Owner.AddCooldown(BubblyBurrow.ID, VictideHeadBurrow.BurrowCooldown); + Projectile.Kill(); + return; + } + else if (!Owner.Calamity().victideBurrowSet) + { + cd.timeLeft = VictideHeadBurrow.BurrowCooldown; + Projectile.Kill(); + return; + } + else if (cd.timeLeft <= VictideHeadBurrow.BurrowCooldown) + { + Projectile.Kill(); + return; + } + // Shimmer interaction (Immediately ends if Chromatic Cloak isn't active) + else if (Owner.shimmering) + { + cd.timeLeft = VictideHeadBurrow.BurrowCooldown; + Projectile.Kill(); + return; + } + Projectile.timeLeft = cd.timeLeft - VictideHeadBurrow.BurrowCooldown; + + #region Movement and Controls + float MaxSpeed = Collision.DrownCollision(Projectile.Center - Vector2.One, 2, 2, Owner.gravDir) ? VictideHeadBurrow.SubmergedBurrowSpeed : VictideHeadBurrow.BaseBurrowSpeed; + // Controlling both opposite movement keys brings you to a near immediate stop (faster deceleration than just releasing both buttons) + // Turnaround acceleration is also twice as fast to aid smoothness of movement + if (Owner.controlLeft && Owner.controlRight) + Projectile.velocity.X *= 0.7f; + else if (Owner.controlLeft) + { + if (Projectile.velocity.X < -MaxSpeed) + { + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, MaxSpeed, 0.05f); + if (Projectile.velocity.X > -MaxSpeed - 0.01f) + Projectile.velocity.X = -MaxSpeed; + } + else if (Projectile.velocity.X > 0f) + Projectile.velocity.X -= VictideHeadBurrow.BaseAcceleration * 2f; + else + Projectile.velocity.X = MathF.Max(Projectile.velocity.X - VictideHeadBurrow.BaseAcceleration, -MaxSpeed); + } + else if (Owner.controlRight) + { + if (Projectile.velocity.X > MaxSpeed) + { + Projectile.velocity.X = MathHelper.Lerp(Projectile.velocity.X, MaxSpeed, 0.05f); + if (Projectile.velocity.X < MaxSpeed + 0.01f) + Projectile.velocity.X = MaxSpeed; + } + else if (Projectile.velocity.X < 0f) + Projectile.velocity.X += VictideHeadBurrow.BaseAcceleration * 2f; + else + Projectile.velocity.X = MathF.Min(Projectile.velocity.X + VictideHeadBurrow.BaseAcceleration, MaxSpeed); + } + else + Projectile.velocity.X *= 0.92f; + + if ((Owner.controlUp || Owner.controlJump) && Owner.controlDown) + Projectile.velocity.Y *= 0.7f; + else if (Owner.controlUp || Owner.controlJump) + { + if (Projectile.velocity.Y < -MaxSpeed) + { + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, MaxSpeed, 0.05f); + if (Projectile.velocity.Y > -MaxSpeed - 0.01f) + Projectile.velocity.Y = -MaxSpeed; + } + else if (Projectile.velocity.Y > 0f) + Projectile.velocity.Y -= VictideHeadBurrow.BaseAcceleration * 2f; + else + Projectile.velocity.Y = MathF.Max(Projectile.velocity.Y - VictideHeadBurrow.BaseAcceleration, -MaxSpeed); + } + else if (Owner.controlDown) + { + if (Projectile.velocity.Y > MaxSpeed) + { + Projectile.velocity.Y = MathHelper.Lerp(Projectile.velocity.Y, MaxSpeed, 0.05f); + if (Projectile.velocity.Y < MaxSpeed + 0.01f) + Projectile.velocity.Y = MaxSpeed; + } + else if (Projectile.velocity.Y < 0f) + Projectile.velocity.Y += VictideHeadBurrow.BaseAcceleration * 2f; + else + Projectile.velocity.Y = MathF.Min(Projectile.velocity.Y + VictideHeadBurrow.BaseAcceleration, MaxSpeed); + } + else + Projectile.velocity.Y *= 0.92f; + + // Rotation is less sudden so that the visuals are smoother -- velocity is not affected so that it also plays natural + float idealRotation = (Projectile.velocity.Length() == 0f ? MathHelper.PiOver2 : Projectile.velocity.ToRotation()); + if (MathF.Abs(idealRotation - Projectile.rotation) < MathHelper.ToRadians(1f) || MathF.Abs(idealRotation - Projectile.rotation) > MathHelper.ToRadians(90f)) + Projectile.rotation = idealRotation; + else + Projectile.rotation = MathHelper.Lerp(Projectile.rotation, idealRotation, 0.25f); + #endregion + + #region Player Manipulation + // Actively remove mounts and hooks from the player + Owner.mount?.Dismount(Owner); + Owner.RemoveAllGrapplingHooks(); + + // Give immunity frames and kill suffocation + Owner.suffocateDelay = 0; + Owner.immune = true; + Owner.immuneNoBlink = true; + Owner.immuneTime = 4; + for (int k = 0; k < Owner.hurtCooldowns.Length; k++) + { + // Excluded explicitly-anti cheesed bosses + if (k == ImmunityCooldownID.Bosses) + continue; + + Owner.hurtCooldowns[k] = Owner.immuneTime; + } + + Owner.velocity = Projectile.velocity; + if (Owner.velocity.Y == 0f) + Owner.velocity.Y += 0.00001f; // Prevent sprint particles from appearing + Owner.ChangeDir((Projectile.velocity.X > 0).ToDirectionInt()); + Projectile.direction = Owner.direction; + + // Move the player to the projectile, allowing them to bypass all tiles + Owner.Center = Projectile.Center; + #endregion + } + + #region Visual and Sound Effects + if (Collision.DrownCollision(Projectile.Center - Vector2.One, 2, 2, Owner.gravDir)) + SubmergedTimer++; + else + SubmergedTimer = 0f; + + Color BubblyBlue = new Color(97, 200, 255); + Vector2 headPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 8f; + Lighting.AddLight(headPosition, BubblyBlue.ToVector3() * Projectile.Opacity * (0.5f + 0.3f * Utils.GetLerpValue(0f, 60f, SubmergedTimer, true))); + + if (SubmergedTimer == 1f) + { + Particle ring = new DirectionalPulseRing(headPosition, Projectile.velocity.SafeNormalize(Vector2.UnitY) * 0.4f, BubblyBlue, new Vector2(0.5f, 1f), Projectile.rotation, 0.95f, 0f, 30); + GeneralParticleHandler.SpawnParticle(ring); + } + + float lifetimeRatio = Projectile.timeLeft / (float)VictideHeadBurrow.BurrowCooldown; + if (Projectile.soundDelay <= 0) + { + Projectile.soundDelay = Main.rand.Next(20, 36) + (int)(lifetimeRatio * 30); + SoundEngine.PlaySound(Main.rand.NextBool() ? SoundID.ShimmerWeak1 : SoundID.ShimmerWeak2, Projectile.Center); + } + + if ((Main.rand.NextBool(4) || Projectile.velocity.Length() > 0.25f) && SubmergedTimer == 0f) + { + Particle foam = new CustomSpark(Projectile.Center, -Projectile.velocity * 0.7f, "CalamityMod/Particles/WaterFoam", false, 9, 0.25f, Color.DeepSkyBlue, Vector2.One, extraRotation: Main.rand.NextFloat(0, MathHelper.TwoPi), shrinkSpeed: 1f); + GeneralParticleHandler.SpawnParticle(foam); + } + + DustCounter += Utils.Remap(Projectile.velocity.Length(), 0f, VictideHeadBurrow.BaseBurrowSpeed, 1f, 3f, true); + if (DustCounter >= 15f) + { + DustCounter = 0f; + for (int i = 0; i < 2; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.rotation.ToRotationVector2().RotatedByRandom(MathHelper.ToRadians(15f)) * Main.rand.NextFloat(-4.8f, -6f)); + dust.noGravity = false; + dust.scale = Main.rand.NextFloat(0.65f, 0.8f); + dust.color = Color.White; + dust.noLightEmittence = true; + } + } + #endregion + } + + public float JetstreamWidthFunction(float completionRatio) => Utils.GetLerpValue(1f, 0.8f, completionRatio, true) * 3f; + public float SpiritWidthFunction(float completionRatio) => MathF.Min(MathHelper.SmoothStep(64f, 8f, completionRatio), Utils.GetLerpValue(0f, 0.15f, completionRatio, true) * 60f); + + public Color InnerJetstreamColorFunction(float completionRatio) => Color.Lerp(Color.CornflowerBlue, new Color(169, 100, 237), MathF.Pow(completionRatio, 2.5f)) * Utils.GetLerpValue(1f, 0.6f, completionRatio, true) * 0.5f; + public Color OuterJetstreamColorFunction(float completionRatio) => Color.Lerp(Color.CornflowerBlue, new Color(100, 237, 237), MathF.Pow(completionRatio, 2.5f)) * Utils.GetLerpValue(1f, 0.6f, completionRatio, true) * 0.2f; + public Color SpiritColorFunction(float completionRatio) => Color.Lerp(Color.Lerp(Color.White, Color.Cyan, 0.4f + completionRatio), Color.RoyalBlue, completionRatio) * Utils.GetLerpValue(0.8f, 0.54f, completionRatio, true); + + public override bool PreDraw(ref Color lightColor) + { + // Jetstream trails + for (int direction = -1; direction <= 1; direction += 2) + { + List trailPositionsInner = new List(); + List trailPositionsOuter = new List(); + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + float mergeFactor = Utils.Remap(i, 0f, 8f, 0f, 1f, true); + + Vector2 trailPosInner = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * i * 8f; + float spreadLengthInner = 20f * MathF.Sin(Main.GlobalTimeWrappedHourly * 5f); + Vector2 sinOffsetInner = (Vector2.UnitY * direction * MathF.Sin(i * MathHelper.Pi * 0.125f) * spreadLengthInner * mergeFactor).RotatedBy(Projectile.oldRot[i]); + trailPositionsInner.Add(trailPosInner + sinOffsetInner); + + Vector2 trailPosOuter = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * i * 12f; + float spreadLengthOuter = 32f * MathF.Sin(Main.GlobalTimeWrappedHourly * 2f); + Vector2 sinOffsetOuter = (Vector2.UnitY * direction * (6f + MathF.Sin(i * MathHelper.Pi * 0.035f) * spreadLengthOuter * mergeFactor)).RotatedBy(Projectile.oldRot[i]); + trailPositionsOuter.Add(trailPosOuter + sinOffsetOuter); + } + + PrimitiveRenderer.RenderTrail(trailPositionsInner, new(JetstreamWidthFunction, InnerJetstreamColorFunction), 20); + PrimitiveRenderer.RenderTrail(trailPositionsOuter, new(JetstreamWidthFunction, OuterJetstreamColorFunction), 20); + } + + // Oops all trails? + List spiritBodyPositions = new List(); + for (int i = 0; i < Projectile.oldPos.Length; i++) + { + // 3 segments ahead so that it's a little offset forward + Vector2 spiritPos = Projectile.Center - Projectile.oldRot[i].ToRotationVector2() * (i - 3) * 8f; + spiritBodyPositions.Add(spiritPos); + } + GameShaders.Misc["CalamityMod:ImpFlameTrail"].SetShaderTexture(ModContent.Request("CalamityMod/ExtraTextures/GreyscaleGradients/EternityStreak")); + PrimitiveRenderer.RenderTrail(spiritBodyPositions, new(SpiritWidthFunction, SpiritColorFunction, shader: GameShaders.Misc["CalamityMod:ImpFlameTrail"]), 60); + + // Glow pulses when the ability is about to run out + if (Projectile.timeLeft < 180) + { + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Texture2D glow = GlowTexture.Value; + Vector2 drawPos = Projectile.Center + Vector2.UnitY * Projectile.gfxOffY - Main.screenPosition; + Color glowColor = new Color(255, 170, 204) * (0.2f * MathF.Sin(Projectile.timeLeft * MathHelper.Pi * 0.25f) + Utils.Remap(Projectile.timeLeft, 180f, 0f, 0.2f, 0.6f, true)); + Main.EntitySpriteDraw(glow, drawPos, null, glowColor, Projectile.rotation, glow.Size() * 0.5f, new Vector2(0.6f, 0.5f), SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + } + return false; + } + + public override bool? CanDamage() => false; + + public override void OnKill(int timeLeft) + { + Owner.velocity *= 0.8f; + Owner.fullRotation = 0f; + + SoundEngine.PlaySound(SoundID.Drown, Projectile.Center); + for (int i = 0; i < 3; i++) + { + Color squareColor = Color.Lerp(Color.Cyan, new Color(255, 170, 204), i * 0.5f) * 0.6f; + float squareScale = 0.6f + i * 0.2f; + float squareRot = (i % 2 == 0 ? MathHelper.PiOver4 : 0f); + Particle square = new CustomSpark(Projectile.Center, Vector2.Zero, "CalamityMod/Particles/GlowSquareParticleThick", false, 18, squareScale, squareColor, Vector2.One, true, true, squareRot, true, glowOpacity: 0.5f, glowCenterScale: squareScale * 1.15f); + GeneralParticleHandler.SpawnParticle(square); + } + } + } +} diff --git a/Projectiles/Typeless/WhitePearl.png b/Projectiles/Typeless/WhitePearl.png new file mode 100644 index 0000000000..a6492a5ea8 Binary files /dev/null and b/Projectiles/Typeless/WhitePearl.png differ diff --git a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs index 616ca734da..03f8a7927e 100644 --- a/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs +++ b/Projectiles/Typeless/WulfrumDiggingTurtleProjectile.cs @@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Typeless public static int Lifetime = 400; public static int DigTime = 350; public static float DigSpeed = 1.5f; - public static int MaxPickPower = 160; + public static int MaxPickPower = 1000; public static float ClearSpaceDiagonal = 50; public override void SetDefaults() diff --git a/Projectiles/Typeless/WulfrumHook.cs b/Projectiles/Typeless/WulfrumHook.cs index 93f0df94db..325ba40a75 100644 --- a/Projectiles/Typeless/WulfrumHook.cs +++ b/Projectiles/Typeless/WulfrumHook.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Typeless { public new string LocalizationCategory => "Projectiles.Typeless"; public Player Owner => Main.player[Projectile.owner]; + public int EquippedHook => Owner.miscEquips[4].type; public HookState State { @@ -117,7 +118,7 @@ namespace CalamityMod.Projectiles.Typeless Point tilePos = Projectile.Center.ToTileCoordinates(); Tile tile = Main.tile[tilePos]; - if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(Owner.miscEquips[4].type == ItemID.SquirrelHook) || Owner.IsBlacklistedForGrappling(tilePos)) + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(EquippedHook == ItemID.SquirrelHook) || Owner.IsBlacklistedForGrappling(tilePos)) State = HookState.Retracting; Projectile.velocity = Vector2.Zero; @@ -153,7 +154,7 @@ namespace CalamityMod.Projectiles.Typeless Tile tile = Main.tile[tilePos]; - if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(Owner.miscEquips[4].type == ItemID.SquirrelHook) || Owner.IsBlacklistedForGrappling(tilePos)) + if (!tile.HasUnactuatedTile || !tile.CanTileBeLatchedOnTo(EquippedHook == ItemID.SquirrelHook && Projectile.Distance(Owner.Center) > 96) || Owner.IsBlacklistedForGrappling(tilePos)) continue; if (Main.myPlayer != Owner.whoAmI) continue; @@ -171,9 +172,15 @@ namespace CalamityMod.Projectiles.Typeless public void OnGrapple(Vector2 grapplePos, int x, int y) { WulfrumPackPlayer mp = Owner.GetModPlayer(); - //Clear previous grapple - if (mp.Grapple > -1 && Main.projectile[mp.Grapple].active && Main.projectile[mp.Grapple].ModProjectile is WulfrumHook hook && hook.State == WulfrumHook.HookState.Grappling) - Main.projectile[mp.Grapple].Kill(); + //Clear all grapples + Owner.ClearGrapplingBlacklist(); + Owner.grappling[0] = -1; + Owner.grapCount = 0; + for (int i = 0; i < 1000; i++) + { + if (Main.projectile[i].active && Main.projectile[i].owner == Owner.whoAmI && Main.projectile[i].aiStyle == 7 && !(Main.projectile[i].whoAmI == Projectile.whoAmI)) + Main.projectile[i].Kill(); + } //Hook onto the tile Projectile.velocity = Vector2.Zero; @@ -189,9 +196,8 @@ namespace CalamityMod.Projectiles.Typeless { Owner.grappling[Owner.grapCount] = Projectile.whoAmI; Owner.grapCount++; - //Owner.velocity = Vector2.Zero; } - if (Owner.miscEquips[4].type == ItemID.QueenSlimeHook) + if (EquippedHook == ItemID.QueenSlimeHook) Owner.DoQueenSlimeHookTeleport(grapplePos + new Vector2(-(Owner.Center - Projectile.Center).Length() * 0.75f, 0).RotatedBy(Projectile.DirectionTo(Owner.Center).ToRotation())); mp.SwingLength = (Owner.Center - Projectile.Center).Length(); mp.OldPosition = Owner.Center - Owner.velocity; @@ -223,7 +229,27 @@ namespace CalamityMod.Projectiles.Typeless public Color PrimColorFunction(float completionRatio) { - return Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Pow(completionRatio, 1.5D)); + Color EndColor = Color.GreenYellow; + + switch (EquippedHook) + { + case ItemID.AntiGravityHook: + EndColor = Color.Aquamarine; + break; + case ItemID.QueenSlimeHook: + EndColor = Color.HotPink; + break; + case ItemID.SquirrelHook: + EndColor = Color.DarkOrange; + break; + case ItemID.StaticHook: + EndColor = Color.Silver; + break; + default: + break; + } + + return Color.Lerp(Color.DeepSkyBlue, EndColor, (float)Math.Pow(completionRatio, 1.5D)); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Typeless/XykWings.cs b/Projectiles/Typeless/XykWings.cs index 222fc845b6..5c4a83a9a4 100644 --- a/Projectiles/Typeless/XykWings.cs +++ b/Projectiles/Typeless/XykWings.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Projectiles.Typeless public float backWingRot = 0; public int lastDir = 0; public float spawnFade = 0; - public float spawnFadePow => (Projectile.ai[1] == 5 ? 1 - (float)Math.Pow(spawnFade, 4) : (float)Math.Pow(spawnFade, 4)); + public float spawnFadePow => (Projectile.ai[1] == 5 ? (float)Math.Pow(spawnFade, 1) : (float)Math.Pow(spawnFade, 4)); public int deathFadeTimer = 0; public bool iAmTopWing = false; @@ -157,7 +157,7 @@ namespace CalamityMod.Projectiles.Typeless deathFadeTimer++; int fadeTime = (BreakApart ? 90 : 20); - spawnFade = Utils.GetLerpValue(0, fadeTime, deathFadeTimer, true); + spawnFade = Utils.GetLerpValue(fadeTime, 0, deathFadeTimer, true); Projectile.scale = intendedScale * spawnFadePow; if (deathFadeTimer >= fadeTime) { @@ -166,107 +166,111 @@ namespace CalamityMod.Projectiles.Typeless } return; } - - bool isFlying = Owner.controlJump; - bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; - bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; - bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; - if (isFalling || timeFalling < 0) - timeFalling++; - else if (timeFalling > 0) - timeFalling -= 2; - float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 60, timeFalling, true), 3); - float topWingNum = (checkActiveWings() - 1); - - float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - - if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) - { - dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); - float bonusScale = 1; - if (Owner.Calamity().rageModeActive) - bonusScale += 0.25f; - if (Owner.Calamity().adrenalineModeActive) - bonusScale += 0.5f; - if (Projectile.scale < bonusScale) - Projectile.scale = bonusScale; - } else { - dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); - if (dashfx > 0) - dashfx -= 0.01f; - else - dashfx = 0; - } + bool isFlying = Owner.controlJump; + bool isFalling = Owner.controlDown && !isFlying && Owner.velocity.Y > 0; + bool isUpBoosting = Owner.wingTime > 0 && Owner.controlJump && Owner.controlUp; + bool isHovering = Owner.wingTime > 0 && Owner.controlDown && Owner.controlJump && !isUpBoosting; + if (isFalling || timeFalling < 0) + timeFalling++; + else if (timeFalling > 0) + timeFalling -= 3; + float fallingLerp = (float)Math.Pow(Utils.GetLerpValue(0, 40, timeFalling, true), 3); + float topWingNum = (checkActiveWings() - 1); - float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + float sine = (float)Math.Sin((time * 0.35f * (isFalling ? 3 : (isHovering || isUpBoosting) ? 3.2f : isFlying ? 2f : 1) + wingNum * ((isHovering || isUpBoosting) ? 3f : 2f)) / MathHelper.Pi); - wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; - - for (int i = -1; i <= 1; i += 2) - { - float dir = i * lastDir; - Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); - float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); - Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; - - float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp)); - float spawnDistance = 150; - if (i == 1) - expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; - else - expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; - } - Projectile.Center = Owner.Center; - - Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; - - if (wingNum == 0) - Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); - - if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) - { - for (int i = -2; i <= 2; i += 1) + if (Owner.dashDelay == -1 || isUpBoosting || isHovering || Owner.Calamity().adrenalineModeActive || Owner.Calamity().rageModeActive || isFalling && Owner.velocity.Y > 16) { - if (i == 0) - i++; - - bool front = i > 0; - Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); - Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); - - if (Owner.Calamity().XykVisualsBlue) - { - bool circle = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 1.5f * (circle ? 0 : 1f); - } + dashfx = MathHelper.Lerp(dashfx, 1, 0.25f); + float bonusScale = 1; + if (Owner.Calamity().rageModeActive) + bonusScale += 0.25f; + if (Owner.Calamity().adrenalineModeActive) + bonusScale += 0.5f; + if (Projectile.scale < bonusScale) + Projectile.scale = bonusScale; + } + else + { + dashfx = MathHelper.Lerp(dashfx, 0, 0.03f); + if (dashfx > 0) + dashfx -= 0.01f; else + dashfx = 0; + } + + float flapSpeed = MathHelper.Lerp(0.06f * (isHovering ? 2.5f : isFlying ? 2f : 1), 0.55f * (isHovering ? 2.5f : isFlying ? 2f : 1), (float)Math.Pow(Utils.GetLerpValue(-1, 1, sine), 3)); + + wingFlapHeight = MathHelper.Lerp(wingFlapHeight, sine, flapSpeed) * spawnFadePow; + + for (int i = -1; i <= 1; i += 2) + { + float dir = i * lastDir; + Vector2 flightMovement = Vector2.UnitY.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (-15 * Projectile.scale + 10 * (isFalling ? 0.35f : isUpBoosting ? 5f : isHovering ? 1.5f : isFlying ? 2.5f : 1) * wingFlapHeight) * ((Owner.velocity.Y == 0) ? 0 : 1); + float wingPartDist = (1.6f / (checkActiveWings() + 1)) * wingNum * (isFalling ? 1 - 0.3f * fallingLerp : isHovering ? 0.5f : 1); + Vector2 destination = (playerCenterPoint - (Vector2.UnitX.RotatedBy(isFalling ? MathHelper.ToRadians(13) * dir * fallingLerp : 0) * (22 + 7 * wingFlapHeight * (i == -1 ? 0.5f : 1)) * Projectile.scale).RotatedBy((-0.8f + (isFalling ? 0.7f * fallingLerp : 0) + wingPartDist + (wingNum == topWingNum ? 0.1f : wingNum == 0 ? -0.1f : 0)) * dir) * dir + (Vector2.One * (isFlying ? 0 : 1)).RotatedBy((time * 0.12f + wingNum * 0.9f) * dir)) + flightMovement; + + float lerpSpeed = (1 + wingNum * (0.1f + 0.15f * fallingLerp) / (Owner.moveSpeed * 0.3f + 1)); + float spawnDistance = 150; + if (i == 1) + expectedWingPosition1 += ((destination + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition1) / lerpSpeed; + else + expectedWingPosition2 += ((destination + (Vector2.UnitX * -6f * lastDir) + destination.DirectionFrom(playerCenterPoint) * Math.Max(1, spawnDistance * (1 - spawnFadePow))) - expectedWingPosition2) / lerpSpeed; + } + Projectile.Center = Owner.Center; + + Projectile.rotation = expectedWingPosition1.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + backWingRot = expectedWingPosition2.DirectionFrom(playerCenterPoint).ToRotation() - MathHelper.PiOver2; + + if (wingNum == 0) + Lighting.AddLight(Owner.Center, Color.Lerp(drawColor, Color.White, 0.5f).ToVector3() * 1.1f * spawnFadePow); + + if (dashfx > 0.3f && (wingNum == checkActiveWings() - 1 || wingNum == 0)) + { + for (int i = -2; i <= 2; i += 1) { - bool square = Main.rand.NextBool(3); - Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); - dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); - dust.noGravity = true; - dust.color = drawColor; - dust.noLightEmittence = true; - dust.fadeIn = 0.1f * (square ? 1 : 3f); + if (i == 0) + i++; + + bool front = i > 0; + Vector2 pos1 = expectedWingPosition1 + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * (45 + 5 * wingNum) * (Projectile.scale + 0.15f); + Vector2 pos2 = expectedWingPosition2 + (backWingRot + MathHelper.PiOver2).ToRotationVector2() * (15 + 3 * wingNum) * (Projectile.scale + 0.15f); + + if (Owner.Calamity().XykVisualsBlue) + { + bool circle = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, circle ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(circle ? 0.5f : 0) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(1.3f, 1.4f) * (front ? 1 : 0.6f) * dashfx * (circle ? 0.6f : 1f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 1.5f * (circle ? 0 : 1f); + } + else + { + bool square = Main.rand.NextBool(3); + Dust dust = Dust.NewDustPerfect(front ? pos1 : pos2, square ? ModContent.DustType() : ModContent.DustType(), Owner.velocity.RotatedByRandom(0.25f) * Main.rand.NextFloat(-0.5f, -0.2f) * dashfx); + dust.scale = Main.rand.NextFloat(0.8f, 1f) * (front ? 1 : 0.6f) * dashfx * (square ? 1 : 1.5f) * (float)Math.Pow(Projectile.scale, 0.4f); + dust.noGravity = true; + dust.color = drawColor; + dust.noLightEmittence = true; + dust.fadeIn = 0.1f * (square ? 1 : 3f); + } } } - } - time++; + time++; + } } - public override bool PreDraw(ref Color lightColor) + public override void PostDraw(Color lightColor) { if (!BreakApart) lastDir = Owner.direction; - + } + public override bool PreDraw(ref Color lightColor) + { float topWingNum = (checkActiveWings() - 1); float width = 1; float height = 1; @@ -310,7 +314,6 @@ namespace CalamityMod.Projectiles.Typeless Main.EntitySpriteDraw(tex, expectedWingPosition1 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), Projectile.rotation, new Vector2(tex.Width * 0.5f, 0), scale, lastDir == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(tex, expectedWingPosition2 - Main.screenPosition, null, Color.Lerp(drawColor, Color.White, dashfx) with { A = 0 } * spawnFadePow * MathHelper.Lerp(1, 0.6f, dashfx), backWingRot, new Vector2(tex.Width * 0.5f, 0), scaleBack, lastDir == -1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0); - return false; } public int checkActiveWings() diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.cs b/Projectiles/Typeless/YanmeisKnifeSlash.cs deleted file mode 100644 index 8d9ccaaf70..0000000000 --- a/Projectiles/Typeless/YanmeisKnifeSlash.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using CalamityMod.Buffs.StatBuffs; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Typeless; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class YanmeisKnifeSlash : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - - public override void SetStaticDefaults() - { - Main.projFrames[Type] = 5; - } - - public override void SetDefaults() - { - Projectile.width = 180; - Projectile.height = 96; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.tileCollide = false; - Projectile.ownerHitCheck = true; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 20; - } - - public override void AI() - { - Player player = Main.player[Projectile.owner]; - - // Frames and crap - Projectile.frameCounter++; - if (Projectile.frameCounter % 7 == 0) - { - Projectile.frame++; - if (Projectile.frame >= Main.projFrames[Type]) - Projectile.Kill(); - } - - // Create idle light and dust. - Vector2 origin = Projectile.Center + Projectile.velocity * 3f; - Lighting.AddLight(origin, 0f, 1.5f, 0.1f); - - Vector2 playerRotatedPoint = player.RotatedRelativePoint(player.MountedCenter, true); - - // Rotation and directioning. - float velocityAngle = Projectile.velocity.ToRotation(); - Projectile.rotation = velocityAngle + (Projectile.spriteDirection == -1).ToInt() * MathHelper.Pi; - Projectile.direction = (Math.Cos(velocityAngle) > 0).ToDirectionInt(); - - // Positioning close to the end of the player's arm. - Projectile.position = playerRotatedPoint - Projectile.Size * 0.5f + velocityAngle.ToRotationVector2() * 80f; - - // Sprite and player directioning. - Projectile.spriteDirection = Projectile.direction; - player.ChangeDir(Projectile.direction); - - // Prevents the projectile from dying - Projectile.timeLeft = 2; - - // Player item-based field manipulation. - player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); - player.heldProj = Projectile.whoAmI; - player.itemTime = 2; - player.itemAnimation = 2; - } - - public void HandleAttachmentMovement(Player player, Vector2 playerRotatedPoint) - { - float speed = 1f; - if (player.ActiveItem().shoot == Projectile.type) - { - speed = player.ActiveItem().shootSpeed * Projectile.scale; - } - - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Vector2 newVelocity = (Main.MouseWorld - playerRotatedPoint).SafeNormalize(Vector2.UnitX * player.direction) * speed; - - // Sync if a velocity component changes. - if (Projectile.velocity.X != newVelocity.X || Projectile.velocity.Y != newVelocity.Y) - { - Projectile.netUpdate = true; - } - Projectile.velocity = newVelocity; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), YanmeisKnife.DebuffDuration); - if (!Main.dedServ) - { - for (int i = 0; i < 60; i++) - { - Dust dust = Dust.NewDustDirect(Main.player[Projectile.owner].position, Main.player[Projectile.owner].width, Main.player[Projectile.owner].height, DustID.RainbowMk2); - dust.position.X += Main.rand.NextFloat(-16f, 16f); - dust.color = Main.hslToRgb(Main.rand.NextFloat(0.26f, 0.37f), 1f, 0.75f); - dust.velocity = Main.rand.NextVector2Circular(24f, 24f); - dust.scale = Main.rand.NextFloat(1.4f, 1.8f); - dust.noGravity = true; - } - } - if (Projectile.ai[0] == 0f) - { - SoundEngine.PlaySound(YanmeisKnife.HitSound, Projectile.position); - Projectile.ai[0] = 1f; - } - Main.player[Projectile.owner].AddBuff(ModContent.BuffType(), YanmeisKnife.BoostDuration); - } - public override Color? GetAlpha(Color lightColor) => new Color(0, 215, 0, 0); - } -} diff --git a/Projectiles/Typeless/YanmeisKnifeSlash.png b/Projectiles/Typeless/YanmeisKnifeSlash.png deleted file mode 100644 index e0b03d728c..0000000000 Binary files a/Projectiles/Typeless/YanmeisKnifeSlash.png and /dev/null differ diff --git a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs b/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs deleted file mode 100644 index dcc0ff7262..0000000000 --- a/Projectiles/VanillaProjectileOverrides/ChlorophyteCrystalAI.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System; -using CalamityMod.Items.VanillaArmorChanges; -using CalamityMod.Projectiles.Typeless; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.GameContent; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.VanillaProjectileOverrides -{ - public static class ChlorophyteCrystalAI - { - public static bool DoChlorophyteCrystalAI(Projectile projectile) - { - Player owner = Main.player[projectile.owner]; - ref float timer = ref projectile.ai[1]; - - timer++; - projectile.aiStyle = -1; - if (!owner.crystalLeaf) - { - projectile.Kill(); - return false; - } - - // Stay above the player. - projectile.Center = owner.Center + Vector2.UnitY * (owner.gfxOffY - 60f); - if (Main.player[projectile.owner].gravDir == -1f) - { - projectile.position.Y += 120f; - projectile.rotation = MathHelper.Pi; - } - else - projectile.rotation = 0f; - projectile.Center = projectile.Center.Floor(); - - // Disable hardcoded spaghetti that fires crystal shots in vanilla code. - owner.petalTimer = 2; - - // Have a periodically pulsing scale. - projectile.scale = MathHelper.Lerp(0.9f, 1.15f, (float)Math.Sin(timer / 27f) * 0.5f + 0.5f); - - // Emit life pulses periodically. - NPC potentialTarget = projectile.Center.ClosestNPCAt(560f, true, true); - bool ownerNotFullHealth = owner.statLife < owner.statLifeMax2; - bool willFirePulses = (potentialTarget is not null) || ownerNotFullHealth; - if (timer % ChlorophyteArmorSetChange.PulseReleaseRate == ChlorophyteArmorSetChange.PulseReleaseRate - 1f && willFirePulses) - { - if (Main.myPlayer == projectile.owner) - { - int pulseDamage = (int)owner.GetBestClassDamage().ApplyTo(ChlorophyteArmorSetChange.BaseDamageToEnemies); - - Projectile.NewProjectile(projectile.GetSource_FromThis(), projectile.Center, Vector2.Zero, ModContent.ProjectileType(), pulseDamage, 0f, projectile.owner); - } - } - - return false; - } - - public static void DoChlorophyteCrystalDrawing(Projectile projectile) - { - // Why doesn't this work? How does one access the texture path of a vanilla projectile? Left bugged for someone else to figure out :) - // It's me. I was that someone - Dominic - // TextureAssets is the answer, along with Main.instance.LoadProjectile(projID), to ensure that the texture is loaded into memory. - // In this instance, however, that should happen already on vanilla's end. - Texture2D texture = TextureAssets.Projectile[projectile.type].Value; - Vector2 drawPosition = projectile.Center - Main.screenPosition; - Vector2 origin = texture.Size() * 0.5f; - - float backglowColorInterpolant = MathHelper.Lerp(0.44f, 0.88f, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.1f) * 0.5f + 0.5f); - Color backglowColor = Color.Lerp(Color.Cyan, Color.Lime, backglowColorInterpolant) * 0.37f; - backglowColor.A = 0; - for (int i = 0; i < 8; i++) - { - Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 3f; - Main.EntitySpriteDraw(texture, drawPosition + drawOffset, null, projectile.GetAlpha(backglowColor), projectile.rotation, origin, projectile.scale, 0, 0); - } - - Main.EntitySpriteDraw(texture, drawPosition, null, projectile.GetAlpha(Color.White * 0.75f), projectile.rotation, origin, projectile.scale, 0, 0); - } - } -} diff --git a/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs b/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs index b79ed81667..16c95c9c77 100644 --- a/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs +++ b/Projectiles/VanillaProjectileOverrides/ImpMinionAI.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides private static float EnemyDistanceDetection { get => Target is null ? MinEnemyDistanceDetection : MaxEnemyDistanceDetection; } - private const int FireRate = 75; + private const int FireRate = 60; private const float ProjectileVelocity = 20f; private static NPC Target { get; set; } @@ -36,7 +36,7 @@ namespace CalamityMod.Projectiles.VanillaProjectileOverrides shootTimer += Main.rand.NextBool(20) ? 2 : 1; if (shootTimer >= FireRate && proj.owner == Main.myPlayer) { - Vector2 toTargetDirection = CalamityUtils.CalculatePredictiveAimToTarget(proj.Center, Target, ProjectileVelocity); + Vector2 toTargetDirection = Utils.DirectionTo(proj.Center, Target.Center) * ProjectileVelocity; Projectile fireball = Projectile.NewProjectileDirect(proj.GetSource_FromThis(), proj.Center, diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json index a505707137..10114472bb 100644 --- a/Properties/launchSettings.json +++ b/Properties/launchSettings.json @@ -1,26 +1,14 @@ { "profiles": { - "Terraria Client (dotnet)": { + "Terraria": { "commandName": "Executable", - "executablePath": "dotnet", + "executablePath": "$(DotNetName)", "commandLineArgs": "$(tMLPath)", "workingDirectory": "$(tMLSteamPath)" }, - "Terraria Server (dotnet)": { + "TerrariaServer": { "commandName": "Executable", - "executablePath": "dotnet", - "commandLineArgs": "$(tMLServerPath)", - "workingDirectory": "$(tMLSteamPath)" - }, - "Terraria Client (dotnet.exe)": { - "commandName": "Executable", - "executablePath": "dotnet.exe", - "commandLineArgs": "$(tMLPath)", - "workingDirectory": "$(tMLSteamPath)" - }, - "Terraria Server (dotnet.exe)": { - "commandName": "Executable", - "executablePath": "dotnet.exe", + "executablePath": "$(DotNetName)", "commandLineArgs": "$(tMLServerPath)", "workingDirectory": "$(tMLSteamPath)" } diff --git a/README.md b/README.md index 9ae12d6b43..fe22891c7f 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - [Steam Workshop](https://calamitymod.com/download/) - [Discord](https://discord.gg/calamity) - [Official Wiki](https://calamitymod.wiki.gg/) -- [Patreon](https://patreon.com/fabsol) +- [Patreon](https://patreon.com/CalamityMod) The Calamity Mod is a vast content mod for Terraria which adds dozens of bosses and thousands of items to create an intense and varied experience. The mod must be installed using [tModLoader](https://github.com/tModLoader/tModLoader). diff --git a/Rarities/BurnishedAuric.cs b/Rarities/BurnishedAuric.cs new file mode 100644 index 0000000000..fd88890cf7 --- /dev/null +++ b/Rarities/BurnishedAuric.cs @@ -0,0 +1,131 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; + +namespace CalamityMod.Rarities +{ + public class BurnishedAuric : ModRarity + { + // Burnished Auric is Rarity 15 (Once was known as Violet) + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(48, 33, 4, 0); + public static Color TextClr = new Color(157, 110, 11, 50); + static float lastFlashTime = 0f; + static bool isFlashing = false; + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + float flashChance = 0.005f; // Low chance per frame + float flashDuration = 0.2f; // Flash lasts ~0.2 seconds + + if (Main.GameUpdateCount - lastFlashTime > flashDuration * 60) + { + if (Main.rand.NextFloat() < flashChance) + { + isFlashing = true; + lastFlashTime = Main.GameUpdateCount; + } + else + { + isFlashing = false; + } + } + var fontSize = font.MeasureString(text); + var center = fontSize / 2.0f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + + float pulsing = 1.5f + (float)Math.Sin(time * 5f); + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + ChatManager.DrawColorCodedString( + spriteBatch, font, text, + new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi), + textColor * 0.5f, rotation, origin, baseScale); + if (isFlashing && CalamityClientConfig.Instance.TextEffects) + origin += Main.rand.NextVector2Circular(2f, 1.2f); // Small shake + } + + if (isFlashing) + { + textColor = new Color(0, 183, 241, 50); + lightColor = new Color(14, 255, 255, 50); + } + + textColor.A = 255; + + // Shadow + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + // Outline base + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), new Color(77, 0, 33), rotation, origin, baseScale); + + float shineWidth = 40f; //set to charSize + float shineSpeed = 80f; + + float shineDisp = time * shineSpeed; //predicted current location of the shine based on the time and speed + float shinePos = (shineDisp % (fontSize.X + shineWidth)); + + Vector2 basePos = new Vector2(X, Y); + if (isFlashing && CalamityClientConfig.Instance.TextEffects) + basePos += Main.rand.NextVector2Circular(3f, 10f); // Small shake + + float charOffsetX = 0f; + if (!renderTextSparkles) + return; + for (int i = 0; i < text.Length; i++) + { + string c = text[i].ToString(); + Vector2 charSize = font.MeasureString(c); + Vector2 charOrigin = charSize * 0.5f; + + Vector2 charPos = basePos + new Vector2(charOffsetX, 0f); + + float centerX = charPos.X + (charSize.X * baseScale.X) / 2f + 10.5f; + float dist = Math.Abs(centerX - (X + shinePos - shineWidth * 0.15f)); + float intensity = 1f - MathHelper.Clamp(dist / shineWidth, 0f, 1f); + + if (intensity > 0f) + { + Color shineColor = isFlashing ? new Color(90, 207, 255) * intensity * 2f : new Color(254, 231, 117) * intensity * 1f; + ChatManager.DrawColorCodedString( + spriteBatch, font, c, charPos, shineColor, rotation, origin, baseScale); + } + + charOffsetX += charSize.X - text.Length * 0.0085f; + } + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + + // TODO: Add a cooler alternative for reforge rarities + /*public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + };*/ + } +} diff --git a/Rarities/CalamityRed.cs b/Rarities/CalamityRed.cs index 3b47a6ab63..d952117f9a 100644 --- a/Rarities/CalamityRed.cs +++ b/Rarities/CalamityRed.cs @@ -1,5 +1,15 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; namespace CalamityMod.Rarities { @@ -8,14 +18,120 @@ namespace CalamityMod.Rarities // Calamity Red is Rarity 17 // This rarity should never be assigned to any items. // It is the equivalent of vanilla's Purple rarity (11): only used for positive reforges on top-rarity items. - public override Color RarityColor => new Color(163, 25, 26); // #A3191A - // (139, 0, 0) is the classic donator item color + //public override Color RarityColor => new Color(163, 25, 26); // #A3191A + // // (139, 0, 0) is the classic donator item color - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(180, 20, 75, 0); + public static Color TextClr = new Color(242, 27, 27, 255); + + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) { - -2 => ModContent.RarityType(), + var crystalTextGlow = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value; + var sparkle = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value; + var fontSize = font.MeasureString(text); + var center = fontSize / 2f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + float pulsing = 10f + (float)Math.Sin(time * 20f); + float baseScalePulse = 1.03f; + float flameHeight = 5f; + float distortionAmount = 2f; + + if (renderTextSparkles) + + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + float angle = f + (time * 2f % MathHelper.TwoPi); + + float distortion = (float)Math.Sin((Y + f * 100f + time * 20f) * 0.05f) * distortionAmount; + + Vector2 offset = new Vector2( + (float)Math.Cos(angle) * pulsing * 0.4f + distortion, + -(float)Math.Abs((float)Math.Sin(angle)) * flameHeight + ); + + float scaleVariation = 0.95f + 0.05f * (float)Math.Sin(time * 15f + f * 2f); + Vector2 scale = new Vector2(baseScalePulse * scaleVariation); + + Color flameLayerColor = new Color( + (int)(textColor.R * 0.5f), + (int)(textColor.G * 0.5f), + (int)(textColor.B * 0.5f), + (int)(textColor.A * 0.5f) + ); + + ChatManager.DrawColorCodedString( + spriteBatch, + font, + text, + new Vector2(X, Y) + offset, + flameLayerColor, + rotation, + origin, + scale + ); + } + + // Draw crisp center text + ChatManager.DrawColorCodedString( + spriteBatch, + font, + text, + new Vector2(X, Y), + textColor, + rotation, + origin, + new Vector2(baseScalePulse) + ); + + textColor.A = 255; + + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f); + + spriteBatch.Draw(crystalTextGlow, glowPosition, null, lightColor, rotation + MathHelper.PiOver2, new Vector2(6f, 33f), + new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f); + + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), Color.Black, rotation, origin, baseScale); + + // Is this a scrapped visual feature of the rarity? + /*int sparkleCount = Main.rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1; + var color2 = lightColor * 1.00f; + color2.A = 0; + var sparkleOrigin = new Vector2(15f, 15f); + for (int i = 0; i < sparkleCount; i++) + { + var v = new Vector2(Main.rand.NextFloat(fontSize.X), Main.rand.NextFloat(fontSize.Y * 0.6f) + 1f); + float lifeTime = Main.GlobalTimeWrappedHourly * 4f + Main.rand.NextFloat(MathHelper.TwoPi * 7f); + lifeTime %= MathHelper.TwoPi * 1f; + }*/ + + return; + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + + // TODO: Add a cooler alternative for reforge rarities + /*public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), -1 => ModContent.RarityType(), _ => Type, - }; + };*/ } } diff --git a/Rarities/ColorTool.cs b/Rarities/ColorTool.cs new file mode 100644 index 0000000000..ca16bd0a20 --- /dev/null +++ b/Rarities/ColorTool.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Rarities +{ + public sealed class ColorTool : GlobalItem + { + public static int RarityCosmicPurple => ModContent.GetInstance().Type; + public static int RarityBurnishedAuric => ModContent.GetInstance().Type; + public static int RarityCalamityRed => ModContent.GetInstance().Type; + + + public override bool PreDrawTooltipLine(Item Item, DrawableTooltipLine line, ref int yOffset) + { + if (line.Mod == "Terraria" && line.Name == "ItemName") + { + if (Item.rare == RarityCosmicPurple) + { + CosmicPurple.Draw(Item, line); + return false; + } + if (Item.rare == RarityBurnishedAuric) + { + BurnishedAuric.Draw(Item, line); + return false; + } + if (Item.rare == RarityCalamityRed) + { + CalamityRed.Draw(Item, line); + return false; + } + } + return true; + } + public static Color colorLerps(Color[] colors, float time) + { + int index = (int)time; + return Color.Lerp(colors[index % colors.Length], colors[(index + 1) % colors.Length], time % 1f); + } + + public static Color Rainbowing(float position) => colorLerps( + [ new Color(255, 50, 50, 255), new Color(255, 128, 50, 255), new Color(230, 255, 50, 255), new Color(80, 255, 60, 255), + new Color(50, 80, 250, 255), new Color(200, 50, 250, 255), new Color(255, 50, 230, 255), ], position); + } +} diff --git a/Rarities/CosmicPurple.cs b/Rarities/CosmicPurple.cs new file mode 100644 index 0000000000..a30636dfdc --- /dev/null +++ b/Rarities/CosmicPurple.cs @@ -0,0 +1,118 @@ +using System; +using CalamityMod.Items; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria.GameContent; +using Terraria.Localization; +using Terraria; +using Terraria.ModLoader; +using Terraria.UI.Chat; +using Terraria.Utilities; +using Terraria.ID; + +namespace CalamityMod.Rarities +{ + public class CosmicPurple : ModRarity + { + // Cosmic Purple is Rarity 14 (once was known as Dark Blue) + public override Color RarityColor => TextClr * 2f; + + public static float MaxY = 4.5f; + public static Color BloomClr = new Color(65, 38, 87, 0); + public static Color TextClr = new Color(103, 66, 138, 255); + + public static void Draw(Item Item, SpriteBatch spriteBatch, string text, int X, int Y, Color textColor, Color lightColor, float rotation, + Vector2 origin, Vector2 baseScale, float time, bool renderTextSparkles, DynamicSpriteFont font) + { + var crystalTextGlow = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextGlow").Value; + var sparkle = ModContent.Request("CalamityMod/ExtraTextures/UI/CrystalTextSparkle").Value; + var fontSize = font.MeasureString(text); + var center = fontSize / 2f; + + var glowPosition = new Vector2(X + center.X, Y + center.Y / 1.5f); + textColor.A = 0; + float pulsing = 2.5f + (float)Math.Sin(time * 5f); + for (float f = 0f; f < MathHelper.TwoPi; f += 0.79f) + { + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y) + new Vector2(pulsing, 0f).RotatedBy(f + time * 2f % MathHelper.TwoPi), textColor * 0.5f, rotation, origin, baseScale); + } + + textColor.A = 255; + + ChatManager.DrawColorCodedStringShadow(spriteBatch, font, text, new Vector2(X, Y), textColor * 2f, rotation, origin, baseScale); + + var bloomColor = ColorTool.Rainbowing(time * 4 - 0.9f); + + spriteBatch.Draw(crystalTextGlow, glowPosition, null, lightColor, rotation + MathHelper.PiOver2, new Vector2(6f, 33f), + new Vector2(1.6f, fontSize.X / crystalTextGlow.Height * 1.2f), SpriteEffects.None, 0f); + + ChatManager.DrawColorCodedString(spriteBatch, font, text, new Vector2(X, Y), Color.Black, rotation, origin, baseScale); + + if (!renderTextSparkles) + return; + + // This is very expensive, however using Main.rand makes the sparkles incredibly jittery so I am just going to leave it for now + var rand = new UnifiedRandom(Main.LocalPlayer.name.GetHashCode() + (int)(center.X + center.Y)); + + int sparkleCount = rand.Next((int)fontSize.X / 7, (int)fontSize.X / 5) + 1; + var color2 = lightColor; + color2.A = 0; + var sparkleOrigin = new Vector2(15f, 15f); + for (int i = 0; i < sparkleCount; i++) + { + var v = new Vector2(rand.NextFloat(fontSize.X), rand.NextFloat(fontSize.Y * 0.6f) + 1f); + float lifeTime = Main.GlobalTimeWrappedHourly * 4f + rand.NextFloat(MathHelper.TwoPi); + lifeTime %= MathHelper.TwoPi; + + if (lifeTime > MathHelper.TwoPi) + continue; + + float sinValue = (float)Math.Sin(lifeTime); + var white = new Color(200 + lightColor.R / 20, 200 + lightColor.G / 20, 200 + lightColor.B / 20, 255) * sinValue; + + float sparkleRotationSpeed = Main.rand.NextFloat(0.8f, 1.5f); // Unique rotation rate per sparkle + float sparkleRotation = time * sparkleRotationSpeed; + + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 3f) + v, null, white, sparkleRotation, sparkleOrigin, + lifeTime / MathHelper.TwoPi * 0.3f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, white * 0.5f, sparkleRotation, sparkleOrigin, + lifeTime / MathHelper.TwoPi, SpriteEffects.None, 0f); + + var scale2 = (float)Math.Sin(lifeTime / MathHelper.PiOver2) + 1f; + var scale3 = lifeTime / MathHelper.TwoPi; + + scale2 *= 0.2f; + scale3 *= 0.15f; + + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale3, scale3) * 1.5f, SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale2, scale3), SpriteEffects.None, 0f); + spriteBatch.Draw(sparkle, new Vector2(X, Y - lifeTime * MaxY + 2f) + v, null, color2 * sinValue, sparkleRotation, sparkleOrigin, + new Vector2(scale3, scale2), SpriteEffects.None, 0f); + } + } + + public static void Draw(Item Item, string text, int X, int Y, float rotation, Vector2 origin, Vector2 baseScale, Color? textColor = null, Color? lightColor = null, bool? renderTextSparkles = null) + { + Draw(Item, Main.spriteBatch, text, X, Y, Colors.AlphaDarken(textColor ?? TextClr), lightColor ?? BloomClr, rotation, origin, baseScale, Main.GlobalTimeWrappedHourly, + renderTextSparkles ?? CalamityClientConfig.Instance.TextEffects, FontAssets.MouseText.Value); + } + + public static void Draw(Item Item, DrawableTooltipLine line) + { + Draw(Item, line.Text, line.X, line.Y, line.Rotation, line.Origin, line.BaseScale); + } + + // TODO: Add a cooler alternative for reforge rarities + /*public override int GetPrefixedRarity(int offset, float valueMult) => offset switch + { + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), + 1 => ModContent.RarityType(), + 2 => ModContent.RarityType(), + _ => Type, + };*/ + } +} diff --git a/Rarities/DarkBlue.cs b/Rarities/DarkBlue.cs deleted file mode 100644 index 02b431036f..0000000000 --- a/Rarities/DarkBlue.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Rarities -{ - public class DarkBlue : ModRarity - { - // Dark Blue is Rarity 14 - public override Color RarityColor => new Color(43, 96, 222); - - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } -} diff --git a/Rarities/HotPink.cs b/Rarities/HotPink.cs index 28258729a5..b3451e2f2d 100644 --- a/Rarities/HotPink.cs +++ b/Rarities/HotPink.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Rarities public override int GetPrefixedRarity(int offset, float valueMult) => offset switch { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), + -2 => ModContent.RarityType(), + -1 => ModContent.RarityType(), 1 => ModContent.RarityType(), 2 => ModContent.RarityType(), _ => Type, diff --git a/Rarities/PureGreen.cs b/Rarities/PureGreen.cs index 5b682682a2..5752ae8335 100644 --- a/Rarities/PureGreen.cs +++ b/Rarities/PureGreen.cs @@ -13,9 +13,7 @@ namespace CalamityMod.Rarities { -2 => ItemRarityID.Purple, -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, + _ => Type, // Cannot reach Cosmic Purple or Burnished Auric }; } } diff --git a/Rarities/Turquoise.cs b/Rarities/Turquoise.cs index 2117b067d9..27428d0c1a 100644 --- a/Rarities/Turquoise.cs +++ b/Rarities/Turquoise.cs @@ -14,7 +14,7 @@ namespace CalamityMod.Rarities -2 => ItemRarityID.Red, -1 => ItemRarityID.Purple, 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), + 2 => ModContent.RarityType(), // Cannot reach Cosmic Purple _ => Type, }; } diff --git a/Rarities/Violet.cs b/Rarities/Violet.cs deleted file mode 100644 index e5b468f021..0000000000 --- a/Rarities/Violet.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria.ModLoader; - -namespace CalamityMod.Rarities -{ - public class Violet : ModRarity - { - // Violet is Rarity 15 - public override Color RarityColor => new Color(108, 45, 199); - - public override int GetPrefixedRarity(int offset, float valueMult) => offset switch - { - -2 => ModContent.RarityType(), - -1 => ModContent.RarityType(), - 1 => ModContent.RarityType(), - 2 => ModContent.RarityType(), - _ => Type, - }; - } -} diff --git a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs index 5b7ee0d578..af0ca2e3bb 100644 --- a/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs +++ b/Scenes/BossBackgroundScenes/DrunkCrabBackgroundScene.cs @@ -13,31 +13,9 @@ namespace CalamityMod.Systems public override bool IsSceneEffectActive(Player player) { - // Case 1: Zenith Seed Crabulon. if (Main.zenithWorld && NPC.AnyNPCs(ModContent.NPCType())) return true; - - // Case 2: Supreme Cirrus BH5. - bool cirrusSpecialAttack = false; - - // Try to find Supreme Cirrus, if she exists. She might not. - try - { - // Is there an index reference to Supreme Calamitas/Cirrus available? Is it valid? I sure hope so. Thanks TML - if (CalamityGlobalNPC.SCal >= 0 && CalamityGlobalNPC.SCal < Main.maxNPCs && Main.npc[CalamityGlobalNPC.SCal].active) - { - NPC npc = Main.npc[CalamityGlobalNPC.SCal]; - SupremeCalamitas supremeSomeone = npc.ModNPC(); - cirrusSpecialAttack = supremeSomeone is not null && supremeSomeone.cirrus && supremeSomeone.gettingTired5; - } - } - catch - { - if (Main.netMode == NetmodeID.SinglePlayer) - Main.NewText("Supreme Cirrus code attempted to crash the game. Did you do something weird?"); - } - - return cirrusSpecialAttack; + return false; } public override void SpecialVisuals(Player player, bool isActive) diff --git a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs index c9689876c6..8c0337b7be 100644 --- a/Scenes/MusicScenes/AquaticScourgeMusicScene.cs +++ b/Scenes/MusicScenes/AquaticScourgeMusicScene.cs @@ -1,6 +1,7 @@ using CalamityMod.Events; using CalamityMod.NPCs; using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.World; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -20,7 +21,7 @@ namespace CalamityMod.Systems { if (CalamityGlobalNPC.aquaticScourge == -1) return false; - return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.getGoodWorld; + return Main.npc[CalamityGlobalNPC.aquaticScourge].justHit || Main.npc[CalamityGlobalNPC.aquaticScourge].life <= Main.npc[CalamityGlobalNPC.aquaticScourge].lifeMax * 0.999 || BossRushEvent.BossRushActive || Main.zenithWorld; } } } diff --git a/Scenes/MusicScenes/DragonfollyMusicScene.cs b/Scenes/MusicScenes/DragonfollyMusicScene.cs index b005c124a8..ae42983e18 100644 --- a/Scenes/MusicScenes/DragonfollyMusicScene.cs +++ b/Scenes/MusicScenes/DragonfollyMusicScene.cs @@ -9,7 +9,7 @@ namespace CalamityMod.Systems { public override SceneEffectPriority Priority => SceneEffectPriority.BossMedium; - public override int NPCType => ModContent.NPCType(); + public override int NPCType => ModContent.NPCType(); public override int? MusicModMusic => CalamityMod.Instance.GetMusicFromMusicMod("Dragonfolly"); public override int VanillaMusic => MusicID.Boss4; public override int OtherworldMusic => MusicID.OtherworldlyBoss2; diff --git a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs b/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs deleted file mode 100644 index e5597c0d2e..0000000000 --- a/Scenes/MusicScenes/SkeletronPrimeMasterMusicScene.cs +++ /dev/null @@ -1,14 +0,0 @@ -using CalamityMod.World; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems -{ - public class SkeletronPrimeMasterMusicScene : ModSceneEffect - { - public override int Music => MusicID.Boss3; // I spent 20 minutes trying to get this music to play while forgetting to actually override this in the first place _ YuH - public override SceneEffectPriority Priority => SceneEffectPriority.BossLow; - public override bool IsSceneEffectActive(Player player) => CalamityWorld.death && NPC.AnyNPCs(NPCID.SkeletronPrime) && Main.npc[NPC.FindFirstNPC(NPCID.SkeletronPrime)].Distance(player.Center) <= 525f * 16f; - } -} diff --git a/Schematics/SchematicManager.cs b/Schematics/SchematicManager.cs index f6b72244b5..0f52794ac9 100644 --- a/Schematics/SchematicManager.cs +++ b/Schematics/SchematicManager.cs @@ -13,6 +13,9 @@ namespace CalamityMod.Schematics { public sealed class SchematicManager : ModSystem { + internal const string ShimmerShrineKey = "Shimmer Shrine Key"; + internal const string ShimmerShrineFilename = "Schematics/Shimmer_Shrine.csch"; + internal const string BrimstoneAtriumType1Key = "Brimstone Atrium Type 1 Key"; internal const string BrimstoneAtriumType1Filename = "Schematics/Brimstone_Atrium1.csch"; @@ -166,6 +169,9 @@ namespace CalamityMod.Schematics PilePlacementMaps = new Dictionary(); TileMaps = new Dictionary { + // Shimmer Shrine + [ShimmerShrineKey] = CalamitySchematicIO.LoadSchematic(ShimmerShrineFilename), + // Underworld structures [BrimstoneAtriumType1Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType1Filename), [BrimstoneAtriumType2Key] = CalamitySchematicIO.LoadSchematic(BrimstoneAtriumType2Filename), diff --git a/Schematics/Shimmer_Shrine.csch b/Schematics/Shimmer_Shrine.csch new file mode 100644 index 0000000000..91c2def6a4 Binary files /dev/null and b/Schematics/Shimmer_Shrine.csch differ diff --git a/Skies/DrunkCrabScreenShaderData.cs b/Skies/DrunkCrabScreenShaderData.cs index 2d67cb7706..922f635755 100644 --- a/Skies/DrunkCrabScreenShaderData.cs +++ b/Skies/DrunkCrabScreenShaderData.cs @@ -13,7 +13,6 @@ namespace CalamityMod.Skies public class DrunkCrabScreenShaderData : ScreenShaderData { public int CrabIndex; - public int CirrusIndex; public DrunkCrabScreenShaderData(string passName) : base(passName) @@ -23,98 +22,28 @@ namespace CalamityMod.Skies public void UpdateBossIndex() { int CrabType = ModContent.NPCType(); - int CirrusType = ModContent.NPCType(); - bool shouldCheckForCirrus = false; - bool shouldForceDeactivateCirrusShader = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - { - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - shouldForceDeactivateCirrusShader = Main.npc[CalamityGlobalNPC.SCal].ModNPC().giveUpCounter <= 1; - } - } - } + if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) + return; - if (shouldCheckForCirrus) - { - if (CirrusIndex >= 0 && Main.npc[CirrusIndex].active && Main.npc[CirrusIndex].type == CirrusType && !shouldForceDeactivateCirrusShader) - return; - - CirrusIndex = -1; - - if (!shouldForceDeactivateCirrusShader) - { - CirrusIndex = NPC.FindFirstNPC(CirrusType); - } - } - else - { - if (CrabIndex >= 0 && Main.npc[CrabIndex].active && Main.npc[CrabIndex].type == CrabType) - return; - - CrabIndex = NPC.FindFirstNPC(CrabType); - } + CrabIndex = NPC.FindFirstNPC(CrabType); } public override void Update(GameTime gameTime) { - bool shouldCheckForCirrus = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - } - } - - if (shouldCheckForCirrus) - { - if (CirrusIndex == -1) - { - UpdateBossIndex(); - if (CirrusIndex == -1) - Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); - } - } - else + if (CrabIndex == -1 || !Main.zenithWorld) { + UpdateBossIndex(); if (CrabIndex == -1 || !Main.zenithWorld) - { - UpdateBossIndex(); - if (CrabIndex == -1 || !Main.zenithWorld) - Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); - } - } + Filters.Scene["CalamityMod:DrunkCrabulon"].Deactivate(); + } } public override void Apply() { UpdateBossIndex(); - bool shouldCheckForCirrus = false; - if (CalamityGlobalNPC.SCal != -1) - { - if (Main.npc[CalamityGlobalNPC.SCal].active) - { - if (Main.npc[CalamityGlobalNPC.SCal].ModNPC().cirrus) - shouldCheckForCirrus = Main.npc[CalamityGlobalNPC.SCal].ModNPC().gettingTired5; - } - } - - if (shouldCheckForCirrus) - { - if (CirrusIndex != -1) - UseTargetPosition(Main.npc[CirrusIndex].Center); - } - else - { - if (CrabIndex != -1) - UseTargetPosition(Main.npc[CrabIndex].Center); - } + if (CrabIndex != -1) + UseTargetPosition(Main.npc[CrabIndex].Center); base.Apply(); } diff --git a/Skies/SCalScreenShaderData.cs b/Skies/SCalScreenShaderData.cs index 1e562f1683..92ca7f0082 100644 --- a/Skies/SCalScreenShaderData.cs +++ b/Skies/SCalScreenShaderData.cs @@ -44,8 +44,8 @@ namespace CalamityMod.Skies { UseTargetPosition(Main.npc[SCalIndex].Center); - if (Main.npc[SCalIndex].ModNPC().cirrus) - Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.9f, 0.3f, 0.9f); + if (Main.npc[SCalIndex].ModNPC().permafrost) + Filters.Scene["CalamityMod:SupremeCalamitas"].GetShader().UseColor(0.3f, 0.6f, 0.9f); } base.Apply(); } diff --git a/Skies/SCalSky.cs b/Skies/SCalSky.cs index 8f47be8370..d961e9a597 100644 --- a/Skies/SCalSky.cs +++ b/Skies/SCalSky.cs @@ -140,7 +140,7 @@ namespace CalamityMod.Skies return Color.Transparent; NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - bool cirrus = scal.ModNPC().cirrus; + bool permafrost = scal.ModNPC().permafrost; float lifeRatio = scal.life / (float)scal.lifeMax; if (NPC.AnyNPCs(ModContent.NPCType()) == true && NPC.AnyNPCs(ModContent.NPCType()) == false) @@ -151,11 +151,11 @@ namespace CalamityMod.Skies return Color.Lerp(Color.Red, Color.IndianRed, Main.rand.NextFloat(0f, 1f)); if (lifeRatio > 0.5f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.DarkCyan : Color.Crimson, Main.rand.NextFloat(0f, 1f)); else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) - return Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); else if (lifeRatio > 0.01f) - return Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); + return Color.Lerp(permafrost ? Color.LightBlue : Color.Red, permafrost ? Color.MediumBlue : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else return Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0f, 0.65f)); } @@ -253,15 +253,15 @@ namespace CalamityMod.Skies } NPC scal = Main.npc[CalamityGlobalNPC.SCal]; - bool cirrus = scal.ModNPC().cirrus; + bool permafrost = scal.ModNPC().permafrost; float lifeRatio = scal.life / (float)scal.lifeMax; if (lifeRatio > 0.5f) - cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Violet : Color.Crimson, Main.rand.NextFloat(0f, 1f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.MediumBlue : Color.Crimson, Main.rand.NextFloat(0f, 1f)); else if (lifeRatio > 0.3f || scal.ModNPC().postMusicHit == false) - cinderColortoBe = Color.Lerp(cirrus ? Color.Cyan : Color.Red, cirrus ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.DarkCyan : Color.Magenta, Main.rand.NextFloat(0f, 0.7f)); else if (lifeRatio > 0.01f) - cinderColortoBe = Color.Lerp(cirrus ? Color.Pink : Color.Red, cirrus ? Color.Green : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); + cinderColortoBe = Color.Lerp(permafrost ? Color.Cyan : Color.Red, permafrost ? Color.DarkTurquoise : Color.Yellow, Main.rand.NextFloat(0f, 0.88f)); else cinderColortoBe = Color.Lerp(Color.Gray, Color.White, Main.rand.NextFloat(0.8f)); diff --git a/Sounds/CommonCalamitySounds.cs b/Sounds/CommonCalamitySounds.cs index fd0f455921..ce89a487ea 100644 --- a/Sounds/CommonCalamitySounds.cs +++ b/Sounds/CommonCalamitySounds.cs @@ -4,58 +4,35 @@ namespace CalamityMod.Sounds { public static class CommonCalamitySounds { - public static readonly SoundStyle ExoHitSound = new("CalamityMod/Sounds/NPCHit/ExoHit", 4) { Volume = 0.4f }; - - public static readonly SoundStyle ExoDeathSound = new("CalamityMod/Sounds/NPCKilled/ExoDeath") { MaxInstances = 1 }; - - public static readonly SoundStyle OtherwordlyHitSound = new("CalamityMod/Sounds/NPCHit/OtherworldlyHit"); - + public static readonly SoundStyle AstralNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/AstralEnemyDeath") { Volume = 0.7f }; public static readonly SoundStyle AstralNPCHitSound = new("CalamityMod/Sounds/NPCHit/AstralEnemyHit", 3); - public static readonly SoundStyle AstralNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/AstralEnemyDeath") { Volume = 0.7f }; - public static readonly SoundStyle WulfrumNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/WulfrumDeath"); - - public static readonly SoundStyle PlagueBoomSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); - - public static readonly SoundStyle WyrmScreamSound = new("CalamityMod/Sounds/Custom/WyrmScream"); - - public static readonly SoundStyle LightningSound = new("CalamityMod/Sounds/Custom/LightningStrike") { Volume = 1.6f }; //This is just the regular SoundID.Thunder sound, except its only the first variant - - public static readonly SoundStyle LightningTelegraph = new("CalamityMod/Sounds/Custom/LightningTelegraph") { Volume = 0.7f }; //This is just the regular SoundID.Thunder sound, except its only the fifth variant - - public static readonly SoundStyle LaserCannonSound = new("CalamityMod/Sounds/Item/LaserCannon") { Volume = 0.85f }; - public static readonly SoundStyle ELRFireSound = new("CalamityMod/Sounds/Item/ELRFire"); //What does ELR stand for - + public static readonly SoundStyle ExoDeathSound = new("CalamityMod/Sounds/NPCKilled/ExoDeath") { MaxInstances = 1 }; + public static readonly SoundStyle ExoHitSound = new("CalamityMod/Sounds/NPCHit/ExoHit", 4) { Volume = 0.4f }; public static readonly SoundStyle ExoLaserShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoLaserShoot"); - public static readonly SoundStyle ExoPlasmaExplosionSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoPlasmaExplosion", 2); - public static readonly SoundStyle ExoPlasmaShootSound = new("CalamityMod/Sounds/Custom/ExoMechs/ExoPlasmaShoot"); - public static readonly SoundStyle LargeWeaponFireSound = new("CalamityMod/Sounds/Item/LargeWeaponFire"); - - public static readonly SoundStyle GaussWeaponFire = new("CalamityMod/Sounds/Item/GaussWeaponFire"); - public static readonly SoundStyle FlareSound = new("CalamityMod/Sounds/Item/FlareSound"); - public static readonly SoundStyle PlasmaBoltSound = new("CalamityMod/Sounds/Item/PlasmaBolt") { Volume = 0.8f }; - - public static readonly SoundStyle PlasmaBlastSound = new("CalamityMod/Sounds/Item/PlasmaBlast"); + public static readonly SoundStyle LargeWeaponFireSound = new("CalamityMod/Sounds/Item/LargeWeaponFire"); + public static readonly SoundStyle LaserCannonSound = new("CalamityMod/Sounds/Item/LaserCannon") { Volume = 0.85f }; + public static readonly SoundStyle LightningSound = new("CalamityMod/Sounds/Custom/LightningStrike") { Volume = 1.6f }; // This is just the regular SoundID.Thunder sound, except its only the first variant + public static readonly SoundStyle LouderPhantomPhoenix = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix", 3); public static readonly SoundStyle MeatySlashSound = new("CalamityMod/Sounds/Custom/MeatySlash"); - public static readonly SoundStyle SwiftSliceSound = new("CalamityMod/Sounds/Custom/SwiftSlice"); + public static readonly SoundStyle PlagueBoomSound = new("CalamityMod/Sounds/Custom/PlagueSounds/PlagueBoom", 4); + public static readonly SoundStyle PlasmaBoltSound = new("CalamityMod/Sounds/Item/PlasmaBolt") { Volume = 0.8f }; + public static readonly SoundStyle PlatingMine = new("CalamityMod/Sounds/Custom/PlatingMine", 3); public static readonly SoundStyle ScissorGuillotineSnapSound = new("CalamityMod/Sounds/Custom/ScissorGuillotineSnap"); - - public static readonly SoundStyle LouderPhantomPhoenix = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix", 3); - - public static readonly SoundStyle LouderSwingWoosh = new("CalamityMod/Sounds/Custom/LoudSwingWoosh"); + public static readonly SoundStyle SwiftSliceSound = new("CalamityMod/Sounds/Custom/SwiftSlice"); public static readonly SoundStyle VoidstoneMine = new("CalamityMod/Sounds/Custom/VoidstoneMine", 3) { Volume = 0.4f }; - public static readonly SoundStyle PlatingMine = new("CalamityMod/Sounds/Custom/PlatingMine", 3); - + public static readonly SoundStyle WulfrumNPCDeathSound = new("CalamityMod/Sounds/NPCKilled/WulfrumDeath"); + public static readonly SoundStyle WyrmScreamSound = new("CalamityMod/Sounds/Custom/WyrmScream"); } } diff --git a/Sounds/Custom/AdrenalineMajorLossGFB.mp3 b/Sounds/Custom/AdrenalineMajorLossGFB.mp3 deleted file mode 100644 index b56ea7eeaf..0000000000 Binary files a/Sounds/Custom/AdrenalineMajorLossGFB.mp3 and /dev/null differ diff --git a/Sounds/Custom/AdrenalineMajorLossGFB.ogg b/Sounds/Custom/AdrenalineMajorLossGFB.ogg new file mode 100644 index 0000000000..d1175cc664 Binary files /dev/null and b/Sounds/Custom/AdrenalineMajorLossGFB.ogg differ diff --git a/Sounds/Custom/BEES/Names.txt b/Sounds/Custom/BEES/Names.txt index 25875d8fef..5645ea0a79 100644 --- a/Sounds/Custom/BEES/Names.txt +++ b/Sounds/Custom/BEES/Names.txt @@ -10,4 +10,5 @@ Names: 9 - StipulatedVenus 10 - Xyk 11 - Shade -12 - YuH \ No newline at end of file +12 - YuH +13 - ENNWAY diff --git a/Sounds/Custom/BEES/bees13.ogg b/Sounds/Custom/BEES/bees13.ogg new file mode 100644 index 0000000000..e7c35d9313 Binary files /dev/null and b/Sounds/Custom/BEES/bees13.ogg differ diff --git a/Sounds/Custom/BazookaRocket.ogg b/Sounds/Custom/BazookaRocket.ogg deleted file mode 100644 index a2c5f35447..0000000000 Binary files a/Sounds/Custom/BazookaRocket.ogg and /dev/null differ diff --git a/Sounds/Custom/BubblyBurst.ogg b/Sounds/Custom/BubblyBurst.ogg new file mode 100644 index 0000000000..3db8409d9b Binary files /dev/null and b/Sounds/Custom/BubblyBurst.ogg differ diff --git a/Sounds/Custom/CalamitasClone/BulletHellEnd.ogg b/Sounds/Custom/CalamitasClone/BulletHellEnd.ogg index 08b4e36553..99e29dd7d2 100644 Binary files a/Sounds/Custom/CalamitasClone/BulletHellEnd.ogg and b/Sounds/Custom/CalamitasClone/BulletHellEnd.ogg differ diff --git a/Sounds/Custom/CalamitasClone/BulletHellEnding.ogg b/Sounds/Custom/CalamitasClone/BulletHellEnding.ogg new file mode 100644 index 0000000000..7ed1d7c40e Binary files /dev/null and b/Sounds/Custom/CalamitasClone/BulletHellEnding.ogg differ diff --git a/Sounds/Custom/CalamitasClone/BulletHellEnding.wav b/Sounds/Custom/CalamitasClone/BulletHellEnding.wav deleted file mode 100644 index 3f54027802..0000000000 Binary files a/Sounds/Custom/CalamitasClone/BulletHellEnding.wav and /dev/null differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash1.ogg b/Sounds/Custom/CalamitasClone/CalCloneDash1.ogg new file mode 100644 index 0000000000..da889da7a9 Binary files /dev/null and b/Sounds/Custom/CalamitasClone/CalCloneDash1.ogg differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash1.wav b/Sounds/Custom/CalamitasClone/CalCloneDash1.wav deleted file mode 100644 index cbdacec6c6..0000000000 Binary files a/Sounds/Custom/CalamitasClone/CalCloneDash1.wav and /dev/null differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash2.ogg b/Sounds/Custom/CalamitasClone/CalCloneDash2.ogg new file mode 100644 index 0000000000..55cf49223d Binary files /dev/null and b/Sounds/Custom/CalamitasClone/CalCloneDash2.ogg differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash2.wav b/Sounds/Custom/CalamitasClone/CalCloneDash2.wav deleted file mode 100644 index d055df0041..0000000000 Binary files a/Sounds/Custom/CalamitasClone/CalCloneDash2.wav and /dev/null differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash3.ogg b/Sounds/Custom/CalamitasClone/CalCloneDash3.ogg new file mode 100644 index 0000000000..63bdc7ee7c Binary files /dev/null and b/Sounds/Custom/CalamitasClone/CalCloneDash3.ogg differ diff --git a/Sounds/Custom/CalamitasClone/CalCloneDash3.wav b/Sounds/Custom/CalamitasClone/CalCloneDash3.wav deleted file mode 100644 index 807f5d0303..0000000000 Binary files a/Sounds/Custom/CalamitasClone/CalCloneDash3.wav and /dev/null differ diff --git a/Sounds/Custom/EidolonWyrmRoarClose.ogg b/Sounds/Custom/EidolonWyrmRoarClose.ogg deleted file mode 100644 index 4f908dd375..0000000000 Binary files a/Sounds/Custom/EidolonWyrmRoarClose.ogg and /dev/null differ diff --git a/Sounds/Custom/GFB/SevenTrebleClefSouls.ogg b/Sounds/Custom/GFB/SevenTrebleClefSouls.ogg new file mode 100644 index 0000000000..000d511566 Binary files /dev/null and b/Sounds/Custom/GFB/SevenTrebleClefSouls.ogg differ diff --git a/Sounds/Custom/Polterghast/PolterSpook1.ogg b/Sounds/Custom/Polterghast/PolterSpook1.ogg deleted file mode 100644 index 55faa22baa..0000000000 Binary files a/Sounds/Custom/Polterghast/PolterSpook1.ogg and /dev/null differ diff --git a/Sounds/Custom/Polterghast/PolterSpook2.ogg b/Sounds/Custom/Polterghast/PolterSpook2.ogg deleted file mode 100644 index 698533a8bd..0000000000 Binary files a/Sounds/Custom/Polterghast/PolterSpook2.ogg and /dev/null differ diff --git a/Sounds/Custom/Polterghast/PolterSpook3.ogg b/Sounds/Custom/Polterghast/PolterSpook3.ogg deleted file mode 100644 index b45fca9b99..0000000000 Binary files a/Sounds/Custom/Polterghast/PolterSpook3.ogg and /dev/null differ diff --git a/Sounds/Custom/Polterghast/PolterSpook4.ogg b/Sounds/Custom/Polterghast/PolterSpook4.ogg deleted file mode 100644 index 8f7ebdb17b..0000000000 Binary files a/Sounds/Custom/Polterghast/PolterSpook4.ogg and /dev/null differ diff --git a/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg b/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg deleted file mode 100644 index 0b4c55ce85..0000000000 Binary files a/Sounds/Custom/SCalSounds/BrimstoneSkullSound.ogg and /dev/null differ diff --git a/Sounds/Custom/SCalSounds/CatastropheResonanceSlash1.ogg b/Sounds/Custom/SCalSounds/CatastropheResonanceSlash.ogg similarity index 100% rename from Sounds/Custom/SCalSounds/CatastropheResonanceSlash1.ogg rename to Sounds/Custom/SCalSounds/CatastropheResonanceSlash.ogg diff --git a/Sounds/Custom/ThunderStrike.ogg b/Sounds/Custom/ThunderStrike.ogg deleted file mode 100644 index 792f62b553..0000000000 Binary files a/Sounds/Custom/ThunderStrike.ogg and /dev/null differ diff --git a/Sounds/Custom/YanmeiKnifeExpire.ogg b/Sounds/Custom/YanmeiKnifeExpire.ogg deleted file mode 100644 index 43f93869d1..0000000000 Binary files a/Sounds/Custom/YanmeiKnifeExpire.ogg and /dev/null differ diff --git a/Sounds/Item/AugerBigSlash.ogg b/Sounds/Item/AugerBigSlash.ogg new file mode 100644 index 0000000000..d068625bfd Binary files /dev/null and b/Sounds/Item/AugerBigSlash.ogg differ diff --git a/Sounds/Item/AugerHit.ogg b/Sounds/Item/AugerHit.ogg new file mode 100644 index 0000000000..26b099ea3b Binary files /dev/null and b/Sounds/Item/AugerHit.ogg differ diff --git a/Sounds/Item/AugerPull.ogg b/Sounds/Item/AugerPull.ogg new file mode 100644 index 0000000000..24db60a049 Binary files /dev/null and b/Sounds/Item/AugerPull.ogg differ diff --git a/Sounds/Item/AugerSlash1.ogg b/Sounds/Item/AugerSlash1.ogg new file mode 100644 index 0000000000..511f3dbee1 Binary files /dev/null and b/Sounds/Item/AugerSlash1.ogg differ diff --git a/Sounds/Item/AugerSlash2.ogg b/Sounds/Item/AugerSlash2.ogg new file mode 100644 index 0000000000..d533e89a27 Binary files /dev/null and b/Sounds/Item/AugerSlash2.ogg differ diff --git a/Sounds/Item/AugerWindup.ogg b/Sounds/Item/AugerWindup.ogg new file mode 100644 index 0000000000..1264dee1c5 Binary files /dev/null and b/Sounds/Item/AugerWindup.ogg differ diff --git a/Sounds/Item/EnergyRifleFire.ogg b/Sounds/Item/EnergyRifleFire.ogg deleted file mode 100644 index 855a605b46..0000000000 Binary files a/Sounds/Item/EnergyRifleFire.ogg and /dev/null differ diff --git a/Sounds/Item/GatlingLaserFireEnd.ogg b/Sounds/Item/GatlingLaserFireEnd.ogg deleted file mode 100644 index b1f2180832..0000000000 Binary files a/Sounds/Item/GatlingLaserFireEnd.ogg and /dev/null differ diff --git a/Sounds/Item/GatlingLaserFireLoop.ogg b/Sounds/Item/GatlingLaserFireLoop.ogg deleted file mode 100644 index 85123255a8..0000000000 Binary files a/Sounds/Item/GatlingLaserFireLoop.ogg and /dev/null differ diff --git a/Sounds/Item/GatlingLaserFireStart.ogg b/Sounds/Item/GatlingLaserFireStart.ogg deleted file mode 100644 index b965fb567f..0000000000 Binary files a/Sounds/Item/GatlingLaserFireStart.ogg and /dev/null differ diff --git a/Sounds/Item/GaussWeaponFire.ogg b/Sounds/Item/GaussWeaponFire.ogg deleted file mode 100644 index e15236ce8e..0000000000 Binary files a/Sounds/Item/GaussWeaponFire.ogg and /dev/null differ diff --git a/Sounds/Item/GunShotSmallHeavy.ogg b/Sounds/Item/GunShotSmallHeavy.ogg deleted file mode 100644 index b23c4ff131..0000000000 Binary files a/Sounds/Item/GunShotSmallHeavy.ogg and /dev/null differ diff --git a/Sounds/Item/HeliumFlashReady.ogg b/Sounds/Item/HeliumFlashReady.ogg index 69bfb600bc..355124aaa7 100644 Binary files a/Sounds/Item/HeliumFlashReady.ogg and b/Sounds/Item/HeliumFlashReady.ogg differ diff --git a/Sounds/Item/HeliumFlashReadyAlt.ogg b/Sounds/Item/HeliumFlashReadyAlt.ogg deleted file mode 100644 index 355124aaa7..0000000000 Binary files a/Sounds/Item/HeliumFlashReadyAlt.ogg and /dev/null differ diff --git a/Sounds/Item/LargeMechGaussRifle.ogg b/Sounds/Item/LargeMechGaussRifle.ogg deleted file mode 100644 index fd91b44c4e..0000000000 Binary files a/Sounds/Item/LargeMechGaussRifle.ogg and /dev/null differ diff --git a/Sounds/Item/LaserRifleFire.ogg b/Sounds/Item/LaserRifleFire.ogg deleted file mode 100644 index 91f7b18d56..0000000000 Binary files a/Sounds/Item/LaserRifleFire.ogg and /dev/null differ diff --git a/Sounds/Item/LucreciaBoltFire.ogg b/Sounds/Item/LucreciaBoltFire.ogg new file mode 100644 index 0000000000..1f189852b1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltFire.ogg differ diff --git a/Sounds/Item/LucreciaBoltImpact.ogg b/Sounds/Item/LucreciaBoltImpact.ogg new file mode 100644 index 0000000000..ca55683cf1 Binary files /dev/null and b/Sounds/Item/LucreciaBoltImpact.ogg differ diff --git a/Sounds/Item/LunicShot1.ogg b/Sounds/Item/LunicShot1.ogg index c7166fea88..ecd913e659 100644 Binary files a/Sounds/Item/LunicShot1.ogg and b/Sounds/Item/LunicShot1.ogg differ diff --git a/Sounds/Item/LunicShot2.ogg b/Sounds/Item/LunicShot2.ogg index bcea333ff4..26df1ef8e2 100644 Binary files a/Sounds/Item/LunicShot2.ogg and b/Sounds/Item/LunicShot2.ogg differ diff --git a/Sounds/Item/M1GarandPing.ogg b/Sounds/Item/M1GarandPing.ogg new file mode 100644 index 0000000000..f05bb8a0da Binary files /dev/null and b/Sounds/Item/M1GarandPing.ogg differ diff --git a/Sounds/Item/M1GarandReload.ogg b/Sounds/Item/M1GarandReload.ogg new file mode 100644 index 0000000000..d43965eff8 Binary files /dev/null and b/Sounds/Item/M1GarandReload.ogg differ diff --git a/Sounds/Item/MagicBlast.ogg b/Sounds/Item/MagicBlast.ogg deleted file mode 100644 index e8e088d672..0000000000 Binary files a/Sounds/Item/MagicBlast.ogg and /dev/null differ diff --git a/Sounds/Item/MetalScrape.ogg b/Sounds/Item/MetalScrape.ogg deleted file mode 100644 index 2f1963610a..0000000000 Binary files a/Sounds/Item/MetalScrape.ogg and /dev/null differ diff --git a/Sounds/Item/MittFail.ogg b/Sounds/Item/MittFail.ogg new file mode 100644 index 0000000000..b7f210727f Binary files /dev/null and b/Sounds/Item/MittFail.ogg differ diff --git a/Sounds/Item/MittHit.ogg b/Sounds/Item/MittHit.ogg new file mode 100644 index 0000000000..0faac84a5e Binary files /dev/null and b/Sounds/Item/MittHit.ogg differ diff --git a/Sounds/Item/MittReadyPalm.ogg b/Sounds/Item/MittReadyPalm.ogg new file mode 100644 index 0000000000..c786f75f8f Binary files /dev/null and b/Sounds/Item/MittReadyPalm.ogg differ diff --git a/Sounds/Item/MittThrust.ogg b/Sounds/Item/MittThrust.ogg new file mode 100644 index 0000000000..342b6df3a9 Binary files /dev/null and b/Sounds/Item/MittThrust.ogg differ diff --git a/Sounds/Item/MittWelding/Weld1.ogg b/Sounds/Item/MittWelding/Weld1.ogg new file mode 100644 index 0000000000..87a68dceac Binary files /dev/null and b/Sounds/Item/MittWelding/Weld1.ogg differ diff --git a/Sounds/Item/MittWelding/Weld2.ogg b/Sounds/Item/MittWelding/Weld2.ogg new file mode 100644 index 0000000000..87a68dceac Binary files /dev/null and b/Sounds/Item/MittWelding/Weld2.ogg differ diff --git a/Sounds/Item/MittWelding/Weld3.ogg b/Sounds/Item/MittWelding/Weld3.ogg new file mode 100644 index 0000000000..87a68dceac Binary files /dev/null and b/Sounds/Item/MittWelding/Weld3.ogg differ diff --git a/Sounds/Item/MittWelding/Weld4.ogg b/Sounds/Item/MittWelding/Weld4.ogg new file mode 100644 index 0000000000..87a68dceac Binary files /dev/null and b/Sounds/Item/MittWelding/Weld4.ogg differ diff --git a/Sounds/Item/MittWelding/Weld5.ogg b/Sounds/Item/MittWelding/Weld5.ogg new file mode 100644 index 0000000000..87a68dceac Binary files /dev/null and b/Sounds/Item/MittWelding/Weld5.ogg differ diff --git a/Sounds/Item/SharkoonBoom.ogg b/Sounds/Item/SharkoonBoom.ogg deleted file mode 100644 index 8dd94403c2..0000000000 Binary files a/Sounds/Item/SharkoonBoom.ogg and /dev/null differ diff --git a/Sounds/Item/ShrimpFire.ogg b/Sounds/Item/ShrimpFire.ogg new file mode 100644 index 0000000000..b60d95c9aa Binary files /dev/null and b/Sounds/Item/ShrimpFire.ogg differ diff --git a/Sounds/Item/ShrimpMissileHit.ogg b/Sounds/Item/ShrimpMissileHit.ogg new file mode 100644 index 0000000000..c34fcac6cf Binary files /dev/null and b/Sounds/Item/ShrimpMissileHit.ogg differ diff --git a/Sounds/Item/ShrimpSound1.ogg b/Sounds/Item/ShrimpSound1.ogg new file mode 100644 index 0000000000..38d7eae4ea Binary files /dev/null and b/Sounds/Item/ShrimpSound1.ogg differ diff --git a/Sounds/Item/ShrimpSound2.ogg b/Sounds/Item/ShrimpSound2.ogg new file mode 100644 index 0000000000..f8106c6edf Binary files /dev/null and b/Sounds/Item/ShrimpSound2.ogg differ diff --git a/Sounds/Item/ShrimpSurprise.ogg b/Sounds/Item/ShrimpSurprise.ogg new file mode 100644 index 0000000000..5eb8fbad6d Binary files /dev/null and b/Sounds/Item/ShrimpSurprise.ogg differ diff --git a/Sounds/Item/SkytiedBolt.ogg b/Sounds/Item/SkytideBolt.ogg similarity index 100% rename from Sounds/Item/SkytiedBolt.ogg rename to Sounds/Item/SkytideBolt.ogg diff --git a/Sounds/Item/Swine1.ogg b/Sounds/Item/Swine1.ogg new file mode 100644 index 0000000000..1dea0682ff Binary files /dev/null and b/Sounds/Item/Swine1.ogg differ diff --git a/Sounds/Item/Swine2.ogg b/Sounds/Item/Swine2.ogg new file mode 100644 index 0000000000..9b6bf3f57f Binary files /dev/null and b/Sounds/Item/Swine2.ogg differ diff --git a/Sounds/Item/SylvestaffFire1.ogg b/Sounds/Item/SylvestaffFire1.ogg new file mode 100644 index 0000000000..8ab459ac0b Binary files /dev/null and b/Sounds/Item/SylvestaffFire1.ogg differ diff --git a/Sounds/Item/SylvestaffFire2.ogg b/Sounds/Item/SylvestaffFire2.ogg new file mode 100644 index 0000000000..4d60af5825 Binary files /dev/null and b/Sounds/Item/SylvestaffFire2.ogg differ diff --git a/Sounds/Item/SylvestaffFire3.ogg b/Sounds/Item/SylvestaffFire3.ogg new file mode 100644 index 0000000000..c8b78c318b Binary files /dev/null and b/Sounds/Item/SylvestaffFire3.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce1.ogg b/Sounds/Item/SylvestaffProjectileBounce1.ogg new file mode 100644 index 0000000000..dbe4a38b8e Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce1.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce2.ogg b/Sounds/Item/SylvestaffProjectileBounce2.ogg new file mode 100644 index 0000000000..81d1d354e4 Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce2.ogg differ diff --git a/Sounds/Item/SylvestaffProjectileBounce3.ogg b/Sounds/Item/SylvestaffProjectileBounce3.ogg new file mode 100644 index 0000000000..4cbae2723f Binary files /dev/null and b/Sounds/Item/SylvestaffProjectileBounce3.ogg differ diff --git a/Sounds/Item/ViperSpit.ogg b/Sounds/Item/ViperSpit.ogg index b7fb928fa1..2be1d386cd 100644 Binary files a/Sounds/Item/ViperSpit.ogg and b/Sounds/Item/ViperSpit.ogg differ diff --git a/Sounds/Item/VulcanRampDown.ogg b/Sounds/Item/VulcanRampDown.ogg new file mode 100644 index 0000000000..3463218167 Binary files /dev/null and b/Sounds/Item/VulcanRampDown.ogg differ diff --git a/Sounds/Item/VulcanRampUp.ogg b/Sounds/Item/VulcanRampUp.ogg new file mode 100644 index 0000000000..63a160b201 Binary files /dev/null and b/Sounds/Item/VulcanRampUp.ogg differ diff --git a/Sounds/Item/VulcanShot.ogg b/Sounds/Item/VulcanShot.ogg new file mode 100644 index 0000000000..11c7584d26 Binary files /dev/null and b/Sounds/Item/VulcanShot.ogg differ diff --git a/Sounds/Item/YanmeiKnifeHit.ogg b/Sounds/Item/YanmeiKnifeHit.ogg deleted file mode 100644 index 37abc0dcf8..0000000000 Binary files a/Sounds/Item/YanmeiKnifeHit.ogg and /dev/null differ diff --git a/Sounds/NPCHit/WulfrumHit1.ogg b/Sounds/NPCHit/WulfrumHit1.ogg new file mode 100644 index 0000000000..10d225e335 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit1.ogg differ diff --git a/Sounds/NPCHit/WulfrumHit1.wav b/Sounds/NPCHit/WulfrumHit1.wav deleted file mode 100644 index a07f2b7194..0000000000 Binary files a/Sounds/NPCHit/WulfrumHit1.wav and /dev/null differ diff --git a/Sounds/NPCHit/WulfrumHit2.ogg b/Sounds/NPCHit/WulfrumHit2.ogg new file mode 100644 index 0000000000..048e071051 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit2.ogg differ diff --git a/Sounds/NPCHit/WulfrumHit2.wav b/Sounds/NPCHit/WulfrumHit2.wav deleted file mode 100644 index 1ba1f11026..0000000000 Binary files a/Sounds/NPCHit/WulfrumHit2.wav and /dev/null differ diff --git a/Sounds/NPCHit/WulfrumHit3.ogg b/Sounds/NPCHit/WulfrumHit3.ogg new file mode 100644 index 0000000000..75a1f42e23 Binary files /dev/null and b/Sounds/NPCHit/WulfrumHit3.ogg differ diff --git a/Sounds/NPCHit/WulfrumHit3.wav b/Sounds/NPCHit/WulfrumHit3.wav deleted file mode 100644 index 782a47fb54..0000000000 Binary files a/Sounds/NPCHit/WulfrumHit3.wav and /dev/null differ diff --git a/Systems/Collections/AbyssValidTileReplacementList.cs b/Systems/Collections/AbyssValidTileReplacementList.cs deleted file mode 100644 index 243d3ba97f..0000000000 --- a/Systems/Collections/AbyssValidTileReplacementList.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of modded Tile IDs which the Abyss can replace while generating. - /// - public sealed class AbyssValidTileReplacementList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - // By default, Calamity does not add anything to this list. Mods are free to do so with reflection. - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not a tile can be replaced by the Abyss while generating. - /// - public static bool Includes(int tileType) => List.Contains(tileType); - } -} diff --git a/Systems/Collections/AlcoholsDict.cs b/Systems/Collections/AlcoholsDict.cs deleted file mode 100644 index bf7ef08f65..0000000000 --- a/Systems/Collections/AlcoholsDict.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.Alcohol; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all alcohol buff's IDs and their corresponding poison level. - /// - public sealed class AlcoholsDict : ModSystem - { - public static IDictionary Dict { get; private set; } - - public override void OnModLoad() - { - Dict = new Dictionary - { - { BuffID.Tipsy, 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 2 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 }, - { BuffType(), 1 } - }; - } - - public override void Unload() - { - Dict?.Clear(); - Dict = null; - } - - /// - /// A shorthand method to obtain an alcohol buff's poison level from its buff ID. - /// - public static bool TryGet(int buffType, out int poisonLevel) - { - return Dict.TryGetValue(buffType, out poisonLevel); - } - } -} diff --git a/Systems/Collections/AmalgamBuffLists.cs b/Systems/Collections/AmalgamBuffLists.cs deleted file mode 100644 index 468614edfb..0000000000 --- a/Systems/Collections/AmalgamBuffLists.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.Alcohol; -using CalamityMod.Buffs.Potions; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a with all buff IDs of those who are boosted by The Amalgam accessory. - /// - public sealed class AmalgamBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffID.ObsidianSkin, - BuffID.Regeneration, - BuffID.Swiftness, - BuffID.Gills, - BuffID.Ironskin, - BuffID.ManaRegeneration, - BuffID.MagicPower, - BuffID.Featherfall, - BuffID.Spelunker, - BuffID.Invisibility, - BuffID.Shine, - BuffID.NightOwl, - BuffID.Battle, - BuffID.Thorns, - BuffID.WaterWalking, - BuffID.Archery, - BuffID.Hunter, - BuffID.Gravitation, - BuffID.Tipsy, - BuffID.WellFed, - BuffID.WellFed2, - BuffID.WellFed3, - BuffID.Honey, - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison, - BuffID.Lucky, - BuffID.Mining, - BuffID.Heartreach, - BuffID.Calm, - BuffID.Builder, - BuffID.Titan, - BuffID.Flipper, - BuffID.Summoning, - BuffID.Dangersense, - BuffID.AmmoReservation, - BuffID.Lifeforce, - BuffID.Endurance, - BuffID.Rage, - BuffID.Inferno, - BuffID.Wrath, - BuffID.Lovestruck, - BuffID.Stinky, - BuffID.Fishing, - BuffID.Sonar, - BuffID.Crate, - BuffID.Warmth, - BuffID.SugarRush - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not a buff is boosted by The Amalgam or not. - /// - public static bool Includes(int buffID) => List.Contains(buffID); - } -} diff --git a/Systems/Collections/AutoreuseableSpearsList.cs b/Systems/Collections/AutoreuseableSpearsList.cs deleted file mode 100644 index 80d81b13f5..0000000000 --- a/Systems/Collections/AutoreuseableSpearsList.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all Vanilla Spears to make them autoreusable. - /// - public sealed class AutoreusableSpearsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ItemID.AdamantiteGlaive, - ItemID.ChlorophytePartisan, - ItemID.CobaltNaginata, - ItemID.DarkLance, - ItemID.MonkStaffT2, - ItemID.Gungnir, - ItemID.MushroomSpear, - ItemID.MythrilHalberd, - ItemID.NorthPole, - ItemID.ObsidianSwordfish, - ItemID.OrichalcumHalberd, - ItemID.PalladiumPike, - ItemID.Spear, - ItemID.Swordfish, - ItemID.TheRottedFork, - ItemID.TitaniumTrident, - ItemID.Trident, - ItemID.ThunderSpear - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not an item is an autoreusable spear. - /// - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs b/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs deleted file mode 100644 index 769faa281d..0000000000 --- a/Systems/Collections/BlacklistedWeaponsWithToolPowerList.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Tools; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.Weapons.Melee; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class BlacklistedWeaponsWithToolPowerList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - // This list intentionally does not contain Grax. - List = - [ - ItemID.ButchersChainsaw, - ItemID.LucyTheAxe, - ItemID.Rockfish, - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if this Item is Blacklisted. - /// - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/BuffedDungeonProjectilesList.cs b/Systems/Collections/BuffedDungeonProjectilesList.cs deleted file mode 100644 index 2d847d0d29..0000000000 --- a/Systems/Collections/BuffedDungeonProjectilesList.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A which contains a that has the Projectile IDs of all projectiles who are buffed Dungeon projectiles. - /// - public sealed class BuffedDungeonProjectilesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.PaladinsHammerHostile, - ProjectileID.ShadowBeamHostile, - ProjectileID.InfernoHostileBolt, - ProjectileID.InfernoHostileBlast, - ProjectileID.LostSoulHostile, - ProjectileID.SniperBullet, - ProjectileID.RocketSkeleton, - ProjectileID.BulletDeadeye, - ProjectileID.Shadowflames - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if this projectile is a buffed Dungeon projectile. - /// - public static bool Includes(int projType) => List.Contains(projType); - } -} diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs new file mode 100644 index 0000000000..35a8b9fd1f --- /dev/null +++ b/Systems/Collections/CalamityBuffSets.cs @@ -0,0 +1,140 @@ +using System.Collections.Generic; +using CalamityMod.Buffs; +using CalamityMod.Buffs.Alcohol; +using CalamityMod.Buffs.Cooldowns; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Potions; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon.Whips; +using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; +using ReLogic.Reflection; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityBuffSets + { + public static SetFactory Factory = new SetFactory(BuffLoader.BuffCount, "CalamityMod/BuffID", Search); + public static IdDictionary Search = IdDictionary.Create(); + + /// + /// If for a buff type, then that buff will have its duration extended with The Amalgam equipped.
+ /// Also used to remove buffs when contacting the Whispering Maelstrom in the Get fixed boi seed.
+ /// Defaults to . + ///
+ public static bool[] BuffedByAmalgam = Factory.CreateBoolSet(BuffID.ObsidianSkin, BuffID.Regeneration, BuffID.Swiftness, BuffID.Gills, BuffID.Ironskin, BuffID.ManaRegeneration, + BuffID.MagicPower, BuffID.Featherfall, BuffID.Spelunker, BuffID.Invisibility, BuffID.Shine, BuffID.NightOwl, BuffID.Battle, BuffID.Thorns, BuffID.WaterWalking, + BuffID.Archery, BuffID.Hunter, BuffID.Gravitation, BuffID.Tipsy, BuffID.WellFed, BuffID.WellFed2, BuffID.WellFed3, BuffID.Honey, BuffID.WeaponImbueVenom, + BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, + BuffID.WeaponImbuePoison, BuffID.Lucky, BuffID.Mining, BuffID.Heartreach, BuffID.Calm, BuffID.Builder, BuffID.Titan, BuffID.Flipper, BuffID.Summoning, BuffID.Dangersense, + BuffID.AmmoReservation, BuffID.Lifeforce, BuffID.Endurance, BuffID.Rage, BuffID.Inferno, BuffID.Wrath, BuffID.Lovestruck, BuffID.Stinky, BuffID.Fishing, BuffID.Sonar, + BuffID.Crate, BuffID.Warmth, BuffID.SugarRush, BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType()); + + /// + /// If for a buff type, then that buff is a persistent buff.
+ /// Used by The Amalgam to prevent removing their persistence when the accessory is unequipped.
+ /// Defaults to . + ///
+ public static bool[] IsPersistentBuff = Factory.CreateBoolSet(BuffID.WeaponImbueVenom, BuffID.WeaponImbueCursedFlames, BuffID.WeaponImbueFire, BuffID.WeaponImbueGold, + BuffID.WeaponImbueIchor, BuffID.WeaponImbueNanites, BuffID.WeaponImbueConfetti, BuffID.WeaponImbuePoison, BuffType(), + BuffType(), BuffType()); + + /// + /// If for a buff type, then that buff is considered to be a sickness debuff.
+ /// Used for reducing buff duration with Honey Dew and its upgrades.
+ /// Defaults to . + ///
+ public static bool[] IsSicknessDebuff = Factory.CreateBoolSet(BuffID.Poisoned, BuffID.Venom, BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); + + /// + /// If for a buff type, then that buff is considered to be a fire debuff.
+ /// Used for reducing buff duration with Living Dew and its upgrades, and providing Permafrost's Concoction's life regeneration boost.
+ /// Defaults to . + ///
+ public static bool[] IsFireDebuff = Factory.CreateBoolSet(BuffID.OnFire, BuffID.OnFire3, BuffID.Burning, BuffID.CursedInferno, BuffID.ShadowFlame, BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType()); + + /// + /// If for a buff type, then that buff is considered to be a debuff.
+ /// This general-purpose set has several different uses, including reducing buff duration with Radiance, Crown Jewel and its upgrades' debuff effects, and removing debuffs with Cleansing Jelly and its upgrades' auras.
+ /// Defaults to . + ///
+ public static bool[] IsDebuff = Factory.CreateBoolSet(BuffID.Poisoned, BuffID.Darkness, BuffID.Cursed, BuffID.OnFire, BuffID.Bleeding, BuffID.Confused, BuffID.Slow, BuffID.Weak, + BuffID.Silenced, BuffID.BrokenArmor, BuffID.CursedInferno, BuffID.Frostburn, BuffID.Chilled, BuffID.Frozen, BuffID.Burning, BuffID.Suffocation, BuffID.Ichor, + BuffID.Venom, BuffID.Blackout, BuffID.Electrified, BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, + BuffID.OgreSpit, BuffID.BetsysCurse, BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), + BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType(), BuffType()); + + /// + /// If for a buff type, then that buff is a whip tag buff on the player.
+ /// Used to prevent "whip stacking", the ability to grant the player multiple whip buff effects at once.
+ /// Defaults to . + ///
+ public static bool[] IsSummonTagBuff = Factory.CreateBoolSet(BuffID.CoolWhipPlayerBuff, BuffID.ScytheWhipPlayerBuff, BuffID.SwordWhipPlayerBuff, BuffID.ThornWhipPlayerBuff, BuffType()); + + /// + /// Associates a buff type with its structure. If a buff type is not a key in this dictionary, then it has no associated .
+ /// Used for several different effects, such as applying tag effects to NPCs, preventing "whip stacking" on NPCs, and drawing the tag effect icon below the NPC. + ///
+ public static Dictionary SummonTagDebuff = new Dictionary + { + { BuffID.BlandWhipEnemyDebuff, SummonTag.LeatherWhip }, + { BuffID.BoneWhipNPCDebuff, SummonTag.SpinalTap }, + { BuffID.CoolWhipNPCDebuff, SummonTag.CoolWhip }, + { BuffID.FlameWhipEnemyDebuff, SummonTag.Firecracker }, + { BuffID.MaceWhipNPCDebuff, SummonTag.MorningStar }, + { BuffID.RainbowWhipNPCDebuff, SummonTag.Kaleidoscope }, + { BuffID.ScytheWhipEnemyDebuff, SummonTag.DarkHarvest }, + { BuffID.SwordWhipNPCDebuff, SummonTag.Durendal }, + { BuffID.ThornWhipNPCDebuff, SummonTag.Snapthorn }, + { BuffType(), ProfanedSoulCrystal.SummonTag } + }; + + /// + /// Associates a buff type with its alcohol poison level. Used for the Alcohol Poisoning mechanic.
+ /// If a buff type is not a key in this dictionary, then it does not increase alcohol poison level. + ///
+ public static Dictionary AlcoholStrength = new Dictionary + { + { BuffID.Tipsy, 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 2 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 }, + { BuffType(), 1 } + }; + } +} diff --git a/Systems/Collections/CalamityItemSets.cs b/Systems/Collections/CalamityItemSets.cs new file mode 100644 index 0000000000..6cc299caf7 --- /dev/null +++ b/Systems/Collections/CalamityItemSets.cs @@ -0,0 +1,96 @@ +using System; +using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor.Vanity; +using CalamityMod.Items.Fishing.FishingRods; +using CalamityMod.Items.LoreItems; +using CalamityMod.Items.Materials; +using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.Furniture.Trophies; +using CalamityMod.Items.Tools; +using CalamityMod.Items.TreasureBags; +using CalamityMod.Items.Weapons.DraedonsArsenal; +using CalamityMod.Items.Weapons.Magic; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Items.Weapons.Summon; +using ReLogic.Reflection; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityItemSets + { + public static SetFactory Factory = new SetFactory(ItemLoader.ItemCount, "CalamityMod/ItemID", Search); + public static IdDictionary Search = IdDictionary.Create(); + + /// + /// If for an item type, allows the item to always be used as long as only one of its projectile exists.
+ /// Used to give specific vanilla spears pseudo-autoswing.
+ /// Defaults to . + ///
+ public static bool[] AutoreusableSpear = Factory.CreateBoolSet(ItemID.AdamantiteGlaive, ItemID.ChlorophytePartisan, ItemID.CobaltNaginata, ItemID.DarkLance, ItemID.MonkStaffT2, + ItemID.Gungnir, ItemID.MushroomSpear, ItemID.MythrilHalberd, ItemID.NorthPole, ItemID.ObsidianSwordfish, ItemID.OrichalcumHalberd, ItemID.PalladiumPike, ItemID.Spear, + ItemID.Swordfish, ItemID.TheRottedFork, ItemID.TitaniumTrident, ItemID.Trident, ItemID.ThunderSpear); + + /// + /// If for an item type, prevents an item from removing Calamity's summon damage penalty mechanic despite having tool power.
+ /// Defaults to . + ///
+ public static bool[] WeaponWithToolPowerAffectedBySummonPenalty = Factory.CreateBoolSet(ItemID.ButchersChainsaw, ItemID.LucyTheAxe, ItemID.Rockfish, + ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, manually disables Calamity's summon damage penalty mechanic while that item type is held.
+ /// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
+ /// Defaults to . + ///
+ public static bool[] ItemWhichDisablesSummonerNerf = Factory.CreateBoolSet(); + + /// + /// If for an item type, holding the item sets to true, preventing fishing lines from breaking.
+ /// Should only be set on fishing poles.
+ /// Defaults to . + ///
+ public static bool[] FishingPoleThatNeverBreaks = Factory.CreateBoolSet(ItemID.GoldenFishingRod, ItemType(), ItemType()); + + /// + /// If for an item type, forces a dropped item of this type to remain within the bounds of the world if it is spawned outside of it.
+ /// Set this for items which are dropped by enemies or bosses which spawn on the edges of the world.
+ /// Defaults to . + ///
+ public static bool[] ItemForcedInsideWorld = Factory.CreateBoolSet(ItemID.HotlineFishingHook, ItemID.BottomlessBucket, ItemID.SuperAbsorbantSponge, ItemID.FishingPotion, + ItemID.SonarPotion, ItemID.CratePotion, ItemID.AnglerTackleBag, ItemID.HighTestFishingLine, ItemID.TackleBox, ItemID.AnglerEarring, ItemID.FishermansGuide, ItemID.WeatherRadio, + ItemID.Sextant, ItemID.AnglerHat, ItemID.AnglerVest, ItemID.AnglerPants, ItemID.GoldenBugNet, ItemID.FishronWings, ItemID.Flairon, ItemID.Tsunami, ItemID.BubbleGun, + ItemID.RazorbladeTyphoon, ItemID.TempestStaff, ItemID.FishronBossBag, ItemID.Coral, ItemID.Seashell, ItemID.Starfish, ItemID.SoulofSight, ItemID.GreaterHealingPotion, + ItemID.SuperHealingPotion, ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType()); + + /// + /// If for an item type, prevents this rogue weapon from triggering Venerated Locket's clone projectile effect when used.
+ /// Primarily used for weapons which shoot short-distance projectiles.
+ /// Defaults to . + ///
+ public static bool[] DisablesVeneratedLocketEffect = Factory.CreateBoolSet(ItemType(), ItemType(), ItemType()); + + /// + /// If for an item type, this item is considered to be a magic gun.
+ /// Used for applying Calamity's reworked Meteor armor set bonus.
+ /// Defaults to . + ///
+ public static bool[] MagicGun = Factory.CreateBoolSet(ItemID.BeeGun, ItemID.BubbleGun, ItemID.ChargedBlasterCannon, ItemID.HeatRay, ItemID.LaserMachinegun, ItemID.LaserRifle, + ItemID.LeafBlower, ItemID.RainbowGun, ItemID.SpaceGun, ItemID.WaspGun, ItemID.ZapinatorGray, ItemID.ZapinatorOrange, ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), + ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType(), ItemType()); + } +} diff --git a/Systems/Collections/CalamityNPCSets.cs b/Systems/Collections/CalamityNPCSets.cs new file mode 100644 index 0000000000..88f24502a4 --- /dev/null +++ b/Systems/Collections/CalamityNPCSets.cs @@ -0,0 +1,359 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.Abyss; +using CalamityMod.NPCs.AcidRain; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.Astral; +using CalamityMod.NPCs.AstrumAureus; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.BrimstoneElemental; +using CalamityMod.NPCs.Bumblebirb; +using CalamityMod.NPCs.CalClone; +using CalamityMod.NPCs.CeaselessVoid; +using CalamityMod.NPCs.Crabulon; +using CalamityMod.NPCs.Crags; +using CalamityMod.NPCs.Cryogen; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Apollo; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Artemis; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.GreatSandShark; +using CalamityMod.NPCs.HiveMind; +using CalamityMod.NPCs.Leviathan; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.OldDuke; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.PlaguebringerGoliath; +using CalamityMod.NPCs.PlagueEnemies; +using CalamityMod.NPCs.Polterghast; +using CalamityMod.NPCs.PrimordialWyrm; +using CalamityMod.NPCs.ProfanedGuardians; +using CalamityMod.NPCs.Providence; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.Signus; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using CalamityMod.NPCs.SunkenSea; +using CalamityMod.NPCs.SupremeCalamitas; +using CalamityMod.NPCs.Yharon; +using ReLogic.Reflection; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityNPCSets + { + public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCID", Search); + public static IdDictionary Search = IdDictionary.Create(); + + /// + /// If for an NPC type, makes this NPC be susceptible to .
+ /// Defaults to . + ///
+ public static bool[] CalamityNPCNotImmuneToConfused = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType()); + + /// + /// If for an NPC type, forces this NPC to draw Calamity's debuff display, even if it is not a boss.
+ /// Defaults to . + ///
+ public static bool[] ForceDrawDebuffDisplay = Factory.CreateBoolSet(NPCID.TargetDummy, NPCID.WallofFleshEye, NPCType()); + + /// + /// If for an NPC type, then that NPC will not provide increased Rage generation despite being considered a boss.
+ /// Primarily used by worm boss body and tail segments to prevent Rage being extraordinarily easy to get.
+ /// Defaults to . + ///
+ public static bool[] BossSegmentThatDoesNotGenerateRageFaster = Factory.CreateBoolSet(NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType()); + + /// + /// If for an NPC type, allows the NPC to scale its health based on the Boss Health Boost Percentage config option, even if it is not a boss.
+ /// Also allows the NPC to receive health scaling from having multiple players in Expert+.
+ /// Defaults to . + ///
+ public static bool[] ScalesHealthLikeBoss = Factory.CreateBoolSet(NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.SkeletronHand, + NPCID.WallofFleshEye, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail, NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.PrimeSaw, NPCID.GolemHead, + NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.Sharkron, NPCID.Sharkron2, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType()); + + /// + /// If for an NPC type, then that NPC will have its contact damage set to 0.
+ /// Defaults to . + ///
+ public static bool[] DealsZeroContactDamage = Factory.CreateBoolSet(NPCID.Harpy, NPCID.Salamander, NPCID.Salamander2, NPCID.Salamander3, NPCID.Salamander4, NPCID.Salamander5, + NPCID.Salamander6, NPCID.Salamander7, NPCID.Salamander8, NPCID.Salamander9, NPCID.GiantCursedSkull, NPCID.FungiBulb, NPCID.GiantFungiBulb, NPCID.IcyMerman, + NPCID.AngryNimbus, NPCID.SandElemental, NPCID.DarkCaster, NPCID.FireImp, NPCID.Tim, NPCID.CultistArcherBlue, NPCID.DesertDjinn, NPCID.DiabolistRed, NPCID.DiabolistWhite, + NPCID.Gastropod, NPCID.IceElemental, NPCID.IchorSticker, NPCID.Necromancer, NPCID.NecromancerArmored, NPCID.RaggedCaster, NPCID.RaggedCasterOpenCoat, NPCID.RuneWizard, + NPCID.SkeletonArcher, NPCID.SkeletonCommando, NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.Clown, NPCID.GoblinArcher, NPCID.GoblinSorcerer, NPCID.GoblinSummoner, + NPCID.PirateCrossbower, NPCID.PirateDeadeye, NPCID.PirateCaptain, NPCID.SnowmanGangsta, NPCID.SnowBalla, NPCID.DrManFly, NPCID.Eyezor, NPCID.Nailhead, NPCID.BrainScrambler, + NPCID.GigaZapper, NPCID.RayGunner, NPCID.ScutlixRider, NPCID.MartianWalker, NPCID.MartianTurret, NPCID.ElfCopter, NPCID.ElfArcher, NPCID.NebulaBrain, NPCID.NebulaSoldier, + NPCID.StardustCellSmall, NPCID.StardustJellyfishBig, NPCID.StardustSoldier, NPCID.StardustSpiderBig, NPCID.VortexHornetQueen, NPCID.VortexRifleman, NPCID.VortexSoldier, + NPCID.PirateShipCannon, NPCID.MartianSaucer, NPCID.MartianSaucerCannon, NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.Probe, NPCID.CultistBoss, NPCID.GolemHead, + NPCID.GolemHeadFree, NPCID.MoonLordFreeEye, NPCID.BloodSquid, NPCID.PlanterasHook, NPCID.Dandelion, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2OgreT2, + NPCID.DD2OgreT3, NPCID.DD2GoblinBomberT1, NPCID.DD2GoblinBomberT2, NPCID.DD2GoblinBomberT3, NPCID.DD2JavelinstT1, NPCID.DD2JavelinstT2, NPCID.DD2JavelinstT3, + NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldFlyerT2, NPCID.DD2KoboldFlyerT3, NPCID.DD2WitherBeastT2, + NPCID.DD2WitherBeastT3, NPCID.DD2LightningBugT3, NPCID.MourningWood, NPCID.Pumpking, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.AncientDoom); + + /// + /// If for an NPC type, then that NPC will have its damage reduced by 25% if the world is in Hardmode.
+ /// Defaults to . + ///
+ public static bool[] NerfDamageInHardmode = Factory.CreateBoolSet(NPCID.AnglerFish, NPCID.AngryTrapper, NPCID.Arapaima, NPCID.BlackRecluse, NPCID.BlackRecluseWall, + NPCID.BloodJelly, NPCID.FungoFish, NPCID.GreenJellyfish, NPCID.Clinger, NPCID.ArmoredSkeleton, NPCID.ArmoredViking, NPCID.Mummy, NPCID.DarkMummy, NPCID.LightMummy, + NPCID.BloodFeeder, NPCID.DesertBeast, NPCID.ChaosElemental, NPCID.BloodMummy, NPCID.CorruptSlime, NPCID.Corruptor, NPCID.Crimslime, NPCID.CrimsonAxe, NPCID.CursedHammer, + NPCID.Derpling, NPCID.Herpling, NPCID.DiggerHead, NPCID.DesertGhoul, NPCID.DesertGhoulCorruption, NPCID.DesertGhoulCrimson, NPCID.DesertGhoulHallow, NPCID.DuneSplicerHead, + NPCID.EnchantedSword, NPCID.FloatyGross, NPCID.GiantBat, NPCID.GiantFlyingFox, NPCID.FungiSpore, NPCID.GiantTortoise, NPCID.IceTortoise, NPCID.HoppinJack, NPCID.Mimic, + NPCID.IlluminantBat, NPCID.IlluminantSlime, NPCID.JungleCreeper, NPCID.JungleCreeperWall, NPCID.DesertLamiaDark, NPCID.DesertLamiaLight, NPCID.MossHornet, NPCID.Moth, + NPCID.PigronCorruption, NPCID.PigronCrimson, NPCID.PigronHallow, NPCID.Pixie, NPCID.PossessedArmor, NPCID.RockGolem, NPCID.DesertScorpionWalk, NPCID.DesertScorpionWall, + NPCID.Slimer, NPCID.ToxicSludge, NPCID.Unicorn, NPCID.WanderingEye, NPCID.Werewolf, NPCID.Wolf, NPCID.SeekerHead, NPCID.Wraith, NPCID.ChatteringTeethBomb, NPCID.IceGolem, + NPCID.RainbowSlime, NPCID.SandShark, NPCID.SandsharkCorrupt, NPCID.SandsharkCrimson, NPCID.SandsharkHallow, NPCID.ShadowFlameApparition, NPCID.Parrot, NPCID.PirateCorsair, + NPCID.PirateDeckhand, NPCID.PirateGhost, NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBonesSword, NPCID.BoneLee, NPCID.DungeonSpirit, NPCID.FlyingSnake, NPCID.HellArmoredBones, + NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBonesSword, NPCID.MisterStabby, NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.DeadlySphere, NPCID.Frankenstein, + NPCID.Fritz, NPCID.Psycho, NPCID.Reaper, NPCID.SwampThing, NPCID.ThePossessed, NPCID.Vampire, NPCID.VampireBat, NPCID.HeadlessHorseman, NPCID.Hellhound, NPCID.Poltergeist, + NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, + NPCID.Splinterling, NPCID.Flocko, NPCID.GingerbreadMan, NPCID.Krampus, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.PresentMimic, NPCID.Yeti, NPCID.ZombieElf, NPCID.ZombieElfBeard, + NPCID.ZombieElfGirl, NPCID.BloodEelHead, NPCID.GoblinShark, NPCID.EyeballFlyingFish, NPCID.ZombieMerman); + + /// + /// If for an NPC type, then that NPC is a post-Plantera Dungeon enemy. This causes two separate changes to the enemy.
+ /// First, it grants them a 20% chance to drop Ectoplasm upon death.
+ /// Second, it multiplies their max health by 2.5x and increases their damage by a flat 30 if Moon Lord has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedDungeonEnemy = Factory.CreateBoolSet(NPCID.SkeletonSniper, NPCID.TacticalSkeleton, NPCID.SkeletonCommando, NPCID.Paladin, NPCID.GiantCursedSkull, + NPCID.BoneLee, NPCID.DiabolistWhite, NPCID.DiabolistRed, NPCID.NecromancerArmored, NPCID.Necromancer, NPCID.RaggedCasterOpenCoat, NPCID.RaggedCaster, + NPCID.HellArmoredBonesSword, NPCID.HellArmoredBonesMace, NPCID.HellArmoredBonesSpikeShield, NPCID.HellArmoredBones, NPCID.BlueArmoredBonesSword, NPCID.BlueArmoredBonesNoPants, + NPCID.BlueArmoredBonesMace, NPCID.BlueArmoredBones, NPCID.RustyArmoredBonesSwordNoArmor, NPCID.RustyArmoredBonesSword, NPCID.RustyArmoredBonesFlail, NPCID.RustyArmoredBonesAxe); + + /// + /// If for an NPC type, then that NPC is spawned in the Pumpkin Moon.
+ /// This will multiply their max health by 3.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedPumpkinMoonEnemy = Factory.CreateBoolSet(NPCID.Scarecrow1, NPCID.Scarecrow2, NPCID.Scarecrow3, NPCID.Scarecrow4, NPCID.Scarecrow5, NPCID.Scarecrow6, + NPCID.Scarecrow7, NPCID.Scarecrow8, NPCID.Scarecrow9, NPCID.Scarecrow10, NPCID.HeadlessHorseman, NPCID.MourningWood, NPCID.Splinterling, NPCID.Pumpking, + NPCID.PumpkingBlade, NPCID.Hellhound, NPCID.Poltergeist); + + /// + /// If for an NPC type, then that NPC is spawned in the Frost Moon.
+ /// This will multiply their max health by 2.5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedFrostMoonEnemy = Factory.CreateBoolSet(NPCID.ZombieElf, NPCID.ZombieElfBeard, NPCID.ZombieElfGirl, NPCID.PresentMimic, NPCID.GingerbreadMan, + NPCID.Yeti, NPCID.Everscream, NPCID.IceQueen, NPCID.SantaNK1, NPCID.ElfCopter, NPCID.Nutcracker, NPCID.NutcrackerSpinning, NPCID.ElfArcher, NPCID.Krampus, NPCID.Flocko); + + /// + /// If for an NPC type, then that NPC is spawned in the Solar Eclipse.
+ /// This will multiply their max health by 5x and increase their damage by a flat 30 if Devourer of Gods has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedSolarEclipseEnemy = Factory.CreateBoolSet(NPCID.Eyezor, NPCID.Reaper, NPCID.Frankenstein, NPCID.SwampThing, NPCID.Vampire, NPCID.VampireBat, + NPCID.Butcher, NPCID.CreatureFromTheDeep, NPCID.Fritz, NPCID.Nailhead, NPCID.Psycho, NPCID.DeadlySphere, NPCID.DrManFly, NPCID.ThePossessed, NPCID.Mothron, + NPCID.MothronEgg, NPCID.MothronSpawn); + + // TODO: This set should really also handle the actual splitting behavior and loot, but unsure of the best way to do that looking at what we have right now + /// + /// If for an NPC type, then that NPC is part of a worm which splits in Death Mode. Solely used to reduce their max health to 15% of its standard value.
+ /// Defaults to . + ///
+ public static bool[] DeathModeSplittingWorm = Factory.CreateBoolSet(NPCID.DuneSplicerHead, NPCID.DuneSplicerBody, NPCID.DuneSplicerTail, + NPCID.DiggerHead, NPCID.DiggerBody, NPCID.DiggerTail, NPCID.SeekerHead, NPCID.SeekerBody, NPCID.SeekerTail); + + /// + /// If for an NPC type, then the NPC will receive a 30 second global cooldown to slowing debuffs after being inflicted by one.
+ /// Also used to prevent weapon pulling effects and Anarchy Blade's ability to instantly kill enemies that are below 50% health.
+ /// Defaults to . + ///
+ public static bool[] ResistSlowingDebuffsAndOtherSpecialEffects = Factory.CreateBoolSet(NPCID.KingSlime, NPCType(), NPCType(), + NPCType(), NPCID.EyeofCthulhu, NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail, NPCID.BrainofCthulhu, NPCID.Creeper, + NPCID.QueenBee, NPCID.Deerclops, NPCID.SkeletronHead, NPCID.SkeletronHand, NPCID.WallofFlesh, NPCID.WallofFleshEye, NPCID.PirateShipCannon, NPCID.QueenSlimeBoss, + NPCID.Probe, NPCID.Retinazer, NPCID.Spazmatism, NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeSaw, NPCID.PrimeLaser, NPCID.PrimeVice, NPCID.Plantera, + NPCID.PlanterasTentacle, NPCType(), NPCID.Everscream, NPCID.SantaNK1, NPCID.IceQueen, NPCID.MourningWood, NPCID.Pumpking, NPCID.Mothron, + NPCID.Golem, NPCID.GolemHead, NPCID.GolemHeadFree, NPCID.GolemFistRight, NPCID.GolemFistLeft, NPCID.MartianSaucerCore, NPCID.MartianSaucerCannon, NPCID.MartianSaucerTurret, + NPCID.DukeFishron, NPCID.Sharkron, NPCID.Sharkron2, NPCID.HallowBoss, NPCID.CultistBoss, NPCID.CultistDragonHead, NPCID.CultistDragonBody1, NPCID.CultistDragonBody2, + NPCID.CultistDragonBody3, NPCID.CultistDragonBody4, NPCID.CultistDragonTail, NPCID.AncientCultistSquidhead, NPCID.MoonLordHead, NPCID.MoonLordHand, NPCID.MoonLordCore, + NPCID.MoonLordFreeEye, NPCID.DD2WyvernT1, NPCID.DD2WyvernT2, NPCID.DD2WyvernT3, NPCID.DD2DarkMageT1, NPCID.DD2DarkMageT3, NPCID.DD2SkeletonT1, NPCID.DD2SkeletonT3, + NPCID.DD2WitherBeastT2, NPCID.DD2WitherBeastT3, NPCID.DD2DrakinT2, NPCID.DD2DrakinT3, NPCID.DD2KoboldWalkerT2, NPCID.DD2KoboldWalkerT3, NPCID.DD2KoboldFlyerT2, + NPCID.DD2KoboldFlyerT3, NPCID.DD2OgreT2, NPCID.DD2OgreT3, NPCID.DD2Betsy, + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType()); + + /// + /// Associates an NPC type with the base value of their max health in Boss Rush.
+ /// If an NPC type is not a key in this dictionary, then it will use its standard max health value. + ///
+ public static Dictionary BossRushHealth = new Dictionary + { + // Tier 1 + { NPCID.KingSlime, 300000 }, // 30 seconds + { NPCID.BlueSlime, 3600 }, + { NPCID.SlimeSpiked, 7200 }, + { NPCID.GreenSlime, 2700 }, + { NPCID.RedSlime, 5400 }, + { NPCID.PurpleSlime, 7200 }, + { NPCID.YellowSlime, 6300 }, + { NPCID.IceSlime, 4500 }, + { NPCID.UmbrellaSlime, 5400 }, + { NPCID.RainbowSlime, 30000 }, + { NPCID.Pinky, 15000 }, + { NPCType(), 21000 }, + { NPCType(), 18000 }, + { NPCType(), 24000 }, + { NPCID.EyeofCthulhu, 450000 }, // 30 seconds + { NPCID.ServantofCthulhu, 6000 }, + { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start + { NPCID.EaterofWorldsBody, 10000 }, + { NPCID.EaterofWorldsTail, 10000 }, + { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers + { NPCID.Creeper, 10000 }, + { NPCID.QueenBee, 315000 }, // 30 seconds + { NPCID.Bee, 3000 }, + { NPCID.BeeSmall, 2000 }, + { NPCID.BigHornetHoney, 10000 }, + { NPCID.HornetHoney, 7500 }, + { NPCID.LittleHornetHoney, 5000 }, + { NPCID.Deerclops, 315000 }, // 30 seconds + { NPCID.SkeletronHead, 150000 }, // 30 seconds + { NPCID.SkeletronHand, 60000 }, + { NPCID.WallofFlesh, 450000 }, // 30 seconds + { NPCID.WallofFleshEye, 450000 }, + { NPCID.TheHungry, 10000 }, + { NPCID.TheHungryII, 5000 }, + { NPCID.LeechHead, 5000 }, + { NPCID.LeechBody, 5000 }, + { NPCID.LeechTail, 5000 }, + // Tier 2 + { NPCID.QueenSlimeBoss, 200000 }, // 30 seconds + { NPCID.QueenSlimeMinionBlue, 6000 }, + { NPCID.QueenSlimeMinionPink, 6000 }, + { NPCID.QueenSlimeMinionPurple, 5000 }, + { NPCID.Spazmatism, 150000 }, // 30 seconds + { NPCID.Retinazer, 125000 }, + { NPCID.TheDestroyer, 600000 }, // 30 seconds + immunity timer at start + { NPCID.TheDestroyerBody, 600000 }, + { NPCID.TheDestroyerTail, 600000 }, + { NPCID.Probe, 10000 }, + { NPCID.SkeletronPrime, 160000 }, // 30 seconds + { NPCID.PrimeVice, 54000 }, + { NPCID.PrimeCannon, 45000 }, + { NPCID.PrimeSaw, 45000 }, + { NPCID.PrimeLaser, 38000 }, + { NPCID.Plantera, 160000 }, // 30 seconds + { NPCID.PlanterasTentacle, 5000 }, + { NPCType(), 5000 }, + // Tier 3 + { NPCID.Golem, 100000 }, // 30 seconds + { NPCID.GolemHead, 70000 }, + { NPCID.GolemFistLeft, 30000 }, + { NPCID.GolemFistRight, 30000 }, + { NPCID.HallowBoss, 200000 }, // 30 seconds + { NPCID.DukeFishron, 290000 }, // 30 seconds + { NPCID.CultistBoss, 220000 }, // 30 seconds + { NPCID.CultistDragonHead, 60000 }, + { NPCID.CultistDragonBody1, 60000 }, + { NPCID.CultistDragonBody2, 60000 }, + { NPCID.CultistDragonBody3, 60000 }, + { NPCID.CultistDragonBody4, 60000 }, + { NPCID.CultistDragonTail, 60000 }, + { NPCID.AncientCultistSquidhead, 50000 }, + { NPCID.MoonLordCore, 160000 }, // 1 minute + { NPCID.MoonLordHand, 45000 }, + { NPCID.MoonLordHead, 60000 }, + { NPCID.MoonLordLeechBlob, 800 } + }; + + /// + /// Associates an NPC type with an ID number used for Calamity's Speedrun Timer. Used for drawing the correct map icon for the boss.
+ /// If an NPC type is not a key in this dictionary, then it will not be displayed on the Speedrun Timer. + ///
+ public static Dictionary BossSpeedrunTimerID = new Dictionary + { + { NPCID.KingSlime, 1 }, + { NPCType(), 2 }, + { NPCID.EyeofCthulhu, 3 }, + { NPCType(), 4 }, + { NPCID.EaterofWorldsHead, 5 }, + { NPCID.EaterofWorldsBody, 5 }, + { NPCID.EaterofWorldsTail, 5 }, + { NPCID.BrainofCthulhu, 6 }, + { NPCType(), 7 }, + { NPCType(), 8 }, + { NPCID.QueenBee, 9 }, + { NPCID.SkeletronHead, 10 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCType(), 11 }, + { NPCID.WallofFlesh, 12 }, + { NPCType(), 13 }, + { NPCID.Retinazer, 14 }, + { NPCID.Spazmatism, 14 }, + { NPCType(), 15 }, + { NPCID.TheDestroyer, 16 }, + { NPCType(), 17 }, + { NPCID.SkeletronPrime, 18 }, + { NPCType(), 19 }, + { NPCID.Plantera, 20 }, + { NPCType(), 21 }, + { NPCType(), 21 }, + { NPCType(), 22 }, + { NPCID.Golem, 23 }, + { NPCType(), 24 }, + { NPCID.DukeFishron, 25 }, + { NPCType(), 26 }, + { NPCID.CultistBoss, 27 }, + { NPCType(), 28 }, + { NPCID.MoonLordCore, 29 }, + { NPCType(), 30 }, + { NPCType(), 31 }, + { NPCType(), 32 }, + { NPCType(), 33 }, + { NPCType(), 34 }, + { NPCType(), 35 }, + { NPCType(), 36 }, + { NPCType(), 37 }, + { NPCType(), 38 }, + { NPCType(), 39 }, + { NPCType(), 40 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCType(), 41 }, + { NPCID.QueenSlimeBoss, 42 }, + { NPCID.HallowBoss, 43 }, + { NPCID.Deerclops, 44 } + }; + } +} diff --git a/Systems/Collections/CalamityNPCTypeSets.cs b/Systems/Collections/CalamityNPCTypeSets.cs new file mode 100644 index 0000000000..3985e71ee1 --- /dev/null +++ b/Systems/Collections/CalamityNPCTypeSets.cs @@ -0,0 +1,72 @@ +using System.Collections.Generic; +using CalamityMod.NPCs.AquaticScourge; +using CalamityMod.NPCs.AstrumDeus; +using CalamityMod.NPCs.DesertScourge; +using CalamityMod.NPCs.DevourerofGods; +using CalamityMod.NPCs.ExoMechs.Ares; +using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.NPCs.NormalNPCs; +using CalamityMod.NPCs.Perforator; +using CalamityMod.NPCs.Ravager; +using CalamityMod.NPCs.SlimeGod; +using CalamityMod.NPCs.StormWeaver; +using ReLogic.Reflection; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityNPCTypeSets + { + public static SetFactory Factory = new SetFactory(NPCLoader.NPCCount, "CalamityMod/NPCType", Search); + public static IdDictionary Search = IdDictionary.Create(); + + public static bool[] AngryBones = Factory.CreateBoolSet(NPCID.AngryBones, NPCID.AngryBonesBig, NPCID.AngryBonesBigMuscle, NPCID.AngryBonesBigHelmet); + + public static bool[] BoundTownNPC = Factory.CreateBoolSet(NPCID.BoundGoblin, NPCID.BoundWizard, NPCID.BoundMechanic, NPCID.SleepingAngler, NPCID.BartenderUnconscious, + NPCID.WebbedStylist, NPCID.GolferRescue); + + public static bool[] Hornet = Factory.CreateBoolSet(NPCID.Hornet, NPCID.HornetFatty, NPCID.HornetHoney, NPCID.HornetLeafy, NPCID.HornetSpikey, NPCID.HornetStingy); + + // Used for dropping Ancient Bone Dust, vanilla has a Skeleton NPCID set which has more unwanted enemies in it + public static bool[] Skeleton = Factory.CreateBoolSet(NPCID.Skeleton, NPCID.HeadacheSkeleton, NPCID.MisassembledSkeleton, NPCID.PantlessSkeleton, NPCID.BoneThrowingSkeleton, + NPCID.BoneThrowingSkeleton2, NPCID.BoneThrowingSkeleton3, NPCID.BoneThrowingSkeleton4, NPCID.SkeletonTopHat, NPCID.SkeletonAstonaut, NPCID.SkeletonAlien, + NPCID.ArmoredSkeleton, NPCID.SkeletonArcher, NPCID.GreekSkeleton, NPCID.SporeSkeleton); + + // Unused, though is more restrictive than the vanilla Zombie NPCID set + public static bool[] Zombie = Factory.CreateBoolSet(NPCID.Zombie, NPCID.ArmedZombie, NPCID.BaldZombie, NPCID.PincushionZombie, NPCID.ArmedZombiePincussion, NPCID.SlimedZombie, + NPCID.ArmedZombieSlimed, NPCID.SwampZombie, NPCID.ArmedZombieSwamp, NPCID.TwiggyZombie, NPCID.ArmedZombieTwiggy, NPCID.FemaleZombie, NPCID.ArmedZombieCenx, + NPCID.ZombieRaincoat, NPCID.ZombieEskimo, NPCID.ArmedZombieEskimo, NPCID.MaggotZombie, NPCType()); + + + + public static List AquaticScourge = [ NPCType(), NPCType(), NPCType(), NPCType() ]; + + public static List Ares = [ NPCType(), NPCType(), NPCType(), NPCType(), NPCType() ]; + + public static List AstrumDeus = [ NPCType(), NPCType(), NPCType() ]; + + public static List DesertScourge = [ NPCType(), NPCType(), NPCType() ]; + + public static List Destroyer = [ NPCID.TheDestroyer, NPCID.TheDestroyerBody, NPCID.TheDestroyerTail ]; + + public static List DevourerOfGods = [ NPCType(), NPCType(), NPCType() ]; + + public static List EaterOfWorlds = [ NPCID.EaterofWorldsHead, NPCID.EaterofWorldsBody, NPCID.EaterofWorldsTail ]; + + public static List Perforators = [ NPCType(), NPCType(), NPCType(), NPCType(), + NPCType(), NPCType(), NPCType(), NPCType(), NPCType() ]; + + public static List Ravager = [ NPCType(), NPCType(), NPCType(), NPCType(), NPCType(), NPCType() ]; + + public static List SkeletronPrime = [ NPCID.SkeletronPrime, NPCID.PrimeCannon, NPCID.PrimeLaser, NPCID.PrimeSaw, NPCID.PrimeVice ]; + + public static List SlimeGod = [ NPCType(), NPCType(), NPCType(), NPCType(), NPCType() ]; + + public static List StormWeaver = [ NPCType(), NPCType(), NPCType() ]; + + public static List Thanatos = [ NPCType(), NPCType(), NPCType(), NPCType() ]; + } +} diff --git a/Systems/Collections/CalamityProjectileSets.cs b/Systems/Collections/CalamityProjectileSets.cs new file mode 100644 index 0000000000..3e0b91e9f0 --- /dev/null +++ b/Systems/Collections/CalamityProjectileSets.cs @@ -0,0 +1,113 @@ +using CalamityMod.Projectiles.Boss; +using CalamityMod.Projectiles.Magic; +using CalamityMod.Projectiles.Rogue; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Projectiles.Typeless; +using ReLogic.Reflection; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityProjectileSets + { + public static SetFactory Factory = new SetFactory(ProjectileLoader.ProjectileCount, "CalamityMod/ProjectileID", Search); + public static IdDictionary Search = IdDictionary.Create(); + + /// + /// If for a projectile type, then that minion will completely ignore Calamity's summon damage penalty mechanic with no exceptions.
+ /// Unused by Calamity itself, and is only used for external mods to add to through mod calls.
+ /// Defaults to . + ///
+ public static bool[] MinionWhichIgnoresSummonerNerf = Factory.CreateBoolSet(); + + /// + /// If for a projectile type, then that projectile is spawned by a post-Plantera Dungeon enemy.
+ /// This increases the projectile's damage by a flat 30 if Moon Lord has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedDungeonProjectile = Factory.CreateBoolSet(ProjectileID.PaladinsHammerHostile, ProjectileID.ShadowBeamHostile, ProjectileID.InfernoHostileBolt, + ProjectileID.InfernoHostileBlast, ProjectileID.LostSoulHostile, ProjectileID.SniperBullet, ProjectileID.RocketSkeleton, ProjectileID.BulletDeadeye, ProjectileID.Shadowflames); + + /// + /// If for a projectile type, then that projectile is spawned by a Solar Eclipse, Pumpkin Moon, or Frost Moon enemy.
+ /// This increases the projectile's damage by a flat 15 during those events if Devourer of Gods has been defeated.
+ /// Defaults to . + ///
+ public static bool[] IsBuffedEventProjectile = Factory.CreateBoolSet(ProjectileID.FlamingWood, ProjectileID.GreekFire1, ProjectileID.GreekFire2, ProjectileID.GreekFire3, + ProjectileID.FlamingScythe, ProjectileID.FlamingArrow, ProjectileID.PineNeedleHostile, ProjectileID.OrnamentHostile, ProjectileID.OrnamentHostileShrapnel, + ProjectileID.FrostWave, ProjectileID.FrostShard, ProjectileID.Missile, ProjectileID.Present, ProjectileID.Spike, ProjectileID.BulletDeadeye, ProjectileID.EyeLaser, + ProjectileID.Nail, ProjectileID.DrManFlyFlask); + + /// + /// If for a projectile type, then that projectile is considered a friendly bee.
+ /// Used to allow the projectile to inflict Plague while wearing the Plaguebringer armor.
+ /// Defaults to . + ///
+ public static bool[] IsFriendlyBeeProjectile = Factory.CreateBoolSet(ProjectileID.GiantBee, ProjectileID.Bee, ProjectileID.Wasp, ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType()); + + /// + /// If for a projectile type, then that projectile is a bomb or other explosive which is not a weapon.
+ /// Used to provide early-game worm bosses a resistance to their explosive damage.
+ /// Defaults to . + ///
+ public static bool[] ResistedExplosiveProjectile = Factory.CreateBoolSet(ProjectileID.Grenade, ProjectileID.StickyGrenade, ProjectileID.BouncyGrenade, ProjectileID.Bomb, + ProjectileID.StickyBomb, ProjectileID.BouncyBomb, ProjectileID.Dynamite, ProjectileID.StickyDynamite, ProjectileID.BouncyDynamite, ProjectileID.Explosives, + ProjectileID.ExplosiveBunny, ProjectileID.PartyGirlGrenade, ProjectileID.BombFish, ProjectileID.ScarabBomb, ProjectileID.TNTBarrel, ProjectileType()); + + /// + /// If for a projectile type, then that projectile will never be reflected by armor or accessory effects.
+ /// Set this for persistent projectiles such as deathrays to avoid major screwing of their behavior.
+ /// Only needs to be set for hostile projectiles, as these effects already have a check to ensure they never trigger in PvP.
+ /// Defaults to . + ///
+ public static bool[] ShouldNotBeReflected = Factory.CreateBoolSet(ProjectileID.SaucerDeathray, ProjectileID.PhantasmalDeathray, ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType()); + + /// + /// Determines what other projectiles this projectile will share ID-static immunity frames with. Defaults to -1, which means that it does not share immunity frames.
+ /// Each "set" of projectile which shares immunity frames is registered to point to the same ID reference, usually the first projectile in the set. If a projectile with this reference hits an NPC, all other projectiles with that reference also have their ID-static immunity cooldown set for that NPC. + ///
+ public static int[] SharedIDStaticIFrames = Factory.CreateIntSet(-1, + // Vanilla bees + ProjectileID.Bee, ProjectileID.Bee, + ProjectileID.GiantBee, ProjectileID.Bee, + // Vilethorn + ProjectileID.VilethornBase, ProjectileID.VilethornBase, + ProjectileID.VilethornTip, ProjectileID.VilethornBase, + // Nettle Burst + ProjectileID.NettleBurstRight, ProjectileID.NettleBurstRight, + ProjectileID.NettleBurstLeft, ProjectileID.NettleBurstRight, + ProjectileID.NettleBurstEnd, ProjectileID.NettleBurstRight, + // Magical Harp notes + ProjectileID.QuarterNote, ProjectileID.QuarterNote, + ProjectileID.EighthNote, ProjectileID.QuarterNote, + ProjectileID.TiedEighthNote, ProjectileID.QuarterNote, + // North Pole + ProjectileID.NorthPoleWeapon, ProjectileID.NorthPoleWeapon, + ProjectileID.NorthPoleSpear, ProjectileID.NorthPoleWeapon, + ProjectileID.NorthPoleSnowflake, ProjectileID.NorthPoleWeapon, + // Spore gas clouds + ProjectileID.SporeTrap, ProjectileID.SporeTrap, + ProjectileID.SporeTrap2, ProjectileID.SporeTrap, + ProjectileID.SporeGas, ProjectileID.SporeTrap, + ProjectileID.SporeGas2, ProjectileID.SporeTrap, + ProjectileID.SporeGas3, ProjectileID.SporeTrap, + // Astral Staff + ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), + // Keelhaul + ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), + // Toxic clouds + ProjectileID.ToxicCloud, ProjectileID.ToxicCloud, + ProjectileID.ToxicCloud2, ProjectileID.ToxicCloud, + ProjectileID.ToxicCloud3, ProjectileID.ToxicCloud + ); + } +} diff --git a/Systems/Collections/CalamityTileSets.cs b/Systems/Collections/CalamityTileSets.cs new file mode 100644 index 0000000000..e241e9881b --- /dev/null +++ b/Systems/Collections/CalamityTileSets.cs @@ -0,0 +1,22 @@ +using CalamityMod.Tiles.LivingFire; +using ReLogic.Reflection; +using Terraria.ID; +using Terraria.ModLoader; +using static Terraria.ModLoader.ModContent; + +namespace CalamityMod.Systems.Collections +{ + [ReinitializeDuringResizeArrays] + public static class CalamityTileSets + { + public static SetFactory Factory = new SetFactory(TileLoader.TileCount, "CalamityMod/TileID", Search); + public static IdDictionary Search = IdDictionary.Create(); + + /// + /// Should only contain modded tiles. If for a tile type, then that tile can be replaced by the Abyss during world generation.
+ /// Unused by Calamity itself, and is only used for external mods to add to through reflection.
+ /// Defaults to . + ///
+ public static bool[] CanBeReplacedByAbyssGeneration = Factory.CreateBoolSet(); + } +} diff --git a/Systems/Collections/ConfusionDebuffImmunitiesList.cs b/Systems/Collections/ConfusionDebuffImmunitiesList.cs deleted file mode 100644 index 5b7e79cc23..0000000000 --- a/Systems/Collections/ConfusionDebuffImmunitiesList.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.Astral; -using CalamityMod.NPCs.Crags; -using CalamityMod.NPCs.NormalNPCs; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains all of the NPC's IDs of the NPCs who are immune to the Confusion debuff. - /// - public sealed class ConfusionDebuffImmunitiesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if an NPC is supposed to be immune to the Confusion debuff. - /// - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/DebuffsList.cs b/Systems/Collections/DebuffsList.cs deleted file mode 100644 index 39b22ffc30..0000000000 --- a/Systems/Collections/DebuffsList.cs +++ /dev/null @@ -1,100 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs; -using CalamityMod.Buffs.Cooldowns; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a that has all Debuff IDs. - /// - public sealed class DebuffsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffID.Poisoned, - BuffID.Darkness, - BuffID.Cursed, - BuffID.OnFire, - BuffID.Bleeding, - BuffID.Confused, - BuffID.Slow, - BuffID.Weak, - BuffID.Silenced, - BuffID.BrokenArmor, - BuffID.CursedInferno, - BuffID.Frostburn, - BuffID.Chilled, - BuffID.Frozen, - BuffID.Burning, - BuffID.Suffocation, - BuffID.Ichor, - BuffID.Venom, - BuffID.Blackout, - BuffID.Electrified, - BuffID.Rabies, - BuffID.Webbed, - BuffID.Stoned, - BuffID.Dazed, - BuffID.VortexDebuff, - BuffID.WitheredArmor, - BuffID.WitheredWeapon, - BuffID.OgreSpit, - BuffID.BetsysCurse, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - // BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if a buff ID is a debuff. - /// - public static bool Includes(int buffID) => List.Contains(buffID); - } -} diff --git a/Systems/Collections/DisabledSummonerNerfItemList.cs b/Systems/Collections/DisabledSummonerNerfItemList.cs deleted file mode 100644 index 0f312357da..0000000000 --- a/Systems/Collections/DisabledSummonerNerfItemList.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DisabledSummonerNerfItemList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = []; - } - - public override void Unload() => List = null; - - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/DisabledSummonerNerfMinionList.cs b/Systems/Collections/DisabledSummonerNerfMinionList.cs deleted file mode 100644 index 48a47c670b..0000000000 --- a/Systems/Collections/DisabledSummonerNerfMinionList.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Collections.Generic; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DisabledSummonerNerfMinionList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = []; - } - - public override void Unload() => List = null; - - public static bool Includes(int projType) => List.Contains(projType); - } -} diff --git a/Systems/Collections/DonatorsNameList.cs b/Systems/Collections/DonatorsNameList.cs index 579e50bb84..258a4fbd64 100644 --- a/Systems/Collections/DonatorsNameList.cs +++ b/Systems/Collections/DonatorsNameList.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Linq; using Terraria; using Terraria.ModLoader; @@ -11,658 +12,754 @@ namespace CalamityMod.Systems.Collections { public static IList List { get; private set; } - public override void OnModLoad() - { - List = - [ - "Vorbis", - "SoloMael", - "Chaotic Reks", - "The Buildmonger", - "YuH", - "Littlepiggy", - "LompL", - "Lilith", - "Ben Shapiro", - "Frederik", - "Faye", - "Gibb50", - "Braden", - "Hannes", - "profoundmango69", - "Jack", - "Hans Volter", - "Krankwagon", - "MishiroUsui", - "pixlgray", - "Arkhine", - "Lodude", - "DevAesthetic", - "Mister Winchester", - "Zacky", - "Veine", - "Javyz", - "Shifter", - "Crysthamyr", - "Elfinlocks", - "Ein", - "2Larry2", - "Jenonen", - "Dodu", - "Arti", - "Tervastator", - "Luis", - "Alexander", - "BakaQing", - "Taylor", - "Xaphlactus", - "MajinBagel", - "Bendy", - "Rando Calrissian", - "Tails the Fox 92", - "Bread", - "Minty Candy", - "Preston", - "MovingTarget_086", - "Shiro", - "Chip", - "Taylor", - "ShotgunAngel", - "Sandblast", - "ThomasThePencil", - "Aero (Aero#4599)", - "Shirosity", // used to be GlitchOut - "Daawnz", - "CrabBar", - "Yatagarasu", - "Jarod", - "Zombieh", - "MingWhy", - "Random Weeb", - "Afzofa", - "Eragon3942", - "TheBlackHand", - "william", - "Samuel", - "Christopher", - "DemoN K!ng", - "Malik", - "Ryan Baker-Ortiz", - "Aleksanders", - "TheSilverGhost", - "Lucazii", - "Shay", - "Prism", - "BobIsNotMyRealName", - "Guwahavel", - "Azura", - "Joshua", - "Doveda", - "William", - "Arche", - "DevilSunrise", - "Yanmei", - "Chaos", - "Ryan", - "Fish Repairs", - "Melvin", - "Vroomy Has -3,000 IQ", - "The Goliath", - "DaPyRo", - "Takeru", - "Circuit-Jay", - "Commmander Frostbite", - "cytokat", - "Cameron", - "Orudeon", - "BumbleDoge", - "Naglfar", - "Helixas", - "Vetus", - "High Charity", - "Devonte", - "Cerberus", - "Brendan", - "Victor", - "KAT-G307", - "Tombarry Expresserino", - "Drip Veezy", - "Glaid", - "Apotheosis", - "Bladesaber", - "Devon", - "Ruthoranium", - "cocodezi_", - "Mendzey", - "GameRDheAsianSandwich", - "Chigbungus", - "Streakist", - "Eisaya", - "Xenocrona", - "RKMoon", - "Eternal Silence", - "Jeff", - "Beta165", - "DanYami", - "Xenocrona", - "Ari", - "cosmickalamity", - "xd Ow0", - "Darren", - "Florian", - "dawn thunder", - "asdf935", - "GentSkeleton", - "Fizzlpoprock", - "Pigeon", - "Aleksh", - "Just a random guy", - "Dee", - "Æthereal", - "Broken Faucet", - "Sarcosuchus", - "Marissa443", - "Warlok", - "JackShizz", - "NebulaMagePlays", - "Primpy", - "Thys", - "Min", - "Wodernet", - "Pedro", - "Depressed Dad Gaming", - "Snowy", - "Stormone", - "Mobian", - "Rinja", - "Check pins", - "Dakota", - "Neoplasmatic", - "False", - "Whitegiraffe", - "Drakkece", - "Levi", - "Izuna", - "djsnj20", - "pyobbo", - "Alec", - "The Illustrious Sqouinchuousor", - "Moist Lad", - "TwanTheGOAT", - "3x1t_5tyl3", - "Will", - "SpookyNinja", - "Boomdiada", - "Culex", - "Rossadon", - "Ben", - "hubert thieblot", - "NepNep", - "Nanaki", - "CrimsonCrips", - "Lagohz", - "Timon", - "F00d Demon", - "Olkothan", - "Vmar98", - "Dasdruid", - "Cinder", - "Brutzli", - "Yhashtur", - "Zekai", - "Doug", - "Uberransy", - "KurlozClown", - "Nemesis 041", - "Asheel", - "Hayden", - "Lightedflare", - "Lady Shira", - "Devin", - "Qelrin", - "Thomas", - "Ne'er Dowell", - "Potion Man", - "martyrdomination", - "Destructoid", - "Coolguystorm YT", - "Wolfmaw", - "yiumik", - "Destiny Stallcup", - "GreenBerry", - "SolsticeUnlimitd", - "darkhawke", - "oracle", - "YumeiSenshi", - "Cameron", - "Aeroni", // previously "Toxin" - "Fweepachino", - "DESPACITO", - "Altzeus", - "Ryan", - "Spider region", - "WinterTire", - "Nycro", - "Vyster", // previously "Bewearium" - "William", - "HellGoat2", - "116taj", - "CaineSenpai", - "Suicide Dreams", - "Roxas", - "Obsoleek", - "Jetpat3", - "GreenTea", - "Woah", - "Ryaegos", - "Popsickle Yoshi", - "Arcadia", - "JensB__", - "Nuclei", - "Picasso's Bean", - "Corn M. Cobb", - "kgh8090", - "Luke", - "Barbara", - "Alexis", - "Soko", - "Albino gonkvader", - "Monic", - "Slim", - "ChaosChaos", - "Deallly", - "Jeff", - "vcf55", - "Kazurgundu", - "Jheybyrd", - "Kipluck", - "SCONICBOOM", - "Mr.Matter", - "Billy", - "jjth0m3", - "GTW High Cube", - "Sabrina", - "Potato - Stego", - "Perditio Astrum", - "MaxingOut", - "SharZz", - "Allegro", - "hoosfire", - "Lauren", - "Ultra Succ", - "Ethan", - "Pacnysam", - "dummyAzure", - "Jaykob", - "Goblin", - "NoOneElse", - "Nicholas", - "oli saer", - "Blobby6799", - "Domrinth", - "zombieseatflesh7", - "Shiny", - "Whale", - "The Infinity", - "MrCreamen", - "TemperedAether", - "LucasTwocas", - "JustLonelyPi", - "Brian", - "Ashton", - "Rolandark", - "Ally2Cute", - "Dionysos", - "Plant Waifu", - "fire", - "Charles", - "Kaden", - "Dr. Pawsworth", - "Jackson", - "Freakish", - "Ashamper", - "Kinzoku", - "Elementari", - "The Wolf Commando", - "Jordan", - "Jessire", - "Ashton", - "callisto", - "velneu", - "Mathuantie", - "Robert", - "Matias", - "T E R M I N A T O R", - "apotofkoolaid", - "Matthew", - "Terrarian Dragon", - "Pomelo", - "Thomas", - "Iconic Parker Gaming", - "Jaydon", - "Aidan", - "Avery", - "yayoi", - "Splotchycrib", - "GIGA MAN", - "Eric", - "Merubel", - "Smug", - "Lime-Wars l 1", - "WillyDilly", - "xAqult", - "Himakaze", - "Face", - "Carboniferous", - "James", - "Taitou1", - "Yumi", - "NEBULA", - "Blackbluue", - "Alex", - "Ruben", - "Rixu", - "Antonie", - "Zerimore", - "Oblivionisbruh", - "Loser", - "Patrick", - "Magic Love", - "gluten tag", - "RetroRed", - "Katherine", - "SoyScoutSmasher", - "Jersey", - "Reiter splash", - "Conner", - "Ekun", - "Driser", - "bikmin", - "MittoMan", - "Pyromaniac146", - "Eddie Spaghetti", - "Colin", - "ZyferDex_", - "LumiEvi", - "Anish", - "MissMudflaps", - "Valkyrie", - "anglerraptor", - "Scribbles", - "Pneuma", - "OrrangProto", - "Tomat (Stevie)", - "That Katsafaros", - "PsychoGrizzly", - "Dayne", - "Hargestar", - "The Pyro", - "Lucas", - "Superbeepig", - "Larry That Barry", - "Monti", - "StarryFox", - "Kevin", - "Poopifier Poopifly", - "Lacuna", - "Nathan", - "Handburger", - "XusTingo9", - "Underlost", - "julius", - "Mark", - "Habb", - "Reanamet", - "Empress Vega", - "Team", - "GP", - "Xsiana", - "NyanLegacy215", - "ethan", - "Trinity Series", - "M001NG", - "WrathOfOlympus", - "dennis", - "Darkweb", - "Chaozhi", - "Mars", - "Elijah", - "Tezguin", - "Shpee", - "Archie", - "Meow", - "CosmicStarIight", - "Alfragiste", - "Number1piratepan", - "Noah", - "Max Kim", - "Anton", - "edm vibes", - "Hunter", - "Doodled_lynx", - "3en", - "Kiyotu", - "Aero", - "Iguy", - "병현 송", - "Tyler", - "Leonidas", - "GregTheSpinarak", - "Cheddar", - "Alex N", - "Magicoal", - "Seanツ", - "Ariscottle", - "Kevin", - "OnTheAirPogs", - "Zerafir", - "Bill", - "Starmitzy", - "FaeLoPondering", - "Brian", - "Smart2004", - "sherk", - "Squishy", - "Ash", - "rawpie2", - "Hokojin", - "sk", - "Done", - "MeanieG", - "Sanctuary", - "Landon", - "Moonicento", - "Hayden", - "Steven", - "Hana", - "Mikabul", - "Nathaniel", - "Brutus", - "EdelVollMilch", - "garfu", - "NuT NiTe", - "adain", - "Dylan", - "Lucas", - "Arthur", - "sweatingdishes", - "pomp neigh", - "Proffesor prostate", - "Saladify", - "26-4-1", - "VeryMasterNinja", - "Vorbis", - "Nyapano", - "Shadoku", - "allosar", - "jes", - "Paltham", - "Fartein", - "Derdjin", - "A_Normal_Person", - "Duck Satan", - "Jalapeno9", - "Grylken", - "Nexus", - "KJ", - "Goober", - "ChAoS DiScOrD", - "Mayhem", - "Zombified _G", - "Madd Cat", - "Natalie", - "Solaire", - "Dakota C", - "The Davester", - "Jose", - "Him", - "Umberto", - "Lance", - "Navigator", - "Ferret4T", - "Rooki", - "LvL-94", - "Feels Fishy", - "Korb Orb", - "Calcium Comrade", - "Talmadge", - "ddoogg88 tdog", - "CasualNoLifer", - "Bossy Punch", - "Creamy", - "Tyler", - "topnormal", - "Gilded Gryphon", - "Nightskyflyer", - "Schlarfblrfsch", - "MrNobody", - "Aden C.N.", - "zombie wolf", - "n0tacat", - "Marko", - "dexxer65", - "DeLordeyeee", - "Kaledoulas", - "Mohammad", - "Skeli_G", - "Arcxus", - "Sigil", - "Dull", - "DjackV", - "Misinput", - "Gameology", - "KugelBlitz", - "TheGreatSako", - "Joep", - "Rottingwood", - "anything5000", - "Gretchen", - "Spirit Shield", - "Briny_Coffee", - "_Skeggy_", - "just akkolite", - "J.U.N.E.S", - "Bruggs", - "Vimek Xol", - "Oceanman232", - "Sadouken", - "srxe", - "ProfessorWinston", - "OctolingGrimm", - "Cole", - "Markie", - "Met Vox", - "Tweee", - "Kaimonick", - "Chow Chow", - "drenmus!", - "Nitronium Productions", - "Goomfrontlut", - "Akkolite", - "Shaun", - "Bruh.PNG", - "James", - "Lord_Lucerne", - "Ulmod", - "Adamko", - "Gamma Freya", - "Finnrua", - "Maskedmilo", - "RockRecker39", - "Konorango", - "Indeciiissive", - "Curtis", - "Ponynator", - "Crippling-Ambition", - "TitaniumLlama", - "OriginForme487", - "FishBread", - "Real mystlc", - "Levi", - "jc.", - "Medi", - "Jakob", - "Borb9834", - "Georgios", - "KeL", - "Cody", - "Cristian(Mihaii)", - "Marco", - "RuskieThe3rd", - "BreachNClear747", - "happy thoughts", - "Azure", - "theHoopty", - "porglesupreme", - "XDkilljoy65XX", - "Mr. Bones", - "dawnboi", - "Joe", - "Sailor Jolt", - "SomeRando", - "Nuclear Chaos", - "Jankle", - "The Roborex", - "everquartz", - "discokittie", - "IsaacInsomnia", - "xElectrix_", - "Forge", - "MiyoshiEira", - "thebettercat", - "Darthlego", - "Azzilan", - "Griffin", - "LucasHM", - "ChrigTopher", - "Colin V", - "Scrumlet", - "Darkus", - "Homunculus Derelictus", - "Professor Pissington", - "Buppercups - Roblox", - "Pusheen_", - "Patrera" - ]; - } - - public override void Unload() => List = null; + /// + /// This list contains all the donors of the current Patreon, which is for the entire Calamity Dev Team.

+ /// There is no overlap between OriginalPatreonList and this list.

+ /// Any user who donates to the new team-wide Patreon gets added to this new list and removed from the old one. + ///
+ internal static IList NewPatreonList { get; private set; } /// - /// Returns 25 random donator usernames. + /// This list contains all the donors of the previous Patreon, which was in Fabsol's name.

+ /// There is no overlap between NewPatreonList and this list.

+ /// Any user who donates to the new team-wide Patreon gets added to the new list and removed from this one. ///
- public static string[] GetRandomDonors() - { - List donorList = new(List); - const int maxDonorsListed = 25; - string[] donors = new string[maxDonorsListed]; - for (int i = 0; i < maxDonorsListed; i++) - { - donors[i] = donorList[Main.rand.Next(donorList.Count)]; - donorList.Remove(donors[i]); - } + internal static IList OriginalPatreonList { get; private set; } - return donors; + public override void OnModLoad() + { + // All donors at the $10 - Brimstone tier or higher are included in the shout-out. + // This is updated for each release. + NewPatreonList = + [ + "Aerosyn", + "Aidan Spears", + "Amandalias", + "Arcxus", + "Ariallis", + "Audrey Lynn Beemus", + "awesomechapro", + "Azariah", + "azazel", + "Ballin", + "Barrett Turner", + "BlueRay_256", + "Boomdiada", + "Borb9834", + "botbot94", + "Bwlstorm", + "c0d3_404", + "Carduelis", + "Careless_imp", + "Chin", + "Cinder", + "CrazyGamer69", + "Darthlego", + "Diamond Nife", + "djsnj20", + "DOGMA", + "DogVTF", + "drake093104", + "Entrian", + "Equinoxux", + "EternalGrayson", + "FishBread", + "goo", + "Grant Curtiss", + "haefer.goat.oats", + "Halleyvetica", + "Hamsting", + "help", + "Iptktp9", + "J.U.N.E.S", + "Jace Ufret", + "Jalapeno9", + "Jankle", + "JFL", + "Kiddorox", + "Liam Rafle", + "Magicoal", + "Mint_loll", + "MizzUltraViolet DamienTK", + "Nature", + "niceguysrage", + "Nick H", + "Nightinglade", + "Nothin Purrsonal", + "Nova Solarius", + "NyxxyNightstar", + "OakhamSam", + "PantySlack", + "Patch357", + "Phil Broome", + "Qwertz", + "Reece", + "roryoftheabyss", + "RuskieThe3rd", + "Sable", + "SakuraWinterz", + "Salted Warlock", + "schmoovi", + "Sharktank6", + "Shayy", // Current dev. Listed as "Shay" on Patreon. + "SirChaos189", + "SkeletonHunter96", + "Taelishe", + "Taylor Olligoci", // also an ex-dev. Listed as "Lilac Olligoci" on Patreon. There were two "Taylor"s on the old list + "Tethox", + "That Katsafaros", + "The Deer Who Sold The World", + "The Roborex", + "The Wither", + "Trinity Series", + "Tsukara", + "Vanillin", + "Vertigo", + "weisslerren", + "xAqult", + "Xtra Trinity 3678", + "Xtra", + "Xzier_Tengal", + "YashimaYamanata", + "Zachtoplasm", + "ZoeyPlague", + ]; + + // Historical donor list. Please never remove names from here unless you are also adding them to NewPatreonList. + OriginalPatreonList = + [ + "_Skeggy_", + "116taj", + "26-4-1", + "2Larry2", + "3en", + "3x1t_5tyl3", + "A_Normal_Person", + "adain", + "Adamko", + "Aden C.N.", + "Aero", + "Aero (Aero#4599)", + "Aeroni", // previously "Toxin" + "Æthereal", + "Afzofa", + "Aidan", + "Akkolite", + "Albino gonkvader", + "Alec", + "Aleksanders", + "Aleksh", + "Alex", + "Alex N", + "Alexander", + "Alexis", + "Alfragiste", + "Allegro", + "allosar", + "Ally2Cute", + "Altzeus", + "anglerraptor", + "Anish", + "Anton", + "Antonie", + "anything5000", + "Apotheosis", + "apotofkoolaid", + "Arcadia", + "Arche", + "Archie", + "Ari", + "Ariscottle", + "Arkhine", + "Arthur", + "Arti", + "asdf935", + "Ash", + "Ashamper", + "Asheel", + "Ashton", + "Ashton", + "Avery", + "Azura", + "Azure", + "Azzilan", + "BakaQing", + "Barbara", + "Ben", + // "Ben Shapiro", // 01JUN2025: Ozzatron: we already have this as a guide name. That's enough. Melting him in lava is appropriate. Crediting him for funding is not. + "Bendy", + "Beta165", + "bikmin", + "Bill", + "Billy", + "Blackbluue", + "Bladesaber", + "Blobby6799", + "BobIsNotMyRealName", + "Boomdiada", + "Borb9834", + "Bossy Punch", + "Braden", + "BreachNClear747", + "Bread", + "Brendan", + "Brian", + "Brian", + "Briny_Coffee", + "Broken Faucet", + "Bruggs", + "Bruh.PNG", + "Brutus", + "Brutzli", + "BumbleDoge", + "Buppercups - Roblox", + "CaineSenpai", + "Calcium Comrade", + "callisto", + "Cameron", + "Cameron", + "Carboniferous", + "CasualNoLifer", + "Cerberus", + "Chaos", + "ChAoS DiScOrD", + "ChaosChaos", + "Chaotic Reks", + "Chaozhi", + "Charles", + "Check pins", + "Cheddar", + "Chigbungus", + "Chip", + "Chow Chow", + "ChrigTopher", + "Christopher", + "Circuit-Jay", + "cocodezi_", + "Cody", + "Cole", + "Colin", + "Colin V", + "Commmander Frostbite", + "Conner", + "Coolguystorm YT", + "Corn M. Cobb", + "cosmickalamity", + "CosmicStarIight", + "CrabBar", // Current dev. + "Creamy", + "CrimsonCrips", + "Crippling-Ambition", + "Cristian(Mihaii)", + "Crysthamyr", + "Culex", + "Curtis", + "cytokat", + "Daawnz", + "Dakota", + "Dakota C", + "DanYami", + "DaPyRo", + "darkhawke", + "Darkus", + "Darkweb", + "Darren", // Current dev. + "Darthlego", + "Dasdruid", + "dawn thunder", + "dawnboi", + "Dayne", + "ddoogg88 tdog", + "Deallly", + "Dee", + "DeLordeyeee", + "DemoN K!ng", + "dennis", + "Depressed Dad Gaming", + "Derdjin", + "DESPACITO", + "Destiny Stallcup", + "Destructoid", + "DevAesthetic", + "DevilSunrise", + "Devin", + "Devon", + "Devonte", + "dexxer65", + "Dionysos", + "discokittie", + "DjackV", + "djsnj20", + "Domrinth", + "Done", + "Doodled_lynx", + "Doug", + "Doveda", + "Dr. Pawsworth", + "Drakkece", + "drenmus!", + "Drip Veezy", + "Driser", + "Duck Satan", + "Dull", + "dummyAzure", + "Dylan", + "Eddie Spaghetti", + "EdelVollMilch", + "edm vibes", + "Ein", + "Eisaya", + "Ekun", + "Elementari", + "Elfinlocks", + "Elijah", + "Empress Vega", + "Eragon3942", + "Eric", + "Eternal Silence", + "ethan", + "Ethan", + "everquartz", + "F00d Demon", + "Face", + "FaeLoPondering", + "False", + "Fartein", + "Faye", + "Feels Fishy", + "Ferret4T", + "Finnrua", + "fire", + "Fish Repairs", + "FishBread", + "Fizzlpoprock", + "Florian", + "Forge", + "Freakish", + "Frederik", + "Fweepachino", + "Gameology", + "GameRDheAsianSandwich", + "Gamma Freya", + "garfu", + "GentSkeleton", + "Georgios", + "Gibb50", + "GIGA MAN", + "Gilded Gryphon", + "Glaid", + "gluten tag", + "Goblin", + "Goober", + "Goomfrontlut", + "GP", + "GreenBerry", + "GreenTea", + "GregTheSpinarak", + "Gretchen", + "Griffin", + "Grylken", + "GTW High Cube", + "Guwahavel", + "Habb", + "Hana", + "Handburger", + "Hannes", + "Hans Volter", + "happy thoughts", + "Hargestar", + "Hayden", + "Hayden", + "Helixas", + "HellGoat2", + "High Charity", + "Him", + "Himakaze", + "Hokojin", + "Homunculus Derelictus", + "hoosfire", + "hubert thieblot", + "Hunter", + "Iconic Parker Gaming", + "Iguy", + "Indeciiissive", + "IsaacInsomnia", + "Izuna", + "J.U.N.E.S", + "Jack", + "JackShizz", + "Jackson", + "Jakob", + "Jalapeno9", + "James", + "James", + "Jankle", + "Jarod", + "Javyz", + "Jaydon", + "Jaykob", + "jc.", + "Jeff", + "Jeff", + "Jenonen", + "JensB__", + "Jersey", + "jes", + "Jessire", + "Jetpat3", + "Jheybyrd", + "jjth0m3", + "Joe", + "Joep", + "Jordan", + "Jose", + "Joshua", + "julius", + "Just a random guy", + "just akkolite", + "JustLonelyPi", + "Kaden", + "Kaimonick", + "Kaledoulas", + "KAT-G307", + "Katherine", + "Kazurgundu", + "KeL", + "Kevin", + "Kevin", + "kgh8090", + "Kinzoku", + "Kipluck", + "Kiyotu", + "KJ", + "Konorango", + "Korb Orb", + "Krankwagon", + "KugelBlitz", + "KurlozClown", + "Lacuna", + "Lady Shira", + "Lagohz", + "Lance", + "Landon", + "Larry That Barry", + "Lauren", + "Leonidas", + "Levi", // Ex-developer. + "Levi", + "Lightedflare", + "Lilith", + "Lime-Wars l 1", + "Littlepiggy", + "Lodude", + "LompL", + "Lord_Lucerne", + "Loser", + "Lucas", + "Lucas", + "LucasHM", + "LucasTwocas", + "Lucazii", + "Luis", + "Luke", + "LumiEvi", + "LvL-94", + "M001NG", + "Madd Cat", + "Magic Love", + "Magicoal", + "MajinBagel", + "Malik", + "Marco", + "Marissa443", + "Mark", + "Markie", + "Marko", + "Mars", + "martyrdomination", + "Maskedmilo", + "Mathuantie", + "Matias", + "Matthew", + "Max Kim", + "MaxingOut", + "Mayhem", + "MeanieG", + "Medi", + "Melvin", + "Mendzey", + "Meow", + "Merubel", + "Met Vox", + "Mikabul", + "Min", + "MingWhy", + "Minty Candy", + "MishiroUsui", + "Misinput", + "MissMudflaps", + "Mister Winchester", + "MittoMan", + "MiyoshiEira", + "Mobian", + "Mohammad", + "Moist Lad", + "Monic", + "Monti", + "Moonicento", + "MovingTarget_086", + "Mr. Bones", + "Mr.Matter", + "MrCreamen", + "MrNobody", + "n0tacat", + "Naglfar", + "Nanaki", + "Natalie", + "Nathan", + "Navigator", + "Ne'er Dowell", + "NEBULA", + "NebulaMagePlays", + "Nemesis 041", + "Neoplasmatic", + "NepNep", + "Nexus", + "Nicholas", + "Nightskyflyer", + "Nitronium Productions", + "Noah", + "NoOneElse", + "Nuclear Chaos", + "Nuclei", + "Number1piratepan", + "NuT NiTe", + "NyanLegacy215", + "Nyapano", + "Nycro", + "Oblivionisbruh", + "Obsoleek", + "Oceanman232", + "OctolingGrimm", + "oli saer", + "Olkothan", + "OnTheAirPogs", + "oracle", + "OriginForme487", + "OrrangProto", + "Orudeon", + "Pacnysam", + "Paltham", + "Patrera", + "Patrick", + "Pedro", + "Perditio Astrum", + "Picasso's Bean", + "Pigeon", + "Plant Waifu", + "Pneuma", + "Pomelo", + "pomp neigh", + "Ponynator", + "Poopifier Poopifly", + "Popsickle Yoshi", + "porglesupreme", + "Potato - Stego", + "Potion Man", + "Preston", + "Primpy", + "Prism", + "Professor Pissington", + "ProfessorWinston", + "Proffesor prostate", + "profoundmango69", + "PsychoGrizzly", + "Pusheen_", + "pyobbo", + "Pyromaniac146", + "Qelrin", + "Rando Calrissian", + "Random Weeb", + "rawpie2", + "Real mystlc", + "Reanamet", + "Reiter splash", + "RetroRed", + "Rinja", + "Rixu", + "RKMoon", + "Robert", + "RockRecker39", + "Rolandark", + "Rooki", + "Rossadon", + "Rottingwood", + "Roxas", + "Ruben", + "RuskieThe3rd", + "Ruthoranium", + "Ryaegos", + "Ryan", + "Ryan", + "Ryan Baker-Ortiz", + "Sabrina", + "Sadouken", + "Sailor Jolt", + "Saladify", + "Samuel", + "Sanctuary", + "Sandblast", + "Sarcosuchus", + "Schlarfblrfsch", + "SCONICBOOM", + "Scribbles", + "Scrumlet", + "Seanツ", + "Sevenfold", // previously "Woah" + "Shadoku", + "SharZz", + "Shaun", + "Shay", // There were two "Shay"s on the old list + "sherk", + "Shifter", + "Shiny", + "Shiro", + "Shirosity", // used to be GlitchOut + "ShotgunAngel", + "Shpee", + "Sigil", + "sk", + "Skeli_G", + "Slim", + "Smart2004", + "Smug", + "Snowy", + "Soko", + "Solaire", + "SoloMael", + "SolsticeUnlimitd", + "SomeRando", + "SoyScoutSmasher", + "Spider region", + "Spirit Shield", + "Splotchycrib", + "SpookyNinja", + "Squishy", + "srxe", + "Starmitzy", + "StarryFox", + "Steven", + "Stormone", + "Streakist", + "Suicide Dreams", + "Superbeepig", + "sweatingdishes", + "T E R M I N A T O R", + "Tails the Fox 92", + "Taitou1", + "Takeru", + "Talmadge", + "Taylor", + "Team", + "TemperedAether", + "Terrarian Dragon", + "Tervastator", + "Tezguin", + "That Katsafaros", + "The Buildmonger", + "The Davester", + "The Evolution", // previously "Nathaniel" + "The Goliath", + "The Illustrious Sqouinchuousor", + "The Infinity", + "The Pyro", + "The Roborex", + "The Wolf Commando", + "thebettercat", + "TheBlackHand", + "TheGreatSako", + "theHoopty", + "TheSilverGhost", + "Thomas", + "Thomas", + "ThomasThePencil", + "Thys", + "Timon", + "TitaniumLlama", + "Tomat (Stevie)", + "Tombarry Expresserino", + "topnormal", + "Trinity Series", + "TwanTheGOAT", + "Tweee", + "Tyler", + "Tyler", + "Uberransy", + "Ulmod", + "Ultra Succ", + "Umberto", + "Underlost", + "Valkyrie", + "vcf55", + "Veine", + "velneu", + "VeryMasterNinja", + "Vetus", + "Victor", + "Vimek Xol", + "Vmar98", + "Vorbis", + "Vroomy Has -3,000 IQ", + "Vyster", // previously "Bewearium" + "Warlok", + "Whale", + "Whitegiraffe", + "Will", + "william", + "William", + "William", + "WillyDilly", + "WinterTire", + "Wodernet", + "Wolfmaw", + "WrathOfOlympus", + "Xaphlactus", + "xAqult", + "xd Ow0", + "XDkilljoy65XX", + "xElectrix_", + "Xenocrona", + "Xenocrona", + "Xsiana", + "XusTingo9", + "Yatagarasu", + "yayoi", + "Yhashtur", + "yiumik", + "YuH", // Current dev. + "YumeiSenshi", + "Yumi", + "Zacky", + "Zekai", + "Zerafir", + "Zerimore", + "zombie wolf", + "Zombieh", + "zombieseatflesh7", + "Zombified _G", + "ZyferDex_", + "병현 송", + ]; + + // Staple the two lists together. + List = [..OriginalPatreonList, ..NewPatreonList]; + } + + public override void Unload() + { + OriginalPatreonList = null; + NewPatreonList = null; + List = null; } } } diff --git a/Systems/Collections/EventProjectileBuffList.cs b/Systems/Collections/EventProjectileBuffList.cs deleted file mode 100644 index 9f3db41e46..0000000000 --- a/Systems/Collections/EventProjectileBuffList.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all Projectile Types that receive Post-DoG Event Buff - /// - public sealed class EventProjectileBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.FlamingWood, - ProjectileID.GreekFire1, - ProjectileID.GreekFire2, - ProjectileID.GreekFire3, - ProjectileID.FlamingScythe, - ProjectileID.FlamingArrow, - ProjectileID.PineNeedleHostile, - ProjectileID.OrnamentHostile, - ProjectileID.OrnamentHostileShrapnel, - ProjectileID.FrostWave, - ProjectileID.FrostShard, - ProjectileID.Missile, - ProjectileID.Present, - ProjectileID.Spike, - ProjectileID.BulletDeadeye, - ProjectileID.EyeLaser, - ProjectileID.Nail, - ProjectileID.DrManFlyFlask - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projType) => List.Contains(projType); - } -} diff --git a/Systems/Collections/FireDebuffsList.cs b/Systems/Collections/FireDebuffsList.cs deleted file mode 100644 index f68d38db98..0000000000 --- a/Systems/Collections/FireDebuffsList.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a that has all the IDs of all Fire-type debuffs. - /// - public sealed class FireDebuffsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffID.OnFire, - BuffID.OnFire3, // Hellfire - BuffID.Burning, // Touching meteorite ore or hellstone without obsidian skull - BuffID.CursedInferno, - BuffID.ShadowFlame, // Vanilla Shadowflame, can normally never be applied to players - BuffType(), // Calamity Shadowflame copy for players - BuffType(), // Crags lava - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), // Aflame enchant self damage - BuffType(), - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if a buff ID is a fire debuff. - /// - public static bool Includes(int buffID) => List.Contains(buffID); - } -} diff --git a/Systems/Collections/FriendlyBeesList.cs b/Systems/Collections/FriendlyBeesList.cs deleted file mode 100644 index 4ccdaf609f..0000000000 --- a/Systems/Collections/FriendlyBeesList.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Rogue; -using CalamityMod.Projectiles.Summon; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a that has all the Projectile IDs of all friendly bees. - /// - public sealed class FriendlyBeesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.GiantBee, - ProjectileID.Bee, - ProjectileID.Wasp, - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if a projectile is a friendly bee. - /// - public static bool Includes(int projType) => List.Contains(projType); - } -} diff --git a/Systems/Collections/GrenadeResistIDList.cs b/Systems/Collections/GrenadeResistIDList.cs deleted file mode 100644 index 917ae8271c..0000000000 --- a/Systems/Collections/GrenadeResistIDList.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Typeless; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class GrenadeResistIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ProjectileID.Grenade, - ProjectileID.StickyGrenade, - ProjectileID.BouncyGrenade, - ProjectileID.Bomb, - ProjectileID.StickyBomb, - ProjectileID.BouncyBomb, - ProjectileID.Dynamite, - ProjectileID.StickyDynamite, - ProjectileID.BouncyDynamite, - ProjectileID.Explosives, - ProjectileID.ExplosiveBunny, - ProjectileID.PartyGirlGrenade, - ProjectileID.BombFish, - ProjectileID.Beenade, - ProjectileID.Bee, - ProjectileID.GiantBee, - ProjectileType(), - ProjectileID.ScarabBomb, - ProjectileID.TNTBarrel - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int projectileType) => List.Contains(projectileType); - } -} diff --git a/Systems/Collections/HighTestFishingPoleList.cs b/Systems/Collections/HighTestFishingPoleList.cs deleted file mode 100644 index aea4781598..0000000000 --- a/Systems/Collections/HighTestFishingPoleList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Fishing.FishingRods; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class HighTestFishingPoleList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ItemID.GoldenFishingRod, - ItemType(), - ItemType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/ItemsForcedInsideWorldList.cs b/Systems/Collections/ItemsForcedInsideWorldList.cs deleted file mode 100644 index 6fd8da39ab..0000000000 --- a/Systems/Collections/ItemsForcedInsideWorldList.cs +++ /dev/null @@ -1,110 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Accessories; -using CalamityMod.Items.Armor.Vanity; -using CalamityMod.Items.LoreItems; -using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; -using CalamityMod.Items.Placeables.Furniture.Trophies; -using CalamityMod.Items.TreasureBags; -using CalamityMod.Items.Weapons.Magic; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Items.Weapons.Ranged; -using CalamityMod.Items.Weapons.Rogue; -using CalamityMod.Items.Weapons.Summon; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of Item IDs of those which are forced to be inside the world map. - /// - public sealed class ItemsForcedInsideWorldList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.HotlineFishingHook, - ItemID.BottomlessBucket, - ItemID.SuperAbsorbantSponge, - ItemID.FishingPotion, - ItemID.SonarPotion, - ItemID.CratePotion, - ItemID.AnglerTackleBag, - ItemID.HighTestFishingLine, - ItemID.TackleBox, - ItemID.AnglerEarring, - ItemID.FishermansGuide, - ItemID.WeatherRadio, - ItemID.Sextant, - ItemID.AnglerHat, - ItemID.AnglerVest, - ItemID.AnglerPants, - ItemID.GoldenBugNet, - ItemID.FishronWings, - ItemID.Flairon, - ItemID.Tsunami, - ItemID.BubbleGun, - ItemID.RazorbladeTyphoon, - ItemID.TempestStaff, - ItemID.FishronBossBag, - ItemID.Coral, - ItemID.Seashell, - ItemID.Starfish, - ItemID.SoulofSight, - ItemID.GreaterHealingPotion, - ItemID.SuperHealingPotion - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not an item is an item that should be forced inside the world map. - /// - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/KamiDebuffColorImmuneList.cs b/Systems/Collections/KamiDebuffColorImmuneList.cs deleted file mode 100644 index 028faa8375..0000000000 --- a/Systems/Collections/KamiDebuffColorImmuneList.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.OldDuke; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class KamiDebuffColorImmuneList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - // Duke Fishron and Old Duke phase 3 becomes way too easy if you can make him stop being invisible with Yanmei's Knife. - // This is a list so that other NPCs can be added as necessary. - // IT DOES NOT make them immune to the debuff, just stops them from being recolored. - List = - [ - NPCID.DukeFishron, - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/LivingFireTilesList.cs b/Systems/Collections/LivingFireTilesList.cs deleted file mode 100644 index 81b2d27c33..0000000000 --- a/Systems/Collections/LivingFireTilesList.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Tiles.LivingFire; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a with all Tile IDs of those which are Living-Fire-type tiles. - /// - public sealed class LivingFireTilesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - TileType(), - TileType(), - TileType(), - TileType(), - TileID.LivingFire, - TileID.LivingCursedFire, - TileID.LivingDemonFire, - TileID.LivingFrostFire, - TileID.LivingIchor, - TileID.LivingUltrabrightFire - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check whether or not a tile is a Living-Fire-type of tile. - /// - public static bool Includes(int tileType) => List.Contains(tileType); - } -} diff --git a/Systems/Collections/MagicGunIDList.cs b/Systems/Collections/MagicGunIDList.cs deleted file mode 100644 index 9bce514ec6..0000000000 --- a/Systems/Collections/MagicGunIDList.cs +++ /dev/null @@ -1,64 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Weapons.DraedonsArsenal; -using CalamityMod.Items.Weapons.Magic; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class MagicGunIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemType(), - ItemID.BeeGun, - ItemID.BubbleGun, - ItemID.ChargedBlasterCannon, - ItemID.HeatRay, - ItemID.LaserMachinegun, - ItemID.LaserRifle, - ItemID.LeafBlower, - ItemID.RainbowGun, - ItemID.SpaceGun, - ItemID.WaspGun, - ItemID.ZapinatorGray, - ItemID.ZapinatorOrange - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if this Item is Magic Gun. - /// - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/Collections/NPCIDs/AngryBonesIDList.cs b/Systems/Collections/NPCIDs/AngryBonesIDList.cs deleted file mode 100644 index 7ca8a86472..0000000000 --- a/Systems/Collections/NPCIDs/AngryBonesIDList.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class AngryBonesIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.AngryBones, - NPCID.AngryBonesBig, - NPCID.AngryBonesBigMuscle, - NPCID.AngryBonesBigHelmet, - NPCID.BigBoned, - NPCID.ShortBones - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs b/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs deleted file mode 100644 index e6b8dae864..0000000000 --- a/Systems/Collections/NPCIDs/AquaticScourgeIDList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AquaticScourge; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class AquaticScourgeIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/AresIDList.cs b/Systems/Collections/NPCIDs/AresIDList.cs deleted file mode 100644 index 09b52cdd3a..0000000000 --- a/Systems/Collections/NPCIDs/AresIDList.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.ExoMechs.Ares; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class AresIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/AstrumDeusIDList.cs b/Systems/Collections/NPCIDs/AstrumDeusIDList.cs deleted file mode 100644 index d5ddc2b632..0000000000 --- a/Systems/Collections/NPCIDs/AstrumDeusIDList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AstrumDeus; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class AstrumDeusIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/BoundNPCIDList.cs b/Systems/Collections/NPCIDs/BoundNPCIDList.cs deleted file mode 100644 index a3667b2fd0..0000000000 --- a/Systems/Collections/NPCIDs/BoundNPCIDList.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class BoundNPCIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.BoundGoblin, - NPCID.BoundWizard, - NPCID.BoundMechanic, - NPCID.SleepingAngler, - NPCID.BartenderUnconscious, - NPCID.WebbedStylist, - NPCID.GolferRescue - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs b/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs deleted file mode 100644 index ebacf52a13..0000000000 --- a/Systems/Collections/NPCIDs/CosmicGuardianIDList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.DevourerofGods; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class CosmicGuardianIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/DemonEyeIDList.cs b/Systems/Collections/NPCIDs/DemonEyeIDList.cs deleted file mode 100644 index d0c72b67bf..0000000000 --- a/Systems/Collections/NPCIDs/DemonEyeIDList.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DemonEyeIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.DemonEye, - NPCID.CataractEye, - NPCID.SleepyEye, - NPCID.DialatedEye, // it is spelled "dilated" - NPCID.GreenEye, - NPCID.PurpleEye, - NPCID.DemonEyeOwl, - NPCID.DemonEyeSpaceship, - NPCID.DemonEye2, - NPCID.PurpleEye2, - NPCID.GreenEye2, - NPCID.DialatedEye2, - NPCID.SleepyEye2, - NPCID.CataractEye2 - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs b/Systems/Collections/NPCIDs/DesertScourgeIDList.cs deleted file mode 100644 index 280a969845..0000000000 --- a/Systems/Collections/NPCIDs/DesertScourgeIDList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.DesertScourge; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DesertScourgeIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/DestroyerIDList.cs b/Systems/Collections/NPCIDs/DestroyerIDList.cs deleted file mode 100644 index 5199177076..0000000000 --- a/Systems/Collections/NPCIDs/DestroyerIDList.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DestroyerIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.TheDestroyer, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs b/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs deleted file mode 100644 index ff37b9725c..0000000000 --- a/Systems/Collections/NPCIDs/DevourerOfGodsIDList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.DevourerofGods; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DevourerOfGodsIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs b/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs deleted file mode 100644 index e4c2f65476..0000000000 --- a/Systems/Collections/NPCIDs/EaterOfWorldsIDList.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class EaterOfWorldsIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/GolemIDList.cs b/Systems/Collections/NPCIDs/GolemIDList.cs deleted file mode 100644 index db9e1b362a..0000000000 --- a/Systems/Collections/NPCIDs/GolemIDList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class GolemIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistLeft, - NPCID.GolemFistRight - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/HornetIDList.cs b/Systems/Collections/NPCIDs/HornetIDList.cs deleted file mode 100644 index 3cb3d5e17f..0000000000 --- a/Systems/Collections/NPCIDs/HornetIDList.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class HornetIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.BigHornetStingy, - NPCID.LittleHornetStingy, - NPCID.BigHornetSpikey, - NPCID.LittleHornetSpikey, - NPCID.BigHornetLeafy, - NPCID.LittleHornetLeafy, - NPCID.BigHornetHoney, - NPCID.LittleHornetHoney, - NPCID.BigHornetFatty, - NPCID.LittleHornetFatty, - NPCID.BigStinger, - NPCID.LittleStinger, - NPCID.Hornet, - NPCID.HornetFatty, - NPCID.HornetHoney, - NPCID.HornetLeafy, - NPCID.HornetSpikey, - NPCID.HornetStingy - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/MossHornetIDList.cs b/Systems/Collections/NPCIDs/MossHornetIDList.cs deleted file mode 100644 index 9f05bd9acf..0000000000 --- a/Systems/Collections/NPCIDs/MossHornetIDList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class MossHornetIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.LittleMossHornet, - NPCID.BigMossHornet, - NPCID.GiantMossHornet - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs b/Systems/Collections/NPCIDs/PerforatorWormIDList.cs deleted file mode 100644 index 4bb42decc1..0000000000 --- a/Systems/Collections/NPCIDs/PerforatorWormIDList.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.Perforator; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PerforatorWormIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/RavagerIDList.cs b/Systems/Collections/NPCIDs/RavagerIDList.cs deleted file mode 100644 index 61dfdb3135..0000000000 --- a/Systems/Collections/NPCIDs/RavagerIDList.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.Ravager; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class RavagerIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - // Purposefully does not include the freed head - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/SkeletonIDList.cs b/Systems/Collections/NPCIDs/SkeletonIDList.cs deleted file mode 100644 index ec63ae51f9..0000000000 --- a/Systems/Collections/NPCIDs/SkeletonIDList.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class SkeletonIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Skeleton, - NPCID.HeadacheSkeleton, - NPCID.MisassembledSkeleton, - NPCID.PantlessSkeleton, - NPCID.BoneThrowingSkeleton, - NPCID.BoneThrowingSkeleton2, - NPCID.BoneThrowingSkeleton3, - NPCID.BoneThrowingSkeleton4, - NPCID.BigPantlessSkeleton, - NPCID.SmallPantlessSkeleton, - NPCID.BigMisassembledSkeleton, - NPCID.SmallMisassembledSkeleton, - NPCID.BigHeadacheSkeleton, - NPCID.SmallHeadacheSkeleton, - NPCID.BigSkeleton, - NPCID.SmallSkeleton, - - //Note: These skeletons don't count for Skeleton Banner for some god forsaken reason - NPCID.SkeletonTopHat, - NPCID.SkeletonAstonaut, - NPCID.SkeletonAlien, - - //Other skeleton types - NPCID.ArmoredSkeleton, - NPCID.HeavySkeleton, - NPCID.SkeletonArcher, - NPCID.GreekSkeleton, - NPCID.SporeSkeleton - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs b/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs deleted file mode 100644 index 21c182ddfa..0000000000 --- a/Systems/Collections/NPCIDs/SkeletronPrimeIDList.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.NormalNPCs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class SkeletronPrimeIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeSaw, - NPCID.PrimeVice - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/SlimeGodIDList.cs b/Systems/Collections/NPCIDs/SlimeGodIDList.cs deleted file mode 100644 index 85bdebd8b6..0000000000 --- a/Systems/Collections/NPCIDs/SlimeGodIDList.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.SlimeGod; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class SlimeGodIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/StormWeaverIDList.cs b/Systems/Collections/NPCIDs/StormWeaverIDList.cs deleted file mode 100644 index 39f1ecd0fa..0000000000 --- a/Systems/Collections/NPCIDs/StormWeaverIDList.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.StormWeaver; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class StormWeaverIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/ThanatosIDList.cs b/Systems/Collections/NPCIDs/ThanatosIDList.cs deleted file mode 100644 index 8688eac6b6..0000000000 --- a/Systems/Collections/NPCIDs/ThanatosIDList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class ThanatosIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCIDs/ZombieIDList.cs b/Systems/Collections/NPCIDs/ZombieIDList.cs deleted file mode 100644 index 0b5ece97d5..0000000000 --- a/Systems/Collections/NPCIDs/ZombieIDList.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.NormalNPCs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class ZombieIDList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Zombie, - NPCID.ArmedZombie, - NPCID.BaldZombie, - NPCID.PincushionZombie, - NPCID.ArmedZombiePincussion, // what is this spelling - NPCID.SlimedZombie, - NPCID.ArmedZombieSlimed, - NPCID.SwampZombie, - NPCID.ArmedZombieSwamp, - NPCID.TwiggyZombie, - NPCID.ArmedZombieTwiggy, - NPCID.FemaleZombie, - NPCID.ArmedZombieCenx, - NPCID.ZombieRaincoat, - NPCID.ZombieEskimo, - NPCID.ArmedZombieEskimo, - NPCID.BigRainZombie, - NPCID.SmallRainZombie, - NPCID.BigFemaleZombie, - NPCID.SmallFemaleZombie, - NPCID.BigTwiggyZombie, - NPCID.SmallTwiggyZombie, - NPCID.BigSwampZombie, - NPCID.SmallSwampZombie, - NPCID.BigSlimedZombie, - NPCID.SmallSlimedZombie, - NPCID.BigPincushionZombie, - NPCID.SmallPincushionZombie, - NPCID.BigBaldZombie, - NPCID.SmallBaldZombie, - NPCID.BigZombie, - NPCID.SmallZombie, - NPCID.MaggotZombie, - NPCType() - // halloween zombies not included because they don't drop shackles or zombie arms - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/BossHPScalingList.cs b/Systems/Collections/NPCs/BossHPScalingList.cs deleted file mode 100644 index 5912dbbc55..0000000000 --- a/Systems/Collections/NPCs/BossHPScalingList.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.PrimordialWyrm; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.SupremeCalamitas; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a that has all NPC IDs of bosses or boss minions that have HP scaling. - /// - public sealed class BossHPScalingList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.SkeletronHand, - NPCID.WallofFleshEye, - NPCID.TheDestroyerBody, - NPCID.TheDestroyerTail, - NPCID.PrimeCannon, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.PrimeSaw, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/BossRushHPChangeDict.cs b/Systems/Collections/NPCs/BossRushHPChangeDict.cs deleted file mode 100644 index 97646e5f90..0000000000 --- a/Systems/Collections/NPCs/BossRushHPChangeDict.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.NormalNPCs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class BossRushHPChangeDict : ModSystem - { - public static IDictionary Dict { get; private set; } - - public override void OnModLoad() - { - Dict = new Dictionary - { - // Tier 1 - { NPCID.KingSlime, 300000 }, // 30 seconds - { NPCID.BlueSlime, 3600 }, - { NPCID.SlimeSpiked, 7200 }, - { NPCID.GreenSlime, 2700 }, - { NPCID.RedSlime, 5400 }, - { NPCID.PurpleSlime, 7200 }, - { NPCID.YellowSlime, 6300 }, - { NPCID.IceSlime, 4500 }, - { NPCID.UmbrellaSlime, 5400 }, - { NPCID.RainbowSlime, 30000 }, - { NPCID.Pinky, 15000 }, - { NPCType(), 21000 }, - { NPCType(), 18000 }, - { NPCType(), 24000 }, - - { NPCID.EyeofCthulhu, 450000 }, // 30 seconds - { NPCID.ServantofCthulhu, 6000 }, - { NPCType(), 12000 }, - - { NPCID.EaterofWorldsHead, 10000 }, // 30 seconds + immunity timer at start - { NPCID.EaterofWorldsBody, 10000 }, - { NPCID.EaterofWorldsTail, 10000 }, - - { NPCID.BrainofCthulhu, 100000 }, // 30 seconds with creepers - { NPCID.Creeper, 10000 }, - - { NPCID.QueenBee, 315000 }, // 30 seconds - { NPCID.Bee, 3000 }, - { NPCID.BeeSmall, 2000 }, - { NPCID.BigHornetHoney, 10000 }, - { NPCID.HornetHoney, 7500 }, - { NPCID.LittleHornetHoney, 5000 }, - - { NPCID.Deerclops, 315000 }, // 30 seconds - - { NPCID.SkeletronHead, 150000 }, // 30 seconds - { NPCID.SkeletronHand, 60000 }, - - { NPCID.WallofFlesh, 450000 }, // 30 seconds - { NPCID.WallofFleshEye, 450000 }, - { NPCID.TheHungry, 10000 }, - { NPCID.TheHungryII, 5000 }, - { NPCID.LeechHead, 5000 }, - { NPCID.LeechBody, 5000 }, - { NPCID.LeechTail, 5000 }, - - // Tier 2 - { NPCID.QueenSlimeBoss, 200000 }, // 30 seconds - { NPCID.QueenSlimeMinionBlue, 6000 }, - { NPCID.QueenSlimeMinionPink, 6000 }, - { NPCID.QueenSlimeMinionPurple, 5000 }, - - { NPCID.Spazmatism, 150000 }, // 30 seconds - { NPCID.Retinazer, 125000 }, - { NPCType(), 137500 }, - - { NPCID.TheDestroyer, 600000 }, // 30 seconds + immunity timer at start - { NPCID.TheDestroyerBody, 600000 }, - { NPCID.TheDestroyerTail, 600000 }, - { NPCID.Probe, 10000 }, - - { NPCID.SkeletronPrime, 160000 }, // 30 seconds - { NPCType(), 160000 }, - { NPCID.PrimeVice, 54000 }, - { NPCID.PrimeCannon, 45000 }, - { NPCID.PrimeSaw, 45000 }, - { NPCID.PrimeLaser, 38000 }, - - { NPCID.Plantera, 160000 }, // 30 seconds - { NPCID.PlanterasTentacle, 5000 }, - { NPCType(), 5000 }, - - // Tier 3 - { NPCID.Golem, 50000 }, // 30 seconds - { NPCID.GolemHead, 30000 }, - { NPCID.GolemHeadFree, 30000 }, - { NPCID.GolemFistLeft, 25000 }, - { NPCID.GolemFistRight, 25000 }, - - { NPCID.HallowBoss, 200000 }, // 30 seconds - - { NPCID.DukeFishron, 290000 }, // 30 seconds - - { NPCID.CultistBoss, 220000 }, // 30 seconds - { NPCID.CultistDragonHead, 60000 }, - { NPCID.CultistDragonBody1, 60000 }, - { NPCID.CultistDragonBody2, 60000 }, - { NPCID.CultistDragonBody3, 60000 }, - { NPCID.CultistDragonBody4, 60000 }, - { NPCID.CultistDragonTail, 60000 }, - { NPCID.AncientCultistSquidhead, 50000 }, - - { NPCID.MoonLordCore, 160000 }, // 1 minute - { NPCID.MoonLordHand, 45000 }, - { NPCID.MoonLordHead, 60000 }, - { NPCID.MoonLordLeechBlob, 800 } - - // 9.5 minutes in total for vanilla Boss Rush bosses - }; - } - - public override void Unload() - { - Dict?.Clear(); - Dict = null; - } - - public static bool TryGet(int npcType, out int newHP) - { - return Dict.TryGetValue(npcType, out newHP); - } - } -} diff --git a/Systems/Collections/NPCs/BossTypeDict.cs b/Systems/Collections/NPCs/BossTypeDict.cs deleted file mode 100644 index 20ddc6d87e..0000000000 --- a/Systems/Collections/NPCs/BossTypeDict.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.BrimstoneElemental; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.CeaselessVoid; -using CalamityMod.NPCs.Crabulon; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Apollo; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Artemis; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.HiveMind; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.Polterghast; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.Signus; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.StormWeaver; -using CalamityMod.NPCs.SupremeCalamitas; -using CalamityMod.NPCs.Yharon; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class BossTypeDict : ModSystem - { - public static IDictionary Dict { get; private set; } - - public override void OnModLoad() - { - Dict = new SortedDictionary() - { - { NPCID.KingSlime, 1 }, - { NPCType(), 2 }, - { NPCID.EyeofCthulhu, 3 }, - { NPCType(), 4 }, - { NPCID.EaterofWorldsHead, 5 }, - { NPCID.EaterofWorldsBody, 5 }, - { NPCID.EaterofWorldsTail, 5 }, - { NPCID.BrainofCthulhu, 6 }, - { NPCType(), 7 }, - { NPCType(), 8 }, - { NPCID.QueenBee, 9 }, - { NPCID.SkeletronHead, 10 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCType(), 11 }, - { NPCID.WallofFlesh, 12 }, - { NPCType(), 13 }, - { NPCID.Retinazer, 14 }, - { NPCID.Spazmatism, 14 }, - { NPCType(), 15 }, - { NPCID.TheDestroyer, 16 }, - { NPCType(), 17 }, - { NPCID.SkeletronPrime, 18 }, - { NPCType(), 19 }, - { NPCID.Plantera, 20 }, - { NPCType(), 21 }, - { NPCType(), 21 }, - { NPCType(), 22 }, - { NPCID.Golem, 23 }, - { NPCType(), 24 }, - { NPCID.DukeFishron, 25 }, - { NPCType(), 26 }, - { NPCID.CultistBoss, 27 }, - { NPCType(), 28 }, - { NPCID.MoonLordCore, 29 }, - { NPCType(), 30 }, - { NPCType(), 31 }, - { NPCType(), 32 }, - { NPCType(), 33 }, - { NPCType(), 34 }, - { NPCType(), 35 }, - { NPCType(), 36 }, - { NPCType(), 37 }, - { NPCType(), 38 }, - { NPCType(), 39 }, - { NPCType(), 40 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCType(), 41 }, - { NPCID.QueenSlimeBoss, 42 }, - { NPCID.HallowBoss, 43 }, - { NPCID.Deerclops, 44 } - }; - } - - public override void Unload() - { - Dict?.Clear(); - Dict = null; - } - - public static bool TryGet(int npcType, out int type) - { - return Dict.TryGetValue(npcType, out type); - } - } -} diff --git a/Systems/Collections/NPCs/BossValueDict.cs b/Systems/Collections/NPCs/BossValueDict.cs deleted file mode 100644 index 43b450ad80..0000000000 --- a/Systems/Collections/NPCs/BossValueDict.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System.Collections.Generic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class BossValueDict : ModSystem - { - public static IDictionary Dict { get; private set; } - - public override void OnModLoad() - { - // NOTE: This does not account for Calamity's base value increases - Dict = new SortedDictionary - { - { NPCID.KingSlime, Item.buyPrice(0, 2) }, - { NPCID.EyeofCthulhu, Item.buyPrice(0, 2) }, - // Evil bosses drop 5 gold in vanilla; unmodified - { NPCID.QueenBee, Item.buyPrice(0, 8) }, - { NPCID.Deerclops, Item.buyPrice(0, 8) }, - { NPCID.SkeletronHead, Item.buyPrice(0, 12) }, - { NPCID.WallofFlesh, Item.buyPrice(0, 12) }, - { NPCID.QueenSlimeBoss, Item.buyPrice(0, 16) }, - { NPCID.Spazmatism, Item.buyPrice(0, 16) }, - { NPCID.Retinazer, Item.buyPrice(0, 16) }, - { NPCID.TheDestroyer, Item.buyPrice(0, 16) }, - { NPCID.SkeletronPrime, Item.buyPrice(0, 16) }, - { NPCID.Plantera, Item.buyPrice(0, 20) }, - { NPCID.Golem, Item.buyPrice(0, 25) }, - { NPCID.HallowBoss, Item.buyPrice(0, 30) }, - { NPCID.DukeFishron, Item.buyPrice(0, 30) }, - { NPCID.CultistBoss, Item.buyPrice(0, 50) } - // Moon Lord drops 1 plat in vanilla; unmodified - }; - } - - public override void Unload() - { - Dict?.Clear(); - Dict = null; - } - - public static bool TryGet(int npcType, out int value) - { - return Dict.TryGetValue(npcType, out value); - } - } -} diff --git a/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs b/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs deleted file mode 100644 index 78c00a647b..0000000000 --- a/Systems/Collections/NPCs/BuffedDungeonEnemiesList.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A which contains a of all NPC's IDs of NPCs who are buffed dungeon enemies. - /// - public sealed class BuffedDungeonEnemiesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.SkeletonCommando, - NPCID.Paladin, - NPCID.GiantCursedSkull, - NPCID.BoneLee, - NPCID.DiabolistWhite, - NPCID.DiabolistRed, - NPCID.NecromancerArmored, - NPCID.Necromancer, - NPCID.RaggedCasterOpenCoat, - NPCID.RaggedCaster, - NPCID.HellArmoredBonesSword, - NPCID.HellArmoredBonesMace, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBones, - NPCID.BlueArmoredBonesSword, - NPCID.BlueArmoredBonesNoPants, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBones, - NPCID.RustyArmoredBonesSwordNoArmor, - NPCID.RustyArmoredBonesSword, - NPCID.RustyArmoredBonesFlail, - NPCID.RustyArmoredBonesAxe - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if an NPC is a buffed Dungeon enemy. - /// - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs b/Systems/Collections/NPCs/DeathModeSplittingWormList.cs deleted file mode 100644 index 9a9f638071..0000000000 --- a/Systems/Collections/NPCs/DeathModeSplittingWormList.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class DeathModeSplittingWormList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.DuneSplicerHead, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.DiggerHead, - NPCID.DiggerBody, - NPCID.DiggerTail, - NPCID.SeekerHead, - NPCID.SeekerBody, - NPCID.SeekerTail - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/EclipseBuffList.cs b/Systems/Collections/NPCs/EclipseBuffList.cs deleted file mode 100644 index aaff7f27b1..0000000000 --- a/Systems/Collections/NPCs/EclipseBuffList.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all NPC Types that receive Post-DoG Eclipse Buff - /// - public sealed class EclipseBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Eyezor, - NPCID.Reaper, - NPCID.Frankenstein, - NPCID.SwampThing, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.Fritz, - NPCID.Nailhead, - NPCID.Psycho, - NPCID.DeadlySphere, - NPCID.DrManFly, - NPCID.ThePossessed, - NPCID.Mothron, - NPCID.MothronEgg, - NPCID.MothronSpawn - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/EnemyImmunitiesList.cs b/Systems/Collections/NPCs/EnemyImmunitiesList.cs deleted file mode 100644 index 60d1d76aa7..0000000000 --- a/Systems/Collections/NPCs/EnemyImmunitiesList.cs +++ /dev/null @@ -1,190 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumAureus; -using CalamityMod.NPCs.Bumblebirb; -using CalamityMod.NPCs.CalClone; -using CalamityMod.NPCs.Cryogen; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.GreatSandShark; -using CalamityMod.NPCs.Leviathan; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.OldDuke; -using CalamityMod.NPCs.Perforator; -using CalamityMod.NPCs.PlaguebringerGoliath; -using CalamityMod.NPCs.PlagueEnemies; -using CalamityMod.NPCs.ProfanedGuardians; -using CalamityMod.NPCs.Providence; -using CalamityMod.NPCs.Ravager; -using CalamityMod.NPCs.SlimeGod; -using CalamityMod.NPCs.SunkenSea; -using CalamityMod.NPCs.SupremeCalamitas; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains all of the NPC IDs of all NPCs that are immune to special debuffs. - /// - public sealed class EnemyImmunitiesList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.KingSlime, - NPCType(), - NPCType(), - NPCType(), - NPCID.EyeofCthulhu, - NPCType(), - NPCID.EaterofWorldsHead, - NPCID.EaterofWorldsBody, - NPCID.EaterofWorldsTail, - NPCID.BrainofCthulhu, - NPCID.Creeper, - NPCID.QueenBee, - NPCID.Deerclops, - NPCID.SkeletronHead, - NPCID.SkeletronHand, - NPCID.WallofFlesh, - NPCID.WallofFleshEye, - NPCID.PirateShipCannon, - NPCID.QueenSlimeBoss, - NPCID.Probe, - NPCID.Retinazer, - NPCID.Spazmatism, - NPCType(), - NPCID.SkeletronPrime, - NPCType(), - NPCID.PrimeCannon, - NPCID.PrimeSaw, - NPCID.PrimeLaser, - NPCID.PrimeVice, - NPCID.Plantera, - NPCID.PlanterasTentacle, - NPCType(), - NPCID.Everscream, - NPCID.SantaNK1, - NPCID.IceQueen, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Mothron, - NPCID.Golem, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.GolemFistRight, - NPCID.GolemFistLeft, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerTurret, - NPCID.DukeFishron, - NPCID.Sharkron, - NPCID.Sharkron2, - NPCID.HallowBoss, - NPCID.CultistBoss, - NPCID.CultistDragonHead, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.AncientCultistSquidhead, - NPCID.MoonLordHead, - NPCID.MoonLordHand, - NPCID.MoonLordCore, - NPCID.MoonLordFreeEye, - NPCID.DD2WyvernT1, - NPCID.DD2WyvernT2, - NPCID.DD2WyvernT3, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2SkeletonT1, - NPCID.DD2SkeletonT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2Betsy, - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if an NPC is in this list. - /// - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/FrostMoonBuffList.cs b/Systems/Collections/NPCs/FrostMoonBuffList.cs deleted file mode 100644 index d94d780e9e..0000000000 --- a/Systems/Collections/NPCs/FrostMoonBuffList.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all NPC Types that receive Post-DoG Frost Moon Buff - /// - public sealed class FrostMoonBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.PresentMimic, - NPCID.GingerbreadMan, - NPCID.Yeti, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.ElfCopter, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.ElfArcher, - NPCID.Krampus, - NPCID.Flocko - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs b/Systems/Collections/NPCs/HardmodeNPCNerfList.cs deleted file mode 100644 index a8d0a144bd..0000000000 --- a/Systems/Collections/NPCs/HardmodeNPCNerfList.cs +++ /dev/null @@ -1,155 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class HardmodeNPCNerfList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - // Reduce contact damage by 25% - List = - [ - NPCID.AnglerFish, - NPCID.AngryTrapper, - NPCID.Arapaima, - NPCID.BlackRecluse, - NPCID.BlackRecluseWall, - NPCID.BloodJelly, - NPCID.FungoFish, - NPCID.GreenJellyfish, - NPCID.Clinger, - NPCID.ArmoredSkeleton, - NPCID.ArmoredViking, - NPCID.Mummy, - NPCID.DarkMummy, - NPCID.LightMummy, - NPCID.BloodFeeder, - NPCID.DesertBeast, - NPCID.ChaosElemental, - NPCID.BloodMummy, - NPCID.CorruptSlime, - NPCID.Slimeling, - NPCID.Corruptor, - NPCID.Crimslime, - NPCID.BigCrimslime, - NPCID.LittleCrimslime, - NPCID.CrimsonAxe, - NPCID.CursedHammer, - NPCID.Derpling, - NPCID.Herpling, - NPCID.DiggerHead, - NPCID.DesertGhoul, - NPCID.DesertGhoulCorruption, - NPCID.DesertGhoulCrimson, - NPCID.DesertGhoulHallow, - NPCID.DuneSplicerHead, - NPCID.EnchantedSword, - NPCID.FloatyGross, - NPCID.GiantBat, - NPCID.GiantFlyingFox, - NPCID.FungiSpore, - NPCID.GiantTortoise, - NPCID.IceTortoise, - NPCID.HoppinJack, - NPCID.Mimic, - NPCID.IlluminantBat, - NPCID.IlluminantSlime, - NPCID.JungleCreeper, - NPCID.JungleCreeperWall, - NPCID.DesertLamiaDark, - NPCID.DesertLamiaLight, - NPCID.BigMossHornet, - NPCID.GiantMossHornet, - NPCID.LittleMossHornet, - NPCID.MossHornet, - NPCID.TinyMossHornet, - NPCID.Moth, - NPCID.PigronCorruption, - NPCID.PigronCrimson, - NPCID.PigronHallow, - NPCID.Pixie, - NPCID.PossessedArmor, - NPCID.RockGolem, - NPCID.DesertScorpionWalk, - NPCID.DesertScorpionWall, - NPCID.Slimer, - NPCID.Slimer2, - NPCID.ToxicSludge, - NPCID.Unicorn, - NPCID.WanderingEye, - NPCID.Werewolf, - NPCID.Wolf, - NPCID.SeekerHead, - NPCID.Wraith, - NPCID.ChatteringTeethBomb, - NPCID.IceGolem, - NPCID.RainbowSlime, - NPCID.SandShark, - NPCID.SandsharkCorrupt, - NPCID.SandsharkCrimson, - NPCID.SandsharkHallow, - NPCID.ShadowFlameApparition, - NPCID.Parrot, - NPCID.PirateCorsair, - NPCID.PirateDeckhand, - NPCID.PirateGhost, - NPCID.BlueArmoredBonesMace, - NPCID.BlueArmoredBonesSword, - NPCID.BoneLee, - NPCID.DungeonSpirit, - NPCID.FlyingSnake, - NPCID.HellArmoredBones, - NPCID.HellArmoredBonesSpikeShield, - NPCID.HellArmoredBonesSword, - NPCID.MisterStabby, - NPCID.Butcher, - NPCID.CreatureFromTheDeep, - NPCID.DeadlySphere, - NPCID.Frankenstein, - NPCID.Fritz, - NPCID.Psycho, - NPCID.Reaper, - NPCID.SwampThing, - NPCID.ThePossessed, - NPCID.Vampire, - NPCID.VampireBat, - NPCID.HeadlessHorseman, - NPCID.Hellhound, - NPCID.Poltergeist, - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.Splinterling, - NPCID.Flocko, - NPCID.GingerbreadMan, - NPCID.Krampus, - NPCID.Nutcracker, - NPCID.NutcrackerSpinning, - NPCID.PresentMimic, - NPCID.Yeti, - NPCID.ZombieElf, - NPCID.ZombieElfBeard, - NPCID.ZombieElfGirl, - NPCID.BloodEelHead, - NPCID.GoblinShark, - NPCID.EyeballFlyingFish, - NPCID.ZombieMerman - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/MinibossList.cs b/Systems/Collections/NPCs/MinibossList.cs deleted file mode 100644 index f2e0ed4f62..0000000000 --- a/Systems/Collections/NPCs/MinibossList.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.Abyss; -using CalamityMod.NPCs.AcidRain; -using CalamityMod.NPCs.GreatSandShark; -using CalamityMod.NPCs.NormalNPCs; -using CalamityMod.NPCs.PlagueEnemies; -using CalamityMod.NPCs.SunkenSea; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class MinibossList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCID.Pumpking, - NPCID.MourningWood, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.Everscream, - NPCID.DD2Betsy, - NPCID.Mothron, - NPCID.MartianSaucer, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/NoRageWormSegmentList.cs b/Systems/Collections/NPCs/NoRageWormSegmentList.cs deleted file mode 100644 index 456dbaa828..0000000000 --- a/Systems/Collections/NPCs/NoRageWormSegmentList.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.AquaticScourge; -using CalamityMod.NPCs.AstrumDeus; -using CalamityMod.NPCs.DesertScourge; -using CalamityMod.NPCs.DevourerofGods; -using CalamityMod.NPCs.ExoMechs.Ares; -using CalamityMod.NPCs.ExoMechs.Thanatos; -using CalamityMod.NPCs.StormWeaver; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class NoRageWormSegmentList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType(), - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/PumpkinMoonBuffList.cs b/Systems/Collections/NPCs/PumpkinMoonBuffList.cs deleted file mode 100644 index 6ab32c0323..0000000000 --- a/Systems/Collections/NPCs/PumpkinMoonBuffList.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a of all NPC Types that receive Post-DoG Pumpkin Moon Buff - /// - public sealed class PumpkinMoonBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Scarecrow1, - NPCID.Scarecrow2, - NPCID.Scarecrow3, - NPCID.Scarecrow4, - NPCID.Scarecrow5, - NPCID.Scarecrow6, - NPCID.Scarecrow7, - NPCID.Scarecrow8, - NPCID.Scarecrow9, - NPCID.Scarecrow10, - NPCID.HeadlessHorseman, - NPCID.MourningWood, - NPCID.Splinterling, - NPCID.Pumpking, - NPCID.PumpkingBlade, - NPCID.Hellhound, - NPCID.Poltergeist - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs b/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs deleted file mode 100644 index dbc3aa6ffd..0000000000 --- a/Systems/Collections/NPCs/ZeroContactDamageNPCList.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System.Collections.Generic; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - public sealed class ZeroContactDamageNPCList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.Harpy, - NPCID.Salamander, - NPCID.Salamander2, - NPCID.Salamander3, - NPCID.Salamander4, - NPCID.Salamander5, - NPCID.Salamander6, - NPCID.Salamander7, - NPCID.Salamander8, - NPCID.Salamander9, - NPCID.GiantCursedSkull, - NPCID.FungiBulb, - NPCID.GiantFungiBulb, - NPCID.IcyMerman, - NPCID.AngryNimbus, - NPCID.SandElemental, - NPCID.DarkCaster, - NPCID.FireImp, - NPCID.Tim, - NPCID.CultistArcherBlue, - NPCID.DesertDjinn, - NPCID.DiabolistRed, - NPCID.DiabolistWhite, - NPCID.Gastropod, - NPCID.IceElemental, - NPCID.IchorSticker, - NPCID.Necromancer, - NPCID.NecromancerArmored, - NPCID.RaggedCaster, - NPCID.RaggedCasterOpenCoat, - NPCID.RuneWizard, - NPCID.SkeletonArcher, - NPCID.SkeletonCommando, - NPCID.SkeletonSniper, - NPCID.TacticalSkeleton, - NPCID.Clown, - NPCID.GoblinArcher, - NPCID.GoblinSorcerer, - NPCID.GoblinSummoner, - NPCID.PirateCrossbower, - NPCID.PirateDeadeye, - NPCID.PirateCaptain, - NPCID.SnowmanGangsta, - NPCID.SnowBalla, - NPCID.DrManFly, - NPCID.Eyezor, - NPCID.Nailhead, - NPCID.BrainScrambler, - NPCID.GigaZapper, - NPCID.RayGunner, - NPCID.ScutlixRider, - NPCID.MartianWalker, - NPCID.MartianTurret, - NPCID.ElfCopter, - NPCID.ElfArcher, - NPCID.NebulaBrain, - NPCID.NebulaSoldier, - NPCID.StardustCellSmall, - NPCID.StardustJellyfishBig, - NPCID.StardustSoldier, - NPCID.StardustSpiderBig, - NPCID.VortexHornetQueen, - NPCID.VortexRifleman, - NPCID.VortexSoldier, - NPCID.PirateShipCannon, - NPCID.MartianSaucer, - NPCID.MartianSaucerCannon, - NPCID.MartianSaucerCore, - NPCID.MartianSaucerTurret, - NPCID.Probe, - NPCID.CultistBoss, - NPCID.GolemHead, - NPCID.GolemHeadFree, - NPCID.MoonLordFreeEye, - NPCID.BloodSquid, - NPCID.PlanterasHook, - NPCID.Dandelion, - NPCID.DD2DarkMageT1, - NPCID.DD2DarkMageT3, - NPCID.DD2OgreT2, - NPCID.DD2OgreT3, - NPCID.DD2GoblinBomberT1, - NPCID.DD2GoblinBomberT2, - NPCID.DD2GoblinBomberT3, - NPCID.DD2JavelinstT1, - NPCID.DD2JavelinstT2, - NPCID.DD2JavelinstT3, - NPCID.DD2KoboldWalkerT2, - NPCID.DD2KoboldWalkerT3, - NPCID.DD2DrakinT2, - NPCID.DD2DrakinT3, - NPCID.DD2KoboldFlyerT2, - NPCID.DD2KoboldFlyerT3, - NPCID.DD2WitherBeastT2, - NPCID.DD2WitherBeastT3, - NPCID.DD2LightningBugT3, - NPCID.MourningWood, - NPCID.Pumpking, - NPCID.Everscream, - NPCID.IceQueen, - NPCID.SantaNK1, - NPCID.DevourerBody, - NPCID.DevourerTail, - NPCID.DiggerBody, - NPCID.DiggerTail, - NPCID.TombCrawlerBody, - NPCID.TombCrawlerTail, - NPCID.DuneSplicerBody, - NPCID.DuneSplicerTail, - NPCID.GiantWormBody, - NPCID.GiantWormTail, - NPCID.LeechBody, - NPCID.LeechTail, - NPCID.StardustWormBody, - NPCID.StardustWormTail, - NPCID.SeekerBody, - NPCID.SeekerTail, - NPCID.BoneSerpentBody, - NPCID.BoneSerpentTail, - NPCID.WyvernBody, - NPCID.WyvernTail, - NPCID.WyvernBody2, - NPCID.WyvernBody3, - NPCID.WyvernLegs, - NPCID.CultistDragonBody1, - NPCID.CultistDragonBody2, - NPCID.CultistDragonBody3, - NPCID.CultistDragonBody4, - NPCID.CultistDragonTail, - NPCID.BloodEelBody, - NPCID.BloodEelTail, - NPCID.AncientDoom - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/NeedsDebuffIconDisplayList.cs b/Systems/Collections/NeedsDebuffIconDisplayList.cs deleted file mode 100644 index 1cd6d90efe..0000000000 --- a/Systems/Collections/NeedsDebuffIconDisplayList.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.NPCs.NormalNPCs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class NeedsDebuffIconDisplayList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - NPCID.TargetDummy, - NPCID.WallofFleshEye, - NPCType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int npcType) => List.Contains(npcType); - } -} diff --git a/Systems/Collections/PersistentBuffList.cs b/Systems/Collections/PersistentBuffList.cs deleted file mode 100644 index 01e165e604..0000000000 --- a/Systems/Collections/PersistentBuffList.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.Potions; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - public sealed class PersistentBuffList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffType(), - BuffType(), - BuffType(), - BuffID.WeaponImbueVenom, - BuffID.WeaponImbueCursedFlames, - BuffID.WeaponImbueFire, - BuffID.WeaponImbueGold, - BuffID.WeaponImbueIchor, - BuffID.WeaponImbueNanites, - BuffID.WeaponImbueConfetti, - BuffID.WeaponImbuePoison - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if this buffType is a PersistentBuff. - /// - public static bool Includes(int buffType) => List.Contains(buffType); - } -} diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs deleted file mode 100644 index 5992a004e2..0000000000 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Projectiles.DraedonsArsenal; -using CalamityMod.Projectiles.Magic; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Projectiles.Melee.MaceFlails; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Projectiles.Rogue; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that holds a list of all projectiles that should be, exceptionally, ignored by projectile destruction. - /// - public sealed class ProjectileDestroyExceptionsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - // Holdout projectiles. - ProjectileID.Phantasm, - ProjectileID.VortexBeater, - ProjectileID.DD2PhoenixBow, - ProjectileID.LastPrism, - ProjectileID.LastPrismLaser, - ProjectileID.LaserMachinegun, - ProjectileID.ChargedBlasterCannon, - ProjectileID.MedusaHead, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - - // Some hostile boss projectiles. - ProjectileID.SaucerDeathray, - ProjectileID.PhantasmalDeathray, - - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType(), - ProjectileType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if a projectile belongs in the exception list. - /// - public static bool Includes(int projType) => List.Contains(projType); - } -} diff --git a/Systems/Collections/SharedStaticIFramesIDSet.cs b/Systems/Collections/SharedStaticIFramesIDSet.cs deleted file mode 100644 index b6495ebf96..0000000000 --- a/Systems/Collections/SharedStaticIFramesIDSet.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Projectiles.Magic; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A which contains an ProjectileID Set, created with the appropriate factory.
- ///
- /// This is populated from a much more human readable set of "shared iframe lists", contained in OnModLoad. - ///
- public sealed class SharedStaticIFrames : ModSystem - { - public static IDictionary> SharedIFrameSets { get; private set; } - public static int[] SharedIFrameFactorySet { get; private set; } - - public override void PostSetupContent() - { - // This transient structure is used to make the setup of intended shared-iframe sets as easy as possible. - // - // If you want to add a new projectile to share iframes with any existing sets, just add it to that [ area ]. - // - // If you want to create a brand new shared iframe set, just add a new [ area ] at the bottom. - IList> setupLists = - [ - [ // Set 1: Vanilla bees (Hive Pack) - ProjectileID.Bee, - ProjectileID.GiantBee - ], - - [ // Set 2: Vilethorn - ProjectileID.VilethornBase, - ProjectileID.VilethornTip - ], - - [ // Set 3: Harp notes - ProjectileID.QuarterNote, - ProjectileID.EighthNote, - ProjectileID.TiedEighthNote - ], - - [ // Set 4: The North Pole - ProjectileID.NorthPoleWeapon, - ProjectileID.NorthPoleSpear, - ProjectileID.NorthPoleSnowflake, - ], - - [ // Set 5: All spore gas clouds - ProjectileID.SporeTrap, - ProjectileID.SporeTrap2, - ProjectileID.SporeGas, - ProjectileID.SporeGas2, - ProjectileID.SporeGas3 - ], - - [ // Set 6: Astral Staff - ModContent.ProjectileType(), - ModContent.ProjectileType() - ], - - [ // Set 7: All toxic clouds - ProjectileID.ToxicCloud, - ProjectileID.ToxicCloud2, - ProjectileID.ToxicCloud3 - ] - ]; - - // Convert the above list-of-lists into a dictionary, where the key is the shared iframe projectile ID. - SharedIFrameSets = new SortedDictionary>(); - foreach (var innerList in setupLists) - { - int sharedIDForThisSet = innerList[0]; - SharedIFrameSets.Add(sharedIDForThisSet, innerList); - } - - // Now construct a vanilla Terraria Projectile ID Set using the appropriate factory. - - // Calculate the total length of the input buffer to the factory - int totalLength = 0; - foreach(var l in SharedIFrameSets.Values) - totalLength += l.Count; - - // Create the buffer and fill it - int[] buffer = new int[totalLength * 2]; - int idx = 0; - foreach (var sharedFrameList in setupLists) - { - int sharedIDForThisSet = sharedFrameList[0]; - - foreach (var projID in sharedFrameList) - { - buffer[idx++] = projID; - buffer[idx++] = sharedIDForThisSet; - } - } - - SharedIFrameFactorySet = ProjectileID.Sets.Factory.CreateIntSet(-1, buffer); - } - - public override void Unload() - { - SharedIFrameSets = null; - SharedIFrameFactorySet = null; - } - - /// - /// A shorthand method to check if this projectile shares static iframes in any way. - /// - public static bool Includes(int projType) => SharedIFrameFactorySet[projType] != -1; - - /// - /// The intended - /// - /// The projectile type to get the set of shared iframe projectile IDs for. - /// A list of projectile IDs that share static iframes with this projectile ID. This list may be empty. - public static IList GetSharedStaticIFrames(int projType) - { - int sharedSetID = SharedIFrameFactorySet[projType]; - bool setExists = SharedIFrameSets.TryGetValue(sharedSetID, out var ret); - - return setExists ? ret : []; - } - } -} diff --git a/Systems/Collections/SicknessDebuffsList.cs b/Systems/Collections/SicknessDebuffsList.cs deleted file mode 100644 index 7d687952a6..0000000000 --- a/Systems/Collections/SicknessDebuffsList.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.Buffs.StatDebuffs; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// A that contains a that has all the Sickness Debuffs' IDs. - /// - public sealed class SicknessDebuffsList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - BuffID.Poisoned, - BuffID.Venom, - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType(), - BuffType() - ]; - } - - public override void Unload() => List = null; - - /// - /// A shorthand method to check if a buff ID is a Sickness Debuff. - /// - public static bool Includes(int buffID) => List.Contains(buffID); - } -} diff --git a/Systems/Collections/VeneratedLocketBanList.cs b/Systems/Collections/VeneratedLocketBanList.cs deleted file mode 100644 index 2aef022abf..0000000000 --- a/Systems/Collections/VeneratedLocketBanList.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using CalamityMod.Items.Weapons.Rogue; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Systems.Collections -{ - /// - /// To ban projectiles from locket, mainly spikeballs altho Toasty asked me to add mod calls for adding stuff like Dreamtastic - /// - public sealed class VeneratedLocketBanList : ModSystem - { - public static IList List { get; private set; } - - public override void OnModLoad() - { - List = - [ - ItemType(), - ItemType(), - ItemType(), - ItemType() - ]; - } - - public override void Unload() => List = null; - - public static bool Includes(int itemType) => List.Contains(itemType); - } -} diff --git a/Systems/GlobalSaveDataSystem.cs b/Systems/GlobalSaveDataSystem.cs new file mode 100644 index 0000000000..3f4b0116f8 --- /dev/null +++ b/Systems/GlobalSaveDataSystem.cs @@ -0,0 +1,86 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Systems +{ + public class GlobalSaveDataSystem : ModSystem + { + internal static List GlobalSaveDataKeys = []; + + /// + /// The directory in which all files related to globall saved data are stored. + /// + internal static string GlobalSaveDataDirectoryPath; + + /// + /// The path to the text file which contains all globally saved data keys. + /// + internal static string GlobalSaveDataKeysPath; + + /// + /// The path to the README file explaining the purpose of the directory. + /// + internal static string READMEPath; + + public override void OnModLoad() + { + string savePathByOS = OperatingSystem.IsLinux() ? "~/.local/share/Terraria/tModloader/" : Main.SavePath; + GlobalSaveDataDirectoryPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData"; + GlobalSaveDataKeysPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "GlobalSaveDataKeys.txt"; + READMEPath = savePathByOS + Path.DirectorySeparatorChar + "CalamityModGlobalSaveData" + Path.DirectorySeparatorChar + "README.txt"; + + // Ensure that the save data keys text file exists. If not, create a new one. + if (!File.Exists(GlobalSaveDataKeysPath)) + { + // Create the directory if necessary. + if (!Directory.Exists(GlobalSaveDataDirectoryPath)) + Directory.CreateDirectory(GlobalSaveDataDirectoryPath); + + // Create both the Global Save Data text file, as well as a README file explaining the directory's purpose. + if (!File.Exists(READMEPath)) + { + using StreamWriter readme = File.CreateText(READMEPath); + readme.WriteLine("Hi! You're probably wondering what this directory is and why it exists if you've found it."); + readme.WriteLine("This is how the Calamity Mod currently manages data that is saved globally across all worlds. " + + "You will find all keys managing globally saved data in the other text file within this folder. You are free to remove " + + "any of those keys if you wish to reapply the lock on whatever in-game content they unlock. If you have no interest in doing so " + + "then it is recommended you simply leave the file as is."); + } + + File.CreateText(GlobalSaveDataKeysPath); + } + // If it does exist, read all keys from the text file and save them into the list. + else + { + GlobalSaveDataKeys = File.ReadAllLines(GlobalSaveDataKeysPath).ToList(); + } + } + + /// + /// Checks whether or not a key has been saved into the GlobalSaveDataKeys text file. + /// + /// True if the key has been saved, false otherwise. + public static bool IsKeyAlreadySaved(string key) => GlobalSaveDataKeys.Contains(key); + + /// + /// Saves a specified key into the GlobalSaveDataKeys text file. + /// + public static void SaveKey(string key) + { + // If the key already exists, log it as a warning and don't run any code. + if (GlobalSaveDataKeys.Contains(key)) + { + CalamityMod.Instance.Logger.Error($"WARNING! A global save data key \"{key}\" which has already been registered is attempting to be registered again. " + + "Please report this to the Calamity Mod Team if you see this!"); + return; + } + + File.AppendAllLines(GlobalSaveDataKeysPath, [key]); + GlobalSaveDataKeys.Add(key); + } + } +} diff --git a/Systems/Graphic/LightingEffectsSystem.cs b/Systems/Graphic/LightingEffectsSystem.cs index 6fa1fddea4..1bc1a1631b 100644 --- a/Systems/Graphic/LightingEffectsSystem.cs +++ b/Systems/Graphic/LightingEffectsSystem.cs @@ -62,7 +62,7 @@ namespace CalamityMod.Systems // Total darkness float signusDarkness = signusLifeRatio * multiplier; darkRatio = MathHelper.Clamp(signusDarkness, 0f, 1f); - scale += (CalamityWorld.LegendaryMode ? MaxGFBSignusDarkness : MaxSignusDarkness) * darkRatio; + scale += (Main.zenithWorld ? MaxGFBSignusDarkness : MaxSignusDarkness) * darkRatio; } } } diff --git a/Systems/Mechanic/DifficultyModeSystem.cs b/Systems/Mechanic/DifficultyModeSystem.cs index 106dd9bdef..98906a763f 100644 --- a/Systems/Mechanic/DifficultyModeSystem.cs +++ b/Systems/Mechanic/DifficultyModeSystem.cs @@ -1,18 +1,17 @@ using System; using System.Collections.Generic; using System.Linq; -using CalamityMod.Buffs.DamageOverTime; -using CalamityMod.CalPlayer; -using CalamityMod.Events; +using System.Reflection; using CalamityMod.Items.Armor.Demonshade; using CalamityMod.UI.ModeIndicator; using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using Newtonsoft.Json.Linq; using ReLogic.Content; using Terraria; using Terraria.Audio; -using Terraria.Graphics; +using Terraria.GameContent.Creative; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -24,21 +23,32 @@ namespace CalamityMod.Systems public class DifficultyModeSystem : ModSystem { internal static bool _hasCheckedItOutYet = false; //Simple variable to add a cool effect to the mode selector + internal static int _newGameModeID = GameModeID.Normal; public static List Difficulties = new List(); //Difficulty modes ordered by ascending difficulty public static List DifficultyTiers; //Difficulty modes grouped together by difficulty public static int MostAlternateDifficulties; //The most alternate difficulties at any tier that exists. Used to know the widest space to take in the ui - public override void Load() + public static FieldInfo journeySliderCacheField; // The current value of the journey mode difficulty slider + public static MethodInfo journeyDifficultyUpdateMethod; // The method which updates difficulty modes in journey mode + + public override void OnModLoad() { MostAlternateDifficulties = 1; //Initialize base mod difficulties - Difficulties = new List() { new NoDifficulty(), new RevengeanceDifficulty(), new DeathDifficulty() }; + Difficulties = new List() { ModContent.GetInstance(), + ModContent.GetInstance(), + ModContent.GetInstance(), ModContent.GetInstance(), + ModContent.GetInstance() }; + + // Reflect private journey difficulty slider info + journeySliderCacheField = typeof(CreativePowers.DifficultySliderPower).GetField("_sliderCurrentValueCache", BindingFlags.Instance | BindingFlags.NonPublic); + journeyDifficultyUpdateMethod = typeof(CreativePowers.DifficultySliderPower).GetMethod("UpdateInfoFromSliderValueCache", BindingFlags.Instance | BindingFlags.NonPublic); CalculateDifficultyData(); } - public override void Unload() + public override void OnModUnload() { Difficulties = null; } @@ -46,13 +56,68 @@ namespace CalamityMod.Systems // Makes the world automatically convert to Death if in Master, or out of Death if in Expert public override void PostUpdateWorld() { - if (!Main.expertMode) - ModeIndicatorUI.SwitchToDifficulty(NoDifficulty.Instance); - if (Main.expertMode && !Main.masterMode && GetCurrentDifficulty == DeathDifficulty.Instance) - ModeIndicatorUI.SwitchToDifficulty(RevengeanceDifficulty.Instance); - if (Main.masterMode && GetCurrentDifficulty == RevengeanceDifficulty.Instance) - ModeIndicatorUI.SwitchToDifficulty(DeathDifficulty.Instance); + static void HandleExternalGameModeChange(int tier) + { + switch (tier) + { + case GameModeID.Normal: + { + // vanilla game mode in classic, but cal difficulty >= expert + if (GetCurrentDifficulty == ModContent.GetInstance() || GetCurrentDifficulty == ModContent.GetInstance()) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance()); + } + break; + } + case GameModeID.Expert: + { + // if death was activated, change it to revengence + if (GetCurrentDifficulty == ModContent.GetInstance()) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance()); + } + break; + } + case GameModeID.Master: + { + // if revengence and master both activated, change it to death + if (GetCurrentDifficulty != ModContent.GetInstance() && CalamityWorld.revenge) + { + ModeIndicatorUI.SwitchToDifficulty(ModContent.GetInstance()); + } + break; + } + } + } + + if (Main.GameMode == GameModeID.Creative) + { + CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower(); + if (power.GetIsUnlocked()) + { + int effectiveVanillaDifficulty; + var sliderValue = (float)journeySliderCacheField.GetValue(power); + if (sliderValue == 1) + { + effectiveVanillaDifficulty = GameModeID.Master; + } + else if (sliderValue >= 0.66f) + { + effectiveVanillaDifficulty = GameModeID.Expert; + } + else + { + effectiveVanillaDifficulty = GameModeID.Normal; + } + HandleExternalGameModeChange(effectiveVanillaDifficulty); + } + } + else + { + HandleExternalGameModeChange(Main.GameMode); + } } + public static DifficultyMode GetCurrentDifficulty { @@ -101,6 +166,45 @@ namespace CalamityMod.Systems Difficulties[i]._difficultyTier = tierIndex; } } + private static readonly Dictionary compatitableValueRanges = new() + { + { GameModeID.Normal, (0.33f, 0.66f ) }, + { GameModeID.Expert, (0.66f, 1f) }, + { GameModeID.Master, (1f, 1f) } + }; + + public static void AlignJourneyDifficultySlider() + { + if(Main.GameMode != GameModeID.Creative) + { + // I have to throw an unhandled exception here to make you alerted to bugs while developing + // If this is tested and working, turn it into a silent warning before release + throw new ArgumentException("DifficultyModeSystemAlignJourneyDifficultySlider(): must be invoked in journey mode"); + } + CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower(); + var oldValue = (float)journeySliderCacheField.GetValue(power); + if (compatitableValueRanges.ContainsKey(_newGameModeID)) + { + var (low, high) = compatitableValueRanges[_newGameModeID]; + float valueToSet; + if (oldValue >= low && oldValue < high) + { + valueToSet = oldValue; + } + else + { + valueToSet = low; + } + journeySliderCacheField.SetValue(power, valueToSet); + journeyDifficultyUpdateMethod.Invoke(power, null); + } + else + { + // I have to throw an unhandled exception here to make you alerted to bugs while developing + // If this is tested and working, turn it into a silent warning before release + throw new ArgumentException("DifficultyModeSystemAlignJourneyDifficultySlider(): _newGameModeID must be in GameModeID.Normal, Expert, Master"); + } + } public override void SaveWorldData(TagCompound tag) { @@ -133,35 +237,43 @@ namespace CalamityMod.Systems } } - public abstract class DifficultyMode + public abstract class DifficultyMode : ModType { + protected override void Register() + { + // This is registered in DifficultyModeSystem.OnModLoad + // Note that DifficultyModeSystem.Load can't ensure system is loaded after all modes + } public abstract bool Enabled { get; set; } + protected Asset _texture; public abstract Asset Texture { get; } + protected Asset _textureDisabled; + public abstract Asset TextureDisabled { get; } + protected SoundStyle? _activationSound; + public abstract SoundStyle ActivationSound{ get; } + public abstract int BackBoneGameModeID { get; } + internal int _difficultyTier; + public abstract float DifficultyScale{ get; } + + public new abstract LocalizedText Name { get; } + public abstract Color ChatTextColor{ get; } + public abstract LocalizedText ShortDescription{ get; } public virtual LocalizedText ExpandedDescription => LocalizedText.Empty; - public float DifficultyScale; - public LocalizedText Name; - public LocalizedText ShortDescription; - - public string ActivationTextKey; - public string DeactivationTextKey; - - public SoundStyle ActivationSound; - - public Color ChatTextColor; - - internal int _difficultyTier; + public abstract LocalizedText FTWName{ get; } + public abstract Color FTWTextColor{ get; } + /// /// Used to know which difficulties to toggle on when selecting a particular difficulty. /// public virtual bool RequiresDifficulty(DifficultyMode mode) => false; - public virtual int FavoredDifficultyAtTier(int tier) => 0; + public virtual int[] FavoredDifficultyAtTier(int tier) => [0]; } public class NoDifficulty : DifficultyMode @@ -169,37 +281,120 @@ namespace CalamityMod.Systems public override bool Enabled { get => true; - set { } - } - - private Asset _texture; - public override Asset Texture - { - get + set { - if (_texture == null) - _texture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_None"); - - return _texture; + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Normal : GameModeID.Expert; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } } } - public NoDifficulty() + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Classic"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Classic_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= SoundID.MenuTick with { Volume = 1f }; + + public override int BackBoneGameModeID => GameModeID.Normal; + + public override float DifficultyScale => 0; + + public override LocalizedText Name => Language.GetText("UI.Normal"); + + public override Color ChatTextColor => Color.White; + + public override LocalizedText ShortDescription => GetText("UI.ClassicInfo"); + + public override LocalizedText FTWName => Language.GetText("UI.Expert"); + + public override Color FTWTextColor => new Color(255, 186, 117); // World display: Main.mcColor + } + + public class ExpertDifficulty : DifficultyMode + { + public override bool Enabled { - DifficultyScale = 0; - Name = CalamityUtils.GetText("UI.NoDifficulty"); - ShortDescription = CalamityUtils.GetText("UI.NoDifficultyInfo"); - - ActivationTextKey = string.Empty; - DeactivationTextKey = string.Empty; - - ActivationSound = SoundID.MenuTick with { Volume = 1f }; - - ChatTextColor = Color.White; - Instance = this; + get => Main.getGoodWorld ? Main.masterMode : Main.expertMode; + set + { + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Expert : GameModeID.Normal; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } + } } - public static NoDifficulty Instance { get; private set; } = null; + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Expert"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Expert_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= SoundID.ForceRoarPitched; + + public override int BackBoneGameModeID => GameModeID.Expert; + + public override float DifficultyScale => 0.1f; + + public override LocalizedText Name => Language.GetText("UI.Expert"); + public override Color ChatTextColor => new Color(255, 186, 117); // World display: Main.mcColor + + public override LocalizedText ShortDescription => GetText("UI.ExpertShortInfo"); + + public override LocalizedText ExpandedDescription => GetText("UI.ExpertExpandedInfo"); + + public override LocalizedText FTWName => Language.GetText("UI.Master"); + + public override Color FTWTextColor => new Color(28, 255, 170); // World display: Main.hcColor + } + + public class MasterDifficulty : DifficultyMode + { + public override bool Enabled + { + get => Main.getGoodWorld ? CalamityWorld.LegendaryMode : Main.masterMode; + set + { + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Master : GameModeID.Expert; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } + } + } + + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Master"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Master_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= SoundID.NPCDeath10; + + public override int BackBoneGameModeID => GameModeID.Master; + + public override float DifficultyScale => 0.25f; + + public override LocalizedText Name => Language.GetText("UI.Master"); + + public override Color ChatTextColor => new Color(28, 255, 170); // World display: Main.hcColor + + public override LocalizedText ShortDescription => GetText("UI.MasterShortInfo"); + + public override LocalizedText ExpandedDescription => GetText("UI.MasterExpandedInfo"); + + public override LocalizedText FTWName => Language.GetText("UI.Legendary"); + + public override Color FTWTextColor => Main.legendaryModeColor; + } public class RevengeanceDifficulty : DifficultyMode @@ -207,98 +402,112 @@ namespace CalamityMod.Systems public override bool Enabled { get => CalamityWorld.revenge; - set => CalamityWorld.revenge = value; - } - - private Asset _texture; - public override Asset Texture - { - get + set { - if (_texture == null) - _texture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev"); - - return _texture; + if (Main.getGoodWorld) + { + CalamityWorld.revenge = value; + CalamityWorld.death = value; + } + else + CalamityWorld.revenge = value; } } + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev"); + + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Rev_Off"); + + public override SoundStyle ActivationSound => _activationSound ??= SoundID.Item119; + + public override int BackBoneGameModeID => GameModeID.Expert; + + public override float DifficultyScale => 0.25f; + + public override LocalizedText Name => GetText("UI.Revengeance"); + + public override Color ChatTextColor => new Color(211, 42, 42); + + public override LocalizedText ShortDescription => GetText("UI.RevengeanceShortInfo"); + public override LocalizedText ExpandedDescription { get { string rageKey = "[c/FFCE85:" + CalamityKeybinds.RageHotKey.TooltipHotkeyString() + "]"; string adrenKey = "[c/79DFBF:" + CalamityKeybinds.AdrenalineHotKey.TooltipHotkeyString() + "]"; - return CalamityUtils.GetText("UI.RevengeanceExpandedInfo").WithFormatArgs(rageKey, adrenKey); + return GetText("UI.RevengeanceExpandedInfo").WithFormatArgs(rageKey, adrenKey); } } - public RevengeanceDifficulty() - { - DifficultyScale = 0.25f; - Name = CalamityUtils.GetText("UI.Revengeance"); - ShortDescription = CalamityUtils.GetText("UI.RevengeanceShortInfo"); + public override LocalizedText FTWName => GetText("UI.Death"); - ActivationTextKey = "Mods.CalamityMod.UI.RevengeanceActivate"; - DeactivationTextKey = "Mods.CalamityMod.UI.RevengeanceDeactivate"; - - ActivationSound = SoundID.Item119; - - ChatTextColor = Color.Crimson; - Instance = this; - } - - public static RevengeanceDifficulty Instance { get; private set; } = null; + public override Color FTWTextColor => new Color(192, 64, 219); } public class DeathDifficulty : DifficultyMode { public override bool Enabled { - get => CalamityWorld.death; - set => CalamityWorld.death = value; - } - - private Asset _texture; - public override Asset Texture - { - get + get => Main.getGoodWorld ? CalamityWorld.death && CalamityWorld.LegendaryMode : CalamityWorld.death; + set { - if (_texture == null) - _texture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death"); - - return _texture; + if (Main.getGoodWorld) + { + if (!Main.GameModeInfo.IsJourneyMode) + { + Main.GameMode = value == true ? GameModeID.Master : GameModeID.Expert; + } + else + { + DifficultyModeSystem.AlignJourneyDifficultySlider(); + } + CalamityWorld.death = value; + } + else + CalamityWorld.death = value; } } - public override LocalizedText ExpandedDescription => CalamityUtils.GetText("UI.DeathExpandedInfo"); + public override Asset Texture => _texture ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death"); - public DeathDifficulty() - { - DifficultyScale = 0.5f; - Name = CalamityUtils.GetText("UI.Death"); - ShortDescription = CalamityUtils.GetText("UI.DeathShortInfo"); + public override Asset TextureDisabled => _textureDisabled ??= ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicator_Death_Off"); - ActivationTextKey = "Mods.CalamityMod.UI.DeathActivate"; - DeactivationTextKey = "Mods.CalamityMod.UI.DeathDeactivate"; + public override SoundStyle ActivationSound => _activationSound ??= DemonshadeHelm.ActivationSound; - ActivationSound = DemonshadeHelm.ActivationSound; + public override int BackBoneGameModeID => GameModeID.Master; - ChatTextColor = Color.MediumOrchid; - Instance = this; - } + public override float DifficultyScale => 0.5f; - public override int FavoredDifficultyAtTier(int tier) + public override LocalizedText Name => GetText("UI.Death"); + + public override Color ChatTextColor => new Color(192, 64, 219); + + public override LocalizedText ShortDescription => GetText("UI.DeathShortInfo"); + + public override LocalizedText ExpandedDescription => GetText("UI.DeathExpandedInfo"); + + + public override LocalizedText FTWName => GetText("UI.Malice"); + + public override Color FTWTextColor => new Color(240, 128, 128); + + public override int[] FavoredDifficultyAtTier(int tier) { DifficultyMode[] tierList = DifficultyModeSystem.DifficultyTiers[tier]; + List difficulties = new List(); + for (int i = 0; i < tierList.Length; i++) { - if (tierList[i].Name == CalamityUtils.GetText("UI.Revengeance")) - return i; + if (tierList[i] is MasterDifficulty || tierList[i] is RevengeanceDifficulty) + difficulties.Add(i); } - return 0; + if (difficulties.Count <= 0) + difficulties.Add(0); + + return difficulties.ToArray(); } - public static DeathDifficulty Instance { get; private set; } = null; } } diff --git a/Systems/Mechanic/RecipeSystem.cs b/Systems/Mechanic/RecipeSystem.cs index a44c41515f..5c0256885e 100644 --- a/Systems/Mechanic/RecipeSystem.cs +++ b/Systems/Mechanic/RecipeSystem.cs @@ -11,6 +11,8 @@ using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; using CalamityMod.Items.Placeables.Abyss; using CalamityMod.Items.Placeables.Astral; +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Items.Placeables.Crags; using CalamityMod.Items.Placeables.SunkenSea; using CalamityMod.Items.Tools; @@ -35,10 +37,10 @@ namespace CalamityMod.Systems #endregion #region Recipe Group Definitions - public static int HardmodeAnvil, HardmodeForge, AnyLargeGem, AnyFood; + public static int HardmodeAnvil, HardmodeForge, AnyFood; public static int AnyCopperOre, AnySilverOre, AnyGoldOre, AnyEvilOre, AnyCobaltOre, AnyMythrilOre, AnyAdamantiteOre; public static int AnyCopperBar, AnySilverBar, AnyGoldBar, AnyEvilBar, AnyCobaltBar, AnyMythrilBar, AnyAdamantiteBar; - public static int AnyEvilPowder, Boss2Material, CursedFlameIchor, AnyEvilWater, AnyEvilFlask; + public static int Boss2Material, CursedFlameIchor, AnyEvilWater; public static int AnyStoneBlock, AnySnowBlock, AnyIceBlock, AnySiltBlock, AnyEvilBlock, AnyGoodBlock; public static int AnyWoodenSword, AnyHallowedHelmet, AnyHallowedPlatemail, AnyHallowedGreaves, AnyGoldCrown, LunarPickaxe, LunarHamaxe; public static int AnyManaFlower, AnyQuiver, AnyTombstone, AnyWings; @@ -87,19 +89,6 @@ namespace CalamityMod.Systems }); HardmodeForge = RecipeGroup.RegisterGroup("HardmodeForge", group); - // Large Gems (PvP tokens) - group = new RecipeGroup(() => CalamityUtils.GetTextValue("Misc.RecipeGroup.AnyLargeGem"), new int[] - { - ItemID.LargeAmber, - ItemID.LargeAmethyst, - ItemID.LargeDiamond, - ItemID.LargeEmerald, - ItemID.LargeRuby, - ItemID.LargeSapphire, - ItemID.LargeTopaz - }); - AnyLargeGem = RecipeGroup.RegisterGroup("AnyLargeGem", group); - // Food AnyFood = RecipeGroup.RegisterGroup("AnyFood", GetFoodItems()); } @@ -214,16 +203,8 @@ namespace CalamityMod.Systems private static void AddEvilBiomeItemRecipeGroups() { - // Vile and Vicious Powder - RecipeGroup group = new RecipeGroup(() => CalamityUtils.GetTextValue("Misc.RecipeGroup.AnyEvilPowder"), new int[] - { - ItemID.VilePowder, - ItemID.ViciousPowder - }); - AnyEvilPowder = RecipeGroup.RegisterGroup("AnyEvilPowder", group); - // Shadow Scale and Tissue Sample - group = new RecipeGroup(() => CalamityUtils.GetTextValue("Misc.RecipeGroup.Boss2Material"), new int[] + RecipeGroup group = new RecipeGroup(() => CalamityUtils.GetTextValue("Misc.RecipeGroup.Boss2Material"), new int[] { ItemID.ShadowScale, ItemID.TissueSample @@ -245,14 +226,6 @@ namespace CalamityMod.Systems ItemID.BloodWater }); AnyEvilWater = RecipeGroup.RegisterGroup("AnyEvilWater", group); - - // Flask of Cursed Flames and Flask of Ichor - group = new RecipeGroup(() => CalamityUtils.GetTextValue("Misc.RecipeGroup.AnyEvilFlask"), new int[] - { - ItemID.FlaskofCursedFlames, - ItemID.FlaskofIchor - }); - AnyEvilFlask = RecipeGroup.RegisterGroup("AnyEvilFlask", group); } private static void AddBiomeBlockRecipeGroups() @@ -455,7 +428,7 @@ namespace CalamityMod.Systems ItemType(), ItemType(), ItemType(), - ItemType(), + ItemType(), ItemType(), ItemID.Jetpack }; @@ -517,6 +490,7 @@ namespace CalamityMod.Systems AddIngredient(ItemID.ExplosivePowder, 4). AddTile(TileID.Anvils). Register(); + // and Rocket IIs (requires slightly more explosive powder) Recipe.Create(ItemID.RocketII, 100). AddRecipeGroup("IronBar"). @@ -841,84 +815,6 @@ namespace CalamityMod.Systems // Berserker's Glove recipe change now that it doesn't provide melee speed { Vanilla(ItemID.BerserkerGlove), ReplaceIngredient(ItemID.PowerGlove, ItemID.TitanGlove) }, - - // Standardize the costs of all PHM ore armors to 10/16/14 head/chest/legs - { Vanilla(ItemID.CopperHelmet), ChangeIngredientStack(ItemID.CopperBar, 10) }, - { Vanilla(ItemID.CopperChainmail), ChangeIngredientStack(ItemID.CopperBar, 16) }, - { Vanilla(ItemID.CopperGreaves), ChangeIngredientStack(ItemID.CopperBar, 14) }, - { Vanilla(ItemID.TinHelmet), ChangeIngredientStack(ItemID.TinBar, 10) }, - { Vanilla(ItemID.TinChainmail), ChangeIngredientStack(ItemID.TinBar, 16) }, - { Vanilla(ItemID.TinGreaves), ChangeIngredientStack(ItemID.TinBar, 14) }, - { Vanilla(ItemID.IronHelmet), ChangeIngredientStack(ItemID.IronBar, 10) }, - { Vanilla(ItemID.IronChainmail), ChangeIngredientStack(ItemID.IronBar, 16) }, - { Vanilla(ItemID.IronGreaves), ChangeIngredientStack(ItemID.IronBar, 14) }, - { Vanilla(ItemID.LeadHelmet), ChangeIngredientStack(ItemID.LeadBar, 10) }, - { Vanilla(ItemID.LeadChainmail), ChangeIngredientStack(ItemID.LeadBar, 16) }, - { Vanilla(ItemID.LeadGreaves), ChangeIngredientStack(ItemID.LeadBar, 14) }, - { Vanilla(ItemID.SilverHelmet), ChangeIngredientStack(ItemID.SilverBar, 10) }, - { Vanilla(ItemID.SilverChainmail), ChangeIngredientStack(ItemID.SilverBar, 16) }, - { Vanilla(ItemID.SilverGreaves), ChangeIngredientStack(ItemID.SilverBar, 14) }, - { Vanilla(ItemID.TungstenHelmet), ChangeIngredientStack(ItemID.TungstenBar, 10) }, - { Vanilla(ItemID.TungstenChainmail), ChangeIngredientStack(ItemID.TungstenBar, 16) }, - { Vanilla(ItemID.TungstenGreaves), ChangeIngredientStack(ItemID.TungstenBar, 14) }, - { Vanilla(ItemID.GoldHelmet), ChangeIngredientStack(ItemID.GoldBar, 10) }, - { Vanilla(ItemID.GoldChainmail), ChangeIngredientStack(ItemID.GoldBar, 16) }, - { Vanilla(ItemID.GoldGreaves), ChangeIngredientStack(ItemID.GoldBar, 14) }, - { Vanilla(ItemID.PlatinumHelmet), ChangeIngredientStack(ItemID.PlatinumBar, 10) }, - { Vanilla(ItemID.PlatinumChainmail), ChangeIngredientStack(ItemID.PlatinumBar, 16) }, - { Vanilla(ItemID.PlatinumGreaves), ChangeIngredientStack(ItemID.PlatinumBar, 14) }, - - // Standardize the costs of all HM ore items to the following: - // 10 BARS : Melee Helm, Ranged Helm, Magic Helm, Pickaxe, Drill, Waraxe, Chainsaw, Sword, Spear, Repeater - // 20 BARS : Breastplate - // 15 BARS : Leggings - { VanillaEach( - ItemID.CobaltHelmet, ItemID.CobaltMask, ItemID.CobaltHat, ItemID.CobaltPickaxe, ItemID.CobaltDrill, ItemID.CobaltWaraxe, ItemID.CobaltChainsaw, - ItemID.CobaltSword, ItemID.CobaltNaginata, ItemID.CobaltRepeater), - ChangeIngredientStack(ItemID.CobaltBar, 10) - }, - { Vanilla(ItemID.CobaltBreastplate), ChangeIngredientStack(ItemID.CobaltBar, 20) }, - { Vanilla(ItemID.CobaltLeggings), ChangeIngredientStack(ItemID.CobaltBar, 15) }, - - { VanillaEach( - ItemID.PalladiumHelmet, ItemID.PalladiumMask, ItemID.PalladiumHeadgear, ItemID.PalladiumPickaxe, ItemID.PalladiumDrill, ItemID.PalladiumWaraxe, ItemID.PalladiumChainsaw, - ItemID.PalladiumSword, ItemID.PalladiumPike, ItemID.PalladiumRepeater), - ChangeIngredientStack(ItemID.PalladiumBar, 10) - }, - { Vanilla(ItemID.PalladiumBreastplate), ChangeIngredientStack(ItemID.PalladiumBar, 20) }, - { Vanilla(ItemID.PalladiumLeggings), ChangeIngredientStack(ItemID.PalladiumBar, 15) }, - - { VanillaEach( - ItemID.MythrilHelmet, ItemID.MythrilHat, ItemID.MythrilHood, ItemID.MythrilPickaxe, ItemID.MythrilDrill, ItemID.MythrilWaraxe, ItemID.MythrilChainsaw, - ItemID.MythrilSword, ItemID.MythrilHalberd, ItemID.MythrilRepeater), - ChangeIngredientStack(ItemID.MythrilBar, 10) - }, - { Vanilla(ItemID.MythrilChainmail), ChangeIngredientStack(ItemID.MythrilBar, 20) }, - { Vanilla(ItemID.MythrilGreaves), ChangeIngredientStack(ItemID.MythrilBar, 15) }, - - { VanillaEach( - ItemID.OrichalcumHelmet, ItemID.OrichalcumMask, ItemID.OrichalcumHeadgear, ItemID.OrichalcumPickaxe, ItemID.OrichalcumDrill, ItemID.OrichalcumWaraxe, ItemID.OrichalcumChainsaw, - ItemID.OrichalcumSword, ItemID.OrichalcumHalberd, ItemID.OrichalcumRepeater), - ChangeIngredientStack(ItemID.OrichalcumBar, 10) - }, - { Vanilla(ItemID.OrichalcumBreastplate), ChangeIngredientStack(ItemID.OrichalcumBar, 20) }, - { Vanilla(ItemID.OrichalcumLeggings), ChangeIngredientStack(ItemID.OrichalcumBar, 15) }, - - { VanillaEach( - ItemID.AdamantiteHelmet, ItemID.AdamantiteMask, ItemID.AdamantiteHeadgear, ItemID.AdamantitePickaxe, ItemID.AdamantiteDrill, ItemID.AdamantiteWaraxe, ItemID.AdamantiteChainsaw, - ItemID.AdamantiteSword, ItemID.AdamantiteGlaive, ItemID.AdamantiteRepeater), - ChangeIngredientStack(ItemID.AdamantiteBar, 10) - }, - { Vanilla(ItemID.AdamantiteBreastplate), ChangeIngredientStack(ItemID.AdamantiteBar, 20) }, - { Vanilla(ItemID.AdamantiteLeggings), ChangeIngredientStack(ItemID.AdamantiteBar, 15) }, - - { VanillaEach( - ItemID.TitaniumHelmet, ItemID.TitaniumMask, ItemID.TitaniumHeadgear, ItemID.TitaniumPickaxe, ItemID.TitaniumDrill, ItemID.TitaniumWaraxe, ItemID.TitaniumChainsaw, - ItemID.TitaniumSword, ItemID.TitaniumTrident, ItemID.TitaniumRepeater), - ChangeIngredientStack(ItemID.TitaniumBar, 10) - }, - { Vanilla(ItemID.TitaniumBreastplate), ChangeIngredientStack(ItemID.TitaniumBar, 20) }, - { Vanilla(ItemID.TitaniumLeggings), ChangeIngredientStack(ItemID.TitaniumBar, 15) }, }; // Apply all recipe changes. @@ -1063,17 +959,13 @@ namespace CalamityMod.Systems convert[ItemID.LifeformAnalyzer] = ItemID.Stopwatch; convert[ItemID.Stopwatch] = ItemID.DPSMeter; - // Pyramid loot edits. There's no good way to have this not be hardcoded. - convert[ItemID.PharaohsMask] = ItemID.PharaohsRobe; - convert[ItemID.PharaohsRobe] = ItemID.PharaohsMask; - - convert[ItemID.AmberHook] = ItemID.SandstorminaBottle; - convert[ItemID.SandstorminaBottle] = ItemID.FlyingCarpet; - convert[ItemID.FlyingCarpet] = ItemID.AmberHook; - // Enchanted Sword and Terragrim shimmer into each other convert[ItemID.EnchantedSword] = ItemID.Terragrim; convert[ItemID.Terragrim] = ItemID.EnchantedSword; + + // Allow Cascade and Gray Zapinator to be obtained in Hardmode + convert[ItemID.HelFire] = ItemID.Cascade; + convert[ItemID.ZapinatorOrange] = ItemID.ZapinatorGray; } #endregion @@ -1338,13 +1230,6 @@ namespace CalamityMod.Systems r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); r.DisableDecraft(); - r = Recipe.Create(ItemID.GoldenDelight); - r.AddIngredient(); - r.AddTile(TileID.CookingPots); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.GoldenDelight); - r.DisableDecraft(); - r = Recipe.Create(ItemID.GoldenDelight); r.AddIngredient(); r.AddTile(TileID.CookingPots); @@ -1383,48 +1268,11 @@ namespace CalamityMod.Systems r.DisableDecraft(); #endregion - #region New Recipes r = Recipe.Create(ItemID.Bacon); r.AddIngredient(); r.AddTile(TileID.Hellforge); r.Register(); r.DisableDecraft(); - - r = Recipe.Create(ItemID.ApplePie); - r.AddIngredient(ItemID.Apple, 3); - r.AddTile(TileID.Hellforge); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.BananaSplit); - r.AddIngredient(ItemID.Banana); - r.AddIngredient(ItemID.IceBlock); - r.AddIngredient(ItemID.MilkCarton); - r.AddTile(TileID.CookingPots); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.BBQRibs); - r.AddIngredient(ItemID.FleshBlock, 6); - r.AddIngredient(ItemID.Bone, 6); - r.AddTile(TileID.Hellforge); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.MilkCarton); - r.AddIngredient(ItemID.BottledWater); - r.AddIngredient(ItemID.Bone, 2); - r.AddTile(TileID.CookingPots); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.Nachos); - r.AddIngredient(ItemID.PotatoChips); - r.AddIngredient(ItemID.MilkCarton); - r.AddTile(TileID.CookingPots); - r.Register(); - r.DisableDecraft(); - #endregion } #endregion @@ -1455,7 +1303,6 @@ namespace CalamityMod.Systems r.AddRecipeGroup("AnyCopperBar", 2); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); // Lower half Desert items (these are partially destroyed by Sunken Sea) // Bast Statue @@ -1465,14 +1312,12 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Ruby); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Encumbering Stone r = Recipe.Create(ItemID.EncumberingStone); r.AddIngredient(ItemID.StoneBlock, 100); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); } #endregion @@ -1485,7 +1330,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Wood, 7); r.AddTile(TileID.WorkBenches); r.Register(); - r.DisableDecraft(); // Wand of Sparking r = Recipe.Create(ItemID.WandofSparking); @@ -1495,7 +1339,6 @@ namespace CalamityMod.Systems r.AddCondition(Condition.NotRemixWorld); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Early game minions // Finch Staff @@ -1504,7 +1347,6 @@ namespace CalamityMod.Systems r.AddRecipeGroup("Wood", 8); r.AddTile(TileID.WorkBenches); r.Register(); - r.DisableDecraft(); // Slime Staff r = Recipe.Create(ItemID.SlimeStaff); @@ -1512,7 +1354,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Gel, 40); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Key sword components // Enchanted Sword @@ -1560,7 +1401,6 @@ namespace CalamityMod.Systems r.AddRecipeGroup("Wood", 10); r.AddTile(TileID.Sawmill); r.Register(); - r.DisableDecraft(); #region Terraspark Boots Line // Hermes Boots @@ -1569,14 +1409,12 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.SwiftnessPotion, 5); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); // Aglet r = Recipe.Create(ItemID.Aglet); r.AddRecipeGroup(AnyCopperBar, 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Anklet of the Wind r = Recipe.Create(ItemID.AnkletoftheWind); @@ -1585,7 +1423,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.PinkGel, 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Ice Skates r = Recipe.Create(ItemID.IceSkates); @@ -1593,7 +1430,6 @@ namespace CalamityMod.Systems r.AddRecipeGroup("IronBar", 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Water Walking Boots r = Recipe.Create(ItemID.WaterWalkingBoots); @@ -1601,7 +1437,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.WaterWalkingPotion, 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Lava Charm r = Recipe.Create(ItemID.LavaCharm); @@ -1619,7 +1454,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Hellstone, 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); #endregion #region Core Movement Accessories @@ -1631,7 +1465,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Feather, 3); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Cloud in a Bottle r = Recipe.Create(ItemID.CloudinaBottle); @@ -1640,7 +1473,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Feather, 2); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Sandstorm in a Bottle r = Recipe.Create(ItemID.SandstorminaBottle); @@ -1660,7 +1492,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Feather, 10); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Flying Carpet r = Recipe.Create(ItemID.FlyingCarpet); @@ -1683,7 +1514,6 @@ namespace CalamityMod.Systems r.AddRecipeGroup(AnyGoldBar, 8); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Shiny Red Balloon r = Recipe.Create(ItemID.ShinyRedBalloon); @@ -1691,7 +1521,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Cloud, 10); r.AddTile(TileID.Solidifier); r.Register(); - r.DisableDecraft(); #endregion // Cobalt Shield @@ -1708,7 +1537,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.Obsidian, 4); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); // Flower Boots r = Recipe.Create(ItemID.FlowerBoots); @@ -1717,21 +1545,18 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.JungleGrassSeeds, 5); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); // Hand Warmer r = Recipe.Create(ItemID.HandWarmer); r.AddIngredient(ItemID.Silk, 10); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); // Radar r = Recipe.Create(ItemID.Radar); r.AddRecipeGroup("IronBar", 5); r.AddTile(TileID.Anvils); r.Register(); - r.DisableDecraft(); } #endregion @@ -1744,34 +1569,18 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.FlinxFur, 1); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoCoat); r.AddIngredient(ItemID.Silk, 8); r.AddIngredient(ItemID.FlinxFur, 2); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); r = Recipe.Create(ItemID.EskimoPants); r.AddIngredient(ItemID.Silk, 6); r.AddIngredient(ItemID.FlinxFur, 1); r.AddTile(TileID.Loom); r.Register(); - r.DisableDecraft(); - - // Pharaoh set (replaced Chest items) - r = Recipe.Create(ItemID.PharaohsMask); - r.AddIngredient(ItemID.AncientCloth, 3); - r.AddTile(TileID.Loom); - r.Register(); - r.DisableDecraft(); - - r = Recipe.Create(ItemID.PharaohsRobe); - r.AddIngredient(ItemID.AncientCloth, 4); - r.AddTile(TileID.Loom); - r.Register(); - r.DisableDecraft(); } #endregion @@ -1802,37 +1611,12 @@ namespace CalamityMod.Systems r.Register(); r.DisableDecraft(); - // Mechanical Glove directly from correct class emblem for cheaper (compromise) - r = Recipe.Create(ItemID.MechanicalGlove); - r.AddIngredient(ItemID.PowerGlove); - r.AddIngredient(ItemID.WarriorEmblem); - r.AddIngredient(ItemID.SoulofFright); - r.AddIngredient(ItemID.SoulofMight); - r.AddIngredient(ItemID.SoulofSight); - r.AddTile(TileID.TinkerersWorkbench); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.MechanicalGlove); - r.DisableDecraft(); - - // Celestial Emblem directly from correct class emblem for cheaper (compromise) - r = Recipe.Create(ItemID.CelestialEmblem); - r.AddIngredient(ItemID.CelestialMagnet); - r.AddIngredient(ItemID.SorcererEmblem); - r.AddIngredient(ItemID.SoulofFright); - r.AddIngredient(ItemID.SoulofMight); - r.AddIngredient(ItemID.SoulofSight); - r.AddTile(TileID.TinkerersWorkbench); - r.Register(); - r.SortAfterFirstRecipesOf(ItemID.CelestialEmblem); - r.DisableDecraft(); - // Tiershift Mini Nuke 1s to post Moon Lord. r = Recipe.Create(ItemID.MiniNukeI, 333); r.AddIngredient(ItemID.RocketIII, 333); r.AddIngredient(ItemID.LunarBar); r.AddTile(TileID.LunarCraftingStation); r.Register(); - r.DisableDecraft(); // Tiershift Mini Nuke 2s to post Moon Lord. r = Recipe.Create(ItemID.MiniNukeII, 333); @@ -1840,7 +1624,6 @@ namespace CalamityMod.Systems r.AddIngredient(ItemID.LunarBar); r.AddTile(TileID.LunarCraftingStation); r.Register(); - r.DisableDecraft(); } #endregion diff --git a/Systems/Mechanic/TilePingerSystem.cs b/Systems/Mechanic/TilePingerSystem.cs index f28c9cb3b1..e33c7ad470 100644 --- a/Systems/Mechanic/TilePingerSystem.cs +++ b/Systems/Mechanic/TilePingerSystem.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.Graphics.Effects; using Terraria.Graphics.Light; using Terraria.ID; @@ -83,6 +84,8 @@ namespace CalamityMod.Systems pingedTiles = new Dictionary>(); pingedNonSolidTiles = new Dictionary>(); tileEffects = new Dictionary(); + + On_TileDrawing.DrawTiles_GetLightOverride += ForceSufficientLight; } public override void Unload() @@ -93,6 +96,42 @@ namespace CalamityMod.Systems tileEffects = null; } + private static Color ForceSufficientLight(On_TileDrawing.orig_DrawTiles_GetLightOverride orig, TileDrawing self, int j, int i, Tile tileCache, ushort typeCache, short tileFrameX, short tileFrameY, Color tileLight) + { + Color returnColor = orig(self, j, i, tileCache, typeCache, tileFrameX, tileFrameY, tileLight); + foreach (IPingedTileEffect effect in tileEffects.Values) + { + // Nothing else uses this so like should be okay + if (effect is WulfrumPingTileEffect w && effect.Active && effect.ShouldRegisterTile(i, j)) + { + float distanceFromCenter = (new Point(i, j).ToWorldCoordinates() - WulfrumPingTileEffect.PingCenter).Length(); + float currentExpansion = MathHelper.Clamp(WulfrumPingTileEffect.PingProgress * WulfrumPingTileEffect.MaxPingLife / (float)WulfrumPingTileEffect.MaxPingTravelTime, 0f, 1f) * WulfrumPingTileEffect.MaxPingRadius; + + if (distanceFromCenter - 8 > currentExpansion) + return returnColor; + + float brightness = 1f; + Tile tile = Framing.GetTileSafely(i, j); + //Counteracts slopes and half tiles being too bright + if (tile.Slope != SlopeType.Solid || tile.IsHalfBlock) + brightness = 0.64f; + + //Fade on the edges + if (distanceFromCenter + 8 > currentExpansion) + brightness *= 1 - (distanceFromCenter - currentExpansion + 8f) / 16f; + + //Fade away with the effect + brightness *= 1 - Math.Max(WulfrumPingTileEffect.PingProgress - 0.9f, 0) / (0.1f); + + if (tileLight.R < 200 * brightness) tileLight.R = (byte)(200 * brightness); + if (tileLight.G < 200 * brightness) tileLight.G = (byte)(200 * brightness); + if (tileLight.B < 200 * brightness) tileLight.B = (byte)(200 * brightness); + returnColor = tileLight; + } + } + return returnColor; + } + public static bool AddPing(string effectName, Vector2 position, Player pinger) { if (!Main.dedServ) @@ -231,11 +270,11 @@ namespace CalamityMod.Systems public class WulfrumPingTileEffect : IPingedTileEffect, ILoadable { internal static Texture2D emptyFrame; - const int MaxPingLife = 350; - const int MaxPingTravelTime = 60; + public const int MaxPingLife = 350; + public const int MaxPingTravelTime = 60; const float PingWaveThickness = 50f; - const float MaxPingRadius = 1700f; + public const float MaxPingRadius = 1700f; public static Vector2 PingCenter = Vector2.Zero; public static int PingTimer = 0; public static float PingProgress => (MaxPingLife - PingTimer) / (float)MaxPingLife; @@ -316,7 +355,8 @@ namespace CalamityMod.Systems Main.spriteBatch.Draw(emptyFrame, pos.ToWorldCoordinates() - Main.screenPosition, null, Color.White, 0, new Vector2(emptyFrame.Width / 2f, emptyFrame.Height / 2f), 16f, 0, 0); } - public void EditDrawData(int i, int j, ref TileDrawInfo drawData) + // CIT 16JUL2025: Tile lighting override is now applied via an On edit; this code is duplicated there, and thus is no longer needed here. + /*public void EditDrawData(int i, int j, ref TileDrawInfo drawData) { float distanceFromCenter = (new Point(i, j).ToWorldCoordinates() - PingCenter).Length(); float currentExpansion = MathHelper.Clamp(PingProgress * MaxPingLife / (float)MaxPingTravelTime, 0f, 1f) * MaxPingRadius; @@ -333,14 +373,14 @@ namespace CalamityMod.Systems //Fade on the edges if (distanceFromCenter + 8 > currentExpansion) brightness *= 1 - (distanceFromCenter - currentExpansion + 8f) / 16f; - + //Fade away with the effect brightness *= 1 - Math.Max(PingProgress - 0.9f, 0) / (0.1f); if (drawData.tileLight.R < 200 * brightness) drawData.tileLight.R = (byte)(200 * brightness); if (drawData.tileLight.G < 200 * brightness) drawData.tileLight.G = (byte)(200 * brightness); if (drawData.tileLight.B < 200 * brightness) drawData.tileLight.B = (byte)(200 * brightness); - } + }*/ public void UpdateEffect() { diff --git a/Systems/Mechanic/WorldSelectionDifficultySystem.cs b/Systems/Mechanic/WorldSelectionDifficultySystem.cs index 18d7107050..677911be0c 100644 --- a/Systems/Mechanic/WorldSelectionDifficultySystem.cs +++ b/Systems/Mechanic/WorldSelectionDifficultySystem.cs @@ -23,7 +23,7 @@ namespace CalamityMod.Systems { WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Revengeance"), GetRevengeance, new(211, 42, 42))); WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Death"), GetDeath, new(192, 64, 219))); - WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.DeathLegend"), GetLegendDeath, new(220, 255, 132))); // Defiled color + WorldDifficulties.Add(new WorldDifficulty(CalamityUtils.GetTextValue("UI.Malice"), GetMalice, new(240, 128, 128))); } } @@ -51,17 +51,25 @@ namespace CalamityMod.Systems public static bool GetDeath(AWorldListItem item) { + // Grab data from the listed world + FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); + WorldFileData worldData = (WorldFileData)worldDataField.GetValue(item); + if (item.Data.TryGetHeaderData(out TagCompound tag)) { if (tag.ContainsKey("DeathMode") && tag.GetBool("DeathMode")) { return true; } + else if (tag.ContainsKey("RevengeanceMode") && tag.GetBool("RevengeanceMode")) + { + return worldData.ForTheWorthy; + } } return false; } - public static bool GetLegendDeath(AWorldListItem item) + public static bool GetMalice(AWorldListItem item) { // Grab data from the listed world FieldInfo worldDataField = typeof(UIWorldListItem).GetField("_data", BindingFlags.NonPublic | BindingFlags.Instance); diff --git a/Systems/Sound/MusicEventSystem.cs b/Systems/Sound/MusicEventSystem.cs index 1746e62840..3a6d20612e 100644 --- a/Systems/Sound/MusicEventSystem.cs +++ b/Systems/Sound/MusicEventSystem.cs @@ -54,17 +54,17 @@ namespace CalamityMod.Systems } AddEntry("CloneDefeated", "Interlude1", TimeSpan.FromSeconds(214.577d), - () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interlude1); + () => DownedBossSystem.downedCalamitasClone, () => CalamityClientConfig.Instance.Interludes); AddEntry("MLDefeated", "Interlude2", TimeSpan.FromSeconds(191.912d), () => NPC.downedMoonlord, - () => CalamityClientConfig.Instance.Interlude2, outroSilence: TimeSpan.FromSeconds(1f)); + () => CalamityClientConfig.Instance.Interludes, outroSilence: TimeSpan.FromSeconds(1f)); // Alternative Interlude 2 -> AddEntry("MLDefeated", "Interlude2_CutIntro", TimeSpan.FromSeconds(160.989d), // () => NPC.downedMoonlord, () => CalamityClientConfig.Instance.Interlude2, // outroSilence: TimeSpan.FromSeconds(1f)); AddEntry("YharonDefeated", "Interlude3", TimeSpan.FromSeconds(295.932d), - () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interlude3); + () => DownedBossSystem.downedYharon, () => CalamityClientConfig.Instance.Interludes); AddEntry("DoGDefeated", "DevourerofGodsEulogy", TimeSpan.FromSeconds(203.620d), () => DownedBossSystem.downedDoG, () => CalamityClientConfig.Instance.DevourerofGodsEulogy, diff --git a/Systems/Tile/BiomeTileCounterSystem.cs b/Systems/Tile/BiomeTileCounterSystem.cs index bd77177433..4baf2a8202 100644 --- a/Systems/Tile/BiomeTileCounterSystem.cs +++ b/Systems/Tile/BiomeTileCounterSystem.cs @@ -10,6 +10,8 @@ using CalamityMod.Tiles.Ores; using CalamityMod.Tiles.SunkenSea; using Terraria; using Terraria.ModLoader; +using CalamityMod.Walls; +using Terraria.ID; namespace CalamityMod.Systems { @@ -23,10 +25,11 @@ namespace CalamityMod.Systems public static int SunkenSeaPolypTiles = 0; public static int SunkenSeaReefsTiles = 0; public static int SunkenSeaBurrowsTiles = 0; + public static int SunkenSeaBasaltTiles = 0; public static int ArsenalLabTiles = 0; public static int AbyssTiles = 0; public static int FloralParadiseTiles = 0; - + public static int UndergroundTiles = 0; public static int Layer1Tiles = 0; public static int Layer2Tiles = 0; public static int Layer3Tiles = 0; @@ -41,9 +44,11 @@ namespace CalamityMod.Systems SunkenSeaPolypTiles = 0; SunkenSeaReefsTiles = 0; SunkenSeaBurrowsTiles = 0; + SunkenSeaBasaltTiles = 0; SulphurTiles = 0; AbyssTiles = 0; ArsenalLabTiles = 0; + UndergroundTiles = 0; Layer1Tiles = 0; Layer2Tiles = 0; @@ -56,14 +61,16 @@ namespace CalamityMod.Systems { BrimstoneCragTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaShoresTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaPolypTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SunkenSeaReefsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; - SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaBurrowsTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + SunkenSeaBasaltTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; AbyssTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; SulphurTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; FloralParadiseTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; ArsenalLabTiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; + UndergroundTiles = tileCounts[TileID.Stone]; Layer1Tiles = tileCounts[ModContent.TileType()]; Layer2Tiles = tileCounts[ModContent.TileType()] + tileCounts[ModContent.TileType()]; diff --git a/Systems/Tile/TileFramingSystem.cs b/Systems/Tile/TileFramingSystem.cs index 8294009f1b..811dff86be 100644 --- a/Systems/Tile/TileFramingSystem.cs +++ b/Systems/Tile/TileFramingSystem.cs @@ -91,8 +91,8 @@ namespace CalamityMod.Systems (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), ]; private static int[][] PlantValidGrounds; @@ -121,7 +121,6 @@ namespace CalamityMod.Systems PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; PlantValidGrounds[ModContent.TileType()] = new int[2] { ModContent.TileType(), ModContent.TileType() }; - PlantValidGrounds[ModContent.TileType()] = new int[1] { ModContent.TileType() }; VineToGrass = new Dictionary { diff --git a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs index 207c4bc4ea..c0035e5be1 100644 --- a/Systems/TileMerging/TileBlendMergeSystem_Draw.cs +++ b/Systems/TileMerging/TileBlendMergeSystem_Draw.cs @@ -120,26 +120,30 @@ namespace CalamityMod.Systems // Sliced Drawing for (int i = 0; i < sliceLength; i++) { - var drawRect = sliceRects[i]; - drawRect.X += rect.X; - drawRect.Y += rect.Y; + // Calculate the source rectangle for the specific slice from the blend texture sheet + var sourceSliceRect = sliceRects[i]; + sourceSliceRect.X += rect.X; + sourceSliceRect.Y += rect.Y; + + // Calculate the destination position for the slice on the screen + var destinationSlicePos = drawPos + sliceRects[i].Location.ToVector2(); var drawColorVec = (tileLight.ToVector3() + slices[i]) * 0.5f; drawColorVec *= drawData.colorTint.ToVector3(); - // Tile is Actucated, Reduce brightness + // Tile is Actuated, Reduce brightness if (tile.IsActuated) { drawColorVec *= 0.4f; } - // Tile is shine + // Tile is shining if (shouldTileShine) { Main.shine(ref drawColorVec, tileType); } - Main.spriteBatch.Draw(texture, drawPos, rect, new Color(drawColorVec), rotation: 0.0f, origin: default, scale: 1.0f, SpriteEffects.None, layerDepth: 0.0f); + Main.spriteBatch.Draw(texture, destinationSlicePos, sourceSliceRect, new Color(drawColorVec), 0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0f); } } } diff --git a/Systems/World/BestiaryRegistrySystem.cs b/Systems/World/BestiaryRegistrySystem.cs index 10e32c9b49..94b29f2688 100644 --- a/Systems/World/BestiaryRegistrySystem.cs +++ b/Systems/World/BestiaryRegistrySystem.cs @@ -17,8 +17,6 @@ namespace CalamityMod.Systems ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; - ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()]; - ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCType()] = ContentSamples.NpcBestiaryCreditIdsByNpcNetIds[NPCID.LavaSlime]; } } } diff --git a/Systems/World/MiscWorldStateSystem.cs b/Systems/World/MiscWorldStateSystem.cs index 2b95101060..a5bdd31e7a 100644 --- a/Systems/World/MiscWorldStateSystem.cs +++ b/Systems/World/MiscWorldStateSystem.cs @@ -56,7 +56,6 @@ namespace CalamityMod //Abyss.AbleToUnlockChests = false; //Yet another fucking failsave for abyss chests spawnedBandit = false; - spawnedCirrus = false; foundHomePermafrost = false; catName = false; @@ -92,8 +91,6 @@ namespace CalamityMod downed.Add("acidRain"); if (spawnedBandit) downed.Add("bandit"); - if (spawnedCirrus) - downed.Add("drunkPrincess"); if (foundHomePermafrost) downed.Add("archmageHome"); @@ -151,7 +148,6 @@ namespace CalamityMod BossRushEvent.BossRushActive = downed.Contains("bossRushActive"); AcidRainEvent.AcidRainEventIsOngoing = downed.Contains("acidRain"); spawnedBandit = downed.Contains("bandit"); - spawnedCirrus = downed.Contains("drunkPrincess"); foundHomePermafrost = downed.Contains("archmageHome"); #region Load Pet Names @@ -237,7 +233,7 @@ namespace CalamityMod BitsByte flags5 = new BitsByte(); flags5[0] = downedAstrumDeus; flags5[1] = spawnedBandit; - flags5[2] = spawnedCirrus; + flags5[2] = false; flags5[3] = AcidRainEvent.HasStartedAcidicDownpour; flags5[4] = false; flags5[5] = downedPolterghast; @@ -391,7 +387,7 @@ namespace CalamityMod BitsByte flags5 = reader.ReadByte(); downedAstrumDeus = flags5[0]; spawnedBandit = flags5[1]; - spawnedCirrus = flags5[2]; + _ = flags5[2]; AcidRainEvent.HasStartedAcidicDownpour = flags5[3]; _ = flags5[4]; downedPolterghast = flags5[5]; diff --git a/Systems/World/WorldMiscUpdateSystem.cs b/Systems/World/WorldMiscUpdateSystem.cs index 411eae4315..bd18a0c963 100644 --- a/Systems/World/WorldMiscUpdateSystem.cs +++ b/Systems/World/WorldMiscUpdateSystem.cs @@ -11,6 +11,7 @@ using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; using CalamityMod.Walls; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -387,6 +388,9 @@ namespace CalamityMod.Systems if (tileType == TileType()) tileType2 = TileType(); + if (tileType == TileType()) + tileType2 = TileType(); + bool canPlaceBasedOnAttached = true; if (tileType2 == TileType() && !isSunkenSeaTile) canPlaceBasedOnAttached = false; @@ -447,7 +451,7 @@ namespace CalamityMod.Systems int tileTypeToPlaceThickness = 3; bool placeLilies = true; - // Do not change this number, ever. - Fabsol + // Apparently this is a reference! int minDistanceFromOtherLilies = 66; for (int k = x - minDistanceFromOtherLilies; k < x + minDistanceFromOtherLilies; k += 2) diff --git a/Systems/World/WorldgenManagementSystem.cs b/Systems/World/WorldgenManagementSystem.cs index df971eb101..03ccf999ab 100644 --- a/Systems/World/WorldgenManagementSystem.cs +++ b/Systems/World/WorldgenManagementSystem.cs @@ -37,29 +37,53 @@ namespace CalamityMod.Systems public override void ModifyWorldGenTasks(List tasks, ref double totalWeight) { // Better Underworld (similar to Don't Dig Up seed but with some adjustments) - int UnderworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); - tasks[UnderworldIndex] = new PassLegacy("Underworld", (progress, config) => + int underworldIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Underworld")); + if (underworldIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; - CustomUnderworld.NewUnderworld(); - }); + tasks[underworldIndex] = new PassLegacy("Underworld", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterUnderworld").Value; + CustomUnderworld.NewUnderworld(); + }); + } + + // Replace the shimmer gen to make it place sanely + int shimmerIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Shimmer")); + if (shimmerIndex != -1) + { + tasks[shimmerIndex] = new PassLegacy("Shimmer", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterShimmer").Value; + CustomShimmer.NewShimmer(); + }); + } // Better Underworld structures after the world has been smoothed - int UnderworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); - tasks.Insert(UnderworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => + int underworldStructuresIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Smooth World")); + if (underworldStructuresIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; - CustomUnderworld.NewUnderworldStructures(); + tasks.Insert(underworldStructuresIndex + 1, new PassLegacy("Underworld Structures", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldStructures").Value; + CustomUnderworld.NewUnderworldStructures(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value; - CustomUnderworld.NewUnderworldPillars(); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldPillars").Value; + CustomUnderworld.NewUnderworldPillars(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; - CustomUnderworld.AshTreesAndGrass(); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldTreesAndGrass").Value; + CustomUnderworld.AshTreesAndGrass(); - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; - CustomUnderworld.PlaceGeyserTraps(); - })); + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.UnderworldGeyserTraps").Value; + CustomUnderworld.PlaceGeyserTraps(); + })); + + // Generate the Shimmer Shrine directly above the center of the underground Shimmer lake + tasks.Insert(underworldStructuresIndex + 2, new PassLegacy("Shimmer Shrine", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.ShimmerShrine").Value; + ShimmerShrine.PlaceShimmerShrine(GenVars.structures); + })); + } // Evil Floating Island int islandIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Floating Island Houses")); @@ -73,47 +97,59 @@ namespace CalamityMod.Systems } // Generate the Astral Chest right after the dungeon has finished generating - int DungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); - tasks.Insert(DungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) => + int dungeonIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Dungeon")); + if (dungeonIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value; - AstralChestGeneration.PlaceAstralChest(); - })); + tasks.Insert(dungeonIndex + 1, new PassLegacy("Astral Chest", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.AstralChest").Value; + AstralChestGeneration.PlaceAstralChest(); + })); + } // Larger Jungle Temple - int JungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); - tasks[JungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => + int jungleTempleIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Jungle Temple")); + if (jungleTempleIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; - CustomTemple.NewJungleTemple(); - }); + tasks[jungleTempleIndex] = new PassLegacy("Jungle Temple", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; + CustomTemple.NewJungleTemple(); + }); - // Floral Paradise Biome - tasks.Insert(JungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => - { - progress.Message = "Growing a floral paradise underground"; - if (FloralParadiseMinibiome.SHOULD_GENERATE) - FloralParadiseMinibiome.GenerateInstances(); - })); + // Floral Paradise Biome + tasks.Insert(jungleTempleIndex + 1, new PassLegacy("FloralParadise", (progress, config) => + { + progress.Message = "Growing a floral paradise underground"; + if (FloralParadiseMinibiome.SHOULD_GENERATE) + FloralParadiseMinibiome.GenerateInstances(); + })); + } // Improved Golem Arena - int JungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); - tasks[JungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => + int jungleTempleIndex2 = tasks.FindIndex(genpass => genpass.Name.Equals("Temple")); + if (jungleTempleIndex2 != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; - Main.tileSolid[162] = false; - Main.tileSolid[226] = true; - CustomTemple.NewJungleTemplePart2(); - Main.tileSolid[232] = false; - }); + tasks[jungleTempleIndex2] = new PassLegacy("Temple", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BetterJungleTemple").Value; + Main.tileSolid[162] = false; + Main.tileSolid[226] = true; + CustomTemple.NewJungleTemplePart2(); + Main.tileSolid[232] = false; + }); + } // Better Lihzahrd Altar (consistency?) - int LihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); - tasks[LihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => + int lihzahrdAltarIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Lihzahrd Altars")); + if (lihzahrdAltarIndex != -1) { - progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value; - CustomTemple.NewJungleTempleLihzahrdAltar(); - }); + tasks[lihzahrdAltarIndex] = new PassLegacy("Lihzahrd Altars", (progress, config) => + { + progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.JungleTempleAltar").Value; + CustomTemple.NewJungleTempleLihzahrdAltar(); + }); + } // Big Hive int giantHiveIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Hives")); @@ -180,22 +216,14 @@ namespace CalamityMod.Systems } // Sunken Sea - int SunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); - if (SunkenSeaIndex != -1) + int sunkenSeaIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Cactus, Palm Trees, & Coral")); + if (sunkenSeaIndex != -1) { - tasks.Insert(SunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => + tasks.Insert(sunkenSeaIndex + 1, new PassLegacy("Sunken Sea", (progress, config) => { - int sunkenSeaX = (GenVars.UndergroundDesertLocation.Left + GenVars.UndergroundDesertLocation.Right) / 2; int sunkenSeaY = Main.maxTilesY / 2; - SunkenSea.ForLoop = CalamityClientConfig.Instance.SunkenSeaMultiThreading switch - { - 2 => SunkenSea.CSharpParallelFor, - 1 => SunkenSea.ReLogicParallelFor, - _ => SunkenSea.NormalForLoop, - }; - // place each piece of the sunken sea based on the above positons // messages intentionally in the "incorrect" order for the player's experience. @@ -203,6 +231,7 @@ namespace CalamityMod.Systems // it breaks up the 3 minute gen time and makes it more interesting for those who dont tab out while worldgen runs, // rather than keeping the player in the dark about what's happening. // it doesn't have to make sense, just be cool for the players :) -ena + //SunkenSea.PlaceBasaltGullyBorderBlend(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SunkenSea").Value; SunkenSea.PlaceBasaltGully(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.TimelessShores").Value; @@ -212,19 +241,20 @@ namespace CalamityMod.Systems progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.PolypForest").Value; SunkenSea.PlaceGleamingBurrows(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); SunkenSea.PlaceClamDen(sunkenSeaX, sunkenSeaY + 630); + SunkenSea.PlaceGleamingBurrowsGeodes(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4) - 50); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.GleamingBurrows").Value; SunkenSea.PlaceTimelessShores(sunkenSeaX, sunkenSeaY); - SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.BasaltGully").Value; + //SunkenSea.BasaltGullyLavaCleanup(sunkenSeaX, sunkenSeaY + (Main.maxTilesY / 4)); SunkenSea.PlaceSunkenSeaAmbience(); })); } // All further tasks occur right before vanilla worldgen is completed (which includes The Dirtiest Block and final secret seed adjustments) - int FinalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); - if (FinalIndex != -1) + int finalIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Final Cleanup")); + if (finalIndex != -1) { - int currentFinalIndex = FinalIndex - 1; + int currentFinalIndex = finalIndex - 1; // Reallocate gems so rarity corresponds to depth tasks.Insert(++currentFinalIndex, new PassLegacy("Gem Depth Adjustment", (progress, config) => @@ -246,10 +276,10 @@ namespace CalamityMod.Systems tasks.Insert(++currentFinalIndex, new PassLegacy("Planetoids", Planetoid.GenerateAllBasePlanetoids)); // Sulphurous Sea (Step 1) - int SulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); - if (SulphurIndex != -1) + int sulphurIndex = tasks.FindIndex(genpass => genpass.Name.Equals("Micro Biomes")); + if (sulphurIndex != -1) { - tasks.Insert(SulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) => + tasks.Insert(sulphurIndex + 1, new PassLegacy("Sulphur Sea", (progress, config) => { progress.Message = Language.GetOrRegister("Mods.CalamityMod.UI.SulphurSea").Value; @@ -412,9 +442,7 @@ namespace CalamityMod.Systems // Could just not add/remove gen pass, but that could lead to mod conflicts // in case whatever mod targets this specific gen pass. if (!CalamityServerConfig.Instance.EarlyHardmodeProgressionRework) - { hardmodeOreT1Pass.Disable(); - } tasks.Insert(announceIndex, hardmodeOreT1Pass); } @@ -504,20 +532,6 @@ namespace CalamityMod.Systems } } - // Fix vanilla's stupidity with Gold Chests being able to have Meteorite Bars in them near the Underworld - if (isGoldChest) - { - for (int inventoryIndex = 0; inventoryIndex < 40; inventoryIndex++) - { - if (chest.item[inventoryIndex].type == ItemID.MeteoriteBar) - { - int oldStack = chest.item[inventoryIndex].stack; - chest.item[inventoryIndex].SetDefaults(WorldGen.genRand.NextBool() ? ItemID.PlatinumBar : ItemID.GoldBar); - chest.item[inventoryIndex].stack = oldStack; - } - } - } - // Give Dead Man's Chests better loot. if (isDeadManChest) { diff --git a/TileEntities/TECalamityPylon.cs b/TileEntities/TECalamityPylon.cs index 4f9c4fe060..e1b64a6094 100644 --- a/TileEntities/TECalamityPylon.cs +++ b/TileEntities/TECalamityPylon.cs @@ -2,7 +2,7 @@ namespace CalamityMod.TileEntities { - /// Copied from ExampleMod for documentation if needed for later -pixl + /// Copied from ExampleMod for documentation if needed for later /// /// This is an empty child class that acts exactly like the default implementation of the abstract /// class, which itself acts nearly identical to vanilla pylon TEs. This inheritance only exists so that modded pylon entities diff --git a/TileEntities/TECodebreaker.cs b/TileEntities/TECodebreaker.cs index 78fcd95db6..4e1dd4117b 100644 --- a/TileEntities/TECodebreaker.cs +++ b/TileEntities/TECodebreaker.cs @@ -1,7 +1,7 @@ using System.IO; using CalamityMod.CustomRecipes; using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.Packets; using CalamityMod.Systems.Collections; using CalamityMod.Tiles.DraedonSummoner; @@ -65,7 +65,7 @@ namespace CalamityMod.TileEntities public bool ContainsVoltageRegulationSystem; public bool ContainsCoolingCell; - public bool ContainsBloodSample; + public bool ContainsBloodyVein; public bool CanDecryptHeldSchematic { @@ -163,7 +163,7 @@ namespace CalamityMod.TileEntities totalCellsToDrop = 999; InputtedCellCount -= totalCellsToDrop; - int itemType = ContainsBloodSample ? ModContent.ItemType() : ModContent.ItemType(); + int itemType = ContainsBloodyVein ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(new EntitySource_TileEntity(this), x * 16, y * 16, 32, 32, itemType, totalCellsToDrop); } } @@ -270,7 +270,7 @@ namespace CalamityMod.TileEntities tag["HeldSchematicID"] = HeldSchematicID; tag["DecryptionCountdown"] = DecryptionCountdown; tag["InitialCellCountBeforeDecrypting"] = InitialCellCountBeforeDecrypting; - tag["ContainsBloodSample"] = ContainsBloodSample; + tag["ContainsBloodyVein"] = ContainsBloodyVein; } public override void LoadData(TagCompound tag) @@ -284,7 +284,7 @@ namespace CalamityMod.TileEntities HeldSchematicID = tag.GetInt("HeldSchematicID"); DecryptionCountdown = tag.GetInt("DecryptionCountdown"); InitialCellCountBeforeDecrypting = tag.GetInt("InitialCellCountBeforeDecrypting"); - ContainsBloodSample = tag.GetBool("ContainsBloodSample"); + ContainsBloodyVein = tag.GetBool("ContainsBloodyVein"); } public override void NetSend(BinaryWriter writer) @@ -298,7 +298,7 @@ namespace CalamityMod.TileEntities writer.Write(HeldSchematicID); writer.Write(DecryptionCountdown); writer.Write(InitialCellCountBeforeDecrypting); - writer.Write(ContainsBloodSample); + writer.Write(ContainsBloodyVein); } public override void NetReceive(BinaryReader reader) @@ -312,7 +312,7 @@ namespace CalamityMod.TileEntities HeldSchematicID = reader.ReadInt32(); DecryptionCountdown = reader.ReadInt32(); InitialCellCountBeforeDecrypting = reader.ReadInt32(); - ContainsBloodSample = reader.ReadBoolean(); + ContainsBloodyVein = reader.ReadBoolean(); } } } diff --git a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs index 4e4ed2bf49..674de72ad1 100644 --- a/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs +++ b/Tiles/Abyss/AbyssAmbient/PhoviamareHalm.cs @@ -43,17 +43,13 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; - r = 0.55f; - g = 0.24f; - b = 0.08f; - r *= brightness; - g *= brightness; - b *= brightness; + Tile tile = Framing.GetTileSafely(i, j); + if (tile.TileFrameY <= 36) + { + r = 0.55f; + g = 0.24f; + b = 0.08f; + } } } } diff --git a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs index 4aa4856eb8..935afa9232 100644 --- a/Tiles/Abyss/AbyssAmbient/PirateCrate.cs +++ b/Tiles/Abyss/AbyssAmbient/PirateCrate.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient //explode when broken (troll!) //also instakill players in for the worthy Vector2 spawnPosition = new(i * 16f + 24f, j * 16f - 4f); - // NOTE: The damage of ProjectileID.Explosives is reduced in CalamityPlayerHitHurt, this actually deals 52 / 67 / 101 damage. + // NOTE: The damage of ProjectileID.Explosives is reduced in CalamityPlayerHitHurt, this actually deals 105 / 210 / 315 damage. int blastDamage = (Main.getGoodWorld ? 99999 : 150) * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); Projectile.NewProjectile(new EntitySource_WorldEvent(), spawnPosition.X, spawnPosition.Y, 0, 0, ProjectileID.Explosives, blastDamage, 0f); diff --git a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs index c8d77c9451..df8f3f93d2 100644 --- a/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs +++ b/Tiles/Abyss/AbyssAmbient/SulphurTentacleCorals.cs @@ -65,32 +65,15 @@ namespace CalamityMod.Tiles.Abyss.AbyssAmbient Tile tile = Framing.GetTileSafely(i, j); if (tile.TileFrameX <= 324) { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.0025f; - brightness *= (float)MathF.Sin(-j / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; r = 0.26f; g = 0.4f; b = 0.41f; - r *= brightness; - g *= brightness; - b *= brightness; } - if (tile.TileFrameX > 324) { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.0025f; - brightness *= (float)MathF.Sin(-j / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 2f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; r = 0.46f; g = 0.51f; b = 0f; - r *= brightness; - g *= brightness; - b *= brightness; } } } diff --git a/Tiles/Abyss/AbyssCoral.cs b/Tiles/Abyss/AbyssCoral.cs index f077ddbf58..739344659b 100644 --- a/Tiles/Abyss/AbyssCoral.cs +++ b/Tiles/Abyss/AbyssCoral.cs @@ -33,17 +33,9 @@ namespace CalamityMod.Tiles.Abyss { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(52, 84, 107); - Color Color2 = new Color(29, 38, 56); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.17f; + g = 0.28f; + b = 0.36f; } } diff --git a/Tiles/Abyss/AcidWoodTree.cs b/Tiles/Abyss/AcidWoodTree.cs index 59f1194b03..ef235d14ed 100644 --- a/Tiles/Abyss/AcidWoodTree.cs +++ b/Tiles/Abyss/AcidWoodTree.cs @@ -1,8 +1,9 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; -using CalamityMod.Items.Placeables.Abyss; +using CalamityMod.Items.Placeables.FurnitureAcidwood; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.AcidRain; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -54,6 +55,15 @@ namespace CalamityMod.Tiles.Abyss // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -115,7 +125,7 @@ namespace CalamityMod.Tiles.Abyss if (type != -1) Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/Abyss/VoidTorch.cs b/Tiles/Abyss/VoidTorch.cs index d3074ce982..df6d9c0339 100644 --- a/Tiles/Abyss/VoidTorch.cs +++ b/Tiles/Abyss/VoidTorch.cs @@ -7,6 +7,7 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Abyss { + [LegacyName("AbyssTorch")] public class VoidTorch : ModTile { public override void SetStaticDefaults() => this.SetUpTorch(ModContent.ItemType(), true, true); diff --git a/Tiles/Astral/AstralBeacon.cs b/Tiles/Astral/AstralBeacon.cs index 39410d4401..f773a5e22a 100644 --- a/Tiles/Astral/AstralBeacon.cs +++ b/Tiles/Astral/AstralBeacon.cs @@ -20,7 +20,6 @@ namespace CalamityMod.Tiles.Astral { public const int Width = 5; public const int Height = 4; - public static readonly Color FailColor = new Color(237, 93, 83); public static readonly SoundStyle UseSound = new("CalamityMod/Sounds/Custom/AstralBeaconUse"); @@ -70,12 +69,6 @@ namespace CalamityMod.Tiles.Astral bool usingStarcore = Main.LocalPlayer.HasItem(ModContent.ItemType()); - if (Main.IsItDay()) - { - CalamityUtils.DisplayLocalizedText("Mods.CalamityMod.Status.Boss.DeusAltarRejectNightText", FailColor); - return false; - } - Vector2 ritualSpawnPosition = new Vector2(left + Width / 2, top).ToWorldCoordinates(); ritualSpawnPosition += new Vector2(0f, -24f); diff --git a/Tiles/Astral/AstralTree.cs b/Tiles/Astral/AstralTree.cs index 4361cf3493..e0ef7fcfd1 100644 --- a/Tiles/Astral/AstralTree.cs +++ b/Tiles/Astral/AstralTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -59,7 +60,7 @@ namespace CalamityMod.Tiles.Astral //treeFrame = (i + j * j) % 3; } - public override int DropWood() => ModContent.ItemType(); + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); public override int SaplingGrowthType(ref int style) @@ -73,6 +74,15 @@ namespace CalamityMod.Tiles.Astral // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) { @@ -137,7 +147,7 @@ namespace CalamityMod.Tiles.Astral type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/AstralDesert/AstralPalmTree.cs b/Tiles/AstralDesert/AstralPalmTree.cs index 6c0d7fc4fe..085f713984 100644 --- a/Tiles/AstralDesert/AstralPalmTree.cs +++ b/Tiles/AstralDesert/AstralPalmTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using ReLogic.Content; @@ -56,7 +57,7 @@ namespace CalamityMod.Tiles.AstralDesert return Color.White * MathHelper.Lerp(0.05f, 0.75f, brightness); } - public override int DropWood() => ModContent.ItemType(); + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); @@ -71,6 +72,16 @@ namespace CalamityMod.Tiles.AstralDesert // Returning false at the end prevents vanilla behavior as the default is palm tree behavior which can include undesirable stuff like seagulls public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? (WorldGen.genRand.NextBool() ? ItemID.Coconut : ItemID.Banana) + : (WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType()); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -123,12 +134,12 @@ namespace CalamityMod.Tiles.AstralDesert type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.Next(36) < 5) // Vanilla palm fruit logic goes first + else if (Main.rand.NextBool(12)) // Vanilla palm fruit logic goes first { int fruitType = Main.rand.NextBool() ? ItemID.Coconut : ItemID.Banana; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); } - else if (Main.rand.Next(36) < 5) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/AstralSnow/AstralSnowTree.cs b/Tiles/AstralSnow/AstralSnowTree.cs index aaa2519155..1edb32555d 100644 --- a/Tiles/AstralSnow/AstralSnowTree.cs +++ b/Tiles/AstralSnow/AstralSnowTree.cs @@ -3,6 +3,7 @@ using CalamityMod.Dusts; using CalamityMod.Gores.Trees; using CalamityMod.Items.Materials; using CalamityMod.Items.Potions.Food; +using CalamityMod.Items.Tools; using CalamityMod.NPCs.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -59,7 +60,7 @@ namespace CalamityMod.Tiles.AstralSnow //treeFrame = (i + j * j) % 6; } - public override int DropWood() => ModContent.ItemType(); + public override int DropWood() => ModContent.ItemType(); public override int CreateDust() => ModContent.DustType(); @@ -74,6 +75,15 @@ namespace CalamityMod.Tiles.AstralSnow // Returning false at the end prevents vanilla behavior as the default is forest tree behavior which can include undesirable stuff like squirrels and butterflies public override bool Shake(int x, int y, ref bool createLeaves) { + // 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ModContent.ItemType() && WorldGen.genRand.NextBool(3)) + { + int treeDropItemType = WorldGen.genRand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); + Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), x * 16, y * 16, 16, 16, treeDropItemType); + } + int randAmt = Main.rand.Next(1, 3); if (Main.getGoodWorld && Main.rand.NextBool(15)) @@ -137,7 +147,7 @@ namespace CalamityMod.Tiles.AstralSnow type = ItemID.FallenStar; Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, type, randAmt); } - else if (Main.rand.NextBool(3)) + else if (Main.rand.NextBool(12)) { int fruitType = Main.rand.NextBool() ? ModContent.ItemType() : ModContent.ItemType(); Item.NewItem(WorldGen.GetItemSource_FromTreeShake(x, y), new Vector2(x, y) * 16, fruitType); diff --git a/Tiles/CalamityGlobalTile.cs b/Tiles/CalamityGlobalTile.cs index 653abbc334..3874b46669 100644 --- a/Tiles/CalamityGlobalTile.cs +++ b/Tiles/CalamityGlobalTile.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Enums; using CalamityMod.Items.Accessories.Vanity; +using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Tiles.Abyss; @@ -11,6 +12,7 @@ using CalamityMod.Tiles.DraedonStructures; using CalamityMod.Tiles.DraedonSummoner; using CalamityMod.Tiles.Furniture.CraftingStations; using CalamityMod.Tiles.SunkenSea; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -24,7 +26,6 @@ namespace CalamityMod.Tiles { public class CalamityGlobalTile : GlobalTile { - public static List GrowthTiles = new List() { TileType(), @@ -32,7 +33,13 @@ namespace CalamityMod.Tiles TileType(), TileType(), TileType(), + TileType(), + TileType(), + TileType(), + TileType(), + TileType(), TileType(), + TileType(), TileType() }; @@ -48,8 +55,10 @@ namespace CalamityMod.Tiles public override void PreShakeTree(int x, int y, TreeTypes treeType) { - // Add an additional 25% chance to drop vanilla fruits - if (WorldGen.genRand.NextBool(4)) + // All trees have a 33% chance to drop extra fruit when using Feller of Evergreens + Vector2 worldPosition = new Vector2(x, y).ToWorldCoordinates(); + Player nearestPlayer = Main.player[Player.FindClosest(worldPosition, 16, 16)]; + if (nearestPlayer.active && nearestPlayer.ActiveItem().type == ItemType() && WorldGen.genRand.NextBool(3)) { int treeDropItemType = 0; switch (treeType) @@ -165,7 +174,7 @@ namespace CalamityMod.Tiles return; Tile t = Main.tile[xPos, yPos]; - if (t.HasTile && (t.TileType == TileType() || t.TileType == TileType())) + if (t.HasTile && (t.TileType == TileType() || t.TileType == TileType() || t.TileType == TileType())) { WorldGen.KillTile(xPos, yPos, false, false, false); if (!Main.tile[xPos, yPos].HasTile && Main.netMode != NetmodeID.SinglePlayer) @@ -174,7 +183,7 @@ namespace CalamityMod.Tiles } // Check if crystals should be shattered, do not shatter crystals next to other crystals if a crystal is shattered. - if (Main.tileSolid[tile.TileType] && tile.TileType != TileType() && tile.TileType != TileType()) + if (Main.tileSolid[tile.TileType] && tile.TileType != TileType() && tile.TileType != TileType() && tile.TileType != TileType()) { bool dontShatter = fail || effectOnly; CheckShatterCrystal(i + 1, j, dontShatter); @@ -303,7 +312,7 @@ namespace CalamityMod.Tiles // Drop Evil Smasher on every 12 alter smashed if (WorldGen.altarCount > 1 && WorldGen.altarCount % 12 == 0) - DropItem(i, j, ItemType(), quantity: 1, asStack: true); + DropItem(i, j, ItemType(), quantity: 1, asStack: true, prefix: true); } // Drop Golden Bombs at a 0.33% chance from Pots @@ -354,7 +363,7 @@ namespace CalamityMod.Tiles } } - private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default) + private static void DropItem(int i, int j, int itemType, int quantity, bool asStack, Vector2 spreadMinMax = default, bool prefix = false) { // Multiplayer Client should not spawn item themselves if (Main.netMode == NetmodeID.MultiplayerClient) @@ -364,14 +373,14 @@ namespace CalamityMod.Tiles if (asStack) { Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); - Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: quantity, prefixGiven: prefix ? -1 : 0); } else { for (int k = 0; k < quantity; k += 1) { Vector2 spawnOffset = Main.rand.NextVector2Unit(spreadMinMax.X, spreadMinMax.Y); - Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1); + Item.NewItem(new EntitySource_TileBreak(i, j), worldPos + spawnOffset, itemType, Stack: 1, prefixGiven: prefix ? -1 : 0); } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs index bf857ae736..c2a908ef42 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedBiolight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; @@ -83,10 +84,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i * 16, j * 16), 9f / 255f * brightness, 195f / 255f * brightness, 0f * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs index 3da6bb123f..0aafeea281 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedBlacklight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; @@ -82,10 +83,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i * 16, j * 16), 182f / 255f * brightness, 28f / 255f * brightness, 232f / 255f * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs index 68899755d7..83a7fd5560 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedCinderlight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; @@ -83,10 +84,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i, j), 252f / 255f * brightness, 184f / 255f * brightness, 29f / 255f * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs index 823fa54776..0d70137c2b 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFlamelight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; @@ -83,10 +84,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i * 16, j * 16), (255f / 255f) * brightness, (104f / 255f) * brightness, (104f / 255f) * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs index 557f857324..dbc8e13c6b 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFloodlight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; @@ -83,10 +84,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i * 16, j * 16), 105f / 255f * brightness, 195f / 255f * brightness, 193f / 255f * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs index 076122c0d9..c553f25054 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedFrostlight.cs @@ -26,6 +26,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; @@ -83,10 +84,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Lighting.AddLight(new Vector2(i * 16, j * 16), 9f / 255f * brightness, 158f / 255f * brightness, 238f / 255f * brightness); } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/AgedLablight.cs b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs index 8c154b9031..72248f3566 100644 --- a/Tiles/DraedonStructures/CagedLights/AgedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/AgedLablight.cs @@ -22,6 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; @@ -79,11 +80,6 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 255f / 510f; } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i, j].IsTileActuallyInvisible()) diff --git a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs index 76f5061edd..2bfbf801fa 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBiolight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 89; @@ -91,9 +92,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs index 702af106f2..88623b86cc 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedBlacklight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 173; @@ -90,10 +91,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs index 7514c37cf2..99622541fb 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedCinderlight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 6; @@ -92,9 +93,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights } } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs index f330d1371d..43dc265ece 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFlamelight.cs @@ -10,6 +10,7 @@ using Terraria.Enums; using Terraria.ObjectData; using Terraria.Audio; using CalamityMod.Sounds; +using CalamityMod.Items.Pets; namespace CalamityMod.Tiles.DraedonStructures.CagedLights { @@ -21,6 +22,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 60; @@ -91,10 +93,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs index 59539ee4f6..764e51188e 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFloodlight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 187; @@ -91,10 +92,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs index 1102fa25b9..635df1e7d4 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedFrostlight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 247; @@ -91,10 +92,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs index 6997a227ba..1e8729a673 100644 --- a/Tiles/DraedonStructures/CagedLights/CagedLablight.cs +++ b/Tiles/DraedonStructures/CagedLights/CagedLablight.cs @@ -21,6 +21,7 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights Main.tileNoFail[Type] = true; Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = false; + RegisterItemDrop(ModContent.ItemType()); HitSound = CommonCalamitySounds.PlatingMine; DustType = 299; @@ -91,9 +92,5 @@ namespace CalamityMod.Tiles.DraedonStructures.CagedLights b = 0f; } } - public override void KillMultiTile(int i, int j, int frameX, int frameY) - { - Item.NewItem(new EntitySource_TileBreak(i, j), i * 16, j * 16, 32, 48, ModContent.ItemType()); - } } } diff --git a/Tiles/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index ae874cba1a..9475eadbcd 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class BlueCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/CirrusCouch.png b/Tiles/Furniture/CirrusCouch.png deleted file mode 100644 index 1bca32a64a..0000000000 Binary files a/Tiles/Furniture/CirrusCouch.png and /dev/null differ diff --git a/Tiles/Furniture/CirrusCouch_Highlight.png b/Tiles/Furniture/CirrusCouch_Highlight.png deleted file mode 100644 index 37368baef2..0000000000 Binary files a/Tiles/Furniture/CirrusCouch_Highlight.png and /dev/null differ diff --git a/Tiles/Furniture/CraftingStations/SCalAltar.cs b/Tiles/Furniture/CraftingStations/SCalAltar.cs index aa81603cc5..26c5741cca 100644 --- a/Tiles/Furniture/CraftingStations/SCalAltar.cs +++ b/Tiles/Furniture/CraftingStations/SCalAltar.cs @@ -1,6 +1,7 @@ using CalamityMod.Events; using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables.Furniture.CraftingStations; +using CalamityMod.Items.Potions; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Items.SummonItems; using CalamityMod.NPCs.SupremeCalamitas; @@ -79,9 +80,9 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public static void HoverItemIcon(int i, int j) { - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (vodka) - Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); + Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); else if (Main.LocalPlayer.HasItem(ModContent.ItemType())) Main.LocalPlayer.cursorItemIconID = ModContent.ItemType(); else @@ -108,12 +109,12 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public static bool AttemptToSummonSCal(int i, int j) { if (!Main.LocalPlayer.HasItem(ModContent.ItemType()) && - !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) + !Main.LocalPlayer.HasItem(ModContent.ItemType()) && !(Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld)) { return true; } - bool vodka = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; + bool meat = Main.LocalPlayer.HeldItem.type == ModContent.ItemType() && Main.zenithWorld; if (NPC.AnyNPCs(ModContent.NPCType()) || BossRushEvent.BossRushActive) return true; @@ -130,14 +131,14 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations ritualSpawnPosition += new Vector2(0f, -24f); SoundEngine.PlaySound(SummonSound, ritualSpawnPosition); - Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, vodka.ToInt()); + Projectile.NewProjectile(new EntitySource_WorldEvent(), ritualSpawnPosition, Vector2.Zero, ModContent.ProjectileType(), 0, 0f, Main.myPlayer, 0, meat.ToInt()); - if (vodka) + if (meat) { - Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); + Main.LocalPlayer.ConsumeItem(ModContent.ItemType(), true); foreach (NPC n in Main.ActiveNPCs) { - if (n.type == ModContent.NPCType()) + if (n.type == ModContent.NPCType()) n.active = false; } } diff --git a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png index 434b490237..d1706759fe 100644 Binary files a/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png and b/Tiles/Furniture/DevPaintings/ThankYouPaintingTile.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs new file mode 100644 index 0000000000..c5b88b3613 --- /dev/null +++ b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.cs @@ -0,0 +1,72 @@ +using CalamityMod.Buffs.Potions; +using CalamityMod.Dusts; +using CalamityMod.ForegroundDrawing.LoopingTextures; +using CalamityMod.Items.Dyes; +using CalamityMod.Items.Placeables.Furniture.Monoliths; +using CalamityMod.NPCs.Yharon; +using CalamityMod.Tiles.BaseTiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.Furniture.Monoliths +{ + public class OldDukeMonolithTile : BaseMonolith + { + public override int TileWidth => 4; + public override int TileHeight => 8; + public override int AnimationFrameCount => 24; + public override int AnimationDelay => 6; + public override int CursorItemType => ModContent.ItemType(); + + public static Asset Numbers; + public override void SetStaticDefaults() + { + if (!Main.dedServ) + { + GlowMask = ModContent.Request($"{Texture}_Glow"); + //Numbers = ModContent.Request("CalamityMod/Tiles/Furniture/Monoliths/ExoObeliskText", AssetRequestMode.AsyncLoad); + } + + RegisterItemDrop(CursorItemType); + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + TileObjectData.newTile.Width = 4; + TileObjectData.newTile.Height = 8; + Main.tileFrameImportant[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + TileObjectData.newTile.Origin = new Point16(1, 4); + TileObjectData.newTile.LavaDeath = false; + TileObjectData.newTile.UsesCustomCanPlace = true; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop, 3, 0); + + AnimationFrameHeight = 8 * 18; + TileObjectData.newTile.CoordinateHeights = [16, 16, 16, 16, 16, 16, 16, 16]; + TileObjectData.addTile(Type); + + AddMapEntry(new Color(54, 54, 54)); + + DustType = DustID.TerraBlade; + } + + public override void NearbyEffects(int i, int j, bool closer, bool monolithEnabled, Player localPlayer) + { + if (!monolithEnabled) + return; + + if (localPlayer is not null && localPlayer.active) + { + localPlayer.GetModPlayer().ShouldDisplayTorrentMonolith = true; + } + } + } +} diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png new file mode 100644 index 0000000000..83f5ef659a Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png new file mode 100644 index 0000000000..790669b2bf Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Glow.png differ diff --git a/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png new file mode 100644 index 0000000000..f1dd43be8f Binary files /dev/null and b/Tiles/Furniture/Monoliths/OldDukeMonolithTile_Highlight.png differ diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index 3ffb8dbfab..f2b8f483c8 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class PinkCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index 31d1864cf7..dd2a5e9886 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class PurpleCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -36,13 +36,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index 177df09292..d9780550bc 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Tiles.Furniture { public class YellowCandle : ModTile { - // TODO -- Unique sounds for each Cirrus Candle. + // TODO -- Unique sounds for each Candle. public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); public override void SetStaticDefaults() @@ -35,13 +35,13 @@ namespace CalamityMod.Tiles.Furniture Player p = Main.LocalPlayer; // Forcibly remove all candle buffs. - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); - p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); // 108000 is the duration used by Ammo Box. - p.AddBuff(ModContent.BuffType(), 108000); + p.AddBuff(ModContent.BuffType(), 108000); // Play a sound. SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); diff --git a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs index 4cad230406..2cc4005b2a 100644 --- a/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodLanternTile.cs @@ -2,8 +2,10 @@ using CalamityMod.Items.Placeables.FurnitureAcidwood; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -11,6 +13,10 @@ namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodLanternTile : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -46,9 +52,19 @@ namespace CalamityMod.Tiles.FurnitureAcidwood CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAcidwood/AcidwoodLanternTileFlame").Value, i, j, 0, -8); + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(64, 128, 102, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/Abyss/AcidwoodTile.cs b/Tiles/FurnitureAcidwood/AcidwoodTile.cs similarity index 96% rename from Tiles/Abyss/AcidwoodTile.cs rename to Tiles/FurnitureAcidwood/AcidwoodTile.cs index eb33744e0a..03b7e8c4f7 100644 --- a/Tiles/Abyss/AcidwoodTile.cs +++ b/Tiles/FurnitureAcidwood/AcidwoodTile.cs @@ -5,7 +5,7 @@ using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.Abyss +namespace CalamityMod.Tiles.FurnitureAcidwood { public class AcidwoodTile : ModTile { diff --git a/Tiles/Abyss/AcidwoodTile.png b/Tiles/FurnitureAcidwood/AcidwoodTile.png similarity index 100% rename from Tiles/Abyss/AcidwoodTile.png rename to Tiles/FurnitureAcidwood/AcidwoodTile.png diff --git a/Tiles/Furniture/CraftingStations/AncientAltar.cs b/Tiles/FurnitureAncient/AncientAltar.cs similarity index 89% rename from Tiles/Furniture/CraftingStations/AncientAltar.cs rename to Tiles/FurnitureAncient/AncientAltar.cs index fb2008520f..99eb9e3e74 100644 --- a/Tiles/Furniture/CraftingStations/AncientAltar.cs +++ b/Tiles/FurnitureAncient/AncientAltar.cs @@ -7,7 +7,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureAncient { public class AncientAltar : ModTile { @@ -21,7 +21,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.newTile.LavaDeath = false; TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); AnimationFrameHeight = 54; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } @@ -58,7 +58,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { - CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/AncientAltarFlame").Value, i, j, offsetY: animationFrame * AnimationFrameHeight); + CalamityUtils.DrawStaticFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientAltarFlame").Value, i, j, offsetY: animationFrame * AnimationFrameHeight); } public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) diff --git a/Tiles/Furniture/CraftingStations/AncientAltar.png b/Tiles/FurnitureAncient/AncientAltar.png similarity index 100% rename from Tiles/Furniture/CraftingStations/AncientAltar.png rename to Tiles/FurnitureAncient/AncientAltar.png diff --git a/Tiles/Furniture/CraftingStations/AncientAltarFlame.png b/Tiles/FurnitureAncient/AncientAltarFlame.png similarity index 100% rename from Tiles/Furniture/CraftingStations/AncientAltarFlame.png rename to Tiles/FurnitureAncient/AncientAltarFlame.png diff --git a/Tiles/FurnitureAncient/AncientLantern.cs b/Tiles/FurnitureAncient/AncientLantern.cs index 00ac4b6fd0..a570d64da5 100644 --- a/Tiles/FurnitureAncient/AncientLantern.cs +++ b/Tiles/FurnitureAncient/AncientLantern.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Tiles.FurnitureAncient { public class AncientLantern : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -40,9 +46,19 @@ namespace CalamityMod.Tiles.FurnitureAncient } } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAncient/AncientLanternFlame").Value, i, j); + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(128, 64, 64, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0f; } public override void HitWire(int i, int j) diff --git a/Tiles/FurnitureAshen/AshenChandelier.cs b/Tiles/FurnitureAshen/AshenChandelier.cs index 65bb0575ff..51b0668275 100644 --- a/Tiles/FurnitureAshen/AshenChandelier.cs +++ b/Tiles/FurnitureAshen/AshenChandelier.cs @@ -75,7 +75,7 @@ namespace CalamityMod.Tiles.FurnitureAshen tileFlameData.flameRangeXMax = 11; tileFlameData.flameRangeYMin = -10; tileFlameData.flameRangeYMax = 11; - tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultX = 0.05f; tileFlameData.flameRangeMultY = 0f; } diff --git a/Tiles/FurnitureAshen/AshenLantern.cs b/Tiles/FurnitureAshen/AshenLantern.cs index ec7f983270..e671750d60 100644 --- a/Tiles/FurnitureAshen/AshenLantern.cs +++ b/Tiles/FurnitureAshen/AshenLantern.cs @@ -1,7 +1,9 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Tiles.FurnitureAshen { public class AshenLantern : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -40,16 +46,26 @@ namespace CalamityMod.Tiles.FurnitureAshen } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(128, 64, 64, 0); + tileFlameData.flameCount = 2; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0f; + tileFlameData.flameRangeMultY = 0f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureAshen/AshenLanternFlame").Value, i, j); - } - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { Tile tile = Main.tile[i, j]; diff --git a/Tiles/FurnitureBasalt/BasaltSlab.cs b/Tiles/FurnitureBasalt/BasaltSlab.cs new file mode 100644 index 0000000000..c1056c95cb --- /dev/null +++ b/Tiles/FurnitureBasalt/BasaltSlab.cs @@ -0,0 +1,57 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles.SunkenSea; + +namespace CalamityMod.Tiles.FurnitureBasalt +{ + public class BasaltSlab : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + TileID.Sets.HasSlopeFrames[Type] = true; + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileShine2[Type] = true; + Main.tileBlendAll[Type] = true; + + Main.tileLargeFrames[Type] = 1; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + DustType = DustID.Ash; + HitSound = SoundID.Tink; + + AddMapEntry(new Color(58, 55, 70)); + + MinPick = 110; + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 1, 0f, 0f, 1, new Color(100, 100, 100), 1f); + return false; + } + + } +} diff --git a/Tiles/FurnitureBasalt/BasaltSlab.png b/Tiles/FurnitureBasalt/BasaltSlab.png new file mode 100644 index 0000000000..a81c872726 Binary files /dev/null and b/Tiles/FurnitureBasalt/BasaltSlab.png differ diff --git a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs b/Tiles/FurnitureBotanic/BotanicPlanter.cs similarity index 93% rename from Tiles/Furniture/CraftingStations/BotanicPlanter.cs rename to Tiles/FurnitureBotanic/BotanicPlanter.cs index 1d620f9c18..f1ab9e9ee2 100644 --- a/Tiles/Furniture/CraftingStations/BotanicPlanter.cs +++ b/Tiles/FurnitureBotanic/BotanicPlanter.cs @@ -7,7 +7,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureBotanic { public class BotanicPlanter : ModTile { @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.StyleLineSkip = 2; TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); AnimationFrameHeight = 54; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } diff --git a/Tiles/Furniture/CraftingStations/BotanicPlanter.png b/Tiles/FurnitureBotanic/BotanicPlanter.png similarity index 100% rename from Tiles/Furniture/CraftingStations/BotanicPlanter.png rename to Tiles/FurnitureBotanic/BotanicPlanter.png diff --git a/Tiles/SunkenSea/Driftwood.cs b/Tiles/FurnitureDriftwood/Driftwood.cs similarity index 91% rename from Tiles/SunkenSea/Driftwood.cs rename to Tiles/FurnitureDriftwood/Driftwood.cs index 2912e3a13a..131b45406e 100644 --- a/Tiles/SunkenSea/Driftwood.cs +++ b/Tiles/FurnitureDriftwood/Driftwood.cs @@ -5,7 +5,7 @@ using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.FurnitureDriftwood { public class Driftwood : ModTile { @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea AddMapEntry(new Color(136, 129, 154)); // 02JUN2024: Ozzatron: Dunesand has no merge - // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); + //TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out tileAdjacency); // 02JUN2024: Ozzatron: Shellstone has no merge tile sheet defined // TileFraming.SetUpUniversalMerge(Type, ModContent.TileType(), out secondTileAdjacency); diff --git a/Tiles/SunkenSea/Driftwood.png b/Tiles/FurnitureDriftwood/Driftwood.png similarity index 100% rename from Tiles/SunkenSea/Driftwood.png rename to Tiles/FurnitureDriftwood/Driftwood.png diff --git a/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.cs b/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.cs new file mode 100644 index 0000000000..d2474ec746 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.cs @@ -0,0 +1,36 @@ +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodBaroqueCello : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This Cello has bookcase dimensions + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetText("Tiles.BaroqueCello")); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.png b/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.png new file mode 100644 index 0000000000..d8de02541c Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodBaroqueCello.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodBathtub.cs b/Tiles/FurnitureDriftwood/DriftwoodBathtub.cs new file mode 100644 index 0000000000..e4119a2b31 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodBathtub.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodBathtub : ModTile + { + public override void SetStaticDefaults() => this.SetUpBathtub(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodBathtub.png b/Tiles/FurnitureDriftwood/DriftwoodBathtub.png new file mode 100644 index 0000000000..f38650ae70 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodBathtub.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodBed.cs b/Tiles/FurnitureDriftwood/DriftwoodBed.cs new file mode 100644 index 0000000000..ffe489ed40 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodBed.cs @@ -0,0 +1,30 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodBed : ModTile + { + public override void SetStaticDefaults() => this.SetUpBed(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodBed.png b/Tiles/FurnitureDriftwood/DriftwoodBed.png new file mode 100644 index 0000000000..c4e1380f12 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodBed.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodBed_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodBed_Highlight.png new file mode 100644 index 0000000000..5974b70765 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodBed_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodBookcase.cs b/Tiles/FurnitureDriftwood/DriftwoodBookcase.cs new file mode 100644 index 0000000000..69d45e8b87 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodBookcase.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodBookcase : ModTile + { + public override void SetStaticDefaults() => this.SetUpBookcase(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodBookcase.png b/Tiles/FurnitureDriftwood/DriftwoodBookcase.png new file mode 100644 index 0000000000..8bd062dc7e Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodBookcase.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs new file mode 100644 index 0000000000..8bad131ba0 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodCandelabra : ModTile + { + public override void SetStaticDefaults() => this.SetUpCandelabra(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 89f / 155f; + g = 98f / 155f; + b = 106f / 155f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandelabra.png b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.png new file mode 100644 index 0000000000..a80821e5a7 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodCandelabra.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandle.cs b/Tiles/FurnitureDriftwood/DriftwoodCandle.cs new file mode 100644 index 0000000000..4d42b720bc --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodCandle.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodCandle : ModTile + { + public override void SetStaticDefaults() => this.SetUpCandle(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 89f / 155f; + g = 98f / 155f; + b = 106f / 155f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, 1, j, 1, 1); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodCandle.png b/Tiles/FurnitureDriftwood/DriftwoodCandle.png new file mode 100644 index 0000000000..a89e4a3b12 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodCandle.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodChair.cs b/Tiles/FurnitureDriftwood/DriftwoodChair.cs new file mode 100644 index 0000000000..de72102d2f --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodChair.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodChair : ModTile + { + public override void SetStaticDefaults() => this.SetUpChair(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodChair.png b/Tiles/FurnitureDriftwood/DriftwoodChair.png new file mode 100644 index 0000000000..f540f21d51 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodChair.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodChair_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodChair_Highlight.png new file mode 100644 index 0000000000..6c8693094f Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodChair_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs b/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs new file mode 100644 index 0000000000..e520931848 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodChandelier.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodChandelier : ModTile + { + public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 89f / 155f; + g = 98f / 155f; + b = 106f / 155f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodChandelier.png b/Tiles/FurnitureDriftwood/DriftwoodChandelier.png new file mode 100644 index 0000000000..2f7510c14d Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodChandelier.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodChest.cs b/Tiles/FurnitureDriftwood/DriftwoodChest.cs new file mode 100644 index 0000000000..2672cb6c9e --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodChest.cs @@ -0,0 +1,32 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodChest : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChest(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodChest.png b/Tiles/FurnitureDriftwood/DriftwoodChest.png new file mode 100644 index 0000000000..63df766217 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodChest.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodChest_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodChest_Highlight.png new file mode 100644 index 0000000000..61e5b0044f Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodChest_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.cs b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.cs new file mode 100644 index 0000000000..ef8946da38 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodDoorClosed : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorClosed(ModContent.ItemType(), true); + TileID.Sets.OpenDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.png b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.png new file mode 100644 index 0000000000..5884fc811f Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorClosed_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed_Highlight.png new file mode 100644 index 0000000000..c923098653 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.cs b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.cs new file mode 100644 index 0000000000..b0561247ab --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodDoorOpen : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorOpen(ModContent.ItemType(), true); + TileID.Sets.CloseDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.png b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.png new file mode 100644 index 0000000000..c57116c347 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDoorOpen_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen_Highlight.png new file mode 100644 index 0000000000..8121934574 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDresser.cs b/Tiles/FurnitureDriftwood/DriftwoodDresser.cs new file mode 100644 index 0000000000..2c0d90f00d --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodDresser.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodDresser : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDresser(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Blue, 0f, 0f, 1, new Color(255, 255, 255), 1f); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Firework_Pink, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodDresser.png b/Tiles/FurnitureDriftwood/DriftwoodDresser.png new file mode 100644 index 0000000000..b942c92ed3 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDresser.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodDresser_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodDresser_Highlight.png new file mode 100644 index 0000000000..726973d772 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodDresser_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodLamp.cs b/Tiles/FurnitureDriftwood/DriftwoodLamp.cs new file mode 100644 index 0000000000..dcc3a7131d --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodLamp.cs @@ -0,0 +1,44 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodLamp : ModTile + { + public override void SetStaticDefaults() => this.SetUpLamp(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 89f / 155f; + g = 98f / 155f; + b = 106f / 155f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodLamp.png b/Tiles/FurnitureDriftwood/DriftwoodLamp.png new file mode 100644 index 0000000000..2669926efb Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodLamp.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodLantern.cs b/Tiles/FurnitureDriftwood/DriftwoodLantern.cs new file mode 100644 index 0000000000..f56e3c9a62 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodLantern.cs @@ -0,0 +1,46 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodLantern : ModTile + { + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 89f / 155f; + g = 98f / 155f; + b = 106f / 155f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 2); + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodLantern.png b/Tiles/FurnitureDriftwood/DriftwoodLantern.png new file mode 100644 index 0000000000..fb3e61ddc8 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodLantern.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodPlatform.cs b/Tiles/FurnitureDriftwood/DriftwoodPlatform.cs new file mode 100644 index 0000000000..2ea14a89b7 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodPlatform.cs @@ -0,0 +1,28 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodPlatform : ModTile + { + public override void SetStaticDefaults() => this.SetUpPlatform(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodPlatform.png b/Tiles/FurnitureDriftwood/DriftwoodPlatform.png new file mode 100644 index 0000000000..339f2394e9 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodPlatform.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodSink.cs b/Tiles/FurnitureDriftwood/DriftwoodSink.cs new file mode 100644 index 0000000000..abfdaf46f1 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodSink.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodSink : ModTile + { + public override void SetStaticDefaults() => this.SetUpSink(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodSink.png b/Tiles/FurnitureDriftwood/DriftwoodSink.png new file mode 100644 index 0000000000..ba278cfee0 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodSink.png differ diff --git a/Tiles/Furniture/CirrusCouch.cs b/Tiles/FurnitureDriftwood/DriftwoodSofa.cs similarity index 78% rename from Tiles/Furniture/CirrusCouch.cs rename to Tiles/FurnitureDriftwood/DriftwoodSofa.cs index 29551f8bb3..da22040621 100644 --- a/Tiles/Furniture/CirrusCouch.cs +++ b/Tiles/FurnitureDriftwood/DriftwoodSofa.cs @@ -6,15 +6,15 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.Furniture +namespace CalamityMod.Tiles.FurnitureDriftwood { - public class CirrusCouch : ModTile + public class DriftwoodSofa : ModTile { - public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); public override bool CreateDust(int i, int j, ref int type) { - Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.PinkFairy); + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); return false; } @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.Furniture public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureDriftwood/DriftwoodSofa.png b/Tiles/FurnitureDriftwood/DriftwoodSofa.png new file mode 100644 index 0000000000..d9043d2231 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodSofa.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodSofa_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodSofa_Highlight.png new file mode 100644 index 0000000000..8b6a408e46 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodSofa_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodSundial.cs b/Tiles/FurnitureDriftwood/DriftwoodSundial.cs new file mode 100644 index 0000000000..2dacba82d0 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodSundial.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodSundial : ModTile + { + public override void SetStaticDefaults() => this.SetUpClock(ModContent.ItemType(), true); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool RightClick(int x, int y) + { + return CalamityUtils.ClockRightClick(); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.SceneMetrics.HasClock = true; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodSundial.png b/Tiles/FurnitureDriftwood/DriftwoodSundial.png new file mode 100644 index 0000000000..5601159701 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodSundial.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodSundial_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodSundial_Highlight.png new file mode 100644 index 0000000000..6c3469902b Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodSundial_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodTable.cs b/Tiles/FurnitureDriftwood/DriftwoodTable.cs new file mode 100644 index 0000000000..3a233fa6e2 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodTable.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodTable : ModTile + { + public override void SetStaticDefaults() => this.SetUpTable(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodTable.png b/Tiles/FurnitureDriftwood/DriftwoodTable.png new file mode 100644 index 0000000000..24259b2899 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodTable.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodToilet.cs b/Tiles/FurnitureDriftwood/DriftwoodToilet.cs new file mode 100644 index 0000000000..d92e67baee --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodToilet.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodToilet : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + // Toilets count as Chairs + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Toilet")); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Granite, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) // I hate this please make it stop. - Merkalto + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - tile.TileFrameY / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodToilet.png b/Tiles/FurnitureDriftwood/DriftwoodToilet.png new file mode 100644 index 0000000000..cb478a2214 Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodToilet.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodToilet_Highlight.png b/Tiles/FurnitureDriftwood/DriftwoodToilet_Highlight.png new file mode 100644 index 0000000000..784cd7f73c Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodToilet_Highlight.png differ diff --git a/Tiles/FurnitureDriftwood/DriftwoodWorkBench.cs b/Tiles/FurnitureDriftwood/DriftwoodWorkBench.cs new file mode 100644 index 0000000000..eec1af1d56 --- /dev/null +++ b/Tiles/FurnitureDriftwood/DriftwoodWorkBench.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureDriftwood +{ + public class DriftwoodWorkBench : ModTile + { + public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, 235, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureDriftwood/DriftwoodWorkBench.png b/Tiles/FurnitureDriftwood/DriftwoodWorkBench.png new file mode 100644 index 0000000000..47a279ce7b Binary files /dev/null and b/Tiles/FurnitureDriftwood/DriftwoodWorkBench.png differ diff --git a/Tiles/FurnitureExo/ExoLanternTile.cs b/Tiles/FurnitureExo/ExoLanternTile.cs index 30c1883ff0..8946144fcf 100644 --- a/Tiles/FurnitureExo/ExoLanternTile.cs +++ b/Tiles/FurnitureExo/ExoLanternTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.FurnitureExo; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Tiles.FurnitureExo { public class ExoLanternTile : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -41,14 +47,24 @@ namespace CalamityMod.Tiles.FurnitureExo } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(102, 115, 128, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureExo/ExoLanternTileFlame").Value, i, j); - } } } diff --git a/Tiles/Astral/AstralMonolith.cs b/Tiles/FurnitureMonolith/AstralMonolith.cs similarity index 98% rename from Tiles/Astral/AstralMonolith.cs rename to Tiles/FurnitureMonolith/AstralMonolith.cs index 5dd4bb0a03..b6d82a7aec 100644 --- a/Tiles/Astral/AstralMonolith.cs +++ b/Tiles/FurnitureMonolith/AstralMonolith.cs @@ -8,8 +8,9 @@ using Terraria; using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; +using CalamityMod.Tiles.Astral; -namespace CalamityMod.Tiles.Astral +namespace CalamityMod.Tiles.FurnitureMonolith { public class AstralMonolith : ModTile { diff --git a/Tiles/Astral/AstralMonolith.png b/Tiles/FurnitureMonolith/AstralMonolith.png similarity index 100% rename from Tiles/Astral/AstralMonolith.png rename to Tiles/FurnitureMonolith/AstralMonolith.png diff --git a/Tiles/Astral/AstralMonolithGlow.png b/Tiles/FurnitureMonolith/AstralMonolithGlow.png similarity index 100% rename from Tiles/Astral/AstralMonolithGlow.png rename to Tiles/FurnitureMonolith/AstralMonolithGlow.png diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs b/Tiles/FurnitureMonolith/MonolithAmalgam.cs similarity index 85% rename from Tiles/Furniture/CraftingStations/MonolithAmalgam.cs rename to Tiles/FurnitureMonolith/MonolithAmalgam.cs index 8d19243ab9..7f1ef8c29d 100644 --- a/Tiles/Furniture/CraftingStations/MonolithAmalgam.cs +++ b/Tiles/FurnitureMonolith/MonolithAmalgam.cs @@ -4,15 +4,15 @@ using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureMonolith { [LegacyName("MonolithCrafting")] public class MonolithAmalgam : ModTile { public override void SetStaticDefaults() { - this.SetUpBookcase(ModContent.ItemType(), true, false, false); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + this.SetUpBookcase(ModContent.ItemType(), true, false, false); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); } public override bool CreateDust(int i, int j, ref int type) @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow").Value; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithAmalgamGlow").Value; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgam.png b/Tiles/FurnitureMonolith/MonolithAmalgam.png similarity index 100% rename from Tiles/Furniture/CraftingStations/MonolithAmalgam.png rename to Tiles/FurnitureMonolith/MonolithAmalgam.png diff --git a/Tiles/Furniture/CraftingStations/MonolithAmalgamGlow.png b/Tiles/FurnitureMonolith/MonolithAmalgamGlow.png similarity index 100% rename from Tiles/Furniture/CraftingStations/MonolithAmalgamGlow.png rename to Tiles/FurnitureMonolith/MonolithAmalgamGlow.png diff --git a/Tiles/FurnitureMonolith/MonolithLantern.cs b/Tiles/FurnitureMonolith/MonolithLantern.cs index c5a2cc2c2e..ab9b0e5a45 100644 --- a/Tiles/FurnitureMonolith/MonolithLantern.cs +++ b/Tiles/FurnitureMonolith/MonolithLantern.cs @@ -1,13 +1,24 @@ using CalamityMod.Dusts; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent.Drawing; using Terraria.ModLoader; namespace CalamityMod.Tiles.FurnitureMonolith { public class MonolithLantern : ModTile { + public Asset FlameTexture; + public Asset GlowTexture; + + public override void Load() + { + FlameTexture = ModContent.Request(Texture + "Flame"); + GlowTexture = ModContent.Request(Texture + "Glow"); + } + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -22,22 +33,7 @@ namespace CalamityMod.Tiles.FurnitureMonolith num = fail ? 1 : 3; } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - if (Main.tile[i, j].IsTileActuallyInvisible()) - return; - - int xPos = Main.tile[i, j].TileFrameX; - int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLanternGlow").Value; - Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); - Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); - Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; - Main.spriteBatch.Draw(glowmask, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - - Texture2D glowmaskBright = ModContent.Request("CalamityMod/Tiles/FurnitureMonolith/MonolithLanternFlame").Value; - Main.spriteBatch.Draw(glowmaskBright, drawOffset, new Rectangle?(new Rectangle(xPos, yPos, 18, 18)), Color.White, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); - } + public override void AdjustMultiTileVineParameters(int i, int j, ref float? overrideWindCycle, ref float windPushPowerX, ref float windPushPowerY, ref bool dontRotateTopTiles, ref float totalWindMultiplier, ref Texture2D glowTexture, ref Color glowColor) => glowTexture = GlowTexture.Value; public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { @@ -55,6 +51,21 @@ namespace CalamityMod.Tiles.FurnitureMonolith } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(102, 115, 128, 0); + tileFlameData.flameCount = 1; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0f; + tileFlameData.flameRangeMultY = 0f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs new file mode 100644 index 0000000000..7fa416acca --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBathtub")] + public class AncientNavystoneBathtub : ModTile + { + public override void SetStaticDefaults() => this.SetUpBathtub(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBathtub.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBathtub.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs new file mode 100644 index 0000000000..a8d3e2b403 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.cs @@ -0,0 +1,31 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBed")] + public class AncientNavystoneBed : ModTile + { + public override void SetStaticDefaults() => this.SetUpBed(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBed.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed.png diff --git a/Tiles/FurnitureEutrophic/EutrophicBed_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBed_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBed_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs new file mode 100644 index 0000000000..10e7e3fe2b --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBench")] + public class AncientNavystoneBench : ModTile + { + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), false, true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBench.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench.png diff --git a/Tiles/FurnitureEutrophic/EutrophicBench_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBench_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBench_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs new file mode 100644 index 0000000000..d4411a6561 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicBookcase")] + public class AncientNavystoneBookcase : ModTile + { + public override void SetStaticDefaults() => this.SetUpBookcase(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicBookcase.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicBookcase.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneBookcase.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs new file mode 100644 index 0000000000..c98491aaa5 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicCandelabra")] + public class AncientNavystoneCandelabra : ModTile + { + public override void SetStaticDefaults() => this.SetUpCandelabra(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 2, 2); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicCandelabra.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicCandelabra.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandelabra.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs new file mode 100644 index 0000000000..c5ec992870 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.cs @@ -0,0 +1,59 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicCandle")] + public class AncientNavystoneCandle : ModTile + { + public override void SetStaticDefaults() => this.SetUpCandle(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 1); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicCandle.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicCandle.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneCandle.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs new file mode 100644 index 0000000000..7baefbb973 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChair")] + public class AncientNavystoneChair : ModTile + { + public override void SetStaticDefaults() => this.SetUpChair(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicChair.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair.png diff --git a/Tiles/FurnitureEutrophic/EutrophicChair_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicChair_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChair_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs new file mode 100644 index 0000000000..4ca18e0ca4 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChandelier")] + public class AncientNavystoneChandelier : ModTile + { + public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicChandelier.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChandelier.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs new file mode 100644 index 0000000000..3677bff276 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicChest")] + public class AncientNavystoneChest : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChest(ModContent.ItemType(), true); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicChest.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest.png diff --git a/Tiles/FurnitureEutrophic/EutrophicChest_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicChest_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneChest_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs new file mode 100644 index 0000000000..a4b73e2700 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.cs @@ -0,0 +1,58 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicClock")] + public class AncientNavystoneClock : ModTile + { + public override void SetStaticDefaults() => this.SetUpClock(ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool RightClick(int x, int y) + { + return CalamityUtils.ClockRightClick(); + } + + public override void NearbyEffects(int i, int j, bool closer) + { + if (closer) + { + Main.SceneMetrics.HasClock = true; + } + } + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicClock.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock.png diff --git a/Tiles/FurnitureEutrophic/EutrophicClock_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicClock_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneClock_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed.cs new file mode 100644 index 0000000000..eac29d4996 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed.cs @@ -0,0 +1,39 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicDoorClosed")] + public class AncientNavystoneDoorClosed : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorClosed(ModContent.ItemType()); + TileID.Sets.OpenDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDoorClosed.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed.png diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDoorClosed_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorClosed_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen.cs new file mode 100644 index 0000000000..d9ca902825 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen.cs @@ -0,0 +1,41 @@ +using CalamityMod.Items.Placeables.FurnitureNavystone; +using CalamityMod.Items.Placeables.FurnitureNavystone.FurnitureAncientNavystone; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicDoorOpen")] + public class AncientNavystoneDoorOpen : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorOpen(ModContent.ItemType()); + TileID.Sets.CloseDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDoorOpen.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen.png diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDoorOpen_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDoorOpen_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs new file mode 100644 index 0000000000..be8cbe7258 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicDresser")] + public class AncientNavystoneDresser : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDresser(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDresser.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser.png diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser_Highlight.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser_Highlight.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicDresser_Highlight.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneDresser_Highlight.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs new file mode 100644 index 0000000000..ad6db914c5 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.cs @@ -0,0 +1,45 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicLamp")] + public class AncientNavystoneLamp : ModTile + { + public override void SetStaticDefaults() => this.SetUpLamp(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicLamp.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicLamp.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLamp.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs new file mode 100644 index 0000000000..68c39d9298 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicLantern")] + public class AncientNavystoneLantern : ModTile + { + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 0.5f; + g = 1f; + b = 1f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 2); + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicLantern.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneLantern.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs new file mode 100644 index 0000000000..a085e8e67f --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicPiano")] + public class AncientNavystonePiano : ModTile + { + public override void SetStaticDefaults() => this.SetUpPiano(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicPiano.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePiano.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs new file mode 100644 index 0000000000..94b3503972 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.cs @@ -0,0 +1,29 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicPlatform")] + public class AncientNavystonePlatform : ModTile + { + public override void SetStaticDefaults() => this.SetUpPlatform(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void PostSetDefaults() + { + Main.tileNoSunLight[Type] = false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicPlatform.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystonePlatform.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs new file mode 100644 index 0000000000..4f7ab93d33 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicSink")] + public class AncientNavystoneSink : ModTile + { + public override void SetStaticDefaults() => this.SetUpSink(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicSink.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicSink.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneSink.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs new file mode 100644 index 0000000000..46cf5a9a78 --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicTable")] + public class AncientNavystoneTable : ModTile + { + public override void SetStaticDefaults() => this.SetUpTable(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicTable.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicTable.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneTable.png diff --git a/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs new file mode 100644 index 0000000000..2f52f6e75b --- /dev/null +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.cs @@ -0,0 +1,24 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone +{ + [LegacyName("EutrophicWorkBench")] + public class AncientNavystoneWorkBench : ModTile + { + public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.png similarity index 100% rename from Tiles/FurnitureEutrophic/EutrophicWorkBench.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientNavystoneWorkBench.png diff --git a/Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs similarity index 92% rename from Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs index 18ae30d146..bee411f11d 100644 --- a/Tiles/FurnitureEutrophic/AncientSmoothNavystone.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.cs @@ -4,7 +4,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone { public class AncientSmoothNavystone : ModTile { diff --git a/Tiles/FurnitureEutrophic/AncientSmoothNavystone.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.png similarity index 100% rename from Tiles/FurnitureEutrophic/AncientSmoothNavystone.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/AncientSmoothNavystone.png diff --git a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs similarity index 94% rename from Tiles/Furniture/CraftingStations/EutrophicShelf.cs rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs index dca632f30e..010779aa70 100644 --- a/Tiles/Furniture/CraftingStations/EutrophicShelf.cs +++ b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.cs @@ -6,7 +6,7 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone { [LegacyName("EutrophicCrafting")] public class EutrophicShelf : ModTile @@ -41,7 +41,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; TileObjectData.addAlternate(1); TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); AnimationFrameHeight = 54; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } diff --git a/Tiles/Furniture/CraftingStations/EutrophicShelf.png b/Tiles/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.png similarity index 100% rename from Tiles/Furniture/CraftingStations/EutrophicShelf.png rename to Tiles/FurnitureNavystone/FurnitureAncientNavystone/EutrophicShelf.png diff --git a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs b/Tiles/FurnitureNavystone/NavystoneBathtub.cs similarity index 75% rename from Tiles/FurnitureEutrophic/EutrophicBathtub.cs rename to Tiles/FurnitureNavystone/NavystoneBathtub.cs index 85dcf8c046..67b72afb56 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBathtub.cs +++ b/Tiles/FurnitureNavystone/NavystoneBathtub.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicBathtub : ModTile + public class NavystoneBathtub : ModTile { - public override void SetStaticDefaults() => this.SetUpBathtub(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpBathtub(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneBathtub.png b/Tiles/FurnitureNavystone/NavystoneBathtub.png new file mode 100644 index 0000000000..60f3952cb5 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneBathtub.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicBed.cs b/Tiles/FurnitureNavystone/NavystoneBed.cs similarity index 82% rename from Tiles/FurnitureEutrophic/EutrophicBed.cs rename to Tiles/FurnitureNavystone/NavystoneBed.cs index 5dd7734de4..31c8888783 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBed.cs +++ b/Tiles/FurnitureNavystone/NavystoneBed.cs @@ -4,11 +4,11 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicBed : ModTile + public class NavystoneBed : ModTile { - public override void SetStaticDefaults() => this.SetUpBed(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpBed(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { @@ -25,6 +25,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/NavystoneBed.png b/Tiles/FurnitureNavystone/NavystoneBed.png new file mode 100644 index 0000000000..001728bd9a Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneBed.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneBed_Highlight.png b/Tiles/FurnitureNavystone/NavystoneBed_Highlight.png new file mode 100644 index 0000000000..b11dd25886 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneBed_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs b/Tiles/FurnitureNavystone/NavystoneBookcase.cs similarity index 75% rename from Tiles/FurnitureEutrophic/EutrophicBookcase.cs rename to Tiles/FurnitureNavystone/NavystoneBookcase.cs index cadb22b791..0ac994ccfa 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBookcase.cs +++ b/Tiles/FurnitureNavystone/NavystoneBookcase.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicBookcase : ModTile + public class NavystoneBookcase : ModTile { - public override void SetStaticDefaults() => this.SetUpBookcase(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpBookcase(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneBookcase.png b/Tiles/FurnitureNavystone/NavystoneBookcase.png new file mode 100644 index 0000000000..85c12525fb Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneBookcase.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs b/Tiles/FurnitureNavystone/NavystoneCandelabra.cs similarity index 85% rename from Tiles/FurnitureEutrophic/EutrophicCandelabra.cs rename to Tiles/FurnitureNavystone/NavystoneCandelabra.cs index 524b5da0cf..61b6bcc3d8 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandelabra.cs +++ b/Tiles/FurnitureNavystone/NavystoneCandelabra.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicCandelabra : ModTile + public class NavystoneCandelabra : ModTile { - public override void SetStaticDefaults() => this.SetUpCandelabra(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpCandelabra(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneCandelabra.png b/Tiles/FurnitureNavystone/NavystoneCandelabra.png new file mode 100644 index 0000000000..09672ac1cb Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneCandelabra.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicCandle.cs b/Tiles/FurnitureNavystone/NavystoneCandle.cs similarity index 86% rename from Tiles/FurnitureEutrophic/EutrophicCandle.cs rename to Tiles/FurnitureNavystone/NavystoneCandle.cs index 1b4f0db715..895adafb2b 100644 --- a/Tiles/FurnitureEutrophic/EutrophicCandle.cs +++ b/Tiles/FurnitureNavystone/NavystoneCandle.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicCandle : ModTile + public class NavystoneCandle : ModTile { - public override void SetStaticDefaults() => this.SetUpCandle(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpCandle(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { @@ -46,7 +46,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); } public override bool RightClick(int i, int j) diff --git a/Tiles/FurnitureNavystone/NavystoneCandle.png b/Tiles/FurnitureNavystone/NavystoneCandle.png new file mode 100644 index 0000000000..e1fe5f8507 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneCandle.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicChair.cs b/Tiles/FurnitureNavystone/NavystoneChair.cs similarity index 85% rename from Tiles/FurnitureEutrophic/EutrophicChair.cs rename to Tiles/FurnitureNavystone/NavystoneChair.cs index 2028c2a9c3..d06a33c753 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChair.cs +++ b/Tiles/FurnitureNavystone/NavystoneChair.cs @@ -6,11 +6,11 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicChair : ModTile + public class NavystoneChair : ModTile { - public override void SetStaticDefaults() => this.SetUpChair(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpChair(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/NavystoneChair.png b/Tiles/FurnitureNavystone/NavystoneChair.png new file mode 100644 index 0000000000..30c65cd137 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneChair.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneChair_Highlight.png b/Tiles/FurnitureNavystone/NavystoneChair_Highlight.png new file mode 100644 index 0000000000..fca0c61d27 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneChair_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs b/Tiles/FurnitureNavystone/NavystoneChandelier.cs similarity index 86% rename from Tiles/FurnitureEutrophic/EutrophicChandelier.cs rename to Tiles/FurnitureNavystone/NavystoneChandelier.cs index c98b6590b7..0c681e1693 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChandelier.cs +++ b/Tiles/FurnitureNavystone/NavystoneChandelier.cs @@ -4,11 +4,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicChandelier : ModTile + public class NavystoneChandelier : ModTile { - public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType()); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); diff --git a/Tiles/FurnitureNavystone/NavystoneChandelier.png b/Tiles/FurnitureNavystone/NavystoneChandelier.png new file mode 100644 index 0000000000..9cc4db1d1c Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneChandelier.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicChest.cs b/Tiles/FurnitureNavystone/NavystoneChest.cs similarity index 76% rename from Tiles/FurnitureEutrophic/EutrophicChest.cs rename to Tiles/FurnitureNavystone/NavystoneChest.cs index 21053e81c1..232e559bea 100644 --- a/Tiles/FurnitureEutrophic/EutrophicChest.cs +++ b/Tiles/FurnitureNavystone/NavystoneChest.cs @@ -5,14 +5,14 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicChest : ModTile + public class NavystoneChest : ModTile { public override void SetStaticDefaults() { - this.SetUpChest(ModContent.ItemType(), true); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + this.SetUpChest(ModContent.ItemType(), true); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); - public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); } diff --git a/Tiles/FurnitureNavystone/NavystoneChest.png b/Tiles/FurnitureNavystone/NavystoneChest.png new file mode 100644 index 0000000000..b77c5ad9e5 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneChest.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneChest_Highlight.png b/Tiles/FurnitureNavystone/NavystoneChest_Highlight.png new file mode 100644 index 0000000000..721846627a Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneChest_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicClock.cs b/Tiles/FurnitureNavystone/NavystoneClock.cs similarity index 88% rename from Tiles/FurnitureEutrophic/EutrophicClock.cs rename to Tiles/FurnitureNavystone/NavystoneClock.cs index c58bfde6cd..98806da830 100644 --- a/Tiles/FurnitureEutrophic/EutrophicClock.cs +++ b/Tiles/FurnitureNavystone/NavystoneClock.cs @@ -4,11 +4,11 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicClock : ModTile + public class NavystoneClock : ModTile { - public override void SetStaticDefaults() => this.SetUpClock(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpClock(ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; @@ -52,6 +52,6 @@ namespace CalamityMod.Tiles.FurnitureEutrophic } } - public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); } } diff --git a/Tiles/FurnitureNavystone/NavystoneClock.png b/Tiles/FurnitureNavystone/NavystoneClock.png new file mode 100644 index 0000000000..ee92788132 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneClock.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneClock_Highlight.png b/Tiles/FurnitureNavystone/NavystoneClock_Highlight.png new file mode 100644 index 0000000000..813835a873 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneClock_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs b/Tiles/FurnitureNavystone/NavystoneDoorClosed.cs similarity index 79% rename from Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs rename to Tiles/FurnitureNavystone/NavystoneDoorClosed.cs index 3fe3f15c77..1d65b6c141 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorClosed.cs +++ b/Tiles/FurnitureNavystone/NavystoneDoorClosed.cs @@ -4,14 +4,14 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicDoorClosed : ModTile + public class NavystoneDoorClosed : ModTile { public override void SetStaticDefaults() { - this.SetUpDoorClosed(ModContent.ItemType()); - TileID.Sets.OpenDoorID[Type] = ModContent.TileType(); + this.SetUpDoorClosed(ModContent.ItemType()); + TileID.Sets.OpenDoorID[Type] = ModContent.TileType(); } public override bool CreateDust(int i, int j, ref int type) @@ -32,7 +32,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneDoorClosed.png b/Tiles/FurnitureNavystone/NavystoneDoorClosed.png new file mode 100644 index 0000000000..f54be56f60 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDoorClosed.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneDoorClosed_Highlight.png b/Tiles/FurnitureNavystone/NavystoneDoorClosed_Highlight.png new file mode 100644 index 0000000000..e212eaa1db Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs b/Tiles/FurnitureNavystone/NavystoneDoorOpen.cs similarity index 75% rename from Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs rename to Tiles/FurnitureNavystone/NavystoneDoorOpen.cs index 3a2e51ab7e..9a319a1f1e 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDoorOpen.cs +++ b/Tiles/FurnitureNavystone/NavystoneDoorOpen.cs @@ -1,18 +1,18 @@ -using CalamityMod.Items.Placeables.FurnitureEutrophic; +using CalamityMod.Items.Placeables.FurnitureNavystone; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicDoorOpen : ModTile + public class NavystoneDoorOpen : ModTile { public override void SetStaticDefaults() { - this.SetUpDoorOpen(ModContent.ItemType()); - TileID.Sets.CloseDoorID[Type] = ModContent.TileType(); + this.SetUpDoorOpen(ModContent.ItemType()); + TileID.Sets.CloseDoorID[Type] = ModContent.TileType(); } public override bool CreateDust(int i, int j, ref int type) @@ -33,7 +33,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic Player player = Main.LocalPlayer; player.noThrow = 2; player.cursorItemIconEnabled = true; - player.cursorItemIconID = ModContent.ItemType(); + player.cursorItemIconID = ModContent.ItemType(); } } } diff --git a/Tiles/FurnitureNavystone/NavystoneDoorOpen.png b/Tiles/FurnitureNavystone/NavystoneDoorOpen.png new file mode 100644 index 0000000000..409dfbc48d Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDoorOpen.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneDoorOpen_Highlight.png b/Tiles/FurnitureNavystone/NavystoneDoorOpen_Highlight.png new file mode 100644 index 0000000000..6b2214683a Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicDresser.cs b/Tiles/FurnitureNavystone/NavystoneDresser.cs similarity index 76% rename from Tiles/FurnitureEutrophic/EutrophicDresser.cs rename to Tiles/FurnitureNavystone/NavystoneDresser.cs index 8456bd20f4..1084bee069 100644 --- a/Tiles/FurnitureEutrophic/EutrophicDresser.cs +++ b/Tiles/FurnitureNavystone/NavystoneDresser.cs @@ -5,14 +5,14 @@ using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicDresser : ModTile + public class NavystoneDresser : ModTile { public override void SetStaticDefaults() { - this.SetUpDresser(ModContent.ItemType()); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + this.SetUpDresser(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); } public override bool CreateDust(int i, int j, ref int type) @@ -23,9 +23,9 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); - public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); - public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); } diff --git a/Tiles/FurnitureNavystone/NavystoneDresser.png b/Tiles/FurnitureNavystone/NavystoneDresser.png new file mode 100644 index 0000000000..b720409b99 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDresser.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneDresser_Highlight.png b/Tiles/FurnitureNavystone/NavystoneDresser_Highlight.png new file mode 100644 index 0000000000..4caa037707 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneDresser_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicLamp.cs b/Tiles/FurnitureNavystone/NavystoneLamp.cs similarity index 86% rename from Tiles/FurnitureEutrophic/EutrophicLamp.cs rename to Tiles/FurnitureNavystone/NavystoneLamp.cs index 72a09fd1a8..bd7f000af4 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLamp.cs +++ b/Tiles/FurnitureNavystone/NavystoneLamp.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicLamp : ModTile + public class NavystoneLamp : ModTile { - public override void SetStaticDefaults() => this.SetUpLamp(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpLamp(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneLamp.png b/Tiles/FurnitureNavystone/NavystoneLamp.png new file mode 100644 index 0000000000..8b639f35dc Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneLamp.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicLantern.cs b/Tiles/FurnitureNavystone/NavystoneLantern.cs similarity index 87% rename from Tiles/FurnitureEutrophic/EutrophicLantern.cs rename to Tiles/FurnitureNavystone/NavystoneLantern.cs index a238668f28..b7ef1ce6cc 100644 --- a/Tiles/FurnitureEutrophic/EutrophicLantern.cs +++ b/Tiles/FurnitureNavystone/NavystoneLantern.cs @@ -4,11 +4,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicLantern : ModTile + public class NavystoneLantern : ModTile { - public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CreateDust(int i, int j, ref int type) diff --git a/Tiles/FurnitureNavystone/NavystoneLantern.png b/Tiles/FurnitureNavystone/NavystoneLantern.png new file mode 100644 index 0000000000..85eea88754 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneLantern.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicPiano.cs b/Tiles/FurnitureNavystone/NavystoneLyre.cs similarity index 75% rename from Tiles/FurnitureEutrophic/EutrophicPiano.cs rename to Tiles/FurnitureNavystone/NavystoneLyre.cs index 7a52e16db4..5880f7e163 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPiano.cs +++ b/Tiles/FurnitureNavystone/NavystoneLyre.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicPiano : ModTile + public class NavystoneLyre : ModTile { - public override void SetStaticDefaults() => this.SetUpPiano(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpPiano(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneLyre.png b/Tiles/FurnitureNavystone/NavystoneLyre.png new file mode 100644 index 0000000000..e797fd1cb9 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneLyre.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs b/Tiles/FurnitureNavystone/NavystonePlatform.cs similarity index 78% rename from Tiles/FurnitureEutrophic/EutrophicPlatform.cs rename to Tiles/FurnitureNavystone/NavystonePlatform.cs index d4162d7113..953bc547c3 100644 --- a/Tiles/FurnitureEutrophic/EutrophicPlatform.cs +++ b/Tiles/FurnitureNavystone/NavystonePlatform.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicPlatform : ModTile + public class NavystonePlatform : ModTile { - public override void SetStaticDefaults() => this.SetUpPlatform(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpPlatform(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystonePlatform.png b/Tiles/FurnitureNavystone/NavystonePlatform.png new file mode 100644 index 0000000000..3f97fc569b Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystonePlatform.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicSink.cs b/Tiles/FurnitureNavystone/NavystoneSink.cs similarity index 76% rename from Tiles/FurnitureEutrophic/EutrophicSink.cs rename to Tiles/FurnitureNavystone/NavystoneSink.cs index d95b05aef6..c276114d43 100644 --- a/Tiles/FurnitureEutrophic/EutrophicSink.cs +++ b/Tiles/FurnitureNavystone/NavystoneSink.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicSink : ModTile + public class NavystoneSink : ModTile { - public override void SetStaticDefaults() => this.SetUpSink(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpSink(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneSink.png b/Tiles/FurnitureNavystone/NavystoneSink.png new file mode 100644 index 0000000000..1410a1a3db Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneSink.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicTable.cs b/Tiles/FurnitureNavystone/NavystoneTable.cs similarity index 75% rename from Tiles/FurnitureEutrophic/EutrophicTable.cs rename to Tiles/FurnitureNavystone/NavystoneTable.cs index e55e216aa7..e9997d1652 100644 --- a/Tiles/FurnitureEutrophic/EutrophicTable.cs +++ b/Tiles/FurnitureNavystone/NavystoneTable.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicTable : ModTile + public class NavystoneTable : ModTile { - public override void SetStaticDefaults() => this.SetUpTable(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpTable(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneTable.png b/Tiles/FurnitureNavystone/NavystoneTable.png new file mode 100644 index 0000000000..fbcdd63309 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneTable.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneToilet.cs b/Tiles/FurnitureNavystone/NavystoneToilet.cs new file mode 100644 index 0000000000..1205e40ff3 --- /dev/null +++ b/Tiles/FurnitureNavystone/NavystoneToilet.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureNavystone +{ + public class NavystoneToilet : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + // Toilets count as Chairs + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Toilet")); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Granite, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) // I hate this please make it stop. - Merkalto + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - tile.TileFrameY / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } + } +} diff --git a/Tiles/FurnitureNavystone/NavystoneToilet.png b/Tiles/FurnitureNavystone/NavystoneToilet.png new file mode 100644 index 0000000000..470aaf68a0 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneToilet.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneToilet_Highlight.png b/Tiles/FurnitureNavystone/NavystoneToilet_Highlight.png new file mode 100644 index 0000000000..5d2772081a Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneToilet_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicBench.cs b/Tiles/FurnitureNavystone/NavystoneTriclinium.cs similarity index 84% rename from Tiles/FurnitureEutrophic/EutrophicBench.cs rename to Tiles/FurnitureNavystone/NavystoneTriclinium.cs index 876e7ec38c..41251b0b2d 100644 --- a/Tiles/FurnitureEutrophic/EutrophicBench.cs +++ b/Tiles/FurnitureNavystone/NavystoneTriclinium.cs @@ -6,11 +6,11 @@ using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicBench : ModTile + public class NavystoneTriclinium : ModTile { - public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), false, true); + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), false, true); public override bool CreateDust(int i, int j, ref int type) { @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.FurnitureEutrophic public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); - public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) { diff --git a/Tiles/FurnitureNavystone/NavystoneTriclinium.png b/Tiles/FurnitureNavystone/NavystoneTriclinium.png new file mode 100644 index 0000000000..68cdff63d5 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneTriclinium.png differ diff --git a/Tiles/FurnitureNavystone/NavystoneTriclinium_Highlight.png b/Tiles/FurnitureNavystone/NavystoneTriclinium_Highlight.png new file mode 100644 index 0000000000..8376806503 Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneTriclinium_Highlight.png differ diff --git a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs b/Tiles/FurnitureNavystone/NavystoneWorkBench.cs similarity index 74% rename from Tiles/FurnitureEutrophic/EutrophicWorkBench.cs rename to Tiles/FurnitureNavystone/NavystoneWorkBench.cs index 07679537ef..162a074600 100644 --- a/Tiles/FurnitureEutrophic/EutrophicWorkBench.cs +++ b/Tiles/FurnitureNavystone/NavystoneWorkBench.cs @@ -3,11 +3,11 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { - public class EutrophicWorkBench : ModTile + public class NavystoneWorkBench : ModTile { - public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType()); + public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType()); public override bool CreateDust(int i, int j, ref int type) { diff --git a/Tiles/FurnitureNavystone/NavystoneWorkBench.png b/Tiles/FurnitureNavystone/NavystoneWorkBench.png new file mode 100644 index 0000000000..5cf0c4842b Binary files /dev/null and b/Tiles/FurnitureNavystone/NavystoneWorkBench.png differ diff --git a/Tiles/SunkenSea/PolishedNavystoneBrick.cs b/Tiles/FurnitureNavystone/PolishedNavystoneBrick.cs similarity index 94% rename from Tiles/SunkenSea/PolishedNavystoneBrick.cs rename to Tiles/FurnitureNavystone/PolishedNavystoneBrick.cs index 9331d479ab..06f5c11b6a 100644 --- a/Tiles/SunkenSea/PolishedNavystoneBrick.cs +++ b/Tiles/FurnitureNavystone/PolishedNavystoneBrick.cs @@ -4,7 +4,7 @@ using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Systems; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.FurnitureNavystone { public class PolishedNavystoneBrick : ModTile { diff --git a/Tiles/SunkenSea/PolishedNavystoneBrick.png b/Tiles/FurnitureNavystone/PolishedNavystoneBrick.png similarity index 100% rename from Tiles/SunkenSea/PolishedNavystoneBrick.png rename to Tiles/FurnitureNavystone/PolishedNavystoneBrick.png diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.cs b/Tiles/FurnitureNavystone/SmoothNavystone.cs similarity index 96% rename from Tiles/FurnitureEutrophic/SmoothNavystone.cs rename to Tiles/FurnitureNavystone/SmoothNavystone.cs index ce85324b05..ff73a7d14c 100644 --- a/Tiles/FurnitureEutrophic/SmoothNavystone.cs +++ b/Tiles/FurnitureNavystone/SmoothNavystone.cs @@ -5,7 +5,7 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Tiles.FurnitureEutrophic +namespace CalamityMod.Tiles.FurnitureNavystone { public class SmoothNavystone : ModTile { diff --git a/Tiles/FurnitureEutrophic/SmoothNavystone.png b/Tiles/FurnitureNavystone/SmoothNavystone.png similarity index 100% rename from Tiles/FurnitureEutrophic/SmoothNavystone.png rename to Tiles/FurnitureNavystone/SmoothNavystone.png diff --git a/Tiles/SunkenSea/SmoothSeaPrism.png b/Tiles/FurnitureNavystone/SmoothSeaPrism.png similarity index 100% rename from Tiles/SunkenSea/SmoothSeaPrism.png rename to Tiles/FurnitureNavystone/SmoothSeaPrism.png diff --git a/Tiles/FurnitureProfaned/ProfanedLantern.cs b/Tiles/FurnitureProfaned/ProfanedLantern.cs index 7435eaccba..5d142f4db2 100644 --- a/Tiles/FurnitureProfaned/ProfanedLantern.cs +++ b/Tiles/FurnitureProfaned/ProfanedLantern.cs @@ -1,8 +1,10 @@ using CalamityMod.Dusts.Furniture; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -10,6 +12,10 @@ namespace CalamityMod.Tiles.FurnitureProfaned { public class ProfanedLantern : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -41,16 +47,26 @@ namespace CalamityMod.Tiles.FurnitureProfaned } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(128, 108, 90, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureProfaned/ProfanedLanternFlame").Value, i, j); - } - public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref TileDrawInfo drawData) { if (Main.tile[i, j].TileFrameX < 18) diff --git a/Tiles/FurnitureRunestone/RunestoneTerracotta.cs b/Tiles/FurnitureRunestone/RunestoneTerracotta.cs new file mode 100644 index 0000000000..ddbef319ce --- /dev/null +++ b/Tiles/FurnitureRunestone/RunestoneTerracotta.cs @@ -0,0 +1,44 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using CalamityMod.Tiles.SunkenSea; + +namespace CalamityMod.Tiles.FurnitureRunestone +{ + public class RunestoneTerracotta : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + DustType = DustID.Pot; + AddMapEntry(new Color(186, 130, 130)); + Main.tileShine2[Type] = true; + + TileID.Sets.CanBeDugByShovel[Type] = true; + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureRunestone/RunestoneTerracotta.png b/Tiles/FurnitureRunestone/RunestoneTerracotta.png new file mode 100644 index 0000000000..c70ef9bd5f Binary files /dev/null and b/Tiles/FurnitureRunestone/RunestoneTerracotta.png differ diff --git a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs index 3b46b8500e..456a13d127 100644 --- a/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs +++ b/Tiles/FurnitureSacrilegious/SacrilegiousLanternTile.cs @@ -1,7 +1,9 @@ using CalamityMod.Items.Placeables.FurnitureSacrilegious; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -9,6 +11,10 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious { public class SacrilegiousLanternTile : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -40,14 +46,24 @@ namespace CalamityMod.Tiles.FurnitureSacrilegious } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(128, 26, 26, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureSacrilegious/SacrilegiousLanternTileFlame").Value, i, j); - } } } diff --git a/Tiles/FurnitureShellstone/ShellTrimBrick.cs b/Tiles/FurnitureShellstone/ShellTrimBrick.cs new file mode 100644 index 0000000000..e62c5122a0 --- /dev/null +++ b/Tiles/FurnitureShellstone/ShellTrimBrick.cs @@ -0,0 +1,34 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; +using Terraria.ID; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; + +namespace CalamityMod.Tiles.FurnitureShellstone +{ + public class ShellTrimBrick : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + TileID.Sets.HasSlopeFrames[Type] = true; + + HitSound = SoundID.Tink; + DustType = DustID.CorruptPlants; + AddMapEntry(new Color(156, 191, 199)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/FurnitureShellstone/ShellTrimBrick.png b/Tiles/FurnitureShellstone/ShellTrimBrick.png new file mode 100644 index 0000000000..36960b0c90 Binary files /dev/null and b/Tiles/FurnitureShellstone/ShellTrimBrick.png differ diff --git a/Tiles/SunkenSea/ShellstoneSlab.cs b/Tiles/FurnitureShellstone/ShellstoneSlab.cs similarity index 93% rename from Tiles/SunkenSea/ShellstoneSlab.cs rename to Tiles/FurnitureShellstone/ShellstoneSlab.cs index bb2f5c706e..c3d5e24bc6 100644 --- a/Tiles/SunkenSea/ShellstoneSlab.cs +++ b/Tiles/FurnitureShellstone/ShellstoneSlab.cs @@ -3,8 +3,9 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; -namespace CalamityMod.Tiles.SunkenSea +namespace CalamityMod.Tiles.FurnitureShellstone { public class ShellstoneSlab : ModTile { diff --git a/Tiles/SunkenSea/ShellstoneSlab.png b/Tiles/FurnitureShellstone/ShellstoneSlab.png similarity index 100% rename from Tiles/SunkenSea/ShellstoneSlab.png rename to Tiles/FurnitureShellstone/ShellstoneSlab.png diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin.cs b/Tiles/FurnitureSilva/SilvaBasin.cs similarity index 93% rename from Tiles/Furniture/CraftingStations/SilvaBasin.cs rename to Tiles/FurnitureSilva/SilvaBasin.cs index a056b5aed6..73964ffa6a 100644 --- a/Tiles/Furniture/CraftingStations/SilvaBasin.cs +++ b/Tiles/FurnitureSilva/SilvaBasin.cs @@ -7,7 +7,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureSilva { public class SilvaBasin : ModTile { @@ -20,7 +20,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.LavaDeath = false; TileObjectData.newTile.StyleLineSkip = 2; TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); AnimationFrameHeight = 54; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); } diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin.png b/Tiles/FurnitureSilva/SilvaBasin.png similarity index 100% rename from Tiles/Furniture/CraftingStations/SilvaBasin.png rename to Tiles/FurnitureSilva/SilvaBasin.png diff --git a/Tiles/Furniture/CraftingStations/SilvaBasin_Highlight.png b/Tiles/FurnitureSilva/SilvaBasin_Highlight.png similarity index 100% rename from Tiles/Furniture/CraftingStations/SilvaBasin_Highlight.png rename to Tiles/FurnitureSilva/SilvaBasin_Highlight.png diff --git a/Tiles/Furniture/CraftingStations/StaticRefiner.cs b/Tiles/FurnitureStatigel/StaticRefiner.cs similarity index 91% rename from Tiles/Furniture/CraftingStations/StaticRefiner.cs rename to Tiles/FurnitureStatigel/StaticRefiner.cs index 092060fb68..083159c5ed 100644 --- a/Tiles/Furniture/CraftingStations/StaticRefiner.cs +++ b/Tiles/FurnitureStatigel/StaticRefiner.cs @@ -6,7 +6,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureStatigel { public class StaticRefiner : ModTile { @@ -18,7 +18,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.addTile(Type); - AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName()); AnimationFrameHeight = 54; //also counts as a Solidifier AdjTiles = new int[] { TileID.Solidifier }; diff --git a/Tiles/Furniture/CraftingStations/StaticRefiner.png b/Tiles/FurnitureStatigel/StaticRefiner.png similarity index 100% rename from Tiles/Furniture/CraftingStations/StaticRefiner.png rename to Tiles/FurnitureStatigel/StaticRefiner.png diff --git a/Tiles/FurnitureStatigel/StatigelLantern.cs b/Tiles/FurnitureStatigel/StatigelLantern.cs index 5d09bb13e9..b31e99ef26 100644 --- a/Tiles/FurnitureStatigel/StatigelLantern.cs +++ b/Tiles/FurnitureStatigel/StatigelLantern.cs @@ -1,6 +1,8 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; +using Terraria.GameContent.Drawing; using Terraria.ID; using Terraria.ModLoader; @@ -8,6 +10,10 @@ namespace CalamityMod.Tiles.FurnitureStatigel { public class StatigelLantern : ModTile { + public Asset FlameTexture; + + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); @@ -38,14 +44,24 @@ namespace CalamityMod.Tiles.FurnitureStatigel } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(102, 115, 128, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 2); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureStatigel/StatigelLanternFlame").Value, i, j); - } } } diff --git a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs index 8d0a4d96ff..406f8a0d69 100644 --- a/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb.cs @@ -98,22 +98,12 @@ namespace CalamityMod.Tiles.FurnitureWulfrum if (Main.tile[i, j].IsTileActuallyInvisible()) return; - float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); - - float time = Main.GameUpdateCount; - float waveScale1 = time * 0.094f; - int scalar = i - (j / 2); - float wave1 = waveScale1 * -50 + scalar * 12; - float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); - - float transparency = 0.05f + wave1angle; - Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/ChargedWulfrumWallMountedBulb_Glow").Value; Tile tile = Main.tile[i, j]; Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); - TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White, false), default); } public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs new file mode 100644 index 0000000000..34ed84e662 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumBathtub : ModTile + { + public override void SetStaticDefaults() => this.SetUpBathtub(ModContent.ItemType()); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png new file mode 100644 index 0000000000..552c86a3e5 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBathtub.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs new file mode 100644 index 0000000000..fd1e3426de --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumBookcase : ModTile + { + public override void SetStaticDefaults() => this.SetUpBookcase(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png new file mode 100644 index 0000000000..93e13605b4 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumBookcase.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs new file mode 100644 index 0000000000..7ca49b489d --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.cs @@ -0,0 +1,37 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChair : ModTile + { + public override void SetStaticDefaults() => this.SetUpChair(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png new file mode 100644 index 0000000000..6ee3ada599 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair_Highlight.png new file mode 100644 index 0000000000..b59a4f5245 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChair_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs new file mode 100644 index 0000000000..025b515bc4 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.cs @@ -0,0 +1,67 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent.Drawing; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChandelier : ModTile + { + + public override void SetStaticDefaults() => this.SetUpChandelier(ModContent.ItemType(), true); + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 201f / 255f; + g = 226f / 255f; + b = 122f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 3, 3); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 2) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png new file mode 100644 index 0000000000..bc974929bc Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier_Glow.png new file mode 100644 index 0000000000..6b8c2c9cf1 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChandelier_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs new file mode 100644 index 0000000000..6b0de18f35 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.cs @@ -0,0 +1,50 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumChest : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpChest(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.ChestMouseOver(i, j); + public override void MouseOverFar(int i, int j) => CalamityUtils.ChestMouseFar(i, j); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.ChestRightClick(i, j); + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png new file mode 100644 index 0000000000..b34000a603 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Glow.png new file mode 100644 index 0000000000..a415184891 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Highlight.png new file mode 100644 index 0000000000..c0d1530a5b Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumChest_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png new file mode 100644 index 0000000000..d2fd41cb59 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Glow.png new file mode 100644 index 0000000000..8c0bf62db6 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Highlight.png new file mode 100644 index 0000000000..3d82b19c24 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumClock_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs new file mode 100644 index 0000000000..f7d2e1aca5 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.cs @@ -0,0 +1,76 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDeskLight : ModTile + { + public override void SetStaticDefaults() => this.SetUpCandle(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 201f / 255f; + g = 226f / 255f; + b = 122f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, 1, j, 1, 1); + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + + public override bool RightClick(int i, int j) + { + CalamityUtils.RightClickBreak(i, j); + return true; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 5) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png new file mode 100644 index 0000000000..3acbbd1bee Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight_Glow.png new file mode 100644 index 0000000000..9089acfd02 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDeskLight_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.cs new file mode 100644 index 0000000000..cd6f07a065 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDoorClosed : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorClosed(ModContent.ItemType(), true); + TileID.Sets.OpenDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.png new file mode 100644 index 0000000000..90a41c9aca Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed_Highlight.png new file mode 100644 index 0000000000..e0758984f1 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorClosed_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.cs new file mode 100644 index 0000000000..5df9264a7a --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.cs @@ -0,0 +1,39 @@ +using CalamityMod.Items.Placeables.FurnitureWulfrum.FurnitureAnodizedWulfrum; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDoorOpen : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDoorOpen(ModContent.ItemType(), true); + TileID.Sets.CloseDoorID[Type] = ModContent.TileType(); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.png new file mode 100644 index 0000000000..98e854a8cc Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen_Highlight.png new file mode 100644 index 0000000000..ca767aed7b Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDoorOpen_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs new file mode 100644 index 0000000000..6d78abbe7c --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.cs @@ -0,0 +1,51 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumDresser : ModTile + { + public override void SetStaticDefaults() + { + this.SetUpDresser(ModContent.ItemType()); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetItemName(), CalamityUtils.GetMapChestName); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override LocalizedText DefaultContainerName(int frameX, int frameY) => CalamityUtils.GetItemName(); + public override void MouseOver(int i, int j) => CalamityUtils.DresserMouseOver(); + public override void MouseOverFar(int i, int j) => CalamityUtils.DresserMouseFar(); + public override void KillMultiTile(int i, int j, int frameX, int frameY) => Chest.DestroyChest(i, j); + public override bool RightClick(int i, int j) => CalamityUtils.DresserRightClick(); + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png new file mode 100644 index 0000000000..d37893dd8d Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Glow.png new file mode 100644 index 0000000000..26cee14f42 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Highlight.png new file mode 100644 index 0000000000..6e31954740 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumDresser_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs new file mode 100644 index 0000000000..d181d7d589 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.cs @@ -0,0 +1,55 @@ +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumJukebox : ModTile + { + public override void SetStaticDefaults() + { + Main.tileLighted[Type] = true; + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); //This Jukebox has bookcase dimensions + TileObjectData.newTile.LavaDeath = false; + TileObjectData.addTile(Type); + AddMapEntry(new Color(191, 142, 111), CalamityUtils.GetText("Tiles.Jukebox")); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png new file mode 100644 index 0000000000..02f87edf42 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox_Glow.png new file mode 100644 index 0000000000..3b011f3b84 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumJukebox_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs new file mode 100644 index 0000000000..9818d57552 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.cs @@ -0,0 +1,62 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumLamp : ModTile + { + public override void SetStaticDefaults() => this.SetUpLamp(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 201f / 255f; + g = 226f / 255f; + b = 122f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 3); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png new file mode 100644 index 0000000000..0d0d621ae0 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp_Glow.png new file mode 100644 index 0000000000..b1d96c1638 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLamp_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs new file mode 100644 index 0000000000..ef14085edf --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.cs @@ -0,0 +1,66 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.GameContent.Drawing; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumLantern : ModTile + { + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType(), true); + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + if (Main.tile[i, j].TileFrameX < 18) + { + r = 201f / 255f; + g = 226f / 255f; + b = 122f / 255f; + } + else + { + r = 0f; + g = 0f; + b = 0f; + } + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y - 4) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + + public override void HitWire(int i, int j) + { + CalamityUtils.LightHitWire(Type, i, j, 1, 2); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png new file mode 100644 index 0000000000..99ca6f27d1 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern_Glow.png new file mode 100644 index 0000000000..cb80de710c Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumLantern_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs new file mode 100644 index 0000000000..ae6d74a64a --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSink : ModTile + { + public override void SetStaticDefaults() => this.SetUpSink(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png new file mode 100644 index 0000000000..ea91bbf73b Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSink.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs new file mode 100644 index 0000000000..ea86bba509 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.cs @@ -0,0 +1,48 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSleepingPod : ModTile + { + public override void SetStaticDefaults() => this.SetUpBed(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) => CalamityUtils.BedRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.MouseOver(i, j, ModContent.ItemType()); + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png new file mode 100644 index 0000000000..76a7a63f3e Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive.png new file mode 100644 index 0000000000..2f42aefcdd Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive_Glow.png new file mode 100644 index 0000000000..285c7fb955 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPodActive_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Glow.png new file mode 100644 index 0000000000..22a6ed63e9 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Highlight.png new file mode 100644 index 0000000000..514de2d0d8 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSleepingPod_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs new file mode 100644 index 0000000000..b63d062ebf --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.cs @@ -0,0 +1,55 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumSofa : ModTile + { + public override void SetStaticDefaults() => this.SetUpSofa(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.BenchSitInfo(i, j, ref info); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.BenchMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png new file mode 100644 index 0000000000..136844ea32 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Glow.png new file mode 100644 index 0000000000..ea27a6db33 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Highlight.png new file mode 100644 index 0000000000..ee7b74d4f0 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumSofa_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs new file mode 100644 index 0000000000..f1cb1bd42e --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumTable : ModTile + { + public override void SetStaticDefaults() => this.SetUpTable(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable_Glow").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png new file mode 100644 index 0000000000..6cd3908340 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable_Glow.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable_Glow.png new file mode 100644 index 0000000000..39b2d14fc7 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumTable_Glow.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs new file mode 100644 index 0000000000..3dd8ae69af --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.cs @@ -0,0 +1,79 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.GameContent; +using Terraria.GameContent.ObjectInteractions; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumToilet : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileWaterDeath[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 18 }; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleMultiplier = 2; + TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); + TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; + TileObjectData.addAlternate(1); + TileObjectData.addTile(Type); + + // Toilets count as Chairs + AddToArray(ref TileID.Sets.RoomNeeds.CountsAsChair); + AddMapEntry(new Color(191, 142, 111), Language.GetText("MapObject.Toilet")); + TileID.Sets.CanBeSatOnForNPCs[Type] = true; + TileID.Sets.CanBeSatOnForPlayers[Type] = true; + TileID.Sets.HasOutlines[Type] = true; + AdjTiles = new int[] { TileID.Chairs }; + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override void ModifySittingTargetInfo(int i, int j, ref TileRestingInfo info) => CalamityUtils.ChairSitInfo(i, j, ref info, shitter: true); + + public override bool RightClick(int i, int j) => CalamityUtils.ChairRightClick(i, j); + + public override void MouseOver(int i, int j) => CalamityUtils.ChairMouseOver(i, j, ModContent.ItemType()); + + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) + { + return settings.player.IsWithinSnappngRangeToTile(i, j, PlayerSittingHelper.ChairSittingMaxDistance); + } + + public override void HitWire(int i, int j) // I hate this please make it stop. - Merkalto + { + Tile tile = Main.tile[i, j]; + + int spawnX = i; + int spawnY = j - tile.TileFrameY / 18; + + Wiring.SkipWire(spawnX, spawnY); + Wiring.SkipWire(spawnX, spawnY + 1); + + if (Wiring.CheckMech(spawnX, spawnY, 60)) + { + Projectile.NewProjectile(Wiring.GetProjectileSource(spawnX, spawnY), spawnX * 16 + 8, spawnY * 16 + 12, 0f, 0f, ProjectileID.ToiletEffect, 0, 0f, Main.myPlayer); + } + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png new file mode 100644 index 0000000000..890177b446 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet_Highlight.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet_Highlight.png new file mode 100644 index 0000000000..5c2fc8b88a Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumToilet_Highlight.png differ diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs new file mode 100644 index 0000000000..8281656683 --- /dev/null +++ b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.cs @@ -0,0 +1,23 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.FurnitureWulfrum.FurnitureAnodizedWulfrum +{ + public class AnodizedWulfrumWorkBench : ModTile + { + public override void SetStaticDefaults() => this.SetUpWorkBench(ModContent.ItemType(), true); + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Tungsten, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png new file mode 100644 index 0000000000..94cbc92609 Binary files /dev/null and b/Tiles/FurnitureWulfrum/FurnitureAnodizedWulfrum/AnodizedWulfrumWorkBench.png differ diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs b/Tiles/FurnitureWulfrum/WulfrumLabstation.cs similarity index 89% rename from Tiles/Furniture/CraftingStations/WulfrumLabstation.cs rename to Tiles/FurnitureWulfrum/WulfrumLabstation.cs index 8b1cfe6971..fdaaccad09 100644 --- a/Tiles/Furniture/CraftingStations/WulfrumLabstation.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLabstation.cs @@ -8,7 +8,7 @@ using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; -namespace CalamityMod.Tiles.Furniture.CraftingStations +namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumLabstation : ModTile { @@ -17,7 +17,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations Main.tileFrameImportant[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); TileObjectData.addTile(Type); - AddMapEntry(new Color(100, 153, 100), CalamityUtils.GetItemName()); + AddMapEntry(new Color(100, 153, 100), CalamityUtils.GetItemName()); } public override bool CreateDust(int i, int j, ref int type) @@ -38,7 +38,7 @@ namespace CalamityMod.Tiles.Furniture.CraftingStations int xPos = Main.tile[i, j].TileFrameX; int yPos = Main.tile[i, j].TileFrameY; - Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow").Value; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumLabstationGlow").Value; Color drawColour = CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, new Color(100, 100, 100, 100)); Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); Vector2 drawOffset = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + zero; diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstation.png b/Tiles/FurnitureWulfrum/WulfrumLabstation.png similarity index 100% rename from Tiles/Furniture/CraftingStations/WulfrumLabstation.png rename to Tiles/FurnitureWulfrum/WulfrumLabstation.png diff --git a/Tiles/Furniture/CraftingStations/WulfrumLabstationGlow.png b/Tiles/FurnitureWulfrum/WulfrumLabstationGlow.png similarity index 100% rename from Tiles/Furniture/CraftingStations/WulfrumLabstationGlow.png rename to Tiles/FurnitureWulfrum/WulfrumLabstationGlow.png diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.cs b/Tiles/FurnitureWulfrum/WulfrumLantern.cs index 01b9749e60..6ba870244e 100644 --- a/Tiles/FurnitureWulfrum/WulfrumLantern.cs +++ b/Tiles/FurnitureWulfrum/WulfrumLantern.cs @@ -1,32 +1,20 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; -using Terraria.DataStructures; +using Terraria.GameContent.Drawing; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; -using Terraria.ObjectData; namespace CalamityMod.Tiles.FurnitureWulfrum { public class WulfrumLantern : ModTile { - public override void SetStaticDefaults() - { - Main.tileLighted[Type] = true; - Main.tileFrameImportant[Type] = true; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2Top); - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleLineSkip = 2; - TileObjectData.addTile(Type); - AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(251, 235, 127), Language.GetText("MapObject.Lantern")); + public Asset FlameTexture; - TileID.Sets.DisableSmartCursor[Type] = true; - AdjTiles = new int[] { TileID.HangingLanterns }; - } + public override void Load() => FlameTexture = ModContent.Request(Texture + "Flame"); + public override void SetStaticDefaults() => this.SetUpLantern(ModContent.ItemType()); public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) => CalamityUtils.DrawSwayingMultiTile(i, j); public override bool CanExplode(int i, int j) => false; @@ -58,14 +46,24 @@ namespace CalamityMod.Tiles.FurnitureWulfrum } } + public override void GetTileFlameData(int i, int j, ref TileDrawing.TileFlameData tileFlameData) + { + ulong flameSeed = Main.TileFrameSeed ^ (ulong)(((long)i << 32) | (uint)j); + tileFlameData.flameSeed = flameSeed; + tileFlameData.flameTexture = FlameTexture.Value; + tileFlameData.flameColor = new Color(102, 115, 128, 0); + tileFlameData.flameCount = 3; + tileFlameData.flameRangeXMin = -10; + tileFlameData.flameRangeXMax = 11; + tileFlameData.flameRangeYMin = -10; + tileFlameData.flameRangeYMax = 11; + tileFlameData.flameRangeMultX = 0.1f; + tileFlameData.flameRangeMultY = 0.1f; + } + public override void HitWire(int i, int j) { CalamityUtils.LightHitWire(Type, i, j, 1, 3); } - - public override void PostDraw(int i, int j, SpriteBatch spriteBatch) - { - CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumLanternFlame").Value, i, j); - } } } diff --git a/Tiles/FurnitureWulfrum/WulfrumLantern.png b/Tiles/FurnitureWulfrum/WulfrumLantern.png index 4eda4d5984..66521d13f8 100644 Binary files a/Tiles/FurnitureWulfrum/WulfrumLantern.png and b/Tiles/FurnitureWulfrum/WulfrumLantern.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png b/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png index 8a4b6a04cb..efc098ace6 100644 Binary files a/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png and b/Tiles/FurnitureWulfrum/WulfrumLanternFlame.png differ diff --git a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs index b13c236cc4..384d860146 100644 --- a/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs +++ b/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb.cs @@ -98,22 +98,12 @@ namespace CalamityMod.Tiles.FurnitureWulfrum if (Main.tile[i, j].IsTileActuallyInvisible()) return; - float brightness = MathHelper.Clamp(0.2f - (j / 680), 0f, 0.2f); - - float time = Main.GameUpdateCount; - float waveScale1 = time * 0.094f; - int scalar = i - (j / 2); - float wave1 = waveScale1 * -50 + scalar * 12; - float wave1angle = 0.30f + 0.25f * MathF.Sin(MathHelper.ToRadians(wave1)); - - float transparency = 0.05f + wave1angle; - Texture2D tex = ModContent.Request("CalamityMod/Tiles/FurnitureWulfrum/WulfrumWallMountedBulb_Glow").Value; Tile tile = Main.tile[i, j]; Rectangle frame = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); - TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White * transparency, false), default); + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, Color.White, false), default); } public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/Merges/AridSoilMerge.cs b/Tiles/Merges/AridSoilMerge.cs new file mode 100644 index 0000000000..d612d6d2ca --- /dev/null +++ b/Tiles/Merges/AridSoilMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class AridSoilMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/AridSoilMerge.png b/Tiles/Merges/AridSoilMerge.png new file mode 100644 index 0000000000..cdd750fcbf Binary files /dev/null and b/Tiles/Merges/AridSoilMerge.png differ diff --git a/Tiles/Merges/BasaltMerge.cs b/Tiles/Merges/BasaltMerge.cs new file mode 100644 index 0000000000..2bfd887153 --- /dev/null +++ b/Tiles/Merges/BasaltMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class BasaltMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/BasaltMerge.png b/Tiles/Merges/BasaltMerge.png new file mode 100644 index 0000000000..a3a1159043 Binary files /dev/null and b/Tiles/Merges/BasaltMerge.png differ diff --git a/Tiles/Merges/DunesandMerge.cs b/Tiles/Merges/DunesandMerge.cs new file mode 100644 index 0000000000..cecb2171e8 --- /dev/null +++ b/Tiles/Merges/DunesandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class DunesandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/DunesandMerge.png b/Tiles/Merges/DunesandMerge.png new file mode 100644 index 0000000000..53c2ac41f4 Binary files /dev/null and b/Tiles/Merges/DunesandMerge.png differ diff --git a/Tiles/Merges/PolypSandMerge.png b/Tiles/Merges/PolypSandMerge.png index 9b36426426..46df8a4b5b 100644 Binary files a/Tiles/Merges/PolypSandMerge.png and b/Tiles/Merges/PolypSandMerge.png differ diff --git a/Tiles/Merges/RunestoneMerge.png b/Tiles/Merges/RunestoneMerge.png index 084eb1d80a..ed589b1070 100644 Binary files a/Tiles/Merges/RunestoneMerge.png and b/Tiles/Merges/RunestoneMerge.png differ diff --git a/Tiles/Merges/ScarletSeaGrassTileMerge.png b/Tiles/Merges/ScarletSeaGrassTileMerge.png index 9b36426426..46df8a4b5b 100644 Binary files a/Tiles/Merges/ScarletSeaGrassTileMerge.png and b/Tiles/Merges/ScarletSeaGrassTileMerge.png differ diff --git a/Tiles/Merges/ShellstoneMerge.png b/Tiles/Merges/ShellstoneMerge.png index 30e9733f65..1b4e76e78e 100644 Binary files a/Tiles/Merges/ShellstoneMerge.png and b/Tiles/Merges/ShellstoneMerge.png differ diff --git a/Tiles/Merges/SuperheatedObsidian.png b/Tiles/Merges/SuperheatedObsidian.png new file mode 100644 index 0000000000..37c2a0baae Binary files /dev/null and b/Tiles/Merges/SuperheatedObsidian.png differ diff --git a/Tiles/Merges/VolcanicSandMerge.cs b/Tiles/Merges/VolcanicSandMerge.cs new file mode 100644 index 0000000000..24e96261eb --- /dev/null +++ b/Tiles/Merges/VolcanicSandMerge.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Merges +{ + public sealed class VolcanicSandMerge : TileBlendTexture + { + public override int TileType => ModContent.TileType(); + } +} diff --git a/Tiles/Merges/VolcanicSandMerge.png b/Tiles/Merges/VolcanicSandMerge.png new file mode 100644 index 0000000000..860fd97de2 Binary files /dev/null and b/Tiles/Merges/VolcanicSandMerge.png differ diff --git a/Tiles/MonsterBanner.cs b/Tiles/MonsterBanner.cs index a62018f05a..7ec43cdd31 100644 --- a/Tiles/MonsterBanner.cs +++ b/Tiles/MonsterBanner.cs @@ -108,7 +108,7 @@ namespace CalamityMod.Tiles npc = NPCType(); break; case 11: - npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? + npc = NPCType(); // There's also the boss variant but I dont think we want banners to affect them? break; /*case 12: npc = NPCType(); - Formerly Sea Urchin diff --git a/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs index 4f20979f50..d74ef3c0b4 100644 --- a/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/DigitateCoralEcho.cs @@ -15,26 +15,4 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); } } - - public class DigitateCoral2Echo : DigitateCoral2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DigitateCoral2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType()); - FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class DigitateCoral3Echo : DigitateCoral3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DigitateCoral3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType()); - FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } } diff --git a/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs b/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs deleted file mode 100644 index c58f0510f5..0000000000 --- a/Tiles/Rubblemaker/SunkenSea/DriftwoodAmbientEcho.cs +++ /dev/null @@ -1,70 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Rubblemaker.SunkenSea -{ - public class DriftwoodAmbient1Echo : DriftwoodAmbient1 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient1"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - // TODO: Most of these currently don't work - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class DriftwoodAmbient2Echo : DriftwoodAmbient2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient3Echo : DriftwoodAmbient3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient4Echo : DriftwoodAmbient4 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient4"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient5Echo : DriftwoodAmbient5 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient5"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class DriftwoodAmbient6Echo : DriftwoodAmbient6 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodAmbient6"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } -} diff --git a/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs b/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs new file mode 100644 index 0000000000..7143c3c0c4 --- /dev/null +++ b/Tiles/Rubblemaker/SunkenSea/DriftwoodMastEcho.cs @@ -0,0 +1,19 @@ +using CalamityMod.Items.Placeables.FurnitureDriftwood; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Terraria.GameContent; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Rubblemaker.SunkenSea +{ + public class DriftwoodMastEcho : DriftwoodMast + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/DriftwoodMast"; + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + RegisterItemDrop(ModContent.ItemType(), Type, 0); + // TODO: Most of these currently don't work + //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); + } + } +} diff --git a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs index 8f08dada84..7da22c763c 100644 --- a/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/FanCoralEcho.cs @@ -29,12 +29,6 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea base.SetStaticDefaults(); } - public override void NearbyEffects(int i, int j, bool closer) - { - if (!Main.dedServ) - Main.SceneMetrics.ActiveFountainColor = SunkenSeaBurrowsWater.Type; - } - public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 3; @@ -42,9 +36,9 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 225f / 255f; - g = 255f / 255f; - b = 255f / 255f; + r = 0.88f; + g = 1f; + b = 1f; } } } diff --git a/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs index 42a7c79415..e439ebfab5 100644 --- a/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/MediumCoralEcho.cs @@ -11,6 +11,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public class MediumCoralEcho : ModTile { public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/MediumCoral"; + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -28,37 +29,41 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea base.SetStaticDefaults(); } + public override void NumDust(int i, int j, bool fail, ref int num) { num = fail ? 1 : 2; } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 229f / 350f; - g = 137f / 350f; - b = 204f / 350f; + r = 0.65f; + g = 0.39f; + b = 0.58f; } } public class MediumCoral2Echo : MediumCoralEcho { public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/MediumCoral2"; + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 60f / 400f; - g = 110f / 400f; - b = 146f / 400f; + r = 0.15f; + g = 0.28f; + b = 0.37f; } } public class MediumCoral3Echo : MediumCoralEcho { public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/MediumCoral3"; + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 60f / 255f; - g = 110f / 255f; - b = 146f / 255f; + r = 0.24f; + g = 0.43f; + b = 0.57f; } } } diff --git a/Tiles/Rubblemaker/SunkenSea/NavystoneAmbientEcho.cs b/Tiles/Rubblemaker/SunkenSea/NavystoneAmbientEcho.cs deleted file mode 100644 index ce3a96b941..0000000000 --- a/Tiles/Rubblemaker/SunkenSea/NavystoneAmbientEcho.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Rubblemaker.SunkenSea -{ - public class NavystoneAmbientEcho : NavystoneAmbient - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystoneAmbient"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - // TODO: Currently none of these work - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class NavystoneAmbient2Echo : NavystoneAmbient2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystoneAmbient2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class NavystoneAmbient3Echo : NavystoneAmbient3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystoneAmbient3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } -} diff --git a/Tiles/Rubblemaker/SunkenSea/NavystonePileEcho.cs b/Tiles/Rubblemaker/SunkenSea/NavystonePileEcho.cs deleted file mode 100644 index ca7ebf753c..0000000000 --- a/Tiles/Rubblemaker/SunkenSea/NavystonePileEcho.cs +++ /dev/null @@ -1,40 +0,0 @@ -using CalamityMod.Items.Placeables.SunkenSea; -using CalamityMod.Tiles.SunkenSea.Ambient; -using Terraria.GameContent; -using Terraria.ModLoader; - -namespace CalamityMod.Tiles.Rubblemaker.SunkenSea -{ - public class NavystonePile1Echo : NavystonePile1 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystonePile1"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class NavystonePile2Echo : NavystonePile2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystonePile2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class NavystonePile3Echo : NavystonePile3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystonePile3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } -} diff --git a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs index 4818944475..7b2c1d2c68 100644 --- a/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SeaAnemoneEcho.cs @@ -31,18 +31,9 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.4f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 85f / 255f; - b = 151f / 255f; - g = 196f / 255f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.11f; + g = 0.29f; + b = 0.57f; } public override void NumDust(int i, int j, bool fail, ref int num) diff --git a/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs index 845dd954ff..10992efdd5 100644 --- a/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/SmallWideCoralEcho.cs @@ -10,6 +10,7 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea public class SmallWideCoralEcho : ModTile { public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallWideCoral"; + public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; @@ -27,21 +28,24 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea base.SetStaticDefaults(); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 161f / 500f; - g = 183f / 500f; - b = 73f / 500f; + r = 0.32f; + g = 0.37f; + b = 0.15f; } } + public class SmallWideCoral2Echo : SmallWideCoralEcho { public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallWideCoral2"; + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 229f / 700f; - g = 137f / 700f; - b = 204f / 700f; + r = 0.33f; + g = 0.2f; + b = 0.29f; } } } diff --git a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs index 28345f79b5..ebe0e4e805 100644 --- a/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/TableCoralEcho.cs @@ -50,14 +50,4 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea frameYOffset = yPos * subsheetHeight; } } - - public class TableCoralEcho2 : TableCoralEcho - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/TableCoral2"; - } - - public class TableCoralEcho3 : TableCoralEcho - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/TableCoral3"; - } } diff --git a/Tiles/Rubblemaker/SunkenSea/WallCoralEcho.cs b/Tiles/Rubblemaker/SunkenSea/WallCoralEcho.cs index da444b3432..f7ef145f92 100644 --- a/Tiles/Rubblemaker/SunkenSea/WallCoralEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/WallCoralEcho.cs @@ -5,9 +5,9 @@ using Terraria.ModLoader; namespace CalamityMod.Tiles.Rubblemaker.SunkenSea { - public class WallCoral1Echo : WallCoral1 + public class WallCoralEcho : WallCoral { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoral1"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoral"; public override void SetStaticDefaults() { base.SetStaticDefaults(); @@ -17,31 +17,9 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea } } - public class WallCoral2Echo : WallCoral2 + public class WallCoralLeftEcho : WallCoralLeft { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoral2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class WallCoral3Echo : WallCoral3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoral3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - - public class WallCoral4Echo : WallCoral4 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoral4"; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WallCoralLeft"; public override void SetStaticDefaults() { base.SetStaticDefaults(); diff --git a/Tiles/Rubblemaker/SunkenSea/WideScarletSeagrassEcho.cs b/Tiles/Rubblemaker/SunkenSea/WideScarletSeagrassEcho.cs index a4fb5ff53c..6af242ce9a 100644 --- a/Tiles/Rubblemaker/SunkenSea/WideScarletSeagrassEcho.cs +++ b/Tiles/Rubblemaker/SunkenSea/WideScarletSeagrassEcho.cs @@ -16,35 +16,4 @@ namespace CalamityMod.Tiles.Rubblemaker.SunkenSea //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); } } - - public class WideScarletSeagrass2Echo : WideScarletSeagrass2 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WideScarletSeagrass2"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementMedium.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class WideScarletSeagrass3Echo : WideScarletSeagrass3 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WideScarletSeagrass3"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } - public class WideScarletSeagrass4Echo : WideScarletSeagrass4 - { - public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/WideScarletSeagrass4"; - public override void SetStaticDefaults() - { - base.SetStaticDefaults(); - RegisterItemDrop(ModContent.ItemType(), Type, 0); - //FlexibleTileWand.RubblePlacementLarge.AddVariations(ModContent.ItemType(), Type, 0); - } - } } diff --git a/Tiles/SunkenSea/Ambient/BarrelCactus.cs b/Tiles/SunkenSea/Ambient/BarrelCactus.cs new file mode 100644 index 0000000000..dd5fc4c3c3 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/BarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class BarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + Main.tileNoAttach[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + TileObjectData.addTile(Type); + AddMapEntry(new Color(85, 143, 46)); + DustType = DustID.Coralstone; + + base.SetStaticDefaults(); + } + //Bro idk how to make a boulder + } +} diff --git a/Tiles/SunkenSea/Ambient/BarrelCactus.png b/Tiles/SunkenSea/Ambient/BarrelCactus.png new file mode 100644 index 0000000000..7263e82a88 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/BarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/BlueCoralTree.cs b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs index d372bdc268..ab1fceaaf6 100644 --- a/Tiles/SunkenSea/Ambient/BlueCoralTree.cs +++ b/Tiles/SunkenSea/Ambient/BlueCoralTree.cs @@ -33,7 +33,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - // DON'T DO DIVISION HERE, I DON'T CARE ABOUT HOW EASY IT IS TO READ, IT'S DOING DIVISION CALCS EVERY FRAME r = 0.235f; g = 0.431f; b = 0.573f; diff --git a/Tiles/SunkenSea/Ambient/BrainCoral.cs b/Tiles/SunkenSea/Ambient/BrainCoral.cs index c115b322ca..eaf4e4c8ce 100644 --- a/Tiles/SunkenSea/Ambient/BrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/BrainCoral.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,6 +29,26 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + float glowbrightness = 1f; + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float glowspeed = (float)(Main.timeForVisualEffects * 0.01); + glowbrightness *= MathF.Sin(i / 60f + glowspeed); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/BrainCoral").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * glowbrightness; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } public override void NearbyEffects(int i, int j, bool closer) { diff --git a/Tiles/SunkenSea/Ambient/BrainCoral.png b/Tiles/SunkenSea/Ambient/BrainCoral.png index dc87921c20..d4eacc4d10 100644 Binary files a/Tiles/SunkenSea/Ambient/BrainCoral.png and b/Tiles/SunkenSea/Ambient/BrainCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/DepthVines.cs b/Tiles/SunkenSea/Ambient/DepthVines.cs index 01c06706dd..35dc66eb9b 100644 --- a/Tiles/SunkenSea/Ambient/DepthVines.cs +++ b/Tiles/SunkenSea/Ambient/DepthVines.cs @@ -16,7 +16,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; TileID.Sets.IsVine[Type] = true; TileID.Sets.VineThreads[Type] = true; - AddMapEntry(new Color(41, 97, 126)); + AddMapEntry(new Color(48, 106, 100)); DustType = DustID.Grass; HitSound = SoundID.Grass; } @@ -45,9 +45,10 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void RandomUpdate(int i, int j) { Tile tileBelow = Framing.GetTileSafely(i, j + 1); - if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + Tile tile = Framing.GetTileSafely(i, j); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) { - bool PlaceVine = false; + bool PlaceVine = false; int Test = j; while (Test > j - 10) { @@ -56,7 +57,7 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { break; } - else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType() && tile.LiquidType == LiquidID.Water) { Test--; continue; @@ -74,6 +75,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); } } + + } } } diff --git a/Tiles/SunkenSea/Ambient/DigitateCoral.cs b/Tiles/SunkenSea/Ambient/DigitateCoral.cs index b2255c8d13..04340a1671 100644 --- a/Tiles/SunkenSea/Ambient/DigitateCoral.cs +++ b/Tiles/SunkenSea/Ambient/DigitateCoral.cs @@ -17,6 +17,11 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileLighted[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); TileObjectData.newTile.DrawYOffset = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.addTile(Type); AddMapEntry(new Color(48, 201, 214)); DustType = DustID.IceGolem; @@ -36,24 +41,4 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient b = 0.45f; } } - - public class DigitateCoral2 : DigitateCoral - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.14f; - g = 0.41f; - b = 0.45f; - } - } - - public class DigitateCoral3 : DigitateCoral - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.14f; - g = 0.41f; - b = 0.45f; - } - } } diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs deleted file mode 100644 index ad72942421..0000000000 --- a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.cs +++ /dev/null @@ -1,142 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.SunkenSea.Ambient -{ - public class DriftwoodAmbient1 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 4); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient2 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 4; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient4 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient5 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 5; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } - - public class DriftwoodAmbient6 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(146, 123, 127)); - DustType = DustID.Shadewood_Tree; - HitSound = SoundID.Dig; - } - } -} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png deleted file mode 100644 index ed3ac19385..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png deleted file mode 100644 index 4b1ae8d4cc..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png deleted file mode 100644 index b786e79bc1..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png deleted file mode 100644 index 528c3ab92b..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient4.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png deleted file mode 100644 index 498e6e8bd4..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient5.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png b/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png deleted file mode 100644 index a723c9116b..0000000000 Binary files a/Tiles/SunkenSea/Ambient/DriftwoodAmbient6.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodMast.cs b/Tiles/SunkenSea/Ambient/DriftwoodMast.cs new file mode 100644 index 0000000000..2279a2049b --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodMast.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodMast : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.newTile.DrawYOffset = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodMast.png b/Tiles/SunkenSea/Ambient/DriftwoodMast.png new file mode 100644 index 0000000000..2965c8e880 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodMast.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs b/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs new file mode 100644 index 0000000000..523a619eae --- /dev/null +++ b/Tiles/SunkenSea/Ambient/DriftwoodScraps.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class DriftwoodScraps : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16,}; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 2); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.newTile.DrawYOffset = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/DriftwoodScraps.png b/Tiles/SunkenSea/Ambient/DriftwoodScraps.png new file mode 100644 index 0000000000..7eb6e171a3 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodScraps.png differ diff --git a/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png new file mode 100644 index 0000000000..503b002088 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/DriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/FanCoral.cs b/Tiles/SunkenSea/Ambient/FanCoral.cs index d30e52a39e..73190388c9 100644 --- a/Tiles/SunkenSea/Ambient/FanCoral.cs +++ b/Tiles/SunkenSea/Ambient/FanCoral.cs @@ -23,11 +23,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient base.SetStaticDefaults(); } - public override void NearbyEffects(int i, int j, bool closer) - { - if (!Main.dedServ) - Main.SceneMetrics.ActiveFountainColor = SunkenSeaBurrowsWater.Type; - } public override void NumDust(int i, int j, bool fail, ref int num) { @@ -36,9 +31,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.882f; - g = 1f; - b = 1f; + r = 0.1f; + g = 0.3f; + b = 0.4f; } } } diff --git a/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs new file mode 100644 index 0000000000..7aa5ca14ee --- /dev/null +++ b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.cs @@ -0,0 +1,35 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.DataStructures; +using Terraria.Enums; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Humanizer; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class FloweringBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.Origin = new Point16(1, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.DrawYOffset = 3; + TileObjectData.addTile(Type); + AddMapEntry(new Color(163, 24, 21)); + DustType = 155; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png new file mode 100644 index 0000000000..fa1ef4ab8c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/FloweringBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/GilHerb.cs b/Tiles/SunkenSea/Ambient/GilHerb.cs new file mode 100644 index 0000000000..3d3b6415cc --- /dev/null +++ b/Tiles/SunkenSea/Ambient/GilHerb.cs @@ -0,0 +1,79 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class GilHerb : ModTile + { + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileSolid[Type] = false; + Main.tileNoFail[Type] = true; + Main.tileNoAttach[Type] = true; + TileID.Sets.IsVine[Type] = true; + TileID.Sets.VineThreads[Type] = true; + AddMapEntry(new Color(124, 67, 197)); + DustType = DustID.Grass; + HitSound = SoundID.Grass; + } + + public override void KillTile(int i, int j, ref bool fail, ref bool effectOnly, ref bool noItem) + { + Tile tile = Framing.GetTileSafely(i, j + 1); + if (tile.HasTile && tile.TileType == Type) + WorldGen.KillTile(i, j + 1); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + Tile tileAbove = Framing.GetTileSafely(i, j - 1); + int type = -1; + if (tileAbove.HasTile && !tileAbove.BottomSlope) + type = tileAbove.TileType; + + if (type == ModContent.TileType() || type == Type) + return true; + + WorldGen.KillTile(i, j); + return true; + } + + public override void RandomUpdate(int i, int j) + { + Tile tileBelow = Framing.GetTileSafely(i, j + 1); + if (WorldGen.genRand.NextBool(5) && !tileBelow.HasTile && tileBelow.LiquidType != LiquidID.Lava) + { + bool PlaceVine = false; + int Test = j; + while (Test > j - 10) + { + Tile testTile = Framing.GetTileSafely(i, Test); + if (testTile.BottomSlope) + { + break; + } + else if (!testTile.HasTile || testTile.TileType != ModContent.TileType()) + { + Test--; + continue; + } + PlaceVine = true; + break; + } + + if (PlaceVine) + { + tileBelow.TileType = Type; + tileBelow.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } +} diff --git a/Tiles/SunkenSea/Ambient/GilHerb.png b/Tiles/SunkenSea/Ambient/GilHerb.png new file mode 100644 index 0000000000..5f73fb2918 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/GilHerb.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs new file mode 100644 index 0000000000..d93b10fd7b --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(85, 143, 46)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png new file mode 100644 index 0000000000..c5a96b33b2 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs new file mode 100644 index 0000000000..75874e0904 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeDriftwoodWreckage : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style5x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 4); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 6; + TileObjectData.newTile.RandomStyleRange = 6; + + TileObjectData.newTile.DrawYOffset = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(146, 123, 127)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png new file mode 100644 index 0000000000..e71f8608c7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeDriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs new file mode 100644 index 0000000000..2562e1c8e9 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeFloweringBarrelCactus : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x4); + + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Origin = new Point16(1, 3); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 2; + TileObjectData.newTile.RandomStyleRange = 2; + + TileObjectData.addTile(Type); + AddMapEntry(new Color(163, 24, 21)); + DustType = DustID.Shadewood_Tree; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png new file mode 100644 index 0000000000..4796754896 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeFloweringBarrelCactus.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs b/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs new file mode 100644 index 0000000000..50bdf1c778 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/LargeShoresFlower.cs @@ -0,0 +1,68 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class LargeShoresFlower : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileLighted[Type] = true; + + TileID.Sets.FramesOnKillWall[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3Wall); + + TileObjectData.newTile.Width = 3; + TileObjectData.newTile.Height = 3; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.Origin = new Point16(1, 1); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(20, 100, 220)); + DustType = DustID.MagicMirror; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float pulse = 0.95f + 0.15f * (0.5f + 0.5f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + r = 0.1f * pulse; + g = 0.3f * pulse; + b = 0.8f * pulse; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float pulse = 0.95f + 0.15f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/LargeShoresFlower").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * pulse; + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center").Value, i, j, 2); + } + } +} diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower.png b/Tiles/SunkenSea/Ambient/LargeShoresFlower.png new file mode 100644 index 0000000000..9c040277a7 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeShoresFlower.png differ diff --git a/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png b/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png new file mode 100644 index 0000000000..b907c78161 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/LargeShoresFlower_Center.png differ diff --git a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs index 31659dbcdb..3d6b793b2a 100644 --- a/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs +++ b/Tiles/SunkenSea/Ambient/LongScarletSeagrass.cs @@ -42,21 +42,6 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient height = 48; } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.4f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.733f; - g = 0.169f; - b = 0.173f; - r *= brightness; - g *= brightness; - b *= brightness; - } public override void AnimateTile(ref int frame, ref int frameCounter) { if (++frameCounter >= 12) diff --git a/Tiles/SunkenSea/Ambient/MediumCoral.cs b/Tiles/SunkenSea/Ambient/MediumCoral.cs index 3cd9962467..cfbc62a123 100644 --- a/Tiles/SunkenSea/Ambient/MediumCoral.cs +++ b/Tiles/SunkenSea/Ambient/MediumCoral.cs @@ -31,9 +31,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.654f; - g = 0.391f; - b = 0.583f; + r = 0.38f; + g = 0.28f; + b = 0.32f; } } @@ -42,8 +42,8 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.15f; - g = 0.275f; - b = 0.365f; + g = 0.37f; + b = 0.46f; } } @@ -51,9 +51,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - r = 0.235f; - g = 0.431f; - b = 0.573f; + r = 0.23f; + g = 0.43f; + b = 0.57f; } } } diff --git a/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png b/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png new file mode 100644 index 0000000000..3038646c27 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumDriftwoodWreckage.png differ diff --git a/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs b/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs new file mode 100644 index 0000000000..909aee6412 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/MediumDunesandPile.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class MediumDunesandPile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(185, 104, 80)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/MediumDunesandPile.png b/Tiles/SunkenSea/Ambient/MediumDunesandPile.png new file mode 100644 index 0000000000..e58ff96cd4 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumDunesandPile.png differ diff --git a/Tiles/SunkenSea/Ambient/MediumShorePile.cs b/Tiles/SunkenSea/Ambient/MediumShorePile.cs new file mode 100644 index 0000000000..4743988be3 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/MediumShorePile.cs @@ -0,0 +1,42 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class MediumShorePile : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileSolid[Type] = false; + Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.Origin = new Point16(2, 2); + TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(158, 129, 177)); + DustType = DustID.BlueMoss; + HitSound = SoundID.Dig; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/MediumShorePile.png b/Tiles/SunkenSea/Ambient/MediumShorePile.png new file mode 100644 index 0000000000..bc84d45181 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/MediumShorePile.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs b/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs deleted file mode 100644 index 34beee3454..0000000000 --- a/Tiles/SunkenSea/Ambient/NavystoneAmbient.cs +++ /dev/null @@ -1,76 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.DataStructures; -using Terraria.Enums; -using Terraria.ID; -using Terraria.ModLoader; -using Terraria.ObjectData; - -namespace CalamityMod.Tiles.SunkenSea.Ambient -{ - public class NavystoneAmbient : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(59, 136, 146)); - DustType = DustID.BlueMoss; - HitSound = SoundID.Dig; - } - } - - public class NavystoneAmbient2 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(59, 136, 146)); - DustType = DustID.BlueMoss; - HitSound = SoundID.Dig; - } - } - - public class NavystoneAmbient3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - TileObjectData.newTile.Width = 3; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(59, 136, 146)); - DustType = DustID.BlueMoss; - HitSound = SoundID.Dig; - } - } -} diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient.png deleted file mode 100644 index 9b93ad7195..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystoneAmbient.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png deleted file mode 100644 index 08f3a3845b..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystoneAmbient2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png b/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png deleted file mode 100644 index 891b37d87d..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystoneAmbient3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile.cs b/Tiles/SunkenSea/Ambient/NavystonePile.cs index 73fa99d2ba..c40d5a1f53 100644 --- a/Tiles/SunkenSea/Ambient/NavystonePile.cs +++ b/Tiles/SunkenSea/Ambient/NavystonePile.cs @@ -3,28 +3,43 @@ using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; using Microsoft.Xna.Framework; +using Terraria.GameContent; namespace CalamityMod.Tiles.SunkenSea.Ambient { - public class NavystonePile1 : ModTile + public class NavystonePileBase : ModTile { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileNoAttach[Type] = true; + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/NavystonePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); + + AddMapEntry(new Color(0, 62, 84)); DustType = 96; HitSound = SoundID.Dig; - } - } + } + } - public class NavystonePile2 : NavystonePile1 - { - } + public class NavystonePile : NavystonePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); - public class NavystonePile3 : NavystonePile1 - { - } + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } } diff --git a/Tiles/SunkenSea/Ambient/NavystonePile.png b/Tiles/SunkenSea/Ambient/NavystonePile.png new file mode 100644 index 0000000000..7c1c723b2b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/NavystonePile.png differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile1.png b/Tiles/SunkenSea/Ambient/NavystonePile1.png deleted file mode 100644 index 45709a1865..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePile1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile2.png b/Tiles/SunkenSea/Ambient/NavystonePile2.png deleted file mode 100644 index a3ff914034..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePile2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePile3.png b/Tiles/SunkenSea/Ambient/NavystonePile3.png deleted file mode 100644 index 73fa4a8fa4..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePile3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png deleted file mode 100644 index d4e121013f..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePileSmall1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png deleted file mode 100644 index e47f6e8a47..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePileSmall2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png b/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png deleted file mode 100644 index 3892fee61c..0000000000 Binary files a/Tiles/SunkenSea/Ambient/NavystonePileSmall3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs index 229c3fc952..0604b3e416 100644 --- a/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs +++ b/Tiles/SunkenSea/Ambient/RefractiveHangingCoral.cs @@ -12,13 +12,14 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void SetStaticDefaults() { Main.tileCut[Type] = true; + Main.tileLighted[Type] = true; Main.tileSolid[Type] = false; Main.tileNoFail[Type] = true; Main.tileNoAttach[Type] = true; Main.tileNoSunLight[Type] = false; TileID.Sets.IsVine[Type] = true; TileID.Sets.VineThreads[Type] = true; - AddMapEntry(new Color(96, 109, 154)); + AddMapEntry(new Color(76, 133, 191)); DustType = DustID.Grass; HitSound = SoundID.Grass; } @@ -65,13 +66,13 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient // Quite possibly some of the laggiest calculations I've ever seen float brightness = 0.9f; brightness *= (float)MathF.Sin(-j / 40f + Main.GameUpdateCount * 0.01f + i); - Color lilac = new Color(236, 194, 252); - Color mint = new Color(163, 252, 195); + Color lilac = new Color(126, 94, 252); + Color mint = new Color(96, 252, 186); Color value = Color.Lerp(lilac, mint, (MathF.Sin(j / 30f + Main.GameUpdateCount * 0.017f + -i / 40f) + 1f) / 2f); Color value1 = Color.Lerp(lilac, mint, (MathF.Sin((-j - 100) / 40f + Main.GameUpdateCount * 0.014f + i / 20f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; + r = (value.R + value1.R) / 450f; + g = (value.G + value1.G) / 450f; + b = (value.B + value1.B) / 450f; r *= brightness; g *= brightness; b *= brightness; diff --git a/Tiles/SunkenSea/Ambient/SeaAnemone.cs b/Tiles/SunkenSea/Ambient/SeaAnemone.cs index 2f910c9339..1b26664232 100644 --- a/Tiles/SunkenSea/Ambient/SeaAnemone.cs +++ b/Tiles/SunkenSea/Ambient/SeaAnemone.cs @@ -31,18 +31,9 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.4f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.333f; - b = 0.592f; - g = 0.769f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.11f; + g = 0.29f; + b = 0.57f; } public override void AnimateTile(ref int frame, ref int frameCounter) diff --git a/Tiles/SunkenSea/Ambient/ShorePile.cs b/Tiles/SunkenSea/Ambient/ShorePile.cs new file mode 100644 index 0000000000..4dd8fca547 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/ShorePile.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria.GameContent; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class ShorePileBase : ModTile + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/ShorePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + + AddMapEntry(new Color(189, 120, 94)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class ShorePile : ShorePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/ShorePile.png b/Tiles/SunkenSea/Ambient/ShorePile.png new file mode 100644 index 0000000000..b9d0c26efd Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShorePile.png differ diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower.cs b/Tiles/SunkenSea/Ambient/ShoresFlower.cs new file mode 100644 index 0000000000..5c276682b0 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/ShoresFlower.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class ShoresFlower : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileLighted[Type] = true; + + TileID.Sets.FramesOnKillWall[Type] = true; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); + TileObjectData.newTile.Width = 2; + TileObjectData.newTile.Height = 2; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16 }; + + TileObjectData.newTile.AnchorWall = true; + TileObjectData.newTile.AnchorTop = AnchorData.Empty; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = AnchorData.Empty; + + TileObjectData.newTile.Origin = new Point16(1, 1); + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(20, 100, 220)); + DustType = DustID.MagicMirror; + } + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + float pulse = 0.95f + 0.15f * (0.5f + 0.5f * (float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + r = 0.1f * pulse; + g = 0.3f * pulse; + b = 0.8f * pulse; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float pulse = 0.95f + 0.15f * ((float)System.Math.Sin(Main.GlobalTimeWrappedHourly * 4.2f)); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/ShoresFlower").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * pulse; + Tile trackTile = Main.tile[i, j]; + + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + + CalamityUtils.DrawFlameEffect(ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/ShoresFlower_Center").Value, i, j, 2); + } + } +} diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower.png b/Tiles/SunkenSea/Ambient/ShoresFlower.png new file mode 100644 index 0000000000..6ae51dd2ac Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShoresFlower.png differ diff --git a/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png b/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png new file mode 100644 index 0000000000..ccc3c4061c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/ShoresFlower_Center.png differ diff --git a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs index 85db49466c..b666e44459 100644 --- a/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs +++ b/Tiles/SunkenSea/Ambient/SmallBrainCoral.cs @@ -1,5 +1,7 @@ -using CalamityMod.Projectiles.Typeless; +using System; +using CalamityMod.Projectiles.Typeless; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; using Terraria.ID; @@ -27,6 +29,26 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { num = fail ? 1 : 3; } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + float glowbrightness = 1f; + if (Main.tile[i, j].IsTileActuallyInvisible()) + return; + float glowspeed = (float)(Main.timeForVisualEffects * 0.01); + glowbrightness *= MathF.Sin(i / 60f + glowspeed); + + int xFrameOffset = Main.tile[i, j].TileFrameX; + int yFrameOffset = Main.tile[i, j].TileFrameY; + Texture2D glowmask = ModContent.Request("CalamityMod/Tiles/SunkenSea/Ambient/SmallBrainCoral").Value; + Vector2 drawOffest = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 drawPosition = new Vector2(i * 16 - Main.screenPosition.X, j * 16 - Main.screenPosition.Y) + drawOffest; + Color drawColour = Color.White * glowbrightness; + Tile trackTile = Main.tile[i, j]; + if (!trackTile.IsHalfBlock && trackTile.Slope == 0) + spriteBatch.Draw(glowmask, drawPosition, new Rectangle(xFrameOffset, yFrameOffset, 18, 18), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + else if (trackTile.IsHalfBlock) + spriteBatch.Draw(glowmask, drawPosition + new Vector2(0f, 8f), new Rectangle(xFrameOffset, yFrameOffset, 18, 8), drawColour, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); + } public override void NearbyEffects(int i, int j, bool closer) { diff --git a/Tiles/SunkenSea/Ambient/SmallBrainCoral.png b/Tiles/SunkenSea/Ambient/SmallBrainCoral.png index 31de0f162e..43ba546b88 100644 Binary files a/Tiles/SunkenSea/Ambient/SmallBrainCoral.png and b/Tiles/SunkenSea/Ambient/SmallBrainCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/SmallCorals.cs b/Tiles/SunkenSea/Ambient/SmallCorals.cs index 59b04ec364..3754230dde 100644 --- a/Tiles/SunkenSea/Ambient/SmallCorals.cs +++ b/Tiles/SunkenSea/Ambient/SmallCorals.cs @@ -10,45 +10,52 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient { public override void SetStaticDefaults() { - Main.tileLighted[Type] = false; - Main.tileCut[Type] = false; - Main.tileSolid[Type] = false; - Main.tileNoAttach[Type] = true; + Main.tileLighted[Type] = true; Main.tileNoFail[Type] = true; - Main.tileLavaDeath[Type] = true; - Main.tileWaterDeath[Type] = false; Main.tileFrameImportant[Type] = true; - TileID.Sets.ReplaceTileBreakUp[Type] = true; - TileID.Sets.SwaysInWindBasic[Type] = false; - TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); - TileObjectData.addTile(Type); + Main.tileObsidianKill[Type] = true; AddMapEntry(new Color(178, 28, 153)); DustType = DustID.Coralstone; HitSound = SoundID.Grass; - - base.SetStaticDefaults(); } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) - { - Tile tileBelow = Framing.GetTileSafely(i, j + 1); - int type = -1; - - if (tileBelow.HasTile) - type = tileBelow.TileType; - - if (type == ModContent.TileType()) - return true; - - WorldGen.KillTile(i, j); - - return true; - } - - public override void SetDrawPositions(int i, int j, ref int width, ref int offsetY, ref int height, ref short tileFrameX, ref short tileFrameY) + public override void NumDust(int i, int j, bool fail, ref int num) { - offsetY = 0; - height = 16; + num = fail ? 1 : 3; + } + + public override bool CanPlace(int i, int j) + { + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if ((belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) || + (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) || + (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) || + (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid())) + return true; + + return false; + } + public override void PlaceInWorld(int i, int j, Item item) + { + Tile belowTile = Main.tile[i, j + 1]; + Tile aboveTile = Main.tile[i, j - 1]; + Tile rightTile = Main.tile[i + 1, j]; + Tile leftTile = Main.tile[i - 1, j]; + + if (belowTile.Slope == SlopeType.Solid && !belowTile.IsHalfBlock && belowTile.HasTile && belowTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 0; + else if (aboveTile.Slope == SlopeType.Solid && !aboveTile.IsHalfBlock && aboveTile.HasTile && aboveTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 18; + else if (rightTile.Slope == SlopeType.Solid && !rightTile.IsHalfBlock && rightTile.HasTile && rightTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 36; + else if (leftTile.Slope == SlopeType.Solid && !leftTile.IsHalfBlock && leftTile.HasTile && leftTile.IsTileSolid()) + Main.tile[i, j].TileFrameY = 54; + + Main.tile[i, j].TileFrameX = (short)(WorldGen.genRand.Next(18) * 18); } } } diff --git a/Tiles/SunkenSea/Ambient/SmallCorals.png b/Tiles/SunkenSea/Ambient/SmallCorals.png index 1aa6601be7..796b5ab8ed 100644 Binary files a/Tiles/SunkenSea/Ambient/SmallCorals.png and b/Tiles/SunkenSea/Ambient/SmallCorals.png differ diff --git a/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs new file mode 100644 index 0000000000..0341b9a4f4 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria.GameContent; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class SmallLimestoneCobblePileBase : ModTile + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + + AddMapEntry(new Color(174, 120, 91)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class SmallLimestoneCobblePile : SmallLimestoneCobblePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png new file mode 100644 index 0000000000..21b14f9f2c Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SmallLimestoneCobblePile.png differ diff --git a/Tiles/SunkenSea/Ambient/SmallNavystonePile.cs b/Tiles/SunkenSea/Ambient/SmallNavystonePile.cs new file mode 100644 index 0000000000..7e4c5e11de --- /dev/null +++ b/Tiles/SunkenSea/Ambient/SmallNavystonePile.cs @@ -0,0 +1,45 @@ +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Microsoft.Xna.Framework; +using Terraria.GameContent; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class SmallNavystonePileBase : ModTile + { + public override string Texture => "CalamityMod/Tiles/SunkenSea/Ambient/SmallNavystonePile"; + + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileObsidianKill[Type] = true; + + DustType = DustID.Stone; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style2x1); + TileObjectData.newTile.DrawYOffset = 2; + TileObjectData.addTile(Type); + + + AddMapEntry(new Color(0, 62, 84)); + DustType = 96; + HitSound = SoundID.Dig; + } + } + + public class SmallNavystonePile : NavystonePileBase + { + public override void SetStaticDefaults() + { + base.SetStaticDefaults(); + + TileID.Sets.BreakableWhenPlacing[Type] = true; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + + TileObjectData.GetTileData(Type, 0).LavaDeath = false; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/SmallNavystonePile.png b/Tiles/SunkenSea/Ambient/SmallNavystonePile.png new file mode 100644 index 0000000000..3cf17393f8 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SmallNavystonePile.png differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs b/Tiles/SunkenSea/Ambient/SmallSunkenStalactites.cs similarity index 76% rename from Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs rename to Tiles/SunkenSea/Ambient/SmallSunkenStalactites.cs index 8200dfda84..840b027776 100644 --- a/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.cs +++ b/Tiles/SunkenSea/Ambient/SmallSunkenStalactites.cs @@ -11,7 +11,7 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea.Ambient { - public class SunkenStalactitesSmall : ModTile + public class SmallSunkenStalactites : ModTile { public override void SetStaticDefaults() { @@ -20,6 +20,10 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.png b/Tiles/SunkenSea/Ambient/SmallSunkenStalactites.png similarity index 100% rename from Tiles/SunkenSea/Ambient/SunkenStalactitesSmall.png rename to Tiles/SunkenSea/Ambient/SmallSunkenStalactites.png diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs b/Tiles/SunkenSea/Ambient/SmallSunkenStalagmites.cs similarity index 72% rename from Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs rename to Tiles/SunkenSea/Ambient/SmallSunkenStalagmites.cs index e38fa0a231..d0c1045bc6 100644 --- a/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.cs +++ b/Tiles/SunkenSea/Ambient/SmallSunkenStalagmites.cs @@ -11,13 +11,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea.Ambient { - public class SunkenStalagmitesSmall : ModTile + public class SmallSunkenStalagmites : ModTile { public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.png b/Tiles/SunkenSea/Ambient/SmallSunkenStalagmites.png similarity index 100% rename from Tiles/SunkenSea/Ambient/SunkenStalagmitesSmall.png rename to Tiles/SunkenSea/Ambient/SmallSunkenStalagmites.png diff --git a/Tiles/SunkenSea/Ambient/SunkenShip.cs b/Tiles/SunkenSea/Ambient/SunkenShip.cs new file mode 100644 index 0000000000..d32f8472c6 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/SunkenShip.cs @@ -0,0 +1,41 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; +using Terraria.ObjectData; +using Terraria.Enums; +using Terraria.DataStructures; +using Terraria.Localization; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class SunkenShip : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileBlockLight[Type] = false; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style1x1); + TileObjectData.newTile.Width = 14; + TileObjectData.newTile.Height = 8; + TileObjectData.newTile.Origin = new Point16(7, 7); + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16, 16, 16, 16, 16, 16 }; + TileObjectData.newTile.AnchorBottom = new AnchorData( + AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, 14, 0); + + TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); + + TileObjectData.addTile(Type); + + AddMapEntry(new Color(100, 80, 70), Language.GetText("Sunken Ship")); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/SunkenShip.png b/Tiles/SunkenSea/Ambient/SunkenShip.png new file mode 100644 index 0000000000..496c1e2555 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SunkenShip.png differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactite1.png b/Tiles/SunkenSea/Ambient/SunkenStalactite1.png deleted file mode 100644 index 3ee3027221..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalactite1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactite2.png b/Tiles/SunkenSea/Ambient/SunkenStalactite2.png deleted file mode 100644 index 9dfc38af8f..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalactite2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactite3.png b/Tiles/SunkenSea/Ambient/SunkenStalactite3.png deleted file mode 100644 index 645ea59c1f..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalactite3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalactite.cs b/Tiles/SunkenSea/Ambient/SunkenStalactites.cs similarity index 77% rename from Tiles/SunkenSea/Ambient/SunkenStalactite.cs rename to Tiles/SunkenSea/Ambient/SunkenStalactites.cs index ab84ff433c..8ba532904f 100644 --- a/Tiles/SunkenSea/Ambient/SunkenStalactite.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalactites.cs @@ -11,8 +11,7 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea.Ambient { - [LegacyName("SunkenStalactites")] - public class SunkenStalactite1 : ModTile + public class SunkenStalactites : ModTile { public override void SetStaticDefaults() { @@ -21,6 +20,10 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); TileObjectData.newTile.AnchorTop = new AnchorData(AnchorType.SolidTile, TileObjectData.newTile.Width, 0); TileObjectData.newTile.AnchorBottom = default(AnchorData); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.DrawYOffset = -2; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); @@ -28,12 +31,4 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient base.SetStaticDefaults(); } } - - public class SunkenStalactite2 : SunkenStalactite1 - { - } - - public class SunkenStalactite3 : SunkenStalactite1 - { - } } diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmite1.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite1.png deleted file mode 100644 index aae38d97d3..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalagmite1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmite2.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite2.png deleted file mode 100644 index 5f17363111..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalagmite2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmite3.png b/Tiles/SunkenSea/Ambient/SunkenStalagmite3.png deleted file mode 100644 index 532fe794b6..0000000000 Binary files a/Tiles/SunkenSea/Ambient/SunkenStalagmite3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmite.cs b/Tiles/SunkenSea/Ambient/SunkenStalagmites.cs similarity index 72% rename from Tiles/SunkenSea/Ambient/SunkenStalagmite.cs rename to Tiles/SunkenSea/Ambient/SunkenStalagmites.cs index 43fc2022a2..c175f8331b 100644 --- a/Tiles/SunkenSea/Ambient/SunkenStalagmite.cs +++ b/Tiles/SunkenSea/Ambient/SunkenStalagmites.cs @@ -11,14 +11,17 @@ using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea.Ambient { - [LegacyName("SunkenStalagmites")] - public class SunkenStalagmite1 : ModTile + public class SunkenStalagmites : ModTile { public override void SetStaticDefaults() { Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; TileObjectData.newTile.CopyFrom(TileObjectData.Style1x2); + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + TileObjectData.newTile.DrawYOffset = 2; TileObjectData.addTile(Type); DustType = 253; AddMapEntry(new Color(31, 92, 114)); @@ -26,12 +29,4 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient base.SetStaticDefaults(); } } - - public class SunkenStalagmite2 : SunkenStalagmite1 - { - } - - public class SunkenStalagmite3 : SunkenStalagmite1 - { - } } diff --git a/Tiles/SunkenSea/Ambient/SunkenStalagmites.png b/Tiles/SunkenSea/Ambient/SunkenStalagmites.png new file mode 100644 index 0000000000..83424a46f6 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/SunkenStalagmites.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral.cs b/Tiles/SunkenSea/Ambient/TableCoral.cs index 8d2c9bd58d..bce49ca9f4 100644 --- a/Tiles/SunkenSea/Ambient/TableCoral.cs +++ b/Tiles/SunkenSea/Ambient/TableCoral.cs @@ -15,18 +15,18 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileFrameImportant[Type] = true; Main.tileNoAttach[Type] = true; Main.tileSolidTop[Type] = true; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); - TileObjectData.newTile.StyleMultiplier = 2; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.newAlternate.Direction = TileObjectDirection.PlaceRight; - TileObjectData.addAlternate(1); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + TileObjectData.newTile.DrawXOffset = 2; TileObjectData.addTile(Type); + DustType = 253; - AddMapEntry(new Color(54, 69, 72)); + AddMapEntry(new Color(23, 56, 75)); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -34,12 +34,4 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient num = fail ? 1 : 3; } } - - public class TableCoral2 : TableCoral - { - } - - public class TableCoral3 : TableCoral - { - } } diff --git a/Tiles/SunkenSea/Ambient/TableCoral.png b/Tiles/SunkenSea/Ambient/TableCoral.png index 45ea42abfd..be8d875999 100644 Binary files a/Tiles/SunkenSea/Ambient/TableCoral.png and b/Tiles/SunkenSea/Ambient/TableCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral2.png b/Tiles/SunkenSea/Ambient/TableCoral2.png deleted file mode 100644 index 90c37eaa63..0000000000 Binary files a/Tiles/SunkenSea/Ambient/TableCoral2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/TableCoral3.png b/Tiles/SunkenSea/Ambient/TableCoral3.png deleted file mode 100644 index 4b9b83df62..0000000000 Binary files a/Tiles/SunkenSea/Ambient/TableCoral3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/TableCoralLeft.cs b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs new file mode 100644 index 0000000000..c8ce04485a --- /dev/null +++ b/Tiles/SunkenSea/Ambient/TableCoralLeft.cs @@ -0,0 +1,38 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class TableCoralLeft : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSolidTop[Type] = true; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 3; + TileObjectData.newTile.RandomStyleRange = 3; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x2); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.DrawXOffset = -2; + TileObjectData.addTile(Type); + + DustType = 253; + AddMapEntry(new Color(23, 56, 75)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/Ambient/TableCoralLeft.png b/Tiles/SunkenSea/Ambient/TableCoralLeft.png new file mode 100644 index 0000000000..e107da9ede Binary files /dev/null and b/Tiles/SunkenSea/Ambient/TableCoralLeft.png differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral.cs b/Tiles/SunkenSea/Ambient/WallCoral.cs index 346747394c..10c7af2a3e 100644 --- a/Tiles/SunkenSea/Ambient/WallCoral.cs +++ b/Tiles/SunkenSea/Ambient/WallCoral.cs @@ -2,13 +2,12 @@ using Terraria; using Terraria.DataStructures; using Terraria.Enums; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; namespace CalamityMod.Tiles.SunkenSea.Ambient { - public class WallCoral1 : ModTile + public class WallCoral : ModTile { public override void SetStaticDefaults() { @@ -16,57 +15,30 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileNoAttach[Type] = true; Main.tileSolidTop[Type] = false; Main.tileLighted[Type] = true; + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.None, 0, 0); - TileObjectData.newAlternate.CopyFrom(TileObjectData.newTile); - TileObjectData.newAlternate.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); - TileObjectData.addAlternate(1); - TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.Origin = new Point16(1, 1); + + TileObjectData.newTile.AnchorTop = AnchorData.Empty; + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = AnchorData.Empty; + TileObjectData.newTile.AnchorRight = new AnchorData(AnchorType.SolidTile, 3, 0); + TileObjectData.newTile.Direction = TileObjectDirection.PlaceLeft; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 4; + TileObjectData.newTile.RandomStyleRange = 4; + TileObjectData.newTile.CoordinateHeights = new[] { 16, 16, 16 }; + TileObjectData.newTile.CoordinateWidth = 16; + TileObjectData.newTile.CoordinatePadding = 2; + TileObjectData.newTile.DrawXOffset = 2; + TileObjectData.addTile(Type); + DustType = 253; AddMapEntry(new Color(54, 69, 72)); } - public override void NumDust(int i, int j, bool fail, ref int num) - { - num = fail ? 1 : 3; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.42f; - g = 0.16f; - b = 0.16f; - } - } - - public class WallCoral2 : WallCoral1 - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.213f; - g = 0.349f; - b = 0.416f; - } - } - - public class WallCoral3 : WallCoral1 - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.151f; - g = 0.342f; - b = 0.284f; - } - } - - public class WallCoral4 : WallCoral1 - { - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - r = 0.458f; - g = 0.196f; - b = 0.387f; - } + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Tiles/SunkenSea/Ambient/WallCoral.png b/Tiles/SunkenSea/Ambient/WallCoral.png new file mode 100644 index 0000000000..6ef197c60b Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoral.png differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral1.png b/Tiles/SunkenSea/Ambient/WallCoral1.png deleted file mode 100644 index 5efc01eaec..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WallCoral1.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral2.png b/Tiles/SunkenSea/Ambient/WallCoral2.png deleted file mode 100644 index ab007eeb0f..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WallCoral2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral3.png b/Tiles/SunkenSea/Ambient/WallCoral3.png deleted file mode 100644 index c5017e1401..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WallCoral3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WallCoral4.png b/Tiles/SunkenSea/Ambient/WallCoral4.png deleted file mode 100644 index 901f50fcdb..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WallCoral4.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WallCoralLeft.cs b/Tiles/SunkenSea/Ambient/WallCoralLeft.cs new file mode 100644 index 0000000000..7bd84d49d0 --- /dev/null +++ b/Tiles/SunkenSea/Ambient/WallCoralLeft.cs @@ -0,0 +1,36 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.Enums; +using Terraria.ModLoader; +using Terraria.ObjectData; + +namespace CalamityMod.Tiles.SunkenSea.Ambient +{ + public class WallCoralLeft : ModTile + { + public override void SetStaticDefaults() + { + Main.tileFrameImportant[Type] = true; + Main.tileNoAttach[Type] = true; + Main.tileSolidTop[Type] = false; + Main.tileLighted[Type] = true; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 4; + TileObjectData.newTile.RandomStyleRange = 4; + + TileObjectData.newTile.CopyFrom(TileObjectData.Style3x3); + TileObjectData.newTile.AnchorBottom = AnchorData.Empty; + TileObjectData.newTile.AnchorLeft = new AnchorData(AnchorType.SolidTile, 2, 0); + TileObjectData.newTile.DrawXOffset = -2; + + TileObjectData.addTile(Type); + + DustType = 253; + AddMapEntry(new Color(54, 69, 72)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Tiles/SunkenSea/Ambient/WallCoralLeft.png b/Tiles/SunkenSea/Ambient/WallCoralLeft.png new file mode 100644 index 0000000000..f8e349d9e8 Binary files /dev/null and b/Tiles/SunkenSea/Ambient/WallCoralLeft.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs index 8d7ab3f8b2..905f79c0fe 100644 --- a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs +++ b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.cs @@ -16,152 +16,29 @@ namespace CalamityMod.Tiles.SunkenSea.Ambient Main.tileFrameImportant[Type] = true; Main.tileSolid[Type] = false; Main.tileLighted[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileWaterDeath[Type] = false; + TileID.Sets.ReplaceTileBreakUp[Type] = true; + TileID.Sets.SwaysInWindBasic[Type] = true; + TileObjectData.newTile.Width = 2; TileObjectData.newTile.Height = 2; TileObjectData.newTile.Origin = new Point16(2, 2); TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); TileObjectData.newTile.CoordinateWidth = 16; TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; + + TileObjectData.newTile.StyleHorizontal = true; + TileObjectData.newTile.StyleWrapLimit = 4; + TileObjectData.newTile.RandomStyleRange = 4; + TileObjectData.addTile(Type); + AddMapEntry(new Color(187, 43, 44)); DustType = DustID.BlueMoss; HitSound = SoundID.Dig; } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.733f; - g = 0.169f; - b = 0.173f; - r *= brightness; - g *= brightness; - b *= brightness; - } - } - - public class WideScarletSeagrass2 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLighted[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 2; - TileObjectData.newTile.Origin = new Point16(2, 2); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(187, 43, 44)); - DustType = 96; - HitSound = SoundID.Dig; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.733f; - g = 0.169f; - b = 0.173f; - r *= brightness; - g *= brightness; - b *= brightness; - } - } - - public class WideScarletSeagrass3 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLighted[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(187, 43, 44)); - DustType = 96; - HitSound = SoundID.Dig; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.733f; - g = 0.169f; - b = 0.173f; - r *= brightness; - g *= brightness; - b *= brightness; - } - } - - public class WideScarletSeagrass4 : ModTile - { - public override void SetStaticDefaults() - { - Main.tileFrameImportant[Type] = true; - Main.tileSolid[Type] = false; - Main.tileLighted[Type] = true; - TileObjectData.newTile.Width = 2; - TileObjectData.newTile.Height = 3; - TileObjectData.newTile.Origin = new Point16(2, 3); - TileObjectData.newTile.CoordinateHeights = new int[] { 16, 16, 16 }; - TileObjectData.newTile.StyleWrapLimit = 36; - TileObjectData.newTile.AnchorBottom = new AnchorData(AnchorType.SolidTile | AnchorType.SolidWithTop | AnchorType.SolidSide, TileObjectData.newTile.Width, 0); - TileObjectData.newTile.CoordinateWidth = 16; - TileObjectData.newTile.CoordinatePadding = 2; - TileObjectData.newTile.DrawYOffset = 3; - TileObjectData.addTile(Type); - AddMapEntry(new Color(187, 43, 44)); - DustType = DustID.BlueMoss; - HitSound = SoundID.Dig; - } - - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) - { - float brightness = 0.7f; - float declareThisHereToPreventRunningTheSameCalculationMultipleTimes = Main.GameUpdateCount * 0.01f; - brightness *= (float)MathF.Sin(-j / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + i); - brightness *= (float)MathF.Sin(-i / 8f + declareThisHereToPreventRunningTheSameCalculationMultipleTimes + j); - brightness += 0.7f; - brightness = MathHelper.Clamp(brightness, 0.1f, 0.5f); - r = 0.733f; - g = 0.169f; - b = 0.173f; - r *= brightness; - g *= brightness; - b *= brightness; - } } } diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png index 6e040b11de..a06329abd7 100644 Binary files a/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png and b/Tiles/SunkenSea/Ambient/WideScarletSeagrass.png differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png deleted file mode 100644 index ef6e26701f..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WideScarletSeagrass2.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png deleted file mode 100644 index a3620da034..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WideScarletSeagrass3.png and /dev/null differ diff --git a/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png b/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png deleted file mode 100644 index ca8367022c..0000000000 Binary files a/Tiles/SunkenSea/Ambient/WideScarletSeagrass4.png and /dev/null differ diff --git a/Tiles/SunkenSea/AridSoil.cs b/Tiles/SunkenSea/AridSoil.cs new file mode 100644 index 0000000000..c8cd653bfe --- /dev/null +++ b/Tiles/SunkenSea/AridSoil.cs @@ -0,0 +1,56 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class AridSoil : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + Main.tileShine2[Type] = false; + + DustType = DustID.Hive; + AddMapEntry(new Color(203, 123, 107)); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/AridSoil.png b/Tiles/SunkenSea/AridSoil.png new file mode 100644 index 0000000000..bdb1c641e5 Binary files /dev/null and b/Tiles/SunkenSea/AridSoil.png differ diff --git a/Tiles/SunkenSea/Basalt.cs b/Tiles/SunkenSea/Basalt.cs index 6e309e5123..d80056fa42 100644 --- a/Tiles/SunkenSea/Basalt.cs +++ b/Tiles/SunkenSea/Basalt.cs @@ -1,4 +1,7 @@ -using Microsoft.Xna.Framework; +using System; +using CalamityMod.Systems; +using CalamityMod.Tiles.SunkenSea.Ambient; +using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -7,21 +10,13 @@ namespace CalamityMod.Tiles.SunkenSea { public class Basalt : ModTile { - private int sheetWidth = 234; - private int sheetHeight = 90; - - public byte[,] tileAdjacency; - public byte[,] secondTileAdjacency; - public byte[,] thirdTileAdjacency; - public byte[,] fourthTileAdjacency; - public override void SetStaticDefaults() { TileID.Sets.GeneralPlacementTiles[Type] = false; - + TileID.Sets.HasSlopeFrames[Type] = true; Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; - Main.tileShine2[Type] = true; + Main.tileShine2[Type] = false; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); @@ -29,17 +24,21 @@ namespace CalamityMod.Tiles.SunkenSea DustType = DustID.Ash; HitSound = SoundID.Tink; - AddMapEntry(new Color(58, 55, 70)); + AddMapEntry(new Color(77, 75, 86)); MinPick = 110; + //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); @@ -52,11 +51,16 @@ namespace CalamityMod.Tiles.SunkenSea return false; } - public override void AnimateIndividualTile(int type, int i, int j, ref int frameXOffset, ref int frameYOffset) + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - frameXOffset = i % 4 * sheetWidth; - frameYOffset = j % 4 * sheetHeight; + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + public override void RandomUpdate(int i, int j) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; } - } } diff --git a/Tiles/SunkenSea/Basalt.png b/Tiles/SunkenSea/Basalt.png index 4341da810c..c2285d2254 100644 Binary files a/Tiles/SunkenSea/Basalt.png and b/Tiles/SunkenSea/Basalt.png differ diff --git a/Tiles/SunkenSea/BlackPearlPile.cs b/Tiles/SunkenSea/BlackPearlPile.cs index 7749b43860..189d5dc4b8 100644 --- a/Tiles/SunkenSea/BlackPearlPile.cs +++ b/Tiles/SunkenSea/BlackPearlPile.cs @@ -1,8 +1,12 @@ -using CalamityMod.Sounds; +using System; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -16,6 +20,9 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileBlockLight[Type] = true; TileID.Sets.HasSlopeFrames[Type] = true; + Main.tileLighted[Type] = true; + + Main.tileBlendAll[Type] = true; CalamityUtils.MergeWithGeneral(Type); Main.tileShine[Type] = 3500; @@ -24,27 +31,139 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = CommonCalamitySounds.VoidstoneMine; DustType = DustID.Lead; - AddMapEntry(new Color(29, 33, 38)); + AddMapEntry(new Color(48, 55, 63)); TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); + //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PyreMantleMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); - this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); - this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); - this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + int frameX = tile.TileFrameX + (i % 1); + int frameY = tile.TileFrameY + (j % 1); + + Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); + + Texture2D GlintTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/BlackPearlPile_Glint").Value; + + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.05f, // upper glint + screenDiagonalLength * 0.5f, // middle glint + screenDiagonalLength * 1.05f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, sourceRect, (Lighting.GetColor(i, j) * 6) * (strength * 0.4f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + // figure out if the tile is exposed - taken from the coral tiles + if (Main.tile[i, j] == null || + (Main.tile[i - 1, j].HasTile && Main.tile[i + 1, j].HasTile && Main.tile[i, j - 1].HasTile && Main.tile[i, j + 1].HasTile)) + return; + + // get in-game lighting color at this tile + Color litColor = Lighting.GetColor(i, j); + + // convert to brightness factor (0 = dark, 1 = full bright) + float brightness = (litColor.R + litColor.G + litColor.B) / (3f * 255f); + + // flip it so the glow is strongest in the dark + float darknessFactor = 1f - brightness; + + // diagonal glint math + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = new Vector2(i * 16, j * 16) - Main.screenPosition; + float projection = Vector2.Dot(screenPos, glintDir); + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + + float[] beamCenters = + { + screenDiagonalLength * 0.05f, + screenDiagonalLength * 0.5f, + screenDiagonalLength * 1.05f + }; + + float stripeWidth = 100f; + float maxStrength = 0f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + if (strength > maxStrength) + maxStrength = strength; + } + + if (maxStrength > 0f) + { + // base intensity scaled by glint strength and darkness + float intensity = 0.6f * maxStrength * (0.5f + darknessFactor * 0.5f); + + r = (67f / 155f) * intensity; + g = (68f / 155f) * intensity; + b = (87f / 155f) * intensity; + } + } } } diff --git a/Tiles/SunkenSea/BlackPearlPile_Glint.png b/Tiles/SunkenSea/BlackPearlPile_Glint.png new file mode 100644 index 0000000000..693c93520c Binary files /dev/null and b/Tiles/SunkenSea/BlackPearlPile_Glint.png differ diff --git a/Tiles/SunkenSea/CyanCoral.cs b/Tiles/SunkenSea/CyanCoral.cs index 596a66cc9c..e1e77df893 100644 --- a/Tiles/SunkenSea/CyanCoral.cs +++ b/Tiles/SunkenSea/CyanCoral.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.HallowSpray; - AddMapEntry(new Color(92, 168, 198)); + AddMapEntry(new Color(109, 190, 221)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -41,17 +41,9 @@ namespace CalamityMod.Tiles.SunkenSea { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(130, 213, 247); - Color Color2 = new Color(26, 68, 85); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 400f; - g = (value.G + value1.G) / 400f; - b = (value.B + value1.B) / 400f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.43f; + g = 0.71f; + b = 0.82f; } } diff --git a/Tiles/SunkenSea/CyanCoral.png b/Tiles/SunkenSea/CyanCoral.png index 318df78b1c..dedf329ad8 100644 Binary files a/Tiles/SunkenSea/CyanCoral.png and b/Tiles/SunkenSea/CyanCoral.png differ diff --git a/Tiles/SunkenSea/Dunesand.cs b/Tiles/SunkenSea/Dunesand.cs index ddf287c5f5..9493a12f8f 100644 --- a/Tiles/SunkenSea/Dunesand.cs +++ b/Tiles/SunkenSea/Dunesand.cs @@ -1,6 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -22,10 +24,19 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; - Main.tileShine2[Type] = true; + Main.tileShine2[Type] = false; DustType = DustID.Hive; - AddMapEntry(new Color(210, 124, 45)); + AddMapEntry(new Color(231, 135, 100)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); diff --git a/Tiles/SunkenSea/Dunesand.png b/Tiles/SunkenSea/Dunesand.png index 06514fde68..2ff9dbac71 100644 Binary files a/Tiles/SunkenSea/Dunesand.png and b/Tiles/SunkenSea/Dunesand.png differ diff --git a/Tiles/SunkenSea/EutrophicGlass.cs b/Tiles/SunkenSea/EutrophicGlass.cs index 77f47816d1..ebde80d594 100644 --- a/Tiles/SunkenSea/EutrophicGlass.cs +++ b/Tiles/SunkenSea/EutrophicGlass.cs @@ -1,4 +1,6 @@ -using CalamityMod.Systems; +using System; +using CalamityMod.Systems; +using Microsoft.CodeAnalysis.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -40,12 +42,22 @@ namespace CalamityMod.Tiles.SunkenSea num = fail ? 1 : 3; } + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (Main.tile[i, j].IsTileActuallyInvisible()) return; - float transparency = 0.6f; + float transparency = 0.4f; // Must be set here TileID.Sets.DrawsWalls[Type] = true; @@ -62,6 +74,41 @@ namespace CalamityMod.Tiles.SunkenSea Color color = Lighting.GetColor(i, j) * transparency; TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, color, false), default); + + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + Texture2D GlintTex = ModContent.Request(Texture + "_Glint").Value; + + Vector2 glintDir = new Vector2(1f, 1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.53f, // upper glint + screenDiagonalLength * 0.63f, // middle glint + screenDiagonalLength * 0.73f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, frame, (Lighting.GetColor(i, j) * 2 ) * (strength * 0.4f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/EutrophicGlass_Glint.png b/Tiles/SunkenSea/EutrophicGlass_Glint.png new file mode 100644 index 0000000000..3b890a78f2 Binary files /dev/null and b/Tiles/SunkenSea/EutrophicGlass_Glint.png differ diff --git a/Tiles/SunkenSea/EutrophicSand.cs b/Tiles/SunkenSea/EutrophicSand.cs index 586129ae10..a695859acc 100644 --- a/Tiles/SunkenSea/EutrophicSand.cs +++ b/Tiles/SunkenSea/EutrophicSand.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; @@ -21,18 +22,28 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); // Tile blends with sandstone, which it is set to merge with here - Main.tileShine[Type] = 1800; + Main.tileShine[Type] = 2500; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Titanium; - AddMapEntry(new Color(163, 194, 212)); + AddMapEntry(new Color(157, 183, 206)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 5); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); @@ -44,33 +55,16 @@ namespace CalamityMod.Tiles.SunkenSea public override void RandomUpdate(int i, int j) { - if (!WorldGen.genRand.NextBool(8)) - return; - Tile tile = Main.tile[i, j]; - if (tile.HasTile || tile.LiquidAmount <= 0) - return; - - if (tile.LeftSlope || tile.RightSlope || tile.IsHalfBlock) - return; - Tile up = Main.tile[i, j - 1]; - if (up.HasTile || up.LiquidAmount <= 0) - return; - Tile up2 = Main.tile[i, j - 2]; - if (up2.HasTile || up2.LiquidAmount <= 0) - return; - // Place corals - if (WorldGen.genRand.NextBool(3)) + // Place sunken kelp + if (WorldGen.genRand.NextBool(2) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { - up.TileType = (ushort)ModContent.TileType(); + up.TileType = (ushort)ModContent.TileType(); up.HasTile = true; - up.TileFrameY = 0; - // 15 different frames, choose a random one - up.TileFrameX = (short)(WorldGen.genRand.Next(15) * 18); WorldGen.SquareTileFrame(i, j - 1, true); if (Main.dedServ) @@ -78,58 +72,6 @@ namespace CalamityMod.Tiles.SunkenSea NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); } } - - //multi-colored corals - if (WorldGen.genRand.NextBool(3)) - { - ushort[] ColoredCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(ColoredCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } - - //blue coral trees - if (WorldGen.genRand.NextBool(6)) - { - ushort[] BlueCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(BlueCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } - - //brown coral trees - if (WorldGen.genRand.NextBool(6)) - { - ushort[] BrownCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(BrownCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } - - //fan coral - if (WorldGen.genRand.NextBool(10)) - { - WorldGen.PlaceObject(i, j - 1, (ushort)ModContent.TileType()); - } - - //misc corals - if (WorldGen.genRand.NextBool()) - { - ushort[] MiscCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(MiscCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } } public override void NumDust(int i, int j, bool fail, ref int num) @@ -139,7 +81,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } } } diff --git a/Tiles/SunkenSea/EutrophicSand.png b/Tiles/SunkenSea/EutrophicSand.png index 7561c14ec6..0e4be4e4ad 100644 Binary files a/Tiles/SunkenSea/EutrophicSand.png and b/Tiles/SunkenSea/EutrophicSand.png differ diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.cs b/Tiles/SunkenSea/HardenedEutrophicSand.cs index c85a907006..380e2cc7e0 100644 --- a/Tiles/SunkenSea/HardenedEutrophicSand.cs +++ b/Tiles/SunkenSea/HardenedEutrophicSand.cs @@ -17,18 +17,19 @@ namespace CalamityMod.Tiles.SunkenSea { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - Main.tileShine[Type] = 1800; + Main.tileShine[Type] = 2500; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Titanium; - AddMapEntry(new Color(61, 151, 194)); + AddMapEntry(new Color(66, 162, 209)); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); @@ -44,7 +45,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } public override void RandomUpdate(int i, int j) @@ -55,17 +56,6 @@ namespace CalamityMod.Tiles.SunkenSea if (!up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) { - //brain corals - if (WorldGen.genRand.NextBool(18)) - { - ushort[] BrainCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - ushort newObject = Main.rand.Next(BrainCorals); - - WorldGen.PlaceObject(i, j - 1, newObject, true); - NetMessage.SendObjectPlacement(-1, i, j - 1, newObject, 0, 0, -1, -1); - } - //tube corals if (WorldGen.genRand.NextBool(8)) { @@ -84,6 +74,20 @@ namespace CalamityMod.Tiles.SunkenSea NetMessage.SendObjectPlacement(-1, i, j - 1, (ushort)ModContent.TileType(), 0, 0, -1, -1); } } + + // Place sunken kelp + if (WorldGen.genRand.NextBool(2) && !up.HasTile && !up2.HasTile && up.LiquidAmount > 0 && up2.LiquidAmount > 0 && !tile.LeftSlope && !tile.RightSlope && !tile.IsHalfBlock) + { + up.TileType = (ushort)ModContent.TileType(); + up.HasTile = true; + + WorldGen.SquareTileFrame(i, j - 1, true); + + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j - 1, 3, TileChangeType.None); + } + } } } } diff --git a/Tiles/SunkenSea/HardenedEutrophicSand.png b/Tiles/SunkenSea/HardenedEutrophicSand.png index 5f80ec3a45..f0dfb21ae8 100644 Binary files a/Tiles/SunkenSea/HardenedEutrophicSand.png and b/Tiles/SunkenSea/HardenedEutrophicSand.png differ diff --git a/Tiles/SunkenSea/LimeCoral.cs b/Tiles/SunkenSea/LimeCoral.cs index 72fb3e4bfc..0abae7fa80 100644 --- a/Tiles/SunkenSea/LimeCoral.cs +++ b/Tiles/SunkenSea/LimeCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Terra; - AddMapEntry(new Color(139, 206, 56)); + AddMapEntry(new Color(176, 242, 96)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -31,21 +31,14 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(176, 242, 96); - Color Color2 = new Color(82, 113, 29); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 139f / 255f; + g = 206f / 255f; + b = 56f / 255f; } } diff --git a/Tiles/SunkenSea/LimeCoral.png b/Tiles/SunkenSea/LimeCoral.png index b7fb07b8d0..fb914d3a3b 100644 Binary files a/Tiles/SunkenSea/LimeCoral.png and b/Tiles/SunkenSea/LimeCoral.png differ diff --git a/Tiles/SunkenSea/Limestone.cs b/Tiles/SunkenSea/Limestone.cs index 6c05789b43..ea405e8d98 100644 --- a/Tiles/SunkenSea/Limestone.cs +++ b/Tiles/SunkenSea/Limestone.cs @@ -1,5 +1,6 @@ using CalamityMod.Systems; using CalamityMod.Tiles.Merges; +using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -21,18 +22,52 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.Pot; - AddMapEntry(new Color(154, 119, 119)); + AddMapEntry(new Color(184, 138, 113)); + //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + public override void RandomUpdate(int i, int j) + { + Tile Tile = Framing.GetTileSafely(i, j); + Tile Below = Framing.GetTileSafely(i, j + 1); + Tile Above = Framing.GetTileSafely(i, j - 1); + + if (!Below.HasTile && Below.LiquidType <= 0 && !Tile.BottomSlope) + { + if (Main.rand.NextBool(10)) + { + Below.TileType = (ushort)ModContent.TileType(); + Below.HasTile = true; + WorldGen.SquareTileFrame(i, j + 1, true); + if (Main.dedServ) + { + NetMessage.SendTileSquare(-1, i, j + 1, 3, TileChangeType.None); + } + } + } + } } } diff --git a/Tiles/SunkenSea/Limestone.png b/Tiles/SunkenSea/Limestone.png index 8663309de3..1ff28b15d7 100644 Binary files a/Tiles/SunkenSea/Limestone.png and b/Tiles/SunkenSea/Limestone.png differ diff --git a/Tiles/SunkenSea/LimestoneCobble.cs b/Tiles/SunkenSea/LimestoneCobble.cs new file mode 100644 index 0000000000..e91b859ac6 --- /dev/null +++ b/Tiles/SunkenSea/LimestoneCobble.cs @@ -0,0 +1,52 @@ +using CalamityMod.Systems; +using CalamityMod.Tiles.Merges; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class LimestoneCobble : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + DustType = DustID.Pot; + AddMapEntry(new Color(200, 120, 101)); + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + } +} diff --git a/Tiles/SunkenSea/LimestoneCobble.png b/Tiles/SunkenSea/LimestoneCobble.png new file mode 100644 index 0000000000..8663309de3 Binary files /dev/null and b/Tiles/SunkenSea/LimestoneCobble.png differ diff --git a/Tiles/SunkenSea/MagentaCoral.cs b/Tiles/SunkenSea/MagentaCoral.cs index 327b375883..7368068537 100644 --- a/Tiles/SunkenSea/MagentaCoral.cs +++ b/Tiles/SunkenSea/MagentaCoral.cs @@ -27,7 +27,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Ice_Pink; - AddMapEntry(new Color(206, 56, 123)); + AddMapEntry(new Color(253, 112, 186)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -36,21 +36,14 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(242, 96, 161); - Color Color2 = new Color(156, 51, 83); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.81f; + g = 0.32f; + b = 0.54f; } } diff --git a/Tiles/SunkenSea/MagentaCoral.png b/Tiles/SunkenSea/MagentaCoral.png index e02ef96fce..83ac873383 100644 Binary files a/Tiles/SunkenSea/MagentaCoral.png and b/Tiles/SunkenSea/MagentaCoral.png differ diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs index 430664f3a3..02cbdf969f 100644 --- a/Tiles/SunkenSea/MediumSeaPrismCrystal.cs +++ b/Tiles/SunkenSea/MediumSeaPrismCrystal.cs @@ -10,6 +10,8 @@ using Terraria.Enums; using Terraria.ObjectData; using CalamityMod.Items.Weapons.Melee; using Terraria.GameContent; +using CalamityMod.Systems; +using Microsoft.Xna.Framework.Graphics; namespace CalamityMod.Tiles.SunkenSea { @@ -22,7 +24,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; Main.tileSpelunker[Type] = true; - Main.tileShine[Type] = 3500; + Main.tileShine[Type] = 5600; Main.tileShine2[Type] = true; HitSound = SoundID.Item27; @@ -30,7 +32,7 @@ namespace CalamityMod.Tiles.SunkenSea MinPick = 55; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); // Attach to ground TileObjectData.newTile.CopyFrom(TileObjectData.Style2x2); @@ -70,20 +72,52 @@ namespace CalamityMod.Tiles.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - var tile = Main.tile[i, j]; - bool lessLightDueToLowWater = tile.LiquidAmount > 50 && tile.LiquidType == LiquidID.Water; + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); - //Blue - Color blue = new Color(202, 236, 238); - Color darkviolet = new Color(18, 67, 116); - Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f); - r = lessLightDueToLowWater ? 0.27f : 0.36f; - g = lessLightDueToLowWater ? 0.405f : 0.54f; - b = lessLightDueToLowWater ? 0.405f : 0.54f; - r *= (value.R + value1.R) / 300f; - g *= (value.G + value1.G) / 300f; - b *= (value.B + value1.B) / 300f; + Color baseColor = new Color(162, 216, 218); //Blue + Color glow1 = new Color(171, 113, 215); //Purple + Color glow2 = new Color(56, 174, 117); //Green + + Vector3 blended = baseColor.ToVector3(); + + blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); + blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); + + float brightness = 0.6f; + blended *= brightness; + + r = blended.X; + g = blended.Y; + b = blended.Z; + } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + Texture2D baseTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue").Value; + spriteBatch.Draw(baseTex, position, sourceRect, Lighting.GetColor(i, j) * 1.5f); + + Texture2D tex1 = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Tiles/SunkenSea/MediumSeaPrismCrystal_Green").Value; + + spriteBatch.Draw(tex1, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); + spriteBatch.Draw(tex2, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); } public override void KillMultiTile(int i, int j, int frameX, int frameY) { diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal.png b/Tiles/SunkenSea/MediumSeaPrismCrystal.png index e087780707..ceef890ebe 100644 Binary files a/Tiles/SunkenSea/MediumSeaPrismCrystal.png and b/Tiles/SunkenSea/MediumSeaPrismCrystal.png differ diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue.png b/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue.png new file mode 100644 index 0000000000..ceef890ebe Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal_Blue.png differ diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal_Glint.png b/Tiles/SunkenSea/MediumSeaPrismCrystal_Glint.png new file mode 100644 index 0000000000..4667f80b89 Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal_Glint.png differ diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal_Green.png b/Tiles/SunkenSea/MediumSeaPrismCrystal_Green.png new file mode 100644 index 0000000000..e10cc3ce4f Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal_Green.png differ diff --git a/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple.png b/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple.png new file mode 100644 index 0000000000..b0d2462bd5 Binary files /dev/null and b/Tiles/SunkenSea/MediumSeaPrismCrystal_Purple.png differ diff --git a/Tiles/SunkenSea/Mire.cs b/Tiles/SunkenSea/Mire.cs new file mode 100644 index 0000000000..3776206d23 --- /dev/null +++ b/Tiles/SunkenSea/Mire.cs @@ -0,0 +1,55 @@ +using CalamityMod.Systems; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class Mire : ModTile + { + public override void SetStaticDefaults() + { + TileID.Sets.GeneralPlacementTiles[Type] = false; + + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithDesert(Type); + TileID.Sets.ChecksForMerge[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + Main.tileShine2[Type] = false; + + DustType = DustID.Hive; + AddMapEntry(new Color(71, 38, 30)); + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AridSoilMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override void NumDust(int i, int j, bool fail, ref int num) + { + num = fail ? 1 : 3; + } + } +} diff --git a/Tiles/SunkenSea/Mire.png b/Tiles/SunkenSea/Mire.png new file mode 100644 index 0000000000..52e651c89f Binary files /dev/null and b/Tiles/SunkenSea/Mire.png differ diff --git a/Tiles/SunkenSea/Navystone.cs b/Tiles/SunkenSea/Navystone.cs index f599048eec..01569563b2 100644 --- a/Tiles/SunkenSea/Navystone.cs +++ b/Tiles/SunkenSea/Navystone.cs @@ -15,13 +15,14 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); TileID.Sets.ChecksForMerge[Type] = true; DustType = DustID.BlueMoss; - AddMapEntry(new Color(17, 53, 77)); + AddMapEntry(new Color(28, 72, 96)); HitSound = SoundID.Tink; this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); @@ -37,7 +38,7 @@ namespace CalamityMod.Tiles.SunkenSea public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { - return TileFramingSystem.BrimstoneFraming(i, j, resetFrame); + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } public override void RandomUpdate(int i, int j) diff --git a/Tiles/SunkenSea/Navystone.png b/Tiles/SunkenSea/Navystone.png index d81a8b93bb..a0cc7f0beb 100644 Binary files a/Tiles/SunkenSea/Navystone.png and b/Tiles/SunkenSea/Navystone.png differ diff --git a/Tiles/SunkenSea/OrangeCoral.cs b/Tiles/SunkenSea/OrangeCoral.cs index b9a4a0c5b5..fe93c8e402 100644 --- a/Tiles/SunkenSea/OrangeCoral.cs +++ b/Tiles/SunkenSea/OrangeCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Pixie; - AddMapEntry(Color.Orange); + AddMapEntry(new Color(255, 144, 63)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -31,21 +31,14 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(255, 177, 120); - Color Color2 = new Color(117, 23, 44); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.92f; + g = 0.62f; + b = 0.42f; } } diff --git a/Tiles/SunkenSea/PinkPearlPile.cs b/Tiles/SunkenSea/PinkPearlPile.cs index 7bcd41ef34..1bc2ac98bd 100644 --- a/Tiles/SunkenSea/PinkPearlPile.cs +++ b/Tiles/SunkenSea/PinkPearlPile.cs @@ -1,10 +1,15 @@ -using CalamityMod.Sounds; +using System; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; +using Microsoft.CodeAnalysis.Text; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static CalamityMod.Projectiles.Rogue.FinalDawnFlame; namespace CalamityMod.Tiles.SunkenSea { @@ -14,6 +19,7 @@ namespace CalamityMod.Tiles.SunkenSea { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; CalamityUtils.MergeWithGeneral(Type); @@ -28,6 +34,10 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); @@ -46,5 +56,113 @@ namespace CalamityMod.Tiles.SunkenSea { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + int frameX = tile.TileFrameX + (i % 1 ); + int frameY = tile.TileFrameY + (j % 1 ); + + Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); + + + Texture2D GlintTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/PinkPearlPile_Glint").Value; + + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.05f, // upper glint + screenDiagonalLength * 0.5f, // middle glint + screenDiagonalLength * 1.05f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, sourceRect, (Lighting.GetColor(i, j) * 6 ) * (strength * 0.4f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + // figure out if the tile is exposed - taken from the coral tiles + if (Main.tile[i, j] == null || + (Main.tile[i - 1, j].HasTile && Main.tile[i + 1, j].HasTile && Main.tile[i, j - 1].HasTile && Main.tile[i, j + 1].HasTile)) + return; + + // get in-game lighting color at this tile + Color litColor = Lighting.GetColor(i, j); + + // convert to brightness factor (0 = dark, 1 = full bright) + float brightness = (litColor.R + litColor.G + litColor.B) / (3f * 255f); + + // flip it so the glow is strongest in the dark + float darknessFactor = 1f - brightness; + + // diagonal glint math + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = new Vector2(i * 16, j * 16) - Main.screenPosition; + float projection = Vector2.Dot(screenPos, glintDir); + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + + float[] beamCenters = + { + screenDiagonalLength * 0.05f, + screenDiagonalLength * 0.5f, + screenDiagonalLength * 1.05f + }; + + float stripeWidth = 100f; + float maxStrength = 0f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + if (strength > maxStrength) + maxStrength = strength; + } + + if (maxStrength > 0f) + { + // base intensity scaled by glint strength and darkness + float intensity = 0.6f * maxStrength * (0.5f + darknessFactor * 0.5f); + + r = (172f / 255f) * intensity; + g = (112f / 255f) * intensity; + b = (145f / 255f) * intensity; + } + } + } } diff --git a/Tiles/SunkenSea/PinkPearlPile_Glint.png b/Tiles/SunkenSea/PinkPearlPile_Glint.png new file mode 100644 index 0000000000..bd5253d1eb Binary files /dev/null and b/Tiles/SunkenSea/PinkPearlPile_Glint.png differ diff --git a/Tiles/SunkenSea/PolypSand.cs b/Tiles/SunkenSea/PolypSand.cs index 4910ac35f5..a92a145606 100644 --- a/Tiles/SunkenSea/PolypSand.cs +++ b/Tiles/SunkenSea/PolypSand.cs @@ -1,10 +1,12 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.SunkenSea.Ambient; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -29,7 +31,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Ice_Red; - AddMapEntry(new Color(221, 180, 182)); + AddMapEntry(new Color(215, 170, 170)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); diff --git a/Tiles/SunkenSea/Runestone.cs b/Tiles/SunkenSea/Runestone.cs index 7108f7d9ed..fd3e738726 100644 --- a/Tiles/SunkenSea/Runestone.cs +++ b/Tiles/SunkenSea/Runestone.cs @@ -22,17 +22,32 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.Pot; - AddMapEntry(new Color(152, 89, 78)); - Main.tileShine2[Type] = true; + AddMapEntry(new Color(162, 98, 85)); + Main.tileShine2[Type] = false; TileID.Sets.CanBeDugByShovel[Type] = true; + //Stone merges this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/PolypSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/DunesandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ScarletSeaGrassTile"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AridSoilMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) diff --git a/Tiles/SunkenSea/Runestone.png b/Tiles/SunkenSea/Runestone.png index a0f612e995..b247e5fac6 100644 Binary files a/Tiles/SunkenSea/Runestone.png and b/Tiles/SunkenSea/Runestone.png differ diff --git a/Tiles/SunkenSea/RunestoneTerracotta.png b/Tiles/SunkenSea/RunestoneTerracotta.png deleted file mode 100644 index 610bdefa21..0000000000 Binary files a/Tiles/SunkenSea/RunestoneTerracotta.png and /dev/null differ diff --git a/Tiles/SunkenSea/ScarletSeaGrassTile.cs b/Tiles/SunkenSea/ScarletSeaGrassTile.cs index b413e27f6a..bc551c75fa 100644 --- a/Tiles/SunkenSea/ScarletSeaGrassTile.cs +++ b/Tiles/SunkenSea/ScarletSeaGrassTile.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.Projectiles.Typeless; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.SunkenSea.Ambient; @@ -6,6 +7,7 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -22,6 +24,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.GeneralPlacementTiles[Type] = false; Main.tileSolid[Type] = true; + Main.tileLighted[Type] = true; Main.tileBlockLight[Type] = false; CalamityUtils.MergeWithGeneral(Type); @@ -32,7 +35,16 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.Hive; - AddMapEntry(new Color(187, 43, 44)); + AddMapEntry(new Color(216, 50, 50)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); @@ -94,15 +106,9 @@ namespace CalamityMod.Tiles.SunkenSea } public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - float brightness = 0.7f; - brightness *= (float)MathF.Sin(-i / 40f + Main.GameUpdateCount * 0.01f + j); - brightness += 0.5f; - r = 187f / 255f; - g = 43f / 255f; - b = 44f / 255f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.3f; + g = 0f; + b = 0.1f; } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/SunkenSea/SeaPrism.cs b/Tiles/SunkenSea/SeaPrism.cs index 3c3f1ae585..22310dc258 100644 --- a/Tiles/SunkenSea/SeaPrism.cs +++ b/Tiles/SunkenSea/SeaPrism.cs @@ -1,7 +1,9 @@ using System; using CalamityMod.Systems; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; +using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; @@ -10,18 +12,20 @@ namespace CalamityMod.Tiles.SunkenSea public class SeaPrism : ModTile { private const short subsheetWidth = 468; - private const short subsheetHeight = 90; - + private const short subsheetHeight = 90; + public override void SetStaticDefaults() { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = false; TileID.Sets.HasSlopeFrames[Type] = true; + Main.tileMerge[Type][ModContent.TileType()] = true; + + Main.tileMerge[Type][ModContent.TileType()] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); Main.tileLighted[Type] = true; - Main.tileShine[Type] = 5000; Main.tileShine2[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; @@ -48,22 +52,95 @@ namespace CalamityMod.Tiles.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - float brightness = 0.9f; - Color blue = new Color(162, 216, 218); - Color darkviolet = new Color(18, 78, 96); - Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 800f; - g = (value.G + value1.G) / 800f; - b = (value.B + value1.B) / 800f; - r *= brightness; - g *= brightness; - b *= brightness; + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + Color baseColor = new Color(162, 216, 218); //Blue + Color glow1 = new Color(171, 113, 215); //Purple + Color glow2 = new Color(56, 174, 117); //Green + + Vector3 blended = baseColor.ToVector3(); + + blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); + blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); + + float brightness = 0.6f; + blended *= brightness; + + r = blended.X; + g = blended.Y; + b = blended.Z; } public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + int frameX = tile.TileFrameX + (i % 8 * subsheetWidth); + int frameY = tile.TileFrameY + (j % 8 * subsheetHeight); + + Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); + + Texture2D baseTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrism_Blue").Value; + spriteBatch.Draw(baseTex, position, sourceRect, Lighting.GetColor(i, j) * 1.5f); + + Texture2D tex1 = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrism_Purple").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrism_Green").Value; + + spriteBatch.Draw(tex1, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); + spriteBatch.Draw(tex2, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); + + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Texture2D GlintTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrism_GlintMask").Value; + + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.05f, // upper glint + screenDiagonalLength * 0.5f, // middle glint + screenDiagonalLength * 1.05f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, sourceRect, Color.White * strength, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } +} + return true; + + } } } diff --git a/Tiles/SunkenSea/SeaPrism.png b/Tiles/SunkenSea/SeaPrism.png index 7e6c12266c..01220e2182 100644 Binary files a/Tiles/SunkenSea/SeaPrism.png and b/Tiles/SunkenSea/SeaPrism.png differ diff --git a/Tiles/SunkenSea/SeaPrismCrystals.cs b/Tiles/SunkenSea/SeaPrismCrystals.cs index dd064e88e7..76e66126d8 100644 --- a/Tiles/SunkenSea/SeaPrismCrystals.cs +++ b/Tiles/SunkenSea/SeaPrismCrystals.cs @@ -1,6 +1,7 @@ using System; using CalamityMod.Items.Placeables.SunkenSea; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.Localization; @@ -17,7 +18,7 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileFrameImportant[Type] = true; Main.tileObsidianKill[Type] = true; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); - AddMapEntry(new Color(48, 201, 214), CalamityUtils.GetItemName()); + AddMapEntry(new Color(53, 136, 207), CalamityUtils.GetItemName()); HitSound = SoundID.Item27; DustType = 67; Main.tileSpelunker[Type] = true; @@ -31,52 +32,51 @@ namespace CalamityMod.Tiles.SunkenSea public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { - var tile = Main.tile[i, j]; - bool lessLightDueToLowWater = tile.LiquidAmount > 50 && tile.LiquidType == LiquidID.Water; - int xframe = tile.TileFrameX / 18; - if (xframe > 7 && xframe < 14) - { - //Purple - Color darkviolet = new Color(75, 54, 103); - Color violet = new Color(231, 205, 245); - Color value = Color.Lerp(darkviolet, violet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.037f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(darkviolet, violet, (MathF.Sin((j - 120) / 50f + Main.GameUpdateCount * 0.014f + -i / 30f) + 1f) / 2f); - r = lessLightDueToLowWater ? 0.36f : 0.48f; - g = lessLightDueToLowWater ? 0.315f : 0.42f; - b = lessLightDueToLowWater ? 0.405f : 0.54f; - r *= (value.R + value1.R) / 300f; - g *= (value.G + value1.G) / 300f; - b *= (value.B + value1.B) / 300f; - - } - else if (xframe >= 14) - { - //Green - Color murkeygreen = new Color(28, 68, 54); - Color lightgreen = new Color(166, 234, 198); - Color value2 = Color.Lerp(murkeygreen, lightgreen, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.027f + i / 40f) + 1f) / 2f); - Color value3 = Color.Lerp(murkeygreen, lightgreen, (MathF.Sin((j - 80) / 50f + Main.GameUpdateCount * 0.034f + -i / 30f) + 1f) / 2f); - r = lessLightDueToLowWater ? 0.225f : 0.3f; - g = lessLightDueToLowWater ? 0.405f : 0.54f; - b = lessLightDueToLowWater ? 0.315f : 0.42f; - r *= (value2.R + value3.R) / 300f; - g *= (value2.G + value3.G) / 300f; - b *= (value2.B + value3.B) / 300f; - } - else - { - //Blue - Color blue = new Color(67, 187, 204); - Color darkviolet = new Color(18, 67, 116); - Color value = Color.Lerp(blue, darkviolet, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(blue, darkviolet, (MathF.Sin((j - 10) / 50f + Main.GameUpdateCount * 0.064f + -i / 30f) + 1f) / 2f); - r = lessLightDueToLowWater ? 0.27f : 0.36f; - g = lessLightDueToLowWater ? 0.405f : 0.54f; - b = lessLightDueToLowWater ? 0.405f : 0.54f; - r *= (value.R + value1.R) / 300f; - g *= (value.G + value1.G) / 300f; - b *= (value.B + value1.B) / 300f; - } + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + Color baseColor = new Color(162, 216, 218); //Blue + Color glow1 = new Color(171, 113, 215); //Purple + Color glow2 = new Color(56, 174, 117); //Green + + Vector3 blended = baseColor.ToVector3(); + + blended = Vector3.Lerp(blended, glow1.ToVector3(), fade1 * 0.5f); + blended = Vector3.Lerp(blended, glow2.ToVector3(), fade2 * 0.5f); + + float brightness = 0.6f; + blended *= brightness; + + r = blended.X; + g = blended.Y; + b = blended.Z; + } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + Rectangle sourceRect = new Rectangle(tile.TileFrameX, tile.TileFrameY, 16, 16); + + Texture2D baseTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals").Value; + spriteBatch.Draw(baseTex, position, sourceRect, Lighting.GetColor(i, j) * 1.5f); + + Texture2D tex1 = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Purple").Value; + Texture2D tex2 = ModContent.Request("CalamityMod/Tiles/SunkenSea/SeaPrismCrystals_Green").Value; + + spriteBatch.Draw(tex1, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade1(i, j)); + spriteBatch.Draw(tex2, position, sourceRect, Lighting.GetColor(i, j) * 1.5f * GetFade2(i, j)); } public override bool CanPlace(int i, int j) diff --git a/Tiles/SunkenSea/SeaPrismCrystals.png b/Tiles/SunkenSea/SeaPrismCrystals.png index c4646c40c6..574fd43f13 100644 Binary files a/Tiles/SunkenSea/SeaPrismCrystals.png and b/Tiles/SunkenSea/SeaPrismCrystals.png differ diff --git a/Tiles/SunkenSea/SeaPrismCrystals_Green.png b/Tiles/SunkenSea/SeaPrismCrystals_Green.png new file mode 100644 index 0000000000..d167aa4b1e Binary files /dev/null and b/Tiles/SunkenSea/SeaPrismCrystals_Green.png differ diff --git a/Tiles/SunkenSea/SeaPrismCrystals_Purple.png b/Tiles/SunkenSea/SeaPrismCrystals_Purple.png new file mode 100644 index 0000000000..52616c685f Binary files /dev/null and b/Tiles/SunkenSea/SeaPrismCrystals_Purple.png differ diff --git a/Tiles/SunkenSea/SeaPrism_Blue.png b/Tiles/SunkenSea/SeaPrism_Blue.png new file mode 100644 index 0000000000..7e6c12266c Binary files /dev/null and b/Tiles/SunkenSea/SeaPrism_Blue.png differ diff --git a/Tiles/SunkenSea/SeaPrism_GlintMask.png b/Tiles/SunkenSea/SeaPrism_GlintMask.png new file mode 100644 index 0000000000..b80a7aaa41 Binary files /dev/null and b/Tiles/SunkenSea/SeaPrism_GlintMask.png differ diff --git a/Tiles/SunkenSea/SeaPrism_Green.png b/Tiles/SunkenSea/SeaPrism_Green.png new file mode 100644 index 0000000000..9ad3fbf00c Binary files /dev/null and b/Tiles/SunkenSea/SeaPrism_Green.png differ diff --git a/Tiles/SunkenSea/SeaPrism_Purple.png b/Tiles/SunkenSea/SeaPrism_Purple.png new file mode 100644 index 0000000000..00eb510c4c Binary files /dev/null and b/Tiles/SunkenSea/SeaPrism_Purple.png differ diff --git a/Tiles/SunkenSea/Shellstone.cs b/Tiles/SunkenSea/Shellstone.cs index 1d62336adb..5924abee9d 100644 --- a/Tiles/SunkenSea/Shellstone.cs +++ b/Tiles/SunkenSea/Shellstone.cs @@ -15,20 +15,32 @@ namespace CalamityMod.Tiles.SunkenSea Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + TileID.Sets.HasSlopeFrames[Type] = true; CalamityUtils.MergeWithGeneral(Type); CalamityUtils.MergeWithDesert(Type); - TileID.Sets.HasSlopeFrames[Type] = true; TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Tink; DustType = DustID.CorruptPlants; AddMapEntry(new Color(123, 127, 170)); - this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/VolcanicSandMerge"); + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } - public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) => TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } public override void RandomUpdate(int i, int j) { diff --git a/Tiles/SunkenSea/SunkenKelp.cs b/Tiles/SunkenSea/SunkenKelp.cs new file mode 100644 index 0000000000..d8c6aab42d --- /dev/null +++ b/Tiles/SunkenSea/SunkenKelp.cs @@ -0,0 +1,147 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SunkenKelp : ModTile + { + private const int MaxChainLength = 18; + private static readonly ushort[] ValidAnchors = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + + private const short FrameBottom = 0; + private const short FrameMid = 18; + private const short FrameTop = 36; + private const short FrameWidth = 18; + + public override void SetStaticDefaults() + { + Main.tileCut[Type] = true; + Main.tileNoFail[Type] = true; + Main.tileLavaDeath[Type] = true; + Main.tileObsidianKill[Type] = true; + + TileID.Sets.IsVine[Type] = true; + TileID.Sets.DisableSmartCursor[Type] = true; + + HitSound = SoundID.Grass; + DustType = DustID.Grass; + + AddMapEntry(new Color(27, 112, 68)); + } + + public override void RandomUpdate(int i, int j) + { + if (!IsTopmostSegment(i, j)) + return; + + if (j <= 0 || Main.tile[i, j - 1].HasTile) + return; + + if (!IsSupportedFromBelow(i, j)) + return; + + if (GetChainLengthUpward(i, j) >= MaxChainLength) + return; + + bool placed = WorldGen.PlaceTile(i, j - 1, Type, mute: true, forced: true); + if (placed) + { + SetFrame(i, j - 1, FrameTop); + SetFrame(i, j, FrameMid); + UpdateBaseSegment(i, j + GetChainLengthDownward(i, j)); + } + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + if (!IsSupportedFromBelow(i, j)) + { + WorldGen.KillTile(i, j, noItem: true, effectOnly: false); + return false; + } + + if (IsTopmostSegment(i, j)) + SetFrame(i, j, FrameTop); + else if (IsBottomSegment(i, j)) + SetFrame(i, j, FrameBottom); + else + SetFrame(i, j, FrameMid); + + return false; + } + + private static bool IsSupportedFromBelow(int i, int j) + { + if (j >= Main.maxTilesY - 1) return false; + Tile below = Main.tile[i, j + 1]; + if (!below.HasTile) return false; + + ushort t = below.TileType; + if (t == ModContent.TileType()) + return true; + + foreach (ushort anchor in ValidAnchors) + if (t == anchor) + return true; + + return false; + } + + private static bool IsTopmostSegment(int i, int j) + { + if (j <= 0) return true; + Tile above = Main.tile[i, j - 1]; + return !(above.HasTile && above.TileType == ModContent.TileType()); + } + + private static bool IsBottomSegment(int i, int j) + { + if (j >= Main.maxTilesY - 1) return true; + Tile below = Main.tile[i, j + 1]; + return !(below.HasTile && below.TileType == ModContent.TileType()); + } + + private static int GetChainLengthUpward(int i, int j) + { + int length = 1; + int y = j - 1; + int vineType = ModContent.TileType(); + while (y >= 0 && Main.tile[i, y].HasTile && Main.tile[i, y].TileType == vineType) + { + length++; + y--; + if (length > MaxChainLength) break; + } + return length; + } + + private static int GetChainLengthDownward(int i, int j) + { + int length = 0; + int y = j + 1; + int vineType = ModContent.TileType(); + while (y < Main.maxTilesY && Main.tile[i, y].HasTile && Main.tile[i, y].TileType == vineType) + { + length++; + y++; + } + return length; + } + + private static void SetFrame(int i, int j, short frameYRow) + { + Tile tile = Main.tile[i, j]; + tile.TileFrameX = (short)(WorldGen.genRand.Next(3) * FrameWidth); + tile.TileFrameY = frameYRow; + } + + private static void UpdateBaseSegment(int i, int bottomY) + { + Tile t = Main.tile[i, bottomY]; + if (t.HasTile && t.TileType == ModContent.TileType()) + SetFrame(i, bottomY, FrameBottom); + } + } +} diff --git a/Tiles/SunkenSea/SunkenKelp.png b/Tiles/SunkenSea/SunkenKelp.png index d6ef19a3c6..46c82c6488 100644 Binary files a/Tiles/SunkenSea/SunkenKelp.png and b/Tiles/SunkenSea/SunkenKelp.png differ diff --git a/Tiles/SunkenSea/SuperheatedObsidian.cs b/Tiles/SunkenSea/SuperheatedObsidian.cs new file mode 100644 index 0000000000..6f6d521783 --- /dev/null +++ b/Tiles/SunkenSea/SuperheatedObsidian.cs @@ -0,0 +1,119 @@ +using System; +using CalamityMod.Sounds; +using CalamityMod.Systems; +using CalamityMod.Tiles.Abyss; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.SunkenSea +{ + public class SuperheatedObsidian : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + + TileID.Sets.HasSlopeFrames[Type] = true; + TileID.Sets.ChecksForMerge[Type] = true; + + //Main.tileShine[Type] = 3500; + Main.tileShine2[Type] = true; + + HitSound = CommonCalamitySounds.VoidstoneMine; + DustType = DustID.Slush; + AddMapEntry(new Color(67, 61, 91)); + + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/BasaltMerge"); + + this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); + this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); + this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); + } + + public override bool TileFrame(int i, int j, ref bool resetFrame, ref bool noBreak) + { + return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); + } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + float transparency = 1f; + + // Must be set here + Main.tileBlockLight[Type] = false; + + Texture2D tex = ModContent.Request(Texture + "_Tile").Value; + + Tile tile = Main.tile[i, j]; + int xPos = i % 1; + int yPos = j % 1; + int frameXOffset = xPos * 1; + int frameYOffset = yPos * 1; + Rectangle frame = new Rectangle(tile.TileFrameX + frameXOffset, tile.TileFrameY + frameYOffset, 16, 16); + + Color color = Lighting.GetColor(i, j) * transparency; + TileFramingSystem.SlopedGlowmask(in tile, i, j, tex, frame, CalamityUtils.ApplyPaint(Main.tile[i, j].TileColor, color, false), default); + + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + Texture2D GlintTex = ModContent.Request(Texture + "_Glint").Value; + + Vector2 glintDir = new Vector2(1f, 1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.53f, // upper glint + screenDiagonalLength * 0.63f, // middle glint + screenDiagonalLength * 0.73f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, frame, (Lighting.GetColor(i, j)) * (strength * 1f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + return true; + } + } +} diff --git a/Tiles/SunkenSea/SuperheatedObsidian.png b/Tiles/SunkenSea/SuperheatedObsidian.png new file mode 100644 index 0000000000..9fc5ba9d95 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian.png differ diff --git a/Tiles/SunkenSea/SuperheatedObsidian_Glint.png b/Tiles/SunkenSea/SuperheatedObsidian_Glint.png new file mode 100644 index 0000000000..dba241c470 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian_Glint.png differ diff --git a/Tiles/SunkenSea/SuperheatedObsidian_Tile.png b/Tiles/SunkenSea/SuperheatedObsidian_Tile.png new file mode 100644 index 0000000000..63b6ac62c8 Binary files /dev/null and b/Tiles/SunkenSea/SuperheatedObsidian_Tile.png differ diff --git a/Tiles/SunkenSea/VolcanicSand.cs b/Tiles/SunkenSea/VolcanicSand.cs index a184ad68d5..e0c17c2c33 100644 --- a/Tiles/SunkenSea/VolcanicSand.cs +++ b/Tiles/SunkenSea/VolcanicSand.cs @@ -1,6 +1,8 @@ -using CalamityMod.Systems; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; +using Terraria.GameContent.Metadata; using Terraria.ID; using Terraria.ModLoader; @@ -23,11 +25,32 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; DustType = DustID.t_PearlWood; - AddMapEntry(new Color(117, 79, 97)); + AddMapEntry(new Color(102, 101, 106)); + + Main.tileSand[Type] = true; + TileMaterials.SetForTileId(Type, TileMaterials._materialsByName["Sand"]); + TileID.Sets.Suffocate[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Conversion.Sand[Type] = true; + TileID.Sets.ForAdvancedCollision.ForSandshark[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 10); + + //Stone merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/RunestoneMerge"); + //Sand merges + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(TileID.Sandstone, "CalamityMod/Tiles/Merges/SandstoneMerge"); this.RegisterUniversalMerge(TileID.Sand, "CalamityMod/Tiles/Merges/SandMerge"); this.RegisterUniversalMerge(TileID.HardenedSand, "CalamityMod/Tiles/Merges/HardenedSandMerge"); + //Normal merges + this.RegisterUniversalMerge(TileID.Stone, "CalamityMod/Tiles/Merges/StoneMerge"); + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/DirtMerge"); + this.RegisterUniversalMerge(TileID.Ash, "CalamityMod/Tiles/Merges/AshMerge"); + this.RegisterUniversalMerge(TileID.Mud, "CalamityMod/Tiles/Merges/MudMerge"); } public override void NumDust(int i, int j, bool fail, ref int num) @@ -39,5 +62,12 @@ namespace CalamityMod.Tiles.SunkenSea { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + public override void RandomUpdate(int i, int j) + { + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; + } } } diff --git a/Tiles/SunkenSea/VolcanicSand.png b/Tiles/SunkenSea/VolcanicSand.png index a85b4c8dee..1be4406780 100644 Binary files a/Tiles/SunkenSea/VolcanicSand.png and b/Tiles/SunkenSea/VolcanicSand.png differ diff --git a/Tiles/SunkenSea/WhitePearlPile.cs b/Tiles/SunkenSea/WhitePearlPile.cs index 94938f9b10..467d779d58 100644 --- a/Tiles/SunkenSea/WhitePearlPile.cs +++ b/Tiles/SunkenSea/WhitePearlPile.cs @@ -1,7 +1,10 @@ -using CalamityMod.Sounds; +using System; +using CalamityMod.Projectiles.Typeless; +using CalamityMod.Sounds; using CalamityMod.Systems; using CalamityMod.Tiles.Abyss; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -14,6 +17,7 @@ namespace CalamityMod.Tiles.SunkenSea { Main.tileSolid[Type] = true; Main.tileBlockLight[Type] = true; + Main.tileLighted[Type] = true; CalamityUtils.MergeWithGeneral(Type); @@ -29,6 +33,10 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.CanBeDugByShovel[Type] = true; + TileID.Sets.Falling[Type] = true; + TileID.Sets.FallingBlockProjectile[Type] = new TileID.Sets.FallingBlockProjectileInfo(ModContent.ProjectileType(), 15); + this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/ShellstoneMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/AbyssGravelMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); @@ -47,5 +55,113 @@ namespace CalamityMod.Tiles.SunkenSea { return TileFramingSystem.BetterGemsparkFraming(i, j, resetFrame); } + + private static float GetFade1(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + } + + private static float GetFade2(int i, int j) + { + return (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + //IF this glint effect below runs poorly on lower end PC's we should keep it as a setting for those with good PC's + + Tile tile = Framing.GetTileSafely(i, j); + Vector2 offScreen = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 position = new Vector2(i * 16, j * 16) - Main.screenPosition + offScreen; + + int frameX = tile.TileFrameX + (i % 1); + int frameY = tile.TileFrameY + (j % 1); + + Rectangle sourceRect = new Rectangle(frameX, frameY, 16, 16); + + Texture2D GlintTex = ModContent.Request("CalamityMod/Tiles/SunkenSea/WhitePearlPile_Glint").Value; + + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = position; + + float projection = Vector2.Dot(screenPos, glintDir); + + // this sets the length between the glints diagonally + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + float[] beamCenters = new float[] + { + screenDiagonalLength * 0.05f, // upper glint + screenDiagonalLength * 0.5f, // middle glint + screenDiagonalLength * 1.05f // lower glint + }; + + float stripeWidth = 100f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + + if (strength > 0f) + { + spriteBatch.Draw(GlintTex, position, sourceRect, (Lighting.GetColor(i, j) * 6) * (strength * 0.4f), 0f, Vector2.Zero, 1f, SpriteEffects.None, 0f); + } + } + } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + // figure out if the tile is exposed - taken from the coral tiles + if (Main.tile[i, j] == null || + (Main.tile[i - 1, j].HasTile && Main.tile[i + 1, j].HasTile && Main.tile[i, j - 1].HasTile && Main.tile[i, j + 1].HasTile)) + return; + + // get in-game lighting color at this tile + Color litColor = Lighting.GetColor(i, j); + + // convert to brightness factor (0 = dark, 1 = full bright) + float brightness = (litColor.R + litColor.G + litColor.B) / (3f * 255f); + + // flip it so the glow is strongest in the dark + float darknessFactor = 1f - brightness; + + // diagonal glint math + Vector2 glintDir = new Vector2(1f, -1f); + glintDir.Normalize(); + + Vector2 screenPos = new Vector2(i * 16, j * 16) - Main.screenPosition; + float projection = Vector2.Dot(screenPos, glintDir); + float screenDiagonalLength = Vector2.Dot(new Vector2(Main.screenWidth, Main.screenHeight), glintDir); + + float[] beamCenters = + { + screenDiagonalLength * 0.05f, + screenDiagonalLength * 0.5f, + screenDiagonalLength * 1.05f + }; + + float stripeWidth = 100f; + float maxStrength = 0f; + + foreach (float bc in beamCenters) + { + float dist = Math.Abs(projection - bc); + float strength = MathHelper.Clamp(1f - dist / stripeWidth, 0f, 1f); + if (strength > maxStrength) + maxStrength = strength; + } + + if (maxStrength > 0f) + { + // base intensity scaled by glint strength and darkness (min = 0.0f, max = 1.0f) + float intensity = 0.6f * maxStrength * (0.5f + darknessFactor * 0.5f); + //float intensity = ((float)(Math.Pow(10.0, (brightness * 2 - 2))) - 0.01f) / 0.99f; was trying to do something cool, may come back to it later + + + r = (185f / 255f) * intensity; + g = (164f / 255f) * intensity; + b = (184f / 255f) * intensity; + } + } } } diff --git a/Tiles/SunkenSea/WhitePearlPile_Glint.png b/Tiles/SunkenSea/WhitePearlPile_Glint.png new file mode 100644 index 0000000000..3a8280eeb8 Binary files /dev/null and b/Tiles/SunkenSea/WhitePearlPile_Glint.png differ diff --git a/Tiles/SunkenSea/YellowCoral.cs b/Tiles/SunkenSea/YellowCoral.cs index 687b972091..37eb470bfb 100644 --- a/Tiles/SunkenSea/YellowCoral.cs +++ b/Tiles/SunkenSea/YellowCoral.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Tiles.SunkenSea TileID.Sets.ChecksForMerge[Type] = true; HitSound = SoundID.Dig; DustType = DustID.Firework_Yellow; - AddMapEntry(new Color(198, 169, 24)); + AddMapEntry(new Color(238, 207, 37)); Main.tileShine2[Type] = true; TileID.Sets.CanBeDugByShovel[Type] = true; @@ -31,21 +31,14 @@ namespace CalamityMod.Tiles.SunkenSea this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/EutrophicSandMerge"); this.RegisterUniversalMerge(ModContent.TileType(), "CalamityMod/Tiles/Merges/NavystoneMerge"); } + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { if (!Main.tile[i - 1, j].HasTile || !Main.tile[i + 1, j].HasTile || !Main.tile[i, j - 1].HasTile || !Main.tile[i, j + 1].HasTile) { - float brightness = 0.9f; - Color Color1 = new Color(218, 203, 67); - Color Color2 = new Color(121, 76, 1); - Color value = Color.Lerp(Color1, Color2, (MathF.Sin(-j / 80f + Main.GameUpdateCount * 0.017f + i / 40f) + 1f) / 2f); - Color value1 = Color.Lerp(Color1, Color2, (MathF.Sin((j - 100) / 50f + Main.GameUpdateCount * 0.004f + -i / 30f) + 1f) / 2f); - r = (value.R + value1.R) / 300f; - g = (value.G + value1.G) / 300f; - b = (value.B + value1.B) / 300f; - r *= brightness; - g *= brightness; - b *= brightness; + r = 0.73f; + g = 0.68f; + b = 0.22f; } } diff --git a/Tiles/SunkenSea/YellowCoral.png b/Tiles/SunkenSea/YellowCoral.png index ef005dc85b..7c2ad9d150 100644 Binary files a/Tiles/SunkenSea/YellowCoral.png and b/Tiles/SunkenSea/YellowCoral.png differ diff --git a/Tiles/Underworld/Dreadstone.cs b/Tiles/Underworld/Dreadstone.cs new file mode 100644 index 0000000000..8d8a70bc47 --- /dev/null +++ b/Tiles/Underworld/Dreadstone.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Sounds; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Tiles.Underworld +{ + public class Dreadstone : ModTile + { + public override void SetStaticDefaults() + { + Main.tileSolid[Type] = true; + Main.tileBlockLight[Type] = true; + Main.tileBrick[Type] = true; + + CalamityUtils.MergeWithGeneral(Type); + CalamityUtils.MergeWithHell(Type); + + TileID.Sets.ChecksForMerge[Type] = true; + HitSound = SoundID.Tink; + MineResist = 2f; + MinPick = 65; + AddMapEntry(new Color(102, 65, 65)); + + this.RegisterUniversalMerge(TileID.Dirt, "CalamityMod/Tiles/Merges/AshMerge"); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, Main.rand.NextBool(4) ? DustID.Torch : DustID.RichMahogany, 0f, 0f, 1, default, 1f); + return false; + } + } +} diff --git a/Tiles/Underworld/Dreadstone.png b/Tiles/Underworld/Dreadstone.png new file mode 100644 index 0000000000..47e2b916d8 Binary files /dev/null and b/Tiles/Underworld/Dreadstone.png differ diff --git a/UI/BossHealthBarManager.cs b/UI/BossHealthBarManager.cs index 5d523812fc..119239acb0 100644 --- a/UI/BossHealthBarManager.cs +++ b/UI/BossHealthBarManager.cs @@ -141,12 +141,11 @@ namespace CalamityMod.UI OneToMany[NPCID.PrimeCannon] = SkelePrime; OneToMany[NPCID.PrimeLaser] = SkelePrime; - int[] Golem = new int[] { NPCID.Golem, NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead, NPCID.GolemHeadFree }; + int[] Golem = new int[] { NPCID.Golem, NPCID.GolemFistLeft, NPCID.GolemFistRight, NPCID.GolemHead }; OneToMany[NPCID.Golem] = Golem; OneToMany[NPCID.GolemFistLeft] = Golem; OneToMany[NPCID.GolemFistRight] = Golem; OneToMany[NPCID.GolemHead] = Golem; - OneToMany[NPCID.GolemHeadFree] = Golem; int[] Saucer = new int[] { NPCID.MartianSaucerCore, NPCID.MartianSaucerTurret, NPCID.MartianSaucerCannon }; OneToMany[NPCID.MartianSaucerCore] = Saucer; diff --git a/UI/CanvasPaintingUI.cs b/UI/CanvasPaintingUI.cs index 30119f2d8d..b655d2b1a4 100644 --- a/UI/CanvasPaintingUI.cs +++ b/UI/CanvasPaintingUI.cs @@ -63,7 +63,7 @@ namespace CalamityMod.UI float paintingFrameScale = painting.scale; Vector2 paintingFramePosition = painting.framePosition; - bool hideUI = Main.keyState.IsKeyDown(Keys.LeftShift); + bool hideUI = Main.keyState.PressingShift(); Texture2D tex = TextureAssets.Tile[ModContent.TileType()].Value; if (p.CurrentlyViewedCanvasType == 1) diff --git a/UI/DialogueDisplay/Assets/DialogueArrow.png b/UI/DialogueDisplay/Assets/DialogueArrow.png new file mode 100644 index 0000000000..18a8a71a0e Binary files /dev/null and b/UI/DialogueDisplay/Assets/DialogueArrow.png differ diff --git a/UI/DialogueDisplay/DialogueDisplayDebugItem.cs b/UI/DialogueDisplay/DialogueDisplayDebugItem.cs new file mode 100644 index 0000000000..ad53038fe6 --- /dev/null +++ b/UI/DialogueDisplay/DialogueDisplayDebugItem.cs @@ -0,0 +1,33 @@ +using Terraria.ID; +using Terraria.ModLoader; +using Terraria; +using System.Linq; +using CalamityMod.UI.DialogueDisplay.DisplayEffects; + +namespace CalamityMod.UI.DialogueDisplay +{ + public class DialogueDisplayDebugItem : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Debug"; + public override string Texture => "CalamityMod/Items/Weapons/Summon/StaffOfNecrosteocytes"; + public override void SetDefaults() + { + Item.width = 25; + Item.height = 29; + Item.rare = ItemRarityID.Red; + Item.useAnimation = Item.useTime = 20; + Item.useStyle = ItemUseStyleID.HoldUp; + } + public override bool? UseItem(Player player) + { + int slot = DialogueDisplaySystem.GetSlot("OceanBlue"); + + if (slot != -1) + DialogueDisplaySystem.ProgressDialogue(slot); + else + DialogueDisplaySystem.StartDialogue("OceanBlue", player.Center, 0, -1, effects: new WhisperingPearlEffects()); + + return true; + } + } +} diff --git a/UI/DialogueDisplay/DialogueDisplayUI.cs b/UI/DialogueDisplay/DialogueDisplayUI.cs new file mode 100644 index 0000000000..8705c674f2 --- /dev/null +++ b/UI/DialogueDisplay/DialogueDisplayUI.cs @@ -0,0 +1,1207 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; +using CalamityMod.Fonts; +using CalamityMod.UI.DialogueDisplay.DialogueEvents; +using CalamityMod.UI.DialogueDisplay.DisplayEffects; +using CalamityMod.UI.DialogueDisplay.TextEffects; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; +using Terraria.UI; +using Terraria.UI.Chat; +using static ReLogic.Graphics.DynamicSpriteFont; + +namespace CalamityMod.UI.DialogueDisplay +{ + internal class DialogueDisplayUI : UIState + { + internal static readonly Dictionary Dialogues = []; + internal static readonly List DialoguesToRemove = []; + + public override void Update(GameTime gameTime) + { + foreach (int index in DialoguesToRemove) + { + RemoveChild(Dialogues[index].ui); + Dialogues.Remove(index); + } + DialoguesToRemove.Clear(); + + foreach (var pair in Dialogues) + { + int slot = pair.Key; + var dialog = pair.Value; + + DialogueDisplay ui = dialog.ui; + DialogueTextData data = dialog.data; + + if (ui.DisplayEffects.FadeWhenTooFar) + { + float distFromSource = Vector2.Distance(Main.LocalPlayer.Center, ui.Position); + // If the player is too far, cancel the dialogue + if (distFromSource > ui.DisplayEffects.FadeBuffer + ui.DisplayEffects.FadeDistance) + { + DialoguesToRemove.Add(slot); + continue; + } + } + + if (dialog.entity != null) + { + if (dialog.entity.active) + dialog.ui.Position = dialog.entity.Center; + else + dialog.ui.ClosingDialogue = true; + } + + if (dialog.upTime != -1) + { + if (ui.Uptime >= dialog.upTime) + { + if (ui.ProgressDialogue) + ui.SwitchingPage = true; + else + ui.ClosingDialogue = true; + } + } + + if (ui.DialoguePage.Event != null) + { + if (ui.DialoguePage.Event.IsOver) + { + if (!ui.ProgressDialogue) + DialoguesToRemove.Add(slot); + else + { + if (++data.Page >= data.PageCount) + DialoguesToRemove.Add(slot); + else + { + ui.DialoguePage = data.Pages[data.Page]; + ui.SwitchingPage = false; + ui.SwitchCounter = 0; + Activate(); + } + } + return; + } + } + if (ui.Switching) + { + if (ui.SwitchCounter >= ui.DisplayEffects.TimeToDisappear) + { + if (ui.ClosingDialogue || !ui.ProgressDialogue) + DialoguesToRemove.Add(slot); + else + { + if (++data.Page >= data.PageCount) + DialoguesToRemove.Add(slot); + else + { + ui.DialoguePage = data.Pages[data.Page]; + ui.SwitchingPage = false; + ui.SwitchCounter = 0; + Activate(); + } + } + continue; + } + ui.SwitchCounter++; + } + } + + base.Update(gameTime); + } + } + + public class DialogueDisplay : UIElement + { + public static readonly Dictionary DialogueSounds = new() + { + { "Amidias", SoundID.NPCHit1 }, + { "Otonilou", SoundID.NPCHit25 } + }; + + /// + /// How long this dialogue has existed + /// + public int DialogueTimer = 0; + /// + /// The position from which the text originates + /// + public Vector2 Position = Vector2.Zero; + + public bool SwitchingPage = false; + public bool ProgressDialogue = true; + public bool ClosingDialogue = false; + public bool ScreenLocked; + + public Vector2 TextSize { get; private set; } + public Vector2 SizeOffsetFromStart { get; private set; } + + public bool Switching => SwitchingPage || ClosingDialogue; + internal int SwitchCounter = 0; + + internal DialoguePage DialoguePage; + internal DisplayEffect DisplayEffects; + internal string Text = ""; + private int TextTimer = 0; + internal int textIndex = 0; + internal int Uptime = 0; + internal string FontKey; + + //Effects + internal Dictionary UniqueColors = []; + internal Dictionary UniqueBorderColors = []; + + internal Dictionary Pauses = []; + internal Dictionary> TextEffects = []; + internal Dictionary UniqueScales = []; + internal List LineBreakIndexes = []; + + private DialogueCharacterData[] CharacterData; + private Color BaseColor = Color.White; + private Color BaseBorderColor = Color.Black; + internal bool Crawling = true; + private int storedDelay = 0; + private bool lockDelay = false; + private float WrapWidth = -1; + + public DialogueDisplay(DialoguePage textData, DisplayEffect displayEffects, int startPage = 0, bool screenLocked = false, float wrapWidth = -1, string font = "MouseText") + { + DisplayEffects = displayEffects; + ScreenLocked = screenLocked; + DialoguePage = textData; + DisplayEffects = displayEffects; + FontKey = font; + WrapWidth = wrapWidth; + } + + public override void OnActivate() + { + Text = ""; + UniqueColors = []; + UniqueBorderColors = []; + Pauses = []; + TextEffects = []; + UniqueScales = []; + + if (DialoguePage.Event != null) + return; + + int fullLength = 0; + List lines = []; + for (int i = 0; i < DialoguePage.Lines.Length; i++) + { + string fullLine = DialoguePage.Lines[i]; + + FindEffects(ref fullLine, fullLength); + + if (fullLine[^1] != ' ') + fullLine += ' '; + + lines.Add(fullLine); + fullLength += fullLine.Length; + } + + if (WrapWidth != -1) + { + for (int i = 0; i < lines.Count; i++) + { + string line = lines[i]; + if (line[^1] == ' ') + line = line.Remove(line.Length - 1, 1); + + int finalIndex = 0; + float width = MeasureString(line, FontAssetSystem.Fonts[FontKey]).X; + + if (width > WrapWidth) + { + string yoinked = ""; + do + { + finalIndex = line.LastIndexOf(' '); + if (finalIndex < line.Length - 1) + finalIndex++; + yoinked = line.Substring(finalIndex) + yoinked; + line = line.Remove(finalIndex); + } while (MeasureString(line, FontAssetSystem.Fonts[FontKey]).X > WrapWidth); + + lines[i] = line; + if (yoinked[0] == ' ') + yoinked = yoinked.Remove(0, 1); + + if (i >= lines.Count - 1) + lines.Add(yoinked); + else + lines[i + 1] = yoinked + lines[i + 1]; + } + } + } + + fullLength = 0; + int[] lineLengths = new int[lines.Count]; + LineBreakIndexes.Clear(); + for (int i = 0; i < lines.Count; i++) + { + lineLengths[i] = lines[i].Length; + + Text += lines[i]; + + fullLength += lines[i].Length; + LineBreakIndexes.Add(fullLength); + } + + if (DialoguePage.BaseColor != null) + BaseColor = DialogueDisplaySystem.GetColorFromHex(DialoguePage.BaseColor); + + if (DialoguePage.BaseBorderColor != null) + BaseBorderColor = DialogueDisplaySystem.GetColorFromHex(DialoguePage.BaseBorderColor); + else + { + BaseBorderColor = BaseColor * DialoguePage.BorderDarkening; + BaseBorderColor.A = 255; + } + + CharacterData = new DialogueCharacterData[Text.Length]; + + for (int i = 0; i < Text.Length; i++) + { + int j = 0; + int summedLength = 0; + for (; j < lineLengths.Length; j++) + { + summedLength += lineLengths[j]; + if (i < summedLength) + break; + } + CharacterData[i] = new(i, Text.Length, j); + } + + textIndex = 0; + Crawling = true; + TextTimer = -30; + storedDelay = 0; + lockDelay = false; + DialogueTimer = 0; + Uptime = 0; + + Vector2 zero = Vector2.Zero; + bool newLine = true; + + float textWidth = 0f; + + float highestFirstLineYScale = 1f; + for (int j = 0; j < Text.Length; j++) + { + if (Text[j] == '\n') + break; + if (UniqueScales.TryGetValue(j, out Vector2 uniqueScale) && uniqueScale.Y > highestFirstLineYScale) + highestFirstLineYScale = uniqueScale.Y; + } + + SizeOffsetFromStart = new(8, 16 * highestFirstLineYScale); + + for (int i = 0; i < Text.Length; i++) + { + char c = Text[i]; + + #region Positioning + Vector2 scale = Vector2.One; + if (UniqueScales.TryGetValue(i, out Vector2 result)) + scale = result; + else if (DialoguePage.TextScale != -1) + scale *= DialoguePage.TextScale; + + //Checks for Special Characters, and handles Line Breaks + switch (c) + { + case '\n': + if (zero.X > textWidth) + textWidth = zero.X; + + zero.X = 0; + + float highestYscale = 1f; + for (int j = i + 1; j < Text.Length; j++) + { + if (Text[j] == '\n') + break; + if (UniqueScales.TryGetValue(j, out Vector2 uniqueScale) && uniqueScale.Y > highestYscale) + highestYscale = uniqueScale.Y; + } + zero.Y += FontAssetSystem.Fonts[FontKey].LineSpacing * highestYscale; + newLine = true; + continue; + case '\r': + continue; + } + + if (LineBreakIndexes.Contains(i)) + { + if (zero.X > textWidth) + textWidth = zero.X; + + zero.X = 0; + + float highestYscale = 1f; + for (int j = i + 1; j < Text.Length; j++) + { + if (Text[j] == '\n') + break; + if (UniqueScales.TryGetValue(j, out Vector2 uniqueScale) && uniqueScale.Y > highestYscale) + highestYscale = uniqueScale.Y; + } + zero.Y += FontAssetSystem.Fonts[FontKey].LineSpacing * highestYscale; + newLine = true; + } + + //Sets the character's position within the full text + SpriteCharacterData spriteData = FontAssetSystem.Fonts[FontKey].SpriteCharacters[c]; + Vector3 kerning = spriteData.Kerning; + Rectangle padding = spriteData.Padding; + + if (newLine) + kerning.X = Math.Max(kerning.X, 0f); + else + zero.X += FontAssetSystem.Fonts[FontKey].CharacterSpacing * scale.X; + + zero.X += kerning.X * scale.X; + Vector2 position = zero + spriteData.Glyph.Size() * 0.5f; + position.X += padding.X * scale.X; + position.Y += padding.Y * scale.Y; + + CharacterData[i].TextPosition = position - (Vector2.UnitY * scale.Y * FontAssetSystem.Fonts[FontKey].LineSpacing * 0.5f); + + zero.X += (kerning.Y + kerning.Z) * scale.X; + newLine = false; + #endregion + } + + if (zero.X > textWidth) + textWidth = zero.X; + float textHeight = zero.Y; + + if (DialoguePage.AlignType != Alignment.Left) + { + for (int i = 0; i < lineLengths.Length; i++) + { + DialogueCharacterData furthestChar = CharacterData.Last(d => d.LineNumber == i && Text[d.Index] != '\n'); + float xPos = furthestChar.TextPosition.X; + float dif = textWidth - xPos; + if (DialoguePage.AlignType == Alignment.Center) + foreach (var c in CharacterData.Where(c => c.LineNumber == i)) + c.TextPosition.X += dif / 2f; + else + foreach (var c in CharacterData.Where(c => c.LineNumber == i)) + c.TextPosition.X += dif; + } + } + + TextSize = new Vector2(textWidth + 8, textHeight + 12) + SizeOffsetFromStart; + } + + private void FindEffects(ref string fullLine, int fullLength) + { + Stack returnPoints = []; + Stack returnString = []; + + for (int j = 0; j < fullLine.Length; j++) + { + char c = fullLine[j]; + + if (c == '[') + { + int k = j + 1; + string currentData = "["; + bool readingData = true; + for (k = j + 1; k < fullLine.Length; k++) + { + if (fullLine[k] == ']') + break; + if (fullLine[k] == '[') + { + returnPoints.Push(j); + returnString.Push(currentData); + currentData = "["; + c = fullLine[k]; + j = k; + readingData = true; + } + else if (readingData) + { + currentData += fullLine[k]; + if (fullLine[k] == ':') + readingData = false; + } + + } + if (fullLine[k] != ']') + throw new Exception("[ was found without a ] after it."); + + string effect = fullLine[j..k]; + string ID = ""; + string Text = ""; + List Params = []; + List ColorParams = []; + List BorderColorParams = []; + string Param = ""; + bool readingText = false; + bool readingParams = false; + for (int l = 1; l < effect.Length; l++) + { + char ch = effect[l]; + if (ch == '(') + { + readingParams = true; + continue; + } + else if (ch == ':') + { + readingText = true; + continue; + } + else if (ch == ']') + break; + + if (readingText) + Text += ch; + else if (readingParams) + { + if (ch == ',' || ch == ')') + { + if (ID == "Colors") + { + if (float.TryParse(Param, out float result)) + Params.Add(result); + else + ColorParams.Add(Param); + } + else if (ID == "BorderColors") + { + if (float.TryParse(Param, out float result)) + Params.Add(result); + else + BorderColorParams.Add(Param); + } + else + { + if (float.TryParse(Param, out float result)) + Params.Add(result); + else + throw new Exception("Invalid Parameter found"); + } + Param = ""; + } + else if (ch == ' ') + continue; + else + Param += ch; + } + else + ID += ch; + } + + fullLine = fullLine.Remove(j, k - j + 1); + fullLine = fullLine.Insert(j, Text); + + if (ID == "Pause") + { + Pauses.Add(j - 1 + fullLength - ID.Length - Params[0].ToString().Length, Params[0]); + } + else + { + for (int i = 0; i < Text.Length; i++) + { + int index = j + i + fullLength; + if (ID == "Colors") + { + int storedLen = 0; + foreach (string s in returnString) + storedLen += s.Length; + + UniqueColors.Add(index - storedLen, (Params.Count == 0 ? 0 : Params[0], [.. ColorParams])); + } + else if (ID == "BorderColors") + { + int storedLen = 0; + foreach (string s in returnString) + storedLen += s.Length; + + UniqueBorderColors.Add(index - storedLen, (Params.Count == 0 ? 0 : Params[0], [.. BorderColorParams])); + } + else if (ID == "Scale") + { + int storedLen = 0; + foreach (string s in returnString) + storedLen += s.Length; + + Vector2 scale; + if (Params.Count == 0) + scale = Vector2.One; + else if (Params.Count == 1) + scale = new(Params[0], Params[0]); + else + scale = new(Params[0], Params[1]); + + + UniqueScales.Add(index - storedLen, scale); + } + else + { + int storedLen = 0; + foreach (string s in returnString) + storedLen += s.Length; + + string path = "CalamityMod.UI.DialogueDisplay.TextEffects."; + Type t = Type.GetType(path + ID) ?? throw new Exception("Invalid text effect ID found"); + TextEffect te = (TextEffect)Activator.CreateInstance(t); + if (TextEffects.TryGetValue(index - storedLen, out var value)) + value.Add(new(te, [.. Params])); + else + TextEffects.Add(index - storedLen, [new(te, [.. Params])]); + } + } + } + + if (returnPoints.Count > 0) + { + j = returnPoints.Pop() - 1; + returnString.Pop(); + } + } + } + } + + private Vector2 MeasureString(string text, DynamicSpriteFont font) + { + if (text.Length == 0) + return Vector2.Zero; + + Vector2 zero = Vector2.Zero; + zero.Y = font.LineSpacing; + float val = 0f; + int num = 0; + float num2 = 0f; + bool newLine = true; + for (int i = 0; i < text.Length; i++) + { + char c = text[i]; + Vector2 scale = Vector2.One; + if (UniqueScales.TryGetValue(i, out Vector2 result)) + scale = result; + else if (DialoguePage.TextScale != -1) + scale *= DialoguePage.TextScale; + + //Checks for Special Characters, and handles Line Breaks + switch (c) + { + case '\n': + zero.X = 0; + + float highestYscale = 1f; + for (int j = i + 1; j < text.Length; j++) + { + if (text[j] == '\n') + break; + if (UniqueScales.TryGetValue(j, out Vector2 uniqueScale) && uniqueScale.Y > highestYscale) + highestYscale = uniqueScale.Y; + } + zero.Y += font.LineSpacing * highestYscale; + newLine = true; + continue; + case '\r': + continue; + } + + //Sets the character's position within the full text + SpriteCharacterData spriteData = font.SpriteCharacters[c]; + Vector3 kerning = spriteData.Kerning; + Rectangle padding = spriteData.Padding; + + if (newLine) + kerning.X = Math.Max(kerning.X, 0f); + else + zero.X += font.CharacterSpacing * scale.X; + + zero.X += kerning.X * scale.X; + Vector2 position = zero + spriteData.Glyph.Size() * 0.5f; + position.X += padding.X * scale.X; + position.Y += padding.Y * scale.Y; + + zero.X += (kerning.Y + kerning.Z) * scale.X; + newLine = false; + } + + zero.X += Math.Max(num2, 0f); + zero.Y += num * font.LineSpacing; + zero.X = Math.Max(zero.X, val); + return zero; + } + + public override void Update(GameTime gameTime) + { + base.Update(gameTime); + + if (DialoguePage.Event != null) + DialoguePage.Event.UpdateEvent(); + else if (!Switching) + { + if (DisplayEffects.FadeWhenTooFar) + { + float distFromSource = Vector2.Distance(Main.LocalPlayer.Center, Position); + SwitchCounter = (int)(MathHelper.Clamp((distFromSource - DisplayEffects.FadeBuffer) / DisplayEffects.FadeDistance, 0f, 1f) * DisplayEffects.TimeToDisappear); + } + + int textDelay = DialoguePage.TextDelay; + if (DialoguePage.TextDelay != -1) + textDelay = DialoguePage.TextDelay; + + if (DialoguePage.Event != null && !DialoguePage.Event.IsOver) + { + DialoguePage.Event.UpdateEvent(); + } + + if (textIndex < Text.Length) + { + if (TextTimer == 0) + { + if (!lockDelay) + { + PunctuationData data = new(); + if (DialoguePage.BasePunctuationDelay != null) + data = DialoguePage.BasePunctuationDelay; + + if (DialoguePage.PunctuationDelays != null) + { + if (DialoguePage.PunctuationDelays.TryGetValue(Text[textIndex].ToString(), out var value)) + data = value; + else if (DialoguePage.PunctuationDelays.TryGetValue(Text[textIndex].ToString(), out value)) + data = value; + } + + switch (Text[textIndex]) + { + case '.': + case '?': + case '!': + case ';': + case ':': + case ',': + if (data.ForceSet) + storedDelay = data.Delay; + else + storedDelay += data.Delay; + break; + case '-': + case '–': + case '—': + if (textIndex == Text.Length - 1 || Text[textIndex + 1] == ' ') + { + if (data.ForceSet) + storedDelay = data.Delay; + else + storedDelay += data.Delay; + } + break; + } + + if (data.Locks) + lockDelay = true; + } + + if (Pauses.TryGetValue(textIndex, out float pause)) + storedDelay = (int)(pause * 60); + } + + if (++TextTimer % ((Text[textIndex] == ' ' || Text[textIndex] == '\n') && storedDelay > 0 ? textDelay + storedDelay : textDelay) == 0 && TextTimer >= 0) + { + if (Text[textIndex] == ' ') + { + storedDelay = 0; + lockDelay = false; + } + else + { + string speaker = null; + if (DialoguePage.Speaker != null) + speaker = DialoguePage.Speaker; + if (speaker != null) + SoundEngine.PlaySound(DialogueSounds[speaker]); + } + + TextTimer = 0; + ++textIndex; + } + } + else + Crawling = false; + } + + if (!Crawling) + Uptime++; + DialogueTimer++; + } + + protected override void DrawSelf(SpriteBatch spriteBatch) + { + Vector2 textTop = DisplayEffects.TextOffsetFromStart(Position, TextSize); + Vector2 pageTop = textTop - SizeOffsetFromStart; + + DisplayEffects.PreDraw(spriteBatch, pageTop, TextSize, DialogueTimer, SwitchCounter); + + #region Shadow Drawing + for (int i = 0; i < textIndex; i++) + { + char c = Text[i]; + + if (c == '\r' || c == '\n') + continue; + + if (CharacterData == null) + Activate(); + + Vector2 drawPos; + float rotation = 0f; + float opacity = 1f; + Vector2 scale = Vector2.One; + if (UniqueScales.TryGetValue(i, out Vector2 result)) + scale = result; + + Color color; + if (UniqueColors.TryGetValue(i, out var textColors)) + { + Color[] colors = new Color[textColors.hexcodes.Length]; + for (int j = 0; j < colors.Length; j++) + colors[j] = DialogueDisplaySystem.GetColorFromHex(textColors.hexcodes[j]); + + color = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly + (i * textColors.IndexOffset), colors); + } + else + color = BaseColor; + + Color borderColor; + if (UniqueBorderColors.TryGetValue(i, out var borderColors)) + { + Color[] colors = new Color[borderColors.hexcodes.Length]; + for (int j = 0; j < colors.Length; j++) + colors[j] = DialogueDisplaySystem.GetColorFromHex(borderColors.hexcodes[j]); + + borderColor = CalamityUtils.MulticolorLerp(Main.GlobalTimeWrappedHourly + (i * borderColors.IndexOffset), colors); + } + else + borderColor = BaseBorderColor; + + if (CharacterData[i].Timer < DisplayEffects.TimeToAppear) + { + drawPos = DisplayEffects.AppearPositioning(Position, textTop + CharacterData[i].TextPosition, CharacterData[i].Timer, CharacterData[i]); + opacity = DisplayEffects.AppearOpacity(opacity, CharacterData[i].Timer, CharacterData[i]); + color = DisplayEffects.AppearColoring(color, CharacterData[i].Timer, CharacterData[i]); + rotation = DisplayEffects.AppearRotation(rotation, CharacterData[i].Timer, CharacterData[i]); + scale = DisplayEffects.AppearScale(scale, CharacterData[i].Timer, CharacterData[i]); + } + else + drawPos = textTop + CharacterData[i].TextPosition; + + if (SwitchCounter > 0) + { + drawPos = DisplayEffects.DisappearPositioning(drawPos, SwitchCounter, CharacterData[i]); + opacity = DisplayEffects.DisappearOpacity(opacity, SwitchCounter, CharacterData[i]); + color = DisplayEffects.DisappearColoring(color, SwitchCounter, CharacterData[i]); + rotation = DisplayEffects.DisappearRotation(rotation, SwitchCounter, CharacterData[i]); + scale = DisplayEffects.DisappearScale(scale, SwitchCounter, CharacterData[i]); + } + + if (!ScreenLocked) + drawPos -= Main.screenPosition; + + foreach (var l in TextEffects.Where(v => v.Key == i)) + foreach ((TextEffect Effect, float[] args) in l.Value) + { + drawPos = Effect.ModifyPos(drawPos, CharacterData[i], args); + + rotation = Effect.ModifyRot(rotation, CharacterData[i], args); + + color = Effect.ModifyColor(color, CharacterData[i], args); + + scale = Effect.ModifyScale(scale, CharacterData[i], args); + } + + SpriteCharacterData spriteData = FontAssetSystem.Fonts[FontKey].SpriteCharacters[c]; + Vector2 origin = spriteData.Glyph.Size() * 0.5f; + + CharacterData[i].SetDrawInfo(drawPos, spriteData.Glyph, color * opacity, rotation, scale); + + foreach (var l in TextEffects.Where(v => v.Key == i)) + foreach ((TextEffect Effect, float[] args) in l.Value) + Effect.PreDraw(spriteBatch, spriteData.Texture, CharacterData[i]); + + for (int j = 0; j < ChatManager.ShadowDirections.Length; j++) + spriteBatch.Draw(spriteData.Texture, drawPos + (ChatManager.ShadowDirections[j] * 2), spriteData.Glyph, borderColor * opacity, rotation, origin, scale, SpriteEffects.None, 0); + } + #endregion + + #region Character Drawing + for (int i = 0; i < textIndex; i++) + { + char c = Text[i]; + + if (c == '\r' || c == '\n') + continue; + + if (CharacterData == null) + Activate(); + + SpriteCharacterData spriteData = FontAssetSystem.Fonts[FontKey].SpriteCharacters[c]; + Vector2 origin = spriteData.Glyph.Size() * 0.5f; + + spriteBatch.Draw(spriteData.Texture, CharacterData[i].DrawPosition, spriteData.Glyph, CharacterData[i].DrawColor, CharacterData[i].Rotation, origin, CharacterData[i].Scale, SpriteEffects.None, 0); + + foreach (var l in TextEffects.Where(v => v.Key == i)) + foreach ((TextEffect Effect, float[] args) in l.Value) + Effect.PostDraw(spriteBatch, spriteData.Texture, CharacterData[i]); + + CharacterData[i].Timer++; + } + #endregion + + DisplayEffects.PostDraw(spriteBatch, pageTop, TextSize, DialogueTimer, SwitchCounter); + } + } + + public class DialogueDisplaySystem : ModSystem + { + internal static DialogueDisplayUI State; + + internal static UserInterface UI; + + public override void Load() + { + if (!Main.dedServ) + { + UI = new(); + State = new(); + State.Activate(); + } + } + + public override void ModifyInterfaceLayers(List layers) + { + int preInventory = layers.FindIndex(layer => layer.Name == "Vanilla: Interface Logic 2"); + if (preInventory != -1) + { + layers.Insert(preInventory, new LegacyGameInterfaceLayer("Dialogue Display", () => + { + UI.Draw(Main.spriteBatch, new()); + return true; + }, InterfaceScaleType.Game)); + } + } + + public override void UpdateUI(GameTime gameTime) + { + if (UI?.CurrentState != null) + UI?.Update(gameTime); + } + + public static readonly JsonSerializerOptions stringEnumOptions = new() + { + Converters = { new JsonStringEnumConverter() } + }; + + public static DialogueTextData Deserialize(string name) + { + string activeExtension = LanguageManager.Instance.ActiveCulture.Name; + string path = "UI/DialogueDisplay/" + activeExtension + "/" + name + ".json"; + + // Fall back to english if not found + if (!CalamityMod.Instance.FileExists(path)) + path = "UI/DialogueDisplay/en-US/" + name + ".json"; + + // Throw if we cant find english either + if (!CalamityMod.Instance.FileExists(path)) + throw new FileNotFoundException($"Could not find the dialog file {path}."); + + Stream stream = CalamityMod.Instance.GetFileStream(path); + + DialogueTextData data = JsonSerializer.Deserialize(stream, stringEnumOptions); + + stream.Close(); + + return data; + } + + public static Color GetColorFromHex(string hex) + { + System.Drawing.Color color = System.Drawing.ColorTranslator.FromHtml('#' + hex); + int r = Convert.ToInt16(color.R); + int g = Convert.ToInt16(color.G); + int b = Convert.ToInt16(color.B); + return new Color(r, g, b); + } + + /// + /// Returns the slot of the first dialogue instance with the coorisponding name + /// + public static int GetSlot(string name) + { + foreach(var pair in DialogueDisplayUI.Dialogues) + if(pair.Value.name == name) + return pair.Key; + return -1; + } + + /// + /// Manually progresses dialogue + /// + public static void ProgressDialogue(int slot) + { + if (DialogueDisplayUI.Dialogues.TryGetValue(slot, out var val)) + { + DialogueDisplay display = val.ui; + if (display.SwitchingPage) + return; + + // If the text crawl hasnt finished, finish it instantly + if (display.textIndex < display.Text.Length - 1) + display.textIndex = display.Text.Length - 1; + // If the text crawl has finished, progress to the next page or finish if we're out of pages + else + display.SwitchingPage = true; + } + } + + /// + /// Ends the dialogue if it exists in the world + /// + /// The name of the dialogue's localization key + public static void EndDialogue(int slot) + { + if (DialogueDisplayUI.Dialogues.TryGetValue(slot, out var val)) + val.ui.ClosingDialogue = true; + } + + public static void RemoveDialogue(int slot) + { + DialogueDisplayUI.DialoguesToRemove.Add(slot); + } + + /// + /// Creates a dialogue instance in the world + /// + /// The name of the dialogue's localization key + /// The position of the text in the world + public static int StartDialogue(string name, Vector2 startPosition, int startIndex = 0, int Uptime = -1, bool progressDialogue = true, DisplayEffect effects = null, float wrapWidth = -1) + { + UI ??= new(); + State ??= new(); + effects ??= new DisplayEffect(); + + DialogueTextData textData = Deserialize(name); + + if (startIndex >= textData.PageCount) + startIndex = textData.PageCount - 1; + + DialogueDisplay display = new(textData.Pages[startIndex], effects, wrapWidth: wrapWidth) + { + Position = startPosition, + ProgressDialogue = progressDialogue, + }; + + int slot; + for (slot = 0; slot <= DialogueDisplayUI.Dialogues.Count; slot++) + if (!DialogueDisplayUI.Dialogues.ContainsKey(slot)) + break; + + DialogueDisplayUI.Dialogues.Add(slot, (name, display, textData, null, Uptime)); + + State.Append(display); + display.Activate(); + + if (UI.CurrentState != State) + UI?.SetState(State); + + return slot; + } + + /// + /// Creates a dialogue instance in the world + /// + /// The name of the dialogue's localization key + /// The entity this dialogue will appear with + /// The entity this dialogue will appear with + public static int StartDialogue(string name, Entity entity, int startIndex = 0, int Uptime = -1, DisplayEffect effects = null, float wrapWidth = -1) + { + UI ??= new(); + State ??= new(); + effects ??= new DisplayEffect(); + + DialogueTextData textData = Deserialize(name); + + if (startIndex >= textData.PageCount) + startIndex = textData.PageCount - 1; + + DialogueDisplay display = new(textData[startIndex], effects, wrapWidth: wrapWidth) + { + Position = entity.Center + }; + + int slot; + for (slot = 0; slot <= DialogueDisplayUI.Dialogues.Count; slot++) + if (!DialogueDisplayUI.Dialogues.ContainsKey(slot)) + break; + + DialogueDisplayUI.Dialogues.Add(slot, (name, display, textData, entity, Uptime)); + + State.Append(display); + display.Activate(); + + if (UI.CurrentState != State) + UI?.SetState(State); + + return slot; + } + + /// + /// Resets all of the dialogue's variables + /// + public static void EndAllDialogue() + { + DialogueDisplayUI.Dialogues.Clear(); + State.RemoveAllChildren(); + UI?.SetState(null); + } + } + + public enum Alignment + { + None = -1, + Left, + Center, + Right + } + + public class DialogueTextData + { + public DialoguePage[] Pages { get; init; } + public DialoguePage this[int index] { get => Pages[index]; set => Pages[index] = value; } + + public int Page { get; set; } + public int PageCount => Pages.Length; + + public string DefaultColor { get; init; } + public string DefaultSpeaker { get; init; } + + public int DefaultScale { get; init; } + + public Alignment AlignType { get; init; } + + public int TextDelay { get; init; } + public PunctuationData BasePunctuationDelay { get; init; } + public int PunctuationDelayCap { get; init; } + public Dictionary PunctuationDelays { get; init; } + + [JsonConstructor] + public DialogueTextData(DialoguePage[] pages, int page = 0, string defaultColor = null, string defaultSpeaker = null, int defaultScale = 1, Alignment alignType = Alignment.Left, int textDelay = 3, PunctuationData basePunctuationDelay = null, int punctuationDelayCap = 60, Dictionary punctuationDelays = null) + { + Pages = pages; + Page = page; + DefaultColor = defaultColor; + DefaultSpeaker = defaultSpeaker; + DefaultScale = defaultScale; + TextDelay = textDelay; + BasePunctuationDelay = basePunctuationDelay ?? new(); + PunctuationDelayCap = punctuationDelayCap; + PunctuationDelays = punctuationDelays ?? []; + AlignType = alignType; + + foreach (DialoguePage p in Pages) + { + p.BaseColor ??= defaultColor; + p.Speaker ??= defaultSpeaker; + if (p.TextScale == -1) + p.TextScale = DefaultScale; + if (p.TextDelay == -1) + p.TextDelay = TextDelay; + if (p.AlignType == Alignment.None) + p.AlignType = AlignType; + p.BasePunctuationDelay ??= BasePunctuationDelay; + if (p.PunctuationDelayCap == -1) + p.PunctuationDelayCap = PunctuationDelayCap; + p.PunctuationDelays ??= PunctuationDelays; + } + } + } + + public class DialoguePage + { + public string[] Lines { get; set; } + + public string BaseColor { get; set; } = null; + public string BaseBorderColor { get; set; } = null; + public float BorderDarkening { get; set; } = 0.33f; + public string Speaker { get; set; } = null; + + public int TextScale { get; set; } = -1; + public Alignment AlignType { get; set; } = Alignment.Left; + + + public int TextDelay { get; set; } = -1; + public PunctuationData BasePunctuationDelay { get; set; } = null; + public int PunctuationDelayCap { get; set; } = -1; + public Dictionary PunctuationDelays { get; set; } = null; + + public DialogueEvent Event { get; set; } = null; + } + + public class PunctuationData + { + public int Delay { get; set; } = 10; + public bool ForceSet { get; set; } = false; + public bool Locks { get; set; } = false; + } + + public class DialogueCharacterData(int index, int textLength, int lineNumber) + { + public int Timer = 0; + + #region Text Info + public int Index = index; + + public int TextLength = textLength; + + public int LineNumber = lineNumber; + + public float CompletionRatio => Index / (float)TextLength; + + public Vector2 TextPosition = Vector2.Zero; + #endregion + + #region Draw Info + public Vector2 DrawPosition; + public Rectangle Frame; + public Color DrawColor; + public float Rotation; + public Vector2 Scale; + + internal void SetDrawInfo(Vector2 drawPos, Rectangle frame, Color color, float rotation, Vector2 scale) + { + DrawPosition = drawPos; + Frame = frame; + DrawColor = color; + Rotation = rotation; + Scale = scale; + } + #endregion + } + +} diff --git a/UI/DialogueDisplay/DialogueEvents/DialogueEvent.cs b/UI/DialogueDisplay/DialogueEvents/DialogueEvent.cs new file mode 100644 index 0000000000..25f3ef9479 --- /dev/null +++ b/UI/DialogueDisplay/DialogueEvents/DialogueEvent.cs @@ -0,0 +1,18 @@ +namespace CalamityMod.UI.DialogueDisplay.DialogueEvents +{ + public abstract class DialogueEvent + { + public string ID { get; set; } + public string[] Args { get; set; } + + internal bool EventOver = true; + public bool IsOver => EventOver; + + internal int EventCounter = 0; + + public virtual void UpdateEvent() + { + EventCounter++; + } + } +} diff --git a/UI/DialogueDisplay/DialogueEvents/SoundEvent.cs b/UI/DialogueDisplay/DialogueEvents/SoundEvent.cs new file mode 100644 index 0000000000..2fc79a048f --- /dev/null +++ b/UI/DialogueDisplay/DialogueEvents/SoundEvent.cs @@ -0,0 +1,19 @@ +using ReLogic.Utilities; +using Terraria.Audio; + +namespace CalamityMod.UI.DialogueDisplay.DialogueEvents +{ + public class SoundEvent : DialogueEvent + { + SoundStyle style; + SlotId soundSlot; + + public override void UpdateEvent() + { + if (EventCounter == 0) + soundSlot = SoundEngine.PlaySound(style = new SoundStyle(Args[0])); + else if (!SoundEngine.TryGetActiveSound(soundSlot, out var result) || result.Style != style) + EventOver = true; + } + } +} diff --git a/UI/DialogueDisplay/DisplayEffects/AlwaysOnScreen.cs b/UI/DialogueDisplay/DisplayEffects/AlwaysOnScreen.cs new file mode 100644 index 0000000000..43b4cc0fff --- /dev/null +++ b/UI/DialogueDisplay/DisplayEffects/AlwaysOnScreen.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework.Graphics; +using Terraria.ModLoader; +using Terraria; +using Microsoft.Xna.Framework; + +namespace CalamityMod.UI.DialogueDisplay.DisplayEffects +{ + public class AlwayOnScreen : DisplayEffect + { + Vector2 StartPosition; + + public override bool FadeWhenTooFar => false; + + public override Vector2 TextOffsetFromStart(Vector2 startPos, Vector2 textSize) + { + StartPosition = startPos; + + Vector2 playerPos = Main.LocalPlayer.Center; + Vector2 halfSize = textSize * 0.5f; + Vector2 newPos = startPos - halfSize + (Vector2.UnitY * -(textSize.Y + 36)); + Vector2 screenPos = newPos.ToScreenPosition(); + + Vector2 boundTopLeftScreen = new((Main.screenWidth / 2f) - (Main.screenWidth / 2.5f), (Main.screenHeight / 2f) - (Main.screenHeight / 2.5f)); + + if (screenPos.X < boundTopLeftScreen.X) + newPos.X = playerPos.X - (Main.screenWidth / 2.5f); + if (screenPos.Y < boundTopLeftScreen.Y) + newPos.Y = playerPos.Y - (Main.screenHeight / 2.5f); + + if (newPos.X > playerPos.X + (Main.screenWidth / 2.5f) - textSize.X) + newPos.X = playerPos.X + (Main.screenWidth / 2.5f) - textSize.X; + if (newPos.Y > playerPos.Y + (Main.screenHeight / 2.5f) - textSize.Y) + newPos.Y = playerPos.Y + (Main.screenHeight / 2.5f) - textSize.Y; + + return newPos; + } + + public override void PreDraw(SpriteBatch spriteBatch, Vector2 textTopLeft, Vector2 textSize, int textTimer, int switchTimer) + { + Texture2D tex = ModContent.Request("CalamityMod/UI/DialogueDisplay/Assets/DialogueArrow").Value; + Vector2 textCenter = textTopLeft + textSize * 0.5f; + Vector2 toStart = (StartPosition - textCenter).SafeNormalize(-Vector2.UnitY) * 64; + spriteBatch.Draw(tex, textCenter + toStart - Main.screenPosition, null, Color.White, toStart.ToRotation(), tex.Size() * 0.5f, 1f, 0, 0); + } + } + +} diff --git a/UI/DialogueDisplay/DisplayEffects/BuiltEffect.cs b/UI/DialogueDisplay/DisplayEffects/BuiltEffect.cs new file mode 100644 index 0000000000..5d74c9ba32 --- /dev/null +++ b/UI/DialogueDisplay/DisplayEffects/BuiltEffect.cs @@ -0,0 +1,12 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.UI.DialogueDisplay.DisplayEffects +{ + public class BuiltEffect : DisplayEffect + { + public override Vector2 AppearPositioning(Vector2 startPos, Vector2 goalPos, float time, DialogueCharacterData charData) => Vector2.Lerp(goalPos + Vector2.UnitX.RotatedBy(charData.Index) * 400, goalPos, time / TimeToAppear); + + public override float AppearRotation(float goalRotation, float time, DialogueCharacterData charData) => MathHelper.Lerp(goalRotation + MathHelper.TwoPi * 2, goalRotation, time / TimeToAppear); + } +} diff --git a/UI/DialogueDisplay/DisplayEffects/DisplayEffect.cs b/UI/DialogueDisplay/DisplayEffects/DisplayEffect.cs new file mode 100644 index 0000000000..d4cb2b60d3 --- /dev/null +++ b/UI/DialogueDisplay/DisplayEffects/DisplayEffect.cs @@ -0,0 +1,49 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.UI.DialogueDisplay.DisplayEffects +{ + public class DisplayEffect + { + public virtual Vector2 TextOffsetFromStart(Vector2 startPos, Vector2 textSize) => startPos + new Vector2(-textSize.X / 2f, -(textSize.Y + 40)); + + public virtual bool FadeWhenTooFar => true; + + public virtual float FadeBuffer => 150f; + + public virtual float FadeDistance => 150f; + + public virtual void PreDraw(SpriteBatch spriteBatch, Vector2 textStart, Vector2 textSize, int textTimer, int switchTimer) { } + + public virtual void PostDraw(SpriteBatch spriteBatch, Vector2 textStart, Vector2 textSize, int textTimer, int switchTimer) { } + + public virtual float TimeToAppear => 30; + + #region Appear Functions + public virtual Vector2 AppearPositioning(Vector2 startPos, Vector2 goalPos, float time, DialogueCharacterData charData) => Vector2.Lerp(startPos, goalPos, CalamityUtils.SineOutEasing(time / TimeToAppear, 1)); + + public virtual Color AppearColoring(Color goalColor, float time, DialogueCharacterData charData) => goalColor; + + public virtual float AppearOpacity(float goalOpacity, float time, DialogueCharacterData charData) => CalamityUtils.SineOutEasing(MathHelper.Clamp(time / 20f, 0f, 1f), 1); + + public virtual float AppearRotation(float goalRotation, float time, DialogueCharacterData charData) => goalRotation; + + public virtual Vector2 AppearScale(Vector2 goalScale, float time, DialogueCharacterData charData) => Vector2.Lerp(Vector2.Zero, goalScale, CalamityUtils.CircOutEasing(time / TimeToAppear, 1)); + #endregion + + public virtual float TimeToDisappear => 30; + + #region Disappear Functions + public virtual Vector2 DisappearPositioning(Vector2 startPos, float time, DialogueCharacterData charData) => startPos; + + public virtual Color DisappearColoring(Color startColor, float time, DialogueCharacterData charData) => startColor; + + public virtual float DisappearOpacity(float startOpacity, float time, DialogueCharacterData charData) => 1 - CalamityUtils.SineOutEasing(MathHelper.Clamp(time / (TimeToDisappear * 0.66f), 0f, 1f), 1); + + public virtual float DisappearRotation(float startRotation, float time, DialogueCharacterData charData) => startRotation; + + public virtual Vector2 DisappearScale(Vector2 startScale, float time, DialogueCharacterData charData) => Vector2.Lerp(startScale, startScale * 1.5f, CalamityUtils.ExpOutEasing(time / TimeToDisappear, 1)); + #endregion + } + +} diff --git a/UI/DialogueDisplay/DisplayEffects/WhisperingPearlEffects.cs b/UI/DialogueDisplay/DisplayEffects/WhisperingPearlEffects.cs new file mode 100644 index 0000000000..420dbd1258 --- /dev/null +++ b/UI/DialogueDisplay/DisplayEffects/WhisperingPearlEffects.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework; +using Terraria.ModLoader; +using Terraria; + +namespace CalamityMod.UI.DialogueDisplay.DisplayEffects +{ + public class WhisperingPearlEffects : DisplayEffect + { + public override void PreDraw(SpriteBatch spriteBatch, Vector2 textStart, Vector2 textSize, int textTimer, int switchTimer) + { + if (textTimer < 0) + return; + + float Opacity = 1f; + if (textTimer < 30f) + Opacity = MathHelper.Lerp(0f, 1f, CalamityUtils.CircOutEasing(textTimer / 30f, 1)); + + if (switchTimer > 0) + Opacity *= 1 - CalamityUtils.CircOutEasing(switchTimer / 60f, 1); + + Texture2D tex = ModContent.Request("CalamityMod/Particles/SmallBloom").Value; + spriteBatch.Draw(tex, textStart + textSize * 0.5f - Main.screenPosition, null, Color.Black * 0.6f * Opacity, 0f, tex.Size() * 0.5f, new Vector2(textSize.X / 160f, textSize.Y / 120f), 0, 0); + } + } + +} diff --git a/UI/DialogueDisplay/TextEffects/Shaking.cs b/UI/DialogueDisplay/TextEffects/Shaking.cs new file mode 100644 index 0000000000..67ec28bf1a --- /dev/null +++ b/UI/DialogueDisplay/TextEffects/Shaking.cs @@ -0,0 +1,19 @@ +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.UI.DialogueDisplay.TextEffects +{ + internal class Shaking : TextEffect + { + private const float StandardAmp = 2f; + + public override Vector2 ModifyPos(Vector2 pos, DialogueCharacterData data, float[] args) + { + var amp = StandardAmp; + if (args.Length > 0) + amp = args[0]; + + return pos + Main.rand.NextVector2Circular(amp, amp); + } + } +} diff --git a/UI/DialogueDisplay/TextEffects/TextEffect.cs b/UI/DialogueDisplay/TextEffects/TextEffect.cs new file mode 100644 index 0000000000..50f3ce4baf --- /dev/null +++ b/UI/DialogueDisplay/TextEffects/TextEffect.cs @@ -0,0 +1,17 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; + +namespace CalamityMod.UI.DialogueDisplay.TextEffects +{ + public abstract class TextEffect + { + public virtual Vector2 ModifyPos(Vector2 pos, DialogueCharacterData data, float[] args) => pos; + public virtual float ModifyRot(float rot, DialogueCharacterData data, float[] args) => rot; + public virtual Color ModifyColor(Color current, DialogueCharacterData data, float[] args) => current; + public virtual Vector2 ModifyScale(Vector2 scale, DialogueCharacterData data, float[] args) => scale; + + public virtual void PreDraw(SpriteBatch spritebatch, Texture2D texture, DialogueCharacterData data) { } + public virtual void PostDraw(SpriteBatch spritebatch, Texture2D texture, DialogueCharacterData data) { } + + } +} diff --git a/UI/DialogueDisplay/TextEffects/Wavy.cs b/UI/DialogueDisplay/TextEffects/Wavy.cs new file mode 100644 index 0000000000..deae5245f7 --- /dev/null +++ b/UI/DialogueDisplay/TextEffects/Wavy.cs @@ -0,0 +1,34 @@ +using System; +using Microsoft.Xna.Framework; +using Terraria; + +namespace CalamityMod.UI.DialogueDisplay.TextEffects +{ + public class Wavy : TextEffect + { + private const float StandardAmp = 6f; + + private const float StandardFreq = 1.5f; + + private const float StandardOffsetFactor = MathHelper.TwoPi / 320f; //since we use position, this means a full cycle will occur every 320 coordiantes + + public override Vector2 ModifyPos(Vector2 pos, DialogueCharacterData data, float[] args) + { + var amp = StandardAmp; + if(args.Length > 0) + amp = args[0]; + + var freq = StandardFreq; + if (args.Length > 1) + freq = args[1]; + + var indexFactor = StandardOffsetFactor; + if (args.Length > 2) + indexFactor = args[2]; + + var sineWave = (float)Math.Sin(Main.GlobalTimeWrappedHourly * freq + data.TextPosition.X * indexFactor) * amp; + + return pos + Vector2.UnitY * sineWave; + } + } +} diff --git a/UI/DialogueDisplay/en-US/OceanBlue.json b/UI/DialogueDisplay/en-US/OceanBlue.json new file mode 100644 index 0000000000..3343eb23ee --- /dev/null +++ b/UI/DialogueDisplay/en-US/OceanBlue.json @@ -0,0 +1,27 @@ +{ + "Pages": [ + { + "BaseColor": "6383FF", + "BaseBorderColor": "020104", + "Speaker": "Amidias", + + "PunctuationDelays": { + "!": { + "Delay": 40, + "ForceSet": true, + "Locks": true + }, + "?": { + "Delay": 40, + "ForceSet": true, + "Locks": true + } + }, + + "Lines": [ + "[Wavy:'Glub, glub, im a fish. Glub glub, im a fish]", + "[Wavy:[BorderColors(EEA5A9):Glub, glub, im a fish. Glub glub, im a fish']]" + ] + } + ] +} \ No newline at end of file diff --git a/UI/DialogueDisplay/en-US/RoyalBlue.json b/UI/DialogueDisplay/en-US/RoyalBlue.json new file mode 100644 index 0000000000..4e808a2a2d --- /dev/null +++ b/UI/DialogueDisplay/en-US/RoyalBlue.json @@ -0,0 +1,179 @@ +{ + "TextDelay": 3, + "BasePunctuationDelay": { + "Delay": 10, + "ForceSet": false, + "Locks": false + }, + "PunctuationDelayCap": 30, + "PunctuationDelays": { + "!": { + "Delay": 20, + "ForceSet": true, + "Locks": true + }, + "?": { + "Delay": 20, + "ForceSet": true, + "Locks": true + } + }, + + "Pages": [ + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + + "TextDelay": 5, + "PunctuationDelays": { + "!": { + "Delay": 40, + "ForceSet": true, + "Locks": true + }, + "?": { + "Delay": 40, + "ForceSet": true, + "Locks": true + } + }, + + "Lines": [ + "[Wavy:'My Goddess... [Pause(2.5)]Are you sure of the course of action? [Pause(2.5)]]", + "[Wavy:We could all flee, [Pause(1)]we have the resources left for a full evacuation.']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'No matter to where we flee, the] [Wavy:[Shaking:[Scale(2):[Colors(FFD500):Godseeker]]]] [Wavy:and his troops will]", + "[Wavy:always be one step away. Even if we hid beneath the deepest of waters]", + "[Wavy:nothing will stop the wrath soon approaching.']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'Can't we erase any trail? Hide until his ultimate passing?]", + "[Wavy:Fake your death?!']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'...Oh, Amidias. I couldn't have wished for a better king.]", + "[Wavy:But the truth is...']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'Please, don't tell me you believe him.']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'...In his deathbed, [Colors(00FFD5):Vetrasyl] confessed to me.]", + "[Wavy:Of his weakness in the face of danger and shame of his escape.]", + "[Wavy:Despite his pleas to carry on his will,]", + "[Wavy:his sureness that he was entrusting the right woman,]", + "[Wavy:I knew that once I consumed his Soul, I would be a sinner.']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'...Otonilou, I will not...']" + ] + }, + + { + "BaseColor": "A75C1B", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'But none of you are.']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'I have bared my sin for longer than that man's wretched walk upon our planet,]", + "[Wavy:but my people were never sinners!]", + "[Wavy:None of you deserve this fate, to be erased from memory!]", + "[Wavy:And on this day, Amidias...']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'If I am a sinner,]", + "[Wavy:then my death shall wash away the sins of all who call themselves Ilmerans.]", + "[Wavy:I shall burn with our nation so that those who yet live may rise from its ashes,]", + "[Wavy:all free from the sin of your Gods!']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'My Goddess, I... I...']" + ] + + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'Shed not a tear, Amidias.]", + "[Wavy:I know this is a tall order, but I wouldn't be giving it to you]", + "[Wavy:if I did not trust in your resolve. So heed me... When the time comes,]", + "[Wavy:guide our people. To a new home, where the sun shines even in the deepest of waters.']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'...It shall be done, my Goddess.]", + "[Wavy:I shall not perish, not until a future for our kind is secured.]", + "[Wavy:This, I promise.']" + ] + }, + + { + "BaseColor": "6383FF", + "Speaker": "Amidias", + "Lines": [ + "[Wavy:'It was an honor to serve you, Otonilou.']" + ] + }, + + { + "BaseColor": "83ECEE", + "Speaker": "Otonilou", + "Lines": [ + "[Wavy:'And it was an honor to have met you, my king.']" + ] + } + ] +} \ No newline at end of file diff --git a/UI/DraedonSummoning/CodebreakerUI.Communication.cs b/UI/DraedonSummoning/CodebreakerUI.Communication.cs index bfaa365107..341ccc23b8 100644 --- a/UI/DraedonSummoning/CodebreakerUI.Communication.cs +++ b/UI/DraedonSummoning/CodebreakerUI.Communication.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using CalamityMod.Fonts; using CalamityMod.NPCs.ExoMechs; using log4net; using Microsoft.Xna.Framework; @@ -232,15 +233,6 @@ namespace CalamityMod.UI.DraedonSummoning internal set; } = new(); - /// - /// The font used for displaying dialog. - /// - public static DynamicSpriteFont DialogFont - { - get; - internal set; - } - /// /// The dialog hover sound. /// @@ -256,17 +248,6 @@ namespace CalamityMod.UI.DraedonSummoning new("CalamityMod/Sounds/Custom/Codebreaker/DraedonTalk3") }; - public override void OnModLoad() - { - if (Main.dedServ) - return; - - if (Environment.OSVersion.Platform == PlatformID.Win32NT) - DialogFont = CalamityMod.Instance.Assets.Request("Fonts/CodebreakerDialog", AssetRequestMode.ImmediateLoad).Value; - else - DialogFont = FontAssets.MouseText.Value; - } - public static void DisplayCommunicationPanel() { // Draw the background panel. This pops up. @@ -433,7 +414,7 @@ namespace CalamityMod.UI.DraedonSummoning Color textColor = Color.Cyan; Color markerColor = Color.White; - Vector2 textArea = DialogFont.MeasureString(inquiry) * GeneralScale; + Vector2 textArea = FontAssetSystem.Fonts["CodebreakerDialog"].MeasureString(inquiry) * GeneralScale; Rectangle textAreaRect = new((int)textTopLeft.X, (int)textTopLeft.Y, (int)(textArea.X * 0.9f), (int)textArea.Y); Rectangle markerArea = Utils.CenteredRectangle(markerDrawPosition, markerTextureSize); textAreaRect.Y = markerArea.Y; @@ -514,7 +495,7 @@ namespace CalamityMod.UI.DraedonSummoning Vector2 markerTextureOrigin = markerTexture.Size() * 0.5f; Main.spriteBatch.Draw(markerTexture, markerDrawPosition, null, markerColor * opacity, 0f, markerTextureOrigin, markerScale, 0, 0f); - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, DialogFont, inquiry, textTopLeft, textColor * opacity, 0f, Vector2.Zero, Vector2.One * GeneralScale * 0.85f); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssetSystem.Fonts["CodebreakerDialog"], inquiry, textTopLeft, textColor * opacity, 0f, Vector2.Zero, Vector2.One * GeneralScale * 0.85f); textTopLeft.Y += verticalOffsetPerOption; OptionsTextHeight += verticalOffsetPerOption; } @@ -632,7 +613,7 @@ namespace CalamityMod.UI.DraedonSummoning foreach (var entry in dialogEntries) { int lineIndex = 0; - foreach (string line in Utils.WordwrapString(entry.Dialog, DialogFont, 336, 1000, out _)) + foreach (string line in Utils.WordwrapString(entry.Dialog, FontAssetSystem.Fonts["CodebreakerDialog"], 336, 1000, out _)) { if (string.IsNullOrEmpty(line)) continue; @@ -650,7 +631,7 @@ namespace CalamityMod.UI.DraedonSummoning Vector2 anchorPoint = new(dialogArea.Center.X, markerDrawPosition.Y); markerDrawPosition.X = anchorPoint.X + (anchorPoint.X - markerDrawPosition.X) - GeneralScale * 12f; localTextTopLeft.X = anchorPoint.X + (anchorPoint.X - localTextTopLeft.X) - GeneralScale * 14f; - localTextTopLeft.X -= DialogFont.MeasureString(line).X * DialogTextScale.X; + localTextTopLeft.X -= FontAssetSystem.Fonts["CodebreakerDialog"].MeasureString(line).X * DialogTextScale.X; localTextTopLeft.Y -= localTextOffsetY; // Use a neutral grey-ish color if text is being said by the player. @@ -664,7 +645,7 @@ namespace CalamityMod.UI.DraedonSummoning Main.spriteBatch.Draw(markerTexture, markerDrawPosition, null, Color.White * dialogHistoryDrawInterpolant, 0f, markerTextureOrigin, markerScale, markerDirection, 0f); // Draw the text itself. - ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, DialogFont, line, localTextTopLeft, dialogColor * dialogHistoryDrawInterpolant, 0f, Vector2.Zero, DialogTextScale); + ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssetSystem.Fonts["CodebreakerDialog"], line, localTextTopLeft, dialogColor * dialogHistoryDrawInterpolant, 0f, Vector2.Zero, DialogTextScale); textTopLeft.Y += panelOffsetPerLine; lineIndex++; diff --git a/UI/DraedonSummoning/CodebreakerUI.cs b/UI/DraedonSummoning/CodebreakerUI.cs index b50d05d200..5b20fbed4c 100644 --- a/UI/DraedonSummoning/CodebreakerUI.cs +++ b/UI/DraedonSummoning/CodebreakerUI.cs @@ -2,6 +2,7 @@ using System.Text; using CalamityMod.Items.DraedonMisc; using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using CalamityMod.NPCs.ExoMechs; using CalamityMod.Packets; using CalamityMod.Systems.Collections; @@ -168,13 +169,13 @@ namespace CalamityMod.UI.DraedonSummoning // Draw the cell payment slot icon. Texture2D emptyCellIconTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Empty").Value; Texture2D occupiedCellIconTexture = ModContent.Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Filled").Value; - Texture2D bloodSampleIconTexture = ModContent.Request("CalamityMod/Items/Materials/BloodSample").Value; + Texture2D bloodyVeinIconTexture = ModContent.Request("CalamityMod/Items/Pets/BloodyVein").Value; Texture2D cellTexture = emptyCellIconTexture; if (codebreakerTileEntity.InputtedCellCount > 0) { - if (codebreakerTileEntity.ContainsBloodSample) + if (codebreakerTileEntity.ContainsBloodyVein) { - cellTexture = bloodSampleIconTexture; + cellTexture = bloodyVeinIconTexture; } else { @@ -194,7 +195,7 @@ namespace CalamityMod.UI.DraedonSummoning DisplayNotStrongEnoughErrorText(schematicSlotDrawCenter + new Vector2(-24f, 56f)); // Handle decryption costs. - else if (codebreakerTileEntity.HeldSchematicID != 0 && codebreakerTileEntity.DecryptionCountdown == 0 && !codebreakerTileEntity.ContainsBloodSample) + else if (codebreakerTileEntity.HeldSchematicID != 0 && codebreakerTileEntity.DecryptionCountdown == 0 && !codebreakerTileEntity.ContainsBloodyVein) { int cost = codebreakerTileEntity.DecryptionCellCost; DisplayCostText(costDisplayLocation, cost); @@ -247,8 +248,8 @@ namespace CalamityMod.UI.DraedonSummoning // Create a temporary item for drawing purposes. // If cells are present, make the item reflect that. Item temporaryPowerCell = new Item(); - if (codebreakerTileEntity.ContainsBloodSample) - temporaryPowerCell.SetDefaults(ModContent.ItemType()); + if (codebreakerTileEntity.ContainsBloodyVein) + temporaryPowerCell.SetDefaults(ModContent.ItemType()); else temporaryPowerCell.SetDefaults(ModContent.ItemType()); @@ -313,7 +314,7 @@ namespace CalamityMod.UI.DraedonSummoning if (Main.mouseLeft && Main.mouseLeftRelease && codebreakerTileEntity.DecryptionCountdown <= 0) { int powercellID = ModContent.ItemType(); - int sampleID = ModContent.ItemType(); + int sampleID = ModContent.ItemType(); short cellStackDiff = 0; bool shouldPlaySound = true; @@ -323,7 +324,7 @@ namespace CalamityMod.UI.DraedonSummoning cellStackDiff = (short)-Math.Min(temporaryItem.stack, temporaryItem.maxStack); Player p = Main.LocalPlayer; var source = p.GetSource_TileInteraction(codebreakerTileEntity.Position.X, codebreakerTileEntity.Position.Y); - p.QuickSpawnItem(source, codebreakerTileEntity.ContainsBloodSample ? sampleID : powercellID, -cellStackDiff); + p.QuickSpawnItem(source, codebreakerTileEntity.ContainsBloodyVein ? sampleID : powercellID, -cellStackDiff); // Do not play a sound in this situation. The player is going to pick up the dropped cells in a few frames, which will make sound. shouldPlaySound = false; @@ -333,7 +334,7 @@ namespace CalamityMod.UI.DraedonSummoning else { bool holdingPowercell = playerHandItem.type == powercellID || (playerHandItem.type == sampleID && Main.zenithWorld); - bool powercellsinserted = !codebreakerTileEntity.ContainsBloodSample && temporaryItem.stack > 0; + bool powercellsinserted = !codebreakerTileEntity.ContainsBloodyVein && temporaryItem.stack > 0; bool cansummon = codebreakerTileEntity.ReadyToSummonDraedon && CalamityWorld.AbleToSummonDraedon; // If the player's held power cells can be stacked on top of what's already in the codeberaker, then stack them. @@ -347,7 +348,7 @@ namespace CalamityMod.UI.DraedonSummoning { SoundEngine.PlaySound(BloodSound, codebreakerTileEntity.Center); } - codebreakerTileEntity.ContainsBloodSample = true; + codebreakerTileEntity.ContainsBloodyVein = true; int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; @@ -362,7 +363,7 @@ namespace CalamityMod.UI.DraedonSummoning // If theres nothing inside or there are cells inside, cells can be inserted if (playerHandItem.type == powercellID && (temporaryItem.stack == 0 || powercellsinserted)) { - codebreakerTileEntity.ContainsBloodSample = false; + codebreakerTileEntity.ContainsBloodyVein = false; int spaceLeft = TECodebreaker.MaxCellCapacity - temporaryItem.stack; @@ -387,7 +388,7 @@ namespace CalamityMod.UI.DraedonSummoning playerHandItem.stack = -cellStackDiff; temporaryItem.TurnToAir(); AwaitingDecryptionTextClose = false; - codebreakerTileEntity.ContainsBloodSample = false; + codebreakerTileEntity.ContainsBloodyVein = false; } } @@ -637,7 +638,7 @@ namespace CalamityMod.UI.DraedonSummoning Rectangle clickArea = Utils.CenteredRectangle(drawPosition, contactButton.Size() * VerificationButtonScale); - float iconrotation = codebreakerTileEntity.ContainsBloodSample ? Main.GlobalTimeWrappedHourly * 20f : 0f; + float iconrotation = codebreakerTileEntity.ContainsBloodyVein ? Main.GlobalTimeWrappedHourly * 20f : 0f; // Check if the mouse is hovering over the contact button area. if (MouseScreenArea.Intersects(clickArea)) @@ -652,7 +653,7 @@ namespace CalamityMod.UI.DraedonSummoning { CalamityWorld.DraedonSummonCountdown = CalamityWorld.DraedonSummonCountdownMax; CalamityWorld.DraedonSummonPosition = codebreakerTileEntity.Center + new Vector2(-8f, -100f); - if (Main.zenithWorld && codebreakerTileEntity.ContainsBloodSample) + if (Main.zenithWorld && codebreakerTileEntity.ContainsBloodyVein) { CalamityWorld.DraedonMechdusa = true; } @@ -677,7 +678,7 @@ namespace CalamityMod.UI.DraedonSummoning string contactTextKey = "Contact"; if (DownedBossSystem.downedExoMechs) contactTextKey = "Summon"; - if (codebreakerTileEntity.ContainsBloodSample) + if (codebreakerTileEntity.ContainsBloodyVein) contactTextKey = "Evoke"; string contactText = CalamityUtils.GetTextValue("UI." + contactTextKey); diff --git a/UI/DraedonsArsenal/ChargeMeterUI.cs b/UI/DraedonsArsenal/ChargeMeterUI.cs index af52bdb329..57c70e0ead 100644 --- a/UI/DraedonsArsenal/ChargeMeterUI.cs +++ b/UI/DraedonsArsenal/ChargeMeterUI.cs @@ -65,7 +65,7 @@ namespace CalamityMod.UI.DraedonsArsenal changed = true; } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } // If the Charge Meter is turned off or the player is not holding an item, stop. @@ -132,7 +132,7 @@ namespace CalamityMod.UI.DraedonsArsenal if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } } diff --git a/UI/DraedonsArsenal/PowerCellSlot_Blood.png b/UI/DraedonsArsenal/PowerCellSlot_Blood.png index 21ab14e734..709119d21e 100644 Binary files a/UI/DraedonsArsenal/PowerCellSlot_Blood.png and b/UI/DraedonsArsenal/PowerCellSlot_Blood.png differ diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index f344bc517c..ce2f74805e 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -125,7 +125,7 @@ namespace CalamityMod.UI } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); return; } @@ -175,7 +175,7 @@ namespace CalamityMod.UI if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } } @@ -237,9 +237,9 @@ namespace CalamityMod.UI Vector2 origin = new Vector2(correctBorder.Width * 0.5f, (correctBorder.Height / FlightAnimFrames) * 0.5f); float xOffset = (correctBorder.Width - flightBarAnimTexture.Width) / 2f; int frameHeight = (flightBarAnimTexture.Height / FlightAnimFrames) - 1; - Vector2 sizeDiffOffset = new Vector2(xOffset, -37f); + Vector2 sizeDiffOffset = new Vector2(xOffset, -37f) * uiScale; Rectangle animCropRect = new Rectangle(0, (frameHeight + 1) * FlightAnimFrame, flightBarAnimTexture.Width, frameHeight); - spriteBatch.Draw(flightBarAnimTexture, screenPos + sizeDiffOffset, animCropRect, Color.White, 0f, origin * Main.UIScale, uiScale, SpriteEffects.None, 0); + spriteBatch.Draw(flightBarAnimTexture, screenPos + sizeDiffOffset, animCropRect, Color.White, 0f, origin, uiScale, SpriteEffects.None, 0); } } diff --git a/UI/ModeIndicator/ModeIndicatorLock.png b/UI/ModeIndicator/ModeIndicatorLock.png index f440e5748d..ae7b9e6073 100644 Binary files a/UI/ModeIndicator/ModeIndicatorLock.png and b/UI/ModeIndicator/ModeIndicatorLock.png differ diff --git a/UI/ModeIndicator/ModeIndicatorOutline.png b/UI/ModeIndicator/ModeIndicatorOutline.png index d4f1f87ee3..8cfff31c70 100644 Binary files a/UI/ModeIndicator/ModeIndicatorOutline.png and b/UI/ModeIndicator/ModeIndicatorOutline.png differ diff --git a/UI/ModeIndicator/ModeIndicatorUI.cs b/UI/ModeIndicator/ModeIndicatorUI.cs index acc4d7cb1b..f56da1d192 100644 --- a/UI/ModeIndicator/ModeIndicatorUI.cs +++ b/UI/ModeIndicator/ModeIndicatorUI.cs @@ -1,17 +1,13 @@ using System; -using System.Collections.Generic; using System.Linq; -using System.Runtime.InteropServices; using System.Text.RegularExpressions; using CalamityMod.CalPlayer; using CalamityMod.Events; using CalamityMod.Systems; -using CalamityMod.World; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.Audio; -using Terraria.GameInput; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -49,7 +45,7 @@ namespace CalamityMod.UI.ModeIndicator internal static int MenuAnimLength => MostAlternateDifficulties > 1 ? 60 : 40; private static int menuOpenTransitionTime = 0; private static DifficultyMode previouslyHoveredMode = null; - public static float WidthForTier(int alts) => (alts - 1) * 40f; + public static float WidthForTier(int alts) => (alts - 1) * 44f; private static void ClearVariables() { @@ -207,14 +203,14 @@ namespace CalamityMod.UI.ModeIndicator if (MouseScreenArea.Intersects(MainClickArea)) { //Display the first non-none difficulty by default - string modeToDisplay = Difficulties[1].Name.ToString(); - bool anyActiveMode = false; + string modeToDisplay = Main.getGoodWorld ? Difficulties[0].FTWName.ToString() : Difficulties[1].Name.ToString(); + bool anyActiveMode = Main.getGoodWorld ? true : false; for (int i = 1; i < Difficulties.Count; i++) { if (GetCurrentDifficulty == Difficulties[i]) { - modeToDisplay = Difficulties[i].Name.ToString(); + modeToDisplay = Main.getGoodWorld ? Difficulties[i].FTWName.ToString() : Difficulties[i].Name.ToString(); anyActiveMode = true; } } @@ -229,12 +225,7 @@ namespace CalamityMod.UI.ModeIndicator { locked = false; text = CalamityUtils.GetText("UI.DifficultyClickText"); - if (!Main.expertMode && GetCurrentDifficulty == Difficulties[0]) - { - locked = true; - text = CalamityUtils.GetText("UI.ExpertDifficultyLock"); - } - else if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) + if (CalamityPlayer.areThereAnyDamnBosses || BossRushEvent.BossRushActive) { locked = true; text = CalamityUtils.GetText("UI.ChangingTheRules"); @@ -303,7 +294,7 @@ namespace CalamityMod.UI.ModeIndicator public static void ManageHexIcons(SpriteBatch spriteBatch, out string text) { int tiers = DifficultyTiers.Count(); - float barLength = 60 * tiers * BarExpansionProgress; + float barLength = 68 * tiers * BarExpansionProgress; float progress = menuOpen ? 1 - menuOpenTransitionTime / (float)MenuAnimLength : menuOpenTransitionTime / (float)MenuAnimLength; Vector2 basePosition = DrawCenter + (barLength / (float)(tiers + 1f)) * Vector2.UnitY; @@ -322,7 +313,7 @@ namespace CalamityMod.UI.ModeIndicator for (int j = 0; j < modesAtTier; j++) { DifficultyMode mode = DifficultyTiers[i][j]; - Texture2D hexIcon = mode.Texture.Value; + Texture2D hexIcon = mode.Enabled ? mode.Texture.Value : mode.TextureDisabled.Value; Vector2 hexIconSize = hexIcon.Size(); // Get position. @@ -332,7 +323,7 @@ namespace CalamityMod.UI.ModeIndicator bool hovered = MouseScreenArea.Intersects(Utils.CenteredRectangle(iconPosition, hexIconSize)); - float usedOpacity = mode.Enabled ? 0.85f : 0.55f; + float usedOpacity = 0.85f; if (hovered) usedOpacity = MathHelper.Lerp(usedOpacity, 1f, 0.7f); @@ -355,11 +346,7 @@ namespace CalamityMod.UI.ModeIndicator text = GetDifficultyText(mode); - // Cannot switch to Death Mode if Master Mode isn't active. - // Cannot switch to Revengeance Mode if Master Mode is active. - // I hate how this is coded, it makes me want to smash my head through a wall. - Fabsol - bool cannotSwitchTo = (!Main.masterMode && mode == Difficulties[2]) || (Main.masterMode && mode == Difficulties[1]); - if (ClickingMouse && !cannotSwitchTo) + if (ClickingMouse) SwitchToDifficulty(mode); } } @@ -373,16 +360,16 @@ namespace CalamityMod.UI.ModeIndicator { Texture2D lockTexture = ModContent.Request("CalamityMod/UI/ModeIndicator/ModeIndicatorLock").Value; float rotationShift = lockClickTime == 0 ? 0f : (float)Math.Sin((1 - lockClickTime / (float)LockAnimLength) * MathHelper.TwoPi * 2f) * 0.5f * (lockClickTime / (float)LockAnimLength); - spriteBatch.Draw(lockTexture, DrawCenter + Vector2.UnitY * 12 * MainIconScale, null, Color.White, 0f + rotationShift, lockTexture.Size() * 0.5f, LockShakeScale * MainIconScale, SpriteEffects.None, 0f); + spriteBatch.Draw(lockTexture, DrawCenter + Vector2.UnitY * 24 * MainIconScale, null, Color.White, 0f + rotationShift, lockTexture.Size() * 0.5f, LockShakeScale * MainIconScale, SpriteEffects.None, 0f); } #endregion #region Difficulty toggling public static string GetDifficultyText(DifficultyMode mode) { - LocalizedText preface = mode.Name; + LocalizedText preface = Main.getGoodWorld ? mode.FTWName : mode.Name; if (mode == GetCurrentDifficulty) - preface = CalamityUtils.GetText("UI.CurrentlySelected").WithFormatArgs(mode.Name.ToString()); + preface = CalamityUtils.GetText("UI.CurrentlySelected").WithFormatArgs(Main.getGoodWorld ? mode.FTWName.ToString() : mode.Name.ToString()); string text = "\n" + mode.ShortDescription.ToString(); @@ -390,7 +377,7 @@ namespace CalamityMod.UI.ModeIndicator if (mode.ExpandedDescription != LocalizedText.Empty) { // Show the description either if the player is holding shift. - if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift)) + if (Main.keyState.PressingShift()) text += "\n" + mode.ExpandedDescription.ToString(); else @@ -407,9 +394,15 @@ namespace CalamityMod.UI.ModeIndicator if (mode == GetCurrentDifficulty) return; + // This has to be put before difficulties change as to not disrupt GetCurrentDifficulty + DisplayFormattedText("Mods.CalamityMod.UI.DifficultySwitch", Color.White, Main.getGoodWorld ? GetCurrentDifficulty.FTWTextColor.Hex3() : GetCurrentDifficulty.ChatTextColor.Hex3(), Main.getGoodWorld ? GetCurrentDifficulty.FTWName : GetCurrentDifficulty.Name + , Main.getGoodWorld ? mode.FTWTextColor.Hex3() :mode.ChatTextColor.Hex3(), Main.getGoodWorld ? mode.FTWName :mode.Name); + // Todo, maybe in the future having a way to have multiple difficulty options on the same tier that can coexist, and it works in branching pathes? Not very necessary for cal & addons. // But would be super useful so other mods can let their own difficulties go there. + DifficultyModeSystem._newGameModeID = mode.BackBoneGameModeID; + // Disable difficulties. for (int i = 0; i < Difficulties.Count; i++) { @@ -417,12 +410,7 @@ namespace CalamityMod.UI.ModeIndicator if (Difficulties[i]._difficultyTier >= mode._difficultyTier && Difficulties[i] != mode) { if (Difficulties[i].Enabled) - { - if (Difficulties[i].DeactivationTextKey != string.Empty) - DisplayLocalizedText(Difficulties[i].DeactivationTextKey, Difficulties[i].ChatTextColor); - Difficulties[i].Enabled = false; - } } } @@ -441,21 +429,24 @@ namespace CalamityMod.UI.ModeIndicator for (int j = 0; j < DifficultyTiers[i].Length; j++) DifficultyTiers[i][j].Enabled = false; - // Enable the one favored by the mode. - DifficultyTiers[i][mode.FavoredDifficultyAtTier(i)].Enabled = true; + // Enable the ones favored by the mode. + for (int j = 0; j < mode.FavoredDifficultyAtTier(i).Length; j++) + { + DifficultyTiers[i][mode.FavoredDifficultyAtTier(i)[j]].Enabled = true; + } } } - if (mode.ActivationTextKey != string.Empty) - DisplayLocalizedText(mode.ActivationTextKey, mode.ChatTextColor); - mode.Enabled = true; SoundEngine.PlaySound(mode.ActivationSound); CalamityNetcode.SyncCalamityWorldDifficulties(Main.myPlayer); - menuOpen = false; - menuOpenTransitionTime = MenuAnimLength; + if (menuOpen) + { + menuOpen = false; + menuOpenTransitionTime = MenuAnimLength; + } } #endregion diff --git a/UI/ModeIndicator/ModeIndicator_Classic.png b/UI/ModeIndicator/ModeIndicator_Classic.png new file mode 100644 index 0000000000..cec6bfee9b Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Classic.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Classic_Off.png b/UI/ModeIndicator/ModeIndicator_Classic_Off.png new file mode 100644 index 0000000000..ccf4bfccbc Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Classic_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Death.png b/UI/ModeIndicator/ModeIndicator_Death.png index 5729ede7b4..3407bf8f8d 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Death.png and b/UI/ModeIndicator/ModeIndicator_Death.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Death_Off.png b/UI/ModeIndicator/ModeIndicator_Death_Off.png new file mode 100644 index 0000000000..2a3f7cc3d5 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Death_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Expert.png b/UI/ModeIndicator/ModeIndicator_Expert.png new file mode 100644 index 0000000000..7f16d0f576 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Expert.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Expert_Off.png b/UI/ModeIndicator/ModeIndicator_Expert_Off.png new file mode 100644 index 0000000000..1ade0d9fd6 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Expert_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Master.png b/UI/ModeIndicator/ModeIndicator_Master.png new file mode 100644 index 0000000000..c69fcfaa6e Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Master.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Master_Off.png b/UI/ModeIndicator/ModeIndicator_Master_Off.png new file mode 100644 index 0000000000..91817fbfd1 Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Master_Off.png differ diff --git a/UI/ModeIndicator/ModeIndicator_None.png b/UI/ModeIndicator/ModeIndicator_None.png deleted file mode 100644 index 58648ff4ed..0000000000 Binary files a/UI/ModeIndicator/ModeIndicator_None.png and /dev/null differ diff --git a/UI/ModeIndicator/ModeIndicator_Rev.png b/UI/ModeIndicator/ModeIndicator_Rev.png index 64eec475d7..5b21cfd0fa 100644 Binary files a/UI/ModeIndicator/ModeIndicator_Rev.png and b/UI/ModeIndicator/ModeIndicator_Rev.png differ diff --git a/UI/ModeIndicator/ModeIndicator_Rev_Off.png b/UI/ModeIndicator/ModeIndicator_Rev_Off.png new file mode 100644 index 0000000000..3f8cc887fa Binary files /dev/null and b/UI/ModeIndicator/ModeIndicator_Rev_Off.png differ diff --git a/UI/ResourceSets/CalamityResourceOverlay.cs b/UI/ResourceSets/CalamityResourceOverlay.cs index b954995b71..82bcf2a992 100644 --- a/UI/ResourceSets/CalamityResourceOverlay.cs +++ b/UI/ResourceSets/CalamityResourceOverlay.cs @@ -40,6 +40,8 @@ namespace CalamityMod.UI.ResourceSets { string folder = $"{baseFolder}MP"; CalamityPlayer modPlayer = Main.LocalPlayer.Calamity(); + if (Main.LocalPlayer.statMana < 0) + return folder + "ManaBurn"; if (modPlayer.pHeart) return folder + "PhantomHeart"; if (modPlayer.eCore) @@ -92,16 +94,14 @@ namespace CalamityMod.UI.ResourceSets // dozezoze - this method is where Chalice's bleed overlay is drawn. This can almost certainly be optimized, but it shouldn't cause problems. public override void PostDrawResourceDisplay(PlayerStatsSnapshot snapshot, IPlayerResourcesDisplaySet displaySet, bool drawingLife, Color textColor, bool drawText) { - - - var CalPlayer = Main.LocalPlayer.Calamity(); - if (!CalPlayer.chaliceOfTheBloodGod) return; var Player = Main.LocalPlayer; - var bleed = CalPlayer.chaliceBleedoutBuffer; - var hearts = snapshot.AmountOfLifeHearts; + var CalPlayer = Player.Calamity(); if (drawingLife) { + if (!CalPlayer.chaliceOfTheBloodGod) return; + var bleed = CalPlayer.chaliceBleedoutBuffer; + var hearts = snapshot.AmountOfLifeHearts; var height = 0; int drawType = -1; //0 - bars 1- regular heart 2 - fancy heart Vector2 position = new Vector2(Main.screenWidth - 60, 28); @@ -147,7 +147,7 @@ namespace CalamityMod.UI.ResourceSets int width = 12 * snapshot.AmountOfLifeHearts; GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice; var barOverlay = new Texture2D(_graphicsDevice, width, 12); - Color[] barTextureData = new Color[12*12]; + Color[] barTextureData = new Color[12 * 12]; ModContent.Request("CalamityMod/UI/ResourceSets/HPChaliceBleedBar").Value.GetData(barTextureData); var pixelsPerLife = 12f / snapshot.LifePerSegment; int deadPixels = (int)Math.Floor((snapshot.LifeMax - snapshot.Life) * pixelsPerLife); @@ -163,7 +163,7 @@ namespace CalamityMod.UI.ResourceSets var bleedCol = Color.Transparent; if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels)) { - bleedCol = barTextureData[((i % 12)+(i/width)*12)]; + bleedCol = barTextureData[((i % 12) + (i / width) * 12)]; } textureData[i] = bleedCol; @@ -197,7 +197,106 @@ namespace CalamityMod.UI.ResourceSets } } } + // This is where Mana Burn is drawn + else if (Player.statMana < 0) + { + var mana = -Player.statMana; + var stars = snapshot.AmountOfManaStars; + var height = 0; + int drawType = -1; //0 - bars 1- regular heart 2 - fancy heart + Vector2 position = new Vector2(Main.screenWidth - 70, 52); + // This sets which bleed overlay draw style to use, as well as the position needed for the selected stat display + switch (displaySet.NameKey) + { + case "HorizontalBarsWithText": + height = 12; + drawType = 0; + break; + case "HorizontalBarsWithFullText": + height = 12; + position.Y -= 2; + drawType = 0; + break; + case "HorizontalBars": + height = 12; + position.Y -= 4; + drawType = 0; + break; + case "Default": + drawType = 1; + position = new Vector2(Main.screenWidth - 25, 43); + break; + case "New": + drawType = 2; + position = new Vector2(Main.screenWidth - 25, 38); + break; + case "NewWithText": + drawType = 2; + position = new Vector2(Main.screenWidth - 25, 38); + break; + } + if (drawType == -1) + { + return; // Loaded HP style doesn't match any of the vanilla ones, so we won't draw the overlay. + } + if (drawType == 0) //bars + { + + // This works by dynamically creating a texture that it then draws over the life bar. + int width = 12 * stars; + GraphicsDevice _graphicsDevice = Main.graphics.GraphicsDevice; + var barOverlay = new Texture2D(_graphicsDevice, width, 12); + Color[] barTextureData = new Color[12*12]; + ModContent.Request(ManaTexturePath() + "Bar").Value.GetData(barTextureData); + var pixelsPerLife = 12f / snapshot.ManaPerSegment; + int deadPixels = (int)Math.Floor((snapshot.ManaMax + snapshot.Mana) * pixelsPerLife); + var bleedPixels = Math.Round(mana * pixelsPerLife); + + Color[] textureData = new Color[width * 12]; + + // doze 19MAR2025 - I don't know if I could optimize this any further without switching to shaders. + // I don't expect performance issues, but at some point might be worth adding a config to disable the indicator in case of lag or accessibility concerns + for (int i = 0; i < textureData.Length; i++) + { + var i_MOD_width = i % width; //minor optimization, calculated here once instead of twice in the loop. + var bleedCol = Color.Transparent; + if ((i_MOD_width < bleedPixels + deadPixels) && !(i_MOD_width < deadPixels)) + { + bleedCol = barTextureData[((i % 12)+(i/width)*12)]; + } + textureData[i] = bleedCol; + + } + + barOverlay.SetData(textureData); + Main.spriteBatch.Draw(barOverlay, position, null, Color.White, 0, new Vector2(width, 0), 1, SpriteEffects.None, 1); + } + else if (drawType == 1) //default heart + { + Texture2D heartTexture = ModContent.Request(ManaTexturePath() + "Star").Value; + for (int i = 0; i < stars; i++) + { + Vector2 PosOffset = new Vector2(0, 28*i); + var opacity = Math.Clamp(-(i * snapshot.ManaPerSegment - snapshot.Mana) / snapshot.ManaPerSegment, -100, 100); + if ((i) * snapshot.ManaPerSegment > -snapshot.Mana) opacity = 0f; + opacity = Math.Clamp(-((i * snapshot.ManaPerSegment - (float)mana) / snapshot.ManaPerSegment), 0, 1); + Main.spriteBatch.Draw(heartTexture, position + PosOffset, null, Color.White, 0, heartTexture.Size() / 2, 1 * opacity, SpriteEffects.None, 1); + } + } + else if (drawType == 2) //fancy heart. this is the same as default but with different distances between hearts + { + Texture2D heartTexture = ModContent.Request(ManaTexturePath() + "Star").Value; + for (int i = 0; i < stars; i++) + { + Vector2 PosOffset = new Vector2(0, 22*i); + var opacity = Math.Clamp(-(i * snapshot.ManaPerSegment - snapshot.Mana) / snapshot.ManaPerSegment, -100, 100); + if ((i) * snapshot.ManaPerSegment > -snapshot.Mana) opacity = 0f; + opacity = Math.Clamp(-((i * snapshot.ManaPerSegment - (float)mana) / snapshot.ManaPerSegment), 0, 1); + Main.spriteBatch.Draw(heartTexture, position + PosOffset, null, Color.White, 0, heartTexture.Size() / 2, 1 * opacity, SpriteEffects.None, 1); + } + } + } } diff --git a/UI/ResourceSets/MPManaBurnBar.png b/UI/ResourceSets/MPManaBurnBar.png new file mode 100644 index 0000000000..ceb93f277d Binary files /dev/null and b/UI/ResourceSets/MPManaBurnBar.png differ diff --git a/UI/ResourceSets/MPManaBurnStar.png b/UI/ResourceSets/MPManaBurnStar.png new file mode 100644 index 0000000000..d5cf117948 Binary files /dev/null and b/UI/ResourceSets/MPManaBurnStar.png differ diff --git a/UI/Rippers/RipperUI.cs b/UI/Rippers/RipperUI.cs index 424310e6ec..f36c398ae7 100644 --- a/UI/Rippers/RipperUI.cs +++ b/UI/Rippers/RipperUI.cs @@ -146,7 +146,7 @@ namespace CalamityMod.UI.Rippers changed = true; } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } if (modPlayer.AdrenalineEnabled) @@ -165,7 +165,7 @@ namespace CalamityMod.UI.Rippers changed = true; } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } #region Mouse Interaction @@ -225,7 +225,7 @@ namespace CalamityMod.UI.Rippers if (ms.LeftButton == ButtonState.Released) { rageDragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } else if (adrenHover) @@ -267,7 +267,7 @@ namespace CalamityMod.UI.Rippers if (ms.LeftButton == ButtonState.Released) { adrenDragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } #endregion diff --git a/UI/SpeedrunTimerUI.cs b/UI/SpeedrunTimerUI.cs index 19eb113455..5e7d334499 100644 --- a/UI/SpeedrunTimerUI.cs +++ b/UI/SpeedrunTimerUI.cs @@ -118,7 +118,7 @@ namespace CalamityMod.UI 28 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 29 => TextureAssets.NpcHeadBoss[8].Value, // Moon Lord 30 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, - 31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, + 31 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 32 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 33 => TextureAssets.NpcHeadBoss[NPCID.Sets.BossHeadTextures[ModContent.NPCType()]].Value, 34 => ModContent.Request("CalamityMod/NPCs/StormWeaver/StormWeaverHeadNaked_Head_Boss").Value, diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 42c9269e04..c369445106 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -76,7 +76,7 @@ namespace CalamityMod.UI } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -98,7 +98,7 @@ namespace CalamityMod.UI string maxStealthStr = (100f * modPlayer.rogueStealthMax).ToString("n2"); string textToDisplay = $"{CalamityUtils.GetTextValue("UI.Stealth")}: {stealthStr}/{maxStealthStr}\n"; - if (!Main.keyState.IsKeyDown(LeftShift)) + if (!Main.keyState.PressingShift()) { textToDisplay += CalamityUtils.GetTextValue("UI.StealthShiftText"); } @@ -139,7 +139,7 @@ namespace CalamityMod.UI if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } } diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index 04b5b562da..f6b1e35b38 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -70,7 +70,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter } if (changed) - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } Rectangle mouseHitbox = new Rectangle((int)Main.MouseScreen.X, (int)Main.MouseScreen.Y, 8, 8); @@ -123,7 +123,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter if (ms.LeftButton == ButtonState.Released) { dragOffset = null; - CalamityClientConfig.SaveConfig(); + CalamityClientConfig.Instance.SaveChanges(); } } else diff --git a/Utilities/DrawingUtils.cs b/Utilities/DrawingUtils.cs index ce5b774884..34fbc5e607 100644 --- a/Utilities/DrawingUtils.cs +++ b/Utilities/DrawingUtils.cs @@ -55,6 +55,22 @@ namespace CalamityMod return backgroundMatrix; } } + /// + /// Gets the texture for the passed string and stores it in the referenced field + /// If the texture is already stored in the field, it will not request it again. + /// Use this instead of requesting every frame. + /// + /// + /// + /// + public static Asset GetTextureEfficient(ref Asset textureAsset, string texture) + { + if (textureAsset is null) + { + textureAsset = ModContent.Request(texture); + } + return textureAsset; + } #region Projectile Afterimages /// @@ -269,12 +285,27 @@ namespace CalamityMod /// /// /// - public static void DrawInventoryCustomScale(SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale, float wantedScale = 1f, Vector2 drawOffset = default) + public static void DrawInventoryCustomScale(SpriteBatch spriteBatch, Texture2D texture, Vector2 position, Rectangle frame, Color drawColor, Color itemColor, Vector2 origin, float scale, float wantedScale = 1f, Vector2 drawOffset = default, SpriteEffects spriteEffects = SpriteEffects.None, float rotation = 0f) { wantedScale = Math.Max(scale, wantedScale * Main.inventoryScale); float scaleDifference = wantedScale - scale; position += drawOffset * wantedScale; - spriteBatch.Draw(texture, position, frame, drawColor, 0f, origin, wantedScale, SpriteEffects.None, 0); + if (itemColor == Color.Transparent) itemColor = Color.White; + spriteBatch.Draw(texture, position, frame, itemColor.MultiplyRGB(drawColor), 0f, origin, wantedScale, SpriteEffects.None, 0); + } + + static Asset ItemDotTexture; + /// + /// Draws an enabled/disabled dot at the bottom right of the item's sprite + /// Used for effects that are enabled/disabled + /// + /// + /// + public static void DrawInventoryDot(SpriteBatch spriteBatch, Vector2 itemPosition, Vector2 dotOffset, bool enabled) + { + var tex = CalamityUtils.GetTextureEfficient(ref ItemDotTexture, "Terraria/Images/Extra_20").Value; + var dotFrame = tex.Frame(1,4, frameY: enabled ? 1 : 2); + spriteBatch.Draw(tex, itemPosition + dotOffset, dotFrame, Color.White, 0, dotFrame.Size() * 0.5f, Main.inventoryScale, SpriteEffects.None, 0); } /// diff --git a/Utilities/DropHelper.cs b/Utilities/DropHelper.cs index 6b19c38c64..57b5b078bb 100644 --- a/Utilities/DropHelper.cs +++ b/Utilities/DropHelper.cs @@ -832,25 +832,6 @@ namespace CalamityMod return p.Calamity().tarraSet; }); - internal const float TrasherEatDistance = 96f; - public static IItemDropRuleCondition AnglerFedToTrasherCondition = If((info) => - { - bool trasherNearby = false; - foreach (NPC nearby in Main.ActiveNPCs) - { - if (nearby.type != ModContent.NPCType()) - continue; - if (info.npc.Distance(nearby.Center) < TrasherEatDistance) - { - trasherNearby = true; - break; - } - } - return trasherNearby; - }); - // The text is a separate rule so it doesn't show up on the non-Trasher Fishing Rod drop which only occurs if the Angler is not fed to a Trasher - public static IItemDropRuleCondition TrasherText => CalamityConditions.TrasherTextCondition.ToDropCondition(ShowItemDropInUI.Always); - // Remix seed drop rules public static IItemDropRuleCondition Remix => Condition.RemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); public static IItemDropRuleCondition NotRemix => Condition.NotRemixWorld.ToDropCondition(ShowItemDropInUI.WhenConditionSatisfied); diff --git a/Utilities/FasterParallel.cs b/Utilities/FasterParallel.cs new file mode 100644 index 0000000000..fc33ffdb23 --- /dev/null +++ b/Utilities/FasterParallel.cs @@ -0,0 +1,102 @@ +#nullable enable + +using System; +using System.Threading; + +using ReLogic.Threading; + +namespace CalamityMod.Utilities +{ + // Tomat: I have recycled this from my initial implementation I've given to + // Nitrate. + /// + /// A faster implementation of without a timeout. + /// + public static class FasterParallel + { + /// + /// A faster reimplementation of . + /// + public static void For(int fromInclusive, int toExclusive, ParallelForAction callback, object? context = null) + { + var rangeLength = toExclusive - fromInclusive; + + if (rangeLength == 0) + { + return; + } + + var initialCount = Math.Min(Math.Max(1, Environment.ProcessorCount - 1), rangeLength); + var rangeLengthPerTask = rangeLength / initialCount; + var remainder = rangeLength % initialCount; + CountdownEvent countdownEvent = new(initialCount); + var currentRangeStart = toExclusive; + + for (var i = initialCount - 1; i >= 0; --i) + { + var rangeLengthForTask = rangeLengthPerTask; + + if (i < remainder) + { + rangeLengthForTask++; + } + + currentRangeStart -= rangeLengthForTask; + var rangeStart = currentRangeStart; + var rangeEnd = rangeStart + rangeLengthForTask; + RangeTask rangeTask = new(callback, rangeStart, rangeEnd, context, countdownEvent); + + if (i < 1) + { + InvokeTask(rangeTask); + } + else + { + ThreadPool.QueueUserWorkItem(InvokeTask, rangeTask); + } + } + + countdownEvent.Wait(); + } + + private static void InvokeTask(object? context) + { + (context as RangeTask)?.Invoke(); + } + + private class RangeTask + { + private readonly ParallelForAction action; + private readonly int fromInclusive; + private readonly int toExclusive; + private readonly object? context; + private readonly CountdownEvent countdownEvent; + + public RangeTask(ParallelForAction action, int fromInclusive, int toExclusive, object? context, CountdownEvent countdownEvent) + { + this.action = action; + this.fromInclusive = fromInclusive; + this.toExclusive = toExclusive; + this.context = context; + this.countdownEvent = countdownEvent; + } + + public void Invoke() + { + try + { + if (fromInclusive == toExclusive) + { + return; + } + + action(fromInclusive, toExclusive, context); + } + finally + { + countdownEvent.Signal(); + } + } + } + } +} diff --git a/Utilities/GeneralExtensionUtils.cs b/Utilities/GeneralExtensionUtils.cs index cba1a4cf52..a7950a7edd 100644 --- a/Utilities/GeneralExtensionUtils.cs +++ b/Utilities/GeneralExtensionUtils.cs @@ -1,5 +1,6 @@ using CalamityMod.CalPlayer; using CalamityMod.Items; +using CalamityMod.Items.BaseItems; using CalamityMod.NPCs; using CalamityMod.Projectiles; using Terraria; @@ -15,5 +16,7 @@ namespace CalamityMod public static CalamityGlobalItem Calamity(this Item item) => item.GetGlobalItem(); public static CalamityGlobalProjectile Calamity(this Projectile proj) => proj.GetGlobalProjectile(); public static Item ActiveItem(this Player player) => Main.mouseItem.IsAir ? player.HeldItem : Main.mouseItem; + public static TransformationPlayer Transformation(this Player player) => player.GetModPlayer(); + } } diff --git a/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index c28487a7fd..cd56f436e1 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -41,65 +41,6 @@ namespace CalamityMod internal static readonly Color DonatorItemColor = new Color(255, 121, 156); #endregion - // TODO -- This probably isn't the best place to put this but it needs to be somewhere easily accessible. - #region Accessory Prefix Stats - internal static int GetScalingDefense(int prefixID) - { - switch (prefixID) - { - default: - return 0; - - // Ironskin Potion - // This makes sense to be here but also not - case -1: - if (DownedBossSystem.downedDoG) - return 14; - else if (NPC.downedMoonlord) - return 12; - else if (Main.hardMode) - return 10; - return 8; - - case PrefixID.Hard: - if (DownedBossSystem.downedDoG) - return 4; - else if (NPC.downedMoonlord) - return 3; - else if (Main.hardMode) - return 2; - return 1; - - case PrefixID.Guarding: - if (DownedBossSystem.downedDoG) - return 5; - else if (NPC.downedMoonlord) - return 4; - else if (Main.hardMode) - return 3; - return 2; - - case PrefixID.Armored: - if (DownedBossSystem.downedDoG) - return 6; - else if (NPC.downedMoonlord) - return 5; - else if (Main.hardMode) - return 4; - return 3; - - case PrefixID.Warding: - if (DownedBossSystem.downedDoG) - return 7; - else if (NPC.downedMoonlord) - return 6; - else if (Main.hardMode) - return 5; - return 4; - } - } - #endregion - #region Reforging Algorithm internal static int GetReworkedReforge(Item item, UnifiedRandom rand, int currentPrefix) { @@ -120,9 +61,9 @@ namespace CalamityMod int accRerolls = 0; int[][] accessoryReforgeTiers = new int[][] { - /* 0 */ new int[] { PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild, GetCalPrefix("Quiet") }, + /* 0 */ new int[] { PrefixID.Hard, PrefixID.Jagged, PrefixID.Brisk, PrefixID.Wild }, /* 1 */ new int[] { PrefixID.Guarding, PrefixID.Spiked, PrefixID.Precise, PrefixID.Fleeting, PrefixID.Rash, GetCalPrefix("Cloaked") }, - /* 2 */ new int[] { PrefixID.Armored, PrefixID.Angry, PrefixID.Hasty2, PrefixID.Intrepid, PrefixID.Arcane, GetCalPrefix("Camouflaged") }, + /* 2 */ new int[] { PrefixID.Armored, PrefixID.Angry, PrefixID.Hasty2, PrefixID.Intrepid, PrefixID.Arcane }, /* 3 */ new int[] { PrefixID.Warding, PrefixID.Menacing, PrefixID.Lucky, PrefixID.Quick2, PrefixID.Violent, GetCalPrefix("Silent") }, }; diff --git a/Utilities/LocalizationUtils.cs b/Utilities/LocalizationUtils.cs index 07d6a8c75f..c4afd06b22 100644 --- a/Utilities/LocalizationUtils.cs +++ b/Utilities/LocalizationUtils.cs @@ -1,4 +1,6 @@ -using Terraria.ID; +using CalamityMod.Enums; +using Terraria; +using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -81,6 +83,8 @@ namespace CalamityMod public static string GetTextValueFromModItem(string suffix) where T : ModItem => GetTextFromModItem(ModContent.ItemType(), suffix).ToString(); #region Tooltip Format Helper + public static string EmbedItemIcon(this int itemID) => $"[i:{itemID}] " + GetItemName(itemID); + public static string FramesToSeconds(this int frame) => Round(frame / 60f, "N2"); public static string ToMph(this float velocity) => Round(velocity * 216000f / 42240f, "N0"); @@ -89,6 +93,9 @@ namespace CalamityMod public static string ToRegenPerSecond(this int regen) => Round(regen * 0.5f, "N2"); public static string ToJumpSpeedPercent(this float boost) => Round(boost * 20f, "N2"); + public static string ToStealth(this float stealth) => Round(stealth * 100f, "N0"); + + public static string GetChanceFromDenominator(this int denominator) => ToPercent(1 / (float)denominator); public static string ToPercent(this float percent, string precision = "N1") => Round(percent * 100f, precision); public static string ToPercent(this double percent, string precision = "N1") => Round(percent * 100D, precision); @@ -96,5 +103,25 @@ namespace CalamityMod public static string Round(this float number, string precision = "N4") => float.Parse((number).ToString(precision)).ToString(); public static string Round(this double number, string precision = "N4") => float.Parse((number).ToString(precision)).ToString(); #endregion + + public static string GetArmorSetBonusKey() + { + ModKeybind setBonusKey = CalamityKeybinds.ArmorSetBonusHotKey; + bool hasHotkey = setBonusKey.GetAssignedKeys().Count != 0; + string directionKey = (Main.ReversedUpDownArmorSetBonuses ? Language.GetTextValue("Key.UP") : Language.GetTextValue("Key.DOWN")); + + // Allow both + if (hasHotkey && CalamityClientConfig.Instance.SetBonusDoubleTap == SetBonusDoubleTapOptions.On) + return GetText("Common.BothArmorSetBonusKeys").Format(setBonusKey.TooltipHotkeyString(), directionKey); + // Literally bind nothing (mentions the key name to you) + else if (!hasHotkey && CalamityClientConfig.Instance.SetBonusDoubleTap == SetBonusDoubleTapOptions.Off) + return GetTextValue("Common.NoArmorSetBonusKey"); + // Hotkey only + else if (hasHotkey) + return GetText("Common.ArmorSetBonusKey").Format(setBonusKey.TooltipHotkeyString()); + // Double tap only + else + return GetText("Common.DoubleTapDown").Format(directionKey); + } } } diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index 371d956ac7..45fba7b694 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Security.Cryptography.Xml; +using Microsoft.CodeAnalysis; using Microsoft.Xna.Framework; using ReLogic.Threading; using Terraria; @@ -225,6 +226,37 @@ namespace CalamityMod /// The input value. public static int DirectionalSign(this float x) => (x > 0f).ToDirectionInt(); + + /// + /// Approximates the derivative of a function at a given point based on a central-difference formula. + /// + /// The function to take the derivative of. + /// The value to evaluate the derivative at. + public static double ApproximateDerivative(this Func fx, double x) + { + double left = fx(x + 1e-7); + double right = fx(x - 1e-7); + return (left - right) * 5e6; + } + + /// + /// Searches for an approximate for a root of a given function. + /// + /// The function to find the root for. + /// The initial guess for what the root could be. + /// The amount of iterations to perform. The higher this is, the more generally accurate the result will be. + public static double IterativelySearchForRoot(Func fx, double initialGuess, int iterations) + { + double result = initialGuess; + for (int i = 0; i < iterations; i++) + { + double derivative = (float)fx.ApproximateDerivative(result); + result -= fx(result) / derivative; + } + + return result; + } + public static List GetIntersectingPointsInLine(Point start, Point end) { List intersectingCells = []; @@ -237,6 +269,9 @@ namespace CalamityMod while (true) { + if (!WorldGen.InWorld(start.X, start.Y)) + break; + // Add the current cell to the list intersectingCells.Add(start); @@ -399,6 +434,17 @@ namespace CalamityMod } return ratio; } + /// + /// Xyk's version of easing in and out
+ /// Returns an eased version of a 0 - 1 lerp value. + ///
+ /// The 0 - 1 lerp input + /// The intensisty of the easing in. + /// /// The intensisty of the easing out. + public static float EaseInOutExp(float lerpValue, float inPower, float outPower) + { + return (lerpValue < 0.5f ? (float)Math.Pow(Utils.GetLerpValue(0, 0.5f, lerpValue, true), inPower) * 0.5f : 0.5f + (1 - (float)Math.Pow(Utils.GetLerpValue(1, 0.5f, lerpValue, true), outPower)) * 0.5f); + } #endregion } diff --git a/Utilities/MiscUtils.cs b/Utilities/MiscUtils.cs index 89973967e4..7fb1b3e804 100644 --- a/Utilities/MiscUtils.cs +++ b/Utilities/MiscUtils.cs @@ -31,6 +31,14 @@ namespace CalamityMod ChatHelper.BroadcastChatMessage(NetworkText.FromKey(key), textColor.Value); } + public static void DisplayFormattedText(string key, Color textColor, params object[] args) + { + if (Main.netMode == NetmodeID.SinglePlayer) + Main.NewText(Language.GetOrRegister(key).Format(args), textColor); + else if (Main.dedServ || Main.netMode == NetmodeID.MultiplayerClient) + ChatHelper.BroadcastChatMessage(NetworkText.FromKey(key, args), textColor); + } + public static int IngredientIndex(this Recipe r, int itemID) { for (int i = 0; i < r.requiredItem.Count; ++i) @@ -203,12 +211,15 @@ namespace CalamityMod list.Add(type); } + public static int ScaleWithDifficulty(this int value) => value * (Main.masterMode ? 3 : Main.expertMode ? 2 : 1); + public static int SecondsToFrames(int seconds) => seconds * 60; - public static int SecondsToFrames(float seconds) => (int)(seconds * 60); + public static int SecondsToFrames(float seconds) => (int)MathF.Round(seconds * 60); public static int MinutesToFrames(int minutes) => minutes * 3600; public static bool WithinBounds(this int index, int cap) => index >= 0 && index < cap; + /// /// Clamps the distance between vectors via normalization. /// /// The starting point. diff --git a/Utilities/NPCDebuffs.cs b/Utilities/NPCDebuffs.cs index cdea134597..ec5d8be588 100644 --- a/Utilities/NPCDebuffs.cs +++ b/Utilities/NPCDebuffs.cs @@ -102,7 +102,7 @@ namespace CalamityMod // Make all Cal NPCs immune to confused unless otherwise specified // Extra note: Clams are not in this list as they initially immune to Confused, but are no longer immune once aggro'd. This is set in their AI(). bool cal = npc.ModNPC != null && npc.ModNPC.Mod.Name.Equals(ModContent.GetInstance().Name); - if (!ConfusionDebuffImmunitiesList.Includes(npc.type) && cal) + if (!CalamityNPCSets.CalamityNPCNotImmuneToConfused[npc.type] && cal) NPCID.Sets.SpecificDebuffImmunity[npc.type][BuffID.Confused] = true; // Sets certain vanilla NPCs and all town NPCs to be immune to most debuffs. @@ -249,9 +249,9 @@ namespace CalamityMod { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, - { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, + { ModContent.NPCType(), new(GeneralImmunityStatus.None, new int[] { ModContent.BuffType() }) }, { ModContent.NPCType(), holy }, { ModContent.NPCType(), holy }, diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index 460f0f32d4..44011b1330 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -9,6 +9,7 @@ using CalamityMod.Enums; using CalamityMod.Events; using CalamityMod.Items.Accessories; using CalamityMod.Items.Armor; +using CalamityMod.Items.Armor.GodSlayer; using CalamityMod.Items.Potions.Alcohol; using CalamityMod.Systems.Collections; using CalamityMod.World; @@ -136,7 +137,7 @@ namespace CalamityMod return ret; } - public static float GetRangedAmmoCostReduction(this Player player) + public static float GetAmmoCostReduction(this Player player) { // Tally up all possible vanilla effects. float vanillaCost = player.ammoBox ? 0.8f : 1f; @@ -148,7 +149,7 @@ namespace CalamityMod vanillaCost *= 0.75f; // Account for Calamity effects. - return vanillaCost * player.Calamity().rangedAmmoCost; + return vanillaCost * player.Calamity().ammoCost; } public static float GetStandingStealthRegen(this Player player) @@ -436,10 +437,8 @@ namespace CalamityMod CalamityPlayer modPlayer = player.Calamity(); int extraIFrames = 0; - if (modPlayer.godSlayerThrowing && hurtInfo.Damage > 80) - extraIFrames += 30; - if (modPlayer.statigelSet && hurtInfo.Damage > 100) - extraIFrames += 30; + if (modPlayer.godSlayerThrowing && hurtInfo.Damage > GodSlayerHeadRogue.SetBonusHurtDamageThreshold) + extraIFrames += GodSlayerHeadRogue.ExtraIFrames; // Deific Amulet provides 10 to 40 bonus immunity frames when you get hit which scale with your missing health. // If you only take 1 damage, you get 5 iframes. @@ -462,7 +461,7 @@ namespace CalamityMod if (modPlayer.rampartOfDeities && hurtInfo.Damage > 200) extraIFrames += 30; - if (modPlayer.cirrusVodka) + if (modPlayer.purpleHaze) { if (hurtInfo.Damage == 1) extraIFrames += 5; @@ -617,6 +616,107 @@ namespace CalamityMod } #endregion + #region Player Healing and Lifesteal + /// + /// Directly provides lifesteal to the player. + /// This obeys the spawn behaviour of lifesteal and incurs cooldown. + /// + /// The player being healed. + /// The target being hit. Input null if there is none. + /// The amount of life being healed. + /// The multiplier to the rate of lifesteal. Increase above 1 to make it weaker and below 1 to make it stronger. + public static void DoLifestealDirect(this Player player, NPC target, int amount, float cooldownMultiplier = 1f) + { + // NPC limitations: disallow if target is not an enemy or deliberately disallowed from lifestealing + if (target is not null && (!target.IsAnEnemy(false) || !target.canGhostHeal)) + return; + + // Limit the amount of heal to the player's max health + amount = Math.Min(amount, player.statLifeMax2 - player.statLife); + + // As well as the physical cap to how much HP can be healed + amount = Math.Min(amount, BalancingConstants.LifeStealCap); + + // Player limitations: disallow if lifesteal variable reaches 0 or lower or Moon Bite is active + if (amount <= 0 || player.lifeSteal <= 0f || player.moonLeech) + return; + + // Grant lifesteal and subtract from the variable accordingly + player.lifeSteal -= amount * cooldownMultiplier; + player.HealPlayer(amount); + } + + /// + /// Spawns a projectile which grants healing to the player on contact. + /// This obeys the spawn behaviour of lifesteal and incurs cooldown. + /// This applies as a projectile on-hit effect. Use DoLifestealDirect for direct lifestealing. + /// + /// The player being healed. + /// The target being hit. Input null if there is none. + /// The source projectile performing this heal. + /// The type of healing projectile spawned. + /// The amount of life to heal. + /// The multiplier to the rate of lifesteal. Increase above 1 to make it weaker and below 1 to make it stronger. + /// Whether or not the heal is given to the player on the team with lowest HP. False by default. + /// The distance the projectile has to be from the player to direct the heal to when sharing. Default of 3000f (187.5 tiles) + public static void SpawnLifeStealProjectile(this Player player, NPC target, Projectile projSource, int projType, int amount, float cooldownMultiplier = 1f, bool shared = false, float distanceRequired = 3000f) + { + // NPC limitations: disallow if target is not an enemy or deliberately disallowed from lifestealing + if (target is not null && (!target.IsAnEnemy(false) || !target.canGhostHeal)) + return; + + int lowestHealthCheck = player.statLifeMax2 - player.statLife; + int targetPlayer = player.whoAmI; + if (shared) + { + foreach (Player otherPlayer in Main.ActivePlayers) + { + if (!otherPlayer.dead && ((!player.hostile && !otherPlayer.hostile) || player.team == otherPlayer.team)) + { + float playerDist = Vector2.Distance(projSource.Center, otherPlayer.Center); + if (playerDist < distanceRequired && (otherPlayer.statLifeMax2 - otherPlayer.statLife) > lowestHealthCheck) + { + lowestHealthCheck = otherPlayer.statLifeMax2 - otherPlayer.statLife; + targetPlayer = otherPlayer.whoAmI; + } + } + } + } + + // Limit the amount of heal to the target player's max health + amount = Math.Min(amount, lowestHealthCheck); + + // As well as the physical cap to how much HP can be healed + amount = Math.Min(amount, BalancingConstants.LifeStealCap); + + // Player limitations: disallow if lifesteal variable reaches 0 or lower or Moon Bite is active + // This is performed on the player who DOES the lifesteal, and not the recipient + if (amount <= 0 || player.lifeSteal <= 0f || player.moonLeech) + return; + + // Grant lifesteal and subtract from the variable accordingly + player.lifeSteal -= amount * cooldownMultiplier; + if (projSource.owner == Main.myPlayer) + Projectile.NewProjectile(projSource.GetSource_FromThis(), projSource.Center, Vector2.Zero, projType, 0, 0f, projSource.owner, targetPlayer, amount); + } + + /// + /// A short method that heals the player. + /// All direct heals in Calamity should use this. + /// + /// The player being healed. + /// The amount of life being healed. + /// Whether the heal CombatText should be displayed, and whether it should be synced. Displays and syncs by default. + public static void HealPlayer(this Player player, int amount, HealTextType healTextType = HealTextType.Broadcast) + { + player.statLife += amount; + if (player.statLife > player.statLifeMax2) + player.statLife = player.statLifeMax2; + if (healTextType != HealTextType.None) + player.HealEffect(amount, healTextType == HealTextType.Broadcast); + } + #endregion + #region Rage and Adrenaline /// /// Returns the damage multiplier Adrenaline Mode provides for the given player. @@ -924,10 +1024,10 @@ namespace CalamityMod item.CountsAsClass() ); - bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !BlacklistedWeaponsWithToolPowerList.Includes(item.type); + bool heldItemIsTool = (item.pick > 0 || item.axe > 0 || item.hammer > 0) && !CalamityItemSets.WeaponWithToolPowerAffectedBySummonPenalty[item.type]; bool heldItemCanBeUsed = item.useStyle != ItemUseStyleID.None; bool heldItemIsAccessoryOrAmmo = item.accessory || item.ammo != AmmoID.None; - bool heldItemIsExcludedByModCall = DisabledSummonerNerfItemList.Includes(item.type); + bool heldItemIsExcludedByModCall = CalamityItemSets.ItemWhichDisablesSummonerNerf[item.type]; if (heldItemIsClassedWeapon && heldItemCanBeUsed && !heldItemIsTool && !heldItemIsAccessoryOrAmmo && !heldItemIsExcludedByModCall) return true; @@ -935,23 +1035,6 @@ namespace CalamityMod return false; } - - /// - /// A short method that heals the player. - /// All direct heals in Calamity should use this. - /// - /// The player being healed. - /// The amount of life being healed. - /// Whether the heal CombatText should be displayed, and whether it should be synced. Displays and syncs by default. - public static void HealPlayer(this Player player, int amount, HealTextType healTextType = HealTextType.Broadcast) - { - player.statLife += amount; - if (player.statLife > player.statLifeMax2) - player.statLife = player.statLifeMax2; - if (healTextType != HealTextType.None) - player.HealEffect(amount, healTextType == HealTextType.Broadcast); - } - /// /// Makes the given player send the given packet to all appropriate receivers.
/// If server is false, the packet is sent only to the multiplayer host.
diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index e8b9ab486f..20c28a596a 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -165,7 +165,7 @@ namespace CalamityMod } } - public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia) + public static void HomeInOnNPC(Projectile projectile, bool ignoreTiles, float distanceRequired, float homingVelocity, float inertia, bool respectIFrames = false) { if (!projectile.friendly) return; @@ -184,10 +184,12 @@ namespace CalamityMod foreach (NPC n in Main.ActiveNPCs) { float extraDistance = (n.width / 2) + (n.height / 2); - if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance)) + if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance) || (respectIFrames && (projectile.localNPCImmunity[n.whoAmI] > 0 || projectile.localNPCImmunity[n.whoAmI] == -1 || n.immune[projectile.owner] > 0))) continue; float currentNPCDist = Vector2.Distance(n.Center, projectile.Center); + if (respectIFrames && Projectile.perIDStaticNPCImmunity[projectile.type][n.whoAmI] > Main.GameUpdateCount) + currentNPCDist += 1600; //Prioritize things that don't currently have iframes, but still home in on stuff that has static iframes if needed. if ((currentNPCDist < npcDistCompare) && (ignoreTiles || Collision.CanHit(projectile.Center, 1, 1, n.Center, 1, 1))) { npcDistCompare = currentNPCDist; @@ -340,9 +342,8 @@ namespace CalamityMod Vector2 spawnPosition = new Vector2(x, y); Vector2 velocity = targetPos - spawnPosition; velocity.X += Main.rand.NextFloat(-xVariance, xVariance); - float speed = projSpeed; float targetDist = velocity.Length(); - targetDist = speed / targetDist; + targetDist = projSpeed / targetDist; velocity.X *= targetDist; velocity.Y *= targetDist; return Projectile.NewProjectileDirect(source, spawnPosition, velocity, projType, damage, knockback, owner); @@ -845,7 +846,6 @@ namespace CalamityMod private static readonly List vanillaBlastImmuneTiles = new List() { - TileID.DemonAltar, TileID.Cobalt, TileID.Mythril, TileID.Adamantite, @@ -854,8 +854,7 @@ namespace CalamityMod TileID.Titanium, TileID.Chlorophyte, TileID.LihzahrdBrick, - TileID.LihzahrdAltar, - TileID.DesertFossil + TileID.LihzahrdAltar }; public static void ExplodeTiles(this Projectile p, int explosionRadius, bool respectStandardBlastImmunity = true, IEnumerable customBlastImmuneTiles = null, IEnumerable customBlastImmuneWalls = null) @@ -918,6 +917,13 @@ namespace CalamityMod // Conditionally toss in Hellstone if it's not Hardmode yet. if (!Main.hardMode) blastImmuneTiles.Add(TileID.Hellstone); + + // Also spikes in FTW + if (Main.getGoodWorld) + { + blastImmuneTiles.Add(TileID.Spikes); + blastImmuneTiles.Add(TileID.WoodenSpikes); + } } // If specified, add custom blast immune tiles. diff --git a/Utilities/RicoshotUtils.cs b/Utilities/RicoshotUtils.cs index 1f54d392cb..a1edc37fb3 100644 --- a/Utilities/RicoshotUtils.cs +++ b/Utilities/RicoshotUtils.cs @@ -30,13 +30,14 @@ namespace CalamityMod public static int GetActiveRicoshotCoinCount(this Player player) { int count = 0; - int id = ModContent.ProjectileType(); + int coinID = ModContent.ProjectileType(); + int clipID = ModContent.ProjectileType(); foreach (Projectile p in Main.ActiveProjectiles) { if (p.owner != player.whoAmI) continue; - if (p.type == id) + if (p.type == coinID || p.type == clipID) ++count; } return count; @@ -45,10 +46,18 @@ namespace CalamityMod // Intentionally not an extension so it doesn't clog the Visual Studio recommendation lists. This is not generally useful. public static bool CanRicoshotCoinForceCrit(Projectile p) { - int id = ModContent.ProjectileType(); - if (!p.active || p.type != id) + int coinID = ModContent.ProjectileType(); + int clipID = ModContent.ProjectileType(); + + if (!p.active || (p.type != coinID && p.type != clipID)) return false; + if (p.type == clipID) + { + int clipUpdateCount = M1GarandEmptyClip.ClipLifetime - p.timeLeft; + return clipUpdateCount >= M1GarandEmptyClip.CritDelayTime; + } + int coinUpdateCount = RicoshotCoin.CoinLifetime - p.timeLeft; return coinUpdateCount >= RicoshotCoin.CritDelayTime; } @@ -96,21 +105,28 @@ namespace CalamityMod { IList coins = new List(); - // Search for all nearby coins. - // Coins do not necessarily have to be owned by the same player as the searching projectile! + // Search for all nearby coins/clips. + // Coins/clips do not necessarily have to be owned by the same player as the searching projectile! int coinID = ModContent.ProjectileType(); + int clipID = ModContent.ProjectileType(); + foreach (Projectile proj in Main.ActiveProjectiles) { - if (proj.ModProjectile is null || proj.type != coinID) + if (proj.ModProjectile is null) + continue; + + // Check if the projectile is either a coin or clip + if (proj.type != coinID && proj.type != clipID) continue; // Coins that have already been struck are ignored. if (proj.localAI[0] > 0f) continue; - // Finally, do a distance check + // Use the appropriate distance check based on the projectile type + float maxDistance = proj.type == clipID ? M1GarandEmptyClip.MaxIntraClipRicoshotDistance : RicoshotCoin.MaxIntraCoinRicoshotDistance; float dist = searchingShot.DistanceSQ(proj.Center); - if (dist <= RicoshotCoin.MaxIntraCoinRicoshotDistance * RicoshotCoin.MaxIntraCoinRicoshotDistance) + if (dist <= maxDistance * maxDistance) coins.Add(proj); } @@ -143,6 +159,11 @@ namespace CalamityMod float closestCoinDistance = RicoshotCoin.MaxIntraCoinRicoshotDistance; foreach (Projectile coin in availableCoins) { + // Determine the max ricochet distance based on the target type + float maxDistance = coin.type == ModContent.ProjectileType() ? M1GarandEmptyClip.MaxIntraClipRicoshotDistance : RicoshotCoin.MaxIntraCoinRicoshotDistance; // New line. Use different distance based on proj type. + if (coin.Distance(startPos) > maxDistance) + continue; + // Skip coins which are already frozen (part of an ongoing ricoshot), unless considering them if (!considerFrozenCoins && coin.ai[1] > 0f) continue; diff --git a/Utilities/TileEntityUtils.cs b/Utilities/TileEntityUtils.cs index 3e5fae0989..4d164a7f20 100644 --- a/Utilities/TileEntityUtils.cs +++ b/Utilities/TileEntityUtils.cs @@ -1,5 +1,5 @@ using CalamityMod.Items.DraedonMisc; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Pets; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -77,7 +77,7 @@ namespace CalamityMod // This check is done twice because the draw order matters. We want to draw the background icon before any text. if (item.stack > 0) { - if (item.type == ItemType()) + if (item.type == ItemType()) { slotBackgroundTex = Request("CalamityMod/UI/DraedonsArsenal/PowerCellSlot_Blood").Value; } diff --git a/Utilities/TileUtils.cs b/Utilities/TileUtils.cs index 4877f181e9..f0ea7eb99e 100644 --- a/Utilities/TileUtils.cs +++ b/Utilities/TileUtils.cs @@ -1,17 +1,20 @@ using System; using System.Collections.Generic; using System.Runtime.CompilerServices; +using CalamityMod.Tiles.FurnitureNavystone.FurnitureAncientNavystone; using CalamityMod.Systems; using CalamityMod.Tiles; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.FurnitureDriftwood; +using CalamityMod.Tiles.FurnitureMonolith; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Crags; using CalamityMod.Tiles.FloralParadise; using CalamityMod.Tiles.FurnitureAbyss; using CalamityMod.Tiles.FurnitureAshen; -using CalamityMod.Tiles.FurnitureEutrophic; +using CalamityMod.Tiles.FurnitureNavystone; using CalamityMod.Tiles.FurnitureOtherworldly; using CalamityMod.Tiles.FurnitureProfaned; using CalamityMod.Tiles.FurnitureVoid; @@ -447,6 +450,8 @@ namespace CalamityMod TileType(), TileType(), TileType(), + TileType(), + TileType(), TileType(), TileType(), TileType(), @@ -517,6 +522,7 @@ namespace CalamityMod TileType(), // Sunken Sea TileType(), + TileType(), TileType(), TileType(), TileType(), diff --git a/Walls/AbyssGravelWall.cs b/Walls/AbyssGravelWall.cs index 44e781e3a0..81c87aa517 100644 --- a/Walls/AbyssGravelWall.cs +++ b/Walls/AbyssGravelWall.cs @@ -1,32 +1,19 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AbyssGravelWallSafe")] public class AbyssGravelWall : ModWall { public override void SetStaticDefaults() { - DustType = 33; + Main.wallHouse[Type] = true; AddMapEntry(new Color(6, 10, 54)); + DustType = 33; } - public override void RandomUpdate(int i, int j) - { - if (Main.tile[i, j].LiquidAmount == 0 && j < Main.maxTilesY - 205) - { - Main.tile[i, j].Get().LiquidType = LiquidID.Water; - Main.tile[i, j].LiquidAmount = byte.MaxValue; - WorldGen.SquareTileFrame(i, j); - if (Main.dedServ) - NetMessage.sendWater(i, j); - } - } - - public override void KillWall(int i, int j, ref bool fail) => fail = true; - public override bool CanExplode(int i, int j) => false; public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/AbyssGravelWallSafe.cs b/Walls/AbyssGravelWallSafe.cs deleted file mode 100644 index 47910b7661..0000000000 --- a/Walls/AbyssGravelWallSafe.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.ModLoader; - -namespace CalamityMod.Walls -{ - public class AbyssGravelWallSafe : ModWall - { - public override string Texture => "CalamityMod/Walls/AbyssGravelWall"; - public override void SetStaticDefaults() - { - Main.wallHouse[Type] = true; - AddMapEntry(new Color(6, 10, 54)); - DustType = 33; - } - - public override bool CanExplode(int i, int j) => false; - - public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; - } -} diff --git a/Walls/AncientSmoothNavystoneWall.cs b/Walls/AncientSmoothNavystoneWall.cs new file mode 100644 index 0000000000..ec71f2f560 --- /dev/null +++ b/Walls/AncientSmoothNavystoneWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls +{ + public class AncientSmoothNavystoneWall : ModWall, IVisibleThroughWater + { + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + this.AddMapEntryWithWaterVisibility(new Color(27, 35, 36)); + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.SnowBlock, 0f, 0f, 1, new Color(54, 69, 72), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + } +} diff --git a/Walls/AncientSmoothNavystoneWall.png b/Walls/AncientSmoothNavystoneWall.png new file mode 100644 index 0000000000..585d059bc8 Binary files /dev/null and b/Walls/AncientSmoothNavystoneWall.png differ diff --git a/Walls/AstralDirtWall.cs b/Walls/AstralDirtWall.cs index ae80a7a4dd..3484205805 100644 --- a/Walls/AstralDirtWall.cs +++ b/Walls/AstralDirtWall.cs @@ -1,21 +1,19 @@ using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralDirtWallSafe")] public class AstralDirtWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralDirtWallUnsafe",this, "CalamityMod/Walls/AstralD" ); - return true; - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralGrassWall.cs b/Walls/AstralGrassWall.cs index 95ff468205..8c8b7c5d25 100644 --- a/Walls/AstralGrassWall.cs +++ b/Walls/AstralGrassWall.cs @@ -8,16 +8,12 @@ using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralGrassWallSafe")] public class AstralGrassWall : ModWall { public static Asset leafTexture = null; public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralGrassWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { @@ -26,6 +22,8 @@ namespace CalamityMod.Walls WallID.Sets.Conversion.Grass[Type] = true; + Main.wallHouse[Type] = true; + AddMapEntry(new Color(60, 48, 64)); if (!Main.dedServ) @@ -37,7 +35,7 @@ namespace CalamityMod.Walls { if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { - Texture2D tex = leafTexture.Value; + Texture2D tex = AstralGrassWall.leafTexture.Value; var rand = new Random(i + (j * 100000)); float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; diff --git a/Walls/AstralIceWall.cs b/Walls/AstralIceWall.cs index 4c0802f5a5..8e3431c427 100644 --- a/Walls/AstralIceWall.cs +++ b/Walls/AstralIceWall.cs @@ -1,20 +1,17 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralIceWallSafe")] public class AstralIceWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralIceWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. + Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); diff --git a/Walls/AstralSandstoneWall.cs b/Walls/AstralSandstoneWall.cs index 7d24446445..ad9bcab1c8 100644 --- a/Walls/AstralSandstoneWall.cs +++ b/Walls/AstralSandstoneWall.cs @@ -1,21 +1,18 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralSandstoneWallSafe")] public class AstralSandstoneWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralSandstoneWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Sandstone[Type] = true; diff --git a/Walls/AstralSnowWall.cs b/Walls/AstralSnowWall.cs index 586060389a..87e48f1d0d 100644 --- a/Walls/AstralSnowWall.cs +++ b/Walls/AstralSnowWall.cs @@ -1,14 +1,17 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralSnowWallSafe")] public class AstralSnowWall : ModWall { + public override void SetStaticDefaults() { DustType = ModContent.DustType(); + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralStoneWall.cs b/Walls/AstralStoneWall.cs index 0de91add8b..1ba76b2331 100644 --- a/Walls/AstralStoneWall.cs +++ b/Walls/AstralStoneWall.cs @@ -1,21 +1,18 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("AstralStoneWallSafe")] public class AstralStoneWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("AstralStoneWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.Stone[Type] = true; diff --git a/Walls/EutrophicSandWall.png b/Walls/EutrophicSandWall.png deleted file mode 100644 index 1e65f4f49e..0000000000 Binary files a/Walls/EutrophicSandWall.png and /dev/null differ diff --git a/Walls/HardenedAstralSandWall.cs b/Walls/HardenedAstralSandWall.cs index 4766efcb6e..567269b30b 100644 --- a/Walls/HardenedAstralSandWall.cs +++ b/Walls/HardenedAstralSandWall.cs @@ -1,21 +1,19 @@ - -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; +using Terraria; using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("HardenedAstralSandWallSafe")] public class HardenedAstralSandWall : ModWall { - /*public override bool Autoload(ref string name, ref string texture) - { - mod.AddWall("HardenedAstralSandWallUnsafe", this, texture); - return base.Autoload(ref name, ref texture); - }*/ + public override string Texture => "CalamityMod/Walls/HardenedAstralSandWall"; public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. DustType = DustID.Shadowflame; + Main.wallHouse[Type] = true; WallID.Sets.Conversion.HardenedSand[Type] = true; diff --git a/Walls/LargeBasaltWall.cs b/Walls/LargeBasaltWall.cs new file mode 100644 index 0000000000..f71e0f1ec0 --- /dev/null +++ b/Walls/LargeBasaltWall.cs @@ -0,0 +1,101 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class LargeBasaltWall : MultiVariantModWall + { + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = true; + + AddMapEntry(new Color(65, 64, 68)); + } + public override void RandomUpdate(int i, int j) + { + Tile t = Main.tile[i, j]; + Tile tUP = Main.tile[i, j - 1]; + Tile tDOWN = Main.tile[i, j + 1]; + Tile tLEFT = Main.tile[i - 1, j]; + Tile tRIGHT = Main.tile[i + 1, j]; + Tile tUPLEFT = Main.tile[i -1, j - 1]; + Tile tDOWNLEFT = Main.tile[i - 1, j + 1]; + Tile tUPRIGHT = Main.tile[i + 1, j -1]; + Tile tDOWNRIGHT = Main.tile[i + 1, j + 1]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUP.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUP.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWN.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWN.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + + if (tUPLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUPRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; + } + public override void PlaceInWorld(int i, int j, Item item) + { + Tile t = Main.tile[i, j]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Ash, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; + } + } +} diff --git a/Walls/LargeBasaltWall.png b/Walls/LargeBasaltWall.png new file mode 100644 index 0000000000..9ee40d2c04 Binary files /dev/null and b/Walls/LargeBasaltWall.png differ diff --git a/Walls/LimestoneWall.cs b/Walls/LimestoneWall.cs index 2061ef7c8a..a23494e1ef 100644 --- a/Walls/LimestoneWall.cs +++ b/Walls/LimestoneWall.cs @@ -12,7 +12,8 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { DustType = 22; - this.AddMapEntryWithWaterVisibility(new Color(147, 92, 63)); + AddMapEntry(new Color(125, 85, 61)); + this.AddMapEntryWithWaterVisibility(new Color(78, 76, 127)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/NavystoneWallSafe.cs b/Walls/NavyslateWall.cs similarity index 54% rename from Walls/NavystoneWallSafe.cs rename to Walls/NavyslateWall.cs index b2dd4387ad..5272d6d750 100644 --- a/Walls/NavystoneWallSafe.cs +++ b/Walls/NavyslateWall.cs @@ -1,21 +1,22 @@ -using Microsoft.Xna.Framework; +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; using Terraria; using Terraria.ModLoader; - namespace CalamityMod.Walls { - public class NavystoneWallSafe : ModWall, IVisibleThroughWater + [LegacyName("EutrophicSandWall")] + public class NavyslateWall : ModWall, IVisibleThroughWater { - public override string Texture => "CalamityMod/Walls/NavystoneWall"; int IVisibleThroughWater.WaterMapEntry { get; set; } - + public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 96; - this.AddMapEntryWithWaterVisibility(new Color(0, 50, 50)); + this.AddMapEntryWithWaterVisibility(new Color(11, 40, 43)); } - + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Walls/NavyslateWall.png b/Walls/NavyslateWall.png new file mode 100644 index 0000000000..bdeabd6610 Binary files /dev/null and b/Walls/NavyslateWall.png differ diff --git a/Walls/NavystoneWall.cs b/Walls/NavystoneWall.cs index 500df762c1..1c5f327811 100644 --- a/Walls/NavystoneWall.cs +++ b/Walls/NavystoneWall.cs @@ -1,15 +1,20 @@ using Microsoft.Xna.Framework; +using Terraria; using Terraria.ModLoader; + namespace CalamityMod.Walls { + [LegacyName("NavystoneWallSafe")] public class NavystoneWall : ModWall, IVisibleThroughWater { + public override string Texture => "CalamityMod/Walls/NavystoneWall"; int IVisibleThroughWater.WaterMapEntry { get; set; } - + public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 96; - this.AddMapEntryWithWaterVisibility(new Color(16, 45, 48)); + this.AddMapEntryWithWaterVisibility(new Color(0, 50, 50)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/NavystoneWall.png b/Walls/NavystoneWall.png index 3c3de52f96..5b79d77914 100644 Binary files a/Walls/NavystoneWall.png and b/Walls/NavystoneWall.png differ diff --git a/Walls/ScarletSeaGrassWall.cs b/Walls/ScarletSeaGrassWall.cs index 75ea6d474c..c8550a7e30 100644 --- a/Walls/ScarletSeaGrassWall.cs +++ b/Walls/ScarletSeaGrassWall.cs @@ -16,13 +16,12 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { - // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass DustType = DustID.CrimsonPlants; WallID.Sets.Conversion.Grass[Type] = true; - AddMapEntry(new Color(103, 24, 24)); - this.AddMapEntryWithWaterVisibility(new Color(89, 49, 108)); + AddMapEntry(new Color(144, 33, 33)); + this.AddMapEntryWithWaterVisibility(new Color(96, 53, 116)); if (!Main.dedServ) { leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); diff --git a/Walls/SeaPrismWall.cs b/Walls/SeaPrismWall.cs new file mode 100644 index 0000000000..333b163bdf --- /dev/null +++ b/Walls/SeaPrismWall.cs @@ -0,0 +1,85 @@ +using System; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.Walls +{ + public class SeaPrismWall : MultiVariantModWall + { + internal static FramedMaskTexture GlowMaskBlue; + internal static FramedMaskTexture GlowMaskPurple; + internal static FramedMaskTexture GlowMaskGreen; + public override void SetStaticDefaults() + { + GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); + GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); + GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); + Main.wallHouse[Type] = true; + DustType = 108; + + AddMapEntry(new Color(27, 123, 131)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 8) * 468; + frameYOffset = (j % 8) * 180; + } + private static float GetFade1(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + + private static float GetFade2(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + int xLength = 32; + + int frameXOffset = (i % 8) * 468; + int frameYOffset = (j % 8) * 180; + + int xPos = tile.WallFrameX + frameXOffset; + int yPos = tile.WallFrameY + frameYOffset; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + + // base wall + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8, -8), frame, Lighting.GetColor(i, j)); + + // glow layers + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + if (GlowMaskBlue.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskBlue.Texture, pos + new Vector2(-8, -8), frame, (Color.White * 1.1f)); + } + if (GlowMaskPurple.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskPurple.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade1 * 1.1f)); + } + if (GlowMaskGreen.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskGreen.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade2 * 1.5f)); + } + + Color wallColor = Lighting.GetColor(i, j) * 1.2f; // brighten a bit + wallColor.A = 255; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + } +} diff --git a/Walls/SeaPrismWall.png b/Walls/SeaPrismWall.png new file mode 100644 index 0000000000..5e4988e6b2 Binary files /dev/null and b/Walls/SeaPrismWall.png differ diff --git a/Walls/SeaPrismWall_Blue.png b/Walls/SeaPrismWall_Blue.png new file mode 100644 index 0000000000..63996bc848 Binary files /dev/null and b/Walls/SeaPrismWall_Blue.png differ diff --git a/Walls/SeaPrismWall_Green.png b/Walls/SeaPrismWall_Green.png new file mode 100644 index 0000000000..228fcd2e0b Binary files /dev/null and b/Walls/SeaPrismWall_Green.png differ diff --git a/Walls/SeaPrismWall_Purple.png b/Walls/SeaPrismWall_Purple.png new file mode 100644 index 0000000000..600a9643ff Binary files /dev/null and b/Walls/SeaPrismWall_Purple.png differ diff --git a/Walls/EutrophicSandWallSafe.cs b/Walls/ShellTrimBrickWall.cs similarity index 51% rename from Walls/EutrophicSandWallSafe.cs rename to Walls/ShellTrimBrickWall.cs index 3bfe9329d3..ed32eacef6 100644 --- a/Walls/EutrophicSandWallSafe.cs +++ b/Walls/ShellTrimBrickWall.cs @@ -4,14 +4,16 @@ using Terraria.ModLoader; namespace CalamityMod.Walls { - public class EutrophicSandWallSafe : ModWall + public class ShellTrimBrickWall : ModWall, IVisibleThroughWater { - public override string Texture => "CalamityMod/Walls/EutrophicSandWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; - DustType = 108; - AddMapEntry(new Color(11, 56, 81)); + Main.wallHouse[Type] = false; + DustType = 24; + + this.AddMapEntryWithWaterVisibility(new Color(75, 71, 85)); } public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; diff --git a/Walls/ShellTrimBrickWall.png b/Walls/ShellTrimBrickWall.png new file mode 100644 index 0000000000..9c121bd0d5 Binary files /dev/null and b/Walls/ShellTrimBrickWall.png differ diff --git a/Walls/ShellstoneSlabWall.png b/Walls/ShellstoneSlabWall.png index 3d6e1f138f..2b2171a158 100644 Binary files a/Walls/ShellstoneSlabWall.png and b/Walls/ShellstoneSlabWall.png differ diff --git a/Walls/ShellstoneWall.cs b/Walls/ShellstoneWall.cs index 89cde319b8..d94ab83478 100644 --- a/Walls/ShellstoneWall.cs +++ b/Walls/ShellstoneWall.cs @@ -10,7 +10,7 @@ namespace CalamityMod.Walls public override void SetStaticDefaults() { - Main.wallHouse[Type] = false; + Main.wallHouse[Type] = true; DustType = 24; this.AddMapEntryWithWaterVisibility(new Color(74, 71, 84)); diff --git a/Walls/SmoothNavystoneWall.png b/Walls/SmoothNavystoneWall.png index 585d059bc8..09aa9344ea 100644 Binary files a/Walls/SmoothNavystoneWall.png and b/Walls/SmoothNavystoneWall.png differ diff --git a/Walls/SulphurousSandWall.cs b/Walls/SulphurousSandWall.cs index 4ea9b6bf5e..f5e33c2e17 100644 --- a/Walls/SulphurousSandWall.cs +++ b/Walls/SulphurousSandWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousSandWallSafe")] public class SulphurousSandWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(84, 71, 46)); } diff --git a/Walls/SulphurousSandstoneWall.cs b/Walls/SulphurousSandstoneWall.cs index 24b9f1da62..a8eb0523bf 100644 --- a/Walls/SulphurousSandstoneWall.cs +++ b/Walls/SulphurousSandstoneWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousSandstoneWallSafe")] public class SulphurousSandstoneWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousSandstoneWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(57, 45, 38)); } diff --git a/Walls/SulphurousShaleWall.cs b/Walls/SulphurousShaleWall.cs index a7a9c9e46d..4cfa1e731d 100644 --- a/Walls/SulphurousShaleWall.cs +++ b/Walls/SulphurousShaleWall.cs @@ -1,14 +1,16 @@ using Microsoft.Xna.Framework; using Terraria; -using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Walls { + [LegacyName("SulphurousShaleWallSafe")] public class SulphurousShaleWall : ModWall { + public override string Texture => "CalamityMod/Walls/SulphurousShaleWall"; public override void SetStaticDefaults() { + Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(59, 40, 63)); } diff --git a/Walls/EutrophicSandWall.cs b/Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs similarity index 65% rename from Walls/EutrophicSandWall.cs rename to Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs index d6b6bb71c2..f202f68ad7 100644 --- a/Walls/EutrophicSandWall.cs +++ b/Walls/UnsafeWalls/UnsafeAbyssGravelWall.cs @@ -3,14 +3,15 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class EutrophicSandWall : ModWall + public class UnsafeAbyssGravelWall : ModWall { + public override string Texture => "CalamityMod/Walls/AbyssGravelWall"; public override void SetStaticDefaults() { - DustType = 108; - AddMapEntry(new Color(11, 56, 81)); + DustType = 33; + AddMapEntry(new Color(6, 10, 54)); } public override void RandomUpdate(int i, int j) @@ -25,6 +26,10 @@ namespace CalamityMod.Walls } } + public override void KillWall(int i, int j, ref bool fail) => fail = true; + + public override bool CanExplode(int i, int j) => false; + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; } } diff --git a/Walls/AstralDirtWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralDirtWall.cs similarity index 81% rename from Walls/AstralDirtWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralDirtWall.cs index 8305333479..3e8494b5f9 100644 --- a/Walls/AstralDirtWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralDirtWall.cs @@ -1,11 +1,10 @@ using Microsoft.Xna.Framework; -using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralDirtWallSafe : ModWall + public class UnsafeAstralDirtWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralDirtWall"; @@ -13,7 +12,6 @@ namespace CalamityMod.Walls { // TODO -- Change this dust to be one more befitting Astral Dirt. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Dirt[Type] = true; AddMapEntry(new Color(26, 22, 32)); } diff --git a/Walls/AstralGrassWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs similarity index 73% rename from Walls/AstralGrassWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralGrassWall.cs index b7f0877466..1a115e39ff 100644 --- a/Walls/AstralGrassWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralGrassWall.cs @@ -2,16 +2,23 @@ using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; using Terraria; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralGrassWallSafe : ModWall + public class UnsafeAstralGrassWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralGrassWall"; + public static Asset leafTexture = null; public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + /*public override bool Autoload(ref string name, ref string texture) + { + mod.AddWall("AstralGrassWallUnsafe", this, texture); + return base.Autoload(ref name, ref texture); + }*/ public override void SetStaticDefaults() { @@ -20,15 +27,18 @@ namespace CalamityMod.Walls WallID.Sets.Conversion.Grass[Type] = true; - Main.wallHouse[Type] = true; - AddMapEntry(new Color(60, 48, 64)); + + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/AstralGrassWallLeaves"); + } } public override void PostDraw(int i, int j, SpriteBatch spriteBatch) { if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) { - Texture2D tex = AstralGrassWall.leafTexture.Value; + Texture2D tex = leafTexture.Value; var rand = new Random(i + (j * 100000)); float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; diff --git a/Walls/AstralIceWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralIceWall.cs similarity index 76% rename from Walls/AstralIceWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralIceWall.cs index 0b93d98546..cef160b93f 100644 --- a/Walls/AstralIceWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralIceWall.cs @@ -1,17 +1,15 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralIceWallSafe : ModWall + public class UnsafeAstralIceWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralIceWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Ice. - Main.wallHouse[Type] = true; DustType = DustID.Shadowflame; WallID.Sets.Conversion.Ice[Type] = true; AddMapEntry(new Color(83, 76, 92)); diff --git a/Walls/AstralSandstoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs similarity index 76% rename from Walls/AstralSandstoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs index af458c22e4..eaa00bad12 100644 --- a/Walls/AstralSandstoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralSandstoneWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralSandstoneWallSafe : ModWall + public class UnsafeAstralSandstoneWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralSandstoneWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Sandstone. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Sandstone[Type] = true; diff --git a/Walls/AstralSnowWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralSnowWall.cs similarity index 74% rename from Walls/AstralSnowWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralSnowWall.cs index fe7d6b8b19..56771bbc1e 100644 --- a/Walls/AstralSnowWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralSnowWall.cs @@ -1,17 +1,15 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralSnowWallSafe : ModWall + public class UnsafeAstralSnowWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralSnowWall"; - public override void SetStaticDefaults() { DustType = ModContent.DustType(); - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Snow[Type] = true; AddMapEntry(new Color(135, 145, 149)); } diff --git a/Walls/AstralStoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeAstralStoneWall.cs similarity index 76% rename from Walls/AstralStoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeAstralStoneWall.cs index 80b21ac42d..3b707574ee 100644 --- a/Walls/AstralStoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeAstralStoneWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class AstralStoneWallSafe : ModWall + public class UnsafeAstralStoneWall : ModWall { public override string Texture => "CalamityMod/Walls/AstralStoneWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Astral Stone. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.Stone[Type] = true; diff --git a/Walls/BrimstoneSlagWallUnsafe.cs b/Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs similarity index 84% rename from Walls/BrimstoneSlagWallUnsafe.cs rename to Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs index 4485858ca2..a05946e17c 100644 --- a/Walls/BrimstoneSlagWallUnsafe.cs +++ b/Walls/UnsafeWalls/UnsafeBrimstoneSlagWall.cs @@ -1,10 +1,12 @@ using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; +using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class BrimstoneSlagWallUnsafe : MultiVariantModWall + [LegacyName("BrimstoneSlagWallUnsafe")] + public class UnsafeBrimstoneSlagWall : MultiVariantModWall { public override string Texture => "CalamityMod/Walls/BrimstoneSlagWall"; public override void SetStaticDefaults() diff --git a/Walls/HardenedAstralSandWallSafe.cs b/Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs similarity index 76% rename from Walls/HardenedAstralSandWallSafe.cs rename to Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs index f95658aff1..ebf7d57c2b 100644 --- a/Walls/HardenedAstralSandWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeHardenedAstralSandWall.cs @@ -1,18 +1,16 @@ -using Microsoft.Xna.Framework; -using Terraria; + +using Microsoft.Xna.Framework; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class HardenedAstralSandWallSafe : ModWall + public class UnsafeHardenedAstralSandWall : ModWall { public override string Texture => "CalamityMod/Walls/HardenedAstralSandWall"; - public override void SetStaticDefaults() { // TODO -- Change this dust to be one more befitting Hardened Astral Sand. DustType = DustID.Shadowflame; - Main.wallHouse[Type] = true; WallID.Sets.Conversion.HardenedSand[Type] = true; diff --git a/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs b/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs new file mode 100644 index 0000000000..fa88417a27 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeLargeBasaltWall.cs @@ -0,0 +1,106 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeLargeBasaltWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/LargeBasaltWall"; + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + AddMapEntry(new Color(65, 64, 68)); + } + public override void RandomUpdate(int i, int j) + { + Tile t = Main.tile[i, j]; + Tile tUP = Main.tile[i, j - 1]; + Tile tDOWN = Main.tile[i, j + 1]; + Tile tLEFT = Main.tile[i - 1, j]; + Tile tRIGHT = Main.tile[i + 1, j]; + Tile tUPLEFT = Main.tile[i -1, j - 1]; + Tile tDOWNLEFT = Main.tile[i - 1, j + 1]; + Tile tUPRIGHT = Main.tile[i + 1, j -1]; + Tile tDOWNRIGHT = Main.tile[i + 1, j + 1]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUP.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUP.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWN.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWN.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + + if (tUPLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNLEFT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNLEFT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tUPRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tUPRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + if (tDOWNRIGHT.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + tDOWNRIGHT.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + Dust dust; + dust = Main.dust[Dust.NewDust(new Vector2(i * 16f, j * 16f), 16, 16, DustID.Smoke, 0f, -1.9069767f, 195, new Color(255, 255, 255), 1f)]; + dust.noGravity = false; + dust.fadeIn = 1.4209302f; + } + public override void PlaceInWorld(int i, int j, Item item) + { + Tile t = Main.tile[i, j]; + if (t.LiquidType == LiquidID.Water && j < Main.maxTilesY - 205) + { + t.LiquidAmount = 0; + WorldGen.SquareTileFrame(i, j); + } + } + + public override bool CreateDust(int i, int j, ref int type) + { + Dust.NewDust(new Vector2(i, j) * 16f, 16, 16, DustID.Ash, 0f, 0f, 1, new Color(255, 255, 255), 1f); + return false; + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 4) * 468; + frameYOffset = (j % 4) * 180; + } + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeLimestoneWall.cs b/Walls/UnsafeWalls/UnsafeLimestoneWall.cs new file mode 100644 index 0000000000..db214dae30 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeLimestoneWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeLimestoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/LimestoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 22; + AddMapEntry(new Color(125, 85, 61)); + this.AddMapEntryWithWaterVisibility(new Color(78, 76, 127)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeNavyslateWall.cs b/Walls/UnsafeWalls/UnsafeNavyslateWall.cs new file mode 100644 index 0000000000..c6a01d7eda --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeNavyslateWall.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeNavyslateWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/NavyslateWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 96; + this.AddMapEntryWithWaterVisibility(new Color(11, 40, 43)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeNavystoneWall.cs b/Walls/UnsafeWalls/UnsafeNavystoneWall.cs new file mode 100644 index 0000000000..4253d42fa2 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeNavystoneWall.cs @@ -0,0 +1,27 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria.GameContent; +using Terraria; +using Terraria.ModLoader; +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeNavystoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/NavystoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + DustType = 96; + this.AddMapEntryWithWaterVisibility(new Color(16, 45, 48)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeRunestoneWall.cs b/Walls/UnsafeWalls/UnsafeRunestoneWall.cs new file mode 100644 index 0000000000..5f22703f03 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeRunestoneWall.cs @@ -0,0 +1,26 @@ +using CalamityMod.Dusts.Furniture; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeRunestoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/RunestoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + + this.AddMapEntryWithWaterVisibility(new Color(122, 59, 48)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs new file mode 100644 index 0000000000..d7175d3781 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeScarletSeaGrassWall.cs @@ -0,0 +1,53 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeScarletSeaGrassWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/ScarletSeaGrassWall"; + public static Asset leafTexture = null; + int IVisibleThroughWater.WaterMapEntry { get; set; } + public static Vector2 TileAdj => (Lighting.Mode == Terraria.Graphics.Light.LightMode.Retro || Lighting.Mode == Terraria.Graphics.Light.LightMode.Trippy) ? Vector2.Zero : Vector2.One * 12; + + public override void SetStaticDefaults() + { + // 18APR2025: Ozzatron: guessed a red dust for scarlet sea grass + DustType = DustID.CrimsonPlants; + Main.wallHouse[Type] = false; + WallID.Sets.Conversion.Grass[Type] = true; + + AddMapEntry(new Color(144, 33, 33)); + this.AddMapEntryWithWaterVisibility(new Color(96, 53, 116)); + if (!Main.dedServ) + { + leafTexture = ModContent.Request("CalamityMod/Walls/ScarletSeaGrassWall_Leaves"); + } + } + public override void PostDraw(int i, int j, SpriteBatch spriteBatch) + { + if (i > Main.screenPosition.X / 16 && i < Main.screenPosition.X / 16 + Main.screenWidth / 16 && j > Main.screenPosition.Y / 16 && j < Main.screenPosition.Y / 16 + Main.screenHeight / 16) + { + Texture2D tex = leafTexture.Value; + var rand = new Random(i + (j * 100000)); + + float offset = i * j % 6.28f + (float)rand.NextDouble() / 8f; + float sin = (float)Math.Sin(Main.GameUpdateCount / 45f + offset); + + spriteBatch.Draw(tex, (new Vector2(i + 0.5f, j + 0.5f) + TileAdj) * 16 + new Vector2(1, 0.5f) * sin * 2.2f - Main.screenPosition, + new Rectangle(rand.Next(4) * 26, 0, 24, 24), Lighting.GetColor(i, j), offset + sin * 0.09f, new Vector2(12, 12), 1 + sin / 14f, 0, 0); + } + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs b/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs new file mode 100644 index 0000000000..f2d8b7972c --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeSeaPrismWall.cs @@ -0,0 +1,90 @@ +using System; +using CalamityMod.Tiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.GameContent; +using Terraria.ID; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeSeaPrismWall : MultiVariantModWall + { + public override string Texture => "CalamityMod/Walls/SeaPrismWall"; + internal static FramedMaskTexture GlowMaskBlue; + internal static FramedMaskTexture GlowMaskPurple; + internal static FramedMaskTexture GlowMaskGreen; + public override void SetStaticDefaults() + { + GlowMaskBlue = new("CalamityMod/Walls/SeaPrismWall_Blue", 36, 36); + GlowMaskPurple = new("CalamityMod/Walls/SeaPrismWall_Purple", 36, 36); + GlowMaskGreen = new("CalamityMod/Walls/SeaPrismWall_Green", 36, 36); + Main.wallHouse[Type] = false; + DustType = 108; + + AddMapEntry(new Color(27, 123, 131)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override void PopulateWallVariant(int i, int j, ref int frameXOffset, ref int frameYOffset) + { + frameXOffset = (i % 8) * 468; + frameYOffset = (j % 8) * 180; + } + private static float GetFade1(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.2f) + 1f) / 2f; + + private static float GetFade2(int i, int j) => + (MathF.Sin(Main.GlobalTimeWrappedHourly * 0.1f + i * 0.08f - j * 0.05f) + 1f) / 2f; + + public static void DrawWallGlow(int wallType, int i, int j, SpriteBatch spriteBatch) + { + Tile tile = Main.tile[i, j]; + int xLength = 32; + + int frameXOffset = (i % 8) * 468; + int frameYOffset = (j % 8) * 180; + + int xPos = tile.WallFrameX + frameXOffset; + int yPos = tile.WallFrameY + frameYOffset; + + Rectangle frame = new Rectangle(xPos, yPos, xLength, 32); + Vector2 zero = Main.drawToScreen ? Vector2.Zero : new Vector2(Main.offScreenRange); + Vector2 pos = new Vector2(i * 16 - (int)Main.screenPosition.X, j * 16 - (int)Main.screenPosition.Y) + zero; + + // base wall + spriteBatch.Draw(TextureAssets.Wall[wallType].Value, pos + new Vector2(-8, -8), frame, Lighting.GetColor(i, j)); + + // glow layers + float fade1 = GetFade1(i, j); + float fade2 = GetFade2(i, j); + + if (GlowMaskBlue.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskBlue.Texture, pos + new Vector2(-8, -8), frame, (Color.White * 1.1f)); + } + if (GlowMaskPurple.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskPurple.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade1 * 1.1f)); + } + if (GlowMaskGreen.HasContentInFramePos(xPos, yPos)) + { + spriteBatch.Draw(GlowMaskGreen.Texture, pos + new Vector2(-8, -8), frame, Color.White * (fade2 * 1.5f)); + } + + Color wallColor = Lighting.GetColor(i, j) * 1.2f; // brighten a bit + wallColor.A = 255; + } + + public override bool PreDraw(int i, int j, SpriteBatch spriteBatch) + { + DrawWallGlow(Type, i, j, spriteBatch); + return false; + } + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/UnsafeWalls/UnsafeShellstoneWall.cs b/Walls/UnsafeWalls/UnsafeShellstoneWall.cs new file mode 100644 index 0000000000..2d29b3f210 --- /dev/null +++ b/Walls/UnsafeWalls/UnsafeShellstoneWall.cs @@ -0,0 +1,27 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Walls.UnsafeWalls +{ + public class UnsafeShellstoneWall : ModWall, IVisibleThroughWater + { + public override string Texture => "CalamityMod/Walls/ShellstoneWall"; + int IVisibleThroughWater.WaterMapEntry { get; set; } + + public override void SetStaticDefaults() + { + Main.wallHouse[Type] = false; + DustType = 24; + + this.AddMapEntryWithWaterVisibility(new Color(74, 71, 84)); + } + + public override void NumDust(int i, int j, bool fail, ref int num) => num = fail ? 1 : 3; + + public override bool Drop(int i, int j, ref int type) + { + return false; + } + } +} diff --git a/Walls/SulphurousSandWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs similarity index 77% rename from Walls/SulphurousSandWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs index e757dc2851..8f8caa9554 100644 --- a/Walls/SulphurousSandWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousSandWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousSandWallSafe : ModWall + public class UnsafeSulphurousSandWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousSandWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(84, 71, 46)); } diff --git a/Walls/SulphurousSandstoneWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs similarity index 77% rename from Walls/SulphurousSandstoneWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs index 8a7091113c..a39c9f24fc 100644 --- a/Walls/SulphurousSandstoneWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousSandstoneWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousSandstoneWallSafe : ModWall + public class UnsafeSulphurousSandstoneWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousSandstoneWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(57, 45, 38)); } diff --git a/Walls/SulphurousShaleWallSafe.cs b/Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs similarity index 77% rename from Walls/SulphurousShaleWallSafe.cs rename to Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs index d0e37e5a12..cbd6f77b3a 100644 --- a/Walls/SulphurousShaleWallSafe.cs +++ b/Walls/UnsafeWalls/UnsafeSulphurousShaleWall.cs @@ -1,15 +1,15 @@ using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class SulphurousShaleWallSafe : ModWall + public class UnsafeSulphurousShaleWall : ModWall { public override string Texture => "CalamityMod/Walls/SulphurousShaleWall"; public override void SetStaticDefaults() { - Main.wallHouse[Type] = true; DustType = 32; AddMapEntry(new Color(59, 40, 63)); } diff --git a/Walls/VoidstoneWallUnsafe.cs b/Walls/UnsafeWalls/UnsafeVoidstoneWall.cs similarity index 97% rename from Walls/VoidstoneWallUnsafe.cs rename to Walls/UnsafeWalls/UnsafeVoidstoneWall.cs index 2f8aa9fc12..54954c556a 100644 --- a/Walls/VoidstoneWallUnsafe.cs +++ b/Walls/UnsafeWalls/UnsafeVoidstoneWall.cs @@ -7,9 +7,9 @@ using Terraria.GameContent; using Terraria.ID; using Terraria.ModLoader; -namespace CalamityMod.Walls +namespace CalamityMod.Walls.UnsafeWalls { - public class VoidstoneWallUnsafe : ModWall + public class UnsafeVoidstoneWall : ModWall { internal static FramedMaskTexture GlowMask; public override string Texture => "CalamityMod/Walls/VoidstoneWall"; diff --git a/Waters/BasaltGullyLava.cs b/Waters/BasaltGullyLava.cs new file mode 100644 index 0000000000..ba11110a93 --- /dev/null +++ b/Waters/BasaltGullyLava.cs @@ -0,0 +1,26 @@ +using CalamityMod.Dusts.WaterSplash; +using CalamityMod.Gores.WaterDroplet; +using CalamityMod.Systems; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Waters +{ + public class BasaltGullyLava : ModLavaStyle + { + public override string WaterfallTexture => "CalamityMod/Waters/BasaltGullyLavaflow"; + + public override int GetSplashDust() => ModContent.DustType(); + + public override int GetDropletGore() => ModContent.GoreType(); + + public override bool IsLavaActive() => Main.LocalPlayer.Calamity().ZoneBasaltGully; + + public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) + { + r = 248f / 255; + g = 73f / 255; + b = 73f / 255; + } + } +} diff --git a/Waters/BasaltGullyLava.png b/Waters/BasaltGullyLava.png new file mode 100644 index 0000000000..489de52258 Binary files /dev/null and b/Waters/BasaltGullyLava.png differ diff --git a/Waters/BasaltGullyLava_Block.png b/Waters/BasaltGullyLava_Block.png new file mode 100644 index 0000000000..6fd6bc9bf5 Binary files /dev/null and b/Waters/BasaltGullyLava_Block.png differ diff --git a/Waters/BasaltGullyLava_Slope.png b/Waters/BasaltGullyLava_Slope.png new file mode 100644 index 0000000000..3f4a9dda65 Binary files /dev/null and b/Waters/BasaltGullyLava_Slope.png differ diff --git a/Waters/BasaltGullyLavaflow.png b/Waters/BasaltGullyLavaflow.png new file mode 100644 index 0000000000..162dcce323 Binary files /dev/null and b/Waters/BasaltGullyLavaflow.png differ diff --git a/Waters/SunkenSeaBurrowsWater.png b/Waters/SunkenSeaBurrowsWater.png index 1dd5bd9f12..b5445b95b0 100644 Binary files a/Waters/SunkenSeaBurrowsWater.png and b/Waters/SunkenSeaBurrowsWater.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Block.png b/Waters/SunkenSeaBurrowsWater_Block.png index bbf43cea00..55f4835baf 100644 Binary files a/Waters/SunkenSeaBurrowsWater_Block.png and b/Waters/SunkenSeaBurrowsWater_Block.png differ diff --git a/Waters/SunkenSeaBurrowsWater_Slope.png b/Waters/SunkenSeaBurrowsWater_Slope.png index 5598cc77c0..c8c200a00e 100644 Binary files a/Waters/SunkenSeaBurrowsWater_Slope.png and b/Waters/SunkenSeaBurrowsWater_Slope.png differ diff --git a/Waters/SunkenSeaBurrowsWaterflow.png b/Waters/SunkenSeaBurrowsWaterflow.png index f2ea06818a..7dfa31563c 100644 Binary files a/Waters/SunkenSeaBurrowsWaterflow.png and b/Waters/SunkenSeaBurrowsWaterflow.png differ diff --git a/Waters/SunkenSeaPolypWater.png b/Waters/SunkenSeaPolypWater.png index 682fb25774..d49ec9cb77 100644 Binary files a/Waters/SunkenSeaPolypWater.png and b/Waters/SunkenSeaPolypWater.png differ diff --git a/Waters/SunkenSeaPolypWater_Block.png b/Waters/SunkenSeaPolypWater_Block.png index 1f823d0ea9..7cb531a45a 100644 Binary files a/Waters/SunkenSeaPolypWater_Block.png and b/Waters/SunkenSeaPolypWater_Block.png differ diff --git a/Waters/SunkenSeaPolypWater_Slope.png b/Waters/SunkenSeaPolypWater_Slope.png index 9404893b7c..7786b18561 100644 Binary files a/Waters/SunkenSeaPolypWater_Slope.png and b/Waters/SunkenSeaPolypWater_Slope.png differ diff --git a/Waters/SunkenSeaPolypWaterflow.png b/Waters/SunkenSeaPolypWaterflow.png index ee3de90b50..d1fca985c2 100644 Binary files a/Waters/SunkenSeaPolypWaterflow.png and b/Waters/SunkenSeaPolypWaterflow.png differ diff --git a/Waters/SunkenSeaReefsWater.png b/Waters/SunkenSeaReefsWater.png index f698094ba2..62239832c4 100644 Binary files a/Waters/SunkenSeaReefsWater.png and b/Waters/SunkenSeaReefsWater.png differ diff --git a/Waters/SunkenSeaReefsWater_Block.png b/Waters/SunkenSeaReefsWater_Block.png index e2a973a704..f93b5fb6c1 100644 Binary files a/Waters/SunkenSeaReefsWater_Block.png and b/Waters/SunkenSeaReefsWater_Block.png differ diff --git a/Waters/SunkenSeaReefsWater_Slope.png b/Waters/SunkenSeaReefsWater_Slope.png index 694bd626c7..b9fd91405c 100644 Binary files a/Waters/SunkenSeaReefsWater_Slope.png and b/Waters/SunkenSeaReefsWater_Slope.png differ diff --git a/Waters/SunkenSeaReefsWaterflow.png b/Waters/SunkenSeaReefsWaterflow.png index 6e894d833c..18a47b1801 100644 Binary files a/Waters/SunkenSeaReefsWaterflow.png and b/Waters/SunkenSeaReefsWaterflow.png differ diff --git a/Waters/SunkenSeaShoresWater.cs b/Waters/SunkenSeaShoresWater.cs index 032e3322b9..ae828a4fa8 100644 --- a/Waters/SunkenSeaShoresWater.cs +++ b/Waters/SunkenSeaShoresWater.cs @@ -12,7 +12,7 @@ namespace CalamityMod.Waters public class SunkenSeaShoresWater : CalamityModWaterStyle { - private readonly Vector3 WaterGlowColor = new Color(140, 222, 239).ToVector3(); + private readonly Vector3 WaterGlowColor = new Color(82, 223, 255).ToVector3(); public static int Type { get; private set; } public static CalamityModWaterStyle Instance { get; private set; } diff --git a/Waters/SunkenSeaShoresWater.png b/Waters/SunkenSeaShoresWater.png index d9ead26b53..3a361affdf 100644 Binary files a/Waters/SunkenSeaShoresWater.png and b/Waters/SunkenSeaShoresWater.png differ diff --git a/Waters/SunkenSeaShoresWater_Block.png b/Waters/SunkenSeaShoresWater_Block.png index c828d653e2..4b0007eecf 100644 Binary files a/Waters/SunkenSeaShoresWater_Block.png and b/Waters/SunkenSeaShoresWater_Block.png differ diff --git a/Waters/SunkenSeaShoresWater_Slope.png b/Waters/SunkenSeaShoresWater_Slope.png index 179eb74a64..cd9bf6cfc6 100644 Binary files a/Waters/SunkenSeaShoresWater_Slope.png and b/Waters/SunkenSeaShoresWater_Slope.png differ diff --git a/Waters/SunkenSeaShoresWaterflow.png b/Waters/SunkenSeaShoresWaterflow.png index 3d605a0e35..7ca2c5df22 100644 Binary files a/Waters/SunkenSeaShoresWaterflow.png and b/Waters/SunkenSeaShoresWaterflow.png differ diff --git a/World/Abyss.cs b/World/Abyss.cs index 84775f63b8..676ad09e8c 100644 --- a/World/Abyss.cs +++ b/World/Abyss.cs @@ -18,6 +18,7 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureVoid; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -73,7 +74,7 @@ namespace CalamityMod.World if (tile.HasTile) { bool vanillaTile = tile.TileType < TileID.Count; - bool validModdedTile = tile.TileType != ModContent.TileType() && AbyssValidTileReplacementList.Includes(tile.TileType); + bool validModdedTile = tile.TileType != ModContent.TileType() && CalamityTileSets.CanBeReplacedByAbyssGeneration[tile.TileType]; canConvert = vanillaTile || validModdedTile; } @@ -91,13 +92,13 @@ namespace CalamityMod.World if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) @@ -115,7 +116,7 @@ namespace CalamityMod.World else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) @@ -123,19 +124,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //basically places smaller clusters everywhere else? @@ -147,13 +148,13 @@ namespace CalamityMod.World if (Y <= rockLayer - (int)((y - 200) * 0.6f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.59f) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y <= rockLayer - (int)((y - 200) * 0.4f)) @@ -171,7 +172,7 @@ namespace CalamityMod.World else if (Y <= rockLayer - (int)((y - 200) * 0.2f)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 1-2 dithering transition else if (Y <= rockLayer - (int)((y - 200) * 0.19f)) @@ -179,19 +180,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } } @@ -207,13 +208,13 @@ namespace CalamityMod.World if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y > (rockLayer + y * 0.145)) @@ -233,19 +234,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 2 (default block for the abyss) else @@ -263,13 +264,13 @@ namespace CalamityMod.World if (Y > (rockLayer + y * 0.270)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3-4 dithering transition else if (Y > (rockLayer + y * 0.268) && WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 3 else if (Y > (rockLayer + y * 0.145)) @@ -289,19 +290,19 @@ namespace CalamityMod.World if (WorldGen.genRand.NextBool(2)) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } else { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } } //layer 1 else if (Y <= rockLayer - 10) { tile.TileType = (ushort)ModContent.TileType(); - tile.WallType = (ushort)ModContent.WallType(); + tile.WallType = (ushort)ModContent.WallType(); } //layer 2 (default block for the abyss) else @@ -1119,6 +1120,7 @@ namespace CalamityMod.World if (ChestIndex != -1) { Main.chest[ChestIndex].item[0].SetDefaults(itemChoice); + Main.chest[ChestIndex].item[0].Prefix(-1); Main.chest[ChestIndex].item[1].SetDefaults(WorldGen.genRand.Next(Potions1)); Main.chest[ChestIndex].item[1].stack = WorldGen.genRand.Next(1, 3); diff --git a/World/AerialiteOreGen.cs b/World/AerialiteOreGen.cs index 9a487be65a..d712a0c3e8 100644 --- a/World/AerialiteOreGen.cs +++ b/World/AerialiteOreGen.cs @@ -34,7 +34,7 @@ namespace CalamityMod.World // 2. The original tile must not be empty air. // 3. A random dice-roll must land correctly, to ensure that patches of ore are occasional. // If any of these conditions are not met, this loop iteration is skipped. - if (!(tile.TileType == TileID.Cloud || tile.TileType == TileID.LesionBlock || tile.TileType == TileID.FleshBlock) || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) + if (!(tile.TileType == TileID.Cloud || ((tile.TileType == TileID.LesionBlock || tile.TileType == TileID.FleshBlock) && WorldGen.remixWorldGen)) || !tile.HasTile || !WorldGen.genRand.NextBool(CloudOreConversionChance)) continue; int radius = (int)(WorldGen.genRand.Next(3, 5) * WorldGen.genRand.NextFloat(0.74f, 0.82f)); diff --git a/World/AstralBiome.cs b/World/AstralBiome.cs index 6fcb107f3b..ddfd043bb4 100644 --- a/World/AstralBiome.cs +++ b/World/AstralBiome.cs @@ -4,10 +4,13 @@ using System.Linq; using CalamityMod.Schematics; using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Astral; +using CalamityMod.Tiles.FurnitureAcidwood; +using CalamityMod.Tiles.FurnitureMonolith; using CalamityMod.Tiles.AstralDesert; using CalamityMod.Tiles.AstralSnow; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -773,33 +776,33 @@ namespace CalamityMod.World if (Main.tile[x, y] != null) { - if (wallType != WallID.None && wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && - wallType != ModContent.WallType() && wallType != ModContent.WallType() && + if (wallType != WallID.None && wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && + wallType != ModContent.WallType() && wallType != ModContent.WallType() && wallType != ModContent.WallType()) { if (WallID.Sets.Conversion.Grass[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.HardenedSand[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Sandstone[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } else if (WallID.Sets.Conversion.Stone[wallType]) { - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); } @@ -814,12 +817,12 @@ namespace CalamityMod.World case WallID.DirtUnsafe4: case WallID.Cave6Unsafe: case WallID.Dirt: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.SnowWallUnsafe: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -829,7 +832,7 @@ namespace CalamityMod.World NetMessage.SendTileSquare(-1, x, y, 1); break; case WallID.IceUnsafe: - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y].WallType = (ushort)ModContent.WallType(); WorldGen.SquareWallFrame(x, y, true); NetMessage.SendTileSquare(-1, x, y, 1); break; @@ -1172,11 +1175,11 @@ namespace CalamityMod.World #region WALL if (Main.tile[x, y] != null) { - if (wallType == ModContent.WallType()) + if (wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.DirtUnsafe; } - else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType() || wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.SnowWallUnsafe; } @@ -1184,7 +1187,7 @@ namespace CalamityMod.World { Main.tile[x, y].WallType = WallID.DesertFossil; } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { switch (convert) { @@ -1202,15 +1205,15 @@ namespace CalamityMod.World break; } } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { Main.tile[x, y].WallType = WallID.IceUnsafe; } else if (wallType == ModContent.WallType()) { - Main.tile[x, y].WallType = WallID.LivingWood; + Main.tile[x, y].WallType = WallID.LivingWoodUnsafe; } - else if (wallType == ModContent.WallType()) + else if (wallType == ModContent.WallType()) { switch (convert) { diff --git a/World/BrimstoneCrag.cs b/World/BrimstoneCrag.cs index 11024b1055..d984d756f6 100644 --- a/World/BrimstoneCrag.cs +++ b/World/BrimstoneCrag.cs @@ -8,6 +8,7 @@ using CalamityMod.Tiles.Crags.Spike; using CalamityMod.Tiles.Crags.Tree; using CalamityMod.Tiles.Ores; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; @@ -56,8 +57,10 @@ namespace CalamityMod.World { for (int y = Main.maxTilesY - 90; y <= Main.maxTilesY - 5; y++) { - WorldGen.PlaceTile(x, y, (ushort)ModContent.TileType()); - Main.tile[x, y].WallType = (ushort)ModContent.WallType(); + Tile tile = Main.tile[x, y]; + tile.TileType = (ushort)ModContent.TileType(); + tile.HasTile = true; + tile.WallType = (ushort)ModContent.WallType(); } } @@ -144,7 +147,7 @@ namespace CalamityMod.World //place more walls behind slag so theres not just a box of walls from the initial rectangle if (tile.HasTile && tileDown.HasTile && tileDown2.HasTile && Main.tile[x, y + 5].HasTile) { - Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y + 5].WallType = (ushort)ModContent.WallType(); } if (tile.LiquidType == LiquidID.Water && tile.LiquidAmount > 0) diff --git a/World/CalamityWorld.cs b/World/CalamityWorld.cs index 6439becdb8..82bca91ae4 100644 --- a/World/CalamityWorld.cs +++ b/World/CalamityWorld.cs @@ -5,9 +5,11 @@ using CalamityMod.NPCs.ExoMechs.Apollo; using CalamityMod.NPCs.ExoMechs.Ares; using CalamityMod.NPCs.ExoMechs.Artemis; using CalamityMod.NPCs.ExoMechs.Thanatos; +using CalamityMod.Systems; using Microsoft.Xna.Framework; using Terraria; using Terraria.DataStructures; +using Terraria.GameContent.Creative; using Terraria.GameContent.Events; using Terraria.ID; using Terraria.ModLoader; @@ -52,10 +54,23 @@ namespace CalamityMod.World /// Evaluates to whether vanilla's "Legendary Mode" is enabled (Master Mode on For the Worthy). public static bool LegendaryMode => Main.getGoodWorld && ReflectMasterMode(); + /// + /// Evaluates to whether "Malice Mode" is enabled (Death Mode on For the Worthy).
+ /// Note that the effects of this difficulty are unaffiliated with the removed Malice Mode. + ///
+ public static bool MaliceMode => Main.getGoodWorld && ReflectMasterMode() && revenge; + // FTW automatically bumps difficulties up and has no proper check for Master since a world generated in Expert Mode will be classified as Master // Therefore gotta reflect! public static bool ReflectMasterMode() { + if (Main.GameModeInfo.IsJourneyMode) + { + CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower(); + float level = (float)DifficultyModeSystem.journeySliderCacheField.GetValue(power); + return level == 1f; + } + FieldInfo findInfo = typeof(Main).GetField("_currentGameModeInfo", BindingFlags.Static | BindingFlags.NonPublic); GameModeData data = (GameModeData)findInfo.GetValue(null); return data.IsMasterMode; @@ -73,8 +88,6 @@ namespace CalamityMod.World /// If true, the Bandit has lived in this world. Used to ensure their spawn condition is not required on subsequent respawns. public static bool spawnedBandit = false; - /// If true, the Drunk Princess has lived in this world. Used to ensure her spawn condition is not required on subsequent respawns. - public static bool spawnedCirrus = false; /// If true, the Archmage has lived in a house in this world. Solely used as a condition for dialogue. public static bool foundHomePermafrost = false; diff --git a/World/CustomShimmer.cs b/World/CustomShimmer.cs new file mode 100644 index 0000000000..6d399c4a5c --- /dev/null +++ b/World/CustomShimmer.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using ReLogic.Utilities; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class CustomShimmer + { + public static void NewShimmer() + { + // Large = 4, Medium = 3, Small = 2 + int worldSize = (int)(Main.maxTilesX / 4200f * 2f); + int minOffsetX = 240; + int maxOffsetX; + switch (worldSize) + { + default: + case 2: + maxOffsetX = 300; + break; + + case 3: + maxOffsetX = 360; + break; + + case 4: + maxOffsetX = 420; + break; + } + + int offset = 50; + int shimmerMinDepth = (int)((Main.worldSurface + Main.rockLayer) * 0.5) + offset; + int shimmerMaxDepth = (int)(((double)((Main.maxTilesY - 250) * 2) + Main.rockLayer) * 0.33); + shimmerMaxDepth = (int)MathHelper.Clamp(shimmerMaxDepth, shimmerMinDepth + 50, Main.maxTilesY - 460); + + int shimmerPositionY = WorldGen.genRand.Next(shimmerMinDepth, shimmerMaxDepth); + int shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + int remixSeedShimmerMinDepth = (int)Main.worldSurface + 150; + int remixSeedShimmerMaxDepth = (int)((Main.rockLayer + Main.worldSurface + 200D) * 0.5); + if (remixSeedShimmerMaxDepth <= remixSeedShimmerMinDepth) + remixSeedShimmerMaxDepth = remixSeedShimmerMinDepth + 50; + + if (WorldGen.tenthAnniversaryWorldGen) + shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); + + int attempts = 0; + while (!WorldGen.ShimmerMakeBiome(shimmerPositionX, shimmerPositionY)) + { + attempts++; + if (WorldGen.tenthAnniversaryWorldGen && attempts < 10000) + { + shimmerPositionY = WorldGen.genRand.Next(remixSeedShimmerMinDepth, remixSeedShimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + } + else if (attempts > 20000) + { + shimmerPositionY = WorldGen.genRand.Next((int)Main.worldSurface + 120, shimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX * 2, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX * 2)); + } + else + { + shimmerPositionY = WorldGen.genRand.Next((int)((Main.worldSurface + Main.rockLayer) * 0.5) + 20, shimmerMaxDepth); + shimmerPositionX = ((GenVars.dungeonSide < 0) ? WorldGen.genRand.Next(Main.maxTilesX - maxOffsetX, Main.maxTilesX - minOffsetX) : WorldGen.genRand.Next(minOffsetX, maxOffsetX)); + } + } + + GenVars.shimmerPosition = new Vector2D(shimmerPositionX, shimmerPositionY); + int genArea = 200; + GenVars.structures.AddProtectedStructure(new Rectangle(shimmerPositionX - (int)(genArea * 0.5f), shimmerPositionY - (int)(genArea * 0.5f), genArea, genArea)); + } + } +} diff --git a/World/CustomUnderworld.cs b/World/CustomUnderworld.cs index 23df6a3460..3271f7e3f4 100644 --- a/World/CustomUnderworld.cs +++ b/World/CustomUnderworld.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using CalamityMod.Tiles.Underworld; using CalamityMod.Schematics; using Microsoft.Xna.Framework; using ReLogic.Utilities; @@ -7,6 +8,7 @@ using Terraria; using Terraria.DataStructures; using Terraria.GameContent.Generation; using Terraria.ID; +using Terraria.ModLoader; using Terraria.WorldBuilding; using static CalamityMod.Schematics.SchematicManager; @@ -1304,7 +1306,7 @@ namespace CalamityMod.World int pillarRightSize = 0; int topTileSectionSize = 10; int pillarTopTileSectionCutOff = pillarIndexStarY + topTileSectionSize; - ushort pillarTileID = Main.zenithWorld ? TileID.PoopBlock : TileID.StoneSlab; + ushort pillarTileID = Main.zenithWorld ? TileID.PoopBlock : (ushort)ModContent.TileType(); ushort pillarWallID = Main.zenithWorld ? WallID.PoopWall : WallID.RocksUnsafe3; // Use the x tile index to find pillar locations @@ -2183,6 +2185,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } @@ -2213,6 +2216,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } diff --git a/World/DraedonStructures.cs b/World/DraedonStructures.cs index 9914b11e72..d4f69609b4 100644 --- a/World/DraedonStructures.cs +++ b/World/DraedonStructures.cs @@ -45,10 +45,15 @@ namespace CalamityMod.World { return true; } - if (tile.TileType == ModContent.TileType() || - tile.TileType == ModContent.TileType() || - tile.WallType == ModContent.WallType() || - tile.WallType == ModContent.WallType()) + if (tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.TileType == ModContent.TileType() || tile.TileType == ModContent.TileType() || + tile.WallType == ModContent.WallType() || // hardened eutrophic sand doesnt have a wall lol + tile.WallType == ModContent.WallType() || + tile.WallType == ModContent.WallType() || // nor polyp sand + tile.WallType == ModContent.WallType()) // ... nor dunesand { return true; } @@ -241,6 +246,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } diff --git a/World/DungeonArchive.cs b/World/DungeonArchive.cs index 51487e5f4c..ff39d10636 100644 --- a/World/DungeonArchive.cs +++ b/World/DungeonArchive.cs @@ -135,6 +135,7 @@ namespace CalamityMod.World else { chest.item[i].SetDefaults(contents2[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents2[i].Stack; } } diff --git a/World/GiantHive.cs b/World/GiantHive.cs index 7845fa730c..cca8d6cd37 100644 --- a/World/GiantHive.cs +++ b/World/GiantHive.cs @@ -25,6 +25,7 @@ using Terraria.IO; using Terraria.ModLoader; using Terraria.Utilities; using Terraria.WorldBuilding; +using CalamityMod.World; namespace CalamityMod.World { @@ -316,83 +317,6 @@ namespace CalamityMod.World } } } - public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Hive) - { - int dx = endX - startX; - int dy = endY - startY; - int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - - for (int i = 0; i <= steps; i++) - { - float t = (float)i / steps; - int x = (int)(startX + dx * t); - int y = (int)(startY + dy * t); - - // Draw a small circular path - for (int xi = -width; xi <= width; xi++) - { - for (int yi = -width; yi <= width; yi++) - { - if (xi * xi + yi * yi <= width * width) - { - int tileX = x + xi; - int tileY = y + yi; - - if (WorldGen.InWorld(tileX, tileY)) - { - Tile tTile = Main.tile[tileX, tileY]; - tTile.HasTile = true; - tTile.TileType = (ushort)tileType; - WorldGen.SquareTileFrame(tileX, tileY); - } - } - } - } - } - } - public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3) - { - int dx = endX - startX; - int dy = endY - startY; - int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); - - for (int i = 0; i <= steps; i++) - { - float t = (float)i / steps; - int x = (int)(startX + dx * t); - int y = (int)(startY + dy * t); - - for (int xi = -width; xi <= width; xi++) - { - for (int yi = -width; yi <= width; yi++) - { - if (xi * xi + yi * yi <= width * width) - { - int tileX = x + xi; - int tileY = y + yi; - - if (WorldGen.InWorld(tileX, tileY)) - { - Tile tTile = Main.tile[tileX, tileY]; - tTile.HasTile = false; - tTile.WallType = (ushort)ModContent.WallType(); - tTile.LiquidAmount = 0; - - WorldGen.SquareWallFrame(tileX, tileY); - - // Optional: Add honey with low chance - if (WorldGen.genRand.NextBool(10)) - { - tTile.LiquidAmount = 100; - tTile.LiquidType = LiquidID.Honey; - WorldGen.SquareTileFrame(tileX, tileY); - } - } - } - } - } - } - } public static void CreateHexagon(int centerX, int centerY, int hexagonSize, int tileType, bool doWalls = false) { int halfHexagonSize = hexagonSize / 2; @@ -600,9 +524,9 @@ namespace CalamityMod.World int hexRadius = WorldGen.genRand.Next(30, 45); CreateGiantHiveHexagon(newX, newY - 15, hexRadius - 1, TileID.Hive, true); CreateHexagon(newX, newY - 15, hexRadius, TileID.Hive); - ClearTunnel(x, y + 30, newX, newY, 5); - CreateTunnel(x, y + 30, newX, newY); - ClearTunnel(x, y + 30, newX, newY, 3); + MiscWorldgenRoutines.ClearTunnel(x, y + 30, newX, newY, 5, 0, 2, true, true); + MiscWorldgenRoutines.CreateTunnel(x, y + 30, newX, newY, 6, TileID.Hive); + MiscWorldgenRoutines.ClearTunnel(x, y + 30, newX, newY, 3, (ushort)ModContent.WallType(), 2, true, true); GiantHiveWallHexagon(newX, newY - 10, WorldGen.genRand.Next(19, 26)); // Place honey chest in this cell with a small chance @@ -831,12 +755,13 @@ namespace CalamityMod.World int index = 0; - chest.item[index++].SetDefaults(random.Next(FocusLootHoney)); + chest.item[index].SetDefaults(random.Next(FocusLootHoney)); + chest.item[index++].Prefix(-1); if (random.Next(3) <= 1) { chest.item[index].SetDefaults(random.Next(BarLootHoney)); - chest.item[index].SetDefaults(random.Next(7, 15)); + chest.item[index++].stack = random.Next(7, 15); } else { diff --git a/World/MechanicShed.cs b/World/MechanicShed.cs index 172e2fb573..5af166de3c 100644 --- a/World/MechanicShed.cs +++ b/World/MechanicShed.cs @@ -130,6 +130,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } diff --git a/World/MiscWorldgenRoutines.cs b/World/MiscWorldgenRoutines.cs index 474cf6d647..412df60374 100644 --- a/World/MiscWorldgenRoutines.cs +++ b/World/MiscWorldgenRoutines.cs @@ -63,6 +63,7 @@ namespace CalamityMod.World return; c.item[itemIndex].SetDefaults(id, false); + c.item[itemIndex].Prefix(-1); // Don't set quantity unless quantity is specified if (minQuantity > 0) @@ -144,6 +145,93 @@ namespace CalamityMod.World } #endregion + #region Tunnel Tools + public static void CreateTunnel(int startX, int startY, int endX, int endY, int width = 6, int tileType = TileID.Dirt) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); + + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + // Draw a small circular path + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = true; + tTile.TileType = (ushort)tileType; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + public static void ClearTunnel(int startX, int startY, int endX, int endY, int width = 3, int wallType = WallID.Dirt, int liquidType = LiquidID.Water, bool liquidOn = true, bool wallOn = true) + { + int dx = endX - startX; + int dy = endY - startY; + int steps = Math.Max(Math.Abs(dx), Math.Abs(dy)); + + for (int i = 0; i <= steps; i++) + { + float t = (float)i / steps; + int x = (int)(startX + dx * t); + int y = (int)(startY + dy * t); + + for (int xi = -width; xi <= width; xi++) + { + for (int yi = -width; yi <= width; yi++) + { + if (xi * xi + yi * yi <= width * width) + { + int tileX = x + xi; + int tileY = y + yi; + + if (WorldGen.InWorld(tileX, tileY)) + { + Tile tTile = Main.tile[tileX, tileY]; + tTile.HasTile = false; + if (wallOn) + { + tTile.WallType = (ushort)wallType; + } + + tTile.LiquidAmount = 0; + + WorldGen.SquareWallFrame(tileX, tileY); + + // Optional: Add liquid with low chance + if (liquidOn) + { + if (WorldGen.genRand.NextBool(10)) + { + tTile.LiquidAmount = 100; + tTile.LiquidType = liquidType; + WorldGen.SquareTileFrame(tileX, tileY); + } + } + } + } + } + } + } + } + #endregion + #region Chasm Generator public static void ChasmGenerator(int i, int j, int steps, bool ocean = false) { diff --git a/World/Planets/MudPlanet.cs b/World/Planets/MudPlanet.cs index 97113e4681..0ce47166f8 100644 --- a/World/Planets/MudPlanet.cs +++ b/World/Planets/MudPlanet.cs @@ -222,13 +222,14 @@ namespace CalamityMod.World.Planets int index = 0; //Focus loot - chest.item[index++].SetDefaults(_random.Next(FocusLoot)); + chest.item[index].SetDefaults(_random.Next(FocusLoot)); + chest.item[index++].Prefix(-1); //Bars if (_random.Next(3) <= 1) { chest.item[index].SetDefaults(_random.Next(BarLoot)); - chest.item[index].SetDefaults(_random.Next(7, 15)); + chest.item[index++].stack = _random.Next(7, 15); } else { diff --git a/World/ShimmerShrine.cs b/World/ShimmerShrine.cs new file mode 100644 index 0000000000..6da42ae74d --- /dev/null +++ b/World/ShimmerShrine.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Schematics; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; +using Terraria.WorldBuilding; +using static CalamityMod.Schematics.SchematicManager; + +namespace CalamityMod.World +{ + public class ShimmerShrine + { + public static void PlaceShimmerShrine(StructureMap structures) + { + string mapKey = ShimmerShrineKey; + var schematic = TileMaps[mapKey]; + + int placementPositionX = (int)GenVars.shimmerPosition.X; + int placementPositionY = (int)Main.worldSurface - 250; + int offset = 28; + + while (!Main.tile[placementPositionX, placementPositionY].HasTile) + placementPositionY++; + + Point placementPoint = new Point(placementPositionX, placementPositionY + offset); + SchematicAnchor anchorType = SchematicAnchor.Center; + + bool place = true; + PlaceSchematic(mapKey, placementPoint, anchorType, ref place, new Action(FillShimmerShrineChest)); + + Rectangle protectionArea = CalamityUtils.GetSchematicProtectionArea(schematic, placementPoint, anchorType); + CalamityUtils.AddProtectedStructure(protectionArea, 30); + } + + public static void FillShimmerShrineChest(Chest chest, int Type, bool place) + { + List contents = new List() + { + new ChestItem(ItemID.AngelStatue, 1), + new ChestItem(WorldGen.genRand.NextBool() ? ItemID.LifeCrystal : ItemID.ManaCrystal, 1), + new ChestItem(GenVars.goldBar == TileID.Gold ? ItemID.GoldBar : ItemID.PlatinumBar, WorldGen.genRand.Next(5, 16)), + new ChestItem(ItemID.CanOfWorms, WorldGen.genRand.Next(3, 5)), + new ChestItem(ItemID.HealingPotion, WorldGen.genRand.Next(5, 11)), + new ChestItem(ItemID.LuckPotionGreater, WorldGen.genRand.Next(1, 3)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 5)), + }; + + for (int i = 0; i < contents.Count; i++) + { + chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].stack = contents[i].Stack; + } + } + } +} diff --git a/World/SulphurousSea.cs b/World/SulphurousSea.cs index c396017248..34ec893c17 100644 --- a/World/SulphurousSea.cs +++ b/World/SulphurousSea.cs @@ -10,6 +10,7 @@ using CalamityMod.Tiles.Abyss; using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.Abyss.Stalactite; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; using Microsoft.Xna.Framework; using Terraria; using Terraria.GameContent.RGB; @@ -244,7 +245,7 @@ namespace CalamityMod.World int width = BiomeWidth + 1; int maxDepth = BlockDepth; ushort blockTileType = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = 1; i < width; i++) { @@ -326,7 +327,7 @@ namespace CalamityMod.World for (int y = top; y < bottom; y++) { if (y >= top + DepthForWater) - Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); + Main.tile[x, y + WorldGen.genRand.Next(22, 25)].WallType = (ushort)ModContent.WallType(); Main.tile[x, y].LiquidAmount = byte.MaxValue; Main.tile[x, y].Get().HasTile = false; } @@ -343,7 +344,7 @@ namespace CalamityMod.World int right = (int)(BiomeWidth * IslandWidthPercentage); int maxDepth = MaxTopWaterDepth; ushort blockTileType = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = left; i < right; i++) { @@ -384,7 +385,7 @@ namespace CalamityMod.World if (maxCaveWidth > 15) maxCaveWidth = 15; - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int i = 2; i < shallowWaterCaveCount; i++) { @@ -441,7 +442,7 @@ namespace CalamityMod.World { int width = BiomeWidth; int depth = (int)(BlockDepth * 0.96f); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int c = 0; c < SpaghettiCaveCarveOutThresholds.Length; c++) { @@ -485,7 +486,7 @@ namespace CalamityMod.World { int width = BiomeWidth; int depth = (int)(BlockDepth * 0.96f); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); for (int c = 0; c < CheeseCaveCarveOutThresholds.Length; c++) { @@ -818,7 +819,7 @@ namespace CalamityMod.World int beachWidth = WorldGen.genRand.Next(150, 190 + 1); var searchCondition = Searches.Chain(new Searches.Down(3000), new Conditions.IsSolid()); ushort sandID = (ushort)ModContent.TileType(); - ushort wallID = (ushort)ModContent.WallType(); + ushort wallID = (ushort)ModContent.WallType(); // Stop immediately if for some strange reason a valid tile could not be located for the beach starting point. if (!WorldUtils.Find(new Point(BiomeWidth + 4, Main.remixWorld ? YStart : (int)GenVars.worldSurfaceLow - 20), searchCondition, out Point determinedPoint)) @@ -1052,7 +1053,7 @@ namespace CalamityMod.World { int sandstoneSeed = WorldGen.genRand.Next(); ushort sandstoneID = (ushort)ModContent.TileType(); - ushort sandstoneWallID = (ushort)ModContent.WallType(); + ushort sandstoneWallID = (ushort)ModContent.WallType(); // Edge score evaluation function that determines the propensity a tile has to become sandstone. // This is based on how much nearby empty areas there are, allowing for "edges" to appear. @@ -1256,7 +1257,7 @@ namespace CalamityMod.World for (int dy = 0; dy < 2; dy++) { Main.tile[chestPoint.X + dx, chestPoint.Y - dy].LiquidAmount = 0; - Main.tile[chestPoint.X + dx, chestPoint.Y - dy].WallType = (ushort)ModContent.WallType(); + Main.tile[chestPoint.X + dx, chestPoint.Y - dy].WallType = (ushort)ModContent.WallType(); Main.tile[chestPoint.X + dx, chestPoint.Y - dy].Get().HasTile = false; } } @@ -1402,7 +1403,7 @@ namespace CalamityMod.World Chest chest = MiscWorldgenRoutines.AddChestWithLoot(x, y, (ushort)ModContent.TileType()); if (chest != null) { - chest.item[0].SetDefaults(ModContent.ItemType()); + chest.item[0].SetDefaults(ModContent.ItemType()); chest.item[0].Prefix(-1); break; } @@ -1578,7 +1579,7 @@ namespace CalamityMod.World int depth = BlockDepth; ushort columnID = (ushort)ModContent.TileType(); ushort hardenedSandstoneWallID = (ushort)ModContent.WallType(); - ushort sandWallID = (ushort)ModContent.WallType(); + ushort sandWallID = (ushort)ModContent.WallType(); short variantFrameOffset = (short)(WorldGen.genRand.Next(3) * 36); for (int x = left; x < left + 2; x++) diff --git a/World/SunkenSea.cs b/World/SunkenSea.cs index 03ea993426..fe847dcf80 100644 --- a/World/SunkenSea.cs +++ b/World/SunkenSea.cs @@ -1,10 +1,15 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Reflection.Metadata; using System.Threading.Tasks; +using Terraria.ObjectData; using CalamityMod.Tiles.SunkenSea; using CalamityMod.Tiles.SunkenSea.Ambient; +using CalamityMod.Utilities; using CalamityMod.Walls; +using CalamityMod.Walls.UnsafeWalls; +using Microsoft.VisualBasic; using Microsoft.Xna.Framework; using ReLogic.Threading; using ReLogic.Utilities; @@ -18,136 +23,137 @@ namespace CalamityMod.World { public class SunkenSea { - /* - Dylandoe checklist: - -Make ambient tiles naturally grow on sunken sea tiles/sands (only eutrophic sand is done) - -Add basalt slab block - -Add navystone brick wall - -Add the wall corals properly - -Make sunken sea walls produce water - */ - - /* - ena todo - - fix the fucking forest being shaved (done - HPU) - cut a half oval out of the top of forest in anticipation of structure placement - change the type of noise both reefs and forest use (reefs more jagged, forest more flat) (done - HPU) - cut a curve out of the top of shores (the desert part) (done - HPU) - extend basalt to hell - DONE - convert normal terrain blocks below basalt into basalt (maybe??? - HPU) - BLOTCHES EVERYWHERE - */ - public static void NormalForLoop(int fromInclusive, int toExclusive, int step, Action action) + internal static class SSOffsets { - for (int i = fromInclusive; i < toExclusive; i += step) - action.Invoke(i); + public static int TimelessShoresX = 0, TimelessShoresY = 0; + public static int RadiantReefsX = 0, RadiantReefsY = 55; + public static int PolypForestX = 0, PolypForestY = 30; + public static int GleamingBurrowsX = 0, GleamingBurrowsY = 75; + public static int ClamDenX = 0, ClamDenY = 75; + public static int BasaltGullyX = 0, BasaltGullyY = 15; + public static int GlobalX = 0, GlobalY = -20; + } + static bool IsAirOrDecor(int x, int y) + { + if (y <= 0 || y >= Main.maxTilesY - 1 || x <= 0 || x >= Main.maxTilesX - 1) + return true; // out-of-bounds above counts as clear + + Tile t = Main.tile[x, y]; + if (!t.HasTile) + return true; + + int type = t.TileType; + + // blockers (full blocks / slopes / platforms) + if (WorldGen.SolidOrSlopedTile(x, y)) return false; // solid/half/sloped + if (Main.tileSolidTop[type]) return false; // platforms & similar + + // ambient stuff + if (Main.tileFrameImportant[type] && !Main.tileSolid[type]) return true; // pots, cactus, decor + if (Main.tileCut[type]) return true; // grass/vines/etc. + if (TileID.Sets.BreakableWhenPlacing[type]) return true; // tiny plants, etc. + + return false; } - public static void ReLogicParallelFor(int fromInclusive, int toExclusive, int step, Action action) + static bool ColumnClearOrDecor(int x, int groundY, int tilesUp) { - FastParallel.For(fromInclusive, toExclusive, (start, end, _) => + for (int k = 1; k <= tilesUp; k++) + { + if (!IsAirOrDecor(x, groundY - k)) + return false; + } + return true; + } + /* + checklist: + -Make sunken sea walls produce water + cut a half oval out of the top of forest in anticipation of structure placement + */ + + public static void ParallelFor(int fromInclusive, int toExclusive, int step, Action action) + { + FasterParallel.For(fromInclusive, toExclusive, (start, end, _) => { for (int i = start; i < end; i += step) action.Invoke(i); }); } - public static void CSharpParallelFor(int fromInclusive, int toExclusive, int step, Action action) - { - var partitioner = Partitioner.Create(fromInclusive, toExclusive, step); - Parallel.ForEach(partitioner, (range, _) => - { - for (int i = range.Item1; i < range.Item2; i += step) - action.Invoke(i); - }); - } - - /// - /// The delegate that describes the method of a type of for loop. - /// - public delegate void ForLoopMethod(int fromInclusive, int toExclusive, int step, Action action); - - /// - /// The current type of for loop used to generate the Sunken Sea. - /// - public static ForLoopMethod ForLoop; - public static void PlaceTimelessShores(int startPosX, int startPosY) { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.TimelessShoresX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.TimelessShoresY; + int biomeSize = 250 + (Main.maxTilesX / 180); - // - // Places a trapezoid of circles to serve as the main area for the biome. - // - const float steepness = 25f; - static float trapezoidLateralSteep(float x) + int XLeft = GenVars.UndergroundDesertLocation.Left; + + int XRight = GenVars.UndergroundDesertLocation.Right; + + const int totalCuveDepth = 90; + // this converts basalt to runestone directy in line to the desert to make the shape look perfect to blend well with the rest of the desert + ParallelFor(XLeft, XRight, 20, (x) => { - if (x <= 1f / steepness) - return steepness * x; - else if (x > 1f / steepness && x < 1f - 1f / steepness) - return 1f; - else - return -steepness * x + steepness; - } - ForLoop.Invoke(startPosX - biomeSize - 5, startPosX + biomeSize + 20, 15, (X) => - { - float height = MathHelper.Lerp(startPosY + 35, startPosY - 15, trapezoidLateralSteep(Utils.GetLerpValue(startPosX - biomeSize - 20, startPosX + biomeSize + 20, X))); - for (int Y = startPosY + 25; Y >= height; Y -= 10) + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); + + for (int y = startY + 100; y >= startY - 175; y -= 15) { - ShapeData circle = new ShapeData(); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Rectangle(20, 20), Actions.Chain(new GenAction[] { - // new Modifiers.RadialDither(1, 30).Output(circle), - new Modifiers.Blotches().Output(circle), + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + } }); - // // Makes the bottom borders of the Timeless Shores curved downwards. // - const int totalCuveDepth = 90; - ForLoop.Invoke(startPosX - biomeSize - 10, startPosX - biomeSize + 200, 10, (x) => + ParallelFor(startX - biomeSize, startX - biomeSize + 200, 10, (x) => { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, x, true))); + for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] { // new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); } }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize + 10, 5, (x) => + ParallelFor(startX + biomeSize - 200, startX + biomeSize, 5, (x) => { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, x, true))); - for (int y = startPosY + 50; y <= startPosY + 70 + curveDepth; y += 5) + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, x, true))); + for (int y = startY + 50; y <= startY + 70 + curveDepth; y += 5) { ShapeData circle = new(); - WorldUtils.Gen(new Point(x, y), new Shapes.Slime(30), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(x, y), new Shapes.Slime(20), Actions.Chain(new GenAction[] { // new Modifiers.RadialDither(1, 30).Output(circle), new Modifiers.Blotches().Output(circle) })); WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(x, y), new ModShapes.All(circle), new Actions.PlaceWall((ushort)ModContent.WallType())); } }); - // Clear a smaller square out of the center where the biomes stuff will be - // Added curves to the top of the biome via curve depth -hpu 02/19/25 - ForLoop.Invoke(startPosX - biomeSize + 10, startPosX + biomeSize - 10, 1, (X) => + // Clears out a curved cavity inside the timeless shores, this creates the main large open space inside the biome + ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 20, startPosX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 17, startPosX - biomeSize + 200, X, true))); + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); int random = WorldGen.genRand.Next(-40, 10); - for (int Y = startPosY - 25 + curveDepth + curveDepth2; Y <= startPosY + 50; Y++) + for (int Y = startY - 25 + curveDepth + curveDepth2; Y <= startY + 50; Y++) { ShapeData circle = new ShapeData(); GenAction blotchMod = new Modifiers.Blotches(2, 0.4); @@ -166,27 +172,28 @@ namespace CalamityMod.World // // Places slopes at the sides of the shores to actually make shores. // - ForLoop.Invoke(startPosX - biomeSize - 15, startPosX - biomeSize + 200, 20, (moundX) => + ParallelFor(startX - biomeSize - 85, startX - biomeSize + 200, 20, (moundX) => { int RandomX = Main.rand.Next(15, 20); ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize + 27, startPosX - biomeSize + 200, moundX))); + int moundY = startY + 75; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize, startX - biomeSize + 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); - WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); - ForLoop.Invoke(startPosX + biomeSize - 200, startPosX + biomeSize - 15, 20, (moundX) => + ParallelFor(startX + biomeSize - 200, startX + biomeSize + 85, 20, (moundX) => { ShapeData mound = new(); GenAction blotchMod = new Modifiers.Blotches().Output(mound); - int moundY = startPosY + 75; - int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize - 27, startPosX + biomeSize - 200, moundX))); + int moundY = startY + 75; + int moundHeight = (int)MathHelper.Lerp(60f, 5f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize, startX + biomeSize - 200, moundX))); WorldUtils.Gen(new Point(moundX, moundY), new Shapes.Mound(30, moundHeight), blotchMod); WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.SetTile((ushort)ModContent.TileType())); + WorldUtils.Gen(new Point(moundX, moundY), new ModShapes.All(mound), new Actions.PlaceWall((ushort)ModContent.WallType())); }); @@ -196,62 +203,102 @@ namespace CalamityMod.World const int platformSize = 130; const int platformHeight = 35; // Remember that because of Terraria's coordinate system, making it lower actually makes it higher. const int platformDepth = 35; // How deep it goes. Like above, the higher it is, the lower it goes. - ForLoop.Invoke(startPosX - platformSize / 2, startPosX + platformSize / 2, 5, (platformX) => + ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 5, (platformX) => { // This makes the "stem" of the platform be thinner towards the base and then expand on the top. - int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; - for (int platformY = startPosY + platformHeight; platformY <= startPosY + thickness; platformY++) + int thickness = (int)(MathF.Pow(CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, platformX)), 3f) * platformDepth) + platformHeight; + for (int platformY = startY + platformHeight; platformY <= startY + thickness; platformY++) { WorldUtils.Gen(new Point(platformX, platformY), new Shapes.Circle(5), Actions.Chain(new GenAction[] { // Clear all tiles and place tiles. new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); } }); - ForLoop.Invoke(startPosX - platformSize / 2, startPosX + platformSize / 2, 1, (x) => + // + // Makes the platform have a curve on top + // + ParallelFor(startX - platformSize / 2, startX + platformSize / 2, 1, (x) => { - float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosX - platformSize / 2, startPosX + platformSize / 2, x, true)); + float interpolator = CalamityUtils.Convert01To010(Utils.GetLerpValue(startX - platformSize / 2, startX + platformSize / 2, x, true)); int elevation = (int)MathHelper.Lerp(4f, 1f, interpolator); - WorldUtils.Gen(new Point(x, startPosY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); + WorldUtils.Gen(new Point(x, startY + platformHeight - 7), new Shapes.Circle(elevation), Actions.Chain(new GenAction[] { new Actions.Clear(), })); }); // Plateau - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 100, (wallPillarX) => + ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPlateauX) => { - int randomDisplacement = WorldGen.genRand.Next(-27, 46); - int RandomX = Main.rand.Next(15, 20); - int RandomH = Main.rand.Next(20, 35); + int randomDisplacement = WorldGen.genRand.Next(-46, -27); + int RandomX = Main.rand.Next(7, 15); + int RandomH = Main.rand.Next(15, 25); - for (int wallPillarY = startPosY + RandomH; wallPillarY <= startPosY + 60; wallPillarY += 10) + for (int wallPlateauY = startY + RandomH; wallPlateauY <= startY + 60; wallPlateauY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - RandomH, startPosY + 45, wallPillarY)) * 25); + int PlateauWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPlateauY)) * 25); - ShapeData rectangle = new ShapeData(); + ShapeData Circle = new ShapeData(); GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); - GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 30, startPosY + 70, wallPillarY) + 0.25, 1)); - - WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Circle(RandomX - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] + if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) { - // Applies a blotch filter to the rectangle. - blotchFilter.Output(rectangle) - })); + WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 2, randomDisplacement + wallPlateauY), new Shapes.Circle(RandomH - PlateauWidth + 3, RandomX), Actions.Chain(new GenAction[] + { + blotchFilter.Output(Circle) + })); - WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] - { - new Actions.SetTile((ushort)ModContent.TileType()) - })) - ; + WorldUtils.Gen(new Point(randomDisplacement + wallPlateauX + PlateauWidth / 4, randomDisplacement + wallPlateauY), new ModShapes.All(Circle), Actions.Chain(new GenAction[] + { + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })) + ; + } } - }); + } + ); + + //Poop emote for gfb + //ParallelFor(startX - biomeSize, startX + biomeSize, 100, (wallPillarX) => + //{ + // int randomDisplacement = WorldGen.genRand.Next(-46, -27); + // int RandomX = Main.rand.Next(7, 15); + // int RandomH = Main.rand.Next(15, 25); + + // for (int wallPillarY = startY + RandomH; wallPillarY <= startY + 60; wallPillarY += 10) + // { + // // Along the height of the pillar, it becomes shorter the more closer to the center we get. + // int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - RandomH, startY + 45, wallPillarY)) * 25); + + // ShapeData rectangle = new ShapeData(); + // GenAction blotchFilter = new Modifiers.Blotches(1, 0.4); + // GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 30, startY + 70, wallPillarY) + 0.25, 1)); + // if (Main.tile[startX, startY].WallType == (ushort)ModContent.WallType()) + // { + // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 2, randomDisplacement + wallPillarY), new Shapes.Circle(RandomH - pillarWidth + 3, RandomX), Actions.Chain(new GenAction[] + // { + // // Applies a blotch filter to the rectangle. + // blotchFilter.Output(rectangle) + // })); + + // WorldUtils.Gen(new Point(randomDisplacement + wallPillarX + pillarWidth / 4, randomDisplacement + wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] + // { + // new Actions.SetTile((ushort)ModContent.TileType()) + // })) + // ; + // } + // } + + //} + //); //place water below the clear barrier for the islands so that theres water inbetween them - ForLoop.Invoke(startPosX - biomeSize + 35, startPosX + biomeSize - 35, 1, (WaterX) => + ParallelFor(startX - biomeSize + 35, startX + biomeSize - 35, 1, (WaterX) => { - for (int WaterY = startPosY + 37; WaterY <= startPosY + 60; WaterY++) + for (int WaterY = startY + 37; WaterY <= startY + 60; WaterY++) { Main.tile[WaterX, WaterY].Get().LiquidType = LiquidID.Water; Main.tile[WaterX, WaterY].LiquidAmount = byte.MaxValue; @@ -262,19 +309,19 @@ namespace CalamityMod.World // Generates pillars made out of walls at random points in the Timeless Shores. // const int furthestDistanceFromCenter = 100; - ForLoop.Invoke(startPosX - (biomeSize / 2) - furthestDistanceFromCenter, startPosX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => + ParallelFor(startX - (biomeSize / 2) - furthestDistanceFromCenter, startX + (biomeSize / 2) + furthestDistanceFromCenter, 100, (wallPillarX) => { - int randomDisplacementX = WorldGen.genRand.Next(-10, 10); + int randomDisplacementX = WorldGen.genRand.Next(-25, 25); int RandomX = Main.rand.Next(3, 6); - for (int wallPillarY = startPosY - 75; wallPillarY <= startPosY + 80; wallPillarY += 10) + for (int wallPillarY = startY - 75; wallPillarY <= startY + 80; wallPillarY += 10) { // Along the height of the pillar, it becomes shorter the more closer to the center we get. - int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startPosY - 75, startPosY + 50, wallPillarY)) * 25); + int pillarWidth = (int)(CalamityUtils.Convert01To010(Utils.GetLerpValue(startY - 75, startY + 50, wallPillarY)) * 25); ShapeData rectangle = new ShapeData(); GenAction blotchFilter = new Modifiers.Blotches(2, 0.4); - GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startPosY + 40, startPosY + 70, wallPillarY) + 0.25, 1)); + GenAction ditherFilter = new Modifiers.Dither(Math.Min(Utils.GetLerpValue(startY + 40, startY + 70, wallPillarY) + 0.25, 1)); WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new Shapes.Rectangle(25 - pillarWidth + 3, 15), Actions.Chain(new GenAction[] { @@ -284,72 +331,120 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(randomDisplacementX + wallPillarX + pillarWidth / 2, wallPillarY), new ModShapes.All(rectangle), Actions.Chain(new GenAction[] { - new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. + new Actions.PlaceWall((ushort)ModContent.WallType()) // The shape places walls. })) ; } }); + // places wall flowers in the curved cavity inside the timeless shores. This is done here to prevent them from appearing in the transiton area + ParallelFor(startX - biomeSize + 10, startX + biomeSize - 10, 1, (X) => + { + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 20, startX + biomeSize - 200, X, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 17, startX - biomeSize + 200, X, true))); + + for (int Y = startY - 60 + curveDepth + curveDepth2; Y <= startY + 30; Y++) + { + int Rand3() => WorldGen.genRand.Next(3); + int ShoresFlowerVariants = Rand3(); + + if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 3, 3)) + { + if (WorldGen.genRand.NextBool(60)) + { + WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); + } + } + + if (Main.tile[X, Y].WallType == ModContent.WallType() && WorldGen.EmptyTileCheck(X - 1, Y - 1, 2, 2)) + { + if (WorldGen.genRand.NextBool(60)) + WorldGen.PlaceObject(X - 1, Y - 1, ModContent.TileType(), mute: true, style: ShoresFlowerVariants); + } + } + }); + // // Makes the transition area to the Timeless Shores. // Replaces tiles, walls, and places some water spots. // - ForLoop.Invoke(startPosX - biomeSize - 30, startPosX + biomeSize + 30, 20, (x) => - { - int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 30, startPosX + biomeSize - 200, x, true))); - int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 30, startPosX - biomeSize + 200, x, true))); - - for (int y = startPosY - 5; y >= startPosY - 149; y -= 15) + ParallelFor(startX - biomeSize - 15, startX + biomeSize + 30, 20, (x) => { - float interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); + int curveDepth = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 30, startX + biomeSize - 200, x, true))); + int curveDepth2 = (int)MathHelper.Lerp(totalCuveDepth, 0f, MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 30, startX - biomeSize + 200, x, true))); - // This lerp does absolutely nothing. - Fabsol - float ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + for (int y = startY - 5; y >= startY - 149; y -= 15) + { + float interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); + + //WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + //{ + // new Modifiers.OnlyTiles(TileID.Sand), + // new Actions.ClearTile(), + // new Actions.PlaceTile((ushort)ModContent.TileType()), + // new Actions.PlaceWall((ushort)ModContent.WallType()) + //})); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { - new Modifiers.OnlyTiles(TileID.Sand, TileID.HardenedSand), - new Modifiers.Dither(ditherStrength + 0f), + new Modifiers.OnlyTiles(TileID.HardenedSand, TileID.Sand,TileID.Copper,TileID.Tin, TileID.Iron, TileID.Lead), new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); - // Changing these makes the walls dither higher up than tiles, to prevent the biome from changing earlier than expected. Still looks nice imo :) - interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 200, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.DesertFossil,TileID.Tungsten,TileID.Silver,TileID.Gold,TileID.Platinum,TileID.Demonite,TileID.Crimtane), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles(TileID.RollingCactus), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + interpolator = Utils.GetLerpValue(startY - 90, startY - 200, y, true); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyWalls(WallID.Sandstone, WallID.HardenedSand), - new Modifiers.Dither(ditherStrength), new Actions.ClearWall(), - new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), })); - // I forgot to change this one. :peepotired: - interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles(TileID.Sandstone), - new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()) })); - interpolator = Utils.GetLerpValue(startPosY - 90, startPosY - 150, y, true); - ditherStrength = MathHelper.Lerp(0f, 0f, interpolator); + interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] { new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Modifiers.Dither(ditherStrength), new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), })); + interpolator = Utils.GetLerpValue(startY - 90, startY - 150, y, true); + WorldUtils.Gen(new Point(x, y + curveDepth + curveDepth2), new Shapes.Circle(15), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyWalls((ushort)ModContent.WallType()), + new Actions.ClearWall(), + new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + if (Main.tile[x, y].Get().LiquidType == LiquidID.Lava) WorldUtils.Gen(new Point(x, y), new Shapes.Rectangle(5, 5), new Actions.SetLiquid(LiquidID.Lava, 0)); - if (WorldGen.genRand.NextBool(5) && y < startPosY - 100) + if (WorldGen.genRand.NextBool(5) && y < startY - 100) { WorldUtils.Gen(new Point(x, y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new GenAction[] { @@ -360,18 +455,20 @@ namespace CalamityMod.World } // Place layer of sand on valid runestone blocks. - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) { - for (int Y = startPosY - 100; Y <= startPosY + 100; Y++) + for (int Y = startY - 100; Y <= startY + 100; Y++) { - bool canPlaceSand = - Main.tile[X, Y].TileType == ModContent.TileType() && - !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && - !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && - !Main.tile[X, Y - 5].HasTile; - + bool canPlaceSand = Main.tile[X, Y].TileType == ModContent.TileType() && ColumnClearOrDecor(X, Y, 5); + if (canPlaceSand) + { + if (Main.tile[X, Y - 1].WallType == 0) + { + WorldGen.KillWall(X, Y); + } PlaceSand(X, Y, 5, ModContent.TileType()); + } // Clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -386,51 +483,34 @@ namespace CalamityMod.World if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) WorldGen.KillTile(X, Y); - // Timeless Shores ambiant tiles - //if (Main.tile[X, Y].TileType == ModContent.TileType()) - //{ - // //Driftwood Ambiance - // if (WorldGen.genRand.NextBool(150)) - // { - // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); - // } - //} - //if (Main.tile[X, Y].TileType == ModContent.TileType()) - //{ - // //Driftwood Ambiance - // if (WorldGen.genRand.NextBool(150)) - // { - // ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - // WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); - // } - //} } - - }); - - + } + // Slope tiles - ForLoop.Invoke(startPosX - biomeSize, startPosX + biomeSize, 1, (X) => + for (int X = startX - biomeSize; X < startX + biomeSize; X += 1) { - for (int Y = startPosY - 300; Y <= startPosY + 200; Y++) + for (int Y = startY - 300; Y <= startY + 200; Y++) + { Tile.SmoothSlope(X, Y); - }); + } + } }); } // Sides of the sunken sea (radiant reefs) public static void PlaceRadiantReefs(int startPosX, int startPosY) { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.RadiantReefsX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.RadiantReefsY; + int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startPosX, startPosY); + Point origin = new Point(startX, startY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - float angle = MathHelper.Pi * 0.20f; + float angle = MathHelper.Pi * 0.15f; float otherAngle = MathHelper.PiOver2 - angle; int biomeSize = 280 + (Main.maxTilesX / 180); @@ -438,12 +518,15 @@ namespace CalamityMod.World float constant = actualSize * 2f / (float)Math.Sin(angle); float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 20f); + int verticalRadius = (int)(constant / 50f); Vector2 fociOffset = Vector2.UnitY * fociSpacing; Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; + ushort Shellstone = (ushort)ModContent.TileType(); + ushort ShellstoneWall = (ushort)ModContent.WallType(); + // Generate the actual caverns bool runOnce = false; // This is used to make the wall on the left side go boom on the second run for (int X = origin.X - biomeSize - 170; X <= origin.X + biomeSize + 170; X++) @@ -452,6 +535,7 @@ namespace CalamityMod.World { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, Y < origin.Y)) { + Tile t = Main.tile[X, Y]; float percent = dist / constant; float blurPercent = 0.99f; if (percent > blurPercent) @@ -459,18 +543,20 @@ namespace CalamityMod.World // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself if (!runOnce) { - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, true, 0f, 0f, true, true); + t.WallType = ShellstoneWall; runOnce = true; } // Place smaller shellstone clumps infront of the basalt so the basalt isnt actually inside of the biome itself if (runOnce) - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), false, 0f, 0f, true, true); + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), Shellstone, false, 0f, 0f, true, true); + t.WallType = ShellstoneWall; } else { // Clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); + t.ClearEverything(); // Generate perlin noise caves float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 90f, Y / 90f, 3, unchecked(cavePerlinSeed + 1)) * 0.01f; @@ -481,9 +567,14 @@ namespace CalamityMod.World // Kill or place tiles depending on the noise map if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + { WorldGen.KillTile(X, Y); + } else - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + { + t.TileType = Shellstone; + t.HasTile = true; + } // Place walls in the biome using a different "seed" so it differs from the cave generation // This creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through @@ -494,19 +585,22 @@ namespace CalamityMod.World float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 3.5f + 0.280f; if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + { + t.WallType = ShellstoneWall; + } + if (caveNoiseMapWalls * caveNoiseMapWalls < (caveCreationThresholdWalls - (caveNoiseMapWalls * 0.2f))) WorldGen.KillTile(X, Y); - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; + t.Get().LiquidType = LiquidID.Water; + t.LiquidAmount = byte.MaxValue; } } } } // Cleanup - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -526,10 +620,10 @@ namespace CalamityMod.World WorldGen.KillTile(X, Y); } } - }); + } // Place layer of sand blocks on valid surfaces - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -546,10 +640,10 @@ namespace CalamityMod.World PlaceSand(X, Y, 5, ModContent.TileType()); } } - }); + } // Cleanup again - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -578,16 +672,23 @@ namespace CalamityMod.World Tile.SmoothSlope(X, Y); } } - }); + } } // Middle of the sunken sea (polyp forest) public static void PlacePolypForest(int startPosX, int startPosY) { + + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.PolypForestX; + + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.PolypForestY; + + int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startPosX, startPosY - 200); + Point origin = new Point(startX, startY - 200); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); float angle = MathHelper.Pi * 0.15f; @@ -604,11 +705,15 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; + ushort Limestone = (ushort)ModContent.TileType(); + ushort LimestoneWall = (ushort)ModContent.WallType(); + // Place the polyp forest caverns for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { for (int Y = (int)(origin.Y + verticalRadius * 0.4f) + 3; Y >= origin.Y - verticalRadius - 3; Y--) { + Tile t = Main.tile[X, Y]; // Modify this part so that the generation happens from bottom to top if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { @@ -621,14 +726,14 @@ namespace CalamityMod.World if (Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(4, 0.7); - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); + //ShapeData circle = new ShapeData(); + //GenAction blotchMod = new Modifiers.Blotches(4, 0.7); + //WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + //{ + // blotchMod.Output(circle) + //})); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + WorldUtils.Gen(new Point(X, Y), new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] { new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) })); @@ -653,7 +758,8 @@ namespace CalamityMod.World } else { - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); + t.TileType = Limestone; + t.HasTile = true; } //place walls in the biome using a different "seed" so it differs from the cave generation @@ -666,13 +772,13 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - //temporarily use navystone - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + t.WallType = LimestoneWall; } if ((caveNoiseMapWalls + 0.085f) * (caveNoiseMapWalls + 0.085f) > caveCreationThresholdWalls) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + if (t.WallType == 0) + t.WallType = (ushort)ModContent.WallType(); } Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; @@ -682,11 +788,11 @@ namespace CalamityMod.World } //cleanup - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { //clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -706,14 +812,14 @@ namespace CalamityMod.World } } } - }); + } //place extra tiles - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { bool canPlaceSand = false; @@ -731,16 +837,16 @@ namespace CalamityMod.World } } - }); - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + } + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 20; Y <= origin.Y + verticalRadius + 20; Y++) { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y > origin.Y)) + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, false, Y < origin.Y)) { bool canPlaceGrass = false; - //place sand clumps on top of exposed limestone + //place grass on top of exposed sand if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile && !Main.tile[X, Y - 4].HasTile && !Main.tile[X, Y - 5].HasTile) { @@ -752,12 +858,33 @@ namespace CalamityMod.World PlaceSand(X, Y, 0, ModContent.TileType()); } } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + if (WorldGen.genRand.NextBool(25) && !Main.tile[X - 1, Y].HasTile) + { + ushort[] Soil = new ushort[] { (ushort)ModContent.TileType() }; + + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(3, 7)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Soil)) + })); + + } + } } - }); + } //cleanup again - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -790,15 +917,17 @@ namespace CalamityMod.World Tile.SmoothSlope(X, Y); } } - }); + } } //bottom of the biome (gleaming burrows) - public static void PlaceGleamingBurrows(int startPosX, int startPosY) - { - int cavePerlinSeed = WorldGen.genRand.Next(); - int cavePerlinSeedWalls = WorldGen.genRand.Next(); + public static void PlaceGleamingBurrowsGeodes(int startPosX, int startPosY) - Point origin = new Point(startPosX, startPosY); + { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; + + Point origin = new Point(startX, startY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); float angle = MathHelper.Pi * 0.15f; @@ -815,168 +944,11 @@ namespace CalamityMod.World Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - //place another barrier so the gleaming burrows doesnt just burst into the gully - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 10, (X) => - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y += 2) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - float percent = dist / constant; - float blurPercent = 0.98f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 10) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(10, 0.4); - - WorldUtils.Gen(new Point(X, Y + 5), new Shapes.Rectangle(10, 10), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y + 5), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.Clear(), - new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - } - } - }); + ushort Navystone = (ushort)ModContent.TileType(); + ushort NavystoneWall = (ushort)ModContent.WallType(); - //place the gleaming burrows caverns - for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - float percent = dist / constant; - float blurPercent = 0.99f; - - if (percent > blurPercent) - { - if (Y > origin.Y - 50) - { - //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself - WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); - } - - //place clean transition between the burrows and the other biomes - if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) - { - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) - })); - } - } - else - { - //clear absolutely everything before generating the caverns - Main.tile[X, Y].ClearEverything(); - - //generate perlin noise caves - float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; - float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; - float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; - float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; - float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; - - //kill or place tiles depending on the noise map - if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) - { - WorldGen.KillTile(X, Y); - } - else - { - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); - } - - //place walls in the biome using a different "seed" so it differs from the cave generation - //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through - float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; - float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; - float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; - float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; - float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; - - if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) - { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); - } - - Main.tile[X, Y].Get().LiquidType = LiquidID.Water; - Main.tile[X, Y].LiquidAmount = byte.MaxValue; - } - } - } - } - - - //cleanup the perlin caves - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - //clean tiles that are sticking out (aka tiles only attached to one tile on one side) - bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; - bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; - - if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) - { - WorldGen.KillTile(X, Y); - } - - //kill random single floating tiles - if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) - { - WorldGen.KillTile(X, Y); - } - } - } - }); - - - //place extra tiles - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => - { - for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) - { - if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) - { - bool canPlaceSand = false; - - //place sand clumps on top of exposed navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) - { - canPlaceSand = true; - } - - if (canPlaceSand) - { - PlaceSand(X, Y, 4, ModContent.TileType()); - } - } - } - }); - //cleanup again, also place geodes for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { @@ -1019,47 +991,111 @@ namespace CalamityMod.World } } } - - //Very bottom of the biome (Clam Den) - public static void PlaceClamDen(int startPosX, int startPosY) + public static void PlaceGleamingBurrows(int startPosX, int startPosY) { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.GleamingBurrowsX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.GleamingBurrowsY; + int cavePerlinSeed = WorldGen.genRand.Next(); int cavePerlinSeedWalls = WorldGen.genRand.Next(); - Point origin = new Point(startPosX, startPosY); + Point origin = new Point(startX, startY); Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); - float angle = MathHelper.Pi * 0.70f; + float angle = MathHelper.Pi * 0.15f; float otherAngle = MathHelper.PiOver2 - angle; - int biomeSize = 80 + (Main.maxTilesX / 180); + int biomeSize = 220 + (Main.maxTilesX / 180); float actualSize = biomeSize * 16f; float constant = actualSize * 2f / (float)Math.Sin(angle); float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); - int verticalRadius = (int)(constant / 10f); + int verticalRadius = (int)(constant / 16f); Vector2 fociOffset = Vector2.UnitY * fociSpacing; Vector2 topFoci = center - fociOffset; Vector2 bottomFoci = center + fociOffset; - //place the Clam Den caverns - for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) + ushort Navystone = (ushort)ModContent.TileType(); + ushort NavystoneWall = (ushort)ModContent.WallType(); + + int XStart = origin.X - biomeSize - 3; + int XEnd = origin.X + biomeSize + 3; + + int YStart = (int)(origin.Y - verticalRadius * 0.4f) - 3; + int YEnd = origin.Y + verticalRadius + 3; + + int newTunnelXLeft = (startX - 300); + int newTunnelYLeft = (startY - 10); + + int newTunnelXRight = (startX + 300); + int newTunnelYRight = (startY - 10); + + + //place another barrier so the gleaming burrows doesnt just burst into the gully + + var basaltcircle = new Shapes.Circle(30); + GenAction paintBasalt = Actions.Chain( + new Actions.Clear(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.SetFrames(true) + ); + + for (int X = XStart; X < XEnd; X += 14) + { + for (int Y = YStart; Y <= YEnd; Y += 12) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) + && Y > origin.Y - 10) + { + WorldUtils.Gen(new Point(X - 5, Y + 5), basaltcircle, paintBasalt); + } + } + } + + var Obsidiancircle = new Shapes.Circle(13); + GenAction paintObsidian = Actions.Chain( + new Actions.Clear(), + new Actions.SetTile((ushort)ModContent.TileType()), + new Actions.PlaceWall((ushort)ModContent.WallType()), + new Actions.SetFrames(true) + ); + + for (int X = XStart; X < XEnd; X += 5) + { + for (int Y = YStart; Y <= YEnd; Y += 5) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float _, true) + && Y > origin.Y - 10) + { + WorldUtils.Gen(new Point(X - 2, Y + 7), Obsidiancircle, paintObsidian); + } + } + } + + + //place the gleaming burrows caverns + for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) { + Tile t = Main.tile[X, Y]; float percent = dist / constant; float blurPercent = 0.99f; if (percent > blurPercent) { - if (Y > origin.Y - 50) + if (Y > origin.Y - 15) { //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + t.WallType = (ushort)ModContent.WallType(); } + //place clean transition between the burrows and the other biomes if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) { @@ -1072,15 +1108,46 @@ namespace CalamityMod.World WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] { - new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()), new Actions.PlaceWall((ushort)ModContent.WallType()) })); } } else - { + { + + //clear absolutely everything before generating the caverns Main.tile[X, Y].ClearEverything(); + //generate perlin noise caves + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 3.5f + 0.235f; + + //kill or place tiles depending on the noise map + if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) + { + WorldGen.KillTile(X, Y); + } + else + { + t.TileType = Navystone; + t.HasTile = true; + } + + float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; + float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; + float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; + + if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) + { + t.WallType = (ushort)ModContent.WallType(); + } + //place walls in the biome using a different "seed" so it differs from the cave generation //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; @@ -1091,9 +1158,12 @@ namespace CalamityMod.World if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) { - WorldGen.PlaceWall(X, Y, ModContent.WallType()); + if (t.WallType == 0) + t.WallType = NavystoneWall; } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; Main.tile[X, Y].LiquidAmount = byte.MaxValue; } @@ -1101,9 +1171,12 @@ namespace CalamityMod.World } } + //Tunnels + MiscWorldgenRoutines.ClearTunnel(startX - 200, startY + 40, newTunnelXLeft, newTunnelYLeft, 3, (ushort)ModContent.WallType(), 2, false, false); + MiscWorldgenRoutines.ClearTunnel(startX + 200, startY + 40, newTunnelXRight, newTunnelYRight, 3, (ushort)ModContent.WallType(), 2, false, false); //cleanup the perlin caves - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -1127,11 +1200,145 @@ namespace CalamityMod.World } } } - }); + } + + //place extra tiles + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + bool canPlaceSand = false; + + //place sand clumps on top of exposed navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y - 2].HasTile && !Main.tile[X, Y - 3].HasTile) + { + canPlaceSand = true; + } + + if (canPlaceSand) + { + PlaceSand(X, Y, 4, ModContent.TileType()); + } + } + } + } + + + } + + //Very bottom of the biome (Clam Den) + public static void PlaceClamDen(int startPosX, int startPosY) + { + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.ClamDenX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.ClamDenY; + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); + + Point origin = new Point(startX, startY); + Vector2 center = origin.ToVector2() * 16f + new Vector2(8f); + + float angle = MathHelper.Pi * 0.70f; + float otherAngle = MathHelper.PiOver2 - angle; + + int biomeSize = 80 + (Main.maxTilesX / 180); + float actualSize = biomeSize * 16f; + float constant = actualSize * 2f / (float)Math.Sin(angle); + + float fociSpacing = actualSize * (float)Math.Sin(otherAngle) / (float)Math.Sin(angle); + int verticalRadius = (int)(constant / 10f); + + Vector2 fociOffset = Vector2.UnitY * fociSpacing; + Vector2 topFoci = center - fociOffset; + Vector2 bottomFoci = center + fociOffset; + + //place the Clam Den caverns + for (int X = origin.X - biomeSize - 190; X <= origin.X + biomeSize + 190; X++) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + Tile t = Main.tile[X, Y]; + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + float percent = dist / constant; + float blurPercent = 0.99f; + + if (percent > blurPercent) + { + if (Y > origin.Y - 50) + { + //place smaller navystone clumps infront of the basalt so the basalt isnt actually inside of the biome itself + WorldGen.TileRunner(X, Y, WorldGen.genRand.Next(8, 12), WorldGen.genRand.Next(8, 12), ModContent.TileType(), true, 0f, 0f, true, true); + t.WallType = (ushort)ModContent.WallType(); + } + //place clean transition between the burrows and the other biomes + if (Y < origin.Y && Main.tile[X, Y].HasTile && Main.tile[X, Y].TileType != ModContent.TileType()) + { + WorldUtils.Gen(new Point(X, Y), new Shapes.Slime(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile((ushort)ModContent.TileType()) + })); + } + } + else + { + //clear absolutely everything before generating the caverns + Main.tile[X, Y].ClearEverything(); + + //place walls in the biome using a different "seed" so it differs from the cave generation + //this creates a neat effect where walls worm their way through the caverns while leaving openings for the background to show through + float horizontalOffsetNoiseWalls = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWalls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWalls; + float cavePerlinValue2Walls = CalamityUtils.PerlinNoise2D(X / 375f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWalls = (cavePerlinValueWalls + cavePerlinValue2Walls) * 0.5f; + float caveCreationThresholdWalls = horizontalOffsetNoiseWalls * 5.5f + 0.235f; + + if (caveNoiseMapWalls * caveNoiseMapWalls > caveCreationThresholdWalls) + { + t.WallType = (ushort)ModContent.WallType(); + } + + Main.tile[X, Y].Get().LiquidType = LiquidID.Water; + Main.tile[X, Y].LiquidAmount = byte.MaxValue; + } + } + } + } + + + //cleanup the perlin caves + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) + { + for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) + { + if (CheckInBiomeArea(new Point(X, Y), topFoci, bottomFoci, constant, center, out float dist, true)) + { + //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + { + WorldGen.KillTile(X, Y); + } + + //kill random single floating tiles + if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.KillTile(X, Y); + } + } + } + } //place extra tiles - ForLoop.Invoke(origin.X - biomeSize - 3, origin.X + biomeSize + 3, 1, (X) => + for (int X = origin.X - biomeSize - 3; X < origin.X + biomeSize + 3; X += 1) { for (int Y = (int)(origin.Y - verticalRadius * 0.4f) - 3; Y <= origin.Y + verticalRadius + 3; Y++) { @@ -1151,7 +1358,7 @@ namespace CalamityMod.World } } } - }); + } //cleanup again for (int X = origin.X - biomeSize - 3; X <= origin.X + biomeSize + 3; X++) @@ -1190,65 +1397,177 @@ namespace CalamityMod.World } } - //basalt biome underneath the sunken sea + //public static void PlaceBasaltGullyBorderBlend(int startPosX, int startPosY) + //{ + // int startX = (startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX); + + // int startY = (startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY) - 90; + + // int biomeSize = 250 + (Main.maxTilesX / 180); + + // ushort Basalt = (ushort)ModContent.TileType(); + // ushort BasaltWall = (ushort)ModContent.WallType(); + + // //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance + // for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) + // { + // const int totalCurveDepth = -320; + // const int totalCurveDepthTop = 70; + + // var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); + // var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); + + + // int curveDepth = (int)MathHelper.Lerp( + // totalCurveDepth, + // 0f, squrt); + // int curveDepth2 = (int)MathHelper.Lerp( + // totalCurveDepth, 0f, squrt2); + // int curveDepthtop = (int)MathHelper.Lerp( + // totalCurveDepthTop, + // 0f, squrt); + // int curveDepth2top = (int)MathHelper.Lerp( + // totalCurveDepthTop, + // 0f, squrt2); + + // int Height = Main.maxTilesY - 270 + curveDepth + curveDepth2; + // int StartHeight = startY - (625) + curveDepthtop + curveDepth2top; + + // for (int Y = StartHeight; Y <= Height; Y++) + // { + // Tile t = Main.tile[X, Y]; + // if (Main.tile[X, Y].HasTile) + // { + // t.TileType = Basalt; + // t.HasTile = true; + // } + + // t.WallType = BasaltWall; + // } + // } + + // //cleanup + // for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) + // { + // for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) + // { + // //clean tiles that are sticking out (aka tiles only attached to one tile on one side) + // bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; + // bool OnlyLeft = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X + 1, Y].HasTile; + // bool OnlyDown = !Main.tile[X, Y - 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + // bool OnlyUp = !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile; + + // if (OnlyRight || OnlyLeft || OnlyDown || OnlyUp) + // { + // WorldGen.KillTile(X, Y); + // } + + // //kill random single floating tiles + // if (!Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile && !Main.tile[X + 1, Y].HasTile) + // { + // WorldGen.KillTile(X, Y); + // } + // Tile.SmoothSlope(X, Y); + // } + // } + //} public static void PlaceBasaltGully(int startPosX, int startPosY) { - int biomeSize = 250 + (Main.maxTilesX / 180); + int startX = startPosX + SSOffsets.GlobalX + SSOffsets.BasaltGullyX; + + int startY = startPosY + SSOffsets.GlobalY + SSOffsets.BasaltGullyY; + + int biomeSize = 270 + (Main.maxTilesX / 180); + + ushort Basalt = (ushort)ModContent.TileType(); + ushort BasaltWall = (ushort)ModContent.WallType(); + + int cavePerlinSeed = WorldGen.genRand.Next(); + int cavePerlinSeedWalls = WorldGen.genRand.Next(); - int XLeft = GenVars.UndergroundDesertLocation.Left + 40; - int XRight = GenVars.UndergroundDesertLocation.Right - 70; //place blocks of basalt all the way down to hell, here it just places one block and wall so it doesnt hurt preformance - ForLoop.Invoke(startPosX - biomeSize - 60, startPosX + biomeSize + 60, 1, (X) => + for (int X = startX - biomeSize - 80; X < startX + biomeSize + 80; X += 1) { - //const int totalCuveDepth = -120; - //const int totalCuveDepth2 = 120; - int basaltbordernoise = Main.rand.Next(180, 185); - int basaltbordernoisetop = Main.rand.Next(645, 650); - const int totalCuveDepth = -220; - const int totalCuveDepth2 = 90; - int curveDepth = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); - int curveDepth2 = (int)MathHelper.Lerp( - totalCuveDepth, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); - int curveDepthtop = (int)MathHelper.Lerp( - totalCuveDepth2, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX + biomeSize + 60, startPosX + biomeSize - 200, X, true))); - int curveDepth2top = (int)MathHelper.Lerp( - totalCuveDepth2, - 0f, - MathF.Sqrt(Utils.GetLerpValue(startPosX - biomeSize - 60, startPosX - biomeSize + 200, X, true))); + int leftEdge = startX - biomeSize - 60; + int rightEdge = startX + biomeSize + 60; + int basaltbordernoise = 270 + Main.rand.Next(0, 4); + int basaltbordernoisetop = 625 + Main.rand.Next(0, 4); + const int totalCurveDepth = -475; + const int totalCurveDepthTop = -100; - for (int Y = startPosY - 650 + curveDepthtop + curveDepth2top; Y <= Main.maxTilesY - 185 + curveDepth + curveDepth2; Y++) + var squrt = MathF.Sqrt(Utils.GetLerpValue(startX + biomeSize + 60, startX + biomeSize - 200, X, true)); + var squrt2 = MathF.Sqrt(Utils.GetLerpValue(startX - biomeSize - 60, startX - biomeSize + 200, X, true)); + + + int curveDepth = (int)MathHelper.Lerp( + totalCurveDepth, + 0f, squrt); + int curveDepth2 = (int)MathHelper.Lerp( + totalCurveDepth, 0f, squrt2); + int curveDepthtop = (int)MathHelper.Lerp( + totalCurveDepthTop, + 0f, squrt); + int curveDepth2top = (int)MathHelper.Lerp( + totalCurveDepthTop, + 0f, squrt2); + + int Height = Main.maxTilesY - basaltbordernoise + curveDepth + curveDepth2; + int StartHeight = startY - (basaltbordernoisetop) + curveDepthtop + curveDepth2top; + + for (int Y = StartHeight; Y <= Height; Y++) { - Main.tile[X, Y].ClearEverything(); - WorldGen.PlaceTile(X, Y, (ushort)ModContent.TileType()); - WorldGen.PlaceWall(X, Y, WallID.LavaUnsafe1); + int leftIndent = Main.rand.Next(0, 12); + int rightIndent = Main.rand.Next(0, 12); + if (X < leftEdge + leftIndent || X > rightEdge - rightIndent) + continue; + + Tile t = Main.tile[X, Y]; + t.ClearEverything(); + t.TileType = Basalt; + t.WallType = BasaltWall; + t.HasTile = true; } - }); + } //place caverns and lava - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + for (int X = startX - biomeSize - (Main.maxTilesX / 25); X <= startX + biomeSize + (Main.maxTilesX / 25); X++) { - for (int Y = startPosY; Y <= Main.maxTilesY - 190; Y++) + for (int Y = startY; Y <= Main.maxTilesY - 190; Y++) { if (Main.tile[X, Y].TileType == ModContent.TileType()) { + Tile t = Main.tile[X, Y]; //place caves - if (WorldGen.genRand.NextBool(350)) + float horizontalOffsetNoise = CalamityUtils.PerlinNoise2D(X / 80, Y / 130, 5, unchecked(cavePerlinSeed + 1)) * 0.01f; + float cavePerlinValue = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeed) + 0.5f + horizontalOffsetNoise; + float cavePerlinValue2 = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeed - 1)) + 0.5f; + float caveNoiseMap = (cavePerlinValue + cavePerlinValue2) * 0.5f; + float caveCreationThreshold = horizontalOffsetNoise * 5.5f + 0.235f; + + if (caveNoiseMap * caveNoiseMap > caveCreationThreshold) { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( - WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.ClearTile())); + t.HasTile = false; + t.LiquidType = 1; + } + + float horizontalOffsetNoiseWallsinner = CalamityUtils.PerlinNoise2D(X / 80, Y / 80, 5, unchecked(cavePerlinSeedWalls + 1)) * 0.01f; + float cavePerlinValueWallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, cavePerlinSeedWalls) + 0.5f + horizontalOffsetNoiseWallsinner; + float cavePerlinValue2Wallsinner = CalamityUtils.PerlinNoise2D(X / 975f, Y / 375f, 5, unchecked(cavePerlinSeedWalls - 1)) + 0.5f; + float caveNoiseMapWallsinner = (cavePerlinValueWallsinner + cavePerlinValue2Wallsinner) * 0.5f; + float caveCreationThresholdWallsinner = horizontalOffsetNoiseWallsinner * 5.5f + 0.435f; + + if (caveNoiseMapWallsinner * caveNoiseMapWallsinner > caveCreationThresholdWallsinner) + { + if (t.WallType == BasaltWall) + { + WorldGen.KillWall(X, Y); + } } //place lava if (WorldGen.genRand.NextBool(2000)) { - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 12)), Actions.Chain(new Modifiers.Blotches( + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(5, 7)), Actions.Chain(new Modifiers.Blotches( WorldGen.genRand.Next(3, 5), WorldGen.genRand.Next(3, 5)), new Actions.SetLiquid(LiquidID.Lava, 255))); } } @@ -1256,9 +1575,9 @@ namespace CalamityMod.World } //place sand blocks - ForLoop.Invoke(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), 1, (X) => + for (int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) { bool canPlaceSand = false; @@ -1273,12 +1592,12 @@ namespace CalamityMod.World PlaceSand(X, Y, 3, ModContent.TileType()); } } - }); + } //cleanup - ForLoop.Invoke(startPosX - biomeSize - (Main.maxTilesX / 25), startPosX + biomeSize + (Main.maxTilesX / 25), 1, (X) => + for(int X = startX - biomeSize - (Main.maxTilesX / 25); X < startX + biomeSize + (Main.maxTilesX / 25); X += 1) { - for (int Y = startPosY; Y <= Main.maxTilesY - 210; Y++) + for (int Y = startY; Y <= Main.maxTilesY - 210; Y++) { //clean tiles that are sticking out (aka tiles only attached to one tile on one side) bool OnlyRight = !Main.tile[X, Y - 1].HasTile && !Main.tile[X, Y + 1].HasTile && !Main.tile[X - 1, Y].HasTile; @@ -1303,25 +1622,15 @@ namespace CalamityMod.World WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); Main.tile[X, Y].TileType = (ushort)ModContent.TileType(); } - } - }); - } + Tile.SmoothSlope(X, Y); - //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it - public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) - { - int biomeSize = 230 + (Main.maxTilesX / 180); - - for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) - { - for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) - { - if (Main.tile[X, Y].WallType == WallID.LavaUnsafe1) + Tile t = Main.tile[X, Y]; + if (Main.tile[X, Y].WallType == BasaltWall) { //get rid of water if (Main.tile[X, Y].LiquidType == LiquidID.Water) { - Main.tile[X, Y].Get().LiquidType = LiquidID.Lava; + t.LiquidType = 1; } //get rid of obsidian blocks @@ -1333,69 +1642,144 @@ namespace CalamityMod.World } } } + + + //cleanup is done separately because for whatever reason it keeps placing water inside of the gully if the cleanup is done before it + //public static void BasaltGullyLavaCleanup(int startPosX, int startPosY) + //{ + // ushort BasaltWall = (ushort)ModContent.WallType(); + // int biomeSize = 230 + (Main.maxTilesX / 180); + + // for (int X = startPosX - biomeSize - (Main.maxTilesX / 25); X <= startPosX + biomeSize + (Main.maxTilesX / 25); X++) + // { + // for (int Y = startPosY + 50; Y <= Main.maxTilesY - 200; Y++) + // { + + // } + // } + //} //place all the ambient tiles in the sunken sea public static void PlaceSunkenSeaAmbience() { + bool shipPlaced = false; //first clean up unnecessary chunks of tiles CleanOutSmallClumps(); - //just loop through the whole world and check for the specific tiles in the sunken sea because im lazy - for (int X = 20; X <= Main.maxTilesX - 20; X++) + // Loop through the area around the Sunken Sea and check for the specific tiles + int minX = Math.Max(20, GenVars.UndergroundDesertLocation.Left - 20); + int maxX = Math.Min(GenVars.UndergroundDesertLocation.Right + 20, Main.maxTilesX - 20); + for (int X = minX; X <= maxX; X++) { - for (int Y = 20; Y <= Main.maxTilesY - 20; Y++) + for (int Y = (int)Main.worldSurface; Y <= Main.UnderworldLayer; Y++) { - //place coral blobs in the radiant reefs - if (WorldGen.genRand.NextBool(1000) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || - (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) + if (WorldGen.genRand.NextBool(200)) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] { - ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + if (WorldGen.genRand.NextBool(200)) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); - ShapeData circle = new ShapeData(); - GenAction blotchMod = new Modifiers.Blotches(2, 0.4); - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] - { - blotchMod.Output(circle) - })); - WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] - { - new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) - })); - } + //Timeless Shores ambiant tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand3() => WorldGen.genRand.Next(3); + int MediumShorePileVariants = Rand3(); + int Rand6() => WorldGen.genRand.Next(6); + int DriftwoodVariants = Rand6(); + int Rand9() => WorldGen.genRand.Next(9); + int ShorePileVariants = Rand9(); //Driftwood Ambiance if (WorldGen.genRand.NextBool(100)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(100)) + {; + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(100)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + //Shore piles + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: ShorePileVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: MediumShorePileVariants); } } + + + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + // stay in-bounds + if (Y > 0) + { + Tile above = Main.tile[X, Y - 1]; + + // only if it's open air (no solid tile), and we don't overwrite other special liquids other than lava (just incase) + if (!above.HasTile && + above.Get().LiquidType != LiquidID.Honey && + above.Get().LiquidType != LiquidID.Shimmer) + { + above.Get().LiquidType = LiquidID.Water; + above.LiquidAmount = byte.MaxValue; // 255 + } + } + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand6() => WorldGen.genRand.Next(6); + int DriftwoodVariants = Rand6(); //Driftwood Ambiance - if (WorldGen.genRand.NextBool(100)) + if (WorldGen.genRand.NextBool(80)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(60)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(60)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } } + + + //gleaming burrows ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand6() => WorldGen.genRand.Next(6); + int NavystonePileVariants = Rand6(); //brain coral - if (WorldGen.genRand.NextBool(10)) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } //small brain coral - if (WorldGen.genRand.NextBool(5)) + if (WorldGen.genRand.NextBool(30)) { WorldGen.PlaceObject(X, Y - 1, (ushort)ModContent.TileType()); } @@ -1425,69 +1809,118 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); } + //navystone piles + if (WorldGen.genRand.NextBool(5)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); + } + //small navystone piles if (WorldGen.genRand.NextBool(5)) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); } + + //Pearls + if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); + + if (WorldGen.genRand.NextBool(60) && !Main.tile[X - 1, Y].HasTile) + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(2), Actions.Chain(new GenAction[] + { + new Modifiers.OnlyTiles((ushort)ModContent.TileType()), + new Actions.ClearTile(), + new Actions.PlaceTile((ushort)ModContent.TileType()), + })); } if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand8() => WorldGen.genRand.Next(8); + int MediumSeaPrismCrystalVariants = Rand8(); //Medium Sea Prism down if (WorldGen.genRand.NextBool(9)) { ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 7); + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); } if (WorldGen.genRand.NextBool(9)) { ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 5); + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); } if (WorldGen.genRand.NextBool(9)) { ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 4); + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); } if (WorldGen.genRand.NextBool(9)) { ushort[] CrystalRandom = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, 2); + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(CrystalRandom), true, 0, 0, MediumSeaPrismCrystalVariants); } } + //grow depth vines on navystone + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int Rand3() => WorldGen.genRand.Next(3); + int TableCoralVariants = WorldGen.genRand.Next(3); + int SpeleothemsVariants = WorldGen.genRand.Next(3); + int Rand6() => WorldGen.genRand.Next(6); + int NavystonePileVariants = Rand6(); + + if (WorldGen.genRand.NextBool(30) && !Main.tile[X + 1, Y].HasTile) + { + WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); + } + + if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) + { + WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, TableCoralVariants); + } + + //Speleothems below //stalactites if (WorldGen.genRand.NextBool(10)) { - ushort[] Stalactites = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y + 2, WorldGen.genRand.Next(Stalactites)); + WorldGen.PlaceTile(X, Y + 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); } //small stalactites if (WorldGen.genRand.NextBool(8)) { - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); } - - //stalagmites if (WorldGen.genRand.NextBool(12)) { - ushort[] Stalagmites = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 2, WorldGen.genRand.Next(Stalagmites)); + WorldGen.PlaceTile(X, Y - 2, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); } //small stalagmites if (WorldGen.genRand.NextBool(10)) { - WorldGen.PlaceTile(X, Y - 1, (ushort)ModContent.TileType(), true, false, -1, 0); + WorldGen.PlaceTile(X, Y - 1, (ushort)ModContent.TileType(), true, false, -1, SpeleothemsVariants); } + // //giant navystone piles if (WorldGen.genRand.NextBool()) @@ -1497,115 +1930,73 @@ namespace CalamityMod.World WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(GiantPiles)); } - //small navystone piles + //navystone piles if (WorldGen.genRand.NextBool()) { - ushort[] Piles = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(Piles)); + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); } - if (WorldGen.genRand.NextBool(8)) - { - ushort[] NavystoneAmbients = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(NavystoneAmbients)); + //small navystone piles + if (WorldGen.genRand.NextBool(5)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: NavystonePileVariants); } } //Polyp Forest Ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { + int RandStyle() => WorldGen.genRand.Next(8); + int style = RandStyle(); //BranchCoralsOnLimestone if (WorldGen.genRand.NextBool(15)) { ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 7); + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); } if (WorldGen.genRand.NextBool(15)) { ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); - } - if (WorldGen.genRand.NextBool(15)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 6); + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, style); } } + //GilHerb Vines + if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) + { + WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); + } + if (Main.tile[X, Y].TileType == ModContent.TileType()) + { + CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); + } if (Main.tile[X, Y].TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType(),(ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); + int Rand8() => WorldGen.genRand.Next(8); + int BranchCoralVariants = Rand8(); + + int Rand4() => WorldGen.genRand.Next(4); + int WideScarletSeagrassVariants = Rand4(); + + int Rand6() => WorldGen.genRand.Next(6); + int DriftwoodVariants = Rand6(); + //BranchCoralsOnSand - if (WorldGen.genRand.NextBool(55)) + if (WorldGen.genRand.NextBool(25)) { ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); + WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); } - if (WorldGen.genRand.NextBool(55)) + if (WorldGen.genRand.NextBool(25)) { ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 1); + WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, BranchCoralVariants); } - if (WorldGen.genRand.NextBool(55)) + if (WorldGen.genRand.NextBool(25)) { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 5); - } - if (WorldGen.genRand.NextBool(55)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 4); - } - if (WorldGen.genRand.NextBool(55)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 3); - } - if (WorldGen.genRand.NextBool(55)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 2); - } - if (WorldGen.genRand.NextBool(55)) - { - ushort[] BranchCorals = new ushort[] { (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y + 1, WorldGen.genRand.Next(BranchCorals), true, 0, 0, 8); - } - if (WorldGen.genRand.NextBool(30)) - { - ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + ushort[] DigitateCorals = new ushort[] { (ushort)ModContent.TileType() }; WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DigitateCorals)); } - if (WorldGen.genRand.NextBool(15)) + if (WorldGen.genRand.NextBool(8)) { ushort[] FryCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; @@ -1614,10 +2005,7 @@ namespace CalamityMod.World } if (WorldGen.genRand.NextBool(8)) { - ushort[] WideScarletSeagrasss = new ushort[] { (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(WideScarletSeagrasss)); + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: WideScarletSeagrassVariants); } if (WorldGen.genRand.NextBool(8)) { @@ -1642,30 +2030,68 @@ namespace CalamityMod.World } //Driftwood Ambiance - if (WorldGen.genRand.NextBool(15)) + if (WorldGen.genRand.NextBool(30)) { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(),true, DriftwoodVariants); } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (!shipPlaced) + { + if (WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), mute: true)) + shipPlaced = true; + } + //small limestone piles + if (WorldGen.genRand.NextBool(25)) + { + WorldGen.PlaceTile(X, Y - 1, ModContent.TileType(), mute: true, style: DriftwoodVariants); + } + } //radiant reefs ambient tiles if (Main.tile[X, Y].TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(100) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(7), Actions.Chain(new GenAction[] + //Coral Blocks (to be removed when we have real gen for them + if (WorldGen.genRand.NextBool(400) && ((Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y - 1].HasTile) || + (Main.tile[X, Y].TileType == ModContent.TileType() && !Main.tile[X, Y + 1].HasTile))) { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - //Driftwood Ambiance - if (WorldGen.genRand.NextBool(15)) - { - ushort[] DriftwoodPiles = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + ushort[] Corals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; - WorldGen.PlaceObject(X, Y - 1, WorldGen.genRand.Next(DriftwoodPiles)); + ShapeData circle = new ShapeData(); + GenAction blotchMod = new Modifiers.Blotches(2, 0.4); + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(WorldGen.genRand.Next(1, 3)), Actions.Chain(new GenAction[] + { + blotchMod.Output(circle) + })); + + WorldUtils.Gen(new Point(X, Y), new ModShapes.All(circle), Actions.Chain(new GenAction[] + { + new Actions.ClearTile(), new Actions.PlaceTile(WorldGen.genRand.Next(Corals)) + })); + } + + int Rand6() => WorldGen.genRand.Next(6); + int DriftwoodVariants = Rand6(); + //Driftwood Ambiance + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); + } + if (WorldGen.genRand.NextBool(30)) + { + WorldGen.PlaceObject(X, Y - 1, ModContent.TileType(), true, DriftwoodVariants); } //multi-colored corals if (WorldGen.genRand.NextBool(3)) @@ -1719,59 +2145,59 @@ namespace CalamityMod.World CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); } - //grow depth vines on navystone - if (Main.tile[X, Y].TileType == ModContent.TileType() && Main.tile[X, Y].Slope == 0 && !Main.tile[X, Y + 1].HasTile && !Main.tile[X, Y + 2].HasTile) - { - // 18APR2025: Ozzatron: removed guaranteed RNG check here, since it was intended to be guaranteed - WorldGen.PlaceTile(X, Y + 1, (ushort)ModContent.TileType()); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - CalamityUtils.GrowVines(X, Y, WorldGen.genRand.Next(1, 4), (ushort)ModContent.TileType()); - } - - //wall corals if (Main.tile[X, Y].TileType == ModContent.TileType()) { - if (WorldGen.genRand.NextBool(5) && !Main.tile[X + 1, Y].HasTile) - { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + int Rand4() => WorldGen.genRand.Next(4); + int WallCoralVariants = Rand4(); - WorldGen.PlaceTile(X + 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); + if (WorldGen.genRand.NextBool(5) && + Main.tile[X, Y].HasTile && + Main.tile[X, Y + 1].HasTile && + Main.tile[X, Y + 2].HasTile && + + !Main.tile[X + 1, Y].HasTile && + !Main.tile[X + 1, Y + 1].HasTile && + !Main.tile[X + 1, Y + 2].HasTile && + + !Main.tile[X + 2, Y].HasTile && + !Main.tile[X + 2, Y + 1].HasTile && + !Main.tile[X + 2, Y + 2].HasTile && + + !Main.tile[X + 3, Y].HasTile && + !Main.tile[X + 3, Y + 1].HasTile && + !Main.tile[X + 3, Y + 2].HasTile && + + !Main.tile[X + 4, Y].HasTile && + !Main.tile[X + 4, Y + 1].HasTile && + !Main.tile[X + 4, Y + 2].HasTile) + { + WorldGen.PlaceTile(X + 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); } - if (WorldGen.genRand.NextBool(5) && !Main.tile[X - 1, Y].HasTile) - { - ushort[] WallCorals = new ushort[] { (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType() }; + if (WorldGen.genRand.NextBool(5) && + Main.tile[X, Y].HasTile && + Main.tile[X, Y + 1].HasTile && + Main.tile[X, Y + 2].HasTile && - WorldGen.PlaceTile(X - 2, Y, WorldGen.genRand.Next(WallCorals), true, false, -1, 0); + !Main.tile[X - 1, Y].HasTile && + !Main.tile[X - 1, Y + 1].HasTile && + !Main.tile[X - 1, Y + 2].HasTile && + + !Main.tile[X - 2, Y].HasTile && + !Main.tile[X - 2, Y + 1].HasTile && + !Main.tile[X - 2, Y + 2].HasTile && + + !Main.tile[X - 3, Y].HasTile && + !Main.tile[X - 3, Y + 1].HasTile && + !Main.tile[X - 3, Y + 2].HasTile && + + !Main.tile[X - 4, Y].HasTile && + !Main.tile[X - 4, Y + 1].HasTile && + !Main.tile[X - 4, Y + 2].HasTile) + { + WorldGen.PlaceTile(X - 2, Y, ModContent.TileType(), true, false, -1, WallCoralVariants); } } - // Pearl Autism - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(50) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - } - if (Main.tile[X, Y].TileType == ModContent.TileType()) - { - if (WorldGen.genRand.NextBool(30) && !Main.tile[X - 1, Y].HasTile) - WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(3), Actions.Chain(new GenAction[] - { - new Modifiers.OnlyTiles((ushort)ModContent.TileType()), - new Actions.ClearTile(), - new Actions.PlaceTile((ushort)ModContent.TileType()), - })); - } } } } @@ -1855,7 +2281,11 @@ namespace CalamityMod.World { new Actions.ClearTile(), new Actions.SetLiquid(), - new Actions.PlaceWall((ushort)ModContent.WallType()) + })); + + WorldUtils.Gen(new Point(X, Y), new Shapes.Circle(radius - 4), Actions.Chain(new GenAction[] + { + new Actions.PlaceWall((ushort)ModContent.WallType()) })); return true; @@ -1866,21 +2296,28 @@ namespace CalamityMod.World { List blockTileTypes = new() { + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), - (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), + (ushort)ModContent.TileType(), }; void getAttachedPoints(int x, int y, List points) @@ -1901,7 +2338,7 @@ namespace CalamityMod.World getAttachedPoints(x, y - 1, points); } - ForLoop.Invoke(20, Main.maxTilesX - 20, 1, (x) => + for (int x = 20; x < Main.maxTilesX - 20; x += 1) { for (int y = 20; y < Main.maxTilesY - 20; y++) { @@ -1916,12 +2353,12 @@ namespace CalamityMod.World WorldUtils.Gen(p, new Shapes.Rectangle(1, 1), Actions.Chain(new GenAction[] { new Actions.ClearTile(true), - new Actions.SetLiquid() + new Actions.ClearWall(true) })); } } } - }); + } } diff --git a/World/UndergroundShrines.cs b/World/UndergroundShrines.cs index 2cb56c1145..b5b3f95e9d 100644 --- a/World/UndergroundShrines.cs +++ b/World/UndergroundShrines.cs @@ -47,8 +47,7 @@ namespace CalamityMod.World } if (tile.TileType == TileType() || tile.TileType == TileType() || - tile.WallType == WallType() || - tile.WallType == WallType()) + tile.WallType == WallType()) { return true; } @@ -272,6 +271,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } @@ -341,6 +341,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } @@ -534,6 +535,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } @@ -670,6 +672,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } @@ -752,7 +755,7 @@ namespace CalamityMod.World new ChestItem(ItemType(), 1), new ChestItem(ItemID.PinkGel, WorldGen.genRand.Next(12, 15 + 1)), new ChestItem(ItemID.Torch, WorldGen.genRand.Next(50, 60 + 1)), - new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(4, 6 + 1)), + new ChestItem(ItemID.GoldCoin, WorldGen.genRand.Next(2, 4 + 1)), new ChestItem(Main.zenithWorld ? ItemID.RestorationPotion : ItemID.LesserHealingPotion, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(potionType, WorldGen.genRand.Next(10, 12 + 1)), new ChestItem(Main.zenithWorld ? ItemID.GasTrap : ItemID.Mushroom, Main.zenithWorld ? 1 : WorldGen.genRand.Next(5,9+1)), @@ -761,6 +764,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } diff --git a/World/VernalPass.cs b/World/VernalPass.cs index cea45e5153..4d3d7d3f94 100644 --- a/World/VernalPass.cs +++ b/World/VernalPass.cs @@ -86,6 +86,7 @@ namespace CalamityMod.World for (int i = 0; i < contents.Count; i++) { chest.item[i].SetDefaults(contents[i].Type); + chest.item[i].Prefix(-1); chest.item[i].stack = contents[i].Stack; } } diff --git a/World/WorldEvilIsland.cs b/World/WorldEvilIsland.cs index 689cb7af47..8adc8d8472 100644 --- a/World/WorldEvilIsland.cs +++ b/World/WorldEvilIsland.cs @@ -18,7 +18,7 @@ namespace CalamityMod.World int yIslandGen; Rectangle potentialArea; - if (WorldGen.getGoodWorldGen) + if (WorldGen.drunkWorldGen) { do { diff --git a/build.txt b/build.txt index b2de9aca5b..f89177c05d 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ -author = Fabsol and the Dev Team -version = 2.0.4.006 +author = The Calamity Dev Team +version = 2.1 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://discord.gg/calamity diff --git a/description.txt b/description.txt index 2d245627a8..cc8249777f 100644 --- a/description.txt +++ b/description.txt @@ -5,9 +5,9 @@ The mod also makes hundreds of adjustments to vanilla items, features and mechan Calamity adds significant progression to the game after defeating the Moon Lord, including many new tiers of equipment. A more detailed breakdown of the content available in Calamity: -- 27 bosses and 12 minibosses +- 27 bosses and 5 minibosses - 200+ enemies -- 5 town NPCs +- 4 town NPCs - 5 biomes and many new structures - 1 event - 1 new playable class (based on Throwing from Terraria 1.3) diff --git a/description_workshop.txt b/description_workshop.txt index 3cdb56ca5b..097c434b08 100644 --- a/description_workshop.txt +++ b/description_workshop.txt @@ -25,9 +25,9 @@ https://steamcommunity.com/sharedfiles/filedetails/?id=2816188633 A more detailed breakdown of the content available in Calamity: [olist] -[*] 27 bosses and 12 minibosses +[*] 27 bosses and 5 minibosses [*] 200+ enemies -[*] 5 town NPCs +[*] 4 town NPCs [*] 5 biomes and many new structures [*] 1 event [*] 1 new playable class (based on Throwing from Terraria 1.3) diff --git a/icon.png b/icon.png index 80069a3be1..8451ec4099 100644 Binary files a/icon.png and b/icon.png differ diff --git a/icon_workshop.png b/icon_workshop.png index 1edebb0978..677e0c27a3 100644 Binary files a/icon_workshop.png and b/icon_workshop.png differ