mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-23 04:59:46 +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());
|
return in_array($this->type, func_get_args());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function attackEntity($entity){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function addVelocity($vX, $vY = 0, $vZ = 0)
|
public function addVelocity($vX, $vY = 0, $vZ = 0)
|
||||||
{
|
{
|
||||||
if($vX instanceof Vector3){
|
if($vX instanceof Vector3){
|
||||||
|
|
|
||||||
|
|
@ -8,4 +8,8 @@ class Monster extends Creature{
|
||||||
public function getAttackDamage(){
|
public function getAttackDamage(){
|
||||||
return 2;
|
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->moveTo($this->target->x, floor($ai->entity->y), $this->target->z);
|
||||||
$ai->mobController->lookOn($this->target);
|
$ai->mobController->lookOn($this->target);
|
||||||
if($ai->entity->boundingBox->intersectsWith($this->target->boundingBox) && $this->attackTime <= 0){
|
if($ai->entity->boundingBox->intersectsWith($this->target->boundingBox) && $this->attackTime <= 0){
|
||||||
|
$ai->entity->attackEntity($this->target);
|
||||||
$this->attackTime = 20;
|
$this->attackTime = 20;
|
||||||
$this->target->harm($ai->entity->getAttackDamage(), $ai->entity->eid);
|
|
||||||
}
|
}
|
||||||
--$this->attackTime;
|
--$this->attackTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ class Creeper extends Monster{
|
||||||
$this->setState($v === null ? !$this->getState() : $v);
|
$this->setState($v === null ? !$this->getState() : $v);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue