From 336732eba28cd53c5031334bb0b316280ead3f40 Mon Sep 17 00:00:00 2001 From: davidmfritz Date: Wed, 31 Oct 2018 23:27:16 +0100 Subject: [PATCH] Performance fix to get out of the loop quicker if library is empty --- Mage.Sets/src/mage/cards/c/ClearTheLand.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Mage.Sets/src/mage/cards/c/ClearTheLand.java b/Mage.Sets/src/mage/cards/c/ClearTheLand.java index 45c621021e..1bc1f4ad01 100644 --- a/Mage.Sets/src/mage/cards/c/ClearTheLand.java +++ b/Mage.Sets/src/mage/cards/c/ClearTheLand.java @@ -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);