[ZNR] Implemented Soul Shatter

This commit is contained in:
Evan Kranzler 2020-09-08 16:37:06 -04:00
parent c5d5c54aa4
commit c2a5a6bb9c
2 changed files with 71 additions and 0 deletions

View file

@ -0,0 +1,70 @@
package mage.cards.s;
import mage.MageObject;
import mage.abilities.effects.common.SacrificeOpponentsEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreatureOrPlaneswalkerPermanent;
import mage.filter.predicate.ObjectPlayer;
import mage.filter.predicate.ObjectPlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class SoulShatter extends CardImpl {
private static final FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent(
"creature or planeswalker with the highest converted mana cost " +
"among creatures and planeswalkers they control"
);
static {
filter.add(SoulShatterPredicate.instance);
}
public SoulShatter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
// Each opponent sacrifices a creature or planeswalker with the highest converted mana cost among creatures and planeswalkers they control.
this.getSpellAbility().addEffect(new SacrificeOpponentsEffect(filter));
}
private SoulShatter(final SoulShatter card) {
super(card);
}
@Override
public SoulShatter copy() {
return new SoulShatter(this);
}
}
enum SoulShatterPredicate implements ObjectPlayerPredicate<ObjectPlayer<Permanent>> {
instance;
private static final FilterPermanent filter = new FilterCreatureOrPlaneswalkerPermanent();
static {
filter.add(TargetController.YOU.getControllerPredicate());
}
@Override
public boolean apply(ObjectPlayer<Permanent> input, Game game) {
int cmc = game.getBattlefield()
.getActivePermanents(filter, input.getPlayerId(), game)
.stream()
.filter(Objects::nonNull)
.mapToInt(MageObject::getConvertedManaCost)
.max()
.orElse(0);
return input.getObject().getConvertedManaCost() >= cmc;
}
}

View file

@ -282,6 +282,7 @@ public final class ZendikarRising extends ExpansionSet {
cards.add(new SetCardInfo("Sneaking Guide", 164, Rarity.COMMON, mage.cards.s.SneakingGuide.class));
cards.add(new SetCardInfo("Song-Mad Ruins", 165, Rarity.UNCOMMON, mage.cards.s.SongMadRuins.class));
cards.add(new SetCardInfo("Song-Mad Treachery", 165, Rarity.UNCOMMON, mage.cards.s.SongMadTreachery.class));
cards.add(new SetCardInfo("Soul Shatter", 127, Rarity.RARE, mage.cards.s.SoulShatter.class));
cards.add(new SetCardInfo("Spare Supplies", 254, Rarity.COMMON, mage.cards.s.SpareSupplies.class));
cards.add(new SetCardInfo("Spikefield Cave", 166, Rarity.UNCOMMON, mage.cards.s.SpikefieldCave.class));
cards.add(new SetCardInfo("Spikefield Hazard", 166, Rarity.UNCOMMON, mage.cards.s.SpikefieldHazard.class));