Fix Tundra Kavu (for #9030) and Death or Glory (#9055)

This commit is contained in:
Hidde vb 2022-06-03 21:34:52 +02:00 committed by GitHub
parent abed4219e0
commit a9d1a92abc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 33 deletions

View file

@ -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<Card> pile1 = new ArrayList<>();
if (controller.choose(Outcome.Neutral, cards, targetCards, game)) {
List<UUID> targets = targetCards.getTargets();
@ -73,8 +73,7 @@ class DeathOrGloryEffect extends OneShotEffect {
}
}
}
List<Card> pile2 = new ArrayList<>();
pile2.addAll(cards.getCards(game));
List<Card> 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<Card> pile1Set = new HashSet<>();
Set<Card> pile2Set = new HashSet<>();
pile1Set.addAll(pile1);
pile2Set.addAll(pile2);
Set<Card> pile1Set = new HashSet<>(pile1);
Set<Card> pile2Set = new HashSet<>(pile2);
controller.moveCards(pile1Set, pile1Zone, source, game, false, false, false, null);
controller.moveCards(pile2Set, pile2Zone, source, game, false, false, false, null);
}

View file

@ -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<String> 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);
}
}

View file

@ -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();
}
}