}
}
// Smart Cubic debuff cancel is 100%
boolean UseCubicCure = false;
L2Skill skill = null;
if (_id >= SMART_CUBIC_EVATEMPLAR && _id <= SMART_CUBIC_SPECTRALMASTER)
{
L2Effect[] effects = owner.getAllEffects();
for (L2Effect e : effects)
{
if (e != null && e.getSkill().isOffensive())
{
UseCubicCure = true;
e.exit(true);
}
}
}
if (UseCubicCure)
{
// Smart Cubic debuff cancel is needed, no other skill is used in this
// activation period
MagicSkillUser msu = new MagicSkillUser(owner, owner, SKILL_CUBIC_CURE, 1, 0, 0);
owner.broadcastPacket(msu);
}
else if (Rnd.get(100) < _chance)
{
skill = _skills.get(Rnd.get(_skills.size()));
if (skill != null)
{
if (skill.getId() == SKILL_CUBIC_HEAL)
{
// friendly skill, so we look a target in owner's party
cubicTargetForHeal();
}
else
{
// offensive skill, we look for an enemy target
getCubicTarget();
if (_target == owner || !isInCubicRange(owner, _target))
_target = null;
}
final L2Character target = _target;
if ((target != null) && (!target.isDead()))
{
if (Config.DEBUG)
{
_log.info("L2CubicInstance: Action.run();");
_log.info("Cubic Id: "
+ _id
+ " Target: "
+ target.getName()
+ " distance: "
+ Math.sqrt(target.getDistanceSq(owner.getX(), owner.getY(), owner.getZ())));
}
owner.broadcastPacket(new MagicSkillUser(owner, target, skill.getId(), skill.getLevel(), 0, 0));
SkillType type = skill.getSkillType();
ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(skill.getSkillType());
L2Character[] targets = { target };
if ((type == SkillType.PARALYZE) || (type == SkillType.STUN)
|| (type == SkillType.ROOT)
|| (type == SkillType.AGGDAMAGE))