summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.cpp
diff options
context:
space:
mode:
authorJaume Aloy <hircine45@gmail.com>2014-08-19 12:38:15 +0200
committerJaume Aloy <hircine45@gmail.com>2014-08-19 12:38:15 +0200
commitd3fd63c9eb5f783da0186efcef81a5b0eb9338d6 (patch)
tree58041caa169e5bd5ac4e5f6887ee24e2aea1d8b5 /src/Entities/Entity.cpp
parentMerge pull request #1329 from mc-server/Move (diff)
downloadcuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar.gz
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar.bz2
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar.lz
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar.xz
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.tar.zst
cuberite-d3fd63c9eb5f783da0186efcef81a5b0eb9338d6.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Entity.cpp62
1 files changed, 61 insertions, 1 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp
index 32f220897..398f7703b 100644
--- a/src/Entities/Entity.cpp
+++ b/src/Entities/Entity.cpp
@@ -316,8 +316,68 @@ bool cEntity::DoTakeDamage(TakeDamageInfo & a_TDI)
// 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)
- if (!Player->IsOnGround())
+
+ cEnchantments Enchantments = Player->GetEquippedItem().m_Enchantments;
+
+ int SharpnessLevel = Enchantments.GetLevel(cEnchantments::enchSharpness);
+ int SmiteLevel = Enchantments.GetLevel(cEnchantments::enchSmite);
+ int BaneOfArthropodsLevel = Enchantments.GetLevel(cEnchantments::enchBaneOfArthropods);
+
+ if (SharpnessLevel > 0)
+ {
+ a_TDI.RawDamage += 1.25 * SharpnessLevel;
+ }
+ else if (SmiteLevel > 0)
+ {
+ if (IsMob())
+ {
+ cMonster * Monster = (cMonster *)this;
+ switch (Monster->GetMobType())
+ {
+ case cMonster::mtSkeleton:
+ case cMonster::mtZombie:
+ case cMonster::mtWither:
+ case cMonster::mtZombiePigman:
+ {
+ a_TDI.RawDamage += 2.5 * SmiteLevel;
+ break;
+ }
+ }
+ }
+ }
+ else if (BaneOfArthropodsLevel > 0)
+ {
+ if (IsMob())
+ {
+ cMonster * Monster = (cMonster *)this;
+ switch (Monster->GetMobType())
+ {
+ case cMonster::mtSpider:
+ case cMonster::mtCaveSpider:
+ case cMonster::mtSilverfish:
+ {
+ a_TDI.RawDamage += 2.5 * BaneOfArthropodsLevel;
+ break;
+ }
+ }
+ }
+ }
+
+ int FireAspectLevel = Enchantments.GetLevel(cEnchantments::enchFireAspect);
+ if (FireAspectLevel > 0)
{
+ int BurnTicks = 3;
+
+ if (FireAspectLevel > 1)
+ {
+ BurnTicks += 4 * (FireAspectLevel - 1);
+ }
+
+ StartBurning(BurnTicks * 20);
+ }
+
+ if (!Player->IsOnGround())
+ {
if ((a_TDI.DamageType == dtAttack) || (a_TDI.DamageType == dtArrowAttack))
{
a_TDI.FinalDamage += 2;