diff --git a/Buffs/Potions/SwinesWrathBuff.cs b/Buffs/Potions/SwinesWrathBuff.cs index 873555d6c3..14ae221f5b 100644 --- a/Buffs/Potions/SwinesWrathBuff.cs +++ b/Buffs/Potions/SwinesWrathBuff.cs @@ -1,4 +1,5 @@ -using CalamityMod.DataStructures; +using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Potions; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -16,6 +17,7 @@ namespace CalamityMod.Buffs.Potions public class SwinesWrathBuff : ModBuff { public static readonly SoundStyle TimerSound = new("CalamityMod/Sounds/Custom/TickingTimer"); + public static readonly SoundStyle TimerSound2 = new("CalamityMod/Sounds/Custom/TickingTimerReverb"); public override void SetStaticDefaults() { @@ -33,10 +35,14 @@ namespace CalamityMod.Buffs.Potions { player.KillMe(PlayerDeathReason.ByCustomReason(CalamityUtils.GetText("Status.Death.SwinesWrath" + Main.rand.Next(1, 7 + 1)).ToNetworkText(player.name)), 1000, -1); concoctionPlayer.swinesWrathCounter = -1; + concoctionPlayer.spamTimer = 0; } else if (concoctionPlayer.swinesWrathCounter % 60 == 59) - SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f) }, player.Center); // Gets louder as time progresses + { + SoundEngine.PlaySound(TimerSound2 with { Volume = MathF.Pow((600f - concoctionPlayer.swinesWrathCounter) / 600f, 2) * 0.8f, MaxInstances = -1 }, player.Center); // Gets louder as time progresses + SoundEngine.PlaySound(TimerSound with { Volume = ((600f - concoctionPlayer.swinesWrathCounter) / 600f), MaxInstances = -1 }, player.Center); // Gets louder as time progresses + } } } } diff --git a/Items/Potions/TheConcoction.cs b/Items/Potions/TheConcoction.cs index 6744a353bc..402cd75755 100644 --- a/Items/Potions/TheConcoction.cs +++ b/Items/Potions/TheConcoction.cs @@ -1,8 +1,11 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using CalamityMod.Buffs.Potions; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Rarities; +using CalamityMod.Scenes.MusicScenes; using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; @@ -15,7 +18,7 @@ namespace CalamityMod.Items.Potions public class TheConcoction : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Potions"; - + public static int healValue = 9999; public override void SetStaticDefaults() { Item.ResearchUnlockCount = 30; @@ -26,15 +29,16 @@ namespace CalamityMod.Items.Potions new Color(246, 34, 79) }; } - public override void SetDefaults() { - Item.DefaultToHealingPotion(50, 56, 500); + Item.DefaultToHealingPotion(50, 56, healValue); Item.value = Item.buyPrice(gold: 1); Item.rare = ItemRarityID.Green; } - - + public override bool CanUseItem(Player player) + { + return true; + } public override void OnConsumeItem(Player player) { TheConcoctionPlayer concoctionPlayer = player.GetModPlayer(); @@ -59,12 +63,39 @@ namespace CalamityMod.Items.Potions public class TheConcoctionPlayer : ModPlayer { public int swinesWrathCounter = -1; + public int spamTimer = 0; + public bool holdingHeal = false; public int hoverTimer = 0; public bool wasHovering = false; public override void PostUpdate() { + if (!holdingHeal && Player.controlQuickHeal && spamTimer >= 0 && Player.InventoryHas(ModContent.ItemType())) + { + Vector2 vel = -Vector2.UnitY.RotatedByRandom(0.4f); + Particle chug = new CustomSpark(Player.Center + vel * 35, vel * Main.rand.NextFloat(2, 3), "CalamityMod/Items/Potions/TheConcoction", false, 22, 0.6f, Color.White, Vector2.One, false, false, 0, false, false, noShrink: true, spin: 0.01f * Math.Sign(vel.X)); + GeneralParticleHandler.SpawnParticle(chug); + SoundStyle tryChug = new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver"); + SoundEngine.PlaySound(tryChug with { pitch = Main.rand.NextFloat(0.6f, 0.8f), MaxInstances = -1 }, Player.Center); + spamTimer += 80; + if (spamTimer > 230) + spamTimer = 230; + holdingHeal = true; + } + if (!Player.controlQuickHeal) + holdingHeal = false; + if (spamTimer > 0) + spamTimer--; + if (spamTimer >= 180) + { + SoundEngine.PlaySound(SoundID.Item3, Player.Center); + Player.HealPlayer(TheConcoction.healValue); + Player.ConsumeItem(ModContent.ItemType()); + swinesWrathCounter = 1200; + spamTimer = -1; + } + if (swinesWrathCounter > 0) { swinesWrathCounter--; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index 86f15ed0cf..006dc5d065 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -159,8 +159,8 @@ SupremeManaPotion: { TheConcoction: { DisplayName: The Concoction - EasterEggText: Removes 500 life - Tooltip: "" + EasterEggText: Removes 9999 life + Tooltip: "Can even be used while you have potion sickness if Quick Heal is repeatedly pressed" SalesPitch: ''' 'Aren't you tired of how unreliable your healing potions are? What if you're in the middle of a zombie horde and sick to the core of those things?!' diff --git a/Scenes/MusicScenes/TheConcoctionMusicScene.cs b/Scenes/MusicScenes/TheConcoctionMusicScene.cs new file mode 100644 index 0000000000..45079987e4 --- /dev/null +++ b/Scenes/MusicScenes/TheConcoctionMusicScene.cs @@ -0,0 +1,18 @@ +using CalamityMod.Items.Potions; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Scenes.MusicScenes +{ + public class TheConcoctionMusicScene : ModSceneEffect + { + public override bool IsSceneEffectActive(Player player) + { + TheConcoctionPlayer concoctionPlayer = Main.LocalPlayer.GetModPlayer(); + return (concoctionPlayer.swinesWrathCounter <= 600 && concoctionPlayer.swinesWrathCounter != -1); + } + public override int Music => MusicLoader.GetMusicSlot(Mod, "Sounds/Music/Silence"); + + public override SceneEffectPriority Priority => SceneEffectPriority.BossHigh; + } +} diff --git a/Sounds/Custom/TickingTimerReverb.ogg b/Sounds/Custom/TickingTimerReverb.ogg new file mode 100644 index 0000000000..5dd9dedc4d Binary files /dev/null and b/Sounds/Custom/TickingTimerReverb.ogg differ