mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
* Added a test for Nykthos, Shrine to Nyx.
This commit is contained in:
parent
e765e3a0b9
commit
da277dbdd9
2 changed files with 58 additions and 21 deletions
|
@ -37,13 +37,13 @@ import mage.abilities.effects.common.ManaEffect;
|
|||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.abilities.mana.ManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceColor;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.ColoredManaSymbol;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -60,9 +60,6 @@ public class NykthosShrineToNyx extends CardImpl {
|
|||
this.addAbility(new ColorlessManaAbility());
|
||||
// {2}, {T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color.
|
||||
Ability ability = new NykthosShrineToNyxManaAbility();
|
||||
Choice choice = new ChoiceColor();
|
||||
choice.setMessage("Choose a color for devotion of Nykthos");
|
||||
ability.addChoice(choice);
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
@ -97,7 +94,8 @@ class NykthosShrineToNyxManaAbility extends ManaAbility {
|
|||
if (game == null) {
|
||||
return new Mana();
|
||||
}
|
||||
return new Mana(((NykthosDynamicManaEffect)this.getEffects().get(0)).computeMana(game, this));
|
||||
// TODO: Give back a list with t he 5 different mana options
|
||||
return new Mana(((NykthosDynamicManaEffect)this.getEffects().get(0)).computeMana("Green", game, this));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,28 +122,39 @@ class NykthosDynamicManaEffect extends ManaEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
computeMana(game, source);
|
||||
game.getPlayer(source.getControllerId()).getManaPool().addMana(computedMana, game, source);
|
||||
return true;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceColor choice = new ChoiceColor();
|
||||
choice.setMessage("Choose a color for devotion of Nykthos");
|
||||
if (controller.choose(outcome, choice, game)) {
|
||||
computeMana(choice.getChoice(), game, source);
|
||||
game.getPlayer(source.getControllerId()).getManaPool().addMana(computedMana, game, source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public Mana computeMana(Game game, Ability source){
|
||||
public Mana computeMana(String color, Game game, Ability source){
|
||||
this.computedMana.clear();
|
||||
if (!source.getChoices().isEmpty()) {
|
||||
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
|
||||
if (choice != null && choice instanceof ChoiceColor && choice.getChoice() != null) {
|
||||
String color = choice.getChoice();
|
||||
if (color.equals("Red")) {
|
||||
if (color !=null && !color.isEmpty()) {
|
||||
switch (color) {
|
||||
case "Red":
|
||||
computedMana.setRed(new DevotionCount(ColoredManaSymbol.R).calculate(game, source, this));
|
||||
} else if (color.equals("Blue")) {
|
||||
break;
|
||||
case "Blue":
|
||||
computedMana.setBlue(new DevotionCount(ColoredManaSymbol.U).calculate(game, source, this));
|
||||
} else if (color.equals("White")) {
|
||||
break;
|
||||
case "White":
|
||||
computedMana.setWhite(new DevotionCount(ColoredManaSymbol.W).calculate(game, source, this));
|
||||
} else if (color.equals("Black")) {
|
||||
break;
|
||||
case "Black":
|
||||
computedMana.setBlack(new DevotionCount(ColoredManaSymbol.B).calculate(game, source, this));
|
||||
} else if (color.equals("Green")) {
|
||||
break;
|
||||
case "Green":
|
||||
computedMana.setGreen(new DevotionCount(ColoredManaSymbol.G).calculate(game, source, this));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return computedMana;
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
public class NykthosShrineToNyxTest extends CardTestPlayerBase {
|
||||
|
||||
@Test
|
||||
public void testNoManaToCast() {
|
||||
public void testNormalUse() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Nykthos, Shrine to Nyx", 1);
|
||||
// Kiora's Follower {G}{U}
|
||||
|
@ -58,8 +58,36 @@ public class NykthosShrineToNyxTest extends CardTestPlayerBase {
|
|||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
Assert.assertEquals("message", 6, playerA.getManaPool().getGreen()); // 5 green mana
|
||||
Assert.assertEquals("message", 6, playerA.getManaPool().getGreen()); // 6 green mana
|
||||
assertPowerToughness(playerA, "Omnath, Locus of Mana", 7, 7);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoubleUse() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Island", 2);
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Nykthos, Shrine to Nyx", 1);
|
||||
// Kiora's Follower {G}{U}
|
||||
// Creature - Merfolk
|
||||
// {T}: Untap another target permanent.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kiora's Follower");
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Kalonian Tusker", 2);
|
||||
// Green mana doesn't empty from your mana pool as steps and phases end.
|
||||
// Omnath, Locus of Mana gets +1/+1 for each green mana in your mana pool.
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Omnath, Locus of Mana", 1);
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color. <i>(Your devotion to a color is the number of mana symbols of that color in the mana costs of permanents you control.)</i>.");
|
||||
setChoice(playerA, "Green");
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{T}: Untap another target permanent.","Nykthos, Shrine to Nyx");
|
||||
|
||||
activateManaAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA, "{2},{T}: Choose a color. Add to your mana pool an amount of mana of that color equal to your devotion to that color. <i>(Your devotion to a color is the number of mana symbols of that color in the mana costs of permanents you control.)</i>.");
|
||||
setChoice(playerA, "Green");
|
||||
|
||||
setStopAt(1, PhaseStep.PRECOMBAT_MAIN);
|
||||
execute();
|
||||
|
||||
Assert.assertEquals("amount of green mana", 10, playerA.getManaPool().getGreen()); // 6G - 2G = 4G + 6G = 10G
|
||||
assertPowerToughness(playerA, "Omnath, Locus of Mana", 11,11);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue