summaryrefslogtreecommitdiffstats
path: root/src/Entities/ArrowEntity.cpp
diff options
context:
space:
mode:
authorJaume Aloy <hircine45@gmail.com>2014-08-19 16:08:17 +0200
committerJaume Aloy <hircine45@gmail.com>2014-08-19 16:08:17 +0200
commit1897f678f93bb038fdc4caf1fb2995a28ef8f92e (patch)
tree08feb248f0a51b067fd61192ca10d3272dcd4d90 /src/Entities/ArrowEntity.cpp
parentAdded some Enchantments (diff)
downloadcuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.gz
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.bz2
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.lz
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.xz
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.zst
cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.zip
Diffstat (limited to 'src/Entities/ArrowEntity.cpp')
-rw-r--r--src/Entities/ArrowEntity.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/Entities/ArrowEntity.cpp b/src/Entities/ArrowEntity.cpp
index c4fd378fb..e71f30a66 100644
--- a/src/Entities/ArrowEntity.cpp
+++ b/src/Entities/ArrowEntity.cpp
@@ -109,18 +109,32 @@ void cArrowEntity::OnHitEntity(cEntity & a_EntityHit, const Vector3d & a_HitPos)
{
Damage += m_World->GetTickRandomNumber(Damage / 2 + 2);
}
- LOGD("Arrow hit an entity");
int PowerLevel = m_Creator->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPower);
if (PowerLevel > 0)
{
- LOGD("Arrow hit an entity 2");
int ExtraDamage = 0.25 * (PowerLevel + 1);
Damage += ceil(ExtraDamage);
}
- a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, 1);
+
+ int KnockbackAmount = 1;
+ int PunchLevel = m_Creator->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchPunch);
+ if (PunchLevel > 0)
+ {
+ Vector3f LookVector = m_Creator->GetLookVector();
+ Vector3f FinalSpeed = Vector3f(0, 0, 0);
+ switch (PunchLevel)
+ {
+ case 1: FinalSpeed = LookVector * Vector3d(5, 0.3, 5);
+ case 2: FinalSpeed = LookVector * Vector3d(8, 0.3, 8);
+ default: break;
+ }
+ a_EntityHit.SetSpeed(FinalSpeed);
+ }
+
+ a_EntityHit.TakeDamage(dtRangedAttack, this, Damage, KnockbackAmount);
- if (m_TicksLeftBurning > 0)
+ if ((m_TicksLeftBurning > 0 && !a_EntityHit.IsSubmerged() && !a_EntityHit.IsSwimming()))
{
a_EntityHit.StartBurning(100);
}