* Command Tower - Fixed that lands like Reflecting Pool could produce all the mana Command Tower can produce.

This commit is contained in:
LevelX2 2014-11-18 01:07:37 +01:00
parent 036095f6ec
commit b2dbb9c6d3
2 changed files with 77 additions and 16 deletions

View file

@ -27,17 +27,20 @@
*/
package mage.sets.commander2013;
import java.util.List;
import java.util.UUID;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.mana.ManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
@ -54,7 +57,7 @@ public class CommandTower extends CardImpl {
this.expansionSetCode = "C13";
// {tap}: Add to your mana pool one mana of any color in your commander's color identity.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, new CommandTowerManaEffect(), new TapSourceCost()));
this.addAbility(new CommandTowerManaAbility());
}
public CommandTower(final CommandTower card) {
@ -67,6 +70,58 @@ public class CommandTower extends CardImpl {
}
}
class CommandTowerManaAbility extends ManaAbility {
public CommandTowerManaAbility() {
super(Zone.BATTLEFIELD, new CommandTowerManaEffect(),new TapSourceCost());
}
public CommandTowerManaAbility(final CommandTowerManaAbility ability) {
super(ability);
}
@Override
public CommandTowerManaAbility copy() {
return new CommandTowerManaAbility(this);
}
@Override
public List<Mana> getNetMana(Game game) {
if (netMana.isEmpty()) {
Player controller = game.getPlayer(getControllerId());
if (controller != null) {
Card commander = game.getCard(controller.getCommanderId());
if (commander != null) {
Mana commanderMana = commander.getManaCost().getMana();
if (commanderMana.getBlack() > 0) {
netMana.add(new Mana(ColoredManaSymbol.B));
}
if (commanderMana.getBlue() > 0) {
netMana.add(new Mana(ColoredManaSymbol.U));
}
if (commanderMana.getGreen() > 0) {
netMana.add(new Mana(ColoredManaSymbol.G));
}
if (commanderMana.getRed() > 0) {
netMana.add(new Mana(ColoredManaSymbol.R));
}
if (commanderMana.getWhite() > 0) {
netMana.add(new Mana(ColoredManaSymbol.W));
}
}
}
}
return netMana;
}
@Override
public boolean definesMana() {
return true;
}
}
class CommandTowerManaEffect extends ManaEffect {
public CommandTowerManaEffect() {
@ -90,7 +145,7 @@ class CommandTowerManaEffect extends ManaEffect {
Card commander = game.getCard(controller.getCommanderId());
if (commander != null) {
Mana commanderMana = commander.getManaCost().getMana();
Choice choice = new ChoiceImpl(true);
Choice choice = new ChoiceImpl();
choice.setMessage("Pick a mana color");
if (commanderMana.getBlack() > 0) {
choice.getChoices().add("Black");
@ -111,18 +166,26 @@ class CommandTowerManaEffect extends ManaEffect {
if (choice.getChoices().size() == 1) {
choice.setChoice(choice.getChoices().iterator().next());
} else {
controller.choose(outcome, choice, game);
if (!controller.choose(outcome, choice, game)) {
return false;
}
}
if (choice.getChoice().equals("Black")) {
controller.getManaPool().addMana(Mana.BlackMana, game, source);
} else if (choice.getChoice().equals("Blue")) {
controller.getManaPool().addMana(Mana.BlueMana, game, source);
} else if (choice.getChoice().equals("Red")) {
controller.getManaPool().addMana(Mana.RedMana, game, source);
} else if (choice.getChoice().equals("Green")) {
controller.getManaPool().addMana(Mana.GreenMana, game, source);
} else if (choice.getChoice().equals("White")) {
controller.getManaPool().addMana(Mana.WhiteMana, game, source);
switch (choice.getChoice()) {
case "Black":
controller.getManaPool().addMana(Mana.BlackMana, game, source);
break;
case "Blue":
controller.getManaPool().addMana(Mana.BlueMana, game, source);
break;
case "Red":
controller.getManaPool().addMana(Mana.RedMana, game, source);
break;
case "Green":
controller.getManaPool().addMana(Mana.GreenMana, game, source);
break;
case "White":
controller.getManaPool().addMana(Mana.WhiteMana, game, source);
break;
}
}
return true;

View file

@ -28,13 +28,11 @@
package mage.abilities.mana;
import java.util.List;
import mage.constants.Zone;
import mage.Mana;
import mage.abilities.costs.Cost;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.game.Game;
import mage.constants.Zone;
/**
*