fixed target invalidation for 2 tasks

This commit is contained in:
GameHerobrine 2024-03-20 04:10:06 +03:00
parent 773e18282c
commit b81438ee23
5 changed files with 24 additions and 9 deletions

View file

@ -8,9 +8,16 @@ class Monster extends Creature{
public function getAttackDamage(){
return 2;
}
/**
*
* @see Entity::attackEntity()
*/
public function attackEntity($entity, $distance){
$entity->harm($this->getAttackDamage(), $this->eid);
return true;
if($distance < 2.0 && $entity->boundingBox->maxX > $this->boundingBox->minY && $entity->boundingBox->minY < $this->boundingBox->maxY){
$entity->harm($this->getAttackDamage(), $this->eid);
return true;
}else{
return false;
}
}
}