forked from External/mage
Remove duplicate code for X costs (#12551)
* 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
This commit is contained in:
parent
1cb902fc43
commit
e8808c3ae3
509 changed files with 1322 additions and 1571 deletions
|
|
@ -3,8 +3,6 @@ package mage.abilities;
|
|||
import mage.ApprovingObject;
|
||||
import mage.MageIdentifier;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.VariableCost;
|
||||
import mage.abilities.costs.mana.ManaCost;
|
||||
import mage.abilities.costs.mana.VariableManaCost;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
|
|
@ -251,7 +249,6 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
|||
|
||||
public int getConvertedXManaCost(Card card) {
|
||||
int xMultiplier = 0;
|
||||
int amount = 0;
|
||||
if (card == null) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -265,18 +262,11 @@ public class SpellAbility extends ActivatedAbilityImpl {
|
|||
}
|
||||
|
||||
// mana cost final X value
|
||||
boolean hasNonManaXCost = false;
|
||||
for (Cost cost : getCosts()) {
|
||||
if (cost instanceof VariableCost) {
|
||||
hasNonManaXCost = true;
|
||||
amount = ((VariableCost) cost).getAmount();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasNonManaXCost) {
|
||||
amount = getManaCostsToPay().getX();
|
||||
Map<String, Object> tagMap = this.getCostsTagMap();
|
||||
if (tagMap == null) {
|
||||
return 0;
|
||||
}
|
||||
int amount = (int) tagMap.getOrDefault("X", 0);
|
||||
return amount * xMultiplier;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue