@Override public void useSkill(Creature activeChar, List<Creature> targets) { int sps = 0; if (isSSPossible()) sps = activeChar.getChargedSpiritShot(); for (Creature target : targets) if (target != null) { if (target.isDead()) continue; int magicLevel = getMagicLevel() == 0 ? activeChar.getLevel() : getMagicLevel(); int landRate = Rnd.get(30, 100); landRate *= target.getLevel(); landRate /= magicLevel; if (Rnd.chance(landRate)) { double mAtk = activeChar.getMAtk(target, this); if (sps == 2) mAtk *= 4; else if (sps == 1) mAtk *= 2; double mDef = target.getMDef(activeChar, this); if (mDef < 1.) mDef = 1.; double damage = Math.sqrt(mAtk) * this.getPower() * (target.getMaxMp() / 97) / mDef; boolean Mcrit = Formulas.calcMCrit(activeChar.getMagicCriticalRate(target, this)); if (Mcrit) { activeChar.sendPacket(Msg.MAGIC_CRITICAL_HIT); damage *= activeChar.calcStat( Stats.MAGIC_CRIT_DAMAGE, activeChar.isPlayable() && target.isPlayable() ? 2.5 : 3., target, this); } target.reduceCurrentMp(damage, activeChar); } else { SystemMessage msg = new SystemMessage(SystemMessage.C1_RESISTED_C2S_MAGIC) .addName(target) .addName(activeChar); activeChar.sendPacket(msg); target.sendPacket(msg); target.reduceCurrentHp( 1., 0, activeChar, this, true, true, false, true, false, false, true); } getEffects(activeChar, target, getActivateRate() > 0, false); } if (isSSPossible()) activeChar.unChargeShots(isMagic()); }
@Override public void useSkill(Creature activeChar, List<Creature> targets) { int sps = isSSPossible() ? isMagic() ? activeChar.getChargedSpiritShot() : activeChar.getChargedSoulShot() ? 2 : 0 : 0; Creature realTarget; boolean reflected; for (Creature target : targets) if (target != null) { if (target.isDead()) continue; reflected = target.checkReflectSkill(activeChar, this); realTarget = reflected ? activeChar : target; Formulas.AttackInfo info = Formulas.calcMagicDam(activeChar, realTarget, this, sps); if (info.damage >= 1) realTarget.reduceCurrentHp( info.damage, info.reflectableDamage, activeChar, this, true, true, false, true, false, false, true); getEffects(activeChar, target, getActivateRate() > 0, false, reflected); } if (isSuicideAttack()) activeChar.doDie(null); else if (isSSPossible()) activeChar.unChargeShots(isMagic()); }
@Override public void useSkill(Creature activeChar, List<Creature> targets) { if (!activeChar.isPlayer()) return; int ss = isSSPossible() ? isMagic() ? activeChar.getChargedSpiritShot() : activeChar.getChargedSoulShot() ? 2 : 0 : 0; if (ss > 0 && getPower() > 0) activeChar.unChargeShots(false); for (Creature target : targets) if (target != null && !target.isDead()) { if (target.isMonster()) if (((MonsterInstance) target).isSpoiled()) activeChar.sendPacket(Msg.ALREADY_SPOILED); else { MonsterInstance monster = (MonsterInstance) target; boolean success; if (!Config.ALT_SPOIL_FORMULA) { int monsterLevel = monster.getLevel(); int modifier = Math.abs(monsterLevel - activeChar.getLevel()); double rateOfSpoil = Config.BASE_SPOIL_RATE; if (modifier > 8) rateOfSpoil = rateOfSpoil - rateOfSpoil * (modifier - 8) * 9 / 100; rateOfSpoil = rateOfSpoil * getMagicLevel() / monsterLevel; if (rateOfSpoil < Config.MINIMUM_SPOIL_RATE) rateOfSpoil = Config.MINIMUM_SPOIL_RATE; else if (rateOfSpoil > 99.) rateOfSpoil = 99.; if (((Player) activeChar).isGM()) activeChar.sendMessage( new CustomMessage( "l2p.gameserver.skills.skillclasses.Spoil.Chance", (Player) activeChar) .addNumber((long) rateOfSpoil)); success = Rnd.chance(rateOfSpoil); } else success = Formulas.calcSkillSuccess(activeChar, target, this, getActivateRate()); if (success && monster.setSpoiled((Player) activeChar)) activeChar.sendPacket(Msg.THE_SPOIL_CONDITION_HAS_BEEN_ACTIVATED); else activeChar.sendPacket( new SystemMessage(SystemMessage.S1_HAS_FAILED) .addSkillName(_id, getDisplayLevel())); } if (getPower() > 0) { double damage, reflectableDamage = 0; if (isMagic()) { AttackInfo info = Formulas.calcMagicDam(activeChar, target, this, ss); damage = info.damage; reflectableDamage = info.reflectableDamage; } else { AttackInfo info = Formulas.calcPhysDam(activeChar, target, this, false, false, ss > 0, false); damage = info.damage; reflectableDamage = info.reflectableDamage; if (info.lethal_dmg > 0) target.reduceCurrentHp( info.lethal_dmg, reflectableDamage, activeChar, this, true, true, false, false, false, false, false); } target.reduceCurrentHp( damage, reflectableDamage, activeChar, this, true, true, false, true, false, false, true); target.doCounterAttack(this, activeChar, false); } getEffects(activeChar, target, false, false); target.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, Math.max(_effectPoint, 1)); } }