From 7650f53dee0b4d480d2a63befed72b6c8197e752 Mon Sep 17 00:00:00 2001 From: LevelX2 Date: Sun, 27 Sep 2015 10:29:30 +0200 Subject: [PATCH] * Rosheen Meanderer - Fixed that the created conditional mana could only be used for spells. --- .../sets/shadowmoor/RosheenMeanderer.java | 19 ++++-- .../test/cards/mana/ConditionalManaTest.java | 65 +++++++++++++++---- .../mage/cards/repository/CardRepository.java | 2 +- 3 files changed, 65 insertions(+), 21 deletions(-) diff --git a/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java b/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java index 80bc63dda1..6907063e21 100644 --- a/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java +++ b/Mage.Sets/src/mage/sets/shadowmoor/RosheenMeanderer.java @@ -37,6 +37,7 @@ import mage.abilities.condition.Condition; import mage.abilities.effects.common.BasicManaEffect; import mage.abilities.mana.BasicManaAbility; import mage.cards.CardImpl; +import mage.constants.AbilityType; import mage.constants.CardType; import mage.constants.Rarity; import mage.game.Game; @@ -56,9 +57,9 @@ public class RosheenMeanderer extends CardImpl { 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}. + // {T}: Add {4} to your mana pool. Spend this mana only on costs that contain {X}. this.addAbility(new RosheenMeandererManaAbility()); - + } public RosheenMeanderer(final RosheenMeanderer card) { @@ -75,7 +76,7 @@ class RosheenMeandererManaAbility extends BasicManaAbility { RosheenMeandererManaAbility() { super(new BasicManaEffect(new RosheenMeandererConditionalMana())); - this.netMana.add(new Mana(0,0,0,0,0,4,0)); + this.netMana.add(new Mana(0, 0, 0, 0, 0, 4, 0)); } RosheenMeandererManaAbility(RosheenMeandererManaAbility ability) { @@ -98,10 +99,16 @@ class RosheenMeandererConditionalMana extends ConditionalMana { } 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"); + if (AbilityType.SPELL.equals(source.getAbilityType())) { + MageObject object = game.getObject(source.getSourceId()); + return object != null + && object.getManaCost().getText().contains("X"); + + } else { + return source.getManaCosts().getText().contains("X"); + } } } diff --git a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java index d7a9ca2029..80560b23be 100644 --- a/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java +++ b/Mage.Tests/src/test/java/org/mage/test/cards/mana/ConditionalManaTest.java @@ -36,7 +36,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase; * * @author LevelX2 */ - public class ConditionalManaTest extends CardTestPlayerBase { @Test @@ -47,11 +46,11 @@ public class ConditionalManaTest extends CardTestPlayerBase { // Target player gains 7 life. addCard(Zone.HAND, playerA, "Heroes' Reunion", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heroes' Reunion", playerA); - + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Heroes' Reunion", playerA); + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - + assertGraveyardCount(playerA, "Heroes' Reunion", 1); assertHandCount(playerA, "Heroes' Reunion", 0); // player A could not cast it assertLife(playerA, 27); @@ -63,16 +62,16 @@ public class ConditionalManaTest extends CardTestPlayerBase { addCard(Zone.BATTLEFIELD, playerA, "Pillar of the Paruns", 2); addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); - castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); + castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); playerA.addChoice("White"); playerA.addChoice("White"); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); assertHandCount(playerA, "Silvercoat Lion", 1); // player A could not cast Silvercoat Lion because the conditional mana is not available } - + @Test public void testWorkingWithReflectingPool() { addCard(Zone.BATTLEFIELD, playerA, "Cavern of Souls", 1); @@ -80,13 +79,13 @@ public class ConditionalManaTest extends CardTestPlayerBase { addCard(Zone.HAND, playerA, "Silvercoat Lion", 1); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - assertPermanentCount(playerA, "Silvercoat Lion", 1); + assertPermanentCount(playerA, "Silvercoat Lion", 1); } - + @Test public void testWorkingWithReflectingPool2() { addCard(Zone.BATTLEFIELD, playerA, "Reflecting Pool", 1); // can create white mana without restriction from the Hive @@ -98,10 +97,48 @@ public class ConditionalManaTest extends CardTestPlayerBase { setChoice(playerA, "White"); castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Silvercoat Lion"); - + setStopAt(1, PhaseStep.BEGIN_COMBAT); execute(); - - assertPermanentCount(playerA, "Silvercoat Lion", 1); - } + + assertPermanentCount(playerA, "Silvercoat Lion", 1); + } + + /** + * I wasunable to use "Rosheen Meanderer" ability to pay for "Candelabra of + * Tawnos" ability even thought it has "X" on its cost + */ + @Test + public void testRosheenMeandererUsingAbility() { + // Flying + addCard(Zone.HAND, playerB, "Snapping Drake", 2); // {3}{U} + // {T}: Add {4} to your mana pool. Spend this mana only on costs that contain {X}. + addCard(Zone.BATTLEFIELD, playerB, "Rosheen Meanderer", 1); + // {X}, {T}: Untap X target lands. + addCard(Zone.BATTLEFIELD, playerB, "Candelabra of Tawnos", 1); + + addCard(Zone.BATTLEFIELD, playerB, "Island", 4); + + castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Snapping Drake"); + + activateManaAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{T}: Add {4}"); + + activateAbility(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "{X},{T}: Untap"); + setChoice(playerB, "X=4"); + addTarget(playerB, "Island"); + addTarget(playerB, "Island"); + addTarget(playerB, "Island"); + addTarget(playerB, "Island"); + + castSpell(2, PhaseStep.POSTCOMBAT_MAIN, playerB, "Snapping Drake"); + + setStopAt(2, PhaseStep.END_TURN); + execute(); + + assertTappedCount("Island", true, 4); + assertTappedCount("Rosheen Meanderer", true, 1); + assertTappedCount("Candelabra of Tawnos", true, 1); + + assertPermanentCount(playerB, "Snapping Drake", 2); + } } diff --git a/Mage/src/mage/cards/repository/CardRepository.java b/Mage/src/mage/cards/repository/CardRepository.java index bb94926761..8a709d9310 100644 --- a/Mage/src/mage/cards/repository/CardRepository.java +++ b/Mage/src/mage/cards/repository/CardRepository.java @@ -63,7 +63,7 @@ public enum CardRepository { // raise this if db structure was changed private static final long CARD_DB_VERSION = 41; // raise this if new cards were added to the server - private static final long CARD_CONTENT_VERSION = 38; + private static final long CARD_CONTENT_VERSION = 39; private final Random random = new Random(); private Dao cardDao;