Beispiel #1
0
  @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);
    }
  }
Beispiel #2
0
  @Override
  public boolean removeKnownObject(L2Object object) {
    if (!super.removeKnownObject(object)) return false;

    if (!(object instanceof L2Character)) return true;

    // get monster
    final L2MonsterInstance monster = (L2MonsterInstance) _activeObject;

    // monster has AI, inform about lost object
    if (monster.hasAI()) monster.getAI().notifyEvent(CtrlEvent.EVT_FORGET_OBJECT, object);

    // clear agro list
    if (monster.isVisible() && getKnownType(L2PcInstance.class).isEmpty()) monster.clearAggroList();

    return true;
  }