Another simplification for ExileFromTopOfLibraryCost

This commit is contained in:
LoneFox 2015-06-21 13:38:54 +03:00
parent 15e229ab23
commit 3598f07caa

View file

@ -31,11 +31,8 @@ package mage.abilities.costs.common;
import java.util.UUID; import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.costs.CostImpl; import mage.abilities.costs.CostImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.players.Library;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
@ -71,12 +68,7 @@ public class ExileFromTopOfLibraryCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
Player controller = game.getPlayer(controllerId); Player controller = game.getPlayer(controllerId);
if(controller != null) { if(controller != null) {
Library library = controller.getLibrary(); controller.moveCards(controller.getLibrary().getTopCards(game, amount), Zone.LIBRARY, Zone.EXILED, ability, game);
Cards cards = new CardsImpl();
for(int i = 0; i < amount; i++) {
cards.add(library.removeFromTop(game));
}
controller.moveCards(cards, Zone.LIBRARY, Zone.EXILED, ability, game);
paid = true; paid = true;
} }
return paid; return paid;