private void makeCast(EffectChanceSkillTrigger effect, L2Character target) { try { if (effect == null || !effect.triggersChanceSkill()) return; L2Skill triggered = SkillTable.getInstance() .getInfo(effect.getTriggeredChanceId(), effect.getTriggeredChanceLevel()); if (triggered == null) return; L2Character caster = triggered.getTargetType() == L2Skill.SkillTargetType.TARGET_SELF ? _owner : effect.getEffector(); if (caster == null || triggered.getSkillType() == L2SkillType.NOTDONE || caster.isSkillDisabled(triggered)) return; if (triggered.getReuseDelay() > 0) caster.disableSkill(triggered, triggered.getReuseDelay()); L2Object[] targets = triggered.getTargetList(caster, false, target); if (targets.length == 0) return; L2Character firstTarget = (L2Character) targets[0]; ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(triggered.getSkillType()); _owner.broadcastPacket( new MagicSkillLaunched(_owner, triggered.getId(), triggered.getLevel(), targets)); _owner.broadcastPacket( new MagicSkillUse(_owner, firstTarget, triggered.getId(), triggered.getLevel(), 0, 0)); // Launch the magic skill and calculate its effects // TODO: once core will support all possible effects, use effects (not handler) if (handler != null) handler.useSkill(caster, triggered, targets); else triggered.useSkill(caster, targets); } catch (Exception e) { _log.log(Level.WARNING, "", e); } }
private void makeCast(L2Skill skill, L2Character target) { try { if (skill.getWeaponDependancy(_owner) && skill.checkCondition(_owner, target, false)) { if (skill .triggersChanceSkill()) // skill will trigger another skill, but only if its not chance // skill { skill = SkillTable.getInstance() .getInfo(skill.getTriggeredChanceId(), skill.getTriggeredChanceLevel()); if (skill == null || skill.getSkillType() == L2SkillType.NOTDONE) return; } if (_owner.isSkillDisabled(skill)) return; if (skill.getReuseDelay() > 0) _owner.disableSkill(skill, skill.getReuseDelay()); L2Object[] targets = skill.getTargetList(_owner, false, target); if (targets.length == 0) return; L2Character firstTarget = (L2Character) targets[0]; ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(skill.getSkillType()); _owner.broadcastPacket( new MagicSkillLaunched(_owner, skill.getId(), skill.getLevel(), targets)); _owner.broadcastPacket( new MagicSkillUse(_owner, firstTarget, skill.getId(), skill.getLevel(), 0, 0)); // Launch the magic skill and calculate its effects // TODO: once core will support all possible effects, use effects (not handler) if (handler != null) handler.useSkill(_owner, skill, targets); else skill.useSkill(_owner, targets); } } catch (Exception e) { _log.log(Level.WARNING, "", e); } }