diff --git a/Balancing/BalancingChangesManager.cs b/Balancing/BalancingChangesManager.cs index 8029a89f37..add400391e 100644 --- a/Balancing/BalancingChangesManager.cs +++ b/Balancing/BalancingChangesManager.cs @@ -290,8 +290,8 @@ namespace CalamityMod.Balancing // 20% resist to The Hive's nuke. NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType())))); - // 20% resist to Mercurial Tides (True Biome Blade). - NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); + // 20% resist to Earthen Tides (True Biome Blade). + NPCSpecificBalancingChanges.Add(new NPCBalancingChange(NPCID.MoonLordCore, Do(new ProjectileResistBalancingRule(0.8f, ProjectileType(), ProjectileType(), ProjectileType())))); #endregion #region Profaned Guardians diff --git a/DataStructures/Attunement.cs b/DataStructures/Attunement.cs index 28ae08e39d..683b8a49b1 100644 --- a/DataStructures/Attunement.cs +++ b/DataStructures/Attunement.cs @@ -1,4 +1,5 @@ -using CalamityMod.Enums; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Enums; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Projectiles.Melee; using Microsoft.Xna.Framework; @@ -14,8 +15,8 @@ namespace CalamityMod.DataStructures { public enum AttunementID : byte { - Default, Hot, Cold, Tropical, Evil, //Broken biome blade - TrueDefault, TrueHot, TrueCold, TrueTropical, TrueEvil, Holy, Astral, Marine, //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 } @@ -23,6 +24,24 @@ namespace CalamityMod.DataStructures // TODO -- Attunements should be managed by an Attunement ModSystem public abstract class Attunement { + public static Attunement[] attunementArray; + + public static void Load() + { + attunementArray = new Attunement[] { + 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(), + null + }; + } + + public static void Unload() + { + attunementArray = null; + } + public AttunementID id; public virtual LocalizedText AttunementName => CalamityUtils.GetText($"Attunement.{GetType().Name}.Name"); @@ -80,13 +99,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 @@ -160,31 +179,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() @@ -224,7 +218,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); @@ -234,13 +228,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 @@ -415,55 +409,6 @@ namespace CalamityMod.DataStructures item.noMelee = true; } } - - public class AstralAttunement : Attunement - { - public AstralAttunement() - { - id = AttunementID.Astral; - tooltipColor = new Color(91, 73, 196); - - energyParticleEdgeColor = new Color(58, 56, 165); - energyParticleCenterColor = new Color(153, 120, 255); - } - - public override float DamageMultiplier => TrueBiomeBlade.AstralAttunement_BaseDamage / (float)TrueBiomeBlade.BaseDamage; - public override void ApplyStats(Item item) - { - item.channel = true; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Thrust; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = null; - item.noMelee = true; - } - } - - public class MarineAttunement : Attunement - { - public MarineAttunement() - { - id = AttunementID.Marine; - tooltipColor = new Color(61, 103, 209); - - energyParticleEdgeColor = new Color(27, 59, 101); - energyParticleCenterColor = new Color(27, 112643, 255); - } - - public override float DamageMultiplier => TrueBiomeBlade.MarineAttunement_BaseDamage / (float)TrueBiomeBlade.BaseDamage; - - public override void ApplyStats(Item item) - { - item.channel = false; - item.noUseGraphic = true; - item.useStyle = ItemUseStyleID.Thrust; - item.shoot = ProjectileType(); - item.shootSpeed = 12f; - item.UseSound = null; - item.noMelee = true; - } - } #endregion #region True Biome Blade Attunements @@ -473,7 +418,7 @@ namespace CalamityMod.DataStructures { id = AttunementID.Whirlwind; tooltipColor = new Color(220, 105, 197); - tooltipColor2 = new Color(171, 239, 113); + tooltipColor2 = new Color(132, 70, 232); } public override float DamageMultiplier => OmegaBiomeBlade.WhirlwindAttunement_BaseDamage / (float)OmegaBiomeBlade.BaseDamage; @@ -491,15 +436,14 @@ namespace CalamityMod.DataStructures public override void PassiveEffect(Player player, IEntitySource source, ref int UseTimer, ref bool Procced, Projectile projectile = null) { - if (UseTimer % 30 == 29 && Main.rand.NextBool(2)) + if (Procced) { - SoundEngine.PlaySound(SoundID.Item78); int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.WhirlwindAttunement_PassiveBaseDamage); - // 14NOV2024: Ozzatron: clamped mouse world unnecessary here, just used for direction - Projectile beamSword = Projectile.NewProjectileDirect(source, player.Center, player.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), damage, 10f, player.whoAmI, 1f); - beamSword.timeLeft = 50; - UseTimer++; + Vector2 velocity = (Main.MouseWorld - player.Center).SafeNormalize(Vector2.UnitX) * 15f; + Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0f, player.whoAmI); + + Procced = false; } } } @@ -579,7 +523,7 @@ namespace CalamityMod.DataStructures public ShockwaveAttunement() { id = AttunementID.Shockwave; - tooltipColor = new Color(132, 109, 233); + tooltipColor = new Color(71, 191, 71); tooltipColor2 = new Color(122, 213, 233); } @@ -590,7 +534,7 @@ namespace CalamityMod.DataStructures item.channel = true; item.noUseGraphic = true; item.useStyle = ItemUseStyleID.Shoot; - item.shoot = ProjectileType(); + item.shoot = ProjectileType(); item.shootSpeed = 12f; item.UseSound = null; item.noMelee = true; @@ -601,7 +545,7 @@ namespace CalamityMod.DataStructures if (UseTimer % 120 == 119) { int damage = (int)player.GetTotalDamage().ApplyTo(OmegaBiomeBlade.ShockwaveAttunement_PassiveBaseDamage); - Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), damage, 10f, player.whoAmI, 1f); + Projectile.NewProjectile(source, player.Center, Vector2.Zero, ProjectileType(), damage, 10f, player.whoAmI, 2f); UseTimer++; } } @@ -633,16 +577,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; 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.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } + item.reuseDelay = 30; } } @@ -667,16 +602,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; 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.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), 0, 0f, player.whoAmI, 1f); - UseTimer++; - } + item.reuseDelay = 30; } } @@ -701,16 +627,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; 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++; - } + item.reuseDelay = 12; } } @@ -736,16 +653,7 @@ namespace CalamityMod.DataStructures item.shootSpeed = 12f; 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++; - } + item.reuseDelay = 30; } } diff --git a/Effects/BordernadoFire.fx b/Effects/BordernadoFire.fx index 44d9e2dec8..057d5b1112 100644 --- a/Effects/BordernadoFire.fx +++ b/Effects/BordernadoFire.fx @@ -58,6 +58,7 @@ float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 opacity *= pow(sin(coords.y * 3.141), lerp(1, 4, pow(coords.x, 2))); opacity *= fadeMapColor.r * 1.5 + 1; opacity *= lerp(0.4, 0.9, fadeMapColor.r); + opacity *= uOpacity; float3 transformColor = lerp(float3(1, 205 / 255.0, 119 / 255.0), float3(1, 76 / 255.0, 79 / 255.0), fadeMapColor.r); color.rgb = lerp(color.rgb, transformColor, fadeMapColor.r); diff --git a/Effects/BordernadoFire.xnb b/Effects/BordernadoFire.xnb index 053e44de32..4b38ad5eb0 100644 Binary files a/Effects/BordernadoFire.xnb and b/Effects/BordernadoFire.xnb differ diff --git a/Items/Weapons/Melee/ArkoftheCosmos.cs b/Items/Weapons/Melee/ArkoftheCosmos.cs index 7521476b79..7802877825 100644 --- a/Items/Weapons/Melee/ArkoftheCosmos.cs +++ b/Items/Weapons/Melee/ArkoftheCosmos.cs @@ -29,14 +29,10 @@ namespace CalamityMod.Items.Weapons.Melee public static float MaxCharge = 15f; // Maximum charge value AKA how much charge you get from a parry public static float chargeDamageMultiplier = 1.35f; //Extra damage from charge public static float chainDamageMultiplier = 0.1f; - - public static int DashIframes = 10; - public static float SlashBoltsDamageMultiplier = 0.2f; public static float SnapBoltsDamageMultiplier = 0.1f; public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier - public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder + public static float BlastBoltsDamageMultiplier = 0.2f; public static float SwirlBoltAmount = 6f; //The amount of cosmic bolts produced during hte swirl attack public static float SwirlBoltDamageMultiplier = 0.7f; //This is the damage multiplier for ALL THE BOLTS: Aka, said damage multiplier is divided by the amount of bolts in a swirl and the full damage multiplier is gotten if you hit all the bolts @@ -116,14 +112,15 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - if (Charge > 0 && player.controlUp) + bool onParryCooldown = false; + if (Main.projectile.Any(p => p.active && p.owner == player.whoAmI && p.type == ProjectileType())) + onParryCooldown = true; + + if (Charge > 0 && onParryCooldown) { float angle = velocity.ToRotation(); Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI, Charge); - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - Charge = 0; } diff --git a/Items/Weapons/Melee/ArkoftheElements.cs b/Items/Weapons/Melee/ArkoftheElements.cs index ffe88ecae2..0fdfb3d968 100644 --- a/Items/Weapons/Melee/ArkoftheElements.cs +++ b/Items/Weapons/Melee/ArkoftheElements.cs @@ -27,10 +27,6 @@ namespace CalamityMod.Items.Weapons.Melee public static float needleDamageMultiplier = 0.8f; //Damage multiplier for non-homing needle projectile public static float glassStarDamageMultiplier = 0.2f; //Damage multiplier for the homing glass stars (4 glass stars per shot) - public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier - public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - public override void ModifyTooltips(List tooltips) { if (tooltips == null) @@ -52,12 +48,6 @@ namespace CalamityMod.Items.Weapons.Melee parryTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("ParryInfo")); parryTooltip.OverrideColor = Color.Orange; } - var blastTooltip = tooltips.FirstOrDefault(x => x.Text.Contains("[BLAST]") && x.Mod == "Terraria"); - if (blastTooltip != null) - { - blastTooltip.Text = Lang.SupportGlyphs(this.GetLocalizedValue("BlastInfo")); - blastTooltip.OverrideColor = Color.Gold; - } } public override void SetDefaults() @@ -106,18 +96,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - if (Charge > 0 && player.controlUp) - { - float angle = velocity.ToRotation(); - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, velocity, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI); - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - - Charge = 0; - } - - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) + if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); return false; @@ -133,9 +112,6 @@ namespace CalamityMod.Items.Weapons.Melee if (Combo > ComboLength) Combo = 0; - - - //Shoot projectiles every upwards swing if (scissorState == 1f) { diff --git a/Items/Weapons/Melee/BrokenBiomeBlade.cs b/Items/Weapons/Melee/BrokenBiomeBlade.cs index bdbca8b591..7658fe7a86 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; @@ -21,7 +22,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; @@ -48,18 +49,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) @@ -204,6 +195,9 @@ namespace CalamityMod.Items.Weapons.Melee if (secondaryAttunement != null) secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; } private static int ClampAttunementRange(int input) @@ -274,7 +268,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 3c2fcc8916..46a820df4b 100644 --- a/Items/Weapons/Melee/FourSeasonsGalaxia.cs +++ b/Items/Weapons/Melee/FourSeasonsGalaxia.cs @@ -30,45 +30,38 @@ namespace CalamityMod.Items.Weapons.Melee public bool OnHitProc = false; #region stats - public static int BaseDamage = 800; + public static int BaseDamage = 250; - public static int PhoenixAttunement_BaseDamage = 1200; + public static int PhoenixAttunement_BaseDamage = 300; public static int PhoenixAttunement_LocalIFrames = 30; //Remember its got one extra update public static float PhoenixAttunement_BoltDamageReduction = 0.5f; public static float PhoenixAttunement_BoltThrowDamageMultiplier = 1f; public static float PhoenixAttunement_BaseDamageReduction = 0.5f; public static float PhoenixAttunement_FullChargeDamageBoost = 2.1f; public static float PhoenixAttunement_ThrowDamageBoost = 3.2f; + public static int PhoenixAttunement_FlamePillarLocalIFrames = 10; - public static int PolarisAttunement_BaseDamage = 1800; - public static int PolarisAttunement_FullChargeDamage = 3600; + public static int PolarisAttunement_BaseDamage = 400; + public static int PolarisAttunement_FullChargeDamage = 630; public static int PolarisAttunement_ShredIFrames = 10; public static int PolarisAttunement_LocalIFrames = 30; //Be warned its got one extra update so all the iframes should be divided in 2 public static int PolarisAttunement_LocalIFramesCharged = 16; public static float PolarisAttunement_SlashDamageBoost = 6f; //Keep in mind the slice always crits - public static int PolarisAttunement_SlashBoltsDamage = 1300; public static int PolarisAttunement_SlashIFrames = 20; public static float PolarisAttunement_ShotDamageBoost = 0.8f; //The shots fired if the dash connects - public static float PolarisAttunement_ShredChargeupGain = 1f; //How much charge is gainted per second. + public static float PolarisAttunement_ShredChargeupGain = 1f; //How much charge is gained per second. - public static int AndromedaAttunement_BaseDamage = 2800; + public static int AndromedaAttunement_BaseDamage = 1120; public static int AndromedaAttunement_DashHitIFrames = 20; - public static float AndromedaAttunement_FullChargeBoost = 6f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage. - public static float AndromedaAttunement_MonolithDamageBoost = 1.2f; - public static float AndromedaAttunement_BoltsDamageReduction = 0.2f; //The shots fired as it charges + public static float AndromedaAttunement_FullChargeMult = 3.5f; //The maxmimum damage multiplier of the lunge. Note that the lunge always crits. + public static float AndromedaAttunement_StarDamageMultiplier = 1f; + public static float AndromedaAttunement_ChargeupBoltDamageMultiplier = 0.2f; //Damage of shots fired as it charges - public static int AriesAttunement_BaseDamage = 1325; + public static int AriesAttunement_BaseDamage = 375; public static int AriesAttunement_LocalIFrames = 10; public static int AriesAttunement_Reach = 650; public static float AriesAttunement_ChainDamageReduction = 0.2f; public static float AriesAttunement_OnHitBoltDamageReduction = 0.5f; - - public static int CancerPassiveDamage = 3000; - public static int CancerPassiveLifeSteal = 3; - public static float CancerPassiveLifeStealProc = 0.4f; - public static int CapricornPassiveDebuffTime = 200; - - #endregion public override string Texture => "CalamityMod/Items/Weapons/Melee/Galaxia"; //Base sprite for stuff like item browser and shit. yeah @@ -87,9 +80,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 @@ -106,23 +97,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 @@ -138,10 +117,10 @@ namespace CalamityMod.Items.Weapons.Melee Item.knockBack = 9f; Item.UseSound = SoundID.Item1; Item.autoReuse = true; - Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; + Item.value = CalamityGlobalItem.RarityTurquoiseBuyPrice; + Item.rare = RarityType(); Item.shoot = ProjectileID.PurificationPowder; Item.shootSpeed = 24f; - Item.rare = RarityType(); Item.reuseDelay = 30; } @@ -234,22 +213,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)); } } @@ -322,9 +294,10 @@ namespace CalamityMod.Items.Weapons.Melee { CreateRecipe(). AddIngredient(). - AddIngredient(8). - AddIngredient(8). - AddTile(). + AddIngredient(). + AddIngredient(). + AddIngredient(). + AddTile(TileID.LunarCraftingStation). Register(); } } diff --git a/Items/Weapons/Melee/OmegaBiomeBlade.cs b/Items/Weapons/Melee/OmegaBiomeBlade.cs index 8fdbf0681f..61f992e40f 100644 --- a/Items/Weapons/Melee/OmegaBiomeBlade.cs +++ b/Items/Weapons/Melee/OmegaBiomeBlade.cs @@ -36,13 +36,13 @@ namespace CalamityMod.Items.Weapons.Melee public static int WhirlwindAttunement_BaseDamage = 140; public static int WhirlwindAttunement_LocalIFrames = 20; //Remember its got one extra update - public static int WhirlwindAttunement_SigilTime = 1000; - public static float WhirlwindAttunement_BeamDamageReduction = 0.5f; + public static float WhirlwindAttunement_EnergyDamageMult = 0.5f; public static float WhirlwindAttunement_BaseDamageReduction = 0.3f; public static float WhirlwindAttunement_FullChargeDamageBoost = 0.9f; 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; @@ -60,17 +60,17 @@ namespace CalamityMod.Items.Weapons.Melee public static int ShockwaveAttunement_BaseDamage = 550; + public static float ShockwaveAttunement_BeamDamageMult = 0.25f; public static int ShockwaveAttunement_DashHitIFrames = 20; public static float ShockwaveAttunement_FullChargeBoost = 2.5f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage. - public static float ShockwaveAttunement_MonolithDamageBoost = 1.1f; - public static float ShockwaveAttunement_MonolithDamageFalloff = 0.15f; //Damage multiplier for all subsequent hits after the first one. - public static float ShockwaveAttunement_BlastDamageReduction = 0.8f; + public static int ShockwaveAttunement_SigilTime = 1000; + public static float ShockwaveAttunement_MonolithDamageBoost = 0.75f; public static int ShockwaveAttunement_PassiveBaseDamage = 200; - public static int FlailBladeAttunement_BaseDamage = 400; - public static int FlailBladeAttunement_LocalIFrames = 30; + public static int FlailBladeAttunement_BaseDamage = 200; + public static int FlailBladeAttunement_LocalIFrames = 15; public static int FlailBladeAttunement_FlailTime = 10; public static int FlailBladeAttunement_Reach = 400; public static float FlailBladeAttunement_ChainDamageReduction = 0.5f; @@ -81,15 +81,16 @@ namespace CalamityMod.Items.Weapons.Melee //Proc coefficients. aka the likelihood of any given attack to trigger a on-hit passive. public static float WhirlwindAttunement_WhirlwindProc = 0.24f; public static float WhirlwindAttunement_SwordThrowProc = 1f; - public static float WhirlwindAttunement_SwordBeamProc = 0.05f; + public static float WhirlwindAttunement_MonolithProc = 0.25f; public static float SuperPogoAttunement_ShredderProc = 0.1f; public static float SuperPogoAttunement_WheelProc = 0.4f; public static float SuperPogoAttunement_DashProc = 1f; public static float ShockwaveAttunement_SwordProc = 1f; - public static float ShockwaveAttunement_MonolithProc = 1f; - public static float ShockwaveAttunement_BlastProc = 0.5f; + public static float ShockwaveAttunement_SwordBeamProc = 0.05f; + public static float ShockwaveAttunement_BlastProc = 0.33f; + public static float ShockwaveAttunement_ShockwaveProc = 0.33f; public static float FlailBladeAttunement_BladeProc = 0.1f; public static float FlailBladeAttunement_ChainProc = 0.05f; @@ -256,6 +257,9 @@ namespace CalamityMod.Items.Weapons.Melee if (secondaryAttunement != null) secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; } private static int ClampAttunementRange(int input) @@ -274,7 +278,7 @@ namespace CalamityMod.Items.Weapons.Melee player.Calamity().rightClickListener = true; player.Calamity().mouseWorldListener = true; - //Reset the strong lunge thing just in case it didnt get caught beofre. + //Reset the strong lunge thing just in case it didnt get caught before. if (CanUseItem(player)) { @@ -304,7 +308,7 @@ namespace CalamityMod.Items.Weapons.Melee return; - //PAssive effetcsts only happen on the side of the owner + //Passive effects only happen on the side of the owner var source = player.GetSource_ItemUse(Item); if (secondaryAttunement != null) { @@ -341,7 +345,7 @@ namespace CalamityMod.Items.Weapons.Melee bool isRightClicking = player.altFunctionUse != ItemAlternativeFunctionID.None; return !isRightClicking && !Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || - n.type == ProjectileType() || + n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType())); } diff --git a/Items/Weapons/Melee/TrueArkoftheAncients.cs b/Items/Weapons/Melee/TrueArkoftheAncients.cs index 2dfe5ff28b..e93a9807cb 100644 --- a/Items/Weapons/Melee/TrueArkoftheAncients.cs +++ b/Items/Weapons/Melee/TrueArkoftheAncients.cs @@ -23,10 +23,6 @@ namespace CalamityMod.Items.Weapons.Melee public static float beamDamageMultiplier = 1f; //Damage multiplier for the charged shots (remember it applies ontop of the charge damage multiplied public static float glassStarDamageMultiplier = 0.6f; //Damage multiplier for the glass stars it shoots (Shoots 3x glass stars when not charged, shoots 2x glass stars + one beam when charged) - public static float blastDamageMultiplier = 0.5f; //Damage multiplier applied ontop of the charge damage multiplier mutliplied by the amount of charges consumed. So if you consume 5 charges, the blast will get multiplied by 5 times the damage multiplier - public static float blastFalloffSpeed = 0.1f; //How much the blast damage falls off as you hit more and more targets - public static float blastFalloffStrenght = 0.75f; //Value between 0 and 1 that determines how much falloff increases affect the damage : Closer to 0 = damage falls off less intensely, closer to 1 : damage falls off way harder - public override void ModifyTooltips(List tooltips) { if (tooltips == null) @@ -79,20 +75,7 @@ namespace CalamityMod.Items.Weapons.Melee { if (player.altFunctionUse == 2) { - if (Charge > 0 && player.controlUp) - { - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - float angle = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY).ToRotation(); - Vector2 laserVector = player.SafeDirectionTo(Main.MouseWorld, Vector2.UnitY) * 600; - Projectile.NewProjectile(source, player.Center + angle.ToRotationVector2() * 90f, laserVector, ProjectileType(), (int)(damage * Charge * chargeDamageMultiplier * blastDamageMultiplier), 0, player.whoAmI); - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 3) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 3; - - Charge = 0; - } - - else if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) + if (!Main.projectile.Any(n => n.active && n.owner == player.whoAmI && (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType()))) Projectile.NewProjectile(source, player.Center, velocity, ProjectileType(), damage, 0, player.whoAmI, 0, 0); return false; diff --git a/Items/Weapons/Melee/TrueBiomeBlade.cs b/Items/Weapons/Melee/TrueBiomeBlade.cs index 59bcf8b91f..3a387cc179 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; @@ -21,7 +22,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; @@ -37,7 +38,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; @@ -68,24 +70,9 @@ namespace CalamityMod.Items.Weapons.Melee public static float HolyAttunement_FullChargeDamageBoost = 2f; public static float HolyAttunement_ThrowDamageBoost = 3.8f; public static int HolyAttunement_LocalIFrames = 16; //Be warned its got 1 extra update yadda yadda - - public static int AstralAttunement_BaseDamage = 250; - public static int AstralAttunement_DashHitIFrames = 20; - public static float AstralAttunement_FullChargeBoost = 4f; //The EXTRA damage boost. So putting 1 here will make it deal double damage. Putting 0.5 here will make it deal 1.5x the damage. - public static float AstralAttunement_MonolithDamageBoost = 1.25f; - public static float AstralAttunement_MonolithDamageFalloff = 0.25f; //Damage multiplier for all subsequent hits after the first one. - - public static int MarineAttunement_BaseDamage = 300; - public static float MarineAttunement_InWaterDamageMultiplier = 1.5f; - + public static float HolyAttunement_MonolithDamage = 0.5f; #endregion - - public override void SetStaticDefaults() - { - //Theres potential for flavor text as well but im not a writer - } - #region tooltip editing public override void ModifyTooltips(List list) @@ -231,6 +218,9 @@ namespace CalamityMod.Items.Weapons.Melee if (secondaryAttunement != null) secondaryAttunement = AttunementSystem.FindOrNull(ClampAttunementRange((int)secondaryAttunement.id)); + + if (mainAttunement == secondaryAttunement) + secondaryAttunement = null; } private static int ClampAttunementRange(int input) @@ -238,8 +228,8 @@ namespace CalamityMod.Items.Weapons.Melee if (input < (int)AttunementID.TrueDefault) return (int)AttunementID.TrueDefault; - if (input > (int)AttunementID.Marine) - return (int)AttunementID.Marine; + if (input > (int)AttunementID.Holy) + return (int)AttunementID.Holy; return input; } @@ -308,9 +298,7 @@ namespace CalamityMod.Items.Weapons.Melee (n.type == ProjectileType() || n.type == ProjectileType() || n.type == ProjectileType() || - n.type == ProjectileType() || - n.type == ProjectileType() || - n.type == ProjectileType())); + n.type == ProjectileType())); } // 03FEB2024: Ozzatron: added so the Iban Blades don't break Overhaul compatibility. Weapons are functionally unchanged. @@ -325,27 +313,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 cbe2d847af..aadaea93ac 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 ''' } @@ -65,7 +57,7 @@ TrueTropicalAttunement: { Name: Grovetender's Touch Function: ''' - Throw out the blade on a vine whip, pulling you toward struck tiles + Throw out the blade using a vine whip Striking enemies with the tip of the whip as it cracks guarantees a critical hit Spreading vines sprout from critical strikes, which can hit up to three targets ''' @@ -84,26 +76,9 @@ HolyAttunement: { Name: Heaven's Might Function: ''' - Swing the sword around you, accelerating over time - Releasing hurls the sword towards your cursor for a short time - ''' -} - -AstralAttunement: { - Name: Extant Abhorrence - Function: - ''' - Charge a star-piercing lunge, release to unleash a devastating blow - Striking the earth with the lunge will cause a massive otherworldly impact, raising monoliths from the ground - ''' -} - -MarineAttunement: { - Name: Gesture for the Drowned - Function: - ''' - Shoot out gravity-affected water orbs, which turn into small waves on ground contact - Waves that make contact with water become much larger and faster + Swing the sword around you, accelerating and dealing more damage over time + Once swung for long enough, releasing hurls the sword towards your cursor for a short time + Striking an enemy with the hurled sword at maximum power causes an astral monolith to erupt from them ''' } @@ -112,10 +87,12 @@ WhirlwindAttunement: { Name: Swordsmith's Pride Function: ''' - Swing the sword around you, accelerating over time. Sword beams are fired at random while swinging - Releasing hurls the sword towards your cursor. Sword beams home onto enemies struck by the thrown sword + Hold to swing the sword around you, accelerating and dealing more damage over time + Homing astral energies are wildly fired around you while swinging + Once swung for long enough, releasing hurls the sword towards your cursor + The hurled sword erupts into astral monoliths on enemy hits ''' - PassiveDesc: All attacks randomly fire sword beams + PassiveDesc: Striking enemies occasionally spawns homing astral bombers that spread the Astral Infection } FlailBladeAttunement: { @@ -135,20 +112,21 @@ SuperPogoAttunement: { Conjure molten blades in front of you that get larger and stronger with enemy hits The blades will bounce you off of tiles while in the air Releasing sends the charged blades hurtling forwards like a wheel - Attacking immediately after throwing the blade launches you toward it, damaging enemies + Attacking immediately after throwing the blade launches you toward it, damaging enemies and healing you ''' PassiveDesc: Striking enemies will rarely heal you } ShockwaveAttunement: { - Name: Mercurial Tides + Name: Earthen Tides Function: ''' - Charge a heaven-shattering lunge, release to unleash a devastating blow - Shockwaves are emitted as the sword charges up - Striking the earth with the lunge will cause a massive otherworldly impact, raising monoliths from the ground + Charge an earth-shattering lunge, release to unleash a devastating blow + Homing sword beams are emitted as the sword charges up + Striking an enemy with the lunge creates a shockwave and marks them with an armor crunching sigil that attracts sword beam homing + Striking the earth with the lunge will cause several blasts of dust to erupt around you ''' - PassiveDesc: Periodically emit shockwaves while attacking + PassiveDesc: Periodically emit large shock waves while attacking } // Galaxia @@ -159,12 +137,7 @@ PhoenixAttunement: { Swing the sword around you, accelerating over time 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 + The hurled sword erupts into a blazing flame pillar on enemy hits ''' } @@ -175,12 +148,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: { @@ -189,29 +156,17 @@ PolarisAttunement: { ''' Channel Galaxia's power into a vortex of celestial energies The vortex powers up over time and while hitting enemies - Release to fire a powerful star directly at your cursor + Release to fire a powerful star directly on your cursor that bombards nearby enemies with bolts 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: { Name: Andromeda's Stride Function: ''' - Charge a spatial lunge, release to shred all enemies in your path + Charge a spatial lunge, release to unleash a galactic blow Charging the sword periodically emits homing bolts - Lunging into tiles releases a ripple of large homing stars - ''' - 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 + Lunging into enemies rains large homing stars from the heavens ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson index b3bf7131b1..b34f3fdb60 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Melee.hjson @@ -89,13 +89,9 @@ ArkoftheCosmos: { to snip out the scissor blades in front of you Hitting an enemy with it will parry them, granting you brief invulnerability You can parry projectiles to make them deal 160 less damage for a short period - Parrying anything will empower the next 15 swings of the sword - ''' - BlastInfo: - ''' - Pressing while holding UP with empowered charges will provoke a Big Rip in spacetime and use all charges - If more than 5 charges were used, you can dash across the rip by holding UP + Parrying will empower the next 15 swings of the sword ''' + BlastInfo: Pressing while on parry cooldown with empowered charges will provoke a Big Rip in spacetime and use all charges } ArkoftheElements: { @@ -104,7 +100,6 @@ ArkoftheElements: { ''' [COMBO] [PARRY] - [BLAST] A heavenly pair of blades infused with the essence of Terraria, powerful enough to cut through the fabric of reality ''' ComboInfo: @@ -119,7 +114,6 @@ ArkoftheElements: { You can parry projectiles to make them deal 100 less damage for a short period Parrying will empower the next 10 swings of the sword, letting you use both blades at once ''' - BlastInfo: Pressing while holding UP with empowered charges will provoke a Big Rip in spacetime and use all charges } AstralBlade: { @@ -558,12 +552,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] ''' } @@ -578,7 +570,6 @@ FracturedArk: { ''' to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you a small window of invulnerability - You can also parry projectiles and temporarily make them deal 50 less damage Parrying empowers the next 10 swings of the sword, boosting damage and letting them throw projectiles ''' } @@ -1389,9 +1380,8 @@ TrueArkoftheAncients: { ''' to extend the Ark out in front of you Hitting an enemy with it will parry them, granting you brief invulnerability + Parrying an enemy empowers the next 10 swings of the sword, letting them throw stronger projectiles You can also parry projectiles to make them deal 80 less damage for a short period - Parrying empowers the next 10 swings of the sword, letting them throw stronger projectiles - Pressing while holding UP will release all empowered charges in a powerful burst of energy ''' } diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index a44825bf12..f1bbe599eb 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -98,6 +98,11 @@ DragoonBigBolt.DisplayName: Dragoon Lightning DragoonSmallBolt.DisplayName: Dragoon Bolt EarthBoom.DisplayName: Earth's Judgement EarthMeteor.DisplayName: Gaia Meteor +EarthenTides.DisplayName: Earthen Tides +EarthenTidesBeam.DisplayName: Earthen Projection +EarthenTidesBlast.DisplayName: Earthen Tides Blast +EarthenTidesBlastSpawner.DisplayName: Blast Spawner +EarthenTidesShockwave.DisplayName: Earthen Tides Shockwave ElementalGlassStar.DisplayName: Glass Star EmpyreanKnife.DisplayName: Empyrean Knife EntropicFlechette.DisplayName: Entropic Flechette @@ -112,7 +117,6 @@ ExobeamSlash.DisplayName: Exobeam Slash ExobeamSlashCreator.DisplayName: Anime Sword Effect Exoboom.DisplayName: Exoplasma Explosion ExtantAbhorrence.DisplayName: Extant Abhorrence -ExtantAbhorrenceMonolith.DisplayName: Abhorrent Monolith FallenBlast.DisplayName: Fallen Paladin's Wrath FallenExplosionSmall.DisplayName: Fallen Hammer Blast FallenPaladinsHammerEcho.DisplayName: Fallen Paladin's Hammer Echo @@ -127,7 +131,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 @@ -151,6 +154,7 @@ GreenWater.DisplayName: Greentide Tooth GrovetendersEntanglingVines.DisplayName: Entangling Growth GrovetendersTouch.DisplayName: Grovetender's Touch HeavensMight.DisplayName: Heaven's Might +HeavensMonolith.DisplayName: Heaven's Monolith HellionSpike.DisplayName: Hellion Spike HolyColliderHolyFire.DisplayName: Holy Collider Fire IceBombFriendly.DisplayName: Ice Bomb @@ -169,9 +173,6 @@ LuxorsGiftMelee.DisplayName: Luxor's Melee MantisClawHoldout.DisplayName: Mantis Claw MantisClawJet.DisplayName: Mantis Claw Jet MantisClawSlash.DisplayName: Mantis Claw Slash -MercurialTides.DisplayName: Mercurial Tides -MercurialTidesBlast.DisplayName: Mercurial Blast -MercurialTidesMonolith.DisplayName: Mercurial Monolith MicrowaveAura.DisplayName: Microwave Radiation MirrorBlast.DisplayName: Mirror Blade MonstrousKnife.DisplayName: Monstrous Knife @@ -189,6 +190,7 @@ Orbacle.DisplayName: Auric Orb OrderbringerBeam.DisplayName: Orderbringer Beam OrderbringerWaveProj.DisplayName: Order-bringing Wave PhoenixsPride.DisplayName: Phoenix's Pride +PhoenixsPrideFirewall.DisplayName: Phoenix's Pride Flame Pillar PhosphorescentGauntletPunches.DisplayName: Gauntlet Punch PhotonRipperProjectile.DisplayName: Extraordinarily Cost-Inefficient Chainsaw PlagueSeeker.DisplayName: Plague Seeker @@ -201,6 +203,7 @@ PrismaticMagicCircle.DisplayName: Magic Circle PrismaticRay.DisplayName: Prismatic Master Spark PrismRay.DisplayName: Prismatic Light PrismTooth.DisplayName: Photon Ripper +PureClarity.DisplayName: Pure Clarity PurityProjection.DisplayName: Purity Projection PurityProjectionSigil.DisplayName: Purity Sigil PwnagehammerEcho.DisplayName: Pwnagehammer Echo @@ -254,7 +257,9 @@ StygianShieldThrown.DisplayName: Shield of Chaos SulphurousGrabberBubble.DisplayName: Grabber Bubble SulphurousGrabberBubble2.DisplayName: Grabber Bubble SwordsmithsPride.DisplayName: Swordsmith's Pride -SwordsmithsPrideBeam.DisplayName: Swordsmith's Projection +SwordsmithsPrideAstralBomber.DisplayName: Swordsmith's Astral Bomber +SwordsmithsPrideAstralEnergy.DisplayName: Swordsmith's Astral Energy +SwordsmithsPrideMonolith.DisplayName: Swordsmiths Pride Monolith SwordsplosionBlue.DisplayName: Blue Sword SwordsplosionGreen.DisplayName: Green Sword SwordsplosionPurple.DisplayName: Purple Sword @@ -289,6 +294,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/ArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs index d54d26ff61..2961189764 100644 --- a/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/ArkOfTheAncients_ParryHoldout.cs @@ -106,39 +106,6 @@ namespace CalamityMod.Projectiles.Melee Projectile.Center = Owner.Center + DistanceFromPlayer; Projectile.scale = 1.4f + ((float)Math.Sin(Timer / 160f * MathHelper.Pi) * 0.6f); //SWAGGER - if (Timer > ParryTime) - return; - - if (AlreadyParried == 0) - { - float collisionPoint = 0f; - float bladeLength = 80f * Projectile.scale; - - for (int k = 0; k < Main.maxProjectiles; k++) - { - Projectile proj = Main.projectile[k]; - - if (proj.active && proj.hostile && proj.damage > 1 && //Only parry harmful projectiles - proj.velocity.Length() * (proj.extraUpdates + 1) > 1f && //Only parry projectiles that move semi-quickly - proj.Size.Length() < 300 && //Only parry projectiles that aren't too large - Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) - { - GeneralParryEffects(); - - //Reduce the projectile's damage by 50 for a second. - if (proj.Calamity().flatDR < 50) - proj.Calamity().flatDR = 50; - if (proj.Calamity().flatDRTimer < 60) - proj.Calamity().flatDRTimer = 60; - - //Bounce off the player if they are in the air - if (Owner.velocity.Y != 0) - Owner.velocity += Utils.SafeNormalize(Owner.Center - proj.Center, Vector2.Zero) * 2; - break; - } - } - } - //Make the owner look like theyre holding the sword bla bla Owner.heldProj = Projectile.whoAmI; Owner.ChangeDir(Math.Sign(Projectile.velocity.X)); diff --git a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs index 620ff8c398..1f7dcec0cf 100644 --- a/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs +++ b/Projectiles/Melee/ArkOfTheCosmos_BlastAttack.cs @@ -17,25 +17,12 @@ namespace CalamityMod.Projectiles.Melee public class ArkoftheCosmosBlast : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Umm actually the rending scissors are for aote mr programmer what the hel.. it gets changed in predraw anywyas + public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; //Yes this is AotE sprite, but it gets changed in predraw anyways private bool initialized = false; public ref float Charge => ref Projectile.ai[0]; - public bool Dashing - { - get - { - return Projectile.ai[1] == 1; - } - - set - { - Projectile.ai[1] = value ? 1f : 0f; - } - } - - const int maxStitches = 8; + const int maxStitches = 10; public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches); public float[] StitchRotations = new float[maxStitches]; public float[] StitchLifetimes = new float[maxStitches]; @@ -74,7 +61,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.penetrate = -1; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = (int)MaxTime + 2; + Projectile.localNPCHitCooldown = -1; } public override bool? CanDamage() @@ -118,14 +105,12 @@ namespace CalamityMod.Projectiles.Melee //Spawn particles when the line appears if (HoldTimer == 1) { - //Check for the up arrow once more so if the player has good reflexes they can avoid the dash. Gives them more control - if (Owner.controlUp && Charge >= 5) - { - // 17APR2024: Ozzatron: Dash iframes are not boosted by Cross Necklace at all and are fixed. - Owner.GiveUniversalIFrames(ArkoftheCosmos.DashIframes); - Dashing = true; - } + // Feel the power + SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 7.5f) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = 7.5f; + // Feel the particles for (int i = 0; i < 20; i++) { float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); @@ -152,31 +137,18 @@ namespace CalamityMod.Projectiles.Melee break; } } - } - - Owner.Calamity().LungingDown = false; - - if (Dashing) - { - Owner.Calamity().LungingDown = true; - Owner.fallStart = (int)(Owner.position.Y / 16f); - Owner.velocity = Owner.SafeDirectionTo(scissorPosition, Vector2.Zero) * 60f; - - if (Owner.Distance(scissorPosition) < 60f) + // Feel the extra stars + if (Owner.whoAmI == Main.myPlayer) { - Dashing = false; - Owner.velocity *= 0.1f; //Abrupt stop - SoundEngine.PlaySound(CommonCalamitySounds.MeatySlashSound, Projectile.Center); - - if (Owner.whoAmI == Main.myPlayer) + int starAmt = 5; + for (int s = 1; s <= starAmt; s++) { - for (int i = 0; i < 5; i++) - { - var source = Projectile.GetSource_FromThis(); - Projectile blast = Projectile.NewProjectileDirect(source, Owner.Center, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.SlashBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); - blast.timeLeft = 100; - } + float lerpRatio = s / (float)starAmt; + float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, lerpRatio); + Vector2 starPosition = Projectile.Center + Projectile.velocity * positionAlongLine; + Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), starPosition, Main.rand.NextVector2CircularEdge(28, 28), ProjectileType(), (int)(ArkoftheCosmos.BlastBoltsDamageMultiplier * Projectile.damage), 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.07f); + blast.timeLeft = 100; } } } @@ -215,6 +187,17 @@ namespace CalamityMod.Projectiles.Melee } StitchLifetimes[i]++; } + + if (StitchProgress > 0) + { + for (int m = 0; m < 2; m++) + { + float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat()); + Vector2 smokePosition = Projectile.Center + Projectile.velocity * positionAlongLine; + HeavySmokeParticle smoke = new(smokePosition, Main.rand.NextVector2CircularEdge(4f, 4f), new Color(117, 36, 32), 12, 0.8f, 0.6f, 0f, true); + GeneralParticleHandler.SpawnParticle(smoke); + } + } } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -231,22 +214,6 @@ namespace CalamityMod.Projectiles.Melee } } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - ArkoftheCosmos.blastFalloffStrenght, Projectile.numHits * ArkoftheCosmos.blastFalloffSpeed); - } - - public override void OnKill(int timeLeft) - { - if (Dashing) - { - Owner.velocity *= 0.1f; //Abrupt stop if the player was still dashing - } - - Owner.Calamity().LungingDown = false; - } - //Animation keys public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f); public CurveSegment thrust = new CurveSegment(EasingType.PolyOut, 0.3f, 0.2f, 3f, 3); @@ -300,7 +267,7 @@ namespace CalamityMod.Projectiles.Melee float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); - float ripWidth = StitchProgress < 0.75f ? 0.2f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; + float ripWidth = StitchProgress < 0.75f ? 0.4f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; @@ -311,6 +278,7 @@ namespace CalamityMod.Projectiles.Melee { for (int i = 0; i < CurrentStitches; i++) { + float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine; diff --git a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs b/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs deleted file mode 100644 index 97ca32cb42..0000000000 --- a/Projectiles/Melee/ArkOfTheElements_SnapBlast.cs +++ /dev/null @@ -1,273 +0,0 @@ -using System; -using System.IO; -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 CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - - -namespace CalamityMod.Projectiles.Melee -{ - public class ArkoftheElementsSnapBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/RendingScissorsRight"; - - private bool initialized = false; - - const int maxStitches = 8; - public int CurrentStitches => (int)Math.Ceiling((1 - (float)Math.Sqrt(1f - (float)Math.Pow(MathHelper.Clamp(StitchProgress * 3f, 0f, 1f), 2f))) * maxStitches); - public float[] StitchRotations = new float[maxStitches]; - public float[] StitchLifetimes = new float[maxStitches]; - - const float MaxTime = 70; - const float SnapTime = 25f; - const float HoldTime = 15f; - - public float SnapTimer => MaxTime - Projectile.timeLeft; - public float HoldTimer => MaxTime - Projectile.timeLeft - SnapTime; - public float StitchTimer => MaxTime - Projectile.timeLeft - SnapTime - (HoldTime / 2f); - - public float SnapProgress => MathHelper.Clamp(SnapTimer / SnapTime, 0, 1); - public float HoldProgress => MathHelper.Clamp(HoldTimer / HoldTime, 0, 1); - public float StitchProgress => MathHelper.Clamp(StitchTimer / (MaxTime - (SnapTime + (HoldTime / 2f))), 0, 1); - - public int CurrentAnimation => (MaxTime - Projectile.timeLeft) <= SnapTime ? 0 : (MaxTime - Projectile.timeLeft) <= SnapTime + HoldTime ? 1 : 2; - - public Player Owner => Main.player[Projectile.owner]; - - public override void SetStaticDefaults() - { - } - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.MeleeNoSpeed; - Projectile.width = Projectile.height = 300; - Projectile.width = Projectile.height = 300; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = (int)MaxTime + 2; - } - - public override bool? CanDamage() - { - return HoldProgress > 0; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (HoldProgress == 0) - return false; - - //The hitbox is simplified into a line collision. - float collisionPoint = 0f; - float bladeLength = ThrustDisplaceRatio() * 242f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + (Projectile.velocity * bladeLength), 30, ref collisionPoint); - } - - public override bool ShouldUpdatePosition() => false; - - public override void AI() - { - if (!initialized) //Initialization - { - Projectile.timeLeft = (int)MaxTime; - SoundEngine.PlaySound(SoundID.Item84 with { Volume = SoundID.Item84.Volume * 0.3f }, Projectile.Center); - - Projectile.velocity.Normalize(); - Projectile.rotation = Projectile.velocity.ToRotation(); - - - initialized = true; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - //Manage position and rotation - Projectile.scale = 1.4f; - - //Update stitches - for (int i = 0; i < CurrentStitches; i++) - { - if (StitchRotations[i] == 0) - { - StitchRotations[i] = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4) + MathHelper.PiOver2; - - SoundStyle sewSound = i % 3 == 0 ? SoundID.Item63 : i % 3 == 1 ? SoundID.Item64 : SoundID.Item65; - SoundEngine.PlaySound(sewSound with { Volume = sewSound.Volume * 0.5f }, Owner.Center); - - float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; - - - Particle spark = new CritSpark(stitchCenter, Vector2.Zero, Color.White, Color.Cyan, 3f, 8, 0.1f, 3); - GeneralParticleHandler.SpawnParticle(spark); - } - StitchLifetimes[i]++; - } - - //Spawn particles when the line appears - if (HoldTimer == 1) - { - for (int i = 0; i < 20; i++) - { - float positionAlongLine = MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, Main.rand.NextFloat(0f, 1f)); - Vector2 particlePosition = Projectile.Center + Projectile.velocity * positionAlongLine + (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; - Color particleColor = Main.rand.NextBool() ? Color.OrangeRed : Main.rand.NextBool() ? Color.White : Color.Orange; - float particleScale = Main.rand.NextFloat(0.05f, 0.4f) * (0.4f + 0.6f * (float)Math.Sin(positionAlongLine / (ThrustDisplaceRatio() * 242f) * MathHelper.Pi)); - - int particleType = Main.rand.Next(3); - Particle particle; - - switch (particleType) - { - case 0: - particle = new StrongBloom(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-4f, -1f), particleColor, particleScale, Main.rand.Next(20) + 10); - GeneralParticleHandler.SpawnParticle(particle); - break; - case 1: - particle = new GenericBloom(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-4f, -1f), particleColor, particleScale, Main.rand.Next(20) + 10); - GeneralParticleHandler.SpawnParticle(particle); - break; - case 2: - particle = new CritSpark(particlePosition, Vector2.UnitY * Main.rand.NextFloat(-10f, -1f), Color.White, particleColor, particleScale * 7f, Main.rand.Next(20) + 10, 0.1f, 3); - GeneralParticleHandler.SpawnParticle(particle); - break; - } - } - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.Orange : Color.Coral) : (Main.rand.NextBool() ? Color.OrangeRed : Color.Gold); - Particle pulse = new PulseRing(target.Center, Vector2.Zero, pulseColor, 0.05f, 0.2f + Main.rand.NextFloat(0f, 1f), 30); - GeneralParticleHandler.SpawnParticle(pulse); - - for (int i = 0; i < 10; i++) - { - Vector2 particleSpeed = Projectile.velocity.RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); - Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Red, 60, 1, 1.5f, hueShift: 0.002f); - GeneralParticleHandler.SpawnParticle(energyLeak); - } - } - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - ArkoftheElements.blastFalloffStrenght, Projectile.numHits * ArkoftheElements.blastFalloffSpeed); - } - - //Animation keys - public CurveSegment anticipation = new CurveSegment(EasingType.SineBump, 0f, 0.2f, -0.1f); - public CurveSegment thrust = new CurveSegment(EasingType.PolyOut, 0.3f, 0.2f, 3f, 3); - internal float ThrustDisplaceRatio() => PiecewiseAnimation(SnapProgress, new CurveSegment[] { anticipation, thrust }); - - - public CurveSegment openMore = new CurveSegment(EasingType.SineBump, 0f, 0f, -0.15f); - public CurveSegment close = new CurveSegment(EasingType.PolyIn, 0.35f, 0f, 1f, 4); - public CurveSegment stayClosed = new CurveSegment(EasingType.Linear, 0.5f, 1f, 0f); - internal float RotationRatio() => PiecewiseAnimation(SnapProgress, new CurveSegment[] { openMore, close, stayClosed }); - - public override bool PreDraw(ref Color lightColor) - { - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - Texture2D sliceTex = Request("CalamityMod/Particles/BloomLine").Value; - Color sliceColor = Color.Lerp(Color.OrangeRed, Color.White, SnapProgress); - float rot = Projectile.rotation + MathHelper.PiOver2; - Vector2 nitpickShiftCorrection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 10f; //Ngl these minor nitpick variables probably be horrible to understand when decompiled into Vector43 - Vector2 sliceScale = new Vector2(0.2f * (1 - SnapProgress), ThrustDisplaceRatio() * 242f); - Main.EntitySpriteDraw(sliceTex, Projectile.Center + nitpickShiftCorrection - Main.screenPosition, null, sliceColor, rot, new Vector2(sliceTex.Width / 2f, sliceTex.Height), sliceScale, 0f, 0); - - //Draw the scissors - if (HoldProgress <= 0.4f) - { - Texture2D frontBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsRight").Value; - Texture2D backBlade = Request("CalamityMod/Projectiles/Melee/RendingScissorsLeft").Value; - - float snippingRotation = Projectile.rotation + MathHelper.PiOver4; - float snippingRotationBack = Projectile.rotation + MathHelper.PiOver4 * 1.75f; - - float nitpickAngleCorrection = MathHelper.ToRadians(6f); //ITS IMPORTANT MOM! - float drawRotation = MathHelper.Lerp(snippingRotation + MathHelper.PiOver4, snippingRotation, RotationRatio()) + nitpickAngleCorrection; - float drawRotationBack = MathHelper.Lerp(snippingRotationBack - MathHelper.PiOver4, snippingRotationBack, RotationRatio()) + nitpickAngleCorrection; - - Vector2 drawOrigin = new Vector2(51, 86); //Right on the hole - Vector2 drawOriginBack = new Vector2(22, 109); //Right on the hole - Vector2 drawPosition = Projectile.Center + ThrustDisplaceRatio() * Projectile.velocity * 200f - Main.screenPosition; - - float opacity = (0.4f - HoldProgress) / 0.4f; - Color drawColor = Color.Orange * opacity * 0.9f; - Color drawColorBack = Color.HotPink * opacity * 0.9f; - - Main.EntitySpriteDraw(backBlade, drawPosition, null, drawColorBack, drawRotationBack, drawOriginBack, Projectile.scale, 0f, 0); - Main.EntitySpriteDraw(frontBlade, drawPosition, null, drawColor * opacity, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - } - - //Draw the rip - if (HoldProgress > 0) - { - Texture2D lineTex = Request("CalamityMod/Particles/ThinEndedLine").Value; - - Vector2 Shake = HoldProgress > 0.2f ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (1 - HoldProgress * 5f) * 0.5f; - float raise = (float)Math.Sin(HoldProgress * MathHelper.PiOver2); - - Vector2 origin = new Vector2(lineTex.Width / 2f, lineTex.Height); - float ripWidth = StitchProgress < 0.75f ? 0.2f : (1 - (StitchProgress - 0.75f) * 4f) * 0.2f; - Vector2 scale = new Vector2(ripWidth, (ThrustDisplaceRatio() * 242f) / lineTex.Height); - float lineOpacity = StitchProgress < 0.75f ? 1f : 1 - (StitchProgress - 0.75f) * 4f; - - Main.EntitySpriteDraw(lineTex, Projectile.Center - Main.screenPosition + Shake + nitpickShiftCorrection, null, Color.Lerp(Color.White, Color.OrangeRed * 0.7f, raise) * lineOpacity, rot, origin, scale, SpriteEffects.None, 0); - - - //Draw the stitches - if (StitchProgress > 0) - { - for (int i = 0; i < CurrentStitches; i++) - { - float positionAlongLine = (ThrustDisplaceRatio() * 242f / (float)maxStitches * 0.5f) + MathHelper.Lerp(0f, ThrustDisplaceRatio() * 242f, i / (float)maxStitches); - Vector2 stitchCenter = Projectile.Center + Projectile.velocity * positionAlongLine + nitpickShiftCorrection; - - rot = Projectile.rotation + MathHelper.PiOver2 + StitchRotations[i]; - origin = new Vector2(lineTex.Width / 2f, lineTex.Height / 2f); - - float stitchLength = (float)Math.Sin(i / (float)(maxStitches - 1) * MathHelper.Pi) * 0.5f + 0.5f; - float stitchScale = (1f + (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.Pi) * 0.3f) * 0.85f; - if (CurrentStitches == maxStitches) - { - stitchScale *= 1 - ((StitchTimer - (MaxTime - SnapTime - HoldTime * 0.5f) * 0.3f) / (MaxTime - SnapTime - HoldTime * 0.5f) * 0.7f) * 0.8f; - } - scale = new Vector2(0.2f, stitchLength) * stitchScale; - - Color stitchColor = Color.Lerp(Color.White, Color.CornflowerBlue * 0.7f, (float)Math.Sin(MathHelper.Clamp(StitchLifetimes[i] / 7f, 0f, 1f) * MathHelper.PiOver2)); - - Main.EntitySpriteDraw(lineTex, stitchCenter - Main.screenPosition + Shake, null, stitchColor, rot, origin, scale, 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; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - } - } -} diff --git a/Projectiles/Melee/BiomeBladeHoldout.cs b/Projectiles/Melee/BiomeBladeHoldout.cs index 77950d089b..39dc41139c 100644 --- a/Projectiles/Melee/BiomeBladeHoldout.cs +++ b/Projectiles/Melee/BiomeBladeHoldout.cs @@ -118,34 +118,26 @@ 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; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; - bool hallow = Owner.ZoneHallow; - bool astral = Owner.Calamity().ZoneAstral; - bool marine = Owner.Calamity().ZoneAbyss || Owner.Calamity().ZoneSunkenSea; + 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 = AttunementSystem.FindOrNull(AttunementID.TrueDefault); - if (desert || hell) + if (hotAttune) attunement = AttunementSystem.FindOrNull(AttunementID.TrueHot); - if (snow) + if (coldAttune) attunement = AttunementSystem.FindOrNull(AttunementID.TrueCold); - if (jungle || ocean) + if (jungleAttune) attunement = AttunementSystem.FindOrNull(AttunementID.TrueTropical); - if (evil) + if (evilAttune) attunement = AttunementSystem.FindOrNull(AttunementID.TrueEvil); - if (hallow) + if (heavenlyAttune) attunement = AttunementSystem.FindOrNull(AttunementID.Holy); - if (astral) - attunement = AttunementSystem.FindOrNull(AttunementID.Astral); - if (marine) - attunement = AttunementSystem.FindOrNull(AttunementID.Marine); - //If the owner already had the attunement , break out of it (And unswap) + //If the owner already had the attunement, break out of it (And unswap) if (item.secondaryAttunement == attunement) { SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); diff --git a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs index 70a438d923..f8c734e346 100644 --- a/Projectiles/Melee/BrokenBiomeBladeHoldout.cs +++ b/Projectiles/Melee/BrokenBiomeBladeHoldout.cs @@ -120,28 +120,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; - bool hell = Owner.ZoneUnderworldHeight; - bool ocean = Owner.ZoneBeach || Owner.Calamity().ZoneSulphur; + bool coldAttune = Owner.ZoneSnow || Owner.ZoneSkyHeight; + bool evilAttune = Owner.ZoneCorrupt || Owner.ZoneCrimson; + bool hotAttune = Owner.ZoneDesert || Owner.ZoneUnderworldHeight; Attunement attunement = AttunementSystem.FindOrNull(AttunementID.Default); - if (desert || hell) + if (hotAttune) { attunement = AttunementSystem.FindOrNull(AttunementID.Hot); } - if (snow) + if (coldAttune) { attunement = AttunementSystem.FindOrNull(AttunementID.Cold); } - if (jungle || ocean) - { - attunement = AttunementSystem.FindOrNull(AttunementID.Tropical); - } - if (evil) + if (evilAttune) { attunement = AttunementSystem.FindOrNull(AttunementID.Evil); } diff --git a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs b/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs deleted file mode 100644 index 700ef6f41d..0000000000 --- a/Projectiles/Melee/BrokenBiomeBlade_GrovetendersTouch.cs +++ /dev/null @@ -1,265 +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 = 400; - const int MinReach = 300; - const float SnappingPoint = 0.7f; //When does the snap occur. - const float ReelBackStrenght = 14f; - - 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 = 36; - 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) - { - Vector2 mouse = Owner.ClampedMouseWorld(); - Projectile.velocity = Owner.SafeDirectionTo(mouse, Vector2.Zero); - Reach = MathHelper.Clamp((Owner.Center - mouse).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) //keep checking for the tile hook - { - Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); - HookToTile(); - 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; - - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); - } - public void HookToTile() - { - if (Main.myPlayer == Owner.whoAmI) - { - //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) - { - Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; - SnapCoyoteTime = 0f; - } - SoundEngine.PlaySound(SoundID.Item65, Projectile.position); - } - } - - 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 93a2a92bf0..b2f7d3f023 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 0f842730fe..23478acb09 100644 --- a/Projectiles/Melee/GalaxiaBolt.cs +++ b/Projectiles/Melee/GalaxiaBolt.cs @@ -15,7 +15,9 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public ref float Hue => ref Projectile.ai[0]; - public ref float HomingStrenght => ref Projectile.ai[1]; + public ref float HomingStrength => ref Projectile.ai[1]; + public ref float ShouldDelayHoming => ref Projectile.ai[2]; + public bool StrongerHoming = false; Particle Head; @@ -56,10 +58,10 @@ 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 || StrongerHoming) && (ShouldDelayHoming != 1f || Projectile.timeLeft < 60)) //Home in { float idealDirection = Projectile.AngleTo(target.Center); - float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrenght); + float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, HomingStrength); Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length() * 0.995f; } diff --git a/Projectiles/Melee/GalaxiaTropicRing.cs b/Projectiles/Melee/GalaxiaTropicRing.cs deleted file mode 100644 index 96a336a693..0000000000 --- a/Projectiles/Melee/GalaxiaTropicRing.cs +++ /dev/null @@ -1,111 +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.HealPlayer(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 79b868ced2..7bcc83b5f9 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStride.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStride.cs @@ -44,10 +44,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool? CanDamage() - { - return (State == 1); - } + public override bool? CanDamage() => State == 1f ? (bool?)null : false; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -87,10 +84,15 @@ namespace CalamityMod.Projectiles.Melee } else { - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); + float screenshakeLevel = 4f + CurrentIndicator * 2f; + if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < screenshakeLevel) + Main.LocalPlayer.Calamity().GeneralScreenShakePower = screenshakeLevel; + CustomPulse shatter = new(Owner.Center, Vector2.Zero, Color.HotPink, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.0075f * CurrentIndicator, 0.075f * CurrentIndicator, 30); + GeneralParticleHandler.SpawnParticle(shatter); + State = 1f; - Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death + Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; // Keep that even, if it's an odd number it'll fuck off and won't reset the player's velocity on death dashDuration = Projectile.timeLeft; lastDisplacement = Projectile.Center - Owner.Center; Projectile.netUpdate = true; @@ -111,11 +113,11 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - //WOahhh do a ring of projectiles!! woahhh + // Spawn a ring of stars for (int i = 0; i < 5; i++) { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 5f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); - blast.timeLeft = 30; + 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); @@ -143,11 +145,11 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - //Projectiles!!! wah!!! + // Spawn more stars for (int i = 0; i < 9; i++) { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, (MathHelper.TwoPi * i / 9f).ToRotationVector2() * 10f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_BoltsDamageReduction), 0f, Owner.whoAmI, 0.75f, MathHelper.Pi * 0.02f); - blast.timeLeft = 50; + 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; @@ -164,9 +166,10 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = true; + // Immediately cancel the lunge if you hit a tile + // Unlike its downgrades, there are NO effects from hitting tiles - it's too impractical at this stage, why would there be? if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) { - SlamDown(); Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; Projectile.active = false; @@ -203,69 +206,22 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } - public void SlamDown() - { - if (Owner.whoAmI != Main.myPlayer) - return; - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction * 16f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); - proj.scale = 3f; - proj.timeLeft = 50; - - SideSprouts(1, 150f, 1f * Charge / MaxCharge); - SideSprouts(-1, 150f, 1f * Charge / MaxCharge); - - SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) - { - spawner.WaitTimer = (1 - projSize) * 34f; - spawner.OriginDirection = direction; - spawner.Facing = facing; - } - } - - return validPositionFound; - } - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { // 17APR2024: Ozzatron: Galaxia's dash gives iframes when striking enemies in a similar manner to a ram dash. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. Owner.GiveUniversalIFrames(FourSeasonsGalaxia.AndromedaAttunement_DashHitIFrames); + + // ai[0] is NPC index to stay locked onto it, ai[1] is charge level to determine how many stars are rained + if (!CalamityUtils.AnyProjectiles(ProjectileType())) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.AndromedaAttunement_StarDamageMultiplier), Projectile.knockBack, Owner.whoAmI, target.whoAmI, CurrentIndicator); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - modifiers.SourceDamage *= 1f + FourSeasonsGalaxia.AndromedaAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2); + // Lunge always critically strikes + modifiers.SetCrit(); + modifiers.SourceDamage *= (FourSeasonsGalaxia.AndromedaAttunement_FullChargeMult * (float)Math.Pow(Charge / MaxCharge, 2)); } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs index 1e34f170f6..00b06171b7 100644 --- a/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs +++ b/Projectiles/Melee/Galaxia_AndromedasStrideBoltSpawner.cs @@ -15,15 +15,9 @@ namespace CalamityMod.Projectiles.Melee public new string LocalizationCategory => "Projectiles.Melee"; public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; public Player Owner => Main.player[Projectile.owner]; - public ref float Size => ref Projectile.ai[1]; //Yes + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + public ref float ChargeLevel => ref Projectile.ai[1]; - public float WaitTimer; //How long until the monoliths appears - public Vector2 OriginDirection; //The direction of the original strike - public float Facing; //The direction of the original strike - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -31,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee Projectile.tileCollide = false; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.timeLeft = 30; + Projectile.timeLeft = 60; Projectile.hide = true; } @@ -39,31 +33,29 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.velocity != Vector2.Zero) + // Set time left based on charge level + if (Projectile.localAI[0] == 0f) { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation(); - Projectile.velocity = Vector2.Zero; + Projectile.timeLeft = 15 * (int)ChargeLevel; + Projectile.localAI[0] = 1f; } - if (WaitTimer > 0) + // Constantly follow its target + // Die if the target is no longer active + if (!Target.active) { - Projectile.timeLeft = 30; - WaitTimer--; + Projectile.Kill(); + return; } + else + Projectile.Center = Target.Center; - if (Projectile.timeLeft == 29) - { - if (Size * 0.8 > 0.4 && Facing != 0) - SideSprouts(Facing, 150f, Size * 0.8f); - } - - if (Projectile.timeLeft < 29) + // Spawn smoke + if (Projectile.timeLeft < 59) { if (Main.rand.NextBool(3)) { - Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver4).ToRotationVector2(); - Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4 / 2f, MathHelper.PiOver4 / 2f)) * Main.rand.NextFloat(15f, 35f); + Vector2 flyDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 8f) * Main.rand.NextFloat(15f, 35f); Particle smoke = new HeavySmokeParticle(Projectile.Center, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.4f, 1.3f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); @@ -77,98 +69,36 @@ namespace CalamityMod.Projectiles.Melee } } - if (Projectile.timeLeft == 2) + // Rain stars from the sky + if (Projectile.timeLeft % 15 == 5) { - //New bolt - if (Owner.whoAmI == Main.myPlayer) + SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); + for (int i = 0; i < 2; i++) { - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.position, Projectile.rotation.ToRotationVector2() * 18f, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, 0.75f, MathHelper.Pi / 25f); - proj.scale = Size * 3f; - proj.timeLeft = 50; + if (Owner.whoAmI == Main.myPlayer) + { + Vector2 starPos = new Vector2(Projectile.Center.X + Main.rand.NextFloat(-250f, 250f), Projectile.Center.Y - Main.rand.NextFloat(650f, 750f)); + 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; + } } - Vector2 particleDirection = (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2(); - SoundEngine.PlaySound(SoundID.DD2_EtherianPortalDryadTouch, Projectile.Center); - - for (int i = 0; i < 8; i++) + for (int i = 0; i < 4; i++) { - Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); - Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); + Vector2 hitPositionDisplace = -Vector2.UnitY * Main.rand.NextFloat(10f); + Vector2 flyDirection = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver2) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(1.6f, 2.2f) * Projectile.scale, 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.MidnightBlue, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(1f, 1.6f) * Projectile.scale, 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); if (Main.rand.NextBool(3)) { - Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.4f, 1.7f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Red, 20, Main.rand.NextFloat(1.1f, 1.4f) * Projectile.scale, 0.8f, 0, true, 0.005f, true); GeneralParticleHandler.SpawnParticle(smokeGlow); } } } } - - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() - { - for (float i = 0; i < 40; i += 0.5f) - { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } - } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is AndromedasStrideBoltSpawner spawner) - { - spawner.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; - spawner.OriginDirection = OriginDirection; - spawner.Facing = facing; - } - } - - return validPositionFound; - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaitTimer); - writer.Write(Facing); - writer.WriteVector2(OriginDirection); - - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaitTimer = reader.ReadSingle(); - Facing = reader.ReadSingle(); - OriginDirection = reader.ReadVector2(); - } } } diff --git a/Projectiles/Melee/Galaxia_AriesWrath.cs b/Projectiles/Melee/Galaxia_AriesWrath.cs index 1f9a392338..71e94c3a56 100644 --- a/Projectiles/Melee/Galaxia_AriesWrath.cs +++ b/Projectiles/Melee/Galaxia_AriesWrath.cs @@ -120,7 +120,7 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.CantUseHoldout() || Owner.HeldItem.type != ItemType()) { - //Kill the projectile if too far away from the player or close enough to get "re-absorbed) + // Kill the projectile if too far away from the player or close enough to get "re-absorbed") if ((Owner.Center - Projectile.Center).Length() < 30f || (Owner.Center - Projectile.Center).Length() > 2000f || Projectile.velocity.Length() > 100f) Projectile.Kill(); diff --git a/Projectiles/Melee/Galaxia_PhoenixsPride.cs b/Projectiles/Melee/Galaxia_PhoenixsPride.cs index 846786a679..c473cb8de7 100644 --- a/Projectiles/Melee/Galaxia_PhoenixsPride.cs +++ b/Projectiles/Melee/Galaxia_PhoenixsPride.cs @@ -105,7 +105,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + // PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -114,7 +114,7 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Sparkle); } - //Actually do projectiles now + // Actually do projectiles now if (Owner.whoAmI == Main.myPlayer) { for (int i = 0; i <= 5; i++) @@ -156,23 +156,14 @@ namespace CalamityMod.Projectiles.Melee if (Main.rand.NextBool(2)) { - - float Opacity = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1) * 0.75f; + float Opacity = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1) * 0.5f; float scaleFactor = MathHelper.Clamp((Empowerment / maxEmpowerment - 0.5f) * 3f, 0, 1); - for (float i = 0f; i <= 1; i += 0.5f) + for (float i = 0f; i < 2; i++) { - Vector2 smokepos = Projectile.Center + (direction * (60 + 40 * i) * Projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); - - + Vector2 smokepos = Projectile.Center + (direction * (60 + 20 * i) * Projectile.scale) + direction.RotatedBy(-MathHelper.PiOver2) * 30f * scaleFactor * Main.rand.NextFloat(); Particle smoke = new HeavySmokeParticle(smokepos, direction.RotatedBy(-MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity, Color.Lerp(Color.MidnightBlue, Color.Indigo, i), 10 + Main.rand.Next(5), scaleFactor * Main.rand.NextFloat(2.8f, 3.1f), Opacity + Main.rand.NextFloat(0f, 0.2f), 0f, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); - - if (Main.rand.NextBool(3)) - { - Particle smokeGlow = new HeavySmokeParticle(smokepos, direction.RotatedBy(-MathHelper.PiOver2) * 20f * scaleFactor + Owner.velocity, Color.OrangeRed, 7, scaleFactor * Main.rand.NextFloat(2f, 2.4f), Opacity * 2, 0f, true, 0.001f, true); - GeneralParticleHandler.SpawnParticle(smokeGlow); - } } } @@ -267,6 +258,16 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + if (CurrentState == 1f && Main.myPlayer == Projectile.owner && !AnyProjectiles(ProjectileType())) + { + Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), Projectile.damage, 0f, Projectile.owner, target.whoAmI); + if (proj.ModProjectile is PhoenixsPrideFirewall fire) + fire.Scale = MathHelper.Clamp(target.width / 100f, 0.3f, 1.25f); + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { if (CurrentState == 1f) @@ -275,11 +276,7 @@ namespace CalamityMod.Projectiles.Melee modifiers.SourceDamage *= FourSeasonsGalaxia.PhoenixAttunement_BaseDamageReduction + (FourSeasonsGalaxia.PhoenixAttunement_FullChargeDamageBoost * Empowerment / maxEmpowerment); } - public override void OnKill(int timeLeft) - { - if (smear != null) - smear.Kill(); - } + public override void OnKill(int timeLeft) => smear?.Kill(); public override bool PreDraw(ref Color lightColor) { diff --git a/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs new file mode 100644 index 0000000000..2f4a52d81d --- /dev/null +++ b/Projectiles/Melee/Galaxia_PhoenixsPrideFirewall.cs @@ -0,0 +1,107 @@ +using CalamityMod.CalPlayer; +using CalamityMod.Graphics.Primitives; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System.IO; +using Terraria; +using Terraria.Graphics.Shaders; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class PhoenixsPrideFirewall : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + public const int TornadoHeight = 480; + + public float Scale; // Size of the firewall, scales with NPC width + public float fadeOut = 0f; // Used to control the firewall fading in and out at the start and end of its lifespan + public NPC Target => Main.npc[(int)Projectile.ai[0]]; + public override void SetStaticDefaults() => ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000; + + public override void SetDefaults() + { + Projectile.width = 408; + Projectile.height = 102; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.alpha = 255; + Projectile.scale = Scale; + Projectile.timeLeft = 150; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PhoenixAttunement_FlamePillarLocalIFrames; + } + + public override void AI() + { + // Constantly follow its target + // Die if the target is no longer active + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center + Target.velocity; + + // Fade in and out at the start and end of its lifespan + if (Projectile.timeLeft > 145) + fadeOut += 0.15f; + if (Projectile.timeLeft < 15) + fadeOut -= 0.05f; + } + + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) + { + float _ = 0f; + return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), + targetHitbox.Size(), + Projectile.Bottom, + Projectile.Bottom - Vector2.UnitY * TornadoHeight, + 72, + ref _); + } + + public float WidthFunction(float completionRatio) => 50f * Scale * (completionRatio > 0.4f ? 1f : completionRatio * 2.5f); + + public override bool PreDraw(ref Color lightColor) + { + Main.spriteBatch.EnterShaderRegion(); + + GameShaders.Misc["CalamityMod:Bordernado"].UseSaturation(-0.2f); + GameShaders.Misc["CalamityMod:Bordernado"].UseOpacity(fadeOut); + GameShaders.Misc["CalamityMod:Bordernado"].SetShaderTexture(ModContent.Request("Terraria/Images/Misc/Perlin")); + Vector2[] drawPoints = new Vector2[5]; + Vector2 upwardAscent = Vector2.UnitY * TornadoHeight; + + Vector2 bottom = Projectile.Center; + Vector2 top = bottom - upwardAscent; + for (int i = 0; i < drawPoints.Length - 1; i++) + drawPoints[i] = Vector2.Lerp(top, bottom, i / (float)(drawPoints.Length - 1)); + + drawPoints[drawPoints.Length - 1] = bottom; + PrimitiveRenderer.RenderTrail(drawPoints, new(WidthFunction, (_) => Color.Orange, shader: GameShaders.Misc["CalamityMod:Bordernado"]), 80); + + Main.spriteBatch.ExitShaderRegion(); + + Texture2D vortexTexture = ModContent.Request("CalamityMod/Projectiles/Boss/OldDukeVortex").Value; + for (int i = 0; i < 90; i++) + { + float angle = MathHelper.TwoPi * i / (25f * Scale) + Main.GlobalTimeWrappedHourly * MathHelper.TwoPi; + Color drawColor = Color.White * 0.04f; + drawColor.A = 0; + Vector2 drawPosition = bottom + angle.ToRotationVector2() * 4f - Main.screenPosition; + + drawPosition += (angle + Main.GlobalTimeWrappedHourly * i / 16f).ToRotationVector2() * 6f; + Main.EntitySpriteDraw(vortexTexture, drawPosition, null, drawColor * fadeOut, angle + MathHelper.PiOver2, vortexTexture.Size() * 0.5f, 0.2f * Scale, SpriteEffects.None, 0); + } + + return false; + } + } +} diff --git a/Projectiles/Melee/Galaxia_PolarisGaze.cs b/Projectiles/Melee/Galaxia_PolarisGaze.cs index ffffb7356f..e7e4fa40cc 100644 --- a/Projectiles/Melee/Galaxia_PolarisGaze.cs +++ b/Projectiles/Melee/Galaxia_PolarisGaze.cs @@ -21,7 +21,6 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float Shred => ref Projectile.ai[0]; //Charge, basically public ref float HitChargeCooldown => ref Projectile.ai[1]; - public ref float ChargeSoundCooldown => ref Projectile.localAI[0]; public float Bounce(float x) => x <= 50 ? x / 50f : x <= 65 ? 1 + 0.15f * (float)Math.Sin((x - 50f) / 15f * MathHelper.Pi) : 1f; public float ShredRatio => MathHelper.Clamp(Shred / (maxShred * 0.5f), 0f, 1f); public Player Owner => Main.player[Projectile.owner]; @@ -72,13 +71,6 @@ namespace CalamityMod.Projectiles.Melee { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { - // 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - if (CalamityUtils.AngleBetween(Owner.Center - Main.MouseWorld, Owner.Center - proj.Center) > MathHelper.PiOver4) - { - proj.Kill(); - break; - } - Wheel = proj; Dashing = true; DashStart = Owner.Center; @@ -122,26 +114,27 @@ namespace CalamityMod.Projectiles.Melee if (PolarStar == null) { - PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale, 2, 0.05f, 5f, true); + PolarStar = new GenericSparkle(Owner.Center + direction, Vector2.Zero, Color.White, Color.DodgerBlue, Projectile.scale, 2, 0.05f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); } else { PolarStar.Time = 0; PolarStar.Position = Owner.Center + direction * 46 * Projectile.scale; - PolarStar.Rotation += (1 + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)) * 0.02f; + PolarStar.Color = ShredRatio > 0.75 ? Color.Lerp(Color.White, Color.CornflowerBlue, Utils.Remap(ShredRatio, 0.75f, 0.85f, 0f, 1f)) : Color.White; + PolarStar.Rotation += (1 + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)) * (ShredRatio > 0.85 ? 0.03f : 0.02f); PolarStar.Scale = Projectile.scale * 2f; } if (Main.rand.NextBool()) { Vector2 smokeSpeed = direction.RotatedByRandom(MathHelper.PiOver4 * 0.3f) * Main.rand.NextFloat(10f, 30f) * (ShredRatio * 0.5f + 1f); - Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, false, 0, true); + Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.5f, 1f) * (ShredRatio * 0.5f + 1f), 0.6f, 0, false, 0); GeneralParticleHandler.SpawnParticle(smoke); - if (Main.rand.NextBool(3)) + if (Main.rand.NextBool(3) && ShredRatio > 0.85) { - Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Main.hslToRgb(0.55f, 1, 0.5f + 0.2f * ShredRatio), 20, Main.rand.NextFloat(0.4f, 0.7f) * (ShredRatio * 0.5f + 1f), 0.8f, 0, true, 0.01f, true); + Particle smokeGlow = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Owner.velocity, Main.hslToRgb(0.55f, 1, 0.5f + 0.2f * ShredRatio), 20, Main.rand.NextFloat(0.4f, 0.7f) * (ShredRatio * 0.5f + 1f), 0.6f, 0, true, 0.01f); GeneralParticleHandler.SpawnParticle(smokeGlow); } } @@ -161,7 +154,7 @@ namespace CalamityMod.Projectiles.Melee //Scaling based on shred Projectile.localNPCHitCooldown = FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - (int)(MathHelper.Lerp(0, FourSeasonsGalaxia.PolarisAttunement_LocalIFrames - FourSeasonsGalaxia.PolarisAttunement_LocalIFramesCharged, ShredRatio)); //Increase the hit frequency - Projectile.scale = 1f + (ShredRatio * 1f); //SWAGGER + Projectile.scale = 1f + (ShredRatio * 1.5f); //SWAGGER if ((Wheel == null || !Wheel.active) && Dashing) @@ -172,14 +165,6 @@ namespace CalamityMod.Projectiles.Melee if (Owner.whoAmI == Main.myPlayer) { - int blastDamage = Owner.CalcIntDamage(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage); - for (int i = 0; i < 5; i++) - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Main.rand.NextVector2CircularEdge(15, 15), ProjectileType(), blastDamage, 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.02f); - blast.timeLeft = 100; - } - - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center - DashStart / 2f, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_SlashDamageBoost), 0, Owner.whoAmI); if (proj.ModProjectile is PolarisGazeDash dash) { @@ -214,21 +199,6 @@ namespace CalamityMod.Projectiles.Melee Owner.itemTime = 2; Owner.itemAnimation = 2; - //Play a sound when the blade throw is available - if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) - { - if (ChargeSoundCooldown <= 0) - { - SoundEngine.PlaySound(SoundID.DD2_BookStaffCast with { Volume = SoundID.DD2_BookStaffCast.Volume * 2.5f }); - ChargeSoundCooldown = 20; - } - } - else - { - ChargeSoundCooldown--; - } - - Shred += FourSeasonsGalaxia.PolarisAttunement_ShredChargeupGain; HitChargeCooldown--; Projectile.timeLeft = 2; @@ -239,7 +209,7 @@ namespace CalamityMod.Projectiles.Melee { float maxMultiplier = FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage / (float)FourSeasonsGalaxia.PolarisAttunement_BaseDamage; float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes + // Adjust the damage to make it constant based on the local iframes float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; modifiers.SourceDamage *= damageMultiplier * damageReduction; @@ -249,14 +219,12 @@ namespace CalamityMod.Projectiles.Melee { float maxMultiplier = FourSeasonsGalaxia.PolarisAttunement_FullChargeDamage / (float)FourSeasonsGalaxia.PolarisAttunement_BaseDamage; float damageMultiplier = MathHelper.Lerp(1f, maxMultiplier, ShredRatio); - //Adjust the damage to make it constant based on the local iframes + // Adjust the damage to make it constant based on the local iframes float damageReduction = Projectile.localNPCHitCooldown / (float)FourSeasonsGalaxia.PolarisAttunement_LocalIFrames; modifiers.SourceDamage *= damageMultiplier * damageReduction; } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => ShredTarget(); public override void OnHitPlayer(Player target, Player.HurtInfo info) => ShredTarget(); @@ -269,10 +237,8 @@ namespace CalamityMod.Projectiles.Melee // get lifted up if (HitChargeCooldown <= 0) { - SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); //Sizzle - Shred += 80; //Augment the shredspeed - if (Owner.velocity.Y > 0) - Owner.velocity.Y = -2f; //Get "stuck" into the enemy partly + SoundEngine.PlaySound(SoundID.NPCHit30, Projectile.Center); // Sizzle + Shred += 80; // Augment the shredspeed // 17APR2024: Ozzatron: Galaxia's pogo gives iframes when striking enemies in a similar manner to a bonk dash. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. @@ -287,7 +253,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.NPCHit43, Projectile.Center); if (ShredRatio > 0.85 && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, direction * 36f, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), (int)(Projectile.damage * FourSeasonsGalaxia.PolarisAttunement_ShotDamageBoost), Projectile.knockBack, Owner.whoAmI, Shred); } if (Dashing) { diff --git a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs index aa04d60b0b..8d25d0320a 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeDash.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeDash.cs @@ -19,9 +19,6 @@ namespace CalamityMod.Projectiles.Melee public Vector2 DashStart; public Vector2 DashEnd; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -52,21 +49,10 @@ namespace CalamityMod.Projectiles.Melee Particle Spark = new CritSpark(target.Center, sparkSpeed, Color.White, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); GeneralParticleHandler.SpawnParticle(Spark); } - - //Explode into cosmic bolts - int blastDamage = Owner.CalcIntDamage(FourSeasonsGalaxia.PolarisAttunement_SlashBoltsDamage); - for (int i = 0; i < 3; i++) - { - Projectile blast = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(target.Center, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4) * 30f, ProjectileType(), blastDamage, 0f, Owner.whoAmI, 0.55f, MathHelper.Pi * 0.01f); - blast.timeLeft = 100; - } } - - - public override bool PreDraw(ref Color lightColor) //OMw to reuse way too much code from the entangling vines + public override bool PreDraw(ref Color lightColor) // omw to reuse way too much code from the entangling vines { - Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); @@ -84,7 +70,7 @@ namespace CalamityMod.Projectiles.Melee Texture2D sparkTexture = Request("CalamityMod/Particles/ThinSparkle").Value; Texture2D bloomTexture = Request("CalamityMod/Particles/BloomCircle").Value; - //Ajust the bloom's texture to be the same size as the star's + // Adjust the bloom's texture to be the same size as the star's float properBloomSize = (float)sparkTexture.Width / (float)bloomTexture.Height; @@ -93,7 +79,7 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(bloomTexture, DashEnd - Main.screenPosition, null, Color.CornflowerBlue * bump * 0.5f, 0, bloomTexture.Size() / 2f, bump * 6f * properBloomSize, SpriteEffects.None, 0); Main.EntitySpriteDraw(sparkTexture, DashEnd - Main.screenPosition, frame, Color.Lerp(Color.White, Color.CornflowerBlue, raise) * bump, raise * MathHelper.TwoPi, frame.Size() / 2f, bump * 3f, SpriteEffects.None, 0); - //Back to normal + // 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; diff --git a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs index 584d675012..5ff1873c7e 100644 --- a/Projectiles/Melee/Galaxia_PolarisGazeStar.cs +++ b/Projectiles/Melee/Galaxia_PolarisGazeStar.cs @@ -21,34 +21,24 @@ namespace CalamityMod.Projectiles.Melee public Player Owner => Main.player[Projectile.owner]; public float Timer => MaxTime - Projectile.timeLeft; + public const int MaxTime = 120; - public const float MaxTime = 120; + public Particle PolarStar; // Using a particle on top of it since the smoke particles would otherwise go over it - public Particle PolarStar; //Using a particle ontop of it since the smoke particles would otherwise go over it - - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; Projectile.width = Projectile.height = 45; - Projectile.tileCollide = true; + Projectile.tileCollide = false; Projectile.ignoreWater = true; Projectile.friendly = true; Projectile.penetrate = -1; - Projectile.extraUpdates = 3; - + Projectile.MaxUpdates = 4; + Projectile.timeLeft = MaxTime; Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 60; + Projectile.localNPCHitCooldown = 15 * Projectile.MaxUpdates; } - public override bool OnTileCollide(Vector2 oldVelocity) - { - Projectile.velocity *= 0.95f; - return false; - } public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -69,23 +59,17 @@ namespace CalamityMod.Projectiles.Melee direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); direction.Normalize(); Projectile.rotation = direction.ToRotation(); - - Projectile.timeLeft = (int)MaxTime; - Projectile.velocity = direction * 16f; - Projectile.scale = 1f + ShredRatio; //SWAGGER Projectile.netUpdate = true; - } - Projectile.velocity *= 0.96f; - Projectile.position += Projectile.velocity; - - if (PolarStar == null) { PolarStar = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.CornflowerBlue, Projectile.scale * 2f, 2, 0.1f, 5f, true); GeneralParticleHandler.SpawnParticle(PolarStar); + + CustomPulse poof = new(Projectile.Center, Vector2.Zero, Color.Indigo, "CalamityMod/Particles/SoftRoundExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.1f, 0.2f, 10); + GeneralParticleHandler.SpawnParticle(poof); } else { @@ -94,7 +78,6 @@ namespace CalamityMod.Projectiles.Melee PolarStar.Scale = Projectile.scale * 2f; } - Vector2 smokeSpeed = Main.rand.NextVector2Circular(10f, 10f); Particle smoke = new HeavySmokeParticle(Projectile.Center, smokeSpeed + Projectile.velocity / 2, Color.Lerp(Color.Purple, Color.Indigo, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 6f)), 30, Main.rand.NextFloat(0.6f, 1.2f), 0.8f, 0, false, 0, true); GeneralParticleHandler.SpawnParticle(smoke); @@ -105,6 +88,13 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(smokeGlow); } + if (Timer % (MaxTime / 6) == 0 && Main.myPlayer == Projectile.owner) + { + Vector2 starVel = Vector2.UnitY.RotatedByRandom(MathHelper.Pi) * 25f; + Projectile star = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, starVel, ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner, 1f, MathHelper.Pi / 20f); + if (star.ModProjectile is GalaxiaBolt bolt) + bolt.StrongerHoming = true; + } } public override bool PreDraw(ref Color lightColor) @@ -145,6 +135,5 @@ namespace CalamityMod.Projectiles.Melee } } } - } } diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs deleted file mode 100644 index 4b8122c972..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.cs +++ /dev/null @@ -1,314 +0,0 @@ -using System; -using System.IO; -using CalamityMod.Items.Weapons.Melee; -using CalamityMod.Particles; -using CalamityMod.Projectiles.Boss; -using CalamityMod.Tiles.Astral; -using Microsoft.Xna.Framework; -using Microsoft.Xna.Framework.Graphics; -using Terraria; -using Terraria.Audio; -using Terraria.Graphics.Shaders; -using Terraria.ID; -using Terraria.ModLoader; -using static CalamityMod.CalamityUtils; -using static Terraria.ModLoader.ModContent; - -namespace CalamityMod.Projectiles.Melee -{ - public class ExtantAbhorrence : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence"; - private bool initialized = false; - Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[Projectile.owner]; - public ref float Charge => ref Projectile.ai[0]; //Charge - public ref float State => ref Projectile.ai[1]; //State 0 is "charging", State 1 is "thrusting" - public ref float CurrentIndicator => ref Projectile.localAI[0]; //What "indicator" stage are you on. - public ref float OverCharge => ref Projectile.localAI[1]; - - const float MaxCharge = 500; - - public Vector2 lastDisplacement; - public float dashDuration; - - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 70; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.extraUpdates = 1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 16; - } - - public override bool? CanDamage() - { - return (State == 1); - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - float bladeLength = 120 * Projectile.scale; - float bladeWidth = 20 * Projectile.scale; - - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center, Owner.Center + (direction * bladeLength), bladeWidth, ref collisionPoint); - } - - public CurveSegment QuickOut = new CurveSegment(EasingType.PolyIn, 0f, 0f, 0.2f, 3); - public CurveSegment Bump = new CurveSegment(EasingType.SineBump, 0.06f, 0.2f, 0.1f); - public CurveSegment QuickDraw = new CurveSegment(EasingType.Linear, 0.25f, 0.2f, -0.45f); - public CurveSegment SlowDrawOut = new CurveSegment(EasingType.PolyIn, 0.50f, -0.25f, -0.2f, 3); - public CurveSegment OverShoot = new CurveSegment(EasingType.SineBump, 0.93f, -0.45f, -0.1f); - - internal float ChargeDisplacement() => PiecewiseAnimation(Charge / MaxCharge, new CurveSegment[] { QuickOut, Bump, QuickDraw, SlowDrawOut, OverShoot }); - - public override void AI() - { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao - { - Projectile.velocity = Vector2.Zero; - SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); - initialized = true; - } - - if (Owner.CantUseHoldout()) - { - if (State == 0f) - { - if (Charge / MaxCharge < 0.25f) - { - SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); - Projectile.Kill(); - return; - } - else - { - - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); - State = 1f; - Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death - dashDuration = Projectile.timeLeft; - lastDisplacement = Projectile.Center - Owner.Center; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - } - } - - if (State == 0f) - { - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - direction.Normalize(); - Projectile.Center = Owner.Center + (direction * 70f * ChargeDisplacement()); - - Charge++; - OverCharge--; - Projectile.timeLeft = 2; - - if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f)) - { - SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = DeusRitualDrama.PulseSound.Pitch - 0.2f + 0.1f * CurrentIndicator }, Projectile.Center); - CurrentIndicator++; - OverCharge = 20f; - } - - if (Charge >= MaxCharge) - { - Charge = MaxCharge; - if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) - { - OverCharge = 20f; - SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); - CurrentIndicator++; - } - } - } - - if (State == 1f) - { - Projectile.Center = Owner.Center + Vector2.Lerp(lastDisplacement, direction * 40f, MathHelper.Clamp(((dashDuration - Projectile.timeLeft) / dashDuration) * 2f, 0f, 1f)); - Owner.fallStart = (int)(Owner.position.Y / 16f); - - Owner.Calamity().LungingDown = true; - - if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) - { - SlamDown(); - Projectile.timeLeft = 0; - Owner.Calamity().LungingDown = false; - Projectile.active = false; - Projectile.netUpdate = true; - Projectile.netSpam = 0; - } - - Owner.velocity = direction * 30f; - - float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); - float strength = (float)Math.Sin(variation * 2f + MathHelper.PiOver2); - Particle Sparkle = new CritSpark(Projectile.Center, Owner.velocity - direction.RotatedBy(variation) * (1 + strength) * 2f * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - } - - Lighting.AddLight(Projectile.Center, new Vector3(1f, 0.56f, 0.56f) * Charge / MaxCharge); - - //Manage position and rotation - Projectile.rotation = direction.ToRotation(); - - //Scaling based on charge - Projectile.scale = 1f + (Charge / MaxCharge * 0.3f); - - Owner.ChangeDir(Math.Sign(direction.X)); - Owner.itemRotation = direction.ToRotation(); - - if (Owner.direction != 1) - { - Owner.itemRotation -= MathHelper.Pi; - } - - Owner.itemRotation = MathHelper.WrapAngle(Owner.itemRotation); - Owner.itemTime = 2; - Owner.itemAnimation = 2; - } - - public void SlamDown() - { - var slamSound = SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - - if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) - return; - - if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 5) - Main.LocalPlayer.Calamity().GeneralScreenShakePower = 5; - - //Only create the central monolith if over half charge - if (Charge / MaxCharge < 0.5f) - return; - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); - - //Only create the side monoliths if over 3/4th charge - if (Charge / MaxCharge < 0.75f) - return; - - if (SideSprouts(1, 150f, 0.8f) && Charge >= MaxCharge) - SideSprouts(1, 250f, 0.5f); - - if (SideSprouts(-1, 150f, 0.8f) && Charge >= MaxCharge) - SideSprouts(-1, 250f, 0.5f); - - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * TrueBiomeBlade.AstralAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is ExtantAbhorrenceMonolith monolith) - monolith.WaitTimer = (1 - projSize) * 34f; - } - - return validPositionFound; - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - // 17APR2024: Ozzatron: Biome Blade's astral slam gives iframes when striking enemies in a similar manner to a ram dash. - // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. - Owner.GiveUniversalIFrames(TrueBiomeBlade.AstralAttunement_DashHitIFrames); - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - modifiers.SourceDamage *= 1f + TrueBiomeBlade.AstralAttunement_FullChargeBoost * (float)Math.Pow(Charge / MaxCharge, 2); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D handle = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence").Value; - - float drawAngle = direction.ToRotation(); - float drawRotation = drawAngle + MathHelper.PiOver4; - - Vector2 drawOrigin = new Vector2(0f, handle.Height); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(handle, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 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); - - //Just in case - if (OverCharge < 0) - OverCharge = 0f; - //When the blink is - GameShaders.Misc["CalamityMod:BasicTint"].UseOpacity(OverCharge / 20f); - GameShaders.Misc["CalamityMod:BasicTint"].UseColor(new Color(154, 244, 240)); - GameShaders.Misc["CalamityMod:BasicTint"].Apply(); - - //Update the parameters - drawOrigin = new Vector2(0f, blade.Height); - - Main.EntitySpriteDraw(blade, drawOffset, null, Color.Lerp(Color.White, lightColor, 0.5f) * 0.9f, drawRotation, drawOrigin, Projectile.scale, 0f, 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; - } - - 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 void SendExtraAI(BinaryWriter writer) - { - writer.Write(initialized); - writer.WriteVector2(direction); - writer.Write(CurrentIndicator); - writer.WriteVector2(lastDisplacement); - writer.Write(dashDuration); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - initialized = reader.ReadBoolean(); - direction = reader.ReadVector2(); - CurrentIndicator = reader.ReadSingle(); - lastDisplacement = reader.ReadVector2(); - dashDuration = reader.ReadSingle(); - } - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png b/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png deleted file mode 100644 index 4ec0fdebc3..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrence.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs deleted file mode 100644 index 1f8259d861..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -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 GestureForTheDrowned : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Items/Weapons/Melee/TrueBiomeBlade"; - Vector2 direction = Vector2.Zero; - public Player Owner => Main.player[Projectile.owner]; - public float Timer => 40 - Projectile.timeLeft; - public float HalfTimer => (Timer % 20); - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 32; - Projectile.friendly = true; - Projectile.penetrate = 1; - Projectile.timeLeft = 40; - Projectile.DamageType = DamageClass.Melee; - Projectile.tileCollide = false; - } - - public override bool? CanDamage() => false; - - public override void AI() - { - if (Math.Abs(HalfTimer / 20f) == 0.5f) - { - SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f }, Projectile.Center); - - if (Owner.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, direction * 0.1f + Owner.velocity, ProjectileType(), Projectile.damage, 0, Owner.whoAmI); - } - - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.CornflowerBlue : Color.DodgerBlue, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - - } - - - direction = Vector2.UnitY.RotatedBy((MathHelper.PiOver4 + Utils.AngleLerp(0f, MathHelper.PiOver4 * 1.5f, HalfTimer / 20f)) * Math.Sign(Timer - 1 - 20f)) * (float)Math.Sin(HalfTimer / 20f * MathHelper.Pi) * 30; - Owner.ChangeDir(Math.Sign(direction.X)); - Owner.itemRotation = direction.ToRotation(); - if (Owner.direction != 1) - { - Owner.itemRotation -= MathHelper.Pi; - } - - Projectile.Center = Owner.Center + direction; - Projectile.rotation = direction.ToRotation() + MathHelper.PiOver2; - Projectile.spriteDirection = Math.Sign(Timer - 20f); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D blade = Request("CalamityMod/Items/Weapons/Melee/TrueBiomeBlade").Value; - - float drawAngle = direction.ToRotation(); - float drawRotation = drawAngle + MathHelper.PiOver4; - Vector2 drawOrigin = new Vector2(0f, blade.Height); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(blade, drawOffset, null, lightColor, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - return false; - } - - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png deleted file mode 100644 index 0454d6961e..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png deleted file mode 100644 index 30a5b3e99e..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs deleted file mode 100644 index ac906d11f8..0000000000 --- a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedOrb.cs +++ /dev/null @@ -1,302 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -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 GestureForTheDrownedOrb : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned"; - public Player Owner => Main.player[Projectile.owner]; - public ref float HasLanded => ref Projectile.ai[0]; //Is the orb in the air or is it on the ground? - public ref float TimeSinceLanding => ref Projectile.ai[1]; //How long has it been on the ground for - public float Timer => MaxTime - Projectile.timeLeft; - public const float MaxTime = 160f; - public float groundOffset; - public bool BounceX => Projectile.oldPosition.X == Projectile.position.X; - - public bool WaterMode = false; - - public float scaleX => 1 + 0.2f * (1f + -(float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f; - public float scaleY => (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); - - public override void SetStaticDefaults() - { - - ProjectileID.Sets.TrailCacheLength[Type] = 5; - ProjectileID.Sets.TrailingMode[Type] = 2; - Main.projFrames[Type] = 3; - } - - public override void SetDefaults() - { - Projectile.width = Projectile.height = 26; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.timeLeft = (int)MaxTime; - Projectile.DamageType = DamageClass.Melee; - Projectile.alpha = 90; - Projectile.ignoreWater = true; - Projectile.hide = true; - } - - public override bool OnTileCollide(Vector2 oldVelocity) - { - if (WaterMode) - { - return true; - } - HasLanded = 1f; - Projectile.velocity.Y = -4f; - return false; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - if (TimeSinceLanding < 10 && !WaterMode) - return base.Colliding(projHitbox, targetHitbox); - float collisionPoint = 0f; - if (!WaterMode) - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Bottom, Projectile.Bottom - (Vector2.UnitY * scaleY * 110), scaleX * 40, ref collisionPoint); - - float halfLength = 66f * Projectile.scale; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center + Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, Projectile.Center - Utils.SafeNormalize(Projectile.velocity.RotatedBy(MathHelper.PiOver2), Vector2.Zero) * halfLength, 40f, ref collisionPoint); - } - - public override void DrawBehind(int index, List behindNPCsAndTiles, List behindNPCs, List behindProjectiles, List overPlayers, List overWiresUI) - { - behindNPCsAndTiles.Add(index); - } - - public override void AI() - { - if (Collision.WetCollision(Projectile.position, Projectile.width, Projectile.height)) - { - WaterMode = true; - Projectile.velocity.Y *= 0.33f; - } - else if (WaterMode) - { - Projectile.Kill(); - } - - if (WaterMode) - { - Projectile.velocity *= 1.02f; - Projectile.scale *= 1.01f; - Projectile.timeLeft--; - - for (int i = 0; i <= 4; i++) - { - Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; - waterTrail.fadeIn = 3f; - } - - Dust foamDust = Main.dust[Dust.NewDust(Projectile.Center + Main.rand.NextVector2Circular(10f, 10f), 9, 0, DustID.Cloud, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; - foamDust.noGravity = true; - - if (Main.rand.NextBool()) - { - float angle = Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2); - float distance = 10f + 50 * Math.Abs(angle) / MathHelper.PiOver2 * Projectile.scale; - Vector2 sparkSpeed = -Projectile.velocity; - Particle Spark = new CritSpark(Projectile.Center + Vector2.Normalize(Projectile.velocity.RotatedBy(angle)) * distance, sparkSpeed, Color.SkyBlue, Color.CornflowerBlue, 1f + Main.rand.NextFloat(0, 1f), 30, 0.4f, 0.6f); - GeneralParticleHandler.SpawnParticle(Spark); - } - return; - } - - if (HasLanded == 1f) - { - TimeSinceLanding++; - - groundOffset = -1; - //Check 7 tiles under the projectile for solid ground - for (float i = 0; i < 7; i += 0.5f) - { - Vector2 positionToCheck = Projectile.position; - if (Main.tile[(int)(positionToCheck.X / 16), (int)((positionToCheck.Y / 16) + 1 * i)].IsTileSolidGround() && groundOffset == -1) - { - groundOffset = i * 16; - break; - } - } - //If no ground has been found, go back to the airborne state - if (groundOffset == -1) - { - HasLanded = 0f; - TimeSinceLanding = 0f; - } - - if (TimeSinceLanding > 10) - { - //Trailing water!! Dust spam!!! - Dust waterTrail = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; - waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(Projectile.TopRight + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; - waterTrail.fadeIn = 3f; - waterTrail = Main.dust[Dust.NewDust(Projectile.TopLeft + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(16f, 16f) + Vector2.UnitX * Projectile.velocity.X * 4f, 23, 0, DustID.Water, -3.7f * Math.Sign(Projectile.velocity.X), -6f, 0, new Color(255, 255, 255), Main.rand.NextFloat(1f, 3f))]; - waterTrail.fadeIn = 3f; - - - Dust foamDust = Main.dust[Dust.NewDust(Projectile.Top + Vector2.UnitY * groundOffset + Vector2.UnitX * 16 * Math.Sign(Projectile.velocity.X), 9, 0, DustID.Cloud, 2.7f * Math.Sign(Projectile.velocity.X), -3f, 0, new Color(255, 255, 255), 1.4f)]; - foamDust.noGravity = true; - - //Foam - float height = scaleY * 100f; - Vector2 origin = Projectile.Top + Vector2.UnitY * groundOffset + Main.rand.NextVector2Circular(Projectile.width / 4f, Projectile.height / 4f) - (Vector2.UnitY * height); - Particle foamSmall = new FakeGlowDust(origin, Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(1f, 2f), 25, 0.1f, bigSize: true, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); - GeneralParticleHandler.SpawnParticle(foamSmall); - - if (Main.rand.NextBool(5)) - { - Particle foamLarge = new MediumMistParticle(origin, Projectile.velocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); - GeneralParticleHandler.SpawnParticle(foamLarge); - } - } - } - - else - { - Particle foamSmall = new FakeGlowDust(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Color.LightSlateGray, Main.rand.NextFloat(0.2f, 2f), 25, 0.1f, gravity: (-Projectile.velocity + Vector2.UnitY) * 0.1f); - GeneralParticleHandler.SpawnParticle(foamSmall); - - if (Main.rand.NextBool()) - { - Particle blob = new WaterGlobParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width / 2f, Projectile.height / 2f), Projectile.velocity / 2f, Main.rand.NextFloat(0.2f, 2f), 0.1f); - GeneralParticleHandler.SpawnParticle(blob); - } - - } - - Projectile.rotation += 0.1f * ((Projectile.velocity.X > 0) ? 1f : -1f); - - - if (Projectile.velocity.Y < 15f) - { - Projectile.velocity.Y += 0.3f; - } - - if (Math.Abs(Projectile.velocity.X) < 8) - { - Projectile.velocity.X += 0.3f * ((Projectile.velocity.X > 0) ? 1f : -1f); - } - else - { - Projectile.velocity.X = Math.Sign(Projectile.velocity.X) * 8; - } - - if (BounceX) - { - //Die lmao - Projectile.Kill(); - } - - Projectile.frameCounter++; - if (Projectile.frameCounter % 6 == 0) - Projectile.frame = (Projectile.frame + 1) % 3; - } - - public override void OnKill(int timeLeft) - { - SoundEngine.PlaySound(SoundID.Splash with { PitchVariance = 2f }, Projectile.Center); - - for (int i = 0; i < 4; i++) - { - Particle foamLarge = new MediumMistParticle(Projectile.Center + Main.rand.NextVector2Circular(Projectile.width, Projectile.height), Projectile.oldVelocity / 2f, Color.LightSlateGray, Color.LightBlue, Main.rand.NextFloat(1f, 2f), 245 - Main.rand.Next(50), 0.1f); - GeneralParticleHandler.SpawnParticle(foamLarge); - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (WaterMode) - modifiers.SourceDamage *= TrueBiomeBlade.MarineAttunement_InWaterDamageMultiplier; - } - - public override bool PreDraw(ref Color lightColor) - { - if (BounceX) - return false; - - if (WaterMode) - { - Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedAquaWave").Value; - float drawRotation = Projectile.velocity.ToRotation() + MathHelper.Pi; - Vector2 drawOrigin = new Vector2(wave.Width / 2f, wave.Height / 2f); - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(wave, drawOffset - Projectile.velocity, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.2f, drawRotation, drawOrigin, Projectile.scale - 0.2f, 0f, 0); - Main.EntitySpriteDraw(wave, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.5f) * 0.5f, drawRotation, drawOrigin, Projectile.scale, 0f, 0); - return false; - } - - - if (HasLanded == 1f && TimeSinceLanding > 10f) - { - Texture2D wave = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave").Value; - Rectangle frame = new Rectangle(0, 0 + 110 * Projectile.frame, 40, 110); - - float drawRotation = 0f; - Vector2 drawOrigin = new Vector2(0f, frame.Height); - - - Vector2 drawOffset; - - //Wobble - Vector2 Scale; - - SpriteEffects flip = Projectile.velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; - - for (int i = 2; i >= 0; i--) - { - drawOffset = Projectile.position + Vector2.UnitY * groundOffset + Vector2.UnitY / 2f - Main.screenPosition; - drawOffset -= Vector2.UnitX * 10f * i * Math.Sign(Projectile.velocity.X); - float ScaleYAlter = (1 + 0.4f * (1f + (float)Math.Sin((TimeSinceLanding - 10f) * 0.1f + 0.2 * i)) * 0.5f) * MathHelper.Clamp((TimeSinceLanding - 10) / 30f, 0f, 1f) * MathHelper.Clamp(Projectile.timeLeft / 30f, 0f, 1f); - Scale = new Vector2(scaleX, ScaleYAlter - 0.05f * i); - float slightfade = 1f - 0.24f * i; - Color darkenedColor = Color.Lerp(lightColor, Color.Black, i * 0.15f); - - Main.EntitySpriteDraw(wave, drawOffset, frame, darkenedColor * MathHelper.Clamp(TimeSinceLanding / 30f, 0f, 1f) * slightfade, drawRotation, drawOrigin, Scale, flip, 0); - } - - - - return false; - } - - else - { - Texture2D ball = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrowned").Value; - float drawRotation = Projectile.rotation; - Vector2 drawOrigin = Projectile.Size / 2f; - Vector2 drawOffset = Projectile.Center - Main.screenPosition; - - Main.EntitySpriteDraw(ball, drawOffset, null, lightColor * MathHelper.Clamp(1 - TimeSinceLanding / 10f, 0f, 1f), drawRotation, drawOrigin, Projectile.scale, 0f, 0); - - return false; - } - - } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaterMode); - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaterMode = reader.ReadBoolean(); - } - - } -} diff --git a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png b/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png deleted file mode 100644 index db336bf69b..0000000000 Binary files a/Projectiles/Melee/MendedBiomeBlade_GestureForTheDrownedWave.png and /dev/null differ diff --git a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs index a32d83e3b2..45316abda7 100644 --- a/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMight.cs @@ -2,6 +2,8 @@ using System.IO; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -100,8 +102,7 @@ namespace CalamityMod.Projectiles.Melee SoundEngine.PlaySound(SoundID.Item80, Projectile.Center); // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -123,12 +124,6 @@ namespace CalamityMod.Projectiles.Melee { if (Owner.whoAmI == Main.myPlayer) { - if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) - { - hasMadeChargeSound = 1f; - SoundEngine.PlaySound(SoundID.Item76); - } - float rotation = direction.ToRotation(); if (rotation > -MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < -MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 1f) hasMadeSound = 0f; @@ -140,6 +135,22 @@ namespace CalamityMod.Projectiles.Melee } } + if (Empowerment / maxEmpowerment >= 0.5f && hasMadeChargeSound == 0f) + { + SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = -0.05f }, Projectile.Center); + hasMadeChargeSound++; + } + + if (Empowerment >= maxEmpowerment) + { + Empowerment = Empowerment; + if (Owner.whoAmI == Main.myPlayer && hasMadeChargeSound < 2f) + { + SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + hasMadeChargeSound++; + } + } + if (Empowerment / maxEmpowerment >= 0.75) { if (smear == null) @@ -154,7 +165,7 @@ namespace CalamityMod.Projectiles.Melee smear.Time = 0; smear.Position = Owner.Center; smear.Scale = Projectile.scale * 1.5f; - smear.Color = Color.Lerp(Color.HotPink, Color.Cyan, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); + smear.Color = Color.Lerp(Color.HotPink, Color.Purple, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); } } @@ -192,6 +203,19 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + // Spawn a monolith on max power sword throws + if (!(CurrentState == 1f && !CalamityUtils.AnyProjectiles(ProjectileType()))) + return; + + if (Empowerment >= maxEmpowerment) + { + 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) { if (CurrentState == 1f) @@ -227,7 +251,7 @@ namespace CalamityMod.Projectiles.Melee Main.spriteBatch.Draw(handle, drawOffset, null, color * MathHelper.Lerp(0f, 0.5f, MathHelper.Clamp(Empowerment / maxEmpowerment - 0.4f / 0.1f, 0f, 1f)), afterimageRotation, drawOrigin, Projectile.scale - 0.2f * ((i / (float)Projectile.oldRot.Length)), 0f, 0f); } - Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes + Main.spriteBatch.End(); //Yippee spritebatch resetting wahoo Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Vector2 afterimageDrawOrigin = new Vector2(0f, blade.Height); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs similarity index 52% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs index 6d758d21ed..d2ada56839 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.cs +++ b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.IO; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; @@ -14,17 +13,15 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTidesMonolith : ModProjectile, ILocalizedModType + public class HeavensMonolith : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith"; + 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 Size => ref Projectile.ai[1]; //Yes - public float WaitTimer; //How long until the monoliths appears - 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 Scale => ref Projectile.ai[1]; public const float BaseWidth = 90f; public const float BaseHeight = 420f; @@ -33,17 +30,14 @@ namespace CalamityMod.Projectiles.Melee public CurveSegment GoNormal = new CurveSegment(EasingType.CircIn, 0.4f, 1.2f, -0.2f); public CurveSegment StayNormal = new CurveSegment(EasingType.Linear, 0.5f, 1f, 0f); - internal float Width() => PiecewiseAnimation(Timer, new CurveSegment[] { StaySmall, GoBig, GoNormal, StayNormal }) * BaseWidth * Size; + internal float Width() => PiecewiseAnimation(Timer, new CurveSegment[] { StaySmall, GoBig, GoNormal, StayNormal }) * BaseWidth; public CurveSegment Anticipate = new CurveSegment(EasingType.CircIn, 0f, 0f, 0.15f); public CurveSegment Overextend = new CurveSegment(EasingType.SineOut, 0.2f, 0.15f, 1f); public CurveSegment Unextend = new CurveSegment(EasingType.CircIn, 0.25f, 1.15f, -0.15f); 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; + internal float Height() => PiecewiseAnimation(Timer, new CurveSegment[] { Anticipate, Overextend, Unextend, Hold }) * BaseHeight; - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -52,11 +46,12 @@ 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; } - public override bool? CanDamage() => WaitTimer <= 0; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -70,37 +65,28 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (Projectile.velocity != Vector2.Zero) - { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity = Vector2.Zero; - } - - if (WaitTimer > 0) - { - Projectile.timeLeft = 102; - WaitTimer--; - } - if (Projectile.timeLeft == 100) { - if (Size >= 1) //Big monoliths create sparkles even before sprouting up - { + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; - for (int i = 0; i < 20; i++) - { - Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); - GeneralParticleHandler.SpawnParticle(Sparkle); - } - } - - if (Size * 0.8 > 0.4 && Facing != 0) + for (int i = 0; i < 20; i++) { - SideSprouts(Facing, 150f, Size * 0.8f); + Particle Sparkle = new CritSpark(Projectile.Center, Main.rand.NextVector2Circular(1f, 1f) * Main.rand.NextFloat(7.5f, 20f), Color.White, Main.rand.NextBool() ? Color.MediumTurquoise : Color.DarkOrange, 0.1f + Main.rand.NextFloat(0f, 1.5f), 20 + Main.rand.Next(30), 1, 3f); + GeneralParticleHandler.SpawnParticle(Sparkle); } } + // 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(); @@ -110,7 +96,7 @@ namespace CalamityMod.Projectiles.Melee { Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(0f, 10f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver2, MathHelper.PiOver2)) * Main.rand.NextFloat(5f, 15f); - Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f) * Size, 165 - Main.rand.Next(30), 0.1f); + Particle smoke = new SmallSmokeParticle(Projectile.Center + hitPositionDisplace, flyDirection, Color.Lerp(Color.DarkOrange, Color.MediumTurquoise, Main.rand.NextFloat()), new Color(130, 130, 130), Main.rand.NextFloat(2.8f, 3.6f), 165 - Main.rand.Next(30), 0.1f); GeneralParticleHandler.SpawnParticle(smoke); } for (int i = 0; i < 6; i++) @@ -118,104 +104,37 @@ namespace CalamityMod.Projectiles.Melee Vector2 hitPositionDisplace = particleDirection.RotatedBy(MathHelper.PiOver2) * Main.rand.NextFloat(10f, 30f); Vector2 flyDirection = particleDirection.RotatedBy(Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4)); - Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)) * Size, 30 + Main.rand.Next(50), 0.1f); + Particle Rock = new StoneDebrisParticle(Projectile.Center + hitPositionDisplace * 3, flyDirection * Main.rand.NextFloat(3f, 6f), Color.Lerp(Color.DarkSlateBlue, Color.LightSlateGray, Main.rand.NextFloat()), (1f + Main.rand.NextFloat(0f, 2.4f)), 30 + Main.rand.Next(50), 0.1f); GeneralParticleHandler.SpawnParticle(Rock); } } } - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() - { - for (float i = 0; i < 40; i += 0.5f) - { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } - } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) - { - Vector2 positionToCheck = Projectile.Center + OriginDirection.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } - } - - if (validPositionFound) - { - Vector2 projPosition = Projectile.Center + OriginDirection.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = OriginDirection.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), Projectile.damage, 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is MercurialTidesMonolith monolith) - { - monolith.WaitTimer = (float)Math.Sqrt(1.0 - Math.Pow(projSize - 1.0, 2)) * 3f; - monolith.OriginDirection = OriginDirection; - monolith.Facing = facing; - } - } - - return validPositionFound; - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_MonolithProc) - sword.OnHitProc = true; - - if (Projectile.numHits > 0) - modifiers.SourceDamage *= OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageFalloff; - } - public override bool PreDraw(ref Color lightColor) { - if (WaitTimer > 0) - return false; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith").Value; - - Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith").Value; 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); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); + Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } public override void PostDraw(Color lightColor) { - if (WaitTimer > 0) - return; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow").Value; 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); @@ -223,19 +142,5 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } - - public override void SendExtraAI(BinaryWriter writer) - { - writer.Write(WaitTimer); - writer.Write(Facing); - writer.WriteVector2(OriginDirection); - - } - public override void ReceiveExtraAI(BinaryReader reader) - { - WaitTimer = reader.ReadSingle(); - Facing = reader.ReadSingle(); - OriginDirection = reader.ReadVector2(); - } } } diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.png b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.png similarity index 100% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.png rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith.png diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow.png b/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow.png similarity index 100% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow.png rename to Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow.png diff --git a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs index 5a67dc7c71..1d50aff5e3 100644 --- a/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs +++ b/Projectiles/Melee/MendedBiomeBlade_PurityProjectionSigil.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Items.Weapons.Melee; using Microsoft.Xna.Framework; using Terraria; using Terraria.ID; @@ -44,6 +45,10 @@ namespace CalamityMod.Projectiles.Melee if (target.active) { Projectile.Center = target.Center; + + // TBB sigil marks the enemy with Armor Crunch + if (Projectile.ai[1] == 1f) + target.AddBuff(ModContent.BuffType(), 5); } else Projectile.active = false; diff --git a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs index f3835831f2..69929be91c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs +++ b/Projectiles/Melee/MendedBiomeBlade_TrueGrovetendersTouch.cs @@ -30,10 +30,9 @@ namespace CalamityMod.Projectiles.Melee const float MaxTime = 90; const int coyoteTimeFrames = 15; //How many frames does the whip stay extended - const int MaxReach = 400; - const int MinReach = 300; + const int MaxReach = 600; + const int MinReach = 250; const float SnappingPoint = 0.55f; //When does the snap occur. - const float ReelBackStrenght = 14f; const float MaxTangleReach = 400f; //How long can tangling vines from crits be @@ -172,10 +171,9 @@ namespace CalamityMod.Projectiles.Melee SnapCoyoteTime = coyoteTimeFrames; } - if (SnapCoyoteTime > 0) //keep checking for the tile hook + if (SnapCoyoteTime > 0) { Lighting.AddLight(Projectile.Center, 0.8f, 1f, 0.35f); - HookToTile(); SnapCoyoteTime--; } @@ -190,19 +188,6 @@ namespace CalamityMod.Projectiles.Melee Owner.itemRotation = MathHelper.WrapAngle(Owner.AngleTo(Owner.Calamity().mouseWorld) - (Owner.direction < 0 ? MathHelper.Pi : 0)); } - public void HookToTile() - { - if (Main.myPlayer == Owner.whoAmI) - { - //Shmoove the player if a tile is hit. This movement always happens if the owner isnt on the ground, but will only happen if the projectile is above the player if they are standing on the ground) - if (Collision.SolidCollision(Projectile.position, 32, 32) && (Owner.velocity.Y != 0 || Projectile.position.Y < Owner.position.Y)) - { - Owner.velocity = Owner.SafeDirectionTo(Projectile.Center, Vector2.Zero) * ReelBackStrenght; - SnapCoyoteTime = 0f; - } - SoundEngine.PlaySound(SoundID.Item65, Projectile.position); - } - } internal static float EaseInFunction(float progress) => progress == 0 ? 0f : (float)Math.Pow(2, 10 * progress - 10); //Potion seller i need your strongest easeIns diff --git a/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs new file mode 100644 index 0000000000..1da0389140 --- /dev/null +++ b/Projectiles/Melee/MendedBiomeBlade_TruePureClarity.cs @@ -0,0 +1,292 @@ +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 three times, 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 = 2; + 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.itemAnimation = 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.itemAnimation = 0; + 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 139ff19839..56f513e75c 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/TrueAncientBlast.cs b/Projectiles/Melee/TrueAncientBlast.cs deleted file mode 100644 index cb87979839..0000000000 --- a/Projectiles/Melee/TrueAncientBlast.cs +++ /dev/null @@ -1,128 +0,0 @@ -using System; -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 TrueAncientBlast : ModProjectile, ILocalizedModType - { - public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; - - public override void SetStaticDefaults() - { - ProjectileID.Sets.TrailCacheLength[Type] = 5; - ProjectileID.Sets.TrailingMode[Type] = 2; - } - - const float MaxTime = 20; - public float Timer => MaxTime - Projectile.timeLeft; - - public Player Owner => Main.player[Projectile.owner]; - - public override void SetDefaults() - { - Projectile.DamageType = DamageClass.Melee; - Projectile.width = Projectile.height = 8; - Projectile.tileCollide = false; - Projectile.friendly = true; - Projectile.penetrate = -1; - Projectile.usesLocalNPCImmunity = true; - Projectile.localNPCHitCooldown = 30; - Projectile.timeLeft = 20; - } - - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) - { - float collisionPoint = 0f; - return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Projectile.Center, Projectile.Center + Projectile.velocity, 20f, ref collisionPoint); - } - - public override bool ShouldUpdatePosition() => false; - - public override void AI() - { - if (Timer == 0) - { - Particle Star = new GenericSparkle(Projectile.Center, Vector2.Zero, Color.White, Color.HotPink, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - - Star = new GenericSparkle(Projectile.Center + Projectile.velocity, Vector2.Zero, Color.White, Color.PaleGoldenrod, Main.rand.NextFloat(2f, 2.5f), 20, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Star); - - SoundEngine.PlaySound(SoundID.Item84, Projectile.Center); - } - } - - public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) - { - Color pulseColor = Main.rand.NextBool() ? (Main.rand.NextBool() ? Color.CornflowerBlue : Color.Coral) : (Main.rand.NextBool() ? Color.GreenYellow : Color.Gold); - Particle pulse = new PulseRing(target.Center, Vector2.Zero, pulseColor, 0.05f, 0.2f + Main.rand.NextFloat(0f, 1f), 30); - GeneralParticleHandler.SpawnParticle(pulse); - - for (int i = 0; i < 10; i++) - { - Vector2 particleSpeed = Utils.SafeNormalize(Projectile.velocity, Vector2.Zero).RotatedByRandom(MathHelper.PiOver4 * 0.8f) * Main.rand.NextFloat(2.6f, 4f); - Particle energyLeak = new SquishyLightParticle(target.Center, particleSpeed, Main.rand.NextFloat(0.3f, 0.6f), Color.Cyan, 60, 1, 1.5f, hueShift: 0.02f); - GeneralParticleHandler.SpawnParticle(energyLeak); - } - } - - public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) - { - //Add some damage falloff - modifiers.SourceDamage *= (float)Math.Pow(1 - TrueArkoftheAncients.blastFalloffStrenght, Projectile.numHits * TrueArkoftheAncients.blastFalloffSpeed); - } - - public override bool PreDraw(ref Color lightColor) - { - Texture2D sword = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncients").Value; - Texture2D glowmask = Request("CalamityMod/Items/Weapons/Melee/TrueArkoftheAncientsGlow").Value; - - float displace = 10 * (1f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.8f)); - - float angle = Projectile.velocity.ToRotation(); - - float drawRotation = angle + MathHelper.PiOver4; - Vector2 drawOrigin = new Vector2(0f, sword.Height); - Vector2 drawOffset = Owner.Center + angle.ToRotationVector2() * displace - Main.screenPosition; - - float swordSize = 1.4f + ((float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.6f); - - Main.EntitySpriteDraw(sword, drawOffset, null, lightColor, drawRotation, drawOrigin, swordSize, 0f, 0); - Main.EntitySpriteDraw(glowmask, drawOffset, null, Color.Lerp(lightColor, Color.White, 0.75f), drawRotation, drawOrigin, swordSize, 0f, 0); - - Main.spriteBatch.End(); - Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); - - //Draw the laser - Texture2D tex = Request("CalamityMod/Particles/BloomLine").Value; - float rot = angle + MathHelper.PiOver2; - Vector2 origin = new Vector2(tex.Width / 2f, tex.Height); - float size = Timer / MaxTime > 0.5f ? (float)Math.Sin(Timer / MaxTime * MathHelper.Pi) * 0.2f + 0.8f : (float)Math.Sin(Timer / MaxTime * MathHelper.Pi); - size *= 3; - Vector2 scale = new Vector2(size, Projectile.velocity.Length() / tex.Height); - Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot, origin, scale, SpriteEffects.None, 0); - - //Cap the lines - Texture2D cap = Request("CalamityMod/Particles/BloomLineCap").Value; - scale = new Vector2(size, size); - origin = new Vector2(cap.Width / 2f, cap.Height); - Main.EntitySpriteDraw(cap, Projectile.Center - Main.screenPosition, null, Color.LightPink, rot + MathHelper.Pi, origin, scale, SpriteEffects.None, 0); - Main.EntitySpriteDraw(cap, Projectile.Center + Projectile.velocity - Main.screenPosition, null, Color.LightPink, rot, origin, scale, 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/TrueArkOfTheAncients_ParryHoldout.cs b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs index 48bc443c2f..1fbbab3c42 100644 --- a/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs +++ b/Projectiles/Melee/TrueArkOfTheAncients_ParryHoldout.cs @@ -47,14 +47,18 @@ namespace CalamityMod.Projectiles.Melee return Collision.CheckAABBvLineCollision(targetHitbox.TopLeft(), targetHitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint); } - public void GeneralParryEffects() + public void GeneralParryEffects(bool npcHit) { TrueArkoftheAncients sword = (Owner.HeldItem.ModItem as TrueArkoftheAncients); - if (sword != null) + if (sword != null && npcHit) sword.Charge = 10f; + SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact); - SoundEngine.PlaySound(SoundID.Item67); - CombatText.NewText(Projectile.Hitbox, new Color(111, 247, 200), CalamityUtils.GetTextValue("Misc.ArkParry"), true); + if (npcHit) + SoundEngine.PlaySound(SoundID.Item67); + + Color parryTextColor = npcHit ? new Color(111, 247, 200) : new Color(98, 161, 139); + CombatText.NewText(Projectile.Hitbox, parryTextColor, CalamityUtils.GetTextValue("Misc.ArkParry"), true); AlreadyParried = 1f; } @@ -63,7 +67,7 @@ namespace CalamityMod.Projectiles.Melee if (AlreadyParried > 0) return; - GeneralParryEffects(); + GeneralParryEffects(true); // 17APR2024: Ozzatron: True Ark of the Ancients is a parry. It uses vanilla parry iframes and benefits from Cross Necklace. // However, iframes are only granted if the target has contact damage. This means it won't work on Providence. Too bad. I have no sympathy for you if you are using this weapon line. @@ -123,7 +127,7 @@ namespace CalamityMod.Projectiles.Melee proj.Size.Length() < 300 && //Only parry projectiles that aren't too large Collision.CheckAABBvLineCollision(proj.Hitbox.TopLeft(), proj.Hitbox.Size(), Owner.Center + DistanceFromPlayer, Owner.Center + DistanceFromPlayer + (Projectile.velocity * bladeLength), 24, ref collisionPoint)) { - GeneralParryEffects(); + GeneralParryEffects(false); //Reduce the projectile's damage by 80 for a second. if (proj.Calamity().flatDR < 80) diff --git a/Projectiles/Melee/TrueBiomeBladeHoldout.cs b/Projectiles/Melee/TrueBiomeBladeHoldout.cs index 0b5075093c..675b93172a 100644 --- a/Projectiles/Melee/TrueBiomeBladeHoldout.cs +++ b/Projectiles/Melee/TrueBiomeBladeHoldout.cs @@ -129,29 +129,19 @@ 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 hallow = Owner.ZoneHallow; - bool astral = 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 = AttunementSystem.FindOrNull(AttunementID.Whirlwind); - if (desert || hell) - attunement = AttunementSystem.FindOrNull(AttunementID.SuperPogo); - if (jungle || ocean || snow) //Check put after the desert check so ocean doesnt get overriden as desert + Attunement attunement = AttunementSystem.FindOrNull(AttunementID.Shockwave); + if (flailAttune) //Check put after the desert check so ocean doesnt get overriden as desert attunement = AttunementSystem.FindOrNull(AttunementID.FlailBlade); - if (evil) //Evil check separated so that it overrides corrupted beach & snow biomes + if (pogoAttune) //Evil check separated so that it overrides corrupted beach & snow biomes attunement = AttunementSystem.FindOrNull(AttunementID.SuperPogo); - if (astral || marine) - attunement = AttunementSystem.FindOrNull(AttunementID.Shockwave); - if (hallow) + if (whirlAttune) attunement = AttunementSystem.FindOrNull(AttunementID.Whirlwind); //Putting holy check at the end so it may override hallowed variants of biomes - //If the owner already had the attunement , break out of it (And unswap) + //If the owner already had the attunement, break out of it (And unswap) if (item.secondaryAttunement == attunement) { SoundEngine.PlaySound(SoundID.DD2_LightningBugZap, Projectile.Center); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs similarity index 71% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs index aa97da0fc6..adf31a775d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using CalamityMod.Projectiles.Boss; @@ -16,10 +17,10 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTides : ModProjectile, ILocalizedModType + public class EarthenTides : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTides"; private bool initialized = false; Vector2 direction = Vector2.Zero; public Player Owner => Main.player[Projectile.owner]; @@ -33,6 +34,9 @@ namespace CalamityMod.Projectiles.Melee public Vector2 lastDisplacement; public float dashDuration; + public static readonly SoundStyle FullChargeSound = new("CalamityMod/Sounds/Item/MagicRockSound"); + public static readonly SoundStyle GroundImpact = new("CalamityMod/Sounds/Item/MagicRockImpact"); + public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -45,10 +49,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.localNPCHitCooldown = 16; } - public override bool? CanDamage() - { - return (State == 1); - } + // Only deal damage while charging + public override bool? CanDamage() => State == 1f; public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { @@ -69,17 +71,19 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (!initialized) //Initialization. Here its litterally just playing a sound tho lmfao + if (!initialized) //Initialization. Here it's literally just playing a sound { Projectile.velocity = Vector2.Zero; SoundEngine.PlaySound(SoundID.Item101, Projectile.Center); initialized = true; } + // Attempt a charge if the player stops channeling the sword if (Owner.CantUseHoldout()) { if (State == 0f) { + // You need at least 25% charge duration to do a charge if (Charge / MaxCharge < 0.25f) { SoundEngine.PlaySound(SoundID.Item109, Projectile.Center); @@ -88,7 +92,6 @@ namespace CalamityMod.Projectiles.Melee } else { - SoundEngine.PlaySound(SoundID.Item120 with { Volume = SoundID.Item120.Volume * 0.5f }, Projectile.Center); State = 1f; Projectile.timeLeft = (7 + (int)((Charge / MaxCharge - 0.25f) * 20)) * 2; //Keep that even, if its an odd number itll fuck off and wont reset the players velocity on death @@ -112,8 +115,13 @@ namespace CalamityMod.Projectiles.Melee Projectile.timeLeft = 2; if ((Charge / MaxCharge >= 0.25f && CurrentIndicator == 0f) || (Charge / MaxCharge >= 0.5f && CurrentIndicator == 1f) || (Charge / MaxCharge >= 0.75f && CurrentIndicator == 2f) && Owner.whoAmI == Main.myPlayer) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); - SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = DeusRitualDrama.PulseSound.Pitch - 0.2f + 0.1f * CurrentIndicator }, Projectile.Center); + for (int s = 0; s < 2; s++) + { + Vector2 swordVel = (Vector2.UnitX.RotatedBy(Projectile.rotation) * 10f).RotatedByRandom(MathHelper.Pi / 8); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, swordVel, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BeamDamageMult), 10f, Owner.whoAmI); + } + + SoundEngine.PlaySound(SoundID.Item69 with { Pitch = -0.2f + 0.1f * CurrentIndicator }, Projectile.Center); CurrentIndicator++; OverCharge = 20f; @@ -124,9 +132,13 @@ namespace CalamityMod.Projectiles.Melee Charge = MaxCharge; if (Owner.whoAmI == Main.myPlayer && CurrentIndicator < 4f) { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BlastDamageReduction), 10f, Owner.whoAmI, 1f + CurrentIndicator * 0.15f); + for (int s = 0; s < 5; s++) + { + Vector2 swordVel = (Vector2.UnitX.RotatedBy(Projectile.rotation) * 10f).RotatedByRandom(MathHelper.Pi / 8); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, swordVel, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_BeamDamageMult), 10f, Owner.whoAmI); + } OverCharge = 20f; - SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + SoundEngine.PlaySound(FullChargeSound, Projectile.Center); CurrentIndicator++; } } @@ -139,9 +151,10 @@ namespace CalamityMod.Projectiles.Melee Owner.Calamity().LungingDown = true; - if (Collision.SolidCollision(Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f, 10, 10)) + Vector2 collisionCheckPos = Owner.Center + (direction * 120 * Projectile.scale) - Vector2.One * 5f; + if (Collision.SolidCollision(collisionCheckPos, 10, 10)) { - SlamDown(); + SlamDown(collisionCheckPos); Projectile.timeLeft = 0; Owner.Calamity().LungingDown = false; Projectile.active = false; @@ -178,59 +191,34 @@ namespace CalamityMod.Projectiles.Melee Owner.itemAnimation = 2; } - public void SlamDown() + public void SlamDown(Vector2 collisionSpot) { - SoundEngine.PlaySound(SoundID.DD2_MonkStaffGroundImpact with { Volume = SoundID.DD2_MonkStaffGroundImpact.Volume * 1.5f }, Projectile.Center); - - if (Owner.whoAmI != Main.myPlayer || Owner.velocity.Y == 0f) return; + // Sound and screenshake + SoundEngine.PlaySound(GroundImpact, Projectile.Center); if (Main.LocalPlayer.Calamity().GeneralScreenShakePower < 15) Main.LocalPlayer.Calamity().GeneralScreenShakePower = 15; - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center + (direction * 120 * Projectile.scale), -direction, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), 1f); - proj.timeLeft = 81; + // Dust and particles from the impact + for (int d = 0; d < 13; d++) + Dust.NewDustPerfect(collisionSpot, Main.rand.NextBool() ? DustID.Clay : DustID.Dirt, Main.rand.NextVector2CircularEdge(6f, 6f), Scale: 1.2f); - - SideSprouts(1, 150f, 1f * Charge / MaxCharge); - SideSprouts(-1, 150f, 1f * Charge / MaxCharge); - - } - - public bool SideSprouts(float facing, float distance, float projSize) - { - float widestAngle = 0f; - float widestSurfaceAngle = 0f; - bool validPositionFound = false; - for (float i = 0f; i < 1; i += 1 / distance) + CustomPulse shatter = new(collisionSpot, Vector2.Zero, Color.SandyBrown, "CalamityMod/Particles/ShatteredExplosion", Vector2.One, Main.rand.NextFloat(MathHelper.TwoPi), 0.03f, 0.275f, 30); + GeneralParticleHandler.SpawnParticle(shatter); + for (int i = 0; i < 10; i++) { - Vector2 positionToCheck = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((i * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - - if (Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - widestAngle = i; - - else if (widestAngle != 0) - { - validPositionFound = true; - widestSurfaceAngle = widestAngle; - } + Vector2 rockVel = -(Owner.velocity * 0.55f).RotatedByRandom(MathHelper.Pi / 2.5f); + StoneDebrisParticle rock = new(collisionSpot, rockVel, Color.White, 1f, 35); + GeneralParticleHandler.SpawnParticle(rock); } - if (validPositionFound) - { - Vector2 projPosition = Owner.Center + (direction * 120 * Projectile.scale) + direction.RotatedBy((widestSurfaceAngle * MathHelper.PiOver2 + MathHelper.PiOver4) * facing) * distance; - Vector2 monolithRotation = direction.RotatedBy(Utils.AngleLerp(widestSurfaceAngle * -facing, 0f, projSize)); - Projectile proj = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), projPosition, -monolithRotation, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 10f, Owner.whoAmI, Main.rand.Next(4), projSize); - if (proj.ModProjectile is MercurialTidesMonolith monolith) - { - monolith.WaitTimer = (1 - projSize) * 34f; - monolith.OriginDirection = direction; - monolith.Facing = facing; - } - } + // Spawn the blast spawner + // Its duration scales with the current charge level + int duration = 12 + (int)CurrentIndicator * 12; + Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Owner.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.ShockwaveAttunement_MonolithDamageBoost), 0f, Owner.whoAmI, duration); - return validPositionFound; } public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) @@ -238,6 +226,9 @@ namespace CalamityMod.Projectiles.Melee // 17APR2024: Ozzatron: True Biome Blade's shockwave slam gives iframes when striking enemies in a similar manner to a ram dash. // This is a fixed and intentionally very low number of iframes, and is not boosted by Cross Necklace. Owner.GiveUniversalIFrames(OmegaBiomeBlade.ShockwaveAttunement_DashHitIFrames); + + if (!CalamityUtils.AnyProjectiles(ProjectileType())) + Projectile.NewProjectile(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), (int)(Projectile.damage * 0.5f), 0f, Owner.whoAmI, 1f); } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) @@ -246,12 +237,25 @@ namespace CalamityMod.Projectiles.Melee if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordProc) sword.OnHitProc = true; + + foreach (Projectile proj in Main.projectile) + { + if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) + { + //Reset the timeLeft on the sigil & set its new target (or same target, doesn't matter) + proj.ai[0] = target.whoAmI; + proj.timeLeft = OmegaBiomeBlade.ShockwaveAttunement_SigilTime; + return; + } + } + Projectile sigil = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI, 1f); + sigil.timeLeft = OmegaBiomeBlade.ShockwaveAttunement_SigilTime; } public override bool PreDraw(ref Color lightColor) { Texture2D handle = Request("CalamityMod/Items/Weapons/Melee/OmegaBiomeBlade").Value; - Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTides").Value; + Texture2D blade = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTides").Value; float drawAngle = direction.ToRotation(); float drawRotation = drawAngle + MathHelper.PiOver4; diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTides.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTides.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTides.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTides.png diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs similarity index 66% rename from Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs index 5dcf795150..1ea26709ac 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.cs @@ -1,6 +1,8 @@ using System; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Items.Weapons.Ranged; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -12,12 +14,12 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class SwordsmithsPrideBeam : ModProjectile, ILocalizedModType + public class EarthenTidesBeam : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; public NPC target; public Player Owner => Main.player[Projectile.owner]; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam"; public override void SetStaticDefaults() { @@ -32,7 +34,7 @@ namespace CalamityMod.Projectiles.Melee AIType = ProjectileID.LightBeam; Projectile.friendly = true; Projectile.penetrate = 1; - Projectile.timeLeft = 80; + Projectile.timeLeft = 150; Projectile.extraUpdates = 1; Projectile.DamageType = DamageClass.Melee; Projectile.tileCollide = false; @@ -40,26 +42,42 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - - if (target == null) + // Sword beams home + if (Projectile.timeLeft < 120) { + // Find the closest target + float npcDistCompare = 240f; + 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) && Collision.CanHit(Projectile.Center, 1, 1, n.Center, 1, 1)) + { + npcDistCompare = currentNPCDist; + index = n.whoAmI; + } + } + // Homing will prioritize an enemy that is marked foreach (Projectile proj in Main.projectile) { if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.whoAmI) { - target = Main.npc[(int)proj.ai[0]]; - break; + if (Vector2.Distance(Main.npc[(int)proj.ai[0]].Center, Projectile.Center) < 560f) + { + index = (int)proj.ai[0]; + break; + } } } - } - - else if ((Projectile.Center - target.Center).Length() >= (Projectile.Center + Projectile.velocity - target.Center).Length() && CalamityUtils.AngleBetween(Projectile.velocity, target.Center - Projectile.Center) < MathHelper.PiOver4) //Home in - { - Projectile.timeLeft = 70; //Remain alive - float angularTurnSpeed = MathHelper.ToRadians(MathHelper.Lerp(15, 2.5f, MathHelper.Clamp(Projectile.Distance(target.Center) / 10f, 0f, 1f))); - float idealDirection = Projectile.AngleTo(target.Center); - float updatedDirection = Projectile.velocity.ToRotation().AngleTowards(idealDirection, angularTurnSpeed); - Projectile.velocity = updatedDirection.ToRotationVector2() * Projectile.velocity.Length(); + // If we found an enemy, curve towards them + if (index != -1) + { + float homingTurnSpeed = 0.05f; + Projectile.velocity = Projectile.velocity.ToRotation().AngleTowards(Projectile.SafeDirectionTo(Main.npc[index].Center).ToRotation(), homingTurnSpeed).ToRotationVector2() * 10f; + } } Lighting.AddLight(Projectile.Center, 0.75f, 1f, 0.24f); @@ -71,12 +89,12 @@ namespace CalamityMod.Projectiles.Melee public override bool PreDraw(ref Color lightColor) { - if (Projectile.timeLeft > 75) + if (Projectile.timeLeft > 145) return false; DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1); - Main.spriteBatch.End(); //Haha sup babe what if i restarted the spritebatch way too many times haha /blushes + Main.spriteBatch.End(); //Yippee wahoo spritebatch restarting! Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, null, Main.GameViewMatrix.TransformationMatrix); Texture2D tex = Terraria.GameContent.TextureAssets.Projectile[Type].Value; @@ -101,17 +119,12 @@ 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 ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordBeamProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_SwordBeamProc) sword.OnHitProc = true; } - public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)); + public override Color? GetAlpha(Color lightColor) => Color.Lerp(Color.DeepSkyBlue, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 4f)); } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideBeam.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesBeam.png diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs new file mode 100644 index 0000000000..843cd4effd --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlast.cs @@ -0,0 +1,68 @@ +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthenTidesBlast : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/Magic/PrimordialAncientProjectile"; + public Player Owner => Main.player[Projectile.owner]; + + public override void SetStaticDefaults() => Main.projFrames[Type] = 6; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 140; + Projectile.friendly = true; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + Projectile.ignoreWater = true; + Projectile.penetrate = -1; + Projectile.timeLeft = 72; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 40; + Projectile.scale = 0.05f; + } + + public override void AI() + { + Lighting.AddLight(Projectile.Center, 0.9f, 0.45f, 0.05f); + Projectile.rotation = Projectile.ai[0]; + if (Projectile.timeLeft > 12) + { + if (Projectile.scale < Projectile.ai[1]) + Projectile.scale += (Projectile.ai[1] - 0.05f) / 12f; + } + else + Projectile.scale -= (Projectile.ai[1] - 0.05f) / 12f; + + Projectile.frameCounter++; + if (Projectile.frameCounter > 2) + { + Projectile.frameCounter = 0; + Projectile.frame++; + if (Projectile.frame >= Main.projFrames[Projectile.type]) + Projectile.frame = 0; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) + sword.OnHitProc = true; + } + + public override bool PreDraw(ref Color lightColor) + { + Texture2D tex = ModContent.Request(Texture).Value; + Rectangle frame = tex.Frame(1, Main.projFrames[Type], 0, Projectile.frame); + Main.EntitySpriteDraw(tex, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() / 2f, Projectile.scale, SpriteEffects.None); + return false; + } + } +} diff --git a/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs new file mode 100644 index 0000000000..18d4b79564 --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesBlastSpawner.cs @@ -0,0 +1,47 @@ +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class EarthenTidesBlastSpawner : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 2; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.timeLeft = 50; + } + + public override void AI() + { + // Set how long the spawner will exist + // 30-40-50-60 for 25%-50%-75%-100% + if (Projectile.ai[1] == 0f) + { + Projectile.timeLeft = (int)Projectile.ai[0]; + Projectile.ai[1]++; + } + + // Constantly stay on top of the owner + Projectile.Center = Main.player[Projectile.owner].Center; + + // Spawn dust blasts + if (Projectile.timeLeft % 6 == 3) + { + for (int i = 0; i < 2; i++) + { + float randomX = Main.rand.NextFloat(-200f, 200f); + float randomY = Main.rand.NextFloat(-200f, 200f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), new Vector2(Projectile.Center.X + randomX, Projectile.Center.Y + randomY), Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Main.myPlayer, Main.rand.NextFloat(-MathHelper.Pi, MathHelper.Pi), Main.rand.NextFloat(0.96f, 1.04f)); + } + } + } + + public override bool? CanDamage() => false; + } +} diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesMonolith.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesMonolith.png diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs similarity index 93% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs index cafa9fde02..aa5ad1ce0d 100644 --- a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.cs +++ b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -11,13 +12,12 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class MercurialTidesBlast : ModProjectile, ILocalizedModType + public class EarthenTidesShockwave : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave"; + public override string Texture => "CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave"; public Player Owner => Main.player[Projectile.owner]; public float Timer => (60f - Projectile.timeLeft) / 100f; - public ref float Variant => ref Projectile.ai[0]; //Yes public ref float Size => ref Projectile.ai[0]; //Yes public Particle BloomRing; @@ -33,6 +33,8 @@ namespace CalamityMod.Projectiles.Melee Projectile.friendly = true; Projectile.penetrate = -1; Projectile.timeLeft = 60; + Projectile.usesIDStaticNPCImmunity = true; + Projectile.idStaticNPCHitCooldown = 12; } public override bool? CanDamage() => Projectile.timeLeft < 40; @@ -87,13 +89,13 @@ namespace CalamityMod.Projectiles.Melee public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_BlastProc) + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.ShockwaveAttunement_ShockwaveProc) sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave").Value; float drawAngle = Projectile.rotation; int animFrame = 6 - (int)Math.Ceiling(Projectile.timeLeft / 10f); diff --git a/Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.png b/Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png similarity index 100% rename from Projectiles/Melee/TrueBiomeBlade_MercurialTidesShockwave.png rename to Projectiles/Melee/TrueBiomeBlade_EarthenTidesShockwave.png diff --git a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs index 50e4adaacb..1db4fff2ff 100644 --- a/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs +++ b/Projectiles/Melee/TrueBiomeBlade_LamentationsOfTheChained.cs @@ -337,24 +337,24 @@ namespace CalamityMod.Projectiles.Melee if (ChainSwapTimer % 6 == 0 || whip1.Y == 0) { - whip1.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.PiOver4 / 16f, -MathHelper.PiOver4 / 16f)).ToRotation(); //X is the orientation - whip1.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip1.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 64f).ToRotation(); //X is the orientation + whip1.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } if ((ChainSwapTimer - 2) % 6 == 0 || whip2.Y == 0) { - whip2.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation - whip2.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip2.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 32f).ToRotation(); //X is the orientation + whip2.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } if ((ChainSwapTimer - 4) % 6 == 0 || whip3.Y == 0) { - whip3.X = Projectile.velocity.RotatedBy(Main.rand.NextFloat(MathHelper.Pi / 16f, -MathHelper.Pi / 16f)).ToRotation(); //X is the orientation - whip3.Y = Main.rand.NextFloat(0.2f, 100f);//Y is the "seed" + whip3.X = Projectile.velocity.RotatedByRandom(MathHelper.Pi / 24f).ToRotation(); //X is the orientation + whip3.Y = Main.rand.NextFloat(0.2f, 50f);//Y is the "seed" ChainSwapTimer++; } diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs index 6c0cc309ec..0b1678ce13 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryDash.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -19,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; @@ -43,8 +41,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) - sword.OnHitProc = true; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword) + { + if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_DashProc) + sword.OnHitProc = true; + } Particle bloom = new StrongBloom(target.Center, target.velocity, Color.Crimson * 0.5f, 1f, 30); GeneralParticleHandler.SpawnParticle(bloom); diff --git a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs index fc841ca661..0c02adb129 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SanguineFuryWheel.cs @@ -1,4 +1,5 @@ -using CalamityMod.Items.Weapons.Melee; +using CalamityMod.DataStructures; +using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -24,11 +25,6 @@ namespace CalamityMod.Projectiles.Melee public const float MaxTime = 120; - - - public override void SetStaticDefaults() - { - } public override void SetDefaults() { Projectile.DamageType = DamageClass.Melee; @@ -85,8 +81,11 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) - sword.OnHitProc = true; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword) + { + if (Main.rand.NextFloat() <= OmegaBiomeBlade.SuperPogoAttunement_WheelProc) + sword.OnHitProc = true; + } } public override bool PreDraw(ref Color lightColor) diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs index 73a041a62a..b0278ff426 100644 --- a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPride.cs @@ -2,6 +2,8 @@ using System.IO; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; +using CalamityMod.Projectiles.Boss; +using CalamityMod.Tiles.Astral; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; @@ -22,7 +24,7 @@ namespace CalamityMod.Projectiles.Melee Vector2 direction = Vector2.Zero; public ref float CurrentState => ref Projectile.ai[0]; public Player Owner => Main.player[Projectile.owner]; - public const float throwOutTime = 90f; + public const float throwOutTime = 60f; public const float throwOutDistance = 440f; public static float snapPoint = 0.45f; @@ -39,10 +41,7 @@ namespace CalamityMod.Projectiles.Melee public float AngleReset = 0f; - public bool CanDirectFire = true; public Particle smear; - public Particle sightLine; - public NPC lastTarget; public override void SetStaticDefaults() { @@ -105,8 +104,7 @@ namespace CalamityMod.Projectiles.Melee // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction direction = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.Zero); - - //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES YES YES MH YES YES + //PARTICLES LOTS OF PARTICLES LOTS OF SPARKLES for (int i = 0; i <= 8; i++) { float variation = Main.rand.NextFloat(-MathHelper.PiOver4, MathHelper.PiOver4); @@ -126,40 +124,37 @@ namespace CalamityMod.Projectiles.Melee if (CurrentState == 0f) { - - if (hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) - { - hasMadeChargeSound = 1f; - SoundEngine.PlaySound(SoundID.Item76, Projectile.Center); - } - float rotation = direction.ToRotation(); if (rotation > -MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < -MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 1f) hasMadeSound = 0f; else if (rotation > MathHelper.PiOver2 - MathHelper.PiOver4 && rotation < MathHelper.PiOver2 + MathHelper.PiOver4 && hasMadeSound == 0f) { - CanDirectFire = true; hasMadeSound = 1f; SoundEngine.PlaySound(SoundID.Item71, Projectile.Center); } + if ((hasMadeChargeSound == 0f && Empowerment / maxEmpowerment >= 0.5) || (hasMadeChargeSound == 1f && Empowerment / maxEmpowerment >= 0.75)) + { + hasMadeChargeSound++; + SoundEngine.PlaySound(DeusRitualDrama.PulseSound with { Pitch = -0.1f + hasMadeChargeSound * 0.1f }, Projectile.Center); + } + if (hasMadeChargeSound == 2f && Empowerment >= maxEmpowerment) + { + hasMadeChargeSound++; + SoundEngine.PlaySound(AstralBeacon.UseSound, Projectile.Center); + } if (Empowerment / maxEmpowerment >= 0.5 && (Empowerment + OverEmpowerment) % 30 == 29 && Owner.whoAmI == Main.myPlayer) { - Vector2 shotDirection = Main.rand.NextVector2CircularEdge(15f, 15f); - if (lastTarget != null && lastTarget.active) //If you've got an actual target, angle your shots towards them - { - shotDirection = (shotDirection.ToRotation().AngleTowards(Owner.AngleTo(lastTarget.Center), MathHelper.PiOver2)).ToRotationVector2() * 15f; - } - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); + Vector2 shotDirection = Main.rand.NextVector2CircularEdge(10f, 10f); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, shotDirection, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_EnergyDamageMult), 0f, Owner.whoAmI); } - if (Empowerment / maxEmpowerment >= 0.75) { - Color currentColor = Color.Lerp(Color.HotPink, Color.GreenYellow, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); + Color currentColor = Color.Lerp(Color.HotPink, Color.DarkViolet, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 2f)) * (((Empowerment / maxEmpowerment) - 0.75f) / 0.25f * 0.8f); if (smear == null) { smear = new CircularSmearVFX(Owner.Center, Color.HotPink, direction.ToRotation(), Projectile.scale * 1.5f); @@ -175,41 +170,6 @@ namespace CalamityMod.Projectiles.Melee smear.Color = currentColor; } - // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction - // this applies to all below uses - - if (sightLine == null) - { - sightLine = new LineVFX(Owner.Center, Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One), 0.2f, Color.HotPink, false); - GeneralParticleHandler.SpawnParticle(sightLine); - } - else - { - sightLine.Position = Owner.Center + Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 40; - (sightLine as LineVFX).LineVector = Owner.SafeDirectionTo(Owner.Calamity().mouseWorld, Vector2.One) * Projectile.scale * 1.88f * 38f; - sightLine.Scale = 0.2f; - sightLine.Time = 0; - sightLine.Color = currentColor * 0.7f; - } - - float rotationAdjusted = MathHelper.WrapAngle(Projectile.rotation) + MathHelper.Pi; - float mouseAngleAdjusted = MathHelper.WrapAngle(Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation()) + MathHelper.Pi; - float deltaAngleShoot = Math.Abs(MathHelper.WrapAngle(rotationAdjusted - mouseAngleAdjusted)); - - if (CanDirectFire && deltaAngleShoot < 0.1f) - { - Particle Blink = new GenericSparkle(Owner.Center + Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * Projectile.scale * 1.88f * 78f, Owner.velocity, Color.White, currentColor, 1.5f, 10, 0.1f, 3f); - GeneralParticleHandler.SpawnParticle(Blink); - - if (Owner.whoAmI == Main.myPlayer) - { - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Owner.Center, Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One) * 15f, ProjectileType(), (int)(Projectile.damage * OmegaBiomeBlade.WhirlwindAttunement_BeamDamageReduction), 0f, Owner.whoAmI); - } - CanDirectFire = false; - AngleReset = Owner.SafeDirectionTo(Main.MouseWorld, Vector2.One).ToRotation(); - } - - if (Main.rand.NextBool()) { float maxDistance = Projectile.scale * 1.9f * 78f; @@ -256,9 +216,25 @@ 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) modifiers.SourceDamage *= MathHelper.Lerp(1f, OmegaBiomeBlade.WhirlwindAttunement_ThrowDamageBoost, Empowerment / maxEmpowerment); else @@ -273,28 +249,12 @@ namespace CalamityMod.Projectiles.Melee if (Owner.HeldItem.ModItem is OmegaBiomeBlade blade && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_SwordThrowProc) blade.OnHitProc = true; - - lastTarget = target; - foreach (Projectile proj in Main.projectile) - { - if (proj.active && proj.type == ProjectileType() && proj.owner == Owner.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 = OmegaBiomeBlade.WhirlwindAttunement_SigilTime; - return; - } - } - Projectile sigil = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), target.Center, Vector2.Zero, ProjectileType(), 0, 0, Owner.whoAmI, target.whoAmI); - sigil.timeLeft = OmegaBiomeBlade.WhirlwindAttunement_SigilTime; } public override void OnKill(int timeLeft) { if (smear != null) smear.Kill(); - if (sightLine != null) - sightLine.Kill(); } public override bool PreDraw(ref Color lightColor) 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_SwordsmithsPrideAstralEnergy.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralEnergy.cs new file mode 100644 index 0000000000..f2e88c452b --- /dev/null +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideAstralEnergy.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class SwordsmithsPrideAstralEnergy : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public ref float Timer => ref Projectile.ai[0]; + + public override void SetDefaults() + { + Projectile.width = Projectile.height = 32; + Projectile.friendly = true; + Projectile.penetrate = 1; + Projectile.timeLeft = 240; + Projectile.extraUpdates = 1; + Projectile.DamageType = DamageClass.Melee; + Projectile.tileCollide = false; + } + + public override void AI() + { + Timer++; + + if (Timer >= 40f) + { + CalamityUtils.HomeInOnNPC(Projectile, true, 480f, 13f, 20f); + } + + Projectile.ai[1] += 0.18f; + float angle = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + float pulse = (float)Math.Sin(Projectile.ai[1]); + float radius = 9f; + Vector2 offset = angle.ToRotationVector2() * pulse * radius; + Dust.NewDustPerfect(Projectile.Center + offset, ModContent.DustType(), Vector2.Zero, Scale: 0.75f); + Dust.NewDustPerfect(Projectile.Center - offset, ModContent.DustType(), Vector2.Zero, Scale: 0.75f); + + Color partColor = Color.Lerp(Color.Orange, Color.Blue, (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3.5f)); + GlowOrbParticle obligatory = new(Projectile.Center, Vector2.Zero, false, 2, 0.8f, partColor); + GeneralParticleHandler.SpawnParticle(obligatory); + } + } +} diff --git a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs similarity index 71% rename from Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs rename to Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs index 03e90f0a94..1c50fbb05c 100644 --- a/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith.cs +++ b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; +using CalamityMod.DataStructures; using CalamityMod.Items.Weapons.Melee; using CalamityMod.Particles; using Microsoft.Xna.Framework; @@ -13,15 +15,18 @@ using static Terraria.ModLoader.ModContent; namespace CalamityMod.Projectiles.Melee { - public class ExtantAbhorrenceMonolith : ModProjectile, ILocalizedModType + public class SwordsmithsPrideMonolith : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Melee"; - public override string Texture => "CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith"; + 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 float WaitTimer; //How long till it appears fr. GOtta remember to sync that one + 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; @@ -38,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; @@ -49,11 +51,12 @@ 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; } - public override bool? CanDamage() => WaitTimer <= 0; - public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) { float collisionPoint = 0f; @@ -67,18 +70,22 @@ namespace CalamityMod.Projectiles.Melee public override void AI() { - if (WaitTimer > 0) + if (Projectile.velocity != Vector2.Zero) { - Projectile.timeLeft = 102; - WaitTimer--; + Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; + Projectile.velocity = Vector2.Zero; } + if (!Target.active) + { + Projectile.Kill(); + return; + } + else + Projectile.Center = Target.Center; + if (Projectile.timeLeft == 100) { - SurfaceUp(); - Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2; - Projectile.velocity = Vector2.Zero; - if (Size >= 1) //Big monoliths create sparkles even before sprouting up { @@ -88,6 +95,20 @@ namespace CalamityMod.Projectiles.Melee GeneralParticleHandler.SpawnParticle(Sparkle); } } + + if (Projectile.ai[2] > 1f) + { + if (Facing == 0) + { + SideSprouts(-1f, Size * 0.8f); + SideSprouts(1f, Size * 0.8f); + } + else + { + SideSprouts(Facing, Size * 0.8f); + } + } + } if (Projectile.timeLeft == 80) @@ -113,59 +134,53 @@ namespace CalamityMod.Projectiles.Melee } } - //Go up to the "surface" so you're not stuck in the middle of the ground like a complete moron. - public void SurfaceUp() + public void SideSprouts(float facing, float projSize) { - for (float i = 0; i < 40; i += 0.5f) + 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) { - Vector2 positionToCheck = Projectile.Center + Projectile.velocity * i; - if (!Main.tile[(int)(positionToCheck.X / 16), (int)(positionToCheck.Y / 16)].IsTileSolid()) - { - Projectile.Center = Projectile.Center + Projectile.velocity * i; - return; - } + monolith.Scale = Scale; + monolith.OriginDirection = monolithRotation; + monolith.Facing = facing; + monolith.Target = Target; } - Projectile.Center = Projectile.Center + Projectile.velocity * 40f; } public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) { - if (Projectile.numHits > 0) - modifiers.SourceDamage *= TrueBiomeBlade.AstralAttunement_MonolithDamageFalloff; + if (Owner.HeldItem.ModItem is OmegaBiomeBlade sword && Main.rand.NextFloat() <= OmegaBiomeBlade.WhirlwindAttunement_MonolithProc) + sword.OnHitProc = true; } public override bool PreDraw(ref Color lightColor) { - if (WaitTimer > 0) - return false; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith").Value; - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith").Value; + Vector2 Shake = Projectile.timeLeft < 70 ? Vector2.Zero : Vector2.One.RotatedByRandom(MathHelper.TwoPi) * (70 - Projectile.timeLeft / 30f) * 0.05f; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f * Scale; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); - Main.EntitySpriteDraw(tex, drawPosition, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); + Main.EntitySpriteDraw(tex, drawPosition + Shake, frame, lightColor * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); return false; } public override void PostDraw(Color lightColor) { - if (WaitTimer > 0) - return; - - Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_ExtantAbhorrenceMonolith_Glow").Value; + Texture2D tex = Request("CalamityMod/Projectiles/Melee/MendedBiomeBlade_HeavensMonolith_Glow").Value; float drawAngle = Projectile.rotation; Rectangle frame = new Rectangle(0 + (int)Variant * 94, 0, 94, 420); - Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight); - Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f; + Vector2 drawScale = new Vector2(Width() / BaseWidth, Height() / BaseHeight) * Scale; + Vector2 drawPosition = Projectile.Center - Main.screenPosition - (Projectile.rotation - MathHelper.PiOver2).ToRotationVector2() * 26f * Scale; Vector2 drawOrigin = new Vector2(frame.Width / 2f, frame.Height); float opacity = MathHelper.Clamp(1f - ((Timer - 0.85f) / 0.15f), 0f, 1f); @@ -173,15 +188,16 @@ namespace CalamityMod.Projectiles.Melee Main.EntitySpriteDraw(tex, drawPosition, frame, Color.White * opacity, drawAngle, drawOrigin, drawScale, 0f, 0); } - public override void SendExtraAI(BinaryWriter writer) { - writer.Write(WaitTimer); + writer.Write(Facing); + writer.WriteVector2(OriginDirection); + } public override void ReceiveExtraAI(BinaryReader reader) { - WaitTimer = reader.ReadSingle(); + Facing = reader.ReadSingle(); + OriginDirection = reader.ReadVector2(); } - } } diff --git a/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png new file mode 100644 index 0000000000..9d931f1918 Binary files /dev/null and b/Projectiles/Melee/TrueBiomeBlade_SwordsmithsPrideMonolith.png differ 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 diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs index 3c2315dc33..27808b0d0a 100644 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -37,7 +37,6 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -45,13 +44,12 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -61,7 +59,6 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), - ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/Mechanic/AttunementSystem.cs b/Systems/Mechanic/AttunementSystem.cs index 0471e0d769..707a654630 100644 --- a/Systems/Mechanic/AttunementSystem.cs +++ b/Systems/Mechanic/AttunementSystem.cs @@ -20,10 +20,10 @@ namespace CalamityMod.Systems Registry = [ // Broken Biome Blade - new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new TropicalAttunement(), new EvilAttunement(), + new DefaultAttunement(), new HotAttunement(), new ColdAttunement(), new EvilAttunement(), // Biome Blade - new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), new AstralAttunement(), new MarineAttunement(), + new TrueDefaultAttunement(), new TrueHotAttunement(), new TrueColdAttunement(), new TrueTropicalAttunement(), new TrueEvilAttunement(), new HolyAttunement(), // True Biome Blade new WhirlwindAttunement(), new FlailBladeAttunement(), new SuperPogoAttunement(), new ShockwaveAttunement(),