From 44ed8cebb7364e13b10fdcb062622936657e8a03 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Wed, 14 Nov 2018 02:10:40 +0400 Subject: [PATCH] * Pemmin's Aura - Fixed exception error after enchanted creature was dies; --- Mage.Sets/src/mage/cards/p/PemminsAura.java | 46 +++++++++++---------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/Mage.Sets/src/mage/cards/p/PemminsAura.java b/Mage.Sets/src/mage/cards/p/PemminsAura.java index 89139bc99d..4cd260a1ac 100644 --- a/Mage.Sets/src/mage/cards/p/PemminsAura.java +++ b/Mage.Sets/src/mage/cards/p/PemminsAura.java @@ -1,7 +1,6 @@ package mage.cards.p; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.mana.ManaCostsImpl; @@ -17,20 +16,16 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.choices.Choice; import mage.choices.ChoiceImpl; -import mage.constants.AttachmentType; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.SubType; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.TargetPermanent; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author fireshoes */ public final class PemminsAura extends CardImpl { @@ -94,21 +89,28 @@ class PemminsAuraBoostEnchantedEffect extends OneShotEffect { public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent enchantment = game.getPermanent(source.getSourceId()); - Permanent creature = game.getPermanent(enchantment.getAttachedTo()); - if (controller != null && creature != null) { - Choice choice = new ChoiceImpl(true); - choice.setMessage("Select how to boost"); - choice.getChoices().add(CHOICE_1); - choice.getChoices().add(CHOICE_2); - if (controller.choose(outcome, choice, game)) { - if (choice.getChoice().equals(CHOICE_1)) { - game.addEffect(new BoostEnchantedEffect(+1, -1, Duration.EndOfTurn), source); - } else { - game.addEffect(new BoostEnchantedEffect(-1, +1, Duration.EndOfTurn), source); - } - return true; - } + if (controller == null || enchantment == null) { + return false; } + + Permanent creature = game.getPermanent(enchantment.getAttachedTo()); + if (creature == null) { + return false; + } + + Choice choice = new ChoiceImpl(true); + choice.setMessage("Select how to boost"); + choice.getChoices().add(CHOICE_1); + choice.getChoices().add(CHOICE_2); + if (controller.choose(outcome, choice, game)) { + if (choice.getChoice().equals(CHOICE_1)) { + game.addEffect(new BoostEnchantedEffect(+1, -1, Duration.EndOfTurn), source); + } else { + game.addEffect(new BoostEnchantedEffect(-1, +1, Duration.EndOfTurn), source); + } + return true; + } + return false; } }