diff --git a/Buffs/DamageOverTime/Bane.cs b/Buffs/DamageOverTime/Bane.cs new file mode 100644 index 0000000000..a31e16ea46 --- /dev/null +++ b/Buffs/DamageOverTime/Bane.cs @@ -0,0 +1,118 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.DamageOverTime +{ + public class Bane : ModBuff + { + public static Color baneColor1 = new Color(217, 115, 0); + public static Color baneColor2 = new Color(0, 232, 146); + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 90, + NPCLifeRegenMethod = BaneNPCLifeRegen + }; + 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 static void BaneNPCLifeRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + bool effected = (cnpc.abaddonEffected || cnpc.apollyonEffected); + bool strong = cnpc.apollyonEffected; + int baseDoTValue = (int)debuffData.EnemyLostRegen; + if (effected) + { + foreach (var player in Main.ActivePlayers) + { + { + float improvedDamage = baseDoTValue * player.Calamity().playerBaneDebuffDamage; + if (improvedDamage > baseDoTValue && (player.Calamity().abaddon || player.Calamity().apollyon)) + { + baseDoTValue = (int)improvedDamage; + } + } + } + } + cnpc.ApplyDPSDebuff(baseDoTValue, baseDoTValue / 20, ref npc.lifeRegen, ref damage); + } + + public override void Update(Player player, ref int buffIndex) + { + player.Calamity().bane = true; + } + + public override void Update(NPC npc, ref int buffIndex) + { + npc.Calamity().bane = true; + } + + internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false) + { + Player player = drawInfo.drawPlayer; + Vector3 light = baneColor1.ToVector3(); + Lighting.AddLight(player.Center, light); + + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + if (Main.rand.NextBool(20)) + { + bool start = !Main.rand.NextBool(4); + Vector2 baneVel = Vector2.UnitY * Main.rand.NextFloat(-0.5f, -1.5f) * (Main.rand.NextBool(5) ? 2 : 1) + player.velocity * 0.35f; + Vector2 banePos = player.Center + Main.rand.NextVector2Circular(3, 8) + (Vector2.UnitY * 14) + Vector2.UnitY * ((1 - sine) * 2.3f); + Particle baneRunes = new BaneParticle(banePos, baneVel, false, 55, 1f, start ? baneColor1 : baneColor2, start ? baneColor2 : baneColor1, Vector2.One, true, Main.rand.NextBool(3) ? Main.rand.NextFloat(-0.2f, 0.2f) : 0, 0.95f, MathHelper.PiOver2 * Main.rand.Next(4 + 1), sineRate: Main.rand.NextFloat(0.2f, 1f), sineIntensity: Main.rand.Next(14, 19 + 1)); + GeneralParticleHandler.SpawnParticle(baneRunes); + if (Main.rand.NextBool()) + baneRunes.DrawLayer = Enums.GeneralDrawLayer.BeforeNPCs; + } + } + + internal static void DrawEffects(NPC npc, ref Color drawColor) + { + Texture2D bloom = ModContent.Request("CalamityMod/Particles/BloomRingAngled").Value; + Texture2D center = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Vector2 drawPosition = npc.Center - Main.screenPosition; + Color color = baneColor1; + Color color2 = baneColor2; + float maxSizeMult = 10f; + float widthMult = MathF.Pow(Utils.Remap(npc.width, 10, 500, 1f, maxSizeMult, false), 0.8f); + float sine = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 9.0f) / MathHelper.Pi); + float sine2 = (float)Math.Sin((Main.GlobalTimeWrappedHourly * 11.0f) / MathHelper.Pi); + float randSize = Main.rand.NextFloat(0.82f, 1.08f); + + float clockSine = (float)Math.Sin((float)Math.Pow(Utils.GetLerpValue(0, 110, ((int)(Main.GlobalTimeWrappedHourly * 60) % 120)), 5)); + + for (int i = 0; i < 2; i++) + { + float sizeMult = (i == 0 ? 1 : 0.8f); + float colorMult = (i == 0 ? 1 : 0.7f); + Main.EntitySpriteDraw(bloom, drawPosition + (Vector2.UnitY * npc.height / 2f) + Vector2.UnitY * ((1 - sine) * 2.3f * MathF.Pow(widthMult, 0.55f)), null, Color.Lerp(color2, Color.White, i * 0.7f) with { A = 0 } * colorMult, 0, bloom.Size() / 2, new Vector2((sine * 0.09f + 1.2f) * widthMult, 0.9f) * 0.18f * MathF.Pow(randSize, 0.3f) * npc.Calamity().baneVisual, SpriteEffects.None); + Main.EntitySpriteDraw(center, drawPosition + (Vector2.UnitY * npc.height / 2f) + Vector2.UnitY * ((1 - sine2) * 3.3f * MathF.Pow(widthMult, 0.55f)), null, Color.Lerp(color, Color.White, i * 0.7f) with { A = 0 } * colorMult, 0, center.Size() / 2, new Vector2((sine2 * 0.09f + 1.2f) * widthMult, 0.6f) * 0.18f * randSize * npc.Calamity().baneVisual, SpriteEffects.None); + } + + int chance = (int)(13 + 40 * (1 - npc.Calamity().baneVisual)); + if (Main.rand.NextBool(chance)) + { + bool start = !Main.rand.NextBool(4); + Vector2 baneVel = Vector2.UnitY * Main.rand.NextFloat(-0.5f, -1.5f) * widthMult * (Main.rand.NextBool(5) ? 2 : 1) + npc.velocity * 0.35f; + Vector2 banePos = npc.Center + Main.rand.NextVector2Circular(3 * widthMult, 8) + (Vector2.UnitY * npc.height / 3f) + Vector2.UnitY * ((1 - sine) * 2.3f); + Particle baneRunes = new BaneParticle(banePos, baneVel, false, 55, 1f * MathF.Pow(widthMult, 0.45f), start ? color : color2, start ? color2 : color, Vector2.One, true, Main.rand.NextBool(3) ? Main.rand.NextFloat(-0.2f, 0.2f) : 0, 0.95f, MathHelper.PiOver2 * Main.rand.Next(4 + 1), sineRate: Main.rand.NextFloat(0.2f, 1f), sineIntensity: Main.rand.Next(14, 19 + 1) * widthMult); + GeneralParticleHandler.SpawnParticle(baneRunes); + if (Main.rand.NextBool()) + baneRunes.DrawLayer = Enums.GeneralDrawLayer.BeforeNPCs; + } + Lighting.AddLight(npc.Center, color.ToVector3() * 0.6f); + } + } +} diff --git a/Buffs/DamageOverTime/Bane.png b/Buffs/DamageOverTime/Bane.png new file mode 100644 index 0000000000..f793baae8e Binary files /dev/null and b/Buffs/DamageOverTime/Bane.png differ diff --git a/Buffs/DamageOverTime/DemonicFlames.cs b/Buffs/DamageOverTime/DemonicFlames.cs index 7f6827f0bb..8e8fd369a5 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() @@ -30,7 +30,6 @@ namespace CalamityMod.Buffs.DamageOverTime 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 de47a1c423..6b893d8bc9 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; @@ -19,7 +20,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/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 01cbd67053..3b28f81093 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -964,6 +964,9 @@ namespace CalamityMod.CalPlayer public bool toxicHeart = false; public bool toxicHeartVisuals = false; public bool abaddon = false; + public int abaddonCooldown = 0; + public bool abaddonEffectVisual = false; + public float playerBaneDebuffDamage = 0; public bool aeroStone = false; public bool lifejelly = false; @@ -1036,7 +1039,7 @@ namespace CalamityMod.CalPlayer public bool IsFirstDashFrame = true; public int fallingBootVelCheckTimer = 0; public bool voidOfCalamity = false; - public bool voidOfExtinction = false; + public bool apollyon = false; public bool eArtifact = false; public bool dArtifact = false; public bool auricSArtifact = false; @@ -1273,7 +1276,6 @@ namespace CalamityMod.CalPlayer public int tailFrame = 0; public bool astralStarRain = false; public int astralStarRainCooldown = 0; - public int AbaddonCooldown = 0; public int VoidCooldown = 0; public int ursaSergeantCooldown = 0; public int AlchFlaskCooldown = 0; @@ -1367,6 +1369,7 @@ namespace CalamityMod.CalPlayer public bool armorCrunch = false; public bool crumble = false; public bool irradiated = false; + public bool bane = false; public bool brimstoneFlames = false; public bool weakBrimstoneFlames = false; public bool demonicFlames = false; @@ -2464,7 +2467,7 @@ namespace CalamityMod.CalPlayer crawCarapace = false; baroclaw = false; voidOfCalamity = false; - voidOfExtinction = false; + apollyon = false; eArtifact = false; dArtifact = false; auricSArtifact = false; @@ -2553,6 +2556,8 @@ namespace CalamityMod.CalPlayer spiritOrigin = false; spiritOriginVanity = false; critDamage = 0; + if (abaddonCooldown > 0) + abaddonCooldown--; astralStarRain = false; @@ -2660,6 +2665,7 @@ namespace CalamityMod.CalPlayer armorCrunch = false; crumble = false; irradiated = false; + bane = false; brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; @@ -3098,7 +3104,6 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; rOfDelivarenceRam = false; astralStarRainCooldown = 0; - AbaddonCooldown = 0; VoidCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; @@ -3147,6 +3152,7 @@ namespace CalamityMod.CalPlayer armorCrunch = false; crumble = false; irradiated = false; + bane = false; brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; @@ -5010,6 +5016,13 @@ namespace CalamityMod.CalPlayer else scionsCurioDebuffDamage = 0; + if (Player.Calamity().abaddon || Player.Calamity().apollyon) + { + Player.Calamity().playerBaneDebuffDamage = (1 + Player.GetTotalCritChance(Player.GetBestClass()) * 0.01f * (Player.Calamity().apollyon ? Apollyon.critScaling : Abaddon.critScaling)); + } + else + Player.Calamity().playerBaneDebuffDamage = 0; + // True melee damage from various vanilla equipment placed here. // Titan Glove and ALL upgrades. diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index e2e3352c4e..c00ca129b2 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -497,8 +497,7 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.brimstoneFlames && drawInfo.shadow == 0f) { - bool resistsBrimstoneFlames = abaddon; // Looks weaker if you have Abaddon equipped - BrimstoneFlames.DrawEffects(drawInfo, resistsBrimstoneFlames); + BrimstoneFlames.DrawEffects(drawInfo); } if (calamityPlayer.brainRot && drawInfo.shadow == 0f) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index ecc0d9c5b7..878c6651be 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -8,6 +8,7 @@ using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; using CalamityMod.Cooldowns; +using CalamityMod.DataStructures; using CalamityMod.Dusts; using CalamityMod.Enums; using CalamityMod.Events; @@ -27,7 +28,7 @@ using CalamityMod.Items.Armor.Tarragon; using CalamityMod.Items.Armor.Victide; using CalamityMod.Items.Armor.Wulfrum; using CalamityMod.Items.Potions; -using CalamityMod.Items.Potions.Alcohol; +using CalamityMod.Items.Tools; using CalamityMod.Items.VanillaArmorChanges; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Items.Weapons.Rogue; @@ -40,6 +41,7 @@ using CalamityMod.NPCs.Providence; using CalamityMod.NPCs.SupremeCalamitas; using CalamityMod.NPCs.VanillaNPCAIOverrides.Bosses; using CalamityMod.Particles; +using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Ranged; using CalamityMod.Projectiles.Rogue; using CalamityMod.Projectiles.Typeless; @@ -52,13 +54,11 @@ using Terraria; using Terraria.Audio; using Terraria.Chat; using Terraria.DataStructures; -using Terraria.Graphics.Shaders; using Terraria.GameContent.Creative; +using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; -using CalamityMod.Projectiles.Melee; -using CalamityMod.Items.Tools; namespace CalamityMod.CalPlayer { @@ -668,7 +668,45 @@ namespace CalamityMod.CalPlayer modifiers.FinalDamage *= BalancingConstants.SummonerCrossClassNerf; } } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + #region Abaddon and VoE effects + if (Player.Calamity().apollyon) + { + target.Calamity().apollyonEffected = true; + // Check here for the amount of debuffs on enemy + int numOfDebuffs = 0; + for (int index = 0; index < target.buffType.Length; index++) + { + int type = target.buffType[index]; + var debuffData = BuffDatasets.DebuffDataset[type]; + if (debuffData != null) + numOfDebuffs++; + } + modifiers.CritDamage += Apollyon.critDamageBoostPerDebuff * numOfDebuffs; + } + else if (Player.Calamity().abaddon) + target.Calamity().abaddonEffected = true; + else + { + target.Calamity().abaddonEffected = false; + target.Calamity().apollyonEffected = false; + } + #endregion + } #endregion + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + NPC npc = target; + int debuffSpreadProj = ModContent.ProjectileType(); + if ((Player.Calamity().abaddon || Player.Calamity().apollyon) && (npc.Calamity().abaddonEffected || npc.Calamity().apollyonEffected) && hit.Crit && abaddonCooldown == 0 && Player.ownedProjectileCounts[debuffSpreadProj] == 0) + { + int maxTargetNum = npc.Calamity().apollyonEffected ? 10 : 6; + Projectile.NewProjectile(Player.GetSource_FromThis(), npc.Center, Vector2.Zero, debuffSpreadProj, 0, 0, Player.whoAmI, 0, npc.whoAmI, maxTargetNum); + abaddonCooldown = -1; // Prevents multiple projectiles hitting on the same frame from spawning multiple of these + } + } #region Modify Hit By NPC public override void ModifyHitByNPC(NPC npc, ref Player.HurtModifiers modifiers) diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index d157d32e52..b181b14c72 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -115,13 +115,14 @@ namespace CalamityMod.CalPlayer ApplyDoTDebuff(crushDepth, 18, purity); ApplyDoTDebuff(astralInfection, 24, infectedJewel || hideOfDeus || purity); ApplyDoTDebuff(shadowflame, 30, purity); - ApplyDoTDebuff(brimstoneFlames, (int)MathF.Round(30 * (abaddon ? (1f - Abaddon.BrimstoneFlamesReduction) : 1f)), purity); + ApplyDoTDebuff(brimstoneFlames, 30, purity); ApplyDoTDebuff(plague, (int)MathF.Round(30 * (alchFlask ? (1f - AlchemicalDecanter.PlagueReduction) : 1f)), 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(bane, 40, purity); ApplyDoTDebuff(nightwither, 40, purity); ApplyDoTDebuff(holyFlames, 40, purity); ApplyDoTDebuff(voidfrost, 40, purity); diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index b0ab62b540..8bdb1af27c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2283,8 +2283,6 @@ namespace CalamityMod.CalPlayer raiderSoundCooldown--; if (astralStarRainCooldown > 0) astralStarRainCooldown--; - if (AbaddonCooldown > 0) - AbaddonCooldown--; if (VoidCooldown > 0) VoidCooldown--; if (ursaSergeantCooldown > 0) diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 430281f13b..478ec02a8b 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -733,20 +733,6 @@ namespace CalamityMod.CalPlayer } } - if (abaddon && crit && AbaddonCooldown <= 0 && !voidOfExtinction) - { - AbaddonCooldown = 15; - int AbaddonExploDamage = (int)Player.GetBestClassDamage().ApplyTo(Abaddon.AbaddonExploDamage); - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), AbaddonExploDamage, 0f, Player.whoAmI); - } - - if (voidOfExtinction && crit && VoidCooldown <= 0) - { - VoidCooldown = 15; - int VoidExploDamage = (int)Player.GetBestClassDamage().ApplyTo(VoidofExtinction.VoidExploDamage); - Projectile.NewProjectile(source, position, Vector2.Zero, ProjectileType(), VoidExploDamage, 0f, Player.whoAmI); - } - if (ursaSergeant && ursaSergeantCooldown <= 0) { ursaSergeantCooldown = UrsaSergeant.MaxCooldown; diff --git a/DataStructures/DebuffData.cs b/DataStructures/DebuffData.cs index d2f86de05d..ae5320365e 100644 --- a/DataStructures/DebuffData.cs +++ b/DataStructures/DebuffData.cs @@ -1,9 +1,9 @@ using System; +using CalamityMod.Buffs.DamageOverTime; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; using Terraria.ModLoader; -using Terraria.WorldBuilding; namespace CalamityMod.DataStructures { @@ -224,7 +224,8 @@ namespace CalamityMod.DataStructures .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveElectricDebuffMultiplier, ElectricDebuffScaling) )))) : - cnpc.ActiveTypelessDebuffMultiplier; + // Bane doesn't scale with debuff multipliers. This should be implemented as a default feature you can apply to debuffs at some point. + buffType == ModContent.BuffType() ? cnpc.ActiveTypelessDebuffMultiplier : StatModifier.Default; //Ensure at least 25% effectiveness if (totalScaling.Multiplicative <= 0.25f) @@ -257,7 +258,8 @@ namespace CalamityMod.DataStructures .CombineWith(ApplyScalingToStatModifer(cnpc.ActiveElectricDebuffMultiplier, ElectricDebuffScaling) )))) : - cnpc.ActiveTypelessDebuffMultiplier; + // Bane doesn't scale with debuff multipliers. This should be implemented as a default feature you can apply to debuffs at some point. + buffType == ModContent.BuffType() ? cnpc.ActiveTypelessDebuffMultiplier : StatModifier.Default; //Ensure at least 25% effectiveness if (totalScaling.Multiplicative <= 0.25f) diff --git a/Dusts/SquashDust.cs b/Dusts/SquashDust.cs index 8adfb2beaa..a0d5160f88 100644 --- a/Dusts/SquashDust.cs +++ b/Dusts/SquashDust.cs @@ -56,7 +56,11 @@ namespace CalamityMod.Dusts public override bool PreDraw(Dust dust) { - Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + Vector2 baseSize = Vector2.One; + if (dust.customData != null) + baseSize = (Vector2)dust.customData; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.Y, 2.5f * baseSize.Y)); // Glow Orb Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); @@ -82,7 +86,11 @@ namespace CalamityMod.Dusts private static void DrawPixelated(Dust dust) { - Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(dust.velocity.Length(), 2, 7, 1, 2.5f)); + Vector2 baseSize = Vector2.One; + if (dust.customData != null) + baseSize = (Vector2)dust.customData; + + Vector2 squash = new Vector2(Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.X, 0.5f * baseSize.X), Utils.Remap(dust.velocity.Length(), 2, 7, 1 * baseSize.Y, 2.5f * baseSize.Y)); // Glow Orb Main.spriteBatch.Draw(BloomCircle.Value, dust.position - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, BloomCircle.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0); diff --git a/Items/Accessories/Abaddon.cs b/Items/Accessories/Abaddon.cs index 6f3dfd0ba5..75eaac9461 100644 --- a/Items/Accessories/Abaddon.cs +++ b/Items/Accessories/Abaddon.cs @@ -1,4 +1,6 @@ -using Terraria; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using Terraria; using Terraria.ID; using Terraria.Localization; using Terraria.ModLoader; @@ -10,11 +12,8 @@ namespace CalamityMod.Items.Accessories { public new string LocalizationCategory => "Items.Accessories"; - public static int CritBoost = 8; public static float BrimstoneFlamesReduction = 0.5f; - public static int AbaddonExploDamage = 25; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, BrimstoneFlamesReduction.ToPercent()); - + public static float critScaling = 3.5f; // How effective crit chance is at increasing debuff damage public override void SetDefaults() { Item.width = 26; @@ -27,7 +26,13 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { player.Calamity().abaddon = true; - player.GetCritChance() += CritBoost; + player.Calamity().abaddonEffectVisual = !hideVisual; + } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + if (Main.LocalPlayer != null) + list.FindAndReplace("[DAMAGE]", ((int)(Bane.debuffData.EnemyLostRegen / 2 * player.Calamity().playerBaneDebuffDamage)).ToString()); } } } diff --git a/Items/Accessories/VoidofExtinction.cs b/Items/Accessories/Apollyon.cs similarity index 53% rename from Items/Accessories/VoidofExtinction.cs rename to Items/Accessories/Apollyon.cs index 7be242b9da..1003190c09 100644 --- a/Items/Accessories/VoidofExtinction.cs +++ b/Items/Accessories/Apollyon.cs @@ -1,20 +1,20 @@ -using CalamityMod.CalPlayer; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.CalPlayer; using CalamityMod.Items.Materials; using Terraria; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Accessories { - public class VoidofExtinction : ModItem, ILocalizedModType + [LegacyName("VoidofExtinction")] + public class Apollyon : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public static int CritBoost = 13; - public static int VoidExploDamage = 40; - public override LocalizedText Tooltip => base.Tooltip.WithFormatArgs(CritBoost, Abaddon.BrimstoneFlamesReduction.ToPercent()); - + public static float critScaling = 7.5f; // How effective crit chance is at increasing debuff damage + public static float critDamageBoostPerDebuff = 0.03f; // 3% increased crit damage per debuff public override void SetDefaults() { Item.width = 26; @@ -37,10 +37,14 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { CalamityPlayer modPlayer = player.Calamity(); - modPlayer.voidOfExtinction = true; - modPlayer.abaddon = true; - player.GetCritChance() += CritBoost; - + modPlayer.apollyon = true; + modPlayer.abaddonEffectVisual = !hideVisual; + } + public override void ModifyTooltips(List list) + { + Player player = Main.LocalPlayer; + if (Main.LocalPlayer != null) + list.FindAndReplace("[DAMAGE]", ((int)(Bane.debuffData.EnemyLostRegen / 2 * player.Calamity().playerBaneDebuffDamage)).ToString()); } } } diff --git a/Items/Accessories/VoidofExtinction.png b/Items/Accessories/Apollyon.png similarity index 100% rename from Items/Accessories/VoidofExtinction.png rename to Items/Accessories/Apollyon.png diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 6d62a7b397..6a544156d4 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1007,6 +1007,16 @@ ArmorCrunch: { ItemTooltip: Damage Reduction is 15% less effective } +Bane: { + DisplayName: Bane + Description: An ancient curse envelops you + ItemTooltip: + ''' + Typeless - Variable DPS + Does not scale with debuff multipliers + ''' +} + Crumbling: { DisplayName: Crumbling Description: Your armor is damaged diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index c4835c0d22..9e57c91d83 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -2,9 +2,9 @@ Abaddon: { DisplayName: Abaddon Tooltip: ''' - {$CommonItemTooltip.PercentIncreasedCritChance} - Critical strikes explode, igniting nearby foes with [cbuff:CalamityMod/BrimstoneFlames] - Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% + Critical strikes curse enemies with [cbuff:CalamityMod/Bane] that scales off of your critical strike chance + When critically hit, enemies spread all debuffs they are afflicted with that are weaker than your [cbuff:CalamityMod/Bane] to nearby enemies + Current [cbuff:CalamityMod/Bane] damage: [DAMAGE] DPS ''' } @@ -152,6 +152,17 @@ AngelTreads: { ''' } +Apollyon: { + DisplayName: Apollyon + Tooltip: + ''' + Critical strikes curse enemies with [cbuff:CalamityMod/Bane] that greatly scales off of your critical strike chance + When critically hit, enemies spread all debuffs they are afflicted with that are weaker than your [cbuff:CalamityMod/Bane] to nearby enemies + Critical strikes deal an additional 3% damage per debuff on the enemy + Current [cbuff:CalamityMod/Bane] damage: [DAMAGE] DPS + ''' +} + AquaticEmblem: { DisplayName: Aquatic Emblem Tooltip: @@ -2058,16 +2069,6 @@ VoidofCalamity: { ''' } -VoidofExtinction: { - DisplayName: Void of Extinction - Tooltip: - ''' - {$CommonItemTooltip.PercentIncreasedCritChance} - Critical strikes explode, igniting nearby foes with [cbuff:CalamityMod/BrimstoneFlames] - Reduces damage taken from [cbuff:CalamityMod/BrimstoneFlames] by {1}% - ''' -} - VoltaicJelly: { DisplayName: Voltaic Jelly Tooltip: diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson index 4521bdd13e..fd7feb6519 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Typeless.hjson @@ -1,4 +1,3 @@ -AbaddonCrit.DisplayName: Brimstone Blast AeroExplosive.DisplayName: Aeroboom AllianceTriangle.DisplayName: Alliance Triangle AmuletEnergy.DisplayName: Sea Spirit @@ -169,7 +168,7 @@ WulfrumDiggingTurtleProjectile.DisplayName: Digging Turtle WulfrumHook.DisplayName: Wulfrum Slingshot WulfrumLureSignal.DisplayName: Signal YellowLabSeeker.DisplayName: Seeking Mechanism -VoidofExtinctionCrit.DisplayName: Void of Extinction Crit XykDeathAnim.DisplayName: Xyk Death Animation XykWings.DisplayName: Xyk Wings StratusBlackHole.DisplayName: Stratus Singularity +DebuffSpreadEffect.DisplayName: Debuff Spread Effect diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 21fc54d93b..729cf87c18 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -290,9 +290,12 @@ namespace CalamityMod.NPCs public bool absorberAffliction = false; public bool irradiated = false; public double irradiatedContactBoost = 1.5; + public bool bane = false; + public float baneVisual = 0; 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; @@ -300,6 +303,8 @@ namespace CalamityMod.NPCs public int antlionCloudDebuffTimer = 0; public bool scionsCurioEffected = false; + public bool abaddonEffected = false; + public bool apollyonEffected = 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 @@ -566,9 +571,12 @@ namespace CalamityMod.NPCs myClone.absorberAffliction = absorberAffliction; myClone.irradiated = irradiated; myClone.irradiatedContactBoost = irradiatedContactBoost; + myClone.bane = bane; + myClone.baneVisual = baneVisual; myClone.brimstoneFlames = brimstoneFlames; myClone.demonicFlames = demonicFlames; myClone.demonicFlamesBonusDamage = demonicFlamesBonusDamage; + myClone.demonicFlamesClearTimer = demonicFlamesClearTimer; myClone.holyFlames = holyFlames; myClone.plague = plague; myClone.armorCrunch = armorCrunch; @@ -576,6 +584,8 @@ namespace CalamityMod.NPCs myClone.antlionCloudDebuffTimer = antlionCloudDebuffTimer; myClone.scionsCurioEffected = scionsCurioEffected; + myClone.abaddonEffected = abaddonEffected; + myClone.apollyonEffected = apollyonEffected; myClone.warbannerBurnTime = warbannerBurnTime; myClone.warbannerBurnTimer = warbannerBurnTimer; myClone.warbannerBurnStacks = warbannerBurnStacks; @@ -769,9 +779,8 @@ namespace CalamityMod.NPCs irradiated = false; if (scionsCurioEffected) irradiatedContactBoost = 2f; + bane = false; brimstoneFlames = false; - if (!demonicFlames) - demonicFlamesBonusDamage = 0; demonicFlames = false; holyFlames = false; plague = false; @@ -3127,6 +3136,12 @@ 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--; @@ -3202,6 +3217,11 @@ namespace CalamityMod.NPCs } warbannerBurnTime--; } + float fadeSpeed = 0.15f; + if (bane) + baneVisual = MathHelper.Lerp(baneVisual, 1, fadeSpeed); + else if (baneVisual > 0) + baneVisual = MathHelper.Lerp(baneVisual, 0, fadeSpeed); if (veriumDoomTimer > 0) veriumDoomTimer--; @@ -4657,6 +4677,9 @@ namespace CalamityMod.NPCs if (astralInfection) AstralInfectionDebuff.DrawEffects(npc, ref drawColor); + if (bane || baneVisual > 0.05f) + Bane.DrawEffects(npc, ref drawColor); + // Brimstone Flames and Demonshade Enrage set bonus share the same visual effects // TODO -- change this when Demonshade is reworked if (brimstoneFlames || npc.HasBuff()) @@ -4924,6 +4947,7 @@ namespace CalamityMod.NPCs // All Calamity DoTs in alphabetical order ("CalamityMod/Buffs/DamageOverTime/AstralInfectionDebuff", NPC => NPC.Calamity().astralInfection), ("CalamityMod/Buffs/DamageOverTime/AuricRebuke", NPC => NPC.Calamity().auricRebuke), + ("CalamityMod/Buffs/DamageOverTime/Bane", NPC => NPC.Calamity().bane), ("CalamityMod/Buffs/DamageOverTime/BanishingFire", NPC => NPC.Calamity().banishingFire), ("CalamityMod/Buffs/DamageOverTime/BrainRot", NPC => NPC.Calamity().brainRot), ("CalamityMod/Buffs/DamageOverTime/BrimstoneFlames", NPC => NPC.Calamity().brimstoneFlames), diff --git a/Particles/BaneParticle.cs b/Particles/BaneParticle.cs new file mode 100644 index 0000000000..f688eef51e --- /dev/null +++ b/Particles/BaneParticle.cs @@ -0,0 +1,132 @@ +using System; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Particles +{ + public class BaneParticle : Particle + { + public override string Texture => "CalamityMod/Particles/BaneParticle"; + public Color InitialColor; + public Color EndColor; + public Color glowColor = Color.White; + public bool AffectedByGravity; + public bool FadeIn = false; + public float FadeInScale = 0f; + public float SineRate = 0; + public float SineIntensity = 0; + public float Sine = 0; + public int sineTime = 0; + + public string NewTexture; + public float ActiveRotation; + public float AddedRotation = 0; + public float SpeedReduction = 0.95f; + public float ExtraRotation = 0; + + public Vector2 Stretch = Vector2.One; + public float ShrinkSpeed = 0; + public bool AltVisual = false; + public override bool UseAdditiveBlend => AltVisual; + public override bool SetLifetime => true; + public override bool UseCustomDraw => true; + + public override int FrameVariants => 5; + + public BaneParticle(Vector2 relativePosition, Vector2 velocity, bool affectedByGravity, int lifetime, float scale, Color color, Color colorEnd, Vector2 stretch, bool useAddativeBlend = false, float activeRotation = 0, float speedReduction = 0.95f, float extraRotation = 0, float sineRate = 1, float sineIntensity = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0) + { + Position = relativePosition; + Velocity = velocity; + ActiveRotation = activeRotation; + AffectedByGravity = affectedByGravity; + AffectedByLight = affectedByLight; + Scale = scale; + Stretch = stretch; + FadeInScale = scale; + Lifetime = lifetime; + Color = InitialColor = color; + EndColor = colorEnd; + ShrinkSpeed = shrinkSpeed; + SpeedReduction = speedReduction; + ExtraRotation = extraRotation; + SineRate = sineRate; + SineIntensity = sineIntensity; + sineTime = Main.rand.Next(0, 400 + 1); + + + AltVisual = useAddativeBlend; + + FadeIn = fadeIn; + + if (FadeIn) + Scale = 0f; + + Variant = Main.rand.Next(FrameVariants); + } + + public override void Update() + { + if (!FadeIn) + { + Scale *= 0.95f; + Color = Color.Lerp(InitialColor, EndColor, LifetimeCompletion); + } + else + { + if ((float)Time / (float)Lifetime < 0.5f) + { + Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f); + } + else + { + Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f); + } + } + Velocity *= SpeedReduction; + if (Velocity.Length() < 12f && AffectedByGravity) + { + Velocity.X *= 0.94f; + Velocity.Y += 0.25f; + } + + float velRot = ActiveRotation == 0 ? (Velocity.ToRotation() + MathHelper.PiOver2) : ActiveRotation; + Rotation = velRot + AddedRotation; + AddedRotation += ActiveRotation; + ActiveRotation *= 0.975f; + + Stretch.X *= (1 - 0.2f * ShrinkSpeed); + Stretch.Y *= (1 + 0.2f * ShrinkSpeed); + + Sine = (float)Math.Sin((sineTime * SineRate) / MathHelper.Pi) * SineIntensity; + sineTime++; + } + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D texture = ModContent.Request("CalamityMod/Particles/BaneParticleGlow").Value; + int frameWidth = 18; + int frameHeight = 18; + int frameSpacing = frameHeight + 2; + Rectangle frame = new Rectangle(0, frameSpacing * Variant, frameWidth, frameHeight); + + Texture2D texture2 = ModContent.Request("CalamityMod/Particles/BaneParticle").Value; + int frameWidth2 = 14; + int frameHeight2 = 10; + int frameSpacing2 = frameHeight2 + 2; + Rectangle frame2 = new Rectangle(0, frameSpacing2 * Variant, frameWidth2, frameHeight2); + + Vector2 scale = Stretch * Scale; + + Color col = Color; + + if (AffectedByLight) + { + col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color); + } + float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, 3D)); + spriteBatch.Draw(texture, Position - Main.screenPosition + Vector2.UnitX * Sine, frame, col * fadeOut, Rotation + ExtraRotation, frame.Size() * 0.5f, scale, 0, 0f); + spriteBatch.Draw(texture2, Position - Main.screenPosition + Vector2.UnitX * Sine, frame2, Color.Lerp(glowColor, col, 0.2f) * 0.75f * fadeOut, Rotation + ExtraRotation, frame2.Size() * 0.5f, scale * 0.95f, 0, 0f); + } + } +} diff --git a/Particles/BaneParticle.png b/Particles/BaneParticle.png new file mode 100644 index 0000000000..89703f1e16 Binary files /dev/null and b/Particles/BaneParticle.png differ diff --git a/Particles/BaneParticleGlow.png b/Particles/BaneParticleGlow.png new file mode 100644 index 0000000000..afbabdf11c Binary files /dev/null and b/Particles/BaneParticleGlow.png differ diff --git a/Particles/BloomRingAngled.png b/Particles/BloomRingAngled.png new file mode 100644 index 0000000000..fa6506a992 Binary files /dev/null and b/Particles/BloomRingAngled.png differ diff --git a/Projectiles/Typeless/AbaddonCrit.cs b/Projectiles/Typeless/AbaddonCrit.cs deleted file mode 100644 index d77d440a3c..0000000000 --- a/Projectiles/Typeless/AbaddonCrit.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class AbaddonCrit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[Projectile.owner]; - private static float ExplosionRadius = 300f; - - public override void SetDefaults() - { - //These shouldn't matter because its circular - Projectile.width = 300; - Projectile.height = 300; - Projectile.friendly = true; - Projectile.DamageType = AverageDamageClass.Instance; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - public override void AI() - { - Player player = Main.player[Projectile.owner]; - for (int i = 0; i <= 30; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 218 : ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(MathHelper.ToRadians(360)) * Main.rand.NextFloat(1.1f, 2.2f), 0, default, Main.rand.NextFloat(2.8f, 3.4f)); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cFace, player); - dust.noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 360); - SoundEngine.PlaySound(SoundID.Item89 with { Volume = 0.5f, PitchVariance = 0.4f }, Projectile.Center); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - public override bool? CanDamage() => base.CanDamage(); - public override bool? CanCutTiles() => false; - } -} diff --git a/Projectiles/Typeless/DebuffSpreadEffect.cs b/Projectiles/Typeless/DebuffSpreadEffect.cs new file mode 100644 index 0000000000..8ab5c80f30 --- /dev/null +++ b/Projectiles/Typeless/DebuffSpreadEffect.cs @@ -0,0 +1,259 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.DataStructures; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using CalamityMod.Systems.Collections; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typeless +{ + public class DebuffSpreadEffect : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typeless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + public List listNPCs = new List(); + public NPC lastNPC; + public int minCooldown = 48; + public static Color startingColor = Bane.baneColor2; + public Color mainColor = Color.White; + public Color subColor = startingColor; + public Color extraColor = Color.White; + public ref float spreadCount => ref Projectile.ai[2]; + public ref float time => ref Projectile.ai[0]; + public override void SetDefaults() + { + Projectile.width = Projectile.height = 1; + Projectile.ignoreWater = true; + Projectile.timeLeft = 9000; + Projectile.tileCollide = false; + Projectile.friendly = true; + Projectile.penetrate = -1; + } + + public override void AI() + { + NPC npc = (lastNPC == null ? Main.npc[(int)Projectile.ai[1]] : lastNPC); + + if (npc != null && spreadCount != 0) + { + if (time % 9 == 0) + { + listNPCs.Add(npc.whoAmI); + Projectile.Center = npc.Center; + mainColor = Color.White; + + bool strong = npc.Calamity().apollyonEffected; + float areaOfEffect = (strong ? 1400 : 800); + int debuffTime = (strong ? 180 : 120); + int startDir = Main.rand.NextBool() ? 1 : -1; + + // Initial infliction lasts longer, hopefully reduces the power imbalance between this accessory with fast weapons vs slow weapons + npc.AddBuff(ModContent.BuffType(), debuffTime * 2); + + float distanceFromCenter = areaOfEffect; + NPC targeted = null; + // Get closest valid target + for (int index = 0; index < Main.npc.Length; index++) + { + NPC closestTarget = Main.npc[index]; + if (closestTarget.CanBeChasedBy(null, false) && closestTarget != npc && !listNPCs.Contains(closestTarget.whoAmI) && closestTarget.life > 0) + { + float extraDistance = (closestTarget.width / 2) + (closestTarget.height / 2); + if (Vector2.Distance(Projectile.Center, closestTarget.Center) < distanceFromCenter) + { + distanceFromCenter = Vector2.Distance(Projectile.Center, closestTarget.Center); + targeted = closestTarget; + } + } + } + + if (targeted != null) + { + targeted.Calamity().apollyonEffected = npc.Calamity().apollyonEffected; + targeted.Calamity().abaddonEffected = npc.Calamity().abaddonEffected; + + float bestDamage = Owner.Calamity().playerBaneDebuffDamage; + int heat = 0; + Color heatClr = Color.OrangeRed; + int sick = 0; + Color sickClr = Color.Lime; + int cold = 0; + Color coldClr = Color.RoyalBlue; + int shock = 0; + Color shockClr = Color.Gold; + int water = 0; + Color waterClr = Color.DarkTurquoise; + // Find all the debuffs on the enemy + int debuffNum = 0; + + for (int index = 0; index < npc.buffType.Length; index++) + { + int type = npc.buffType[index]; + var debuffData = BuffDatasets.DebuffDataset[type]; + + // Calculate the Bane damage to see if the debuffs can be transfered + int bDamage = Math.Max((int)(Bane.debuffData.EnemyLostRegen * bestDamage), (int)Bane.debuffData.EnemyLostRegen); + + if (CalamityBuffSets.IsDebuff[type]) + { + if (debuffData == null || debuffData.EnemyLostRegen <= bDamage) + { + debuffNum++; + float timeMult = (debuffData == null || (debuffData != null && debuffData == Bane.debuffData)) ? 1 : Utils.Remap(debuffData.EnemyLostRegen, 0, bDamage, 5, 1); + targeted.AddBuff(type, (int)(debuffTime * timeMult)); + } + if (debuffData != null) + { + if (debuffData.HeatDebuffScaling > 0) { mainColor = Color.Lerp(mainColor, heatClr, 0.65f); heat++; } + if (debuffData.SicknessDebuffScaling > 0) { mainColor = Color.Lerp(mainColor, sickClr, 0.65f); sick++; } + if (debuffData.ColdDebuffScaling > 0) { mainColor = Color.Lerp(mainColor, coldClr, 0.65f); cold++; } + if (debuffData.ElectricDebuffScaling > 0) { mainColor = Color.Lerp(mainColor, shockClr, 0.65f); shock++; } + if (debuffData.WaterDebuffScaling > 0) { mainColor = Color.Lerp(mainColor, waterClr, 0.65f); water++; } + if (new List { heat, sick, cold, shock, water }.Max() == 0) + { + mainColor = Bane.baneColor1; + } + } + } + // Edge case fixes for Shred and Demonic Flames + // Not ideal but not sure how else to do it + if (npc.Calamity().somaShredStacks > 0 && Shred.BaseDamage <= bDamage) + targeted.AddBuff(ModContent.BuffType(), debuffTime); + int demonicFlames = ModContent.GetModBuff(ModContent.BuffType()).Type; + if (npc.HasBuff(demonicFlames)) + targeted.Calamity().demonicFlamesBonusDamage = npc.Calamity().demonicFlamesBonusDamage; + } + if (debuffNum == 0) + { + KillSelf(); + return; + } + + List best = new List { heat, sick, cold, shock, water }; + int highest = best.Max(); + if (highest != 0) + { + // Ideally these lines would run in a random order, so that fire isn't prioritsed as an extra color, but I don't know how to do that! + if (heat == highest && extraColor == Color.White) { if (subColor != startingColor) { extraColor = heatClr; } else { subColor = heatClr; } } + if (sick == highest && extraColor == Color.White) { if (subColor != startingColor) { extraColor = sickClr; } else { subColor = sickClr; } } + if (cold == highest && extraColor == Color.White) { if (subColor != startingColor) { extraColor = coldClr; } else { subColor = coldClr; } } + if (shock == highest && extraColor == Color.White) { if (subColor != startingColor) { extraColor = shockClr; } else { subColor = shockClr; } } + if (water == highest && extraColor == Color.White) { if (subColor != startingColor) { extraColor = waterClr; } else { subColor = waterClr; } } + } + + VisualEffects(npc, targeted, startDir, 1 + (best.Sum() * 0.12f)); + + Projectile.ForceNetUpdate(); + targeted.ForceNetUpdate(); + lastNPC = targeted; + } + else + { + KillSelf(); + return; + } + + if (Owner.Calamity().abaddonCooldown <= 0) + Owner.Calamity().abaddonCooldown = minCooldown * 2; + spreadCount--; + } + } + else + { + KillSelf(); + return; + } + time++; + } + public void KillSelf() + { + if (Owner.Calamity().abaddonCooldown > minCooldown) + Owner.Calamity().abaddonCooldown = minCooldown; + if (Owner.Calamity().abaddonCooldown < 0) + Owner.Calamity().abaddonCooldown = 0; + Projectile.Kill(); + } + public void VisualEffects(NPC npc, NPC targeted, int startDirection, float effectPower) + { + Vector2 start = npc.Center; + Vector2 end = targeted.Center; + if (Owner.Calamity().abaddonEffectVisual) + { + // Spawn a single particle line between the first target and the new target + Vector2 lerpVel = Vector2.Lerp(start, end, 0.5f); + float scale = 0.015f; + Particle spark = new CustomSpark(lerpVel, npc.SafeDirectionTo(targeted.Center), "CalamityMod/Particles/BloomLineSoftEdge", false, 18, scale, mainColor, new Vector2(1.2f * effectPower, (Utils.Distance(start, end) * 0.038f)), true, true, shrinkSpeed: 0.25f, glowOpacity: 0.75f); + GeneralParticleHandler.SpawnParticle(spark); + + for (int g = 0; g < 7; g++) + { + int DustID = ModContent.DustType(); + Dust dust2 = Dust.NewDustDirect(targeted.Center, targeted.width, targeted.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() ? subColor : (extraColor != Color.White ? extraColor : mainColor); + } + + float distance = Vector2.Distance(targeted.Center, npc.Center); + + // This might look like a lot of dust for a thing that can happen to at few enemies in succession, but it + // does get reduced significantly based on distance and lasts only a few frames. + int averageDusts = (int)(65 * (float)Math.Pow(effectPower, 0.3f)); + int maxDusts = (int)((float)Math.Pow(Math.Max(distance, 1) / 1000, 0.65f) * averageDusts); + + Vector2 dustLineStart = start; + Vector2 dustLineEnd = end; + Vector2 currentDustPos = default; + Vector2 dustVel = start.DirectionTo(end); + int startingPoint = Main.rand.Next(0, 400 + 1); + Vector2 lastDustPos = default; + for (int i = 0; i < maxDusts; i++) + { + float sineSpeed = Utils.Remap(startingPoint, 0, 400, 1.6f, 0.7f); + float sine = (float)Math.Sin((i + startingPoint) * sineSpeed / MathHelper.Pi) * startDirection; + float endStartFade = Math.Min(Utils.GetLerpValue(maxDusts * 0.9f, maxDusts * 0.1f, i, true), Utils.GetLerpValue(maxDusts * 0.1f, maxDusts * 0.9f, i, true)); + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 6 * sine * endStartFade; + if (i == 0) + lastDustPos = currentDustPos; + + bool wildDust = Main.rand.NextBool(5); + currentDustPos = Vector2.Lerp(dustLineStart, dustLineEnd, i / (float)maxDusts) + dustVel.RotatedBy(MathHelper.PiOver2) * 55 * sine * endStartFade * effectPower; + Dust dustLinger = Dust.NewDustPerfect(currentDustPos, ModContent.DustType()); + dustLinger.position = currentDustPos; + dustLinger.velocity = currentDustPos.DirectionTo(lastDustPos) * (wildDust ? 6.5f : Main.rand.NextFloat(0.2f, 0.8f)); + dustLinger.noGravity = true; + dustLinger.scale = Main.rand.NextFloat(0.8f, 1f) * (wildDust ? 1.7f : 1.5f) * effectPower; + dustLinger.fadeIn = Main.rand.NextFloat(0.6f, 1f) * 4 * effectPower * (wildDust ? 0.35f : 1); + dustLinger.color = Color.Lerp((extraColor != Color.White ? extraColor : mainColor), subColor, Utils.GetLerpValue(0, maxDusts, i)); + if (wildDust) + dustLinger.color = !Main.rand.NextBool(4) ? subColor : (extraColor != Color.White ? extraColor : mainColor); + if (!wildDust) + { + dustLinger.noLightEmittence = true; + dustLinger.customData = new Vector2(0.8f, 3); + } + else + dustLinger.customData = new Vector2(0.6f, 1.5f); + + lastDustPos = currentDustPos; + } + } + for (int u = 0; u < 2; u++) + { + Vector2 pos = start; + if (u == 0) pos = end; + Particle spark3 = new CustomSpark(pos, Vector2.Zero, "CalamityMod/Particles/BloomCircle", false, 18, u != 0 ? 0.7f : 0.55f, (u == 0 ? subColor : mainColor) * (Owner.Calamity().abaddonEffectVisual ? 1 : 0.3f), Vector2.One, true, true, glowOpacity: 0.85f); + GeneralParticleHandler.SpawnParticle(spark3); + } + } + public override bool? CanDamage() => false; + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false; + } +} diff --git a/Projectiles/Typeless/VoidofExtinctionCrit.cs b/Projectiles/Typeless/VoidofExtinctionCrit.cs deleted file mode 100644 index 9f56c8349e..0000000000 --- a/Projectiles/Typeless/VoidofExtinctionCrit.cs +++ /dev/null @@ -1,53 +0,0 @@ -using CalamityMod.Dusts; -using Microsoft.Xna.Framework; -using Terraria; -using Terraria.Audio; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; - -namespace CalamityMod.Projectiles.Typeless -{ - public class VoidofExtinctionCrit : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Typeless"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - public Player Owner => Main.player[Projectile.owner]; - private static float ExplosionRadius = 300f; - - public override void SetDefaults() - { - //These shouldn't matter because its circular - Projectile.width = 300; - Projectile.height = 300; - Projectile.friendly = true; - Projectile.DamageType = AverageDamageClass.Instance; - Projectile.ignoreWater = true; - Projectile.tileCollide = false; - Projectile.penetrate = -1; - Projectile.timeLeft = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = -1; - } - public override void AI() - { - Player player = Main.player[Projectile.owner]; - for (int i = 0; i <= 30; i++) - { - Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(4) ? 218 : ModContent.DustType(), new Vector2(5, 5).RotatedByRandom(MathHelper.ToRadians(360)) * Main.rand.NextFloat(1.1f, 2.2f), 0, default, Main.rand.NextFloat(2.8f, 3.4f)); - dust.shader = GameShaders.Armor.GetSecondaryShader(player.cFace, player); - dust.noGravity = true; - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(ModContent.BuffType(), 360); - SoundEngine.PlaySound(SoundID.Item89 with { Volume = 0.5f, PitchVariance = 0.4f }, Projectile.Center); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox); - public override bool? CanDamage() => base.CanDamage(); - public override bool? CanCutTiles() => false; - } -} diff --git a/Systems/Collections/CalamityBuffSets.cs b/Systems/Collections/CalamityBuffSets.cs index afd3ba2ca8..48c092ed60 100644 --- a/Systems/Collections/CalamityBuffSets.cs +++ b/Systems/Collections/CalamityBuffSets.cs @@ -59,14 +59,15 @@ 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.Venom, BuffID.Blackout, BuffID.Electrified, BuffID.Rabies, BuffID.Webbed, BuffID.Stoned, BuffID.Dazed, BuffID.VortexDebuff, BuffID.WitheredArmor, BuffID.WitheredWeapon, BuffID.ShadowFlame, + 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(), BuffType(), BuffType()); /// /// If for a buff type, then that buff is a whip tag buff on the player.