fix Do or Die (related to #12245)

This commit is contained in:
xenohedron 2024-05-14 22:38:06 -04:00
parent a0c3c7a7de
commit 614be8e928

View file

@ -1,9 +1,5 @@
package mage.cards.d;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
@ -12,12 +8,17 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
*
* @author fireshoes
@ -62,9 +63,12 @@ class DoOrDieEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(source.getFirstTarget());
if (player != null && targetPlayer != null) {
int count = game.getBattlefield().countAll(StaticFilters.FILTER_PERMANENT_CREATURES, targetPlayer.getId(), game);
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, count, new FilterCreaturePermanent("creatures to put in the first pile"), true);
if (player == null || targetPlayer == null) {
return false;
}
FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures to put in the first pile");
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
TargetCreaturePermanent creatures = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
List<Permanent> pile1 = new ArrayList<>();
creatures.setRequired(false);
if (player.choose(Outcome.Neutral, creatures, source, game)) {
@ -93,8 +97,6 @@ class DoOrDieEffect extends OneShotEffect {
return true;
}
return false;
}
private void destroyPermanents(List<Permanent> pile, Game game, Ability source) {
for (Permanent permanent : pile) {