Re-introduction of cast target and skill target check.

This commit is contained in:
MobiusDevelopment
2021-11-03 05:35:14 +00:00
parent 0b5708fd83
commit d9cb58d31c
164 changed files with 930 additions and 213 deletions

View File

@@ -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.
*/

View File

@@ -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);
}