예제 #1
0
void RPG_CharacterStats::Tick(float const deltaTime)
{
  if(m_healthRegenerationEnabled && (Vision::GetTimer()->GetTime() - GetLastDamageTime() >= m_healthRegenerationDelay)) // @todo: do we need server time here?
  {
    UpdateHealthRegeneration(deltaTime);
  }

  if(m_manaRegenerationEnabled)
  {
    UpdateManaRegeneration(deltaTime);
  }
}
예제 #2
0
//=========================================================
// Pensamiento: Nectar
//=========================================================
void CFR_Player::NectarThink()
{
	// Menos nectar para tu cuerpo.
	if ( random->RandomInt(0, 5) <= 2 && m_iNectar > 0 )
		--m_iNectar;

	DevMsg("m_iEmptyNectarSeconds: %i \r\n", m_iEmptyNectarSeconds);
	
	// ¡Te has quedado sin nectar!
	if ( m_iNectar <= 0 )
	{
		// Todavia te quedan unos segundos para recuperar el nectar perdido.
		if ( m_iEmptyNectarSeconds > 0 )
			--m_iEmptyNectarSeconds;

		// Sin nectar y sin segundos. Le quitamos salud cada 5 segs.
		else if ( GetLastDamageTime() < (gpGlobals->curtime - 5) )
		{
			CTakeDamageInfo damage;

			damage.SetAttacker(this);
			damage.SetInflictor(this);
			damage.SetDamageType(DMG_GENERIC);
			damage.SetDamage(random->RandomInt(10, 30)); // Entre 10 a 30 de daño.

			TakeDamage(damage);
		}
	}

	// Tienes nectar, restaurar los segundos para recuperarlo.
	else if ( m_iEmptyNectarSeconds != fr_emptynectar_seconds.GetInt() )
		m_iEmptyNectarSeconds = fr_emptynectar_seconds.GetInt();

	m_HL2Local.m_iNectar = GetNectar();
	SetNextThink(gpGlobals->curtime + 1, "NectarContext");
}