[MH2] Implemented Vile Entomber

This commit is contained in:
Evan Kranzler 2021-06-03 08:44:01 -04:00
parent d4eb9f5c92
commit 798b578125
5 changed files with 94 additions and 82 deletions

View file

@ -1,21 +1,13 @@
package mage.cards.e; package mage.cards.e;
import java.util.UUID; import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect;
import mage.abilities.Ability;
import mage.abilities.effects.SearchEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone; import java.util.UUID;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/** /**
*
* @author Plopman * @author Plopman
*/ */
public final class Entomb extends CardImpl { public final class Entomb extends CardImpl {
@ -24,7 +16,7 @@ public final class Entomb extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{B}");
// Search your library for a card and put that card into your graveyard. Then shuffle your library. // Search your library for a card and put that card into your graveyard. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInGraveyard()); this.getSpellAbility().addEffect(new SearchLibraryPutInGraveyardEffect());
} }
private Entomb(final Entomb card) { private Entomb(final Entomb card) {
@ -36,35 +28,3 @@ public final class Entomb extends CardImpl {
return new Entomb(this); return new Entomb(this);
} }
} }
class SearchLibraryPutInGraveyard extends SearchEffect {
public SearchLibraryPutInGraveyard() {
super(new TargetCardInLibrary(new FilterCard()), Outcome.Neutral);
staticText = "search your library for a card, put that card into your graveyard, then shuffle";
}
public SearchLibraryPutInGraveyard(final SearchLibraryPutInGraveyard effect) {
super(effect);
}
@Override
public SearchLibraryPutInGraveyard copy() {
return new SearchLibraryPutInGraveyard(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
}

View file

@ -1,23 +1,18 @@
package mage.cards.g; package mage.cards.g;
import mage.MageInt; import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.SearchEffect;
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect;
import mage.abilities.keyword.LifelinkAbility; import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType; import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.filter.FilterCard; import mage.filter.FilterCard;
import mage.filter.predicate.card.CastFromZonePredicate; import mage.filter.predicate.card.CastFromZonePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
import java.util.UUID; import java.util.UUID;
@ -45,7 +40,7 @@ public final class GravebreakerLamia extends CardImpl {
this.addAbility(LifelinkAbility.getInstance()); this.addAbility(LifelinkAbility.getInstance());
// When Gravebreaker Lamia enters the battlefield, search your library for a card, put it into your graveyard, then shuffle your library. // When Gravebreaker Lamia enters the battlefield, search your library for a card, put it into your graveyard, then shuffle your library.
this.addAbility(new EntersBattlefieldTriggeredAbility(new GravebreakerLamiaSearchEffect(), false)); this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInGraveyardEffect(), false));
// Spells you cast from your graveyard cost {1} less to cast. // Spells you cast from your graveyard cost {1} less to cast.
this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1) this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1)
@ -61,33 +56,3 @@ public final class GravebreakerLamia extends CardImpl {
return new GravebreakerLamia(this); return new GravebreakerLamia(this);
} }
} }
class GravebreakerLamiaSearchEffect extends SearchEffect {
GravebreakerLamiaSearchEffect() {
super(new TargetCardInLibrary(), Outcome.Neutral);
staticText = "search your library for a card, put it into your graveyard, then shuffle";
}
private GravebreakerLamiaSearchEffect(final GravebreakerLamiaSearchEffect effect) {
super(effect);
}
@Override
public GravebreakerLamiaSearchEffect copy() {
return new GravebreakerLamiaSearchEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
}

View file

@ -0,0 +1,42 @@
package mage.cards.v;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class VileEntomber extends CardImpl {
public VileEntomber(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}{B}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.WARLOCK);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// When Vile Entomber enters the battlefield, search your library for a card, put that card into your graveyard, then shuffle.
this.addAbility(new EntersBattlefieldTriggeredAbility(new SearchLibraryPutInGraveyardEffect()));
}
private VileEntomber(final VileEntomber card) {
super(card);
}
@Override
public VileEntomber copy() {
return new VileEntomber(this);
}
}

View file

@ -278,6 +278,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Verdant Command", 182, Rarity.RARE, mage.cards.v.VerdantCommand.class)); cards.add(new SetCardInfo("Verdant Command", 182, Rarity.RARE, mage.cards.v.VerdantCommand.class));
cards.add(new SetCardInfo("Vermin Gorger", 107, Rarity.COMMON, mage.cards.v.VerminGorger.class)); cards.add(new SetCardInfo("Vermin Gorger", 107, Rarity.COMMON, mage.cards.v.VerminGorger.class));
cards.add(new SetCardInfo("Viashino Lashclaw", 146, Rarity.COMMON, mage.cards.v.ViashinoLashclaw.class)); cards.add(new SetCardInfo("Viashino Lashclaw", 146, Rarity.COMMON, mage.cards.v.ViashinoLashclaw.class));
cards.add(new SetCardInfo("Vile Entomber", 108, Rarity.UNCOMMON, mage.cards.v.VileEntomber.class));
cards.add(new SetCardInfo("Vindicate", 294, Rarity.RARE, mage.cards.v.Vindicate.class)); cards.add(new SetCardInfo("Vindicate", 294, Rarity.RARE, mage.cards.v.Vindicate.class));
cards.add(new SetCardInfo("Void Mirror", 242, Rarity.RARE, mage.cards.v.VoidMirror.class)); cards.add(new SetCardInfo("Void Mirror", 242, Rarity.RARE, mage.cards.v.VoidMirror.class));
cards.add(new SetCardInfo("Wavesifter", 217, Rarity.COMMON, mage.cards.w.Wavesifter.class)); cards.add(new SetCardInfo("Wavesifter", 217, Rarity.COMMON, mage.cards.w.Wavesifter.class));

View file

@ -0,0 +1,44 @@
package mage.abilities.effects.common.search;
import mage.abilities.Ability;
import mage.abilities.effects.SearchEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInLibrary;
/**
* @author TheElk801
*/
public class SearchLibraryPutInGraveyardEffect extends SearchEffect {
public SearchLibraryPutInGraveyardEffect() {
super(new TargetCardInLibrary(StaticFilters.FILTER_CARD), Outcome.Neutral);
staticText = "search your library for a card, put that card into your graveyard, then shuffle";
}
public SearchLibraryPutInGraveyardEffect(final SearchLibraryPutInGraveyardEffect effect) {
super(effect);
}
@Override
public SearchLibraryPutInGraveyardEffect copy() {
return new SearchLibraryPutInGraveyardEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
if (controller.searchLibrary(target, source, game)) {
controller.moveCards(game.getCard(target.getFirstTarget()), Zone.GRAVEYARD, source, game);
}
controller.shuffleLibrary(source, game);
return true;
}
}