From 87e21dadaaef6e48a514e25f9212b996bd34f95e Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sat, 28 Jun 2014 17:56:38 +0200 Subject: [PATCH] * Chorid - Fixed handling of cost to pay. --- .../src/mage/sets/darksteel/Soulscour.java | 52 ++++--------------- .../mage/sets/eventide/CreakwoodLiege.java | 10 ++-- .../src/mage/sets/theros/DaxosOfMeletis.java | 44 +++++++++------- Mage.Sets/src/mage/sets/torment/Ichorid.java | 21 ++++---- 4 files changed, 49 insertions(+), 78 deletions(-) diff --git a/Mage.Sets/src/mage/sets/darksteel/Soulscour.java b/Mage.Sets/src/mage/sets/darksteel/Soulscour.java index 7fb1bcb3b0..d1220d07b5 100644 --- a/Mage.Sets/src/mage/sets/darksteel/Soulscour.java +++ b/Mage.Sets/src/mage/sets/darksteel/Soulscour.java @@ -29,18 +29,13 @@ package mage.sets.darksteel; import java.util.UUID; - +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.CardImpl; -import mage.constants.Outcome; import mage.filter.FilterPermanent; import mage.filter.predicate.Predicates; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.game.Game; -import mage.game.permanent.Permanent; /** * @@ -48,11 +43,19 @@ import mage.game.permanent.Permanent; */ public class Soulscour extends CardImpl { + private static final FilterPermanent filter = new FilterPermanent("nonartifact permanents"); + + static { + filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT))); + } + public Soulscour (UUID ownerId) { super(ownerId, 14, "Soulscour", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{7}{W}{W}{W}"); this.expansionSetCode = "DST"; this.color.setWhite(true); - this.getSpellAbility().addEffect(new SoulscourEffect()); + + // Destroy all nonartifact permanents. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); } public Soulscour (final Soulscour card) { @@ -65,36 +68,3 @@ public class Soulscour extends CardImpl { } } - - -class SoulscourEffect extends OneShotEffect { - - private static final FilterPermanent filter = new FilterPermanent(""); - - static { - filter.add(Predicates.not(new CardTypePredicate(CardType.ARTIFACT))); - } - - public SoulscourEffect() { - super(Outcome.DestroyPermanent); - staticText = "Destroy all nonartifact permanents"; - } - - public SoulscourEffect(final SoulscourEffect effect) { - super(effect); - } - - @Override - public boolean apply(Game game, Ability source) { - for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { - permanent.destroy(source.getId(), game, false); - } - return true; - } - - @Override - public SoulscourEffect copy() { - return new SoulscourEffect(this); - } - -} diff --git a/Mage.Sets/src/mage/sets/eventide/CreakwoodLiege.java b/Mage.Sets/src/mage/sets/eventide/CreakwoodLiege.java index e260d8c63c..9e45d90766 100644 --- a/Mage.Sets/src/mage/sets/eventide/CreakwoodLiege.java +++ b/Mage.Sets/src/mage/sets/eventide/CreakwoodLiege.java @@ -51,12 +51,12 @@ import mage.game.permanent.token.Token; public class CreakwoodLiege extends CardImpl { private static final FilterCreaturePermanent filterBlackCreature = new FilterCreaturePermanent("black creatures"); - private static final FilterCreaturePermanent filterGreenCreature = new FilterCreaturePermanent("green creatures"); + private static final FilterCreaturePermanent filterGreenCreature = new FilterCreaturePermanent("green creatures"); - static { - filterBlackCreature.add(new ColorPredicate(ObjectColor.BLACK)); - filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN)); - } + static { + filterBlackCreature.add(new ColorPredicate(ObjectColor.BLACK)); + filterGreenCreature.add(new ColorPredicate(ObjectColor.GREEN)); + } public CreakwoodLiege(UUID ownerId) { diff --git a/Mage.Sets/src/mage/sets/theros/DaxosOfMeletis.java b/Mage.Sets/src/mage/sets/theros/DaxosOfMeletis.java index 14e513ae20..37455a10ba 100644 --- a/Mage.Sets/src/mage/sets/theros/DaxosOfMeletis.java +++ b/Mage.Sets/src/mage/sets/theros/DaxosOfMeletis.java @@ -29,6 +29,7 @@ package mage.sets.theros; import java.util.UUID; import mage.MageInt; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -108,28 +109,31 @@ class DaxosOfMeletisEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { - Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); - if (damagedPlayer != null) { - Player controller = game.getPlayer(source.getControllerId()); - UUID exileId = CardUtil.getCardExileZoneId(game, source); - Card card = damagedPlayer.getLibrary().getFromTop(game); - if (card != null && controller != null) { - // move card to exile - card.moveToExile(exileId, "Daxos of Meletis", source.getSourceId(), game); - // player gains life - int cmc = card.getManaCost().convertedManaCost(); - if (cmc > 0) { - controller.gainLife(cmc, game); - } - // Add effects only if the card has a spellAbility (e.g. not for lands). - if (card.getSpellAbility() != null) { - // allow to cast the card - game.addEffect(new DaxosOfMeletisCastFromExileEffect(card.getId(), exileId), source); - // and you may spend mana as though it were mana of any color to cast it - game.addEffect(new DaxosOfMeletisSpendAnyManaEffect(card.getId()), source); + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Player damagedPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (damagedPlayer != null) { + MageObject sourceObject = game.getObject(source.getSourceId()); + UUID exileId = CardUtil.getCardExileZoneId(game, source); + Card card = damagedPlayer.getLibrary().getFromTop(game); + if (card != null) { + // move card to exile + controller.moveCardToExileWithInfo(card, exileId, sourceObject.getLogName(), source.getSourceId(), game, Zone.LIBRARY); + // player gains life + int cmc = card.getManaCost().convertedManaCost(); + if (cmc > 0) { + controller.gainLife(cmc, game); + } + // Add effects only if the card has a spellAbility (e.g. not for lands). + if (card.getSpellAbility() != null) { + // allow to cast the card + game.addEffect(new DaxosOfMeletisCastFromExileEffect(card.getId(), exileId), source); + // and you may spend mana as though it were mana of any color to cast it + game.addEffect(new DaxosOfMeletisSpendAnyManaEffect(card.getId()), source); + } } + return true; } - return true; } return false; } diff --git a/Mage.Sets/src/mage/sets/torment/Ichorid.java b/Mage.Sets/src/mage/sets/torment/Ichorid.java index e38cb8b46a..ab02a3e834 100644 --- a/Mage.Sets/src/mage/sets/torment/Ichorid.java +++ b/Mage.Sets/src/mage/sets/torment/Ichorid.java @@ -34,6 +34,7 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; import mage.abilities.costs.common.ExileFromGraveCost; +import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect; import mage.abilities.effects.common.SacrificeSourceEffect; import mage.abilities.keyword.HasteAbility; @@ -71,13 +72,10 @@ public class Ichorid extends CardImpl { // At the beginning of the end step, sacrifice Ichorid. this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new SacrificeSourceEffect(), false)); // At the beginning of your upkeep, if Ichorid is in your graveyard, you may exile a black creature card other than Ichorid from your graveyard. If you do, return Ichorid to the battlefield. - Ability ability = new IchoridTriggerdAbility(); - FilterCard filter = new FilterCreatureCard("an other black creature card from your graveyard"); + FilterCard filter = new FilterCreatureCard("a black creature card other than Ichorid from your graveyard"); filter.add(Predicates.not(new CardIdPredicate(this.getId()))); filter.add(new ColorPredicate(ObjectColor.BLACK)); - TargetCardInYourGraveyard target = new TargetCardInYourGraveyard(filter); - target.setRequired(false); - ability.addCost(new ExileFromGraveCost(target)); + Ability ability = new IchoridTriggerdAbility(filter); this.addAbility(ability); } @@ -93,9 +91,11 @@ public class Ichorid extends CardImpl { } class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{ - - public IchoridTriggerdAbility(){ - super(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, false); + + public IchoridTriggerdAbility(FilterCard filter){ + super(Zone.GRAVEYARD, + new DoIfCostPaid(new ReturnSourceFromGraveyardToBattlefieldEffect(), new ExileFromGraveCost(new TargetCardInYourGraveyard(filter))), + TargetController.YOU, false); } public IchoridTriggerdAbility(IchoridTriggerdAbility ability) { @@ -107,7 +107,6 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{ return new IchoridTriggerdAbility(this); } - @Override public boolean checkInterveningIfClause(Game game) { Player controller = game.getPlayer(controllerId); @@ -122,6 +121,4 @@ class IchoridTriggerdAbility extends BeginningOfUpkeepTriggeredAbility{ return "At the beginning of your upkeep, if {source} is in your graveyard, you may exile a black creature card other than {source} from your graveyard. If you do, return {source} to the battlefield"; } - - -} \ No newline at end of file +}