From 2d41ef40869fb2b99e9b6deafd3e3d9cd74fc0cc Mon Sep 17 00:00:00 2001 From: termigator1359 <45545085+termigator1359@users.noreply.github.com> Date: Mon, 5 Oct 2020 16:57:19 -0400 Subject: [PATCH] Adjusted Norfleet and Starmada offsets again --- Projectiles/Ranged/NorfleetCannon.cs | 2 +- Projectiles/Ranged/NorfleetComet.cs | 66 +++++++++++-------------- Projectiles/Ranged/NorfleetExplosion.cs | 64 ++++-------------------- Projectiles/Ranged/StarfleetMK2Gun.cs | 2 +- 4 files changed, 41 insertions(+), 93 deletions(-) diff --git a/Projectiles/Ranged/NorfleetCannon.cs b/Projectiles/Ranged/NorfleetCannon.cs index 9778944da6..bda71edb15 100644 --- a/Projectiles/Ranged/NorfleetCannon.cs +++ b/Projectiles/Ranged/NorfleetCannon.cs @@ -110,7 +110,7 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(64, 10).RotatedBy(projectile.rotation); + Vector2 displayOffset = new Vector2(15, -10f * projectile.direction).RotatedBy(projectile.rotation); projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; if (projectile.spriteDirection == -1) projectile.rotation += MathHelper.Pi; diff --git a/Projectiles/Ranged/NorfleetComet.cs b/Projectiles/Ranged/NorfleetComet.cs index 39d6e1a5d7..3b73e13965 100644 --- a/Projectiles/Ranged/NorfleetComet.cs +++ b/Projectiles/Ranged/NorfleetComet.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -52,34 +53,30 @@ namespace CalamityMod.Projectiles.Ranged projectile.localAI[0] = 0f; for (int l = 0; l < 12; l++) { - Vector2 vector3 = Vector2.UnitX * (float)-(float)projectile.width / 2f; - vector3 += -Vector2.UnitY.RotatedBy((double)((float)l * 3.14159274f / 6f), default) * new Vector2(8f, 16f); - vector3 = vector3.RotatedBy((double)(projectile.rotation - 1.57079637f), default); - int num9 = Dust.NewDust(projectile.Center, 0, 0, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 160, default, 1f); - Main.dust[num9].scale = 1.1f; - Main.dust[num9].noGravity = true; - Main.dust[num9].position = projectile.Center + vector3; - Main.dust[num9].velocity = projectile.velocity * 0.1f; - Main.dust[num9].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[num9].position) * 1.25f; + Vector2 dustOffset = Vector2.UnitX * (float)-(float)projectile.width / 2f; + dustOffset += -Vector2.UnitY.RotatedBy((double)((float)l * MathHelper.Pi / 6f), default) * new Vector2(8f, 16f); + dustOffset = dustOffset.RotatedBy((double)(projectile.rotation - MathHelper.PiOver2), default); + int idx = Dust.NewDust(projectile.Center, 0, 0, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 160, default, 1f); + Main.dust[idx].scale = 1.1f; + Main.dust[idx].noGravity = true; + Main.dust[idx].position = projectile.Center + dustOffset; + Main.dust[idx].velocity = projectile.velocity * 0.1f; + Main.dust[idx].velocity = Vector2.Normalize(projectile.Center - projectile.velocity * 3f - Main.dust[idx].position) * 1.25f; } } projectile.alpha -= 15; - int num58 = 150; - if (projectile.Center.Y >= projectile.ai[1]) + int alphaLimit = 150; + if (projectile.alpha < alphaLimit) { - num58 = 0; + projectile.alpha = alphaLimit; } - if (projectile.alpha < num58) - { - projectile.alpha = num58; - } - projectile.rotation = projectile.velocity.ToRotation() - 1.57079637f; + projectile.rotation = projectile.velocity.ToRotation() - MathHelper.PiOver2; if (Main.rand.NextBool(16)) { - Vector2 value3 = Vector2.UnitX.RotatedByRandom(1.5707963705062866).RotatedBy((double)projectile.velocity.ToRotation(), default); - int num59 = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); - Main.dust[num59].velocity = value3 * 0.66f; - Main.dust[num59].position = projectile.Center + value3 * 12f; + Vector2 dustOffset = Vector2.UnitX.RotatedByRandom(Math.PI * 0.5).RotatedBy((double)projectile.velocity.ToRotation(), default); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, projectile.velocity.X * 0.5f, projectile.velocity.Y * 0.5f, 150, default, 1.2f); + Main.dust[idx].velocity = dustOffset * 0.66f; + Main.dust[idx].position = projectile.Center + dustOffset * 12f; } if (projectile.ai[1] == 1f) { @@ -100,25 +97,22 @@ namespace CalamityMod.Projectiles.Ranged { if (projectile.owner == Main.myPlayer) { - Projectile.NewProjectile(projectile.Center.X, projectile.Center.Y, 0f, 0f, ModContent.ProjectileType(), (int)((double)projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner, 0f, 0f); + Projectile.NewProjectile(projectile.Center, Vector2.Zero, ModContent.ProjectileType(), (int)(projectile.damage * 0.3), projectile.knockBack * 0.1f, projectile.owner); } - Main.PlaySound(SoundID.Item10, projectile.position); - projectile.position = projectile.Center; - projectile.width = projectile.height = 144; - projectile.position.X = projectile.position.X - (float)(projectile.width / 2); - projectile.position.Y = projectile.position.Y - (float)(projectile.height / 2); - for (int num193 = 0; num193 < 4; num193++) + Main.PlaySound(SoundID.Item10, projectile.Center); + CalamityGlobalProjectile.ExpandHitboxBy(projectile, 144); + for (int d = 0; d < 4; d++) { - Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); + Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); } - for (int num194 = 0; num194 < 20; num194++) + for (int d = 0; d < 20; d++) { - int num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 2.5f); - Main.dust[num195].noGravity = true; - Main.dust[num195].velocity *= 3f; - num195 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); - Main.dust[num195].velocity *= 2f; - Main.dust[num195].noGravity = true; + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 0, default, 2.5f); + Main.dust[idx].noGravity = true; + Main.dust[idx].velocity *= 3f; + idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 50, default, 1.5f); + Main.dust[idx].velocity *= 2f; + Main.dust[idx].noGravity = true; } } diff --git a/Projectiles/Ranged/NorfleetExplosion.cs b/Projectiles/Ranged/NorfleetExplosion.cs index 8451566c53..e542ec905e 100644 --- a/Projectiles/Ranged/NorfleetExplosion.cs +++ b/Projectiles/Ranged/NorfleetExplosion.cs @@ -28,61 +28,15 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { Lighting.AddLight(projectile.Center, (255 - projectile.alpha) * 0.75f / 255f, (255 - projectile.alpha) * 0.5f / 255f, (255 - projectile.alpha) * 0.01f / 255f); - bool flag15 = false; - bool flag16 = false; - if (projectile.velocity.X < 0f && projectile.position.X < projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.X > 0f && projectile.position.X > projectile.ai[0]) - { - flag15 = true; - } - if (projectile.velocity.Y < 0f && projectile.position.Y < projectile.ai[1]) - { - flag16 = true; - } - if (projectile.velocity.Y > 0f && projectile.position.Y > projectile.ai[1]) - { - flag16 = true; - } - if (flag15 && flag16) - { - projectile.Kill(); - } - float num461 = 25f; - if (projectile.ai[0] > 180f) - { - num461 -= (projectile.ai[0] - 180f) / 2f; - } - if (num461 <= 0f) - { - num461 = 0f; - projectile.Kill(); - } - num461 *= 0.7f; - projectile.ai[0] += 4f; - int num462 = 0; - while ((float)num462 < num461) - { - float num463 = (float)Main.rand.Next(-120, 121); - float num464 = (float)Main.rand.Next(-120, 121); - float num465 = (float)Main.rand.Next(36, 108); - float num466 = (float)Math.Sqrt((double)(num463 * num463 + num464 * num464)); - num466 = num465 / num466; - num463 *= num466; - num464 *= num466; - int num467 = Dust.NewDust(new Vector2(projectile.position.X, projectile.position.Y), projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 100, default, 2f); - Dust dust = Main.dust[num467]; - dust.noGravity = true; - dust.position.X = projectile.Center.X; - dust.position.Y = projectile.Center.Y; - dust.position.X += (float)Main.rand.Next(-10, 11); - dust.position.Y += (float)Main.rand.Next(-10, 11); - dust.velocity.X = num463; - dust.velocity.Y = num464; - num462++; - } + Vector2 dustVel = CalamityUtils.RandomVelocity(120f, 36f, 108f, 1f); + int idx = Dust.NewDust(projectile.position, projectile.width, projectile.height, Main.rand.NextBool(2) ? 221 : 244, 0f, 0f, 100, default, 2f); + Dust dust = Main.dust[idx]; + dust.noGravity = true; + dust.position.X = projectile.Center.X; + dust.position.Y = projectile.Center.Y; + dust.position.X += Main.rand.NextFloat(-10f, 10f); + dust.position.Y += Main.rand.NextFloat(-10f, 10f); + dust.velocity = dustVel; } } } diff --git a/Projectiles/Ranged/StarfleetMK2Gun.cs b/Projectiles/Ranged/StarfleetMK2Gun.cs index bf44245477..b7da78a950 100644 --- a/Projectiles/Ranged/StarfleetMK2Gun.cs +++ b/Projectiles/Ranged/StarfleetMK2Gun.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Ranged } } projectile.rotation = projectile.velocity.ToRotation(); - Vector2 displayOffset = new Vector2(32, 0).RotatedBy(projectile.rotation); + Vector2 displayOffset = new Vector2(32f, -10f * projectile.direction).RotatedBy(projectile.rotation); projectile.Center = player.RotatedRelativePoint(player.MountedCenter, true) + displayOffset; if (projectile.spriteDirection == -1) projectile.rotation += MathHelper.Pi;