change getLibrary().size() > 0 to hasCards()

This commit is contained in:
ingmargoudt 2017-03-07 17:28:26 +01:00
parent d6e4ef793e
commit 1caf3a6be4
131 changed files with 186 additions and 220 deletions

View file

@ -34,6 +34,7 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import mage.cards.Card;
import mage.counters.Counters;
import mage.game.ExileZone;
@ -47,7 +48,6 @@ import mage.players.Player;
import mage.players.net.UserData;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PlayerView implements Serializable {
@ -125,7 +125,7 @@ public class PlayerView implements Serializable {
} catch (ConcurrentModificationException e) {
// can happen as a player left battlefield while PlayerView is created
}
Card cardOnTop = (player.isTopCardRevealed() && player.getLibrary().size() > 0)
Card cardOnTop = (player.isTopCardRevealed() && player.getLibrary().hasCards())
? player.getLibrary().getFromTop(game) : null;
this.topCard = cardOnTop != null ? new CardView(cardOnTop) : null;
if (player.getUserData() != null) {

View file

@ -98,7 +98,7 @@ class AbbotOfKeralKeepExileEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
if (card != null) {

View file

@ -94,7 +94,7 @@ class AberrantResearcherEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.getLibrary().size() > 0) {
if (controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
controller.moveCards(card, Zone.GRAVEYARD, source, game);
if (card.isInstant() || card.isSorcery()) {

View file

@ -104,7 +104,7 @@ class AbundanceReplacementEffect extends ReplacementEffectImpl {
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
}
Cards cards = new CardsImpl();
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (filter.match(card, source.getSourceId(), source.getControllerId(), game)) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -28,6 +28,7 @@
package mage.cards.a;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
@ -41,13 +42,12 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author North
*/
public class AdNauseam extends CardImpl {
public AdNauseam(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{B}{B}");
// Reveal the top card of your library and put that card into your hand. You lose life equal to its converted mana cost. You may repeat this process any number of times.
this.getSpellAbility().addEffect(new AdNauseamEffect());
@ -87,7 +87,7 @@ class AdNauseamEffect extends OneShotEffect {
if (controller == null || sourceCard == null) {
return false;
}
while (controller.chooseUse(outcome, message, source, game) && controller.getLibrary().size() > 0) {
while (controller.chooseUse(outcome, message, source, game) && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
controller.moveCards(card, Zone.HAND, source, game);

View file

@ -100,7 +100,7 @@ class AidFromTheCowlEffect extends OneShotEffect {
return false;
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -114,7 +114,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect {
return false;
}
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);

View file

@ -103,7 +103,7 @@ class BalustradeSpyEffect extends OneShotEffect {
}
CardsImpl cards = new CardsImpl();
boolean landFound = false;
while (controller.getLibrary().size() > 0 && !landFound) {
while (controller.getLibrary().hasCards() && !landFound) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -112,7 +112,7 @@ public class BanefulOmen extends CardImpl {
if (player == null) {
return false;
}
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);

View file

@ -114,11 +114,11 @@ class BlessedReincarnationEffect extends OneShotEffect {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
Library library = player.getLibrary();
if (library.size() > 0) {
if (library.hasCards()) {
Cards cards = new CardsImpl();
Card card = library.removeFromTop(game);
cards.add(card);
while (!card.isCreature() && library.size() > 0) {
while (!card.isCreature() && library.hasCards()) {
card = library.removeFromTop(game);
cards.add(card);
}

View file

@ -119,7 +119,7 @@ class BloodlineShamanEffect extends OneShotEffect {
filterSubtype.add(new SubtypePredicate(typeChoice.getChoice()));
// Reveal the top card of your library.
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -91,7 +91,7 @@ class CallOfTheWildEffect extends OneShotEffect {
return false;
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -89,7 +89,7 @@ class CandlesOfLengEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
CardsImpl cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {

View file

@ -89,7 +89,7 @@ class CellarDoorEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
Card card = player.getLibrary().removeFromBottom(game);
if (card != null) {
player.moveCards(card, Zone.GRAVEYARD, source, game);

View file

@ -87,7 +87,7 @@ class CerebralEruptionEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
MageObject sourceObject = game.getObject(source.getSourceId());
if (player != null && sourceObject != null && player.getLibrary().size() > 0) {
if (player != null && sourceObject != null && player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
player.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -206,7 +206,7 @@ class ChandraPyromasterEffect2 extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null && controller.getLibrary().size() > 0) {
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
if (card != null) {

View file

@ -114,7 +114,7 @@ class ChandraTorchOfDefianceEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null && controller.getLibrary().size() > 0) {
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
if (card != null) {

View file

@ -133,7 +133,7 @@ class ChaosWarpRevealEffect extends OneShotEffect {
return false;
}
if (owner.getLibrary().size() > 0) {
if (owner.getLibrary().hasCards()) {
Card card = owner.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -94,7 +94,7 @@ class ChronostutterEffect extends OneShotEffect {
}
Card card = null;
if (owner.getLibrary().size() > 0) {
if (owner.getLibrary().hasCards()) {
card = owner.getLibrary().removeFromTop(game);
}

View file

@ -107,7 +107,7 @@ class ConfluxEffect extends OneShotEffect {
TargetCardInLibrary targetRed = new TargetCardInLibrary(filterRed);
TargetCardInLibrary targetGreen = new TargetCardInLibrary(filterGreen);
if (you != null && you.getLibrary().size() > 0) {
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetWhite, game)) {
if (!targetWhite.getTargets().isEmpty()) {
for (UUID cardId : (List<UUID>) targetWhite.getTargets()) {
@ -119,7 +119,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
}
if (you != null && you.getLibrary().size() > 0) {
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetBlue, game)) {
if (!targetBlue.getTargets().isEmpty()) {
for (UUID cardId : (List<UUID>) targetBlue.getTargets()) {
@ -131,7 +131,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
}
if (you != null && you.getLibrary().size() > 0) {
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetBlack, game)) {
if (!targetBlack.getTargets().isEmpty()) {
for (UUID cardId : (List<UUID>) targetBlack.getTargets()) {
@ -143,7 +143,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
}
if (you != null && you.getLibrary().size() > 0) {
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetRed, game)) {
if (!targetRed.getTargets().isEmpty()) {
for (UUID cardId : (List<UUID>) targetRed.getTargets()) {
@ -155,7 +155,7 @@ class ConfluxEffect extends OneShotEffect {
}
}
}
if (you != null && you.getLibrary().size() > 0) {
if (you != null && you.getLibrary().hasCards()) {
if (you.searchLibrary(targetGreen, game)) {
if (!targetGreen.getTargets().isEmpty()) {
for (UUID cardId : (List<UUID>) targetGreen.getTargets()) {

View file

@ -105,7 +105,7 @@ class ConsumingAberrationEffect extends OneShotEffect {
}
Cards cards = new CardsImpl();
while(player.getLibrary().size() > 0){
while(player.getLibrary().hasCards()){
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -92,7 +92,7 @@ class ConundrumSphinxEffect extends OneShotEffect {
Choice cardChoice = new ChoiceImpl();
cardChoice.setChoices(CardRepository.instance.getNames());
for (Player player: game.getPlayers().values()) {
if(player.getLibrary().size() > 0){
if(player.getLibrary().hasCards()){
cardChoice.clearChoice();
while (!player.choose(Outcome.DrawCard, cardChoice, game) && player.canRespond()) {
if (!player.canRespond()) {

View file

@ -105,7 +105,7 @@ class CountrysideCrusherEffect extends OneShotEffect {
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
Cards cards = new CardsImpl();
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
cards.add(card);
if (card.isLand()) {

View file

@ -98,14 +98,14 @@ class DakraMysticEffect extends OneShotEffect {
if (controller != null) {
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
player.revealCards(player.getLogName(), new CardsImpl(player.getLibrary().getFromTop(game)), game);
}
}
if (controller.chooseUse(outcome, "Put revealed cards into graveyard?", source, game)) {
for(UUID playerId: game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
player.moveCards(player.getLibrary().getFromTop(game), Zone.GRAVEYARD, source, game);
}
}

View file

@ -89,7 +89,7 @@ class DarkConfidantEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -80,7 +80,7 @@ class DarkTutelageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);

View file

@ -104,7 +104,7 @@ class DelverOfSecretsEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (player != null && sourcePermanent != null) {
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);

View file

@ -106,7 +106,7 @@ class DemonicConsultationEffect extends OneShotEffect {
// then reveal cards from the top of your library until you reveal the named card.
Cards cardsToReaveal = new CardsImpl();
Card cardToHand = null;
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cardsToReaveal.add(card);

View file

@ -92,7 +92,7 @@ class DescendantsPathEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;

View file

@ -100,7 +100,7 @@ class DestroyTheEvidenceEffect extends OneShotEffect {
}
boolean landFound = false;
Cards cards = new CardsImpl();
while (player.getLibrary().size() > 0 && !landFound) {
while (player.getLibrary().hasCards() && !landFound) {
if (!player.canRespond()) {
return false;
}

View file

@ -110,7 +110,7 @@ class DimensionalInfiltratorEffect extends OneShotEffect {
return false;
}
if (opponent.getLibrary().size() > 0) {
if (opponent.getLibrary().hasCards()) {
Card card = opponent.getLibrary().getFromTop(game);
if (card != null) {
card.moveToExile(null, "Dimensional Infiltrator", source.getSourceId(), game);

View file

@ -112,11 +112,11 @@ class DivergentTransformationsEffect extends OneShotEffect {
for (UUID playerId : controllerList) {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Cards cards = new CardsImpl();
Card card = player.getLibrary().removeFromTop(game);
cards.add(card);
while (!card.isCreature() && player.getLibrary().size() > 0) {
while (!card.isCreature() && player.getLibrary().hasCards()) {
card = player.getLibrary().removeFromTop(game);
cards.add(card);
}

View file

@ -101,7 +101,7 @@ class DjinnOfWishesEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null && controller.getLibrary().size() > 0) {
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -122,7 +122,7 @@ class DomriRadeEffect1 extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null && controller.getLibrary().size() > 0) {
if (sourceObject != null && controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();

View file

@ -100,7 +100,7 @@ class DuskmantleSeerEffect extends OneShotEffect {
return false;
}
for (Player player: game.getPlayers().values()) {
if(player.getLibrary().size() > 0){
if(player.getLibrary().hasCards()){
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
Cards cards = new CardsImpl();

View file

@ -90,7 +90,7 @@ class ErraticExplosionEffect extends OneShotEffect {
CardsImpl toReveal = new CardsImpl();
Card nonLandCard = null;
while (nonLandCard == null && controller.getLibrary().size() > 0) {
while (nonLandCard == null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
toReveal.add(card);
if (!card.isLand()) {

View file

@ -95,7 +95,7 @@ class ErraticMutationEffect extends OneShotEffect {
CardsImpl toReveal = new CardsImpl();
Card nonLandCard = null;
while (nonLandCard == null && controller.getLibrary().size() > 0) {
while (nonLandCard == null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
toReveal.add(card);
if (!card.isLand()) {

View file

@ -104,7 +104,7 @@ class EtherwroughtPageEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.getLibrary().size() > 0) {
if (controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();

View file

@ -88,7 +88,7 @@ class ExplosiveRevelationEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
CardsImpl cards = new CardsImpl();
Library library = player.getLibrary();
Card card = null;
@ -97,7 +97,7 @@ class ExplosiveRevelationEffect extends OneShotEffect {
if (card != null) {
cards.add(card);
}
} while (library.size() > 0 && card != null && card.isLand());
} while (library.hasCards() && card != null && card.isLand());
// reveal cards
if (!cards.isEmpty()) {
player.revealCards("Explosive Revelation", cards, game);

View file

@ -90,7 +90,7 @@ public class FathomTrawl extends CardImpl {
Cards cards = new CardsImpl();
Cards nonlandCards = new CardsImpl();
Cards landCards = new CardsImpl();
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -84,7 +84,7 @@ class ForceMasteryEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -28,6 +28,7 @@
package mage.cards.g;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
@ -44,13 +45,12 @@ import mage.game.Game;
import mage.players.Player;
/**
*
* @author North
*/
public class Galvanoth extends CardImpl {
public Galvanoth(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.subtype.add("Beast");
this.power = new MageInt(3);
@ -84,7 +84,7 @@ class GalvanothEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && controller.getLibrary().size() > 0) {
if (controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.lookAtCards("Galvanoth", cards, game);

View file

@ -85,7 +85,7 @@ class GhoulcallersBellEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Collection<Player> players = game.getPlayers().values();
for (Player player : players) {
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
player.moveCards(card, Zone.GRAVEYARD, source, game);

View file

@ -99,7 +99,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
}
Cards cards = new CardsImpl();
boolean landFound = false;
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -98,7 +98,7 @@ class GrenzoDungeonWardenEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromBottom(game);
if (card != null) {
controller.moveCards(card, Zone.GRAVEYARD, source, game);

View file

@ -110,7 +110,7 @@ class GrindstoneEffect extends OneShotEffect {
cards.addAll(targetPlayer.getLibrary().getTopCards(game, 2));
if (!cards.isEmpty()) {
Card card1 = targetPlayer.getLibrary().removeFromTop(game);
if (targetPlayer.getLibrary().size() > 0) {
if (targetPlayer.getLibrary().hasCards()) {
colorShared = card1.getColor(game).shares(targetPlayer.getLibrary().removeFromTop(game).getColor(game));
}
}

View file

@ -110,7 +110,7 @@ class GrinningTotemSearchAndExileEffect extends OneShotEffect {
Player targetOpponent = game.getPlayer(source.getFirstTarget());
MageObject sourceObject = game.getObject(source.getSourceId());
if (you != null && targetOpponent != null) {
if (targetOpponent.getLibrary().size() > 0) {
if (targetOpponent.getLibrary().hasCards()) {
TargetCardInLibrary targetCard = new TargetCardInLibrary();
if (you.searchLibrary(targetCard, game, targetOpponent.getId())) {
Card card = targetOpponent.getLibrary().remove(targetCard.getFirstTarget(), game);

View file

@ -107,7 +107,7 @@ class HellcarverDemonEffect extends OneShotEffect {
}
for (int i = 0; i < 6; i++) {
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
Card topCard = player.getLibrary().getFromTop(game);
topCard.moveToExile(source.getSourceId(), "Cards exiled by Hellcarver Demon", source.getSourceId(), game);
}

View file

@ -102,7 +102,7 @@ class HelmOfObedienceEffect extends OneShotEffect {
if(max != 0){
int numberOfCard = 0;
while(targetOpponent.getLibrary().size() > 0) {
while(targetOpponent.getLibrary().hasCards()) {
Card card = targetOpponent.getLibrary().removeFromTop(game);
if (card != null){
if (targetOpponent.moveCards(card, Zone.GRAVEYARD, source, game)) {

View file

@ -97,7 +97,7 @@ class SeekEffect extends OneShotEffect {
Player opponent = game.getPlayer(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
if (player != null && opponent != null) {
if (opponent.getLibrary().size() > 0) {
if (opponent.getLibrary().hasCards()) {
TargetCardInLibrary target = new TargetCardInLibrary();
if (player.searchLibrary(target, game, opponent.getId())) {
UUID targetId = target.getFirstTarget();

View file

@ -127,7 +127,7 @@ class IndomitableCreativityEffect extends OneShotEffect {
Player controllerOfDestroyedCreature = game.getPlayer(permanent.getControllerId());
if (controllerOfDestroyedCreature != null) {
Library library = controllerOfDestroyedCreature.getLibrary();
if (library.size() > 0) {
if (library.hasCards()) {
Cards cards = new CardsImpl();
Cards revealCards;
if (cardsToReveal.containsKey(controllerOfDestroyedCreature)) {
@ -138,7 +138,7 @@ class IndomitableCreativityEffect extends OneShotEffect {
}
Card card = library.removeFromTop(game);
cards.add(card);
while (!card.isCreature() && !card.isArtifact() && library.size() > 0) {
while (!card.isCreature() && !card.isArtifact() && library.hasCards()) {
card = library.removeFromTop(game);
cards.add(card);
}

View file

@ -102,7 +102,7 @@ class IreShamanExileEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
String exileName = sourcePermanent.getIdName() + " <this card may be played the turn it was exiled>";

View file

@ -118,7 +118,7 @@ class JeskaiInfiltratorEffect extends OneShotEffect {
controller.moveCardToExileWithInfo(sourcePermanent, sourcePermanent.getId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
cardsToManifest.add(sourceCard);
}
if (sourcePermanent != null && controller.getLibrary().size() > 0) {
if (sourcePermanent != null && controller.getLibrary().hasCards()) {
Card cardFromLibrary = controller.getLibrary().removeFromTop(game);
controller.moveCardToExileWithInfo(cardFromLibrary, sourcePermanent.getId(), sourcePermanent.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);
cardsToManifest.add(cardFromLibrary);

View file

@ -115,7 +115,7 @@ class JestersScepterEffect extends OneShotEffect {
if (controller != null
&& targetedPlayer != null
&& sourceObject != null) {
if (targetedPlayer.getLibrary().size() > 0) {
if (targetedPlayer.getLibrary().hasCards()) {
Set<Card> cardsToExile = targetedPlayer.getLibrary().getTopCards(game, 5);
for (Card card : cardsToExile) {
if (card.moveToExile(CardUtil.getCardExileZoneId(game, source), new StringBuilder(sourceObject.getName()).toString(), source.getSourceId(), game)) {

View file

@ -91,7 +91,7 @@ class JudgeUnworthyEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null && controller != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
controller.revealCards(sourceCard.getName(), new CardsImpl(card), game);
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));

View file

@ -108,7 +108,7 @@ class KnacksawCliqueEffect extends OneShotEffect {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && opponent != null) {
if (opponent.getLibrary().size() > 0) {
if (opponent.getLibrary().hasCards()) {
Library library = opponent.getLibrary();
Card card = library.getFromTop(game);
if (card != null) {

View file

@ -90,10 +90,10 @@ class LongTermPlansEffect extends OneShotEffect {
player.shuffleLibrary(source, game);
Card cardTop = null;
Card cardSecond = null;
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
cardTop = player.getLibrary().removeFromTop(game);
}
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
cardSecond = player.getLibrary().removeFromTop(game);
}
player.getLibrary().putOnTop(card, game);

View file

@ -88,7 +88,7 @@ class LostInTheWoodsEffect extends OneShotEffect {
if (sourceObject == null || controller == null) {
return false;
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);

View file

@ -90,7 +90,7 @@ class LurkingPredatorsEffect extends OneShotEffect {
return false;
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -85,7 +85,7 @@ class MadcapExperimentEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && controller.getLibrary().size() > 0) {
if (controller != null && controller.getLibrary().hasCards()) {
CardsImpl cards = new CardsImpl();
Library library = controller.getLibrary();
Card card = null;
@ -94,7 +94,7 @@ class MadcapExperimentEffect extends OneShotEffect {
if (card != null) {
cards.add(card);
}
} while (library.size() > 0 && card != null && !card.isArtifact());
} while (library.hasCards() && card != null && !card.isArtifact());
// reveal cards
if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -99,7 +99,7 @@ class MassPolymorphEffect extends OneShotEffect {
Cards revealed = new CardsImpl();
Set<Card> creatureCards = new LinkedHashSet<>();
Cards nonCreatureCards = new CardsImpl();
while (creatureCards.size() < count && controller.getLibrary().size() > 0) {
while (creatureCards.size() < count && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
revealed.add(card);
if (card.isCreature()) {

View file

@ -89,7 +89,7 @@ class MatterReshaperEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null && controller.getLibrary().size() > 0) {
if (controller != null && sourceObject != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;

View file

@ -111,12 +111,7 @@ class MechanizedProductionEffect extends OneShotEffect {
}
Map<String, Integer> countNames = new HashMap<>();
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterArtifactPermanent(), source.getControllerId(), game)) {
int counter;
if (countNames.containsKey(permanent.getName())) {
counter = countNames.get(permanent.getName());
} else {
counter = 0;
}
int counter = countNames.getOrDefault(permanent.getName(),0);
countNames.put(permanent.getName(), counter + 1);
}
for (Entry<String, Integer> entry : countNames.entrySet()) {

View file

@ -92,7 +92,7 @@ class MindFuneralEffect extends OneShotEffect {
if (opponent != null) {
Cards cards = new CardsImpl();
int landsFound = 0;
while (landsFound < 4 && opponent.getLibrary().size() > 0) {
while (landsFound < 4 && opponent.getLibrary().hasCards()) {
Card card = opponent.getLibrary().removeFromTop(game);
if (card == null) {
break;

View file

@ -103,7 +103,7 @@ class MindGrindEffect extends OneShotEffect {
}
int landsToReveal = xValue;
Cards cards = new CardsImpl();
while(player.getLibrary().size() > 0){
while(player.getLibrary().hasCards()){
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -95,7 +95,7 @@ class MindsDesireEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
controller.shuffleLibrary(source, game);
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
controller.moveCardToExileWithInfo(card, source.getSourceId(), sourceObject.getIdName(), source.getSourceId(), game, Zone.LIBRARY, true);

View file

@ -133,7 +133,7 @@ class MindsDilationEffect extends OneShotEffect {
MageObject sourceObject = source.getSourceObject(game);
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (controller != null && sourceObject != null && opponent != null) {
if (opponent.getLibrary().size() > 0) {
if (opponent.getLibrary().hasCards()) {
Card card = opponent.getLibrary().getFromTop(game);
if (card != null && opponent.moveCards(card, Zone.EXILED, source, game)) {
if (!card.isLand()) {

View file

@ -93,7 +93,7 @@ class MindshriekerEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null) {
if (targetPlayer.getLibrary().size() > 0) {
if (targetPlayer.getLibrary().hasCards()) {
Card card = targetPlayer.getLibrary().removeFromTop(game);
if (card != null) {
targetPlayer.moveCards(card, Zone.GRAVEYARD, source, game);

View file

@ -105,7 +105,7 @@ class MirkoVoskMindDrinkerEffect extends OneShotEffect {
}
int landsToReveal = 4;
Cards cards = new CardsImpl();
while(player.getLibrary().size() > 0){
while(player.getLibrary().hasCards()){
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);

View file

@ -110,7 +110,7 @@ class NarsetTranscendentEffect1 extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null && controller.getLibrary().size() > 0) {
if (sourceObject != null && controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();

View file

@ -107,7 +107,7 @@ class NayaSoulbeastCastEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
cmc += card.getConvertedManaCost();
player.revealCards(sourceObject.getName() + " (" + player.getName() + ')', new CardsImpl(card), game);

View file

@ -137,7 +137,7 @@ class NecropotenceEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (controller.moveCardToExileWithInfo(card, null, "", source.getSourceId(), game, Zone.LIBRARY, false)) {
card.setFaceDown(true, game);

View file

@ -98,7 +98,7 @@ class NeurokFamiliarEffect extends OneShotEffect {
return false;
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

View file

@ -28,6 +28,7 @@
package mage.cards.n;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
@ -47,7 +48,6 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
/**
*
* @author dustinconrad
*/
public class NimbusMaze extends CardImpl {
@ -61,7 +61,7 @@ public class NimbusMaze extends CardImpl {
}
public NimbusMaze(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},"");
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
@ -89,33 +89,3 @@ public class NimbusMaze extends CardImpl {
}
}
class FilterPermanentCost extends CostImpl {
private final FilterPermanent filter;
public FilterPermanentCost(FilterPermanent filter) {
this.filter = filter;
this.text = "Activate this ability only if " + filter.getMessage();
}
public FilterPermanentCost(final FilterPermanentCost cost) {
super(cost);
this.filter = cost.filter;
}
@Override
public FilterPermanentCost copy() {
return new FilterPermanentCost(this);
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
return game.getBattlefield().contains(filter, controllerId, 1, game);
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
this.paid = true;
return paid;
}
}

View file

@ -111,7 +111,7 @@ class NissaSageAnimistPlusOneEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && controller != null && controller.getLibrary().size() > 0) {
if (sourceObject != null && controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card == null) {
return false;

View file

@ -98,7 +98,7 @@ class NivixAerieOfTheFiremindEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Library library = controller.getLibrary();
if (library.size() > 0) {
if (library.hasCards()) {
Card card = library.removeFromTop(game);
if (card != null
&& controller.moveCardsToExile(card, source, game, true, source.getSourceId(), "Nivix, Aerie of the Firemind")

View file

@ -145,7 +145,7 @@ class OathOfDruidsEffect extends OneShotEffect {
Card creatureCard = null;
Cards nonCreatureCards = new CardsImpl();
//The first player may reveal cards from the top of his or her library
while (creatureCard == null && controller.getLibrary().size() > 0) {
while (creatureCard == null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
revealed.add(card);
// until he or she reveals a creature card.

View file

@ -100,7 +100,7 @@ class OrnateKanzashiEffect extends OneShotEffect {
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
if (sourceObject != null && opponent != null) {
if (opponent.getLibrary().size() > 0) {
if (opponent.getLibrary().hasCards()) {
Library library = opponent.getLibrary();
Card card = library.getFromTop(game);
if (card != null) {

View file

@ -93,7 +93,7 @@ class OustEffect extends OneShotEffect {
}
Card card = null;
if (owner.getLibrary().size() > 0) {
if (owner.getLibrary().hasCards()) {
card = owner.getLibrary().removeFromTop(game);
}

View file

@ -94,7 +94,7 @@ class PainSeerEffect extends OneShotEffect {
return false;
}
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
Cards cards = new CardsImpl();
cards.add(card);

View file

@ -174,7 +174,7 @@ class ExileTopCardLibraryCost extends CostImpl {
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
return controller.getLibrary().size() > 0;
return controller.getLibrary().hasCards();
}
return false;
}

View file

@ -96,11 +96,11 @@ class PolymorphEffect extends OneShotEffect {
Player player = game.getPlayer(permanent.getControllerId());
if (player != null) {
Library library = player.getLibrary();
if (library.size() > 0) {
if (library.hasCards()) {
Cards cards = new CardsImpl();
Card card = library.removeFromTop(game);
cards.add(card);
while (!card.isCreature() && library.size() > 0) {
while (!card.isCreature() && library.hasCards()) {
card = library.removeFromTop(game);
cards.add(card);
}

View file

@ -136,7 +136,7 @@ class PossibilityStormEffect extends OneShotEffect {
Player spellController = game.getPlayer(spell.getControllerId());
if (spellController != null
&& spellController.moveCardsToExile(spell, source, game, true, source.getSourceId(), sourceObject.getIdName())) {
if (spellController.getLibrary().size() > 0) {
if (spellController.getLibrary().hasCards()) {
Library library = spellController.getLibrary();
Card card;
do {
@ -144,7 +144,7 @@ class PossibilityStormEffect extends OneShotEffect {
if (card != null) {
spellController.moveCardsToExile(card, source, game, true, source.getSourceId(), sourceObject.getIdName());
}
} while (library.size() > 0 && card != null && !sharesType(card, spell.getCardType()));
} while (library.hasCards() && card != null && !sharesType(card, spell.getCardType()));
if (card != null && sharesType(card, spell.getCardType())
&& !card.isLand()

View file

@ -92,7 +92,7 @@ class PrimalSurgeEffect extends OneShotEffect {
boolean repeat;
do {
repeat = false;
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToExile(null, "", source.getSourceId(), game);

View file

@ -102,7 +102,7 @@ class PropheticFlamespeakerExileEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Library library = controller.getLibrary();
Card card = library.removeFromTop(game);
if (card != null) {

View file

@ -102,7 +102,7 @@ class ProteusStaffEffect extends OneShotEffect {
// That creature's controller reveals cards from the top of his or her library until he or she reveals a creature card.
Cards cards = new CardsImpl();
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
if (card.isCreature()) {

View file

@ -98,7 +98,7 @@ class PsychicVortexCost extends CostImpl {
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Player controller = game.getPlayer(controllerId);
return controller.getLibrary().size() > 0;
return controller.getLibrary().hasCards();
}
@Override

View file

@ -111,7 +111,7 @@ class PyxisOfPandemoniumExileEffect extends OneShotEffect {
Player player = game.getPlayer(playerId);
if (player != null) {
if (player.getLibrary().size() > 0) {
if (player.getLibrary().hasCards()) {
Card card = player.getLibrary().getFromTop(game);
String exileKey = playerId.toString() + CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()).toString();
UUID exileId = exileIds.computeIfAbsent(exileKey, k -> UUID.randomUUID());

View file

@ -98,7 +98,7 @@ class QuestForUlasTempleEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (sourcePermanent != null && controller != null && controller.getLibrary().size() > 0) {
if (sourcePermanent != null && controller != null && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.lookAtCards(sourcePermanent.getName(), cards, game);

View file

@ -87,12 +87,12 @@ class RallyTheHordeEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
int nonLandCardsExiled = 0;
while(controller.getLibrary().size() > 0) {
while(controller.getLibrary().hasCards()) {
nonLandCardsExiled += checkIfNextLibCardIsNonLandAndExile(controller, source, game);
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
nonLandCardsExiled += checkIfNextLibCardIsNonLandAndExile(controller, source, game);
}
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
int nonLands = checkIfNextLibCardIsNonLandAndExile(controller, source, game);
if (nonLands == 0) {
break;

View file

@ -104,11 +104,11 @@ class ReweaveEffect extends OneShotEffect {
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {
Library library = permanentController.getLibrary();
if (library.size() > 0) {
if (library.hasCards()) {
Cards cards = new CardsImpl();
Card card = null;
boolean cardFound = false;
if (library.size() > 0) {
if (library.hasCards()) {
do {
card = library.removeFromTop(game);
cards.add(card);
@ -121,7 +121,7 @@ class ReweaveEffect extends OneShotEffect {
}
}
}
} while (!cardFound && library.size() > 0);
} while (!cardFound && library.hasCards());
permanentController.moveCards(card, Zone.BATTLEFIELD, source, game);
}

View file

@ -92,7 +92,7 @@ class RiddleOfLightningEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (sourceCard != null && controller != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
controller.revealCards(sourceCard.getName(), new CardsImpl(card), game);
Permanent targetCreature = game.getPermanent(this.getTargetPointer().getFirst(game, source));

View file

@ -108,7 +108,7 @@ class RiptideShapeshifterEffect extends OneShotEffect {
}
}
Cards revealedCards = new CardsImpl();
while (controller.getLibrary().size() > 0) {
while (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card.isCreature() && card.getSubtype(game).contains(choice.getChoice())) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -90,7 +90,7 @@ class RummagingWizardLookLibraryEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
CardsImpl cards = new CardsImpl();

View file

@ -100,7 +100,7 @@ class SaplingOfColfenorEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().getFromTop(game);
Cards cards = new CardsImpl(card);
controller.revealCards(sourceObject.getIdName(), cards, game);

View file

@ -98,7 +98,7 @@ class ScribNibblersEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player you = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (targetPlayer != null && targetPlayer.getLibrary().size() > 0) {
if (targetPlayer != null && targetPlayer.getLibrary().hasCards()) {
Card card = targetPlayer.getLibrary().getFromTop(game);
card.moveToExile(id, "Scrib Nibblers Exile", source.getSourceId(), game);
if (card != null && card.isLand()) {

View file

@ -96,7 +96,7 @@ class SearchTheCityExileEffect extends OneShotEffect {
if (player != null) {
// move cards from library to exile
for (int i = 0; i < 5; i++) {
if (player != null && player.getLibrary().size() > 0) {
if (player != null && player.getLibrary().hasCards()) {
Card topCard = player.getLibrary().getFromTop(game);
topCard.moveToExile(source.getSourceId(), "Cards exiled by Search the City", source.getSourceId(), game);
}

View file

@ -89,7 +89,7 @@ class SelvalasStampedeDilemmaEffect extends CouncilsDilemmaVoteEffect {
Cards revealedCards = new CardsImpl();
int cardsToReveal = voteOneCount;
while (cardsToReveal > 0 && controller.getLibrary().size() > 0) {
while (cardsToReveal > 0 && controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card.isCreature()) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game);

View file

@ -100,7 +100,7 @@ public class ShapeAnew extends CardImpl {
Card artifactCard = null;
Cards nonArtifactCards = new CardsImpl();
Player targetController = game.getPlayer(sourcePermanent.getControllerId());
while (artifactCard == null && targetController.getLibrary().size() > 0) {
while (artifactCard == null && targetController.getLibrary().hasCards()) {
Card card = targetController.getLibrary().removeFromTop(game);
revealed.add(card);
if (card.isArtifact()) {

View file

@ -99,7 +99,7 @@ class SinProdderEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourcePermanent != null) {
if (controller.getLibrary().size() > 0) {
if (controller.getLibrary().hasCards()) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
Cards cards = new CardsImpl(card);

Some files were not shown because too many files have changed in this diff Show more