diff --git a/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java b/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java new file mode 100644 index 0000000000..61bf6f9fb4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/g/GravebreakerLamia.java @@ -0,0 +1,89 @@ +package mage.cards.g; + +import java.util.UUID; +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.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.other.CastFromZonePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public final class GravebreakerLamia extends CardImpl { + + public GravebreakerLamia(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT, CardType.CREATURE}, "{4}{B}"); + + this.subtype.add(SubType.SNAKE); + this.subtype.add(SubType.LAMIA); + + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Lifelink + 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)); + + // Spells you cast from your graveyard cost {1} less to cast. + FilterCard filter = new FilterCard("Spells you cast from your graveyard"); + filter.add(new CastFromZonePredicate(Zone.GRAVEYARD)); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SpellsCostReductionControllerEffect(filter, 1))); + } + + private GravebreakerLamia(final GravebreakerLamia card) { + super(card); + } + + @Override + public GravebreakerLamia copy() { + 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 your library"; + } + + 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/t/ThassaDeepDwelling.java b/Mage.Sets/src/mage/cards/t/ThassaDeepDwelling.java index 9b1f932882..902a8cb64f 100644 --- a/Mage.Sets/src/mage/cards/t/ThassaDeepDwelling.java +++ b/Mage.Sets/src/mage/cards/t/ThassaDeepDwelling.java @@ -1,5 +1,6 @@ package mage.cards.t; +import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.BeginningOfEndStepTriggeredAbility; @@ -24,8 +25,6 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.AnotherPredicate; import mage.target.TargetPermanent; -import java.util.UUID; - /** * @author TheElk801 */ @@ -54,7 +53,7 @@ public final class ThassaDeepDwelling extends CardImpl { // At the beginning of your end step, exile up to one other target creature you control, then return that card to the battlefield under your control. Ability ability = new BeginningOfEndStepTriggeredAbility( - new ExileTargetForSourceEffect().setText("exile up to one other target creature you control,"), + new ExileTargetForSourceEffect().setText("exile up to one other target creature you control, then "), TargetController.YOU, false ); ability.addEffect(new ReturnToBattlefieldUnderYourControlTargetEffect(true)); diff --git a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java index 96b18eb786..01978f47d3 100644 --- a/Mage.Sets/src/mage/sets/TherosBeyondDeath.java +++ b/Mage.Sets/src/mage/sets/TherosBeyondDeath.java @@ -107,6 +107,7 @@ public final class TherosBeyondDeath extends ExpansionSet { cards.add(new SetCardInfo("Glimpse of Freedom", 50, Rarity.UNCOMMON, mage.cards.g.GlimpseOfFreedom.class)); cards.add(new SetCardInfo("Glory Bearers", 17, Rarity.COMMON, mage.cards.g.GloryBearers.class)); cards.add(new SetCardInfo("Grasping Giant", 288, Rarity.RARE, mage.cards.g.GraspingGiant.class)); + cards.add(new SetCardInfo("Gravebreaker Lamia", 98, Rarity.RARE, mage.cards.g.GravebreakerLamia.class)); cards.add(new SetCardInfo("Gray Merchant of Asphodel", 99, Rarity.UNCOMMON, mage.cards.g.GrayMerchantOfAsphodel.class)); cards.add(new SetCardInfo("Grim Physician", 100, Rarity.COMMON, mage.cards.g.GrimPhysician.class)); cards.add(new SetCardInfo("Haktos the Unscarred", 218, Rarity.RARE, mage.cards.h.HaktosTheUnscarred.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java index b4d57f8981..1fd38caa06 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/cost/SpellsCostReductionControllerEffect.java @@ -55,7 +55,8 @@ public class SpellsCostReductionControllerEffect extends CostModificationEffectI this.filter = filter; this.amount = amount; this.upTo = upTo; - this.staticText = filter.getMessage() + " you cast cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; + this.staticText = (filter.getMessage().contains("you cast") ? filter.getMessage() : filter.getMessage() + " you cast") + + " cost " + (upTo ? "up to " : "") + '{' + amount + "} less to cast"; } protected SpellsCostReductionControllerEffect(final SpellsCostReductionControllerEffect effect) { diff --git a/Mage/src/main/java/mage/filter/predicate/other/CastFromZonePredicate.java b/Mage/src/main/java/mage/filter/predicate/other/CastFromZonePredicate.java new file mode 100644 index 0000000000..fa684cf8ac --- /dev/null +++ b/Mage/src/main/java/mage/filter/predicate/other/CastFromZonePredicate.java @@ -0,0 +1,39 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.filter.predicate.other; + +import mage.cards.Card; +import mage.constants.Zone; +import mage.filter.predicate.Predicate; +import mage.game.Game; +import mage.game.stack.Spell; + +/** + * + * @author LevelX2 + */ +public class CastFromZonePredicate implements Predicate { + + private final Zone zone; + + public CastFromZonePredicate(Zone zone) { + this.zone = zone; + } + + @Override + public boolean apply(Card input, Game game) { + if (input instanceof Spell) { + return zone.match(((Spell) input).getFromZone()); + } else { + return zone.match(game.getState().getZone(input.getId())); + } + } + + @Override + public String toString() { + return "Spells you cast from your " + zone.toString(); + } +}