Re-introduction of cast target and skill target check.
This commit is contained in:
@@ -72,7 +72,7 @@ abstract class AbstractAI implements Ctrl
|
||||
|
||||
/** Different targets this AI maintains */
|
||||
private WorldObject _target;
|
||||
private Creature _castTarget;
|
||||
private WorldObject _castTarget;
|
||||
private Creature _attackTarget;
|
||||
private Creature _followTarget;
|
||||
|
||||
@@ -765,15 +765,12 @@ abstract class AbstractAI implements Ctrl
|
||||
_target = target;
|
||||
}
|
||||
|
||||
protected synchronized void setCastTarget(Creature target)
|
||||
protected synchronized void setCastTarget(WorldObject target)
|
||||
{
|
||||
_castTarget = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current cast target.
|
||||
*/
|
||||
public synchronized Creature getCastTarget()
|
||||
public synchronized WorldObject getCastTarget()
|
||||
{
|
||||
return _castTarget;
|
||||
}
|
||||
@@ -783,9 +780,6 @@ abstract class AbstractAI implements Ctrl
|
||||
_attackTarget = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return current attack target.
|
||||
*/
|
||||
@Override
|
||||
public synchronized Creature getAttackTarget()
|
||||
{
|
||||
|
@@ -278,7 +278,7 @@ public class CreatureAI extends AbstractAI
|
||||
}
|
||||
|
||||
// Set the AI cast target
|
||||
setCastTarget((Creature) target);
|
||||
setCastTarget(target);
|
||||
|
||||
// Stop actions client-side to cast the skill
|
||||
if (skill.getHitTime() > 50)
|
||||
|
@@ -196,9 +196,8 @@ public class PlayerAI extends CreatureAI
|
||||
|
||||
private void thinkCast()
|
||||
{
|
||||
final Creature target = getCastTarget();
|
||||
final WorldObject target = getCastTarget();
|
||||
final Skill skill = getSkill();
|
||||
// if (Config.DEBUG) LOGGER.warning("PlayerAI: thinkCast -> Start");
|
||||
if (checkTargetLost(target))
|
||||
{
|
||||
if (skill.isOffensive() && (getAttackTarget() != null))
|
||||
@@ -219,28 +218,17 @@ public class PlayerAI extends CreatureAI
|
||||
clientStopMoving(null);
|
||||
}
|
||||
|
||||
final WorldObject oldTarget = _actor.getTarget();
|
||||
if (oldTarget != null)
|
||||
// Check if target has changed.
|
||||
final WorldObject currentTarget = _actor.getTarget();
|
||||
if ((currentTarget != target) && (currentTarget != null) && (target != null))
|
||||
{
|
||||
// Replace the current target by the cast target
|
||||
if ((target != null) && (oldTarget != target))
|
||||
{
|
||||
_actor.setTarget(getCastTarget());
|
||||
}
|
||||
|
||||
// Launch the Cast of the skill
|
||||
_accessor.doCast(getSkill());
|
||||
|
||||
// Restore the initial target
|
||||
if ((target != null) && (oldTarget != target))
|
||||
{
|
||||
_actor.setTarget(oldTarget);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_accessor.doCast(skill);
|
||||
_actor.setTarget(target);
|
||||
_actor.doCast(skill);
|
||||
_actor.setTarget(currentTarget);
|
||||
return;
|
||||
}
|
||||
|
||||
_actor.doCast(skill);
|
||||
}
|
||||
|
||||
private void thinkPickUp()
|
||||
|
@@ -85,7 +85,7 @@ public class SummonAI extends CreatureAI
|
||||
|
||||
private void thinkCast()
|
||||
{
|
||||
final Creature target = getCastTarget();
|
||||
final WorldObject target = getCastTarget();
|
||||
if (checkTargetLost(target))
|
||||
{
|
||||
setCastTarget(null);
|
||||
|
Reference in New Issue
Block a user