Example #1
0
  public void setInvul(boolean invulState) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst != null) {
        mobInst.setInvul(invulState);
      }
    }
  }
Example #2
0
  protected void removeDead() {
    List<L2ControllableMobInstance> deadMobs = new FastList<>();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if ((mobInst != null) && mobInst.isDead()) {
        deadMobs.add(mobInst);
      }
    }

    getMobs().removeAll(deadMobs);
  }
Example #3
0
  public void setNoMoveMode(boolean enabled) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.setNotMoving(enabled);
    }
  }
Example #4
0
  public void setFollowMode(L2Character character) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.follow(character);
    }
  }
Example #5
0
  public void setCastMode() {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.setAlternateAI(L2ControllableMobAI.AI_CAST);
    }
  }
Example #6
0
  public void setIdleMode() {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.stop();
    }
  }
Example #7
0
  public void setAttackTarget(L2Character target) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.forceAttack(target);
    }
  }
Example #8
0
  public boolean isGroupMember(L2ControllableMobInstance mobInst) {
    for (L2ControllableMobInstance groupMember : getMobs()) {
      if (groupMember == null) {
        continue;
      }

      if (groupMember.getObjectId() == mobInst.getObjectId()) {
        return true;
      }
    }

    return false;
  }
Example #9
0
  public void setAttackGroup(MobGroup otherGrp) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.forceAttackGroup(otherGrp);
      ai.setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
    }
  }
Example #10
0
  public void setAttackRandom() {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.setAlternateAI(L2ControllableMobAI.AI_NORMAL);
      ai.setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
    }
  }
Example #11
0
  public void killGroup(L2PcInstance activeChar) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      if (!mobInst.isDead()) {
        mobInst.reduceCurrentHp(mobInst.getMaxHp() + 1, activeChar, null);
      }

      SpawnTable.getInstance().deleteSpawn(mobInst.getSpawn(), false);
    }

    getMobs().clear();
  }
Example #12
0
  public void teleportGroup(L2PcInstance player) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      if (!mobInst.isDead()) {
        int x = player.getX() + Rnd.nextInt(50);
        int y = player.getY() + Rnd.nextInt(50);

        mobInst.teleToLocation(x, y, player.getZ(), true);
        L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
        ai.follow(player);
      }
    }
  }
Example #13
0
  public void returnGroup(L2Character activeChar) {
    setIdleMode();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      int signX = (Rnd.nextInt(2) == 0) ? -1 : 1;
      int signY = (Rnd.nextInt(2) == 0) ? -1 : 1;
      int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
      int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.move(
          activeChar.getX() + (signX * randX),
          activeChar.getY() + (signY * randY),
          activeChar.getZ());
    }
  }
Example #14
0
  public void unspawnGroup() {
    removeDead();

    if (getActiveMobCount() == 0) {
      return;
    }

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      if (!mobInst.isDead()) {
        mobInst.deleteMe();
      }

      SpawnTable.getInstance().deleteSpawn(mobInst.getSpawn(), false);
    }

    getMobs().clear();
  }