From cb095902c39b0b65b5ba8b25219370cdcf6db1be Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 22 Sep 2023 20:59:08 -0700 Subject: [PATCH] Changed the visuals of almost every buff and debuff on the player Also added new visuals for rage and adrenaline Added a new function for a often used particle to set its position mounted center on the player (this is why there's so many random file changes) --- Buffs/StatBuffs/AdrenalineMode.cs | 3 +- Buffs/StatBuffs/RageMode.cs | 1 + CalPlayer/CalamityPlayer.cs | 15 +- CalPlayer/CalamityPlayerDrawEffects.cs | 457 ++++++++++++------ CalPlayer/CalamityPlayerMiscEffects.cs | 1 + CalPlayer/Dashes/GodslayerArmorDash.cs | 6 +- CalPlayer/DrawLayers/AdrenalineTrailLayer.cs | 48 ++ Dusts/AdrenDust.cs | 33 ++ Dusts/AdrenDust.png | Bin 0 -> 2878 bytes Particles/DirectionalPulseRing.cs | 11 +- .../DraedonsArsenal/AnomalysNanogunHoldout.cs | 2 +- .../AnomalysNanogunPlasmaBeam.cs | 2 +- .../DraedonsArsenal/SnakeEyesProjectile.cs | 2 +- .../DraedonsArsenal/SnakeEyesSummon.cs | 4 +- Projectiles/Magic/CoralSpoutHoldout.cs | 4 +- Projectiles/Melee/GalaxySmasherEcho.cs | 4 +- Projectiles/Melee/GalaxySmasherHammer.cs | 4 +- .../Ranged/AdamantiteAcceleratorHoldout.cs | 2 +- Projectiles/Ranged/NovaChargeShot.cs | 4 +- Projectiles/Ranged/PressurizedBubbleStream.cs | 2 +- Projectiles/Ranged/TitaniumRailgunScope.cs | 2 +- Projectiles/Rogue/RealityRuptureStealth.cs | 2 +- Projectiles/Typeless/PauldronExplosion.cs | 4 +- 23 files changed, 439 insertions(+), 174 deletions(-) create mode 100644 CalPlayer/DrawLayers/AdrenalineTrailLayer.cs create mode 100644 Dusts/AdrenDust.cs create mode 100644 Dusts/AdrenDust.png diff --git a/Buffs/StatBuffs/AdrenalineMode.cs b/Buffs/StatBuffs/AdrenalineMode.cs index d568557613..e00f3537b3 100644 --- a/Buffs/StatBuffs/AdrenalineMode.cs +++ b/Buffs/StatBuffs/AdrenalineMode.cs @@ -1,4 +1,4 @@ -using Terraria; +using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -17,6 +17,7 @@ namespace CalamityMod.Buffs.StatBuffs public override void Update(Player player, ref int buffIndex) { player.Calamity().adrenalineModeActive = true; + player.Calamity().AdrenalineTrail = true; } } } diff --git a/Buffs/StatBuffs/RageMode.cs b/Buffs/StatBuffs/RageMode.cs index 7b5d443bef..628750e992 100644 --- a/Buffs/StatBuffs/RageMode.cs +++ b/Buffs/StatBuffs/RageMode.cs @@ -36,6 +36,7 @@ namespace CalamityMod.Buffs.StatBuffs player.DelBuff(buffIndex--); // TML documentation requires you to decrement buffIndex if deleting the buff during Update. mp.rageModeActive = false; mp.rage = 0f; + player.Calamity().ragePulseTimer = 0; } } } diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 792edb1a94..60a05f6b5e 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -225,6 +225,9 @@ namespace CalamityMod.CalPlayer public float SulphWaterPoisoningLevel; public NPC unstableSelectedTarget; public int zapActivity = 0; + public bool ragePulse = false; + public int rageBuffTimer = 0; + public int ragePulseTimer = 0; private const int DashDisableCooldown = 12; @@ -344,6 +347,7 @@ namespace CalamityMod.CalPlayer #region Adrenaline public bool AdrenalineEnabled => CalamityWorld.revenge || draedonsHeart; public bool adrenalineModeActive = false; + public bool AdrenalineTrail = false; public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); @@ -2092,6 +2096,7 @@ namespace CalamityMod.CalPlayer rageModeActive = false; adrenalineModeActive = false; + AdrenalineTrail = false; RageDuration = BalancingConstants.DefaultRageDuration; RageDamageBoost = BalancingConstants.DefaultRageDamageBoost; @@ -2360,6 +2365,7 @@ namespace CalamityMod.CalPlayer tRegen = false; rageModeActive = false; adrenalineModeActive = false; + AdrenalineTrail = false; vodka = false; redWine = false; grapeBeer = false; @@ -3053,7 +3059,6 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) SoundEngine.PlaySound(ActivationSound); - // TODO -- Adrenaline should provide bright green vibrating afterimages on the player for the duration. int dustPerSegment = 96; // Parametric segment 1: y = 3x + 120 @@ -3075,7 +3080,7 @@ namespace CalamityMod.CalPlayer for (int i = 0; i < dustPerSegment; ++i) { bool electricity = Main.rand.NextBool(4); - int dustID = electricity ? 132 : DustID.TerraBlade; + int dustID = electricity ? (Main.rand.NextBool(2) ? 132 : 131) : ModContent.DustType(); float interpolant = i + 0.5f; float spreadSpeed = Main.rand.NextFloat(0.5f, maxDustVelSpread); @@ -3086,19 +3091,19 @@ namespace CalamityMod.CalPlayer Dust d = Dust.NewDustPerfect(segmentOnePos, dustID, Vector2.Zero); if (electricity) d.noGravity = false; - d.scale = Main.rand.NextFloat(0.8f, 1.4f); + d.scale = Main.rand.NextFloat(1.2f, 1.8f); d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; Vector2 segmentTwoPos = Player.Center + segmentTwoStart + segmentTwoIncrement * interpolant; d = Dust.CloneDust(d); d.position = segmentTwoPos; - d.scale = Main.rand.NextFloat(0.8f, 1.4f); + d.scale = Main.rand.NextFloat(1.2f, 1.8f); d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; Vector2 segmentThreePos = Player.Center + segmentThreeStart + segmentThreeIncrement * interpolant; d = Dust.CloneDust(d); d.position = segmentThreePos; - d.scale = Main.rand.NextFloat(0.8f, 1.4f); + d.scale = Main.rand.NextFloat(1.2f, 1.8f); d.velocity = Main.rand.NextVector2Unit() * spreadSpeed; } } diff --git a/CalPlayer/CalamityPlayerDrawEffects.cs b/CalPlayer/CalamityPlayerDrawEffects.cs index 77706ca6a6..adf6bb8c30 100644 --- a/CalPlayer/CalamityPlayerDrawEffects.cs +++ b/CalPlayer/CalamityPlayerDrawEffects.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq.Expressions; using CalamityMod.CalPlayer.DrawLayers; using CalamityMod.Dusts; using CalamityMod.Items.Weapons.Ranged; @@ -199,71 +200,74 @@ namespace CalamityMod.CalPlayer } } } - if (calamityPlayer.auricSet) - { - if (Player != null && !Player.dead) - { - Lighting.AddLight((int)Player.Center.X / 16, (int)Player.Center.Y / 16, 31 / 235f, 170 / 235f, 222 / 235f); - if (!Player.mount.Active) - { - if (Main.rand.NextBool(14) && drawInfo.shadow == 0f) - { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 8, Player.height + 8, 206, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1f; - drawInfo.DustCache.Add(dust); - } - if (noRogueStealth) - { - r *= 0f; - g *= 0.55f; - b *= 0.6f; - fullBright = true; - } - } - if (!Player.StandingStill() && !Player.mount.Active) - { - if (Main.rand.NextBool(8) && drawInfo.shadow == 0f) - { - int de_dust2 = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(2) ? 204 : 213, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); - Main.dust[de_dust2].noGravity = true; - Main.dust[de_dust2].velocity *= 0.5f; - drawInfo.DustCache.Add(de_dust2); - } - } - } - } + if (calamityPlayer.auricSet) + { + if (Player != null && !Player.dead) + { + Lighting.AddLight((int)Player.Center.X / 16, (int)Player.Center.Y / 16, 31 / 235f, 170 / 235f, 222 / 235f); + if (!Player.mount.Active) + { + if (Main.rand.NextBool(14) && drawInfo.shadow == 0f) + { + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 8, Player.height + 8, 206, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 1f; + drawInfo.DustCache.Add(dust); + } + if (noRogueStealth) + { + r *= 0f; + g *= 0.55f; + b *= 0.6f; + fullBright = true; + } + } + if (!Player.StandingStill() && !Player.mount.Active) + { + if (Main.rand.NextBool(8) && drawInfo.shadow == 0f) + { + int de_dust2 = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(2) ? 204 : 213, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.5f); + Main.dust[de_dust2].noGravity = true; + Main.dust[de_dust2].velocity *= 0.5f; + drawInfo.DustCache.Add(de_dust2); + } + } + } + } if (calamityPlayer.bFlames) { - if (Main.rand.NextBool(abaddon ? 6 : 4) && drawInfo.shadow == 0f) //looks weaker if you have Abaddon equipped + if (Main.rand.NextBool(abaddon ? 4 : 2) && drawInfo.shadow == 0f) //looks weaker if you have Abaddon equipped { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, ModContent.DustType(), Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, abaddon ? 1.3f : 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); - } - if (noRogueStealth) - { - r *= 0.25f; - g *= 0.01f; - b *= 0.01f; - fullBright = true; + Dust dust = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Main.rand.NextBool(3) ? 114 : ModContent.DustType(), new Vector2(0, Main.rand.NextFloat(-3f, -5f)) + Player.velocity, 0, default, abaddon ? 1.1f : 1.6f); + dust.noGravity = true; + for (int i = 0; i < 3; i++) + { + Dust dust2 = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), 19), Main.rand.NextBool(2) ? 90 : ModContent.DustType(), new Vector2(Main.rand.NextFloat(-4f, 4f), Main.rand.NextFloat(-1f, -3f)) + Player.velocity, 0, default, abaddon ? 0.4f : 1.4f); + dust2.noGravity = true; + } + + if (noRogueStealth) + { + r *= 0.25f; + g *= 0.01f; + b *= 0.01f; + fullBright = true; + } } } if (calamityPlayer.shadowflame) { if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.95f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 27, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.1f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; - Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 3f; if (Main.rand.NextBool(4)) { Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; + Main.dust[dust].scale *= 0.3f; } } } @@ -271,7 +275,7 @@ namespace CalamityMod.CalPlayer { if (Main.rand.Next(5) < 4 && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 46, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.95f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 298, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 0.6f); Main.dust[dust].noGravity = true; Main.dust[dust].velocity *= 0.75f; Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; @@ -279,7 +283,12 @@ namespace CalamityMod.CalPlayer if (Main.rand.NextBool(4)) { Main.dust[dust].noGravity = false; - Main.dust[dust].scale *= 0.5f; + Main.dust[dust].scale *= 0.2f; + } + if (Main.rand.NextBool(5)) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-3f, -4f)), Main.rand.NextBool(2) ? Color.OliveDrab : Color.GreenYellow, new Vector2(0.8f, 1), 0, 0.09f, 0f, 45, false); + GeneralParticleHandler.SpawnParticle(pulse); } } if (noRogueStealth) @@ -295,37 +304,58 @@ namespace CalamityMod.CalPlayer { if (drawInfo.shadow == 0f) { - int dustCount = Main.rand.NextBool() ? 2 : 3; - for (int i = 0; i < dustCount; ++i) - { - int dustID = ModContent.DustType(); - if (shatteredCommunity && Main.rand.NextBool(3)) - dustID = DustID.DemonTorch; + ragePulseTimer++; + int dustID = heartOfDarkness ? 240 : 114; - Vector2 dustVel = Player.velocity * 0.5f; - int idx = Dust.NewDust(drawInfo.Position, Player.width, Player.height, dustID, dustVel.X, dustVel.Y); - Dust d = Main.dust[idx]; - d.fadeIn = 0.4f; - d.scale = Main.rand.NextFloat(0.8f, 1.5f); - d.noGravity = true; - d.noLight = false; - drawInfo.DustCache.Add(idx); + if (shatteredCommunity && Main.rand.NextBool(2)) + dustID = 112; //special dust visual for Shattered Community + + if (heartOfDarkness && !shatteredCommunity && Main.rand.NextBool(2)) + dustID = 90; //special dust visual for Heart of Darkness + + if (ragePulseTimer == 60) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Center, Vector2.Zero, Color.Red, new Vector2(1, 1), 0, 0f, 0.23f, 40, true); + GeneralParticleHandler.SpawnParticle(pulse); + ragePulse = true; } + + if (ragePulse) + { + rageBuffTimer++; + if (rageBuffTimer >= 30) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.MountedCenter, Vector2.Zero, (shatteredCommunity ? Color.MediumPurple : Color.Red), new Vector2(1, 1), 0, 0f, 0.18f, 30, true); + GeneralParticleHandler.SpawnParticle(pulse); + rageBuffTimer = 0; + ragePulse = false; + ragePulseTimer = 0; + } + } + + Dust dust = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), dustID); + dust.scale = Main.rand.NextFloat(0.3f, 0.45f); + if (dustID == 112) + dust.scale = Main.rand.NextFloat(0.7f, 0.8f); + if (dustID == 240) + dust.scale = Main.rand.NextFloat(0.8f, 0.95f); + dust.velocity = -Player.velocity / 3; + dust.noGravity = true; + } } // Dust while Adrenaline Mode is active if (calamityPlayer.adrenalineModeActive) { - if (drawInfo.shadow == 0f) + for (int i = 0; i < 4; i++) { - int dustID = 132; + int dustID = ModContent.DustType(); Vector2 dustVel = Player.velocity * 0.5f; - int idx = Dust.NewDust(drawInfo.Position, Player.width, Player.height, dustID, dustVel.X, dustVel.Y); + int idx = Dust.NewDust(Main.rand.NextBool(5) ? drawInfo.Position : drawInfo.Position -Player.velocity * 1.5f, Player.width, Player.height, dustID, dustVel.X, dustVel.Y); Dust d = Main.dust[idx]; - d.fadeIn = 1.1f; - d.scale = Main.rand.NextFloat(0.8f, 1.5f); - d.noGravity = Main.rand.NextBool(4); + d.scale = Main.rand.NextFloat(0.4f, 1.2f); + d.noGravity = true; d.noLight = false; drawInfo.DustCache.Add(idx); } @@ -333,13 +363,10 @@ namespace CalamityMod.CalPlayer if (calamityPlayer.gsInferno) { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(1) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 173, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + SparkParticle spark = new SparkParticle(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), new Vector2(0, Main.rand.NextFloat(-5f, 5f)), false, Main.rand.Next(11, 13), Main.rand.NextFloat(0.2f, 0.5f), Main.rand.NextBool(7) ? Color.Aqua : Color.Fuchsia); + GeneralParticleHandler.SpawnParticle(spark); } if (noRogueStealth) { @@ -353,24 +380,29 @@ namespace CalamityMod.CalPlayer { if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dustType = Main.rand.NextBool(2) ? ModContent.DustType() : ModContent.DustType(); - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.2f, Player.velocity.Y * 0.2f, 100, default, 0.7f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.5f; - Main.dust[dust].color = new Color(255, 255, 255, 0); - drawInfo.DustCache.Add(dust); + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vector2.Zero, Main.rand.NextBool(2) ? Color.DarkTurquoise : Color.Coral, new Vector2(1, 1), 0, 0.08f, 0f, 20, false); + GeneralParticleHandler.SpawnParticle(pulse); + Particle orb = new GenericBloom(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vector2.Zero, Main.rand.NextBool(2) ? Color.DarkTurquoise : Color.Coral, 0.055f, 8); + GeneralParticleHandler.SpawnParticle(orb); } } - if (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire) + if (calamityPlayer.hFlames || calamityPlayer.hInferno || calamityPlayer.banishingFire) //Sun stone makes it look weaker { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(reducedHolyFlamesDamage && !calamityPlayer.hInferno ? 4 : 2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, ModContent.DustType(), Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + CritSpark spark = new CritSpark(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vect, Main.rand.NextBool(2) ? Color.Coral : Color.OrangeRed, Color.Orange, (reducedHolyFlamesDamage && !calamityPlayer.hInferno ? 0.4f : 0.8f), 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(spark); + } + + if (Main.rand.NextBool(reducedHolyFlamesDamage && !calamityPlayer.hInferno ? 4 : 2) && drawInfo.shadow == 0f) + { + Vector2 dustCorner = Player.position - 2f * Vector2.One; + Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-5f, -1f)); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, 87, dustVel.X, dustVel.Y); + Main.dust[d].noGravity = true; + Main.dust[d].scale = reducedHolyFlamesDamage && !calamityPlayer.hInferno ? Main.rand.NextFloat(0.3f, 0.5f) : Main.rand.NextFloat(0.7f, 1.2f); + Main.dust[d].alpha = 235; } if (noRogueStealth) { @@ -380,9 +412,9 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - else if (calamityPlayer.icarusFolly || calamityPlayer.dragonFire) + else if (calamityPlayer.icarusFolly) { - if (Main.rand.NextBool(calamityPlayer.dragonFire ? 6 : 12) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(12) && drawInfo.shadow == 0f) { int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, (int)CalamityDusts.ProfanedFire, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); Main.dust[dust].noGravity = true; @@ -391,28 +423,104 @@ namespace CalamityMod.CalPlayer drawInfo.DustCache.Add(dust); } } - if (calamityPlayer.miracleBlight) + if (calamityPlayer.dragonFire) { - // Violent dust fountain for (int i = 0; i < 2; ++i) { - Vector2 dustCorner = Player.position - 2f * Vector2.One; - Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-15f, -12f)); - int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, (int)CalamityDusts.MiracleBlight, dustVel.X, dustVel.Y); - Main.dust[d].noGravity = true; - drawInfo.DustCache.Add(d); + Vector2 Vect2 = new Vector2(0f, Main.rand.NextBool(4) ? -2f : -8f).RotatedByRandom(MathHelper.ToRadians(Main.rand.NextBool(3) ? 10 : 35f)) * Main.rand.NextFloat(0.1f, 1.9f); + SparkParticle spark = new SparkParticle(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), new Vector2(Vect2.X - Player.velocity.X * 0.3f, Vect2.Y), false, 10, Main.rand.NextFloat(0.4f, 0.5f), Main.rand.NextBool(2) ? Color.OrangeRed : Color.Orange); + GeneralParticleHandler.SpawnParticle(spark); + + if (Main.rand.NextBool(3)) + { + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(2) ? -3f : -14f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + SmallSmokeParticle smoke = new SmallSmokeParticle(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vect, Color.DimGray, Main.rand.NextBool(2) ? Color.Black : Color.DimGray, Main.rand.NextFloat(0.2f, 1.2f), 100); + GeneralParticleHandler.SpawnParticle(smoke); + } } } - if (calamityPlayer.pFlames) + if (calamityPlayer.miracleBlight) { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + Color sparkColor; + switch (Main.rand.Next(4)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 89, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.2f; - Main.dust[dust].velocity.Y -= 0.15f; - drawInfo.DustCache.Add(dust); + case 0: + sparkColor = Color.DarkRed; + break; + case 1: + sparkColor = Color.MediumTurquoise; + break; + case 2: + sparkColor = Color.Orange; + break; + default: + sparkColor = Color.LawnGreen; + break; } + + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), new Vector2(5, 5).RotatedByRandom(360), sparkColor, new Vector2(Main.rand.NextFloat(1f, 5f), Main.rand.NextFloat(1f, 5f)), 0, Main.rand.NextFloat(0.07f, 0.1f), 0f, 18, false); + GeneralParticleHandler.SpawnParticle(pulse); + + float numberOfDusts = 3f; + float rotFactor = 360f / numberOfDusts; + if (Player.miscCounter % 4 == 0) + { + for (int i = 0; i < numberOfDusts; i++) + { + int DustType; + switch (Main.rand.Next(4)) + { + case 0: + DustType = 219; + break; + case 1: + DustType = 220; + break; + case 2: + DustType = 226; + break; + default: + DustType = 222; + break; + } + + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f)); + Vector2 velOffset = CalamityUtils.RandomVelocity(100f, 70f, 150f, 0.04f); + Dust dust = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)) + offset, DustType, new Vector2(velOffset.X, velOffset.Y)); + dust.noGravity = true; + dust.velocity = velOffset; + velOffset *= 10; + dust.position = Player.Center - velOffset; + dust.scale = Main.rand.NextFloat(0.7f, 0.8f); + } + } + + } + if (calamityPlayer.pFlames) //Plague debuff + { + float numberOfDusts = 2f; + float rotFactor = 360f / numberOfDusts; + if (Player.miscCounter % 4 == 0) + { + for (int i = 0; i < 2; i++) + { + DirectionalPulseRing pulse = new DirectionalPulseRing(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vector2.Zero, Main.rand.NextBool(3) ? Color.LimeGreen : Color.Green, new Vector2(1, 1), 0, Main.rand.NextFloat(0.07f, 0.18f), 0f, 35, false); + GeneralParticleHandler.SpawnParticle(pulse); + } + + for (int i = 0; i < 7; i++) + { + int DustID = Main.rand.NextBool(30) ? 220 : 89; + float rot = MathHelper.ToRadians(i * rotFactor); + Vector2 offset = new Vector2(0.3f, 0).RotatedBy(rot * Main.rand.NextFloat(0.2f, 0.3f)); + Dust dust2 = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)) + offset, DustID); + dust2.scale = Main.rand.NextFloat(0.3f, 0.4f); + if (DustID == 220) + dust2.scale = Main.rand.NextFloat(1f, 1.2f); + } + } + if (noRogueStealth) { r *= 0.07f; @@ -421,15 +529,22 @@ namespace CalamityMod.CalPlayer fullBright = true; } } - if (calamityPlayer.nightwither) + if (calamityPlayer.nightwither) //Moon stone makes it look weaker { - if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(reducedNightwitherDamage ? 4 : 2) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 176, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + Vector2 Vect = new Vector2(0f, Main.rand.NextBool(4) ? -5f : -9f).RotatedByRandom(MathHelper.ToRadians(25f)) * Main.rand.NextFloat(0.1f, 1.9f); + CritSpark spark = new CritSpark(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), Vect, Main.rand.NextBool(2) ? Color.Cyan : Color.DarkBlue, Color.DodgerBlue, (reducedNightwitherDamage ? 0.4f : 0.8f), 15, 2f, 1.9f); + GeneralParticleHandler.SpawnParticle(spark); + } + for (int i = 0; i < (reducedNightwitherDamage ? 1 : 2); i++) + { + Vector2 dustCorner = Player.position - 2f * Vector2.One; + Vector2 dustVel = Player.velocity + new Vector2(0f, Main.rand.NextFloat(-11f, -2f)); + int d = Dust.NewDust(dustCorner, Player.width + 4, Player.height + 4, Main.rand.NextBool(4) ? 160 : 206, dustVel.X, dustVel.Y); + Main.dust[d].noGravity = true; + Main.dust[d].scale = reducedNightwitherDamage ? Main.rand.NextFloat(0.3f, 0.4f) : Main.rand.NextFloat(0.5f, 0.7f); + Main.dust[d].alpha = 235; } if (noRogueStealth) { @@ -443,13 +558,13 @@ namespace CalamityMod.CalPlayer { int dustType = Utils.SelectRandom(Main.rand, new int[] { - 246, - 242, - 229, - 226, - 247, - 187, - 234 + 246, + 242, + 229, + 226, + 247, + 187, + 234 }); if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { @@ -474,6 +589,32 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.gState || calamityPlayer.cDepth || calamityPlayer.eutrophication) { + if (Main.rand.NextBool(30) && cDepth) + { + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(15)) + bloodScale *= 1.3f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 1.5f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Player.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 186, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 0.6f); + Main.dust[dust].noGravity = true; + Main.dust[dust].velocity *= 0.75f; + Main.dust[dust].velocity.X = Main.dust[dust].velocity.X * 0.75f; + Main.dust[dust].velocity.Y = Main.dust[dust].velocity.Y - 1f; + if (Main.rand.NextBool(4) & cDepth) + { + Main.dust[dust].noGravity = false; + Main.dust[dust].scale *= 0.2f; + } if (noRogueStealth) { r *= 0f; @@ -488,20 +629,35 @@ namespace CalamityMod.CalPlayer { int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 165, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1f); Main.dust[dust].noGravity = false; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y += 0.5f; + Main.dust[dust].velocity *= 1.2f; + Main.dust[dust].velocity.Y += 0.8f; drawInfo.DustCache.Add(dust); } } if (calamityPlayer.bBlood) { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(11)) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; - Main.dust[dust].velocity.Y -= 0.5f; - drawInfo.DustCache.Add(dust); + int bloodLifetime = Main.rand.Next(22, 36); + float bloodScale = Main.rand.NextFloat(0.6f, 0.8f); + Color bloodColor = Color.Lerp(Color.Red, Color.DarkRed, Main.rand.NextFloat()); + bloodColor = Color.Lerp(bloodColor, new Color(51, 22, 94), Main.rand.NextFloat(0.65f)); + + if (Main.rand.NextBool(15)) + bloodScale *= 1.3f; + + float randomSpeedMultiplier = Main.rand.NextFloat(1.25f, 1.5f); + Vector2 bloodVelocity = Main.rand.NextVector2Unit() * 2 * randomSpeedMultiplier; + bloodVelocity.Y -= 5f; + BloodParticle blood = new BloodParticle(Player.Center, bloodVelocity, bloodLifetime, bloodScale, bloodColor); + GeneralParticleHandler.SpawnParticle(blood); + } + for (int i = 0; i < 2; i++) + { + float rot = MathHelper.ToRadians(i * 280); + Vector2 offset = new Vector2(0.1f, 0).RotatedBy(rot * Main.rand.NextFloat(0.08f, 0.05f)); + Dust dust2 = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)) + offset, 5); + dust2.scale = Main.rand.NextFloat(0.6f, 0.7f); } if (noRogueStealth) { @@ -513,14 +669,20 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.mushy) { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(4) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 56, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 2f); - Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 0.5f; - Main.dust[dust].velocity.Y -= 0.1f; - drawInfo.DustCache.Add(dust); + Dust dust = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-20f, 20f)), 56, Vector2.Zero, 100, default, 0.9f); + dust.noGravity = true; + dust.velocity *= 0.5f; + dust.velocity.Y -= 0.1f; + dust.alpha = 200; } + if (Main.rand.NextBool(15)) + { + Dust dust2 = Dust.NewDustPerfect(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), 19), Main.rand.NextBool(3) ? 41 : 56, new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, -2f)) + Player.velocity / 3, 0, default, 0.9f); + dust2.alpha = 145; + } + if (noRogueStealth) { r *= 0.15f; @@ -555,14 +717,19 @@ namespace CalamityMod.CalPlayer } if (calamityPlayer.bloodfinBoost) { - if (Main.rand.NextBool(6) && drawInfo.shadow == 0f) + if (Main.rand.NextBool(3) && drawInfo.shadow == 0f) { - int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f); + int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, Main.rand.NextBool(8) ? 296 : 5, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 1.25f); Main.dust[dust].noGravity = true; - Main.dust[dust].velocity *= 1.8f; + Main.dust[dust].velocity *= 1.3f; Main.dust[dust].velocity.Y -= 0.5f; drawInfo.DustCache.Add(dust); } + if (Main.rand.NextBool(16) && drawInfo.shadow == 0f) + { + Particle Plus = new HealingPlus(Player.Center - new Vector2(4, 0), Main.rand.NextFloat(0.4f, 0.8f), Color.Red, Color.DarkRed, Main.rand.Next(10, 15)); + GeneralParticleHandler.SpawnParticle(Plus); + } if (noRogueStealth) { r *= 0.5f; @@ -586,12 +753,12 @@ namespace CalamityMod.CalPlayer drawInfo.GoreCache.Add(heart); } } - if (calamityPlayer.shadow && CalamityConfig.Instance.StealthInvisibility) - { - r *= 0f; - g *= 0f; - b *= 0f; - } + if (calamityPlayer.shadow && CalamityConfig.Instance.StealthInvisibility) + { + r *= 0f; + g *= 0f; + b *= 0f; + } } #endregion diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 44b82610b4..dbebff8a4b 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -527,6 +527,7 @@ namespace CalamityMod.CalPlayer // If Adrenaline Mode is currently active, you smoothly lose all adrenaline over the duration. if (adrenalineModeActive) { + adrenalineDiff = -adrenalineMax / AdrenalineDuration; // If using Draedon's Heart, you get healing instead of damage. diff --git a/CalPlayer/Dashes/GodslayerArmorDash.cs b/CalPlayer/Dashes/GodslayerArmorDash.cs index 8fb8b6eb64..112be3e327 100644 --- a/CalPlayer/Dashes/GodslayerArmorDash.cs +++ b/CalPlayer/Dashes/GodslayerArmorDash.cs @@ -43,7 +43,7 @@ namespace CalamityMod.CalPlayer.Dashes GSDashSlot = SoundEngine.PlaySound(DevourerofGodsHead.DeathAnimationSound, player.Center); SoundOnce = true; - Particle pulse = new DirectionalPulseRing(player.Center, Vector2.Zero, Color.Orchid, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 12f, 18); + Particle pulse = new DirectionalPulseRing(player.Center, Vector2.Zero, Color.Orchid, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 12f, 18, false); GeneralParticleHandler.SpawnParticle(pulse); for (int i = 0; i <= 15; i++) @@ -96,9 +96,9 @@ namespace CalamityMod.CalPlayer.Dashes if (Time > 20 && Time < 100) { - Particle pulse = new DirectionalPulseRing(player.Center - player.velocity * 0.52f, player.velocity / 1.5f, Color.Fuchsia, new Vector2(1f, 2f), player.velocity.ToRotation(), 0.82f, 0.32f, 60); + Particle pulse = new DirectionalPulseRing(player.Center - player.velocity * 0.52f, player.velocity / 1.5f, Color.Fuchsia, new Vector2(1f, 2f), player.velocity.ToRotation(), 0.82f, 0.32f, 60, false); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(player.Center - player.velocity * 0.40f, player.velocity / 1.5f * 0.9f, Color.Aqua, new Vector2(0.8f, 1.5f), player.velocity.ToRotation(), 0.58f, 0.28f, 50); + Particle pulse2 = new DirectionalPulseRing(player.Center - player.velocity * 0.40f, player.velocity / 1.5f * 0.9f, Color.Aqua, new Vector2(0.8f, 1.5f), player.velocity.ToRotation(), 0.58f, 0.28f, 50, false); GeneralParticleHandler.SpawnParticle(pulse2); Time = 111; } diff --git a/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs b/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs new file mode 100644 index 0000000000..8524e8de6a --- /dev/null +++ b/CalPlayer/DrawLayers/AdrenalineTrailLayer.cs @@ -0,0 +1,48 @@ +using System.Collections.Generic; +using CalamityMod.Items.VanillaArmorChanges; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.CalPlayer.DrawLayers +{ + public class AdrenalineTrailLayer : PlayerDrawLayer + { + public override Position GetDefaultPosition() => new AfterParent(PlayerDrawLayers.LastVanillaLayer); + public int Time = 0; + public override bool GetDefaultVisibility(PlayerDrawSet drawInfo) + { + Player drawPlayer = drawInfo.drawPlayer; + if (drawInfo.shadow != 0f || drawPlayer.dead) + return false; + + return drawPlayer.Calamity().AdrenalineTrail; + } + + protected override void Draw(ref PlayerDrawSet drawInfo) + { + Time++; + Player drawPlayer = drawInfo.drawPlayer; + List existingDrawData = drawInfo.DrawDataCache; + float movementSpeedInterpolant = CobaltArmorSetChange.CalculateMovementSpeedInterpolant(drawPlayer); + for (float i = 0; i < drawPlayer.Calamity().OldPositions.Length; i += 0.9f) + { + float completionRatio = i / (float)drawPlayer.Calamity().OldPositions.Length; + float scale = MathHelper.Lerp(1.1f, 0.1f, completionRatio); + float opacity = MathHelper.Lerp(0.5f, 0.3f, completionRatio) * movementSpeedInterpolant; + List afterimages = new List(); + for (int j = 0; j < existingDrawData.Count; j++) + { + var drawData = existingDrawData[j]; + Vector2 extraPosition = (Time % 6 == 0 ? new Vector2(Main.rand.NextFloat(-10f, 10f), Main.rand.NextFloat(-10f, 10f)) : Vector2.Zero); + drawData.position = existingDrawData[j].position - drawPlayer.position + drawPlayer.oldPosition + extraPosition; + drawData.color = new Color(0, 255, 201) * opacity; + drawData.scale = new Vector2(scale); + afterimages.Add(drawData); + } + drawInfo.DrawDataCache.InsertRange(0, afterimages); + } + } + } +} diff --git a/Dusts/AdrenDust.cs b/Dusts/AdrenDust.cs new file mode 100644 index 0000000000..7e2387418a --- /dev/null +++ b/Dusts/AdrenDust.cs @@ -0,0 +1,33 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Dusts +{ + public class AdrenDust : ModDust + { + public override void OnSpawn(Dust dust) + { + dust.color = default; + dust.velocity *= 0.5f; + dust.noGravity = true; + dust.noLight = true; + dust.alpha = 50; + } + + public override bool Update(Dust dust) + { + dust.position += dust.velocity; + dust.scale *= 0.94f; + dust.velocity *= 0.90f; + Lighting.AddLight(dust.position, 0.255f, 0.185f, 0.094f); + if (dust.scale < 0.4f) + { + dust.active = false; + } + return false; + } + + public override Color? GetAlpha(Dust dust, Color lightColor) => new Color(Color.White.R, Color.White.G, Color.White.B, dust.alpha); + } +} diff --git a/Dusts/AdrenDust.png b/Dusts/AdrenDust.png new file mode 100644 index 0000000000000000000000000000000000000000..75e3e651d48fcc9b6538c886c4cbf9876a7fa953 GIT binary patch literal 2878 zcmV-E3&He>P)f6 zXi@@54ZTQ_E-Enz5K6$103tR-RB%L5k){YTDBysjLy@r}iiH7DvFijGMAUI`6dRUF zWUU$Bym{}eS9UO(Z2>7`&z9wUXbV-Il#&6`Y8GKGQ04S2&F6MJnWNa;Ck|;8QE#r9r;7G||@X{|> z%+C|c55>;RS}qbKr-&IQTvLXPlM{>K&(BTgi^a?^4mXV>;xX8n8Ce|RasXz}{8imI52H3ZN4bfe_i~WlJ|C&UW9+{8AKoW!}eExnGFE2re(F+`iE_46#!l9 z0Z_aBhs|Iw0E)7{bq;-T9=d#9QpDmcXDh4R++0fmpKB>E=%LdZt9g$j;($`3&Zthxi`{{&gM}5&R^+h%b~yM9Zd3AWW9ETgVfL z1(`yIK=_}U_z%PWq}jQaiQ4!P(3V&Nr6C$XejWfQDiI(Fdt@un?|lo#M+5oIi_w{w zo%_#%{(V=tO#a9gB!7-$M?^BX5>d|Vn*3S!?g~$*UQipUPL&zMmg;!4Do9IA%up=Rh? z=qPj=x&RGBx1dpI68aT-2O}^EromdU5o`ssU{5#*j)WJ%$?!5bA1;Eoz?EiTr=n?cd`V|I)p<|3Oju?MT93~aB0<#&j8`F+Cg&D?-VWzQItUA^l>xvD zRIYI4MQ`g1<+DyrL=EogS06Xii({| zv`U^zjmmKqDIK93(F5q|^fLNk`gQs{RV`IdRle#b)i%{Ds;|}NsClUI)k@Ub)kf6b zsWa4l)YH_rsduU0(?DsMX@qO!YV6TCtMPOWZH~(v?wpc2hv(eZgf-1HBQ#fN?$aF5 zoYvCT^3%%Fs?s{6^;Da#?V+8jy+iwi_M{F~$4y6|vqR^k&SQoO!;_KDsATjprgSxR z{dFa}^}2()GkV5)QF?`X?Rxk03HmJkB>f%wz4}uIItC#I1qQ7Kw+-=zEW;GTU55RJ zuZ@h2VvIHzbs0S}Rx=JT&Npr~zH34@aW`3J(qMAU6l2OVO*7qXdf5y%vo}jIt1%lg zhs_<#1?IcWhb_<+P8LFo28$a^64R5J!)#@aTGB0pEekEXET35!SjAgyv+B3{Xl-wu zZrx~o$A)4PXj5p@WAm%6nJw40#`fA=@?77!tLJvleQsxN$G6*KchjC~A7a13zSsVP zgQJ7Uq0M2^(ZDg$vDWbhi^d9LZDyT!LOXdmt#&%*^w!zIS?qk+`4<X~g?%56 z2@eae34a)26HyS+zks@6$%2*zuOhu7%OdYYnM6sVdZQJi6QY}=U&naIl*dS8tzuWk zUW(I*6U24LW8oFzvR(TOpM zEs5_rp_~TJ^wNN(wM(bCZ0;`Z6P^ce2XB(^$}i_nB)KM)Cp}7bP2Qe7nc|*Ok@8f) z7E}wKr~0SXrM^xJP1~RLDLp2=Jp-4Km~m7{5vB?IGPN`FGKaIwvx>8%%bb_(Ts9>N z5;bK**^9Ef#WdN^)PTf9vR*Qp{o-l7 zTcBI8wqSIn=gRt3(5j`YdRObOE?Pal#&6AmwS={4Ykw%TE-Wv6xh`g1Pmxy9nxe7w ze(PI{6^cd0H#WFzsN0CzDA+i-Y3`<~O&?2mB^OJrODjs>Z{}{k_?699m0x|@lC)*8 z%%N=0R?Jr6*6Z8cw;d=~F3&F?+a9vLa|dHb$&Qyhm+ZVyVOLSNi?B>BD~Ee(8aT1AWbo&CM;EEoH56tE6@EV8X%6-*|u1-NtOIZ>P7H z9s-9XhaP{M`0e$>L5F*fu#U8SXZT%h2eqT56Y5;vIn|ZYCGC#u9zGg)w718lr{jCe z@An_mJyvsE<#^c%!il02pHAkVoIaIx>gnm^(__6$dheWxJ#(!uyl?Pq(Ao3ne9xWf z_v}A;-u3*k3(gmgUSwVDy5w-FbHIL};|Kd6ItCpEJBJ*Hx-UCj?irppeBz4xmD5+f zub#UWaP88_{E^}7QP*$YNVp-r$-DXJR{E{yw{vdK+*xxMeYfPE(!GlNn)e%iH2tw% z>L5Kn>ODH}V8MesW8ASPKV|>)e!S=*`C-L`&P4Mg+egPHeJ3wJUif(YN!F8@r^P=j z|6Kdbc>FRj6+1QlT=e|YubW?}zu5oM?q%0Dy!50Qvv` z0D$NK0Cg|`0P0`>06Lfe02gqax=}m;000SaNLh0L01FZT01FZU(%pXi0000RbVXQn zQ*UN;cVTj607GSLb9r+hQ*?D?X>TA@Z*OeDr{R16002r!L_t(Ijbr@(|33pUfRSW{ zSATp#(V@-3!#LO!6788`rBM0r3=|!AnKQ5l&j2bU+B3sSA;+)dC^~+ySz-^K0aQq| cXXvjG0Be?s#g#f16951J07*qoM6N<$g7%SQY5)KL literal 0 HcmV?d00001 diff --git a/Particles/DirectionalPulseRing.cs b/Particles/DirectionalPulseRing.cs index 5e22c895b4..682cd28511 100644 --- a/Particles/DirectionalPulseRing.cs +++ b/Particles/DirectionalPulseRing.cs @@ -4,6 +4,8 @@ using System; using static CalamityMod.CalamityUtils; using Terraria; using Terraria.ModLoader; +using rail; +using CalamityMod.CalPlayer; namespace CalamityMod.Particles { @@ -14,13 +16,16 @@ namespace CalamityMod.Particles public override bool SetLifetime => true; public override bool UseCustomDraw => true; + public Player player = Main.player[Main.myPlayer]; + private float OriginalScale; private float FinalScale; private float opacity; private Vector2 Squish; private Color BaseColor; + private bool LockToPlayerPosition; - public DirectionalPulseRing(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime) + public DirectionalPulseRing(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool lockToPlayerPosition) { Position = position; Velocity = velocity; @@ -31,6 +36,7 @@ namespace CalamityMod.Particles Lifetime = lifeTime; Squish = squish; Rotation = rotation; + LockToPlayerPosition = lockToPlayerPosition; } public override void Update() @@ -43,6 +49,9 @@ namespace CalamityMod.Particles Color = BaseColor * opacity; Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f); Velocity *= 0.95f; + + if (LockToPlayerPosition) + Position = player.MountedCenter; } public override void CustomDraw(SpriteBatch spriteBatch) diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs index 6f6b7ba4cb..0de9620788 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunHoldout.cs @@ -121,7 +121,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal TargetRecoil = recoil; // Shooty ring - Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * GunLength, Vector2.Zero, Color.DeepSkyBlue, new Vector2(0.5f, 1f), direction.ToRotation(), 0.2f, 1f, 30); + Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * GunLength, Vector2.Zero, Color.DeepSkyBlue, new Vector2(0.5f, 1f), direction.ToRotation(), 0.2f, 1f, 30, false); GeneralParticleHandler.SpawnParticle(pulse); return; } diff --git a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs index d2e942b6a8..0e789496f0 100644 --- a/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs +++ b/Projectiles/DraedonsArsenal/AnomalysNanogunPlasmaBeam.cs @@ -69,7 +69,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal int step = 10; while (step < LaserLength) { - Particle pulse = new DirectionalPulseRing(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, new Vector2(0.5f, 1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12); + Particle pulse = new DirectionalPulseRing(Projectile.Center + MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * step, Vector2.Zero, Color.Red, new Vector2(0.5f, 1f), MathHelper.WrapAngle(Projectile.rotation + MathHelper.PiOver2), 0.1f, 1f, 12, false); GeneralParticleHandler.SpawnParticle(pulse); step += 100; } diff --git a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs index ebc322e266..e25cf4e66d 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesProjectile.cs @@ -138,7 +138,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal boomDust.noGravity = true; } - Particle boom = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.White, Vector2.One, 0f, 0.05f, 1f + Main.rand.NextFloat(0.2f), 20); + Particle boom = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.White, Vector2.One, 0f, 0.05f, 1f + Main.rand.NextFloat(0.2f), 20, false); GeneralParticleHandler.SpawnParticle(boom); SoundEngine.PlaySound(SoundID.Item14, Projectile.Center); diff --git a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs index a789a53b17..499d7780cd 100644 --- a/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs +++ b/Projectiles/DraedonsArsenal/SnakeEyesSummon.cs @@ -71,7 +71,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal // Random flavor pulse. if (Main.rand.NextBool(100)) { - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkCyan, Vector2.One, 0f, 0.05f, 0.4f + Main.rand.NextFloat(0.2f), 30); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkCyan, Vector2.One, 0f, 0.05f, 0.4f + Main.rand.NextFloat(0.2f), 30, false); GeneralParticleHandler.SpawnParticle(pulse); } @@ -229,7 +229,7 @@ namespace CalamityMod.Projectiles.DraedonsArsenal pulseDust.noGravity = true; } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, empowered ? Color.White : Color.DarkCyan * 1.2f, Vector2.One, 0f, 0.05f, 0.5f + Main.rand.NextFloat(0.2f), 20); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, empowered ? Color.White : Color.DarkCyan * 1.2f, Vector2.One, 0f, 0.05f, 0.5f + Main.rand.NextFloat(0.2f), 20, false); GeneralParticleHandler.SpawnParticle(pulse); } diff --git a/Projectiles/Magic/CoralSpoutHoldout.cs b/Projectiles/Magic/CoralSpoutHoldout.cs index 7ad3a1471c..a2428f6955 100644 --- a/Projectiles/Magic/CoralSpoutHoldout.cs +++ b/Projectiles/Magic/CoralSpoutHoldout.cs @@ -137,7 +137,7 @@ namespace CalamityMod.Projectiles.Magic } Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue; - Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * 44f, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.04f, 0.2f, 30); + Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * 44f, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.04f, 0.2f, 30, false); GeneralParticleHandler.SpawnParticle(pulse); } @@ -154,7 +154,7 @@ namespace CalamityMod.Projectiles.Magic } Color pulseColor = Main.rand.NextBool() ? Color.Coral : Color.DeepSkyBlue; - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), direction.ToRotation(), 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30, false); GeneralParticleHandler.SpawnParticle(pulse); } } diff --git a/Projectiles/Melee/GalaxySmasherEcho.cs b/Projectiles/Melee/GalaxySmasherEcho.cs index 7699be7196..d69b6f420e 100644 --- a/Projectiles/Melee/GalaxySmasherEcho.cs +++ b/Projectiles/Melee/GalaxySmasherEcho.cs @@ -131,9 +131,9 @@ namespace CalamityMod.Projectiles.Melee else SoundEngine.PlaySound(SlamHamSound, Projectile.Center); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.2f, 4f, 12); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.2f, 4f, 12, false); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.5f, 11); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.5f, 11, false); GeneralParticleHandler.SpawnParticle(pulse2); Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity * 0f, ModContent.ProjectileType(), Projectile.damage / 2, Projectile.knockBack, Projectile.owner, 0f); diff --git a/Projectiles/Melee/GalaxySmasherHammer.cs b/Projectiles/Melee/GalaxySmasherHammer.cs index 5e0f3f7d22..792a83f043 100644 --- a/Projectiles/Melee/GalaxySmasherHammer.cs +++ b/Projectiles/Melee/GalaxySmasherHammer.cs @@ -153,7 +153,7 @@ namespace CalamityMod.Projectiles.Melee if (InPulse == 0) { SoundEngine.PlaySound(RedHamSound, Projectile.Center); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.95f, 120); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Aqua, new Vector2(1f, 1f), Main.rand.NextFloat(12f, 25f), 0.1f, 1.95f, 120, false); GeneralParticleHandler.SpawnParticle(pulse); InPulse = 1; } @@ -244,7 +244,7 @@ namespace CalamityMod.Projectiles.Melee } if (PulseCooldown >= 15); { - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(0.5f, 0.5f), Main.rand.NextFloat(12f, 25f), 0.2f, 1.4f + (EmpoweredHammer * 0.1f), 14); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Violet, new Vector2(0.5f, 0.5f), Main.rand.NextFloat(12f, 25f), 0.2f, 1.4f + (EmpoweredHammer * 0.1f), 14, false); GeneralParticleHandler.SpawnParticle(pulse); PulseCooldown = 0; } diff --git a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs index cb6fd3520b..a82cba78b3 100644 --- a/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs +++ b/Projectiles/Ranged/AdamantiteAcceleratorHoldout.cs @@ -145,7 +145,7 @@ namespace CalamityMod.Projectiles.Ranged SoundEngine.PlaySound(SoundID.Item92, NuzzlePosition); SoundEngine.PlaySound(SoundID.Item60, NuzzlePosition); - Particle pulse = new DirectionalPulseRing(NuzzlePosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30); + Particle pulse = new DirectionalPulseRing(NuzzlePosition + Projectile.rotation.ToRotationVector2() * 5f, Vector2.Zero, color, new Vector2(0.5f, 1f), Projectile.rotation, 0.05f, 0.34f + Main.rand.NextFloat(0.3f), 30, false); GeneralParticleHandler.SpawnParticle(pulse); if (Owner == Main.LocalPlayer && Owner.Calamity().GeneralScreenShakePower < 5) diff --git a/Projectiles/Ranged/NovaChargeShot.cs b/Projectiles/Ranged/NovaChargeShot.cs index ebfc7e3cf3..f1b4904e95 100644 --- a/Projectiles/Ranged/NovaChargeShot.cs +++ b/Projectiles/Ranged/NovaChargeShot.cs @@ -74,9 +74,9 @@ namespace CalamityMod.Projectiles.Ranged dust2.scale = Main.rand.NextFloat(0.8f, 1.5f); } SoundEngine.PlaySound(ChargeImpact, Projectile.position); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.6f, 20); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Lime, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.6f, 20, false); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Chartreuse, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.5f, 16); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Chartreuse, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 0.5f, 16, false); GeneralParticleHandler.SpawnParticle(pulse2); for (int i = 0; i < 25; ++i) diff --git a/Projectiles/Ranged/PressurizedBubbleStream.cs b/Projectiles/Ranged/PressurizedBubbleStream.cs index 8661718601..ac14958270 100644 --- a/Projectiles/Ranged/PressurizedBubbleStream.cs +++ b/Projectiles/Ranged/PressurizedBubbleStream.cs @@ -98,7 +98,7 @@ namespace CalamityMod.Projectiles.Ranged PulseTimer = PrevPulseTimer * 2f; Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.SkyBlue : Color.LightSkyBlue) : (Main.rand.NextBool() ? Color.LightBlue : Color.DeepSkyBlue); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.05f, 0.2f + 0.3f * (1 - Progress), 30); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, pulseColor, new Vector2(0.5f, 1f), Projectile.velocity.ToRotation(), 0.05f, 0.2f + 0.3f * (1 - Progress), 30, false); GeneralParticleHandler.SpawnParticle(pulse); int numDust = 18; diff --git a/Projectiles/Ranged/TitaniumRailgunScope.cs b/Projectiles/Ranged/TitaniumRailgunScope.cs index ca386ce464..ddb329f7d4 100644 --- a/Projectiles/Ranged/TitaniumRailgunScope.cs +++ b/Projectiles/Ranged/TitaniumRailgunScope.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Ranged // Spawn a ring particle based off charge percent to emphasize the impact float originalScale = 0.2f * ChargePercent; float maxScale = 1f * ChargePercent; - Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * WeaponLength, Vector2.Zero, Color.White, new Vector2(0.5f, 1f), direction.ToRotation(), originalScale, maxScale, 30); + Particle pulse = new DirectionalPulseRing(Owner.MountedCenter + direction * WeaponLength, Vector2.Zero, Color.White, new Vector2(0.5f, 1f), direction.ToRotation(), originalScale, maxScale, 30, false); GeneralParticleHandler.SpawnParticle(pulse); // Play a sound with volume scaling with charge percent diff --git a/Projectiles/Rogue/RealityRuptureStealth.cs b/Projectiles/Rogue/RealityRuptureStealth.cs index d5c0e1887f..8e961008cf 100644 --- a/Projectiles/Rogue/RealityRuptureStealth.cs +++ b/Projectiles/Rogue/RealityRuptureStealth.cs @@ -95,7 +95,7 @@ namespace CalamityMod.Projectiles.Rogue { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, 272, Projectile.oldVelocity.X * 0.3f, Projectile.oldVelocity.Y * 0.3f, 0, default, Main.rand.NextFloat(1.7f, 2.1f)); } - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Plum, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1f, 13); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.Plum, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0.1f, 1f, 13, false); GeneralParticleHandler.SpawnParticle(pulse); } } diff --git a/Projectiles/Typeless/PauldronExplosion.cs b/Projectiles/Typeless/PauldronExplosion.cs index e3fd808406..193dd89277 100644 --- a/Projectiles/Typeless/PauldronExplosion.cs +++ b/Projectiles/Typeless/PauldronExplosion.cs @@ -37,9 +37,9 @@ namespace CalamityMod.Projectiles.Typeless { target.AddBuff(BuffID.OnFire3, 240); - Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20); + Particle pulse = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.OrangeRed, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.8f, 1.1f), 20, false); GeneralParticleHandler.SpawnParticle(pulse); - Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20); + Particle pulse2 = new DirectionalPulseRing(Projectile.Center, Vector2.Zero, Color.DarkOrange, new Vector2(2f, 2f), Main.rand.NextFloat(12f, 25f), 0f, Main.rand.NextFloat(0.6f, 0.9f), 20, false); GeneralParticleHandler.SpawnParticle(pulse2); }