[C21] Implemented Author of Shadows

This commit is contained in:
Evan Kranzler 2021-04-19 08:38:11 -04:00
parent ccd1c38004
commit beaae98bd1
2 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,96 @@
package mage.cards.a;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.*;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInExile;
import mage.util.CardUtil;
import java.util.Objects;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AuthorOfShadows extends CardImpl {
public AuthorOfShadows(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.subtype.add(SubType.SHADE);
this.subtype.add(SubType.WARLOCK);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Author of Shadows enters the battlefield, exile all cards from all opponents' graveyards. Choose a nonland card exiled this way. You may cast that card for as long as it remains exiled, and you may spend mana as though it were mana of any color to cast that spell.
this.addAbility(new EntersBattlefieldTriggeredAbility(new AuthorOfShadowsEffect()));
}
private AuthorOfShadows(final AuthorOfShadows card) {
super(card);
}
@Override
public AuthorOfShadows copy() {
return new AuthorOfShadows(this);
}
}
class AuthorOfShadowsEffect extends OneShotEffect {
AuthorOfShadowsEffect() {
super(Outcome.Benefit);
staticText = "exile all cards from all opponents' graveyards. Choose a nonland card exiled this way. " +
"You may cast that card for as long as it remains exiled, and you may spend mana " +
"as though it were mana of any color to cast that spell";
}
private AuthorOfShadowsEffect(final AuthorOfShadowsEffect effect) {
super(effect);
}
@Override
public AuthorOfShadowsEffect copy() {
return new AuthorOfShadowsEffect(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.getOpponents(source.getControllerId())
.stream()
.map(game::getPlayer)
.filter(Objects::nonNull)
.map(Player::getGraveyard)
.forEach(cards::addAll);
cards.removeIf(Objects::isNull);
if (cards.isEmpty()) {
return false;
}
player.moveCards(cards, Zone.EXILED, source, game);
cards.retainZone(Zone.EXILED, game);
if (cards.isEmpty()) {
return false;
}
TargetCard target = new TargetCardInExile(StaticFilters.FILTER_CARD_A_NON_LAND);
target.setNotTarget(true);
player.choose(outcome, cards, target, game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
CardUtil.makeCardPlayable(game, source, card, Duration.Custom, true);
return true;
}
}

View file

@ -36,6 +36,7 @@ public final class Commander2021Edition extends ExpansionSet {
cards.add(new SetCardInfo("Arcane Signet", 234, Rarity.COMMON, mage.cards.a.ArcaneSignet.class));
cards.add(new SetCardInfo("Archaeomancer's Map", 12, Rarity.RARE, mage.cards.a.ArchaeomancersMap.class));
cards.add(new SetCardInfo("Audacious Reshapers", 47, Rarity.RARE, mage.cards.a.AudaciousReshapers.class));
cards.add(new SetCardInfo("Author of Shadows", 35, Rarity.RARE, mage.cards.a.AuthorOfShadows.class));
cards.add(new SetCardInfo("Barren Moor", 277, Rarity.UNCOMMON, mage.cards.b.BarrenMoor.class));
cards.add(new SetCardInfo("Battlefield Forge", 278, Rarity.RARE, mage.cards.b.BattlefieldForge.class));
cards.add(new SetCardInfo("Beast Within", 186, Rarity.UNCOMMON, mage.cards.b.BeastWithin.class));