public Permanent getPermanent(UUID permanentId) { if (permanentId != null && battlefield.containsPermanent(permanentId)) { Permanent permanent = battlefield.getPermanent(permanentId); setZone(permanent.getId(), Zone.BATTLEFIELD); // shouldn't this be set anyway? (LevelX2) return permanent; } return null; }
public void applyEffects(Game game) { for (Player player : players.values()) { player.reset(); } battlefield.reset(game); combat.reset(); this.reset(); effects.apply(game); battlefield.fireControlChangeEvents(game); }
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(); }
public void clear() { battlefield.clear(); effects.clear(); triggers.clear(); delayed.clear(); triggered.clear(); stack.clear(); exile.clear(); command.clear(); revealed.clear(); lookedAt.clear(); turnNum = 0; extraTurn = false; legendaryRuleActive = true; gameOver = false; specialActions.clear(); otherAbilities.clear(); combat.clear(); turnMods.clear(); watchers.clear(); values.clear(); zones.clear(); }
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(); }