From a7223cc0438a9c8da92bdcc17f7221ea2e363fa1 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 4 Aug 2023 01:22:06 -0700 Subject: [PATCH] Mana Jelly -> Cleansing Jelly and rework Using a healing potion will spawn an aura that cleanses all debuffs and defense damage once --- CalPlayer/CalamityPlayer.cs | 7 + CalPlayer/CalamityPlayerMiscEffects.cs | 12 +- .../{ManaJelly.cs => CleansingJelly.cs} | 10 +- .../{ManaJelly.png => CleansingJelly.png} | Bin Items/Accessories/GrandGelatin.cs | 2 +- .../en-US/Mods.CalamityMod.Buffs.hjson | 2 +- .../Mods.CalamityMod.Items.Accessories.hjson | 8 +- NPCs/Abyss/MirageJelly.cs | 2 +- NPCs/CalamityGlobalNPCLoot.cs | 4 +- Projectiles/Typeless/BlueJellyAura.cs | 138 ++++++++++++++++++ Projectiles/Typeless/PinkJellyAura.cs | 5 +- en-US.hjson | 11 +- 12 files changed, 182 insertions(+), 19 deletions(-) rename Items/Accessories/{ManaJelly.cs => CleansingJelly.cs} (65%) rename Items/Accessories/{ManaJelly.png => CleansingJelly.png} (100%) create mode 100644 Projectiles/Typeless/BlueJellyAura.cs diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index a011fddd8a..c20dc54ad7 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -497,6 +497,8 @@ namespace CalamityMod.CalPlayer public bool abaddon = false; public bool aeroStone = false; public bool lifejelly = false; + public bool cleansingjelly = false; + public int CleansingEffect = 0; public bool community = false; public bool shatteredCommunity = false; public bool fleshTotem = false; @@ -1569,6 +1571,7 @@ namespace CalamityMod.CalPlayer abaddon = false; aeroStone = false; lifejelly = false; + cleansingjelly = false; community = false; shatteredCommunity = false; stressPills = false; @@ -3209,6 +3212,10 @@ namespace CalamityMod.CalPlayer if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && lifejelly) Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + //Cleansing Jelly regen aura spawn when using a healing potion + if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && cleansingjelly) + Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + if (snowman) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index ce27fe0619..df79920985 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -3553,7 +3553,7 @@ namespace CalamityMod.CalPlayer #region Defense Effects private void DefenseEffects() { - // + //yeshere // Defense Damage // // Current defense damage can be calculated at any time using the accessor property CurrentDefenseDamage. @@ -3570,6 +3570,16 @@ namespace CalamityMod.CalPlayer // (in addition to the player taking more defense damage, of course). if (totalDefenseDamage > 0) { + //Used to cleanse all defense damage by accessories + if (CleansingEffect == 1) + { + totalDefenseDamage = 0; + defenseDamageRecoveryFrames = 0; + totalDefenseDamageRecoveryFrames = DefenseDamageBaseRecoveryTime; + defenseDamageDelayFrames = 0; + CleansingEffect = 0; + } + // Defense damage is capped at your maximum defense, no matter what. if (totalDefenseDamage > Player.statDefense) totalDefenseDamage = Player.statDefense; diff --git a/Items/Accessories/ManaJelly.cs b/Items/Accessories/CleansingJelly.cs similarity index 65% rename from Items/Accessories/ManaJelly.cs rename to Items/Accessories/CleansingJelly.cs index 3f978e6527..8656f91b69 100644 --- a/Items/Accessories/ManaJelly.cs +++ b/Items/Accessories/CleansingJelly.cs @@ -2,10 +2,11 @@ using Terraria; using Terraria.ModLoader; using Terraria.ID; +using CalamityMod.CalPlayer; namespace CalamityMod.Items.Accessories { - public class ManaJelly : ModItem, ILocalizedModType + public class CleansingJelly : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; public override void SetDefaults() @@ -19,11 +20,8 @@ namespace CalamityMod.Items.Accessories public override void UpdateAccessory(Player player, bool hideVisual) { - player.statManaMax2 += 20; - if ((double)Math.Abs(player.velocity.X) < 0.05 && (double)Math.Abs(player.velocity.Y) < 0.05 && player.itemAnimation == 0) - { - player.manaRegenBonus += 4; - } + CalamityPlayer modPlayer = player.Calamity(); + modPlayer.cleansingjelly = true; } } } diff --git a/Items/Accessories/ManaJelly.png b/Items/Accessories/CleansingJelly.png similarity index 100% rename from Items/Accessories/ManaJelly.png rename to Items/Accessories/CleansingJelly.png diff --git a/Items/Accessories/GrandGelatin.cs b/Items/Accessories/GrandGelatin.cs index 5c9271d321..cb398cd96b 100644 --- a/Items/Accessories/GrandGelatin.cs +++ b/Items/Accessories/GrandGelatin.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Items.Accessories public override void AddRecipes() { CreateRecipe(). - AddIngredient(). + AddIngredient(). AddIngredient(). AddIngredient(). AddIngredient(ItemID.SoulofLight, 2). diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index caab8b3e31..9a4d9040f9 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1474,5 +1474,5 @@ WulfrumDroidBuff: { PinkJellyRegen: { DisplayName: Pink Jelly Regen - Description: You feel refreshed by the power of goo, life regen increased by 4 + Description: The power of goo refreshes you, life regen increased by 4 } \ No newline at end of file diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index d15fa726d4..ce00120e5c 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1021,12 +1021,12 @@ LuxorsGift: { ''' } -ManaJelly: { - DisplayName: Mana Jelly +CleansingJelly: { + DisplayName: Cleansing Jelly Tooltip: ''' - +20 max mana - Standing still boosts mana regen + Using a healing potion will spawn an aura that cleanses + all debuffs and defense damage once ''' } diff --git a/NPCs/Abyss/MirageJelly.cs b/NPCs/Abyss/MirageJelly.cs index dd2b8e65d5..81425f34d7 100644 --- a/NPCs/Abyss/MirageJelly.cs +++ b/NPCs/Abyss/MirageJelly.cs @@ -223,7 +223,7 @@ namespace CalamityMod.NPCs.Abyss postClone.Add(DropHelper.NormalVsExpertQuantity(ModContent.ItemType(), 2, 5, 7, 10, 14)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 5)); npcLoot.Add(ItemID.JellyfishNecklace, 10); } diff --git a/NPCs/CalamityGlobalNPCLoot.cs b/NPCs/CalamityGlobalNPCLoot.cs index 59a4850809..12af95ce22 100644 --- a/NPCs/CalamityGlobalNPCLoot.cs +++ b/NPCs/CalamityGlobalNPCLoot.cs @@ -255,9 +255,9 @@ namespace CalamityMod.NPCs break; // Blue Jellyfish - // Mana Jelly @ 14.29% Normal, 25% Expert+ + // Cleansing Jelly @ 14.29% Normal, 25% Expert+ case NPCID.BlueJellyfish: - npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); + npcLoot.Add(ItemDropRule.NormalvsExpert(ModContent.ItemType(), 7, 4)); break; // Green Jellyfish diff --git a/Projectiles/Typeless/BlueJellyAura.cs b/Projectiles/Typeless/BlueJellyAura.cs new file mode 100644 index 0000000000..445d99ca68 --- /dev/null +++ b/Projectiles/Typeless/BlueJellyAura.cs @@ -0,0 +1,138 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatBuffs; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Typless +{ + public class BlueJellyAura : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Typless"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public Player Owner => Main.player[Projectile.owner]; + private static float Radius = 160f; + public int ShinkGrow = 0; + public int Framecounter = 0; + public int CleanseOnce = 1; + public int PulseOnce = 1; + public int PulseOnce2 = 1; + public int PulseOnce3 = 1; + public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal1") { Volume = 0.5f }; + public ref int CleansingEffect => ref Main.player[Projectile.owner].Calamity().CleansingEffect; + + public override void SetDefaults() + { + //These shouldn't matter because its circular + Projectile.width = 336; + Projectile.height = 336; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Default; + Projectile.ignoreWater = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = 2710; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 10; + } + + public override void AI() + { + Framecounter++; + + for (int playerIndex = 0; playerIndex < Main.maxPlayers; playerIndex++) + { + Player player = Main.player[playerIndex]; + float targetDist = Vector2.Distance(player.Center, Projectile.Center); + + //Remove the players debuffs and defense damage, but only once per aura + if (targetDist < 155f && CleanseOnce == 1) + { + CleansingEffect = 1; + for (int l = 0; l < Player.MaxBuffs; l++) + { + int hasBuff = player.buffType[l]; + if (player.buffTime[l] > 2 && CalamityLists.debuffList.Contains(hasBuff)) + { + player.buffTime[l] *= 0; + } + } + CleanseOnce = 0; + } + } + + if (ShinkGrow == 0) + { + if (PulseOnce == 1) + { + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.05f }, Projectile.Center); + Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 0f, 2f, 10); + GeneralParticleHandler.SpawnParticle(pulse); + PulseOnce = 0; + } + + if (Framecounter == 10) + { + ShinkGrow = 1; + } + } + if (ShinkGrow == 1) + { + if (PulseOnce2 == 1) + { + Particle pulse2 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 2f, 2f, 2700); + GeneralParticleHandler.SpawnParticle(pulse2); + PulseOnce2 = 0; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 59); + dust.scale = Main.rand.NextFloat(2.2f, 3.3f); + dust.noGravity = true; + } + + for (int i = 0; i < 1; i++) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(150f, 150f), 59); + dust.scale = Main.rand.NextFloat(0.8f, 1.3f); + dust.noGravity = true; + } + + if (Framecounter == 2710) + { + ShinkGrow = 2; + } + } + if (ShinkGrow == 2) + { + if (PulseOnce3 == 1) + { + Particle pulse3 = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.RoyalBlue, new Vector2(1f, 1f), 0f, 2f, 0f, 10); + GeneralParticleHandler.SpawnParticle(pulse3); + PulseOnce3 = 0; + } + } + } + + public override bool? CanCutTiles() + { + return false; + } + public override bool? CanHitNPC(NPC target) + { + return false; + } + + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Radius, targetHitbox); + + } +} diff --git a/Projectiles/Typeless/PinkJellyAura.cs b/Projectiles/Typeless/PinkJellyAura.cs index 9140a7bbae..2969e1ec6c 100644 --- a/Projectiles/Typeless/PinkJellyAura.cs +++ b/Projectiles/Typeless/PinkJellyAura.cs @@ -23,6 +23,7 @@ namespace CalamityMod.Projectiles.Typless public int PulseOnce = 1; public int PulseOnce2 = 1; public int PulseOnce3 = 1; + public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal1") { Volume = 0.5f }; public override void SetDefaults() { @@ -59,7 +60,7 @@ namespace CalamityMod.Projectiles.Typless { Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.HotPink, new Vector2(1f, 1f), 0f, 0f, 2f, 10); GeneralParticleHandler.SpawnParticle(pulse); - SoundEngine.PlaySound(SoundID.NPCDeath28 with { Volume = 0.8f }, Projectile.Center); + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.05f }, Projectile.Center); PulseOnce = 0; } @@ -77,7 +78,7 @@ namespace CalamityMod.Projectiles.Typless PulseOnce2 = 0; } - for (int i = 0; i < 2; i++) + for (int i = 0; i < 1; i++) { Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 242); dust.scale = Main.rand.NextFloat(2.2f, 3.3f); diff --git a/en-US.hjson b/en-US.hjson index 2413eca1f7..151318f4e1 100644 --- a/en-US.hjson +++ b/en-US.hjson @@ -1 +1,10 @@ -Mods.CalamityMod.Projectiles.Typless.PinkJellyAura.DisplayName: Pink Jelly Aura \ No newline at end of file +Mods: { + CalamityMod: { + Projectiles: { + Typless: { + PinkJellyAura.DisplayName: Pink Jelly Aura + BlueJellyAura.DisplayName: Blue Jelly Aura + } + } + } +} \ No newline at end of file