From a9d1a92abc6ed203839a072bc1a5ec43ab842eb5 Mon Sep 17 00:00:00 2001 From: Hidde vb Date: Fri, 3 Jun 2022 21:34:52 +0200 Subject: [PATCH] Fix Tundra Kavu (for #9030) and Death or Glory (#9055) --- Mage.Sets/src/mage/cards/d/DeathOrGlory.java | 11 +++----- Mage.Sets/src/mage/cards/t/TundraKavu.java | 26 +++++++------------ .../BecomesBasicLandTargetEffect.java | 21 ++++++++------- 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/Mage.Sets/src/mage/cards/d/DeathOrGlory.java b/Mage.Sets/src/mage/cards/d/DeathOrGlory.java index ea656f1632c..59e7f718353 100644 --- a/Mage.Sets/src/mage/cards/d/DeathOrGlory.java +++ b/Mage.Sets/src/mage/cards/d/DeathOrGlory.java @@ -61,7 +61,7 @@ class DeathOrGloryEffect extends OneShotEffect { if (controller != null) { Cards cards = new CardsImpl(controller.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game)); if (!cards.isEmpty()) { - TargetCard targetCards = new TargetCard(0, cards.size(), Zone.EXILED, new FilterCard("cards to put in the first pile")); + TargetCard targetCards = new TargetCard(0, cards.size(), Zone.GRAVEYARD, new FilterCard("cards to put in the first pile")); List pile1 = new ArrayList<>(); if (controller.choose(Outcome.Neutral, cards, targetCards, game)) { List targets = targetCards.getTargets(); @@ -73,8 +73,7 @@ class DeathOrGloryEffect extends OneShotEffect { } } } - List pile2 = new ArrayList<>(); - pile2.addAll(cards.getCards(game)); + List pile2 = new ArrayList<>(cards.getCards(game)); StringBuilder sb = new StringBuilder("First pile of ").append(controller.getLogName()).append(": "); sb.append(pile1.stream().map(Card::getLogName).collect(Collectors.joining(", "))); @@ -103,10 +102,8 @@ class DeathOrGloryEffect extends OneShotEffect { pile1Zone = Zone.BATTLEFIELD; pile2Zone = Zone.EXILED; } - Set pile1Set = new HashSet<>(); - Set pile2Set = new HashSet<>(); - pile1Set.addAll(pile1); - pile2Set.addAll(pile2); + Set pile1Set = new HashSet<>(pile1); + Set pile2Set = new HashSet<>(pile2); controller.moveCards(pile1Set, pile1Zone, source, game, false, false, false, null); controller.moveCards(pile2Set, pile2Zone, source, game, false, false, false, null); } diff --git a/Mage.Sets/src/mage/cards/t/TundraKavu.java b/Mage.Sets/src/mage/cards/t/TundraKavu.java index e8cb2e1bc25..a5e7e709a70 100644 --- a/Mage.Sets/src/mage/cards/t/TundraKavu.java +++ b/Mage.Sets/src/mage/cards/t/TundraKavu.java @@ -1,9 +1,8 @@ package mage.cards.t; -import java.util.LinkedHashSet; -import java.util.Set; -import java.util.UUID; +import java.util.*; + import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -66,25 +65,18 @@ class TundraKavuEffect extends BecomesBasicLandTargetEffect { } @Override - public void init(Ability source, Game game) { + protected void chooseLandType(Ability source, Game game) { landTypes.clear(); Player controller = game.getPlayer(source.getControllerId()); - if (controller != null) { - Set choiceSet = new LinkedHashSet<>(); - choiceSet.add("Island"); - choiceSet.add("Plains"); - ChoiceImpl choice = new ChoiceImpl(true, ChoiceHintType.CARD); - choice.setChoices(choiceSet); - choice.setMessage("Choose a basic land type"); - if (!controller.choose(outcome, choice, game)) { - discard(); - return; - } + + ChoiceImpl choice = new ChoiceImpl(true, ChoiceHintType.CARD); + choice.setChoices(new HashSet<>(Arrays.asList("Plains", "Island"))); + choice.setMessage("Choose a basic land type"); + + if (controller != null && controller.choose(outcome, choice, game)) { landTypes.add(SubType.byDescription(choice.getChoice())); } else { this.discard(); } - - super.init(source, game); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java index af33aaa9427..00b59751b20 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesBasicLandTargetEffect.java @@ -79,16 +79,19 @@ public class BecomesBasicLandTargetEffect extends ContinuousEffectImpl { @Override public void init(Ability source, Game game) { super.init(source, game); - // choose land type + if (chooseLandType) { - Player controller = game.getPlayer(source.getControllerId()); - Choice choice = new ChoiceBasicLandType(); - if (controller != null && controller.choose(outcome, choice, game)) { - landTypes.add(SubType.byDescription(choice.getChoice())); - } else { - this.discard(); - return; - } + this.chooseLandType(source, game); + } + } + + protected void chooseLandType(Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + Choice choice = new ChoiceBasicLandType(); + if (controller != null && controller.choose(outcome, choice, game)) { + landTypes.add(SubType.byDescription(choice.getChoice())); + } else { + this.discard(); } }