Package org.jpokemon.battle.slot

Examples of org.jpokemon.battle.slot.Slot


  public void serve(JSONObject request, Player player) throws ServiceException {
  }

  @Override
  public Turn getTurn() {
    Slot slot = battle.getSlot(slotId);

    return new RunTurn(battle, slot);
  }
View Full Code Here


  @Override
  public Turn getTurn() {
    if (pokemonIndex == -1) { return null; }

    Slot userSlot = battle.getSlot(slotId);

    return new SwapTurn(battle, userSlot, pokemonIndex);
  }
View Full Code Here

  @Override
  public Turn getTurn() {
    if (moveIndex == -1 || targetId == null) { return null; }

    Slot userSlot = battle.getSlot(slotId);
    Slot targetSlot = battle.getSlot(targetId);

    return new AttackTurn(battle, userSlot, targetSlot, userSlot.party().get(0).move(moveIndex));
  }
View Full Code Here

  public void addTrainer(PokemonTrainer trainer, int team) {
    if (contains(trainer))
      throw new IllegalArgumentException("Duplicate trainer: " + trainer);

    slots.put(trainer.id(), new Slot(trainer, team));
    System.out.println(this + " trainer added: " + trainer);
  }
View Full Code Here

  private void doTrainerAttacks() {
    for (Slot slot : slots.values()) {
      if (slot.trainer() instanceof Player)
        continue;

      Slot randomSlot;
      do {
        Slot[] allSlots = slots.values().toArray(new Slot[slots.values().size()]);
        randomSlot = allSlots[(int) (Math.random() * allSlots.length)];
      } while (slot.equals(randomSlot));

View Full Code Here

    }

    if (onlyOneTeamLeft) {
      while (!slots.isEmpty()) {
        String slotKey = (String) slots.keySet().toArray()[0];
        Slot slot = slots.remove(slotKey);

        if (slot.trainer() instanceof Player) {
          Player p = (Player) slot.trainer();
          PlayerManager.pushJson(p, json);
          PlayerManager.popActivity(p, this);
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.jpokemon.battle.slot.Slot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.