diff --git a/Mage.Sets/src/mage/sets/commander2013/AngelOfFinality.java b/Mage.Sets/src/mage/sets/commander2013/AngelOfFinality.java new file mode 100644 index 00000000000..6bd5c7e0d09 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/AngelOfFinality.java @@ -0,0 +1,72 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.target.TargetPlayer; + +/** + * + * @author LevelX2 + */ +public class AngelOfFinality extends CardImpl { + + public AngelOfFinality(UUID ownerId) { + super(ownerId, 4, "Angel of Finality", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}"); + this.expansionSetCode = "C13"; + this.subtype.add("Angel"); + + this.color.setWhite(true); + this.power = new MageInt(3); + this.toughness = new MageInt(4); + + // Flying + this.addAbility(FlyingAbility.getInstance()); + // When Angel of Finality enters the battlefield, exile all cards from target player's graveyard. + Ability ability = new EntersBattlefieldTriggeredAbility(new ExileGraveyardAllTargetPlayerEffect()); + ability.addTarget(new TargetPlayer(true)); + this.addAbility(ability); + } + + public AngelOfFinality(final AngelOfFinality card) { + super(card); + } + + @Override + public AngelOfFinality copy() { + return new AngelOfFinality(this); + } +} diff --git a/Mage.Sets/src/mage/sets/commander2013/KirtarsWrath.java b/Mage.Sets/src/mage/sets/commander2013/KirtarsWrath.java new file mode 100644 index 00000000000..e7fa6423901 --- /dev/null +++ b/Mage.Sets/src/mage/sets/commander2013/KirtarsWrath.java @@ -0,0 +1,102 @@ +/* + * 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.commander2013; + +import java.util.UUID; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.condition.InvertCondition; +import mage.abilities.condition.common.CardsInControllerGraveCondition; +import mage.abilities.decorator.ConditionalManaEffect; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.BasicManaEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.token.SpiritWhiteToken; + +/** + * + * @author LevelX2 + */ +public class KirtarsWrath extends CardImpl { + + public KirtarsWrath(UUID ownerId) { + super(ownerId, 15, "Kirtar's Wrath", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{W}{W}"); + this.expansionSetCode = "C13"; + + this.color.setWhite(true); + + // Destroy all creatures. They can't be regenerated. + // Threshold - If seven or more cards are in your graveyard, instead destroy all creatures, then put two 1/1 white Spirit creature tokens with flying onto the battlefield. Creatures destroyed this way can't be regenerated. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new KirtarsWrathEffect(), + new DestroyAllEffect(new FilterCreaturePermanent("all creatures"), true), + new CardsInControllerGraveCondition(7), + "Destroy all creatures. They can't be regenerated.

Threshold - If seven or more cards are in your graveyard, instead destroy all creatures, then put two 1/1 white Spirit creature tokens with flying onto the battlefield. Creatures destroyed this way can't be regenerated")); + + } + + public KirtarsWrath(final KirtarsWrath card) { + super(card); + } + + @Override + public KirtarsWrath copy() { + return new KirtarsWrath(this); + } +} + +class KirtarsWrathEffect extends OneShotEffect { + + public KirtarsWrathEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "destroy all creatures, then put two 1/1 white Spirit creature tokens with flying onto the battlefield. Creatures destroyed this way can't be regenerated"; + } + + public KirtarsWrathEffect(final KirtarsWrathEffect effect) { + super(effect); + } + + @Override + public KirtarsWrathEffect copy() { + return new KirtarsWrathEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + new DestroyAllEffect(new FilterCreaturePermanent("all creatures"), true).apply(game, source); + return new CreateTokenEffect(new SpiritWhiteToken(), 2).apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/odyssey/KirtarsWrath.java b/Mage.Sets/src/mage/sets/odyssey/KirtarsWrath.java new file mode 100644 index 00000000000..4c2e450078d --- /dev/null +++ b/Mage.Sets/src/mage/sets/odyssey/KirtarsWrath.java @@ -0,0 +1,52 @@ +/* + * 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.odyssey; + +import java.util.UUID; + +/** + * + * @author LevelX2 + */ +public class KirtarsWrath extends mage.sets.commander2013.KirtarsWrath { + + public KirtarsWrath(UUID ownerId) { + super(ownerId); + this.cardNumber = 28; + this.expansionSetCode = "ODY"; + } + + public KirtarsWrath(final KirtarsWrath card) { + super(card); + } + + @Override + public KirtarsWrath copy() { + return new KirtarsWrath(this); + } +} diff --git a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java index 163ac496edf..a8bc4e1f347 100644 --- a/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java +++ b/Mage.Sets/src/mage/sets/returntoravnica/RakdosCharm.java @@ -27,18 +27,16 @@ */ package mage.sets.returntoravnica; -import java.util.ArrayList; import java.util.UUID; - -import mage.constants.CardType; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.Mode; import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; import mage.cards.CardImpl; +import mage.constants.CardType; import mage.constants.Outcome; +import mage.constants.Rarity; import mage.filter.FilterPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.game.Game; @@ -61,7 +59,7 @@ public class RakdosCharm extends CardImpl { this.color.setRed(true); // Choose one — Exile all cards from target player's graveyard; - this.getSpellAbility().addEffect(new RakdosCharmExileEffect()); + this.getSpellAbility().addEffect(new ExileGraveyardAllTargetPlayerEffect()); this.getSpellAbility().addTarget(new TargetPlayer()); // or destroy target artifact; @@ -119,30 +117,4 @@ public class RakdosCharm extends CardImpl { } } - - class RakdosCharmExileEffect extends OneShotEffect { - - public RakdosCharmExileEffect() { - super(Outcome.Exile); - staticText = "Exile all cards from target player's graveyard"; - } - - @Override - public RakdosCharmExileEffect copy() { - return new RakdosCharmExileEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } - } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/scarsofmirrodin/NihilSpellbomb.java b/Mage.Sets/src/mage/sets/scarsofmirrodin/NihilSpellbomb.java index f37b70e6a94..61e7551117b 100644 --- a/Mage.Sets/src/mage/sets/scarsofmirrodin/NihilSpellbomb.java +++ b/Mage.Sets/src/mage/sets/scarsofmirrodin/NihilSpellbomb.java @@ -27,24 +27,19 @@ */ package mage.sets.scarsofmirrodin; -import java.util.ArrayList; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; -import mage.abilities.Ability; import mage.abilities.common.DiesTriggeredAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.DoIfCostPaid; import mage.abilities.effects.common.DrawCardControllerEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; import mage.cards.CardImpl; -import mage.game.Game; -import mage.players.Player; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.target.TargetPlayer; /** @@ -57,10 +52,12 @@ public class NihilSpellbomb extends CardImpl { super(ownerId, 187, "Nihil Spellbomb", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}"); this.expansionSetCode = "SOM"; - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NihilSpellbombEffect(), new TapSourceCost()); + // {T}, Sacrifice Nihil Spellbomb: Exile all cards from target player's graveyard. + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileGraveyardAllTargetPlayerEffect(), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); + // When Nihil Spellbomb is put into a graveyard from the battlefield, you may pay {B}. If you do, draw a card. this.addAbility(new DiesTriggeredAbility(new DoIfCostPaid(new DrawCardControllerEffect(1), new ManaCostsImpl("{B}")), false)); } @@ -73,30 +70,3 @@ public class NihilSpellbomb extends CardImpl { return new NihilSpellbomb(this); } } - -class NihilSpellbombEffect extends OneShotEffect { - - public NihilSpellbombEffect() { - super(Outcome.Exile); - staticText = "Exile all cards from target player's graveyard"; - } - - @Override - public NihilSpellbombEffect copy() { - return new NihilSpellbombEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/shardsofalara/JundCharm.java b/Mage.Sets/src/mage/sets/shardsofalara/JundCharm.java index e393d842569..6220c8715ac 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/JundCharm.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/JundCharm.java @@ -27,23 +27,17 @@ */ package mage.sets.shardsofalara; -import java.util.ArrayList; import java.util.UUID; - +import mage.abilities.Mode; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; +import mage.abilities.effects.common.counter.AddCountersTargetEffect; +import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Outcome; import mage.constants.Rarity; -import mage.constants.Zone; -import mage.abilities.Ability; -import mage.abilities.Mode; -import mage.abilities.effects.OneShotEffect; -import mage.abilities.effects.common.DamageAllEffect; -import mage.abilities.effects.common.counter.AddCountersTargetEffect; -import mage.cards.CardImpl; import mage.counters.CounterType; import mage.filter.common.FilterCreaturePermanent; -import mage.game.Game; -import mage.players.Player; import mage.target.TargetPlayer; import mage.target.common.TargetCreaturePermanent; @@ -62,7 +56,7 @@ public class JundCharm extends CardImpl { this.color.setBlack(true); // Choose one - Exile all cards from target player's graveyard; - this.getSpellAbility().addEffect(new JundCharmEffect()); + this.getSpellAbility().addEffect(new ExileGraveyardAllTargetPlayerEffect()); this.getSpellAbility().addTarget(new TargetPlayer()); // or Jund Charm deals 2 damage to each creature; Mode mode = new Mode(); @@ -84,29 +78,3 @@ public class JundCharm extends CardImpl { return new JundCharm(this); } } - -class JundCharmEffect extends OneShotEffect { - - public JundCharmEffect() { - super(Outcome.Exile); - staticText = "Exile all cards from target player's graveyard"; - } - - @Override - public JundCharmEffect copy() { - return new JundCharmEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java b/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java index 4e2e2fc9c61..63e3a6f639b 100644 --- a/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java +++ b/Mage.Sets/src/mage/sets/shardsofalara/MightyEmergence.java @@ -82,7 +82,7 @@ class MightyEmergenceTriggeredAbility extends TriggeredAbilityImpl { +class MightyEmergenceAddCountersTargetEffect extends OneShotEffect { - public AddCountersTargetEffect() { + public MightyEmergenceAddCountersTargetEffect() { super(Outcome.Benefit); } - public AddCountersTargetEffect(final AddCountersTargetEffect effect) { + public MightyEmergenceAddCountersTargetEffect(final MightyEmergenceAddCountersTargetEffect effect) { super(effect); } @@ -145,8 +145,8 @@ class AddCountersTargetEffect extends OneShotEffect { } @Override - public AddCountersTargetEffect copy() { - return new AddCountersTargetEffect(this); + public MightyEmergenceAddCountersTargetEffect copy() { + return new MightyEmergenceAddCountersTargetEffect(this); } diff --git a/Mage.Sets/src/mage/sets/timeshifted/TormodsCrypt.java b/Mage.Sets/src/mage/sets/timeshifted/TormodsCrypt.java index fc2694e90ba..34fb98749de 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TormodsCrypt.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TormodsCrypt.java @@ -27,20 +27,15 @@ */ package mage.sets.timeshifted; -import java.util.ArrayList; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; -import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.costs.common.TapSourceCost; -import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; import mage.cards.CardImpl; -import mage.game.Game; -import mage.players.Player; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.target.TargetPlayer; /** @@ -54,7 +49,7 @@ public class TormodsCrypt extends CardImpl { this.expansionSetCode = "TSB"; // {tap}, Sacrifice Tormod's Crypt: Exile all cards from target player's graveyard. - SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TormodsCryptEffect(), new TapSourceCost()); + SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ExileGraveyardAllTargetPlayerEffect(), new TapSourceCost()); ability.addCost(new SacrificeSourceCost()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); @@ -69,29 +64,3 @@ public class TormodsCrypt extends CardImpl { return new TormodsCrypt(this); } } - -class TormodsCryptEffect extends OneShotEffect { - - public TormodsCryptEffect() { - super(Outcome.Exile); - staticText = "Exile all cards from target player's graveyard"; - } - - @Override - public TormodsCryptEffect copy() { - return new TormodsCryptEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } -} diff --git a/Mage.Sets/src/mage/sets/torment/CabalRitual.java b/Mage.Sets/src/mage/sets/torment/CabalRitual.java index 95b4e124219..89bf0a08f61 100644 --- a/Mage.Sets/src/mage/sets/torment/CabalRitual.java +++ b/Mage.Sets/src/mage/sets/torment/CabalRitual.java @@ -28,13 +28,13 @@ package mage.sets.torment; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Rarity; import mage.Mana; import mage.abilities.condition.common.CardsInControllerGraveCondition; -import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.decorator.ConditionalManaEffect; import mage.abilities.effects.common.BasicManaEffect; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; /** * @@ -49,13 +49,12 @@ public class CabalRitual extends CardImpl { this.color.setBlack(true); // Add {B}{B}{B} to your mana pool. - this.getSpellAbility().addEffect(new BasicManaEffect(new Mana(0, 0, 0, 0, 3, 0, 0))); - // Threshold - Add {B}{B}{B}{B}{B} to your mana pool instead if seven or more cards are in your graveyard. - this.getSpellAbility().addEffect(new ConditionalOneShotEffect( - new BasicManaEffect(new Mana(0, 0, 0, 0, 2, 0, 0)), - new CardsInControllerGraveCondition(7), - "Threshold - Add {B}{B}{B}{B}{B} to your mana pool instead if seven or more cards are in your graveyard" - )); + // Threshold — Add {B}{B}{B}{B}{B} to your mana pool instead if seven or more cards are in your graveyard. + this.getSpellAbility().addEffect(new ConditionalManaEffect( + new BasicManaEffect(new Mana(0, 0, 0, 0, 5, 0, 0)), + new BasicManaEffect(new Mana(0, 0, 0, 0, 3, 0, 0)), + new CardsInControllerGraveCondition(7), + "Add {B}{B}{B} to your mana pool.

Threshold - Add {B}{B}{B}{B}{B} to your mana pool instead if seven or more cards are in your graveyard")); } public CabalRitual(final CabalRitual card) { diff --git a/Mage.Sets/src/mage/sets/worldwake/BojukaBog.java b/Mage.Sets/src/mage/sets/worldwake/BojukaBog.java index 7cd56ab50b9..449b44017de 100644 --- a/Mage.Sets/src/mage/sets/worldwake/BojukaBog.java +++ b/Mage.Sets/src/mage/sets/worldwake/BojukaBog.java @@ -29,16 +29,17 @@ package mage.sets.worldwake; import java.util.ArrayList; import java.util.UUID; -import mage.constants.CardType; -import mage.constants.Outcome; -import mage.constants.Rarity; -import mage.constants.Zone; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; import mage.abilities.mana.BlackManaAbility; import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; import mage.game.Game; import mage.players.Player; import mage.target.TargetPlayer; @@ -53,10 +54,13 @@ public class BojukaBog extends CardImpl { super(ownerId, 132, "Bojuka Bog", Rarity.COMMON, new CardType[]{CardType.LAND}, ""); this.expansionSetCode = "WWK"; + // Bojuka Bog enters the battlefield tapped. this.addAbility(new EntersBattlefieldTappedAbility()); - EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new BojukaBogEffect()); + // When Bojuka Bog enters the battlefield, exile all cards from target player's graveyard. + EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new ExileGraveyardAllTargetPlayerEffect()); ability.addTarget(new TargetPlayer()); this.addAbility(ability); + // {T}: Add {B} to your mana pool. this.addAbility(new BlackManaAbility()); } @@ -69,30 +73,3 @@ public class BojukaBog extends CardImpl { return new BojukaBog(this); } } - -class BojukaBogEffect extends OneShotEffect { - - public BojukaBogEffect() { - super(Outcome.Exile); - staticText = "exile all cards from target player's graveyard"; - } - - @Override - public BojukaBogEffect copy() { - return new BojukaBogEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } - -} diff --git a/Mage.Sets/src/mage/sets/zendikar/RavenousTrap.java b/Mage.Sets/src/mage/sets/zendikar/RavenousTrap.java index dc8d94e5d0d..a95bfb13be6 100644 --- a/Mage.Sets/src/mage/sets/zendikar/RavenousTrap.java +++ b/Mage.Sets/src/mage/sets/zendikar/RavenousTrap.java @@ -36,6 +36,7 @@ import mage.abilities.Ability; import mage.abilities.costs.AlternativeCostImpl; import mage.abilities.costs.mana.GenericManaCost; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; import mage.cards.CardImpl; import mage.constants.Outcome; import mage.constants.Zone; @@ -63,7 +64,7 @@ public class RavenousTrap extends CardImpl { this.addWatcher(new CardsPutIntoGraveyardWatcher()); // Exile all cards from target player's graveyard. - this.getSpellAbility().addEffect(new RavenousTrapEffect()); + this.getSpellAbility().addEffect(new ExileGraveyardAllTargetPlayerEffect()); this.getSpellAbility().addTarget(new TargetPlayer()); } @@ -111,30 +112,3 @@ class RavenousTrapAlternativeCost extends AlternativeCostImpl { - - public RavenousTrapEffect() { - super(Outcome.Exile); - staticText = "Exile all cards from target player's graveyard"; - } - - @Override - public RavenousTrapEffect copy() { - return new RavenousTrapEffect(); - } - - @Override - public boolean apply(Game game, Ability source) { - Player targetPlayer = game.getPlayer(source.getFirstTarget()); - if (targetPlayer != null) { - ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); - for (UUID cardId : graveyard) { - game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); - } - return true; - } - return false; - } - -} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/CardsInControllerGraveCondition.java b/Mage/src/mage/abilities/condition/common/CardsInControllerGraveCondition.java index 2c7f5c5c026..355d7b9e06c 100644 --- a/Mage/src/mage/abilities/condition/common/CardsInControllerGraveCondition.java +++ b/Mage/src/mage/abilities/condition/common/CardsInControllerGraveCondition.java @@ -5,14 +5,14 @@ import mage.abilities.condition.Condition; import mage.game.Game; import mage.players.Player; - /** - * Condition for - - * Controller has X or more cards in his or her graveyard - * @author LevelX2 + * Condition for - Controller has X or more cards in his or her graveyard + * + * @author LevelX2 */ public class CardsInControllerGraveCondition implements Condition { - private int value; + + private final int value; public CardsInControllerGraveCondition(int value) { this.value = value; @@ -20,11 +20,7 @@ public class CardsInControllerGraveCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - Player p = game.getPlayer(source.getControllerId()); - if (p != null && p.getGraveyard().size() >= value) - { - return true; - } - return false; + Player player = game.getPlayer(source.getControllerId()); + return player != null && player.getGraveyard().size() >= value; } } diff --git a/Mage/src/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java b/Mage/src/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java new file mode 100644 index 00000000000..2e2d7601591 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/ExileGraveyardAllTargetPlayerEffect.java @@ -0,0 +1,69 @@ +/* + * 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.abilities.effects.common; + +import java.util.ArrayList; +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; + +/** + * + * @author LevelX2 + */ + +public class ExileGraveyardAllTargetPlayerEffect extends OneShotEffect { + + public ExileGraveyardAllTargetPlayerEffect() { + super(Outcome.Exile); + staticText = "exile all cards from target player's graveyard"; + } + + @Override + public ExileGraveyardAllTargetPlayerEffect copy() { + return new ExileGraveyardAllTargetPlayerEffect(); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(this.getTargetPointer().getFirst(game, source)); + if (targetPlayer != null) { + ArrayList graveyard = new ArrayList(targetPlayer.getGraveyard()); + for (UUID cardId : graveyard) { + game.getCard(cardId).moveToZone(Zone.EXILED, cardId, game, false); + } + return true; + } + return false; + } +} diff --git a/Mage/src/mage/players/PlayerImpl.java b/Mage/src/mage/players/PlayerImpl.java index d045cb2ef78..f1b010a4184 100644 --- a/Mage/src/mage/players/PlayerImpl.java +++ b/Mage/src/mage/players/PlayerImpl.java @@ -920,9 +920,11 @@ public abstract class PlayerImpl> implements Player, Ser } if (zone != Zone.HAND) { if (zone != Zone.BATTLEFIELD && game.getContinuousEffects().asThough(object.getId(), AsThoughEffectType.CAST, game)) { - for (ActivatedAbility ability: object.getAbilities().getActivatedAbilities(Zone.HAND)) { + for (Ability ability: object.getAbilities()) { ability.setControllerId(this.getId()); - useable.put(ability.getId(), ability); + if (ability instanceof ActivatedAbility && ability.getZone().match(Zone.HAND)) { + useable.put(ability.getId(), (ActivatedAbility) ability); + } } } } @@ -1755,8 +1757,9 @@ public abstract class PlayerImpl> implements Player, Ser for (ExileZone exile: game.getExile().getExileZones()) { for (Card card: exile.getCards(game)) { if (game.getContinuousEffects().asThough(card.getId(), AsThoughEffectType.CAST, game)) { - for (ActivatedAbility ability: card.getAbilities().getActivatedAbilities(Zone.HAND)) { - if (ability instanceof SpellAbility || ability instanceof PlayLandAbility) { + for (Ability ability: card.getAbilities()) { + ability.setControllerId(this.getId()); // controller must be set for case owner != caster + if (ability.getZone().match(Zone.HAND) && (ability instanceof SpellAbility || ability instanceof PlayLandAbility)) { playable.add(ability); } }