Re-introduction of cast target and skill target check.
This commit is contained in:
@@ -117,32 +117,7 @@ public abstract class AbstractAI implements Ctrl
|
||||
return _intention;
|
||||
}
|
||||
|
||||
protected void setCastTarget(Creature target)
|
||||
{
|
||||
_castTarget = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current cast target.
|
||||
*/
|
||||
public Creature getCastTarget()
|
||||
{
|
||||
return _castTarget;
|
||||
}
|
||||
|
||||
protected void setAttackTarget(Creature target)
|
||||
{
|
||||
_attackTarget = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return current attack target.
|
||||
*/
|
||||
@Override
|
||||
public Creature getAttackTarget()
|
||||
{
|
||||
return _attackTarget;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Intention of this AbstractAI.<br>
|
||||
@@ -834,6 +809,27 @@ public abstract class AbstractAI implements Ctrl
|
||||
_target = target;
|
||||
}
|
||||
|
||||
protected void setCastTarget(Creature target)
|
||||
{
|
||||
_castTarget = target;
|
||||
}
|
||||
|
||||
public Creature getCastTarget()
|
||||
{
|
||||
return _castTarget;
|
||||
}
|
||||
|
||||
protected void setAttackTarget(Creature target)
|
||||
{
|
||||
_attackTarget = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Creature getAttackTarget()
|
||||
{
|
||||
return _attackTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop all Ai tasks and futures.
|
||||
*/
|
||||
|
@@ -298,6 +298,16 @@ public class PlayerAI extends PlayableAI
|
||||
clientStopMoving(null);
|
||||
}
|
||||
|
||||
// Check if target has changed.
|
||||
final WorldObject currentTarget = _actor.getTarget();
|
||||
if ((currentTarget != target) && (currentTarget != null) && (target != null))
|
||||
{
|
||||
_actor.setTarget(target);
|
||||
_actor.doCast(_skill);
|
||||
_actor.setTarget(currentTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
_actor.doCast(_skill);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user