From 031a307382c82f4d805383cd0201a99091dccf62 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 25 Oct 2014 01:30:14 +0200 Subject: [PATCH] [BOK] Added 4 black cards. --- .../betrayersofkamigawa/CallForBlood.java | 110 +++++++++++++++++ .../betrayersofkamigawa/OgreMarauder.java | 114 +++++++++++++++++ .../betrayersofkamigawa/StirTheGrave.java | 77 ++++++++++++ .../YukoraThePrisoner.java | 116 ++++++++++++++++++ .../mage/sets/nemesis/DeathPitOffering.java | 43 ++++++- .../sets/newphyrexia/PostmortemLunge.java | 33 +++-- 6 files changed, 471 insertions(+), 22 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/betrayersofkamigawa/CallForBlood.java create mode 100644 Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java create mode 100644 Mage.Sets/src/mage/sets/betrayersofkamigawa/StirTheGrave.java create mode 100644 Mage.Sets/src/mage/sets/betrayersofkamigawa/YukoraThePrisoner.java diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/CallForBlood.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/CallForBlood.java new file mode 100644 index 00000000000..ad4f4008a70 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/CallForBlood.java @@ -0,0 +1,110 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.betrayersofkamigawa; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continious.BoostTargetEffect; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class CallForBlood extends CardImpl { + + public CallForBlood(UUID ownerId) { + super(ownerId, 63, "Call for Blood", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{B}"); + this.expansionSetCode = "BOK"; + this.subtype.add("Arcane"); + + this.color.setBlack(true); + + // As an additional cost to cast Call for Blood, sacrifice a creature. + this.getSpellAbility().addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent())); + // Target creature gets -X/-X until end of turn, where X is the sacrificed creature's power. + DynamicValue xValue = new CallForBloodDynamicValue(); + this.getSpellAbility().addEffect(new BoostTargetEffect(xValue, xValue, Duration.EndOfTurn, true)); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + } + + public CallForBlood(final CallForBlood card) { + super(card); + } + + @Override + public CallForBlood copy() { + return new CallForBlood(this); + } +} + +class CallForBloodDynamicValue implements DynamicValue { + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Card sourceCard = game.getCard(sourceAbility.getSourceId()); + if (sourceCard != null) { + for (Object cost: sourceAbility.getCosts()) { + if (cost instanceof SacrificeTargetCost) { + Permanent p = (Permanent) game.getLastKnownInformation(((SacrificeTargetCost) cost).getPermanents().get(0).getId(), Zone.BATTLEFIELD); + if (p != null) { + return -1 * p.getPower().getValue(); + } + } + } + } + return 0; + } + + @Override + public CallForBloodDynamicValue copy() { + return this; + } + + @Override + public String getMessage() { + return ", where X is the sacrificed creature's power"; + } + + @Override + public String toString() { + return "-X"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java new file mode 100644 index 00000000000..510fefef29a --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/OgreMarauder.java @@ -0,0 +1,114 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.betrayersofkamigawa; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObject; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.combat.UnblockableSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetControlledCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class OgreMarauder extends CardImpl { + + public OgreMarauder(UUID ownerId) { + super(ownerId, 75, "Ogre Marauder", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{B}{B}"); + this.expansionSetCode = "BOK"; + this.subtype.add("Ogre"); + this.subtype.add("Warrior"); + + this.color.setBlack(true); + this.power = new MageInt(3); + this.toughness = new MageInt(1); + + // Whenever Ogre Marauder attacks, it gains "Ogre Marauder is unblockable" until end of turn unless defending player sacrifices a creature. + this.addAbility(new AttacksTriggeredAbility(new OgreMarauderEffect(), false)); + } + + public OgreMarauder(final OgreMarauder card) { + super(card); + } + + @Override + public OgreMarauder copy() { + return new OgreMarauder(this); + } +} + +class OgreMarauderEffect extends OneShotEffect { + + public OgreMarauderEffect() { + super(Outcome.Benefit); + this.staticText = "it gains \"{this} is unblockable\" until end of turn unless defending player sacrifices a creature"; + } + + public OgreMarauderEffect(final OgreMarauderEffect effect) { + super(effect); + } + + @Override + public OgreMarauderEffect copy() { + return new OgreMarauderEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID defendingPlayerId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game); + MageObject sourceObject = game.getObject(source.getSourceId()); + Player defender = game.getPlayer(defendingPlayerId); + if (defender != null && sourceObject != null) { + Cost cost = new SacrificeTargetCost(new TargetControlledCreaturePermanent()); + if (cost.canPay(source, source.getSourceId(), defendingPlayerId, game) && + defender.chooseUse(Outcome.LoseAbility, "Sacrifice a creature to prevent " + sourceObject.getLogName() + " from getting unblockable?", game)) { + if (!cost.pay(source, game, source.getSourceId(), defendingPlayerId, false)) { + // cost was not payed - so source gets unblockable + ContinuousEffect effect = new UnblockableSourceEffect(Duration.EndOfTurn); + game.addEffect(effect, source); + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/StirTheGrave.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/StirTheGrave.java new file mode 100644 index 00000000000..7d34e14ab02 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/StirTheGrave.java @@ -0,0 +1,77 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.betrayersofkamigawa; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.Filter; +import mage.filter.FilterCard; +import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; +import mage.game.Game; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author LevelX2 + */ +public class StirTheGrave extends CardImpl { + + public StirTheGrave(UUID ownerId) { + super(ownerId, 85, "Stir the Grave", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{X}{B}"); + this.expansionSetCode = "BOK"; + + this.color.setBlack(true); + + // Return target creature card with converted mana cost X or less from your graveyard to the battlefield. + this.getSpellAbility().addEffect(new ReturnFromGraveyardToBattlefieldTargetEffect()); + this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); + } + + @Override + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + int xValue = ability.getManaCostsToPay().getX(); + FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard"); + filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue + 1)); + ability.getTargets().add(new TargetCardInYourGraveyard(filter)); + } + + public StirTheGrave(final StirTheGrave card) { + super(card); + } + + @Override + public StirTheGrave copy() { + return new StirTheGrave(this); + } +} diff --git a/Mage.Sets/src/mage/sets/betrayersofkamigawa/YukoraThePrisoner.java b/Mage.Sets/src/mage/sets/betrayersofkamigawa/YukoraThePrisoner.java new file mode 100644 index 00000000000..26cd7fc1bc8 --- /dev/null +++ b/Mage.Sets/src/mage/sets/betrayersofkamigawa/YukoraThePrisoner.java @@ -0,0 +1,116 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.betrayersofkamigawa; + +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author LevelX2 + */ +public class YukoraThePrisoner extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Ogre creatures"); + + static { + filter.add(Predicates.not(new SubtypePredicate("Ogre"))); + } + + public YukoraThePrisoner(UUID ownerId) { + super(ownerId, 90, "Yukora, the Prisoner", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{B}{B}"); + this.expansionSetCode = "BOK"; + this.supertype.add("Legendary"); + this.subtype.add("Demon"); + this.subtype.add("Spirit"); + + this.color.setBlack(true); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // When Yukora, the Prisoner leaves the battlefield, sacrifice all non-Ogre creatures you control. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new YukoraThePrisonerEffect(), false)); + + } + + public YukoraThePrisoner(final YukoraThePrisoner card) { + super(card); + } + + @Override + public YukoraThePrisoner copy() { + return new YukoraThePrisoner(this); + } +} + +class YukoraThePrisonerEffect extends OneShotEffect { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("non-Ogre creatures"); + + static { + filter.add(Predicates.not(new SubtypePredicate("Ogre"))); + } + + public YukoraThePrisonerEffect() { + super(Outcome.Sacrifice); + this.staticText = "sacrifice all non-Ogre creatures you control"; + } + + public YukoraThePrisonerEffect(final YukoraThePrisonerEffect effect) { + super(effect); + } + + @Override + public YukoraThePrisonerEffect copy() { + return new YukoraThePrisonerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List permanents = game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game); + for (Permanent permanent : permanents) { + permanent.sacrifice(source.getSourceId(), game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/nemesis/DeathPitOffering.java b/Mage.Sets/src/mage/sets/nemesis/DeathPitOffering.java index 23854137fa7..b2871073f25 100644 --- a/Mage.Sets/src/mage/sets/nemesis/DeathPitOffering.java +++ b/Mage.Sets/src/mage/sets/nemesis/DeathPitOffering.java @@ -27,17 +27,24 @@ */ package mage.sets.nemesis; +import java.util.List; import java.util.UUID; - -import mage.constants.*; +import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.common.SacrificeAllEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continious.BoostAllEffect; import mage.cards.CardImpl; -import mage.filter.common.FilterControlledCreaturePermanent; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; /** * @@ -58,7 +65,7 @@ public class DeathPitOffering extends CardImpl { this.color.setBlack(true); // When Death Pit Offering enters the battlefield, sacrifice all creatures you control. - this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeAllEffect(new FilterControlledCreaturePermanent()))); + this.addAbility(new EntersBattlefieldTriggeredAbility(new DeathPitOfferingEffect())); // Creatures you control get +2/+2. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(2, 2, Duration.WhileOnBattlefield, filter, false))); } @@ -72,3 +79,29 @@ public class DeathPitOffering extends CardImpl { return new DeathPitOffering(this); } } + +class DeathPitOfferingEffect extends OneShotEffect { + + public DeathPitOfferingEffect() { + super(Outcome.Sacrifice); + this.staticText = "sacrifice all creatures you control"; + } + + public DeathPitOfferingEffect(final DeathPitOfferingEffect effect) { + super(effect); + } + + @Override + public DeathPitOfferingEffect copy() { + return new DeathPitOfferingEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + List permanents = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game); + for (Permanent permanent : permanents) { + permanent.sacrifice(source.getSourceId(), game); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PostmortemLunge.java b/Mage.Sets/src/mage/sets/newphyrexia/PostmortemLunge.java index a37c08296c9..5961efd53be 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PostmortemLunge.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PostmortemLunge.java @@ -35,15 +35,15 @@ import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.DelayedTriggeredAbility; import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; -import mage.abilities.costs.VariableCost; -import mage.abilities.costs.mana.GenericManaCost; -import mage.abilities.costs.mana.ManaCost; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.ExileTargetEffect; import mage.abilities.keyword.HasteAbility; import mage.cards.Card; import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.filter.FilterCard; import mage.filter.common.FilterCreatureCard; +import mage.filter.predicate.mageobject.ConvertedManaCostPredicate; import mage.game.Game; import mage.players.Player; import mage.target.common.TargetCardInYourGraveyard; @@ -61,6 +61,7 @@ public class PostmortemLunge extends CardImpl { this.color.setBlack(true); + // Return target creature card with converted mana cost X from your graveyard to the battlefield. It gains haste. Exile it at the beginning of the next end step. this.getSpellAbility().addEffect(new PostmortemLungeEffect()); this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard"))); } @@ -75,18 +76,12 @@ public class PostmortemLunge extends CardImpl { } @Override - public void adjustCosts(Ability ability, Game game) { - Card card = game.getCard(ability.getFirstTarget()); - if (card != null) { - // insert at the beginning (so it will be {2}{B}, not {B}{2}) - ability.getManaCostsToPay().add(0, new GenericManaCost(card.getManaCost().convertedManaCost())); - } - // no {X} anymore as we already have chosen the target with defined manacost - for (ManaCost cost : ability.getManaCostsToPay()) { - if (cost instanceof VariableCost) { - cost.setPaid(); - } - } + public void adjustTargets(Ability ability, Game game) { + ability.getTargets().clear(); + int xValue = ability.getManaCostsToPay().getX(); + FilterCard filter = new FilterCreatureCard("creature card with converted mana cost " + xValue + " or less from your graveyard"); + filter.add(new ConvertedManaCostPredicate(Filter.ComparisonType.LessThan, xValue + 1)); + ability.getTargets().add(new TargetCardInYourGraveyard(filter)); } } @@ -109,8 +104,12 @@ class PostmortemLungeEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { Card card = game.getCard(source.getFirstTarget()); - Player player = game.getPlayer(card.getOwnerId()); - if (card != null && player != null) { + + if (card != null) { + Player player = game.getPlayer(card.getOwnerId()); + if (player == null) { + return false; + } card.addAbility(HasteAbility.getInstance()); card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), source.getControllerId());