mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Pemmin's Aura - Fixed exception error after enchanted creature was dies;
This commit is contained in:
parent
8d4f44bee6
commit
44ed8cebb7
1 changed files with 24 additions and 22 deletions
|
@ -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,21 +89,28 @@ 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());
|
||||||
Permanent creature = game.getPermanent(enchantment.getAttachedTo());
|
if (controller == null || enchantment == null) {
|
||||||
if (controller != null && 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue