mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
bugfix, CostPartMana tried to take color of X into account
This commit is contained in:
@@ -19,6 +19,7 @@ package forge.card.cost;
|
|||||||
|
|
||||||
import forge.Card;
|
import forge.Card;
|
||||||
import forge.FThreads;
|
import forge.FThreads;
|
||||||
|
import forge.card.MagicColor;
|
||||||
import forge.card.ability.AbilityUtils;
|
import forge.card.ability.AbilityUtils;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostBeingPaid;
|
import forge.card.mana.ManaCostBeingPaid;
|
||||||
@@ -117,13 +118,13 @@ public class CostPartMana extends CostPart {
|
|||||||
final Card source = ability.getSourceCard();
|
final Card source = ability.getSourceCard();
|
||||||
ManaCostBeingPaid toPay = new ManaCostBeingPaid(getManaToPay());
|
ManaCostBeingPaid toPay = new ManaCostBeingPaid(getManaToPay());
|
||||||
|
|
||||||
if (this.getAmountOfX() > 0) {
|
if (this.getAmountOfX() > 0 && !ability.getSVar("X").equals("Count$xPaid")) {
|
||||||
// if X cost is a defined value, other than xPaid
|
// if X cost is a defined value, other than xPaid
|
||||||
if (!ability.getSVar("X").equals("Count$xPaid")) {
|
|
||||||
// this currently only works for things about Targeted object
|
// this currently only works for things about Targeted object
|
||||||
int xCost = AbilityUtils.calculateAmount(source, "X", ability) * this.getAmountOfX();
|
int xCost = AbilityUtils.calculateAmount(source, "X", ability) * this.getAmountOfX();
|
||||||
toPay.increaseColorlessMana(xCost);
|
byte xColor = MagicColor.fromName(ability.hasParam("XColor") ? ability.getParam("XColor") : "1");
|
||||||
}
|
toPay.increaseShard(ManaCostShard.valueOf(xColor), xCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,6 @@ public final class ManaCost implements Comparable<ManaCost> {
|
|||||||
* the parser
|
* the parser
|
||||||
*/
|
*/
|
||||||
public ManaCost(final IParserManaCost parser) {
|
public ManaCost(final IParserManaCost parser) {
|
||||||
if (!parser.hasNext()) {
|
|
||||||
throw new RuntimeException("Empty manacost passed to parser (this should have been handled before)");
|
|
||||||
}
|
|
||||||
final List<ManaCostShard> shardsTemp = new ArrayList<ManaCostShard>();
|
final List<ManaCostShard> shardsTemp = new ArrayList<ManaCostShard>();
|
||||||
this.hasNoCost = false;
|
this.hasNoCost = false;
|
||||||
while (parser.hasNext()) {
|
while (parser.hasNext()) {
|
||||||
@@ -90,8 +87,7 @@ public final class ManaCost implements Comparable<ManaCost> {
|
|||||||
shardsTemp.add(shard);
|
shardsTemp.add(shard);
|
||||||
} // null is OK - that was generic mana
|
} // null is OK - that was generic mana
|
||||||
}
|
}
|
||||||
this.genericCost = parser.getTotalColorlessCost(); // collect generic
|
this.genericCost = parser.getTotalColorlessCost(); // collect generic mana
|
||||||
// mana
|
|
||||||
// here
|
// here
|
||||||
sealClass(shardsTemp);
|
sealClass(shardsTemp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,8 @@ public class ManaCostBeingPaid {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalColorlessCost() {
|
public int getTotalColorlessCost() {
|
||||||
return unpaidShards.get(ManaCostShard.COLORLESS);
|
Integer c = unpaidShards.get(ManaCostShard.COLORLESS);
|
||||||
|
return c == null ? 0 : c.intValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user