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
This commit is contained in:
Xyk authored and Cameron Ewell committed 2023-08-06 22:34:28 -04:00
1 parent 6f45aed3f4
commit 8d334b1c42
6 files changed
+29 -21

No files matched your search

+7 -1
View File
@@ -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<BlueJellyAura>(), 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<GreenJellyAura>(), 0, 0, Player.whoAmI);
HasGotCleansed = false;
}
if (snowman)
{
+1 -1
View File
@@ -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.
@@ -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
'''
}
+6 -5
View File
@@ -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;
}
+6 -5
View File
@@ -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<GreenJellyRegen>(), 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;
}
+1 -1
View File
@@ -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;
}