[LCI] Implement Another Chance

This commit is contained in:
Susucre 2023-11-04 18:58:39 +01:00
parent ceca8aa5d5
commit bcd0558cc1
2 changed files with 83 additions and 0 deletions

View file

@ -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;
}
}

View file

@ -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));