Merge pull request #5364 from mooretc2/JaceArchitectOfThoughtFix

Fixing Jace, Architect of Thought with concurrent search library (for issue #5357)
This commit is contained in:
LevelX2 2018-11-26 17:29:40 +01:00 committed by GitHub
commit 09b64b2025
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 2 deletions

View file

@ -245,6 +245,10 @@ class JaceArchitectOfThoughtEffect3 extends OneShotEffect {
if (controller == null || sourcePermanent == null) { if (controller == null || sourcePermanent == null) {
return false; return false;
} }
if (controller.chooseUse(Outcome.Benefit, "Look at all players' libraries before card select?", null, game)) {
game.informPlayers(controller.getLogName() + " is looking at all players' libraries.");
controller.lookAtAllLibraries(source, game);
}
List<UUID> playerList = new ArrayList<>(); List<UUID> playerList = new ArrayList<>();
playerList.addAll(game.getState().getPlayersInRange(controller.getId(), game)); playerList.addAll(game.getState().getPlayersInRange(controller.getId(), game));
Set<UUID> checkList = new HashSet<>(); Set<UUID> checkList = new HashSet<>();

View file

@ -2309,8 +2309,12 @@ public class TestPlayer implements Player {
} }
@Override @Override
public boolean flipCoin(Game game public void lookAtAllLibraries(Ability source, Game game) {
) { computerPlayer.lookAtAllLibraries(source, game);
}
@Override
public boolean flipCoin(Game game) {
return computerPlayer.flipCoin(game); return computerPlayer.flipCoin(game);
} }

View file

@ -597,6 +597,9 @@ public class PlayerStub implements Player {
return false; return false;
} }
@Override
public void lookAtAllLibraries(Ability source, Game game) {}
@Override @Override
public boolean canPlayLand() { public boolean canPlayLand() {
return false; return false;

View file

@ -349,6 +349,15 @@ public interface Player extends MageItem, Copyable<Player> {
*/ */
boolean searchLibrary(TargetCardInLibrary target, Game game, UUID targetPlayerId, boolean triggerEvents); 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
*/
void lookAtAllLibraries(Ability source, Game game);
boolean canPlayLand(); boolean canPlayLand();
/** /**

View file

@ -2488,6 +2488,17 @@ public abstract class PlayerImpl implements Player, Serializable {
return false; return false;
} }
@Override
public void 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);
}
}
private boolean handleLibraryCastableCards(Library library, Game game, UUID targetPlayerId) { private boolean handleLibraryCastableCards(Library library, Game game, UUID targetPlayerId) {
// for handling Panglacial Wurm // for handling Panglacial Wurm
boolean alreadyChosenUse = false; boolean alreadyChosenUse = false;