From a6ef9743ff2077cd283573ca167fe1dfdf339d43 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 1 Sep 2024 18:25:38 -0400 Subject: [PATCH 1/9] Several changes based on feedback * Reverted Earthen Tides shockwave color to be water-themed again * Removed passive attunements from Galaxia * Monoliths from BB Heaven's Might and TBB Swordsmith's Pride now scale in size based on the target's size and follow their targets * TBB Swordsmith's Pride monoliths now spawn on hit instead of at the peak of the sword throw, and always rise upwards instead of being based on sword throw direction --- DataStructures/Attunement.cs | 40 ------- Items/Weapons/Melee/FourSeasonsGalaxia.cs | 23 +--- .../en-US/Mods.CalamityMod.Attunement.hjson | 24 ---- ...Mods.CalamityMod.Items.Weapons.Melee.hjson | 2 - .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 - Projectiles/Melee/GalaxiaTropicRing.cs | 112 ------------------ .../Galaxia_AndromedasStrideBoltSpawner.cs | 9 +- .../Melee/MendedBiomeBlade_HeavensMight.cs | 8 +- .../Melee/MendedBiomeBlade_HeavensMonolith.cs | 23 ++-- .../TrueBiomeBlade_EarthenTidesShockwave.cs | 10 +- .../TrueBiomeBlade_EarthenTidesShockwave.png | Bin 3984 -> 5794 bytes .../Melee/TrueBiomeBlade_SwordsmithsPride.cs | 27 +++-- ...TrueBiomeBlade_SwordsmithsPrideMonolith.cs | 30 +++-- 13 files changed, 72 insertions(+), 237 deletions(-) delete mode 100644 Projectiles/Melee/GalaxiaTropicRing.cs diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index fd239c11cf..2307e19427 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -599,16 +599,6 @@ namespace CalamityMod.DataStructures item.UseSound = null; item.noMelee = true; } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } - } } public class AriesAttunement : Attunement @@ -633,16 +623,6 @@ namespace CalamityMod.DataStructures item.UseSound = null; item.noMelee = true; } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, Main.MouseWorld, Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } - } } public class PolarisAttunement : Attunement @@ -667,16 +647,6 @@ namespace CalamityMod.DataStructures item.UseSound = null; item.noMelee = true; } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); - UseTimer++; - } - } } public class AndromedaAttunement : Attunement @@ -702,16 +672,6 @@ namespace CalamityMod.DataStructures item.UseSound = null; item.noMelee = true; } - - public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) - { - if (UseTimer % 500 == 449) - { - SoundEngine.PlaySound(SoundID.Item78); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), FourSeasonsGalaxia.CancerPassiveDamage, 0f, player.whoAmI, 0f); - UseTimer++; - } - } } #endregion diff --git a/Items/Weapons/Melee/FourSeasonsGalaxia.cs b/Items/Weapons/Melee/FourSeasonsGalaxia.cs index 3e52429c52..008bea0bf2 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -86,9 +86,7 @@ namespace CalamityMod.Items.Weapons.Melee return; var effectDescTooltip = list.FirstOrDefault(x => x.Text.Contains("[FUNC]") && x.Mod == "Terraria"); - var passiveDescTooltip = list.FirstOrDefault(x => x.Text.Contains("[PASS]") && x.Mod == "Terraria"); var mainAttunementTooltip = list.FirstOrDefault(x => x.Text.Contains("[ATT]") && x.Mod == "Terraria"); - var blessingTooltip = list.FirstOrDefault(x => x.Text.Contains("[BLE]") && x.Mod == "Terraria"); //Default stuff gets skipped here. MainAttunement is set to true in SafeCheckAttunements() above @@ -105,23 +103,11 @@ namespace CalamityMod.Items.Weapons.Melee effectDescTooltip.OverrideColor = mainAttunement.tooltipColor; } - if (passiveDescTooltip != null) - { - passiveDescTooltip.Text = mainAttunement.PassiveDesc.ToString(); - passiveDescTooltip.OverrideColor = mainAttunement.tooltipPassiveColor; - } - if (mainAttunementTooltip != null) { mainAttunementTooltip.Text = mainAttunementTooltip.Text.Replace("ATT", mainAttunement.AttunementName.ToString()); mainAttunementTooltip.OverrideColor = Color.Lerp(mainAttunement.tooltipColor, mainAttunement.tooltipColor2, 0.5f + (float)Math.Sin(Main.GlobalTimeWrappedHourly) * 0.5f); } - - if (blessingTooltip != null) - { - blessingTooltip.Text = blessingTooltip.Text.Replace("BLE", mainAttunement.PassiveName.ToString()); - blessingTooltip.OverrideColor = mainAttunement.tooltipPassiveColor; - } } #endregion @@ -222,22 +208,15 @@ namespace CalamityMod.Items.Weapons.Melee } SafeCheckAttunements(); - mainAttunement.ApplyStats(Item); - //Passive effects only jappen player side haha - if (player.whoAmI != Main.myPlayer) - return; - - var source = player.GetSource_ItemUse(Item); - mainAttunement.PassiveEffect(player, source, ref UseTimer, ref OnHitProc); - if (player.Calamity().mouseRight && CanUseItem(player) && player.whoAmI == Main.myPlayer && !Main.mapFullscreen) { //Don't shoot out a visual blade if you already have one out if (Main.projectile.Any(n => n.active && n.type == ProjectileType() && n.owner == player.whoAmI)) return; + var source = player.GetSource_ItemUse(Item); Projectile.NewProjectile(source, player.Top, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI, 0, Math.Sign(player.position.X - Main.MouseWorld.X)); } } diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 9f8fa7c009..661dce6473 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -146,12 +146,6 @@ PhoenixAttunement: { The swirling nebula constantly emits homing cosmic bolts Release to hurl the sword toward the cursor alongside 6 gigantic cosmic bolts ''' - PassiveName: Capricorn's Blessing - PassiveDesc: - ''' - Periodically releases a ring of weakening stars around your cursor when attacking - The ring moves away from you, but slows down over time - ''' } AriesAttunement: { @@ -161,12 +155,6 @@ AriesAttunement: { Binds the sword to your cursor through a chain of constellations Striking enemies causes nebulous explosions which spawn homing cosmic bolts ''' - PassiveName: Capricorn's Blessing - PassiveDesc: - ''' - Periodically releases a ring of weakening stars around your cursor when attacking - The ring moves away from you, but slows down over time - ''' } PolarisAttunement: { @@ -178,12 +166,6 @@ PolarisAttunement: { Release to fire a powerful star directly at your cursor Attacking immediately after firing the star launches you toward it, damaging enemies ''' - PassiveName: Cancer's Blessing - PassiveDesc: - ''' - Periodically releases a ring of lifestealing stars around you when attacking - The ring moves toward you, but slows down over time - ''' } AndromedaAttunement: { @@ -194,10 +176,4 @@ AndromedaAttunement: { Charging the sword periodically emits homing bolts Lunging into enemies rains large homing stars from the heavens ''' - PassiveName: Cancer's Blessing - PassiveDesc: - ''' - Periodically releases a ring of lifestealing stars around you when attacking - The ring moves toward you, but slows down over time - ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index c7e6853ffc..5571e2c695 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -544,12 +544,10 @@ FourSeasonsGalaxia: { Tooltip: ''' [FUNC] - [PASS] Freed from earthly shackles and coursing with cosmic power Has access to all of the attunements at all times Press to cycle the sword's attunement depending on the cursor's position Active Attunement : [ATT] - Passive Blessing : [BLE] ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 6115d579f8..034a060b36 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -130,7 +130,6 @@ GaelSkull2.DisplayName: No Longer Ark of the Cosmos' Superior Cousin GalacticaComet.DisplayName: Galactus Comet GalaxiaBolt.DisplayName: Galaxia Bolt GalaxiaHoldout.DisplayName: Galactic Formation -GalaxiaTropicRing.DisplayName: Star Ring GalaxyBlast.DisplayName: Galaxy Blast GalaxyBlastType2.DisplayName: Galaxy Blast GalaxyBlastType3.DisplayName: Galaxy Blast diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs deleted file mode 100644 index c0fb8cc795..0000000000 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ /dev/null @@ -1,112 +0,0 @@ -using System; -using CalamityMod.Buffs.StatDebuffs; -using CalamityMod.Items.Weapons.Melee; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Melee -{ - public class GalaxiaTropicRing : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public Player Owner => Main.player[Projectile.owner]; - public ref float Mode => ref Projectile.ai[0]; - public ref float Fade => ref Projectile.ai[1]; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 30; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = 300; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Mode == 0f && Main.rand.NextFloat() < FourSeasonsGalaxia.CancerPassiveLifeStealProc) - { - Owner.statLife += FourSeasonsGalaxia.CancerPassiveLifeSteal; - Owner.HealEffect(FourSeasonsGalaxia.CancerPassiveLifeSteal); - } - else - { - target.AddBuff(BuffType(), FourSeasonsGalaxia.CapricornPassiveDebuffTime); - } - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - return Collision.CheckAABBvAABBCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center - Vector2.One * 95 * Projectile.scale, Vector2.One * 190 * Projectile.scale); - } - - public override void AI() - { - Projectile.velocity *= 0.95f; - - if (Mode == 0f) - Projectile.Center = Vector2.Lerp(Projectile.Center, Owner.Center, 0.4f * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1)); - else - Projectile.velocity = Utils.SafeNormalize(Projectile.Center - Owner.Center, Vector2.Zero) * MathHelper.Clamp((Projectile.timeLeft - 150) / 150f, 0, 1) * 3f * (5f - MathHelper.Clamp((Projectile.Center - Owner.Center).Length() / 150f, 0, 4f)); - - Fade = Projectile.timeLeft > 250 ? (float)Math.Sin((300 - Projectile.timeLeft) / 50f * MathHelper.PiOver2) * 0.6f + 0.4f : Projectile.timeLeft > 50 ? 1f : (float)Math.Sin((Projectile.timeLeft) / 50f * MathHelper.PiOver2); - Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); - - } - - public Vector2 starPosition(int MaxStars, int StarIndex, float diameter) - { - float starHeight = (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); - float starWidth = (float)Math.Cos(Main.GlobalTimeWrappedHourly * 3 + StarIndex * MathHelper.TwoPi / (float)MaxStars); - - return Projectile.Center + Projectile.rotation.ToRotationVector2() * starWidth * (Projectile.scale * diameter * 0.4f) + (Projectile.rotation + MathHelper.PiOver2).ToRotationVector2() * starHeight * (Projectile.scale * diameter * 0.4f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D sigil = Request(Mode == 0 ? "CalamityMod/Projectiles/Melee/GalaxiaCancer" : "CalamityMod/Projectiles/Melee/GalaxiaCapricorn").Value; //OMG Karkat and Gamzee from homestuck i am a big fan - Texture2D ring = Request("CalamityMod/Particles/BloomRing").Value; - Texture2D starTexture = Request("CalamityMod/Particles/Sparkle").Value; - Texture2D lineTexture = Request("CalamityMod/Particles/BloomLine").Value; - Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; - - Color ringColor = Mode == 0 ? new Color(255, 0, 0) * Fade : new Color(66, 0, 176) * Fade; - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - Main.EntitySpriteDraw(bloomTexture, Projectile.Center - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 2.5f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(ring, Projectile.Center - Main.screenPosition, null, ringColor * 0.8f, 0f, ring.Size() / 2f, Projectile.scale, 0f, 0); - - Main.EntitySpriteDraw(sigil, Projectile.Center - Main.screenPosition, null, ringColor * MathHelper.Lerp(0.7f, 0f, ((Main.GlobalTimeWrappedHourly * 5f) % 10) / 10f), 0f, sigil.Size() / 2f, Projectile.scale + ((Main.GlobalTimeWrappedHourly * 5f) % 10) / 10f * 2f, 0f, 0); - Main.EntitySpriteDraw(sigil, Projectile.Center - Main.screenPosition, null, Color.White * Fade, 0f, sigil.Size() / 2f, Projectile.scale, 0f, 0); - - for (int i = 0; i < 5; i++) - { - - Vector2 starPos = starPosition(5, i, ring.Width); - - Vector2 LineVector = starPosition(5, i + 1, ring.Width) - starPos; - float rot = LineVector.ToRotation() + MathHelper.PiOver2; - Vector2 origin = new Vector2(lineTexture.Width / 2f, lineTexture.Height); - Vector2 scale = new Vector2(0.3f, LineVector.Length() / lineTexture.Height); - - Main.EntitySpriteDraw(lineTexture, starPos - Main.screenPosition, null, Color.White * Fade * 0.7f, rot, origin, scale, SpriteEffects.None, 0); - - Main.EntitySpriteDraw(bloomTexture, starPos - Main.screenPosition, null, ringColor * 0.5f, 0, bloomTexture.Size() / 2f, 0.1f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(starTexture, starPos - Main.screenPosition, null, ringColor * 0.5f, Main.GlobalTimeWrappedHourly * 5 + MathHelper.PiOver4 * i, starTexture.Size() / 2f, 1f, SpriteEffects.None, 0); - Main.EntitySpriteDraw(starTexture, starPos - Main.screenPosition, null, Color.White * Fade, Main.GlobalTimeWrappedHourly * 5, starTexture.Size() / 2f, 1.4f, SpriteEffects.None, 0); - } - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - return false; - } - } -} diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index 089af06a1b..c0a6677e0f 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -41,7 +41,14 @@ namespace CalamityMod.Projectiles.Melee } // Constantly follow its target - Projectile.Center = Target.Center; + // Die if the target is no longer active + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; // Spawn smoke if (Projectile.timeLeft < 59) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index a33a92b11e..88a1444c12 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -98,7 +98,6 @@ namespace CalamityMod.Projectiles.Melee else if (CurrentState == 0f) { CurrentState = 1f; - Projectile.numHits = 0; SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES @@ -205,11 +204,14 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // Spawn a monolith on max power sword throws - if (!(CurrentState == 1f && Projectile.numHits <= 0)) + if (!(CurrentState == 1f && !CalamityUtils.AnyProjectiles(ProjectileType()))) return; if (Empowerment >= maxEmpowerment) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10), ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HolyAttunement_MonolithDamage), 10f, Owner.whoAmI, Main.rand.Next(4)); + { + float monolithScale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f), ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.HolyAttunement_MonolithDamage), 10f, Owner.whoAmI, Main.rand.Next(4), monolithScale, target.whoAmI); + } } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs index dee46f1586..d2ada56839 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs @@ -18,9 +18,10 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith"; public Player Owner => Main.player[Projectile.owner]; + public NPC Target => Main.npc[(int)Projectile.ai[2]]; public float Timer => (100f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes - public ref float WaitTimer => ref Projectile.ai[1]; //How long till it appears fr + public ref float Variant => ref Projectile.ai[0]; + public ref float Scale => ref Projectile.ai[1]; public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -37,9 +38,6 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment Hold = new CurveSegment(EasingType.ExpOut, 0.70f, 1f, -0.1f); internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -48,6 +46,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 102; + Projectile.scale = Scale; Projectile.usesIDStaticNPCImmunity = true; Projectile.idStaticNPCHitCooldown = 10; Projectile.hide = true; @@ -78,6 +77,16 @@ namespace CalamityMod.Projectiles.Melee } } + // Constantly follow its target + // Die if its target is no longer active + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; + if (Projectile.timeLeft == 80) { Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); @@ -108,7 +117,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); @@ -125,7 +134,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs index 9c6c385221..f5bb85666d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs @@ -52,7 +52,7 @@ namespace CalamityMod.Projectiles.Melee if (Projectile.timeLeft == 60) { SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); - Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.BurlyWood : Color.Brown, Projectile.scale, 20, 0.2f, 2); + Particle Sparkle = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, Projectile.scale, 20, 0.2f, 2); GeneralParticleHandler.SpawnParticle(Sparkle); } @@ -62,21 +62,21 @@ namespace CalamityMod.Projectiles.Melee { SoundEngine.PlaySound(SoundID.DD2_ExplosiveTrapExplode, Projectile.Center); - BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Brown, Projectile.scale, 40); + BloomRing = new BloomRing(Projectile.Center, Vector2.Zero, Color.Aqua, Projectile.scale, 40); GeneralParticleHandler.SpawnParticle(BloomRing); - Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.BurlyWood * 0.6f : Color.Brown * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20); + Particle Bloom = new StrongBloom(Projectile.Center, Vector2.Zero, Main.rand.NextBool() ? Color.Aqua * 0.6f : Color.SpringGreen * 0.6f, Projectile.scale * (1f + Main.rand.NextFloat(0f, 1.5f)), 20); GeneralParticleHandler.SpawnParticle(Bloom); for (int i = 0; i < 10; i++) { - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.SandyBrown : Color.LimeGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(17.5f, 25f) * Projectile.scale, Color.White, Main.rand.NextBool() ? Color.DarkSlateBlue : Color.Chocolate, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } for (float i = 0f; i < 1; i += 0.05f) { float rotation = i * MathHelper.TwoPi; - Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.SaddleBrown : Color.Brown, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + Particle Sparkle = new CritSpark(Projectile.Center + rotation.ToRotationVector2() * 65f * Projectile.scale, rotation.ToRotationVector2() * 10f, Color.White, Main.rand.NextBool() ? Color.Aqua : Color.SpringGreen, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); GeneralParticleHandler.SpawnParticle(Sparkle); } } diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png index bc29ed731e42743974f21c23bf8c801f5c470768..55dd6345b9849b755cf464bedbf545d34c7c5d89 100644 GIT binary patch literal 5794 zcmbVQd0diNzjx|wDx2)J)Rxh_Q?FC*O}XSsmPBbT$d;g3GnomwBrfGf+2T#hrbVq> z!zBa-Q*jL`oi6I; zL?f3`@$)gs@&(xfdroSL>))H^@i%zh`|SD6u!S1SrJtNt{@3S3e6Yt;cycv20Hx1@P5QMG#&pwK(+7j;C+${d$h|C18Iy+&K{?`H4+ z+z%}s6C3}B07qSjV`_M?#aBGp;@#oa&A25k--F0?E~b;@(d;cr75cR|XdB&-Avf;T z)D%)ixQaGaE(EjycHnoehvQZSjU z;U3@XCki({KVXuw6E&yWdHAuRBm_M2d9U-IqZW)q>EiOT3BAlU#-_W|V=05a z89$GoDv^G61pOF8iP(4WqPEByt~Oyv@)-0uT|I#B9@O?t#}aXHla{fZw<(q*0nwNB zDSeDK2Hm~>>^^@&H?wXUTg=sf2z%^r)mS#fn95Q?Zfe?h1i$4n2SvtU=xENN8G@Ni zph^Za=?wiq67Drc4K094zC^YteY+2+7iN8XHS4!E7qBn$U{`1xPbw=4PlOj0Ut%Q( z>1VEKTE9@jbT?_A|EFs~qXJ~t@QFAm`kLz#Z{fN^x_iH~m`z+Cb+cL&2WHEs@E`Z3 zn}-q(X9TRDal~QJJIbv{&y8-I%o9r$D-u<$#;@KE`d~rV?G!Yn=SL?p3oPe&0Gfh2 zZMYZefA&Gq!<^6KlMM_IO6N}0#I0c}gJSYkHUv{Wri~l_-t5&uAh~=tjmM-^h2nM=a^+y5xMKKCBO$P;m~#o^$J1 zNoEay;KjBF)jIGF%({+6YZ~2s|DR>MF&F&G2R%5Ft)Hhr$2xQIgSQH_)vdO8QSQzaPdq* zf{#~_NaQpYuj-bl%IoM@We$>Vr{bEIYGi0zcwBDsLiS<< ziG8NS(FQk|;`Hc7a>0j&sUhR_8llnS(9Z3zR5|?xs!#E%NAQwB-}hbYyV!2s{HtwA z<));bIO%<}<8Gl77Wj61-)>VT5eE42u}i2DQzIy^qy+N`Bw{bfQ-Xn9*oWpPIFb^< zdTXZz*_`c*8Gc#Sq{@w^y{BMX(FCf8J z1aMni@Q2?ULVW-%6Wqt|FcF{1zqN+w)-Ep>6xMCq%05ifM_3ckBpLNEQkQ)84?;|) z6c5G=5!9)zBN0o#vbK$im4FM8$2+E1ooU4|7k>glZ}owj4zBy~8WWh6HGc;5Z>_t= zA(U1Ti+YuSACdT4lF;vKu|kOejd&JG6eat4Obv=EAgk=2WdkOZ%>xDe**VN*1+6kz zn`N+_K`V9v>SF7F_w6NO2#FQ=3xNQNn6p+JY7IWjY%n){J^<7s0h3h&2?x3QLM3kN zh^DgY;PjXk`z~$cqmK5FKhhe=)(k_6on8%29uN(7%AbCt#8<{4T^HVZXrm(Qo)VI1 zV6|0tOkF3vTHHK-8beF@wORdm9WQ#*DkDGij#Ck*cg9*wzelnKKf!SEZm9t6u&~&j zu>meYmcK^4Ktk<^Yd(hcVxol4)d>Y{<*@TQi``O|6#vd44KhK{=b1E@ftt*T;5o?` zk``5OQM{m;To?G?;Fj~g{30K8pgg~Zcmmpt4ICpg;$O$8EA+9*>xJ~q{>Vv8oQzyj z4q1ST;gruh=?n8*FY^j$gKBj#4e#3Lje^wCm;dsHUhVZNkbQ==m~U9FSP>BReAt!- zMqUx8;eAuGS5O9ktmYtYk;ooU z;v^i?eU_8g2jc4I(me*VN`f)y@US|XS?CZenF?}=(8C=4F&5(wE_2fHjaN-W2_05U zAU<+i6#3TLo@>p&dv;nAA$@s;p<};B3ny^Z%{|$1Gv@(wEb?K;$M%g+o&y%Ae=ma5 zHsST0crlL3tASSgk(T9}*E)R9c)fDP*+Dj>wfhjZ_QBmq3I+rhu7nybR?CfPdh9>a zEESEP4=pPhiNk9d7Ap@IxaW*Bz@yrk8f<#xv%G8s>^6zpI!E+SGCKeq=(*gow3(Qh zPX1C5dJwDKlm$Ys+8CFh=@|$~`^UL1GqUrpEh@mag{fy@m*p-+X|+Rs3WY3p8* zVA28P_rI;kC66mkI{a*D>B5e?!gGZiC+!xH1p(>qS^%W5G{=v^3wfOUUqmW33fkF! z;QIu7?MK*-O*mhHMs^~Z&2>Gmhi&4mU)&}4I_qDJ9cIx>l(CKC?JAs*Eq7;1eTxA0 zfqeXU6j|S}%u%lTniA4+cu+C|amE%NCiXU3rR*+HEzsEZ!80giN|@>jNbfzpm}u&6 zOoMj~n=>QGZm7N$2>|nB2AuhfS5wTT^}QWNsg%VggXk{EIP^!IVw4G}Wkw#j7d^O) zT4i-GV3lWDJX5eVg0~F06!u5jyTE_v!^b2Hu89GL6blPIQZaM-gHr^e}cwgu>+8#hfR&||^qzXwZ37#>X z{)J?{+#Waw*w`|9_ud@^;6--98+5#_ZC0aOtIKB);S5FW)rUdR;{BvUTN;iPaSVm)11Zsc=T|z)0Sv_qY=8j#ksj@FrM#IRa;Gd7Q?VK0ybGy_`a%U~rm@HTy?(Px{ zM6~5Joa;6>vIb#&bYSdL_=oPt1#(J3vFP0*AqtQG#$I-mu^HkudQJm2kkzzs*vnCT z{XE=%m!f3=I+i;mv?cfGvzp^jaBSX6;BN0*Fa(;Dhh;(={-C5uo(MGa;2T2$i5i3& zJC7gi)piOdK?e3qIlbeK<4d$ILb|`Z>62^mE_`&c2lDzq2PR{_U*brkaDSBic?{5Y z9ED`~Ni=U$n#P1t6<~(?KqN})xhJj{c_`t#QYl-N0gAAgj>$ZYz+}x|FCAxi!hQis ziGYWx&z9X5S^vuWL=1VodaL>mpbj_MkpvjQOucnw7o~>-y0yy?VZq_{wz#k}R51!* zF`lj}yso~r0l$!x56~JeqswgeJSJBZ``r2pk`Yeeqt_>He2R+y0~%VpkuBRp(D>(BSiiR!&w_$agAbX3}9fwOr~J0fd1}g(HhJM_gn=-hM8vw z9SGnBZ+2DBj=SClDoIXrjL&CKw6;|DedRzbqPaHoz7ELT$Q&<)q)4ni$Zp$5Q0C|W zl~B~PsL?EvwH9p9W_eS=ZWa)=UK+*(tpHua1vx|O-tP+u>lyjx3xVF{G=^k4kS}Lg zEnClov5vu(`rZLqH6(Z!imGa7rYSA})>L7u=r(g`|JWu!Ko`6~sYC(R=wCO>E>JoG%4Ms9Qe_<&Qk<%ZyA&0<9*^NeZTRWv5=v3MOgO#ctYA(l;Trq z78C*XfLr(?p??$)mxUrn`ZTP((vwkQgst|jZ>9Y+8`I>({rgVAJ2 zi)I-j4a$43>L?2`Gi5J4m8V=z6>c02%OEY8;&uxQfHrL*$cLyNwyJIb%4ucMAhiuX zl2iq1{|7W_Un5KaUc_AT(1*^LJ@ViGI${P~^_U?xc_Y`J{PwQquN&Wvng7!{L2t;a zSIU8Bb|MX9)0uxv<{)5 z5p?=BPzTkQ#B20zAx$5-<(Qb^SdOe*{idhn4ayJAq-M;A2Y4mEnLqL>? zrCo7?^!gs~Ucn9dBgXeVQLyYdcGUh{s_(p(O)uoI6wrG@=x`H~>MeBosjBc0)K+(O zKi(c;*`4;-!kRnuuGGo74_LPoF!98Ao1BFv7r=NQ7TPbU%I*`P!gWK!>S9Nd`9|x~ jlk>4{4shgmAFvwZ<5NUV%~FULMEav}Z+F(g6Dj`%Ao&lL8543je-X`)z-_R##b<_0D~{!@2kDz0Y~+ zSRaoK2HOn~2*d`@58V8~vkZZF5hB^nQP5dKbMo;lxPp!^<3vIARHYT0m!khL^=B4hcG1{%Hn2@mK_B62qY;E z`-5oC!_lNRB!*h3wu)S)z?4=nC4w{QFaX=A5=QQ6B-a0ZVTUjX-G z@Hg5G9D4=xNy-E>^$Ug){fIXXyV`c5!zED<_3|zNi zkitC9ByRR2tJl>npWaVwYLC35jT&{-9!k1x(VzC7rB zR|4TTy0XCqo$E$nA2#(RB?D5Hh*z8MYNd>jaq0QI+^4D;5zo#3jEWs|T0L(q%XtF^ zL>T1P6sO~(G281UF8c7ITNmAM+p@S(rIo{Oxb*UbdN#|_m|cKG)!I9}50C}(0&_*V zxQ33GmB(d*i(IRI7w_4$GPBSkH~}P;S)cDT$=^M7swH*`4#a6I71BIOicIZu@CEMQ z3)>xQq@EodU%nlgbP--~VXyG{sJyCz%!AN}JkUV6H$&q{dQqn-B$d~7cGiLD89MSh z7$V4S0=5tFI{J|z1KHEjRCid$o3GW^9^kocJ&UDG(7=GL3Y$Xe@(y79Uo(84S9oW= z1sf3mkt?xt4{#_%U)jK`0HTp*s$f-QY7Ifo`>;_Zgw97o(xDf1Z=4egTPV16n~S&% zQfm+S#hmO5kbd%;j-eM9mCnMYMD@Vv=t^<~?D(91G`~LE86Tk<>>KN^D)%Tt^Pvba zI!Roa*@6Ti2W0LS>}+Yz9B7{hp&qva3>6gc3`3$fOc1-D3TPj}A~Zz8d(Jtn2S*t1 z59;Ap+}BAWmSA;Wa}jvD5yJW>Fu8kg{hr5o(z_6)64qC79}&%{p(OR|^tl?_>C*R7 ztBF4Tix=kRL0AH*wS4i~x-Pt&1%paeEa<-3Gz>V@OSKDan~w2Z4={4v4&PZ*?FU3C z{dqiKuBDI-M96GEUQB|fkpYLaVCu;TBI!1liXOUt3@{UqPIZQQ>^|XcdRycpt(OP7 zW^^)3K(7g7u-G(vsS^MOrAY5L2mrYzCP+cmlzZJ1sB36|`i7Mr-rdb-ENSgz*9bT= z3LZKy55tF`cBHwE+H$z0`)3Cm(2L&eGyO7RyWca>qs+4jN^B}lsh1@inLJm z9-0DicEvf`){aaRRl%w_5ok^KhevEQlL+7!y9faxCMMql&7Y*6UTabotw66G!{Fq)+n z#h0k_d&05XS}9P<348i(m?CViJR<3`bgQgC5#%bRt_9qi~#&_Vo0!pVig>Xv4ZmtO29 zIZsS-sD(R6aG6s&z6ijA{SmCerW$a}E8WWaSfg+45F7t; zbepC8OlnyPn|7@$2o!nUiPqk#!7+8?9%n0XzVgfU7b3rt3`;?Q@k;?xy?>6BH~ovE z%F-*kuvQ3`eRcC6 z6R9qRrtMNF;=X5UWLkhan?(bHB%Gd9UFPH?zVBSbO<*Tu~`Mxjq=1pddW7lgmJr+%U&Wm7vJuAUhXDc1U@U{+@0}png}H7h5YF#)zWM>@j>kEDgN_=vZ&XGsroU?Jpo%B*^ciPj@K;fa$m#7{gdhc|&u5s05$ zC%Y-9CzJV$MUQVY!RN%n+p%F|cdeEe+rh%dc0cmyRCv+_?wqrbyIOt&<5(;9=JNhS z_gl~By`t%>XKrEkz6T3UKPQrnvWq-E6C^gq*z)Ntc-Z?UJOOKCqmytk!?^ zv2)C8uJR|0Xd(S1Hq4Lmau|MivSj-olS2;aPhS2>4*4ys{HWDbOZjpsxCT6`cy9tSgK6Hd&1plvb0+*xH zgwdeHdF0HKO7p-l3lx1kZ-=`c&jR%gj_wtJL>;%U_Y2;ji&Q>svNCGz9B$RC%SIrc zk)`k1G&XbAMT*6ST+v90Jjm?if8dHB&&%?Zx6b&gA 0f && snapTimer < 0.04f) - { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_MonolithDamageMult), Projectile.knockBack, Owner.whoAmI, Main.rand.Next(4), 1f, hasMadeChargeSound); - if (proj.ModProjectile is SwordsmithsPrideMonolith monolith) - { - monolith.OriginDirection = direction; - monolith.Facing = 0f; - } - } } //Make the owner look like theyre holding the sword bla bla @@ -223,6 +213,23 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (CurrentState == 1f && !CalamityUtils.AnyProjectiles(ProjectileType())) + { + float monolithScale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + Vector2 monolithDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f); + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, monolithDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_MonolithDamageMult), Projectile.knockBack, Owner.whoAmI, Main.rand.Next(4), 1f, hasMadeChargeSound); + if (proj.ModProjectile is SwordsmithsPrideMonolith monolith) + { + monolith.Scale = monolithScale; + monolith.OriginDirection = monolithDirection; + monolith.Facing = 0f; + monolith.Target = target; + } + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (CurrentState == 1f) diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs index 2098858de1..7e8f5a7680 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs @@ -21,10 +21,12 @@ namespace CalamityMod.Projectiles.Melee public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith"; public Player Owner => Main.player[Projectile.owner]; public float Timer => (100f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes - public ref float Size => ref Projectile.ai[1]; //Yes - public Vector2 OriginDirection; //The direction of the original strike - public float Facing; //The direction of the original strike + public ref float Variant => ref Projectile.ai[0]; + public ref float Size => ref Projectile.ai[1]; + public float Scale; // The scale multiplier based on the target's size + public Vector2 OriginDirection; // The direction of the original strike + public float Facing; // The direction of the original strike + public NPC Target; // The NPC to stick on top of public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -41,9 +43,6 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment Hold = new CurveSegment(EasingType.ExpOut, 0.70f, 1f, -0.1f); internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight * Size; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -52,6 +51,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 102; + Projectile.scale = Scale; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = 20; Projectile.hide = true; @@ -76,6 +76,14 @@ namespace CalamityMod.Projectiles.Melee Projectile.velocity = Vector2.Zero; } + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; + if (Projectile.timeLeft == 100) { if (Size >= 1) //Big monoliths create sparkles even before sprouting up @@ -128,12 +136,14 @@ namespace CalamityMod.Projectiles.Melee public void SideSprouts(float facing, float projSize) { - Vector2 monolithRotation = OriginDirection.RotatedBy((MathHelper.Pi / 6f) * facing); + Vector2 monolithRotation = OriginDirection.RotatedBy(MathHelper.Pi / 9.5f * facing); Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize, Projectile.ai[2] - 1f); if (proj.ModProjectile is SwordsmithsPrideMonolith monolith) { + monolith.Scale = Scale; monolith.OriginDirection = monolithRotation; monolith.Facing = facing; + monolith.Target = Target; } } @@ -152,7 +162,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); @@ -169,7 +179,7 @@ namespace CalamityMod.Projectiles.Melee float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); From f9c3b9473011fd0f71f332659f646a0914f5bbe8 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sun, 1 Sep 2024 21:04:08 -0400 Subject: [PATCH 2/9] Two more feedback changes * Swordsmith's Pride passive now makes attacks spawn homing astral bombers instead of making attacks inflict Astral Infection * Andromeda's Stride chargeup stars are now aimed in a spread forward, with delayed homing --- DataStructures/Attunement.cs | 13 +- Items/Weapons/Melee/OmegaBiomeBlade.cs | 2 +- .../en-US/Mods.CalamityMod.Attunement.hjson | 2 +- .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 + Projectiles/Melee/GalaxiaBolt.cs | 3 +- Projectiles/Melee/Galaxia_AndromedasStride.cs | 6 +- .../Galaxia_AndromedasStrideBoltSpawner.cs | 1 - .../Melee/TrueBiomeBlade_EarthenTides.cs | 3 - .../Melee/TrueBiomeBlade_EarthenTidesBeam.cs | 6 - .../Melee/TrueBiomeBlade_EarthenTidesBlast.cs | 6 - .../TrueBiomeBlade_EarthenTidesShockwave.cs | 6 - .../Melee/TrueBiomeBlade_GhastlyChain.cs | 6 - ...TrueBiomeBlade_LamentationsOfTheChained.cs | 3 - .../Melee/TrueBiomeBlade_SanguineFury.cs | 7 +- .../Melee/TrueBiomeBlade_SanguineFuryDash.cs | 6 - .../Melee/TrueBiomeBlade_SanguineFuryWheel.cs | 8 -- ...BiomeBlade_SwordsmithsPrideAstralBomber.cs | 122 ++++++++++++++++++ Projectiles/Summon/AureusBomberGlow.png | Bin 0 -> 696 bytes 18 files changed, 140 insertions(+), 61 deletions(-) create mode 100644 Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs create mode 100644 Projectiles/Summon/AureusBomberGlow.png diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 2307e19427..4cbac05222 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -460,12 +460,15 @@ namespace CalamityMod.DataStructures public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) { - // CIT 15JUL2024: Swordsmith's Pride no longer applies its passive effect using this function, since it requires an NPC argument. - // It is now applied using the RealPassiveEffect function below. - // This implentation is admittedly kinda clunky, but oh well. - } + if (Procced) + { + int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage); + Vector2 velocity = (Main.MouseWorld - player.Center).SafeNormalize(Vector2.UnitX) * 15f; + Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0f, player.whoAmI); - public static void RealPassiveEffect(NPC target) => target.AddBuff(BuffType(), 90); + Procced = false; + } + } } public class FlailBladeAttunement : Attunement diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index fc65aea889..3deb216156 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -41,7 +41,7 @@ namespace CalamityMod.Items.Weapons.Melee public static float WhirlwindAttunement_ThrowDamageBoost = 3.3f; public static float WhirlwindAttunement_MonolithDamageMult = 0.5f; - public static int WhirlwindAttunement_PassiveBaseDamage = 200; + public static int WhirlwindAttunement_PassiveBaseDamage = 80; public static int SuperPogoAttunement_BaseDamage = 200; diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 661dce6473..9665c578f1 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -100,7 +100,7 @@ WhirlwindAttunement: { Once swung for long enough, releasing hurls the sword towards your cursor Once pulled back, the hurled sword erupts into astral monoliths ''' - PassiveDesc: All attacks inflict the Astral Infection debuff + PassiveDesc: Striking enemies occasionally spawns homing astral bombers that spread the Astral Infection } FlailBladeAttunement: { diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 034a060b36..0d27023e3e 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -249,6 +249,7 @@ StygianShieldThrown.DisplayName: Shield of Chaos SulphurousGrabberBubble.DisplayName: Grabber Bubble SulphurousGrabberBubble2.DisplayName: Grabber Bubble SwordsmithsPride.DisplayName: Swordsmith's Pride +SwordsmithsPrideAstralBomber.DisplayName: Swordsmith's Astral Bomber SwordsmithsPrideAstralEnergy.DisplayName: Swordsmith's Astral Energy SwordsmithsPrideMonolith.DisplayName: Swordsmiths Pride Monolith SwordsplosionBlue.DisplayName: Blue Sword diff --git a/Projectiles/Melee/GalaxiaBolt.cs b/Projectiles/Melee/GalaxiaBolt.cs index 1e9c160c2b..2a449495e2 100644 --- a/Projectiles/Melee/GalaxiaBolt.cs +++ b/Projectiles/Melee/GalaxiaBolt.cs @@ -16,6 +16,7 @@ namespace CalamityMod.Projectiles.Melee public ref float Hue => ref Projectile.ai[0]; public ref float HomingStrenght => ref Projectile.ai[1]; + public ref float ShouldDelayHoming => ref Projectile.ai[2]; Particle Head; @@ -55,7 +56,7 @@ namespace CalamityMod.Projectiles.Melee if (target == null) target = Projectile.Center.ClosestNPCAt(812f, true); - else if (CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver2) //Home in + else if (CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver2 && (ShouldDelayHoming != 1f || Projectile.timeLeft < 60)) //Home in { float idealDirection = Projectile.AngleTo(target.Center); float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); diff --git a/Projectiles/Melee/Galaxia_AndromedasStride.cs b/Projectiles/Melee/Galaxia_AndromedasStride.cs index 109659d94a..83953994bc 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -115,7 +115,8 @@ namespace CalamityMod.Projectiles.Melee // Spawn a ring of stars for (int i = 0; i < 5; i++) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Vector2 velocity = direction.RotatedByRandom(MathHelper.PiOver4) * 10f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, velocity, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f, 1f); } SoundEngine.PlaySound(SoundID.Item79, Projectile.Center); @@ -146,7 +147,8 @@ namespace CalamityMod.Projectiles.Melee // Spawn more stars for (int i = 0; i < 9; i++) { - Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); + Vector2 velocity = direction.RotatedByRandom(MathHelper.PiOver4) * 10f; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, velocity, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_ChargeupBoltDamageMultiplier), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f, 1f); } OverCharge = 20f; diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index c0a6677e0f..00b06171b7 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -81,7 +81,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 starVel = (Projectile.Center - starPos).SafeNormalize(Vector2.UnitY) * 27f; Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), starPos, starVel, ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI, 0.75f, MathHelper.Pi / 20f); star.scale = 2f; - star.timeLeft = 100; } } diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs index 573dec4b77..8431177f0b 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs @@ -226,9 +226,6 @@ namespace CalamityMod.Projectiles.Melee // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. Owner.GiveUniversalIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames); - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - if (!CalamityUtils.AnyProjectiles(ProjectileType())) Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Owner.whoAmI, 1f); } diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs index f3ef2eb8f9..8ab9d6e068 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs @@ -128,12 +128,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordBeamProc) diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs index cb57a97185..843cd4effd 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs @@ -51,12 +51,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs index f5bb85666d..aa5ad1ce0d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs @@ -87,12 +87,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_ShockwaveProc) diff --git a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs index b763216a2c..7c61988cce 100644 --- a/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs +++ b/Projectiles/Melee/TrueBiomeBlade_GhastlyChain.cs @@ -57,12 +57,6 @@ namespace CalamityMod.Projectiles.Melee sword.OnHitProc = true; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - } - public override bool PreDraw(ref Color lightColor) { Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChainedChain").Value; diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 70ad3324fe..2b388cda7d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -117,9 +117,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - if (hit.Crit) { SoundEngine.PlaySound(CommonCalamitySounds.SwiftSliceSound, Projectile.Center); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs index 4b580a3548..17f2ad2f16 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFury.cs @@ -242,12 +242,7 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= damageMultiplier * damageReduction; } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - ShredTarget(); - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); private void ShredTarget() diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index c744402dbe..51944ea35a 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -20,9 +20,6 @@ namespace CalamityMod.Projectiles.Melee public Vector2 DashStart; public Vector2 DashEnd; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -48,9 +45,6 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) sword.OnHitProc = true; - - if (sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); } Particle bloom = new StrongBloom(target.Center, target.velocity, Color.Crimson * 0.5f, 1f, 30); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index 37098ad43d..278a8a8158 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -25,11 +25,6 @@ namespace CalamityMod.Projectiles.Melee public const float MaxTime = 120; - - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -89,9 +84,6 @@ namespace CalamityMod.Projectiles.Melee { if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) sword.OnHitProc = true; - - if (sword.secondaryAttunement.id == AttunementID.Whirlwind) - WhirlwindAttunement.RealPassiveEffect(target); } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs new file mode 100644 index 0000000000..595e5117e2 --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralBomber.cs @@ -0,0 +1,122 @@ +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsmithsPrideAstralBomber : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Summon/AureusBomber"; + + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() + { + Main.projFrames[Type] = 3; + ProjectileID.Sets.TrailCacheLength[Projectile.type] = 3; + ProjectileID.Sets.TrailingMode[Projectile.type] = 0; + } + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 60; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.timeLeft = 240; + Projectile.tileCollide = false; + } + + public override void AI() + { + // Animation and visuals. + Projectile.frameCounter++; + if (Projectile.frameCounter > 6) + { + Projectile.frame++; + Projectile.frameCounter = 0; + if (Projectile.frame >= 3) + Projectile.frame = 0; + } + Lighting.AddLight(Projectile.Center, Color.Lerp(Color.Orange, Color.Cyan, (float)Math.Sin(Main.GlobalTimeWrappedHourly)).ToVector3()); + if (Projectile.timeLeft % 10 == 0) + { + Vector2 sparklePos = new Vector2(Projectile.position.X + Main.rand.Next(Projectile.width), Projectile.position.Y + Main.rand.Next(Projectile.height)); + GenericSparkle sparkle = new(sparklePos, Vector2.Zero, Main.rand.NextBool() ? Color.Orange : Color.Cyan, Color.White, 0.9f, 30, 0f); + GeneralParticleHandler.SpawnParticle(sparkle); + } + + // Find the closest target. + Vector2 destination = Projectile.Center; + bool foundTarget = false; + float npcDistCompare = 400f; + int index = -1; + + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile, false)) + continue; + + float currentNPCDist = Vector2.Distance(n.Center, Projectile.Center); + if (currentNPCDist < npcDistCompare) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + if (index != -1) + { + destination = Main.npc[index].Center; + foundTarget = true; + } + + // Homing and facing direction. + if (foundTarget) + { + Vector2 homeDirection = (destination - Projectile.Center).SafeNormalize(Vector2.UnitY); + Projectile.velocity = (Projectile.velocity * 20f + homeDirection * 15f) / 21f; + if ((destination - Projectile.Center).X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else + Projectile.spriteDirection = Projectile.direction = 1; + } + else + { + if (Projectile.velocity.X > 0f) + Projectile.spriteDirection = Projectile.direction = -1; + else if (Projectile.velocity.X < 0f) + Projectile.spriteDirection = Projectile.direction = 1; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType(), 90); + + public override void OnKill(int timeLeft) + { + for (int i = 0; i < 9; i++) + { + Vector2 veloc = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * Main.rand.NextFloat(3.5f, 6f); + LineParticle sparks = new(Projectile.Center, veloc, false, 16, 0.8f, Main.rand.NextBool() ? Color.Orange : Color.Cyan); + GeneralParticleHandler.SpawnParticle(sparks); + } + } + + public override bool PreDraw(ref Color lightColor) + { + CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1); + return false; + } + + public override void PostDraw(Color lightColor) + { + Texture2D glow = ModContent.Request("CalamityMod/Projectiles/Summon/AureusBomberGlow").Value; + Rectangle frame = glow.Frame(1, 3, 0, Projectile.frame); + Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, 0f, frame.Size() / 2f, 1f, SpriteEffects.None); + } + } +} diff --git a/Projectiles/Summon/AureusBomberGlow.png b/Projectiles/Summon/AureusBomberGlow.png new file mode 100644 index 0000000000000000000000000000000000000000..1faa9ff87dbf4225c1e94aca186b2b66031abdbf GIT binary patch literal 696 zcmV;p0!RIcP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D0!>LoK~#8N?V7(Y z1VI$Xcj@R(BT?`tD78++A3%o_Duqr*t<))0B!`YaK*VX4{san%L|jKF%X_!)a^4y< zYsc8P`##BJc8bf*eedo2H4`bGiPJe4d-K~#`iSga?K|yZD4i7>*UhB_M!Ga2M$wFY zysR$buWKxf;yPYw2eD&P^>%m?*W7l+DB9m>a@tB@G}>DcjL?9RFgC~Uad70>Xp-D~ zdGorh1DwZBE`r!7LGQ@jWAAI{I_LNxU(q<84XPwTiW2mX3RLv-jZYtuQ2vu3Kib?F z!FBiY6=!jZ8aL`1gM9%?qMFO=y}^*DDA)wq1u#94;P`96+n~o`N`fCHUkb>3>k0n$ zcaGk0rU>C1?!Tk6W1P6xk*g@dBLs2yG=;Nktz(1!L7U%}uP8xPqWbz(i$O{Q$0D@ypTVyl;r@?KDAv<03zx?C`5Tj^+ zqogF*;D6cSPsmfW?15^4K%Oh8qOOq7+*y0ZwW-&oirO&cv!<-8K8p7Hso(V7 zk+k1wqdwg{8<~zV$DnB5+N#EidQy;6Uq5O(9WII(MHNM<8@YWP?_$_a^oXJ-d)0|d zT*17G(C6vCovEK{%LVEi>s>L`OjIfGyMd}`UQCq&-4Rqp^OC7%*=-%oM-@dWDH%WN zdiyXmawC&#cg~l>uKBL~Sa0nl6Nc^`F?eqp7`(R(xSqRKFMBd(aSBxlnVy)Se eq9~;#iar2kb`Y&Uc5{RP0000 Date: Mon, 2 Sep 2024 20:26:49 -0400 Subject: [PATCH 3/9] I hate custom use style melee Oh I also did actual things as well: * Removed Grovetender's Touch from BBB * Removed specific attunement classification for sea biomes (they now attune into Pure Clarity) * Space now attunes into Biting Embrace * Reorganized the structure of bools for granting attunements --- CalamityLists.cs | 2 +- DataStructures/Attunement.cs | 41 +-- Items/Weapons/Melee/BrokenBiomeBlade.cs | 17 +- .../en-US/Mods.CalamityMod.Attunement.hjson | 9 - .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 + Projectiles/Melee/BiomeBladeHoldout.cs | 22 +- Projectiles/Melee/BrokenBiomeBladeHoldout.cs | 19 +- .../BrokenBiomeBlade_GrovetendersTouch.cs | 248 ------------------ .../Melee/BrokenBiomeBlade_PureClarity.cs | 153 +++++++++++ Projectiles/Melee/TrueBiomeBladeHoldout.cs | 23 +- 10 files changed, 190 insertions(+), 345 deletions(-) delete mode 100644 Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs create mode 100644 Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs diff --git a/CalamityLists.cs b/CalamityLists.cs index d01e70294c..cb46dd77c2 100644 --- a/CalamityLists.cs +++ b/CalamityLists.cs @@ -807,10 +807,10 @@ namespace CalamityMod ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 4cbac05222..a88486d14d 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -14,7 +14,7 @@ namespace CalamityMod.DataStructures { public enum AttunementID : byte { - Default, Hot, Cold, Tropical, Evil, //Broken biome blade + Default, Hot, Cold, Evil, //Broken biome blade TrueDefault, TrueHot, TrueCold, TrueTropical, TrueEvil, Holy, //Biome blade Whirlwind, FlailBlade, SuperPogo, Shockwave, //True biome blade Phoenix, Aries, Polaris, Andromeda //Galaxia @@ -28,7 +28,7 @@ namespace CalamityMod.DataStructures public static void Load() { attunementArray = new Attunement[] { - new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new TropicalAttunement(), new EvilAttunement(), + new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new EvilAttunement(), new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), new WhirlwindAttunement(), new FlailBladeAttunement(), new SuperPogoAttunement(), new ShockwaveAttunement(), new PhoenixAttunement(), new AriesAttunement(), new PolarisAttunement(), new AndromedaAttunement(), @@ -98,13 +98,13 @@ namespace CalamityMod.DataStructures public override void ApplyStats(Item item) { - item.channel = false; - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); + item.channel = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.Shoot; + item.shoot = ProjectileType(); item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; - item.noMelee = false; + item.UseSound = null; + item.noMelee = true; } } public class HotAttunement : Attunement @@ -178,31 +178,6 @@ namespace CalamityMod.DataStructures } } - public class TropicalAttunement : Attunement - { - public TropicalAttunement() - { - id = AttunementID.Tropical; - tooltipColor = new Color(162, 200, 85); - - energyParticleEdgeColor = new Color(53, 112, 4); - energyParticleCenterColor = new Color(131, 173, 39); - } - - public override float DamageMultiplier => BrokenBiomeBlade.TropicalAttunement_BaseDamage / (float)BrokenBiomeBlade.BaseDamage; - - public override void ApplyStats(Item item) - { - item.channel = false; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); - item.shootSpeed = 30; - item.UseSound = null; - item.noMelee = true; - } - } - public class EvilAttunement : Attunement { public EvilAttunement() diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index ebd82fb459..a45c00e5ac 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; @@ -20,7 +21,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Items.Weapons.Melee { [LegacyName("BiomeBlade")] - public class BrokenBiomeBlade : ModItem, ILocalizedModType + public class BrokenBiomeBlade : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public Attunement mainAttunement = null; @@ -47,18 +48,8 @@ namespace CalamityMod.Items.Weapons.Melee public static int HotAttunement_LocalIFrames = 40; //Be warned its got one extra update so all the iframes should be divided in 2 public static int HotAttunement_LocalIFramesCharged = 25; public static float HotAttunement_ShredDecayRate = 1f; //How much charge is lost per frame. - - public static int TropicalAttunement_BaseDamage = 65; - public static float TropicalAttunement_ChainDamageReduction = 0.6f; - public static float TropicalAttunement_SweetSpotDamageMultiplier = 1.2f; //It also crits, so be mindful of that - public static int TropicalAttunement_LocalIFrames = 60; //Be warned its got 2 extra updates so all the iframes should be divided in 3 #endregion - public override void SetStaticDefaults() - { - //Theres potential for flavor text as well but im not a writer - } - public override void ModifyTooltips(List list) { if (list == null) @@ -261,8 +252,8 @@ namespace CalamityMod.Items.Weapons.Melee { bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && - (n.type == ProjectileType() || - n.type == ProjectileType() || + (n.type == ProjectileType() || + n.type == ProjectileType() || n.type == ProjectileType())); } diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 9665c578f1..4e218e340c 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -18,15 +18,6 @@ ColdAttunement: { Function: Perform a 3 strike combo with a glacial blade, with the final strike freezing foes for a split second } -TropicalAttunement: { - Name: Grovetender's Touch - Function: - ''' - Throw out the blade on a vine whip, pulling you toward struck tiles - Striking enemies with the tip of the whip as it cracks guarantees a critical hit - ''' -} - EvilAttunement: { Name: Decay's Retort Function: Lunge forward with a ghostly rapier projection, bouncing away from struck targets and leeching their life diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 0d27023e3e..8c7e1291b3 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -199,6 +199,7 @@ PrismaticBeam.DisplayName: Prismatic Beam PrismaticWave.DisplayName: Prismatic Wave PrismRay.DisplayName: Prismatic Light PrismTooth.DisplayName: Photon Ripper +PureClarity.DisplayName: Pure Clarity PurityProjection.DisplayName: Purity Projection PurityProjectionSigil.DisplayName: Purity Sigil PwnagehammerEcho.DisplayName: Pwnagehammer Echo diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index 4bfba69445..9b1bc95342 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -117,25 +117,23 @@ namespace CalamityMod.Projectiles.Melee public void Attune(TrueBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert || Owner.Calamity().ZoneSunkenSea; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur || Owner.Calamity().ZoneAbyss; - bool heavenly = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; + bool jungleAttune = Owner.ZoneJungle; + bool coldAttune = Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool evilAttune = Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool hotAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight; + bool heavenlyAttune = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; Attunement attunement = Attunement.attunementArray[(int)AttunementID.TrueDefault]; - if (desert || hell) + if (hotAttune) attunement = Attunement.attunementArray[(int)AttunementID.TrueHot]; - if (snow) + if (coldAttune) attunement = Attunement.attunementArray[(int)AttunementID.TrueCold]; - if (jungle || ocean) + if (jungleAttune) attunement = Attunement.attunementArray[(int)AttunementID.TrueTropical]; - if (evil) + if (evilAttune) attunement = Attunement.attunementArray[(int)AttunementID.TrueEvil]; - if (heavenly) + if (heavenlyAttune) attunement = Attunement.attunementArray[(int)AttunementID.Holy]; //If the owner already had the attunement, break out of it (And unswap) diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 74e88f0315..1cf5493bf4 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -119,28 +119,21 @@ namespace CalamityMod.Projectiles.Melee public void Attune(BrokenBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert || Owner.Calamity().ZoneSunkenSea; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur || Owner.Calamity().ZoneAbyss; + bool coldAttune = Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool evilAttune = Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool hotAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight; Attunement attunement = Attunement.attunementArray[(int)AttunementID.Default]; - if (desert || hell) + if (hotAttune) { attunement = Attunement.attunementArray[(int)AttunementID.Hot]; } - if (snow) + if (coldAttune) { attunement = Attunement.attunementArray[(int)AttunementID.Cold]; } - if (jungle || ocean) - { - attunement = Attunement.attunementArray[(int)AttunementID.Tropical]; - } - if (evil) + if (evilAttune) { attunement = Attunement.attunementArray[(int)AttunementID.Evil]; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs deleted file mode 100644 index 0490a4ad6e..0000000000 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ /dev/null @@ -1,248 +0,0 @@ -using System; -using System.IO; -using CalamityMod.DataStructures; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Particles; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.ID; -using Terraria.ModLoader; -using static Terraria.ModLoader.ModContent; - - -namespace CalamityMod.Projectiles.Melee -{ - public class GrovetendersTouch : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade"; - private bool initialized = false; - public Player Owner => Main.player[Projectile.owner]; - public float Timer => MaxTime - Projectile.timeLeft; - public ref float HasSnapped => ref Projectile.ai[0]; - public ref float SnapCoyoteTime => ref Projectile.ai[1]; - public ref float Reach => ref Projectile.localAI[0]; - - const float MaxTime = 90; - const int coyoteTimeFrames = 15; //How many frames does the whip stay extended - const int MaxReach = 450; - const int MinReach = 250; - const float SnappingPoint = 0.65f; //When does the snap occur. - - public BezierCurve curve; - private Vector2 controlPoint1; - private Vector2 controlPoint2; - internal bool ReelingBack => Timer / MaxTime > SnappingPoint; - - public override void SetStaticDefaults() - { - } - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 40; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.extraUpdates = 2; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = BrokenBiomeBlade.TropicalAttunement_LocalIFrames; - } - - public override bool? CanCutTiles() => false; //Itd be quite counterproductive to make the whip cut the tiles it just grew - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, Projectile.Center }); - - int numPoints = 32; - Vector2[] chainPositions = curve.GetPoints(numPoints).ToArray(); - float collisionPoint = 0; - for (int i = 1; i < numPoints; i++) - { - Vector2 position = chainPositions[i]; - Vector2 previousPosition = chainPositions[i - 1]; - if (Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), position, previousPosition, 6, ref collisionPoint)) - return true; - } - return base.Colliding(projHitbox, targetHitbox); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - base.ModifyHitNPC(target, ref modifiers); - Vector2 projectileHalfLength = (Projectile.Size / 2f) * Projectile.rotation.ToRotationVector2(); - float collisionPoint = 0; - //If you hit the enemy during the coyote time with the blade of the whip, guarantee a crit & get some bonus damage - if (Collision.CheckAABBvLineCollision(target.Hitbox.TopLeft(), target.Hitbox.Size(), Projectile.Center - projectileHalfLength, Projectile.Center + projectileHalfLength, 32, ref collisionPoint)) - { - if (SnapCoyoteTime > 0f) - { - modifiers.SourceDamage *= BrokenBiomeBlade.TropicalAttunement_SweetSpotDamageMultiplier; - modifiers.SetCrit(); - for (int i = 0; i < 3; i++) - { - Vector2 sparkSpeed = Owner.DirectionTo(target.Center).RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * 9f; - Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, Color.LimeGreen, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); - GeneralParticleHandler.SpawnParticle(Spark); - } - } - } - else - modifiers.SourceDamage *= BrokenBiomeBlade.TropicalAttunement_ChainDamageReduction; //If the enemy is hit with the chain of the whip, the damage gets reduced - } - - public override void AI() - { - if (!initialized) //Initialization. create control points & shit - { - Projectile.velocity = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - Reach = MathHelper.Clamp((Owner.Center - Owner.Calamity().mouseWorld).Length(), MinReach, MaxReach); - SoundEngine.PlaySound(SoundID.DD2_OgreSpit, Projectile.Center); - controlPoint1 = Projectile.Center; - controlPoint2 = Projectile.Center; - Projectile.timeLeft = (int)MaxTime; - initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - if (ReelingBack && HasSnapped == 0f) //Snap & also small coyote time for the hook - { - SoundEngine.PlaySound(SoundID.Item41, Projectile.Center); //Snap - HasSnapped = 1f; - SnapCoyoteTime = coyoteTimeFrames; - } - - if (SnapCoyoteTime > 0) - { - Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); - SnapCoyoteTime--; - } - - Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); - Projectile.rotation = Projectile.AngleFrom(Owner.Center); //Point away from playah - - float ratio = GetSwingRatio(); - Projectile.Center = Owner.MountedCenter + SwingPosition(ratio); - Projectile.direction = Projectile.spriteDirection = -Owner.direction; - - Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); - } - - internal float EaseInFunction(float progress) => progress == 0 ? 0f : (float)Math.Pow(2, 10 * progress - 10); //Potion seller i need your strongest easeIns - - private float GetSwingRatio() - { - float ratio = (Timer - SnappingPoint * MaxTime) / (MaxTime * (1 - SnappingPoint)); //The ratio for the last section of the snap is a new curve. - if (!ReelingBack) - ratio = EaseInFunction(Timer / (MaxTime * SnappingPoint)); //Watch this ratio get eased - if (SnapCoyoteTime > 0) - ratio = 0f; - return ratio; - } - - private Vector2 SwingPosition(float progress) - { - //Whip windup and snap part - if (!ReelingBack) - { - float distance = Reach * MathHelper.Lerp((float)Math.Sin(progress * MathHelper.PiOver2), 1, 0.04f); //half arc - distance = Math.Max(distance, 65); //Dont be too close to player - - float angleDeviation = MathHelper.Pi / 1.2f; - float angleOffset = Owner.direction * MathHelper.Lerp(-angleDeviation, 0, progress); //Go from very angled to straight at the zenith of the attack - return Projectile.velocity.RotatedBy(angleOffset) * distance; - } - else - { - float distance = MathHelper.Lerp(Reach, 0f, progress); //Quickly zip back to the player . No angles or minimum distance from player. - return Projectile.velocity * distance; - } - } - - public override bool PreDraw(ref Color lightColor) - { - if (Timer == 0) - return false; - Texture2D handle = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchGlow").Value; - - Vector2 projBottom = Projectile.Center + new Vector2(-handle.Width / 2, handle.Height / 2).RotatedBy(Projectile.rotation + MathHelper.PiOver4) * 0.75f; - DrawChain(projBottom, out Vector2[] chainPositions); - - float drawRotation = (projBottom - chainPositions[^2]).ToRotation() + MathHelper.PiOver4; //Face away from the last point of the bezier curve - drawRotation += SnapCoyoteTime > 0 ? MathHelper.Pi : 0; //During coyote time the blade flips for some reason. Prevent that from happening - drawRotation += Projectile.spriteDirection < 0 ? 0f : 0f; - - Vector2 drawOrigin = new Vector2(0f, handle.Height); - SpriteEffects flip = (Projectile.spriteDirection < 0) ? SpriteEffects.None : SpriteEffects.None; - lightColor = Lighting.GetColor((int)(Projectile.Center.X / 16f), (int)(Projectile.Center.Y / 16f)); - - Main.EntitySpriteDraw(handle, projBottom - Main.screenPosition, null, lightColor, drawRotation, drawOrigin, Projectile.scale, flip, 0); - - //Turn on additive blending - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - //Only update the origin for once - drawOrigin = new Vector2(0f, blade.Height); - Main.EntitySpriteDraw(blade, projBottom - Main.screenPosition, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, flip, 0); - //Back to normal - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - return false; - } - - private void DrawChain(Vector2 projBottom, out Vector2[] chainPositions) - { - Texture2D chainTex = Request("CalamityMod/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouchChain").Value; - - float ratio = GetSwingRatio(); - - if (!ReelingBack) //Make the curve be formed from points slightly ahead of the projectile, but clamped to the max rotation (straight line ahead) - { - controlPoint1 = Owner.MountedCenter + SwingPosition(MathHelper.Clamp(ratio + 0.5f, 0f, 1f)) * 0.2f; - controlPoint2 = Owner.MountedCenter + SwingPosition(MathHelper.Clamp(ratio + 0.2f, 0f, 1f)) * 0.5f; - } - else //After the whip snaps, make the curve be a wave - { - Vector2 perpendicular = SwingPosition(ratio).SafeNormalize(Vector2.Zero).RotatedBy(MathHelper.PiOver2); - controlPoint1 = Owner.MountedCenter + SwingPosition(MathHelper.Lerp(ratio, 1f, ratio)) + perpendicular * MathHelper.SmoothStep(0f, 1f, ratio) * -155f; - controlPoint2 = Owner.MountedCenter + SwingPosition(MathHelper.Lerp(ratio, 1f, ratio / 2)) + perpendicular * MathHelper.SmoothStep(0f, 1f, ratio) * 100f; - } - - BezierCurve curve = new BezierCurve(new Vector2[] { Owner.MountedCenter, controlPoint1, controlPoint2, projBottom }); - int numPoints = 30; //"Should make dynamic based on curve length, but I'm not sure how to smoothly do that while using a bezier curve" -Graydee, from the code i referenced. I do agree. - chainPositions = curve.GetPoints(numPoints).ToArray(); - - //Draw each chain segment bar the very first one - for (int i = 1; i < numPoints; i++) - { - Vector2 position = chainPositions[i]; - float rotation = (chainPositions[i] - chainPositions[i - 1]).ToRotation() - MathHelper.PiOver2; //Calculate rotation based on direction from last point - float yScale = Vector2.Distance(chainPositions[i], chainPositions[i - 1]) / chainTex.Height; //Calculate how much to squash/stretch for smooth chain based on distance between points - Vector2 scale = new Vector2(1, yScale); - Color chainLightColor = Lighting.GetColor((int)position.X / 16, (int)position.Y / 16); //Lighting of the position of the chain segment - if (ReelingBack) - chainLightColor *= 1 - EaseInFunction(ratio); //Make the chain fade when reeling it back - Vector2 origin = new Vector2(chainTex.Width / 2, chainTex.Height); //Draw from center bottom of texture - Main.EntitySpriteDraw(chainTex, position - Main.screenPosition, null, chainLightColor, rotation, origin, scale, SpriteEffects.None, 0); - } - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - writer.Write(Reach); - } - - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - Reach = reader.ReadSingle(); - } - } -} diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs new file mode 100644 index 0000000000..fe61227a00 --- /dev/null +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -0,0 +1,153 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.DataStructures; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PureClarity : BaseCustomUseStyleProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override int AssignedItemID => ModContent.ItemType(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/BrokenBiomeBlade"; + public override float HitboxOutset => 30f; + public override Vector2 HitboxSize => new Vector2(36, 36); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(0, 12); + + public ref float SwingDir => ref Projectile.ai[1]; + public Vector2 mousePos; + public Vector2 aimPos; + public bool doSwing = true; + public bool postSwing = false; + public int useAnimation; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void OnSpawn(IEntitySource source) + { + SwingDir = 1f; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnimation = Owner.itemAnimationMax; + + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + if (CanHit || postSwing) + mousePos = Owner.Center - aimPos; + else + mousePos = Owner.Calamity().mouseWorld; + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + } + else + { + if (!CanHit && !postSwing) + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + else + Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnimation / 3)) + { + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + SwingDir = -SwingDir; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); + } + else + { + float swingTime = AnimationProgress - (useAnimation / 3); + float swingTimeMax = useAnimation - (useAnimation / 3); + + if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + { + CanHit = true; + + Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(10, 90), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Color particleColor = (Owner.HeldItem.ModItem as BrokenBiomeBlade).mainAttunement.tooltipColor; + if (Main.rand.NextBool()) + { + GenericBloom bloom = new(particlePos, particleVel, particleColor, 0.08f, 20); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, 0.55f, 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + CanHit = false; + + if (swingTime == (int)(swingTimeMax * 0.4f)) + { + Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * Owner.HeldItem.shootSpeed; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + } + + RotationOffset = MathHelper.Lerp(RotationOffset, + MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), + 0.2f); + + if (swingTime >= swingTimeMax) + doSwing = false; + if (swingTime < (int)(swingTimeMax * 0.7f)) + postSwing = true; + } + } + + ArmRotationOffset = MathHelper.ToRadians(-140f); + } + + public override bool PreDraw(ref Color lightColor) + { + // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. + if ((useAnimation > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) + { + Asset tex = ModContent.Request(Texture); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + + 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)); + } + return false; + } + + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index b7510385cf..bf24937c8e 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -128,26 +128,17 @@ namespace CalamityMod.Projectiles.Melee public void Attune(OmegaBiomeBlade item) { - bool jungle = Owner.ZoneJungle; - bool snow = Owner.ZoneSnow; - bool evil = Owner.ZoneCorrupt || Owner.ZoneCrimson; - bool desert = Owner.ZoneDesert; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool heavenly = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; - bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; + bool flailAttune = Owner.ZoneJungle || Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool pogoAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight || Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool whirlAttune = Owner.ZoneHallow || Owner.Calamity().ZoneAstral; Attunement attunement = Attunement.attunementArray[(int)AttunementID.Shockwave]; - if (desert || hell) + if (pogoAttune) attunement = Attunement.attunementArray[(int)AttunementID.SuperPogo]; - if (jungle || ocean || snow) //Check put after the desert check so ocean doesnt get overriden as desert + if (flailAttune) attunement = Attunement.attunementArray[(int)AttunementID.FlailBlade]; - if (evil) //Evil check separated so that it overrides corrupted beach & snow biomes - attunement = Attunement.attunementArray[(int)AttunementID.SuperPogo]; - if (marine) - attunement = Attunement.attunementArray[(int)AttunementID.Shockwave]; - if (heavenly) - attunement = Attunement.attunementArray[(int)AttunementID.Whirlwind]; //Putting holy check at the end so it may override hallowed variants of biomes + if (whirlAttune) + attunement = Attunement.attunementArray[(int)AttunementID.Whirlwind]; //If the owner already had the attunement, break out of it (And unswap) if (item.secondaryAttunement == attunement) From cf1506b4996e65156fb93776de18b6e116af719f Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Sep 2024 12:58:04 -0400 Subject: [PATCH 4/9] Fixed it not swinging back and forth Still need to properly align it (this will be annoying) --- Items/Weapons/Melee/BrokenBiomeBlade.cs | 3 +-- Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs | 7 ++++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index a45c00e5ac..eb08776086 100644 --- a/Items/Weapons/Melee/BrokenBiomeBlade.cs +++ b/Items/Weapons/Melee/BrokenBiomeBlade.cs @@ -252,8 +252,7 @@ namespace CalamityMod.Items.Weapons.Melee { bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && - (n.type == ProjectileType() || - n.type == ProjectileType() || + (n.type == ProjectileType() || n.type == ProjectileType())); } diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index fe61227a00..df34c9d60b 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -15,10 +15,10 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override int AssignedItemID => ModContent.ItemType(); public override string Texture => "CalamityMod/Items/Weapons/Melee/BrokenBiomeBlade"; - public override float HitboxOutset => 30f; - public override Vector2 HitboxSize => new Vector2(36, 36); + public override float HitboxOutset => 36f; + public override Vector2 HitboxSize => new Vector2(45, 45); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 12); + public override Vector2 SpriteOrigin => new(0, 30); public ref float SwingDir => ref Projectile.ai[1]; public Vector2 mousePos; @@ -130,6 +130,7 @@ namespace CalamityMod.Projectiles.Melee } ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); } public override bool PreDraw(ref Color lightColor) From 96a2132d4b006d773274336eff2fd0f31fb8ca45 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Sep 2024 20:32:05 -0400 Subject: [PATCH 5/9] BBB Pure Clarity functionality done This is the first time I've ever used hot reload lol --- DataStructures/Attunement.cs | 2 +- .../Melee/BrokenBiomeBlade_PureClarity.cs | 33 ++++++++----------- .../BrokenBiomeBlade_PurityProjection.cs | 9 ++--- 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index a88486d14d..ec9e58b5ff 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -102,7 +102,7 @@ namespace CalamityMod.DataStructures item.noUseGraphic = true; item.useStyle = ItemUseStyleID.Shoot; item.shoot = ProjectileType(); - item.shootSpeed = 12f; + item.shootSpeed = 0f; item.UseSound = null; item.noMelee = true; } diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index df34c9d60b..19fe521f4b 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -3,9 +3,10 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using ReLogic.Content; using Terraria; +using Terraria.Audio; using Terraria.DataStructures; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Melee @@ -15,10 +16,10 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override int AssignedItemID => ModContent.ItemType(); public override string Texture => "CalamityMod/Items/Weapons/Melee/BrokenBiomeBlade"; - public override float HitboxOutset => 36f; - public override Vector2 HitboxSize => new Vector2(45, 45); + public override float HitboxOutset => 50f; + public override Vector2 HitboxSize => new Vector2(48, 48); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); - public override Vector2 SpriteOrigin => new(0, 30); + public override Vector2 SpriteOrigin => new(-5, 40); public ref float SwingDir => ref Projectile.ai[1]; public Vector2 mousePos; @@ -30,6 +31,7 @@ namespace CalamityMod.Projectiles.Melee public override void SetDefaults() { base.SetDefaults(); + Projectile.scale = 1.25f; Projectile.DamageType = DamageClass.Melee; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; @@ -76,6 +78,7 @@ namespace CalamityMod.Projectiles.Melee if (AnimationProgress < (useAnimation / 3)) { + // Swing wind-up. Should not deal damage. aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; postSwing = false; @@ -95,8 +98,9 @@ namespace CalamityMod.Projectiles.Melee { CanHit = true; + // Particle effects on swing. Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); - Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(10, 90), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); Color particleColor = (Owner.HeldItem.ModItem as BrokenBiomeBlade).mainAttunement.tooltipColor; if (Main.rand.NextBool()) { @@ -112,9 +116,11 @@ namespace CalamityMod.Projectiles.Melee else CanHit = false; + // Fire projectiles. if (swingTime == (int)(swingTimeMax * 0.4f)) { - Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * Owner.HeldItem.shootSpeed; + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); } @@ -129,24 +135,11 @@ namespace CalamityMod.Projectiles.Melee } } + // Make the player's arms rotate. ArmRotationOffset = MathHelper.ToRadians(-140f); ArmRotationOffsetBack = MathHelper.ToRadians(-140f); } - public override bool PreDraw(ref Color lightColor) - { - // Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to. - if ((useAnimation > 0 || DrawUnconditionally) && Owner.ItemAnimationActive) - { - Asset tex = ModContent.Request(Texture); - - float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; - - 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)); - } - return false; - } - public override void ResetStyle() { } diff --git a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs index cf1ff9c56c..35b530522b 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PurityProjection.cs @@ -10,7 +10,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class PurityProjection : ModProjectile, ILocalizedModType //The boring plain one + public class PurityProjection : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/Melee/BrokenBiomeBlade_PurityProjection"; @@ -56,7 +56,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; @@ -66,10 +65,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 90; - target.AddBuff(BuffType(), debuffTime); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffType(), 90); } } From 3ff9880c94c77b28734fb6f604c858dc68f6eb19 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Tue, 3 Sep 2024 21:30:48 -0400 Subject: [PATCH 6/9] Start of BB Pure Clarity Also increased Grovetender's Touch range --- DataStructures/Attunement.cs | 14 +- Items/Weapons/Melee/TrueBiomeBlade.cs | 3 +- .../Mods.CalamityMod.Projectiles.Melee.hjson | 1 + .../MendedBiomeBlade_TrueGrovetendersTouch.cs | 2 +- .../Melee/MendedBiomeBlade_TruePureClarity.cs | 147 ++++++++++++++++++ .../MendedBiomeBlade_TruePurityProjection.cs | 9 +- 6 files changed, 160 insertions(+), 16 deletions(-) create mode 100644 Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index ec9e58b5ff..55a51bc7f7 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -227,13 +227,13 @@ namespace CalamityMod.DataStructures public override void ApplyStats(Item item) { - item.channel = false; - item.noUseGraphic = false; - item.useStyle = ItemUseStyleID.Swing; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = SoundID.Item1; - item.noMelee = false; + item.channel = true; + item.noUseGraphic = true; + item.useStyle = ItemUseStyleID.Shoot; + item.shoot = ProjectileType(); + item.shootSpeed = 0f; + item.UseSound = null; + item.noMelee = true; } } public class TrueHotAttunement : Attunement diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index eff49af8c8..762bd2c0f9 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using CalamityMod.DataStructures; +using CalamityMod.Items.BaseItems; using CalamityMod.Items.Materials; using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; @@ -20,7 +21,7 @@ namespace CalamityMod.Items.Weapons.Melee { // TODO -- CANNOT RENAME this and True Biome Blade to "TrueBiomeBlade" and "BiomeBlade" internally without corrupting existing items // (Comment copied from an equivalent one on OmegaBiomeBlade from June 2022) - public class TrueBiomeBlade : ModItem, ILocalizedModType + public class TrueBiomeBlade : CustomUseProjItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; public Attunement mainAttunement = null; diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 8c7e1291b3..d37976ea67 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -287,6 +287,7 @@ TrueBiomeBladeHoldout.DisplayName: True Biome Blade TrueBitingEmbrace.DisplayName: Biting Embrace TrueDecaysRetort.DisplayName: Decay's Retort TrueGrovetendersTouch.DisplayName: Grovetender's Touch +TruePureClarity.DisplayName: Pure Clarity TruePurityProjection.DisplayName: Purity Projection TumbleweedRolling.DisplayName: Rolling Tumbleweed TyphonsGreedBubble.DisplayName: Typhon's Greed diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index f85d83704d..380e758333 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -30,7 +30,7 @@ namespace CalamityMod.Projectiles.Melee const float MaxTime = 90; const int coyoteTimeFrames = 15; //How many frames does the whip stay extended - const int MaxReach = 450; + const int MaxReach = 600; const int MinReach = 250; const float SnappingPoint = 0.55f; //When does the snap occur. diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs new file mode 100644 index 0000000000..545205e61b --- /dev/null +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TruePureClarity : BaseCustomUseStyleProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; + public override int AssignedItemID => ModContent.ItemType(); + + public override float HitboxOutset => 65f; + public override Vector2 HitboxSize => new Vector2(100, 100); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(-2, 70); + + public ref float SwingDir => ref Projectile.ai[1]; + public Vector2 mousePos; + public Vector2 aimPos; + public bool doSwing = true; + public bool postSwing = false; + public int useAnimation; + + public override void SetDefaults() + { + base.SetDefaults(); + Projectile.scale = 1.25f; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + } + + public override void OnSpawn(IEntitySource source) + { + SwingDir = 1f; + base.OnSpawn(source); + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + useAnimation = Owner.itemAnimationMax; + + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + } + + public override void UseStyle() + { + if (CanHit || postSwing) + mousePos = Owner.Center - aimPos; + else + mousePos = Owner.Calamity().mouseWorld; + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mousePos = Owner.Calamity().mouseWorld; + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; + } + else + { + if (!CanHit && !postSwing) + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + else + Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnimation / 3)) + { + // Swing wind-up. Should not deal damage. + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) + { + doSwing = false; + SwingDir = -SwingDir; + } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); + } + else + { + float swingTime = AnimationProgress - (useAnimation / 3); + float swingTimeMax = useAnimation - (useAnimation / 3); + + if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + { + CanHit = true; + + // Particle effects on swing. + Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Color particleColor = (Owner.HeldItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; + if (Main.rand.NextBool()) + { + GenericBloom bloom = new(particlePos, particleVel, particleColor, 0.08f, 20); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, 0.55f, 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + CanHit = false; + + // Fire projectiles. + if (swingTime == (int)(swingTimeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + } + + RotationOffset = MathHelper.Lerp(RotationOffset, + MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), + 0.2f); + + if (swingTime >= swingTimeMax) + doSwing = false; + if (swingTime < (int)(swingTimeMax * 0.7f)) + postSwing = true; + } + } + + // Make the player's arms rotate. + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + + public override void ResetStyle() + { + } + } +} diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs index 1545f4d734..841004a76f 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePurityProjection.cs @@ -10,7 +10,7 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class TruePurityProjection : ModProjectile, ILocalizedModType //The boring plain one. With cool homing now + public class TruePurityProjection : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public NPC target; @@ -80,7 +80,6 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); for (int i = 0; i <= 15; i++) { Vector2 displace = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2() * (-0.5f + (i / 15f)) * 88f; @@ -90,10 +89,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - int debuffTime = 90; - target.AddBuff(BuffType(), debuffTime); - } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(BuffType(), 90); } } From 1c6510ef9d872f1e4fbd89fe333cba659c3314f2 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Sep 2024 00:56:52 -0400 Subject: [PATCH 7/9] Biome Blade Pure Clarity wrangling --- Items/Weapons/Melee/TrueBiomeBlade.cs | 24 +- .../en-US/Mods.CalamityMod.Attunement.hjson | 7 +- .../Melee/BrokenBiomeBlade_PureClarity.cs | 2 +- .../Melee/MendedBiomeBlade_TruePureClarity.cs | 262 +++++++++++++----- .../MendedBiomeBlade_TruePureClarityGhost.png | Bin 0 -> 1072 bytes 5 files changed, 198 insertions(+), 97 deletions(-) create mode 100644 Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 762bd2c0f9..4903f3dba7 100644 --- a/Items/Weapons/Melee/TrueBiomeBlade.cs +++ b/Items/Weapons/Melee/TrueBiomeBlade.cs @@ -37,7 +37,8 @@ namespace CalamityMod.Items.Weapons.Melee public static int DefaultAttunement_BaseDamage = 105; public static int DefaultAttunement_SigilTime = 900; public static int DefaultAttunement_BeamTime = 90; - public static float DefaultAttunement_HomingAngle = MathHelper.PiOver4; + public static float DefaultAttunement_LungeDamageMult = 2f; + public static float DefaultAttunement_HomingAngle = MathHelper.Pi / 3f; public static int EvilAttunement_BaseDamage = 155; public static int EvilAttunement_Lifesteal = 2; @@ -297,27 +298,6 @@ namespace CalamityMod.Items.Weapons.Melee return mainAttunement.Shoot(player, source, ref position, ref velocity.X, ref velocity.Y, ref type, ref damage, ref knockback, ref Combo, ref StoredLunges, ref PowerLungeCounter); } - - //This is only used for the purity sigil effect of the default attunement - public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone) - { - if (mainAttunement == null || mainAttunement.id != AttunementID.TrueDefault || player.whoAmI != Main.myPlayer) - return; - - foreach (Projectile proj in Main.projectile) - { - if (proj.active && proj.type == ProjectileType() && proj.owner == player.whoAmI) - { - //Reset the timeleft on the sigil & give it its new target (or the same, it doesnt matter really. - proj.ai[0] = target.whoAmI; - proj.timeLeft = DefaultAttunement_SigilTime; - return; - } - } - var source = player.GetSource_ItemUse(Item); - Projectile.NewProjectile(source, target.Center, Vector2.Zero, ProjectileType(), 0, 0, player.whoAmI, target.whoAmI); - } - internal static ChargingEnergyParticleSet BiomeEnergyParticles = new ChargingEnergyParticleSet(-1, 2, Color.White, Color.White, 0.04f, 20f); internal static void UpdateAllParticleSets() { diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index 4e218e340c..d71b9af0a1 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -1,7 +1,7 @@ // Broken Biome Blade DefaultAttunement: { Name: Pure Clarity - Function: Fires a weak projectile that crushes enemy defenses + Function: Fires a weak sword beam that crushes enemy defenses } HotAttunement: { @@ -28,8 +28,9 @@ TrueDefaultAttunement: { Name: Pure Clarity Function: ''' - Fires a weak projectile that crushes enemy defenses - True melee hits mark enemies with a sigil; your projectiles home onto marked foes + Fires a weak sword beam that crushes enemy defenses + True melee hits charge a powerful lunge, unleashed when you stop swinging the sword + Enemies hit by the lunge are marked with a sigil that sword beams will home in on ''' } diff --git a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs index 19fe521f4b..4c59053614 100644 --- a/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -119,7 +119,7 @@ namespace CalamityMod.Projectiles.Melee // Fire projectiles. if (swingTime == (int)(swingTimeMax * 0.4f)) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); + SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.65f }, Projectile.Center); Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); } diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 545205e61b..d25ae3f0ee 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -2,6 +2,8 @@ using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; using Terraria; using Terraria.Audio; using Terraria.DataStructures; @@ -13,14 +15,15 @@ namespace CalamityMod.Projectiles.Melee public class TruePureClarity : BaseCustomUseStyleProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; public override int AssignedItemID => ModContent.ItemType(); + public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; public override float HitboxOutset => 65f; public override Vector2 HitboxSize => new Vector2(100, 100); public override float HitboxRotationOffset => MathHelper.ToRadians(-45); public override Vector2 SpriteOrigin => new(-2, 70); + public ref float State => ref Projectile.ai[0]; // 0 - Swinging. 1 - Thrusting. public ref float SwingDir => ref Projectile.ai[1]; public Vector2 mousePos; public Vector2 aimPos; @@ -28,6 +31,13 @@ namespace CalamityMod.Projectiles.Melee public bool postSwing = false; public int useAnimation; + public Color outlineColorGreen => (Main.player[Projectile.owner].HeldItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; + public Color outlineColorBlue => new Color(90, 176, 255); + public const int dashTime = 30; + public float dashRotation; + public Vector2 lastDisplacement; + public Vector2 dashDirection = Vector2.Zero; + public override void SetDefaults() { base.SetDefaults(); @@ -51,93 +61,203 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { - if (CanHit || postSwing) - mousePos = Owner.Center - aimPos; - else - mousePos = Owner.Calamity().mouseWorld; - - if (!doSwing) + if (Owner.CantUseHoldout()) { - for (int i = 0; i < Main.maxNPCs; i++) - Projectile.localNPCImmunity[i] = 0; - - mousePos = Owner.Calamity().mouseWorld; - aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; - CanHit = false; - Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; - FlipAsSword = Owner.direction == -1 ? true : false; - doSwing = true; - } - else - { - if (!CanHit && !postSwing) - Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; - else - Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; - Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); - - if (AnimationProgress < (useAnimation / 3)) + if (State == 0f && Projectile.numHits > 0) { - // Swing wind-up. Should not deal damage. + State = 1f; + AnimationProgress = 0; + Projectile.rotation = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX).ToRotation(); + Projectile.timeLeft = dashTime; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + } + + if (State == 0f) + { + dashDirection = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero).SafeNormalize(Vector2.UnitX); + + if (CanHit || postSwing) + mousePos = Owner.Center - aimPos; + else + mousePos = Owner.Calamity().mouseWorld; + + if (!doSwing) + { + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + + mousePos = Owner.Calamity().mouseWorld; aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; CanHit = false; - postSwing = false; - if (AnimationProgress == 0) - { - doSwing = false; - SwingDir = -SwingDir; - } - RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + FlipAsSword = Owner.direction == -1 ? true : false; + doSwing = true; } else { - float swingTime = AnimationProgress - (useAnimation / 3); - float swingTimeMax = useAnimation - (useAnimation / 3); + if (!CanHit && !postSwing) + Owner.direction = (mousePos.X < Owner.Center.X) ? -1 : 1; + else + Owner.direction = ((Owner.Center - aimPos).X < Owner.Center.X) ? -1 : 1; - if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(65f), 0.1f); + + if (AnimationProgress < (useAnimation / 3)) { - CanHit = true; - - // Particle effects on swing. - Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); - Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); - Color particleColor = (Owner.HeldItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; - if (Main.rand.NextBool()) + // Swing wind-up. Should not deal damage. + aimPos = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65; + CanHit = false; + postSwing = false; + if (AnimationProgress == 0) { - GenericBloom bloom = new(particlePos, particleVel, particleColor, 0.08f, 20); - GeneralParticleHandler.SpawnParticle(bloom); - } - else - { - GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, 0.55f, 20); - GeneralParticleHandler.SpawnParticle(sparkle); + doSwing = false; + SwingDir = -SwingDir; } + RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * SwingDir * Owner.direction), 0.2f); } else - CanHit = false; - - // Fire projectiles. - if (swingTime == (int)(swingTimeMax * 0.4f)) { - SoundEngine.PlaySound(SoundID.Item43, Projectile.Center); - Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + float swingTime = AnimationProgress - (useAnimation / 3); + float swingTimeMax = useAnimation - (useAnimation / 3); + + if (swingTime > (int)(swingTimeMax * 0.2f) && swingTime < (int)(swingTimeMax * 0.85f)) + { + CanHit = true; + + // Particle effects on swing. + Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); + Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); + Color particleColor = Main.rand.NextBool() ? outlineColorBlue : outlineColorGreen; + bool empowered = Projectile.numHits > 0; + if (Main.rand.NextBool()) + { + GenericBloom bloom = new(particlePos, particleVel, particleColor, empowered ? 0.13f : 0.08f, 20); + GeneralParticleHandler.SpawnParticle(bloom); + } + else + { + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, empowered ? 0.75f : 0.55f, 20); + GeneralParticleHandler.SpawnParticle(sparkle); + } + } + else + CanHit = false; + + // Fire projectiles. + if (swingTime == (int)(swingTimeMax * 0.4f)) + { + SoundEngine.PlaySound(SoundID.Item43 with { Volume = 0.65f }, Projectile.Center); + Vector2 projVel = -aimPos.SafeNormalize(Vector2.UnitX) * 12f; + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, projVel, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Owner.whoAmI); + } + + RotationOffset = MathHelper.Lerp(RotationOffset, + MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), + 0.2f); + + if (swingTime >= swingTimeMax) + doSwing = false; + if (swingTime < (int)(swingTimeMax * 0.7f)) + postSwing = true; } - - RotationOffset = MathHelper.Lerp(RotationOffset, - MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), - 0.2f); - - if (swingTime >= swingTimeMax) - doSwing = false; - if (swingTime < (int)(swingTimeMax * 0.7f)) - postSwing = true; } - } - // Make the player's arms rotate. - ArmRotationOffset = MathHelper.ToRadians(-140f); - ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + // Make the player's arms rotate. + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + else + { + CanHit = true; + Owner.direction = Owner.velocity.X > 0f ? 1 : -1; + FlipAsSword = Owner.direction == -1 ? true : false; + RotationOffset = MathHelper.PiOver4 * Owner.direction; + Owner.itemAnimation = 5; + Owner.fallStart = (int)(Owner.position.Y / 16f); + Owner.Calamity().LungingDown = true; + + // Fancy particle dash effects + Vector2 waterVel = Owner.velocity.RotatedBy(MathHelper.PiOver2 * (Main.rand.NextBool() ? 1 : -1)).RotatedByRandom(MathHelper.Pi / 16f).SafeNormalize(Vector2.UnitX) * 5f; + WaterFoamParticle water = new(Owner.Center, waterVel, 20, 0.45f, outlineColorBlue); + GeneralParticleHandler.SpawnParticle(water); + + // Immediately cancel if the lunge hits a tile + Vector2 collisionCheckPos = Owner.Center + (dashDirection * 120 * Projectile.scale) - Vector2.One * 5f; + if (Collision.SolidCollision(collisionCheckPos, 10, 10)) + { + Projectile.timeLeft = 0; + Owner.Calamity().LungingDown = false; + Projectile.active = false; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + + Owner.velocity = dashDirection * 30f; + } + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (State == 1f) + { + foreach (Projectile proj in Main.projectile) + { + if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Owner.whoAmI) + { + // Reset the time left on the sigil and set the new target + proj.ai[0] = target.whoAmI; + proj.timeLeft = TrueBiomeBlade.DefaultAttunement_SigilTime; + return; + } + } + // If no sigil exists, spawn one + var source = Owner.GetSource_ItemUse(Owner.HeldItem); + Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (State == 1f) + modifiers.SourceDamage *= TrueBiomeBlade.DefaultAttunement_LungeDamageMult; + } + + public override void OnKill(int timeLeft) + { + // Cut the velocity short if dashing + if (State == 1f) + Owner.velocity *= 0.33f; + + Owner.Calamity().LungingDown = false; + + Projectile.active = false; + } + + public override bool PreDraw(ref Color lightColor) + { + if (Owner.itemAnimation > 0) + { + Texture2D tex = ModContent.Request(Texture).Value; + float r = FlipAsSword ? (State == 1f ? MathHelper.Pi : MathHelper.PiOver2) : 0f; + + if (Projectile.numHits > 0) + { + for (int i = 0; i < 5; i++) + { + Color outlineColor = Color.Lerp(outlineColorGreen, outlineColorBlue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.5f)); + Texture2D outline = ModContent.Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost").Value; + Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); + rotationalDrawOffset *= MathHelper.Lerp(3.25f, 6f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f); + Main.EntitySpriteDraw(outline, Projectile.Center - Main.screenPosition + rotationalDrawOffset + new Vector2(0, Owner.gfxOffY), null, outlineColor, 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(tex, 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)); + } + return false; } public override void ResetStyle() diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png b/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png new file mode 100644 index 0000000000000000000000000000000000000000..e30e2c1b14953dddae699ccff4b2dc317dee709d GIT binary patch literal 1072 zcmV-01kd}4P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1I0;1K~#8N?V8Oi zY+)S7$1MvR*?LPBMzK+BER>gGL9>vRC|QauZ1@8x8&a}UR!VlFCh}4W$-+irBY7^S$?U&dfEPGc&(WO`mhRa=YjG+~;}DnNt)hQ2P4%z7vOFdwUz#;t$S@ zBn4Lp%joFn!1>|fA#8;>P%syysj2BZ_6di>q1eX>D@4fq3&Jw0s;WY|`-D&WP%MOYahABQ(LH$DAZtq>vbg}9Z`+}sQg4GqC0 z-7<(3A_TS&meJ7Afb-|)XP9M7Pfx>SZ*LDiJ3E8ZErVDgLf{I~GCn>&U{YFI3UgKA zK7;#@Ov@lvh!B`UoXTJk{r&xLTU#6a+hq_dMDV>3Ekn`Ogma~Gw$#2Ve-HG3^%M0A!~(nc6Q?Y`uZAvd3k}Ko}OUBXQ6X*b1z?J|fJB4m8Ebq=_^yiECBS_7Q&yetEx3nSqy< zmf-5@YS^zbh!rAaT*&L|D@-0A9}`D$SVnDaEj%?f1&@x7!YqWa6u-(KR*2xa5RQ0F zO$|)m-``>GL`h>~BV1o!4|7$~lE%iyVE+03{yx0EzHW0!5b!(-EQRnMgztlYGAx9v&+P0h+|$zo^En60a9TwM z2M1FMv_b+x+N0n!mz0#0z=ZcMoDt3}S@{e~pgrGqjAOqoaS0sM8$7H-31pLj1mGal#4_lB2^B z=8lu^VeIbi!urhAD|{E7rI4VNL97s=NXy`pE`CpPdU_hjk<1oWh>*M>0|Nv26gpOj qkenY{TU%51AB8q|5Gy2wQ0NCi{FymvTs0N|0000 Date: Thu, 5 Sep 2024 11:13:12 -0400 Subject: [PATCH 8/9] Lunge use sound --- .../Melee/MendedBiomeBlade_TruePureClarity.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index d25ae3f0ee..751010a192 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -61,11 +61,14 @@ namespace CalamityMod.Projectiles.Melee public override void UseStyle() { + // If the player stops using the weapon after hitting with it once, switch to lunge. if (Owner.CantUseHoldout()) { if (State == 0f && Projectile.numHits > 0) { State = 1f; + SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); + AnimationProgress = 0; Projectile.rotation = (Owner.Calamity().mouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX).ToRotation(); Projectile.timeLeft = dashTime; @@ -75,6 +78,7 @@ namespace CalamityMod.Projectiles.Melee } } + // Normal swing behavior. if (State == 0f) { dashDirection = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero).SafeNormalize(Vector2.UnitX); @@ -84,6 +88,7 @@ namespace CalamityMod.Projectiles.Melee else mousePos = Owner.Calamity().mouseWorld; + // Reset before a new swing. if (!doSwing) { for (int i = 0; i < Main.maxNPCs; i++) @@ -158,6 +163,7 @@ namespace CalamityMod.Projectiles.Melee MathHelper.ToRadians(MathHelper.Lerp(150f * SwingDir * Owner.direction, 120f * -SwingDir * Owner.direction, CalamityUtils.ExpInOutEasing(swingTime / swingTimeMax, 1))), 0.2f); + // Extra swing control. if (swingTime >= swingTimeMax) doSwing = false; if (swingTime < (int)(swingTimeMax * 0.7f)) @@ -171,6 +177,7 @@ namespace CalamityMod.Projectiles.Melee } else { + // These are set to ensure the lunge looks and works properly. CanHit = true; Owner.direction = Owner.velocity.X > 0f ? 1 : -1; FlipAsSword = Owner.direction == -1 ? true : false; @@ -179,12 +186,12 @@ namespace CalamityMod.Projectiles.Melee Owner.fallStart = (int)(Owner.position.Y / 16f); Owner.Calamity().LungingDown = true; - // Fancy particle dash effects + // Fancy particle dash effects. Vector2 waterVel = Owner.velocity.RotatedBy(MathHelper.PiOver2 * (Main.rand.NextBool() ? 1 : -1)).RotatedByRandom(MathHelper.Pi / 16f).SafeNormalize(Vector2.UnitX) * 5f; WaterFoamParticle water = new(Owner.Center, waterVel, 20, 0.45f, outlineColorBlue); GeneralParticleHandler.SpawnParticle(water); - // Immediately cancel if the lunge hits a tile + // Immediately cancel if the lunge hits a tile. Vector2 collisionCheckPos = Owner.Center + (dashDirection * 120 * Projectile.scale) - Vector2.One * 5f; if (Collision.SolidCollision(collisionCheckPos, 10, 10)) { @@ -207,13 +214,13 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ModContent.ProjectileType() && proj.owner == Owner.whoAmI) { - // Reset the time left on the sigil and set the new target + // Reset the time left on the sigil and set the new target. proj.ai[0] = target.whoAmI; proj.timeLeft = TrueBiomeBlade.DefaultAttunement_SigilTime; return; } } - // If no sigil exists, spawn one + // If no sigil exists, spawn one. var source = Owner.GetSource_ItemUse(Owner.HeldItem); Projectile.NewProjectile(source, target.Center, Vector2.Zero, ModContent.ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); } @@ -227,7 +234,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnKill(int timeLeft) { - // Cut the velocity short if dashing + // Cut the velocity short if dashing. if (State == 1f) Owner.velocity *= 0.33f; @@ -243,6 +250,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D tex = ModContent.Request(Texture).Value; float r = FlipAsSword ? (State == 1f ? MathHelper.Pi : MathHelper.PiOver2) : 0f; + // Draw extra outline sprites if you've hit once, to signify that you can lunge. if (Projectile.numHits > 0) { for (int i = 0; i < 5; i++) From 7566e7ad351b16a9e0b8d16df57bd3bf366f8507 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Thu, 5 Sep 2024 23:43:36 -0400 Subject: [PATCH 9/9] BB Pure Clarity changes * Brightened colors * Now have to hit the true melee 3 times to get the lunge; this also has particle effects to signify it --- DataStructures/Attunement.cs | 2 +- .../en-US/Mods.CalamityMod.Attunement.hjson | 4 +-- .../Melee/MendedBiomeBlade_TruePureClarity.cs | 27 ++++++++++++++----- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 55a51bc7f7..fdc4d09edd 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -217,7 +217,7 @@ namespace CalamityMod.DataStructures public TrueDefaultAttunement() { id = AttunementID.TrueDefault; - tooltipColor = new Color(171, 180, 73); + tooltipColor = new Color(201, 220, 93); energyParticleEdgeColor = new Color(117, 126, 72); energyParticleCenterColor = new Color(200, 184, 136); diff --git a/Localization/en-US/Mods.CalamityMod.Attunement.hjson b/Localization/en-US/Mods.CalamityMod.Attunement.hjson index d71b9af0a1..0511293d38 100644 --- a/Localization/en-US/Mods.CalamityMod.Attunement.hjson +++ b/Localization/en-US/Mods.CalamityMod.Attunement.hjson @@ -29,8 +29,8 @@ TrueDefaultAttunement: { Function: ''' Fires a weak sword beam that crushes enemy defenses - True melee hits charge a powerful lunge, unleashed when you stop swinging the sword - Enemies hit by the lunge are marked with a sigil that sword beams will home in on + Landing three true melee hits charges a powerful lunge, unleashed when you stop swinging the sword + Enemies struck by the lunge are marked with a sigil that sword beams will home in on ''' } diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs index 751010a192..dddfb1ea03 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -30,9 +30,10 @@ namespace CalamityMod.Projectiles.Melee public bool doSwing = true; public bool postSwing = false; public int useAnimation; + public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/MagicRockSound"); public Color outlineColorGreen => (Main.player[Projectile.owner].HeldItem.ModItem as TrueBiomeBlade).mainAttunement.tooltipColor; - public Color outlineColorBlue => new Color(90, 176, 255); + public Color outlineColorBlue => new Color(110, 216, 255); public const int dashTime = 30; public float dashRotation; public Vector2 lastDisplacement; @@ -64,7 +65,7 @@ namespace CalamityMod.Projectiles.Melee // If the player stops using the weapon after hitting with it once, switch to lunge. if (Owner.CantUseHoldout()) { - if (State == 0f && Projectile.numHits > 0) + if (State == 0f && Projectile.numHits > 2) { State = 1f; SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); @@ -136,15 +137,15 @@ namespace CalamityMod.Projectiles.Melee Vector2 particleVel = new Vector2(0, 10 * -SwingDir * Owner.direction).RotatedBy(FinalRotation - MathHelper.PiOver4); Vector2 particlePos = Owner.Center + new Vector2(Main.rand.Next(0, 80), 0).RotatedBy(FinalRotation - MathHelper.PiOver4); Color particleColor = Main.rand.NextBool() ? outlineColorBlue : outlineColorGreen; - bool empowered = Projectile.numHits > 0; + bool empowered = Projectile.numHits > 2; if (Main.rand.NextBool()) { - GenericBloom bloom = new(particlePos, particleVel, particleColor, empowered ? 0.13f : 0.08f, 20); + GenericBloom bloom = new(particlePos, particleVel, particleColor, empowered ? 0.12f : 0.08f, 20); GeneralParticleHandler.SpawnParticle(bloom); } else { - GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, empowered ? 0.75f : 0.55f, 20); + GenericSparkle sparkle = new(particlePos, particleVel, particleColor, particleColor, empowered ? 0.78f : 0.55f, 20); GeneralParticleHandler.SpawnParticle(sparkle); } } @@ -208,6 +209,20 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + // Burst of particles to signify that the lunge is ready. + // Due to how numHits works, this has to be 1 less than our target. + if (Projectile.numHits == 2) + { + SoundEngine.PlaySound(FullChargeSound, Owner.Center); + + for (int i = 0; i < 10; i++) + { + Vector2 particleVel = Vector2.UnitX.RotatedBy(MathHelper.TwoPi * (i / 10f)) * Main.rand.NextFloat(3.5f, 4f); + MediumMistParticle readySmoke = new(Owner.Center, particleVel, outlineColorGreen, Color.Brown, 1f, 192f); + GeneralParticleHandler.SpawnParticle(readySmoke); + } + } + if (State == 1f) { foreach (Projectile proj in Main.projectile) @@ -255,7 +270,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < 5; i++) { - Color outlineColor = Color.Lerp(outlineColorGreen, outlineColorBlue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.5f)); + Color outlineColor = Color.Lerp(outlineColorGreen, outlineColorBlue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 1.5f)) * MathHelper.Clamp(Projectile.numHits / 3f, 0f, 1f); Texture2D outline = ModContent.Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost").Value; Vector2 rotationalDrawOffset = (MathHelper.TwoPi * i / 7f + Main.GlobalTimeWrappedHourly * 17f).ToRotationVector2(); rotationalDrawOffset *= MathHelper.Lerp(3.25f, 6f, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 4f) * 0.5f + 1.5f);