Exemplo n.º 1
0
  public void powerOff(PowerControlUnitInstance powerUnit) {
    FortressSiegeEvent event = getEvent(FortressSiegeEvent.class);
    SpawnExObject exObject = event.getFirstObject(FortressSiegeEvent.IN_POWER_UNITS);

    int machineNumber = -1;
    for (int i = 0; i < 3; i++) {
      Spawner spawn = exObject.getSpawns().get(i);
      if (spawn == powerUnit.getSpawn()) {
        machineNumber = i;
      }
    }

    NpcString msg = null;
    switch (machineNumber) {
      case 0:
        msg = NpcString.MACHINE_NO_1_POWER_OFF;
        break;
      case 1:
        msg = NpcString.MACHINE_NO_2_POWER_OFF;
        break;
      case 2:
        msg = NpcString.MACHINE_NO_3_POWER_OFF;
        break;
      default:
        throw new IllegalArgumentException("Wrong spawn at fortress: " + event.getName());
    }

    _powerUnits--;
    Functions.npcShout(this, msg);
  }
Exemplo n.º 2
0
  @Override
  public void onBypassFeedback(Player player, String command) {
    if (!canBypassCheck(player, this)) {
      return;
    }

    if (_powerUnits != 0) {
      return;
    }

    Functions.npcShout(this, NpcString.FORTRESS_POWER_DISABLED);

    FortressSiegeEvent siegeEvent = getEvent(FortressSiegeEvent.class);
    if (siegeEvent == null) {
      return;
    }

    siegeEvent.spawnAction(FortressSiegeEvent.IN_POWER_UNITS, false);
    siegeEvent.barrackAction(3, true);

    siegeEvent.broadcastTo(
        SystemMsg.THE_BARRACKS_HAVE_BEEN_SEIZED, SiegeEvent.ATTACKERS, SiegeEvent.DEFENDERS);

    onDecay();

    siegeEvent.checkBarracks();
  }
Exemplo n.º 3
0
  @Override
  public void onEvtSpawn() {
    super.onEvtSpawn();

    ZONE_3.setActive(true);

    Functions.npcShout(
        getActor(),
        NpcString
            .HEH_HEH_I_SEE_THAT_THE_FEAST_HAS_BEGAN_BE_WARY_THE_CURSE_OF_THE_HELLMANN_FAMILY_HAS_POISONED_THIS_LAND);
  }
Exemplo n.º 4
0
  @Override
  public void onEvtDead(Creature killer) {
    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);

    ClanHallSiegeEvent siegeEvent = actor.getEvent(ClanHallSiegeEvent.class);
    if (siegeEvent == null) {
      return;
    }
    SpawnExObject spawnExObject = siegeEvent.getFirstObject(ClanHallSiegeEvent.BOSS);
    NpcInstance lidiaNpc = spawnExObject.getFirstSpawned();

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