* Rosheen Meanderer - Fixed that the created conditional mana could only be used for spells.

This commit is contained in:
LevelX2 2015-09-27 10:29:30 +02:00
parent 9e1111748d
commit 7650f53dee
3 changed files with 65 additions and 21 deletions

View file

@ -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,7 +57,7 @@ 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());
}
@ -98,10 +99,16 @@ class RosheenMeandererConditionalMana extends ConditionalMana {
}
class RosheenMeandererManaCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
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");
}
}
}

View file

@ -36,7 +36,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class ConditionalManaTest extends CardTestPlayerBase {
@Test
@ -104,4 +103,42 @@ public class ConditionalManaTest extends CardTestPlayerBase {
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);
}
}

View file

@ -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<CardInfo, Object> cardDao;