From a9b122b11b05f93cdc8a4097b3dc98e75f43ac22 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 6 Jan 2026 18:17:54 -0800 Subject: [PATCH] Finished and Polished Fixed many issues and made Demon Flames work again --- Buffs/DamageOverTime/DemonicFlames.cs | 7 +-- Buffs/DamageOverTime/Shred.cs | 6 ++- CalPlayer/CalamityPlayerHitHurt.cs | 52 +++++++++++++------ CalPlayer/CalamityPlayerMiscEffects.cs | 2 - Items/Accessories/Abaddon.cs | 2 +- Items/Accessories/VoidofExtinction.cs | 4 +- .../Mods.CalamityMod.Items.Accessories.hjson | 8 +-- NPCs/CalamityGlobalNPC.cs | 12 ++++- Systems/Collections/CalamityBuffSets.cs | 5 +- 9 files changed, 64 insertions(+), 34 deletions(-) diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 82b6e11979..607e4abaed 100644 --- a/Buffs/DamageOverTime/DemonicFlames.cs +++ b/Buffs/DamageOverTime/DemonicFlames.cs @@ -16,11 +16,11 @@ namespace CalamityMod.Buffs.DamageOverTime { 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 + NPCLifeRegenMethod = DemonicFlamesNPCLifeRegen }; - public static void DemonFlamesNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + public static void DemonicFlamesNPCLifeRegen(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); + int baseDemonicFlamesDoTValue = (int)Math.Max(Math.Max(npc.Calamity().ActiveHeatDebuffMultiplier.ApplyTo(npc.Calamity().demonicFlamesBonusDamage), npc.Calamity().demonicFlamesBonusDamage), (int)debuffData.EnemyLostRegen); npc.Calamity().ApplyDPSDebuff(baseDemonicFlamesDoTValue, baseDemonicFlamesDoTValue / 15, ref npc.lifeRegen, ref damage); } public override void SetStaticDefaults() @@ -29,6 +29,7 @@ namespace CalamityMod.Buffs.DamageOverTime 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) diff --git a/Buffs/DamageOverTime/Shred.cs b/Buffs/DamageOverTime/Shred.cs index bd168fd492..422fe65db8 100644 --- a/Buffs/DamageOverTime/Shred.cs +++ b/Buffs/DamageOverTime/Shred.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.NPCs; using CalamityMod.Particles; using CalamityMod.Projectiles; @@ -18,7 +19,10 @@ namespace CalamityMod.Buffs.DamageOverTime // This deals 600 DPS per stack, is boosted by ranged stats and can supercrit. internal static int BaseDamage = 120; internal static int FramesPerDamageTick = 12; - + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = BaseDamage + }; public override void SetStaticDefaults() { Main.debuff[Type] = true; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 3213c0103a..a4ad4ec957 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -762,25 +762,28 @@ namespace CalamityMod.CalPlayer public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { NPC npc = target; - if ((target.Calamity().abaddonEffected || target.Calamity().voidOfExtinctionEffected) && hit.Crit && abaddonCooldown == 0) + if ((npc.Calamity().abaddonEffected || npc.Calamity().voidOfExtinctionEffected) && hit.Crit && abaddonCooldown == 0) { - bool strong = target.Calamity().voidOfExtinctionEffected; - abaddonCooldown = 60; - float areaOfEffect = (strong ? 1000 : 500); + bool strong = npc.Calamity().voidOfExtinctionEffected; + float areaOfEffect = (strong ? 1200 : 600); if (Main.netMode != NetmodeID.MultiplayerClient) { Color color1 = Color.Crimson; Color color2 = Color.OrangeRed; + int debuffTime = (strong ? 180 : 90); int targetNum = 0; - int maxTargetNum = strong ? 12 : 8; + int maxTargetNum = strong ? 8 : 5; int startDir = Main.rand.NextBool() ? 1 : -1; for (int r = 0; r < Main.maxNPCs; r++) { NPC targeted = Main.npc[r]; - if (targeted != null && targeted.CanBeChasedBy() && Vector2.Distance(targeted.Center, npc.Center) <= areaOfEffect && targetNum < maxTargetNum) + if (targeted != null && targeted != npc && targeted.CanBeChasedBy() && Vector2.Distance(targeted.Center, npc.Center) <= areaOfEffect && targetNum < maxTargetNum) { - Vector2 start = npc.Center; + targeted.Calamity().voidOfExtinctionEffected = npc.Calamity().voidOfExtinctionEffected; + targeted.Calamity().abaddonEffected = npc.Calamity().abaddonEffected; + + Vector2 start = npc.Center + Main.rand.NextVector2Circular(npc.width / 2, npc.height / 2); Vector2 end = targeted.Center; Color color = Main.rand.NextBool() ? color2 : color1; @@ -808,10 +811,10 @@ namespace CalamityMod.CalPlayer if (dustDivisor < 2) dustDivisor = 2; - Vector2 dustLineStart = targeted.Center; - Vector2 dustLineEnd = npc.Center; + Vector2 dustLineStart = start; + Vector2 dustLineEnd = end; Vector2 currentDustPos = default; - Vector2 dustVel = npc.Center.DirectionTo(targeted.Center); + Vector2 dustVel = start.DirectionTo(end); int startingPoint = Main.rand.Next(0, 400 + 1); Vector2 lastDustPos = default; for (int i = 0; i < maxDusts; i++) @@ -844,9 +847,7 @@ namespace CalamityMod.CalPlayer u++; } - int debuffTime = (strong ? 180 : 90); npc.AddBuff(ModContent.BuffType(), debuffTime); - float bestDamage = 0; // Find all the debuffs on the enemy @@ -854,7 +855,11 @@ namespace CalamityMod.CalPlayer { int type = npc.buffType[index]; var debuffData = BuffDatasets.DebuffDataset[type]; - if (debuffData != null) + + // Calculate the brimstone flames damage to see if the debuffs can be transfered + int bFlamesDamage = Math.Max((int)(BrimstoneFlames.debuffData.EnemyLostRegen * bestDamage), (int)BrimstoneFlames.debuffData.EnemyLostRegen); + + if (CalamityBuffSets.IsDebuff[type]) { // Find the player who has the accessory for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) @@ -866,16 +871,29 @@ namespace CalamityMod.CalPlayer bestDamage = player.Calamity().abaddonFlameDamage; } } - // Calculate the brimstone flames damage to see if the debuffs can be transfered - int bFlamesDamage = Math.Max((int)(60 * bestDamage), 60); - if (debuffData.EnemyLostRegen <= bFlamesDamage) + + if (debuffData == null || debuffData.EnemyLostRegen <= bFlamesDamage) targeted.AddBuff(type, debuffTime); } + // Edge case fixes for Shred and Demonic Flames + if (npc.Calamity().somaShredStacks > 0 && Shred.BaseDamage <= bFlamesDamage) + targeted.AddBuff(ModContent.BuffType(), debuffTime); + int demonicFlames = ModContent.GetModBuff(ModContent.BuffType()).Type; + if (npc.HasBuff(demonicFlames)) + targeted.Calamity().demonicFlamesBonusDamage = npc.Calamity().demonicFlamesBonusDamage; } - targetNum++; } } + if (targetNum == 0) + { + npc.AddBuff(ModContent.BuffType(), debuffTime); + Color color = Main.rand.NextBool() ? color2 : color1; + Particle spark2 = new CustomSpark(npc.Center, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 18, 0.55f, color * (Player.Calamity().abaddonEffectVisual ? 1 : 0.3f), Vector2.One, true, true, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(spark2); + + } + abaddonCooldown = targetNum * 12; } } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 35f572c889..46fa49ed2b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2237,8 +2237,6 @@ namespace CalamityMod.CalPlayer raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; - if (AbaddonCooldown > 0) - AbaddonCooldown--; if (VoidCooldown > 0) VoidCooldown--; if (ursaSergeantCooldown > 0) diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index e8bd8878c7..5a92b845c2 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -36,7 +36,7 @@ namespace CalamityMod.Items.Accessories { Player player = Main.LocalPlayer; if (Main.LocalPlayer != null) - list.FindAndReplace("[DAMAGE]", ((int)(BrimstoneFlames.debuffData.EnemyLostRegen / 2 * player.Calamity().abaddonFlameDamage)).ToString() + " DPS"); + list.FindAndReplace("[DAMAGE]", ((int)(BrimstoneFlames.debuffData.EnemyLostRegen / 2 * player.Calamity().abaddonFlameDamage)).ToString()); } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/VoidofExtinction.cs index bd654b064d..82fe55b61d 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/VoidofExtinction.cs @@ -13,9 +13,9 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int CritBoost = 13; + public static int CritBoost = 8; public static float critScaling = 7; // How effective crit chance is at increasing debuff damage - public static float critDamageBoostPerDebuff = 0.03f; // 3% increased crit damage per debuff + public static float critDamageBoostPerDebuff = 0.02f; // 2% increased crit damage per debuff public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, Abaddon.BrimstoneFlamesReduction.ToPercent()); public override void SetDefaults() diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 3b99ef822c..134015fb78 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -4,9 +4,9 @@ Abaddon: { ''' {$CommonItemTooltip.PercentIncreasedCritChance} Critical strikes burn enemies with [cbuff:CalamityMod/BrimstoneFlames] that scales off of your crit chance - When crit, enemies spread all debuffs thay are afflicted with that are weaker than your [cbuff:CalamityMod/BrimstoneFlames] to nearby enemies + When crit, enemies spread all debuffs they are afflicted with that are weaker than your [cbuff:CalamityMod/BrimstoneFlames] to nearby enemies Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% - Current [cbuff:CalamityMod/BrimstoneFlames] damage: [DAMAGE] + Current [cbuff:CalamityMod/BrimstoneFlames] damage: [DAMAGE] DPS ''' } @@ -2064,10 +2064,10 @@ VoidofExtinction: { ''' {$CommonItemTooltip.PercentIncreasedCritChance} Critical strikes burn enemies with [cbuff:CalamityMod/BrimstoneFlames] that greatly scales off of your crit chance - When crit, enemies spread all debuffs thay are afflicted with that are weaker than your [cbuff:CalamityMod/BrimstoneFlames] to nearby enemies + When crit, enemies spread all debuffs they are afflicted with that are weaker than your [cbuff:CalamityMod/BrimstoneFlames] to nearby enemies Crits deal an additional 2% damage per debuff on the enemy Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% - Current [cbuff:CalamityMod/BrimstoneFlames] damage: [DAMAGE] + Current [cbuff:CalamityMod/BrimstoneFlames] damage: [DAMAGE] DPS ''' } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 8cf0e437db..850ccbb3ec 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -292,6 +292,7 @@ namespace CalamityMod.NPCs public bool brimstoneFlames = false; public bool demonicFlames = false; public int demonicFlamesBonusDamage = 0; + public int demonicFlamesClearTimer = 0; public bool holyFlames = false; public bool plague = false; public bool armorCrunch = false; @@ -570,6 +571,7 @@ namespace CalamityMod.NPCs myClone.brimstoneFlames = brimstoneFlames; myClone.demonicFlames = demonicFlames; myClone.demonicFlamesBonusDamage = demonicFlamesBonusDamage; + myClone.demonicFlamesClearTimer = demonicFlamesClearTimer; myClone.holyFlames = holyFlames; myClone.plague = plague; myClone.armorCrunch = armorCrunch; @@ -773,8 +775,6 @@ namespace CalamityMod.NPCs if (scionsCurioEffected) irradiatedContactBoost = 2f; brimstoneFlames = false; - if (!demonicFlames) - demonicFlamesBonusDamage = 0; demonicFlames = false; holyFlames = false; plague = false; @@ -3377,6 +3377,14 @@ namespace CalamityMod.NPCs if (!Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].head)) npc.ai[3] = 0f; } + + if (demonicFlames) + demonicFlamesClearTimer = 0; + else + demonicFlamesClearTimer++; + if (demonicFlamesClearTimer >= 2) + demonicFlamesBonusDamage = 0; + if (warbannerBurnTimer > 0) warbannerBurnTimer--; if (warbannerBurnTimer == 0 && warbannerBurnMarked) diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs index 4a1b8a821d..243ca41c5b 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -57,13 +57,14 @@ namespace CalamityMod.Systems.Collections 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(), + BuffID.OgreSpit, BuffID.BetsysCurse, BuffID.Wet, BuffID.Slimed, BuffID.OnFire3, BuffID.Frostburn2, 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()); + 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.