diff --git a/Balancing/BalancingConstants.cs b/Balancing/BalancingConstants.cs index d19eec31bc..6d211d33c7 100644 --- a/Balancing/BalancingConstants.cs +++ b/Balancing/BalancingConstants.cs @@ -153,6 +153,12 @@ internal static readonly float AdrenalineDamagePerBooster = 0.15f; // +15% internal static readonly float FullAdrenalineDR = 0.5f; // 50% internal static readonly float AdrenalineDRPerBooster = 0.05f; // +5% per booster + + internal static readonly int AdrenalinePauseAfterDamage = CalamityUtils.SecondsToFrames(1); + internal static readonly float MinimumAdrenalineLoss = 0.1f; // No matter how small a hit, you will always lose at least 10% current Adrenaline + internal static readonly float AdrenalineFalloffTinyHitHealthRatio = 0.05f; // Hits for 5% max HP or less result in less Adrenaline loss + + internal static readonly float TrueMeleeRipperReductionFactor = 0.5f; // True melee benefits less from rippers to prevent excessive melting. #endregion // TODO -- NPC classification is not done consistently with predictable thresholds. diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index db0cfae270..aac01bcac9 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -355,6 +355,7 @@ namespace CalamityMod.CalPlayer public bool AdrenalineTrail = false; public float adrenaline = 0f; public float adrenalineMax = 100f; // 0 to 100% by default + public int adrenalinePauseTimer = 0; public int AdrenalineDuration = CalamityUtils.SecondsToFrames(5); public int AdrenalineChargeTime = CalamityUtils.SecondsToFrames(30); public int AdrenalineFadeTime = CalamityUtils.SecondsToFrames(2); @@ -493,7 +494,6 @@ namespace CalamityMod.CalPlayer public bool laudanum = false; public bool heartOfDarkness = false; public bool draedonsHeart = false; - public int nanomachinesLockoutTimer = 0; public bool vexation = false; public bool dodgeScarf = false; public bool evasionScarf = false; @@ -2401,7 +2401,7 @@ namespace CalamityMod.CalPlayer soaring = false; bounding = false; shadow = false; - nanomachinesLockoutTimer = 0; + adrenalinePauseTimer = 0; photosynthesis = false; astralInjection = false; gravityNormalizer = false; diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index 554428fc89..97abe9c107 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -1471,21 +1471,14 @@ namespace CalamityMod.CalPlayer if (info.Damage < 1 /* || (godSlayerDamage && info.Damage <= 80) */) return true; - // If this hit was marked to be completely ignored due to shield absorption, then ignore it. + // If this hit was marked to be completely ignored due to shield absorption, then process Adrenaline changes and ignore it. if (freeDodgeFromShieldAbsorption) { freeDodgeFromShieldAbsorption = false; // 20FEB2024: Ozzatron: Hits fully absorbed by shields remove half of your current Adrenaline. - if (AdrenalineEnabled) - { - // Draedon's Heart instead pauses for half the usual duration. - if (draedonsHeart) - nanomachinesLockoutTimer += DraedonsHeart.NanomachinePauseAfterShieldDamage; - else if (adrenaline >= 0f) - adrenaline /= 2f; - } - + // If using Draedon's Heart, it pauses for half the typical duration. + LoseAdrenalineOnHurt(info, true); return true; } @@ -2137,21 +2130,7 @@ namespace CalamityMod.CalPlayer // Lose adrenaline on hit, unless using Draedon's Heart. if (AdrenalineEnabled) { - // Being hit for zero from Paladin's Shield damage share does not cancel Adrenaline. - // Adrenaline is not lost when hit if using Draedon's Heart. - // Adrenaline is not lost when an empowered parry is performed with blazing core (reduces damage to 1, but not 0) - if (!draedonsHeart && !blazingCoreEmpoweredParry && !adrenalineModeActive && hurtInfo.Damage > 0) - { - if (adrenaline >= adrenalineMax) - { - SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); - } - adrenaline = 0f; - } - - // If using Draedon's Heart and not actively healing with Nanomachines, pause generation briefly. - if (draedonsHeart && !adrenalineModeActive) - nanomachinesLockoutTimer += DraedonsHeart.NanomachinePauseAfterDamage; + LoseAdrenalineOnHurt(hurtInfo, false); } if (evilSmasherBoost > 0) @@ -2939,5 +2918,63 @@ namespace CalamityMod.CalPlayer CombatText.NewText(location, messageColor, Language.GetTextValue(text)); } #endregion + + #region Adrenaline Loss Function + /// + /// Causes the player to lose Adrenaline based on an incoming hit. The behavior differs based on energy shields or Draedon's Heart. + /// + /// The incoming damage event to the player. + /// Whether or not the hit was fully absorbed by one or more energy shields. Tends to halve Adrenaline loss. + private void LoseAdrenalineOnHurt(Player.HurtInfo hurtInfo, bool fullyAbsorbedByShield = false) + { + // Being hit for zero from Paladin's Shield damage share has no effects on Adrenaline, regardless of all other circumstances. + // Likewise, being struck while Adrenaline is actively burning has no effects on Adrenaline. + if (hurtInfo.Damage <= 0 || adrenalineModeActive) + return; + + // Draedon's Heart pauses for half the usual duration on a shield hit. + // Otherwise, nothing happens here because no Adrenaline is actually lost. + if (draedonsHeart) + { + int pauseTime = fullyAbsorbedByShield ? DraedonsHeart.NanomachinePauseAfterShieldDamage : DraedonsHeart.NanomachinePauseAfterDamage; + adrenalinePauseTimer += pauseTime; + } + + // Standard Adrenaline behavior + else + { + // Regular Adrenaline pauses on any hit, even if you lose all Adrenaline. + adrenalinePauseTimer += BalancingConstants.AdrenalinePauseAfterDamage; + + // Play a sound if Adrenaline was lost from full (this means Adrenaline DR helped mitigate the hit). + // If this occurs, since Adrenaline DR helped mitigate the hit's damage, we can't allow the amount of Adrenaline lost to actually be reduced. + bool hitAtFullAdrenaline = adrenaline >= adrenalineMax; + if (hitAtFullAdrenaline) + { + SoundEngine.PlaySound(AdrenalineHurtSound, Player.Center); + adrenaline = 0f; + return; + } + + // Calculate the amount of Adrenaline to lose. This is done in 3 steps: + // 1. Find out how much %HP the player lost (or was absorbed by a shield). + // 2. Use an inverse lerp to calculate the Adrenaline loss scaling down for very small hits (5% HP or less). + // 3. Re-scale the lerp result into a % of Adrenaline loss from 10% (min loss) to 100%. + float damageMaxHPRatio = (float)hurtInfo.Damage / Player.statLifeMax2; + float smallHitAdrenalineLossRatio = (float)Utils.GetLerpValue(0f, BalancingConstants.AdrenalineFalloffTinyHitHealthRatio, damageMaxHPRatio, true); + float adrenalineLossFraction = MathHelper.Lerp(BalancingConstants.MinimumAdrenalineLoss, 1f, smallHitAdrenalineLossRatio); + float adrenalineToLose = adrenaline * adrenalineLossFraction; + + // If the hit was fully absorbed by a shield, then lose half that much instead. + if (fullyAbsorbedByShield) + adrenalineToLose /= 2f; + + // Actually subtract Adrenaline. + adrenaline -= adrenalineToLose; + if (adrenaline < 0f) + adrenaline = 0f; + } + } + #endregion } } diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 3be30c4569..6a51852dd3 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -608,7 +608,7 @@ namespace CalamityMod.CalPlayer // Apply the adrenaline change and cap adrenaline in both directions. // Changes are only applied if the Adrenaline mechanic is available. - if (AdrenalineEnabled && nanomachinesLockoutTimer == 0) + if (AdrenalineEnabled && adrenalinePauseTimer == 0) { adrenaline += adrenalineDiff; if (adrenaline < 0f) @@ -629,8 +629,8 @@ namespace CalamityMod.CalPlayer playFullAdrenalineSound = true; } - if (nanomachinesLockoutTimer > 0) - nanomachinesLockoutTimer--; + if (adrenalinePauseTimer > 0) + adrenalinePauseTimer--; #endregion } #endregion diff --git a/Items/Weapons/Magic/ShadecrystalBarrage.cs b/Items/Weapons/Magic/ShadecrystalBarrage.cs index 1cb011c486..bb8e51f3cd 100644 --- a/Items/Weapons/Magic/ShadecrystalBarrage.cs +++ b/Items/Weapons/Magic/ShadecrystalBarrage.cs @@ -19,12 +19,12 @@ namespace CalamityMod.Items.Weapons.Magic { Item.width = 28; Item.height = 30; - Item.damage = 35; + Item.damage = 24; Item.DamageType = DamageClass.Magic; Item.mana = 10; Item.useTime = 7; Item.useAnimation = 14; - Item.reuseDelay = 30; + Item.reuseDelay = 49; Item.useLimitPerAnimation = 3; Item.useStyle = ItemUseStyleID.Shoot; Item.noMelee = true; @@ -39,14 +39,14 @@ namespace CalamityMod.Items.Weapons.Magic public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { - int projAmt = 8; + int projAmt = 6; float maxSpread = ShootSpeed * 0.25f; Vector2 cachedVelocity = velocity; Vector2 newPosition = position + velocity.SafeNormalize(Vector2.UnitY) * 20f; for (int index = 0; index < projAmt; index++) { velocity += new Vector2(Main.rand.NextFloat(-maxSpread, maxSpread), Main.rand.NextFloat(-maxSpread, maxSpread)); - Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI, 0f, MathHelper.Lerp(1.01f, 1.05f, index / (float)(projAmt - 1))); + Projectile.NewProjectile(source, newPosition, velocity, type, damage, knockback, player.whoAmI, 0f, MathHelper.Lerp(1.04f, 1.09f, index / (float)(projAmt - 1))); velocity = cachedVelocity; } return false; diff --git a/Items/Weapons/Magic/StarShower.cs b/Items/Weapons/Magic/StarShower.cs index 3005b6c215..e900725209 100644 --- a/Items/Weapons/Magic/StarShower.cs +++ b/Items/Weapons/Magic/StarShower.cs @@ -13,13 +13,13 @@ namespace CalamityMod.Items.Weapons.Magic { public new string LocalizationCategory => "Items.Weapons.Magic"; - internal const float ShootSpeed = 24f; + internal const float ShootSpeed = 28f; public override void SetDefaults() { Item.width = 38; Item.height = 40; - Item.damage = 57; + Item.damage = 60; Item.DamageType = DamageClass.Magic; Item.mana = 15; Item.rare = ItemRarityID.Cyan; diff --git a/Items/Weapons/Ranged/Infinity.cs b/Items/Weapons/Ranged/Infinity.cs index c1ef8cab1a..0a3822976f 100644 --- a/Items/Weapons/Ranged/Infinity.cs +++ b/Items/Weapons/Ranged/Infinity.cs @@ -24,7 +24,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 120; + Item.damage = 110; Item.DamageType = DamageClass.Ranged; Item.useTime = 2; Item.useAnimation = 12; diff --git a/Items/Weapons/Ranged/Shredder.cs b/Items/Weapons/Ranged/Shredder.cs index c0a162a147..a010c8b7aa 100644 --- a/Items/Weapons/Ranged/Shredder.cs +++ b/Items/Weapons/Ranged/Shredder.cs @@ -20,7 +20,7 @@ namespace CalamityMod.Items.Weapons.Ranged { Item.width = 56; Item.height = 24; - Item.damage = 30; + Item.damage = 31; Item.DamageType = DamageClass.Ranged; Item.useTime = 4; Item.useAnimation = 24; diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson index c8816c75fe..54733ffdde 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Magic.hjson @@ -677,7 +677,7 @@ Serpentine: { ShadecrystalBarrage: { DisplayName: Shadecrystal Barrage - Tooltip: Summons rapid fire shadecrystals, can shoot two crystals at once + Tooltip: Summons bursts of shadecrystals that can home in on enemies } ShaderainStaff: { @@ -737,7 +737,7 @@ StaffofBlushie: { StarShower: { DisplayName: Star Shower - Tooltip: Casts a spread of astral stars at the mouse cursor + Tooltip: Casts a spread of astral stars from the sky that converge at the cursor } SubsumingVortex: { diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 5f32b61dd5..70c18b9e70 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -1707,6 +1707,16 @@ namespace CalamityMod.Projectiles } } + // Making Rocket Launcher, Grenade Launcher, Proximity Mine Launcher, and Cluster Rocket fragments not damage the player. + bool isGrenadeLauncherProj = (projectile.type == 133 || projectile.type == 136 || projectile.type == 139 || projectile.type == 142 || projectile.type == 777 || projectile.type == 781 || projectile.type == 785 || projectile.type == 788 || projectile.type == 791 || projectile.type == 794 || projectile.type == 797 || projectile.type == 800); + bool isRocketLauncherProj = (projectile.type == 134 || projectile.type == 137 || projectile.type == 140 || projectile.type == 143 || projectile.type == 776 || projectile.type == 780 || projectile.type == 784 || projectile.type == 787 || projectile.type == 790 || projectile.type == 793 || projectile.type == 796 || projectile.type == 799); + bool isProximityMineProj = (projectile.type == 135 || projectile.type == 138 || projectile.type == 141 || projectile.type == 144 || projectile.type == 778 || projectile.type == 782 || projectile.type == 786 || projectile.type == 789 || projectile.type == 792 || projectile.type == 795 || projectile.type == 798 || projectile.type == 801); + + if (isGrenadeLauncherProj || isRocketLauncherProj || isProximityMineProj || projectile.type == ProjectileID.ClusterFragmentsI || projectile.type == ProjectileID.ClusterFragmentsII) + { + ProjectileID.Sets.RocketsSkipDamageForPlayers[projectile.type] = true; + } + if (CalamityWorld.revenge || BossRushEvent.BossRushActive) { bool masterMode = Main.masterMode || BossRushEvent.BossRushActive; diff --git a/Projectiles/Magic/ShadecrystalProjectile.cs b/Projectiles/Magic/ShadecrystalProjectile.cs index 57d0ff2f5d..2284b4a2da 100644 --- a/Projectiles/Magic/ShadecrystalProjectile.cs +++ b/Projectiles/Magic/ShadecrystalProjectile.cs @@ -60,7 +60,7 @@ namespace CalamityMod.Projectiles.Magic } } else - CalamityUtils.HomeInOnNPC(Projectile, false, 200f, maxVelocity, 30f); + CalamityUtils.HomeInOnNPC(Projectile, false, 224f, maxVelocity * 1.25f, 30f); Projectile.ai[0] += 1f; if (Projectile.ai[0] >= 520f) diff --git a/Projectiles/Ranged/ChargedBlast.cs b/Projectiles/Ranged/ChargedBlast.cs index 9a191bd341..caacfc330d 100644 --- a/Projectiles/Ranged/ChargedBlast.cs +++ b/Projectiles/Ranged/ChargedBlast.cs @@ -53,7 +53,7 @@ namespace CalamityMod.Projectiles.Ranged if (Projectile.owner == Main.myPlayer) { for (int k = 0; k < projectiles; k++) - Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(5f, 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.8), Projectile.knockBack * 0.8f, Main.myPlayer); + Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Main.rand.NextVector2CircularEdge(5f, 5f), ModContent.ProjectileType(), (int)(Projectile.damage * 0.5), Projectile.knockBack * 0.8f, Main.myPlayer); } } } diff --git a/Utilities/PlayerUtils.cs b/Utilities/PlayerUtils.cs index ce3f29870b..a42f871bb0 100644 --- a/Utilities/PlayerUtils.cs +++ b/Utilities/PlayerUtils.cs @@ -520,15 +520,12 @@ namespace CalamityMod /// A reference to the current in-use damage multiplier. This will be increased in-place. public static void ApplyRippersToDamage(CalamityPlayer mp, bool trueMelee, ref float damageMult) { - // Reduce how much true melee benefits from Rage and Adrenaline. - float rageAndAdrenalineTrueMeleeDamageMult = 0.5f; - // Rage and Adrenaline now stack additively with no special cases. if (mp.rageModeActive) - damageMult += trueMelee ? mp.RageDamageBoost * rageAndAdrenalineTrueMeleeDamageMult : mp.RageDamageBoost; + damageMult += trueMelee ? mp.RageDamageBoost * BalancingConstants.TrueMeleeRipperReductionFactor : mp.RageDamageBoost; // Draedon's Heart disables Adrenaline damage. if (mp.adrenalineModeActive && !mp.draedonsHeart) - damageMult += trueMelee ? mp.GetAdrenalineDamage() * rageAndAdrenalineTrueMeleeDamageMult : mp.GetAdrenalineDamage(); + damageMult += trueMelee ? mp.GetAdrenalineDamage() * BalancingConstants.TrueMeleeRipperReductionFactor : mp.GetAdrenalineDamage(); } #endregion