コード例 #1
0
ファイル: Spoil.java プロジェクト: RostMyr/aCis
  @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);
    }
  }