Performance fix to get out of the loop quicker if library is empty

This commit is contained in:
davidmfritz 2018-10-31 23:27:16 +01:00
parent bf8123b7a5
commit 336732eba2

View file

@ -71,14 +71,15 @@ class ClearTheLandEffect extends OneShotEffect {
Library library = player.getLibrary();
Cards cardsToReveal = new CardsImpl();
for (int i = 0; i < numOfCardsToReveal; i++) {
if (library.hasCards()) {
Card card = library.getFromTop(game);
cardsToReveal.add(card);
if (card.isLand()) {
player.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, true, null);
} else {
player.moveCards(card, Zone.EXILED, source, game);
}
if (!library.hasCards()) {
break;
}
Card card = library.getFromTop(game);
cardsToReveal.add(card);
if (card.isLand()) {
player.moveCards(card, Zone.BATTLEFIELD, source, game, tapped, false, true, null);
} else {
player.moveCards(card, Zone.EXILED, source, game);
}
}
player.revealCards(source, "Revealed cards for " + player.getName(), cardsToReveal, game);