From 2fcdd29be72bf7da1401b5b44e86416762c17e6d Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 29 Aug 2023 09:52:58 -0400 Subject: [PATCH] [SLD] Implement Arden Angel --- Mage.Sets/src/mage/cards/a/ArdenAngel.java | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/ArdenAngel.java diff --git a/Mage.Sets/src/mage/cards/a/ArdenAngel.java b/Mage.Sets/src/mage/cards/a/ArdenAngel.java new file mode 100644 index 00000000000..44cb6196e67 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/ArdenAngel.java @@ -0,0 +1,85 @@ +package mage.cards.a; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.*; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ArdenAngel extends CardImpl { + + public ArdenAngel(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{W}"); + + this.subtype.add(SubType.ANGEL); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + + // At the beginning of your upkeep, if Arden Angel is in your graveyard, roll a four-sided die. If the result is 1, return Arden Angel from your graveyard to the battlefield. + this.addAbility(new ConditionalInterveningIfTriggeredAbility( + new BeginningOfUpkeepTriggeredAbility(new ArdenAngelEffect(), TargetController.YOU, false), + ArdenAngelCondition.instance, "At the beginning of your upkeep, if {this} is in your graveyard, " + + "roll a four-sided die. If the result is 1, return {this} from your graveyard to the battlefield." + )); + } + + private ArdenAngel(final ArdenAngel card) { + super(card); + } + + @Override + public ArdenAngel copy() { + return new ArdenAngel(this); + } +} + +enum ArdenAngelCondition implements Condition { + instance; + + @Override + public boolean apply(Game game, Ability source) { + return game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD; + } +} + +class ArdenAngelEffect extends OneShotEffect { + + ArdenAngelEffect() { + super(Outcome.Benefit); + } + + private ArdenAngelEffect(final ArdenAngelEffect effect) { + super(effect); + } + + @Override + public ArdenAngelEffect copy() { + return new ArdenAngelEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null || player.rollDice(outcome, source, game, 4) != 1) { + return false; + } + Card card = game.getCard(source.getSourceId()); + return card != null && player.moveCards(card, Zone.BATTLEFIELD, source, game); + } +}