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

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst != null) {
        mobInst.setInvul(invulState);
      }
    }
  }
Esempio 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);
  }
Esempio 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);
    }
  }
Esempio 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);
    }
  }
Esempio 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);
    }
  }
Esempio n. 6
0
  public void setIdleMode() {
    removeDead();

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

      L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
      ai.stop();
    }
  }
Esempio 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);
    }
  }
Esempio 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;
  }
Esempio 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);
    }
  }
Esempio 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);
    }
  }
Esempio 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();
  }
Esempio 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);
      }
    }
  }
Esempio 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());
    }
  }
Esempio 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();
  }