package ai.instance.tiamatStrongHold;
import java.util.concurrent.Future;
import com.aionemu.gameserver.ai.AIActions;
import com.aionemu.gameserver.ai.AIName;
import com.aionemu.gameserver.ai.NpcAI;
import com.aionemu.gameserver.ai.poll.AIQuestion;
import com.aionemu.gameserver.model.gameobjects.Npc;
import com.aionemu.gameserver.utils.ThreadPoolManager;
/**
* @author Cheatkiller, Luzien
*/
@AIName("gravity")
public class GravityAI extends NpcAI {
private Future<?> task;
public GravityAI(Npc owner) {
super(owner);
}
@Override
protected void handleSpawned() {
super.handleSpawned();
task = ThreadPoolManager.getInstance().scheduleAtFixedRate(() -> AIActions.useSkill(GravityAI.this, 20738), 0, 3250);
ThreadPoolManager.getInstance().schedule(() -> AIActions.deleteOwner(GravityAI.this), 20000);
}
@Override
public void handleDespawned() {
if (task != null)
task.cancel(true);
super.handleDespawned();
}
@Override
public boolean ask(AIQuestion question) {
return switch (question) {
case ALLOW_DECAY, ALLOW_RESPAWN, REWARD_AP_XP_DP_LOOT -> false;
default -> super.ask(question);
};
}
}