Make weakness effect only applicable for melee damage (#6489)

This commit is contained in:
Muqsit 2024-11-10 03:18:30 +08:00 committed by GitHub
parent b3b8aaddff
commit 8c04d47b1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -57,7 +57,7 @@ class EntityDamageByEntityEvent extends EntityDamageEvent{
$this->setModifier($this->getBaseDamage() * 0.3 * $strength->getEffectLevel(), self::MODIFIER_STRENGTH);
}
if(($weakness = $effects->get(VanillaEffects::WEAKNESS())) !== null){
if(($weakness = $effects->get(VanillaEffects::WEAKNESS())) !== null && $this->getCause() === EntityDamageEvent::CAUSE_ENTITY_ATTACK){
$this->setModifier(-($this->getBaseDamage() * 0.2 * $weakness->getEffectLevel()), self::MODIFIER_WEAKNESS);
}
}