[MAT] Implement Blot Out

This commit is contained in:
theelk801 2023-05-08 08:50:14 -04:00
parent 6f9358c095
commit 7209e037e5
2 changed files with 107 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.b;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledCreatureOrPlaneswalkerPermanent;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BlotOut extends CardImpl {
public BlotOut(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
// Target opponent exiles a creature or planeswalker they control with the greatest mana value among creatures and planeswalkers they control.
this.getSpellAbility().addEffect(new BlotOutEffect());
this.getSpellAbility().addTarget(new TargetOpponent());
}
private BlotOut(final BlotOut card) {
super(card);
}
@Override
public BlotOut copy() {
return new BlotOut(this);
}
}
class BlotOutEffect extends OneShotEffect {
private enum BlotOutPredicate implements ObjectSourcePlayerPredicate<Permanent> {
instance;
@Override
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
return input
.getObject()
.getManaValue()
>= game
.getBattlefield()
.getActivePermanents(
StaticFilters.FILTER_CONTROLLED_PERMANENT_CREATURE_OR_PLANESWALKER,
input.getPlayerId(), input.getSource(), game
)
.stream()
.mapToInt(MageObject::getManaValue)
.max()
.orElse(0);
}
}
private static final FilterPermanent filter = new FilterControlledCreatureOrPlaneswalkerPermanent(
"creature or planeswalker you control with the greatest mana value"
);
static {
filter.add(BlotOutPredicate.instance);
}
BlotOutEffect() {
super(Outcome.Benefit);
staticText = "target opponent exiles a creature or planeswalker they control with " +
"the greatest mana value among creatures and planeswalkers they control";
}
private BlotOutEffect(final BlotOutEffect effect) {
super(effect);
}
@Override
public BlotOutEffect copy() {
return new BlotOutEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source));
if (opponent == null || game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_PERMANENT_CREATURE_OR_PLANESWALKER, opponent.getId(), source, game
) < 1) {
return false;
}
TargetPermanent target = new TargetPermanent(filter);
target.setNotTarget(true);
opponent.choose(outcome, target, source, game);
return opponent.moveCards(game.getCard(target.getFirstTarget()), Zone.EXILED, source, game);
}
}

View file

@ -23,6 +23,7 @@ public final class MarchOfTheMachineTheAftermath extends ExpansionSet {
cards.add(new SetCardInfo("Arni Metalbrow", 16, Rarity.RARE, mage.cards.a.ArniMetalbrow.class));
cards.add(new SetCardInfo("Ayara's Oathsworn", 11, Rarity.RARE, mage.cards.a.AyarasOathsworn.class));
cards.add(new SetCardInfo("Blot Out", 12, Rarity.UNCOMMON, mage.cards.b.BlotOut.class));
cards.add(new SetCardInfo("Calix, Guided by Fate", 26, Rarity.MYTHIC, mage.cards.c.CalixGuidedByFate.class));
cards.add(new SetCardInfo("Campus Renovation", 27, Rarity.UNCOMMON, mage.cards.c.CampusRenovation.class));
cards.add(new SetCardInfo("Coppercoat Vanguard", 1, Rarity.UNCOMMON, mage.cards.c.CoppercoatVanguard.class));