From 949eb1acb007ad72f85ca5a73426e8255473154e Mon Sep 17 00:00:00 2001 From: Ryan Skeldon Date: Sat, 26 Nov 2016 02:00:30 -0500 Subject: [PATCH 1/2] Implemented Cairn Wanderer --- Mage.Sets/src/mage/cards/c/CairnWanderer.java | 115 ++++++++++++++++ Mage.Sets/src/mage/sets/Lorwyn.java | 3 +- .../cards/single/lrw/CairnWandererTest.java | 124 ++++++++++++++++++ 3 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/cards/c/CairnWanderer.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/single/lrw/CairnWandererTest.java diff --git a/Mage.Sets/src/mage/cards/c/CairnWanderer.java b/Mage.Sets/src/mage/cards/c/CairnWanderer.java new file mode 100644 index 00000000000..6158d38cb81 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CairnWanderer.java @@ -0,0 +1,115 @@ +package mage.cards.c; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.keyword.ChangelingAbility; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.DoubleStrikeAbility; +import mage.abilities.keyword.FearAbility; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.LandwalkAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.ShroudAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; + +/** + * + * @author psykad + */ +public class CairnWanderer extends CardImpl { + public CairnWanderer(UUID ownerId, CardSetInfo setInfo) { + super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}"); + + this.subtype.add("Shapeshifter"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Changeling + this.addAbility(ChangelingAbility.getInstance()); + + // As long as a creature card with flying is in a graveyard, {this} has flying. The same is true for fear, first strike, double strike, deathtouch, haste, landwalk, lifelink, protection, reach, trample, shroud, and vigilance. + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CairnWandererEffect())); + } + + public CairnWanderer(final CairnWanderer card) { + super(card); + } + + @Override + public CairnWanderer copy() { + return new CairnWanderer(this); + } + + class CairnWandererEffect extends ContinuousEffectImpl { + public CairnWandererEffect() { + super(Duration.WhileOnBattlefield, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility); + staticText = "As long as a creature card with flying is in a graveyard, {this} has flying. The same is true for fear, first strike, double strike, deathtouch, haste, landwalk, lifelink, protection, reach, trample, shroud, and vigilance."; + } + + public CairnWandererEffect(final CairnWandererEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent perm = game.getPermanent(source.getSourceId()); + + if (perm == null) return false; + + for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) { + Player player = game.getPlayer(playerId); + + if (player != null) { + for (Card card : player.getGraveyard().getCards(game)) { + if (card.getCardType().contains(CardType.CREATURE)) { + for (Ability ability : card.getAbilities()) { + if (ability instanceof FlyingAbility || + ability instanceof FearAbility || + ability instanceof FirstStrikeAbility || + ability instanceof DoubleStrikeAbility || + ability instanceof DeathtouchAbility || + ability instanceof HasteAbility || + ability instanceof LandwalkAbility || + ability instanceof LifelinkAbility || + ability instanceof ProtectionAbility || + ability instanceof ReachAbility || + ability instanceof TrampleAbility || + ability instanceof ShroudAbility || + ability instanceof VigilanceAbility) { + perm.addAbility(ability, game); + } + } + } + } + } + } + + return true; + } + + @Override + public CairnWandererEffect copy() { + return new CairnWandererEffect(this); + } + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Lorwyn.java b/Mage.Sets/src/mage/sets/Lorwyn.java index 8b99e20d9c3..a911d9f488b 100644 --- a/Mage.Sets/src/mage/sets/Lorwyn.java +++ b/Mage.Sets/src/mage/sets/Lorwyn.java @@ -86,6 +86,7 @@ public class Lorwyn extends ExpansionSet { cards.add(new SetCardInfo("Brion Stoutarm", 246, Rarity.RARE, mage.cards.b.BrionStoutarm.class)); cards.add(new SetCardInfo("Broken Ambitions", 54, Rarity.COMMON, mage.cards.b.BrokenAmbitions.class)); cards.add(new SetCardInfo("Burrenton Forge-Tender", 7, Rarity.UNCOMMON, mage.cards.b.BurrentonForgeTender.class)); + cards.add(new SetCardInfo("Cairn Wanderer", 105, Rarity.RARE, mage.cards.c.CairnWanderer.class)); cards.add(new SetCardInfo("Caterwauling Boggart", 157, Rarity.COMMON, mage.cards.c.CaterwaulingBoggart.class)); cards.add(new SetCardInfo("Ceaseless Searblades", 158, Rarity.UNCOMMON, mage.cards.c.CeaselessSearblades.class)); cards.add(new SetCardInfo("Cenn's Heir", 8, Rarity.COMMON, mage.cards.c.CennsHeir.class)); @@ -260,7 +261,7 @@ public class Lorwyn extends ExpansionSet { cards.add(new SetCardInfo("Profane Command", 135, Rarity.RARE, mage.cards.p.ProfaneCommand.class)); cards.add(new SetCardInfo("Protective Bubble", 80, Rarity.COMMON, mage.cards.p.ProtectiveBubble.class)); cards.add(new SetCardInfo("Prowess of the Fair", 136, Rarity.UNCOMMON, mage.cards.p.ProwessOfTheFair.class)); - cards.add(new SetCardInfo("Purity", 37, Rarity.RARE, mage.cards.p.Purity.class)); + cards.add(new SetCardInfo("Purity", 37, Rarity.RARE, mage.cards.p.Purity.class)); cards.add(new SetCardInfo("Quill-Slinger Boggart", 137, Rarity.COMMON, mage.cards.q.QuillSlingerBoggart.class)); cards.add(new SetCardInfo("Rebellion of the Flamekin", 188, Rarity.UNCOMMON, mage.cards.r.RebellionOfTheFlamekin.class)); cards.add(new SetCardInfo("Ringskipper", 81, Rarity.COMMON, mage.cards.r.Ringskipper.class)); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/single/lrw/CairnWandererTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/single/lrw/CairnWandererTest.java new file mode 100644 index 00000000000..2f3e6851fe3 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/single/lrw/CairnWandererTest.java @@ -0,0 +1,124 @@ +/* + * 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 org.mage.test.cards.single.lrw; + +import java.util.ArrayList; +import java.util.List; +import mage.abilities.Ability; +import mage.abilities.keyword.DeathtouchAbility; +import mage.abilities.keyword.DoubleStrikeAbility; +import mage.abilities.keyword.FearAbility; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.abilities.keyword.FlyingAbility; +import mage.abilities.keyword.HasteAbility; +import mage.abilities.keyword.LifelinkAbility; +import mage.abilities.keyword.PlainswalkAbility; +import mage.abilities.keyword.ProtectionAbility; +import mage.abilities.keyword.ReachAbility; +import mage.abilities.keyword.ShroudAbility; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.constants.Zone; +import mage.filter.FilterCard; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author psykad + */ +public class CairnWandererTest extends CardTestPlayerBase { + + /* + * Testing: As long as a creature card with flying is in a graveyard, + * {this} has flying. The same is true for fear, first strike, + * double strike, deathtouch, haste, landwalk, lifelink, protection, + * reach, trample, shroud, and vigilance. + */ + @Test + public void TestCairnWandererEffect() { + addCard(Zone.BATTLEFIELD, playerA, "Cairn Wanderer"); + + // Testing FlyingAbility. + addCard(Zone.GRAVEYARD, playerA, "Lantern Kami"); + + // Testing FearAbility. + addCard(Zone.GRAVEYARD, playerA, "Prickly Boggart"); + + // Testing FirstStrikeAbility. + addCard(Zone.GRAVEYARD, playerA, "Serra Zealot"); + + // Testing DoubleStrikeAbility. + addCard(Zone.GRAVEYARD, playerA, "Fencing Ace"); + + // Testing DeathtouchAbility. + addCard(Zone.GRAVEYARD, playerA, "Typhoid Rats"); + + // Testing HasteAbility. + addCard(Zone.GRAVEYARD, playerA, "Raging Goblin"); + + // Testing LandwalkAbility. + addCard(Zone.GRAVEYARD, playerA, "Zodiac Rooster"); + + // Testing LifelinkAbility. + addCard(Zone.GRAVEYARD, playerA, "Trained Caracal"); + + // Testing ProtectionAbility. + addCard(Zone.GRAVEYARD, playerA, "Progenitus"); + + // Testing ReachAbility. + addCard(Zone.GRAVEYARD, playerA, "Tree Monkey"); + + // Testing TrampleAbility. + addCard(Zone.GRAVEYARD, playerA, "Defiant Elf"); + + // Testing ShroudAbility. + addCard(Zone.GRAVEYARD, playerA, "Elvish Lookout"); + + // Testing VigilanceAbility. + addCard(Zone.GRAVEYARD, playerA, "Veteran Cavalier"); + + execute(); + + List abilities = new ArrayList<>(); + abilities.add(FlyingAbility.getInstance()); + abilities.add(FearAbility.getInstance()); + abilities.add(FirstStrikeAbility.getInstance()); + abilities.add(DoubleStrikeAbility.getInstance()); + abilities.add(DeathtouchAbility.getInstance()); + abilities.add(HasteAbility.getInstance()); + abilities.add(LifelinkAbility.getInstance()); + abilities.add(ReachAbility.getInstance()); + abilities.add(ShroudAbility.getInstance()); + abilities.add(TrampleAbility.getInstance()); + abilities.add(VigilanceAbility.getInstance()); + assertAbilities(playerA, "Cairn Wanderer", abilities); + assertAbility(playerA, "Cairn Wanderer", new PlainswalkAbility(), true); + assertAbility(playerA, "Cairn Wanderer", new ProtectionAbility(new FilterCard("everything")), true); // Progenitus - protection from everything. + } +} \ No newline at end of file From ae3750840b6377820ba7d73132cb82918c49bd23 Mon Sep 17 00:00:00 2001 From: Ryan Skeldon Date: Sat, 26 Nov 2016 02:23:27 -0500 Subject: [PATCH 2/2] Added license --- Mage.Sets/src/mage/cards/c/CairnWanderer.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Mage.Sets/src/mage/cards/c/CairnWanderer.java b/Mage.Sets/src/mage/cards/c/CairnWanderer.java index 6158d38cb81..0a48f58f9b0 100644 --- a/Mage.Sets/src/mage/cards/c/CairnWanderer.java +++ b/Mage.Sets/src/mage/cards/c/CairnWanderer.java @@ -1,3 +1,30 @@ +/* + * 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.cards.c; import java.util.UUID;