From c20b16a0fe0ebb1e1e2a01b19375adaa4bae31a0 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Fri, 30 Mar 2018 11:31:30 +0100 Subject: [PATCH] Living: fixed damage resistance negating >100% of damage, closes #2052 --- src/pocketmine/entity/Living.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pocketmine/entity/Living.php b/src/pocketmine/entity/Living.php index 2aaff2db2..89fa52678 100644 --- a/src/pocketmine/entity/Living.php +++ b/src/pocketmine/entity/Living.php @@ -445,7 +445,7 @@ abstract class Living extends Entity implements Damageable{ $cause = $source->getCause(); if($this->hasEffect(Effect::DAMAGE_RESISTANCE) and $cause !== EntityDamageEvent::CAUSE_VOID and $cause !== EntityDamageEvent::CAUSE_SUICIDE){ - $source->setDamage(-($source->getFinalDamage() * 0.20 * $this->getEffect(Effect::DAMAGE_RESISTANCE)->getEffectLevel()), EntityDamageEvent::MODIFIER_RESISTANCE); + $source->setDamage(-$source->getFinalDamage() * min(1, 0.2 * $this->getEffect(Effect::DAMAGE_RESISTANCE)->getEffectLevel()), EntityDamageEvent::MODIFIER_RESISTANCE); } $totalEpf = 0;