From 3ebef3e1e1080753d0aa71daa4338ac4701dac49 Mon Sep 17 00:00:00 2001 From: Xhack <72313282+energykid@users.noreply.github.com> Date: Wed, 7 Aug 2024 19:39:05 -0400 Subject: [PATCH] Small changes + fixed vortex --- NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs | 15 ++++---- Particles/MediumMistParticle.cs | 3 +- Projectiles/Boss/OldDukeGore.cs | 35 +++++++------------ Projectiles/Boss/OldDukeVortex.cs | 24 +++++++++++++ 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs index 23de0e8e3e..8883d47367 100644 --- a/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs +++ b/NPCs/CalamityAIs/CalamityBossAIs/OldDukeAI.cs @@ -1651,20 +1651,19 @@ namespace CalamityMod.NPCs.CalamityAIs.CalamityBossAIs SoundEngine.PlaySound(phase > 1 ? OldDuke.OldDuke.DashSoundP3 : OldDuke.OldDuke.DashSound, npc.Center); if (phase > 1) - { - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); - SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); - GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); - } - - if (phase > 0) { for (int i = 0; i < 30; i++) { float fl = Main.rand.NextFloat(-60, 60); GeneralParticleHandler.SpawnParticle(new SparkParticle(npc.Center + (Vector2.Zero.DirectionTo(npc.velocity) * 20) + new Vector2(0, fl).RotatedBy(Vector2.Zero.AngleTo(npc.velocity)), (-npc.velocity * Main.rand.NextFloat(2f)).RotatedBy(MathHelper.ToRadians(fl)), false, 25, Main.rand.NextFloat(0.3f, 1.2f), FireGreen)); } + + CalamityUtils.AddScreenshakeAt(npc.Center, 10, 3000); + + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballImpact, npc.Center); + SoundEngine.PlaySound(SoundID.DD2_BetsyFireballShot, npc.Center); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 3, FireGreen, "CalamityMod/Particles/DustyCircleHardEdge", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.05f, 0.2f, 20)); + GeneralParticleHandler.SpawnParticle(new CustomPulse(npc.Center, -npc.velocity / 2, FireGreen, "CalamityMod/Particles/FlameExplosion", new Vector2(0.4f, 1.2f), Vector2.Zero.AngleTo(npc.velocity) + (Main.rand.NextBool() ? 0 : -MathHelper.Pi), 0.1f, 0.4f, 20)); } } static void DoChargeVisual(NPC npc, int phase) diff --git a/Particles/MediumMistParticle.cs b/Particles/MediumMistParticle.cs index d35f5330ca..358ccdbcbc 100644 --- a/Particles/MediumMistParticle.cs +++ b/Particles/MediumMistParticle.cs @@ -1,4 +1,5 @@ -using Microsoft.Xna.Framework; +using System.Collections.Generic; +using Microsoft.Xna.Framework; using Terraria; diff --git a/Projectiles/Boss/OldDukeGore.cs b/Projectiles/Boss/OldDukeGore.cs index 34f853d9bb..e11f6d75fb 100644 --- a/Projectiles/Boss/OldDukeGore.cs +++ b/Projectiles/Boss/OldDukeGore.cs @@ -51,43 +51,32 @@ namespace CalamityMod.Projectiles.Boss Projectile.rotation += Projectile.velocity.X * 0.1f; + MediumMistParticle mist2 = new MediumMistParticle(Projectile.Center, Projectile.velocity, OldDuke.GlowColor, Color.DarkSlateBlue, Main.rand.NextFloat(1f), 200f); + mist2.AffectedByLight = true; + + GeneralParticleHandler.SpawnParticle(new HeavySmokeParticle(Projectile.Center, (Projectile.velocity / 2) + new Vector2(Main.rand.NextFloat(-1f, 1f), Main.rand.NextFloat(-1f, 1f)), Color.DarkRed, 20, Main.rand.NextFloat(0.2f, 1f), 0.2f, MathHelper.ToRadians(Main.rand.NextFloat(-2f, 2f)), affectedByLight: true)); + GeneralParticleHandler.SpawnParticle(mist2); + int blood = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Blood, 0f, 0f, 100, default, 1f); Main.dust[blood].noGravity = true; Main.dust[blood].velocity *= 0f; - - int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default, 1f); - Main.dust[acid].noGravity = true; - Main.dust[acid].velocity *= 0f; } public override void OnSpawn(IEntitySource source) { + for (int i = 0; i < 3; i++) + { + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center + (Projectile.velocity * 2f), Projectile.velocity.RotatedBy(MathHelper.ToRadians(Main.rand.NextFloat(-20, 20))) * Main.rand.NextFloat(3f), true, 8, Main.rand.NextFloat(1f, 2f), Color.DarkRed.MultiplyRGBA(new Color(0.3f, 0.3f, 0.3f, 0.3f)), false, true)); + } } public override void OnKill(int timeLeft) { SoundEngine.PlaySound(SoundID.NPCDeath12, Projectile.Center); - int dustAmt = 8; - for (int i = 0; i < dustAmt; i++) + for (int i = 0; i < 15; i++) { - Vector2 dustRotation = Vector2.Normalize(Projectile.velocity) * new Vector2((float)Projectile.width / 2f, (float)Projectile.height) * 0.75f; - dustRotation = dustRotation.RotatedBy((double)((float)(i - (dustAmt / 2 - 1)) * 6.28318548f / (float)dustAmt), default) + Projectile.Center; - Vector2 dustVel = dustRotation - Projectile.Center; - int blood = Dust.NewDust(dustRotation + dustVel, 0, 0, DustID.Blood, dustVel.X, dustVel.Y, 100, default, 1.2f); - Main.dust[blood].noGravity = true; - Main.dust[blood].noLight = true; - Main.dust[blood].velocity = dustVel; - } - - for (int d = 0; d < 6; d++) - { - int acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 3f); - Main.dust[acid].noGravity = true; - Main.dust[acid].velocity *= 5f; - acid = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, (int)CalamityDusts.SulphurousSeaAcid, 0f, 0f, 100, default(Color), 2f); - Main.dust[acid].velocity *= 2f; - Main.dust[acid].noGravity = true; + GeneralParticleHandler.SpawnParticle(new PointParticle(Projectile.Center, new Vector2(Main.rand.NextFloat(10), 0).RotatedByRandom(MathHelper.TwoPi), true, 10, Main.rand.NextFloat(0.5f, 1.5f), Color.DarkRed, false, true)); } } diff --git a/Projectiles/Boss/OldDukeVortex.cs b/Projectiles/Boss/OldDukeVortex.cs index 3d1cbd6b4b..fce758e2a0 100644 --- a/Projectiles/Boss/OldDukeVortex.cs +++ b/Projectiles/Boss/OldDukeVortex.cs @@ -97,6 +97,30 @@ namespace CalamityMod.Projectiles.Boss } } + float distanceRequired = 800f * Projectile.scale; + float succPower = Main.zenithWorld ? 1f : 0.5f; + foreach (Player player in Main.ActivePlayers) + { + float distance = Vector2.Distance(player.Center, Projectile.Center); + if (distance < distanceRequired && player.grappling[0] == -1) + { + if (Collision.CanHit(Projectile.Center, 1, 1, player.Center, 1, 1)) + { + float distanceRatio = distance / distanceRequired; + + float wingTimeSet = (float)Math.Ceiling((float)player.wingTimeMax * 0.5f * distanceRatio); + if (player.wingTime > wingTimeSet) + player.wingTime = wingTimeSet; + + float multiplier = 1f - distanceRatio; + if (player.Center.X < Projectile.Center.X) + player.velocity.X += succPower * multiplier; + else + player.velocity.X -= succPower * multiplier; + } + } + } + if (Projectile.timeLeft <= 85) { Projectile.localAI[2] += 1f / 85f;