Fixed clamping issues
This commit is contained in:
@@ -327,10 +327,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
||||
|
||||
// TODO: Apply damage to armor
|
||||
|
||||
if (m_Health < 0)
|
||||
{
|
||||
m_Health = 0;
|
||||
}
|
||||
m_Health = std::max(m_Health, 0);
|
||||
|
||||
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
|
||||
{
|
||||
|
||||
@@ -382,10 +382,7 @@ short cPlayer::DeltaExperience(short a_Xp_delta)
|
||||
m_CurrentXp += a_Xp_delta;
|
||||
|
||||
// Make sure they didn't subtract too much
|
||||
if (m_CurrentXp < 0)
|
||||
{
|
||||
m_CurrentXp = 0;
|
||||
}
|
||||
m_CurrentXp = std::max<short int>(m_CurrentXp, 0);
|
||||
|
||||
// Update total for score calculation
|
||||
if (a_Xp_delta > 0)
|
||||
|
||||
@@ -44,10 +44,7 @@ public:
|
||||
// y = -0.25x + 1, where x is the distance from the player. Approximation for potion splash.
|
||||
// TODO: better equation
|
||||
double Reduction = -0.25 * SplashDistance + 1.0;
|
||||
if (Reduction < 0)
|
||||
{
|
||||
Reduction = 0;
|
||||
}
|
||||
Reduction = std::max(Reduction, 0.0);
|
||||
|
||||
((cPawn *) a_Entity)->AddEntityEffect(m_EntityEffectType, m_EntityEffect.GetDuration(), m_EntityEffect.GetIntensity(), Reduction);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user