From 32f48e4d2926aecfa40ec0d29e93f525a5ffb95d Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 4 Jun 2022 15:10:23 -0400 Subject: [PATCH] [CLB] Implemented Abdel Adrian, Gorion's Ward --- .../mage/cards/a/AbdelAdrianGorionsWard.java | 105 ++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 106 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AbdelAdrianGorionsWard.java diff --git a/Mage.Sets/src/mage/cards/a/AbdelAdrianGorionsWard.java b/Mage.Sets/src/mage/cards/a/AbdelAdrianGorionsWard.java new file mode 100644 index 00000000000..351904f3bc3 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AbdelAdrianGorionsWard.java @@ -0,0 +1,105 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.ChooseABackgroundAbility; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.common.delayed.OnLeaveReturnExiledToBattlefieldAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.*; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterNonlandPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SoldierToken; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.util.CardUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AbdelAdrianGorionsWard extends CardImpl { + + public AbdelAdrianGorionsWard(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.WARRIOR); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // When Abdel Adrian, Gorion's Ward enters the battlefield, exile any number of other nonland permanents you control until Abdel Adrian leaves the battlefield. Create a 1/1 white Soldier creature token for each permanent exiled this way. + this.addAbility(new EntersBattlefieldTriggeredAbility(new AbdelAdrianGorionsWardEffect())); + + // Choose a Background + this.addAbility(ChooseABackgroundAbility.getInstance()); + } + + private AbdelAdrianGorionsWard(final AbdelAdrianGorionsWard card) { + super(card); + } + + @Override + public AbdelAdrianGorionsWard copy() { + return new AbdelAdrianGorionsWard(this); + } +} + +class AbdelAdrianGorionsWardEffect extends OneShotEffect { + + private static final FilterPermanent filter + = new FilterNonlandPermanent("other nonland permanents you control"); + + static { + filter.add(AnotherPredicate.instance); + filter.add(TargetController.YOU.getOwnerPredicate()); + } + + AbdelAdrianGorionsWardEffect() { + super(Outcome.Benefit); + staticText = "exile any number of other nonland permanents you control until {this} leaves the battlefield. " + + "Create a 1/1 white Soldier creature token for each permanent exiled this way"; + } + + private AbdelAdrianGorionsWardEffect(final AbdelAdrianGorionsWardEffect effect) { + super(effect); + } + + @Override + public AbdelAdrianGorionsWardEffect copy() { + return new AbdelAdrianGorionsWardEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + Permanent permanent = source.getSourcePermanentIfItStillExists(game); + if (player == null || permanent == null) { + return false; + } + TargetPermanent target = new TargetPermanent(0, Integer.MAX_VALUE, filter, true); + player.choose(outcome, target, source, game); + Cards cards = new CardsImpl(target.getTargets()); + player.moveCardsToExile( + cards.getCards(game), source, game, true, + CardUtil.getExileZoneId(game, source), + CardUtil.getSourceName(game, source) + ); + cards.retainZone(Zone.EXILED, game); + int count = cards.size(); + if (count > 0) { + new SoldierToken().putOntoBattlefield(count, game, source); + } + game.addDelayedTriggeredAbility(new OnLeaveReturnExiledToBattlefieldAbility(), source); + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index bb7516fc4f5..8b51b16c0d7 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -22,6 +22,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { this.hasBoosters = false; // temporary cards.add(new SetCardInfo("Aarakocra Sneak", 54, Rarity.COMMON, mage.cards.a.AarakocraSneak.class)); + cards.add(new SetCardInfo("Abdel Adrian, Gorion's Ward", 2, Rarity.UNCOMMON, mage.cards.a.AbdelAdrianGorionsWard.class)); cards.add(new SetCardInfo("Acolyte of Bahamut", 212, Rarity.UNCOMMON, mage.cards.a.AcolyteOfBahamut.class)); cards.add(new SetCardInfo("Aether Gale", 712, Rarity.RARE, mage.cards.a.AetherGale.class)); cards.add(new SetCardInfo("Agent of the Iron Throne", 107, Rarity.UNCOMMON, mage.cards.a.AgentOfTheIronThrone.class));