diff --git a/Items/Weapons/Melee/Earth.cs b/Items/Weapons/Melee/Earth.cs index 0e55e55fc9..b1c759fa17 100644 --- a/Items/Weapons/Melee/Earth.cs +++ b/Items/Weapons/Melee/Earth.cs @@ -21,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { Item.width = 164; Item.height = 164; - Item.damage = 4004; + Item.damage = 5684; Item.DamageType = TrueMeleeDamageClass.Instance; Item.useAnimation = 42; Item.useTime = 42; diff --git a/Particles/VerticalSmearLarge.png b/Particles/VerticalSmearLarge.png new file mode 100644 index 0000000000..ca28d1e321 Binary files /dev/null and b/Particles/VerticalSmearLarge.png differ diff --git a/Particles/VerticalSmearRagged.png b/Particles/VerticalSmearRagged.png new file mode 100644 index 0000000000..3d65f01e4b Binary files /dev/null and b/Particles/VerticalSmearRagged.png differ diff --git a/Projectiles/Melee/EarthHoldout.cs b/Projectiles/Melee/EarthHoldout.cs index fede55a8f0..970dd9e6ad 100644 --- a/Projectiles/Melee/EarthHoldout.cs +++ b/Projectiles/Melee/EarthHoldout.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Runtime.ConstrainedExecution; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; @@ -22,10 +23,10 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/Earth"; public override float HitboxOutset => 135; - public override Vector2 HitboxSize => new Vector2(255, 255); + public override Vector2 HitboxSize => new Vector2(255, 255) * (1 + bladeFade); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 165.5f); + public override Vector2 SpriteOrigin => new(-3, 164f); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -37,6 +38,9 @@ namespace CalamityMod.Projectiles.Melee public Color mainColor = Color.OrangeRed; public bool finalFlip = false; public int pause = 0; + public bool playSwingSound = true; + public bool allowSecondHit = true; + public float bladeFade = 0; public override void SetDefaults() { base.SetDefaults(); @@ -54,7 +58,7 @@ namespace CalamityMod.Projectiles.Melee // 14NOV2024: Ozzatron: clamped mouse position unnecessary, it does not influence Earth's projectile spawning mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - useAnim = Owner.itemAnimationMax; + useAnim = Owner.itemAnimationMax * 2; if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; @@ -74,7 +78,7 @@ namespace CalamityMod.Projectiles.Melee AnimationProgress = Animation % useAnim; DrawUnconditionally = false; - float rate = Main.GlobalTimeWrappedHourly * 19; + float rate = Main.GlobalTimeWrappedHourly * 12; List earthColors = new List() { Color.OrangeRed, @@ -95,16 +99,22 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.2f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); + if (Projectile.ai[1] == -1) + bladeFade = MathHelper.Lerp(bladeFade, 1, 0.15f); + else + bladeFade = MathHelper.Lerp(bladeFade, 0, 0.15f); if (!doSwing) { for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + allowSecondHit = true; + playSwingSound = true; spawnBoom = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; @@ -113,9 +123,16 @@ namespace CalamityMod.Projectiles.Melee if (mousePos.X < Owner.Center.X) Owner.direction = -1; else Owner.direction = 1; FlipAsSword = Owner.direction == -1 ? true : false; + if (swingCount % 2 == 0) + { + useAnim = Owner.itemAnimationMax * 2; + } + else + { + useAnim = Owner.itemAnimationMax; + } doSwing = true; - swingCount++; finalFlip = false; } else @@ -133,18 +150,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / (swingCount % 2 == 0 ? 1.3f : 7))) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.6f, Animation, true)) * 0.25f)), 0.2f); } else { @@ -153,28 +170,37 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction < 0 ? true : false; } - float time = (AnimationProgress) - (useAnim / 3); - float timeMax = useAnim - (useAnim / 3); + float time = (AnimationProgress) - (useAnim / 2.5f); + float timeMax = useAnim - (useAnim / 2.5f); - if (time == (int)(timeMax * 0.4f)) + if (time >= (int)(timeMax * 0.4f) && playSwingSound) { - SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); - SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.6f : 0.9f) }, Projectile.Center); + SoundStyle swing = new("CalamityMod/Sounds/Item/SwingMid"); + SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? -0.4f : -0.1f) }, Projectile.Center); + SoundStyle swing2 = new("CalamityMod/Sounds/Item/HellkiteSwing", 2); + SoundEngine.PlaySound(swing2 with { Volume = 0.8f, Pitch = (Projectile.ai[1] == 1 ? 0.4f : 0.7f) }, Projectile.Center); + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f)) + if ((int)(time) % 2 == 0 && Projectile.ai[1] == 1) + { + SoundStyle swoosh = new("CalamityMod/Sounds/Item/SwooshMid"); + SoundEngine.PlaySound(swoosh with { Volume = 1f, Pitch = -0.4f, MaxInstances = -1 }, Projectile.Center); + } + if (time > (int)(timeMax * 0.45f) && time < (int)(timeMax * 0.9f)) { CanHit = true; for (int i = 0; i < 2; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 170), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(170 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); GeneralParticleHandler.SpawnParticle(new GlowSparkParticle(particlePos, -particleVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.75f, 0.9f), false, 14, Main.rand.NextFloat(0.06f, 0.03f), mainColor, new Vector2(1.3f, 0.2f), true, false, 0.55f)); } for (int i = 0; i < 6; i++) { Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)); - Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, 240), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); + Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(30, (int)(240 * (1 + bladeFade * 0.6f))), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45))); if (Main.rand.NextBool(3)) { Particle sparker = new CustomSpark(particlePos + Main.rand.NextVector2Circular(15, 15), -particleVel * Main.rand.NextFloat(0.4f, 0.8f), "CalamityMod/Particles/Sparkle", false, 30, Main.rand.NextFloat(1.2f, 2.2f), mainColor, new Vector2(0.4f, Main.rand.NextFloat(0.9f, 1.4f)), true, true); @@ -190,14 +216,19 @@ namespace CalamityMod.Projectiles.Melee else CanHit = false; - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), - 0.2f); - + float start = swingCount % 2 != 0 ? (150 * Projectile.ai[1] * Owner.direction) : (150f * Projectile.ai[1] * Owner.direction); + float end = swingCount % 2 != 0 ? ((270) * -Projectile.ai[1] * Owner.direction) : (120f * -Projectile.ai[1] * Owner.direction); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(start, end, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + if (time > timeMax * 0.7f) + { + RotationOffset = Utils.AngleLerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(start, end, CalamityUtils.ExpInOutEasing(time / timeMax, 1))), 0.2f); + } if (time >= timeMax) doSwing = false; if (time < (int)(timeMax * 0.7f)) + { postSwing = true; - + } if (CanHit) { for (int i = 0; i < 3; i++) @@ -205,10 +236,10 @@ namespace CalamityMod.Projectiles.Melee float randRot = Main.rand.NextFloat(-30, -60); Vector2 dustVel = (new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot)); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(240, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(240 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, Color.White, mainColor, Main.rand.NextFloat(0.5f, 0.7f), 11, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); - Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(240, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel); + Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(240 * (1 + bladeFade * 0.6f), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, dustVel); dust2.scale = Main.rand.NextFloat(0.65f, 1.05f); dust2.noGravity = true; dust2.color = Color.Lerp(Color.White, mainColor, 0.5f); @@ -229,7 +260,7 @@ namespace CalamityMod.Projectiles.Melee if (target.CanBeMoved(true)) { // Launch - Vector2 launchVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitY) * -17; + Vector2 launchVel = (Projectile.ai[1] != 1 ? Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld) : Utils.DirectionTo(Owner.Center, target.Center)) * 37; target.velocity = launchVel * (target.knockBackResist == 0 ? 0.5f : 1f); } @@ -258,13 +289,13 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.ai[1] == -1) { Vector2 spawnSpot = target.Center + new Vector2(Main.rand.NextFloat(-450, 450), Main.rand.NextFloat(-450, -650)); - Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 0, 0, 2); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), spawnSpot, Vector2.Zero, ModContent.ProjectileType(), (int)(Projectile.damage * 1.2f), Projectile.knockBack, Projectile.owner, 0, 0, 2); } spawnBoom = false; } - int heal = (int)(MathHelper.Clamp(80 - Projectile.numHits * 60, 1, 80)); + int heal = (int)(MathHelper.Clamp(85 - Projectile.numHits * 65, 1, 85)); if (Projectile.numHits < 15) { Owner.HealPlayer(heal); @@ -319,13 +350,37 @@ namespace CalamityMod.Projectiles.Melee float r = (FlipAsSword ? MathHelper.ToRadians(90) : 0f); - for (int i = 0; i < 25; i++) + for (int i = 0; i < 20; i++) { Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/EarthGhost").Value; Color auraColor = mainColor with { A = 0 } * 0.15f * fadeIn; Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 8 * fadeIn; Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (swingCount > 0) + { + if (swingCount % 2 != 0) + { + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 3.15f / 4, SpriteEffects.None); + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 3.15f / 4, SpriteEffects.FlipVertically); + } + else + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, mainColor with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -85 : 85) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 3.15f * 1.6f / 4, SpriteEffects.None); + } + + Asset tex2 = ModContent.Request("CalamityMod/Particles/BloomCircle"); + int draws = 24; + + for (int i = 0; i < draws; i++) + { + Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)); + + Color auraColor = Color.Lerp(mainColor, Color.Lerp(mainColor, Color.White, 0.7f), Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * bladeFade; + Vector2 drawOffset = -offsetDir * 9 * i * bladeFade; + Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(2, 2), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.03f) * 0.7f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); + } Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/GrandGuardianHoldout.cs b/Projectiles/Melee/GrandGuardianHoldout.cs index 83f09b63bc..8db7eaf418 100644 --- a/Projectiles/Melee/GrandGuardianHoldout.cs +++ b/Projectiles/Melee/GrandGuardianHoldout.cs @@ -23,12 +23,12 @@ namespace CalamityMod.Projectiles.Melee public override LocalizedText DisplayName => CalamityUtils.GetItemName(); public override string Texture => "CalamityMod/Items/Weapons/Melee/GrandGuardian"; - public override float HitboxOutset => 105; + public override float HitboxOutset => 112; - public override Vector2 HitboxSize => new Vector2(175, 175); + public override Vector2 HitboxSize => new Vector2(180, 180); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 124); + public override Vector2 SpriteOrigin => new(-3, 130); public Vector2 mousePos; public Vector2 aimVel; public bool doSwing = true; @@ -38,6 +38,7 @@ namespace CalamityMod.Projectiles.Melee public int swingCount; public bool spawnBoom = true; public bool finalFlip = false; + public bool playSwingSound = true; public override void SetDefaults() { base.SetDefaults(); @@ -76,9 +77,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.2f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); if (!doSwing) @@ -86,6 +87,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + playSwingSound = true; spawnBoom = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; @@ -96,7 +98,6 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; doSwing = true; - swingCount++; finalFlip = false; } else @@ -115,17 +116,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.3f)) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.1f, useAnim * 0.25f, Animation, true)) * 0.35f)), 0.2f); } else { @@ -137,12 +139,14 @@ namespace CalamityMod.Projectiles.Melee float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * 0.3f)) + if (time >= (int)(timeMax * 0.3f) && playSwingSound) { SoundEngine.PlaySound(SoundID.DD2_MonkStaffSwing with { Volume = 1f, Pitch = -0.2f }, Projectile.Center); SoundEngine.PlaySound(SoundID.DD2_GhastlyGlaivePierce with { Volume = 1f, Pitch = -0.5f }, Projectile.Center); + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.9f)) + if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax)) { CanHit = true; @@ -169,7 +173,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < 3; i++) { bool color = Main.rand.NextBool(); - GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); + GenericSparkle sparker = new GenericSparkle(Owner.Center + (new Vector2(190, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), Vector2.Zero, color ? Color.Cyan : Color.DarkOrchid, color ? Color.DarkOrchid : Color.Cyan, Main.rand.NextFloat(0.4f, 0.6f), 10, Main.rand.NextFloat(-0.1f, 0.1f), 2.68f); GeneralParticleHandler.SpawnParticle(sparker); Dust dust2 = Dust.NewDustPerfect(Owner.Center + (new Vector2(180, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), 278, Vector2.One.RotatedByRandom(100) * Main.rand.NextFloat(0.5f, 2)); @@ -246,6 +250,7 @@ namespace CalamityMod.Projectiles.Melee { Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/GrandGuardianGlow"); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; @@ -256,6 +261,8 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 6 * fadeIn; Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + if (swingCount > 0) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.DarkOrchid with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 2.45f / 4, SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); diff --git a/Projectiles/Melee/HellkiteHoldout.cs b/Projectiles/Melee/HellkiteHoldout.cs index a4ee410736..a0becfe61a 100644 --- a/Projectiles/Melee/HellkiteHoldout.cs +++ b/Projectiles/Melee/HellkiteHoldout.cs @@ -33,7 +33,7 @@ namespace CalamityMod.Projectiles.Melee public float fadeIn = 0; // Used to make particle effects and outer glow on the sword fade in and out public int useAnim; // Used as your use time stat since checking the held item use time gets jank if your attack speed changes mid swing public int storedUseAnim; // Used to check your use time when you began using the item and to reset use time when needed - public int swingCount = -1; // Runs counting code first, so it has to be one below + public int swingCount = 0; public float GFBMulti = 1; // GFB infinite charge particle and damage multiplier public int GFBCharge = 0; // GFB charge counter public bool GFBFlashWarning = false; @@ -42,6 +42,7 @@ namespace CalamityMod.Projectiles.Melee public bool chargedSwing = false; // True if you have a charged swing fully charged public int chargeTimer = 0; // Timer for charging the blade with right click public int chargeTimerMax = 240; // This is set to be base don use time on spawn + public bool playSwingSound = true; public SlotId AudSlot; public override void SetDefaults() @@ -53,6 +54,7 @@ namespace CalamityMod.Projectiles.Melee } public override void OnSpawn(IEntitySource source) { + CanHit = false; Projectile.knockBack = 0; Projectile.scale = 1; Projectile.ai[1] = -1; @@ -89,9 +91,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.23f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.3f); if (chargeTimer > 0) fadeIn = Utils.Remap(chargeTimer, 0, chargeTimerMax, 0, 1f); @@ -109,6 +111,7 @@ namespace CalamityMod.Projectiles.Melee if (!doSwing) { + playSwingSound = true; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; @@ -218,7 +221,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.5f)) { if (Projectile.ai[2] == 5 && !chargedSwing) doSwing = false; @@ -235,11 +238,11 @@ namespace CalamityMod.Projectiles.Melee doSwing = false; chargeTimer = 0; chargedSwing = false; - swingCount++; useAnim = storedUseAnim; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.6f, Animation, true)) * 0.45f)), 0.2f); FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; } else @@ -247,7 +250,7 @@ namespace CalamityMod.Projectiles.Melee float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * (chargedSwing ? 0.2f : 0.4f))) + if (time >= (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && playSwingSound) { if (!chargedSwing) { @@ -258,8 +261,10 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(Hellkite.SwingSound with { Volume = 0.9f, Pitch = 0.2f }, Projectile.Center); SoundEngine.PlaySound(Hellkite.SwingSoundBig with { Volume = 1f, Pitch = 0f }, Projectile.Center); } + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && time < (int)(timeMax * (chargedSwing ? 0.9f : 0.7f))) + if (time > (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && time < (int)(timeMax * (chargedSwing ? 0.9f : 0.7f))) { CanHit = true; @@ -424,6 +429,7 @@ namespace CalamityMod.Projectiles.Melee Asset tex = ModContent.Request(Texture); Asset glowTex = ModContent.Request("CalamityMod/Items/Weapons/Melee/HellkiteGlow"); Asset shineTex = ModContent.Request("CalamityMod/Particles/Sparkle"); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearRagged"); float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; Vector2 generalDrawPos = Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY); @@ -433,10 +439,13 @@ namespace CalamityMod.Projectiles.Melee { Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/HellkiteGhost").Value; Color auraColor = Color.OrangeRed with { A = 0 } * 0.15f * fadeIn; - Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 7 * fadeIn; + Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * (chargeTimer > 0 ? 4 : 7) * fadeIn; Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + if (swingCount > 0 && Projectile.ai[2] != 5 && !playSwingSound) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Lerp(Color.DarkRed, Color.OrangeRed, 0.25f) with { A = 0 } * fadeIn * 0.9f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -80 : 80) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 2.35f / 4, swingCount % 2 == 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(tex.Value, generalDrawPos, tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, sEffects); if (chargeTimer > 0) diff --git a/Projectiles/Melee/HolyColliderHoldout.cs b/Projectiles/Melee/HolyColliderHoldout.cs index c90bcacacb..88b15b7092 100644 --- a/Projectiles/Melee/HolyColliderHoldout.cs +++ b/Projectiles/Melee/HolyColliderHoldout.cs @@ -45,6 +45,7 @@ namespace CalamityMod.Projectiles.Melee public Color mainColor1 = Color.Goldenrod; public Color mainColor2 = Color.OrangeRed; + public bool playSwingSound = true; public SlotId AudSlot; public override void SetDefaults() @@ -202,11 +203,12 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.6f)) { if (Projectile.ai[2] == 5 && !chargedSwing) doSwing = false; + playSwingSound = true; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; @@ -221,7 +223,7 @@ namespace CalamityMod.Projectiles.Melee useAnim = storedUseAnim; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.15f, useAnim * 0.35f, Animation, true)) * 0.35f)), 0.2f); FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; } else @@ -229,7 +231,7 @@ namespace CalamityMod.Projectiles.Melee float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * (chargedSwing ? 0.2f : 0.4f))) + if (time >= (int)(timeMax * (chargedSwing ? 0.2f : 0.4f)) && playSwingSound) { if (!chargedSwing) { @@ -245,6 +247,7 @@ namespace CalamityMod.Projectiles.Melee SoundStyle swing2 = new("CalamityMod/Sounds/Item/SwingMid"); SoundEngine.PlaySound(swing2 with { Volume = 0.9f, Pitch = -0.55f }, Projectile.Center); } + playSwingSound = false; } if ( time > (int)(timeMax * (chargedSwing ? 0.1f : 0.3f)) && time < (int)(timeMax * (chargedSwing ? 0.95f : 0.85f))) { diff --git a/Projectiles/Melee/MajesticGuardHoldout.cs b/Projectiles/Melee/MajesticGuardHoldout.cs index db12b879d1..07b37fb4f0 100644 --- a/Projectiles/Melee/MajesticGuardHoldout.cs +++ b/Projectiles/Melee/MajesticGuardHoldout.cs @@ -33,6 +33,7 @@ namespace CalamityMod.Projectiles.Melee public int useAnim; public int swingCount; public bool finalFlip = false; + public bool playSwingSound = true; public override void SetDefaults() { base.SetDefaults(); @@ -71,9 +72,9 @@ namespace CalamityMod.Projectiles.Melee } if (CanHit) - fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f); + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.15f); else - fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f); + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.25f); if (!doSwing) @@ -81,6 +82,7 @@ namespace CalamityMod.Projectiles.Melee for (int i = 0; i < Main.maxNPCs; i++) Projectile.localNPCImmunity[i] = 0; + playSwingSound = true; Projectile.numHits = 0; mousePos = Owner.Calamity().mouseWorld; aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; @@ -90,7 +92,6 @@ namespace CalamityMod.Projectiles.Melee FlipAsSword = Owner.direction == -1 ? true : false; doSwing = true; - swingCount++; finalFlip = false; } else @@ -109,17 +110,18 @@ namespace CalamityMod.Projectiles.Melee Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f); - if (AnimationProgress < (useAnim / 3)) + if (AnimationProgress < (useAnim / 1.6f)) { aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; if (AnimationProgress == 0) { + Animation = 0; doSwing = false; Projectile.ai[1] = -Projectile.ai[1]; } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f); + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.35f, useAnim * 0.65f, Animation, true)) * 0.45f)), 0.2f); FlipAsSword = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX).X > 0 ? true : false; } else @@ -132,12 +134,14 @@ namespace CalamityMod.Projectiles.Melee float time = (AnimationProgress) - (useAnim / 3); float timeMax = useAnim - (useAnim / 3); - if (time == (int)(timeMax * 0.4f)) + if (time >= (int)(timeMax * 0.4f) && playSwingSound) { SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing"); SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.35f, 0.55f) }, Projectile.Center); + swingCount++; + playSwingSound = false; } - if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f)) + if ( time > (int)(timeMax * 0.5f) && time < (int)(timeMax * 0.7f)) { CanHit = true; @@ -230,6 +234,10 @@ namespace CalamityMod.Projectiles.Melee Vector2 drawOffset = (MathHelper.TwoPi * i / 25f).ToRotationVector2() * 5 * fadeIn; Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), centerTexture.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); } + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + + if (swingCount > 0 && !playSwingSound) + Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Silver with { A = 0 } * fadeIn * 0.4f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 != 0 ? -55 : 55) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.9f / 4, swingCount % 2 != 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), lightColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None)); Main.EntitySpriteDraw(glowTex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), glowTex.Frame(1, FrameCount, 0, Frame), Color.White, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(glowTex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));