Beispiel #1
0
  /**
   * Method onEvtAggression.
   *
   * @param attacker Creature
   * @param aggro int
   */
  @Override
  protected void onEvtAggression(Creature attacker, int aggro) {
    final NpcInstance actor = (NpcInstance) getActor();
    final Player player = attacker.getPlayer();

    if ((player == null) || (actor == null)) {
      return;
    }

    final SiegeEvent<?, ?> siegeEvent1 = actor.getEvent(SiegeEvent.class);
    final SiegeEvent<?, ?> siegeEvent2 = player.getEvent(SiegeEvent.class);
    final SiegeClanObject siegeClan =
        siegeEvent1.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());

    if ((siegeEvent2 == null) || ((siegeEvent1.equals(siegeEvent2)) && (siegeClan != null))) {
      ThreadPoolManager.getInstance().schedule(new notifyGuard(player), 1000);
    }
  }
  /**
   * Method onEvtDead.
   *
   * @param killer Creature
   */
  @Override
  public void onEvtDead(Creature killer) {
    final NpcInstance actor = getActor();
    super.onEvtDead(killer);
    ZONE_3.setActive(false);
    Functions.npcShout(actor, NpcString.AARGH_IF_I_DIE_THEN_THE_MAGIC_FORCE_FIELD_OF_BLOOD_WILL);
    final ClanHallSiegeEvent siegeEvent = actor.getEvent(ClanHallSiegeEvent.class);

    if (siegeEvent == null) {
      return;
    }

    final SpawnExObject spawnExObject = siegeEvent.getFirstObject(ClanHallSiegeEvent.BOSS);
    final NpcInstance lidiaNpc = spawnExObject.getFirstSpawned();

    if (lidiaNpc.getCurrentHpRatio() == 1.) {
      lidiaNpc.setCurrentHp(lidiaNpc.getMaxHp() >> 1, true);
    }
  }