From 9044146e021bed330a1c3f6e4b2ae609cbbb19fe Mon Sep 17 00:00:00 2001 From: Xyk Date: Fri, 7 Mar 2025 01:43:44 -0800 Subject: [PATCH] Luxors Fixes --- Items/Accessories/LuxorsGift.cs | 2 +- .../Mods.CalamityMod.Items.Accessories.hjson | 3 ++- Projectiles/Melee/LuxorsGiftMelee.cs | 9 ++++----- Projectiles/Ranged/LuxorsGiftRanged.cs | 13 +------------ Projectiles/Rogue/LuxorsGiftRogue.cs | 16 ++++++---------- Projectiles/Summon/LuxorsGiftSummon.cs | 3 ++- Projectiles/Typeless/Luxor.cs | 3 +++ 7 files changed, 19 insertions(+), 30 deletions(-) diff --git a/Items/Accessories/LuxorsGift.cs b/Items/Accessories/LuxorsGift.cs index f2f6c4ffa8..d2d0a1d680 100644 --- a/Items/Accessories/LuxorsGift.cs +++ b/Items/Accessories/LuxorsGift.cs @@ -26,7 +26,7 @@ namespace CalamityMod.Items.Accessories public const int rogueAttackSpeed = 36; // Rogue has a 12 frame delay between it's two shots, so it's actaully a bit slower than you'd think public const int classlessAttackSpeed = 50; - public const int meleeDamage = 16; + public const int meleeDamage = 10; public const int rangedDamage = 5; public const int magicDamage = 13; public const int summonerDamage = 22; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index 8a1ae65060..8743fe97dd 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1056,7 +1056,8 @@ LuxorsGift: { Tooltip: ''' Summons a scarab launcher that follows you closely - The scarab fires different projectiles at enemies depending on what class the held weapon belongs to + The scarab fires different projectiles at enemies depending on what class the held weapon belongs to + Held item class is not updated when holding a tool When not in use, the scarab will condense itself into a small orb of light ''' } diff --git a/Projectiles/Melee/LuxorsGiftMelee.cs b/Projectiles/Melee/LuxorsGiftMelee.cs index 1d102d26d6..0535c4ff7f 100644 --- a/Projectiles/Melee/LuxorsGiftMelee.cs +++ b/Projectiles/Melee/LuxorsGiftMelee.cs @@ -30,6 +30,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; Projectile.extraUpdates = 2; + Projectile.tileCollide = false; } public override void AI() { @@ -65,6 +66,9 @@ namespace CalamityMod.Projectiles.Melee Particle spark = new GlowSparkParticle(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 2, false, 14, 0.02f, Color.Red * 0.45f, new Vector2(1.4f, 1f), true, false, 0.6f); GeneralParticleHandler.SpawnParticle(spark); } + + if (Collision.SolidCollision(Projectile.Center, 9, 9)) + Projectile.velocity *= 0.91f; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { @@ -75,11 +79,6 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.numHits >= 1 && Projectile.timeLeft > 70) Projectile.timeLeft = 70; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.velocity = oldVelocity * 0.85f; - return false; - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.ai[0] == 5 || Projectile.numHits >= 2) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Ranged/LuxorsGiftRanged.cs b/Projectiles/Ranged/LuxorsGiftRanged.cs index 1c71157927..7bcf579a96 100644 --- a/Projectiles/Ranged/LuxorsGiftRanged.cs +++ b/Projectiles/Ranged/LuxorsGiftRanged.cs @@ -57,18 +57,8 @@ namespace CalamityMod.Projectiles.Ranged int hitsToMinMult = 3; float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); modifiers.SourceDamage *= damageMult; - - for (int i = 0; i < 12; i++) - { - Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.2f) * Main.rand.NextFloat(2.5f, 8.5f); - Dust dust = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(11, 11), Main.rand.NextBool() ? 278 : ModContent.DustType(), dustVel * Main.rand.NextFloat(0.3f, 1.7f)); - dust.noGravity = true; - dust.scale = Main.rand.NextFloat(0.8f, 1.1f); - dust.color = Color.Cyan; - dust.noLightEmittence = true; - } } - public override bool OnTileCollide(Vector2 oldVelocity) + public override void OnKill(int timeLeft) { for (int i = 0; i < 12; i++) { @@ -79,7 +69,6 @@ namespace CalamityMod.Projectiles.Ranged dust.color = Color.Cyan; dust.noLightEmittence = true; } - return true; } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 20, targetHitbox); public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Rogue/LuxorsGiftRogue.cs b/Projectiles/Rogue/LuxorsGiftRogue.cs index 8d06bbd973..4992f835b2 100644 --- a/Projectiles/Rogue/LuxorsGiftRogue.cs +++ b/Projectiles/Rogue/LuxorsGiftRogue.cs @@ -34,17 +34,13 @@ namespace CalamityMod.Projectiles.Rogue Lighting.AddLight(Projectile.Center, Color.Magenta.ToVector3() * 0.35f); Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; if (Projectile.numHits == 0) - { Projectile.velocity.Y += 0.04f; - if (Projectile.velocity.Y > 0) - Projectile.velocity.X *= 0.99f; - } else - { Projectile.velocity.Y += 0.06f; - if (Projectile.velocity.Y > 0) - Projectile.velocity.X *= 0.985f; - } + + if (Projectile.velocity.Y > 0) + Projectile.velocity.X *= 0.99f; + if (Projectile.timeLeft > 60) { Vector2 dustVel = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2().RotatedByRandom(0.05f) * Main.rand.NextFloat(0.1f, 0.3f); @@ -63,7 +59,7 @@ namespace CalamityMod.Projectiles.Rogue modifiers.SourceDamage *= damageMult; Projectile.velocity = Utils.DirectionTo(target.Center, Projectile.Center).RotatedByRandom(0.2f) * 7; - Projectile.velocity.X *= 0.2f; + Projectile.velocity.X *= 0.25f; Projectile.velocity.Y *= 1.2f; for (int i = 0; i < 8; i++) @@ -102,7 +98,7 @@ namespace CalamityMod.Projectiles.Rogue for (int i = 0; i < 8; i++) { - Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f; + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 1f; Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Summon/LuxorsGiftSummon.cs b/Projectiles/Summon/LuxorsGiftSummon.cs index cf487f853e..4e1654aa79 100644 --- a/Projectiles/Summon/LuxorsGiftSummon.cs +++ b/Projectiles/Summon/LuxorsGiftSummon.cs @@ -88,6 +88,7 @@ namespace CalamityMod.Projectiles.Summon dust.color = Color.Lime; dust.noLightEmittence = true; } + Projectile.Kill(); } } public override bool? CanHitNPC(NPC target) => (targeted != null && target == targeted && attackTime == 0) ? null : false; @@ -101,7 +102,7 @@ namespace CalamityMod.Projectiles.Summon for (int i = 0; i < 8; i++) { - Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 2f; + Vector2 drawOffset = (MathHelper.TwoPi * i / 8f).ToRotationVector2() * 1f; Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset, null, drawColor with { A = 0 } * 0.4f * (float)Math.Pow(fade, 3), Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition, null, Color.White * fade, Projectile.rotation, tex.Size() * 0.5f, Projectile.scale, SpriteEffects.None); diff --git a/Projectiles/Typeless/Luxor.cs b/Projectiles/Typeless/Luxor.cs index 7c20ddac95..ca5210dd07 100644 --- a/Projectiles/Typeless/Luxor.cs +++ b/Projectiles/Typeless/Luxor.cs @@ -53,6 +53,9 @@ namespace CalamityMod.Projectiles.Typeless { Color classColor = Color.White; DamageClass itemClass = Owner.HeldItem.DamageType; + // Held item class is not updated when you hold any tools + if ((Owner.HeldItem.axe > 0 || Owner.HeldItem.hammer > 0 || Owner.HeldItem.pick > 0) && lastDamageClass != null) + itemClass = lastDamageClass; if (itemClass == null) { Projectile.Kill();