diff --git a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java index 1c94669e7c..345086c7df 100644 --- a/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java +++ b/Mage.Sets/src/mage/cards/b/BattletideAlchemist.java @@ -94,8 +94,4 @@ class BattletideAlchemistEffect extends PreventionEffectImpl { return event.getType() == EventType.DAMAGE_PLAYER; } - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return super.applies(event, source, game); - } } diff --git a/Mage.Sets/src/mage/cards/c/CloneShell.java b/Mage.Sets/src/mage/cards/c/CloneShell.java index d4e82f32df..47b9d5f20a 100644 --- a/Mage.Sets/src/mage/cards/c/CloneShell.java +++ b/Mage.Sets/src/mage/cards/c/CloneShell.java @@ -117,7 +117,7 @@ class CloneShellDiesEffect extends OneShotEffect { List imprinted = permanent.getImprinted(); if (!imprinted.isEmpty()) { Card imprintedCard = game.getCard(imprinted.get(0)); - if (imprinted != null) { + if (imprintedCard != null) { imprintedCard.setFaceDown(false, game); if (imprintedCard.isCreature()) { controller.moveCards(imprintedCard, Zone.BATTLEFIELD, source, game); diff --git a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java index ef91a62b11..b548a8db00 100644 --- a/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java +++ b/Mage.Sets/src/mage/cards/c/CyclopeanTomb.java @@ -226,11 +226,6 @@ class CyclopeanTombCounterWatcher extends Watcher { } } - @Override - public void reset() { - super.reset(); - } - public Set landMiredByCyclopeanTombInstance(MageObjectReference mor, Game game) { if (counterData.containsKey(mor)) { return counterData.get(mor); diff --git a/Mage.Sets/src/mage/cards/d/DreadWight.java b/Mage.Sets/src/mage/cards/d/DreadWight.java index 0bdf71c0ee..e3225c405f 100644 --- a/Mage.Sets/src/mage/cards/d/DreadWight.java +++ b/Mage.Sets/src/mage/cards/d/DreadWight.java @@ -98,10 +98,6 @@ class DreadWightTriggeredAbility extends TriggeredAbilityImpl { return false; } - @Override - public String getRule() { - return super.getRule(); - } } class DreadWightEffect extends OneShotEffect { diff --git a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java index b703d4150d..563fb12b5c 100644 --- a/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java +++ b/Mage.Sets/src/mage/cards/e/EyeOfTheStorm.java @@ -124,11 +124,9 @@ class EyeOfTheStormEffect1 extends OneShotEffect { && !eyeOfTheStorm.getImprinted().isEmpty()) { CardsImpl copiedCards = new CardsImpl(); for (UUID uuid : eyeOfTheStorm.getImprinted()) { - card = game.getCard(uuid); - // Check if owner of card is still in game - if (card != null - && game.getPlayer(card.getOwnerId()) != null) { + card = game.getCard(uuid); + if (card != null && game.getPlayer(card.getOwnerId()) != null) { if (card.isSplitCard()) { copiedCards.add(((SplitCard) card).getLeftHalfCard()); copiedCards.add(((SplitCard) card).getRightHalfCard()); diff --git a/Mage.Sets/src/mage/cards/f/ForgottenLore.java b/Mage.Sets/src/mage/cards/f/ForgottenLore.java index 62ec82fcf4..8798d3f755 100644 --- a/Mage.Sets/src/mage/cards/f/ForgottenLore.java +++ b/Mage.Sets/src/mage/cards/f/ForgottenLore.java @@ -1,7 +1,5 @@ - package mage.cards.f; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.costs.Cost; import mage.abilities.costs.mana.ManaCostsImpl; @@ -18,14 +16,16 @@ import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInGraveyard; import mage.target.common.TargetOpponent; + +import java.util.UUID; + /** - * * @author LoneFox */ public final class ForgottenLore extends CardImpl { public ForgottenLore(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{G}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{G}"); // Target opponent chooses a card in your graveyard. You may pay {G}. If you do, repeat this process except that opponent can't choose a card already chosen for Forgotten Lore. Then put the last chosen card into your hand. this.getSpellAbility().addEffect(new ForgottenLoreEffect()); @@ -62,8 +62,7 @@ class ForgottenLoreEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player you = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(targetPointer.getFirst(game, source)); - if(you != null && opponent != null) - { + if (you != null && opponent != null) { FilterCard filter = new FilterCard(); filter.add(new OwnerIdPredicate(you.getId())); Cost cost = new ManaCostsImpl("{G}"); @@ -73,31 +72,31 @@ class ForgottenLoreEffect extends OneShotEffect { do { chosenCard = new TargetCardInGraveyard(filter); chosenCard.setNotTarget(true); - if(chosenCard.canChoose(opponent.getId(), game)) { + if (chosenCard.canChoose(opponent.getId(), game)) { opponent.chooseTarget(Outcome.ReturnToHand, chosenCard, source, game); card = game.getCard(chosenCard.getFirstTarget()); - filter.add(Predicates.not(new CardIdPredicate(card.getId()))); - game.informPlayers("Forgotten Lore: " + opponent.getLogName() + " has chosen " + card.getLogName()); - } - else { + if (card != null) { + filter.add(Predicates.not(new CardIdPredicate(card.getId()))); + game.informPlayers("Forgotten Lore: " + opponent.getLogName() + " has chosen " + card.getLogName()); + } + } else { done = true; } - if(!done) { - if(cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { + if (!done) { + if (cost.canPay(source, source.getSourceId(), you.getId(), game) && you.chooseUse(Outcome.Benefit, "Pay {G} to choose a different card ?", source, game)) { cost.clearPaid(); - if(!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { + if (!cost.pay(source, game, source.getSourceId(), you.getId(), false, null)) { done = true; } - } - else { + } else { done = true; } } - } while(!done); + } while (!done); - if(card != null) { + if (card != null) { Cards cardsToHand = new CardsImpl(); cardsToHand.add(card); you.moveCards(cardsToHand, Zone.HAND, source, game); diff --git a/Mage.Sets/src/mage/cards/g/GalepowderMage.java b/Mage.Sets/src/mage/cards/g/GalepowderMage.java index 28a2c19cce..8c7c5715f0 100644 --- a/Mage.Sets/src/mage/cards/g/GalepowderMage.java +++ b/Mage.Sets/src/mage/cards/g/GalepowderMage.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -15,8 +13,8 @@ import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; @@ -26,8 +24,9 @@ import mage.players.Player; import mage.target.common.TargetCreaturePermanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class GalepowderMage extends CardImpl { @@ -39,7 +38,7 @@ public final class GalepowderMage extends CardImpl { } public GalepowderMage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.KITHKIN); this.subtype.add(SubType.WIZARD); @@ -87,10 +86,10 @@ class GalepowderMageEffect extends OneShotEffect { if (controller != null && sourceObject != null) { if (getTargetPointer().getFirst(game, source) != null) { Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); - Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (permanent != null) { UUID exileId = UUID.randomUUID(); if (controller.moveCardToExileWithInfo(permanent, exileId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true)) { + Card card = game.getCard(getTargetPointer().getFirst(game, source)); if (card != null) { Effect effect = new ReturnToBattlefieldUnderOwnerControlTargetEffect(); effect.setTargetPointer(new FixedTarget(card.getId(), game.getState().getZoneChangeCounter(card.getId()))); diff --git a/Mage.Sets/src/mage/cards/g/GatherSpecimens.java b/Mage.Sets/src/mage/cards/g/GatherSpecimens.java index 812e8a993e..9efc66b27b 100644 --- a/Mage.Sets/src/mage/cards/g/GatherSpecimens.java +++ b/Mage.Sets/src/mage/cards/g/GatherSpecimens.java @@ -1,7 +1,5 @@ - package mage.cards.g; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.ReplacementEffectImpl; import mage.cards.Card; @@ -16,14 +14,15 @@ import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.players.Player; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class GatherSpecimens extends CardImpl { public GatherSpecimens(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{U}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{U}{U}{U}"); // If a creature would enter the battlefield under an opponent's control this turn, it enters the battlefield under your control instead. this.getSpellAbility().addEffect(new GatherSpecimensReplacementEffect()); @@ -70,7 +69,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl { if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent) event).getToZone().match(Zone.BATTLEFIELD)) { Card card = game.getCard(event.getTargetId()); - if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly + if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly Player controller = game.getPlayer(source.getControllerId()); if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { return true; @@ -79,9 +78,7 @@ class GatherSpecimensReplacementEffect extends ReplacementEffectImpl { } if (event.getType() == GameEvent.EventType.CREATE_TOKEN && event.getFlag()) { // flag indicates if it's a creature token Player controller = game.getPlayer(source.getControllerId()); - if (controller != null && controller.hasOpponent(event.getPlayerId(), game)) { - return true; - } + return controller != null && controller.hasOpponent(event.getPlayerId(), game); } return false; } diff --git a/Mage.Sets/src/mage/cards/g/GeodeGolem.java b/Mage.Sets/src/mage/cards/g/GeodeGolem.java index f4842176da..d35482b02e 100644 --- a/Mage.Sets/src/mage/cards/g/GeodeGolem.java +++ b/Mage.Sets/src/mage/cards/g/GeodeGolem.java @@ -1,6 +1,5 @@ package mage.cards.g; -import java.util.UUID; import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; @@ -20,8 +19,9 @@ import mage.constants.Zone; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** - * * @author spjspj */ public final class GeodeGolem extends CardImpl { @@ -68,7 +68,6 @@ class GeodeGolemEffect extends OneShotEffect { for (UUID commanderId : controller.getCommandersIds()) { if (game.getState().getZone(commanderId) == Zone.COMMAND) { Card commander = game.getCard(commanderId); - if (commander != null && game.getState().getZone(commanderId) == Zone.COMMAND) { SpellAbility ability = commander.getSpellAbility(); SpellAbility newAbility = commander.getSpellAbility().copy(); diff --git a/Mage.Sets/src/mage/cards/g/GuildmagesForum.java b/Mage.Sets/src/mage/cards/g/GuildmagesForum.java index 1a1792352e..e87d34e10d 100644 --- a/Mage.Sets/src/mage/cards/g/GuildmagesForum.java +++ b/Mage.Sets/src/mage/cards/g/GuildmagesForum.java @@ -88,11 +88,6 @@ class GuildmagesForumWatcher extends Watcher { } } - @Override - public void reset() { - super.reset(); - } - } class GuildmagesForumEntersBattlefieldEffect extends ReplacementEffectImpl { diff --git a/Mage.Sets/src/mage/cards/h/HintOfInsanity.java b/Mage.Sets/src/mage/cards/h/HintOfInsanity.java index 745149db0b..461575814c 100644 --- a/Mage.Sets/src/mage/cards/h/HintOfInsanity.java +++ b/Mage.Sets/src/mage/cards/h/HintOfInsanity.java @@ -1,14 +1,8 @@ - package mage.cards.h; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; -import mage.cards.CardImpl; -import mage.cards.CardSetInfo; -import mage.cards.Cards; -import mage.cards.CardsImpl; +import mage.cards.*; import mage.constants.CardType; import mage.constants.Outcome; import mage.filter.FilterCard; @@ -16,9 +10,11 @@ import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetCardInHand; +import mage.util.CardUtil; + +import java.util.UUID; /** - * * @author jeffwadsworth */ public final class HintOfInsanity extends CardImpl { @@ -62,8 +58,6 @@ class HintOfInsanityEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { FilterCard filter = new FilterCard("card from your hand"); Player targetPlayer = game.getPlayer(source.getFirstTarget()); - String nameOfChosenCard; - Card chosenCard; if (targetPlayer != null) { TargetCardInHand targetCard = new TargetCardInHand(filter); targetCard.setNotTarget(true); @@ -72,12 +66,12 @@ class HintOfInsanityEffect extends OneShotEffect { targetPlayer.revealCards("Hint of Insanity Reveal", cardsInHand, game); if (!cardsInHand.isEmpty() && targetPlayer.choose(Outcome.Discard, targetCard, source.getSourceId(), game)) { - chosenCard = game.getCard(targetCard.getFirstTarget()); - nameOfChosenCard = chosenCard.getName(); - for (Card card : cardsInHand.getCards(game)) { - if (card.getName().equals(nameOfChosenCard) - && !card.isLand()) { - targetPlayer.discard(card, source, game); + Card chosenCard = game.getCard(targetCard.getFirstTarget()); + if (chosenCard != null) { + for (Card card : cardsInHand.getCards(game)) { + if (CardUtil.haveSameNames(card, chosenCard) && !card.isLand()) { + targetPlayer.discard(card, source, game); + } } } return true; diff --git a/Mage.Sets/src/mage/cards/i/IxalansBinding.java b/Mage.Sets/src/mage/cards/i/IxalansBinding.java index 471a3ada5c..95be9e826b 100644 --- a/Mage.Sets/src/mage/cards/i/IxalansBinding.java +++ b/Mage.Sets/src/mage/cards/i/IxalansBinding.java @@ -1,7 +1,5 @@ - package mage.cards.i; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -12,11 +10,7 @@ import mage.abilities.effects.common.ExileUntilSourceLeavesEffect; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterNonlandPermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.ExileZone; @@ -26,8 +20,9 @@ import mage.game.permanent.Permanent; import mage.target.TargetPermanent; import mage.util.CardUtil; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class IxalansBinding extends CardImpl { @@ -80,10 +75,10 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl @Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); - Card card = game.getCard(event.getSourceId()); - if(event.getPlayerId().equals(source.getControllerId())){ + if (event.getPlayerId().equals(source.getControllerId())) { return false; } + Card card = game.getCard(event.getSourceId()); if (sourcePermanent != null && card != null) { UUID exileZone = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()); if (exileZone != null) { diff --git a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java index 4211de5922..bc09e9f0d0 100644 --- a/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java +++ b/Mage.Sets/src/mage/cards/j/JhoiraOfTheGhitu.java @@ -1,9 +1,5 @@ - package mage.cards.j; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageInt; import mage.MageObjectReference; import mage.abilities.Ability; @@ -17,25 +13,24 @@ import mage.abilities.keyword.SuspendAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Outcome; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; import mage.counters.CounterType; import mage.filter.common.FilterNonlandCard; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInHand; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class JhoiraOfTheGhitu extends CardImpl { public JhoiraOfTheGhitu(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{R}"); addSuperType(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.WIZARD); @@ -83,13 +78,17 @@ class JhoiraOfTheGhituSuspendEffect extends OneShotEffect { return false; } List cards = new ArrayList<>(); - for (Cost cost: source.getCosts()) { + for (Cost cost : source.getCosts()) { if (cost instanceof ExileFromHandCost) { cards = ((ExileFromHandCost) cost).getCards(); } } if (cards != null && !cards.isEmpty()) { + // always one card to exile Card card = game.getCard(cards.get(0).getId()); + if (card == null) { + return false; + } boolean hasSuspend = card.getAbilities().containsClass(SuspendAbility.class); UUID exileId = SuspendAbility.getSuspendExileId(controller.getId(), game); diff --git a/Mage.Sets/src/mage/cards/j/Juxtapose.java b/Mage.Sets/src/mage/cards/j/Juxtapose.java index 6c0cddb15c..a5464c16ed 100644 --- a/Mage.Sets/src/mage/cards/j/Juxtapose.java +++ b/Mage.Sets/src/mage/cards/j/Juxtapose.java @@ -1,13 +1,5 @@ - package mage.cards.j; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.effects.ContinuousEffectImpl; @@ -15,12 +7,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.cards.Cards; import mage.cards.CardsImpl; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.FilterCard; import mage.filter.FilterPermanent; import mage.filter.StaticFilters; @@ -31,8 +18,9 @@ import mage.players.Player; import mage.target.TargetCard; import mage.target.TargetPlayer; +import java.util.*; + /** - * * @author Quercitron */ public final class Juxtapose extends CardImpl { @@ -89,7 +77,6 @@ class JuxtaposeEffect extends ContinuousEffectImpl { public void init(Ability source, Game game) { Player you = game.getPlayer(source.getControllerId()); Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); - MageObject sourceObject = game.getCard(source.getSourceId()); if (you != null && targetPlayer != null) { Permanent permanent1 = chooseOnePermanentsWithTheHighestCMC(game, you, filter); @@ -109,6 +96,7 @@ class JuxtaposeEffect extends ContinuousEffectImpl { permanent1.changeControllerId(targetPlayer.getId(), game); permanent2.changeControllerId(you.getId(), game); + MageObject sourceObject = game.getCard(source.getSourceId()); game.informPlayers((sourceObject != null ? sourceObject.getLogName() : "") + ": " + you.getLogName() + " and " + targetPlayer.getLogName() + " exchange control of " + permanent1.getLogName() + " and " + permanent2.getName()); diff --git a/Mage.Sets/src/mage/cards/k/Kudzu.java b/Mage.Sets/src/mage/cards/k/Kudzu.java index 37e3b35540..0c8f9cb857 100644 --- a/Mage.Sets/src/mage/cards/k/Kudzu.java +++ b/Mage.Sets/src/mage/cards/k/Kudzu.java @@ -1,7 +1,5 @@ - package mage.cards.k; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BecomesTappedAttachedTriggeredAbility; import mage.abilities.effects.OneShotEffect; @@ -21,8 +19,9 @@ import mage.target.Target; import mage.target.TargetPermanent; import mage.target.common.TargetLandPermanent; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class Kudzu extends CardImpl { @@ -73,7 +72,6 @@ class KudzuEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Permanent kudzu = game.getPermanentOrLKIBattlefield(source.getSourceId()); - Card kudzuCard = game.getCard(source.getSourceId()); if (kudzu != null) { Permanent enchantedLand = game.getPermanentOrLKIBattlefield(kudzu.getAttachedTo()); Player controller = game.getPlayer(source.getControllerId()); @@ -86,8 +84,8 @@ class KudzuEffect extends OneShotEffect { if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield Target target = new TargetLandPermanent(); target.setNotTarget(true); //not a target, it is chosen - if (kudzuCard != null - && landsController != null) { + Card kudzuCard = game.getCard(source.getSourceId()); + if (kudzuCard != null && landsController != null) { if (landsController.choose(Outcome.Detriment, target, source.getId(), game)) { if (target.getFirstTarget() != null) { Permanent landChosen = game.getPermanent(target.getFirstTarget()); diff --git a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java index 05038cb183..8f209d80b3 100644 --- a/Mage.Sets/src/mage/cards/l/LegionsInitiative.java +++ b/Mage.Sets/src/mage/cards/l/LegionsInitiative.java @@ -1,7 +1,5 @@ - package mage.cards.l; -import java.util.UUID; import mage.ObjectColor; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -17,11 +15,7 @@ import mage.abilities.keyword.HasteAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.FilterPermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardTypePredicate; @@ -32,8 +26,9 @@ import mage.game.Game; import mage.game.permanent.Permanent; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class LegionsInitiative extends CardImpl { @@ -47,7 +42,7 @@ public final class LegionsInitiative extends CardImpl { } public LegionsInitiative(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{R}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{R}{W}"); // Red creatures you control get +1/+0. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.WhileOnBattlefield, filterRedCreature))); @@ -136,12 +131,14 @@ class LegionsInitiativeReturnFromExileEffect extends OneShotEffect { exile = exile.copy(); for (UUID cardId : exile) { Card card = game.getCard(cardId); - card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); - Permanent returnedCreature = game.getPermanent(cardId); - if (returnedCreature != null) { - ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); - effect.setTargetPointer(new FixedTarget(returnedCreature.getId())); - game.addEffect(effect, source); + if (card != null) { + card.moveToZone(Zone.BATTLEFIELD, source.getSourceId(), game, false); + Permanent returnedCreature = game.getPermanent(cardId); + if (returnedCreature != null) { + ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(returnedCreature.getId())); + game.addEffect(effect, source); + } } } game.getExile().getExileZone(source.getSourceId()).clear(); diff --git a/Mage.Sets/src/mage/cards/l/LightUpTheStage.java b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java index 2a48c3106c..a588256490 100644 --- a/Mage.Sets/src/mage/cards/l/LightUpTheStage.java +++ b/Mage.Sets/src/mage/cards/l/LightUpTheStage.java @@ -62,10 +62,10 @@ class LightUpTheStageEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Card sourceCard = game.getCard(source.getSourceId()); if (controller != null) { Set cards = controller.getLibrary().getTopCards(game, 2); - controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard.getIdName()); + Card sourceCard = game.getCard(source.getSourceId()); + controller.moveCardsToExile(cards, source, game, true, CardUtil.getCardExileZoneId(game, source), sourceCard != null ? sourceCard.getIdName() : ""); for (Card card : cards) { ContinuousEffect effect = new LightUpTheStageMayPlayEffect(); @@ -107,9 +107,7 @@ class LightUpTheStageMayPlayEffect extends AsThoughEffectImpl { @Override public boolean isInactive(Ability source, Game game) { if (castOnTurn != game.getTurnNum() && game.getPhase().getStep().getType() == PhaseStep.END_TURN) { - if (game.isActivePlayer(source.getControllerId())) { - return true; - } + return game.isActivePlayer(source.getControllerId()); } return false; } diff --git a/Mage.Sets/src/mage/cards/m/Martyrdom.java b/Mage.Sets/src/mage/cards/m/Martyrdom.java index b684ec48b7..067ad07278 100644 --- a/Mage.Sets/src/mage/cards/m/Martyrdom.java +++ b/Mage.Sets/src/mage/cards/m/Martyrdom.java @@ -94,11 +94,6 @@ class MartyrdomActivatedAbility extends ActivatedAbilityImpl { this.caster = ability.caster; } - @Override - public Effects getEffects(Game game, EffectType effectType) { - return super.getEffects(game, effectType); - } - @Override public ActivationStatus canActivate(UUID playerId, Game game) { if (playerId.equals(caster)) { diff --git a/Mage.Sets/src/mage/cards/m/Merseine.java b/Mage.Sets/src/mage/cards/m/Merseine.java index 836365c850..cec4a052dc 100644 --- a/Mage.Sets/src/mage/cards/m/Merseine.java +++ b/Mage.Sets/src/mage/cards/m/Merseine.java @@ -77,11 +77,6 @@ class MerseineActivatedAbility extends SimpleActivatedAbility { super(ability); } - @Override - public Effects getEffects(Game game, EffectType effectType) { - return super.getEffects(game, effectType); - } - @Override public ActivationStatus canActivate(UUID playerId, Game game) { Permanent sourcePermanent = game.getBattlefield().getPermanent(this.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java index 5b5fce962f..25ff9a740d 100644 --- a/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java +++ b/Mage.Sets/src/mage/cards/m/MinionOfTheWastes.java @@ -1,7 +1,5 @@ - package mage.cards.m; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.AsEntersBattlefieldAbility; @@ -13,17 +11,13 @@ import mage.abilities.keyword.TrampleAbility; import mage.cards.Card; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.players.Player; +import java.util.UUID; + /** - * * @author L_J */ public final class MinionOfTheWastes extends CardImpl { @@ -39,7 +33,7 @@ public final class MinionOfTheWastes extends CardImpl { // As Minion of the Wastes enters the battlefield, pay any amount of life. The amount you pay can't be more than the total number of white nontoken permanents your opponents control plus the total number of white cards in their graveyards. this.addAbility(new AsEntersBattlefieldAbility(new MinionOfTheWastesEffect())); - + // Minion of the Wastes's power and toughness are each equal to the life paid as it entered the battlefield. this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect("{this}'s power and toughness are each equal to the life paid as it entered the battlefield"))); } @@ -74,10 +68,10 @@ class MinionOfTheWastesEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { - Card sourceCard = game.getCard(source.getSourceId()); int payAmount = controller.getAmount(0, controller.getLife(), "Pay any amount of life", game); controller.loseLife(payAmount, game, false); - game.informPlayers(sourceCard.getLogName() + ": " + controller.getLogName() + + Card sourceCard = game.getCard(source.getSourceId()); + game.informPlayers((sourceCard != null ? sourceCard.getLogName() : "") + ": " + controller.getLogName() + " pays " + payAmount + " life"); game.addEffect(new SetPowerToughnessSourceEffect(payAmount, payAmount, Duration.Custom, SubLayer.SetPT_7b), source); return true; diff --git a/Mage.Sets/src/mage/cards/m/Mistcaller.java b/Mage.Sets/src/mage/cards/m/Mistcaller.java index 0a10fd7504..e2bef655e5 100644 --- a/Mage.Sets/src/mage/cards/m/Mistcaller.java +++ b/Mage.Sets/src/mage/cards/m/Mistcaller.java @@ -1,6 +1,5 @@ package mage.cards.m; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -8,21 +7,18 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.keyword.TransformAbility; import mage.cards.Card; -import mage.constants.SubType; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.ZoneChangeEvent; import mage.players.Player; import mage.watchers.common.CreatureWasCastWatcher; +import java.util.UUID; + /** - * * @author TheElk801 */ public final class Mistcaller extends CardImpl { @@ -96,14 +92,14 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) { Card card = game.getCard(event.getTargetId()); - Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId()); - if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) { - card = card.getSecondCardFace(); - } - if (card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly - CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class); - if (watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId())) { - return true; + if (card != null) { + Object entersTransformed = game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + event.getTargetId()); + if (entersTransformed instanceof Boolean && (Boolean) entersTransformed && card.getSecondCardFace() != null) { + card = card.getSecondCardFace(); + } + if (card != null && card.isCreature()) { // TODO: Bestow Card cast as Enchantment probably not handled correctly + CreatureWasCastWatcher watcher = game.getState().getWatcher(CreatureWasCastWatcher.class); + return watcher != null && !watcher.wasCreatureCastThisTurn(event.getTargetId()); } } } diff --git a/Mage.Sets/src/mage/cards/m/MoltenBirth.java b/Mage.Sets/src/mage/cards/m/MoltenBirth.java index 66898ae84d..8ca1c620ba 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenBirth.java +++ b/Mage.Sets/src/mage/cards/m/MoltenBirth.java @@ -1,7 +1,5 @@ - package mage.cards.m; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; @@ -14,8 +12,9 @@ import mage.game.Game; import mage.game.permanent.token.MoltenBirthElementalToken; import mage.players.Player; +import java.util.UUID; + /** - * * @author jeffwadsworth */ public final class MoltenBirth extends CardImpl { @@ -57,13 +56,15 @@ class MoltenBirthEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); - Card molten = game.getCard(source.getSourceId()); if (controller != null) { MoltenBirthElementalToken token = new MoltenBirthElementalToken(); token.putOntoBattlefield(2, game, source.getSourceId(), source.getControllerId()); if (controller.flipCoin(game)) { - molten.moveToZone(Zone.HAND, source.getSourceId(), game, true); - game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand."); + Card molten = game.getCard(source.getSourceId()); + if (molten != null) { + molten.moveToZone(Zone.HAND, source.getSourceId(), game, true); + game.informPlayers(controller.getLogName() + " won the flip. " + molten.getLogName() + " is returned to " + controller.getLogName() + "'s hand."); + } } return true; } diff --git a/Mage.Sets/src/mage/cards/n/Nightcreep.java b/Mage.Sets/src/mage/cards/n/Nightcreep.java index 13e51cd7b0..45cde1263c 100644 --- a/Mage.Sets/src/mage/cards/n/Nightcreep.java +++ b/Mage.Sets/src/mage/cards/n/Nightcreep.java @@ -59,11 +59,6 @@ class NightcreepLandEffect extends BecomesBasicLandTargetEffect { this.setTargetPointer(new FixedTargets(targets, game)); } - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - return super.apply(layer, sublayer, source, game); - } - @Override public NightcreepLandEffect copy() { return new NightcreepLandEffect(this); @@ -88,11 +83,6 @@ class NightcreepCreatureEffect extends BecomesColorTargetEffect { this.setTargetPointer(new FixedTargets(targets, game)); } - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - return super.apply(layer, sublayer, source, game); - } - @Override public NightcreepCreatureEffect copy() { return new NightcreepCreatureEffect(this); diff --git a/Mage.Sets/src/mage/cards/p/PatriciansScorn.java b/Mage.Sets/src/mage/cards/p/PatriciansScorn.java index 5de846bda5..12cecad6c1 100644 --- a/Mage.Sets/src/mage/cards/p/PatriciansScorn.java +++ b/Mage.Sets/src/mage/cards/p/PatriciansScorn.java @@ -98,8 +98,4 @@ class PatriciansScornWatcher extends Watcher { } } - @Override - public void reset() { - super.reset(); - } } diff --git a/Mage.Sets/src/mage/cards/p/PucasMischief.java b/Mage.Sets/src/mage/cards/p/PucasMischief.java index cb5f3d419e..dcf0628b1b 100644 --- a/Mage.Sets/src/mage/cards/p/PucasMischief.java +++ b/Mage.Sets/src/mage/cards/p/PucasMischief.java @@ -64,11 +64,6 @@ class TargetControlledPermanentWithCMCGreaterOrLessThanOpponentPermanent extends super(target); } - @Override - public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { - return super.canTarget(controllerId, id, source, game); - } - @Override public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); diff --git a/Mage.Sets/src/mage/cards/s/Spawnbroker.java b/Mage.Sets/src/mage/cards/s/Spawnbroker.java index 2e291383a3..1d83a023cd 100644 --- a/Mage.Sets/src/mage/cards/s/Spawnbroker.java +++ b/Mage.Sets/src/mage/cards/s/Spawnbroker.java @@ -69,11 +69,6 @@ class TargetControlledCreatureWithPowerGreaterOrLessThanOpponentPermanent extend super(target); } - @Override - public boolean canTarget(UUID controllerId, UUID id, Ability source, Game game) { - return super.canTarget(controllerId, id, source, game); - } - @Override public Set possibleTargets(UUID sourceId, UUID sourceControllerId, Game game) { Set possibleTargets = new HashSet<>(); diff --git a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java index dd050ce172..790b95f3e6 100644 --- a/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/AuraReplacementEffect.java @@ -1,7 +1,5 @@ - package mage.abilities.effects; -import java.util.UUID; import mage.MageObject; import mage.abilities.Ability; import mage.abilities.SpellAbility; @@ -19,6 +17,8 @@ import mage.players.Player; import mage.target.Target; import mage.target.common.TargetCardInGraveyard; +import java.util.UUID; + /** * Cards with the Aura subtype don't change the zone they are in, if there is no * valid target on the battlefield. Also, when entering the battlefield and it @@ -60,6 +60,9 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { Card card = game.getCard(event.getTargetId()); UUID sourceId = event.getSourceId(); UUID controllerId = event.getPlayerId(); + if (card == null) { + return false; + } if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) { card = card.getSecondCardFace(); @@ -149,7 +152,6 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { } Player targetPlayer = game.getPlayer(targetId); if (targetCard != null || targetPermanent != null || targetPlayer != null) { - card = game.getCard(event.getTargetId()); card.removeFromZone(game, fromZone, sourceId); PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game); ZoneChangeEvent zoneChangeEvent = new ZoneChangeEvent(permanent, controllerId, fromZone, Zone.BATTLEFIELD); @@ -184,14 +186,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl { if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD && (((ZoneChangeEvent) event).getFromZone() != Zone.STACK)) { Card card = game.getCard(event.getTargetId()); - if (card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game) + return card != null && (card.isEnchantment() && card.hasSubtype(SubType.AURA, game) || // in case of transformable enchantments (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null - && card.getSecondCardFace() != null - && card.getSecondCardFace().isEnchantment() - && card.getSecondCardFace().hasSubtype(SubType.AURA, game)))) { - return true; - } + && card.getSecondCardFace() != null + && card.getSecondCardFace().isEnchantment() + && card.getSecondCardFace().hasSubtype(SubType.AURA, game))); } return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java index 092c8ec92c..8f90639c3b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CreateTokenCopyTargetEffect.java @@ -1,8 +1,5 @@ package mage.abilities.effects.common; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; import mage.MageObject; import mage.ObjectColor; import mage.abilities.Ability; @@ -14,11 +11,7 @@ import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.SuperType; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; import mage.game.permanent.token.EmptyToken; @@ -27,8 +20,11 @@ import mage.util.CardUtil; import mage.util.functions.ApplyToPermanent; import mage.util.functions.EmptyApplyToPermanent; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + /** - * * @author LevelX2 */ public class CreateTokenCopyTargetEffect extends OneShotEffect { @@ -73,12 +69,11 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { } /** - * - * @param playerId null the token is controlled/owned by the controller of - * the source ability + * @param playerId null the token is controlled/owned by the controller of + * the source ability * @param additionalCardType the token gains this card type in addition - * @param hasHaste the token gains haste - * @param number number of tokens to put into play + * @param hasHaste the token gains haste + * @param number number of tokens to put into play * @param tapped * @param attacking */ @@ -165,7 +160,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect { copyFrom = game.getCard(getTargetPointer().getFirst(game, source)); } - if (permanent == null && copyFrom == null) { + if (copyFrom == null) { return false; } diff --git a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java index 5e8ddbdac5..ad8a25bbde 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/discard/DiscardCardYouChooseTargetEffect.java @@ -1,8 +1,5 @@ - package mage.abilities.effects.common.discard; -import java.util.List; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; @@ -20,8 +17,10 @@ import mage.target.TargetCard; import mage.target.common.TargetCardInHand; import mage.util.CardUtil; +import java.util.List; +import java.util.UUID; + /** - * * @author noxx */ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { @@ -98,7 +97,6 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player player = game.getPlayer(targetPointer.getFirst(game, source)); Player controller = game.getPlayer(source.getControllerId()); - Card sourceCard = game.getCard(source.getSourceId()); if (player != null && controller != null) { if (revealAllCards) { this.numberCardsToReveal = new StaticValue(player.getHand().size()); @@ -125,6 +123,7 @@ public class DiscardCardYouChooseTargetEffect extends OneShotEffect { revealedCards.addAll(player.getHand()); } + Card sourceCard = game.getCard(source.getSourceId()); player.revealCards(sourceCard != null ? sourceCard.getIdName() + " (" + sourceCard.getZoneChangeCounter(game) + ')' : "Discard", revealedCards, game); boolean result = true; diff --git a/Mage/src/main/java/mage/game/GameState.java b/Mage/src/main/java/mage/game/GameState.java index 159ab6b9cb..3caa16a21a 100644 --- a/Mage/src/main/java/mage/game/GameState.java +++ b/Mage/src/main/java/mage/game/GameState.java @@ -544,7 +544,7 @@ public class GameState implements Serializable, Copyable { return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), uuid.toString())); } - public T getWatcher(Class watcherClass,String prefix) { + public T getWatcher(Class watcherClass, String prefix) { return watcherClass.cast(watchers.get(watcherClass.getSimpleName(), prefix)); } @@ -776,7 +776,9 @@ public class GameState implements Serializable, Copyable { ZoneChangeEvent castEvent = (ZoneChangeEvent) event; UUID targetId = castEvent.getTargetId(); Card card = game.getCard(targetId); - movedCards.add(card); + if (card != null) { + movedCards.add(card); + } } ZoneChangeData eventData = entry.getKey(); if (!movedCards.isEmpty()) { @@ -1117,7 +1119,7 @@ public class GameState implements Serializable, Copyable { this.watchers.add(watcher); } - public void resetWatchers(){ + public void resetWatchers() { this.watchers.reset(); } diff --git a/Mage/src/main/java/mage/players/Library.java b/Mage/src/main/java/mage/players/Library.java index 2514aa7faa..3f930f781f 100644 --- a/Mage/src/main/java/mage/players/Library.java +++ b/Mage/src/main/java/mage/players/Library.java @@ -186,7 +186,9 @@ public class Library implements Serializable { Map cards = new HashMap<>(); for (UUID cardId : library) { Card card = game.getCard(cardId); - cards.putIfAbsent(card.getName(), card); + if (card != null) { + cards.putIfAbsent(card.getName(), card); + } } return cards.values(); }