From a0cb316866fba042a17af23228dc89e1803a8f40 Mon Sep 17 00:00:00 2001 From: theelk801 Date: Sun, 23 Apr 2023 14:27:04 -0400 Subject: [PATCH] [BRC] Implement Sanwell, Avenger Ace --- .../src/mage/cards/s/SanwellAvengerAce.java | 110 ++++++++++++++++++ .../mage/sets/TheBrothersWarCommander.java | 1 + 2 files changed, 111 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/s/SanwellAvengerAce.java diff --git a/Mage.Sets/src/mage/cards/s/SanwellAvengerAce.java b/Mage.Sets/src/mage/cards/s/SanwellAvengerAce.java new file mode 100644 index 0000000000..a7831a0bc9 --- /dev/null +++ b/Mage.Sets/src/mage/cards/s/SanwellAvengerAce.java @@ -0,0 +1,110 @@ +package mage.cards.s; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BecomesTappedSourceTriggeredAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalPreventionEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PreventAllDamageToSourceEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterArtifactCard; +import mage.filter.common.FilterArtifactCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.AttackingPredicate; +import mage.game.Game; +import mage.players.Player; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class SanwellAvengerAce extends CardImpl { + + private static final FilterPermanent filter = new FilterArtifactCreaturePermanent(); + + static { + filter.add(AttackingPredicate.instance); + } + + private static final Condition condition = new PermanentsOnTheBattlefieldCondition(filter); + + public SanwellAvengerAce(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.PILOT); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // As long as an artifact creature you control is attacking, prevent all damage that would be dealt to Sanwell, Avenger Ace. + this.addAbility(new SimpleStaticAbility(new ConditionalPreventionEffect( + new PreventAllDamageToSourceEffect(Duration.WhileOnBattlefield), condition, "as long as " + + "an artifact creature you control is attacking, prevent all damage that would be dealt to {this}" + ))); + + // Whenever Sanwell becomes tapped, exile the top six cards of your library. You may cast a Vehicle or artifact creature spell from among them. Then put the rest on the bottom of your library in a random order. + this.addAbility(new BecomesTappedSourceTriggeredAbility(new SanwellAvengerAceEffect())); + } + + private SanwellAvengerAce(final SanwellAvengerAce card) { + super(card); + } + + @Override + public SanwellAvengerAce copy() { + return new SanwellAvengerAce(this); + } +} + +class SanwellAvengerAceEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterArtifactCard(); + + static { + filter.add(Predicates.or( + SubType.VEHICLE.getPredicate(), + CardType.CREATURE.getPredicate() + )); + } + + SanwellAvengerAceEffect() { + super(Outcome.Benefit); + staticText = "exile the top six cards of your library. You may cast a Vehicle or artifact creature spell " + + "from among them. Then put the rest on the bottom of your library in a random order"; + } + + private SanwellAvengerAceEffect(final SanwellAvengerAceEffect effect) { + super(effect); + } + + @Override + public SanwellAvengerAceEffect copy() { + return new SanwellAvengerAceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Cards cards = new CardsImpl(player.getLibrary().getTopCards(game, 6)); + player.moveCards(cards, Zone.EXILED, source, game); + CardUtil.castSpellWithAttributesForFree(player, source, game, cards, filter); + cards.retainZone(Zone.EXILED, game); + player.putCardsOnBottomOfLibrary(cards, game, source, false); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java index 01762a5e57..36bec2271c 100644 --- a/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java +++ b/Mage.Sets/src/mage/sets/TheBrothersWarCommander.java @@ -127,6 +127,7 @@ public final class TheBrothersWarCommander extends ExpansionSet { cards.add(new SetCardInfo("Reliquary Tower", 196, Rarity.UNCOMMON, mage.cards.r.ReliquaryTower.class)); cards.add(new SetCardInfo("River of Tears", 197, Rarity.RARE, mage.cards.r.RiverOfTears.class)); cards.add(new SetCardInfo("Sai, Master Thopterist", 93, Rarity.RARE, mage.cards.s.SaiMasterThopterist.class)); + cards.add(new SetCardInfo("Sanwell, Avenger Ace", 5, Rarity.RARE, mage.cards.s.SanwellAvengerAce.class)); cards.add(new SetCardInfo("Sardian Avenger", 23, Rarity.RARE, mage.cards.s.SardianAvenger.class)); cards.add(new SetCardInfo("Scavenged Brawler", 17, Rarity.RARE, mage.cards.s.ScavengedBrawler.class)); cards.add(new SetCardInfo("Scholar of New Horizons", 6, Rarity.RARE, mage.cards.s.ScholarOfNewHorizons.class));