Fixed multiple NPE errors in cards;

This commit is contained in:
Oleg Agafonov 2020-01-28 03:37:49 +04:00
parent 285ed5801f
commit 105062beb7
14 changed files with 104 additions and 94 deletions

View file

@ -25,6 +25,7 @@ import mage.players.Player;
import mage.target.TargetSpell; import mage.target.TargetSpell;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
/** /**
@ -133,10 +134,17 @@ class AshioksErasureReplacementEffect extends ContinuousRuleModifyingEffectImpl
exile = game.getExile().getExileZone(exileZone); exile = game.getExile().getExileZone(exileZone);
} }
} }
if (exile == null) { if (exile == null) {
return false; 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) { if (exiledCard != null) {
return exiledCard.getName().equals(card.getName()); return exiledCard.getName().equals(card.getName());
} }

View file

@ -1,7 +1,5 @@
package mage.cards.a; package mage.cards.a;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
@ -19,8 +17,10 @@ import mage.game.Game;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class AugurOfBolas extends CardImpl { 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); int number = topCards.count(new FilterInstantOrSorceryCard(), source.getSourceId(), source.getControllerId(), game);
if (number > 0) { 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)) { 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) { 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 { } else {
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterInstantOrSorceryCard()); TargetCard target = new TargetCard(Zone.LIBRARY, new FilterInstantOrSorceryCard());
controller.chooseTarget(outcome, topCards, target, source, game); controller.chooseTarget(outcome, topCards, target, source, game);

View file

@ -1,7 +1,5 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -16,8 +14,10 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author BetaSteward_at_googlemail.com * @author BetaSteward_at_googlemail.com
*/ */
public final class Cultivate extends CardImpl { 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); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
revealed.remove(card); 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) { if (card != null) {
controller.moveCards(card, Zone.HAND, source, game); controller.moveCards(card, Zone.HAND, source, game);
} }
} else if (target.getTargets().size() == 1) { } 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) { if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
} }

View file

@ -1,14 +1,8 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
@ -18,8 +12,10 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author TheElk801 * @author TheElk801
*/ */
public final class FinalParting extends CardImpl { public final class FinalParting extends CardImpl {
@ -78,10 +74,12 @@ class FinalPartingEffect extends OneShotEffect {
Card card = searched.get(target2.getFirstTarget(), game); Card card = searched.get(target2.getFirstTarget(), game);
controller.moveCards(card, Zone.HAND, source, game); controller.moveCards(card, Zone.HAND, source, game);
searched.remove(card); 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); controller.moveCards(card, Zone.GRAVEYARD, source, game);
} else if (target.getTargets().size() == 1) { } 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); controller.moveCards(card, Zone.HAND, source, game);
} }

View file

@ -127,7 +127,7 @@ class GodEternalKefnetDrawCardReplacementEffect extends ReplacementEffectImpl {
return false; return false;
} }
Card topCard = you.getLibrary().getTopCards(game, 1).iterator().next(); Card topCard = you.getLibrary().getFromTop(game);
if (topCard == null) { if (topCard == null) {
return false; return false;
} }

View file

@ -1,14 +1,8 @@
package mage.cards.j; package mage.cards.j;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
@ -19,8 +13,10 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class JaradsOrders extends CardImpl { public final class JaradsOrders extends CardImpl {
@ -41,6 +37,7 @@ public final class JaradsOrders extends CardImpl {
return new JaradsOrders(this); return new JaradsOrders(this);
} }
} }
class JaradsOrdersEffect extends OneShotEffect { class JaradsOrdersEffect extends OneShotEffect {
protected static final FilterCard filter = new FilterCard("card to put into your hand"); protected static final FilterCard filter = new FilterCard("card to put into your hand");
@ -78,10 +75,12 @@ class JaradsOrdersEffect extends OneShotEffect {
Card card = revealed.get(target2.getFirstTarget(), game); Card card = revealed.get(target2.getFirstTarget(), game);
controller.moveCards(card, Zone.HAND, source, game); controller.moveCards(card, Zone.HAND, source, game);
revealed.remove(card); 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); controller.moveCards(card, Zone.GRAVEYARD, source, game);
} else if (target.getTargets().size() == 1) { } 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); controller.moveCards(card, Zone.HAND, source, game);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.k; package mage.cards.k;
import mage.MageObject; import mage.MageObject;
@ -16,10 +15,10 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class KodamasReach extends CardImpl { public final class KodamasReach extends CardImpl {
@ -84,12 +83,14 @@ class KodamasReachEffect extends OneShotEffect {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
revealed.remove(card); 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) { if (card != null) {
controller.moveCards(card, Zone.HAND, source, game); controller.moveCards(card, Zone.HAND, source, game);
} }
} else if (target.getTargets().size() == 1) { } 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) { if (card != null) {
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
} }

View file

@ -1,8 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.Iterator;
import java.util.UUID;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
@ -11,21 +8,19 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.players.Player; import mage.players.Player;
import java.util.Iterator;
import java.util.UUID;
/** /**
*
* @author HCrescent * @author HCrescent
*/ */
public final class MagusOfTheJar extends CardImpl { public final class MagusOfTheJar extends CardImpl {
@ -73,9 +68,9 @@ class MagusoftheJarEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null) {
Cards hand = player.getHand(); Cards handCards = new CardsImpl(player.getHand());
while (!hand.isEmpty()) { for (UUID cardId : handCards) {
Card card = hand.get(hand.iterator().next(), game); Card card = handCards.get(cardId, game);
if (card != null) { if (card != null) {
card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game); card.moveToExile(getId(), "Magus of the Jar", source.getSourceId(), game);
card.setFaceDown(true, game); card.setFaceDown(true, game);

View file

@ -1,8 +1,5 @@
package mage.cards.m; package mage.cards.m;
import java.util.Iterator;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility; import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
@ -10,11 +7,7 @@ import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.Effect; import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
@ -23,8 +16,10 @@ import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.players.Player; import mage.players.Player;
import java.util.Iterator;
import java.util.UUID;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class MemoryJar extends CardImpl { public final class MemoryJar extends CardImpl {
@ -69,9 +64,9 @@ class MemoryJarEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null) {
Cards hand = player.getHand(); Cards handCards = new CardsImpl(player.getHand());
while (!hand.isEmpty()) { for (UUID cardId : handCards) {
Card card = hand.get(hand.iterator().next(), game); Card card = handCards.get(cardId, game);
if (card != null) { if (card != null) {
card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game); card.moveToExile(getId(), "Memory Jar", source.getSourceId(), game);
card.setFaceDown(true, game); card.setFaceDown(true, game);

View file

@ -17,6 +17,7 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.Set;
import java.util.UUID; 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)) { 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; Card card;
if (number == 1) { 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 { } else {
TargetCard target = new TargetCard(Zone.LIBRARY, filter); TargetCard target = new TargetCard(Zone.LIBRARY, filter);
controller.choose(outcome, topCards, target, game); controller.choose(outcome, topCards, target, game);

View file

@ -1,22 +1,17 @@
package mage.cards.p; package mage.cards.p;
import java.util.Arrays;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card; import mage.cards.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
@ -26,8 +21,11 @@ import mage.target.common.TargetCardInLibrary;
import mage.util.CardUtil; import mage.util.CardUtil;
import mage.util.RandomUtil; import mage.util.RandomUtil;
import java.util.Arrays;
import java.util.Set;
import java.util.UUID;
/** /**
*
* @author jeffwadsworth * @author jeffwadsworth
*/ */
public final class ParallelThoughts extends CardImpl { public final class ParallelThoughts extends CardImpl {
@ -131,10 +129,11 @@ class ParallelThoughtsReplacementEffect extends ReplacementEffectImpl {
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
&& !game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)).getCards(game).isEmpty()) { 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)) { 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) { if (card != null) {
controller.moveCards(card, Zone.HAND, source, game); controller.moveCards(card, Zone.HAND, source, game);
} }

View file

@ -1,4 +1,3 @@
package mage.cards.p; package mage.cards.p;
import mage.MageObject; import mage.MageObject;
@ -17,10 +16,10 @@ import mage.players.Player;
import mage.target.TargetCard; import mage.target.TargetCard;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import java.util.Set;
import java.util.UUID; import java.util.UUID;
/** /**
*
* @author LevelX2 * @author LevelX2
*/ */
public final class Peregrination extends CardImpl { public final class Peregrination extends CardImpl {
@ -85,10 +84,12 @@ class PeregrinationEffect extends OneShotEffect {
Card card = revealed.get(target2.getFirstTarget(), game); Card card = revealed.get(target2.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
revealed.remove(card); 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); controller.moveCards(card, Zone.HAND, source, game);
} else if (target.getTargets().size() == 1) { } 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); controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
} }

View file

@ -1,7 +1,5 @@
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.UUID;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -13,9 +11,11 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.util.CardUtil; import mage.util.CardUtil;
import java.util.Set;
import java.util.UUID;
/** /**
* @author LevelX2 * @author LevelX2
*
*/ */
public class HideawayPlayEffect extends OneShotEffect { public class HideawayPlayEffect extends OneShotEffect {
@ -41,11 +41,15 @@ public class HideawayPlayEffect extends OneShotEffect {
zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanent.getZoneChangeCounter(game))); zone = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), permanent.getZoneChangeCounter(game)));
} }
if (zone == null if (zone == null) {
|| zone.isEmpty()) {
return true; 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()); Player controller = game.getPlayer(source.getControllerId());
if (card != null && controller != null) { if (card != null && controller != null) {
if (controller.chooseUse(Outcome.PlayForFree, "Do you want to play " + card.getIdName() + " for free now?", source, game)) { if (controller.chooseUse(Outcome.PlayForFree, "Do you want to play " + card.getIdName() + " for free now?", source, game)) {

View file

@ -285,6 +285,9 @@ public final class ZonesHandler {
public static List<Card> chooseOrder(String message, Cards cards, Player player, Game game) { public static List<Card> chooseOrder(String message, Cards cards, Player player, Game game) {
List<Card> order = new ArrayList<>(); List<Card> order = new ArrayList<>();
if (cards.isEmpty()) {
return order;
}
TargetCard target = new TargetCard(Zone.ALL, new FilterCard(message)); TargetCard target = new TargetCard(Zone.ALL, new FilterCard(message));
target.setRequired(true); target.setRequired(true);
while (player.isInGame() && cards.size() > 1) { while (player.isInGame() && cards.size() > 1) {