This commit is contained in:
Jeff Wadsworth 2024-06-15 21:59:35 -05:00
parent b335947afd
commit e0a16bd3e2

View file

@ -6,7 +6,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect; import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.effects.common.MillCardsControllerEffect; import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldWithCounterTargetEffect;
import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect; import mage.abilities.effects.common.continuous.AddCardTypeTargetEffect;
import mage.cards.*; import mage.cards.*;
import mage.constants.*; import mage.constants.*;
@ -18,12 +17,10 @@ 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.common.TargetCardInYourGraveyard; import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTargets;
import java.util.List; import java.util.List;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors; import mage.target.targetpointer.FixedTarget;
/** /**
* @author TheElk801 * @author TheElk801
@ -72,9 +69,9 @@ class TheWarInHeavenEffect extends OneShotEffect {
TheWarInHeavenEffect() { TheWarInHeavenEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "choose up to three target creature cards with total mana value 8 or less in your graveyard. " + staticText = "choose up to three target creature cards with total mana value 8 or less in your graveyard. "
"Return each of them to the battlefield with a necrodermis counter on it. " + + "Return each of them to the battlefield with a necrodermis counter on it. "
"They're artifacts in addition to their other types"; + "They\'re artifacts in addition to their other types";
} }
private TheWarInHeavenEffect(final TheWarInHeavenEffect effect) { private TheWarInHeavenEffect(final TheWarInHeavenEffect effect) {
@ -92,19 +89,18 @@ class TheWarInHeavenEffect extends OneShotEffect {
if (player == null) { if (player == null) {
return false; return false;
} }
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source)); List<UUID> targetIds = this.getTargetPointer().getTargets(game, source);
new ReturnFromGraveyardToBattlefieldWithCounterTargetEffect( for (UUID targetId : targetIds) {
CounterType.NECRODERMIS.createInstance() Card card = game.getCard(targetId);
).apply(game, source); if (card != null) {
List<Permanent> permanents = cards card.moveToZone(Zone.BATTLEFIELD, source, game, false);
.stream() Permanent permanent = game.getPermanent(card.getId());
.map(game::getPermanent) if (permanent != null) {
.filter(Objects::nonNull) permanent.addCounters(CounterType.NECRODERMIS.createInstance(), source, game);
.collect(Collectors.toList()); game.addEffect(new AddCardTypeTargetEffect(Duration.Custom, CardType.ARTIFACT)
if (!permanents.isEmpty()) { .setTargetPointer(new FixedTarget(permanent, game)), source);
game.addEffect(new AddCardTypeTargetEffect( }
Duration.Custom, CardType.ARTIFACT }
).setTargetPointer(new FixedTargets(permanents, game)), source);
} }
return true; return true;
} }
@ -138,8 +134,8 @@ class TheWarInHeavenTarget extends TargetCardInYourGraveyard {
return false; return false;
} }
Card card = game.getCard(id); Card card = game.getCard(id);
return card != null && return card != null
this.getTargets() && this.getTargets()
.stream() .stream()
.map(game::getCard) .map(game::getCard)
.mapToInt(Card::getManaValue) .mapToInt(Card::getManaValue)