Implementing new function in all classes implementing Player

This commit is contained in:
Tyler Moore 2018-10-04 14:16:52 -07:00
parent c5cedc2aba
commit 4057cc2859
4 changed files with 9 additions and 3 deletions

View file

@ -2072,6 +2072,10 @@ public class TestPlayer implements Player {
return computerPlayer.searchLibrary(target, game, targetPlayerId, triggerEvents); return computerPlayer.searchLibrary(target, game, targetPlayerId, triggerEvents);
} }
public void lookAtAllLibraries(Ability source, Game game) {
computerPlayer.lookAtAllLibraries(source, game);
}
@Override @Override
public boolean flipCoin(Game game) { 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

@ -357,7 +357,7 @@ public interface Player extends MageItem, Copyable<Player> {
* @param game * @param game
* @return * @return
*/ */
boolean lookAtAllLibraries(Ability source, Game game); void lookAtAllLibraries(Ability source, Game game);
boolean canPlayLand(); boolean canPlayLand();

View file

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