/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai;
import lineage2.commons.util.Rnd;
import lineage2.gameserver.ai.DefaultAI;
import lineage2.gameserver.model.Creature;
import lineage2.gameserver.model.instances.NpcInstance;
import lineage2.gameserver.scripts.Functions;
import lineage2.gameserver.utils.Location;
/**
* @author Mobius
* @version $Revision: 1.0 $
*/
public class Rogin extends DefaultAI
{
/**
* Field points.
*/
static final Location[] points =
{
new Location(115756, -183472, -1480),
new Location(115866, -183287, -1480),
new Location(116280, -182918, -1520),
new Location(116587, -184306, -1568),
new Location(116392, -184090, -1560),
new Location(117083, -182538, -1528),
new Location(117802, -182541, -1528),
new Location(116720, -182479, -1528),
new Location(115857, -183295, -1480),
new Location(115756, -183472, -1480)
};
/**
* Field current_point.
*/
private int current_point = -1;
/**
* Field wait_timeout.
*/
private long wait_timeout = 0;
/**
* Field wait.
*/
private boolean wait = false;
/**
* Constructor for Rogin.
* @param actor NpcInstance
*/
public Rogin(NpcInstance actor)
{
super(actor);
}
/**
* Method isGlobalAI.
* @return boolean
*/
@Override
public boolean isGlobalAI()
{
return true;
}
/**
* Method thinkActive.
* @return boolean
*/
@Override
protected boolean thinkActive()
{
final NpcInstance actor = getActor();
if (actor.isDead())
{
return true;
}
if (_def_think)
{
doTask();
return true;
}
if ((System.currentTimeMillis() > wait_timeout) && ((current_point > -1) || Rnd.chance(5)))
{
if (!wait)
{
switch (current_point)
{
case 3:
wait_timeout = System.currentTimeMillis() + 15000;
Functions.npcSay(actor, "Have you seen Torocco today?");
wait = true;
return true;
case 6:
wait_timeout = System.currentTimeMillis() + 15000;
Functions.npcSay(actor, "Have you seen Torocco?");
wait = true;
return true;
case 7:
wait_timeout = System.currentTimeMillis() + 15000;
Functions.npcSay(actor, "Where is that fool hiding?");
wait = true;
return true;
case 8:
wait_timeout = System.currentTimeMillis() + 60000;
wait = true;
return true;
}
}
wait_timeout = 0;
wait = false;
current_point++;
if (current_point >= points.length)
{
current_point = 0;
}
addTaskMove(points[current_point], true);
doTask();
return true;
}
if (randomAnimation())
{
return true;
}
return false;
}
/**
* Method onEvtAttacked.
* @param attacker Creature
* @param damage int
*/
@Override
protected void onEvtAttacked(Creature attacker, int damage)
{
// empty method
}
/**
* Method onEvtAggression.
* @param target Creature
* @param aggro int
*/
@Override
protected void onEvtAggression(Creature target, int aggro)
{
// empty method
}
}