summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-04-25 23:48:00 +0200
committerMattes D <github@xoft.cz>2014-04-25 23:48:00 +0200
commita4f21908b23ec004f13448ac38268042b6e7e02f (patch)
treed37e29a6200868cf23ec358daa1b11ad28eeb65c /src
parentUpdated MSVC side of CMake files after recent changes. (diff)
parentFix formatting (diff)
downloadcuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar.gz
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar.bz2
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar.lz
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar.xz
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.tar.zst
cuberite-a4f21908b23ec004f13448ac38268042b6e7e02f.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 6da6da54e..d0dd6fb50 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -326,9 +326,38 @@ void cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
m_Health = 0;
}
- if (IsMob() || IsPlayer()) // Knockback for only players and mobs
+ if ((IsMob() || IsPlayer()) && (a_TDI.Attacker != NULL)) // Knockback for only players and mobs
{
- AddSpeed(a_TDI.Knockback * 2);
+ int KnockbackLevel = 0;
+ if (a_TDI.Attacker->GetEquippedWeapon().m_ItemType == E_ITEM_BOW)
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ }
+ else
+ {
+ KnockbackLevel = a_TDI.Attacker->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchKnockback);
+ }
+
+ Vector3d additionalSpeed(0, 0, 0);
+ switch (KnockbackLevel)
+ {
+ case 1:
+ {
+ additionalSpeed.Set(5, .3, 5);
+ break;
+ }
+ case 2:
+ {
+ additionalSpeed.Set(8, .3, 8);
+ break;
+ }
+ default:
+ {
+ additionalSpeed.Set(2, .3, 2);
+ break;
+ }
+ }
+ AddSpeed(a_TDI.Knockback * additionalSpeed);
}
m_World->BroadcastEntityStatus(*this, esGenericHurt);
@@ -773,14 +802,12 @@ void cEntity::TickBurning(cChunk & a_Chunk)
// Remember the current burning state:
bool HasBeenBurning = (m_TicksLeftBurning > 0);
- if (GetWorld()->GetWeather() == eWeather_Rain)
+ if (m_World->IsWeatherWet())
{
- if (HasBeenBurning)
+ if (POSY_TOINT > m_World->GetHeight(POSX_TOINT, POSZ_TOINT))
{
m_TicksLeftBurning = 0;
- OnFinishedBurning();
- }
- return;
+ }
}
// Do the burning damage: