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

View file

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