Updated armor cover calculation. (#3858)
* Updated armor damage calculation. + Added lua docs, added casts from float to int. * Changed verbage in docstring and comment.
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user