[BRO] Implemented Teferi, Temporal Pilgrim (#9692)

This commit is contained in:
Daniel Bomar 2022-10-31 07:59:59 -05:00 committed by GitHub
parent d27c66bb95
commit 28e3c68570
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 147 additions and 0 deletions

View file

@ -0,0 +1,110 @@
package mage.cards.t;
import java.util.HashSet;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.DrawCardControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.SpiritTeferiToken;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetOpponent;
/**
*
* @author weirddan455
*/
public final class TeferiTemporalPilgrim extends CardImpl {
public TeferiTemporalPilgrim(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.TEFERI);
this.setStartingLoyalty(4);
// Whenever you draw a card, put a loyalty counter on Teferi, Temporal Pilgrim.
this.addAbility(new DrawCardControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.LOYALTY.createInstance()), false));
// 0: Draw a card.
this.addAbility(new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 0));
// -2: Create a 2/2 blue Spirit creature token with vigilance and "Whenever you draw a card, put a +1/+1 counter on this creature."
this.addAbility(new LoyaltyAbility(new CreateTokenEffect(new SpiritTeferiToken()), -2));
// -12: Target opponent chooses a permanent they control and returns it to its owner's had. Then they shuffle each nonland permanent they control into its owner's library.
Ability ability = new LoyaltyAbility(new TeferiTemporalPilgrimEffect(), -12);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);
}
private TeferiTemporalPilgrim(final TeferiTemporalPilgrim card) {
super(card);
}
@Override
public TeferiTemporalPilgrim copy() {
return new TeferiTemporalPilgrim(this);
}
}
class TeferiTemporalPilgrimEffect extends OneShotEffect {
public TeferiTemporalPilgrimEffect() {
super(Outcome.Removal);
this.staticText = "Target opponent chooses a permanent they control and returns it to its owner's had. Then they shuffle each nonland permanent they control into its owner's library.";
}
private TeferiTemporalPilgrimEffect(final TeferiTemporalPilgrimEffect effect) {
super(effect);
}
@Override
public TeferiTemporalPilgrimEffect copy() {
return new TeferiTemporalPilgrimEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player opponent = game.getPlayer(source.getFirstTarget());
if (opponent == null) {
return false;
}
TargetControlledPermanent target = new TargetControlledPermanent();
target.setNotTarget(true);
opponent.chooseTarget(Outcome.ReturnToHand, target, source, game);
Permanent toHand = game.getPermanent(target.getFirstTarget());
if (toHand != null) {
opponent.moveCards(toHand, Zone.HAND, source, game);
game.getState().processAction(game);
}
HashSet<Permanent> toLibrary = new HashSet<>(game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_NON_LAND, opponent.getId(), game));
if (toLibrary.isEmpty()) {
return true;
}
HashSet<UUID> ownerIds = new HashSet<>();
for (Permanent permanent : toLibrary) {
ownerIds.add(permanent.getOwnerId());
}
opponent.moveCards(toLibrary, Zone.LIBRARY, source, game);
for (UUID ownerId : ownerIds) {
Player owner = game.getPlayer(ownerId);
if (owner != null) {
owner.shuffleLibrary(source, game);
}
}
return true;
}
}

View file

@ -70,6 +70,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Stern Lesson", 64, Rarity.COMMON, mage.cards.s.SternLesson.class));
cards.add(new SetCardInfo("Surge Engine", 81, Rarity.MYTHIC, mage.cards.s.SurgeEngine.class));
cards.add(new SetCardInfo("Swamp", 282, Rarity.LAND, mage.cards.basiclands.Swamp.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Teferi, Temporal Pilgrim", 66, Rarity.MYTHIC, mage.cards.t.TeferiTemporalPilgrim.class));
cards.add(new SetCardInfo("The Mightstone and Weakstone", "238a", Rarity.RARE, mage.cards.t.TheMightstoneAndWeakstone.class));
cards.add(new SetCardInfo("Third Path Savant", 67, Rarity.COMMON, mage.cards.t.ThirdPathSavant.class));
cards.add(new SetCardInfo("Titania, Gaea Incarnate", "256b", Rarity.MYTHIC, mage.cards.t.TitaniaGaeaIncarnate.class));

View file

@ -0,0 +1,36 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.abilities.common.DrawCardControllerTriggeredAbility;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.CounterType;
/**
*
* @author weirddan455
*/
public class SpiritTeferiToken extends TokenImpl {
public SpiritTeferiToken() {
super("Spirit Token", "2/2 blue Spirit creature token with vigilance and \"Whenever you draw a card, put a +1/+1 counter on this creature.\"");
cardType.add(CardType.CREATURE);
subtype.add(SubType.SPIRIT);
color.setBlue(true);
power = new MageInt(2);
toughness = new MageInt(2);
addAbility(VigilanceAbility.getInstance());
addAbility(new DrawCardControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), false));
}
private SpiritTeferiToken(final SpiritTeferiToken token) {
super(token);
}
@Override
public SpiritTeferiToken copy() {
return new SpiritTeferiToken(this);
}
}