mirror of
https://github.com/ValveSoftware/source-sdk-2013.git
synced 2025-04-17 16:01:34 +00:00
Fix afterburn duration bonus behaviour
This commit is contained in:
parent
aea94b32cb
commit
21fb673ba7
2 changed files with 14 additions and 9 deletions
|
@ -2884,11 +2884,11 @@ void CTFPlayerShared::ConditionGameRulesThink( void )
|
|||
#endif // DEBUG
|
||||
|
||||
// which degree are we burning?
|
||||
if ( m_flAfterburnDuration >= tf_afterburn_duration_ratio_third_degree * tf_afterburn_max_duration )
|
||||
if ( m_flAfterburnDuration >= tf_afterburn_duration_ratio_third_degree * m_flAfterburnMaxDuration )
|
||||
{
|
||||
flBurnDamage *= tf_afterburn_mult_third_degree;
|
||||
}
|
||||
else if ( m_flAfterburnDuration >= tf_afterburn_duration_ratio_second_degree * tf_afterburn_max_duration )
|
||||
else if ( m_flAfterburnDuration >= tf_afterburn_duration_ratio_second_degree * m_flAfterburnMaxDuration )
|
||||
{
|
||||
flBurnDamage *= tf_afterburn_mult_second_degree;
|
||||
}
|
||||
|
@ -6580,12 +6580,18 @@ void CTFPlayerShared::Burn( CTFPlayer *pAttacker, CTFWeaponBase *pWeapon, float
|
|||
static float s_flReachMaxAfterburnTime = 0.f;
|
||||
#endif // DEBUG
|
||||
|
||||
// Cache mult_wpn_burntime instead of calling hook every time
|
||||
float flMultWpnBurntime = 1.0f;
|
||||
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pWeapon, flMultWpnBurntime, mult_wpn_burntime );
|
||||
|
||||
if ( !InCond( TF_COND_BURNING ) )
|
||||
{
|
||||
// Start burning
|
||||
AddCond( TF_COND_BURNING, -1.f, pAttacker );
|
||||
m_flFlameBurnTime = gpGlobals->curtime + TF_BURNING_FREQUENCY;
|
||||
m_flAfterburnMaxDuration = tf_afterburn_max_duration * flMultWpnBurntime; // Updated only when starting to burn
|
||||
m_flAfterburnDuration = pWeapon ? pWeapon->GetInitialAfterburnDuration() : 0.f;
|
||||
m_flAfterburnDuration *= flMultWpnBurntime;
|
||||
|
||||
// Reduces direct healing effectiveness
|
||||
AddCond( TF_COND_HEALING_DEBUFF, m_flAfterburnDuration, pAttacker );
|
||||
|
@ -6668,8 +6674,6 @@ void CTFPlayerShared::Burn( CTFPlayer *pAttacker, CTFWeaponBase *pWeapon, float
|
|||
flFlameLife = flBurningTime;
|
||||
}
|
||||
|
||||
CALL_ATTRIB_HOOK_FLOAT_ON_OTHER( pWeapon, flFlameLife, mult_wpn_burntime );
|
||||
|
||||
// flame immunity will always have a fixed duration
|
||||
if ( bAfterburnImmunity )
|
||||
{
|
||||
|
@ -6678,20 +6682,20 @@ void CTFPlayerShared::Burn( CTFPlayer *pAttacker, CTFWeaponBase *pWeapon, float
|
|||
// otherwise stack the duration
|
||||
else
|
||||
{
|
||||
m_flAfterburnDuration += flFlameLife;
|
||||
m_flAfterburnDuration += flFlameLife * flMultWpnBurntime;
|
||||
}
|
||||
|
||||
m_flAfterburnDuration = Clamp( m_flAfterburnDuration, 0.f, tf_afterburn_max_duration );
|
||||
m_flAfterburnDuration = Clamp( m_flAfterburnDuration, 0.f, m_flAfterburnMaxDuration );
|
||||
|
||||
#ifdef DEBUG
|
||||
if ( tf_afterburn_debug.GetBool() )
|
||||
{
|
||||
engine->Con_NPrintf( 1, "Added afterburn duration = %f", m_flAfterburnDuration );
|
||||
|
||||
if ( s_flReachMaxAfterburnTime == 0.f && m_flAfterburnDuration == tf_afterburn_max_duration )
|
||||
if ( s_flReachMaxAfterburnTime == 0.f && m_flAfterburnDuration == flAfterburnMaxDuration )
|
||||
{
|
||||
s_flReachMaxAfterburnTime = gpGlobals->curtime;
|
||||
DevMsg( "took %f seconds to reach max afterburn duration\n", s_flReachMaxAfterburnTime - s_flStartAfterburnTime );
|
||||
DevMsg( "took %f seconds to reach max afterburn duration %f s\n", s_flReachMaxAfterburnTime - s_flStartAfterburnTime, flAfterburnMaxDuration );
|
||||
}
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
|
|
@ -1037,7 +1037,8 @@ private:
|
|||
CHandle<CTFPlayer> m_hOriginalBurnAttacker; // Player who originally ignited this target
|
||||
CHandle<CTFWeaponBase> m_hBurnWeapon;
|
||||
float m_flFlameBurnTime;
|
||||
float m_flAfterburnDuration;
|
||||
float m_flAfterburnDuration; // Active afterburn duration
|
||||
float m_flAfterburnMaxDuration; // Maximum afterburn duration
|
||||
|
||||
// Bleeding
|
||||
struct bleed_struct_t
|
||||
|
|
Loading…
Reference in a new issue