mirror of
https://github.com/magefree/mage.git
synced 2025-12-26 05:22:02 -08: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
|
|
@ -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…
Add table
Add a link
Reference in a new issue