Implemented Shatter Assumptions

This commit is contained in:
Evan Kranzler 2019-06-01 10:53:48 -04:00
parent 6400d948bb
commit cc6d7936e9
2 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package mage.cards.s;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterCard;
import mage.filter.common.FilterNonlandCard;
import mage.filter.predicate.mageobject.ColorlessPredicate;
import mage.filter.predicate.mageobject.MulticoloredPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class ShatterAssumptions extends CardImpl {
public ShatterAssumptions(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{B}{B}");
// Choose one
// Target opponent reveals their hand and discards all colorless nonland cards.
this.getSpellAbility().addEffect(new ShatterAssumptionsEffect(true));
this.getSpellAbility().addTarget(new TargetOpponent());
// Target opponent reveals their hand and discards all multicolored cards.
Mode mode = new Mode(new ShatterAssumptionsEffect(false));
mode.addTarget(new TargetOpponent());
this.getSpellAbility().addMode(mode);
}
private ShatterAssumptions(final ShatterAssumptions card) {
super(card);
}
@Override
public ShatterAssumptions copy() {
return new ShatterAssumptions(this);
}
}
class ShatterAssumptionsEffect extends OneShotEffect {
private static final FilterCard filter = new FilterNonlandCard("colorless nonland");
private static final FilterCard filter2 = new FilterCard("multicolored");
static {
filter.add(ColorlessPredicate.instance);
filter2.add(MulticoloredPredicate.instance);
}
private final boolean colorless;
ShatterAssumptionsEffect(boolean colorless) {
super(Outcome.Benefit);
this.colorless = colorless;
if (colorless) {
staticText = "Target opponent reveals their hand and discards all colorless nonland cards.";
} else {
staticText = "Target opponent reveals their hand and discards all multicolored cards.";
}
}
private ShatterAssumptionsEffect(final ShatterAssumptionsEffect effect) {
super(effect);
this.colorless = effect.colorless;
}
@Override
public ShatterAssumptionsEffect copy() {
return new ShatterAssumptionsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(player.getHand());
player.revealCards(source, cards, game);
FilterCard f;
if (colorless) {
f = filter;
} else {
f = filter2;
}
for (Card card : cards.getCards(f, source.getSourceId(), source.getControllerId(), game)) {
player.discard(card, source, game);
}
return true;
}
}

View file

@ -189,6 +189,7 @@ public final class ModernHorizons extends ExpansionSet {
cards.add(new SetCardInfo("Secluded Steppe", 245, Rarity.UNCOMMON, mage.cards.s.SecludedSteppe.class)); cards.add(new SetCardInfo("Secluded Steppe", 245, Rarity.UNCOMMON, mage.cards.s.SecludedSteppe.class));
cards.add(new SetCardInfo("Segovian Angel", 25, Rarity.COMMON, mage.cards.s.SegovianAngel.class)); cards.add(new SetCardInfo("Segovian Angel", 25, Rarity.COMMON, mage.cards.s.SegovianAngel.class));
cards.add(new SetCardInfo("Serra the Benevolent", 26, Rarity.MYTHIC, mage.cards.s.SerraTheBenevolent.class)); cards.add(new SetCardInfo("Serra the Benevolent", 26, Rarity.MYTHIC, mage.cards.s.SerraTheBenevolent.class));
cards.add(new SetCardInfo("Shatter Assumptions", 106, Rarity.UNCOMMON, mage.cards.s.ShatterAssumptions.class));
cards.add(new SetCardInfo("Shelter", 28, Rarity.COMMON, mage.cards.s.Shelter.class)); cards.add(new SetCardInfo("Shelter", 28, Rarity.COMMON, mage.cards.s.Shelter.class));
cards.add(new SetCardInfo("Shenanigans", 146, Rarity.COMMON, mage.cards.s.Shenanigans.class)); cards.add(new SetCardInfo("Shenanigans", 146, Rarity.COMMON, mage.cards.s.Shenanigans.class));
cards.add(new SetCardInfo("Silent Clearing", 246, Rarity.RARE, mage.cards.s.SilentClearing.class)); cards.add(new SetCardInfo("Silent Clearing", 246, Rarity.RARE, mage.cards.s.SilentClearing.class));