本文整理汇总了C++中CTFPlayer::GetCritMult方法的典型用法代码示例。如果您正苦于以下问题:C++ CTFPlayer::GetCritMult方法的具体用法?C++ CTFPlayer::GetCritMult怎么用?C++ CTFPlayer::GetCritMult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTFPlayer
的用法示例。
在下文中一共展示了CTFPlayer::GetCritMult方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalcIsAttackCriticalHelper
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFWeaponBaseMelee::CalcIsAttackCriticalHelper( void )
{
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return false;
int nCvarValue = tf_weapon_criticals_melee.GetInt();
if ( nCvarValue == 0 )
return false;
if ( nCvarValue == 1 && !tf_weapon_criticals.GetBool() )
return false;
float flPlayerCritMult = pPlayer->GetCritMult();
float flCritChance = TF_DAMAGE_CRIT_CHANCE_MELEE * flPlayerCritMult;
CALL_ATTRIB_HOOK_FLOAT( flCritChance, mult_crit_chance );
// If the chance is 0, just bail.
if ( flCritChance == 0.0f )
return false;
return ( RandomInt( 0, WEAPON_RANDOM_RANGE-1 ) <= flCritChance * WEAPON_RANDOM_RANGE );
}
示例2: CalcIsAttackCriticalHelper
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFWeaponBaseMelee::CalcIsAttackCriticalHelper( void )
{
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return false;
float flPlayerCritMult = pPlayer->GetCritMult();
return ( RandomInt( 0, WEAPON_RANDOM_RANGE-1 ) <= ( TF_DAMAGE_CRIT_CHANCE_MELEE * flPlayerCritMult ) * WEAPON_RANDOM_RANGE );
}
示例3: CalcIsAttackCriticalHelper
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
bool CTFWeaponBaseMelee::CalcIsAttackCriticalHelper( void )
{
CTFPlayer *pPlayer = ToTFPlayer( GetPlayerOwner() );
if ( !pPlayer )
return false;
int iShouldCrit = tf_weapon_criticals_melee.GetInt();
if ( iShouldCrit == 0 )
return false;
if ( iShouldCrit == 1 && !tf_weapon_criticals.GetBool() )
return false;
float flPlayerCritMult = pPlayer->GetCritMult();
return ( RandomInt( 0, WEAPON_RANDOM_RANGE-1 ) <= ( TF_DAMAGE_CRIT_CHANCE_MELEE * flPlayerCritMult ) * WEAPON_RANDOM_RANGE );
}