Range checks for skill casting.
Contributed by Liamxroy.
This commit is contained in:
@@ -56,6 +56,7 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class manages AI of L2Attackable.
|
||||
@@ -926,6 +927,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), getActiveChar(), target, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isCharacter())
|
||||
{
|
||||
// Skip if target is already affected by such skill.
|
||||
|
@@ -164,6 +164,11 @@ public class SkillCaster implements Runnable
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), caster, target, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
castTime = castTime > -1 ? castTime : Formulas.calcHitTime(caster, skill);
|
||||
|
||||
// Schedule a thread that will execute 500ms before casting time is over (for animation issues and retail handling).
|
||||
@@ -359,6 +364,15 @@ public class SkillCaster implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(_skill.getEffectRange(), caster, target, true))
|
||||
{
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
caster.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gather list of affected targets by this skill.
|
||||
_targets = _skill.getTargetsAffected(caster, target);
|
||||
|
||||
|
@@ -56,6 +56,7 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class manages AI of L2Attackable.
|
||||
@@ -926,6 +927,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), getActiveChar(), target, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isCharacter())
|
||||
{
|
||||
// Skip if target is already affected by such skill.
|
||||
|
@@ -164,6 +164,11 @@ public class SkillCaster implements Runnable
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), caster, target, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
castTime = castTime > -1 ? castTime : Formulas.calcHitTime(caster, skill);
|
||||
|
||||
// Schedule a thread that will execute 500ms before casting time is over (for animation issues and retail handling).
|
||||
@@ -359,6 +364,15 @@ public class SkillCaster implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(_skill.getEffectRange(), caster, target, true))
|
||||
{
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
caster.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gather list of affected targets by this skill.
|
||||
_targets = _skill.getTargetsAffected(caster, target);
|
||||
|
||||
|
@@ -56,6 +56,7 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class manages AI of L2Attackable.
|
||||
@@ -926,6 +927,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), getActiveChar(), target, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isCharacter())
|
||||
{
|
||||
// Skip if target is already affected by such skill.
|
||||
|
@@ -164,6 +164,11 @@ public class SkillCaster implements Runnable
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), caster, target, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
castTime = castTime > -1 ? castTime : Formulas.calcHitTime(caster, skill);
|
||||
|
||||
// Schedule a thread that will execute 500ms before casting time is over (for animation issues and retail handling).
|
||||
@@ -359,6 +364,15 @@ public class SkillCaster implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(_skill.getEffectRange(), caster, target, true))
|
||||
{
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
caster.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gather list of affected targets by this skill.
|
||||
_targets = _skill.getTargetsAffected(caster, target);
|
||||
|
||||
|
@@ -56,6 +56,7 @@ import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jmobius.gameserver.model.skills.Skill;
|
||||
import com.l2jmobius.gameserver.model.skills.SkillCaster;
|
||||
import com.l2jmobius.gameserver.model.zone.ZoneId;
|
||||
import com.l2jmobius.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class manages AI of L2Attackable.
|
||||
@@ -926,6 +927,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), getActiveChar(), target, true))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.isCharacter())
|
||||
{
|
||||
// Skip if target is already affected by such skill.
|
||||
|
@@ -164,6 +164,11 @@ public class SkillCaster implements Runnable
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(skill.getCastRange(), caster, target, true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
castTime = castTime > -1 ? castTime : Formulas.calcHitTime(caster, skill);
|
||||
|
||||
// Schedule a thread that will execute 500ms before casting time is over (for animation issues and retail handling).
|
||||
@@ -359,6 +364,15 @@ public class SkillCaster implements Runnable
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Util.checkIfInRange(_skill.getEffectRange(), caster, target, true))
|
||||
{
|
||||
if (caster.isPlayer())
|
||||
{
|
||||
caster.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_STOPPED);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Gather list of affected targets by this skill.
|
||||
_targets = _skill.getTargetsAffected(caster, target);
|
||||
|
||||
|
Reference in New Issue
Block a user