From 545b656d743fc0858bc4f9b64d1250442aaf29d6 Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Tue, 14 Apr 2026 12:48:03 -0500 Subject: [PATCH] Raider Boost now works properly --- CalPlayer/CalamityPlayerHitHurt.cs | 14 +++++++++++++- CalPlayer/CalamityPlayerMiscEffects.cs | 10 ---------- CalPlayer/CalamityPlayerOnHit.cs | 11 +++++++++++ Items/Accessories/Nanotech.cs | 2 +- Items/Accessories/RaidersTalisman.cs | 4 ++-- Items/Accessories/VampiricTalisman.cs | 6 +++--- Projectiles/CalamityGlobalProjectile.cs | 11 +++++++++++ 7 files changed, 41 insertions(+), 17 deletions(-) diff --git a/CalPlayer/CalamityPlayerHitHurt.cs b/CalPlayer/CalamityPlayerHitHurt.cs index a94e709a5b..e8b533e4d5 100644 --- a/CalPlayer/CalamityPlayerHitHurt.cs +++ b/CalPlayer/CalamityPlayerHitHurt.cs @@ -595,7 +595,19 @@ namespace CalamityMod.CalPlayer { if (proj.npcProj || proj.trap) return; - + + //Add raider crit before hit + if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) + { + if (nanotech) + proj.CritChance += Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance += VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance += RaidersTalisman.RaiderBonus; + } + + modifiers.CritDamage += critDamage; // All Calamity multipliers are added together to prevent insane exponential stacking diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 5c7d52a83d..e406cd1611 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -2705,16 +2705,6 @@ namespace CalamityMod.CalPlayer } } - // Raider Talisman bonus - if (!StealthStrikeAvailable() && raiderCritLifespan > 0f) - { - if (nanotech) - Player.GetCritChance() += Items.Accessories.Nanotech.RaiderBonus; - else if (vampiricTalisman) - Player.GetCritChance() += VampiricTalisman.RaiderBonus; - else if (raiderTalisman) - Player.GetCritChance() += RaidersTalisman.RaiderBonus; - } if (avertorBonus) Player.GetDamage() += 0.1f; diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 39b2b2a7dc..5cfacc35d6 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -226,6 +226,17 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI != Main.myPlayer) return; + //Undo raider crit after hit + if (!proj.Calamity().stealthStrike && !proj.Calamity().stealthStrikeSubProjectile && raiderCritLifespan > 0f) + { + if (nanotech) + proj.CritChance -= Items.Accessories.Nanotech.RaiderBonus; + else if (vampiricTalisman) + proj.CritChance -= VampiricTalisman.RaiderBonus; + else if (raiderTalisman) + proj.CritChance -= RaidersTalisman.RaiderBonus; + } + // Apply this to player equippable sources ie. Orichalcum set bonus petal spawns // Do not apply if this effect is an extension of a weapon ie. Pearl God round effect as it will mess up Old Fashioned var source = Player.GetSource_OnHit(target); diff --git a/Items/Accessories/Nanotech.cs b/Items/Accessories/Nanotech.cs index 0d7c09a4df..c327cbdd88 100644 --- a/Items/Accessories/Nanotech.cs +++ b/Items/Accessories/Nanotech.cs @@ -11,7 +11,7 @@ namespace CalamityMod.Items.Accessories { //The stealth damage boost is handled in CalamityPlayer for some reason, maybe someone didn't want em to stack? public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 10f; + public static int RaiderBonus => 10; public override void SetDefaults() { Item.width = 46; diff --git a/Items/Accessories/RaidersTalisman.cs b/Items/Accessories/RaidersTalisman.cs index 775a842fa1..2e45d69df2 100644 --- a/Items/Accessories/RaidersTalisman.cs +++ b/Items/Accessories/RaidersTalisman.cs @@ -9,8 +9,8 @@ namespace CalamityMod.Items.Accessories public class RaidersTalisman : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Accessories"; - public const float RaiderBonus = 15f; - public const int RaiderCooldown = 10; //seconds + public static int RaiderBonus => 15; + public static int RaiderCooldown => 10; //seconds public static readonly SoundStyle StealthHitSound = new("CalamityMod/Sounds/Custom/RaidersTalismanStealthHit"); public override void SetDefaults() diff --git a/Items/Accessories/VampiricTalisman.cs b/Items/Accessories/VampiricTalisman.cs index eb0800a9db..9967c7d23e 100644 --- a/Items/Accessories/VampiricTalisman.cs +++ b/Items/Accessories/VampiricTalisman.cs @@ -9,9 +9,9 @@ namespace CalamityMod.Items.Accessories { public class VampiricTalisman : ModItem, ILocalizedModType, IHoldShiftTooltipItem { - internal const int ArmorCrunchDebuffTime = 150; - internal const int HeavyBleedingDebuffTime = 300; - public const float RaiderBonus = 15f; + internal static int ArmorCrunchDebuffTime => 150; + internal static int HeavyBleedingDebuffTime => 300; + public static int RaiderBonus => 15; public bool ShowExtensionIndicator => false; diff --git a/Projectiles/CalamityGlobalProjectile.cs b/Projectiles/CalamityGlobalProjectile.cs index 2d9425e0bc..b626906ce8 100644 --- a/Projectiles/CalamityGlobalProjectile.cs +++ b/Projectiles/CalamityGlobalProjectile.cs @@ -260,6 +260,10 @@ namespace CalamityMod.Projectiles /// If true, this projectile is from a rogue stealth strike. The primary variable responsible for triggering stealth strike effects. public bool stealthStrike = false; /// + /// If true, this projectile is spawned from a stealth strike, but is not a primary projectile. Used to avoid proccing things like Raiders Talisman. + /// + public bool stealthStrikeSubProjectile = false; + /// /// Number of times this stealth strike projectile has pierced an enemy.
/// Used to limit the number of times a projectile can proc certain effects from rogue accessories. ///
@@ -407,6 +411,13 @@ namespace CalamityMod.Projectiles if (e.Context == "SetBonus_GhostHurt") projectile.damage /= 2; } + + if (source is EntitySource_Parent { Entity: Projectile parent }) + { + if (parent.Calamity().stealthStrike || parent.Calamity().stealthStrikeSubProjectile) + stealthStrikeSubProjectile = true; + } + } public override void SendExtraAI(Projectile projectile, BitWriter bitWriter, BinaryWriter binaryWriter) => binaryWriter.Write(ParentNPCIndex); public override void ReceiveExtraAI(Projectile projectile, BitReader bitReader, BinaryReader binaryReader) => ParentNPCIndex = binaryReader.ReadInt32();