summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorJaume Aloy <hircine45@gmail.com>2014-08-31 11:28:42 +0200
committerJaume Aloy <hircine45@gmail.com>2014-08-31 11:28:42 +0200
commit6180f7df095c228530e4c0d2bfaa90fed7b11f49 (patch)
tree6fe80e11d9a381b944dea492759f45d46dddd3ec /src/Entities/Entity.cpp
parentAdded a_Digger check (diff)
downloadcuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.gz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.bz2
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.lz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.xz
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.tar.zst
cuberite-6180f7df095c228530e4c0d2bfaa90fed7b11f49.zip
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r--src/Entities/Entity.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 10a0f8920..e36ed6c37 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -396,7 +396,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
}
int ThornsLevel = 0;
- cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
+ const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
{
cItem Item = ArmorItems[i];
@@ -428,7 +428,8 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
Player->GetStatManager().AddValue(statDamageDealt, (StatValue)floor(a_TDI.FinalDamage * 10 + 0.5));
}
- if (IsPlayer()){
+ if (IsPlayer())
+ {
double TotalEPF = 0.0;
double EPFProtection = 0.00;
double EPFFireProtection = 0.00;
@@ -436,7 +437,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
double EPFProjectileProtection = 0.00;
double EPFFeatherFalling = 0.00;
- cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
+ const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
{
cItem Item = ArmorItems[i];
@@ -469,7 +470,6 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
TotalEPF = EPFProtection + EPFFireProtection + EPFFeatherFalling + EPFBlastProtection + EPFProjectileProtection;
-
EPFProtection = EPFProtection / TotalEPF;
EPFFireProtection = EPFFireProtection / TotalEPF;
EPFFeatherFalling = EPFFeatherFalling / TotalEPF;
@@ -507,8 +507,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
a_TDI.FinalDamage -= RemovedDamage;
}
-
-
+
m_Health -= (short)a_TDI.FinalDamage;
@@ -516,7 +515,6 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
m_Health = std::max(m_Health, 0);
-
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
{
int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment