@Override public boolean onActionTime() { if (_skill == null) return true; int mpConsume = _skill.getMpConsume(); if (mpConsume > getEffector().getCurrentMp()) { getEffector() .sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SKILL_REMOVED_DUE_LACK_MP)); return false; } getEffector().reduceCurrentMp(mpConsume); List<L2Character> targets = new ArrayList<>(); for (L2Character cha : _actor .getKnownList() .getKnownTypeInRadius(L2Character.class, getSkill().getSkillRadius())) { if (_skill.isOffensive() && !L2Skill.checkForAreaOffensiveSkills(getEffector(), cha, _skill, _srcInArena)) continue; // there doesn't seem to be a visible effect with MagicSkillLaunched packet... _actor.broadcastPacket( new MagicSkillUse(_actor, cha, _skill.getId(), _skill.getLevel(), 0, 0)); targets.add(cha); } if (!targets.isEmpty()) getEffector().callSkill(_skill, targets.toArray(new L2Character[targets.size()])); return true; }
@Override public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) { if (!(activeChar instanceof L2PcInstance)) return; if (targets == null) return; for (L2Object tgt : targets) { if (!(tgt instanceof L2MonsterInstance)) continue; final L2MonsterInstance target = (L2MonsterInstance) tgt; if (target.isDead()) continue; if (target.getSpoilerId() != 0) { activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_SPOILED)); continue; } if (Formulas.calcMagicSuccess(activeChar, (L2Character) tgt, skill)) { target.setSpoilerId(activeChar.getObjectId()); activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.SPOIL_SUCCESS)); } else activeChar.sendPacket( SystemMessage.getSystemMessage(SystemMessageId.S1_RESISTED_YOUR_S2) .addCharName(target) .addSkillName(skill.getId())); target.getAI().notifyEvent(CtrlEvent.EVT_ATTACKED, activeChar); } }
private void load() { final File dir = new File("./data/xml/skills"); for (File file : dir.listFiles()) { DocumentSkill doc = new DocumentSkill(file); doc.parse(); for (L2Skill skill : doc.getSkills()) _skills.put(getSkillHashCode(skill), skill); } _log.info("SkillTable: Loaded " + _skills.size() + " skills."); // Stores max level of skills in a map for future uses. for (final L2Skill skill : _skills.values()) { // Only non-enchanted skills final int skillLvl = skill.getLevel(); if (skillLvl < 99) { final int skillId = skill.getId(); final int maxLvl = getMaxLevel(skillId); if (skillLvl > maxLvl) _skillMaxLevel.put(skillId, skillLvl); } } // Loading FrequentSkill enumeration values for (FrequentSkill sk : FrequentSkill.values()) sk._skill = getInfo(sk._id, sk._level); for (int i = 0; i < _heroSkillsId.length; i++) _heroSkills[i] = getInfo(_heroSkillsId[i], 1); for (int i = 0; i < _nobleSkills.length; i++) _nobleSkills[i] = getInfo(_nobleSkillsId[i], 1); }
@Override public String onSpellFinished(L2Npc npc, L2PcInstance player, L2Skill skill) { if (skill.getId() == 4589) attack(((L2Attackable) npc), player); return super.onSpellFinished(npc, player, skill); }
public ConfirmDlg addSkillName(L2Skill skill) { return addSkillName(skill.getId(), skill.getLevel()); }
/** * Provides the skill hash * * @param skill The L2Skill to be hashed * @return SkillTable.getSkillHashCode(skill.getId(), skill.getLevel()) */ public static int getSkillHashCode(L2Skill skill) { return getSkillHashCode(skill.getId(), skill.getLevel()); }