* Pemmin's Aura - Fixed exception error after enchanted creature was dies;

This commit is contained in:
Oleg Agafonov 2018-11-14 02:10:40 +04:00
parent 8d4f44bee6
commit 44ed8cebb7

View file

@ -1,7 +1,6 @@
package mage.cards.p; package mage.cards.p;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl; import mage.abilities.costs.mana.ManaCostsImpl;
@ -17,20 +16,16 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.choices.Choice; import mage.choices.Choice;
import mage.choices.ChoiceImpl; import mage.choices.ChoiceImpl;
import mage.constants.AttachmentType; import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.TargetPermanent; import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
*
* @author fireshoes * @author fireshoes
*/ */
public final class PemminsAura extends CardImpl { public final class PemminsAura extends CardImpl {
@ -94,8 +89,15 @@ class PemminsAuraBoostEnchantedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent enchantment = game.getPermanent(source.getSourceId()); Permanent enchantment = game.getPermanent(source.getSourceId());
if (controller == null || enchantment == null) {
return false;
}
Permanent creature = game.getPermanent(enchantment.getAttachedTo()); Permanent creature = game.getPermanent(enchantment.getAttachedTo());
if (controller != null && creature != null) { if (creature == null) {
return false;
}
Choice choice = new ChoiceImpl(true); Choice choice = new ChoiceImpl(true);
choice.setMessage("Select how to boost"); choice.setMessage("Select how to boost");
choice.getChoices().add(CHOICE_1); choice.getChoices().add(CHOICE_1);
@ -108,7 +110,7 @@ class PemminsAuraBoostEnchantedEffect extends OneShotEffect {
} }
return true; return true;
} }
}
return false; return false;
} }
} }