mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-24 13:39:44 +00:00
attackEntity method was added
This commit is contained in:
parent
89ee29a30a
commit
45b36cb034
4 changed files with 50 additions and 40 deletions
|
|
@ -189,6 +189,10 @@ class Entity extends Position
|
|||
return in_array($this->type, func_get_args());
|
||||
}
|
||||
|
||||
public function attackEntity($entity){
|
||||
|
||||
}
|
||||
|
||||
public function addVelocity($vX, $vY = 0, $vZ = 0)
|
||||
{
|
||||
if($vX instanceof Vector3){
|
||||
|
|
|
|||
|
|
@ -8,4 +8,8 @@ class Monster extends Creature{
|
|||
public function getAttackDamage(){
|
||||
return 2;
|
||||
}
|
||||
|
||||
public function attackEntity($entity){
|
||||
$entity->harm($this->getAttackDamage(), $this->eid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ class TaskAttackPlayer extends TaskTempt
|
|||
$ai->mobController->moveTo($this->target->x, floor($ai->entity->y), $this->target->z);
|
||||
$ai->mobController->lookOn($this->target);
|
||||
if($ai->entity->boundingBox->intersectsWith($this->target->boundingBox) && $this->attackTime <= 0){
|
||||
$ai->entity->attackEntity($this->target);
|
||||
$this->attackTime = 20;
|
||||
$this->target->harm($ai->entity->getAttackDamage(), $ai->entity->eid);
|
||||
}
|
||||
--$this->attackTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class Creeper extends Monster{
|
|||
$this->setState($v === null ? !$this->getState() : $v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue