From 8d334b1c42e408d5ceffe32c21b7e4fec9e4ae85 Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 4 Aug 2023 15:29:34 -0700 Subject: [PATCH] Multiplayer pre-compatibility for the jellies I've never worked with multiplayer stuff before, but I did re-write the cleansing effect so it will probably work as intended but I still need to find a way to change the bool for all players for it to work properly --- CalPlayer/CalamityPlayer.cs | 8 +++++++- CalPlayer/CalamityPlayerMiscEffects.cs | 2 +- .../Mods.CalamityMod.Items.Accessories.hjson | 16 ++++++++-------- Projectiles/Typeless/BlueJellyAura.cs | 11 ++++++----- Projectiles/Typeless/GreenJellyAura.cs | 11 ++++++----- Projectiles/Typeless/PinkJellyAura.cs | 2 +- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e5da80cca4..705bdde252 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -500,6 +500,7 @@ namespace CalamityMod.CalPlayer public bool cleansingjelly = false; public bool GrandGelatin = false; public int CleansingEffect = 0; + public bool HasGotCleansed = false; public bool community = false; public bool shatteredCommunity = false; public bool fleshTotem = false; @@ -3219,11 +3220,16 @@ namespace CalamityMod.CalPlayer //Cleansing Jelly cleansing 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); - + HasGotCleansed = false; + } //Grand Gellatin regen and cleansing aura spawn when using a healing potion if (timePotionSick == 1 && Player.whoAmI == Main.myPlayer && GrandGelatin) + { Projectile.NewProjectile(Player.GetSource_FromThis(), Player.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Player.whoAmI); + HasGotCleansed = false; + } if (snowman) { diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index df79920985..bcfe84af6c 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. diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 862127d59d..fa220b3153 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -851,10 +851,10 @@ GrandGelatin: { DisplayName: Grand Gelatin Tooltip: ''' - Using a healing potion will spawn an aura that both cleanses - all debuffs and defense damage once and provides life - regeneration to all player inside for 8 seconds - 10% increased movement and jump speed + 10% increased movement speed and jump speed + Using a healing potion will spawn a cleansing aura + Walking into the aura removes all debuffs and defense damage one time + The aura provides increased life regen for all players inside for 8 seconds ''' } @@ -988,8 +988,8 @@ LifeJelly: { DisplayName: Life Jelly Tooltip: ''' - Using a healing potion will spawn an aura that provides life - regeneration to all player inside for 5 seconds + Using a healing potion will spawn a lingering aura + The aura provides increased life regen for all players inside for 5 seconds ''' } @@ -1026,8 +1026,8 @@ CleansingJelly: { DisplayName: Cleansing Jelly Tooltip: ''' - Using a healing potion will spawn an aura that cleanses - all debuffs and defense damage once + Using a healing potion will spawn a cleansing aura + Walking into the aura removes all debuffs and defense damage one time ''' } diff --git a/Projectiles/Typeless/BlueJellyAura.cs b/Projectiles/Typeless/BlueJellyAura.cs index 445d99ca68..70009e2802 100644 --- a/Projectiles/Typeless/BlueJellyAura.cs +++ b/Projectiles/Typeless/BlueJellyAura.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Typless 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 ref bool HasGotCleansed => ref Main.player[Projectile.owner].Calamity().HasGotCleansed; public override void SetDefaults() { @@ -53,7 +54,7 @@ namespace CalamityMod.Projectiles.Typless 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) + if (targetDist < 155f && HasGotCleansed == false) { CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) @@ -64,7 +65,8 @@ namespace CalamityMod.Projectiles.Typless player.buffTime[l] *= 0; } } - CleanseOnce = 0; + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); + HasGotCleansed = true; } } @@ -72,7 +74,6 @@ namespace CalamityMod.Projectiles.Typless { 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; @@ -94,14 +95,14 @@ namespace CalamityMod.Projectiles.Typless for (int i = 0; i < 1; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 59); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(155f, 155f), 187); 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 dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(150f, 150f), 187); dust.scale = Main.rand.NextFloat(0.8f, 1.3f); dust.noGravity = true; } diff --git a/Projectiles/Typeless/GreenJellyAura.cs b/Projectiles/Typeless/GreenJellyAura.cs index 3a4b111477..ab333c8b19 100644 --- a/Projectiles/Typeless/GreenJellyAura.cs +++ b/Projectiles/Typeless/GreenJellyAura.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Projectiles.Typless public int PulseOnce3 = 1; public static readonly SoundStyle Spawnsound = new("CalamityMod/Sounds/Custom/OrbHeal3") { Volume = 0.5f }; public ref int CleansingEffect => ref Main.player[Projectile.owner].Calamity().CleansingEffect; + public ref bool HasGotCleansed => ref Main.player[Projectile.owner].Calamity().HasGotCleansed; public override void SetDefaults() { @@ -56,7 +57,7 @@ namespace CalamityMod.Projectiles.Typless if (targetDist < 232f) { player.AddBuff(ModContent.BuffType(), 480); - if (CleanseOnce == 1) + if (HasGotCleansed == false) { CleansingEffect = 1; for (int l = 0; l < Player.MaxBuffs; l++) @@ -67,7 +68,8 @@ namespace CalamityMod.Projectiles.Typless player.buffTime[l] *= 0; } } - CleanseOnce = 0; + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); + HasGotCleansed = true; } } } @@ -76,7 +78,6 @@ namespace CalamityMod.Projectiles.Typless { if (PulseOnce == 1) { - SoundEngine.PlaySound(Spawnsound with { Pitch = -0.05f }, Projectile.Center); Particle pulse = new StaticPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(1f, 1f), 0f, 0f, 3f, 10); GeneralParticleHandler.SpawnParticle(pulse); PulseOnce = 0; @@ -98,14 +99,14 @@ namespace CalamityMod.Projectiles.Typless for (int i = 0; i < 2; i++) { - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(232f, 232f), 61); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2CircularEdge(232f, 232f), 298); 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(225f, 225f), 61); + Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(225f, 225f), 298); dust.scale = Main.rand.NextFloat(0.8f, 1.3f); dust.noGravity = true; } diff --git a/Projectiles/Typeless/PinkJellyAura.cs b/Projectiles/Typeless/PinkJellyAura.cs index 2969e1ec6c..a0d20e5891 100644 --- a/Projectiles/Typeless/PinkJellyAura.cs +++ b/Projectiles/Typeless/PinkJellyAura.cs @@ -60,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(Spawnsound with { Pitch = -0.05f }, Projectile.Center); + SoundEngine.PlaySound(Spawnsound with { Pitch = -0.9f }, Projectile.Center); PulseOnce = 0; }