Removed AttackableAI casting skills with the onIntentionAttack method.

Contributed by Trance.
This commit is contained in:
MobiusDevelopment 2020-05-24 00:20:36 +00:00
parent 48fa46afea
commit 3e8fa12b47
18 changed files with 53 additions and 305 deletions

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -913,7 +913,6 @@ public class AttackableAI extends CreatureAI
final WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(oldTarget);
return;

View File

@ -112,7 +112,6 @@ public class AttackableAI extends CreatureAI
/** The flag used to indicate that a thinking action is in progress, to prevent recursive thinking. */
private boolean _thinking;
private int _chaosTime = 0;
private int _lastBuffTick;
// Fear parameters
private int _fearTime;
private Future<?> _fearTask = null;
@ -381,22 +380,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((_lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
if (checkSkillCastConditions(getActiveChar(), buff) && !_actor.isAffectedBySkill(buff.getId()))
{
_actor.setTarget(_actor);
_actor.doCast(buff);
_actor.setTarget(target);
break;
}
}
_lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -1834,16 +1817,19 @@ public class AttackableAI extends CreatureAI
{
return false;
}
// Character is in "skill disabled" mode.
if (caster.isSkillDisabled(skill))
{
return false;
}
// If is a static skill and magic skill and character is muted or is a physical skill muted and character is physically muted.
if (!skill.isStatic() && ((skill.isMagic() && caster.isMuted()) || caster.isPhysicalMuted()))
{
return false;
}
return true;
}
@ -1853,6 +1839,7 @@ public class AttackableAI extends CreatureAI
{
return null;
}
final Attackable actor = getActiveChar();
if (!sk.hasEffectType(EffectType.DISPEL, EffectType.DISPEL_BY_SLOT))
{

View File

@ -112,7 +112,6 @@ public class AttackableAI extends CreatureAI
/** The flag used to indicate that a thinking action is in progress, to prevent recursive thinking. */
private boolean _thinking;
private int _chaosTime = 0;
private int _lastBuffTick;
// Fear parameters
private int _fearTime;
private Future<?> _fearTask = null;
@ -381,22 +380,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((_lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
if (checkSkillCastConditions(getActiveChar(), buff) && !_actor.isAffectedBySkill(buff.getId()))
{
_actor.setTarget(_actor);
_actor.doCast(buff);
_actor.setTarget(target);
break;
}
}
_lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -1834,16 +1817,19 @@ public class AttackableAI extends CreatureAI
{
return false;
}
// Character is in "skill disabled" mode.
if (caster.isSkillDisabled(skill))
{
return false;
}
// If is a static skill and magic skill and character is muted or is a physical skill muted and character is physically muted.
if (!skill.isStatic() && ((skill.isMagic() && caster.isMuted()) || caster.isPhysicalMuted()))
{
return false;
}
return true;
}
@ -1853,6 +1839,7 @@ public class AttackableAI extends CreatureAI
{
return null;
}
final Attackable actor = getActiveChar();
if (!sk.hasEffectType(EffectType.DISPEL, EffectType.DISPEL_BY_SLOT))
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{

View File

@ -83,7 +83,6 @@ public class AttackableAI extends CreatureAI
private boolean _thinking;
private int chaostime = 0;
int lastBuffTick;
public AttackableAI(Attackable attackable)
{
@ -267,23 +266,6 @@ public class AttackableAI extends CreatureAI
// Calculate the attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getInstance().getGameTicks();
// self and buffs
if ((lastBuffTick + 30) < GameTimeController.getInstance().getGameTicks())
{
for (Skill buff : getActiveChar().getTemplate().getAISkills(AISkillScope.BUFF))
{
final Creature buffTarget = skillTargetReconsider(buff, true);
if (buffTarget != null)
{
setTarget(buffTarget);
_actor.doCast(buff);
setTarget(target);
break;
}
}
lastBuffTick = GameTimeController.getInstance().getGameTicks();
}
// Manage the Attack Intention : Stop current Attack (if necessary), Start a new Attack and Launch Think Event
super.onIntentionAttack(target);
}
@ -295,10 +277,12 @@ public class AttackableAI extends CreatureAI
{
return;
}
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(_skill)))
{
return;
}
setIntention(AI_INTENTION_ACTIVE);
_actor.doCast(_skill, _item, _forceUse, _dontMove);
}
@ -316,6 +300,7 @@ public class AttackableAI extends CreatureAI
{
final Attackable npc = getActiveChar();
WorldObject target = getTarget();
// Update every 1s the _globalAggro counter to come close to 0
if (_globalAggro != 0)
{