diff options
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Player.cpp | 27 |
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) { |