* @return boolean
*/
@Override
protected boolean createNewTask()
{
final NpcInstance actor = getActor();
if (actor == null)
{
return true;
}
if (!BaiumManager.getZone().checkIfInZone(actor))
{
teleportHome();
return false;
}
clearTasks();
Creature target = prepareTarget();
if (target == null)
{
return false;
}
if (!BaiumManager.getZone().checkIfInZone(target))
{
actor.getAggroList().remove(target, false);
return false;
}
final int s_energy_wave = 20;
final int s_earth_quake = 20;
final int s_group_hold = (actor.getCurrentHpPercents() > 50) ? 0 : 20;
final int s_thunderbolt = (actor.getCurrentHpPercents() > 25) ? 0 : 20;
Skill r_skill = null;
if (actor.isMovementDisabled())
{
r_skill = thunderbolt;
}
else if (!Rnd.chance(100 - s_thunderbolt - s_group_hold - s_energy_wave - s_earth_quake))
{
final Map<Skill, Integer> d_skill = new HashMap<>();
final double distance = actor.getDistance(target);
addDesiredSkill(d_skill, target, distance, energy_wave);
addDesiredSkill(d_skill, target, distance, earth_quake);
if (s_group_hold > 0)
{
addDesiredSkill(d_skill, target, distance, group_hold);