Fixed skill abort casting.
This commit is contained in:
parent
9bac3a6a40
commit
24dbe34180
@ -723,8 +723,29 @@ public class SkillCaster implements Runnable
|
||||
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
|
||||
{
|
||||
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
|
||||
// If there is a queued skill, launch it and wipe the queue.
|
||||
if (caster.isPlayer())
|
||||
@ -743,23 +764,6 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked())
|
||||
{
|
||||
if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
{
|
||||
if (_skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (_skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calcSkillTiming(L2Character creature, Skill skill)
|
||||
@ -868,7 +872,7 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable
|
||||
// Apply channeling skills on the targets.
|
||||
if (skill.getChannelingSkillId() > 0)
|
||||
{
|
||||
final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1);
|
||||
if (baseSkill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !");
|
||||
_channelizer.abortCast();
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
final L2Object target = skill.getTarget(_channelizer, false, false, false);
|
||||
if (target != null)
|
||||
|
@ -723,8 +723,29 @@ public class SkillCaster implements Runnable
|
||||
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
|
||||
{
|
||||
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
|
||||
// If there is a queued skill, launch it and wipe the queue.
|
||||
if (caster.isPlayer())
|
||||
@ -743,23 +764,6 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked())
|
||||
{
|
||||
if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
{
|
||||
if (_skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (_skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calcSkillTiming(L2Character creature, Skill skill)
|
||||
@ -868,7 +872,7 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable
|
||||
// Apply channeling skills on the targets.
|
||||
if (skill.getChannelingSkillId() > 0)
|
||||
{
|
||||
final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1);
|
||||
if (baseSkill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !");
|
||||
_channelizer.abortCast();
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
final L2Object target = skill.getTarget(_channelizer, false, false, false);
|
||||
if (target != null)
|
||||
|
@ -723,8 +723,29 @@ public class SkillCaster implements Runnable
|
||||
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
|
||||
{
|
||||
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
|
||||
// If there is a queued skill, launch it and wipe the queue.
|
||||
if (caster.isPlayer())
|
||||
@ -743,23 +764,6 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked())
|
||||
{
|
||||
if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
{
|
||||
if (_skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (_skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calcSkillTiming(L2Character creature, Skill skill)
|
||||
@ -868,7 +872,7 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable
|
||||
// Apply channeling skills on the targets.
|
||||
if (skill.getChannelingSkillId() > 0)
|
||||
{
|
||||
final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1);
|
||||
if (baseSkill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !");
|
||||
_channelizer.abortCast();
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
final L2Object target = skill.getTarget(_channelizer, false, false, false);
|
||||
if (target != null)
|
||||
|
@ -723,8 +723,29 @@ public class SkillCaster implements Runnable
|
||||
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
|
||||
{
|
||||
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
|
||||
// If there is a queued skill, launch it and wipe the queue.
|
||||
if (caster.isPlayer())
|
||||
@ -743,23 +764,6 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked())
|
||||
{
|
||||
if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
{
|
||||
if (_skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (_skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calcSkillTiming(L2Character creature, Skill skill)
|
||||
@ -868,7 +872,7 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable
|
||||
// Apply channeling skills on the targets.
|
||||
if (skill.getChannelingSkillId() > 0)
|
||||
{
|
||||
final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1);
|
||||
if (baseSkill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !");
|
||||
_channelizer.abortCast();
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
final L2Object target = skill.getTarget(_channelizer, false, false, false);
|
||||
if (target != null)
|
||||
|
@ -723,8 +723,29 @@ public class SkillCaster implements Runnable
|
||||
caster.sendPacket(ActionFailed.get(_castingType)); // send an "action failed" packet to the caster
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (caster.getAI().getNextIntention() == null))
|
||||
{
|
||||
if ((_skill.getNextAction() == NextActionType.ATTACK) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if ((_skill.getNextAction() == NextActionType.CAST) && (target != null) && (target != caster) && target.isAutoAttackable(caster))
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
caster.getAI().notifyEvent(CtrlEvent.EVT_FINISH_CASTING);
|
||||
}
|
||||
|
||||
// Notify the AI of the L2Character with EVT_FINISH_CASTING
|
||||
|
||||
// If there is a queued skill, launch it and wipe the queue.
|
||||
if (caster.isPlayer())
|
||||
@ -743,23 +764,6 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Attack target after skill use
|
||||
// TODO: This shouldnt be here. If skill condition fail, you still go autoattack. This doesn't happen if skill is in cooldown though.
|
||||
if ((_skill.getNextAction() != NextActionType.NONE) && (target != null) && (target != caster) && target.canBeAttacked())
|
||||
{
|
||||
if ((caster.getAI().getIntention() == null) || (caster.getAI().getIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
|
||||
{
|
||||
if (_skill.getNextAction() == NextActionType.ATTACK)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
|
||||
}
|
||||
else if (_skill.getNextAction() == NextActionType.CAST)
|
||||
{
|
||||
caster.getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, _skill, target, _item, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void calcSkillTiming(L2Character creature, Skill skill)
|
||||
@ -868,7 +872,7 @@ public class SkillCaster implements Runnable
|
||||
*/
|
||||
public boolean canAbortCast()
|
||||
{
|
||||
return _targets == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
return getCaster().getTarget() == null; // When targets are allocated, that means skill is already launched, therefore cannot be aborted.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,14 +151,6 @@ public class SkillChannelizer implements Runnable
|
||||
// Apply channeling skills on the targets.
|
||||
if (skill.getChannelingSkillId() > 0)
|
||||
{
|
||||
final Skill baseSkill = SkillData.getInstance().getSkill(skill.getChannelingSkillId(), 1);
|
||||
if (baseSkill == null)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": skill " + skill + " couldn't find effect id skill: " + skill.getChannelingSkillId() + " !");
|
||||
_channelizer.abortCast();
|
||||
return;
|
||||
}
|
||||
|
||||
final List<L2Character> targetList = new ArrayList<>();
|
||||
final L2Object target = skill.getTarget(_channelizer, false, false, false);
|
||||
if (target != null)
|
||||
|
Loading…
Reference in New Issue
Block a user