From 94ad36058c955e92b0184dc6730db29e6ddc6d9d Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Wed, 24 Jun 2015 00:11:03 +0200 Subject: [PATCH] [ORI] Added 5 cards with Renown relation and a renown test. --- .../sets/magicorigins/EnshroudingMist.java | 75 +++++++++ .../sets/magicorigins/HonoredHierarch.java | 87 +++++++++++ .../magicorigins/KnightOfThePilgrimsRoad.java | 63 ++++++++ .../mage/sets/magicorigins/RelicSeeker.java | 81 ++++++++++ .../mage/sets/magicorigins/RhoxMaulers.java | 66 ++++++++ .../mage/sets/mediainserts/RelicSeeker.java | 55 +++++++ .../cards/abilities/keywords/RenownTest.java | 142 ++++++++++++++++++ ...ecomesMonstrousSourceTriggeredAbility.java | 1 - .../BecomesRenownSourceTriggeredAbility.java | 59 ++++++++ .../condition/common/RenownCondition.java | 47 ++++++ 10 files changed, 675 insertions(+), 1 deletion(-) create mode 100644 Mage.Sets/src/mage/sets/magicorigins/EnshroudingMist.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/HonoredHierarch.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/KnightOfThePilgrimsRoad.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/RelicSeeker.java create mode 100644 Mage.Sets/src/mage/sets/magicorigins/RhoxMaulers.java create mode 100644 Mage.Sets/src/mage/sets/mediainserts/RelicSeeker.java create mode 100644 Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RenownTest.java create mode 100644 Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java create mode 100644 Mage/src/mage/abilities/condition/common/RenownCondition.java diff --git a/Mage.Sets/src/mage/sets/magicorigins/EnshroudingMist.java b/Mage.Sets/src/mage/sets/magicorigins/EnshroudingMist.java new file mode 100644 index 00000000000..9c81ff6e17d --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/EnshroudingMist.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.magicorigins; + +import java.util.UUID; +import mage.abilities.condition.common.RenownCondition; +import mage.abilities.decorator.ConditionalOneShotEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.PreventDamageToTargetEffect; +import mage.abilities.effects.common.UntapSourceEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author LevelX2 + */ +public class EnshroudingMist extends CardImpl { + + public EnshroudingMist(UUID ownerId) { + super(ownerId, 13, "Enshrouding Mist", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{W}"); + this.expansionSetCode = "ORI"; + + // Target creature gets +1/+1 until end of turn. Prevent all damage that would dealt to it this turn. If it's renowned, untap it. + this.getSpellAbility().addEffect(new BoostTargetEffect(1, 1, Duration.EndOfTurn)); + Effect effect = new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE); + effect.setText("Prevent all damage that would dealt to it this turn"); + this.getSpellAbility().addEffect(effect); + OneShotEffect effect2 = new UntapSourceEffect(); + effect2.setText("untap it"); + this.getSpellAbility().addEffect(new ConditionalOneShotEffect(effect2, RenownCondition.getInstance())); + this.getSpellAbility().addTarget(new TargetCreaturePermanent()); + + + } + + public EnshroudingMist(final EnshroudingMist card) { + super(card); + } + + @Override + public EnshroudingMist copy() { + return new EnshroudingMist(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/HonoredHierarch.java b/Mage.Sets/src/mage/sets/magicorigins/HonoredHierarch.java new file mode 100644 index 00000000000..d09a2fb9e63 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/HonoredHierarch.java @@ -0,0 +1,87 @@ +/* + * 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.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.RenownCondition; +import mage.abilities.decorator.ConditionalContinuousEffect; +import mage.abilities.effects.Effect; +import mage.abilities.effects.common.continuous.GainAbilitySourceEffect; +import mage.abilities.keyword.RenownAbility; +import mage.abilities.keyword.VigilanceAbility; +import mage.abilities.mana.AnyColorManaAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Rarity; +import mage.constants.Zone; + +/** + * + * @author LevelX2 + */ +public class HonoredHierarch extends CardImpl { + + public HonoredHierarch(UUID ownerId) { + super(ownerId, 182, "Honored Hierarch", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{G}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Human"); + this.subtype.add("Druid"); + this.power = new MageInt(1); + this.toughness = new MageInt(1); + + // Renown 1 (When this creature deals combat damage to a player, if it isn't renowned put a +1/+1 counter on it and it becomes renowned.) + this.addAbility(new RenownAbility(1)); + + // As long as Honored Hierarch is renowned, it has vigilance and "{T}: Add one mana of any color to your mana pool." + Effect effect = new ConditionalContinuousEffect( + new GainAbilitySourceEffect(VigilanceAbility.getInstance(), Duration.WhileOnBattlefield), + RenownCondition.getInstance(), + "As long as {this} is renown, it has vigilance"); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect); + effect = new ConditionalContinuousEffect( + new GainAbilitySourceEffect(new AnyColorManaAbility(), Duration.WhileOnBattlefield), + RenownCondition.getInstance(), + "and \"{T}: Add one mana of any color to your mana pool.\""); + ability.addEffect(effect); + this.addAbility(ability); + + } + + public HonoredHierarch(final HonoredHierarch card) { + super(card); + } + + @Override + public HonoredHierarch copy() { + return new HonoredHierarch(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/KnightOfThePilgrimsRoad.java b/Mage.Sets/src/mage/sets/magicorigins/KnightOfThePilgrimsRoad.java new file mode 100644 index 00000000000..78462196d1c --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/KnightOfThePilgrimsRoad.java @@ -0,0 +1,63 @@ +/* + * 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.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.keyword.RenownAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class KnightOfThePilgrimsRoad extends CardImpl { + + public KnightOfThePilgrimsRoad(UUID ownerId) { + super(ownerId, 20, "Knight of the Pilgrim's Road", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Human"); + this.subtype.add("Knight"); + this.power = new MageInt(3); + this.toughness = new MageInt(2); + + // Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.) + this.addAbility(new RenownAbility(1)); + } + + public KnightOfThePilgrimsRoad(final KnightOfThePilgrimsRoad card) { + super(card); + } + + @Override + public KnightOfThePilgrimsRoad copy() { + return new KnightOfThePilgrimsRoad(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/RelicSeeker.java b/Mage.Sets/src/mage/sets/magicorigins/RelicSeeker.java new file mode 100644 index 00000000000..612b08ceacb --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/RelicSeeker.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.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.common.BecomesRenownSourceTriggeredAbility; +import mage.abilities.effects.common.search.SearchLibraryPutInHandEffect; +import mage.abilities.keyword.RenownAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; +import mage.filter.FilterCard; +import mage.filter.predicate.mageobject.CardTypePredicate; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.target.common.TargetCardInLibrary; + +/** + * + * @author LevelX2 + */ +public class RelicSeeker extends CardImpl { + + private static final FilterCard filter = new FilterCard("an Equipment card"); + + static { + filter.add(new CardTypePredicate(CardType.ARTIFACT)); + filter.add(new SubtypePredicate("Equipment")); + } + + public RelicSeeker(UUID ownerId) { + super(ownerId, 107, "Relic Seeker", Rarity.SPECIAL, new CardType[]{CardType.CREATURE}, "{1}{W}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Human"); + this.subtype.add("Soldier"); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Renown 1 + this.addAbility(new RenownAbility(1)); + + // When Relic Seeker becomes renowned, you may search your library for an Equipment card, reveal it, put it into your hand, then shuffle your library. + TargetCardInLibrary target = new TargetCardInLibrary(1, 1, filter); + this.addAbility(new BecomesRenownSourceTriggeredAbility(new SearchLibraryPutInHandEffect(target, true, true), true)); + + } + + public RelicSeeker(final RelicSeeker card) { + super(card); + } + + @Override + public RelicSeeker copy() { + return new RelicSeeker(this); + } +} diff --git a/Mage.Sets/src/mage/sets/magicorigins/RhoxMaulers.java b/Mage.Sets/src/mage/sets/magicorigins/RhoxMaulers.java new file mode 100644 index 00000000000..0ca73fcf3a7 --- /dev/null +++ b/Mage.Sets/src/mage/sets/magicorigins/RhoxMaulers.java @@ -0,0 +1,66 @@ +/* + * 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.magicorigins; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.keyword.TrampleAbility; +import mage.abilities.keyword.RenownAbility; +import mage.cards.CardImpl; +import mage.constants.CardType; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class RhoxMaulers extends CardImpl { + + public RhoxMaulers(UUID ownerId) { + super(ownerId, 196, "Rhox Maulers", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{G}"); + this.expansionSetCode = "ORI"; + this.subtype.add("Rhino"); + this.subtype.add("Soldier"); + this.power = new MageInt(4); + this.toughness = new MageInt(4); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + // Renown 2 + this.addAbility(new RenownAbility(2)); + } + + public RhoxMaulers(final RhoxMaulers card) { + super(card); + } + + @Override + public RhoxMaulers copy() { + return new RhoxMaulers(this); + } +} diff --git a/Mage.Sets/src/mage/sets/mediainserts/RelicSeeker.java b/Mage.Sets/src/mage/sets/mediainserts/RelicSeeker.java new file mode 100644 index 00000000000..bf67641740e --- /dev/null +++ b/Mage.Sets/src/mage/sets/mediainserts/RelicSeeker.java @@ -0,0 +1,55 @@ +/* + * 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.mediainserts; + +import java.util.UUID; +import mage.constants.Rarity; + +/** + * + * @author LevelX2 + */ +public class RelicSeeker extends mage.sets.magicorigins.RelicSeeker { + + public RelicSeeker(UUID ownerId) { + super(ownerId); + this.cardNumber = 107; + this.expansionSetCode = "MBP"; + this.rarity = Rarity.RARE; + + } + + public RelicSeeker(final RelicSeeker card) { + super(card); + } + + @Override + public RelicSeeker copy() { + return new RelicSeeker(this); + } +} diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RenownTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RenownTest.java new file mode 100644 index 00000000000..7db71b19598 --- /dev/null +++ b/Mage.Tests/src/test/java/org/mage/test/cards/abilities/keywords/RenownTest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, are + * permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The views and conclusions contained in the software and documentation are those of the + * authors and should not be interpreted as representing official policies, either expressed + * or implied, of BetaSteward_at_googlemail.com. + */ +package org.mage.test.cards.abilities.keywords; + +import mage.abilities.keyword.VigilanceAbility; +import mage.constants.PhaseStep; +import mage.constants.Zone; +import org.junit.Test; +import org.mage.test.serverside.base.CardTestPlayerBase; + +/** + * + * @author LevelX2 + */ +public class RenownTest extends CardTestPlayerBase { + + @Test + public void testKnightOfThePilgrimsRoad() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 3); + // Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.) + addCard(Zone.HAND, playerA, "Knight of the Pilgrim's Road"); // 3/2 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Knight of the Pilgrim's Road"); + + attack(3, playerA, "Knight of the Pilgrim's Road"); // 3 damage + attack(5, playerA, "Knight of the Pilgrim's Road"); // 4 damage + attack(7, playerA, "Knight of the Pilgrim's Road"); // 4 damage + + setStopAt(7, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPowerToughness(playerA, "Knight of the Pilgrim's Road", 4, 3); + + assertLife(playerA, 20); + assertLife(playerB, 9); + + } + + /** + * Test renown trigger + */ + @Test + public void testRelicSeeker() { + addCard(Zone.BATTLEFIELD, playerA, "Plains", 2); + // Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.) + // When Relic Seeker becomes renowned, you may search your library for an Equipment card, reveal it, put it into your hand, then shuffle your library. + addCard(Zone.HAND, playerA, "Relic Seeker"); // 2/2 + + addCard(Zone.LIBRARY, playerA, "Veteran's Sidearm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Relic Seeker"); + + attack(3, playerA, "Relic Seeker"); // 2 damage + attack(5, playerA, "Relic Seeker"); // 3 damage + + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPowerToughness(playerA, "Relic Seeker", 3, 3); + assertHandCount(playerA, "Veteran's Sidearm", 1); + + assertLife(playerA, 20); + assertLife(playerB, 15); + + } + + /** + * Test renown state + */ + @Test + public void testHonoredHierarch() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 1); + // As long as Honored Hierarch is renowned, it has vigilance and "{T}: Add one mana of any color to your mana pool." + addCard(Zone.HAND, playerA, "Honored Hierarch"); // 1/1 + + addCard(Zone.LIBRARY, playerA, "Veteran's Sidearm"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Honored Hierarch"); + + attack(3, playerA, "Honored Hierarch"); // 1 damage + attack(5, playerA, "Honored Hierarch"); // 2 damage + + setStopAt(5, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPowerToughness(playerA, "Honored Hierarch", 2, 2); + assertTapped("Honored Hierarch", false); + assertAbility(playerA, "Honored Hierarch", VigilanceAbility.getInstance(), true); + + assertLife(playerA, 20); + assertLife(playerB, 17); + + } + /** + * Test renown > 1 + */ + @Test + public void testRhoxMaulers() { + addCard(Zone.BATTLEFIELD, playerA, "Forest", 5); + // Trample + // Renown 2 + addCard(Zone.HAND, playerA, "Rhox Maulers"); // 4/4 + + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Rhox Maulers"); + + attack(3, playerA, "Rhox Maulers"); // 4 damage + attack(5, playerA, "Rhox Maulers"); // 6 damage + attack(7, playerA, "Rhox Maulers"); // 6 damage + + setStopAt(7, PhaseStep.POSTCOMBAT_MAIN); + execute(); + + assertPowerToughness(playerA, "Rhox Maulers", 6, 6); + + assertLife(playerA, 20); + assertLife(playerB, 4); + + } +} diff --git a/Mage/src/mage/abilities/common/BecomesMonstrousSourceTriggeredAbility.java b/Mage/src/mage/abilities/common/BecomesMonstrousSourceTriggeredAbility.java index 42f1dfec1f2..ad847267547 100644 --- a/Mage/src/mage/abilities/common/BecomesMonstrousSourceTriggeredAbility.java +++ b/Mage/src/mage/abilities/common/BecomesMonstrousSourceTriggeredAbility.java @@ -32,7 +32,6 @@ import mage.abilities.effects.Effect; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; /** * diff --git a/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java b/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java new file mode 100644 index 00000000000..0864328cee7 --- /dev/null +++ b/Mage/src/mage/abilities/common/BecomesRenownSourceTriggeredAbility.java @@ -0,0 +1,59 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.common; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.Effect; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; + +/** + * + * @author LevelX2 + */ + +public class BecomesRenownSourceTriggeredAbility extends TriggeredAbilityImpl { + + private int renownValue; + + public BecomesRenownSourceTriggeredAbility(Effect effect, boolean optional) { + super(Zone.BATTLEFIELD, effect, optional); + } + + public BecomesRenownSourceTriggeredAbility(final BecomesRenownSourceTriggeredAbility ability) { + super(ability); + this.renownValue = ability.renownValue; + } + + @Override + public BecomesRenownSourceTriggeredAbility copy() { + return new BecomesRenownSourceTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.BECOMES_RENOWN; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + if (event.getSourceId().equals(this.getSourceId())) { + this.renownValue = event.getAmount(); + return true; + } + return false; + } + + public int getRenownValue() { + return renownValue; + } + + @Override + public String getRule() { + return "When {this} becomes monstrous, " + super.getRule(); + } +} \ No newline at end of file diff --git a/Mage/src/mage/abilities/condition/common/RenownCondition.java b/Mage/src/mage/abilities/condition/common/RenownCondition.java new file mode 100644 index 00000000000..1e00bba4426 --- /dev/null +++ b/Mage/src/mage/abilities/condition/common/RenownCondition.java @@ -0,0 +1,47 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.condition.common; + +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; +import mage.game.permanent.Permanent; + +/** + * Checks if a Permanent is renown + * + * @author LevelX2 + */ + +public class RenownCondition implements Condition { + + private static RenownCondition fInstance = null; + + private RenownCondition() {} + + public static RenownCondition getInstance() { + if (fInstance == null) { + fInstance = new RenownCondition(); + } + return fInstance; + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getSourceId()); + if (permanent != null) { + return permanent.isRenown(); + } + return false; + } + + @Override + public String toString() { + return "it's renowned"; + } + + +} \ No newline at end of file