From 700d00f23f35cb8081efadec773c65671d82a8d2 Mon Sep 17 00:00:00 2001 From: Altixal <73398287+Altixal@users.noreply.github.com> Date: Sun, 30 Jul 2023 14:42:31 +0700 Subject: [PATCH] archerfish line tweaks again --- Items/Weapons/Ranged/Archerfish.cs | 30 ++++--- Items/Weapons/Ranged/Megalodon.cs | 27 +++--- Items/Weapons/Ranged/Seadragon.cs | 27 +++--- Projectiles/Ranged/ArcherfishRing.cs | 69 +++++++++------ Projectiles/Ranged/ArcherfishRing.png | Bin 3257 -> 0 bytes Projectiles/Ranged/ArcherfishShot.cs | 116 +++++--------------------- Sounds/Custom/BubblyPop.ogg | Bin 0 -> 4670 bytes Utilities/CollisionUtils.cs | 8 +- 8 files changed, 111 insertions(+), 166 deletions(-) delete mode 100644 Projectiles/Ranged/ArcherfishRing.png create mode 100644 Sounds/Custom/BubblyPop.ogg diff --git a/Items/Weapons/Ranged/Archerfish.cs b/Items/Weapons/Ranged/Archerfish.cs index 485e954365..76b7140b78 100644 --- a/Items/Weapons/Ranged/Archerfish.cs +++ b/Items/Weapons/Ranged/Archerfish.cs @@ -1,7 +1,8 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -23,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged Item.knockBack = 2f; Item.value = CalamityGlobalItem.Rarity3BuyPrice; Item.rare = ItemRarityID.Orange; - Item.UseSound = SoundID.Item11; + Item.UseSound = SoundID.Item85; Item.autoReuse = true; Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 11f; @@ -31,23 +32,32 @@ namespace CalamityMod.Items.Weapons.Ranged Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, -5); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, -5); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + // Reposition to the gun's tip + Vector2 newPos = position + new Vector2(60f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + + // Fires a spread of harmless bubbles + for (int i = 0; i < 4; i++) + { + Gore bubble = Gore.NewGorePerfect(source, newPos, velocity.RotatedByRandom(MathHelper.ToRadians(30f)) * 0.5f, 411); + bubble.timeLeft = 6 + Main.rand.Next(4); + bubble.scale = Main.rand.NextFloat(0.6f, 0.8f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; + } + // Replaces standard bullets with water jets. if (type == ProjectileID.Bullet) - Projectile.NewProjectile(source, position, velocity, ModContent.ProjectileType(), damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, velocity, Item.shoot, damage, knockback, player.whoAmI); else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, velocity, type, damage, knockback, player.whoAmI); // Always fires a close range water blast. int waterRingDamage = (int)(damage * 0.5f); float boostedKB = knockback + 5f; - Projectile.NewProjectile(source, position, velocity * 0.5f, ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); + Projectile.NewProjectile(source, newPos, velocity * 0.5f, ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); return false; } diff --git a/Items/Weapons/Ranged/Megalodon.cs b/Items/Weapons/Ranged/Megalodon.cs index 6a62fcfbc2..fd6681b690 100644 --- a/Items/Weapons/Ranged/Megalodon.cs +++ b/Items/Weapons/Ranged/Megalodon.cs @@ -1,9 +1,10 @@ -using Terraria.DataStructures; -using CalamityMod.Projectiles.Ranged; -using CalamityMod.Items.Materials; +using CalamityMod.Items.Materials; using CalamityMod.Items.Placeables; +using CalamityMod.Projectiles.Ranged; using Microsoft.Xna.Framework; +using System; using Terraria; +using Terraria.DataStructures; using Terraria.ID; using Terraria.ModLoader; @@ -29,33 +30,29 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ItemRarityID.Lime; Item.UseSound = SoundID.Item11; Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-5, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-5, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Both bullets and water jets have very slight inaccuracy - float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; + // Reposition to the gun's tip + add some inaccuracy + Vector2 newPos = position + new Vector2(64f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); // Fire either the bullet or the water jet, depending on cadence. - int projectileToFire = fireWater ? ModContent.ProjectileType() : type; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projectileToFire, damage, knockback, player.whoAmI, 0.0f, 0.0f); + int projectileToFire = fireWater ? Item.shoot : type; + Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); // Always fires a close range water blast. // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. - Vector2 waterRingVec = new Vector2(SpeedX, SpeedY) * Main.rand.NextFloat(0.5f, 0.6f); int waterRingDamage = (int)(damage * 0.5f); float boostedKB = knockback + 7f; // Stronger guaranteed KB than Archerfish for mid-late Hardmode - Projectile.NewProjectile(source, position, waterRingVec, ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.5f, 0.6f), ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); // Swap between firing bullets and water jets each shot. fireWater = !fireWater; diff --git a/Items/Weapons/Ranged/Seadragon.cs b/Items/Weapons/Ranged/Seadragon.cs index 5e382de81d..05672055dd 100644 --- a/Items/Weapons/Ranged/Seadragon.cs +++ b/Items/Weapons/Ranged/Seadragon.cs @@ -3,6 +3,7 @@ using CalamityMod.Items.Placeables; using CalamityMod.Projectiles.Ranged; using CalamityMod.Rarities; using Microsoft.Xna.Framework; +using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -34,34 +35,30 @@ namespace CalamityMod.Items.Weapons.Ranged Item.rare = ModContent.RarityType(); Item.UseSound = SoundID.Item11; Item.autoReuse = true; - Item.shoot = ProjectileID.PurificationPowder; + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.useAmmo = AmmoID.Bullet; Item.Calamity().canFirePointBlankShots = true; } - public override Vector2? HoldoutOffset() - { - return new Vector2(-10, 0); - } + public override Vector2? HoldoutOffset() => new Vector2(-10, 0); public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - // Both bullets and water jets have very slight inaccuracy - float SpeedX = velocity.X + Main.rand.Next(-10, 11) * 0.05f; - float SpeedY = velocity.Y + Main.rand.Next(-10, 11) * 0.05f; + // Reposition to the gun's tip + add some inaccuracy + Vector2 newPos = position + new Vector2(74f, player.direction * (Math.Abs(velocity.SafeNormalize(Vector2.Zero).X) < 0.02f ? -2f : -8f)).RotatedBy(velocity.ToRotation()); + Vector2 newVel = velocity.RotatedByRandom(MathHelper.ToRadians(5f)); // Fire either the bullet or the water jet, depending on cadence. bool fireWater = shotCounter % 2 == 0; - int projectileToFire = fireWater ? ModContent.ProjectileType() : type; - Projectile.NewProjectile(source, position.X, position.Y, SpeedX, SpeedY, projectileToFire, damage, knockback, player.whoAmI, 0.0f, 0.0f); + int projectileToFire = fireWater ? Item.shoot : type; + Projectile.NewProjectile(source, newPos, newVel, projectileToFire, damage, knockback, player.whoAmI); // Always fires a close range water blast. // It goes in the same direction as the main shot but has a minor velocity variation to be less monotonous. - Vector2 waterRingVec = new Vector2(SpeedX, SpeedY) * Main.rand.NextFloat(0.45f, 0.65f); int waterRingDamage = (int)(damage * 0.5f); float boostedKB = knockback + 7f; // Same KB bonus as Megalodon. The muzzle blast will annihilate nearby enemies and send their gibs flying. - Projectile.NewProjectile(source, position, waterRingVec, ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel * Main.rand.NextFloat(0.45f, 0.65f), ModContent.ProjectileType(), waterRingDamage, boostedKB, player.whoAmI); // Check cadence position to determine which bonus projectile to add, if any. bool fireRocket = shotCounter == 9; @@ -70,19 +67,17 @@ namespace CalamityMod.Items.Weapons.Ranged // Rockets have their own more chaotic spread than bullets. if (fireRocket) { - Vector2 rocketVec = velocity.SafeNormalize(Vector2.Zero).RotatedBy(Main.rand.NextFloat(-0.25f, 0.25f)) * 25f; int rocketDamage = damage * 5; - Projectile.NewProjectile(source, position, rocketVec, ModContent.ProjectileType(), rocketDamage, knockback, player.whoAmI); + Projectile.NewProjectile(source, newPos, newVel * 1.2f, ModContent.ProjectileType(), rocketDamage, knockback, player.whoAmI); SoundEngine.PlaySound(SoundID.Item109, player.Center); } // Muzzle blasts are always directly in line with the gun's muzzle. if (muzzleBlast) { - Vector2 muzzleBlastVec = velocity.SafeNormalize(Vector2.Zero) * 18f; int muzzleBlastDamage = damage * 25; // This might be too much but it's every 18th shot... float muzzleBlastKB = knockback + 12f; - Projectile.NewProjectile(source, position+player.DirectionTo(Main.MouseWorld)*48f, muzzleBlastVec, ModContent.ProjectileType(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI); + Projectile.NewProjectile(source, newPos, velocity, ModContent.ProjectileType(), muzzleBlastDamage, muzzleBlastKB, player.whoAmI); // Play additional sound for muzzle blasts SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, position); diff --git a/Projectiles/Ranged/ArcherfishRing.cs b/Projectiles/Ranged/ArcherfishRing.cs index ac4526b716..9bb8d81d44 100644 --- a/Projectiles/Ranged/ArcherfishRing.cs +++ b/Projectiles/Ranged/ArcherfishRing.cs @@ -3,16 +3,17 @@ using Microsoft.Xna.Framework.Graphics; using System; using Terraria; using Terraria.ID; -using Terraria.DataStructures; using Terraria.ModLoader; using Terraria.Audio; - namespace CalamityMod.Projectiles.Ranged { public class ArcherfishRing : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Ranged"; + public override string Texture => "CalamityMod/Particles/HollowCircleHardEdge"; + + public static readonly SoundStyle PopSound = new("CalamityMod/Sounds/Custom/BubblyPop") { PitchVariance = 0.5f, Volume = 0.66f }; public override void SetDefaults() { @@ -23,7 +24,7 @@ namespace CalamityMod.Projectiles.Ranged Projectile.ignoreWater = true; Projectile.penetrate = 2; Projectile.tileCollide = false; - Projectile.alpha = 115; + Projectile.alpha = 15; Projectile.timeLeft = 300; Projectile.MaxUpdates = 3; Projectile.usesLocalNPCImmunity = true; @@ -31,44 +32,62 @@ namespace CalamityMod.Projectiles.Ranged Projectile.Calamity().pointBlankShotDuration = CalamityGlobalProjectile.DefaultPointBlankDuration; } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => Projectile.RotatingHitboxCollision(targetHitbox.TopLeft(), targetHitbox.Size(), scale: Projectile.scale); + public override void AI() { //The ring expanding slowing while increasing opacity until it disappears at max size - - if (Projectile.ai[0] == 0) + if (Projectile.ai[0] == 0f) { - Projectile.scale = 0.2f; - Projectile.ai[0]++; + Projectile.scale = 0.5f; + Projectile.ai[0]++; } if (Projectile.scale <= 1.5f) - { - Projectile.scale *= 1.035f; - } - if (Projectile.velocity.X > -0.8f && Projectile.velocity.X < 0.8f & - Projectile.velocity.Y > -0.8f && Projectile.velocity.Y < 0.8f) - { - Projectile.alpha += 10; - } - if (Projectile.alpha >= 255) - { - Projectile.Kill(); - } + Projectile.scale *= 1.015f; else - { - Projectile.velocity *= 0.95f; - } - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.scale = 1.5f; + if (Projectile.velocity.Length() < 0.08f) + Projectile.alpha += 15; + + if (Projectile.alpha >= 255) + Projectile.Kill(); + else + Projectile.velocity *= 0.95f; + + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { //Audio feedback for hitting the ring - Player user = Main.player[Projectile.owner]; - SoundEngine.PlaySound(SoundID.Item21, Projectile.position); + SoundEngine.PlaySound(PopSound, Projectile.Center); target.AddBuff(BuffID.Wet, 240); } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Vector2 ringScale = Projectile.Size / tex.Size() * Projectile.scale; + Color ringColor = Color.Lerp(Color.DodgerBlue, Color.Blue, Projectile.Opacity) * Projectile.Opacity * 1.2f; + + Main.spriteBatch.EnterShaderRegion(BlendState.Additive); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, ringColor, Projectile.rotation, tex.Size() / 2f, ringScale, SpriteEffects.None); + Main.spriteBatch.ExitShaderRegion(); + return false; + } + + public override void Kill(int timeLeft) + { + float totalDusts = 18f; + for (float i = 0f; i < totalDusts; i++) + { + Vector2 ringSpeed = new Vector2((float)Math.Cos(i / totalDusts * MathHelper.TwoPi), (float)Math.Sin(i / totalDusts * MathHelper.TwoPi) * 0.5f).RotatedBy(Projectile.rotation) * 4f * Projectile.scale; + Dust droplets = Dust.NewDustPerfect(Projectile.Center, 211, ringSpeed, 100); + droplets.noGravity = true; + } + } } } diff --git a/Projectiles/Ranged/ArcherfishRing.png b/Projectiles/Ranged/ArcherfishRing.png deleted file mode 100644 index bd321597a96b614644329f9752eb4708c26e1a8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3257 zcmV;q3`X;bP)f6 zXi@@54ZTQ_E-Enz5K6$103tR-RB%L5k){YTDBysjLy@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j607GSLb9r+hQ*?D?X>TA@Z*OeDr{R1600G5GL_t(&f$f<;OT$1Iho6Ar z;G%=j8V99*1Hr|wkxJ)IA{10QbPM!)|ry3IyZw{h}XVKq@*lB-LL0Bp>EnfzaBp1v0Vc>VZ{{9H|5 zSAaO-zN9Y62@(!AwTXv>C0Vaha{=z&et=lCT1i}zV+Q}6UjFJ^WO_J^B^Zm^mZl!jVai zNH~NfZy*c=gtzui2EHhhfa!EUE_BPMI>|mS)X681sY5}Z@R00000NkvXXu0mjfEm9n2 diff --git a/Projectiles/Ranged/ArcherfishShot.cs b/Projectiles/Ranged/ArcherfishShot.cs index e6b3587336..7084312299 100644 --- a/Projectiles/Ranged/ArcherfishShot.cs +++ b/Projectiles/Ranged/ArcherfishShot.cs @@ -29,112 +29,36 @@ namespace CalamityMod.Projectiles.Ranged public override void AI() { - if (Projectile.localAI[0] < 5f) + // Bubbles + if (Main.rand.NextBool(2)) { - Projectile.localAI[0] += 1f; - return; + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity * 0.2f + Main.rand.NextVector2Circular(1f, 1f), 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; } - int num3; - for (int num586 = 0; num586 < 1; num586 = num3 + 1) + + // Water trail + for (int i = 0; i < 6; i++) { - for (int num587 = 0; num587 < 6; num587 = num3 + 1) - { - float num588 = Projectile.velocity.X / 6f * (float)num587; - float num589 = Projectile.velocity.Y / 6f * (float)num587; - int num590 = 6; - int num591 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num590, Projectile.position.Y + (float)num590), Projectile.width - num590 * 2, Projectile.height - num590 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); - Dust dust; - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num591]; - dust.alpha += 25; - } - Main.dust[num591].noGravity = true; - dust = Main.dust[num591]; - dust.velocity *= 0.3f; - dust = Main.dust[num591]; - dust.velocity += Projectile.velocity * 0.5f; - Main.dust[num591].position = Projectile.Center; - Dust var_2_18F52_cp_0_cp_0 = Main.dust[num591]; - var_2_18F52_cp_0_cp_0.position.X -= num588; - Dust var_2_18F74_cp_0_cp_0 = Main.dust[num591]; - var_2_18F74_cp_0_cp_0.position.Y -= num589; - dust = Main.dust[num591]; - dust.velocity *= 0.2f; - num3 = num587; - } - if (Main.rand.NextBool(4)) - { - int num592 = 6; - int num593 = Dust.NewDust(new Vector2(Projectile.position.X + (float)num592, Projectile.position.Y + (float)num592), Projectile.width - num592 * 2, Projectile.height - num592 * 2, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 0.65f); - Dust dust = Main.dust[num593]; - dust.velocity *= 0.5f; - dust = Main.dust[num593]; - dust.velocity += Projectile.velocity * 0.5f; - } - num3 = num586; + Dust water = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, 211, 0f, 0f, 100); + water.noGravity = true; + water.velocity = Projectile.velocity * 0.5f; } } public override void Kill(int timeLeft) { - Projectile.velocity = Projectile.oldVelocity * 0.2f; - int num3; - for (int num362 = 0; num362 < 100; num362 = num3 + 1) + // Bubbles + for (int i = 0; i < 10; i++) { - int num363 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 211, 0f, 0f, (int)CalamityDusts.SulfurousSeaAcid, default, 1.2f); - Dust dust; - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - dust = Main.dust[num363]; - dust.alpha += 25; - } - if (Main.rand.NextBool(2)) - { - Main.dust[num363].scale = 0.6f; - } - else - { - Main.dust[num363].noGravity = true; - } - dust = Main.dust[num363]; - dust.velocity *= 0.3f; - dust = Main.dust[num363]; - dust.velocity += Projectile.velocity; - dust = Main.dust[num363]; - dust.velocity *= 1f + (float)Main.rand.Next(-100, 101) * 0.01f; - Dust expr_C6F7_cp_0_cp_0 = Main.dust[num363]; - expr_C6F7_cp_0_cp_0.velocity.X += (float)Main.rand.Next(-50, 51) * 0.015f; - Dust expr_C726_cp_0_cp_0 = Main.dust[num363]; - expr_C726_cp_0_cp_0.velocity.Y += (float)Main.rand.Next(-50, 51) * 0.015f; - Main.dust[num363].position = Projectile.Center; - num3 = num362; + Gore bubble = Gore.NewGorePerfect(Projectile.GetSource_FromAI(), Projectile.position, Projectile.velocity.RotatedByRandom(MathHelper.ToRadians(60f)) * 0.3f, 411); + bubble.timeLeft = 9 + Main.rand.Next(7); + bubble.scale = Main.rand.NextFloat(0.6f, 1f); + bubble.type = Main.rand.NextBool(3) ? 412 : 411; } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - target.AddBuff(BuffID.Wet, 240); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffID.Wet, 240); } -} +} \ No newline at end of file diff --git a/Sounds/Custom/BubblyPop.ogg b/Sounds/Custom/BubblyPop.ogg new file mode 100644 index 0000000000000000000000000000000000000000..a819506cd252c40479aeba5e3ae153bd08c2b609 GIT binary patch literal 4670 zcmeHKdstIP7N3Lw0RaI64K!#X;Sm*=@UW0#ivbD*2ql0>EV?A1^3sxsEwyw*MZ}0P zhKLv`g+KzthAn9DvF(eV5Hjm7AVv=)w*uoJ@n5 zlf)>8)^(nm`}$vh**Yy|^w>wbr z>G?UL88L$8%$>oFSV=(P2vNC?i!6;|1*g}AQR$|w=bmBpcyNapjm(G&PIqt*RUCah zOU~^p9a5$uOrVLD_NFA(Z@gC8NKHFiI6;TmZTkANg*IL=Q-qGIBntKn)j`6-_)00! z^1@~+%$jI0Yr$p(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>F53K?$M?PNuKE6Y+-J@9n`(C{s;a8aojP*hY?g3rOvv5k zn)@}ib&066B`Yia!Q z?Uum*s{d%pFgtL6=&5e%%{!M56s1R-vv&stdU)L%sB7+d_ti6x4+nRQw2007*O2Fa z|A)ikp>Hp}bmzw(=5U^Js4*py`gyi_f%1;!lHVH)ya$mLx{$p`7JePSz*|!| zp^UFgE-$Q9>>bG8B5mEhHenU~oM^lgUNOJ(Q*`3N=(_>?{U0819>2o4v9N5-#hAI1 zb*me{N#HNtuTtkVR#RLK=4+~_cD#{#WX)f`oY)`vSqh7=rf;&SWlvdgf^ zi5@-S&b6t+)KsqA^40m*QwVuy-KAQyDY#^v&%&xkr>gdjr{CBX9^Z4(&{>`roR-!1 zfo19VgUco5q57g%ye_LZIuOp^Ry=E~D?B1sPP%LV$O$vDt=3S9sIEq1)$m0D?Us*T zzhYw3%hpc^(^FIT4IGK}@$ufFzbT_?HcLbS2RQtf6BP3T-2xqK*Y?S)zwr2}M6pMl z{Z`W#bIKVpnJEP&u`33)esF1nO{VW+o0?2hm5W)k(hw&(6LbAj-|srE5wD~zB92*a z7%H4x>_T{C5i}99ym>qzb)R`UrYDQ$-F%kn=DkQ$n04uvn!md*{+=?kKIcrJ{b=w0 z&f_}exzE?ye?0o|nt#UPk_C>*9JPDE`R9*+oaDSOXiE6A&UEMe*-DW7&ia_ literal 0 HcmV?d00001 diff --git a/Utilities/CollisionUtils.cs b/Utilities/CollisionUtils.cs index d13693c649..f8b02121b2 100644 --- a/Utilities/CollisionUtils.cs +++ b/Utilities/CollisionUtils.cs @@ -12,17 +12,17 @@ namespace CalamityMod /// The top left coordinates of the target to check. /// The hitbox size of the target to check. /// An optional direction override - public static bool RotatingHitboxCollision(this Entity entity, Vector2 targetTopLeft, Vector2 targetHitboxDimensions, Vector2? directionOverride = null) + public static bool RotatingHitboxCollision(this Entity entity, Vector2 targetTopLeft, Vector2 targetHitboxDimensions, Vector2? directionOverride = null, float scale = 1f) { Vector2 lineDirection = directionOverride ?? entity.velocity; // Ensure that the line direction is a unit vector. lineDirection = lineDirection.SafeNormalize(Vector2.UnitY); - Vector2 start = entity.Center - lineDirection * entity.height * 0.5f; - Vector2 end = entity.Center + lineDirection * entity.height * 0.5f; + Vector2 start = entity.Center - lineDirection * entity.height * 0.5f * scale; + Vector2 end = entity.Center + lineDirection * entity.height * 0.5f * scale; float _ = 0f; - return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width, ref _); + return Collision.CheckAABBvLineCollision(targetTopLeft, targetHitboxDimensions, start, end, entity.width * scale, ref _); } ///