Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/game/server/tf/tf_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11268,7 +11268,7 @@ void CTFPlayer::Event_KilledOther( CBaseEntity *pVictim, const CTakeDamageInfo &
flRefill *= 0.2;
}

if ( flRefill > 0 && ((info.GetDamageType() & DMG_MELEE) || ( info.GetDamageCustom() == TF_DMG_CUSTOM_CHARGE_IMPACT ) ) )
if ( flRefill > 0 && ( ( info.GetDamageType() & DMG_MELEE ) || ( info.GetDamageCustom() == TF_DMG_CUSTOM_STICKBOMB_EXPLOSION ) || ( info.GetDamageCustom() == TF_DMG_CUSTOM_CHARGE_IMPACT ) ) )
{
m_Shared.SetDemomanChargeMeter( m_Shared.GetDemomanChargeMeter() + flRefill * 100.0f );
}
Expand Down
4 changes: 2 additions & 2 deletions src/game/shared/tf/tf_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7258,7 +7258,7 @@ float CTFGameRules::ApplyOnDamageAliveModifyRules( const CTakeDamageInfo &info,
outParams.bPlayDamageReductionSound = CheckMedicResist( TF_COND_MEDIGUN_SMALL_BULLET_RESIST, TF_COND_MEDIGUN_UBER_BULLET_RESIST, pVictim, flRawDamage, flDamageBase, bCrit, flDamageBonus );
}

if ( info.GetDamageType() & DMG_MELEE )
if ( ( info.GetDamageType() & DMG_MELEE ) || ( info.GetDamageCustom() == TF_DMG_CUSTOM_STICKBOMB_EXPLOSION ) )
{
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pVictim, flDamageBase, mult_dmgtaken_from_melee );
}
Expand Down Expand Up @@ -7374,7 +7374,7 @@ float CTFGameRules::ApplyOnDamageAliveModifyRules( const CTakeDamageInfo &info,

if ( pVictim && pVictim->GetActiveTFWeapon() && !iAttackIgnoresResists )
{
if ( info.GetDamageType() & (DMG_CLUB) )
if ( info.GetDamageType() & (DMG_CLUB) || ( info.GetDamageCustom() == TF_DMG_CUSTOM_STICKBOMB_EXPLOSION ) )
{
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pVictim->GetActiveTFWeapon(), flRealDamage, dmg_from_melee );
}
Expand Down
69 changes: 65 additions & 4 deletions src/game/shared/tf/tf_weapon_bottle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,16 +254,23 @@ void CTFStickBomb::Smack( void )

TE_TFExplosion( filter, 0.0f, explosion, Vector(0,0,1), TF_WEAPON_GRENADELAUNCHER, pTFPlayer->entindex(), -1, SPECIAL1, iCustomParticleIndex );

int dmgType = DMG_BLAST | DMG_USEDISTANCEMOD | DMG_MELEE;
int dmgType = DMG_BLAST | DMG_USEDISTANCEMOD;

if ( IsCurrentAttackACrit() )
{
// TODO: Not removing the old critical path yet, but the new custom damage is marking criticals as well for melee now.
dmgType |= DMG_CRITICAL;
}
else if ( m_bMiniCrit )
{
dmgType |= DMG_RADIUS_MAX; // Unused for melee, indicates this should be a minicrit.
}

float flDamage = 75.0f;
CALL_ATTRIB_HOOK_FLOAT( flDamage, mult_dmg );
float flDamage = GetBlastDamage( &dmgType );

CTakeDamageInfo info( pTFPlayer, pTFPlayer, this, explosion, explosion, flDamage, dmgType, TF_DMG_CUSTOM_STICKBOMB_EXPLOSION, &explosion );

float flRadius = 100.f;
float flRadius = 100.0f;
CALL_ATTRIB_HOOK_FLOAT( flRadius, mult_explosion_radius );

CTFRadiusDamageInfo radiusinfo( &info, explosion, flRadius );
Expand All @@ -273,6 +280,60 @@ void CTFStickBomb::Smack( void )
}
}

//-----------------------------------------------------------------------------
// Purpose:
// Output : float
//-----------------------------------------------------------------------------
#ifdef GAME_DLL
float CTFStickBomb::GetBlastDamage( int *iDamageType )
{
float flDamage = 75.0f;
CALL_ATTRIB_HOOK_FLOAT( flDamage, mult_dmg );

int iCritDoesNoDamage = 0;
CALL_ATTRIB_HOOK_INT( iCritDoesNoDamage, crit_does_no_damage );
if ( iCritDoesNoDamage > 0 )
{
if ( IsCurrentAttackACrit() )
{
return 0.0f;
}

if ( iDamageType && *iDamageType & DMG_CRITICAL )
{
return 0.0f;
}
}

CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( pPlayer )
{
float flHalfHealth = pPlayer->GetMaxHealth() * 0.5f;
if ( pPlayer->GetHealth() < flHalfHealth )
{
CALL_ATTRIB_HOOK_FLOAT( flDamage, mult_dmg_bonus_while_half_dead );
}
else
{
CALL_ATTRIB_HOOK_FLOAT( flDamage, mult_dmg_penalty_while_half_alive );
}

// Some weapons change damage based on player's health
float flReducedHealthBonus = 1.0f;
CALL_ATTRIB_HOOK_FLOAT( flReducedHealthBonus, mult_dmg_with_reduced_health );
if ( flReducedHealthBonus != 1.0f )
{
float flHealthFraction = clamp( pPlayer->HealthFraction(), 0.0f, 1.0f );
flReducedHealthBonus = Lerp( flHealthFraction, flReducedHealthBonus, 1.0f );

flDamage *= flReducedHealthBonus;
}
}

return flDamage;
}
#endif

void CTFStickBomb::WeaponReset( void )
{
BaseClass::WeaponReset();
Expand Down
3 changes: 3 additions & 0 deletions src/game/shared/tf/tf_weapon_bottle.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ class CTFStickBomb : public CTFBreakableMelee
virtual void WeaponRegenerate( void ) OVERRIDE;
virtual void SwitchBodyGroups( void ) OVERRIDE;
virtual const char* GetWorldModel( void ) const OVERRIDE;
#ifdef GAME_DLL
virtual float GetBlastDamage( int *iDamageType );
#endif
#ifdef CLIENT_DLL
virtual int GetWorldModelIndex( void ) OVERRIDE;
#endif
Expand Down