Exemplo n.º 1
0
  public void setInvul(boolean invulState) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst != null) {
        mobInst.setInvul(invulState);
      }
    }
  }
Exemplo n.º 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);
  }
Exemplo n.º 3
0
  public void setNoMoveMode(boolean enabled) {
    removeDead();

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

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

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

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.follow(character);
    }
  }
Exemplo n.º 5
0
  public void setCastMode() {
    removeDead();

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

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.setAlternateAI(L2ControllableMobAI.AI_CAST);
    }
  }
Exemplo n.º 6
0
  public void setIdleMode() {
    removeDead();

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

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

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

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

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

    return false;
  }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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);
    }
  }
Exemplo n.º 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();
  }
Exemplo n.º 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);
      }
    }
  }
Exemplo n.º 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());
    }
  }
Exemplo n.º 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();
  }