summaryrefslogtreecommitdiffstats
path: root/src/Entities
diff options
context:
space:
mode:
authorLane Kolbly <lane@rscheme.org>2017-05-31 18:50:13 +0200
committerLukas Pioch <lukas@zgow.de>2017-07-02 07:45:49 +0200
commit7c7f85117bcc5365381cf92c03d97a688195f9a4 (patch)
tree147249ed8c8a731f97ece05cd6e14fc5e090494f /src/Entities
parentFix horse taming (#3820) (diff)
downloadcuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar.gz
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar.bz2
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar.lz
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar.xz
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.tar.zst
cuberite-7c7f85117bcc5365381cf92c03d97a688195f9a4.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Player.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp
index 7232ed614..761337a30 100644
--- a/src/Entities/Player.cpp
+++ b/src/Entities/Player.cpp
@@ -976,6 +976,18 @@ 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)
{
if (a_TDI.Attacker->IsPawn())