summaryrefslogtreecommitdiffstats
path: root/src/Entities/Player.cpp
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-07-23 11:46:38 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2017-07-23 11:46:38 +0200
commit87af95b67cb45b72bffd77f7744dc1a10cb3f25a (patch)
tree516a9c969936fc0d42a251f4462a5d1f92781230 /src/Entities/Player.cpp
parentCreepers explode when burned by flint and steel (#3865) (diff)
downloadcuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar.gz
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar.bz2
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar.lz
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar.xz
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.tar.zst
cuberite-87af95b67cb45b72bffd77f7744dc1a10cb3f25a.zip
Diffstat (limited to 'src/Entities/Player.cpp')
-rw-r--r--src/Entities/Player.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index e4192140a..77ce378da 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -940,6 +940,22 @@ void cPlayer::SetFlying(bool a_IsFlying)
+void cPlayer::ApplyArmorDamage(int DamageBlocked)
+{
+ short ArmorDamage = static_cast<short>(DamageBlocked / 4);
+ if (ArmorDamage == 0)
+ {
+ ArmorDamage = 1;
+ }
+ m_Inventory.DamageItem(cInventory::invArmorOffset + 0, ArmorDamage);
+ m_Inventory.DamageItem(cInventory::invArmorOffset + 1, ArmorDamage);
+ m_Inventory.DamageItem(cInventory::invArmorOffset + 2, ArmorDamage);
+ m_Inventory.DamageItem(cInventory::invArmorOffset + 3, ArmorDamage);
+}
+
+
+
+
bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
{
@@ -976,17 +992,6 @@ bool cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI)
AddFoodExhaustion(0.3f);
SendHealth();
- // Damage armor
- short ArmorDamage = static_cast<short>(a_TDI.RawDamage / 4);
- if (ArmorDamage == 0)
- {
- ArmorDamage = 1;
- }
- m_Inventory.DamageItem(cInventory::invArmorOffset + 0, ArmorDamage);
- m_Inventory.DamageItem(cInventory::invArmorOffset + 1, ArmorDamage);
- m_Inventory.DamageItem(cInventory::invArmorOffset + 2, ArmorDamage);
- m_Inventory.DamageItem(cInventory::invArmorOffset + 3, ArmorDamage);
-
// Tell the wolves
if (a_TDI.Attacker != nullptr)
{