summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--src/Entities/Player.cpp12
-rw-r--r--src/Item.cpp20
2 files changed, 32 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())
diff --git a/src/Item.cpp b/src/Item.cpp
index fdce06d1c..d421a95ad 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -41,22 +41,42 @@ short cItem::GetMaxDamage(void) const
switch (m_ItemType)
{
case E_ITEM_BOW: return 384;
+ case E_ITEM_CHAIN_BOOTS: return 196;
+ case E_ITEM_CHAIN_CHESTPLATE:return 241;
+ case E_ITEM_CHAIN_HELMET: return 166;
+ case E_ITEM_CHAIN_LEGGINGS: return 226;
case E_ITEM_DIAMOND_AXE: return 1561;
+ case E_ITEM_DIAMOND_BOOTS: return 430;
+ case E_ITEM_DIAMOND_CHESTPLATE: return 529;
+ case E_ITEM_DIAMOND_HELMET: return 364;
case E_ITEM_DIAMOND_HOE: return 1561;
+ case E_ITEM_DIAMOND_LEGGINGS:return 496;
case E_ITEM_DIAMOND_PICKAXE: return 1561;
case E_ITEM_DIAMOND_SHOVEL: return 1561;
case E_ITEM_DIAMOND_SWORD: return 1561;
case E_ITEM_FLINT_AND_STEEL: return 64;
case E_ITEM_GOLD_AXE: return 32;
+ case E_ITEM_GOLD_BOOTS: return 92;
+ case E_ITEM_GOLD_CHESTPLATE: return 113;
+ case E_ITEM_GOLD_HELMET: return 78;
case E_ITEM_GOLD_HOE: return 32;
+ case E_ITEM_GOLD_LEGGINGS: return 106;
case E_ITEM_GOLD_PICKAXE: return 32;
case E_ITEM_GOLD_SHOVEL: return 32;
case E_ITEM_GOLD_SWORD: return 32;
case E_ITEM_IRON_AXE: return 250;
+ case E_ITEM_IRON_BOOTS: return 196;
+ case E_ITEM_IRON_CHESTPLATE: return 241;
+ case E_ITEM_IRON_HELMET: return 166;
case E_ITEM_IRON_HOE: return 250;
+ case E_ITEM_IRON_LEGGINGS: return 226;
case E_ITEM_IRON_PICKAXE: return 250;
case E_ITEM_IRON_SHOVEL: return 250;
case E_ITEM_IRON_SWORD: return 250;
+ case E_ITEM_LEATHER_BOOTS: return 66;
+ case E_ITEM_LEATHER_CAP: return 55;
+ case E_ITEM_LEATHER_PANTS: return 76;
+ case E_ITEM_LEATHER_TUNIC: return 81;
case E_ITEM_SHEARS: return 250;
case E_ITEM_STONE_AXE: return 131;
case E_ITEM_STONE_HOE: return 131;