initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
65
java/src/game/ai/EntityAIExplode.java
Executable file
65
java/src/game/ai/EntityAIExplode.java
Executable file
|
@ -0,0 +1,65 @@
|
|||
package game.ai;
|
||||
|
||||
import game.entity.npc.EntityHaunter;
|
||||
import game.entity.types.EntityLiving;
|
||||
|
||||
public class EntityAIExplode extends EntityAIBase
|
||||
{
|
||||
EntityHaunter entity;
|
||||
EntityLiving target;
|
||||
|
||||
public EntityAIExplode(EntityHaunter entity)
|
||||
{
|
||||
this.entity = entity;
|
||||
this.setMutexBits(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the EntityAIBase should begin execution.
|
||||
*/
|
||||
public boolean shouldExecute()
|
||||
{
|
||||
EntityLiving entitylivingbase = this.entity.getAttackTarget();
|
||||
return this.entity.getExplodeState() > 0 || entitylivingbase != null && this.entity.getDistanceSqToEntity(entitylivingbase) < 9.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a one shot task or start executing a continuous task
|
||||
*/
|
||||
public void startExecuting()
|
||||
{
|
||||
this.entity.getNavigator().clearPathEntity();
|
||||
this.target = this.entity.getAttackTarget();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the task
|
||||
*/
|
||||
public void resetTask()
|
||||
{
|
||||
this.target = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the task
|
||||
*/
|
||||
public void updateTask()
|
||||
{
|
||||
if (this.target == null)
|
||||
{
|
||||
this.entity.setExplodeState(-1);
|
||||
}
|
||||
else if (this.entity.getDistanceSqToEntity(this.target) > 49.0D)
|
||||
{
|
||||
this.entity.setExplodeState(-1);
|
||||
}
|
||||
else if (!this.entity.getEntitySenses().canSee(this.target))
|
||||
{
|
||||
this.entity.setExplodeState(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.entity.setExplodeState(1);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue