[BRC] Implement Tawnos, Solemn Survivor

This commit is contained in:
Evan Kranzler 2022-11-06 12:12:11 -05:00
parent 109d27138c
commit 8b52789b52
2 changed files with 125 additions and 0 deletions

View file

@ -0,0 +1,124 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ExileFromGraveCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.MillCardsControllerEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.common.FilterControlledArtifactPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentCard;
import mage.target.TargetPermanent;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.common.TargetControlledPermanent;
import mage.util.CardUtil;
import java.util.Collection;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TawnosSolemnSurvivor extends CardImpl {
private static final FilterPermanent filter
= new FilterControlledArtifactPermanent("artifact token you control");
private static final FilterControlledPermanent filter2
= new FilterControlledArtifactPermanent("artifact tokens");
static {
filter.add(TokenPredicate.TRUE);
filter2.add(TokenPredicate.TRUE);
}
public TawnosSolemnSurvivor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ARTIFICER);
this.power = new MageInt(1);
this.toughness = new MageInt(3);
// {2}, {T}: Create a token that's a copy of up to one target artifact token you control. Mill two cards.
Ability ability = new SimpleActivatedAbility(new CreateTokenCopyTargetEffect(), new GenericManaCost(2));
ability.addCost(new TapSourceCost());
ability.addEffect(new MillCardsControllerEffect(2));
ability.addTarget(new TargetPermanent(0, 1, filter));
this.addAbility(ability);
// {1}{W}{U}{B}, {T}, Sacrifice two artifact tokens, Exile an artifact or creature card from your graveyard: Create a token that's a copy of the exiled card, except it's an artifact in addition to its other types. Activate only as a sorcery.
ability = new ActivateAsSorceryActivatedAbility(
new TawnosSolemnSurvivorEffect(), new ManaCostsImpl<>("{1}{W}{U}{B}")
);
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(2, filter2)));
ability.addCost(new ExileFromGraveCost(
new TargetCardInYourGraveyard(StaticFilters.FILTER_CARD_ARTIFACT_OR_CREATURE)
));
this.addAbility(ability);
}
private TawnosSolemnSurvivor(final TawnosSolemnSurvivor card) {
super(card);
}
@Override
public TawnosSolemnSurvivor copy() {
return new TawnosSolemnSurvivor(this);
}
}
class TawnosSolemnSurvivorEffect extends OneShotEffect {
TawnosSolemnSurvivorEffect() {
super(Outcome.Benefit);
staticText = "create a token that's a copy of the exiled card, " +
"except it's an artifact in addition to its other types";
}
private TawnosSolemnSurvivorEffect(final TawnosSolemnSurvivorEffect effect) {
super(effect);
}
@Override
public TawnosSolemnSurvivorEffect copy() {
return new TawnosSolemnSurvivorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = CardUtil
.castStream(source.getCosts().stream(), ExileFromGraveCost.class)
.map(ExileFromGraveCost::getExiledCards)
.flatMap(Collection::stream)
.findFirst()
.orElse(null);
if (card == null) {
return false;
}
Permanent permanent = new PermanentCard(card, source.getControllerId(), game);
return new CreateTokenCopyTargetEffect(
null, CardType.ARTIFACT, false
).setSavedPermanent(permanent).apply(game, source);
}
}

View file

@ -149,6 +149,7 @@ public final class TheBrothersWarCommander extends ExpansionSet {
cards.add(new SetCardInfo("Swamp", 33, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 33, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swiftfoot Boots", 166, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class)); cards.add(new SetCardInfo("Swiftfoot Boots", 166, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));
cards.add(new SetCardInfo("Swords to Plowshares", 75, Rarity.UNCOMMON, mage.cards.s.SwordsToPlowshares.class)); cards.add(new SetCardInfo("Swords to Plowshares", 75, Rarity.UNCOMMON, mage.cards.s.SwordsToPlowshares.class));
cards.add(new SetCardInfo("Tawnos, Solemn Survivor", 3, Rarity.MYTHIC, mage.cards.t.TawnosSolemnSurvivor.class));
cards.add(new SetCardInfo("Tempered Steel", 76, Rarity.RARE, mage.cards.t.TemperedSteel.class)); cards.add(new SetCardInfo("Tempered Steel", 76, Rarity.RARE, mage.cards.t.TemperedSteel.class));
cards.add(new SetCardInfo("Temple of Deceit", 205, Rarity.RARE, mage.cards.t.TempleOfDeceit.class)); cards.add(new SetCardInfo("Temple of Deceit", 205, Rarity.RARE, mage.cards.t.TempleOfDeceit.class));
cards.add(new SetCardInfo("Temple of Enlightenment", 206, Rarity.RARE, mage.cards.t.TempleOfEnlightenment.class)); cards.add(new SetCardInfo("Temple of Enlightenment", 206, Rarity.RARE, mage.cards.t.TempleOfEnlightenment.class));