From 17e796427dcdca2b60755125c0fa526b48dc2aa0 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 21 Feb 2015 13:17:37 -0600 Subject: [PATCH 1/4] - Stasis now uses ContinuousRuleModifiyingEffect --- .../src/mage/sets/fifthedition/Stasis.java | 29 +++++-------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/sets/fifthedition/Stasis.java b/Mage.Sets/src/mage/sets/fifthedition/Stasis.java index 330a0a2942a..60ba48c5e51 100644 --- a/Mage.Sets/src/mage/sets/fifthedition/Stasis.java +++ b/Mage.Sets/src/mage/sets/fifthedition/Stasis.java @@ -34,7 +34,7 @@ import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl; import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect; import mage.cards.CardImpl; import mage.game.Game; @@ -71,11 +71,11 @@ public class Stasis extends CardImpl { } } -class SkipUntapStepEffect extends ReplacementEffectImpl { +class SkipUntapStepEffect extends ContinuousRuleModifiyingEffectImpl { public SkipUntapStepEffect() { - super(Duration.WhileOnBattlefield, Outcome.Neutral); - staticText = "Players skip their untap steps"; + super(Duration.WhileOnBattlefield, Outcome.Neutral, false, false); + staticText = "Players skip their uptap steps"; } public SkipUntapStepEffect(final SkipUntapStepEffect effect) { @@ -87,24 +87,11 @@ class SkipUntapStepEffect extends ReplacementEffectImpl { return new SkipUntapStepEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - return true; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP_STEP; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); - return controller != null && controller.getInRange().contains(event.getPlayerId()); + return event.getType() == GameEvent.EventType.UNTAP_STEP + && controller != null + && controller.getInRange().contains(event.getPlayerId()); } -} \ No newline at end of file +} From bd5d56950a561813d99bae70eac6ea57f7e7898f Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 21 Feb 2015 18:09:36 -0600 Subject: [PATCH 2/4] - Added Tyrannize, Impromptu Raid, and Morselhoarder --- .../mage/sets/shadowmoor/ImpromptuRaid.java | 136 +++++++++++++++ .../mage/sets/shadowmoor/Morselhoarder.java | 94 ++++++++++ .../src/mage/sets/shadowmoor/Tyrannize.java | 162 ++++++++++++++++++ 3 files changed, 392 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/ImpromptuRaid.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/Morselhoarder.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java diff --git a/Mage.Sets/src/mage/sets/shadowmoor/ImpromptuRaid.java b/Mage.Sets/src/mage/sets/shadowmoor/ImpromptuRaid.java new file mode 100644 index 00000000000..6fdaafc0e3a --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/ImpromptuRaid.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.MageObject; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.SacrificeTargetEffect; +import mage.abilities.effects.common.continious.GainAbilityTargetEffect; +import mage.abilities.keyword.HasteAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.Cards; +import mage.cards.CardsImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.FilterCard; +import mage.filter.predicate.Predicates; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.game.Game; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public class ImpromptuRaid extends CardImpl { + + public ImpromptuRaid(UUID ownerId) { + super(ownerId, 209, "Impromptu Raid", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{3}{R/G}"); + this.expansionSetCode = "SHM"; + + // {2}{RG}: Reveal the top card of your library. If it isn't a creature card, put it into your graveyard. Otherwise, put that card onto the battlefield. That creature gains haste. Sacrifice it at the beginning of the next end step. + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ImpromptuRaidEffect(), new ManaCostsImpl("{2}{R/G}"))); + + } + + public ImpromptuRaid(final ImpromptuRaid card) { + super(card); + } + + @Override + public ImpromptuRaid copy() { + return new ImpromptuRaid(this); + } +} + +class ImpromptuRaidEffect extends OneShotEffect { + + private static final FilterCard filterPutInGraveyard = new FilterCard("noncreature card to put into your graveyard"); + + static { + filterPutInGraveyard.add(Predicates.not(new CardTypePredicate(CardType.CREATURE))); + } + + public ImpromptuRaidEffect() { + super(Outcome.DrawCard); + this.staticText = "Reveal the top card of your library. If it isn't a creature card, put it into your graveyard. Otherwise, put that card onto the battlefield. That creature gains haste. Sacrifice it at the beginning of the next end step"; + } + + public ImpromptuRaidEffect(final ImpromptuRaidEffect effect) { + super(effect); + } + + @Override + public ImpromptuRaidEffect copy() { + return new ImpromptuRaidEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (sourceObject != null && controller != null) { + Card card = controller.getLibrary().getFromTop(game); + Cards cards = new CardsImpl(); + if (card != null) { + cards.add(card); + controller.revealCards(sourceObject.getLogName(), cards, game); + if (filterPutInGraveyard.match(card, source.getSourceId(), source.getControllerId(), game)) { + controller.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY); + return true; + } + if (controller.putOntoBattlefieldWithInfo(card, game, Zone.LIBRARY, source.getSourceId())) { + ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(card.getId())); + game.addEffect(effect, source); + SacrificeTargetEffect sacrificeEffect = new SacrificeTargetEffect(); + sacrificeEffect.setTargetPointer(new FixedTarget(card.getId())); + DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(sacrificeEffect); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + delayedAbility.setSourceObject(source.getSourceObject(game)); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Morselhoarder.java b/Mage.Sets/src/mage/sets/shadowmoor/Morselhoarder.java new file mode 100644 index 00000000000..ea39bc57e91 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/Morselhoarder.java @@ -0,0 +1,94 @@ +/* + * 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.Mana; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.RemoveCountersSourceCost; +import mage.abilities.effects.common.AddManaOfAnyColorEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.mana.ManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.counters.CounterType; + +/** + * + * @author jeffwadsworth + */ +public class Morselhoarder extends CardImpl { + + public Morselhoarder(UUID ownerId) { + super(ownerId, 212, "Morselhoarder", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{R/G}{R/G}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Elemental"); + this.power = new MageInt(6); + this.toughness = new MageInt(4); + + // Morselhoarder enters the battlefield with two -1/-1 counters on it. + this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2), false))); + + // Remove a -1/-1 counter from Morselhoarder: Add one mana of any color to your mana pool. + this.addAbility(new MorselhoarderAbility()); + + } + + public Morselhoarder(final Morselhoarder card) { + super(card); + } + + @Override + public Morselhoarder copy() { + return new Morselhoarder(this); + } +} + +class MorselhoarderAbility extends ManaAbility { + public MorselhoarderAbility() { + this(new RemoveCountersSourceCost(CounterType.M1M1.createInstance())); + } + + public MorselhoarderAbility(Cost cost) { + super(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), cost); + this.netMana.add(new Mana(0,0,0,0,0,0,1)); + } + + public MorselhoarderAbility(final MorselhoarderAbility ability) { + super(ability); + } + + @Override + public MorselhoarderAbility copy() { + return new MorselhoarderAbility(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java b/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java new file mode 100644 index 00000000000..0df49bbc043 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/Tyrannize.java @@ -0,0 +1,162 @@ +/* + * 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.MageObject; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.costs.Cost; +import mage.abilities.costs.common.PayLifeCost; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.Effects; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.PostResolveEffect; +import mage.abilities.effects.common.discard.DiscardHandTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.game.Game; +import mage.players.Player; +import mage.target.TargetPlayer; +import mage.util.CardUtil; + +/** + * + * @author jeffwadsworth using code from LevelX + */ +public class Tyrannize extends CardImpl { + + private static final String rule = "Pay 7 life? (otherwise discard your hand)"; + + public Tyrannize(UUID ownerId) { + super(ownerId, 201, "Tyrannize", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{3}{B/R}{B/R}"); + this.expansionSetCode = "SHM"; + + // Target player discards his or her hand unless he or she pays 7 life. + this.getSpellAbility().addTarget(new TargetPlayer()); + this.getSpellAbility().addEffect(new DoUnlessTargetPaysEffect(new DiscardHandTargetEffect(), new PayLifeCost(7), rule)); + + } + + public Tyrannize(final Tyrannize card) { + super(card); + } + + @Override + public Tyrannize copy() { + return new Tyrannize(this); + } +} + +class DoUnlessTargetPaysEffect extends OneShotEffect { + protected Effects executingEffects = new Effects(); + private final Cost cost; + private String chooseUseText; + + public DoUnlessTargetPaysEffect(Effect effect, Cost cost) { + this(effect, cost, null); + } + + public DoUnlessTargetPaysEffect(Effect effect, Cost cost, String chooseUseText) { + super(Outcome.Benefit); + this.executingEffects.add(effect); + this.cost = cost; + this.chooseUseText = chooseUseText; + } + + public DoUnlessTargetPaysEffect(final DoUnlessTargetPaysEffect effect) { + super(effect); + this.executingEffects = effect.executingEffects.copy(); + this.cost = effect.cost.copy(); + this.chooseUseText = effect.chooseUseText; + } + + public void addEffect(Effect effect) { + executingEffects.add(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); + MageObject sourceObject = game.getObject(source.getSourceId()); + if (controller != null && sourceObject != null && targetPlayer != null) { + String message; + if (chooseUseText == null) { + String effectText = executingEffects.getText(source.getModes().getMode()); + message = "Pay " + cost.getText() + " to prevent (" + effectText.substring(0, effectText.length() -1) + ")?"; + } else { + message = chooseUseText; + } + message = CardUtil.replaceSourceName(message, sourceObject.getLogName()); + boolean result = true; + boolean doEffect = true; + // check if target player is willing to pay + if (cost.canPay(source, source.getSourceId(), targetPlayer.getId(), game) && targetPlayer.chooseUse(Outcome.Detriment, message, game)) { + cost.clearPaid(); + if (cost.pay(source, game, source.getSourceId(), targetPlayer.getId(), false)) { + game.informPlayers(targetPlayer.getName() + " pays the cost to prevent the effect"); + doEffect = false; + } + } + // do the effects player did not pay + if (doEffect) { + for(Effect effect: executingEffects) { + effect.setTargetPointer(this.targetPointer); + if (effect instanceof OneShotEffect) { + if (!(effect instanceof PostResolveEffect)) { + result &= effect.apply(game, source); + } + } + else { + game.addEffect((ContinuousEffect) effect, source); + } + } + } + return result; + } + return false; + } + + @Override + public String getText(Mode mode) { + if (!staticText.isEmpty()) { + return staticText; + } + String effectsText = executingEffects.getText(mode); + return effectsText.substring(0, effectsText.length() -1) + " unless he or she pays " + cost.getText(); + } + + @Override + public DoUnlessTargetPaysEffect copy() { + return new DoUnlessTargetPaysEffect(this); + } +} From ddce9c5b1a02fb848c8d31c73d20686687d1935a Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 21 Feb 2015 19:59:15 -0600 Subject: [PATCH 3/4] - Added Valleymaker, Tattermunge Witch, Rosheen Meanderer, and Mudbrawler Raiders --- .../sets/shadowmoor/MudbrawlerRaiders.java | 75 ++++++++++++ .../sets/shadowmoor/RosheenMeanderer.java | 107 ++++++++++++++++++ .../sets/shadowmoor/TattermungeWitch.java | 81 +++++++++++++ .../src/mage/sets/shadowmoor/Valleymaker.java | 91 +++++++++++++++ 4 files changed, 354 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerRaiders.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/TattermungeWitch.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java diff --git a/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerRaiders.java b/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerRaiders.java new file mode 100644 index 00000000000..59d981e2947 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/MudbrawlerRaiders.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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SimpleEvasionAbility; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author jeffwadsworth + */ +public class MudbrawlerRaiders extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("blue creatures"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLUE)); + } + + public MudbrawlerRaiders(UUID ownerId) { + super(ownerId, 213, "Mudbrawler Raiders", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{R/G}{R/G}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Goblin"); + this.subtype.add("Warrior"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Mudbrawler Raiders can't be blocked by blue creatures. + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + + } + + public MudbrawlerRaiders(final MudbrawlerRaiders card) { + super(card); + } + + @Override + public MudbrawlerRaiders copy() { + return new MudbrawlerRaiders(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java b/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java new file mode 100644 index 00000000000..80bc63dda1a --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java @@ -0,0 +1,107 @@ +/* + * 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.ConditionalMana; +import mage.MageInt; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.abilities.effects.common.BasicManaEffect; +import mage.abilities.mana.BasicManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.game.Game; + +/** + * + * @author jeffwadsworth + */ +public class RosheenMeanderer extends CardImpl { + + public RosheenMeanderer(UUID ownerId) { + super(ownerId, 214, "Rosheen Meanderer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R/G}"); + this.expansionSetCode = "SHM"; + this.supertype.add("Legendary"); + this.subtype.add("Giant"); + this.subtype.add("Shaman"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // {tap}: Add {4} to your mana pool. Spend this mana only on costs that contain {X}. + this.addAbility(new RosheenMeandererManaAbility()); + + } + + public RosheenMeanderer(final RosheenMeanderer card) { + super(card); + } + + @Override + public RosheenMeanderer copy() { + return new RosheenMeanderer(this); + } +} + +class RosheenMeandererManaAbility extends BasicManaAbility { + + RosheenMeandererManaAbility() { + super(new BasicManaEffect(new RosheenMeandererConditionalMana())); + this.netMana.add(new Mana(0,0,0,0,0,4,0)); + } + + RosheenMeandererManaAbility(RosheenMeandererManaAbility ability) { + super(ability); + } + + @Override + public RosheenMeandererManaAbility copy() { + return new RosheenMeandererManaAbility(this); + } +} + +class RosheenMeandererConditionalMana extends ConditionalMana { + + public RosheenMeandererConditionalMana() { + super(Mana.ColorlessMana(4)); + staticText = "Spend this mana only on costs that contain {X}"; + addCondition(new RosheenMeandererManaCondition()); + } +} + +class RosheenMeandererManaCondition implements Condition { + @Override + public boolean apply(Game game, Ability source) { + MageObject object = game.getObject(source.getSourceId()); + return object != null + && object.getManaCost().getText().contains("X"); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/TattermungeWitch.java b/Mage.Sets/src/mage/sets/shadowmoor/TattermungeWitch.java new file mode 100644 index 00000000000..7e03c3e8895 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/TattermungeWitch.java @@ -0,0 +1,81 @@ +/* + * 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.mana.ManaCostsImpl; +import mage.abilities.effects.common.continious.BoostAllEffect; +import mage.abilities.effects.common.continious.GainAbilityAllEffect; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.BlockedPredicate; + +/** + * + * @author jeffwadsworth + */ +public class TattermungeWitch extends CardImpl { + + static final private FilterCreaturePermanent filter = new FilterCreaturePermanent("Each blocked creature"); + + static { + filter.add(new BlockedPredicate()); + } + + public TattermungeWitch(UUID ownerId) { + super(ownerId, 220, "Tattermunge Witch", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{1}{R/G}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Goblin"); + this.subtype.add("Shaman"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // {R}{G}: Each blocked creature gets +1/+0 and gains trample until end of turn. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), new ManaCostsImpl("{R}{G}")); + ability.addEffect(new GainAbilityAllEffect(TrampleAbility.getInstance(), Duration.EndOfTurn, filter, "and gains trample until end of turn")); + this.addAbility(ability); + + } + + public TattermungeWitch(final TattermungeWitch card) { + super(card); + } + + @Override + public TattermungeWitch copy() { + return new TattermungeWitch(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java b/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java new file mode 100644 index 00000000000..235b5a204aa --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/Valleymaker.java @@ -0,0 +1,91 @@ +/* + * 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.Mana; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.costs.common.SacrificeTargetCost; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect; +import mage.abilities.effects.common.DamageTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.TargetPlayer; +import mage.target.common.TargetControlledPermanent; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author jeffwadsworth + */ +public class Valleymaker extends CardImpl { + + private static final FilterControlledPermanent filter = new FilterControlledPermanent("a Mountain"); + private static final FilterControlledPermanent filter2 = new FilterControlledPermanent("a Forest"); + static { + filter.add(new SubtypePredicate("Mountain")); + filter2.add(new SubtypePredicate("Forest")); + } + + public Valleymaker(UUID ownerId) { + super(ownerId, 221, "Valleymaker", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R/G}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Giant"); + this.subtype.add("Shaman"); + this.power = new MageInt(5); + this.toughness = new MageInt(5); + + // {tap}, Sacrifice a Mountain: Valleymaker deals 3 damage to target creature. + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), new TapSourceCost()); + ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + + // {tap}, Sacrifice a Forest: Choose a player. That player adds {G}{G}{G} to his or her mana pool. + Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddManaToManaPoolTargetControllerEffect(new Mana(0,3,0,0,0,0,0), "chosen player"), new TapSourceCost()); + ability2.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter2))); + ability2.addTarget(new TargetPlayer(1, 1, true)); + this.addAbility(ability2); + } + + public Valleymaker(final Valleymaker card) { + super(card); + } + + @Override + public Valleymaker copy() { + return new Valleymaker(this); + } +} From a3561025f582aef52434083db504ae6c7d6ff8a1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 21 Feb 2015 22:55:16 -0600 Subject: [PATCH 4/4] - Added Medicine Runner, Ravens Run Dragoon, Heartmender, and Blazethorn Scarecrow. --- .../sets/shadowmoor/BlazethornScarecrow.java | 89 +++++++++++ .../src/mage/sets/shadowmoor/Heartmender.java | 112 +++++++++++++ .../mage/sets/shadowmoor/MedicineRunner.java | 151 ++++++++++++++++++ .../sets/shadowmoor/RavensRunDragoon.java | 75 +++++++++ 4 files changed, 427 insertions(+) create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/BlazethornScarecrow.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/MedicineRunner.java create mode 100644 Mage.Sets/src/mage/sets/shadowmoor/RavensRunDragoon.java diff --git a/Mage.Sets/src/mage/sets/shadowmoor/BlazethornScarecrow.java b/Mage.Sets/src/mage/sets/shadowmoor/BlazethornScarecrow.java new file mode 100644 index 00000000000..2e4ca911fdd --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/BlazethornScarecrow.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.sets.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition; +import mage.abilities.decorator.ConditionalContinousEffect; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.common.continious.GainAbilitySourceEffect; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.WitherAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; +import mage.filter.common.FilterControlledCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author jeffwadsworth + */ +public class BlazethornScarecrow extends CardImpl { + + private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("a red creature"); + private static final FilterControlledCreaturePermanent filter2 = new FilterControlledCreaturePermanent("a green creature"); + static { + filter.add(new ColorPredicate(ObjectColor.RED)); + filter2.add(new ColorPredicate(ObjectColor.GREEN)); + } + + private static final String rule = "{this} has haste as long as you control a red creature"; + private static final String rule2 = "{this} has wither as long as you control a green creature"; + + public BlazethornScarecrow(UUID ownerId) { + super(ownerId, 246, "Blazethorn Scarecrow", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{5}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Scarecrow"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Blazethorn Scarecrow has haste as long as you control a red creature. + ContinuousEffect effect = new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.WhileOnBattlefield); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect, new PermanentsOnTheBattlefieldCondition(filter), rule))); + + // Blazethorn Scarecrow has wither as long as you control a green creature. + ContinuousEffect effect2 = new GainAbilitySourceEffect(WitherAbility.getInstance(), Duration.WhileOnBattlefield); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConditionalContinousEffect(effect2, new PermanentsOnTheBattlefieldCondition(filter2), rule2))); + + } + + public BlazethornScarecrow(final BlazethornScarecrow card) { + super(card); + } + + @Override + public BlazethornScarecrow copy() { + return new BlazethornScarecrow(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java new file mode 100644 index 00000000000..788c9d1d5ef --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/Heartmender.java @@ -0,0 +1,112 @@ +/* + * 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.BeginningOfUpkeepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.PersistAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.constants.TargetController; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.filter.common.FilterCreaturePermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author jeffwadsworth + */ +public class Heartmender extends CardImpl { + + public Heartmender(UUID ownerId) { + super(ownerId, 228, "Heartmender", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{2}{G/W}{G/W}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Elemental"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // At the beginning of your upkeep, remove a -1/-1 counter from each creature you control. + this.addAbility(new BeginningOfUpkeepTriggeredAbility(new HeartmenderEffect(CounterType.M1M1.createInstance()), TargetController.YOU, false)); + + // Persist + this.addAbility(new PersistAbility()); + + } + + public Heartmender(final Heartmender card) { + super(card); + } + + @Override + public Heartmender copy() { + return new Heartmender(this); + } +} + +class HeartmenderEffect extends OneShotEffect { + + private final Counter counter; + + public HeartmenderEffect(Counter counter) { + super(Outcome.BoostCreature); + this.counter = counter; + staticText = "remove a -1/-1 counter from each creature you control"; + } + + public HeartmenderEffect(HeartmenderEffect effect) { + super(effect); + this.counter = effect.counter.copy(); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean applied = false; + for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) { + if (creature != null + && creature.getCounters().getCount(counter.getName()) >= counter.getCount()) { + creature.removeCounters(counter.getName(), counter.getCount(), game); + game.informPlayers(new StringBuilder("Removed ").append(counter.getCount()).append(" ").append(counter.getName()) + .append(" counter from ").append(creature.getName()).toString()); + applied = true; + } + } + return applied; + } + + @Override + public HeartmenderEffect copy() { + return new HeartmenderEffect(this); + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/MedicineRunner.java b/Mage.Sets/src/mage/sets/shadowmoor/MedicineRunner.java new file mode 100644 index 00000000000..b11ab87ecd0 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/MedicineRunner.java @@ -0,0 +1,151 @@ +/* + * 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.HashSet; +import java.util.Set; +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.Rarity; +import mage.counters.Counter; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.TargetPermanent; + +/** + * + * @author jeffwadsworth using code from LevelX + */ +public class MedicineRunner extends CardImpl { + + public MedicineRunner(UUID ownerId) { + super(ownerId, 230, "Medicine Runner", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{1}{G/W}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Elf"); + this.subtype.add("Cleric"); + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // When Medicine Runner enters the battlefield, you may remove a counter from target permanent. + Ability ability = new EntersBattlefieldTriggeredAbility(new RemoveCounterTargetEffect(), true); + ability.addTarget(new TargetPermanent()); + this.addAbility(ability); + + } + + public MedicineRunner(final MedicineRunner card) { + super(card); + } + + @Override + public MedicineRunner copy() { + return new MedicineRunner(this); + } +} + +class RemoveCounterTargetEffect extends OneShotEffect { + + private CounterType counterTypeToRemove; + + public RemoveCounterTargetEffect() { + super(Outcome.Detriment); + this.staticText = "remove a counter from target permanent"; + } + + public RemoveCounterTargetEffect(CounterType counterTypeToRemove) { + super(Outcome.Detriment); + this.staticText = "remove a " + counterTypeToRemove.getName() + " counter from target permanent"; + this.counterTypeToRemove = counterTypeToRemove; + } + + public RemoveCounterTargetEffect(final RemoveCounterTargetEffect effect) { + super(effect); + this.counterTypeToRemove = effect.counterTypeToRemove; + } + + @Override + public RemoveCounterTargetEffect copy() { + return new RemoveCounterTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + boolean result = false; + Player controller = game.getPlayer(source.getControllerId()); + for (UUID targetId : getTargetPointer().getTargets(game, source)) { + Permanent permanent = game.getPermanent(targetId); + if (permanent != null) { + if (permanent.getCounters().size() > 0 && (counterTypeToRemove == null || permanent.getCounters().containsKey(counterTypeToRemove))) { + String counterName = null; + if (counterTypeToRemove != null) { + counterName = counterTypeToRemove.getName(); + } else { + if (permanent.getCounters().size() > 1 && counterTypeToRemove == null) { + Choice choice = new ChoiceImpl(true); + Set choices = new HashSet<>(); + for (Counter counter : permanent.getCounters().values()) { + if (permanent.getCounters().getCount(counter.getName()) > 0) { + choices.add(counter.getName()); + } + } + choice.setChoices(choices); + choice.setMessage("Choose a counter type to remove from " + permanent.getName()); + controller.choose(Outcome.Detriment, choice, game); + counterName = choice.getChoice(); + } else { + for (Counter counter : permanent.getCounters().values()) { + if (counter.getCount() > 0) { + counterName = counter.getName(); + } + } + } + } + if (counterName != null) { + permanent.removeCounters(counterName, 1, game); + if (permanent.getCounters().getCount(counterName) == 0) { + permanent.getCounters().removeCounter(counterName); + } + result |= true; + game.informPlayers(new StringBuilder(controller.getName()).append(" removes a ").append(counterName).append(" counter from ").append(permanent.getName()).toString()); + } + } + } + } + return result; + } +} diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RavensRunDragoon.java b/Mage.Sets/src/mage/sets/shadowmoor/RavensRunDragoon.java new file mode 100644 index 00000000000..1a2720139c1 --- /dev/null +++ b/Mage.Sets/src/mage/sets/shadowmoor/RavensRunDragoon.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.shadowmoor; + +import java.util.UUID; +import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.common.SimpleEvasionAbility; +import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.ColorPredicate; + +/** + * + * @author jeffwadsworth + */ +public class RavensRunDragoon extends CardImpl { + + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("black creatures"); + + static { + filter.add(new ColorPredicate(ObjectColor.BLACK)); + } + + public RavensRunDragoon(UUID ownerId) { + super(ownerId, 235, "Raven's Run Dragoon", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{G/W}{G/W}"); + this.expansionSetCode = "SHM"; + this.subtype.add("Elf"); + this.subtype.add("Knight"); + this.power = new MageInt(3); + this.toughness = new MageInt(3); + + // Raven's Run Dragoon can't be blocked by black creatures. + this.addAbility(new SimpleEvasionAbility(new CantBeBlockedByCreaturesSourceEffect(filter, Duration.WhileOnBattlefield))); + + } + + public RavensRunDragoon(final RavensRunDragoon card) { + super(card); + } + + @Override + public RavensRunDragoon copy() { + return new RavensRunDragoon(this); + } +}