HealthBoostEffect: Ensure that current health is within limits after reducing max health on removal(#5303)

This commit is contained in:
Ali 2022-09-24 15:45:12 +03:00 committed by GitHub
parent 93d4475111
commit 3c55db531d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,5 +33,8 @@ class HealthBoostEffect extends Effect{
public function remove(Living $entity, EffectInstance $instance) : void{
$entity->setMaxHealth($entity->getMaxHealth() - 4 * $instance->getEffectLevel());
if($entity->getHealth() > $entity->getMaxHealth()){
$entity->setHealth($entity->getMaxHealth());
}
}
}