void CASW_Director::OnMarineStartedHack( CASW_Marine *pMarine, CBaseEntity *pComputer ) { CASW_Game_Resource *pGameResource = ASWGameResource(); if ( !pGameResource ) return; //Msg( " Marine started hack!\n" ); // reset intensity so we can have a big fight without relaxing immediately for ( int i=0;i<pGameResource->GetMaxMarineResources();i++ ) { CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i); if ( !pMR ) continue; pMR->GetIntensity()->Reset(); } float flQuickStart = RandomFloat( 2.0f, 5.0f ); if ( m_HordeTimer.GetRemainingTime() > flQuickStart ) { m_HordeTimer.Start( flQuickStart ); } // TODO: Instead have some kind of 'is in a big fight' state? }
// increase intensity as aliens are killed (particularly if they're close to the marines) void CASW_Director::Event_AlienKilled( CBaseEntity *pAlien, const CTakeDamageInfo &info ) { if ( !pAlien ) return; CASW_Game_Resource *pGameResource = ASWGameResource(); if ( !pGameResource ) return; bool bDangerous = pAlien->Classify() == CLASS_ASW_SHIELDBUG; // shieldbug bool bVeryDangerous = pAlien->Classify() == CLASS_ASW_QUEEN; // queen for ( int i=0;i<pGameResource->GetMaxMarineResources();i++ ) { CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(i); if ( !pMR ) continue; CASW_Marine *pMarine = pMR->GetMarineEntity(); if ( !pMarine || pMarine->GetHealth() <= 0 ) continue; CASW_Intensity::IntensityType stress = CASW_Intensity::MILD; if ( bVeryDangerous ) { stress = CASW_Intensity::EXTREME; } else if ( bDangerous ) { stress = CASW_Intensity::HIGH; } else { float distance = pMarine->GetAbsOrigin().DistTo( pAlien->GetAbsOrigin() ); if ( distance > asw_intensity_far_range.GetFloat() ) { stress = CASW_Intensity::MILD; } else { stress = CASW_Intensity::MODERATE; } } pMR->GetIntensity()->Increase( stress ); } ASWArena()->Event_AlienKilled( pAlien, info ); }