Implemented Brought Back

This commit is contained in:
Evan Kranzler 2019-06-24 20:34:01 -04:00
parent 5a09578700
commit 3996511976
2 changed files with 65 additions and 0 deletions

View file

@ -0,0 +1,64 @@
package mage.cards.b;
import mage.MageObjectReference;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterCard;
import mage.filter.common.FilterPermanentCard;
import mage.filter.predicate.Predicate;
import mage.game.Game;
import mage.target.common.TargetCardInYourGraveyard;
import mage.watchers.common.CardsPutIntoGraveyardWatcher;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class BroughtBack extends CardImpl {
private static final FilterCard filter = new FilterPermanentCard(
"permanent cards in your graveyard that were put there from the battlefield this turn"
);
static {
filter.add(BroughtBackPredicate.instance);
}
public BroughtBack(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{W}{W}");
// Choose up to two target permanent cards in your graveyard that were put there from the battlefield this turn. Return them to the battlefield tapped.
this.getSpellAbility().addEffect(
new ReturnFromGraveyardToBattlefieldTargetEffect()
.setText("Choose up to two target permanent cards in your graveyard " +
"that were put there from the battlefield this turn. " +
"Return them to the battlefield tapped.")
);
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 2, filter));
this.getSpellAbility().addWatcher(new CardsPutIntoGraveyardWatcher());
}
private BroughtBack(final BroughtBack card) {
super(card);
}
@Override
public BroughtBack copy() {
return new BroughtBack(this);
}
}
enum BroughtBackPredicate implements Predicate<Card> {
instance;
@Override
public boolean apply(Card input, Game game) {
CardsPutIntoGraveyardWatcher watcher = game.getState().getWatcher(CardsPutIntoGraveyardWatcher.class);
return watcher != null
&& watcher.getCardsPutToGraveyardFromBattlefield().contains(new MageObjectReference(input, game));
}
}

View file

@ -63,6 +63,7 @@ public final class CoreSet2020 extends ExpansionSet {
cards.add(new SetCardInfo("Blossoming Sands", 243, Rarity.COMMON, mage.cards.b.BlossomingSands.class));
cards.add(new SetCardInfo("Bone Splinters", 92, Rarity.COMMON, mage.cards.b.BoneSplinters.class));
cards.add(new SetCardInfo("Boneclad Necromancer", 93, Rarity.COMMON, mage.cards.b.BonecladNecromancer.class));
cards.add(new SetCardInfo("Brought Back", 9, Rarity.RARE, mage.cards.b.BroughtBack.class));
cards.add(new SetCardInfo("Captivating Gyre", 51, Rarity.UNCOMMON, mage.cards.c.CaptivatingGyre.class));
cards.add(new SetCardInfo("Cavalier of Dawn", 10, Rarity.MYTHIC, mage.cards.c.CavalierOfDawn.class));
cards.add(new SetCardInfo("Cavalier of Flame", 125, Rarity.MYTHIC, mage.cards.c.CavalierOfFlame.class));