From bdebcbaf630ca73bb2d7d2ae29ee14fc25aafb30 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 18 Jun 2016 10:47:40 +0200 Subject: [PATCH] * Angelic Skirmisher - Fixed that the ability choice caused error. --- .../src/mage/sets/apocalypse/TundraKavu.java | 10 ++-- .../sets/gatecrash/AngelicSkirmisher.java | 51 ++++++++++--------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Mage.Sets/src/mage/sets/apocalypse/TundraKavu.java b/Mage.Sets/src/mage/sets/apocalypse/TundraKavu.java index e1f72960bf..ad473af813 100644 --- a/Mage.Sets/src/mage/sets/apocalypse/TundraKavu.java +++ b/Mage.Sets/src/mage/sets/apocalypse/TundraKavu.java @@ -74,7 +74,6 @@ public class TundraKavu extends CardImpl { } } - class TundraKavuEffect extends BecomesBasicLandTargetEffect { public TundraKavuEffect() { @@ -86,6 +85,7 @@ class TundraKavuEffect extends BecomesBasicLandTargetEffect { super(effect); } + @Override public TundraKavuEffect copy() { return new TundraKavuEffect(this); } @@ -94,14 +94,18 @@ class TundraKavuEffect extends BecomesBasicLandTargetEffect { public void init(Ability source, Game game) { landTypes.clear(); Player controller = game.getPlayer(source.getControllerId()); - if(controller != null) { + if (controller != null) { Set choiceSet = new LinkedHashSet<>(); choiceSet.add("Island"); choiceSet.add("Plains"); ChoiceImpl choice = new ChoiceImpl(true); choice.setChoices(choiceSet); choice.setMessage("Choose a basic land type"); - controller.choose(outcome, choice, game); + while (!controller.choose(outcome, choice, game)) { + if (!controller.canRespond()) { + return; + } + } landTypes.add(choice.getChoice()); } else { this.discard(); diff --git a/Mage.Sets/src/mage/sets/gatecrash/AngelicSkirmisher.java b/Mage.Sets/src/mage/sets/gatecrash/AngelicSkirmisher.java index a79dba3117..b9d81802e9 100644 --- a/Mage.Sets/src/mage/sets/gatecrash/AngelicSkirmisher.java +++ b/Mage.Sets/src/mage/sets/gatecrash/AngelicSkirmisher.java @@ -85,6 +85,7 @@ public class AngelicSkirmisher extends CardImpl { } class AngelicSkirmisherEffect extends OneShotEffect { + AngelicSkirmisherEffect() { super(Outcome.AddAbility); staticText = "choose first strike, vigilance or lifelink. Creatures you control gain that ability until end of turn"; @@ -96,7 +97,6 @@ class AngelicSkirmisherEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanent(source.getSourceId()); if (controller != null && sourcePermanent != null) { @@ -107,29 +107,32 @@ class AngelicSkirmisherEffect extends OneShotEffect { abilityChoices.add("Vigilance"); abilityChoices.add("Lifelink"); abilityChoice.setChoices(abilityChoices); - Ability ability = null; - switch (abilityChoice.getChoice()) { - case "First strike": - ability = FirstStrikeAbility.getInstance(); - break; - case "Vigilance": - ability = VigilanceAbility.getInstance(); - break; - case "Lifelink": - ability = LifelinkAbility.getInstance(); - break; - default: - break; + while (!controller.choose(outcome, abilityChoice, game)) { + if (!controller.canRespond()) { + return false; + } } - if (ability != null) { - GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent()); - game.addEffect(effect, source); - game.informPlayers(new StringBuilder(sourcePermanent.getName()) - .append(": ") - .append(controller.getLogName()) - .append(" has chosen ") - .append(abilityChoice.getChoice().toLowerCase()).toString()); - return true; + Ability ability = null; + if (abilityChoice.getChoice() != null) { + switch (abilityChoice.getChoice()) { + case "First strike": + ability = FirstStrikeAbility.getInstance(); + break; + case "Vigilance": + ability = VigilanceAbility.getInstance(); + break; + case "Lifelink": + ability = LifelinkAbility.getInstance(); + break; + default: + break; + } + if (ability != null) { + GainAbilityControlledEffect effect = new GainAbilityControlledEffect(ability, Duration.EndOfTurn, new FilterControlledCreaturePermanent()); + game.addEffect(effect, source); + game.informPlayers(sourcePermanent.getName() + ": " + controller.getLogName() + " has chosen " + abilityChoice.getChoice().toLowerCase()); + return true; + } } } return false; @@ -139,4 +142,4 @@ class AngelicSkirmisherEffect extends OneShotEffect { public AngelicSkirmisherEffect copy() { return new AngelicSkirmisherEffect(this); } -} \ No newline at end of file +}