diff --git a/Cooldowns/PanaceaCooldown.cs b/Cooldowns/PanaceaCooldown.cs new file mode 100644 index 0000000000..cc2e416f71 --- /dev/null +++ b/Cooldowns/PanaceaCooldown.cs @@ -0,0 +1,18 @@ +using Microsoft.Xna.Framework; +using Terraria.Audio; +using Terraria.Localization; + +namespace CalamityMod.Cooldowns +{ + public class PanaceaCooldown : CooldownHandler + { + public static new string ID => "Panacea"; + public override bool ShouldDisplay => true; + public override LocalizedText DisplayName => CalamityUtils.GetText($"UI.Cooldowns.{ID}"); + public override string Texture => "CalamityMod/Cooldowns/PanaceaCooldown"; + public override Color OutlineColor => new Color(122, 198, 255); + public override Color CooldownStartColor => new Color(0, 128, 255); + public override Color CooldownEndColor => new Color(0, 255, 255); + public override SoundStyle? EndSound => new("CalamityMod/Sounds/Custom/AbilitySounds/PotionSicknessOver"); + } +} diff --git a/Cooldowns/PanaceaCooldown.png b/Cooldowns/PanaceaCooldown.png new file mode 100644 index 0000000000..290132735c Binary files /dev/null and b/Cooldowns/PanaceaCooldown.png differ diff --git a/Cooldowns/PanaceaCooldownOutline.png b/Cooldowns/PanaceaCooldownOutline.png new file mode 100644 index 0000000000..f31edcf0b4 Binary files /dev/null and b/Cooldowns/PanaceaCooldownOutline.png differ diff --git a/Cooldowns/PanaceaCooldownOverlay.png b/Cooldowns/PanaceaCooldownOverlay.png new file mode 100644 index 0000000000..7d72fd3769 Binary files /dev/null and b/Cooldowns/PanaceaCooldownOverlay.png differ diff --git a/Items/Potions/BottledPanacea.cs b/Items/Potions/BottledPanacea.cs new file mode 100644 index 0000000000..347e59c2f1 --- /dev/null +++ b/Items/Potions/BottledPanacea.cs @@ -0,0 +1,67 @@ +using CalamityMod.Cooldowns; +using CalamityMod.DataStructures; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Items.Potions +{ + public class BottledPanacea : ModItem, ILocalizedModType + { + public new string LocalizationCategory => "Items.Potions"; + + public override void SetStaticDefaults() + { + Item.ResearchUnlockCount = 20; + ItemID.Sets.DrinkParticleColors[Type] = new Color[2] { + new Color(84, 215, 254), + new Color(35, 101, 192) + }; + } + + public override void SetDefaults() + { + Item.UseSound = SoundID.Item3; + Item.useStyle = ItemUseStyleID.DrinkLiquid; + Item.useTurn = true; + Item.useTime = Item.useAnimation = 17; + Item.maxStack = Item.CommonMaxStack; + Item.consumable = true; + Item.value = Item.sellPrice(silver: 2); + Item.rare = ItemRarityID.Blue; + } + + public override bool CanUseItem(Player player) => !player.HasCooldown(PanaceaCooldown.ID); + + public override bool? UseItem(Player player) + { + if (player.itemAnimation > 0 && player.itemTime == 0) + { + player.itemTime = Item.useTime; + SoundEngine.PlaySound(SoundID.Item4, player.Center); + + for (int i = Player.MaxBuffs - 1; i >= 0; i--) + { + int buffType = player.buffType[i]; + if (BuffDatasets.DebuffDataset[buffType] is not null && (BuffDatasets.DebuffDataset[buffType].SicknessDebuffScaling > 0 || BuffDatasets.DebuffDataset[buffType].ElectricDebuffScaling > 0)) + player.DelBuff(i); + } + + for (int i = 0; i < 4; i++) + { + Vector2 plusVel = new Vector2(Main.rand.NextFloat(-0.55f, 0.55f), Main.rand.NextFloat(-6f, 0f)); + HealingPlus plus = new(Main.rand.NextVector2FromRectangle(player.Hitbox), Main.rand.NextFloat(1.25f, 1.5f), plusVel, Color.SkyBlue, Color.SkyBlue, 20); + GeneralParticleHandler.SpawnParticle(plus); + } + for (int d = 0; d < 10; d++) + Dust.NewDust(player.position, player.width, player.height, DustID.BlueTorch); + + player.AddCooldown(PanaceaCooldown.ID, CalamityUtils.SecondsToFrames(30)); + } + return true; + } + } +} diff --git a/Items/Potions/BottledPanacea.png b/Items/Potions/BottledPanacea.png new file mode 100644 index 0000000000..8a98e6f6bf Binary files /dev/null and b/Items/Potions/BottledPanacea.png differ diff --git a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson index fe583cd6b0..8f627dff88 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Potions.hjson @@ -36,6 +36,15 @@ BlasphemousDonut: { ''' } +BottledPanacea: { + DisplayName: Bottled Panacea + Tooltip: + ''' + Cures you of all sickness and electricity debuffs when consumed + This has a 30 second cooldown + ''' +} + BoundingPotion: { DisplayName: Bounding Potion Tooltip: "{0}% increased jump speed and {1}% increased jump height" diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson index 447903f9c0..87001e5c43 100644 --- a/Localization/en-US/Mods.CalamityMod.UI.hjson +++ b/Localization/en-US/Mods.CalamityMod.UI.hjson @@ -127,6 +127,7 @@ Cooldowns: { OldDukeScalesFatigue: Stamina OmegaBlueActive: Abyssal Madness OmegaBlueCooldown: Abyssal Madness Cooldown + Panacea: Panacea Cooldown PermafrostConcoction: Permafrost's Concoction Cooldown PlagueBlackout: Plague Blackout Cooldown PotionSickness: Healing Cooldown diff --git a/NPCs/SunkenSea/PolypPanasea.cs b/NPCs/SunkenSea/PolypPanasea.cs index 384e6de48e..8d25c15808 100644 --- a/NPCs/SunkenSea/PolypPanasea.cs +++ b/NPCs/SunkenSea/PolypPanasea.cs @@ -16,6 +16,7 @@ using CalamityMod.Enums; using System.IO; using CalamityMod.Particles; using Terraria.Audio; +using CalamityMod.Items.Potions; namespace CalamityMod.NPCs.SunkenSea { @@ -480,8 +481,7 @@ namespace CalamityMod.NPCs.SunkenSea { if (PanaceaTimer > 60) { - // TODO: add actual panacea item - Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ItemID.FlaskofPoison); + Item.NewItem(NPC.GetSource_CatchEntity(NPC), (int)NPC.Center.X, (int)NPC.Center.Y, 1, 1, ModContent.ItemType()); PanaceaTimer = 60; } return false;