Ejemplo n.º 1
0
  public String getValue(boolean useHidden) {
    StringBuilder sb = new StringBuilder(1024);

    sb.append(turnNum)
        .append(turn.getPhaseType())
        .append(turn.getStepType())
        .append(activePlayerId)
        .append(priorityPlayerId);

    for (Player player : players.values()) {
      sb.append("player").append(player.getLife()).append("hand");
      if (useHidden) {
        sb.append(player.getHand());
      } else {
        sb.append(player.getHand().size());
      }
      sb.append("library")
          .append(player.getLibrary().size())
          .append("graveyard")
          .append(player.getGraveyard());
    }

    sb.append("permanents");
    for (Permanent permanent : battlefield.getAllPermanents()) {
      sb.append(permanent.getValue());
    }

    sb.append("spells");
    for (StackObject spell : stack) {
      sb.append(spell.getControllerId()).append(spell.getName());
    }

    for (ExileZone zone : exile.getExileZones()) {
      sb.append("exile").append(zone.getName()).append(zone);
    }

    sb.append("combat");
    for (CombatGroup group : combat.getGroups()) {
      sb.append(group.getDefenderId()).append(group.getAttackers()).append(group.getBlockers());
    }

    return sb.toString();
  }
Ejemplo n.º 2
0
  public String getValue(boolean useHidden, Game game) {
    StringBuilder sb = new StringBuilder(1024);

    sb.append(turnNum)
        .append(turn.getPhaseType())
        .append(turn.getStepType())
        .append(activePlayerId)
        .append(priorityPlayerId);

    for (Player player : players.values()) {
      sb.append("player").append(player.isPassed()).append(player.getLife()).append("hand");
      if (useHidden) {
        sb.append(player.getHand());
      } else {
        sb.append(player.getHand().size());
      }
      sb.append("library").append(player.getLibrary().size());
      sb.append("graveyard");
      for (Card card : player.getGraveyard().getCards(game)) {
        sb.append(card.getName());
      }
    }

    sb.append("permanents");
    List<String> perms = new ArrayList<String>();
    for (Permanent permanent : battlefield.getAllPermanents()) {
      perms.add(permanent.getValue());
    }
    Collections.sort(perms);
    sb.append(perms);

    sb.append("spells");
    for (StackObject spell : stack) {
      sb.append(spell.getControllerId()).append(spell.getName());
      sb.append(spell.getStackAbility().toString());
      for (Mode mode : spell.getStackAbility().getModes().values()) {
        if (!mode.getTargets().isEmpty()) {
          sb.append("targets");
          for (Target target : mode.getTargets()) {
            sb.append(target.getTargets());
          }
        }
        if (!mode.getChoices().isEmpty()) {
          sb.append("choices");
          for (Choice choice : mode.getChoices()) {
            sb.append(choice.getChoice());
          }
        }
      }
    }

    for (ExileZone zone : exile.getExileZones()) {
      sb.append("exile").append(zone.getName()).append(zone);
    }

    sb.append("combat");
    for (CombatGroup group : combat.getGroups()) {
      sb.append(group.getDefenderId()).append(group.getAttackers()).append(group.getBlockers());
    }

    return sb.toString();
  }