forked from External/mage
* Replace "([a-zA-Z]+).getManaCostsToPay().getX()" with CardUtil.getSourceCostsTag(game, $1, "X", 0) Fix Disrupting Shoal * Change final card .getX() calls * Condense all ManacostVariableValue enum values into "instance" * Further removal of getX, Display X symbol for non-mana X cards * Fix test * Fully remove ManaCosts.getX * Replace all different X dynamic values with GetXValue * Remove individual cards checking getAmount for X values (leaving cost reduction that does not use X) * Add null check for game object inside getSourceCostsTagsMap * fix build errors * fix Vicious Betrayal * text fix
51 lines
1.4 KiB
Java
51 lines
1.4 KiB
Java
|
|
package mage.abilities.dynamicvalue.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.costs.Cost;
|
|
import mage.abilities.costs.common.ExileFromHandCost;
|
|
import mage.abilities.dynamicvalue.DynamicValue;
|
|
import mage.abilities.effects.Effect;
|
|
import mage.cards.Card;
|
|
import mage.game.Game;
|
|
import mage.util.CardUtil;
|
|
|
|
/**
|
|
* Calculates the converted mana costs of a card that was exiled from hand as
|
|
* cost. If no card was exiled CardUtil.getSourceCostsTag(game, the, "X", 0) will be used as
|
|
* value.
|
|
*
|
|
* @author LevelX2
|
|
*/
|
|
public enum ExileFromHandCostCardConvertedMana implements DynamicValue {
|
|
instance;
|
|
|
|
@Override
|
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
|
for (Cost cost : sourceAbility.getCosts()) {
|
|
if (cost.isPaid() && cost instanceof ExileFromHandCost) {
|
|
int xValue = 0;
|
|
for (Card card : ((ExileFromHandCost) cost).getCards()) {
|
|
xValue += card.getManaValue();
|
|
}
|
|
return xValue;
|
|
}
|
|
}
|
|
return CardUtil.getSourceCostsTag(game, sourceAbility, "X", 0);
|
|
}
|
|
|
|
@Override
|
|
public ExileFromHandCostCardConvertedMana copy() {
|
|
return ExileFromHandCostCardConvertedMana.instance;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "X";
|
|
}
|
|
|
|
@Override
|
|
public String getMessage() {
|
|
return "";
|
|
}
|
|
}
|