diff --git a/Mage.Server/src/main/java/mage/server/Session.java b/Mage.Server/src/main/java/mage/server/Session.java index 4d6368fae2..c705ffd740 100644 --- a/Mage.Server/src/main/java/mage/server/Session.java +++ b/Mage.Server/src/main/java/mage/server/Session.java @@ -181,6 +181,8 @@ public class Session { return 1018; case "Bandit": return 1020; + case "Wehk": + return 66; } return 51; } 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 0000000000..0fb985c656 --- /dev/null +++ b/Mage.Sets/src/mage/sets/conspiracy/BarbedShocker.java @@ -0,0 +1,106 @@ +/* + * 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.Set; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +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 markedagain + */ +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 BarbedShockerEffect(), false, true)); + } + + public BarbedShocker(final BarbedShocker card) { + super(card); + } + + @Override + 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/magicorigins/DarkDabbling.java b/Mage.Sets/src/mage/sets/magicorigins/DarkDabbling.java index f8b734832f..43b0d5783e 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/DarkDabbling.java +++ b/Mage.Sets/src/mage/sets/magicorigins/DarkDabbling.java @@ -31,6 +31,7 @@ import java.util.UUID; import mage.abilities.Ability; import mage.abilities.condition.common.SpellMasteryCondition; import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.RegenerateTargetEffect; import mage.cards.CardImpl; import mage.constants.CardType; @@ -53,6 +54,7 @@ public class DarkDabbling extends CardImpl { // Regenerate target creature. Draw a card. this.getSpellAbility().addEffect(new RegenerateTargetEffect()); + this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1)); this.getSpellAbility().addTarget(new TargetCreaturePermanent()); // Spell mastery — If there are two or more instant and/or sorcery cards in your graveyard, also regenerate each other creature you control. this.getSpellAbility().addEffect(new DarkDabblingEffect()); diff --git a/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java b/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java index 56631e05d8..219311c74b 100644 --- a/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java +++ b/Mage.Sets/src/mage/sets/magicorigins/InfectiousBloodlust.java @@ -29,11 +29,11 @@ package mage.sets.magicorigins; import java.util.UUID; import mage.abilities.Ability; -import mage.abilities.common.AttacksEachTurnStaticAbility; import mage.abilities.common.DiesAttachedTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.Effect; import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.combat.AttacksIfAbleAttachedEffect; import mage.abilities.effects.common.continuous.BoostEnchantedEffect; import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect; import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; @@ -42,6 +42,7 @@ import mage.abilities.keyword.HasteAbility; import mage.cards.CardImpl; import mage.constants.AttachmentType; import mage.constants.CardType; +import mage.constants.Duration; import mage.constants.Outcome; import mage.constants.Rarity; import mage.constants.Zone; @@ -56,7 +57,7 @@ import mage.target.common.TargetCreaturePermanent; * @author fireshoes */ public class InfectiousBloodlust extends CardImpl { - + private static final FilterCard filter = new FilterCard("card named Infectious Bloodlust"); static { @@ -74,7 +75,7 @@ public class InfectiousBloodlust extends CardImpl { this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); Ability ability = new EnchantAbility(auraTarget.getTargetName()); this.addAbility(ability); - + // Enchanted creature gets +2/+1, has haste, and attacks each turn if able. Effect effect = new BoostEnchantedEffect(2, 1); effect.setText("Enchanted creature gets +2/+1"); @@ -82,11 +83,12 @@ public class InfectiousBloodlust extends CardImpl { effect = new GainAbilityAttachedEffect(HasteAbility.getInstance(), AttachmentType.AURA); effect.setText("has haste"); ability.addEffect(effect); - effect = new GainAbilityAttachedEffect(new AttacksEachTurnStaticAbility(), AttachmentType.AURA); + ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(2, 2, Duration.WhileOnBattlefield)); + effect = new AttacksIfAbleAttachedEffect(Duration.WhileOnBattlefield, AttachmentType.AURA); effect.setText("and attacks each turn if able"); ability.addEffect(effect); this.addAbility(ability); - + // When enchanted creature dies, you may search your library for a card named Infectious Bloodlust, reveal it, put it into your hand, then shuffle your library. TargetCardInLibrary target = new TargetCardInLibrary(0, 1, filter); this.addAbility(new DiesAttachedTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), "enchanted creature", true)); 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 0000000000..ac9da8f9ea --- /dev/null +++ b/Mage.Sets/src/mage/sets/onslaught/CabalSlaver.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.onslaught; + +import java.util.UUID; +import mage.MageInt; +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.SetTargetPointer; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; + +/** + * + * @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}"); + 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 DealsDamageToAPlayerAllTriggeredAbility(new DiscardTargetEffect(1),filter, false, SetTargetPointer.NONE, true)); + } + + public CabalSlaver(final CabalSlaver card) { + super(card); + } + + @Override + public CabalSlaver copy() { + return new CabalSlaver(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/DryadsCaress.java b/Mage.Sets/src/mage/sets/ravnica/DryadsCaress.java new file mode 100644 index 0000000000..0e7052ceda --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/DryadsCaress.java @@ -0,0 +1,74 @@ +/* + * 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.ravnica; + +import java.util.UUID; +import mage.abilities.condition.common.ManaWasSpentCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount; +import mage.abilities.effects.common.GainLifeEffect; +import mage.abilities.effects.common.UntapAllControllerEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.common.FilterCreaturePermanent; + +/** + * + * @author Wehk + */ +public class DryadsCaress extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature on the battlefield"); + private static final String rule = "untap all creatures you control"; + + public DryadsCaress(UUID ownerId) { + super(ownerId, 160, "Dryad's Caress", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{4}{G}{G}"); + this.expansionSetCode = "RAV"; + + // You gain 1 life for each creature on the battlefield. + + this.getSpellAbility().addEffect(new GainLifeEffect(new PermanentsOnBattlefieldCount(filter))); + + //If {W} was spent to cast Dryad's Caress, untap all creatures you control. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new UntapAllControllerEffect(new FilterControlledCreaturePermanent(), rule), + new ManaWasSpentCondition(ColoredManaSymbol.W), "If {W} was spent to cast {this}, untap all creatures you control")); + } + + public DryadsCaress(final DryadsCaress card) { + super(card); + } + + @Override + public DryadsCaress copy() { + return new DryadsCaress(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/GolgariGermination.java b/Mage.Sets/src/mage/sets/ravnica/GolgariGermination.java new file mode 100644 index 0000000000..c4c3cde7ba --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/GolgariGermination.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.ravnica; + +import java.util.UUID; +import mage.abilities.common.DiesCreatureTriggeredAbility; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.permanent.ControllerPredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.permanent.token.SaprolingToken; + +/** + * + * @author Wehk + */ +public class GolgariGermination extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature you control"); + + static { + filter.add(new ControllerPredicate(TargetController.YOU)); + filter.add(Predicates.not(new TokenPredicate())); + } + + public GolgariGermination(UUID ownerId) { + super(ownerId, 209, "Golgari Germination", Rarity.UNCOMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}{G}"); + this.expansionSetCode = "RAV"; + + // Whenever a nontoken creature you control dies, put a 1/1 green Saproling creature token onto the battlefield. + this.addAbility(new DiesCreatureTriggeredAbility(new CreateTokenEffect(new SaprolingToken()), false, filter)); + } + + public GolgariGermination(final GolgariGermination card) { + super(card); + } + + @Override + public GolgariGermination copy() { + return new GolgariGermination(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/HourOfReckoning.java b/Mage.Sets/src/mage/sets/ravnica/HourOfReckoning.java new file mode 100644 index 0000000000..523d558168 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/HourOfReckoning.java @@ -0,0 +1,73 @@ +/* + * 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.ravnica; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.effects.common.DestroyAllEffect; +import mage.abilities.keyword.ConvokeAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.ColorPredicate; +import mage.filter.predicate.permanent.TokenPredicate; + +/** + * + * @author Wehk + */ +public class HourOfReckoning extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature"); + + static { + filter.add(Predicates.not(new TokenPredicate())); + } + + public HourOfReckoning(UUID ownerId) { + super(ownerId, 21, "Hour of Reckoning", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{W}{W}{W}"); + this.expansionSetCode = "RAV"; + + // Convoke + this.addAbility(new ConvokeAbility()); + + // Destroy all nontoken creatures. + this.getSpellAbility().addEffect(new DestroyAllEffect(filter)); + } + + public HourOfReckoning(final HourOfReckoning card) { + super(card); + } + + @Override + public HourOfReckoning copy() { + return new HourOfReckoning(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/SeedSpark.java b/Mage.Sets/src/mage/sets/ravnica/SeedSpark.java new file mode 100644 index 0000000000..0818865d24 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/SeedSpark.java @@ -0,0 +1,71 @@ +/* + * 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.ravnica; + +import java.util.UUID; +import mage.abilities.condition.common.ManaWasSpentCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.common.DestroyTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.ColoredManaSymbol; +import mage.constants.Rarity; +import mage.filter.common.FilterArtifactOrEnchantmentPermanent; +import mage.game.permanent.token.SaprolingToken; +import mage.target.TargetPermanent; +import mage.abilities.effects.common.CreateTokenEffect; + +/** + * + * @author Wehk + */ +public class SeedSpark extends CardImpl { + + public SeedSpark(UUID ownerId) { + super(ownerId, 30, "Seed Spark", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{3}{W}"); + this.expansionSetCode = "RAV"; + + // Destroy target artifact or enchantment. + this.getSpellAbility().addTarget(new TargetPermanent(new FilterArtifactOrEnchantmentPermanent())); + this.getSpellAbility().addEffect(new DestroyTargetEffect()); + + //If {G} was spent to cast Seed Spark, put two 1/1 green Saproling creature tokens onto the battlefield. + this.getSpellAbility().addEffect(new ConditionalOneShotEffect( + new CreateTokenEffect(new SaprolingToken(), 2), + new ManaWasSpentCondition(ColoredManaSymbol.G), "If {G} was spent to cast {this}, put two 1/1 green Saproling creature tokens onto the battlefield")); + } + + public SeedSpark(final SeedSpark card) { + super(card); + } + + @Override + public SeedSpark copy() { + return new SeedSpark(this); + } +} diff --git a/Mage.Sets/src/mage/sets/ravnica/StoneSeederHierophant.java b/Mage.Sets/src/mage/sets/ravnica/StoneSeederHierophant.java new file mode 100644 index 0000000000..b6aeee6f40 --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnica/StoneSeederHierophant.java @@ -0,0 +1,78 @@ +/* + * 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.ravnica; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterLandPermanent; +import mage.target.Target; +import mage.target.common.TargetLandPermanent; + +/** + * + * @author Wehk + */ +public class StoneSeederHierophant extends CardImpl { + + public StoneSeederHierophant(UUID ownerId) { + super(ownerId, 184, "Stone-Seeder Hierophant", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G}{G}"); + this.expansionSetCode = "RAV"; + this.subtype.add("Human"); + this.subtype.add("Druid"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Whenever a land enters the battlefield under your control, untap Stone-Seeder Hierophant. + this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new FilterLandPermanent("a land"), false)); + + // {tap}: Untap target land. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapTargetEffect(), new TapSourceCost()); + Target target = new TargetLandPermanent(); + ability.addTarget(target); + this.addAbility(ability); + } + + public StoneSeederHierophant(final StoneSeederHierophant card) { + super(card); + } + + @Override + public StoneSeederHierophant copy() { + return new StoneSeederHierophant(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 0000000000..4ed38a71f3 --- /dev/null +++ b/Mage.Sets/src/mage/sets/tempest/Shocker.java @@ -0,0 +1,99 @@ +/* + * 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.Ability; +import mage.abilities.common.DealsDamageToAPlayerTriggeredAbility; +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 markedagain + */ +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 ShockerEffect(), false, true)); + } + + public Shocker(final Shocker card) { + super(card); + } + + @Override + public Shocker copy() { + 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/timeshifted/TeferisMoat.java b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java index e1edcb283c..6348e83d0d 100644 --- a/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java +++ b/Mage.Sets/src/mage/sets/timeshifted/TeferisMoat.java @@ -100,4 +100,4 @@ class TeferisMoatRestrictionEffect extends RestrictionEffect { public TeferisMoatRestrictionEffect copy() { return new TeferisMoatRestrictionEffect(this); } -} \ 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 new file mode 100644 index 0000000000..28587af387 --- /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 markedagain + */ +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.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java new file mode 100644 index 0000000000..7bb54c0dd5 --- /dev/null +++ b/Mage.Sets/src/mage/sets/timespiral/MwonvuliAcidMoss.java @@ -0,0 +1,71 @@ +/* + * 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.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 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"; + + 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(new FilterLandPermanent())); + 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); + } +} + 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 0000000000..075ebcb48e --- /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 markedagain + */ +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/common/BecomesRenownSourceTriggeredAbility.java b/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java index 0864328cee..44ae09a0f2 100644 --- a/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java @@ -15,7 +15,6 @@ import mage.game.events.GameEvent; * * @author LevelX2 */ - public class BecomesRenownSourceTriggeredAbility extends TriggeredAbilityImpl { private int renownValue; @@ -54,6 +53,6 @@ public class BecomesRenownSourceTriggeredAbility extends TriggeredAbilityImpl { @Override public String getRule() { - return "When {this} becomes monstrous, " + super.getRule(); + return "When {this} becomes renown, " + super.getRule(); } -} \ No newline at end of file +} 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 0000000000..91b85072c9 --- /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 markedagain + */ +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); + } + +}