[MH2] Implemented Dauthi Voidwalker

This commit is contained in:
Evan Kranzler 2021-06-05 11:58:07 -04:00
parent 3cd434e814
commit ffd681a0ec
3 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,148 @@
package mage.cards.d;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
import mage.abilities.keyword.ShadowAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.players.Player;
import mage.target.common.TargetCardInExile;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DauthiVoidwalker extends CardImpl {
public DauthiVoidwalker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}{B}");
this.subtype.add(SubType.DAUTHI);
this.subtype.add(SubType.ROGUE);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// Shadow
this.addAbility(ShadowAbility.getInstance());
// If a card would be put into an opponent's graveyard from anywhere, instead exile it with a void counter on it.
this.addAbility(new SimpleStaticAbility(new DauthiVoidwalkerReplacementEffect()));
// {T}, Sacrifice Dauthi Voidwalker: Choose an exiled card an opponent owns with a void counter on it. You may play it this turn without paying its mana cost.
Ability ability = new SimpleActivatedAbility(new DauthiVoidwalkerPlayEffect(), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
private DauthiVoidwalker(final DauthiVoidwalker card) {
super(card);
}
@Override
public DauthiVoidwalker copy() {
return new DauthiVoidwalker(this);
}
}
class DauthiVoidwalkerReplacementEffect extends ReplacementEffectImpl {
DauthiVoidwalkerReplacementEffect() {
super(Duration.WhileOnBattlefield, Outcome.Exile);
staticText = "if a card would be put into an opponent's graveyard from anywhere, " +
"instead exile it with a void counter on it";
}
private DauthiVoidwalkerReplacementEffect(final DauthiVoidwalkerReplacementEffect effect) {
super(effect);
}
@Override
public DauthiVoidwalkerReplacementEffect copy() {
return new DauthiVoidwalkerReplacementEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(event.getTargetId());
if (player == null || card == null) {
return false;
}
player.moveCards(card, Zone.EXILED, source, game);
card.addCounters(CounterType.VOID.createInstance(), source.getControllerId(), source, game);
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return ((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
&& game.getOpponents(source.getControllerId()).contains(game.getOwnerId(event.getTargetId()));
}
}
class DauthiVoidwalkerPlayEffect extends OneShotEffect {
private static final FilterCard filter
= new FilterCard("exiled card an opponent owns with a void counter on it");
static {
filter.add(CounterType.VOID.getPredicate());
filter.add(TargetController.OPPONENT.getOwnerPredicate());
}
DauthiVoidwalkerPlayEffect() {
super(Outcome.Benefit);
staticText = "choose an exiled card an opponent owns with a void counter on it. " +
"You may play it this turn without paying its mana cost";
}
private DauthiVoidwalkerPlayEffect(final DauthiVoidwalkerPlayEffect effect) {
super(effect);
}
@Override
public DauthiVoidwalkerPlayEffect copy() {
return new DauthiVoidwalkerPlayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
TargetCardInExile target = new TargetCardInExile(
0, 1, filter, null, true
);
player.choose(outcome, target, source.getSourceId(), game);
Card card = game.getCard(target.getFirstTarget());
if (card == null) {
return false;
}
game.addEffect(new PlayFromNotOwnHandZoneTargetEffect(
Zone.EXILED, TargetController.YOU, Duration.EndOfTurn, true, false
).setTargetPointer(new FixedTarget(card, game)), source);
return true;
}
}

View file

@ -81,6 +81,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Cursed Totem", 295, Rarity.RARE, mage.cards.c.CursedTotem.class));
cards.add(new SetCardInfo("Dakkon, Shadow Slayer", 192, Rarity.MYTHIC, mage.cards.d.DakkonShadowSlayer.class));
cards.add(new SetCardInfo("Darkmoss Bridge", 245, Rarity.COMMON, mage.cards.d.DarkmossBridge.class));
cards.add(new SetCardInfo("Dauthi Voidwalker", 81, Rarity.RARE, mage.cards.d.DauthiVoidwalker.class));
cards.add(new SetCardInfo("Deepwood Denizen", 155, Rarity.COMMON, mage.cards.d.DeepwoodDenizen.class));
cards.add(new SetCardInfo("Diamond Lion", 225, Rarity.RARE, mage.cards.d.DiamondLion.class));
cards.add(new SetCardInfo("Dihada's Ploy", 193, Rarity.COMMON, mage.cards.d.DihadasPloy.class));

View file

@ -168,6 +168,7 @@ public enum CounterType {
VERSE("verse"),
VIGILANCE("vigilance"),
VITALITY("vitality"),
VOID("void"),
VORTEX("vortex"),
VOW("vow"),
VOYAGE("voyage"),