mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-30 15:01:19 +00:00
Living: Apply absorption after effect damage reduction is checked
This commit is contained in:
parent
92e966686e
commit
1822abc862
@ -355,12 +355,12 @@ abstract class Living extends Entity implements Damageable{
|
|||||||
* @param EntityDamageEvent $source
|
* @param EntityDamageEvent $source
|
||||||
*/
|
*/
|
||||||
public function applyDamageModifiers(EntityDamageEvent $source) : void{
|
public function applyDamageModifiers(EntityDamageEvent $source) : void{
|
||||||
$source->setDamage(-min($this->getAbsorption(), $source->getFinalDamage()), EntityDamageEvent::MODIFIER_ABSORPTION);
|
|
||||||
|
|
||||||
$cause = $source->getCause();
|
$cause = $source->getCause();
|
||||||
if($this->hasEffect(Effect::DAMAGE_RESISTANCE) and $cause !== EntityDamageEvent::CAUSE_VOID and $cause !== EntityDamageEvent::CAUSE_SUICIDE){
|
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() * 0.20 * $this->getEffect(Effect::DAMAGE_RESISTANCE)->getEffectLevel()), EntityDamageEvent::MODIFIER_RESISTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$source->setDamage(-min($this->getAbsorption(), $source->getFinalDamage()), EntityDamageEvent::MODIFIER_ABSORPTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user