From bcd0558cc160e80fd215efbeefaeb7a860583e69 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Sat, 4 Nov 2023 18:58:39 +0100 Subject: [PATCH] [LCI] Implement Another Chance --- Mage.Sets/src/mage/cards/a/AnotherChance.java | 82 +++++++++++++++++++ .../src/mage/sets/TheLostCavernsOfIxalan.java | 1 + 2 files changed, 83 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/a/AnotherChance.java diff --git a/Mage.Sets/src/mage/cards/a/AnotherChance.java b/Mage.Sets/src/mage/cards/a/AnotherChance.java new file mode 100644 index 00000000000..6cf61cd76d8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/a/AnotherChance.java @@ -0,0 +1,82 @@ +package mage.cards.a; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class AnotherChance extends CardImpl { + + public AnotherChance(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}"); + + // You may mill two cards. Then return up to two creature cards from your graveyard to your hand. + this.getSpellAbility().addEffect(new AnotherChanceEffect()); + } + + private AnotherChance(final AnotherChance card) { + super(card); + } + + @Override + public AnotherChance copy() { + return new AnotherChance(this); + } +} + +/** + * Inspired by {@link mage.cards.u.UnsealTheNecropolis} + */ +class AnotherChanceEffect extends OneShotEffect { + + AnotherChanceEffect() { + super(Outcome.Benefit); + staticText = "You may mill two cards. Then you return up to two creature cards from your graveyard to your hand"; + } + + private AnotherChanceEffect(final AnotherChanceEffect effect) { + super(effect); + } + + @Override + public AnotherChanceEffect copy() { + return new AnotherChanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + + if (player.chooseUse(outcome, "Mill two cards?", source, game)) { + player.millCards(2, source, game); + } + + TargetCard target = new TargetCardInYourGraveyard( + 0, 2, StaticFilters.FILTER_CARD_CREATURES_YOUR_GRAVEYARD, true + ); + player.choose(outcome, target, source, game); + Cards cards = new CardsImpl(target.getTargets()); + if (!cards.isEmpty()) { + player.moveCards(cards, Zone.HAND, source, game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java index 2d83221eade..9e615a97284 100644 --- a/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java +++ b/Mage.Sets/src/mage/sets/TheLostCavernsOfIxalan.java @@ -33,6 +33,7 @@ public final class TheLostCavernsOfIxalan extends ExpansionSet { cards.add(new SetCardInfo("Ancestors' Aid", 132, Rarity.COMMON, mage.cards.a.AncestorsAid.class)); cards.add(new SetCardInfo("Ancestral Reminiscence", 45, Rarity.COMMON, mage.cards.a.AncestralReminiscence.class)); cards.add(new SetCardInfo("Anim Pakal, Thousandth Moon", 223, Rarity.RARE, mage.cards.a.AnimPakalThousandthMoon.class)); + cards.add(new SetCardInfo("Another Chance", 90, Rarity.COMMON, mage.cards.a.AnotherChance.class)); cards.add(new SetCardInfo("Attentive Sunscribe", 4, Rarity.COMMON, mage.cards.a.AttentiveSunscribe.class)); cards.add(new SetCardInfo("Bartolome del Presidio", 224, Rarity.UNCOMMON, mage.cards.b.BartolomeDelPresidio.class)); cards.add(new SetCardInfo("Basking Capybara", 175, Rarity.COMMON, mage.cards.b.BaskingCapybara.class));