From b2e929e03af84ceb162759d306e6e5a4249ca7c9 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Sat, 11 Jan 2020 12:00:18 -0500 Subject: [PATCH] Implemented Acolyte of Affliction --- .../src/mage/cards/a/AcolyteOfAffliction.java | 87 +++++++++++++++++++ .../src/mage/sets/TherosBeyondDeath.java | 1 + 2 files changed, 88 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AcolyteOfAffliction.java diff --git a/Mage.Sets/src/mage/cards/a/AcolyteOfAffliction.java b/Mage.Sets/src/mage/cards/a/AcolyteOfAffliction.java new file mode 100644 index 0000000000..3a158f7778 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AcolyteOfAffliction.java @@ -0,0 +1,87 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.common.FilterPermanentCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class AcolyteOfAffliction extends CardImpl { + + public AcolyteOfAffliction(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{G}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.CLERIC); + this.power = new MageInt(2); + this.toughness = new MageInt(3); + + // When Acolyte of Affliction enters the battlefield, put the top two cards of your library into your graveyard, then you may return a permanent card from your graveyard to your hand. + this.addAbility(new EntersBattlefieldTriggeredAbility(new AcolyteOfAfflictionEffect())); + } + + private AcolyteOfAffliction(final AcolyteOfAffliction card) { + super(card); + } + + @Override + public AcolyteOfAffliction copy() { + return new AcolyteOfAffliction(this); + } +} + +class AcolyteOfAfflictionEffect extends OneShotEffect { + + private static final FilterCard filter = new FilterPermanentCard("permanent card from your graveyard"); + + AcolyteOfAfflictionEffect() { + super(Outcome.Benefit); + staticText = "put the top two cards of your library into your graveyard, " + + "then you may return a permanent card from your graveyard to your hand."; + } + + private AcolyteOfAfflictionEffect(final AcolyteOfAfflictionEffect effect) { + super(effect); + } + + @Override + public AcolyteOfAfflictionEffect copy() { + return new AcolyteOfAfflictionEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + player.moveCards(player.getLibrary().getTopCards(game, 2), Zone.GRAVEYARD, source, game); + TargetCard target = new TargetCardInYourGraveyard(0, 1, filter, true); + if (!player.choose(Outcome.ReturnToHand, target, source.getSourceId(), game)) { + return true; + } + Card card = game.getCard(target.getFirstTarget()); + if (card == null) { + return true; + } + player.moveCards(card, Zone.HAND, source, game); + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 3c71e606e9..4fe04061b6 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -26,6 +26,7 @@ public final class TherosBeyondDeath extends ExpansionSet { this.ratioBoosterMythic = 8; this.maxCardNumberInBooster = 254; + cards.add(new SetCardInfo("Acolyte of Affliction", 206, Rarity.UNCOMMON, mage.cards.a.AcolyteOfAffliction.class)); cards.add(new SetCardInfo("Allure of the Unknown", 207, Rarity.RARE, mage.cards.a.AllureOfTheUnknown.class)); cards.add(new SetCardInfo("Alseid of Life's Bounty", 1, Rarity.UNCOMMON, mage.cards.a.AlseidOfLifesBounty.class)); cards.add(new SetCardInfo("Altar of the Pantheon", 231, Rarity.COMMON, mage.cards.a.AltarOfThePantheon.class));