Exemplo n.º 1
0
void CSDKPlayer::CheatImpulseCommands( int iImpulse )
{
	if ( iImpulse != 101 )
	{
		BaseClass::CheatImpulseCommands( iImpulse );
		return ;
	}
	gEvilImpulse101 = true;

	EquipSuit();

	GiveNamedItem( "weapon_mp5" );
	GiveNamedItem( "weapon_grenade" );
	GiveNamedItem( "weapon_shotgun" );

	// Give the player everything!
	GiveAmmo( 90, AMMO_BULLETS );
	GiveAmmo( 3, AMMO_GRENADE );
	
	if ( GetHealth() < 100 )
	{
		TakeHealth( 25, DMG_GENERIC );
	}

	gEvilImpulse101		= false;
}
Exemplo n.º 2
0
//=========================================================
// Regeneración de salud.
//=========================================================
void CFR_Player::HealthRegeneration()
{
	if ( m_iNectar <= 0 || m_iHealth >= GetMaxHealth() )
		return;

	SetNectar(m_iNectar - fr_nectar_healthpenalty.GetInt());
	TakeHealth(fr_nectar_healthregen.GetInt(), DMG_GENERIC);
}
//-----------------------------------------------------------------------------
// Purpose: Powerup has just started
//-----------------------------------------------------------------------------
void CBaseCombatCharacter::PowerupStart( int iPowerup, float flAmount, CBaseEntity *pAttacker, CDamageModifier *pDamageModifier )
{
	Assert( iPowerup >= 0 && iPowerup < MAX_POWERUPS );

	switch( iPowerup )
	{
	case POWERUP_BOOST:
		{
			// Players can be boosted over their max
			int iMaxBoostedHealth;
			if ( IsPlayer() )
			{
				iMaxBoostedHealth = GetMaxHealth() + GetMaxHealth() / 2;
			}
			else
			{
				iMaxBoostedHealth = GetMaxHealth();
			}

			// Can we boost health further?
			if ( GetHealth() < iMaxBoostedHealth )
			{
				int maxHealthToAdd = iMaxBoostedHealth - GetHealth();

				// It uses floating point in here so it doesn't lose the fractional healing part on small frame times.
				float flHealthToAdd = flAmount + m_flFractionalBoost;
				int nHealthToAdd = (int)flHealthToAdd;
				m_flFractionalBoost = flHealthToAdd - nHealthToAdd; 
				if ( nHealthToAdd )
				{
					int nHealthAdded = min( nHealthToAdd, maxHealthToAdd );
					if ( IsPlayer() )
					{
						((CBaseTFPlayer*)this)->TakeHealthBoost( nHealthAdded, GetMaxHealth(), 25 );
					}
					else
					{
						TakeHealth( nHealthAdded, DMG_GENERIC );
					}

					TFStats()->IncrementPlayerStat( pAttacker, TF_PLAYER_STAT_HEALTH_GIVEN, nHealthAdded );
				}
			}
		}
		break;

	case POWERUP_EMP:
		{
			// EMP removes adrenalin rush
			SetPowerup( POWERUP_RUSH, false );
		}
		break;

	default:
		break;
	}
}
//=========================================================
// Ejecuta un comando de tipo impulse <iImpulse>
//=========================================================
void CSCP_Player::CheatImpulseCommands(int iImpulse)
{
	if ( !sv_cheats->GetBool() )
		return;

	switch ( iImpulse )
	{
		case 102:
		{
			if ( GetHealth() < GetMaxHealth() )
				TakeHealth(GetMaxHealth(), DMG_GENERIC);

			return;
		}

		default:
			BaseClass::CheatImpulseCommands(iImpulse);
	}
}
Exemplo n.º 5
0
//=========================================================
// Ejecuta un comando de tipo impulse <iImpulse>
//=========================================================
void CFR_Player::CheatImpulseCommands(int iImpulse)
{
	if ( !sv_cheats->GetBool() )
		return;

	if ( iImpulse == 102 )
	{
		if ( GetHealth() < GetMaxHealth() )
			TakeHealth(GetMaxHealth(), DMG_GENERIC);

		if ( GetNectar() < GetMaxNectar() )
			TakeNectar(GetMaxNectar());

		return;
	}

	switch ( iImpulse )
	{
		default:
			BaseClass::CheatImpulseCommands(iImpulse);
	}
}
Exemplo n.º 6
0
void CSDKPlayer::CheatImpulseCommands( int iImpulse )
{
	if ( !sv_cheats->GetBool() )
	{
		return;
	}

	if ( iImpulse != 101 )
	{
		BaseClass::CheatImpulseCommands( iImpulse );
		return ;
	}
	gEvilImpulse101 = true;

	EquipSuit();
	
	if ( GetHealth() < 100 )
	{
		TakeHealth( 25, DMG_GENERIC );
	}

	gEvilImpulse101		= false;
}
Exemplo n.º 7
0
void CSDKPlayer::PostThink()
{
	BaseClass::PostThink();

	// Keep the model upright; pose params will handle pitch aiming.
	QAngle angles = GetLocalAngles();
	angles[PITCH] = 0;
	SetLocalAngles(angles);

	if ( m_flNextMouseoverUpdate < gpGlobals->curtime )
	{
		m_flNextMouseoverUpdate = gpGlobals->curtime + 0.2f;
		if ( m_bShowHints )
		{
			#ifdef PLAYER_MOUSEOVER_HINTS
			UpdateMouseoverHints();
			#endif
		}
	}

#ifdef PLAYER_HEALTH_REGEN
	// Regenerate heath after 3 seconds
	if ( IsAlive() && GetHealth() < GetMaxHealth() )
	{
		// Color to overlay on the screen while the player is taking damage
		color32 hurtScreenOverlay = {64,0,0,64};

		if ( gpGlobals->curtime > m_fTimeLastHurt + sv_regeneration_wait_time.GetFloat() )
		{
			TakeHealth( 1, DMG_GENERIC );
			m_bIsRegenerating = true;

			if ( GetHealth() >= GetMaxHealth() )
			{
				m_bIsRegenerating = false;
			}
		}
		else
		{
			m_bIsRegenerating = false;
			UTIL_ScreenFade( this, hurtScreenOverlay, 1.0f, 0.1f, FFADE_IN|FFADE_PURGE );
		}
	}
#else
	// HACK!: Make it so that when we fall, we show red!
	if ( IsAlive() && GetHealth() < GetMaxHealth() )
	{
		// Color to overlay on the screen while the player is taking damage
		color32 hurtScreenOverlay = {64,0,0,64};

		if ( gpGlobals->curtime > m_fTimeLastHurt + sv_regeneration_wait_time.GetFloat() )
		{
			if ( GetHealth() >= GetMaxHealth() )
			{
				// Nothing at all???
			}
		}
		else
		{
			UTIL_ScreenFade( this, hurtScreenOverlay, 1.0f, 0.1f, FFADE_IN|FFADE_PURGE );
		}
	}
#endif

}
Exemplo n.º 8
0
//=========================================================
// ZapBeam - heavy damage directly forward
//=========================================================
void CISlave :: ZapBeam( int side )
{
	Vector vecSrc, vecAim;
	TraceResult tr;
	CBaseEntity *pEntity;

	if (m_iBeams >= ISLAVE_MAX_BEAMS)
		return;

	vecSrc = pev->origin + gpGlobals->v_up * 36;
	vecAim = ShootAtEnemy( vecSrc );
	float deflection = 0.01;
	vecAim = vecAim + side * gpGlobals->v_right * RANDOM_FLOAT( 0, deflection ) + gpGlobals->v_up * RANDOM_FLOAT( -deflection, deflection );
	UTIL_TraceLine ( vecSrc, vecSrc + vecAim * 1024, dont_ignore_monsters, ENT( pev ), &tr);

	m_pBeam[m_iBeams] = CBeam::BeamCreate( "sprites/lgtning.spr", 50 );
	if (!m_pBeam[m_iBeams])
		return;

	m_pBeam[m_iBeams]->PointEntInit( tr.vecEndPos, entindex( ) );
	m_pBeam[m_iBeams]->SetEndAttachment( side < 0 ? 2 : 1 );
	m_pBeam[m_iBeams]->SetColor( 180, 255, 96 );
	m_pBeam[m_iBeams]->SetBrightness( 255 );
	m_pBeam[m_iBeams]->SetNoise( 20 );
	m_iBeams++;

	pEntity = CBaseEntity::Instance(tr.pHit);
	if (pEntity != NULL && pEntity->pev->takedamage)
	{
		pEntity->TraceAttack( pev, gSkillData.slaveDmgZap, vecAim, &tr, DMG_SHOCK );

		//im fat!
//		pev->renderfx = kRenderFxFatness;
		pev->renderamt += 10;

/*
		if (pev->health <=100 )
        pev->renderamt = 20;

		if (pev->health <=110 )
		pev->renderamt = 30;

		if (pev->health <=120 )
		pev->renderamt = 40;

		if (pev->health <=130 )
		pev->renderamt = 50;

		if (pev->health <=140 )
		pev->renderamt = 60;
*/

		TakeHealth(500, DMG_GENERIC);//150
	}

	//sys
/*	CSprite *pSprite = CSprite::SpriteCreate( "sprites/exp_end.spr", tr.vecEndPos, TRUE );
					
	pSprite->SetTransparency( kRenderTransAlpha, 222, 222, 222, 88, kRenderFxNone );
	pSprite->SetScale( 5.0 );
	pSprite->Expand( 5 , RANDOM_FLOAT( 140.0, 160.0 )  );
	pSprite->pev->frame = 0;
*/
	UTIL_DecalTrace( &tr, DECAL_SMALLSCORCH1 );

	UTIL_EmitAmbientSound( ENT(pev), tr.vecEndPos, "weapons/electro4.wav", 0.5, ATTN_NORM, 0, RANDOM_LONG( 140, 160 ) );
}