Adding lookAtAllLibraries to Player/PlayerImpl and using that method during JAOT's -8 resolution

This commit is contained in:
Tyler Moore 2018-10-04 13:45:44 -07:00
parent 02d9287cfa
commit c5cedc2aba
3 changed files with 23 additions and 0 deletions

View file

@ -239,12 +239,14 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
if (controller == null || sourcePermanent == null) {
return false;
}
controller.lookAtAllLibraries(source, game);
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
String playerName = new StringBuilder(player.getLogName()).append("'s").toString();
if (source.isControlledBy(player.getId())) {
playerName = "your";
}
TargetCardInLibrary target = new TargetCardInLibrary(new FilterNonlandCard(new StringBuilder("nonland card from ").append(playerName).append(" library").toString()));
if (controller.searchLibrary(target, game, playerId)) {
UUID targetId = target.getFirstTarget();

View file

@ -350,6 +350,15 @@ public interface Player extends MageItem, Copyable<Player> {
*/
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents);
/**
* Reveals all players' libraries. Useful for abilities like Jace, Architect of Thought's -8
* that have effects that require information from all libraries.
* @param source
* @param game
* @return
*/
boolean lookAtAllLibraries(Ability source, Game game);
boolean canPlayLand();
/**

View file

@ -2477,6 +2477,18 @@ public abstract class PlayerImpl implements Player, Serializable {
return false;
}
@Override
public boolean lookAtAllLibraries(Ability source, Game game) {
for(UUID playerId : game.getState().getPlayersInRange(this.getId(), game)){
Player player = game.getPlayer(playerId);
String playerName = this.getName().equals(player.getName()) ? "Your " : player.getName() + "'s ";
playerName += "library";
Cards cardsInLibrary = new CardsImpl(player.getLibrary().getTopCards(game, player.getLibrary().size()));
lookAtCards(playerName, cardsInLibrary, game);
}
return true;
}
private boolean handleLibraryCastableCards(Library library, Game game, UUID targetPlayerId) {
// for handling Panglacial Wurm
boolean alreadyChosenUse = false;