diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index e74c3a4528..d53694517c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -608,6 +608,7 @@ namespace CalamityMod.CalPlayer public bool holyMinions = false; public bool alchFlask = false; public bool toxicHeart = false; + public bool toxicHeartVisuals = false; public bool abaddon = false; public bool aeroStone = false; @@ -1820,6 +1821,7 @@ namespace CalamityMod.CalPlayer holyMinions = false; alchFlask = false; toxicHeart = false; + toxicHeartVisuals = false; abaddon = false; aeroStone = false; lifejelly = false; diff --git a/CalPlayer/CalamityPlayerLifeRegen.cs b/CalPlayer/CalamityPlayerLifeRegen.cs index 37c3508bbc..cf8aca672f 100644 --- a/CalPlayer/CalamityPlayerLifeRegen.cs +++ b/CalPlayer/CalamityPlayerLifeRegen.cs @@ -900,16 +900,27 @@ namespace CalamityMod.CalPlayer if (toxicHeart) // Since it needs to know your life regen, it must be placed here { + float minLifeRegen = -20; // Fastest rate + float maxLifeRegen = 15; // Slowest rate int auraDamage = (int)Player.GetBestClassDamage().ApplyTo(200); var source = Player.GetSource_Accessory(FindAccessory(ModContent.ItemType())); - pulseRate = Utils.Remap(Player.lifeRegen, -30, 10, 20, 1, true); + float lifeRegenRate = Utils.Remap(Player.lifeRegen, minLifeRegen, maxLifeRegen, 20, 1, true); + + if (pulseRate < lifeRegenRate) // Jump to fastest pulse rate and slowly slow down if life regen increases + pulseRate = lifeRegenRate; + else + pulseRate = MathHelper.Lerp(pulseRate, lifeRegenRate, 0.002f); + if (pulseCounter >= 420) { Projectile.NewProjectile(source, Player.Center, Vector2.Zero, ModContent.ProjectileType(), auraDamage, 0f, Player.whoAmI, 0, 0, 0); pulseCounter = 0; - float soundVolume = Utils.Remap(Player.lifeRegen, -30, 10, 1f, 0.3f, true); - SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); - SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + if (toxicHeartVisuals) + { + float soundVolume = Utils.Remap(Player.lifeRegen, minLifeRegen, maxLifeRegen, 1f, 0.3f, true); + SoundStyle heartbeat = new("CalamityMod/Sounds/Item/Heartbeat"); + SoundEngine.PlaySound(heartbeat with { Volume = soundVolume, PitchVariance = 0.2f }, Player.Center); + } } else { diff --git a/Items/Accessories/ToxicHeart.cs b/Items/Accessories/ToxicHeart.cs index ca3e9c0e5a..97daa1e8cb 100644 --- a/Items/Accessories/ToxicHeart.cs +++ b/Items/Accessories/ToxicHeart.cs @@ -27,6 +27,7 @@ namespace CalamityMod.Items.Accessories { CalamityPlayer modPlayer = player.Calamity(); modPlayer.toxicHeart = true; + modPlayer.toxicHeartVisuals = !hideVisual; } } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 1117ef443e..b91cd402a8 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1905,6 +1905,7 @@ ToxicHeart: { Your heart beats with the plague, pulsing outside of your body Pulse frequency scale with regen, and pulses that kill enemies pulse again to heal you Multiplies all sickness debuff damage by 1.5x + Effects are transparent and silent if visibility is disabled ''' } diff --git a/Projectiles/Typeless/PlaguePulse.cs b/Projectiles/Typeless/PlaguePulse.cs index 482dde104f..64e4a8f6d3 100644 --- a/Projectiles/Typeless/PlaguePulse.cs +++ b/Projectiles/Typeless/PlaguePulse.cs @@ -19,7 +19,7 @@ namespace CalamityMod.Projectiles.Typeless public ref float time => ref Projectile.ai[0]; public ref float radius => ref Projectile.ai[1]; public float maxRadius = 300; - public int startDamage; + public bool visible; public override void SetDefaults() { Projectile.width = 96; @@ -36,23 +36,22 @@ namespace CalamityMod.Projectiles.Typeless public override void AI() { - if (time == 0) - startDamage = Projectile.damage; - Player player = Main.player[Projectile.owner]; + visible = player.Calamity().toxicHeartVisuals; if (Projectile.ai[2] == 0) Projectile.Center = player.MountedCenter; if (Projectile.ai[2] == 1) { - maxRadius = 200; + maxRadius = Main.rand.Next(150, 250 + 1); + Projectile.extraUpdates = 2; } - if (Main.rand.NextBool(5)) + if (Main.rand.NextBool(5) && visible) { DirectionalPulseRing pulse = new DirectionalPulseRing(Projectile.Center + Main.rand.NextVector2Circular(radius, radius), Vector2.Zero, (Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green) * 0.6f, new Vector2(1, 1), 0, Main.rand.NextFloat(0.07f, 0.23f), 0f, 20); GeneralParticleHandler.SpawnParticle(pulse); } - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && visible) { for (int i = 0; i < 2; i++) { @@ -70,10 +69,10 @@ namespace CalamityMod.Projectiles.Typeless } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - Projectile.damage = (int)(Projectile.damage * 0.85f); - if (Projectile.damage < 1) - Projectile.damage = 1; + float minMult = 0.4f; + int hitsToMinMult = 6; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { @@ -83,15 +82,33 @@ namespace CalamityMod.Projectiles.Typeless if ((target.life <= 0 && target.realLife == -1)) { player.Heal(10); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(startDamage * 0.8f), 0f, Projectile.owner, 0, 0, 1); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 0.9f), 0f, Projectile.owner, 0, Projectile.ai[1] + 1, 1); + } + if (target.CanBeMoved()) // Always push targets away from the player + { + Vector2 pushVelocity = Utils.DirectionTo(player.Center, target.Center) * 5; + target.velocity = pushVelocity; } } public override bool PreDraw(ref Color lightColor) { Player player = Main.player[Projectile.owner]; - Texture2D rexture = ModContent.Request("CalamityMod/Particles/HighResHollowCircleHardEdge").Value; - Main.EntitySpriteDraw(rexture, Projectile.Center - Main.screenPosition, null, (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 }, Projectile.rotation, rexture.Size() * 0.5f, (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f), SpriteEffects.None, 0); + Texture2D rexture = ModContent.Request("CalamityMod/Particles/SoftRoundExplosion").Value; + Texture2D fexture = ModContent.Request("CalamityMod/Particles/BloomCircle").Value; + Color color = (Color.Green * Utils.Remap(time, 30, 60, 0.35f, 0, true)) with { A = 0 } * (visible ? 1f : 0.25f); + float scale = (Utils.Remap(time, 0, 60, 1, 6, true) / 21) * (maxRadius == 300 ? 1 : 0.7f); + Vector2 pos = Projectile.Center - Main.screenPosition; + Main.EntitySpriteDraw(rexture, pos, null, color, Projectile.rotation - Main.GlobalTimeWrappedHourly * 1.5f, rexture.Size() * 0.5f, scale, SpriteEffects.None, 0); + Main.EntitySpriteDraw(rexture, pos, null, color, Projectile.rotation + Main.GlobalTimeWrappedHourly * 3, rexture.Size() * 0.5f, scale * 0.95f, SpriteEffects.None, 0); + if (Projectile.ai[2] == 1) + { + for (int i = 0; i < 4; i++) + { + float pulseScale = (scale * 6 + 0.11f) - i * 0.022f; + Main.EntitySpriteDraw(fexture, pos, null, color, Projectile.rotation, fexture.Size() * 0.5f, pulseScale, SpriteEffects.None, 0); + } + } return false; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, radius, targetHitbox);