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/Buffs/StatBuffs/SmashedEvil.cs b/Buffs/StatBuffs/SmashedEvil.cs new file mode 100644 index 0000000000..9991a19dad --- /dev/null +++ b/Buffs/StatBuffs/SmashedEvil.cs @@ -0,0 +1,64 @@ +using System; +using CalamityMod.DataStructures; +using CalamityMod.Items.Accessories; +using Terraria; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.StatBuffs +{ + public class SmashedEvil : ModBuff + { + public static DebuffData debuffData = new DebuffData() + { + EnemyLostRegen = 40, + SicknessDebuffScaling = 1, + HeatDebuffScaling = 1, + ColdDebuffScaling = 1, + ElectricDebuffScaling = 1, + WaterDebuffScaling = 1, + NPCLifeRegenMethod = SmashedEvilNPCRegen + + }; + + public static void SmashedEvilNPCRegen(NPC npc, int buffType, ref int buffIndex, ref int damage) + { + var cnpc = npc.Calamity(); + float totalDPS = debuffData.EnemyLostRegen; + + var heat = cnpc.ActiveHeatDebuffMultiplier; + var cold = cnpc.ActiveColdDebuffMultiplier; + var sick = cnpc.ActiveSicknessDebuffMultiplier; + var elec = cnpc.ActiveElectricDebuffMultiplier; + var water = cnpc.ActiveWaterDebuffMultiplier; + StatModifier totalScaling = + DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveHeatDebuffMultiplier, debuffData.HeatDebuffScaling) + .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveColdDebuffMultiplier, debuffData.ColdDebuffScaling) + .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveSicknessDebuffMultiplier, debuffData.SicknessDebuffScaling) + .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveWaterDebuffMultiplier, debuffData.WaterDebuffScaling) + .CombineWith(DebuffData.ForceModifierPositiveWithScaling(cnpc.ActiveElectricDebuffMultiplier, debuffData.ElectricDebuffScaling) + )))); + totalDPS = totalScaling.ApplyTo(totalDPS); + var totalDPSAdjusted = totalDPS - debuffData.EnemyVanillaRegenToCancelOut; + npc.Calamity().ApplyDPSDebuff((int)(totalDPSAdjusted), (int)Math.Max(totalDPS * debuffData.MultiplierDamageTickSize, debuffData.MinimumDamageTickSize), ref npc.lifeRegen, ref damage); + } + public override void SetStaticDefaults() + { + Main.debuff[Type] = false; + Main.pvpBuff[Type] = true; + Main.buffNoSave[Type] = true; + BuffDatasets.DebuffDataset[Type] = debuffData; + } + + public override void Update(Player player, ref int buffIndex) + { + player.lifeRegenTime += 2; + player.GetDamage() += 0.1f; + player.moveSpeed += 0.2f; + } + + public override void Update(NPC npc, ref int buffIndex) + { + } + } +} diff --git a/Buffs/StatBuffs/SmashedEvil.png b/Buffs/StatBuffs/SmashedEvil.png new file mode 100644 index 0000000000..a75b74f944 Binary files /dev/null and b/Buffs/StatBuffs/SmashedEvil.png differ diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index c48601beb8..3b28f81093 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -454,6 +454,9 @@ namespace CalamityMod.CalPlayer public int consecutiveCaughtFish = 0; public float WeakTimeFreezeUseTimer = 0; public bool WeakTimeFreezeInUse = false; + + public int DemonAltarDialogueCounter = 0; + public int DemonAltarDialogueCooldown = 0; #endregion #region Sound @@ -961,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; @@ -1033,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; @@ -1270,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; @@ -1364,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; @@ -2461,7 +2467,7 @@ namespace CalamityMod.CalPlayer crawCarapace = false; baroclaw = false; voidOfCalamity = false; - voidOfExtinction = false; + apollyon = false; eArtifact = false; dArtifact = false; auricSArtifact = false; @@ -2550,6 +2556,8 @@ namespace CalamityMod.CalPlayer spiritOrigin = false; spiritOriginVanity = false; critDamage = 0; + if (abaddonCooldown > 0) + abaddonCooldown--; astralStarRain = false; @@ -2642,6 +2650,9 @@ namespace CalamityMod.CalPlayer blunderBoosterVisibility = true; veneratedLocket = false; + if (DemonAltarDialogueCooldown > 0) + DemonAltarDialogueCooldown--; + alcoholPoisoning = false; shadowflame = false; daybroken = false; @@ -2654,6 +2665,7 @@ namespace CalamityMod.CalPlayer armorCrunch = false; crumble = false; irradiated = false; + bane = false; brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; @@ -3092,7 +3104,6 @@ namespace CalamityMod.CalPlayer gSabatonTempJumpSpeed = 0; rOfDelivarenceRam = false; astralStarRainCooldown = 0; - AbaddonCooldown = 0; VoidCooldown = 0; AlchFlaskCooldown = 0; ascendantInsigniaCooldown = 0; @@ -3141,6 +3152,7 @@ namespace CalamityMod.CalPlayer armorCrunch = false; crumble = false; irradiated = false; + bane = false; brimstoneFlames = false; witheredDebuff = false; absorberAffliction = false; @@ -5004,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 a4ef95d5b3..38b829bd1e 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 { @@ -465,10 +465,48 @@ namespace CalamityMod.CalPlayer { if (Player.Calamity().yharimsGift) target.AddBuff(ModContent.BuffType(),120); + + int debuffSpreadProj = ModContent.ProjectileType(); + if ((Player.Calamity().abaddon || Player.Calamity().apollyon) && (target.Calamity().abaddonEffected || target.Calamity().apollyonEffected) && hit.Crit && abaddonCooldown == 0 && Player.ownedProjectileCounts[debuffSpreadProj] == 0) + { + int maxTargetNum = target.Calamity().apollyonEffected ? 10 : 6; + Projectile.NewProjectile(Player.GetSource_FromThis(), target.Center, Vector2.Zero, debuffSpreadProj, 0, 0, Player.whoAmI, 0, target.whoAmI, maxTargetNum); + abaddonCooldown = -1; // Prevents multiple projectiles hitting on the same frame from spawning multiple of these + } } #endregion #region Modify Hit NPC + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (target.HasBuff()) + { + //This is essentially 10 AP, but independent of armor amount + modifiers.FlatBonusDamage += 5; + } + + 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; + } + } public override void ModifyHitNPCWithItem(Item item, NPC target, ref NPC.HitModifiers modifiers) { modifiers.CritDamage += critDamage; 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 14b873d37b..8bdb1af27c 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -69,6 +69,8 @@ using CalamityMod.Tiles.Abyss.AbyssAmbient; using CalamityMod.Tiles.FurnitureAuric; using CalamityMod.Tiles.Ores; using CalamityMod.UI; +using CalamityMod.UI.DialogueDisplay; +using CalamityMod.UI.DialogueDisplay.DisplayEffects; using CalamityMod.Utilities; using CalamityMod.World; using Microsoft.Xna.Framework; @@ -1139,8 +1141,39 @@ namespace CalamityMod.CalPlayer } } + private void DemonAltarTalking() + { + + for (var h = -15; h < 15; h++) + { + for (var j = -15; j < 15; j++) + { + var tilePos = Player.Center.ToTileCoordinates() + new Point(h, j); + if (Main.tile[tilePos.X, tilePos.Y].TileType == TileID.DemonAltar) + { + string type = WorldGen.crimson ? "Mods.CalamityMod.EvilSmasher.CrimsonAltar" : "Mods.CalamityMod.EvilSmasher.DemonAltar"; + if (DialogueDisplaySystem.ContainsDialogueKey(type)) + DialogueDisplaySystem.RemoveDialogue(DialogueDisplaySystem.GetSlot(type)); + DialogueDisplaySystem.StartDialogueOnClient(type, new Vector2(tilePos.X * 16 + 16, tilePos.Y * 16), DemonAltarDialogueCounter, 180, false, new AltarText()); + DemonAltarDialogueCounter++; + DemonAltarDialogueCooldown = 300; + if (DemonAltarDialogueCounter >= 4) + { + DemonAltarDialogueCooldown = 3600; + DemonAltarDialogueCounter = 0; + } + return; + } + } + } + } private void MiscEffects() { + if (Player.inventory.Any(x => x.type == ItemID.Pwnhammer) && !Player.inventory.Any(x => x.type == ModContent.ItemType()) && Player.adjTile[TileID.DemonAltar] && DemonAltarDialogueCooldown <= 0 && Player.miscCounter % 30 == 0) + { + DemonAltarTalking(); + } + //Mana Burn update if (ManaBurnFireDrawer != null) { @@ -2250,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/Cooldowns/CooldownRegistry.cs b/Cooldowns/CooldownRegistry.cs index b697488611..e22fb8fb3a 100644 --- a/Cooldowns/CooldownRegistry.cs +++ b/Cooldowns/CooldownRegistry.cs @@ -6,7 +6,6 @@ using Terraria.ModLoader; namespace CalamityMod.Cooldowns { - // TODO -- This can be made into a ModSystem with simple OnModLoad and Unload hooks. public sealed class CooldownRegistry : ModSystem { // Indexed by ushort netID. Contains every registered cooldown. 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/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.CrimsonAltar.json b/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.CrimsonAltar.json new file mode 100644 index 0000000000..2b0ab25d50 --- /dev/null +++ b/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.CrimsonAltar.json @@ -0,0 +1,47 @@ +{ + "Revision": 1, + "DefaultColor": "FF0000", + "DefaultSpeaker": "DemonAltar", + "AlignType": 1, + "TextDelay": 2, + "BasePunctuationDelay": { + "Delay": 10, + "ForceSet": false, + "Locks": false + }, + "PunctuationDelayCap": 30, + "PunctuationDelays": { + "!": { + "Delay": 20, + "ForceSet": true, + "Locks": true + }, + "?": { + "Delay": 20, + "ForceSet": true, + "Locks": true + } + }, + "Pages": [ + { + "Lines": [ + "You, slayer of the flesh tower...[Pause(0.25)] we have an offer fitting of your deeds." + ] + }, + { + "Lines": [ + "We can bestow you might untold...[Pause(0.25)] [Shaking:to grind your enemies to dust!]" + ] + }, + { + "Lines": [ + "Simply yield the holy hammer unto the altar." + ] + }, + { + "Lines": [ + "Kneel, and we shall render you the strength." + ] + } + ] +} diff --git a/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.DemonAltar.json b/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.DemonAltar.json new file mode 100644 index 0000000000..bfdd7ae10c --- /dev/null +++ b/Dialogues/en-US/Dialogue.Mods.CalamityMod.EvilSmasher.DemonAltar.json @@ -0,0 +1,47 @@ +{ + "Revision": 1, + "DefaultColor": "FF00FF", + "DefaultSpeaker": "DemonAltar", + "AlignType": 1, + "TextDelay": 2, + "BasePunctuationDelay": { + "Delay": 10, + "ForceSet": false, + "Locks": false + }, + "PunctuationDelayCap": 30, + "PunctuationDelays": { + "!": { + "Delay": 20, + "ForceSet": true, + "Locks": true + }, + "?": { + "Delay": 20, + "ForceSet": true, + "Locks": true + } + }, + "Pages": [ + { + "Lines": [ + "Bearer of the Holy Hammer...[Pause(0.25)] [Wavy:desirest thou to taste true power?]" + ] + }, + { + "Lines": [ + "Thine eyes shall be opened...[Pause(0.25)] [Shaking:thou shalt be even as the gods!]" + ] + }, + { + "Lines": [ + "Yield the hammer unto us upon the altar." + ] + }, + { + "Lines": [ + "Surrender, and thou shalt surely receive our might." + ] + } + ] +} 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/Items/Weapons/Melee/EvilSmasher.cs b/Items/Weapons/Melee/EvilSmasher.cs index 27abbe6fa8..596829a8c7 100644 --- a/Items/Weapons/Melee/EvilSmasher.cs +++ b/Items/Weapons/Melee/EvilSmasher.cs @@ -1,38 +1,203 @@ -using Terraria; +using System; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Melee; +using CalamityMod.Utilities.Daybreak; +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.Items.Weapons.Melee { - public class EvilSmasher : ModItem, ILocalizedModType + public class EvilSmasher : BaseSwordHoldoutItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; + public override int ProjectileType => ModContent.ProjectileType(); + + public bool IsAnimating = false; + public int AnimationTime = 0; public override void SetDefaults() { + base.SetDefaults(); Item.width = 64; Item.height = 66; - Item.damage = 120; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = Item.useTime = 38; - Item.useStyle = ItemUseStyleID.Swing; - Item.useTurn = true; + Item.damage = 200; + Item.DamageType = AverageDamageClass.Instance; + Item.useAnimation = Item.useTime = 120; + Item.channel = true; Item.knockBack = 6f; - Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityLightRedBuyPrice; Item.rare = ItemRarityID.LightRed; } - - public override float UseSpeedMultiplier(Player player) => 1f + (player.Calamity().evilSmasherBoost * 0.1f); - - public override void ModifyWeaponDamage(Player player, ref StatModifier damage) => damage *= 1f + player.Calamity().evilSmasherBoost * 0.1f; - - public override void ModifyWeaponKnockback(Player player, ref StatModifier knockback) => knockback *= 1f + (player.Calamity().evilSmasherBoost * 0.1f); - - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) + public override void UpdateInventory(Player player) { - if (target.life <= 0 && player.Calamity().evilSmasherBoost < 10) - player.Calamity().evilSmasherBoost += 1; + AnimationTime = 300; + base.UpdateInventory(player); + } + + public override void Update(ref float gravity, ref float maxFallSpeed) + { + if (!IsAnimating) + { + if (AnimationTime < 300) + AnimationTime++; + return; + } + float completion = AnimationTime / 240f; + Item.noGrabDelay = 120; + Item.velocity = new Vector2(0, -1f); + int dotAmount = 0; + for (var i = 0; i < dotAmount; i++) + { + var ringDir = getRingOffset(i / (float)dotAmount * -MathHelper.TwoPi + MathHelper.TwoPi * completion * 3, ySquish: 3f); + Dust.NewDustPerfect(Item.Center + (ringDir * (completion - MathF.Pow(completion, 2)) * 256), i % 2 == 0 ? DustID.Crimson : DustID.Corruption, ringDir); + } + if (Main.rand.NextFloat() < completion) + Dust.NewDustPerfect(Item.Center, Main.rand.NextBool() ? DustID.CursedTorch : DustID.IchorTorch,Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * 5); + if (completion >= 1) + { + for (var i = 0; i < 50; i++) + { + Dust.NewDustPerfect(Item.Center, Main.rand.NextBool() ? DustID.CursedTorch : DustID.IchorTorch, Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * 5); + Dust.NewDustPerfect(Item.Center, Main.rand.NextBool() ? DustID.Crimson : DustID.Corruption, Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * 5); + } + IsAnimating = false; + Item.velocity = new Vector2(0, -5); + } + AnimationTime++; + } + + #region Textures + private static Asset GlowTex = null; + private static Texture2D GetGlowTex() + { + if (GlowTex == null) + { + GlowTex = ModContent.Request("CalamityMod/Particles/BloomCircle"); + } + return GlowTex.Value; + } + + private static Asset GlowBeamTex = null; + private static Texture2D GetGlowBeamTex() + { + if (GlowBeamTex == null) + { + GlowBeamTex = ModContent.Request("CalamityMod/Particles/BloomLineFade"); + } + return GlowBeamTex.Value; + } + private static Asset GlowBeamCapTex = null; + private static Texture2D GetGlowBeamCapTex() + { + if (GlowBeamCapTex == null) + { + GlowBeamCapTex = ModContent.Request("CalamityMod/Particles/BloomLineCap"); + } + return GlowBeamCapTex.Value; + } + #endregion + public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI) + { + if (IsAnimating) + { + var color = Color.Lerp(Color.Purple, Color.Red, MathF.Sin(Main.GlobalTimeWrappedHourly * 6) * 0.5f + 0.5f); + + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Immediate, + BlendState.Additive, + SamplerState.PointClamp, + DepthStencilState.None, + Main.Rasterizer, + null, + Main.GameViewMatrix.TransformationMatrix + ); + + Main.spriteBatch.Draw(GetGlowTex(), Item.Center - Main.screenPosition, null, color, 0, GetGlowTex().Size() * 0.5f, 0.1f + 0.7f * (AnimationTime / 240f), SpriteEffects.None, 0); + int rep = 0; + for (float i = 0; i <= MathHelper.TwoPi; i += MathHelper.TwoPi * 0.166f) + { + Main.spriteBatch.Draw(GetGlowBeamTex(), Item.Center - Main.screenPosition, null, color, MathHelper.WrapAngle(Main.GlobalTimeWrappedHourly) + i, new(GetGlowBeamTex().Size().X * 0.5f, 0), 0f + 0.06f * (AnimationTime / 240f) * (rep == 0 ? 1 : 0.75f), SpriteEffects.None, 0); + rep = (rep + 1) % 2; + } + + Main.spriteBatch.End(); + } + + var tex = TextureAssets.Item[ItemID.Pwnhammer].Value; + Main.spriteBatch.Draw(tex, Item.Center - Main.screenPosition, null, Color.Lerp(lightColor, Color.Black, AnimationTime / 240f), 0, tex.Size() * 0.5f, MathHelper.Lerp(1, 1.75f, AnimationTime / 240f), SpriteEffects.None, 0); + return false; + + } + else if (AnimationTime < 300) + { + float completion = 1 - (AnimationTime - 240) / 60f; + var color = Color.Lerp(Color.Purple, Color.Red, MathF.Sin(Main.GlobalTimeWrappedHourly * 6) * 0.5f + 0.5f); + + using (Main.spriteBatch.Scope()) + { + Main.spriteBatch.Begin(SpriteSortMode.Immediate, + BlendState.Additive, + SamplerState.PointClamp, + DepthStencilState.None, + Main.Rasterizer, + null, + Main.GameViewMatrix.TransformationMatrix + ); + + Main.spriteBatch.Draw(GetGlowTex(), Item.Center - Main.screenPosition, null, color, 0, GetGlowTex().Size() * 0.5f, 0.1f + 0.7f * completion, SpriteEffects.None, 0); + int rep = 0; + for (float i = 0; i <= MathHelper.TwoPi; i += MathHelper.TwoPi * 0.166f) + { + Main.spriteBatch.Draw(GetGlowBeamTex(), Item.Center - Main.screenPosition, null, color, MathHelper.WrapAngle(Main.GlobalTimeWrappedHourly) + i, new(GetGlowBeamTex().Size().X * 0.5f, 0), 0f + 0.06f * completion * (rep == 0 ? 1 : 0.75f), SpriteEffects.None, 0); + rep = (rep + 1) % 2; + } + + Main.spriteBatch.End(); + } + } + return base.PreDrawInWorld(spriteBatch, lightColor, alphaColor, ref rotation, ref scale, whoAmI); + } + + private Vector2 getRingOffset(float rad, float xSquish = 1, float ySquish = 1) + { + return new Vector2((1 / xSquish) * MathF.Cos(rad), (1 / ySquish) * MathF.Sin(rad)); + } + } + + public class EvilSmasherSacrifice : GlobalItem + { + public override bool AppliesToEntity(Item entity, bool lateInstantiation) + { + return entity.type == ItemID.Pwnhammer; + } + + public override void Update(Item item, ref float gravity, ref float maxFallSpeed) + { + if (item.noGrabDelay > 0) return; //Only run once the item is fully settled + for (var i = 0; i < 5; i++) //Loop a couple times to check different vertical positions for the altar, improving accuracy. + { + var tileCheckPos = item.Center.ToTileCoordinates() + new Point(0, i); + if (Main.tile[tileCheckPos.X, tileCheckPos.Y].TileType == TileID.DemonAltar) + { + if (!(Main.netMode == NetmodeID.MultiplayerClient)) + { + var newItem = Main.item[Item.NewItem(item.GetSource_FromThis(), item.Hitbox, ModContent.ItemType())]; + newItem.noGrabDelay = 120; + newItem.prefix = item.prefix; + (newItem.ModItem as EvilSmasher).IsAnimating = true; + } + item.stack -= 1; + if (item.stack <= 0) + item.active = false; + return; + } + } } } } diff --git a/Items/Weapons/Melee/EvilSmasherGlow.png b/Items/Weapons/Melee/EvilSmasherGlow.png new file mode 100644 index 0000000000..a42c9964b6 Binary files /dev/null and b/Items/Weapons/Melee/EvilSmasherGlow.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 75dab61d8c..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 @@ -1701,3 +1711,18 @@ CnidarianSummonTagBuff: { DisplayName: Cnidarian Summon Tag Buff Description: you are not seeing this } + +SmashedEvil: { + DisplayName: Smashed Evil + Description: Increased damage, movement speed, and regeneration + ItemTooltip: + ''' + - On Enemies - + All Types - 20 DPS + +5 damage taken + - On Players - + Regen returns to full strength 200% faster + 10% increased damage + 20% increased movement speed + ''' +} 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.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index ee39a9879c..d0043441be 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -454,12 +454,19 @@ EvilSmasher: { DisplayName: Evil Smasher Tooltip: ''' - For every enemy you kill this hammer gains stat bonuses - These bonuses stack until a cap is reached - The bonus stacks will reset if you select a different item - The bonus stacks will be reduced by 1 every time you get hit + Channels a powerful hammer strike with the capability to crush all evil + Striking a tile with the hammer strike will cause an explosion and push you back + Striking enemies inflicts [cbuff:CalamityMod/SmashedEvil] on both the user and target + Charging strikes increases damage, explosion radius, and [cbuff:CalamityMod/SmashedEvil] duration 'EViL! sMaSH eVIl! SmAsh... ER!' ''' + //All damage and kill dialogue has the capitalization randomized when said + DamageDialogue0: smash! + DamageDialogue1: evil! + DamageDialogue2: crush! + DamageDialogue3: des.. troy! + KillDialogue0: smash evil! + KillDialogue1: smash.. er! } ExaltedOathblade: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index bb4a5def16..7586da81d3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -311,3 +311,4 @@ WulfrumScrew.DisplayName: Wulfrum Screw WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver YinYoDark.DisplayName: Dark Shard YinYoLight.DisplayName: Light Shard +EvilSmasherProjectile.DisplayName: Evil Smasher 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 00d7c4dbd7..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), @@ -4966,6 +4990,7 @@ namespace CalamityMod.NPCs ("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/StatBuffs/SmashedEvil", NPC => NPC.HasBuff()), ("CalamityMod/Buffs/StatDebuffs/TemporalSadness", NPC => NPC.Calamity().temporalSadness), ("CalamityMod/Buffs/StatDebuffs/TimeDistortion", NPC => NPC.Calamity().timeDistortion), ("CalamityMod/Buffs/StatDebuffs/WhisperingDeath", NPC => NPC.Calamity().whisperingDeath), 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/Melee/EvilSmasherProjectile.cs b/Projectiles/Melee/EvilSmasherProjectile.cs new file mode 100644 index 0000000000..f7182884f2 --- /dev/null +++ b/Projectiles/Melee/EvilSmasherProjectile.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Sounds; +using Humanizer; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.GameContent; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + + public class EvilSmasherProjectile : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public Player Owner => Main.player[Projectile.owner]; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + + public override string Texture => BaseItem.ModItem.Texture; + public override int AfterImageLength => 10; + public override int OffsetDistance => 50; + public override int CooldownTime { get; set; } + public override bool AlternateSwings => false; + public override bool useMeleeSpeed => false; + public override SoundStyle? UseSound => SoundID.DD2_MonkStaffSwing with {Volume = 1f}; + + bool hasSmashedTile = false; + bool playedChargeSound = false; + bool firstEnemyHit = true; + + public override void Defaults() + { + Projectile.extraUpdates = 3; + swingWidth = 200; + RotateInCooldown = 0; + RotateInStartup = 0; + Projectile.width = 64; + Projectile.height = 66; + } + + public override void Spawn() + { + angle = new Vector2(angle.X.DirectionalSign(), 0); + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 80; + CooldownTime = 30; + swingTime = 10; + modplayer.swingNum = 0; + Projectile.timeLeft = 600; + Projectile.scale *= 1.25f; + Projectile.originalDamage = Projectile.damage; + } + + public override void AdditionalAI() + { + if (inStartup) + { + Projectile.damage = (int)(Projectile.originalDamage * (timer / (float)(StartupTime-1))); + Owner.velocity.X *= 0.97f; + } + if (inStartup && !Owner.channel && timer > 30) + { + timer = StartupTime - 1; + } + if (Owner.channel && timer == StartupTime - 1) + { + Projectile.timeLeft++; + timer--; + if (!playedChargeSound) { + SoundEngine.PlaySound(SoundID.Item178,Projectile.Center); + playedChargeSound = true; + for (int i = 0; i < 5; i++) + { + int sparkLifetime = Main.rand.Next(8, 12); + float sparkScale = Main.rand.NextFloat(0.5f, 1f); + var sparkColor = Main.rand.NextBool() ? Color.Purple : Color.Red; + + if (Main.rand.NextBool(5)) + sparkScale *= 1.4f; + + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(Projectile.Center + angle * 30, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + } + } + } + if (!hasSmashedTile && inSwing && SwingCompletion > 0.275f) + { + var adjustedAngle = angle.RotatedBy(Projectile.spriteDirection * SwingFunction()); + Vector2 HammerFrontPos = Projectile.Center + adjustedAngle * -16 * Projectile.scale + (adjustedAngle.RotatedBy(MathHelper.PiOver2) * 20 * Projectile.scale * angle.X); + if (Collision.SolidCollision(HammerFrontPos, 1, 1)) + { + + Owner.velocity *= 0.15f; + Owner.velocity -= adjustedAngle.RotatedBy(MathHelper.PiOver2) * angle.X * MathHelper.Lerp(7.5f,16f,Projectile.damage / (float)Projectile.originalDamage); + float ringRot = SwingCompletion < 0.5f ? 0 : MathHelper.PiOver2; + GeneralParticleHandler.SpawnParticle(new CustomPulse(HammerFrontPos, Vector2.Zero, Color.Red, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloatDirection(), 0.03f, 0.04f * (2 + Projectile.damage / (float)Projectile.originalDamage), 15)); + GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.2f, 0.75f * (2 + Projectile.damage / (float)Projectile.originalDamage), 30)); + GeneralParticleHandler.SpawnParticle(new DirectionalPulseRing(HammerFrontPos, Vector2.Zero, Color.Purple, new Vector2(0.2f, 1f), ringRot, 0.1f, 0.5f * (2 + Projectile.damage / (float)Projectile.originalDamage), 30)); + int radius = (int)(4 * Projectile.damage / (float)Projectile.originalDamage); + Point scanAreaStart = HammerFrontPos.ToTileCoordinates() + new Point(-radius, -radius); + Point scanAreaEnd = HammerFrontPos.ToTileCoordinates() + new Point(radius, radius); + Projectile.CreateImpactExplosion((int)(10 * Projectile.damage / (float)Projectile.originalDamage), Projectile.Center, ref scanAreaStart, ref scanAreaEnd, Projectile.width, out bool causedShockwaves); + + hasSmashedTile = true; + timer = StartupTime + swingTime; + angle = adjustedAngle; + var pos = Projectile.Center; + Projectile.Size *= 2 + Projectile.damage / (float)Projectile.originalDamage; + Projectile.Center = HammerFrontPos; + Projectile.Damage(); + Projectile.Size /= 2 + Projectile.damage / (float)Projectile.originalDamage; + Projectile.Center = pos; + + if ((Projectile.damage / (float)Projectile.originalDamage) >= 1) + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact with {VariantsWeights = new ReadOnlySpan(new float[] { 1, 0, 0 })}); + SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact); + } + } + Owner.heldProj = Projectile.whoAmI; + } + + public override float SwingFunction() + { + if (hasSmashedTile) + return MathHelper.ToRadians(MathHelper.Lerp(0, -swingWidth * 0.4f, MathF.Pow(CooldownCompletion, 0.5f))); + if (inStartup) + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * 0.8f, -swingWidth * 0.66f, 1 - MathF.Pow(StartupCompletion, 0.5f))); + if (inCooldown) + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * 0.33f, swingWidth * 0.45f, MathF.Pow(CooldownCompletion, 0.5f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(-swingWidth * .66f, (swingWidth * 0.33f), SwingCompletion)); + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (firstEnemyHit && Main.rand.NextFloat() < (Projectile.damage / (float)Projectile.originalDamage)) + { + string text = ""; + if (target.life > 0) + text = CalamityUtils.GetTextValue("Items.Weapons.Melee.EvilSmasher.DamageDialogue" + Main.rand.Next(4)); + else + text = CalamityUtils.GetTextValue("Items.Weapons.Melee.EvilSmasher.KillDialogue" + Main.rand.Next(2)); + char[] textToFormat = text.ToCharArray(); + for (var i = 0; i < textToFormat.Length; i++) + { + if (Main.rand.NextBool()) + textToFormat[i] = char.ToUpper(textToFormat[i]); + } + text = new string(textToFormat); + bool intense = target.life <= 0; + CombatText.NewText(Projectile.Hitbox, Color.Lerp(Color.DarkGray,Color.Gold, intense ? 0.25f: 0.1f), text, intense); + firstEnemyHit = false; + } + if (!hasSmashedTile && (Projectile.damage / (float)Projectile.originalDamage) >= 1) + { + for (int i = 0; i < 16; i++) + { + int sparkLifetime = Main.rand.Next(10, 15); + float sparkScale = Main.rand.NextFloat(1f, 2f); + var sparkColor = Main.rand.NextBool() ? Color.Purple : Color.Red; + + if (Main.rand.NextBool(5)) + sparkScale *= 1.4f; + + Vector2 sparkVelocity = Vector2.UnitX.RotatedByRandom(MathHelper.TwoPi) * MathHelper.Lerp(10, 30, Main.rand.NextFloat()); + SparkParticle spark = new SparkParticle(target.Center, sparkVelocity, false, sparkLifetime, sparkScale, sparkColor); + GeneralParticleHandler.SpawnParticle(spark); + + } + SoundEngine.PlaySound(SoundID.DeerclopsRubbleAttack with { Volume = 0.5f, LimitsArePerVariant = false, MaxInstances = 1 }); + } + else if (!hasSmashedTile) + { + + SoundEngine.PlaySound(SoundID.Item69 with { Volume = 1f, LimitsArePerVariant = false, MaxInstances = 1 }); + } + target.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, Projectile.damage / (float)Projectile.originalDamage)); + Owner.AddBuff(ModContent.BuffType(), (int)MathHelper.Lerp(60, 900, Projectile.damage / (float)Projectile.originalDamage)); + } + + public override bool PreDraw(ref Color lightColor) + { + if (!inCooldown) + { + var tex = ModContent.Request(Texture + "Glow").Value; + float outlineWidth = (int)(4 * (Projectile.damage / (float)Projectile.originalDamage)) * 0.5f; + if (inSwing) + { + outlineWidth *= 1 - SwingCompletion; + } + for (float i = 0; i <= MathHelper.TwoPi; i += MathHelper.TwoPi * 0.25f) + { + Main.spriteBatch.Draw( + tex, + Projectile.Center + new Vector2(0, Projectile.gfxOffY) + Vector2.UnitX.RotatedBy(i + Projectile.rotation) * outlineWidth * Projectile.scale - Main.screenPosition, + null, + Color.Lerp(Color.Purple,Color.Red,MathF.Sin(Main.GlobalTimeWrappedHourly * 6)* 0.5f + 0.5f), + Projectile.rotation, + tex.Size() * 0.5f, + Projectile.scale, + Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, + 0 + ); + } + } + if (inSwing) + return base.PreDraw(ref lightColor); + return true; + } + } +} 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.
diff --git a/UI/DialogueDisplay/DisplayEffects/AltarText.cs b/UI/DialogueDisplay/DisplayEffects/AltarText.cs new file mode 100644 index 0000000000..e04228bf16 --- /dev/null +++ b/UI/DialogueDisplay/DisplayEffects/AltarText.cs @@ -0,0 +1,43 @@ +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.UI.DialogueDisplay.DisplayEffects +{ + public class AltarText : DisplayEffect + { + public override bool FadeWhenTooFar => false; + + public override bool DespawnWithAttachedNPC => false; + + public override Vector2 TextOffsetFromStart(Vector2 startPos, Vector2 textSize) + { + Vector2 halfSize = textSize * 0.5f; + return startPos - halfSize + (Vector2.UnitY * (textSize.Y - 60)); + } + float OffsetDisappearTime(float time, float ratio) => MathHelper.Clamp((time - (ratio * TimeToDisappear / 2f)) / (TimeToDisappear / 2f), 0f, 1f); + + public override Vector2 DisappearPositioning(Vector2 startPos, float time, DialogueCharacterData charData) => Vector2.Lerp(startPos, startPos + (Vector2.unitXVector * 12 * charData.Scale), CalamityUtils.SineOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1)); + + public override float DisappearOpacity(float startOpacity, float time, DialogueCharacterData charData) => 1 - CalamityUtils.SineOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1); + + public override Vector2 DisappearScale(Vector2 startScale, float time, DialogueCharacterData charData) => Vector2.Lerp(startScale, startScale * 0.75f, CalamityUtils.ExpOutEasing(OffsetDisappearTime(time, charData.CompletionRatio), 1)); + + 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/Utilities/ItemUtils.cs b/Utilities/ItemUtils.cs index 3c29818724..4efddb7d89 100644 --- a/Utilities/ItemUtils.cs +++ b/Utilities/ItemUtils.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; using CalamityMod.DataStructures; using CalamityMod.UI.CalamitasEnchants; using Microsoft.Xna.Framework; @@ -129,6 +130,7 @@ namespace CalamityMod public static Color TypelessDebuffColor => new(230, 202, 250); public static Color VulnHexDebuffColor => new(196, 35, 43); public static Color MiracleBlightDebuffColor => Main.DiscoColor; + public static Color SmashedEvilDebuffColor => Color.Lerp(new Color(162, 88, 231), new Color(221, 66, 97), MathHelper.SmoothStep(0, 1, (MathF.Sin(Main.GlobalTimeWrappedHourly * 2) + 1) * 0.5f)); private static readonly Dictionary> debuffColorWeightsCache = []; @@ -144,6 +146,11 @@ namespace CalamityMod { color = MiracleBlightDebuffColor; } + + else if (debuffId == ModContent.BuffType() && CalamityClientConfig.Instance.TextEffects) + { + color = SmashedEvilDebuffColor; + } else if (BuffDatasets.DebuffDataset[debuffId] is not null) { if (!debuffColorWeightsCache.TryGetValue(debuffId, out var weights))