void CGargantua::OnTakeDamage( const CTakeDamageInfo& info ) { ALERT( at_aiconsole, "CGargantua::OnTakeDamage\n"); CTakeDamageInfo newInfo = info; if ( IsAlive() ) { if ( !( newInfo.GetDamageTypes() & GARG_DAMAGE) ) newInfo.GetMutableDamage() *= 0.01; if ( newInfo.GetDamageTypes() & DMG_BLAST ) SetConditions( bits_COND_LIGHT_DAMAGE ); } CBaseMonster::OnTakeDamage( newInfo ); }
void CGargantua::TraceAttack( const CTakeDamageInfo& info, Vector vecDir, TraceResult& tr ) { ALERT( at_aiconsole, "CGargantua::TraceAttack\n"); if ( !IsAlive() ) { CBaseMonster::TraceAttack( info, vecDir, tr ); return; } CTakeDamageInfo newInfo = info; // UNDONE: Hit group specific damage? if ( newInfo.GetDamageTypes() & (GARG_DAMAGE|DMG_BLAST) ) { if ( m_painSoundTime < gpGlobals->time ) { EMIT_SOUND_DYN( this, CHAN_VOICE, pPainSounds[ RANDOM_LONG(0,ARRAYSIZE(pPainSounds)-1) ], 1.0, ATTN_GARG, 0, PITCH_NORM ); m_painSoundTime = gpGlobals->time + RANDOM_FLOAT( 2.5, 4 ); } } newInfo.GetMutableDamageTypes() &= GARG_DAMAGE; if ( newInfo.GetDamageTypes() == 0) { if ( GetDamageTime() != gpGlobals->time || (RANDOM_LONG(0,100) < 20) ) { UTIL_Ricochet( tr.vecEndPos, RANDOM_FLOAT(0.5,1.5) ); SetDamageTime( gpGlobals->time ); // if ( RANDOM_LONG(0,100) < 25 ) // EMIT_SOUND_DYN( this, CHAN_BODY, pRicSounds[ RANDOM_LONG(0,ARRAYSIZE(pRicSounds)-1) ], 1.0, ATTN_NORM, 0, PITCH_NORM ); } newInfo.GetMutableDamage() = 0; } CBaseMonster::TraceAttack( newInfo, vecDir, tr ); }
void CZombie::OnTakeDamage( const CTakeDamageInfo& info ) { CTakeDamageInfo newInfo = info; // Take 30% damage from bullets if ( newInfo.GetDamageTypes() == DMG_BULLET ) { Vector vecDir = GetAbsOrigin() - ( newInfo.GetInflictor()->pev->absmin + newInfo.GetInflictor()->pev->absmax) * 0.5; vecDir = vecDir.Normalize(); float flForce = DamageForce( newInfo.GetDamage() ); pev->velocity = pev->velocity + vecDir * flForce; newInfo.GetMutableDamage() *= 0.3; } // HACK HACK -- until we fix this. if ( IsAlive() ) PainSound(); CBaseMonster::OnTakeDamage( newInfo ); }