From a5f2cc1fcaac8a83702f8ade80a551d2301e05a6 Mon Sep 17 00:00:00 2001 From: CongratsIsTrash <1q2w3e4dasd@gmail.com> Date: Sat, 31 May 2025 11:20:17 -0400 Subject: [PATCH] Bunch of misc balance stuff I've been sitting on --- Items/CalamityGlobalItemTweaks.cs | 1 - Items/Weapons/Ranged/AuroraBlazer.cs | 2 +- Items/Weapons/Rogue/Glaive.cs | 26 ++--- .../Mods.CalamityMod.Items.Accessories.hjson | 2 +- ...Mods.CalamityMod.Items.Weapons.Rogue.hjson | 4 +- NPCs/CalamityGlobalNPC.cs | 10 +- Projectiles/Rogue/GlaiveProj.cs | 110 ++++++++++++++++-- 7 files changed, 117 insertions(+), 38 deletions(-) diff --git a/Items/CalamityGlobalItemTweaks.cs b/Items/CalamityGlobalItemTweaks.cs index ccac4c3858..6352984b55 100644 --- a/Items/CalamityGlobalItemTweaks.cs +++ b/Items/CalamityGlobalItemTweaks.cs @@ -113,7 +113,6 @@ namespace CalamityMod.Items { ItemID.FairyQueenMagicItem, Do(DamageExact(54)) }, // Nightglow { ItemID.FalconBlade, Do(UseTurn, UseExact(13)) }, { ItemID.FireworksLauncher, Do(DamageExact(50), UseExact(25)) }, // Celebration - { ItemID.Flairon, Do(DamageExact(65)) }, { ItemID.Flamarang, Do(DamageExact(40)) }, { ItemID.Flamelash, Do(DamageExact(40)) }, { ItemID.Flamethrower, Do(DamageExact(21), ShootSpeedDelta(+3f)) }, diff --git a/Items/Weapons/Ranged/AuroraBlazer.cs b/Items/Weapons/Ranged/AuroraBlazer.cs index ffb8e030fb..825b90649f 100644 --- a/Items/Weapons/Ranged/AuroraBlazer.cs +++ b/Items/Weapons/Ranged/AuroraBlazer.cs @@ -15,7 +15,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 68; Item.height = 36; - Item.damage = 89; + Item.damage = 80; Item.DamageType = DamageClass.Ranged; Item.useTime = 5; Item.useAnimation = 30; diff --git a/Items/Weapons/Rogue/Glaive.cs b/Items/Weapons/Rogue/Glaive.cs index b76b2ab6d9..91097539e0 100644 --- a/Items/Weapons/Rogue/Glaive.cs +++ b/Items/Weapons/Rogue/Glaive.cs @@ -10,8 +10,8 @@ namespace CalamityMod.Items.Weapons.Rogue public class Glaive : RogueWeapon { //These 2 are used on the Projectile AI and thus remain here - public static float Speed = 10f; - public static float StealthSpeedMult = 1.8f; + public static float Speed = 13f; + public static float StealthSpeedMult = 1.3f; public override void SetDefaults() { @@ -29,29 +29,23 @@ namespace CalamityMod.Items.Weapons.Rogue Item.rare = ItemRarityID.Orange; Item.UseSound = SoundID.Item1; - Item.shootSpeed = 10; + Item.shootSpeed = Speed; Item.shoot = ModContent.ProjectileType(); } - - // Terraria seems to really dislike high crit values in SetDefaults - public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 4; - public override float StealthVelocityMultiplier => StealthSpeedMult; + // Terraria seems to really dislike high crit values in SetDefaults + public override void ModifyWeaponCrit(Player player, ref float crit) => crit += 6; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] <= 0; public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - float ai1 = 0f; - if (player.Calamity().StealthStrikeAvailable()) - { - ai1 = 1f; - } - - int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, ai1); + int p = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI, 0f, -1f); if (player.Calamity().StealthStrikeAvailable() && p.WithinBounds(Main.maxProjectiles)) + { Main.projectile[p].Calamity().stealthStrike = true; + Main.projectile[p].penetrate = 4; + } return false; } - - public override bool CanUseItem(Player player) => player.ownedProjectileCounts[Item.shoot] < 3; } } diff --git a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson index c1f543f6da..33cfa1017b 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Accessories.hjson @@ -1874,7 +1874,7 @@ TheAmalgam: { Tooltip: ''' 10% increased damage - All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3.5x + All attacks inflict a variety of debuffs and multiplies all elemental debuff damage by 3x Most buffs last twice as long, and persist after dying Taking damage confuses nearby enemies and spawns a dank creeper The dank creeper flies above you, exploding into several shaderain clouds diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 7274743e98..2037158363 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -504,8 +504,8 @@ Glaive: { DisplayName: Glaive Tooltip: ''' - Tosses up to 3 sharp returning glaives - Stealth strikes are super fast and pierce infinitely + Tosses a very fast and sharp returning glaive + Stealth strikes are faster and can ricochet between enemies, or stick into a single enemy ''' } diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 51d182b3d4..6baf90661a 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1004,11 +1004,11 @@ namespace CalamityMod.NPCs //Amalgam triples all elemental debuff damage. Ironically this excludes Elemental Mix if (IncreasedDebuffEffects_Amalgam) { - heatDamageMult += 3.5; - coldDamageMult += 3.5; - waterDamageMult += 3.5; - sicknessDamageMult += 3.5; - electricityDamageMult += 3.5; + heatDamageMult += 3; + coldDamageMult += 3; + waterDamageMult += 3; + sicknessDamageMult += 3; + electricityDamageMult += 3; } // Subtract 1 for the vanilla damage multiplier because it's already dealing DoT in the vanilla regen code. diff --git a/Projectiles/Rogue/GlaiveProj.cs b/Projectiles/Rogue/GlaiveProj.cs index 5ba3bdc63f..40c9a6b8d6 100644 --- a/Projectiles/Rogue/GlaiveProj.cs +++ b/Projectiles/Rogue/GlaiveProj.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using CalamityMod.Items.Weapons.Rogue; using Microsoft.Xna.Framework; using Terraria; @@ -14,7 +15,9 @@ namespace CalamityMod.Projectiles.Rogue public override string Texture => "CalamityMod/Items/Weapons/Rogue/Glaive"; private static int Lifetime = 180; - private static int ReboundTime = 45; + private static int ReboundTime = 40; + private List HitNPCs = []; + public ref float AIState => ref Projectile.ai[0]; // 0 - Going out. 1 - Returning. 2 - Stealth stuck to enemy. public override void SetStaticDefaults() { @@ -29,21 +32,18 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = true; Projectile.penetrate = 3; + Projectile.MaxUpdates = 3; Projectile.timeLeft = Lifetime; DrawOffsetX = -10; Projectile.DamageType = RogueDamageClass.Instance; Projectile.usesIDStaticNPCImmunity = true; - Projectile.idStaticNPCHitCooldown = 10; + Projectile.idStaticNPCHitCooldown = 20; } public override void AI() { - // ai[1] = 1 means that the projectile is a stealth strike, in which case it pierces infinitely. - if (Projectile.ai[1] == 1f) - Projectile.penetrate = Projectile.maxPenetrate = -1; - // Boomerang rotation - Projectile.rotation += 0.4f * (float)Projectile.direction; + Projectile.rotation += 0.175f * Projectile.direction; // Boomerang sound if (Projectile.soundDelay == 0) @@ -54,16 +54,22 @@ namespace CalamityMod.Projectiles.Rogue // Returns after some number of frames in the air if (Projectile.timeLeft < Lifetime - ReboundTime) - Projectile.ai[0] = 1f; + AIState = 1f; - if (Projectile.ai[0] != 0f) + if (AIState == 0f && Projectile.ai[1] >= 0) + { + if (Projectile.timeLeft % 10 == 0) + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[(int)Projectile.ai[1]].Center) * Projectile.velocity.Length(); + } + + if (AIState == 1f) { Projectile.tileCollide = false; float returnSpeed = Glaive.Speed * 1.6f; float acceleration = 1.4f; - if (Projectile.ai[1] == 1f) + if (Projectile.Calamity().stealthStrike) { returnSpeed *= Glaive.StealthSpeedMult; acceleration *= Glaive.StealthSpeedMult; @@ -114,6 +120,24 @@ namespace CalamityMod.Projectiles.Rogue if (Projectile.Hitbox.Intersects(owner.Hitbox)) Projectile.Kill(); } + + if (AIState == 2f) + { + Projectile.tileCollide = false; + Projectile.velocity = Vector2.Zero; + if (Main.npc[(int)Projectile.ai[1]].active) + { + if (Projectile.FinalExtraUpdate()) + Projectile.Center += Main.npc[(int)Projectile.ai[1]].velocity; + } + else + AIState = 1f; + + if (Projectile.penetrate == -1) + { + AIState = 1f; + } + } } public override bool PreDraw(ref Color lightColor) @@ -124,11 +148,73 @@ namespace CalamityMod.Projectiles.Rogue public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { + if (Projectile.Calamity().stealthStrike) + { + if (AIState != 2f) + { + HitNPCs.Add(target.whoAmI); + float maxDistance = 1000f; + float npcDistCompare = 1000f; + int index = -1; + foreach (NPC n in Main.ActiveNPCs) // Find an NPC to ricochet to + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || HitNPCs.Contains(n.whoAmI)) + 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; + } + } + + // If you find an NPC, ricochet in their direction and reset iframes for them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If there are no new NPCs to ricochet to, try to go back to an already hit NPC + { + maxDistance = 1000f; + npcDistCompare = 1000f; + index = -1; + foreach (NPC n in Main.ActiveNPCs) + { + if (!n.CanBeChasedBy(Projectile) || !Projectile.WithinRange(n.Center, maxDistance) || n.whoAmI == target.whoAmI) + 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; + } + } + + // If this can find an NPC, ricochet back to them + if (index != -1) + { + Projectile.ai[1] = index; + Projectile.velocity = Utils.DirectionTo(Projectile.Center, Main.npc[index].Center) * Projectile.velocity.Length(); + Projectile.perIDStaticNPCImmunity[Type][index] = Main.GameUpdateCount; // Resets the iframes + } + else // If you still find no one new, stick to the hit NPC + { + Projectile.ai[1] = target.whoAmI; + AIState = 2f; + } + } + } + Projectile.timeLeft = Lifetime + ReboundTime * 3; + } // After its last hit, starts returning instead of vanishing. Can pierce infinitely on the way back. if (Projectile.penetrate == 1) { Projectile.penetrate = -1; - Projectile.ai[0] = 1f; + AIState = 1f; } } @@ -147,7 +233,7 @@ namespace CalamityMod.Projectiles.Rogue { Projectile.velocity.Y = -oldVelocity.Y; } - Projectile.ai[0] = 1f; + AIState = 1f; return false; } }