From a3561025f582aef52434083db504ae6c7d6ff8a1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 21 Feb 2015 22:55:16 -0600 Subject: [PATCH] - 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 0000000000..2e4ca911fd --- /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 0000000000..788c9d1d5e --- /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 0000000000..b11ab87ecd --- /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 0000000000..1a2720139c --- /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); + } +}