Implemented Dredge the Mire

This commit is contained in:
Evan Kranzler 2020-04-06 21:53:33 -04:00
parent a818251d3f
commit 7e233baa28
2 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,80 @@
package mage.cards.d;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCardInGraveyard;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class DredgeTheMire extends CardImpl {
public DredgeTheMire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{B}");
// Each opponent chooses a creature card in their graveyard. Put those cards onto the battlefield under your control.
this.getSpellAbility().addEffect(new DredgeTheMireEffect());
}
private DredgeTheMire(final DredgeTheMire card) {
super(card);
}
@Override
public DredgeTheMire copy() {
return new DredgeTheMire(this);
}
}
class DredgeTheMireEffect extends OneShotEffect {
DredgeTheMireEffect() {
super(Outcome.Benefit);
staticText = "Each opponent chooses a creature card in their graveyard. " +
"Put those cards onto the battlefield under your control.";
}
private DredgeTheMireEffect(final DredgeTheMireEffect effect) {
super(effect);
}
@Override
public DredgeTheMireEffect copy() {
return new DredgeTheMireEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Cards cards = new CardsImpl();
for (UUID opponentId : game.getOpponents(source.getControllerId())) {
Player player = game.getPlayer(opponentId);
if (player == null || player.getGraveyard().count(StaticFilters.FILTER_CARD_CREATURE, game) == 0) {
continue;
}
TargetCard target = new TargetCardInGraveyard(StaticFilters.FILTER_CARD_CREATURE_YOUR_GRAVEYARD);
target.setNotTarget(true);
if (!player.choose(outcome, player.getGraveyard(), target, game)) {
continue;
}
cards.add(target.getFirstTarget());
}
return controller.moveCards(cards, Zone.BATTLEFIELD, source, game);
}
}

View file

@ -71,6 +71,7 @@ public final class Commander2020Edition extends ExpansionSet {
cards.add(new SetCardInfo("Deadly Tempest", 131, Rarity.RARE, mage.cards.d.DeadlyTempest.class)); cards.add(new SetCardInfo("Deadly Tempest", 131, Rarity.RARE, mage.cards.d.DeadlyTempest.class));
cards.add(new SetCardInfo("Deflecting Swat", 50, Rarity.RARE, mage.cards.d.DeflectingSwat.class)); cards.add(new SetCardInfo("Deflecting Swat", 50, Rarity.RARE, mage.cards.d.DeflectingSwat.class));
cards.add(new SetCardInfo("Dismantling Wave", 25, Rarity.RARE, mage.cards.d.DismantlingWave.class)); cards.add(new SetCardInfo("Dismantling Wave", 25, Rarity.RARE, mage.cards.d.DismantlingWave.class));
cards.add(new SetCardInfo("Dredge the Mire", 43, Rarity.RARE, mage.cards.d.DredgeTheMire.class));
cards.add(new SetCardInfo("Eternal Dragon", 88, Rarity.RARE, mage.cards.e.EternalDragon.class)); cards.add(new SetCardInfo("Eternal Dragon", 88, Rarity.RARE, mage.cards.e.EternalDragon.class));
cards.add(new SetCardInfo("Fierce Guardianship", 35, Rarity.RARE, mage.cards.f.FierceGuardianship.class)); cards.add(new SetCardInfo("Fierce Guardianship", 35, Rarity.RARE, mage.cards.f.FierceGuardianship.class));
cards.add(new SetCardInfo("Flawless Maneuver", 26, Rarity.RARE, mage.cards.f.FlawlessManeuver.class)); cards.add(new SetCardInfo("Flawless Maneuver", 26, Rarity.RARE, mage.cards.f.FlawlessManeuver.class));