diff --git a/CalamityLists.cs b/CalamityLists.cs index d64e144332..eb6cfff797 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 fd239c11cf..fdc4d09edd 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.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 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() @@ -242,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); @@ -252,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 @@ -460,12 +435,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 @@ -599,16 +577,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 +601,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 +625,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 +650,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/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index ebd82fb459..eb08776086 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) @@ -262,7 +253,6 @@ 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())); } 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/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index e2c2b6e7a9..20e0ac2121 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/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index eff49af8c8..4903f3dba7 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; @@ -36,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; @@ -296,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 9f8fa7c009..0511293d38 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: { @@ -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 @@ -37,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 + 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 ''' } @@ -100,7 +92,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: { @@ -146,12 +138,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 +147,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 +158,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 +168,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 2fa918d3f3..7982818210 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -543,12 +543,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 646dc5087b..6a9cfd8994 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -127,7 +127,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 @@ -197,6 +196,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 @@ -248,6 +248,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 @@ -284,6 +285,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/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..4c59053614 --- /dev/null +++ b/Projectiles/Melee/BrokenBiomeBlade_PureClarity.cs @@ -0,0 +1,147 @@ +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.Audio; +using Terraria.DataStructures; +using Terraria.ID; +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 => 50f; + public override Vector2 HitboxSize => new Vector2(48, 48); + public override float HitboxRotationOffset => MathHelper.ToRadians(-45); + public override Vector2 SpriteOrigin => new(-5, 40); + + 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 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; + + // 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; + } + } + + // Make the player's arms rotate. + ArmRotationOffset = MathHelper.ToRadians(-140f); + ArmRotationOffsetBack = MathHelper.ToRadians(-140f); + } + + 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); } } diff --git a/Projectiles/Melee/GalaxiaBolt.cs b/Projectiles/Melee/GalaxiaBolt.cs index f182dc58e7..d1ad4f81fa 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; @@ -56,7 +57,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/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_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 089af06a1b..00b06171b7 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) @@ -74,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/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/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..dddfb1ea03 --- /dev/null +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -0,0 +1,290 @@ +using CalamityMod.Items.Weapons.Melee; +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; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class TruePureClarity : BaseCustomUseStyleProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + 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; + 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(110, 216, 255); + public const int dashTime = 30; + public float dashRotation; + public Vector2 lastDisplacement; + public Vector2 dashDirection = Vector2.Zero; + + 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 the player stops using the weapon after hitting with it once, switch to lunge. + if (Owner.CantUseHoldout()) + { + if (State == 0f && Projectile.numHits > 2) + { + 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; + lastDisplacement = Projectile.Center - Owner.Center; + Projectile.netUpdate = true; + Projectile.netSpam = 0; + } + } + + // Normal swing behavior. + 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; + + // Reset before a new swing. + 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 = Main.rand.NextBool() ? outlineColorBlue : outlineColorGreen; + bool empowered = Projectile.numHits > 2; + if (Main.rand.NextBool()) + { + 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.78f : 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); + + // Extra swing control. + 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); + } + 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; + 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) + { + // 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) + { + 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; + + // 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++) + { + 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); + 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 0000000000..e30e2c1b14 Binary files /dev/null and b/Projectiles/Melee/MendedBiomeBlade_TruePureClarityGhost.png differ 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); } } 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) 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 9c6c385221..aa5ad1ce0d 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); } } @@ -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_EarthenTidesShockwave.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png index bc29ed731e..55dd6345b9 100644 Binary files a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png and b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png differ 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_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 3671807fe5..fc2fd8d82c 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -198,16 +198,6 @@ namespace CalamityMod.Projectiles.Melee { Projectile.Center = Owner.Center + (direction * Projectile.scale * 10) + (direction * throwOutDistance * ThrowCurve()); Projectile.scale = (1 + Empowerment / maxEmpowerment * 1.5f) * MathHelper.Clamp(1 - retractionTimer, 0.3f, 1f); - - if (snapTimer > 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_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/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); diff --git a/Projectiles/Summon/AureusBomberGlow.png b/Projectiles/Summon/AureusBomberGlow.png new file mode 100644 index 0000000000..1faa9ff87d Binary files /dev/null and b/Projectiles/Summon/AureusBomberGlow.png differ