mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
* Rosheen Meanderer - Fixed that the created conditional mana could only be used for spells.
This commit is contained in:
parent
9e1111748d
commit
7650f53dee
3 changed files with 65 additions and 21 deletions
|
@ -37,6 +37,7 @@ import mage.abilities.condition.Condition;
|
||||||
import mage.abilities.effects.common.BasicManaEffect;
|
import mage.abilities.effects.common.BasicManaEffect;
|
||||||
import mage.abilities.mana.BasicManaAbility;
|
import mage.abilities.mana.BasicManaAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.AbilityType;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -56,7 +57,7 @@ public class RosheenMeanderer extends CardImpl {
|
||||||
this.power = new MageInt(4);
|
this.power = new MageInt(4);
|
||||||
this.toughness = 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());
|
this.addAbility(new RosheenMeandererManaAbility());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -75,7 +76,7 @@ class RosheenMeandererManaAbility extends BasicManaAbility {
|
||||||
|
|
||||||
RosheenMeandererManaAbility() {
|
RosheenMeandererManaAbility() {
|
||||||
super(new BasicManaEffect(new RosheenMeandererConditionalMana()));
|
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) {
|
RosheenMeandererManaAbility(RosheenMeandererManaAbility ability) {
|
||||||
|
@ -98,10 +99,16 @@ class RosheenMeandererConditionalMana extends ConditionalMana {
|
||||||
}
|
}
|
||||||
|
|
||||||
class RosheenMeandererManaCondition implements Condition {
|
class RosheenMeandererManaCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
|
if (AbilityType.SPELL.equals(source.getAbilityType())) {
|
||||||
MageObject object = game.getObject(source.getSourceId());
|
MageObject object = game.getObject(source.getSourceId());
|
||||||
return object != null
|
return object != null
|
||||||
&& object.getManaCost().getText().contains("X");
|
&& object.getManaCost().getText().contains("X");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return source.getManaCosts().getText().contains("X");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ConditionalManaTest extends CardTestPlayerBase {
|
public class ConditionalManaTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -104,4 +103,42 @@ public class ConditionalManaTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public enum CardRepository {
|
||||||
// raise this if db structure was changed
|
// raise this if db structure was changed
|
||||||
private static final long CARD_DB_VERSION = 41;
|
private static final long CARD_DB_VERSION = 41;
|
||||||
// raise this if new cards were added to the server
|
// 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 final Random random = new Random();
|
||||||
private Dao<CardInfo, Object> cardDao;
|
private Dao<CardInfo, Object> cardDao;
|
||||||
|
|
Loading…
Reference in a new issue