TriggerSkillByAttack should never be triggered by skills.
Thanks to Sahar.
This commit is contained in:
parent
c96804ac6b
commit
5c2aced5eb
@ -49,6 +49,8 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
private final InstanceType _attackerType;
|
private final InstanceType _attackerType;
|
||||||
private int _allowWeapons;
|
private int _allowWeapons;
|
||||||
private final boolean _isCritical;
|
private final boolean _isCritical;
|
||||||
|
private final boolean _allowNormalAttack;
|
||||||
|
private final boolean _allowSkillAttack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param attachCond
|
* @param attachCond
|
||||||
@ -62,14 +64,17 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
super(attachCond, applyCond, set, params);
|
super(attachCond, applyCond, set, params);
|
||||||
|
|
||||||
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
||||||
_maxAttackerLevel = params.getInt("maxAttackerLevel", 100);
|
_maxAttackerLevel = params.getInt("maxAttackerLevel", 127);
|
||||||
_minDamage = params.getInt("minDamage", 1);
|
_minDamage = params.getInt("minDamage", 1);
|
||||||
_chance = params.getInt("chance", 100);
|
_chance = params.getInt("chance", 100);
|
||||||
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
|
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
|
||||||
_targetType = params.getEnum("targetType", TargetType.class, TargetType.SELF);
|
_targetType = params.getEnum("targetType", TargetType.class, TargetType.SELF);
|
||||||
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
||||||
_isCritical = params.getBoolean("isCritical", false);
|
_isCritical = params.getBoolean("isCritical", false);
|
||||||
if (params.getString("allowWeapons").equalsIgnoreCase("ALL"))
|
_allowNormalAttack = params.getBoolean("allowNormalAttack", true);
|
||||||
|
_allowSkillAttack = params.getBoolean("allowSkillAttack", false);
|
||||||
|
|
||||||
|
if (params.getString("allowWeapons", "ALL").equalsIgnoreCase("ALL"))
|
||||||
{
|
{
|
||||||
_allowWeapons = 0;
|
_allowWeapons = 0;
|
||||||
}
|
}
|
||||||
@ -82,13 +87,14 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAttackEvent(OnCreatureDamageDealt event)
|
private void onAttackEvent(OnCreatureDamageDealt event)
|
||||||
{
|
{
|
||||||
if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0)))
|
if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0)) || (!_allowNormalAttack && !_allowSkillAttack))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there is dependancy on critical.
|
||||||
if (_isCritical != event.isCritical())
|
if (_isCritical != event.isCritical())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -101,6 +107,18 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When no skill attacks are allowed.
|
||||||
|
if (!_allowSkillAttack && (event.getSkill() != null))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When no normal attacks are allowed.
|
||||||
|
if (!_allowNormalAttack && (event.getSkill() == null))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getAttacker() == event.getTarget())
|
if (event.getAttacker() == event.getTarget())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -49,6 +49,8 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
private final InstanceType _attackerType;
|
private final InstanceType _attackerType;
|
||||||
private int _allowWeapons;
|
private int _allowWeapons;
|
||||||
private final boolean _isCritical;
|
private final boolean _isCritical;
|
||||||
|
private final boolean _allowNormalAttack;
|
||||||
|
private final boolean _allowSkillAttack;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param attachCond
|
* @param attachCond
|
||||||
@ -62,14 +64,17 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
super(attachCond, applyCond, set, params);
|
super(attachCond, applyCond, set, params);
|
||||||
|
|
||||||
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
_minAttackerLevel = params.getInt("minAttackerLevel", 1);
|
||||||
_maxAttackerLevel = params.getInt("maxAttackerLevel", 100);
|
_maxAttackerLevel = params.getInt("maxAttackerLevel", 127);
|
||||||
_minDamage = params.getInt("minDamage", 1);
|
_minDamage = params.getInt("minDamage", 1);
|
||||||
_chance = params.getInt("chance", 100);
|
_chance = params.getInt("chance", 100);
|
||||||
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
|
_skill = new SkillHolder(params.getInt("skillId"), params.getInt("skillLevel", 1));
|
||||||
_targetType = params.getEnum("targetType", TargetType.class, TargetType.SELF);
|
_targetType = params.getEnum("targetType", TargetType.class, TargetType.SELF);
|
||||||
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
_attackerType = params.getEnum("attackerType", InstanceType.class, InstanceType.Creature);
|
||||||
_isCritical = params.getBoolean("isCritical", false);
|
_isCritical = params.getBoolean("isCritical", false);
|
||||||
if (params.getString("allowWeapons").equalsIgnoreCase("ALL"))
|
_allowNormalAttack = params.getBoolean("allowNormalAttack", true);
|
||||||
|
_allowSkillAttack = params.getBoolean("allowSkillAttack", false);
|
||||||
|
|
||||||
|
if (params.getString("allowWeapons", "ALL").equalsIgnoreCase("ALL"))
|
||||||
{
|
{
|
||||||
_allowWeapons = 0;
|
_allowWeapons = 0;
|
||||||
}
|
}
|
||||||
@ -82,13 +87,14 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onAttackEvent(OnCreatureDamageDealt event)
|
private void onAttackEvent(OnCreatureDamageDealt event)
|
||||||
{
|
{
|
||||||
if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0)))
|
if (event.isDamageOverTime() || (_chance == 0) || ((_skill.getSkillId() == 0) || (_skill.getSkillLevel() == 0)) || (!_allowNormalAttack && !_allowSkillAttack))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there is dependancy on critical.
|
||||||
if (_isCritical != event.isCritical())
|
if (_isCritical != event.isCritical())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -101,6 +107,18 @@ public class TriggerSkillByAttack extends AbstractEffect
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When no skill attacks are allowed.
|
||||||
|
if (!_allowSkillAttack && (event.getSkill() != null))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// When no normal attacks are allowed.
|
||||||
|
if (!_allowNormalAttack && (event.getSkill() == null))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getAttacker() == event.getTarget())
|
if (event.getAttacker() == event.getTarget())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user