mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-09 19:24:12 +00:00
Altered armour handling, now works for damage other than PvP
This commit is contained in:
@ -136,4 +136,25 @@ class EntityDamageEvent extends EntityEvent implements Cancellable{
|
||||
return array_sum($this->modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether an entity can use armour points to reduce this type of damage.
|
||||
* @return bool
|
||||
*/
|
||||
public function canBeReducedByArmor() : bool{
|
||||
switch($this->cause){
|
||||
case self::CAUSE_FIRE_TICK:
|
||||
case self::CAUSE_SUFFOCATION:
|
||||
case self::CAUSE_DROWNING:
|
||||
case self::CAUSE_STARVATION:
|
||||
case self::CAUSE_FALL:
|
||||
case self::CAUSE_VOID:
|
||||
case self::CAUSE_MAGIC:
|
||||
case self::CAUSE_SUICIDE:
|
||||
//TODO: lightning
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user