diff --git a/Mage.Sets/src/mage/sets/darkascension/FeedThePack.java b/Mage.Sets/src/mage/sets/darkascension/FeedThePack.java new file mode 100644 index 00000000000..50640d52474 --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/FeedThePack.java @@ -0,0 +1,114 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Outcome; +import mage.Constants.Rarity; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.filter.Filter; +import mage.filter.common.FilterNonTokenPermanent; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.WolfToken; +import mage.players.Player; +import mage.target.Target; +import mage.target.TargetPermanent; +import mage.target.common.TargetControlledPermanent; + +/** + * + * @author BetaSteward + */ +public class FeedThePack extends CardImpl { + + public FeedThePack(UUID ownerId) { + super(ownerId, 114, "Feed the Pack", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{5}{G}"); + this.expansionSetCode = "DKA"; + + this.color.setGreen(true); + + // At the beginning of your end step, you may sacrifice a nontoken creature. If you do, put X 2/2 green Wolf creature tokens onto the battlefield, where X is the sacrificed creature's toughness. + this.addAbility(new BeginningOfYourEndStepTriggeredAbility(new FeedThePackEffect(), true)); + } + + public FeedThePack(final FeedThePack card) { + super(card); + } + + @Override + public FeedThePack copy() { + return new FeedThePack(this); + } +} + +class FeedThePackEffect extends OneShotEffect { + + private static final FilterNonTokenPermanent filter = new FilterNonTokenPermanent("nontoken creature"); + + static { + filter.getCardType().add(CardType.CREATURE); + filter.setScopeCardType(Filter.ComparisonScope.Any); + filter.setTargetController(Constants.TargetController.YOU); + } + + public FeedThePackEffect() { + super(Constants.Outcome.Sacrifice); + this.staticText = "sacrifice a nontoken creature. If you do, put X 2/2 green Wolf creature tokens onto the battlefield, where X is the sacrificed creature's toughness"; + } + + public FeedThePackEffect(final FeedThePackEffect effect) { + super(effect); + } + + @Override + public FeedThePackEffect copy() { + return new FeedThePackEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Target target = new TargetPermanent(filter); + Player player = game.getPlayer(source.getControllerId()); + if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) { + Permanent permanent = game.getPermanent(target.getFirstTarget()); + if (permanent != null && permanent.sacrifice(source.getSourceId(), game)) { + int toughness = permanent.getToughness().getValue(); + WolfToken token = new WolfToken(); + token.putOntoBattlefield(toughness, game, source.getSourceId(), source.getControllerId()); + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java b/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java new file mode 100644 index 00000000000..63d5b4777ce --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/FlayerOfTheHatebound.java @@ -0,0 +1,157 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.keyword.UndyingAbility; +import mage.cards.CardImpl; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.common.TargetCreatureOrPlayer; + +/** + * + * @author BetaSteward + */ +public class FlayerOfTheHatebound extends CardImpl { + + public FlayerOfTheHatebound(UUID ownerId) { + super(ownerId, 89, "Flayer of the Hatebound", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{5}{R}"); + this.expansionSetCode = "DKA"; + this.subtype.add("Devil"); + + this.color.setRed(true); + this.power = new MageInt(4); + this.toughness = new MageInt(2); + + this.addAbility(new UndyingAbility()); + + // Whenever Flayer of the Hatebound or another creature enters the battlefield from your graveyard, that creature deals damage equal to its power to target creature or player. + Ability ability = new FlayerTriggeredAbility(); + ability.addTarget(new TargetCreatureOrPlayer()); + this.addAbility(ability); + } + + public FlayerOfTheHatebound(final FlayerOfTheHatebound card) { + super(card); + } + + @Override + public FlayerOfTheHatebound copy() { + return new FlayerOfTheHatebound(this); + } +} + +class FlayerTriggeredAbility extends TriggeredAbilityImpl { + + public FlayerTriggeredAbility() { + super(Constants.Zone.BATTLEFIELD, new FlayerEffect(), false); + } + + public FlayerTriggeredAbility(FlayerTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getType() == GameEvent.EventType.ZONE_CHANGE) { + Permanent permanent = game.getPermanent(event.getTargetId()); + if (((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD + && ((ZoneChangeEvent) event).getFromZone() == Constants.Zone.GRAVEYARD + && permanent.getOwnerId().equals(controllerId) + && permanent.getCardType().contains(CardType.CREATURE)) { + Effect effect = this.getEffects().get(0); + effect.setValue("damageSource", event.getTargetId()); + return true; + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever Flayer of the Hatebound or another creature enters the battlefield from your graveyard, that creature deals damage equal to its power to target creature or player."; + } + + @Override + public FlayerTriggeredAbility copy() { + return new FlayerTriggeredAbility(this); + } +} + +class FlayerEffect extends OneShotEffect { + + public FlayerEffect() { + super(Constants.Outcome.Damage); + staticText = "that creature deals damage equal to its power to target creature or player"; + } + + public FlayerEffect(final FlayerEffect effect) { + super(effect); + } + + @Override + public FlayerEffect copy() { + return new FlayerEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + UUID creatureId = (UUID) getValue("damageSource"); + Permanent creature = game.getPermanent(creatureId); + if (creature == null) { + creature = (Permanent) game.getLastKnownInformation(creatureId, Constants.Zone.BATTLEFIELD); + } + if (creature != null) { + int amount = creature.getPower().getValue(); + UUID target = source.getTargets().getFirstTarget(); + Permanent targetCreature = game.getPermanent(target); + if (targetCreature != null) { + targetCreature.damage(amount, creature.getId(), game, true, false); + return true; + } + Player player = game.getPlayer(target); + if (player != null) { + player.damage(amount, creature.getId(), game, false, true); + return true; + } + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/darkascension/LoyalCathar.java b/Mage.Sets/src/mage/sets/darkascension/LoyalCathar.java new file mode 100644 index 00000000000..13b0db5a6dc --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/LoyalCathar.java @@ -0,0 +1,148 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.DiesTriggeredAbility; +import mage.abilities.common.delayed.AtEndOfTurnDelayedTriggeredAbility; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnFromExileEffect; +import mage.abilities.keyword.TransformAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.cards.Card; +import mage.cards.CardImpl; +import mage.game.ExileZone; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * + * @author BetaSteward + */ +public class LoyalCathar extends CardImpl { + + public LoyalCathar(UUID ownerId) { + super(ownerId, 13, "Loyal Cathar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{W}{W}"); + this.expansionSetCode = "DKA"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + + this.canTransform = true; + this.secondSideCard = new UnhallowedCathar(ownerId); + + this.color.setWhite(true); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + this.addAbility(VigilanceAbility.getInstance()); + + // When Loyal Cathar dies, return it to the battlefield transformed under your control at the beginning of the next end step. + this.addAbility(new TransformAbility()); + this.addAbility(new DiesTriggeredAbility(new LoyalCatharEffect())); + } + + public LoyalCathar(final LoyalCathar card) { + super(card); + } + + @Override + public LoyalCathar copy() { + return new LoyalCathar(this); + } +} + +class LoyalCatharEffect extends OneShotEffect { + + private static final String effectText = "return it to the battlefield transformed under your control at the beginning of the next end step"; + + LoyalCatharEffect ( ) { + super(Constants.Outcome.Benefit); + staticText = effectText; + } + + LoyalCatharEffect(LoyalCatharEffect effect) { + super(effect); + } + + @Override + public boolean apply(Game game, Ability source) { + //create delayed triggered ability + AtEndOfTurnDelayedTriggeredAbility delayedAbility = new AtEndOfTurnDelayedTriggeredAbility(new ReturnLoyalCatharEffect(source.getSourceId())); + delayedAbility.setSourceId(source.getSourceId()); + delayedAbility.setControllerId(source.getControllerId()); + game.addDelayedTriggeredAbility(delayedAbility); + return true; + } + + @Override + public LoyalCatharEffect copy() { + return new LoyalCatharEffect(this); + } + +} + +class ReturnLoyalCatharEffect extends OneShotEffect { + + private UUID cardId; + + public ReturnLoyalCatharEffect(UUID cardId) { + super(Constants.Outcome.PutCardInPlay); + this.cardId = cardId; + this.staticText = "return it to the battlefield transformed under your control"; + } + + public ReturnLoyalCatharEffect(final ReturnLoyalCatharEffect effect) { + super(effect); + this.cardId = effect.cardId; + } + + @Override + public ReturnLoyalCatharEffect copy() { + return new ReturnLoyalCatharEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Card card = game.getCard(cardId); + if (card != null) { + card.putOntoBattlefield(game, Constants.Zone.GRAVEYARD, source.getSourceId(), source.getControllerId()); + Permanent perm = game.getPermanent(cardId); + if (perm != null && perm.canTransform()) { + perm.transform(game); + return true; + } + } + return false; + } + +} diff --git a/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java b/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java new file mode 100644 index 00000000000..f75aa50da64 --- /dev/null +++ b/Mage.Sets/src/mage/sets/darkascension/UnhallowedCathar.java @@ -0,0 +1,68 @@ +/* + * 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.darkascension; + +import java.util.UUID; +import mage.Constants.CardType; +import mage.Constants.Rarity; +import mage.MageInt; +import mage.abilities.common.CantBlockAbility; +import mage.cards.CardImpl; + +/** + * + * @author BetaSteward + */ +public class UnhallowedCathar extends CardImpl { + + public UnhallowedCathar(UUID ownerId) { + super(ownerId, 13, "Unhallowed Cathar", Rarity.COMMON, new CardType[]{CardType.CREATURE}, ""); + this.expansionSetCode = "DKA"; + this.subtype.add("Zombie"); + this.subtype.add("Soldier"); + + // this card is the second face of double-faced card + this.nightCard = true; + this.canTransform = true; + + this.power = new MageInt(2); + this.toughness = new MageInt(1); + + // Unhallowed Cathar can't block. + this.addAbility(CantBlockAbility.getInstance()); + } + + public UnhallowedCathar(final UnhallowedCathar card) { + super(card); + } + + @Override + public UnhallowedCathar copy() { + return new UnhallowedCathar(this); + } +} diff --git a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianIngester.java b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianIngester.java index 0747d5f2efd..5cc486e0a13 100644 --- a/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianIngester.java +++ b/Mage.Sets/src/mage/sets/newphyrexia/PhyrexianIngester.java @@ -43,11 +43,11 @@ import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.OneShotEffect; import mage.cards.Card; import mage.cards.CardImpl; -import mage.filter.common.FilterCreaturePermanent; +import mage.filter.Filter; +import mage.filter.common.FilterNonTokenPermanent; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.game.permanent.PermanentToken; -import mage.target.common.TargetCreaturePermanent; +import mage.target.TargetPermanent; /** * @@ -55,6 +55,13 @@ import mage.target.common.TargetCreaturePermanent; */ public class PhyrexianIngester extends CardImpl { + private static final FilterNonTokenPermanent filter = new FilterNonTokenPermanent("nontoken creature"); + + static { + filter.getCardType().add(CardType.CREATURE); + filter.setScopeCardType(Filter.ComparisonScope.Any); + } + public PhyrexianIngester(UUID ownerId) { super(ownerId, 41, "Phyrexian Ingester", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{U}"); this.expansionSetCode = "NPH"; @@ -66,22 +73,7 @@ public class PhyrexianIngester extends CardImpl { // Imprint - When Phyrexian Ingester enters the battlefield, you may exile target nontoken creature. Ability ability = new EntersBattlefieldTriggeredAbility(new PhyrexianIngesterImprintEffect(), true); - FilterCreaturePermanent filter = new FilterCreaturePermanent("nontoken creature") { - - @Override - public boolean match(Permanent permanent) { - if (!super.match(permanent)) { - return notFilter; - } - - if (permanent instanceof PermanentToken) { - return notFilter; - } - - return !notFilter; - } - }; - ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addTarget(new TargetPermanent(filter)); this.addAbility(ability); // Phyrexian Ingester gets +X/+Y, where X is the exiled creature card's power and Y is its toughness. this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PhyrexianIngesterBoostEffect())); diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/TestFeedThePack.java b/Mage.Tests/src/test/java/org/mage/test/cards/TestFeedThePack.java new file mode 100644 index 00000000000..12b99918e45 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/TestFeedThePack.java @@ -0,0 +1,28 @@ +package org.mage.test.cards; + +import mage.Constants; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author BetaSteward + */ +public class TestFeedThePack extends CardTestPlayerBase { + + @Test + public void testCard() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Feed the Pack"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Craw Wurm"); + + setStopAt(2, Constants.PhaseStep.DRAW); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + assertPermanentCount(playerA, "Wolf", 4); + assertPermanentCount(playerB, "Craw Wurm", 0); + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/TestFlayerOfTheHatebound.java b/Mage.Tests/src/test/java/org/mage/test/cards/TestFlayerOfTheHatebound.java new file mode 100644 index 00000000000..15e28335495 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/TestFlayerOfTheHatebound.java @@ -0,0 +1,67 @@ +package org.mage.test.cards; + +import mage.Constants; +import mage.filter.Filter; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * also tests undying + * + * @author BetaSteward + */ +public class TestFlayerOfTheHatebound extends CardTestPlayerBase { + + @Test + public void testCard() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Flayer of the Hatebound"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain", 1); + addCard(Constants.Zone.HAND, playerA, "Lightning Bolt", 1); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Flayer of the Hatebound"); + setStopAt(2, Constants.PhaseStep.DRAW); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 15); + assertPermanentCount(playerA, "Flayer of the Hatebound", 1); + assertPowerToughness(playerA, "Flayer of the Hatebound", 5, 3, Filter.ComparisonScope.Any); + } + + @Test + public void testCard1() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Flayer of the Hatebound"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Swamp", 2); + addCard(Constants.Zone.GRAVEYARD, playerA, "Reassembling Skeleton", 1); + + activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "{1}{B}:"); + setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 19); + assertPermanentCount(playerA, "Flayer of the Hatebound", 1); + assertPermanentCount(playerA, "Reassembling Skeleton", 1); + assertPowerToughness(playerA, "Flayer of the Hatebound", 4, 2, Filter.ComparisonScope.Any); + } + + @Test + public void testCard2() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Flayer of the Hatebound"); + addCard(Constants.Zone.BATTLEFIELD, playerB, "Swamp", 2); + addCard(Constants.Zone.GRAVEYARD, playerB, "Reassembling Skeleton", 1); + + activateAbility(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerB, "{1}{B}:"); + setStopAt(1, Constants.PhaseStep.BEGIN_COMBAT); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + assertPermanentCount(playerA, "Flayer of the Hatebound", 1); + assertPermanentCount(playerB, "Reassembling Skeleton", 1); + assertPowerToughness(playerA, "Flayer of the Hatebound", 4, 2, Filter.ComparisonScope.Any); + } + +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/TestUnhallowedCathar.java b/Mage.Tests/src/test/java/org/mage/test/cards/TestUnhallowedCathar.java new file mode 100644 index 00000000000..36ed3b381e2 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/TestUnhallowedCathar.java @@ -0,0 +1,30 @@ +package org.mage.test.cards; + +import mage.Constants; +import org.junit.Ignore; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author BetaSteward + */ +public class TestUnhallowedCathar extends CardTestPlayerBase { + + @Test + public void testCard() { + addCard(Constants.Zone.BATTLEFIELD, playerA, "Mountain"); + addCard(Constants.Zone.BATTLEFIELD, playerA, "Loyal Cathar"); + addCard(Constants.Zone.HAND, playerA, "Lightning Bolt"); + + castSpell(1, Constants.PhaseStep.PRECOMBAT_MAIN, playerA, "Lightning Bolt", "Loyal Cathar"); + setStopAt(2, Constants.PhaseStep.DRAW); + execute(); + + assertLife(playerA, 20); + assertLife(playerB, 20); + assertPermanentCount(playerA, "Loyal Cathar", 0); + assertPermanentCount(playerA, "Unhallowed Cathar", 1); + } + +} diff --git a/Mage/src/mage/filter/common/FilterNonTokenPermanent.java b/Mage/src/mage/filter/common/FilterNonTokenPermanent.java new file mode 100644 index 00000000000..2ffe30ee9bc --- /dev/null +++ b/Mage/src/mage/filter/common/FilterNonTokenPermanent.java @@ -0,0 +1,71 @@ +/* +* Copyright 2012 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.filter.common; + +import mage.filter.FilterPermanent; +import mage.game.permanent.Permanent; +import mage.game.permanent.PermanentToken; + +/** + * + * @author BetaSteward_at_googlemail.com + */ +public class FilterNonTokenPermanent extends FilterPermanent { + + public FilterNonTokenPermanent() { + this("nontoken permanent"); + } + + public FilterNonTokenPermanent(String name) { + super(name); + } + + public FilterNonTokenPermanent(final FilterNonTokenPermanent filter) { + super(filter); + } + + @Override + public boolean match(Permanent permanent) { + if (!super.match(permanent)) { + return notFilter; + } + + if (permanent instanceof PermanentToken) { + return notFilter; + } + + return !notFilter; + } + + @Override + public FilterNonTokenPermanent copy() { + return new FilterNonTokenPermanent(this); + } + +}