mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Use static-analysis-friendly method for getting effects from EffectManager
fixes 5 phpstan level 8 errors
This commit is contained in:
@ -49,12 +49,12 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
|
||||
protected function addAttackerModifiers(Entity $damager) : void{
|
||||
if($damager instanceof Living){ //TODO: move this to entity classes
|
||||
$effects = $damager->getEffects();
|
||||
if($effects->has(VanillaEffects::STRENGTH())){
|
||||
$this->setModifier($this->getBaseDamage() * 0.3 * $effects->get(VanillaEffects::STRENGTH())->getEffectLevel(), self::MODIFIER_STRENGTH);
|
||||
if(($strength = $effects->get(VanillaEffects::STRENGTH())) !== null){
|
||||
$this->setModifier($this->getBaseDamage() * 0.3 * $strength->getEffectLevel(), self::MODIFIER_STRENGTH);
|
||||
}
|
||||
|
||||
if($effects->has(VanillaEffects::WEAKNESS())){
|
||||
$this->setModifier(-($this->getBaseDamage() * 0.2 * $effects->get(VanillaEffects::WEAKNESS())->getEffectLevel()), self::MODIFIER_WEAKNESS);
|
||||
if(($weakness = $effects->get(VanillaEffects::WEAKNESS())) !== null){
|
||||
$this->setModifier(-($this->getBaseDamage() * 0.2 * $weakness->getEffectLevel()), self::MODIFIER_WEAKNESS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user