[MIR] Implement Tainted Specter (#11525)

This commit is contained in:
Cameron Merkel 2023-12-07 20:47:28 -06:00 committed by GitHub
parent 2e75b73802
commit 2a90e8256e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 115 additions and 0 deletions

View file

@ -0,0 +1,114 @@
package mage.cards.t;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageEverythingEffect;
import mage.abilities.effects.common.discard.DiscardTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
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 mage.target.TargetPlayer;
import mage.target.common.TargetCardInHand;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author Cguy7777
*/
public final class TaintedSpecter extends CardImpl {
public TaintedSpecter(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.SPECTER);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {1}{B}{B}, {tap}: Target player discards a card unless they put a card from their hand on top of their library.
// If that player discards a card this way, Tainted Specter deals 1 damage to each creature and each player.
// Activate this ability only any time you could cast a sorcery.
Ability ability = new ActivateAsSorceryActivatedAbility(
Zone.BATTLEFIELD, new TaintedSpecterEffect(), new ManaCostsImpl<>("{1}{B}{B}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
private TaintedSpecter(final TaintedSpecter card) {
super(card);
}
@Override
public TaintedSpecter copy() {
return new TaintedSpecter(this);
}
}
class TaintedSpecterEffect extends OneShotEffect {
public TaintedSpecterEffect() {
super(Outcome.Detriment);
staticText = "Target player discards a card unless they put a card from their hand on top of their library. "
+ "If that player discards a card this way, {this} deals 1 damage to each creature and each player";
}
private TaintedSpecterEffect(final TaintedSpecterEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source));
if (targetPlayer == null) {
return false;
}
if (targetPlayer.getHand().isEmpty()) {
return true;
}
final String message = "Discard a card, or put a card from your hand on top of your library?";
if (targetPlayer.chooseUse(outcome, message, null, "Discard a card", "Put a card from your hand on top", source, game)) {
// Discard a card
Effect discardEffect = new DiscardTargetEffect(1);
discardEffect.setTargetPointer(new FixedTarget(targetPlayer.getId()));
if (discardEffect.apply(game, source)) {
new DamageEverythingEffect(1).apply(game, source);
}
} else {
// Put a card from your hand on top of your library
TargetCardInHand target = new TargetCardInHand();
target.withNotTarget(true);
target.setTargetName("a card from your hand to put on top of your library");
targetPlayer.choose(Outcome.Detriment, target, source, game);
Card card = targetPlayer.getHand().get(target.getFirstTarget(), game);
if (card != null) {
targetPlayer.moveCardToLibraryWithInfo(card, source, game, Zone.HAND, true, false);
}
}
return true;
}
@Override
public TaintedSpecterEffect copy() {
return new TaintedSpecterEffect(this);
}
}

View file

@ -309,6 +309,7 @@ public final class Mirage extends ExpansionSet {
cards.add(new SetCardInfo("Swamp", 340, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swamp", 341, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Swamp", 342, Rarity.LAND, mage.cards.basiclands.Swamp.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Tainted Specter", 148, Rarity.RARE, mage.cards.t.TaintedSpecter.class));
cards.add(new SetCardInfo("Talruum Minotaur", 196, Rarity.COMMON, mage.cards.t.TalruumMinotaur.class));
cards.add(new SetCardInfo("Taniwha", 95, Rarity.RARE, mage.cards.t.Taniwha.class));
cards.add(new SetCardInfo("Teeka's Dragon", 320, Rarity.RARE, mage.cards.t.TeekasDragon.class));