mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
Fixed multiple NPE errors in cards;
This commit is contained in:
parent
285ed5801f
commit
105062beb7
14 changed files with 104 additions and 94 deletions
|
@ -25,6 +25,7 @@ import mage.players.Player;
|
|||
import mage.target.TargetSpell;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -133,10 +134,17 @@ class AshioksErasureReplacementEffect extends ContinuousRuleModifyingEffectImpl
|
|||
exile = game.getExile().getExileZone(exileZone);
|
||||
}
|
||||
}
|
||||
|
||||
if (exile == null) {
|
||||
return false;
|
||||
}
|
||||
Card exiledCard = exile.getCards(game).iterator().next();
|
||||
|
||||
Set<Card> cards = exile.getCards(game);
|
||||
if (cards.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Card exiledCard = cards.iterator().next();
|
||||
if (exiledCard != null) {
|
||||
return exiledCard.getName().equals(card.getName());
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -19,8 +17,10 @@ import mage.game.Game;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class AugurOfBolas extends CardImpl {
|
||||
|
@ -81,9 +81,12 @@ class AugurOfBolasEffect extends OneShotEffect {
|
|||
int number = topCards.count(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game);
|
||||
if (number > 0) {
|
||||
if (controller.chooseUse(outcome, "Reveal an instant or sorcery card from the looked at cards and put it into your hand?", source, game)) {
|
||||
Card card;
|
||||
Card card = null;
|
||||
if (number == 1) {
|
||||
card = topCards.getCards(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game).iterator().next();
|
||||
Set<Card> cards = topCards.getCards(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game);
|
||||
if (!cards.isEmpty()) {
|
||||
card = cards.iterator().next();
|
||||
}
|
||||
} else {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterInstantOrSorceryCard());
|
||||
controller.chooseTarget(outcome, topCards, target, source, game);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -16,8 +14,10 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class Cultivate extends CardImpl {
|
||||
|
@ -79,12 +79,14 @@ class CultivateEffect extends OneShotEffect {
|
|||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
revealed.remove(card);
|
||||
}
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
} else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
Card card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
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.constants.Zone;
|
||||
|
@ -18,8 +12,10 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class FinalParting extends CardImpl {
|
||||
|
@ -78,10 +74,12 @@ class FinalPartingEffect extends OneShotEffect {
|
|||
Card card = searched.get(target2.getFirstTarget(), game);
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
searched.remove(card);
|
||||
card = searched.getCards(game).iterator().next();
|
||||
Set<Card> cards = searched.getCards(game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
} else if (target.getTargets().size() == 1) {
|
||||
Card card = searched.getCards(game).iterator().next();
|
||||
Set<Card> cards = searched.getCards(game);
|
||||
Card card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class GodEternalKefnetDrawCardReplacementEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
Card topCard = you.getLibrary().getTopCards(game, 1).iterator().next();
|
||||
Card topCard = you.getLibrary().getFromTop(game);
|
||||
if (topCard == null) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
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.constants.Zone;
|
||||
|
@ -19,14 +13,16 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class JaradsOrders extends CardImpl {
|
||||
|
||||
public JaradsOrders(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{B}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{G}");
|
||||
|
||||
// Search your library for up to two creature cards and reveal them. Put one into your hand and the other into your graveyard. Then shuffle your library.
|
||||
this.getSpellAbility().addEffect(new JaradsOrdersEffect());
|
||||
|
@ -41,6 +37,7 @@ public final class JaradsOrders extends CardImpl {
|
|||
return new JaradsOrders(this);
|
||||
}
|
||||
}
|
||||
|
||||
class JaradsOrdersEffect extends OneShotEffect {
|
||||
|
||||
protected static final FilterCard filter = new FilterCard("card to put into your hand");
|
||||
|
@ -60,14 +57,14 @@ class JaradsOrdersEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(0, 2, new FilterCreatureCard("creature cards"));
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
if (!target.getTargets().isEmpty()) {
|
||||
Cards revealed = new CardsImpl();
|
||||
for (UUID cardId: target.getTargets()) {
|
||||
for (UUID cardId : target.getTargets()) {
|
||||
Card card = controller.getLibrary().getCard(cardId, game);
|
||||
revealed.add(card);
|
||||
}
|
||||
|
@ -78,10 +75,12 @@ class JaradsOrdersEffect extends OneShotEffect {
|
|||
Card card = revealed.get(target2.getFirstTarget(), game);
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
revealed.remove(card);
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.GRAVEYARD, source, game);
|
||||
} else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
Card card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.k;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -16,16 +15,16 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class KodamasReach extends CardImpl {
|
||||
|
||||
public KodamasReach(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{2}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");
|
||||
this.subtype.add(SubType.ARCANE);
|
||||
|
||||
// Search your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Then shuffle your library.
|
||||
|
@ -84,12 +83,14 @@ class KodamasReachEffect extends OneShotEffect {
|
|||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
revealed.remove(card);
|
||||
}
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
} else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
Card card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
|
@ -11,28 +8,26 @@ import mage.abilities.costs.common.SacrificeSourceCost;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
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.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author HCrescent
|
||||
*/
|
||||
public final class MagusOfTheJar extends CardImpl {
|
||||
|
||||
public MagusOfTheJar(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
|
||||
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.WIZARD);
|
||||
this.power = new MageInt(3);
|
||||
|
@ -42,7 +37,7 @@ public final class MagusOfTheJar extends CardImpl {
|
|||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MagusoftheJarEffect(), new TapSourceCost());
|
||||
ability.addCost(new SacrificeSourceCost());
|
||||
this.addAbility(ability);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public MagusOfTheJar(final MagusOfTheJar card) {
|
||||
|
@ -73,9 +68,9 @@ class MagusoftheJarEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Cards hand = player.getHand();
|
||||
while (!hand.isEmpty()) {
|
||||
Card card = hand.get(hand.iterator().next(), game);
|
||||
Cards handCards = new CardsImpl(player.getHand());
|
||||
for (UUID cardId : handCards) {
|
||||
Card card = handCards.get(cardId, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
|
@ -133,7 +128,7 @@ class MagusoftheJarDelayedEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
//Return to hand
|
||||
for (Iterator<Card> it = cards.getCards(game).iterator(); it.hasNext();) {
|
||||
for (Iterator<Card> it = cards.getCards(game).iterator(); it.hasNext(); ) {
|
||||
Card card = it.next();
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -10,11 +7,7 @@ import mage.abilities.costs.common.SacrificeSourceCost;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
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.constants.Zone;
|
||||
|
@ -23,14 +16,16 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public final class MemoryJar extends CardImpl {
|
||||
|
||||
public MemoryJar(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{5}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{5}");
|
||||
|
||||
// {T}, Sacrifice Memory Jar: Each player exiles all cards from their hand face down and draws seven cards.
|
||||
// At the beginning of the next end step, each player discards their hand and returns to their hand each
|
||||
|
@ -69,9 +64,9 @@ class MemoryJarEffect extends OneShotEffect {
|
|||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
Cards hand = player.getHand();
|
||||
while (!hand.isEmpty()) {
|
||||
Card card = hand.get(hand.iterator().next(), game);
|
||||
Cards handCards = new CardsImpl(player.getHand());
|
||||
for (UUID cardId : handCards) {
|
||||
Card card = handCards.get(cardId, game);
|
||||
if (card != null) {
|
||||
card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game);
|
||||
card.setFaceDown(true, game);
|
||||
|
@ -129,7 +124,7 @@ class MemoryJarDelayedEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
//Return to hand
|
||||
for (Iterator<Card> it = cards.getCards(game).iterator(); it.hasNext();) {
|
||||
for (Iterator<Card> it = cards.getCards(game).iterator(); it.hasNext(); ) {
|
||||
Card card = it.next();
|
||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, true);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -83,7 +84,8 @@ class OathOfNissaEffect extends OneShotEffect {
|
|||
if (controller.chooseUse(outcome, "Reveal a creature, land, or planeswalker card from the looked at cards and put it into your hand?", source, game)) {
|
||||
Card card;
|
||||
if (number == 1) {
|
||||
card = topCards.getCards(filter, source.getSourceId(), source.getControllerId(), game).iterator().next();
|
||||
Set<Card> cards = topCards.getCards(filter, source.getSourceId(), source.getControllerId(), game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
} else {
|
||||
TargetCard target = new TargetCard(Zone.LIBRARY, filter);
|
||||
controller.choose(outcome, topCards, target, game);
|
||||
|
|
|
@ -1,22 +1,17 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
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.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.game.ExileZone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
|
@ -26,8 +21,11 @@ import mage.target.common.TargetCardInLibrary;
|
|||
import mage.util.CardUtil;
|
||||
import mage.util.RandomUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class ParallelThoughts extends CardImpl {
|
||||
|
@ -131,10 +129,11 @@ class ParallelThoughtsReplacementEffect extends ReplacementEffectImpl {
|
|||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null
|
||||
&& !game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)).getCards(game).isEmpty()) {
|
||||
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
||||
Set<Card> cards = exileZone != null ? exileZone.getCards(game) : null;
|
||||
if (controller != null && cards != null && !cards.isEmpty()) {
|
||||
if (controller.chooseUse(outcome, "Draw a card from the pile you exiled instead drawing from your library?", source, game)) {
|
||||
Card card = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)).getCards(game).iterator().next();
|
||||
Card card = cards.iterator().next();
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.p;
|
||||
|
||||
import mage.MageObject;
|
||||
|
@ -17,16 +16,16 @@ import mage.players.Player;
|
|||
import mage.target.TargetCard;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class Peregrination extends CardImpl {
|
||||
|
||||
public Peregrination(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{G}");
|
||||
|
||||
// Seach your library for up to two basic land cards, reveal those cards, and put one onto the battlefield tapped and the other into your hand. Shuffle your library, then scry 1.
|
||||
this.getSpellAbility().addEffect(new PeregrinationEffect());
|
||||
|
@ -85,10 +84,12 @@ class PeregrinationEffect extends OneShotEffect {
|
|||
Card card = revealed.get(target2.getFirstTarget(), game);
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
revealed.remove(card);
|
||||
card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.HAND, source, game);
|
||||
} else if (target.getTargets().size() == 1) {
|
||||
Card card = revealed.getCards(game).iterator().next();
|
||||
Set<Card> cards = revealed.getCards(game);
|
||||
Card card = cards.isEmpty() ? null : cards.iterator().next();
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
|
@ -13,9 +11,11 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*
|
||||
*/
|
||||
public class HideawayPlayEffect extends OneShotEffect {
|
||||
|
||||
|
@ -40,12 +40,16 @@ public class HideawayPlayEffect extends OneShotEffect {
|
|||
if (permanent != null) {
|
||||
zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanent.getZoneChangeCounter(game)));
|
||||
}
|
||||
|
||||
if (zone == null
|
||||
|| zone.isEmpty()) {
|
||||
|
||||
if (zone == null) {
|
||||
return true;
|
||||
}
|
||||
Card card = zone.getCards(game).iterator().next();
|
||||
Set<Card> cards = zone.getCards(game);
|
||||
if (cards.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Card card = cards.iterator().next();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (card != null && controller != null) {
|
||||
if (controller.chooseUse(Outcome.PlayForFree, "Do you want to play " + card.getIdName() + " for free now?", source, game)) {
|
||||
|
|
|
@ -285,6 +285,9 @@ public final class ZonesHandler {
|
|||
|
||||
public static List<Card> chooseOrder(String message, Cards cards, Player player, Game game) {
|
||||
List<Card> order = new ArrayList<>();
|
||||
if (cards.isEmpty()) {
|
||||
return order;
|
||||
}
|
||||
TargetCard target = new TargetCard(Zone.ALL, new FilterCard(message));
|
||||
target.setRequired(true);
|
||||
while (player.isInGame() && cards.size() > 1) {
|
||||
|
|
Loading…
Reference in a new issue