Exemple #1
0
  @Override
  public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isPet) {
    if (player == null) return null;

    // Retrieve the attacker.
    final L2Character originalAttacker = (isPet ? player.getPet() : player);

    // Make all mobs found in a radius 2k aggressive towards attacker.
    for (L2Attackable obj : player.getKnownList().getKnownTypeInRadius(L2Attackable.class, 2000)) {
      if (obj.isDead() || obj == npc) continue;

      obj.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, originalAttacker, 1);
    }

    return null;
  }
Exemple #2
0
 /**
  * Monster runs and attacks the playable.
  *
  * @param npc The npc to use.
  * @param playable The victim.
  * @param aggro The aggro to add, 999 if not given.
  */
 public static void attack(L2Attackable npc, L2Playable playable, int aggro) {
   npc.setIsRunning(true);
   npc.addDamageHate(playable, 0, (aggro <= 0) ? 999 : aggro);
   npc.getAI().setIntention(CtrlIntention.ATTACK, playable);
 }