Skip to content

Commit 8b57c99

Browse files
committed
gameplay: fix enforcer pierce bugs
fix a seeming typo on resistance piercing for the battallion's backup. there is no evidence I could find that mod_ignore_resists_absorbs ever existed as a valid attribute, so change it to the correct mod_pierce_resists_absorbs that is used by the enforcer also add an exclusion for the mult_dmgtaken_from_bullets. the Pain Train uses this to add bullet vulnerability, so the enforcer actually does less damage in this case since it "pierces" the vulnerability. technically, the pierce resistance attribute should also do this check for all other damage types for compatibility with attribute mods, but that's a more extensive change than just addressing it for the vanilla case.
1 parent a7160e1 commit 8b57c99

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/game/shared/tf/tf_gamerules.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6183,7 +6183,7 @@ bool CTFGameRules::ApplyOnDamageModifyRules( CTakeDamageInfo &info, CBaseEntity
61836183
}
61846184

61856185
int iPierceResists = 0;
6186-
CALL_ATTRIB_HOOK_INT_ON_OTHER( pWeapon, iPierceResists, mod_ignore_resists_absorbs );
6186+
CALL_ATTRIB_HOOK_INT_ON_OTHER( pWeapon, iPierceResists, mod_pierce_resists_absorbs );
61876187

61886188
// Use defense buffs if it's not a backstab or direct crush damage (telefrage, etc.)
61896189
if ( pVictim && info.GetDamageCustom() != TF_DMG_CUSTOM_BACKSTAB && ( info.GetDamageType() & DMG_CRUSH ) == 0 )
@@ -6833,10 +6833,11 @@ float CTFGameRules::ApplyOnDamageAliveModifyRules( const CTakeDamageInfo &info,
68336833
// Check if we're immune
68346834
outParams.bPlayDamageReductionSound = CheckForDamageTypeImmunity( info.GetDamageType(), pVictim, flDamageBase, flDamageBonus );
68356835

6836+
// Reduce only the crit portion of the damage with crit resist
6837+
bool bCrit = ( info.GetDamageType() & DMG_CRITICAL ) > 0;
6838+
68366839
if ( !iPierceResists )
68376840
{
6838-
// Reduce only the crit portion of the damage with crit resist
6839-
bool bCrit = ( info.GetDamageType() & DMG_CRITICAL ) > 0;
68406841
if ( bCrit )
68416842
{
68426843
// Break the damage down and reassemble
@@ -6876,15 +6877,23 @@ float CTFGameRules::ApplyOnDamageAliveModifyRules( const CTakeDamageInfo &info,
68766877
outParams.bPlayDamageReductionSound = CheckMedicResist( TF_COND_MEDIGUN_SMALL_BLAST_RESIST, TF_COND_MEDIGUN_UBER_BLAST_RESIST, pVictim, flRawDamage, flDamageBase, bCrit, flDamageBonus );
68776878
}
68786879
}
6880+
}
68796881

6880-
if ( info.GetDamageType() & (DMG_BULLET|DMG_BUCKSHOT) )
6882+
if ( info.GetDamageType() & (DMG_BULLET|DMG_BUCKSHOT) )
6883+
{
6884+
float flResist = 1.0f;
6885+
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pVictim, flResist, mult_dmgtaken_from_bullets );
6886+
// If the resist is actually a vulnerability, apply it even if we're piercing resists
6887+
if ( flResist > 1.0f || !iPierceResists )
68816888
{
6882-
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pVictim, flDamageBase, mult_dmgtaken_from_bullets );
6883-
6889+
flDamageBase *= flResist;
68846890
// Check for medic resist
68856891
outParams.bPlayDamageReductionSound = CheckMedicResist( TF_COND_MEDIGUN_SMALL_BULLET_RESIST, TF_COND_MEDIGUN_UBER_BULLET_RESIST, pVictim, flRawDamage, flDamageBase, bCrit, flDamageBonus );
68866892
}
6893+
}
68876894

6895+
if ( !iPierceResists )
6896+
{
68886897
if ( info.GetDamageType() & DMG_MELEE )
68896898
{
68906899
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pVictim, flDamageBase, mult_dmgtaken_from_melee );

0 commit comments

Comments
 (0)