* Add mana of the chosen color - added info about chosen color to ability choose dialog (#6677);

This commit is contained in:
Oleg Agafonov 2020-06-20 00:29:33 +04:00
parent fed6ddff8e
commit cd8d12365f

View file

@ -1,13 +1,9 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package mage.abilities.effects.mana;
import mage.Mana;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.common.ManaEffect;
import mage.constants.ColoredManaSymbol;
import mage.game.Game;
@ -17,6 +13,8 @@ import mage.game.Game;
*/
public class AddManaChosenColorEffect extends ManaEffect {
private ObjectColor chosenColorInfo = null;
public AddManaChosenColorEffect() {
super();
staticText = "Add one mana of the chosen color";
@ -24,6 +22,7 @@ public class AddManaChosenColorEffect extends ManaEffect {
public AddManaChosenColorEffect(final AddManaChosenColorEffect effect) {
super(effect);
chosenColorInfo = effect.chosenColorInfo;
}
@Override
@ -31,6 +30,7 @@ public class AddManaChosenColorEffect extends ManaEffect {
if (game != null) {
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
if (color != null) {
this.chosenColorInfo = color;
return new Mana(ColoredManaSymbol.lookup(color.toString().charAt(0)));
}
}
@ -41,4 +41,9 @@ public class AddManaChosenColorEffect extends ManaEffect {
public AddManaChosenColorEffect copy() {
return new AddManaChosenColorEffect(this);
}
@Override
public String getText(Mode mode) {
return super.getText(mode) + (chosenColorInfo == null ? "" : " {" + chosenColorInfo.toString() + "}");
}
}