Fixed style
This commit is contained in:
parent
4900645b28
commit
6180f7df09
@ -396,7 +396,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int ThornsLevel = 0;
|
int ThornsLevel = 0;
|
||||||
cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
|
const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
|
||||||
{
|
{
|
||||||
cItem Item = ArmorItems[i];
|
cItem Item = ArmorItems[i];
|
||||||
@ -428,7 +428,8 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
Player->GetStatManager().AddValue(statDamageDealt, (StatValue)floor(a_TDI.FinalDamage * 10 + 0.5));
|
Player->GetStatManager().AddValue(statDamageDealt, (StatValue)floor(a_TDI.FinalDamage * 10 + 0.5));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPlayer()){
|
if (IsPlayer())
|
||||||
|
{
|
||||||
double TotalEPF = 0.0;
|
double TotalEPF = 0.0;
|
||||||
double EPFProtection = 0.00;
|
double EPFProtection = 0.00;
|
||||||
double EPFFireProtection = 0.00;
|
double EPFFireProtection = 0.00;
|
||||||
@ -436,7 +437,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
double EPFProjectileProtection = 0.00;
|
double EPFProjectileProtection = 0.00;
|
||||||
double EPFFeatherFalling = 0.00;
|
double EPFFeatherFalling = 0.00;
|
||||||
|
|
||||||
cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
|
const cItem ArmorItems[] = { GetEquippedHelmet(), GetEquippedChestplate(), GetEquippedLeggings(), GetEquippedBoots() };
|
||||||
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
|
for (size_t i = 0; i < ARRAYCOUNT(ArmorItems); i++)
|
||||||
{
|
{
|
||||||
cItem Item = ArmorItems[i];
|
cItem Item = ArmorItems[i];
|
||||||
@ -469,7 +470,6 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
TotalEPF = EPFProtection + EPFFireProtection + EPFFeatherFalling + EPFBlastProtection + EPFProjectileProtection;
|
TotalEPF = EPFProtection + EPFFireProtection + EPFFeatherFalling + EPFBlastProtection + EPFProjectileProtection;
|
||||||
|
|
||||||
|
|
||||||
EPFProtection = EPFProtection / TotalEPF;
|
EPFProtection = EPFProtection / TotalEPF;
|
||||||
EPFFireProtection = EPFFireProtection / TotalEPF;
|
EPFFireProtection = EPFFireProtection / TotalEPF;
|
||||||
EPFFeatherFalling = EPFFeatherFalling / TotalEPF;
|
EPFFeatherFalling = EPFFeatherFalling / TotalEPF;
|
||||||
@ -507,8 +507,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
a_TDI.FinalDamage -= RemovedDamage;
|
a_TDI.FinalDamage -= RemovedDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_Health -= (short)a_TDI.FinalDamage;
|
m_Health -= (short)a_TDI.FinalDamage;
|
||||||
|
|
||||||
@ -516,7 +515,6 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
|
|||||||
|
|
||||||
m_Health = std::max(m_Health, 0);
|
m_Health = std::max(m_Health, 0);
|
||||||
|
|
||||||
|
|
||||||
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
|
if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
|
||||||
{
|
{
|
||||||
int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment
|
int KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback); // More common enchantment
|
||||||
|
@ -1963,6 +1963,8 @@ void cPlayer::UseEquippedItem(int a_Amount)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the item has an unbreaking enchantment, give it a random chance of not breaking:
|
||||||
cItem Item = GetEquippedItem();
|
cItem Item = GetEquippedItem();
|
||||||
int UnbreakingLevel = Item.m_Enchantments.GetLevel(cEnchantments::enchUnbreaking);
|
int UnbreakingLevel = Item.m_Enchantments.GetLevel(cEnchantments::enchUnbreaking);
|
||||||
if (UnbreakingLevel > 0)
|
if (UnbreakingLevel > 0)
|
||||||
@ -1983,6 +1985,7 @@ void cPlayer::UseEquippedItem(int a_Amount)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetInventory().DamageEquippedItem(a_Amount))
|
if (GetInventory().DamageEquippedItem(a_Amount))
|
||||||
{
|
{
|
||||||
m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
m_World->BroadcastSoundEffect("random.break", GetPosX(), GetPosY(), GetPosZ(), 0.5f, (float)(0.75 + ((float)((GetUniqueID() * 23) % 32)) / 64));
|
||||||
|
@ -94,7 +94,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
struct CreatorData
|
struct CreatorData
|
||||||
{
|
{
|
||||||
CreatorData(int a_UniqueID, const AString & a_Name, cEnchantments a_Enchantments) :
|
CreatorData(int a_UniqueID, const AString & a_Name, const cEnchantments & a_Enchantments) :
|
||||||
m_UniqueID(a_UniqueID),
|
m_UniqueID(a_UniqueID),
|
||||||
m_Name(a_Name),
|
m_Name(a_Name),
|
||||||
m_Enchantments(a_Enchantments)
|
m_Enchantments(a_Enchantments)
|
||||||
|
Loading…
Reference in New Issue
Block a user