From 09a4267a46ccad004a95cb03d032ed90aa1be268 Mon Sep 17 00:00:00 2001 From: emerald000 Date: Sun, 24 May 2015 16:57:12 -0400 Subject: [PATCH] Added Boiling Seas, Cephalid Constable, Devastating Dreams and Life and Limb. --- .../mage/sets/judgment/CephalidConstable.java | 115 +++++++++++++ .../mage/sets/ninthedition/BoilingSeas.java | 65 +++++++ .../mage/sets/planarchaos/LifeAndLimb.java | 158 ++++++++++++++++++ .../src/mage/sets/portal/BoilingSeas.java | 52 ++++++ .../sets/tenthedition/CephalidConstable.java | 52 ++++++ .../mage/sets/torment/DevastatingDreams.java | 109 ++++++++++++ .../effects/common/SacrificeAllEffect.java | 4 +- 7 files changed, 553 insertions(+), 2 deletions(-) create mode 100644 Mage.Sets/src/mage/sets/judgment/CephalidConstable.java create mode 100644 Mage.Sets/src/mage/sets/ninthedition/BoilingSeas.java create mode 100644 Mage.Sets/src/mage/sets/planarchaos/LifeAndLimb.java create mode 100644 Mage.Sets/src/mage/sets/portal/BoilingSeas.java create mode 100644 Mage.Sets/src/mage/sets/tenthedition/CephalidConstable.java create mode 100644 Mage.Sets/src/mage/sets/torment/DevastatingDreams.java diff --git a/Mage.Sets/src/mage/sets/judgment/CephalidConstable.java b/Mage.Sets/src/mage/sets/judgment/CephalidConstable.java new file mode 100644 index 00000000000..0d3f8629c7d --- /dev/null +++ b/Mage.Sets/src/mage/sets/judgment/CephalidConstable.java @@ -0,0 +1,115 @@ +/* + * 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.judgment; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.ReturnToHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; +import mage.game.events.DamagedPlayerEvent; +import mage.game.events.GameEvent; +import mage.target.Target; +import mage.target.TargetPermanent; + +/** + * + * @author emerald000 + */ +public class CephalidConstable extends CardImpl { + + public CephalidConstable(UUID ownerId) { + super(ownerId, 35, "Cephalid Constable", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{U}{U}"); + this.expansionSetCode = "JUD"; + this.subtype.add("Cephalid"); + this.subtype.add("Wizard"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Cephalid Constable deals combat damage to a player, return up to that many target permanents that player controls to their owners' hands. + Ability ability = new CephalidConstableTriggeredAbility(); + ability.addTarget(new TargetPermanent(0, 1, new FilterPermanent(), false)); // Ajusted when it triggers. + this.addAbility(ability); + } + + public CephalidConstable(final CephalidConstable card) { + super(card); + } + + @Override + public CephalidConstable copy() { + return new CephalidConstable(this); + } +} + +class CephalidConstableTriggeredAbility extends TriggeredAbilityImpl { + + CephalidConstableTriggeredAbility() { + super(Zone.BATTLEFIELD, new ReturnToHandTargetEffect(), false); + } + + CephalidConstableTriggeredAbility(final CephalidConstableTriggeredAbility ability) { + super(ability); + } + + @Override + public CephalidConstableTriggeredAbility copy() { + return new CephalidConstableTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DAMAGED_PLAYER; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getSourceId().equals(this.sourceId) && ((DamagedPlayerEvent) event).isCombatDamage()) { + FilterPermanent filter = new FilterPermanent("permanent" + (event.getAmount() > 1 ? "s" : "") + " damaged player control"); + filter.add(new ControllerIdPredicate(event.getPlayerId())); + Target target = new TargetPermanent(0, event.getAmount(), filter, false); + this.getTargets().clear(); + this.getTargets().add(target); + return true; + } + return false; + } + + @Override + public String getRule() { + return "Whenever {this} deals combat damage to a player, return up to that many target permanents that player controls to their owners' hands"; + } + +} diff --git a/Mage.Sets/src/mage/sets/ninthedition/BoilingSeas.java b/Mage.Sets/src/mage/sets/ninthedition/BoilingSeas.java new file mode 100644 index 00000000000..c78108a055d --- /dev/null +++ b/Mage.Sets/src/mage/sets/ninthedition/BoilingSeas.java @@ -0,0 +1,65 @@ +/* + * 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.ninthedition; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @author emerald000 + */ +public class BoilingSeas extends CardImpl { + + private static final FilterPermanent filter = new FilterPermanent("Islands"); + static { + filter.add(new SubtypePredicate("Island")); + } + + public BoilingSeas(UUID ownerId) { + super(ownerId, 178, "Boiling Seas", Rarity.UNCOMMON, new CardType[]{CardType.SORCERY}, "{3}{R}"); + this.expansionSetCode = "9ED"; + + // Destroy all Islands. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + } + + public BoilingSeas(final BoilingSeas card) { + super(card); + } + + @Override + public BoilingSeas copy() { + return new BoilingSeas(this); + } +} diff --git a/Mage.Sets/src/mage/sets/planarchaos/LifeAndLimb.java b/Mage.Sets/src/mage/sets/planarchaos/LifeAndLimb.java new file mode 100644 index 00000000000..ef75978269e --- /dev/null +++ b/Mage.Sets/src/mage/sets/planarchaos/LifeAndLimb.java @@ -0,0 +1,158 @@ +/* + * 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.planarchaos; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.mana.GreenManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import static mage.constants.Layer.AbilityAddingRemovingEffects_6; +import static mage.constants.Layer.PTChangingEffects_7; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author emerald000 + */ +public class LifeAndLimb extends CardImpl { + + public LifeAndLimb(UUID ownerId) { + super(ownerId, 133, "Life and Limb", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); + this.expansionSetCode = "PLC"; + + // All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LifeAndLimbEffect())); + } + + public LifeAndLimb(final LifeAndLimb card) { + super(card); + } + + @Override + public LifeAndLimb copy() { + return new LifeAndLimb(this); + } +} + +class LifeAndLimbEffect extends ContinuousEffectImpl { + + private static final FilterPermanent filter = new FilterPermanent("All Forests and all Saprolings"); + static { + filter.add(Predicates.or(new SubtypePredicate("Forest"), new SubtypePredicate("Saproling"))); + } + + LifeAndLimbEffect() { + super(Duration.WhileOnBattlefield, Outcome.Neutral); + staticText = "All Forests and all Saprolings are 1/1 green Saproling creatures and Forest lands in addition to their other types"; + } + + LifeAndLimbEffect(final LifeAndLimbEffect effect) { + super(effect); + } + + @Override + public LifeAndLimbEffect copy() { + return new LifeAndLimbEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + Player player = game.getPlayer(source.getControllerId()); + if (player != null) { + for (Permanent permanent : game.getState().getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) { + switch (layer) { + case TypeChangingEffects_4: + if (!permanent.getCardType().contains(CardType.CREATURE)) { + permanent.getCardType().add(CardType.CREATURE); + } + if (!permanent.getSubtype().contains("Saproling")) { + permanent.getSubtype().add("Saproling"); + } + if (!permanent.getCardType().contains(CardType.LAND)) { + permanent.getCardType().add(CardType.LAND); + } + if (!permanent.getSubtype().contains("Forest")) { + permanent.getSubtype().add("Forest"); + } + break; + case ColorChangingEffects_5: + permanent.getColor().setColor(ObjectColor.GREEN); + break; + case AbilityAddingRemovingEffects_6: + boolean flag = false; + for (Ability ability : permanent.getAbilities(game)) { + if (ability instanceof GreenManaAbility) { + flag = true; + break; + } + } + if (!flag) { + permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game); + } + break; + case PTChangingEffects_7: + if (sublayer.equals(SubLayer.SetPT_7b)) { + permanent.getPower().setValue(1); + permanent.getToughness().setValue(1); + } + break; + } + } + return true; + } + return false; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.TypeChangingEffects_4 + || layer == Layer.ColorChangingEffects_5 + || layer == Layer.AbilityAddingRemovingEffects_6 + || layer == Layer.PTChangingEffects_7; + } +} diff --git a/Mage.Sets/src/mage/sets/portal/BoilingSeas.java b/Mage.Sets/src/mage/sets/portal/BoilingSeas.java new file mode 100644 index 00000000000..a2c29bcea6f --- /dev/null +++ b/Mage.Sets/src/mage/sets/portal/BoilingSeas.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.portal; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class BoilingSeas extends mage.sets.ninthedition.BoilingSeas { + + public BoilingSeas(UUID ownerId) { + super(ownerId); + this.cardNumber = 124; + this.expansionSetCode = "POR"; + } + + public BoilingSeas(final BoilingSeas card) { + super(card); + } + + @Override + public BoilingSeas copy() { + return new BoilingSeas(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tenthedition/CephalidConstable.java b/Mage.Sets/src/mage/sets/tenthedition/CephalidConstable.java new file mode 100644 index 00000000000..fbc5884eec5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tenthedition/CephalidConstable.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.tenthedition; + +import java.util.UUID; + +/** + * + * @author emerald000 + */ +public class CephalidConstable extends mage.sets.judgment.CephalidConstable { + + public CephalidConstable(UUID ownerId) { + super(ownerId); + this.cardNumber = 72; + this.expansionSetCode = "10E"; + } + + public CephalidConstable(final CephalidConstable card) { + super(card); + } + + @Override + public CephalidConstable copy() { + return new CephalidConstable(this); + } +} diff --git a/Mage.Sets/src/mage/sets/torment/DevastatingDreams.java b/Mage.Sets/src/mage/sets/torment/DevastatingDreams.java new file mode 100644 index 00000000000..55a583904f9 --- /dev/null +++ b/Mage.Sets/src/mage/sets/torment/DevastatingDreams.java @@ -0,0 +1,109 @@ +/* + * 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.torment; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.Cost; +import mage.abilities.costs.VariableCostImpl; +import mage.abilities.costs.common.DiscardTargetCost; +import mage.abilities.dynamicvalue.common.GetXValue; +import mage.abilities.effects.common.DamageAllEffect; +import mage.abilities.effects.common.SacrificeAllEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.common.FilterControlledLandPermanent; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.players.Player; +import mage.target.common.TargetCardInHand; + +/** + * + * @author emerald000 + */ +public class DevastatingDreams extends CardImpl { + + public DevastatingDreams(UUID ownerId) { + super(ownerId, 95, "Devastating Dreams", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{R}{R}"); + this.expansionSetCode = "TOR"; + + // As an additional cost to cast Devastating Dreams, discard X cards at random. + this.getSpellAbility().addCost(new DevastatingDreamsAdditionalCost()); + + // Each player sacrifices X lands. + this.getSpellAbility().addEffect(new SacrificeAllEffect(new GetXValue(), new FilterControlledLandPermanent("lands"))); + + // Devastating Dreams deals X damage to each creature. + this.getSpellAbility().addEffect(new DamageAllEffect(new GetXValue(), new FilterCreaturePermanent())); + } + + public DevastatingDreams(final DevastatingDreams card) { + super(card); + } + + @Override + public DevastatingDreams copy() { + return new DevastatingDreams(this); + } +} + +class DevastatingDreamsAdditionalCost extends VariableCostImpl { + + DevastatingDreamsAdditionalCost() { + super("cards to discard randomly"); + this.text = "As an additional cost to cast {this}, discard X cards at random"; + } + + DevastatingDreamsAdditionalCost(final DevastatingDreamsAdditionalCost cost) { + super(cost); + } + + @Override + public DevastatingDreamsAdditionalCost copy() { + return new DevastatingDreamsAdditionalCost(this); + } + + @Override + public int getMaxValue(Ability source, Game game) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + return controller.getHand().size(); + } + return 0; + } + + @Override + public Cost getFixedCostsFromAnnouncedValue(int xValue) { + TargetCardInHand target = new TargetCardInHand(xValue, new FilterCard()); + return new DiscardTargetCost(target, true); + } +} + diff --git a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java index 57a93b530df..12ca8a7485a 100644 --- a/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java +++ b/Mage/src/mage/abilities/effects/common/SacrificeAllEffect.java @@ -31,11 +31,11 @@ package mage.abilities.effects.common; import java.util.ArrayList; import java.util.List; import java.util.UUID; -import mage.constants.Outcome; import mage.abilities.Ability; import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.OneShotEffect; +import mage.constants.Outcome; import mage.filter.common.FilterControlledPermanent; import mage.game.Game; import mage.game.permanent.Permanent; @@ -110,7 +110,7 @@ public class SacrificeAllEffect extends OneShotEffect { private void setText() { StringBuilder sb = new StringBuilder(); - sb.append("Each players sacrifices "); + sb.append("Each player sacrifices "); if (amount.toString().equals("X")) { sb.append(amount.toString()); } else {