From 37ef0b714794fdde6ed7da91329892c0825ab298 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Fri, 31 May 2024 18:34:12 -0400 Subject: [PATCH 1/7] 1 - Reimplementation of Cirrus Candles as permanent buff stations. 2 - All four Candle buffs are now mutually exclusive. 3 - Unlike other buff stations, Cirrus Candles persist through death. 4 - Changed all Cirrus Candles to be Pink rarity (matching Cirrus) and cost 2 platinum, because you only need one of them. 5 - Buffed Blue Candle from 5% to 10% movement speed, wing time, and acceleration. 6 - Buffed Pink Candle from 0.4% HP/s to 0.6% HP/s 7 - Buffed Yellow Candle from 1.05x damage to 1.07x damage. No longer ignores DR, but still ignores defense. 8 - Yellow Candle is no longer a tag debuff and does not apply to enemies in any way. 9 - Purple Candle is mechanically unchanged. --- Buffs/Placeables/CirrusBlueCandleBuff.cs | 18 +++++- Buffs/Placeables/CirrusPinkCandleBuff.cs | 20 +++--- Buffs/Placeables/CirrusPurpleCandleBuff.cs | 12 +++- Buffs/Placeables/CirrusYellowCandleBuff.cs | 19 +++--- CalPlayer/CalamityPlayer.cs | 3 +- CalPlayer/CalamityPlayerHitHurt.cs | 10 +++ CalPlayer/CalamityPlayerLifeRegen.cs | 3 +- CalPlayer/CalamityPlayerMiscEffects.cs | 6 +- Items/Placeables/Furniture/ResilientCandle.cs | 4 +- Items/Placeables/Furniture/SpitefulCandle.cs | 4 +- Items/Placeables/Furniture/VigorousCandle.cs | 4 +- .../Placeables/Furniture/WeightlessCandle.cs | 4 +- .../en-US/Mods.CalamityMod.Buffs.hjson | 6 +- .../Mods.CalamityMod.Items.Placeables.hjson | 15 +++-- NPCs/CalamityGlobalNPC.cs | 8 --- Tiles/Furniture/BlueCandle.cs | 46 ++++++++++---- Tiles/Furniture/BlueCandle_Highlight.png | Bin 0 -> 190 bytes Tiles/Furniture/PinkCandle.cs | 46 ++++++++++---- Tiles/Furniture/PinkCandle_Highlight.png | Bin 0 -> 190 bytes Tiles/Furniture/PurpleCandle.cs | 46 ++++++++++---- Tiles/Furniture/PurpleCandle_Highlight.png | Bin 0 -> 190 bytes Tiles/Furniture/YellowCandle.cs | 58 +++++++++++------- Tiles/Furniture/YellowCandle_Highlight.png | Bin 0 -> 190 bytes 23 files changed, 226 insertions(+), 106 deletions(-) create mode 100644 Tiles/Furniture/BlueCandle_Highlight.png create mode 100644 Tiles/Furniture/PinkCandle_Highlight.png create mode 100644 Tiles/Furniture/PurpleCandle_Highlight.png create mode 100644 Tiles/Furniture/YellowCandle_Highlight.png diff --git a/Buffs/Placeables/CirrusBlueCandleBuff.cs b/Buffs/Placeables/CirrusBlueCandleBuff.cs index 5552456597..1080599c10 100644 --- a/Buffs/Placeables/CirrusBlueCandleBuff.cs +++ b/Buffs/Placeables/CirrusBlueCandleBuff.cs @@ -6,17 +6,29 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusBlueCandleBuff : ModBuff { + public static float MoveSpeedBoost = 0.1f; + public static double WingTimeBoost = 0.1D; + public static float AccelerationBoost = 0.1f; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } + // Implementation is partially performed elsewhere using the blueCandle bool. public override void Update(Player player, ref int buffIndex) { + player.moveSpeed += MoveSpeedBoost; player.Calamity().blueCandle = true; } } diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/CirrusPinkCandleBuff.cs index eaeb003cbc..cde31c0c50 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/CirrusPinkCandleBuff.cs @@ -6,18 +6,24 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusPinkCandleBuff : ModBuff { + public static double PercentHealthPerSecond = 0.006D; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } - public override void Update(Player player, ref int buffIndex) - { - player.Calamity().pinkCandle = true; - } + // Implementation is performed elsewhere using the pinkCandle bool. + public override void Update(Player player, ref int buffIndex) => player.Calamity().pinkCandle = true; } } diff --git a/Buffs/Placeables/CirrusPurpleCandleBuff.cs b/Buffs/Placeables/CirrusPurpleCandleBuff.cs index a56d3e179b..3ad0e23b18 100644 --- a/Buffs/Placeables/CirrusPurpleCandleBuff.cs +++ b/Buffs/Placeables/CirrusPurpleCandleBuff.cs @@ -10,11 +10,17 @@ namespace CalamityMod.Buffs.Placeables public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } public override void Update(Player player, ref int buffIndex) diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/CirrusYellowCandleBuff.cs index 8ad664c83a..69a60673c7 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -6,19 +6,24 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusYellowCandleBuff : ModBuff { + public static float ExtraChipDamageRatio = 0.07f; + public override void SetStaticDefaults() { - Main.buffNoTimeDisplay[Type] = true; - Main.debuff[Type] = true; + // These settings are standard for a "opt-in eternal" buff, which has the following properties: + // - Is not removed on death + // - Saves with the player / is not removed on logout + // - Does not display its time + // - Never reduces its duration + // - Can be manually canceled Main.pvpBuff[Type] = true; + Main.persistentBuff[Type] = true; Main.buffNoSave[Type] = false; - BuffID.Sets.NurseCannotRemoveDebuff[Type] = true; - - // Spite (the +5% final damage effect of Yellow Candle) is a tag buff. Nothing is immune to it. - // They may however be unaffected by it (including only temporarily) if they have incredibly high DR. - BuffID.Sets.IsATagBuff[Type] = true; + Main.buffNoTimeDisplay[Type] = true; + BuffID.Sets.TimeLeftDoesNotDecrease[Type] = true; } + // Implementation is performed elsewhere using the yellowCandle bool. public override void Update(Player player, ref int buffIndex) => player.Calamity().yellowCandle = true; } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 784402d02f..cb4fca8350 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -4,6 +4,7 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.BiomeManagers; using CalamityMod.Buffs; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; @@ -3715,7 +3716,7 @@ namespace CalamityMod.CalPlayer (kamiBoost ? KamiBuff.RunAccelerationBoost : 0f) + (CobaltSet ? CobaltArmorSetChange.SpeedBoostSetBonusPercentage * 0.01f : 0f) + (silvaSet ? 0.05f : 0f) + - (blueCandle ? 0.05f : 0f) + + (blueCandle ? CirrusBlueCandleBuff.AccelerationBoost : 0f) + (planarSpeedBoost > 0 ? (0.01f * planarSpeedBoost) : 0f) + (hasteLevel * 0.05f); diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 0b6d6f69fa..2ad91438aa 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -3,6 +3,7 @@ using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.Cooldowns; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; using CalamityMod.CalPlayer.Dashes; @@ -524,6 +525,15 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 31MAY2024: Ozzatron: apply Yellow Candle "chip damage" in a different way, by adjusting FinalDamage.Base + // This is still gated by the old conditionals to ensure it doesn't apply to "near invincible" targets + // Calamity's DR is also implemented at the FinalDamage step as a multiplier so Yellow Candle doesn't ignore DR anymore (and has been buffed to compensate) + // + // FinalDamage.Flat would technically be closer to the intended implementation, but is heavily discouraged from use and would cause huge cross-mod issues + CalamityGlobalNPC cgn = target.Calamity(); + if (Player.HasBuff() && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.FinalDamage.Base *= 1f + CirrusYellowCandleBuff.ExtraChipDamageRatio; + // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) { diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index e561d98c24..590e89edba 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -2,6 +2,7 @@ using System.Linq; using CalamityMod.Buffs.Alcohol; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Cooldowns; using CalamityMod.Items.Accessories; using CalamityMod.NPCs; @@ -735,7 +736,7 @@ namespace CalamityMod.CalPlayer if (pinkCandle && !noLifeRegen) { // Every frame, add up 1/60th of the healing value (0.4% max HP per second) - pinkCandleHealFraction += Player.statLifeMax2 * 0.004 / 60; + pinkCandleHealFraction += Player.statLifeMax2 * CirrusPinkCandleBuff.PercentHealthPerSecond / 60; if (pinkCandleHealFraction >= 1D) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5f2adbd3b7..1dac773f1d 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.Placeables; using CalamityMod.Buffs.Potions; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; @@ -2862,16 +2863,13 @@ namespace CalamityMod.CalPlayer (harpyRing ? 0.2 : 0D) + (reaverSpeed ? 0.1 : 0D) + (angelTreads ? 0.1 : 0D) + - (blueCandle ? 0.05 : 0D) + + (blueCandle ? CirrusBlueCandleBuff.WingTimeBoost : 0D) + (soaring ? 0.1 : 0D) + (prismaticGreaves ? 0.1 : 0D) + (plagueReaper ? 0.05 : 0D) + (ascendantInsignia ? 0.05 : 0D) + // Added to soaring insignia's flight to get 30% (Player.empressBrooch ? 0.25 : 0D); - if (blueCandle) - Player.moveSpeed += 0.05f; - if (community) { float baseBoost = TheCommunity.CalculatePower(); diff --git a/Items/Placeables/Furniture/ResilientCandle.cs b/Items/Placeables/Furniture/ResilientCandle.cs index 87c79ac75d..b076d3f27b 100644 --- a/Items/Placeables/Furniture/ResilientCandle.cs +++ b/Items/Placeables/Furniture/ResilientCandle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + Item.value = Item.buyPrice(platinum: 2); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/SpitefulCandle.cs b/Items/Placeables/Furniture/SpitefulCandle.cs index cef61b3d9b..82ef62991d 100644 --- a/Items/Placeables/Furniture/SpitefulCandle.cs +++ b/Items/Placeables/Furniture/SpitefulCandle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + Item.value = Item.buyPrice(platinum: 2); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/VigorousCandle.cs b/Items/Placeables/Furniture/VigorousCandle.cs index f5457c0f4a..136b9c8c54 100644 --- a/Items/Placeables/Furniture/VigorousCandle.cs +++ b/Items/Placeables/Furniture/VigorousCandle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + Item.value = Item.buyPrice(platinum: 2); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Items/Placeables/Furniture/WeightlessCandle.cs b/Items/Placeables/Furniture/WeightlessCandle.cs index 903f707f04..85fec2bbd9 100644 --- a/Items/Placeables/Furniture/WeightlessCandle.cs +++ b/Items/Placeables/Furniture/WeightlessCandle.cs @@ -19,8 +19,8 @@ namespace CalamityMod.Items.Placeables.Furniture Item.useTime = 10; Item.useStyle = ItemUseStyleID.Swing; Item.consumable = true; - Item.value = Item.buyPrice(0, 25, 0, 0); - Item.rare = ItemRarityID.LightRed; + Item.value = Item.buyPrice(platinum: 2); + Item.rare = ItemRarityID.Pink; Item.createTile = ModContent.TileType(); } } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 7a8bcf9910..e7843c0e46 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -465,17 +465,17 @@ CirrusBlueCandleBuff: { CirrusPinkCandleBuff: { DisplayName: Vigor - Description: Its brilliant light suffuses those nearby with hope + Description: The brilliant light suffuses you with hope } CirrusPurpleCandleBuff: { DisplayName: Resilience - Description: Neither rain nor wind can snuff its undying flame + Description: Neither rain nor wind can snuff your undying flame } CirrusYellowCandleBuff: { DisplayName: Spite - Description: Its hateful glow flickers with ire + Description: The hateful, flickering glow fuels your ire } CorruptionEffigyBuff: { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index ddb61fbc36..11eecccc2e 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -729,7 +729,9 @@ ResilientCandle: { DisplayName: Resilient Candle Tooltip: ''' - When placed, nearby players' defense blocks 10% more damage + when placed to make defense block 10% more damage + (60% in Classic, 85% in Expert, and 110% in Master) + This cannot be stacked with other Cirrus Candle buffs 'Neither rain nor wind can snuff its undying flame' ''' } @@ -748,8 +750,9 @@ SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: ''' - When placed, nearby enemies take 5% more damage. - This extra damage bypasses enemy damage reduction and defense + when placed to deal 1.07x damage to all enemies + The extra 0.07x damage bypasses enemy defense + This cannot be stacked with other Cirrus Candle buffs 'Its hateful glow flickers with ire' ''' } @@ -973,8 +976,9 @@ VigorousCandle: { DisplayName: Vigorous Candle Tooltip: ''' - When placed, nearby players regenerate 0.4% of their maximum health per second + when placed to regenerate 0.6% of your maximum health per second This regeneration is at full power even while moving and bypasses Revengeance Mode caps + This cannot be stacked with other Cirrus Candle buffs 'Its brilliant light suffuses those nearby with hope' ''' } @@ -983,7 +987,8 @@ WeightlessCandle: { DisplayName: Weightless Candle Tooltip: ''' - When placed, nearby players gain 5% increased movement speed, wing time and acceleration + when placed to gain 10% increased movement speed, wing time and acceleration + This cannot be stacked with other Cirrus Candle buffs 'The floating flame seems to uplift your very spirit' ''' } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 5e267f5447..b2a4ed9359 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -3221,14 +3221,6 @@ namespace CalamityMod.NPCs if (effectiveDR <= 0f) effectiveDR = 0f; - // Add Yellow Candle damage if the NPC isn't supposed to be "near invincible" - // Armor penetration has already been applied as bonus damage. - // Yellow Candle provides +5% damage which ignores both DR and defense. - // This means Yellow Candle is buffing armor penetration and technically not ignoring defense, - // but it's small enough to let it slide. - if (npc.HasBuff() && DR < 0.99f && npc.takenDamageMultiplier > 0.05f) - finalMultiplier += 0.05f; - // Calculate extra DR based on kill time, similar to the Hush boss from The Binding of Isaac // Cirrus being active makes the extra DR cease to function bool cirrusBossActive = false; diff --git a/Tiles/Furniture/BlueCandle.cs b/Tiles/Furniture/BlueCandle.cs index e174008003..ae874cba1a 100644 --- a/Tiles/Furniture/BlueCandle.cs +++ b/Tiles/Furniture/BlueCandle.cs @@ -2,9 +2,9 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; -using Terraria.DataStructures; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; -using Terraria.Localization; using Terraria.ModLoader; using Terraria.ObjectData; @@ -12,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class BlueCandle : ModTile { + // TODO -- Unique sounds for each Cirrus Candle. + public static readonly SoundStyle ActivationSound = new("CalamityMod/Sounds/Item/LouderPhantomPhoenix2"); + public override void SetStaticDefaults() { Main.tileLighted[Type] = true; @@ -22,9 +25,39 @@ namespace CalamityMod.Tiles.Furniture AdjTiles = new int[] { TileID.Candles }; AddToArray(ref TileID.Sets.RoomNeeds.CountsAsTorch); AddMapEntry(new Color(238, 145, 105), CalamityUtils.GetItemName()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.35f; diff --git a/Tiles/Furniture/BlueCandle_Highlight.png b/Tiles/Furniture/BlueCandle_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..02427f1b605d2f4f1c853368675f17ddb8c3bba5 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0ze$a!3HEZ8eGc;QjEnx?oJHr&dIz4a#+$GeI0>P z{oH>NS%G{%PZ!6K2=}*F47nH-c~}lqJo&HBS5Xm@s&1y4CMBA3GmAM&BGmN%?}=w* zUf1lq-h1`IlB56r?`mXtaY%`?!A@rq!;8ZZMngx3_>AMpcASyFje#cfrABzB`T8()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.75f; diff --git a/Tiles/Furniture/PinkCandle_Highlight.png b/Tiles/Furniture/PinkCandle_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..02427f1b605d2f4f1c853368675f17ddb8c3bba5 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0ze$a!3HEZ8eGc;QjEnx?oJHr&dIz4a#+$GeI0>P z{oH>NS%G{%PZ!6K2=}*F47nH-c~}lqJo&HBS5Xm@s&1y4CMBA3GmAM&BGmN%?}=w* zUf1lq-h1`IlB56r?`mXtaY%`?!A@rq!;8ZZMngx3_>AMpcASyFje#cfrABzB`T8()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -35,15 +68,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player is null) - return; - if (!player.dead && player.active) - player.AddBuff(ModContent.BuffType(), 20); - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.65f; diff --git a/Tiles/Furniture/PurpleCandle_Highlight.png b/Tiles/Furniture/PurpleCandle_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..02427f1b605d2f4f1c853368675f17ddb8c3bba5 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0ze$a!3HEZ8eGc;QjEnx?oJHr&dIz4a#+$GeI0>P z{oH>NS%G{%PZ!6K2=}*F47nH-c~}lqJo&HBS5Xm@s&1y4CMBA3GmAM&BGmN%?}=w* zUf1lq-h1`IlB56r?`mXtaY%`?!A@rq!;8ZZMngx3_>AMpcASyFje#cfrABzB`T8()); + TileID.Sets.HasOutlines[Type] = true; AnimationFrameHeight = 18; } + public override bool HasSmartInteract(int i, int j, SmartInteractScanSettings settings) => true; + + public override bool RightClick(int i, int j) + { + Player p = Main.LocalPlayer; + + // Forcibly remove all candle buffs. + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + p.ClearBuff(ModContent.BuffType()); + + // 108000 is the duration used by Ammo Box. + p.AddBuff(ModContent.BuffType(), 108000); + + // Play a sound. + SoundEngine.PlaySound(ActivationSound, new Vector2(i * 16, j * 16)); + + return true; + } + + public override void MouseOver(int i, int j) + { + Player player = Main.LocalPlayer; + player.noThrow = 2; + player.cursorItemIconEnabled = true; + player.cursorItemIconID = ModContent.ItemType(); + } + public override void AnimateTile(ref int frame, ref int frameCounter) { frameCounter++; @@ -32,29 +67,6 @@ namespace CalamityMod.Tiles.Furniture } } - public override void NearbyEffects(int i, int j, bool closer) - { - Player player = Main.LocalPlayer; - if (player == null || !player.active || player.dead) - return; - player.AddBuff(ModContent.BuffType(), 20); - - if (Main.netMode == NetmodeID.MultiplayerClient) - return; - - // All NPCs within a certain distance of the player get "Tagged" with Spite. - for (int m = 0; m < Main.maxNPCs; m++) - { - NPC npc = Main.npc[m]; - if (npc is null || !npc.active || npc.friendly) - continue; - - float dist2 = npc.DistanceSQ(player.Center); - if (dist2 < 23040000f) // 4800px range - Main.npc[m].AddBuff(ModContent.BuffType(), 20, false); - } - } - public override void ModifyLight(int i, int j, ref float r, ref float g, ref float b) { r = 0.75f; diff --git a/Tiles/Furniture/YellowCandle_Highlight.png b/Tiles/Furniture/YellowCandle_Highlight.png new file mode 100644 index 0000000000000000000000000000000000000000..02427f1b605d2f4f1c853368675f17ddb8c3bba5 GIT binary patch literal 190 zcmeAS@N?(olHy`uVBq!ia0vp^0ze$a!3HEZ8eGc;QjEnx?oJHr&dIz4a#+$GeI0>P z{oH>NS%G{%PZ!6K2=}*F47nH-c~}lqJo&HBS5Xm@s&1y4CMBA3GmAM&BGmN%?}=w* zUf1lq-h1`IlB56r?`mXtaY%`?!A@rq!;8ZZMngx3_>AMpcASyFje#cfrABzB`T8 Date: Fri, 31 May 2024 22:52:59 -0400 Subject: [PATCH 2/7] Yellow Candle now applies to projectiles, no longer restricted to Use Style 1 Broadswords. --- CalPlayer/CalamityPlayerHitHurt.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 2ad91438aa..456ca387b0 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -531,7 +531,7 @@ namespace CalamityMod.CalPlayer // // FinalDamage.Flat would technically be closer to the intended implementation, but is heavily discouraged from use and would cause huge cross-mod issues CalamityGlobalNPC cgn = target.Calamity(); - if (Player.HasBuff() && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) modifiers.FinalDamage.Base *= 1f + CirrusYellowCandleBuff.ExtraChipDamageRatio; // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. @@ -600,6 +600,15 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 31MAY2024: Ozzatron: apply Yellow Candle "chip damage" in a different way, by adjusting FinalDamage.Base + // This is still gated by the old conditionals to ensure it doesn't apply to "near invincible" targets + // Calamity's DR is also implemented at the FinalDamage step as a multiplier so Yellow Candle doesn't ignore DR anymore (and has been buffed to compensate) + // + // FinalDamage.Flat would technically be closer to the intended implementation, but is heavily discouraged from use and would cause huge cross-mod issues + CalamityGlobalNPC cgn = target.Calamity(); + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.FinalDamage.Base *= 1f + CirrusYellowCandleBuff.ExtraChipDamageRatio; + // Stealth strike damage multipliers are applied here. // TODO -- stealth should be its own damage class and this should be applied as player StealthDamage *= XYZ if (proj.Calamity().stealthStrike && proj.CountsAsClass()) From d4f227078736710f799aa35027fd2da127d6a5cc Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 1 Jun 2024 16:49:55 -0400 Subject: [PATCH 3/7] 1 - Nerfed Yellow Candle from 1.07x to 1.04x but it ignores DR again as intended. 2 - Fixed Yellow Candle being placebo, for real this time. --- Buffs/Placeables/CirrusYellowCandleBuff.cs | 10 +++++++++- CalPlayer/CalamityPlayerHitHurt.cs | 18 ++++++++---------- .../Mods.CalamityMod.Items.Placeables.hjson | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/CirrusYellowCandleBuff.cs index 69a60673c7..69fd6f35c9 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -1,12 +1,13 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; +using static Terraria.NPC; namespace CalamityMod.Buffs.Placeables { public class CirrusYellowCandleBuff : ModBuff { - public static float ExtraChipDamageRatio = 0.07f; + public static float ExtraChipDamageRatio = 0.04f; public override void SetStaticDefaults() { @@ -25,5 +26,12 @@ namespace CalamityMod.Buffs.Placeables // Implementation is performed elsewhere using the yellowCandle bool. public override void Update(Player player, ref int buffIndex) => player.Calamity().yellowCandle = true; + + // Yellow Candle is implemented as a dirty modifier. + internal static void ModifyHitInfo_Spite(ref HitInfo info) + { + int damageBoost = (int)(info.SourceDamage * ExtraChipDamageRatio); + info.Damage += damageBoost; + } } } diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 456ca387b0..aca930da03 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -525,14 +525,13 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; - // 31MAY2024: Ozzatron: apply Yellow Candle "chip damage" in a different way, by adjusting FinalDamage.Base - // This is still gated by the old conditionals to ensure it doesn't apply to "near invincible" targets - // Calamity's DR is also implemented at the FinalDamage step as a multiplier so Yellow Candle doesn't ignore DR anymore (and has been buffed to compensate) + // 01JUN2024: Ozzatron: apply Yellow Candle "chip damage" as a dirty modifier + // The registration of the dirty modifier is conditional to ensure it doesn't apply to "near invincible" targets // - // FinalDamage.Flat would technically be closer to the intended implementation, but is heavily discouraged from use and would cause huge cross-mod issues + // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.FinalDamage.Base *= 1f + CirrusYellowCandleBuff.ExtraChipDamageRatio; + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) @@ -600,14 +599,13 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; - // 31MAY2024: Ozzatron: apply Yellow Candle "chip damage" in a different way, by adjusting FinalDamage.Base - // This is still gated by the old conditionals to ensure it doesn't apply to "near invincible" targets - // Calamity's DR is also implemented at the FinalDamage step as a multiplier so Yellow Candle doesn't ignore DR anymore (and has been buffed to compensate) + // 01JUN2024: Ozzatron: apply Yellow Candle "chip damage" as a dirty modifier + // The registration of the dirty modifier is conditional to ensure it doesn't apply to "near invincible" targets // - // FinalDamage.Flat would technically be closer to the intended implementation, but is heavily discouraged from use and would cause huge cross-mod issues + // FinalDamage cannot be used for the intended effect because there is no way to access the actual damage of the hit CalamityGlobalNPC cgn = target.Calamity(); if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) - modifiers.FinalDamage.Base *= 1f + CirrusYellowCandleBuff.ExtraChipDamageRatio; + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; // Stealth strike damage multipliers are applied here. // TODO -- stealth should be its own damage class and this should be applied as player StealthDamage *= XYZ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 11eecccc2e..8f64b995fd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -750,8 +750,8 @@ SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: ''' - when placed to deal 1.07x damage to all enemies - The extra 0.07x damage bypasses enemy defense + when placed to deal 1.04x damage to all enemies + The extra 0.04x damage bypasses enemy defense and damage reduction This cannot be stacked with other Cirrus Candle buffs 'Its hateful glow flickers with ire' ''' From fa8b21c32177d0d6fc824b6d5ec5b1fa3ddce6c6 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Sat, 1 Jun 2024 18:01:42 -0400 Subject: [PATCH 4/7] Reverted Pink Candle buff from 0.6% HP/s to 0.4% HP/s --- Buffs/Placeables/CirrusPinkCandleBuff.cs | 2 +- Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Buffs/Placeables/CirrusPinkCandleBuff.cs b/Buffs/Placeables/CirrusPinkCandleBuff.cs index cde31c0c50..8cf6bc1437 100644 --- a/Buffs/Placeables/CirrusPinkCandleBuff.cs +++ b/Buffs/Placeables/CirrusPinkCandleBuff.cs @@ -6,7 +6,7 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusPinkCandleBuff : ModBuff { - public static double PercentHealthPerSecond = 0.006D; + public static double PercentHealthPerSecond = 0.004D; public override void SetStaticDefaults() { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 8f64b995fd..11471412cf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -976,7 +976,7 @@ VigorousCandle: { DisplayName: Vigorous Candle Tooltip: ''' - when placed to regenerate 0.6% of your maximum health per second + when placed to regenerate 0.4% of your maximum health per second This regeneration is at full power even while moving and bypasses Revengeance Mode caps This cannot be stacked with other Cirrus Candle buffs 'Its brilliant light suffuses those nearby with hope' From 863c3cb99a285fb363f10f1bde468652c715a024 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 1 Jun 2024 19:18:07 -0400 Subject: [PATCH 5/7] Spiteful Candle buff --- Buffs/Placeables/CirrusYellowCandleBuff.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Buffs/Placeables/CirrusYellowCandleBuff.cs b/Buffs/Placeables/CirrusYellowCandleBuff.cs index 69fd6f35c9..1b5f9a7f96 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -7,7 +7,7 @@ namespace CalamityMod.Buffs.Placeables { public class CirrusYellowCandleBuff : ModBuff { - public static float ExtraChipDamageRatio = 0.04f; + public static float ExtraChipDamageRatio = 0.07f; public override void SetStaticDefaults() { From 42d58f3867c8e4ced378978366635177d8a83386 Mon Sep 17 00:00:00 2001 From: mountaindrew10 Date: Sat, 1 Jun 2024 18:34:40 -0500 Subject: [PATCH 6/7] Version bump --- build.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.txt b/build.txt index b80ad208f0..cf9028fcf7 100644 --- a/build.txt +++ b/build.txt @@ -1,5 +1,5 @@ author = Fabsol and the Dev Team -version = 2.0.4.002 +version = 2.0.4.003 displayName = Calamity Mod modReferences = CalamityModMusic homepage = https://discord.gg/calamity From 36fe426cbe64bc1bdf7692fe711c6611b3fa9a1a Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 1 Jun 2024 20:16:54 -0400 Subject: [PATCH 7/7] Fixed Spiteful Candle's tooltip --- Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson index 11471412cf..4c0d8b539a 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Placeables.hjson @@ -750,8 +750,8 @@ SpitefulCandle: { DisplayName: Spiteful Candle Tooltip: ''' - when placed to deal 1.04x damage to all enemies - The extra 0.04x damage bypasses enemy defense and damage reduction + when placed to deal 1.07x damage to all enemies + The extra 0.07x damage bypasses enemy defense and damage reduction This cannot be stacked with other Cirrus Candle buffs 'Its hateful glow flickers with ire' '''