Human: replace hardcoded difficulty values with constants in doFoodTick()

This commit is contained in:
Dylan K. Taylor 2018-05-19 16:32:30 +01:00
parent 807af2e6fb
commit 11cc9f19ad

View File

@ -656,7 +656,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
$this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN); $this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN);
} }
}elseif($food <= 0){ }elseif($food <= 0){
if(($difficulty === 1 and $health > 10) or ($difficulty === 2 and $health > 1) or $difficulty === 3){ if(($difficulty === Level::DIFFICULTY_EASY and $health > 10) or ($difficulty === Level::DIFFICULTY_NORMAL and $health > 1) or $difficulty === Level::DIFFICULTY_HARD){
$this->attack(new EntityDamageEvent($this, EntityDamageEvent::CAUSE_STARVATION, 1)); $this->attack(new EntityDamageEvent($this, EntityDamageEvent::CAUSE_STARVATION, 1));
} }
} }