From 798b57812585b5eb624bed836cfbe57d8c925121 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 3 Jun 2021 08:44:01 -0400 Subject: [PATCH] [MH2] Implemented Vile Entomber --- Mage.Sets/src/mage/cards/e/Entomb.java | 50 ++----------------- .../src/mage/cards/g/GravebreakerLamia.java | 39 +-------------- Mage.Sets/src/mage/cards/v/VileEntomber.java | 42 ++++++++++++++++ Mage.Sets/src/mage/sets/ModernHorizons2.java | 1 + .../SearchLibraryPutInGraveyardEffect.java | 44 ++++++++++++++++ 5 files changed, 94 insertions(+), 82 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/v/VileEntomber.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInGraveyardEffect.java diff --git a/Mage.Sets/src/mage/cards/e/Entomb.java b/Mage.Sets/src/mage/cards/e/Entomb.java index f7a8bf8f59..aeff5ad324 100644 --- a/Mage.Sets/src/mage/cards/e/Entomb.java +++ b/Mage.Sets/src/mage/cards/e/Entomb.java @@ -1,30 +1,22 @@ - package mage.cards.e; -import java.util.UUID; -import mage.abilities.Ability; -import mage.abilities.effects.SearchEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.filter.FilterCard; -import mage.game.Game; -import mage.players.Player; -import mage.target.common.TargetCardInLibrary; + +import java.util.UUID; /** - * * @author Plopman */ public final class Entomb extends CardImpl { public Entomb(UUID ownerId, CardSetInfo setInfo) { - 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. - this.getSpellAbility().addEffect(new SearchLibraryPutInGraveyard()); + this.getSpellAbility().addEffect(new SearchLibraryPutInGraveyardEffect()); } private Entomb(final Entomb card) { @@ -36,35 +28,3 @@ public final class Entomb extends CardImpl { 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; - } - -} diff --git a/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java b/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java index 3e4e135085..f000c0d51e 100644 --- a/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java +++ b/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java @@ -1,23 +1,18 @@ package mage.cards.g; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.SearchEffect; import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInGraveyardEffect; import mage.abilities.keyword.LifelinkAbility; 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.filter.FilterCard; import mage.filter.predicate.card.CastFromZonePredicate; -import mage.game.Game; -import mage.players.Player; -import mage.target.common.TargetCardInLibrary; import java.util.UUID; @@ -45,7 +40,7 @@ public final class GravebreakerLamia extends CardImpl { 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. - 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. this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1) @@ -61,33 +56,3 @@ public final class GravebreakerLamia extends CardImpl { 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; - } -} diff --git a/Mage.Sets/src/mage/cards/v/VileEntomber.java b/Mage.Sets/src/mage/cards/v/VileEntomber.java new file mode 100644 index 0000000000..144ad9a5c6 --- /dev/null +++ b/Mage.Sets/src/mage/cards/v/VileEntomber.java @@ -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); + } +} diff --git a/Mage.Sets/src/mage/sets/ModernHorizons2.java b/Mage.Sets/src/mage/sets/ModernHorizons2.java index 6294c89de5..4e7710d5b7 100644 --- a/Mage.Sets/src/mage/sets/ModernHorizons2.java +++ b/Mage.Sets/src/mage/sets/ModernHorizons2.java @@ -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("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("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("Void Mirror", 242, Rarity.RARE, mage.cards.v.VoidMirror.class)); cards.add(new SetCardInfo("Wavesifter", 217, Rarity.COMMON, mage.cards.w.Wavesifter.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInGraveyardEffect.java b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInGraveyardEffect.java new file mode 100644 index 0000000000..090a7366b5 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/search/SearchLibraryPutInGraveyardEffect.java @@ -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; + } + +} \ No newline at end of file