1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-08 09:11:04 -09:00

[C21] Implemented Dazzling Sphinx

This commit is contained in:
Evan Kranzler 2021-04-14 19:04:22 -04:00
parent 802dacea29
commit af048afb69
2 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.d;
import mage.ApprovingObject;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DazzlingSphinx extends CardImpl {
public DazzlingSphinx(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}{U}");
this.subtype.add(SubType.SPHINX);
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever Dazzling Sphinx deals combat damage to a player, that player exiles cards from the top of their library until they exile an instant or sorcery card. You may cast that card without paying its mana cost. Then that player puts the exiled cards that weren't cast this way on the bottom of their library in a random order.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new DazzlingSphinxEffect(), false, true
));
}
private DazzlingSphinx(final DazzlingSphinx card) {
super(card);
}
@Override
public DazzlingSphinx copy() {
return new DazzlingSphinx(this);
}
}
class DazzlingSphinxEffect extends OneShotEffect {
DazzlingSphinxEffect() {
super(Outcome.Benefit);
staticText = "that player exiles cards from the top of their library until they exile an " +
"instant or sorcery card. You may cast that card without paying its mana cost. Then that player " +
"puts the exiled cards that weren't cast this way on the bottom of their library in a random order";
}
private DazzlingSphinxEffect(final DazzlingSphinxEffect effect) {
super(effect);
}
@Override
public DazzlingSphinxEffect copy() {
return new DazzlingSphinxEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(targetPointer.getFirst(game, source));
if (controller == null || opponent == null) {
return false;
}
Cards cards = new CardsImpl();
Card toCast = null;
for (Card card : opponent.getLibrary().getCards(game)) {
cards.add(card);
if (card.isInstantOrSorcery()) {
toCast = card;
}
}
opponent.moveCards(cards, Zone.EXILED, source, game);
if (toCast != null && controller.chooseUse(
outcome, "Cast " + toCast.getName() + " without paying its mana cost?", source, game
)) {
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), Boolean.TRUE);
controller.cast(
controller.chooseAbilityForCast(toCast, game, true),
game, true, new ApprovingObject(source, game)
);
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), null);
}
cards.retainZone(Zone.EXILED, game);
opponent.putCardsOnBottomOfLibrary(cards, game, source, false);
return true;
}
}

View file

@ -82,6 +82,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Daretti, Scrap Savant", 164, Rarity.MYTHIC, mage.cards.d.DarettiScrapSavant.class));
cards.add(new SetCardInfo("Darksteel Citadel", 285, Rarity.UNCOMMON, mage.cards.d.DarksteelCitadel.class));
cards.add(new SetCardInfo("Darksteel Mutation", 87, Rarity.UNCOMMON, mage.cards.d.DarksteelMutation.class));
cards.add(new SetCardInfo("Dazzling Sphinx", 25, Rarity.RARE, mage.cards.d.DazzlingSphinx.class));
cards.add(new SetCardInfo("Deadly Tempest", 140, Rarity.RARE, mage.cards.d.DeadlyTempest.class));
cards.add(new SetCardInfo("Deathbringer Liege", 214, Rarity.RARE, mage.cards.d.DeathbringerLiege.class));
cards.add(new SetCardInfo("Deathbringer Regent", 141, Rarity.RARE, mage.cards.d.DeathbringerRegent.class));