From cb99dbd330626eea9c37a9f367b6a7dea2aefa7a Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 13:56:31 -0400 Subject: [PATCH 1/9] set filter on restriction effect --- Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java index 4ae362d68d6..e614bae19e1 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java @@ -41,6 +41,9 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -73,6 +76,11 @@ public class TeferisMoat extends CardImpl { class TeferisMoatRestrictionEffect extends RestrictionEffect { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures without flying"); + static { + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + TeferisMoatRestrictionEffect(){ super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "Creatures of the chosen color without flying can't attack you"; From 8357514142d72659344115642ed71f4ad98c1e26 Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 17:45:36 -0400 Subject: [PATCH 2/9] Revert "set filter on restriction effect" This reverts commit cb99dbd330626eea9c37a9f367b6a7dea2aefa7a. --- Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java index e614bae19e1..4ae362d68d6 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java @@ -41,9 +41,6 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -76,11 +73,6 @@ public class TeferisMoat extends CardImpl { class TeferisMoatRestrictionEffect extends RestrictionEffect { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures without flying"); - static { - filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); - } - TeferisMoatRestrictionEffect(){ super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "Creatures of the chosen color without flying can't attack you"; From 0b60b3750619ff4e8a0896ac3f5e7929605b59d7 Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 17:46:14 -0400 Subject: [PATCH 3/9] new card Mwonvulia Acid Moss --- .../sets/timespiral/MwonvuliAcidMoss.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java diff --git a/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java new file mode 100644 index 00000000000..a3902e1aa77 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java @@ -0,0 +1,75 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author anonymous + */ +public class MwonvuliAcidMoss extends CardImpl { + + public MwonvuliAcidMoss(UUID ownerId) { + super(ownerId, 207, "Mwonvuli Acid-Moss", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{G}{G}"); + this.expansionSetCode = "TSP"; + + FilterPermanent filter = new FilterPermanent("land"); + filter.add(Predicates.and(new CardTypePredicate(CardType.LAND))); + + FilterCard filterForest = new FilterCard("a Forest card"); + filterForest.add(new SubtypePredicate("Forest")); + + // Destroy target land. Search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library. + this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filterForest), false, true)); + } + + public MwonvuliAcidMoss(final MwonvuliAcidMoss card) { + super(card); + } + + @Override + public MwonvuliAcidMoss copy() { + return new MwonvuliAcidMoss(this); + } +} + From d231ace13075e240c8d2cb689508394905c0c65d Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 13:56:31 -0400 Subject: [PATCH 4/9] set filter on restriction effect --- Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java index e1edcb283c4..4fc0cf8e35c 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java @@ -41,6 +41,9 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -73,6 +76,11 @@ public class TeferisMoat extends CardImpl { class TeferisMoatRestrictionEffect extends RestrictionEffect { + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures without flying"); + static { + filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); + } + TeferisMoatRestrictionEffect(){ super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "Creatures of the chosen color without flying can't attack you"; @@ -100,4 +108,4 @@ class TeferisMoatRestrictionEffect extends RestrictionEffect { public TeferisMoatRestrictionEffect copy() { return new TeferisMoatRestrictionEffect(this); } -} \ No newline at end of file +} From 9bb10eb8c9c603a4fbce70262419f7be37805778 Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 17:45:36 -0400 Subject: [PATCH 5/9] Revert "set filter on restriction effect" This reverts commit cb99dbd330626eea9c37a9f367b6a7dea2aefa7a. --- Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java index 4fc0cf8e35c..6348e83d0dd 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java @@ -41,9 +41,6 @@ import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.AbilityPredicate; import mage.game.Game; import mage.game.permanent.Permanent; @@ -76,11 +73,6 @@ public class TeferisMoat extends CardImpl { class TeferisMoatRestrictionEffect extends RestrictionEffect { - private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creatures without flying"); - static { - filter.add(Predicates.not(new AbilityPredicate(FlyingAbility.class))); - } - TeferisMoatRestrictionEffect(){ super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "Creatures of the chosen color without flying can't attack you"; From 271957a1a179faf69bb9981021e8f5c562f44f68 Mon Sep 17 00:00:00 2001 From: mkalender Date: Tue, 23 Jun 2015 17:46:14 -0400 Subject: [PATCH 6/9] new card Mwonvulia Acid Moss --- .../sets/timespiral/MwonvuliAcidMoss.java | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java diff --git a/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java new file mode 100644 index 00000000000..a3902e1aa77 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java @@ -0,0 +1,75 @@ +/* + * 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.timespiral; + +import java.util.UUID; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.FilterPermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPermanent; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author anonymous + */ +public class MwonvuliAcidMoss extends CardImpl { + + public MwonvuliAcidMoss(UUID ownerId) { + super(ownerId, 207, "Mwonvuli Acid-Moss", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{G}{G}"); + this.expansionSetCode = "TSP"; + + FilterPermanent filter = new FilterPermanent("land"); + filter.add(Predicates.and(new CardTypePredicate(CardType.LAND))); + + FilterCard filterForest = new FilterCard("a Forest card"); + filterForest.add(new SubtypePredicate("Forest")); + + // Destroy target land. Search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library. + this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); + this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filterForest), false, true)); + } + + public MwonvuliAcidMoss(final MwonvuliAcidMoss card) { + super(card); + } + + @Override + public MwonvuliAcidMoss copy() { + return new MwonvuliAcidMoss(this); + } +} + From 9294bac4c2e0ac5a991356461226637bde5e05e0 Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 24 Jun 2015 11:15:22 -0400 Subject: [PATCH 7/9] Harvest Wurm implementation --- .../mage/sets/weatherlight/HarvestWurm.java | 66 ++++++++++++++ .../common/ReturnToHandFromGraveyardCost.java | 86 +++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java create mode 100644 Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java diff --git a/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java b/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java new file mode 100644 index 00000000000..7b2c3be0442 --- /dev/null +++ b/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java @@ -0,0 +1,66 @@ +/* + * 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.weatherlight; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.costs.common.ReturnToHandFromGraveyardCost; +import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterBasicLandCard; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author anonymous + */ +public class HarvestWurm extends CardImpl { + + public HarvestWurm(UUID ownerId) { + super(ownerId, 72, "Harvest Wurm", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G}"); + this.expansionSetCode = "WTH"; + this.subtype.add("Wurm"); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // When Harvest Wurm enters the battlefield, sacrifice it unless you return a basic land card from your graveyard to your hand. + this.addAbility(new EntersBattlefieldTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ReturnToHandFromGraveyardCost(new TargetCardInYourGraveyard(new FilterBasicLandCard()))))); + } + + public HarvestWurm(final HarvestWurm card) { + super(card); + } + + @Override + public HarvestWurm copy() { + return new HarvestWurm(this); + } +} diff --git a/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java new file mode 100644 index 00000000000..f73578adf39 --- /dev/null +++ b/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -0,0 +1,86 @@ +/* + * 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.costs.common; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.costs.CostImpl; +import mage.constants.Outcome; +import mage.constants.Zone; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; +import mage.target.common.TargetCardInYourGraveyard; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class ReturnToHandFromGraveyardCost extends CostImpl { + + public ReturnToHandFromGraveyardCost(TargetCardInYourGraveyard target) { + this.addTarget(target); + if (target.getMaxNumberOfTargets() > 1 && target.getMaxNumberOfTargets() == target.getNumberOfTargets()) { + this.text = new StringBuilder("return ").append(target.getMaxNumberOfTargets()).append(" ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); + } else { + this.text = new StringBuilder("return ").append(target.getTargetName()).append(" from graveyard to it's owner's hand").toString(); + } + } + public ReturnToHandFromGraveyardCost(ReturnToHandFromGraveyardCost cost) { + super(cost); + } + + @Override + public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) { + Player controller = game.getPlayer(controllerId); + if (controller != null) { + if (targets.choose(Outcome.ReturnToHand, controllerId, sourceId, game)) { + for (UUID targetId: targets.get(0).getTargets()) { + mage.cards.Card targetCard = game.getCard(targetId); + if (targetCard == null) { + return false; + } + paid |= controller.moveCardToHandWithInfo(targetCard, sourceId, game, Zone.HAND); + } + } + } + return paid; + } + + @Override + public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) { + return targets.canChoose(controllerId, game); + } + + @Override + public ReturnToHandFromGraveyardCost copy() { + return new ReturnToHandFromGraveyardCost(this); + } + +} From e35a7b2f364ddb1c9fc013f3631f03f4d2a7acb5 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 25 Jun 2015 21:05:39 -0400 Subject: [PATCH 8/9] new cards Barbed Shocker ,Cabal Slaver, Shoker added new DiscardHandAndDrawEffect --- .../mage/sets/conspiracy/BarbedShocker.java | 70 +++++++++++++++ .../src/mage/sets/onslaught/CabalSlaver.java | 66 ++++++++++++++ Mage.Sets/src/mage/sets/tempest/Shocker.java | 64 +++++++++++++ .../mage/sets/timespiral/BarbedShocker.java | 52 +++++++++++ .../discard/DiscardHandAndDrawEffect.java | 89 +++++++++++++++++++ 5 files changed, 341 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java create mode 100644 Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java create mode 100644 Mage.Sets/src/mage/sets/tempest/Shocker.java create mode 100644 Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java create mode 100644 Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java diff --git a/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java b/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java new file mode 100644 index 00000000000..bc47168738b --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java @@ -0,0 +1,70 @@ +/* + * 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.conspiracy; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.keyword.HasteAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author anonymous + */ +public class BarbedShocker extends CardImpl { + + public BarbedShocker(UUID ownerId) { + super(ownerId, 136, "Barbed Shocker", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{R}"); + this.expansionSetCode = "CNS"; + this.subtype.add("Insect"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + // Haste + this.addAbility(HasteAbility.getInstance()); + // Whenever Barbed Shocker deals damage to a player, that player discards all the cards in his or her hand, then draws that many cards. + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardHandAndDrawEffect(TargetController.OPPONENT), false, true)); + } + + public BarbedShocker(final BarbedShocker card) { + super(card); + } + + @Override + public BarbedShocker copy() { + return new BarbedShocker(this); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java b/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java new file mode 100644 index 00000000000..9b3ee5a8b82 --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java @@ -0,0 +1,66 @@ +/* + * 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.onslaught; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.abilities.effects.common.discard.DiscardTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author anonymous + */ +public class CabalSlaver extends CardImpl { + + public CabalSlaver(UUID ownerId) { + super(ownerId, 131, "Cabal Slaver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); + this.expansionSetCode = "ONS"; + this.subtype.add("Human"); + this.subtype.add("Cleric"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Whenever a Goblin deals combat damage to a player, that player discards a card. + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1), false, true)); + } + + public CabalSlaver(final CabalSlaver card) { + super(card); + } + + @Override + public CabalSlaver copy() { + return new CabalSlaver(this); + } +} diff --git a/Mage.Sets/src/mage/sets/tempest/Shocker.java b/Mage.Sets/src/mage/sets/tempest/Shocker.java new file mode 100644 index 00000000000..fe32c73bab3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Shocker.java @@ -0,0 +1,64 @@ +/* + * 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.tempest; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; + +/** + * + * @author anonymous + */ +public class Shocker extends CardImpl { + + public Shocker(UUID ownerId) { + super(ownerId, 204, "Shocker", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{R}"); + this.expansionSetCode = "TMP"; + this.subtype.add("Insect"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever Shocker deals damage to a player, that player discards all the cards in his or her hand, then draws that many cards. + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardHandAndDrawEffect(TargetController.OPPONENT), false, true)); + } + + public Shocker(final Shocker card) { + super(card); + } + + @Override + public Shocker copy() { + return new Shocker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java b/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java new file mode 100644 index 00000000000..fe57ec4b632 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.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.timespiral; + +import java.util.UUID; + +/** + * + * @author anonymous + */ +public class BarbedShocker extends mage.sets.conspiracy.BarbedShocker { + + public BarbedShocker(UUID ownerId) { + super(ownerId); + this.cardNumber = 144; + this.expansionSetCode = "TSP"; + } + + public BarbedShocker(final BarbedShocker card) { + super(card); + } + + @Override + public BarbedShocker copy() { + return new BarbedShocker(this); + } +} diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java new file mode 100644 index 00000000000..322d613dcc7 --- /dev/null +++ b/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java @@ -0,0 +1,89 @@ +/* + * 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.discard; + +import java.util.Set; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; +import mage.constants.Outcome; +import mage.constants.TargetController; +import mage.game.Game; +import mage.players.Player; + +/** + * @author mluds + */ +public class DiscardHandAndDrawEffect extends OneShotEffect { + + private int CardDrawOffset = 0; + public DiscardHandAndDrawEffect(TargetController targetController) { + this(targetController,0); + } + public DiscardHandAndDrawEffect(TargetController targetController, int cardDrawOffset) { + super(Outcome.Discard); + String PostText = ""; + if (cardDrawOffset >0){ + PostText = " plus " + cardDrawOffset; + }else if(cardDrawOffset < 0){ + PostText = " minus " + cardDrawOffset; + } + this.CardDrawOffset = cardDrawOffset; + switch(targetController) { + case OPPONENT: + this.staticText = "Opponent discards his hand then draws that many cards" + PostText; + break; + case YOU: + this.staticText = "Discard your hand then draws that many cards" + PostText; + break; + } + } + + public DiscardHandAndDrawEffect(final DiscardHandAndDrawEffect effect) { + super(effect); + } + + @Override + public DiscardHandAndDrawEffect copy() { + return new DiscardHandAndDrawEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(targetPointer.getFirst(game, source)); + if (player != null) { + Set cards = player.getHand().getCards(game); + int count = cards.size(); + for (Card card : cards) { + player.discard(card, source, game); + } + player.drawCards(count + this.CardDrawOffset, game); + } + return true; + } +} From f3f48496381199283d1752d3b3cc5f42fd14c8c7 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 2 Jul 2015 15:14:45 -0400 Subject: [PATCH 9/9] fixed Barbed Shocker ,Cabal Slaver, Shoker removed DiscardHandAndDrawEffect added author name --- .../mage/sets/conspiracy/BarbedShocker.java | 42 ++++++++- .../src/mage/sets/onslaught/CabalSlaver.java | 16 ++-- Mage.Sets/src/mage/sets/tempest/Shocker.java | 41 ++++++++- .../mage/sets/timespiral/BarbedShocker.java | 2 +- .../sets/timespiral/MwonvuliAcidMoss.java | 16 ++-- .../mage/sets/weatherlight/HarvestWurm.java | 2 +- .../common/ReturnToHandFromGraveyardCost.java | 2 +- .../discard/DiscardHandAndDrawEffect.java | 89 ------------------- 8 files changed, 97 insertions(+), 113 deletions(-) delete mode 100644 Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java diff --git a/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java b/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java index bc47168738b..0fb985c6562 100644 --- a/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java +++ b/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java @@ -27,20 +27,26 @@ */ package mage.sets.conspiracy; +import java.util.Set; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; -import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.abilities.effects.OneShotEffect; import mage.abilities.keyword.TrampleAbility; import mage.abilities.keyword.HasteAbility; +import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; +import mage.game.Game; +import mage.players.Player; /** * - * @author anonymous + * @author markedagain */ public class BarbedShocker extends CardImpl { @@ -56,7 +62,7 @@ public class BarbedShocker extends CardImpl { // Haste this.addAbility(HasteAbility.getInstance()); // Whenever Barbed Shocker deals damage to a player, that player discards all the cards in his or her hand, then draws that many cards. - this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardHandAndDrawEffect(TargetController.OPPONENT), false, true)); + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new BarbedShockerEffect(), false, true)); } public BarbedShocker(final BarbedShocker card) { @@ -67,4 +73,34 @@ public class BarbedShocker extends CardImpl { public BarbedShocker copy() { return new BarbedShocker(this); } +} +class BarbedShockerEffect extends OneShotEffect { + + public BarbedShockerEffect() { + super(Outcome.Discard); + this.staticText = " that player discards all the cards in his or her hand, then draws that many cards"; + } + + public BarbedShockerEffect(final BarbedShockerEffect effect) { + super(effect); + } + + @Override + public BarbedShockerEffect copy() { + return new BarbedShockerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); + if (targetPlayer != null) { + int count = targetPlayer.getHand().size(); + for (Card card : targetPlayer.getHand().getCards(game)) { + targetPlayer.discard(card, source, game); + } + targetPlayer.drawCards(count, game); + return false; + } + return true; + } } \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java b/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java index 9b3ee5a8b82..ac9da8f9eae 100644 --- a/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java +++ b/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.java @@ -29,19 +29,25 @@ package mage.sets.onslaught; import java.util.UUID; import mage.MageInt; -import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; -import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.abilities.common.DealsDamageToAPlayerAllTriggeredAbility; import mage.abilities.effects.common.discard.DiscardTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.constants.TargetController; +import mage.constants.SetTargetPointer; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; /** * - * @author anonymous + * @author markedagain */ public class CabalSlaver extends CardImpl { + private static final FilterPermanent filter = new FilterPermanent("Goblin"); + + static { + filter.add(new SubtypePredicate("Goblin")); + } public CabalSlaver(UUID ownerId) { super(ownerId, 131, "Cabal Slaver", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{B}"); @@ -52,7 +58,7 @@ public class CabalSlaver extends CardImpl { this.toughness = new MageInt(1); // Whenever a Goblin deals combat damage to a player, that player discards a card. - this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardTargetEffect(1), false, true)); + this.addAbility(new DealsDamageToAPlayerAllTriggeredAbility(new DiscardTargetEffect(1),filter, false, SetTargetPointer.NONE, true)); } public CabalSlaver(final CabalSlaver card) { diff --git a/Mage.Sets/src/mage/sets/tempest/Shocker.java b/Mage.Sets/src/mage/sets/tempest/Shocker.java index fe32c73bab3..4ed38a71f35 100644 --- a/Mage.Sets/src/mage/sets/tempest/Shocker.java +++ b/Mage.Sets/src/mage/sets/tempest/Shocker.java @@ -29,16 +29,21 @@ package mage.sets.tempest; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; -import mage.abilities.effects.common.discard.DiscardHandAndDrawEffect; +import mage.abilities.effects.OneShotEffect; +import mage.cards.Card; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.TargetController; +import mage.game.Game; +import mage.players.Player; /** * - * @author anonymous + * @author markedagain */ public class Shocker extends CardImpl { @@ -50,7 +55,7 @@ public class Shocker extends CardImpl { this.toughness = new MageInt(1); // Whenever Shocker deals damage to a player, that player discards all the cards in his or her hand, then draws that many cards. - this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new DiscardHandAndDrawEffect(TargetController.OPPONENT), false, true)); + this.addAbility(new DealsDamageToAPlayerTriggeredAbility(new ShockerEffect(), false, true)); } public Shocker(final Shocker card) { @@ -62,3 +67,33 @@ public class Shocker extends CardImpl { return new Shocker(this); } } +class ShockerEffect extends OneShotEffect { + + public ShockerEffect() { + super(Outcome.Discard); + this.staticText = " that player discards all the cards in his or her hand, then draws that many cards"; + } + + public ShockerEffect(final ShockerEffect effect) { + super(effect); + } + + @Override + public ShockerEffect copy() { + return new ShockerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player targetPlayer = game.getPlayer(targetPointer.getFirst(game, source)); + if (targetPlayer != null) { + int count = targetPlayer.getHand().size(); + for (Card card : targetPlayer.getHand().getCards(game)) { + targetPlayer.discard(card, source, game); + } + targetPlayer.drawCards(count, game); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java b/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java index fe57ec4b632..28587af3873 100644 --- a/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java +++ b/Mage.Sets/src/mage/sets/timespiral/BarbedShocker.java @@ -31,7 +31,7 @@ import java.util.UUID; /** * - * @author anonymous + * @author markedagain */ public class BarbedShocker extends mage.sets.conspiracy.BarbedShocker { diff --git a/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java index a3902e1aa77..7bb54c0dd5b 100644 --- a/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java +++ b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java @@ -33,33 +33,29 @@ import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect; import mage.cards.CardImpl; import mage.constants.CardType; import mage.constants.Rarity; -import mage.filter.FilterCard; -import mage.filter.FilterPermanent; -import mage.filter.predicate.Predicates; -import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.common.FilterBasicLandCard; +import mage.filter.common.FilterLandCard; +import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.target.TargetPermanent; import mage.target.common.TargetCardInLibrary; /** * - * @author anonymous + * @author markedagain */ public class MwonvuliAcidMoss extends CardImpl { public MwonvuliAcidMoss(UUID ownerId) { super(ownerId, 207, "Mwonvuli Acid-Moss", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{G}{G}"); this.expansionSetCode = "TSP"; - - FilterPermanent filter = new FilterPermanent("land"); - filter.add(Predicates.and(new CardTypePredicate(CardType.LAND))); - FilterCard filterForest = new FilterCard("a Forest card"); + FilterLandCard filterForest = new FilterLandCard(); filterForest.add(new SubtypePredicate("Forest")); // Destroy target land. Search your library for a Forest card and put that card onto the battlefield tapped. Then shuffle your library. this.getSpellAbility().addEffect(new DestroyTargetEffect(true)); - this.getSpellAbility().addTarget(new TargetPermanent(filter)); + this.getSpellAbility().addTarget(new TargetPermanent(new FilterLandPermanent())); this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filterForest), false, true)); } diff --git a/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java b/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java index 7b2c3be0442..075ebcb48e0 100644 --- a/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java +++ b/Mage.Sets/src/mage/sets/weatherlight/HarvestWurm.java @@ -40,7 +40,7 @@ import mage.target.common.TargetCardInYourGraveyard; /** * - * @author anonymous + * @author markedagain */ public class HarvestWurm extends CardImpl { diff --git a/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java b/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java index f73578adf39..91b85072c9a 100644 --- a/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java +++ b/Mage/src/mage/abilities/costs/common/ReturnToHandFromGraveyardCost.java @@ -40,7 +40,7 @@ import mage.target.common.TargetCardInYourGraveyard; /** * - * @author BetaSteward_at_googlemail.com + * @author markedagain */ public class ReturnToHandFromGraveyardCost extends CostImpl { diff --git a/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java b/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java deleted file mode 100644 index 322d613dcc7..00000000000 --- a/Mage/src/mage/abilities/effects/common/discard/DiscardHandAndDrawEffect.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.discard; - -import java.util.Set; -import mage.abilities.Ability; -import mage.abilities.effects.OneShotEffect; -import mage.cards.Card; -import mage.constants.Outcome; -import mage.constants.TargetController; -import mage.game.Game; -import mage.players.Player; - -/** - * @author mluds - */ -public class DiscardHandAndDrawEffect extends OneShotEffect { - - private int CardDrawOffset = 0; - public DiscardHandAndDrawEffect(TargetController targetController) { - this(targetController,0); - } - public DiscardHandAndDrawEffect(TargetController targetController, int cardDrawOffset) { - super(Outcome.Discard); - String PostText = ""; - if (cardDrawOffset >0){ - PostText = " plus " + cardDrawOffset; - }else if(cardDrawOffset < 0){ - PostText = " minus " + cardDrawOffset; - } - this.CardDrawOffset = cardDrawOffset; - switch(targetController) { - case OPPONENT: - this.staticText = "Opponent discards his hand then draws that many cards" + PostText; - break; - case YOU: - this.staticText = "Discard your hand then draws that many cards" + PostText; - break; - } - } - - public DiscardHandAndDrawEffect(final DiscardHandAndDrawEffect effect) { - super(effect); - } - - @Override - public DiscardHandAndDrawEffect copy() { - return new DiscardHandAndDrawEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - Player player = game.getPlayer(targetPointer.getFirst(game, source)); - if (player != null) { - Set cards = player.getHand().getCards(game); - int count = cards.size(); - for (Card card : cards) { - player.discard(card, source, game); - } - player.drawCards(count + this.CardDrawOffset, game); - } - return true; - } -}