[AFR] Implemented Temple of the Dragon Queen

This commit is contained in:
Daniel Bomar 2021-07-14 10:18:43 -05:00
parent 945c4f5b87
commit 3ea08e1e7b
No known key found for this signature in database
GPG key ID: C86C8658F4023918
2 changed files with 120 additions and 0 deletions

View file

@ -0,0 +1,119 @@
package mage.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ChooseColorEffect;
import mage.abilities.effects.mana.AddManaChosenColorEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterBySubtypeCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author weirddan455
*/
public final class TempleOfTheDragonQueen extends CardImpl {
public TempleOfTheDragonQueen(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, "");
// As Temple of the Dragon Queen enters the battlefield, you may reveal a Dragon card from your hand.
// Temple of the Dragon Queen enters the battlefield tapped unless you revealed a Dragon card this way or you control a Dragon.
this.addAbility(new AsEntersBattlefieldAbility(new TempleOfTheDragonQueenEffect()));
// As Temple of the Dragon Queen enters the battlefield, choose a color.
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Neutral)));
// {T}: Add one mana of the chosen color.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new AddManaChosenColorEffect(), new TapSourceCost()));
}
private TempleOfTheDragonQueen(final TempleOfTheDragonQueen card) {
super(card);
}
@Override
public TempleOfTheDragonQueen copy() {
return new TempleOfTheDragonQueen(this);
}
}
class TempleOfTheDragonQueenEffect extends OneShotEffect {
private static final FilterBySubtypeCard filter = new FilterBySubtypeCard(SubType.DRAGON);
public TempleOfTheDragonQueenEffect() {
super(Outcome.Tap);
this.staticText = "you may reveal a Dragon card from your hand. "
+ "{this} enters the battlefield tapped unless you revealed a Dragon card this way or you control a Dragon";
}
private TempleOfTheDragonQueenEffect(final TempleOfTheDragonQueenEffect effect) {
super(effect);
}
@Override
public TempleOfTheDragonQueenEffect copy() {
return new TempleOfTheDragonQueenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent land = source.getSourcePermanentIfItStillExists(game);
if (land == null) {
land = game.getPermanentEntering(source.getSourceId());
}
if (land != null) {
boolean entersTapped = true;
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
boolean dragonInHand = false;
for (UUID cardId : controller.getHand()) {
Card card = game.getCard(cardId);
if (card != null && card.hasSubtype(SubType.DRAGON, game)) {
dragonInHand = true;
break;
}
}
if (dragonInHand && controller.chooseUse(Outcome.Untap, "Reveal a Dragon card from your hand?", source, game)) {
TargetCardInHand target = new TargetCardInHand(filter);
if (controller.chooseTarget(Outcome.Untap, target, source, game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null && card.hasSubtype(SubType.DRAGON, game)) {
controller.revealCards(source, new CardsImpl(card), game);
entersTapped = false;
}
}
}
if (entersTapped) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(controller.getId())) {
if (permanent != null && permanent.hasSubtype(SubType.DRAGON, game)) {
entersTapped = false;
break;
}
}
}
}
if (entersTapped) {
land.setTapped(true);
return true;
}
}
return false;
}
}

View file

@ -220,6 +220,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
cards.add(new SetCardInfo("Sylvan Shepherd", 206, Rarity.COMMON, mage.cards.s.SylvanShepherd.class));
cards.add(new SetCardInfo("Targ Nar, Demon-Fang Gnoll", 234, Rarity.UNCOMMON, mage.cards.t.TargNarDemonFangGnoll.class));
cards.add(new SetCardInfo("Tasha's Hideous Laughter", 78, Rarity.RARE, mage.cards.t.TashasHideousLaughter.class));
cards.add(new SetCardInfo("Temple of the Dragon Queen", 260, Rarity.UNCOMMON, mage.cards.t.TempleOfTheDragonQueen.class));
cards.add(new SetCardInfo("The Blackstaff of Waterdeep", 48, Rarity.RARE, mage.cards.t.TheBlackstaffOfWaterdeep.class));
cards.add(new SetCardInfo("The Book of Exalted Deeds", 4, Rarity.MYTHIC, mage.cards.t.TheBookOfExaltedDeeds.class));
cards.add(new SetCardInfo("The Book of Vile Darkness", 91, Rarity.MYTHIC, mage.cards.t.TheBookOfVileDarkness.class));