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..8cf6bc1437 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.004D; + 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..1b5f9a7f96 100644 --- a/Buffs/Placeables/CirrusYellowCandleBuff.cs +++ b/Buffs/Placeables/CirrusYellowCandleBuff.cs @@ -1,24 +1,37 @@ 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 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; + + // 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/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..aca930da03 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,14 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 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 cannot be used for the intended effect because there is no way to access the actual damage of the hit + CalamityGlobalNPC cgn = target.Calamity(); + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + // Excalibur and True Excalibur deal +100% damage to targets above 75% HP. if (item.type == ItemID.Excalibur || item.type == ItemID.TrueExcalibur) { @@ -590,6 +599,14 @@ namespace CalamityMod.CalPlayer // Apply all Calamity multipliers as a sum total to TML New Damage in a single step modifiers.SourceDamage *= totalDamageMult; + // 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 cannot be used for the intended effect because there is no way to access the actual damage of the hit + CalamityGlobalNPC cgn = target.Calamity(); + if (yellowCandle && cgn.DR < 0.99f && target.takenDamageMultiplier > 0.05f) + modifiers.ModifyHitInfo += CirrusYellowCandleBuff.ModifyHitInfo_Spite; + // 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()) 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..4c0d8b539a 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 and damage reduction + 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.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' ''' } @@ -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 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/BlueCandle_Highlight.png differ diff --git a/Tiles/Furniture/PinkCandle.cs b/Tiles/Furniture/PinkCandle.cs index fd4a947066..3ffb8dbfab 100644 --- a/Tiles/Furniture/PinkCandle.cs +++ b/Tiles/Furniture/PinkCandle.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 PinkCandle : 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.75f; diff --git a/Tiles/Furniture/PinkCandle_Highlight.png b/Tiles/Furniture/PinkCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/PinkCandle_Highlight.png differ diff --git a/Tiles/Furniture/PurpleCandle.cs b/Tiles/Furniture/PurpleCandle.cs index 232603c410..31d1864cf7 100644 --- a/Tiles/Furniture/PurpleCandle.cs +++ b/Tiles/Furniture/PurpleCandle.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 PurpleCandle : 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.65f; diff --git a/Tiles/Furniture/PurpleCandle_Highlight.png b/Tiles/Furniture/PurpleCandle_Highlight.png new file mode 100644 index 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/PurpleCandle_Highlight.png differ diff --git a/Tiles/Furniture/YellowCandle.cs b/Tiles/Furniture/YellowCandle.cs index 54779eadf4..177df09292 100644 --- a/Tiles/Furniture/YellowCandle.cs +++ b/Tiles/Furniture/YellowCandle.cs @@ -2,6 +2,8 @@ using CalamityMod.Items.Placeables.Furniture; using Microsoft.Xna.Framework; using Terraria; +using Terraria.Audio; +using Terraria.GameContent.ObjectInteractions; using Terraria.ID; using Terraria.ModLoader; using Terraria.ObjectData; @@ -10,6 +12,9 @@ namespace CalamityMod.Tiles.Furniture { public class YellowCandle : 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; @@ -19,9 +24,39 @@ namespace CalamityMod.Tiles.Furniture TileObjectData.addTile(Type); 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++; @@ -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 0000000000..02427f1b60 Binary files /dev/null and b/Tiles/Furniture/YellowCandle_Highlight.png differ 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