From 3e365dbb4e6c79d9030a8bdf9d7dda9ff31c4a98 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Wed, 18 May 2022 22:07:33 -0400 Subject: [PATCH] [CLB] Implemented Viconia, Drow Apostate --- .../src/mage/cards/v/ViconiaDrowApostate.java | 94 +++++++++++++++++++ .../CommanderLegendsBattleForBaldursGate.java | 1 + 2 files changed, 95 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/v/ViconiaDrowApostate.java diff --git a/Mage.Sets/src/mage/cards/v/ViconiaDrowApostate.java b/Mage.Sets/src/mage/cards/v/ViconiaDrowApostate.java new file mode 100644 index 0000000000..5feea7acff --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/ViconiaDrowApostate.java @@ -0,0 +1,94 @@ +package mage.cards.v; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.common.ChooseABackgroundAbility; +import mage.abilities.condition.Condition; +import mage.abilities.condition.common.CardsInControllerGraveyardCondition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.dynamicvalue.common.CardsInControllerGraveyardCount; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.util.RandomUtil; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ViconiaDrowApostate extends CardImpl { + + private static final Condition condition + = new CardsInControllerGraveyardCondition(4, StaticFilters.FILTER_CARD_CREATURE); + private static final Hint hint = new ValueHint( + "Creature cards in your graveyard", + new CardsInControllerGraveyardCount(StaticFilters.FILTER_CARD_CREATURE) + ); + + public ViconiaDrowApostate(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}"); + + this.addSuperType(SuperType.LEGENDARY); + this.subtype.add(SubType.ELF); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // At the beginning of your upkeep, if there are four or more creature cards in your graveyard, return a creature card at random from your graveyard to your hand. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfUpkeepTriggeredAbility( + new ViconiaDrowApostateEffect(), TargetController.YOU, false + ), condition, "At the beginning of your upkeep, if there are four or more creature cards " + + "in your graveyard, return a creature card at random from your graveyard to your hand." + ).addHint(hint)); + + // Choose a Background + this.addAbility(ChooseABackgroundAbility.getInstance()); + } + + private ViconiaDrowApostate(final ViconiaDrowApostate card) { + super(card); + } + + @Override + public ViconiaDrowApostate copy() { + return new ViconiaDrowApostate(this); + } +} + +class ViconiaDrowApostateEffect extends OneShotEffect { + + ViconiaDrowApostateEffect() { + super(Outcome.Benefit); + } + + private ViconiaDrowApostateEffect(final ViconiaDrowApostateEffect effect) { + super(effect); + } + + @Override + public ViconiaDrowApostateEffect copy() { + return new ViconiaDrowApostateEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Card card = RandomUtil.randomFromCollection( + player.getGraveyard().getCards(StaticFilters.FILTER_CARD_CREATURE, game) + ); + return card != null && player.moveCards(card, Zone.HAND, source, game); + } +} diff --git a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java index d792d33b10..b6f3e73ea3 100644 --- a/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java +++ b/Mage.Sets/src/mage/sets/CommanderLegendsBattleForBaldursGate.java @@ -77,6 +77,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet { cards.add(new SetCardInfo("Swamp", 459, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swiftfoot Boots", 339, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class)); cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class)); + cards.add(new SetCardInfo("Viconia, Drow Apostate", 156, Rarity.UNCOMMON, mage.cards.v.ViconiaDrowApostate.class)); cards.add(new SetCardInfo("Wand of Wonder", 204, Rarity.RARE, mage.cards.w.WandOfWonder.class)); cards.add(new SetCardInfo("Wayfarer's Bauble", 344, Rarity.COMMON, mage.cards.w.WayfarersBauble.class)); cards.add(new SetCardInfo("White Plume Adventurer", 49, Rarity.RARE, mage.cards.w.WhitePlumeAdventurer.class));