mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-08 04:38:35 +00:00
HealthBoostEffect: Ensure that current health is within limits after reducing max health on removal(#5303)
This commit is contained in:
parent
93d4475111
commit
3c55db531d
@ -33,5 +33,8 @@ class HealthBoostEffect extends Effect{
|
|||||||
|
|
||||||
public function remove(Living $entity, EffectInstance $instance) : void{
|
public function remove(Living $entity, EffectInstance $instance) : void{
|
||||||
$entity->setMaxHealth($entity->getMaxHealth() - 4 * $instance->getEffectLevel());
|
$entity->setMaxHealth($entity->getMaxHealth() - 4 * $instance->getEffectLevel());
|
||||||
|
if($entity->getHealth() > $entity->getMaxHealth()){
|
||||||
|
$entity->setHealth($entity->getMaxHealth());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user