From 60d6add4e1bd23c7581ba31c59c7c8b77bf0ee3e Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Fri, 13 Dec 2024 12:18:42 +0700 Subject: [PATCH] Projectile spread fixes continued Except for Arch Amaryllis (BeamingBolt) in which the change is to make the even circle follow projectile travel direction like its downgrades --- Projectiles/Magic/BeamingBolt.cs | 4 ++-- Projectiles/Magic/GleamingBolt.cs | 12 ++++------- Projectiles/Magic/ManaBolt.cs | 13 +++++------- Projectiles/Magic/PlasmaRay.cs | 14 ++++--------- Projectiles/Magic/VividBeam.cs | 12 ++++------- Projectiles/Melee/DracoBeam.cs | 12 +++-------- Projectiles/Melee/RSSolarFlare.cs | 13 +++--------- Projectiles/Ranged/MagnomalyRocket.cs | 12 ++++------- Projectiles/Ranged/SlagRound.cs | 12 +++-------- Projectiles/Rogue/CelestusProj.cs | 11 +++------- Projectiles/Rogue/ReboundingRainbowProj.cs | 17 ++++++---------- Projectiles/Rogue/RegulusRiotProj.cs | 11 +++------- .../Rogue/TarragonThrowingDartProjectile.cs | 15 +++----------- Projectiles/Typeless/CursorProj.cs | 20 ++++--------------- 14 files changed, 51 insertions(+), 127 deletions(-) diff --git a/Projectiles/Magic/BeamingBolt.cs b/Projectiles/Magic/BeamingBolt.cs index 6c069c3319..4861b6e389 100644 --- a/Projectiles/Magic/BeamingBolt.cs +++ b/Projectiles/Magic/BeamingBolt.cs @@ -61,8 +61,8 @@ namespace CalamityMod.Projectiles.Magic { for (int i = 0; i < 8; i++) { - Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1), Projectile.knockBack, Projectile.owner, Projectile.ai[0]); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, Projectile.ai[0]); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/GleamingBolt.cs b/Projectiles/Magic/GleamingBolt.cs index 1443b9062c..8fdd57539f 100644 --- a/Projectiles/Magic/GleamingBolt.cs +++ b/Projectiles/Magic/GleamingBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -44,17 +45,12 @@ namespace CalamityMod.Projectiles.Magic }); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, randomDust, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.75), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item105, Projectile.Center); diff --git a/Projectiles/Magic/ManaBolt.cs b/Projectiles/Magic/ManaBolt.cs index de520ad65e..aeb777d2c8 100644 --- a/Projectiles/Magic/ManaBolt.cs +++ b/Projectiles/Magic/ManaBolt.cs @@ -1,4 +1,5 @@ using System; +using Microsoft.Xna.Framework; using Terraria; using Terraria.Audio; using Terraria.ID; @@ -37,17 +38,13 @@ namespace CalamityMod.Projectiles.Magic Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.MagicMirror, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.TerraBlade, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 90f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + int type = (i < 3 ? ModContent.ProjectileType() : ModContent.ProjectileType()); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, type, (int)(Projectile.damage * 0.5), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item10, Projectile.Center); diff --git a/Projectiles/Magic/PlasmaRay.cs b/Projectiles/Magic/PlasmaRay.cs index b0c6fe4ce1..76a251b329 100644 --- a/Projectiles/Magic/PlasmaRay.cs +++ b/Projectiles/Magic/PlasmaRay.cs @@ -53,19 +53,13 @@ namespace CalamityMod.Projectiles.Magic public override bool OnTileCollide(Vector2 oldVelocity) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 1.75), Projectile.knockBack, Projectile.owner); } } Projectile.penetrate--; diff --git a/Projectiles/Magic/VividBeam.cs b/Projectiles/Magic/VividBeam.cs index 028a3a5681..79df19ea9c 100644 --- a/Projectiles/Magic/VividBeam.cs +++ b/Projectiles/Magic/VividBeam.cs @@ -125,15 +125,11 @@ namespace CalamityMod.Projectiles.Magic break; case 2f: - float spread = 30f * 0.01f * MathHelper.PiOver2; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + float offset = Main.rand.NextFloat(MathHelper.TwoPi); + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(source, Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - offset).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } break; } diff --git a/Projectiles/Melee/DracoBeam.cs b/Projectiles/Melee/DracoBeam.cs index e75c10b4c5..d27aec629b 100644 --- a/Projectiles/Melee/DracoBeam.cs +++ b/Projectiles/Melee/DracoBeam.cs @@ -57,18 +57,12 @@ namespace CalamityMod.Projectiles.Melee { if (Projectile.numHits < 1) { - float spread = 30f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.Pi / 8f)).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Melee/RSSolarFlare.cs b/Projectiles/Melee/RSSolarFlare.cs index 1365f97247..e3515eca78 100644 --- a/Projectiles/Melee/RSSolarFlare.cs +++ b/Projectiles/Melee/RSSolarFlare.cs @@ -82,18 +82,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; if (Projectile.owner == Main.myPlayer) { - for (int i = 0; i < 1; i++) - { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0f, 0f); - } + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(-MathHelper.PiOver2), ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item14, Projectile.position); Projectile.position.X = Projectile.position.X + (float)(Projectile.width / 2); diff --git a/Projectiles/Ranged/MagnomalyRocket.cs b/Projectiles/Ranged/MagnomalyRocket.cs index 12dacb88a4..b46d7237e6 100644 --- a/Projectiles/Ranged/MagnomalyRocket.cs +++ b/Projectiles/Ranged/MagnomalyRocket.cs @@ -185,15 +185,11 @@ namespace CalamityMod.Projectiles.Ranged { if (Projectile.owner == Main.myPlayer) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - for (int i = 0; i < 4; i++) + float angleOffset = Main.rand.NextFloat(-30f, 30f); + for (int i = 0; i < 8; i++) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int proj1 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); - int proj2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), Projectile.damage / 4, Projectile.knockBack / 4, Projectile.owner, 0f, 1f); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f + angleOffset) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25), Projectile.knockBack * 0.25f, Projectile.owner, ai1: 1f); } } } diff --git a/Projectiles/Ranged/SlagRound.cs b/Projectiles/Ranged/SlagRound.cs index acfbcffc99..bc9098440e 100644 --- a/Projectiles/Ranged/SlagRound.cs +++ b/Projectiles/Ranged/SlagRound.cs @@ -58,18 +58,12 @@ namespace CalamityMod.Projectiles.Ranged { Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Sand, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f); } - float spread = 180f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - int i; if (Projectile.owner == Main.myPlayer) { - for (i = 0; i <= 1; i++) + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 4f) - (MathHelper.Pi / 2f - Projectile.velocity.ToRotation())).ToRotationVector2() * 3.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.35), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/CelestusProj.cs b/Projectiles/Rogue/CelestusProj.cs index 3ff5f325cb..d1f724e892 100644 --- a/Projectiles/Rogue/CelestusProj.cs +++ b/Projectiles/Rogue/CelestusProj.cs @@ -152,15 +152,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 2.5f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.7), Projectile.knockBack, Projectile.owner); } } SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); diff --git a/Projectiles/Rogue/ReboundingRainbowProj.cs b/Projectiles/Rogue/ReboundingRainbowProj.cs index 7a05825cc5..8f847a26a8 100644 --- a/Projectiles/Rogue/ReboundingRainbowProj.cs +++ b/Projectiles/Rogue/ReboundingRainbowProj.cs @@ -142,20 +142,15 @@ namespace CalamityMod.Projectiles.Rogue int splitProj = ModContent.ProjectileType(); if (Projectile.owner == Main.myPlayer && Main.player[Projectile.owner].ownedProjectileCounts[splitProj] < 16) { - float spread = 45f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - double offsetAngle; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - int disk = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f), (float)(Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); - int disk2 = Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f), (float)(-Math.Cos(offsetAngle) * 5f), splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 4f; + Projectile split = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, velocity, splitProj, Projectile.damage, Projectile.knockBack, Projectile.owner); if (Projectile.Calamity().stealthStrike) { - Main.projectile[disk].idStaticNPCHitCooldown = Main.projectile[disk2].idStaticNPCHitCooldown = 8; - Main.projectile[disk].usesIDStaticNPCImmunity = Main.projectile[disk2].usesIDStaticNPCImmunity = true; - Main.projectile[disk].timeLeft = Main.projectile[disk2].timeLeft = 60; + split.idStaticNPCHitCooldown = 8; + split.usesIDStaticNPCImmunity = true; + split.timeLeft = 60; } } } diff --git a/Projectiles/Rogue/RegulusRiotProj.cs b/Projectiles/Rogue/RegulusRiotProj.cs index 894510f190..83667543fa 100644 --- a/Projectiles/Rogue/RegulusRiotProj.cs +++ b/Projectiles/Rogue/RegulusRiotProj.cs @@ -177,15 +177,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.owner == Main.myPlayer) { - float spread = 60f * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 6f; - double offsetAngle; - for (int i = 0; i < 3; i++) + for (int i = 0; i < 6; i++) { - offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 2f), (float)(Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 2f), (float)(-Math.Cos(offsetAngle) * 2f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner, 0f, 0f); + Vector2 velocity = ((MathHelper.TwoPi * i / 6f) - (MathHelper.Pi / 3f - Projectile.velocity.ToRotation())).ToRotationVector2() * 2f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.4), Projectile.knockBack, Projectile.owner); } } } diff --git a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs index 7b4cbfeb6e..9741c76fb2 100644 --- a/Projectiles/Rogue/TarragonThrowingDartProjectile.cs +++ b/Projectiles/Rogue/TarragonThrowingDartProjectile.cs @@ -51,19 +51,10 @@ namespace CalamityMod.Projectiles.Rogue { if (Projectile.Calamity().stealthStrike) { - float random = Main.rand.Next(30, 90); - float spread = random * 0.0174f; - double startAngle = Math.Atan2(Projectile.velocity.X, Projectile.velocity.Y) - spread / 2; - double deltaAngle = spread / 8f; - - int projID = ModContent.ProjectileType(); - int splitDamage = (int)(Projectile.damage * 0.25f); - float splitKB = 1f; - for (int i = 0; i < 4; i++) + for (int i = 0; i < 8; i++) { - double offsetAngle = startAngle + deltaAngle * (i + i * i) / 2f + 32f * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(Math.Sin(offsetAngle) * 5f) * 2f, (float)(Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, (float)(-Math.Sin(offsetAngle) * 5f) * 2f, (float)(-Math.Cos(offsetAngle) * 5f) * 2f, projID, splitDamage, splitKB, Projectile.owner); + Vector2 velocity = ((MathHelper.TwoPi * i / 8f) - (MathHelper.ToRadians(67.5f) - Projectile.velocity.ToRotation())).ToRotationVector2() * 10f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType(), (int)(Projectile.damage * 0.25f), Projectile.knockBack * 0.25f, Projectile.owner); } } } diff --git a/Projectiles/Typeless/CursorProj.cs b/Projectiles/Typeless/CursorProj.cs index a84c07f3e1..99313d1a2a 100644 --- a/Projectiles/Typeless/CursorProj.cs +++ b/Projectiles/Typeless/CursorProj.cs @@ -189,23 +189,11 @@ namespace CalamityMod.Projectiles.Typeless public override void OnKill(int timeLeft) { - Vector2 velocity = Projectile.velocity; - velocity.Normalize(); - velocity *= 4f; - - int spread = 45; - int numProj = 4; - float rotation = MathHelper.ToRadians(spread); - float baseSpeed = (float)Math.Sqrt(velocity.X * velocity.X + velocity.Y * velocity.Y); - double startAngle = Math.Atan2(velocity.X, velocity.Y) - rotation / 2; - double deltaAngle = rotation / (float)numProj; - double offsetAngle; - - for (int i = 0; i < numProj; i++) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 4f; + for (int i = 0; i < 4; i++) { - offsetAngle = startAngle + deltaAngle * i; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center.X, Projectile.Center.Y, baseSpeed * (float)Math.Sin(offsetAngle), baseSpeed * (float)Math.Cos(offsetAngle), - ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner, 0f, 0f); + float offset = MathHelper.ToRadians(MathHelper.Lerp(-22.5f, 22.5f, i / 3f)); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Projectile.velocity.RotatedBy(offset), ModContent.ProjectileType(), Projectile.damage / 3, Projectile.knockBack * 0.33f, Projectile.owner); } SoundEngine.PlaySound(SoundID.Item110, Projectile.Center);