Implemented hunger-related regen and damage

This commit is contained in:
PEMapModder
2016-02-11 01:53:51 +08:00
parent 329a525ea1
commit 52e8781d36
5 changed files with 123 additions and 11 deletions

View File

@ -201,6 +201,14 @@ class Effect{
return ($this->duration % $interval) === 0;
}
return true;
case Effect::HUNGER:
if($this->amplifier < 0){ // prevents hacking with amplifier -1
return false;
}
if(($interval = 20) > 0){
return ($this->duration % $interval) === 0;
}
return true;
}
return false;
}
@ -225,6 +233,11 @@ class Effect{
$entity->heal($ev->getAmount(), $ev);
}
break;
case Effect::HUNGER:
if($entity instanceof Human){
$entity->exhaust(0.5 * $this->amplifier);
}
}
}