diff options
author | Jaume Aloy <hircine45@gmail.com> | 2014-08-19 16:08:17 +0200 |
---|---|---|
committer | Jaume Aloy <hircine45@gmail.com> | 2014-08-19 16:08:17 +0200 |
commit | 1897f678f93bb038fdc4caf1fb2995a28ef8f92e (patch) | |
tree | 08feb248f0a51b067fd61192ca10d3272dcd4d90 /src/Entities/ArrowEntity.cpp | |
parent | Added some Enchantments (diff) | |
download | cuberite-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.cpp | 22 |
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); } |