diff options
author | Bond-009 <bond.009@outlook.com> | 2018-01-17 22:12:24 +0100 |
---|---|---|
committer | Alexander Harkness <me@bearbin.net> | 2018-01-17 22:12:24 +0100 |
commit | ec9e0eecf616bb190e4d0be76f1c120cac9eb60b (patch) | |
tree | 318307c5475351da91220f8200698783a8b5fd92 | |
parent | Prioritize hinge on the left side (#4153) (diff) | |
download | cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar.gz cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar.bz2 cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar.lz cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar.xz cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.tar.zst cuberite-ec9e0eecf616bb190e4d0be76f1c120cac9eb60b.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Entity.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index a051b3ffc..c811988bf 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -414,8 +414,19 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) Player->GetEquippedItem().GetHandler()->OnEntityAttack(Player, this); - // IsOnGround() only is false if the player is moving downwards // TODO: Better damage increase, and check for enchantments (and use magic critical instead of plain) + + // IsOnGround() only is false if the player is moving downwards + // Ref: https://minecraft.gamepedia.com/Damage#Critical_Hits + if (!Player->IsOnGround()) + { + if ((a_TDI.DamageType == dtAttack) || (a_TDI.DamageType == dtArrowAttack)) + { + a_TDI.FinalDamage *= 1.5; // 150% damage + m_World->BroadcastEntityAnimation(*this, 4); // Critical hit + } + } + const cEnchantments & Enchantments = Player->GetEquippedItem().m_Enchantments; int SharpnessLevel = static_cast<int>(Enchantments.GetLevel(cEnchantments::enchSharpness)); @@ -456,7 +467,7 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) case mtCaveSpider: case mtSilverfish: { - a_TDI.RawDamage += static_cast<int>(ceil(2.5 * BaneOfArthropodsLevel)); + a_TDI.FinalDamage += static_cast<int>(ceil(2.5 * BaneOfArthropodsLevel)); // The duration of the effect is a random value between 1 and 1.5 seconds at level I, // increasing the max duration by 0.5 seconds each level // Ref: https://minecraft.gamepedia.com/Enchanting#Bane_of_Arthropods @@ -519,15 +530,6 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI) } } - if (!Player->IsOnGround()) - { - if ((a_TDI.DamageType == dtAttack) || (a_TDI.DamageType == dtArrowAttack)) - { - a_TDI.FinalDamage += 2; - m_World->BroadcastEntityAnimation(*this, 4); // Critical hit - } - } - Player->GetStatManager().AddValue(statDamageDealt, static_cast<StatValue>(floor(a_TDI.FinalDamage * 10 + 0.5))); } |