* Fixed CMC for spells (Escalate is not calculated correctly when more than 1 mode is chosen) fixes #2143.

This commit is contained in:
LevelX2 2016-08-06 13:16:49 +02:00
parent 5b5c13c137
commit 7a4b358f8a
2 changed files with 5 additions and 13 deletions

View file

@ -176,8 +176,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
return cardName;
}
public int getConvertedManaCost() {
int cmc = 0;
public int getConvertedXManaCost() {
int xMultiplier = 0;
for (String symbolString : getManaCosts().getSymbols()) {
int index = symbolString.indexOf("{X}");
@ -187,12 +186,7 @@ public class SpellAbility extends ActivatedAbilityImpl {
index = symbolString.indexOf("{X}");
}
}
if (getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
cmc += getManaCostsToPay().getX() * xMultiplier;
} else {
cmc += getManaCosts().convertedManaCost() + getManaCostsToPay().getX() * xMultiplier;
}
return cmc;
return getManaCostsToPay().getX() * xMultiplier;
}
}

View file

@ -503,11 +503,9 @@ public class Spell extends StackObjImpl implements Card {
return 0;
}
for (SpellAbility spellAbility : spellAbilities) {
cmc += spellAbility.getConvertedManaCost();
cmc += spellAbility.getConvertedXManaCost();
}
if (this.getSpellAbility().getSpellAbilityType().equals(SpellAbilityType.BASE_ALTERNATE)) {
cmc += getCard().getManaCost().convertedManaCost();
}
return cmc;
}