From c00daa46044bfcaf35fb7ef1590633dc914ccd93 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:28:44 +0700 Subject: [PATCH] various fixes --- NPCs/CalamityGlobalNPC.cs | 2 -- Projectiles/CalamityGlobalProjectile.cs | 6 +++--- Projectiles/Ranged/HiveMissile.cs | 2 +- Projectiles/Ranged/HiveNuke.cs | 2 +- Projectiles/Ranged/MarksmanShot.cs | 12 +++++++++--- Projectiles/Ranged/ScorpioLargeRocket.cs | 2 +- Projectiles/Ranged/ScorpioRocket.cs | 2 +- Projectiles/Ranged/SevensStrikerHoldout.cs | 12 +++++++----- Projectiles/Rogue/Crushax.cs | 6 ++---- 9 files changed, 25 insertions(+), 21 deletions(-) diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 81a98247d3..8c2b9f3674 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -5276,8 +5276,6 @@ namespace CalamityMod.NPCs GaussFluxTimer--; if (ladHearts > 0) ladHearts--; - if (vulnerabilityHex > 0) - vulnerabilityHex--; if (banishingFire > 0) banishingFire--; if (wither > 0) diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 083e4dcb55..549113959b 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -4222,13 +4222,13 @@ namespace CalamityMod.Projectiles } } - // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. - // damageScale = 0.1f + player.velocity.Length() / 7f * 0.9f if (projectile.type == ProjectileID.JoustingLance || projectile.type == ProjectileID.HallowJoustingLance || projectile.type == ProjectileID.ShadowJoustingLance) { + // The vanilla damage Jousting Lance multiplier is as follows. Calamity overrides this with a new formula. + float vanillaVelocityDamageMultiplier = 0.1f + player.velocity.Length() / 7f * 0.9f; float baseVelocityDamageMultiplier = 0.01f + player.velocity.Length() * 0.002f; float calamityVelocityDamageMultiplier = 100f * (1f - (1f / (1f + baseVelocityDamageMultiplier))); - modifiers.SourceDamage *= calamityVelocityDamageMultiplier; + modifiers.SourceDamage *= calamityVelocityDamageMultiplier / vanillaVelocityDamageMultiplier; } // If applicable, use ricoshot bonus damage. diff --git a/Projectiles/Ranged/HiveMissile.cs b/Projectiles/Ranged/HiveMissile.cs index 21fba14125..33ceb2d7f6 100644 --- a/Projectiles/Ranged/HiveMissile.cs +++ b/Projectiles/Ranged/HiveMissile.cs @@ -38,7 +38,7 @@ namespace CalamityMod.Projectiles.Ranged // Rotates towards its velocity. Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) { HasHit = true; Projectile.Kill(); diff --git a/Projectiles/Ranged/HiveNuke.cs b/Projectiles/Ranged/HiveNuke.cs index 95c48cb8dc..fd07e0e2ba 100644 --- a/Projectiles/Ranged/HiveNuke.cs +++ b/Projectiles/Ranged/HiveNuke.cs @@ -107,7 +107,7 @@ namespace CalamityMod.Projectiles.Ranged // Rotates towards its velocity. Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); Time++; diff --git a/Projectiles/Ranged/MarksmanShot.cs b/Projectiles/Ranged/MarksmanShot.cs index e7f74735cf..9ca1f1c94a 100644 --- a/Projectiles/Ranged/MarksmanShot.cs +++ b/Projectiles/Ranged/MarksmanShot.cs @@ -183,7 +183,10 @@ namespace CalamityMod.Projectiles.Ranged Collision.HitTiles(Projectile.position, Projectile.velocity, Projectile.width, Projectile.height); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + if (Projectile.numHits == 0) + Projectile.timeLeft = Math.Min(Lifetime - Projectile.timeLeft, trailLength); + + Projectile.numHits++; return false; } @@ -192,8 +195,11 @@ namespace CalamityMod.Projectiles.Ranged target.AddBuff(BuffID.Midas, 60); // Instead of immediately killing the projectile, simply set the time left so the trail can fade out. - Projectile.velocity = Vector2.Zero; - Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + if (Projectile.numHits == 0) + { + Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = Math.Min((Lifetime - Projectile.timeLeft), trailLength); + } } internal Color ColorFunction(float completionRatio) diff --git a/Projectiles/Ranged/ScorpioLargeRocket.cs b/Projectiles/Ranged/ScorpioLargeRocket.cs index f4382f2726..0404c6b0f6 100644 --- a/Projectiles/Ranged/ScorpioLargeRocket.cs +++ b/Projectiles/Ranged/ScorpioLargeRocket.cs @@ -57,7 +57,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.velocity *= 1.032f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); // Every X frames it changes the projectile to its next animation frame. diff --git a/Projectiles/Ranged/ScorpioRocket.cs b/Projectiles/Ranged/ScorpioRocket.cs index 309634c16a..321682b4ef 100644 --- a/Projectiles/Ranged/ScorpioRocket.cs +++ b/Projectiles/Ranged/ScorpioRocket.cs @@ -73,7 +73,7 @@ namespace CalamityMod.Projectiles.Ranged else Projectile.velocity *= 0.9f; - if (Projectile.wet && RocketID == ItemID.DryRocket && RocketID == ItemID.WetRocket && RocketID == ItemID.LavaRocket && RocketID == ItemID.HoneyRocket) + if (Projectile.wet && (RocketID == ItemID.DryRocket || RocketID == ItemID.WetRocket || RocketID == ItemID.LavaRocket || RocketID == ItemID.HoneyRocket)) Projectile.Kill(); // Rotates towards its velocity. diff --git a/Projectiles/Ranged/SevensStrikerHoldout.cs b/Projectiles/Ranged/SevensStrikerHoldout.cs index 8d25d50b28..52c5f49420 100644 --- a/Projectiles/Ranged/SevensStrikerHoldout.cs +++ b/Projectiles/Ranged/SevensStrikerHoldout.cs @@ -38,7 +38,6 @@ namespace CalamityMod.Projectiles.Ranged Projectile.tileCollide = false; Projectile.DamageType = DamageClass.Ranged; Projectile.ignoreWater = true; - Projectile.alpha = 255; } public override void AI() @@ -235,7 +234,7 @@ namespace CalamityMod.Projectiles.Ranged player.heldProj = Projectile.whoAmI; player.itemTime = 2; player.itemAnimation = 2; - player.itemRotation = (float)Math.Atan2((double)(Projectile.velocity.Y * (float)Projectile.direction), (double)(Projectile.velocity.X * (float)Projectile.direction)); + player.itemRotation = (Projectile.velocity * Projectile.direction).ToRotation(); } // Calculates which attack will occur based on coin. @@ -320,8 +319,7 @@ namespace CalamityMod.Projectiles.Ranged Vector2 armPosition = player.RotatedRelativePoint(player.MountedCenter, true); armPosition += Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * 32f; armPosition.Y -= 20f; - Vector2 shootDirection = (Main.MouseWorld - Projectile.Center).SafeNormalize(-Vector2.UnitY); - Vector2 gunTip = armPosition + shootDirection * player.ActiveItem().scale * 90f; + Vector2 gunTip = armPosition + Projectile.velocity.SafeNormalize(player.direction * Vector2.UnitX) * player.ActiveItem().scale * 70f; for (int i = 0; i < projcount; ++i) { Vector2 perturbedSpeed = Projectile.velocity.RotatedBy(MathHelper.Lerp(-spreadfactor, spreadfactor, i / 7f)) * scaleFactor; @@ -346,7 +344,8 @@ namespace CalamityMod.Projectiles.Ranged int currentframe = indframeheight * Projectile.frame; Rectangle frame = new Rectangle(0, currentframe, gun.Width, indframeheight); - Main.EntitySpriteDraw(gun, drawOffset, frame, lightColor, drawAngle, drawOrigin, Projectile.scale, flip, 0); + // This is full brightness but it's better than random flickering for whatever reason + Main.EntitySpriteDraw(gun, drawOffset, frame, Color.White, drawAngle, drawOrigin, Projectile.scale, flip, 0); return false; } @@ -365,5 +364,8 @@ namespace CalamityMod.Projectiles.Ranged // This gun does not deal melee damage, thanks. public override bool? CanDamage() => false; + + // Has velocity but updates positions manually + public override bool ShouldUpdatePosition() => false; } } diff --git a/Projectiles/Rogue/Crushax.cs b/Projectiles/Rogue/Crushax.cs index e4faf91f2e..c1850724fa 100644 --- a/Projectiles/Rogue/Crushax.cs +++ b/Projectiles/Rogue/Crushax.cs @@ -17,13 +17,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.ignoreWater = true; Projectile.penetrate = 2; Projectile.aiStyle = ProjAIStyleID.ThrownProjectile; + AIType = ProjectileID.ThrowingKnife; + Projectile.DamageType = RogueDamageClass.Instance; Projectile.timeLeft = 300; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 12; - AIType = ProjectileID.ThrowingKnife; - Projectile.DamageType = RogueDamageClass.Instance; - Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 7; } public override void AI()