예제 #1
0
  @Override
  public void spawnObject(GlobalEvent event) {
    if (_flag == null) {
      _flag = new NpcInstance(IdFactory.getInstance().getNextId(), _flagTemplate);
      _flag.setCurrentHpMp(_flag.getMaxHp(), _flag.getMaxMp());
      _flag.setHasChatWindow(false);
      _flag.spawnMe(_flagLoc);
    } else if (_mob == null) {
      NpcTemplate template =
          _siegeClan == null || _siegeClan.getParam() == 0
              ? _mobTemplate
              : NpcHolder.getInstance().getTemplate((int) _siegeClan.getParam());

      _mob = (CTBBossInstance) template.getNewInstance();
      _mob.setCurrentHpMp(_mob.getMaxHp(), _mob.getMaxMp());
      _mob.setMatchTeamObject(this);
      _mob.addEvent(event);

      int x =
          (int) (_flagLoc.x + 300 * Math.cos(_mob.headingToRadians(_flag.getHeading() - 32768)));
      int y =
          (int) (_flagLoc.y + 300 * Math.sin(_mob.headingToRadians(_flag.getHeading() - 32768)));

      Location loc = new Location(x, y, _flag.getZ(), _flag.getHeading());
      _mob.setSpawnedLoc(loc);
      _mob.spawnMe(loc);
    } else throw new IllegalArgumentException("Cant spawn twice");
  }
 public SeedOfAnnihilationInstance(int objectId, NpcTemplate template) {
   super(objectId, template);
   if (ArrayUtils.contains(BISTAKON_MOBS, template.getNpcId()))
     addMinions(BISTAKON_MINIONS[Rnd.get(BISTAKON_MINIONS.length)], template);
   else if (ArrayUtils.contains(COKRAKON_MOBS, template.getNpcId()))
     addMinions(COKRAKON_MINIONS[Rnd.get(COKRAKON_MINIONS.length)], template);
 }
 private static void addMinions(int[] minions, NpcTemplate template) {
   if (minions != null && minions.length > 0)
     for (int id : minions) template.addMinion(new MinionData(id, 1));
 }