[C21] Implemented Creative Technique

This commit is contained in:
Evan Kranzler 2021-04-12 18:15:28 -04:00
parent b4b2836337
commit d137487605
2 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,95 @@
package mage.cards.c;
import mage.ApprovingObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.DemonstrateAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class CreativeTechnique extends CardImpl {
public CreativeTechnique(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{R}");
// Demonstrate
this.addAbility(new DemonstrateAbility());
// Shuffle your library, then reveal cards from the top of it until you reveal a nonland card. Exile that card and put the rest on the bottom of your library in a random order. You may cast the exiled card without paying its mana cost.
this.getSpellAbility().addEffect(new CreativeTechniqueEffect());
}
private CreativeTechnique(final CreativeTechnique card) {
super(card);
}
@Override
public CreativeTechnique copy() {
return new CreativeTechnique(this);
}
}
class CreativeTechniqueEffect extends OneShotEffect {
CreativeTechniqueEffect() {
super(Outcome.Benefit);
staticText = "shuffle your library, then reveal cards from the top of it until you reveal a nonland card. " +
"Exile that card and put the rest on the bottom of your library in a random order. " +
"You may cast the exiled card without paying its mana cost";
}
private CreativeTechniqueEffect(final CreativeTechniqueEffect effect) {
super(effect);
}
@Override
public CreativeTechniqueEffect copy() {
return new CreativeTechniqueEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
player.shuffleLibrary(source, game);
Cards cards = new CardsImpl();
Card toCast = null;
for (Card card : player.getLibrary().getCards(game)) {
cards.add(card);
if (!card.isLand()) {
toCast = card;
break;
}
}
player.revealCards(source, cards, game);
cards.remove(toCast);
if (toCast != null) {
player.moveCards(toCast, Zone.EXILED, source, game);
}
player.putCardsOnBottomOfLibrary(cards, game, source, false);
if (toCast == null || !player.chooseUse(
Outcome.PlayForFree, "Cast " + toCast.getIdName()
+ " without paying its mana cost?", source, game
)) {
return true;
}
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), Boolean.TRUE);
player.cast(
player.chooseAbilityForCast(toCast, game, true),
game, true, new ApprovingObject(source, game)
);
game.getState().setValue("PlayFromNotOwnHandZone" + toCast.getId(), null);
return true;
}
}

View file

@ -64,6 +64,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Coveted Jewel", 240, Rarity.RARE, mage.cards.c.CovetedJewel.class));
cards.add(new SetCardInfo("Crackling Drake", 213, Rarity.UNCOMMON, mage.cards.c.CracklingDrake.class));
cards.add(new SetCardInfo("Crafty Cutpurse", 117, Rarity.RARE, mage.cards.c.CraftyCutpurse.class));
cards.add(new SetCardInfo("Creative Technique", 49, Rarity.RARE, mage.cards.c.CreativeTechnique.class));
cards.add(new SetCardInfo("Curiosity Crafter", 24, Rarity.RARE, mage.cards.c.CuriosityCrafter.class));
cards.add(new SetCardInfo("Curse of Disturbance", 138, Rarity.UNCOMMON, mage.cards.c.CurseOfDisturbance.class));
cards.add(new SetCardInfo("Curse of the Swine", 118, Rarity.RARE, mage.cards.c.CurseOfTheSwine.class));