Skill condition checks before auto skill use.
This commit is contained in:
parent
f1b0bc4c07
commit
4531b8962e
@ -88,7 +88,7 @@ public class ItemSkillsTemplate implements IItemHandler
|
||||
hasConsumeSkill = true;
|
||||
}
|
||||
|
||||
if (!itemSkill.hasEffectType(EffectType.SUMMON_PET) && !itemSkill.checkCondition(playable, playable.getTarget()))
|
||||
if (!itemSkill.hasEffectType(EffectType.SUMMON_PET) && !itemSkill.checkCondition(playable, playable.getTarget(), true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ public class EffectList
|
||||
}
|
||||
|
||||
// Check for passive skill conditions.
|
||||
if (!skill.checkCondition(info.getEffector(), info.getEffected()))
|
||||
if (!skill.checkCondition(info.getEffector(), info.getEffected(), true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ public abstract class Summon extends Playable
|
||||
}
|
||||
|
||||
// Check if all casting conditions are completed
|
||||
if (!skill.checkCondition(this, target))
|
||||
if (!skill.checkCondition(this, target, true))
|
||||
{
|
||||
// Send a Server->Client packet ActionFailed to the PlayerInstance
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
@ -8369,7 +8369,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Check if all casting conditions are completed
|
||||
if (!skill.checkCondition(this, target))
|
||||
if (!skill.checkCondition(this, target, true))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
@ -14062,7 +14062,7 @@ public class PlayerInstance extends Playable
|
||||
removeAutoSkill(skillId);
|
||||
continue;
|
||||
}
|
||||
if (!isAffectedBySkill(skillId) && !isInsideZone(ZoneId.PEACE) && !hasSkillReuse(skill.getReuseHashCode()))
|
||||
if (!isAffectedBySkill(skillId) && !isInsideZone(ZoneId.PEACE) && !hasSkillReuse(skill.getReuseHashCode()) && skill.checkCondition(this, this, false))
|
||||
{
|
||||
doCast(skill);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class Weapon extends Item
|
||||
}
|
||||
|
||||
// Skill condition not met
|
||||
if (!skill.checkCondition(caster, target))
|
||||
if (!skill.checkCondition(caster, target, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ public class Skill implements IIdentifiable
|
||||
return _effectPoint < 0;
|
||||
}
|
||||
|
||||
public boolean checkCondition(Creature creature, WorldObject object)
|
||||
public boolean checkCondition(Creature creature, WorldObject object, boolean sendMessage)
|
||||
{
|
||||
if (creature.isFakePlayer() || (creature.canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) && !Config.GM_SKILL_RESTRICTION))
|
||||
{
|
||||
@ -1059,7 +1059,7 @@ public class Skill implements IIdentifiable
|
||||
|
||||
if (!checkConditions(SkillConditionScope.GENERAL, creature, object) || !checkConditions(SkillConditionScope.TARGET, creature, object))
|
||||
{
|
||||
if (!((creature == object) && isBad())) // Self targeted bad skills should not send a message.
|
||||
if (sendMessage && !((creature == object) && isBad())) // Self targeted bad skills should not send a message.
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(_id);
|
||||
|
@ -797,7 +797,7 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
if (skill.checkCondition(creature, target))
|
||||
if (skill.checkCondition(creature, target, true))
|
||||
{
|
||||
if (creature.isSkillDisabled(skill))
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ public class EffectZone extends ZoneType
|
||||
for (Entry<Integer, Integer> e : _skills.entrySet())
|
||||
{
|
||||
final Skill skill = SkillData.getInstance().getSkill(e.getKey(), e.getValue());
|
||||
if ((skill != null) && (_bypassConditions || skill.checkCondition(character, character)))
|
||||
if ((skill != null) && (_bypassConditions || skill.checkCondition(character, character, true)))
|
||||
{
|
||||
if (character.getAffectedSkillLevel(skill.getId()) < skill.getLevel())
|
||||
{
|
||||
|
@ -88,7 +88,7 @@ public class ItemSkillsTemplate implements IItemHandler
|
||||
hasConsumeSkill = true;
|
||||
}
|
||||
|
||||
if (!itemSkill.hasEffectType(EffectType.SUMMON_PET) && !itemSkill.checkCondition(playable, playable.getTarget()))
|
||||
if (!itemSkill.hasEffectType(EffectType.SUMMON_PET) && !itemSkill.checkCondition(playable, playable.getTarget(), true))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ public class EffectList
|
||||
}
|
||||
|
||||
// Check for passive skill conditions.
|
||||
if (!skill.checkCondition(info.getEffector(), info.getEffected()))
|
||||
if (!skill.checkCondition(info.getEffector(), info.getEffected(), true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -680,7 +680,7 @@ public abstract class Summon extends Playable
|
||||
}
|
||||
|
||||
// Check if all casting conditions are completed
|
||||
if (!skill.checkCondition(this, target))
|
||||
if (!skill.checkCondition(this, target, true))
|
||||
{
|
||||
// Send a Server->Client packet ActionFailed to the PlayerInstance
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
@ -8303,7 +8303,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
// Check if all casting conditions are completed
|
||||
if (!skill.checkCondition(this, target))
|
||||
if (!skill.checkCondition(this, target, true))
|
||||
{
|
||||
sendPacket(ActionFailed.STATIC_PACKET);
|
||||
|
||||
@ -14040,7 +14040,7 @@ public class PlayerInstance extends Playable
|
||||
removeAutoSkill(skillId);
|
||||
continue;
|
||||
}
|
||||
if (!isAffectedBySkill(skillId) && !isInsideZone(ZoneId.PEACE) && !hasSkillReuse(skill.getReuseHashCode()))
|
||||
if (!isAffectedBySkill(skillId) && !isInsideZone(ZoneId.PEACE) && !hasSkillReuse(skill.getReuseHashCode()) && skill.checkCondition(this, this, false))
|
||||
{
|
||||
doCast(skill);
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class Weapon extends Item
|
||||
}
|
||||
|
||||
// Skill condition not met
|
||||
if (!skill.checkCondition(caster, target))
|
||||
if (!skill.checkCondition(caster, target, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1042,7 +1042,7 @@ public class Skill implements IIdentifiable
|
||||
return _effectPoint < 0;
|
||||
}
|
||||
|
||||
public boolean checkCondition(Creature creature, WorldObject object)
|
||||
public boolean checkCondition(Creature creature, WorldObject object, boolean sendMessage)
|
||||
{
|
||||
if (creature.isFakePlayer() || (creature.canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) && !Config.GM_SKILL_RESTRICTION))
|
||||
{
|
||||
@ -1059,7 +1059,7 @@ public class Skill implements IIdentifiable
|
||||
|
||||
if (!checkConditions(SkillConditionScope.GENERAL, creature, object) || !checkConditions(SkillConditionScope.TARGET, creature, object))
|
||||
{
|
||||
if (!((creature == object) && isBad())) // Self targeted bad skills should not send a message.
|
||||
if (sendMessage && !((creature == object) && isBad())) // Self targeted bad skills should not send a message.
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS);
|
||||
sm.addSkillName(_id);
|
||||
|
@ -797,7 +797,7 @@ public class SkillCaster implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
if (skill.checkCondition(creature, target))
|
||||
if (skill.checkCondition(creature, target, true))
|
||||
{
|
||||
if (creature.isSkillDisabled(skill))
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ public class EffectZone extends ZoneType
|
||||
for (Entry<Integer, Integer> e : _skills.entrySet())
|
||||
{
|
||||
final Skill skill = SkillData.getInstance().getSkill(e.getKey(), e.getValue());
|
||||
if ((skill != null) && (_bypassConditions || skill.checkCondition(character, character)))
|
||||
if ((skill != null) && (_bypassConditions || skill.checkCondition(character, character, true)))
|
||||
{
|
||||
if (character.getAffectedSkillLevel(skill.getId()) < skill.getLevel())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user