//----------------------------------------------------------------------------- // Purpose: // Input: // Output: //----------------------------------------------------------------------------- void CASW_Ranger::Event_Killed( const CTakeDamageInfo &info ) { CTakeDamageInfo newInfo(info); // scale up the force if we're shot by a marine, to make our ragdolling more interesting if (newInfo.GetAttacker() && newInfo.GetAttacker()->Classify() == CLASS_ASW_MARINE) { // scale based on the weapon used if (info.GetAmmoType() == GetAmmoDef()->Index("ASW_R") || info.GetAmmoType() == GetAmmoDef()->Index("ASW_AG") || info.GetAmmoType() == GetAmmoDef()->Index("ASW_P")) newInfo.ScaleDamageForce(22.0f); else if (info.GetAmmoType() == GetAmmoDef()->Index("ASW_PDW") || info.GetAmmoType() == GetAmmoDef()->Index("ASW_SG")) newInfo.ScaleDamageForce(30.0f); else if (info.GetAmmoType() == GetAmmoDef()->Index("ASW_ASG")) newInfo.ScaleDamageForce(35.0f); // tilt the angle up a bit? Vector vecForceDir = newInfo.GetDamageForce(); float force = vecForceDir.NormalizeInPlace(); QAngle angForce; VectorAngles(vecForceDir, angForce); angForce[PITCH] += asw_drone_death_force_pitch.GetFloat(); AngleVectors(angForce, &vecForceDir); vecForceDir *= force; newInfo.SetDamageForce(vecForceDir); } trace_t tr; UTIL_TraceLine( GetAbsOrigin() + Vector( 0, 0, 16 ), GetAbsOrigin() - Vector( 0, 0, 64 ), MASK_SOLID, this, COLLISION_GROUP_NONE, &tr ); UTIL_DecalTrace( &tr, "GreenBloodBig" ); BaseClass::Event_Killed( newInfo ); }
//----------------------------------------------------------------------------- // Purpose: // Input : &info - // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- bool CNPC_CombineShot::IsHeavyDamage(const CTakeDamageInfo &info) { // Combine considers AR2 fire to be heavy damage if ( info.GetAmmoType() == GetAmmoDef()->Index("AR2") ) return true; // 357 rounds are heavy damage if ( info.GetAmmoType() == GetAmmoDef()->Index("357") ) return true; // Shotgun blasts where at least half the pellets hit me are heavy damage if ( info.GetDamageType() & DMG_BUCKSHOT ) { int iHalfMax = sk_plr_dmg_buckshot.GetFloat() * sk_plr_num_shotgun_pellets.GetInt() * 0.5; if ( info.GetDamage() >= iHalfMax ) return true; } // Rollermine shocks if( (info.GetDamageType() & DMG_SHOCK) && hl2_episodic.GetBool() ) { return true; } return BaseClass::IsHeavyDamage( info ); }
//----------------------------------------------------------------------------- // Purpose: Add damage to the existing multidamage, and apply if it won't fit //----------------------------------------------------------------------------- void AddMultiDamage( const CTakeDamageInfo &info, CBaseEntity *pEntity ) { if ( !pEntity ) return; if ( pEntity != g_MultiDamage.GetTarget() ) { ApplyMultiDamage(); g_MultiDamage.Init( pEntity, info.GetInflictor(), info.GetAttacker(), info.GetWeapon(), vec3_origin, vec3_origin, vec3_origin, 0.0, info.GetDamageType(), info.GetDamageCustom() ); } g_MultiDamage.AddDamageType( info.GetDamageType() ); g_MultiDamage.SetDamage( g_MultiDamage.GetDamage() + info.GetDamage() ); g_MultiDamage.SetDamageForce( g_MultiDamage.GetDamageForce() + info.GetDamageForce() ); g_MultiDamage.SetDamagePosition( info.GetDamagePosition() ); g_MultiDamage.SetReportedPosition( info.GetReportedPosition() ); g_MultiDamage.SetMaxDamage( MAX( g_MultiDamage.GetMaxDamage(), info.GetDamage() ) ); g_MultiDamage.SetAmmoType( info.GetAmmoType() ); if ( g_MultiDamage.GetPlayerPenetrationCount() == 0 ) { g_MultiDamage.SetPlayerPenetrationCount( info.GetPlayerPenetrationCount() ); } bool bHasPhysicsForceDamage = !g_pGameRules->Damage_NoPhysicsForce( info.GetDamageType() ); if ( bHasPhysicsForceDamage && g_MultiDamage.GetDamageType() != DMG_GENERIC ) { // If you hit this assert, you've called TakeDamage with a damage type that requires a physics damage // force & position without specifying one or both of them. Decide whether your damage that's causing // this is something you believe should impart physics force on the receiver. If it is, you need to // setup the damage force & position inside the CTakeDamageInfo (Utility functions for this are in // takedamageinfo.cpp. If you think the damage shouldn't cause force (unlikely!) then you can set the // damage type to DMG_GENERIC, or | DMG_CRUSH if you need to preserve the damage type for purposes of HUD display. if ( g_MultiDamage.GetDamageForce() == vec3_origin || g_MultiDamage.GetDamagePosition() == vec3_origin ) { static int warningCount = 0; if ( ++warningCount < 10 ) { if ( g_MultiDamage.GetDamageForce() == vec3_origin ) { Warning( "AddMultiDamage: g_MultiDamage.GetDamageForce() == vec3_origin\n" ); } if ( g_MultiDamage.GetDamagePosition() == vec3_origin) { Warning( "AddMultiDamage: g_MultiDamage.GetDamagePosition() == vec3_origin\n" ); } } } } }
// ф-ция вызывается при смерти крематора; «выключает» глаза, убирает иммолатор и опционально отрывает голову. void CNPC_Cremator::Event_Killed( const CTakeDamageInfo &info ) { CTakeDamageInfo Info = info; if( (Info.GetAmmoType() == GetAmmoDef()->Index( ".50BMG" )) || (Info.GetAmmoType() == GetAmmoDef()->Index( "Buckshot" )) || (Info.GetAmmoType() == GetAmmoDef()->Index( "Gauss" )) || (Info.GetAmmoType() == GetAmmoDef()->Index( "XBowBolt" )) || (Info.GetAmmoType() == GetAmmoDef()->Index( "357" )) && ( m_bHeadshot == 1 ) ) { SetBodygroup (2, 1); // turn the head off DropHead ( 65 ); } else if( Info.GetDamageType() == DMG_BLAST ) { SetBodygroup( 2,1 ); DropHead( 300 ); } m_nSkin = CREMATOR_SKIN_DEAD; // turn the eyes black SetBodygroup (1, 1); // turn the gun off BaseClass::Event_Killed( info ); }
// Далее следует массивая таблица просчета повреждений и урона от разных типов вооружения. void CNPC_Cremator::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr ) { CTakeDamageInfo newInfo = info; // the head and the abdomen sphere are the only vulnerable parts, // the legs, arms and stuff under the cloak is likely just some machinery, // and the C. is encountered in City after the lab and in Canals when // the player doesn't have weapon apart from crowbar, pistol and SMG // TODO: torn clothes with bullets, exposing underlying machinery if( (newInfo.GetDamageType() & DMG_BULLET || DMG_CLUB || DMG_BUCKSHOT || DMG_ENERGYBEAM ) ) { // the multipliers here are so small because of the innate // headshot multiplayer which makes killing a cremator with headshots // ridiculously easy even on Hard. So all of them were divided by 6. if( ptr->hitgroup == HITGROUP_HEAD ) { m_bHeadshot = 1; if( g_pGameRules->IsSkillLevel(SKILL_EASY) ) { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) // base damage 100 { newInfo.ScaleDamage( 1.0 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) // base damage 40 { newInfo.ScaleDamage( 0.6 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.1 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") ) { newInfo.ScaleDamage( 0.75 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 1.0 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 0.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 0.192 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") ) { newInfo.ScaleDamage( 1.5 ); } } else if( g_pGameRules->IsSkillLevel(SKILL_HARD) ) { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) // base damage 100 { newInfo.ScaleDamage( 0.33 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) // base damage 40 { newInfo.ScaleDamage( 0.33 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.1 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") ) { newInfo.ScaleDamage( 0.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 0.65 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 0.45 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 0.146 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") ) { newInfo.ScaleDamage( 2.5 ); } } else { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) { newInfo.ScaleDamage( 0.66 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) { newInfo.ScaleDamage( 0.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.1 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("10mm") ) { newInfo.ScaleDamage( 0.66 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 0.75 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 0.4 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 0.16 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("CombineRounds") ) { newInfo.ScaleDamage( 2.0 ); } } } else if( ptr->hitgroup == CREMATOR_CANISTER ) { m_bCanisterShot = 1; // попадание в канистру на животе. if( g_pGameRules->IsSkillLevel(SKILL_EASY) ) { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) { newInfo.ScaleDamage( 1.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) { newInfo.ScaleDamage( 2.0 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.66 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 1.15 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 1.15 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 1.15 ); } } else if( g_pGameRules->IsSkillLevel(SKILL_HARD) ) { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) { newInfo.ScaleDamage( 1.15 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) { newInfo.ScaleDamage( 1.75 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.33 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 0.75 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 0.75 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 0.875 ); } } else if (g_pGameRules->IsSkillLevel(SKILL_VERYHARD)) { if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG")) { newInfo.ScaleDamage(1.05); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("357")) { newInfo.ScaleDamage(1.50); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19")) { newInfo.ScaleDamage(0.25); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45")) { newInfo.ScaleDamage(0.50); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot")) { newInfo.ScaleDamage(0.50); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium")) { newInfo.ScaleDamage(0.65); } } else if (g_pGameRules->IsSkillLevel(SKILL_HARD)) { if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG")) { newInfo.ScaleDamage(0.85); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("357")) { newInfo.ScaleDamage(1.25); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19")) { newInfo.ScaleDamage(0.15); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45")) { newInfo.ScaleDamage(0.25); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot")) { newInfo.ScaleDamage(0.25); } else if (newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium")) { newInfo.ScaleDamage(0.50); } } else { if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".50BMG") ) { newInfo.ScaleDamage( 1.25 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("357") ) { newInfo.ScaleDamage( 1.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("9x19") ) { newInfo.ScaleDamage( 0.5 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index(".556x45") ) { newInfo.ScaleDamage( 1.0 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Buckshot") ) { newInfo.ScaleDamage( 1.0 ); } else if( newInfo.GetAmmoType() == GetAmmoDef()->Index("Uranium") ) { newInfo.ScaleDamage( 1.0 ); } } } /* // however, if the sprayer is damaged, something unpleasant may happen else if (ptr->hitgroup == CREMATOR_GUN ) { // well, right now I can't think of any specific effect DevMsg( "Cremator: gear is damaged\n"); }*/ else { newInfo.ScaleDamage( 0.75 ); // В общем случае, крематор получает толко 25% урона (т.е. имеет сопротивление 75) DevMsg( "Generic 0.25 Non-specified\n" ); } } // BaseClass::TraceAttack( newInfo, vecDir, ptr ); }