diff --git a/Mage.Sets/src/mage/sets/ravnika/MindleechMass.java b/Mage.Sets/src/mage/sets/ravnika/MindleechMass.java new file mode 100644 index 00000000000..882a2d08bcc --- /dev/null +++ b/Mage.Sets/src/mage/sets/ravnika/MindleechMass.java @@ -0,0 +1,120 @@ +/* + * 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.ravnika; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterNonlandCard; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetCard; + +/** + * + * @author jeffwadsworth + */ +public class MindleechMass extends CardImpl { + + public MindleechMass(UUID ownerId) { + super(ownerId, 215, "Mindleech Mass", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{U}{B}{B}"); + this.expansionSetCode = "RAV"; + this.subtype.add("Horror"); + + this.color.setBlack(true); + this.color.setBlue(true); + this.power = new MageInt(6); + this.toughness = new MageInt(6); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // Whenever Mindleech Mass deals combat damage to a player, you may look at that player's hand. If you do, you may cast a nonland card in it without paying that card's mana cost. + this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new MindleechMassEffect(), true, true)); + } + + public MindleechMass(final MindleechMass card) { + super(card); + } + + @Override + public MindleechMass copy() { + return new MindleechMass(this); + } +} + +class MindleechMassEffect extends OneShotEffect { + + public MindleechMassEffect() { + super(Outcome.PlayForFree); + this.staticText = "you may look at that player's hand. If you do, you may cast a nonland card in it without paying that card's mana cost"; + } + + public MindleechMassEffect(final MindleechMassEffect effect) { + super(effect); + } + + @Override + public MindleechMassEffect copy() { + return new MindleechMassEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player opponent = game.getPlayer(getTargetPointer().getFirst(game, source)); + Player you = game.getPlayer(source.getControllerId()); + if (opponent != null && you != null) { + Cards cardsInHand = new CardsImpl(Zone.PICK); + cardsInHand.addAll(opponent.getHand()); + opponent.revealCards("Opponents hand", cardsInHand, game); + if (cardsInHand.size() > 0 + && cardsInHand.getCards(new FilterNonlandCard(), game).size() > 0) { + TargetCard target = new TargetCard(1, Zone.PICK, new FilterNonlandCard()); + if (you.chooseTarget(Outcome.PlayForFree, cardsInHand, target, source, game)) { + Card card = game.getCard(target.getFirstTarget()); + if (card != null) { + you.cast(card.getSpellAbility(), game, true); + } + } + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Gloomlance.java b/Mage.Sets/src/mage/sets/shadowmoor/Gloomlance.java new file mode 100644 index 00000000000..968e9e09b5a --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/Gloomlance.java @@ -0,0 +1,102 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package mage.sets.shadowmoor; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class Gloomlance extends CardImpl { + + public Gloomlance(UUID ownerId) { + super(ownerId, 67, "Gloomlance", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{B}{B}"); + this.expansionSetCode = "SHM"; + + this.color.setBlack(true); + + // Destroy target creature. If that creature was green or white, its controller discards a card. + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + this.getSpellAbility().addEffect(new GloomlanceEffect()); + + } + + public Gloomlance(final Gloomlance card) { + super(card); + } + + @Override + public Gloomlance copy() { + return new Gloomlance(this); + } +} + +class GloomlanceEffect extends OneShotEffect { + + public GloomlanceEffect() { + super(Outcome.DestroyPermanent); + this.staticText = "Destroy target creature. If that creature was green or white, its controller discards a card"; + } + + public GloomlanceEffect(final GloomlanceEffect effect) { + super(effect); + } + + @Override + public GloomlanceEffect copy() { + return new GloomlanceEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent targetCreature = game.getPermanent(source.getFirstTarget()); + if (targetCreature != null) { + Player targetController = game.getPlayer(targetCreature.getControllerId()); + targetCreature.destroy(source.getSourceId(), game, false); + Permanent destroyedCreature = game.getPermanentOrLKIBattlefield(source.getFirstTarget()); + if (destroyedCreature.getColor().isGreen() + || destroyedCreature.getColor().isWhite()) { + targetController.discard(1, source, game); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/PrismwakeMerrow.java b/Mage.Sets/src/mage/sets/shadowmoor/PrismwakeMerrow.java new file mode 100644 index 00000000000..572d9cc5ce0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/PrismwakeMerrow.java @@ -0,0 +1,142 @@ +/* + * 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.shadowmoor; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continious.SetCardColorTargetEffect; +import mage.abilities.keyword.FlashAbility; +import mage.cards.CardImpl; +import mage.choices.ChoiceColor; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class PrismwakeMerrow extends CardImpl { + + public PrismwakeMerrow(UUID ownerId) { + super(ownerId, 46, "Prismwake Merrow", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Merfolk"); + this.subtype.add("Wizard"); + + this.color.setBlue(true); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Flash + this.addAbility(FlashAbility.getInstance()); + + // When Prismwake Merrow enters the battlefield, target permanent becomes the color or colors of your choice until end of turn. + Ability ability = new EntersBattlefieldTriggeredAbility(new ChangeColorOrColorsTargetEffect(), false); + ability.addTarget(new TargetPermanent()); + this.addAbility(ability); + + } + + public PrismwakeMerrow(final PrismwakeMerrow card) { + super(card); + } + + @Override + public PrismwakeMerrow copy() { + return new PrismwakeMerrow(this); + } +} + +class ChangeColorOrColorsTargetEffect extends OneShotEffect { + + public ChangeColorOrColorsTargetEffect() { + super(Outcome.Neutral); + staticText = "target permanent becomes the color or colors of your choice until end of turn"; + } + + public ChangeColorOrColorsTargetEffect(final ChangeColorOrColorsTargetEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player you = game.getPlayer(source.getControllerId()); + Permanent target = game.getPermanent(source.getFirstTarget()); + List chosenColors = new ArrayList<>(); + if (you != null && target != null) { + for (int i = 0; i < 5; i++) { + if (!you.chooseUse(Outcome.Neutral, "Do you wish to choose another color?", game)) { + break; + } + ChoiceColor choiceColor = new ChoiceColor(); + you.choose(Outcome.Benefit, choiceColor, game); + if (!you.isInGame()) { + return false; + } + game.informPlayers(target.getName() + ": " + you.getName() + " has chosen " + choiceColor.getChoice()); + if (choiceColor.getColor().isBlack()) { + chosenColors.add(ObjectColor.BLACK); + } else if (choiceColor.getColor().isBlue()) { + chosenColors.add(ObjectColor.BLUE); + } else if (choiceColor.getColor().isRed()) { + chosenColors.add(ObjectColor.RED); + } else if (choiceColor.getColor().isGreen()) { + chosenColors.add(ObjectColor.GREEN); + } else if (choiceColor.getColor().isWhite()) { + chosenColors.add(ObjectColor.WHITE); + } + } + for (ObjectColor color : chosenColors) { + ContinuousEffect effect = new SetCardColorTargetEffect(color, Duration.EndOfTurn, "is " + color); + effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); + game.addEffect(effect, source); + } + return true; + } + return false; + } + + @Override + public ChangeColorOrColorsTargetEffect copy() { + return new ChangeColorOrColorsTargetEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RhysTheRedeemed.java b/Mage.Sets/src/mage/sets/shadowmoor/RhysTheRedeemed.java new file mode 100644 index 00000000000..e624b95f715 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/RhysTheRedeemed.java @@ -0,0 +1,145 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.CreateTokenEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterPermanent; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.permanent.TokenPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.EmptyToken; +import mage.game.permanent.token.Token; +import mage.players.Player; +import mage.util.CardUtil; + +/** + * + * @author jeffwadsworth + */ +public class RhysTheRedeemed extends CardImpl { + + public RhysTheRedeemed(UUID ownerId) { + super(ownerId, 237, "Rhys the Redeemed", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{G/W}"); + this.expansionSetCode = "SHM"; + this.supertype.add("Legendary"); + this.subtype.add("Elf"); + this.subtype.add("Warrior"); + + this.color.setWhite(true); + this.color.setGreen(true); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // {2}{GW}, {tap}: Put a 1/1 green and white Elf Warrior creature token onto the battlefield. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new RhysTheRedeemedToken()), new ManaCostsImpl("{2}{G/W}")); + ability.addCost(new TapSourceCost()); + this.addAbility(ability); + + // {4}{GW}{GW}, {tap}: For each creature token you control, put a token that's a copy of that creature onto the battlefield. + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RhysTheRedeemedEffect(), new ManaCostsImpl("{4}{G/W}{G/W}")); + ability2.addCost(new TapSourceCost()); + this.addAbility(ability2); + + } + + public RhysTheRedeemed(final RhysTheRedeemed card) { + super(card); + } + + @Override + public RhysTheRedeemed copy() { + return new RhysTheRedeemed(this); + } +} + +class RhysTheRedeemedEffect extends OneShotEffect { + + private static final FilterPermanent filter = new FilterPermanent(); + + static { + filter.add(new CardTypePredicate(CardType.CREATURE)); + filter.add(new TokenPredicate()); + } + + public RhysTheRedeemedEffect() { + super(Outcome.Neutral); + this.staticText = "For each creature token you control, put a token that's a copy of that creature onto the battlefield"; + } + + public RhysTheRedeemedEffect(final RhysTheRedeemedEffect effect) { + super(effect); + } + + @Override + public RhysTheRedeemedEffect copy() { + return new RhysTheRedeemedEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player you = game.getPlayer(source.getControllerId()); + if (you != null) { + for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) { + if (permanent.getControllerId().equals(source.getControllerId())) { + EmptyToken token = new EmptyToken(); + CardUtil.copyTo(token).from(permanent); + token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId()); + } + } + return true; + } + return false; + } +} + +class RhysTheRedeemedToken extends Token { + + public RhysTheRedeemedToken() { + super("Elf Warrior", "1/1 green and white Elf Warrior creature token"); + cardType.add(CardType.CREATURE); + color.setGreen(true); + color.setWhite(true); + subtype.add("Elf"); + subtype.add("Warrior"); + power = new MageInt(1); + toughness = new MageInt(1); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RiverKelpie.java b/Mage.Sets/src/mage/sets/shadowmoor/RiverKelpie.java new file mode 100644 index 00000000000..08ac5c76c64 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/RiverKelpie.java @@ -0,0 +1,136 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.DrawCardSourceControllerEffect; +import mage.abilities.keyword.PersistAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; + +/** + * + * @author jeffwadsworth + */ +public class RiverKelpie extends CardImpl { + + public RiverKelpie(UUID ownerId) { + super(ownerId, 49, "River Kelpie", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Beast"); + + this.color.setBlue(true); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Whenever River Kelpie or another permanent is put onto the battlefield from a graveyard, draw a card. + this.addAbility(new RiverKelpieTriggeredAbility()); + + // Whenever a player casts a spell from a graveyard, draw a card. + this.addAbility(new RiverKelpieTriggeredAbility2()); + + // Persist + this.addAbility(new PersistAbility()); + } + + public RiverKelpie(final RiverKelpie card) { + super(card); + } + + @Override + public RiverKelpie copy() { + return new RiverKelpie(this); + } +} + +class RiverKelpieTriggeredAbility extends TriggeredAbilityImpl { + + @Override + public RiverKelpieTriggeredAbility copy() { + return new RiverKelpieTriggeredAbility(this); + } + + public RiverKelpieTriggeredAbility(final RiverKelpieTriggeredAbility ability) { + super(ability); + } + + public RiverKelpieTriggeredAbility() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if (zEvent.getFromZone() == Zone.GRAVEYARD && zEvent.getToZone() == Zone.BATTLEFIELD) { + Permanent permanent = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD); + return permanent != null; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever River Kelpie or another permanent is put onto the battlefield from a graveyard, draw a card."; + } +} + +class RiverKelpieTriggeredAbility2 extends TriggeredAbilityImpl { + + public RiverKelpieTriggeredAbility2() { + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false); + } + + public RiverKelpieTriggeredAbility2(final RiverKelpieTriggeredAbility2 ability) { + super(ability); + } + + @Override + public RiverKelpieTriggeredAbility2 copy() { + return new RiverKelpieTriggeredAbility2(this); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + return (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD); + } + + @Override + public String getRule() { + return "Whenever a player casts a spell from a graveyard, draw a card."; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/SinkingFeeling.java b/Mage.Sets/src/mage/sets/shadowmoor/SinkingFeeling.java new file mode 100644 index 00000000000..f9885629ad7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/SinkingFeeling.java @@ -0,0 +1,90 @@ +/* + * 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.shadowmoor; + +import java.util.UUID; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.PutCountersSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.SkipEnchantedUntapEffect; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.abilities.effects.common.continious.GainAbilityAttachedEffect; +import mage.abilities.keyword.EnchantAbility; +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; +import mage.counters.CounterType; +import mage.target.TargetPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class SinkingFeeling extends CardImpl { + + public SinkingFeeling(UUID ownerId) { + super(ownerId, 51, "Sinking Feeling", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Aura"); + + this.color.setBlue(true); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // Enchanted creature doesn't untap during its controller's untap step. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipEnchantedUntapEffect())); + + // Enchanted creature has "{1}, Put a -1/-1 counter on this creature: Untap this creature. + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new ManaCostsImpl("{1}")); + ability2.addCost(new PutCountersSourceCost(CounterType.M1M1.createInstance())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(ability2, AttachmentType.AURA, Duration.Custom, "Enchanted creature has \"{1}, Put a -1/-1 counter on this creature: Untap this creature."))); + + } + + public SinkingFeeling(final SinkingFeeling card) { + super(card); + } + + @Override + public SinkingFeeling copy() { + return new SinkingFeeling(this); + } +}