[CLB] Implemented Tasha, the Witch Queen

This commit is contained in:
Evan Kranzler 2022-05-19 19:09:09 -04:00
parent fa6ef0ae54
commit b797768b19
4 changed files with 191 additions and 0 deletions

View file

@ -0,0 +1,156 @@
package mage.cards.t;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.*;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.FilterSpell;
import mage.filter.StaticFilters;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.filter.predicate.card.OwnerIdPredicate;
import mage.game.Game;
import mage.game.permanent.token.Demon33Token;
import mage.players.Player;
import mage.target.common.TargetCardInOpponentsGraveyard;
import mage.target.targetadjustment.TargetAdjuster;
import mage.target.targetpointer.EachTargetPointer;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class TashaTheWitchQueen extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a spell you don't own");
static {
filter.add(TargetController.NOT_YOU.getOwnerPredicate());
}
public TashaTheWitchQueen(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.TASHA);
this.setStartingLoyalty(4);
// Whenever you cast a spell you don't own, create a 3/3 black Demon creature token.
this.addAbility(new SpellCastControllerTriggeredAbility(new CreateTokenEffect(new Demon33Token()), filter, false));
// +1: Draw a card. For each opponent, exile up to one target instant or sorcery card from that player's graveyard and put a page counter on it.
Ability ability = new LoyaltyAbility(new DrawCardSourceControllerEffect(1), 1);
ability.addEffect(new TashaTheWitchQueenExileEffect());
ability.setTargetAdjuster(TashaTheWitchQueenAdjuster.instance);
this.addAbility(ability);
// 3: You may cast a spell from among cards in exile with page counters on them without paying its mana cost.
this.addAbility(new LoyaltyAbility(new TashaTheWitchQueenCastEffect(), -3));
// Tasha, the Witch Queen can be your commander.
this.addAbility(CanBeYourCommanderAbility.getInstance());
}
private TashaTheWitchQueen(final TashaTheWitchQueen card) {
super(card);
}
@Override
public TashaTheWitchQueen copy() {
return new TashaTheWitchQueen(this);
}
}
enum TashaTheWitchQueenAdjuster implements TargetAdjuster {
instance;
@Override
public void adjustTargets(Ability ability, Game game) {
ability.getTargets().clear();
for (UUID opponentId : game.getOpponents(ability.getControllerId())) {
Player opponent = game.getPlayer(opponentId);
if (opponent == null) {
continue;
}
FilterCard filter = new FilterInstantOrSorceryCard("instant or sorcery card from " + opponent.getLogName() + "'s graveyard");
filter.add(new OwnerIdPredicate(opponentId));
TargetCardInOpponentsGraveyard target = new TargetCardInOpponentsGraveyard(0, 1, filter);
ability.addTarget(target);
}
}
}
class TashaTheWitchQueenExileEffect extends OneShotEffect {
TashaTheWitchQueenExileEffect() {
super(Outcome.Benefit);
this.setTargetPointer(new EachTargetPointer());
staticText = "For each opponent, exile up to one target instant or sorcery card " +
"from that player's graveyard and put a page counter on it";
}
private TashaTheWitchQueenExileEffect(final TashaTheWitchQueenExileEffect effect) {
super(effect);
}
@Override
public TashaTheWitchQueenExileEffect copy() {
return new TashaTheWitchQueenExileEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(getTargetPointer().getTargets(game, source));
player.moveCards(cards, Zone.EXILED, source, game);
cards.retainZone(Zone.EXILED, game);
for (Card card : cards.getCards(game)) {
card.addCounters(CounterType.PAGE.createInstance(), source, game);
}
return true;
}
}
class TashaTheWitchQueenCastEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard();
static {
filter.add(CounterType.PAGE.getPredicate());
}
TashaTheWitchQueenCastEffect() {
super(Outcome.Benefit);
staticText = "you may cast a spell from among cards in exile with page counters on them without paying its mana cost";
}
private TashaTheWitchQueenCastEffect(final TashaTheWitchQueenCastEffect effect) {
super(effect);
}
@Override
public TashaTheWitchQueenCastEffect copy() {
return new TashaTheWitchQueenCastEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Cards cards = new CardsImpl(game.getExile().getCards(filter, game));
return !cards.isEmpty() && CardUtil.castSpellWithAttributesForFree(player, source, game, cards, StaticFilters.FILTER_CARD);
}
}

View file

@ -85,6 +85,7 @@ public final class CommanderLegendsBattleForBaldursGate extends ExpansionSet {
cards.add(new SetCardInfo("Summon Undead", 151, Rarity.COMMON, mage.cards.s.SummonUndead.class)); cards.add(new SetCardInfo("Summon Undead", 151, Rarity.COMMON, mage.cards.s.SummonUndead.class));
cards.add(new SetCardInfo("Swamp", 459, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Swamp", 459, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swiftfoot Boots", 339, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class)); cards.add(new SetCardInfo("Swiftfoot Boots", 339, Rarity.UNCOMMON, mage.cards.s.SwiftfootBoots.class));
cards.add(new SetCardInfo("Tasha, the Witch Queen", 294, Rarity.MYTHIC, mage.cards.t.TashaTheWitchQueen.class));
cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class)); cards.add(new SetCardInfo("Tymora's Invoker", 101, Rarity.COMMON, mage.cards.t.TymorasInvoker.class));
cards.add(new SetCardInfo("Viconia, Drow Apostate", 156, Rarity.UNCOMMON, mage.cards.v.ViconiaDrowApostate.class)); cards.add(new SetCardInfo("Viconia, Drow Apostate", 156, Rarity.UNCOMMON, mage.cards.v.ViconiaDrowApostate.class));
cards.add(new SetCardInfo("Wand of Wonder", 204, Rarity.RARE, mage.cards.w.WandOfWonder.class)); cards.add(new SetCardInfo("Wand of Wonder", 204, Rarity.RARE, mage.cards.w.WandOfWonder.class));

View file

@ -459,6 +459,7 @@ public enum SubType {
SORIN("Sorin", SubTypeSet.PlaneswalkerType), SORIN("Sorin", SubTypeSet.PlaneswalkerType),
SZAT("Szat", SubTypeSet.PlaneswalkerType), SZAT("Szat", SubTypeSet.PlaneswalkerType),
TAMIYO("Tamiyo", SubTypeSet.PlaneswalkerType), TAMIYO("Tamiyo", SubTypeSet.PlaneswalkerType),
TASHA("Tasha", SubTypeSet.PlaneswalkerType),
TEFERI("Teferi", SubTypeSet.PlaneswalkerType), TEFERI("Teferi", SubTypeSet.PlaneswalkerType),
TEYO("Teyo", SubTypeSet.PlaneswalkerType), TEYO("Teyo", SubTypeSet.PlaneswalkerType),
TEZZERET("Tezzeret", SubTypeSet.PlaneswalkerType), TEZZERET("Tezzeret", SubTypeSet.PlaneswalkerType),

View file

@ -0,0 +1,33 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.Arrays;
/**
* @author TheElk801
*/
public final class Demon33Token extends TokenImpl {
public Demon33Token() {
super("Demon Token", "3/3 black Demon creature token");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add(SubType.DEMON);
power = new MageInt(3);
toughness = new MageInt(3);
availableImageSetCodes.addAll(Arrays.asList("CLB"));
}
public Demon33Token(final Demon33Token token) {
super(token);
}
@Override
public Demon33Token copy() {
return new Demon33Token(this);
}
}