- Trying to fix cards like Back from the Brink and Merseine resulting from incorrect copying of mana costs with \EnchantedCost or \Exiled restrictions.

- This is a hack, not sure if it works well enough and doesn't break anything, there's probably a better and more elegant way to fix this, please review.
This commit is contained in:
Agetian
2016-10-01 06:08:20 +00:00
parent 76c4a7725e
commit bda9baa4fc
2 changed files with 10 additions and 1 deletions

View File

@@ -764,7 +764,7 @@ public class Cost {
String r1 = ((CostPartMana) part).getRestiction();
String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2);
costParts.remove(costPart2);
costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r));
costParts.add(0, new CostPartMana(oldManaCost.toManaCost(), r, ((CostPartMana)part).isExiledCreatureCost(), ((CostPartMana)part).isEnchantedCreatureCost()));
} else if (part instanceof CostDiscard || part instanceof CostTapType) {
boolean alreadyAdded = false;
for (final CostPart other : costParts) {

View File

@@ -49,6 +49,15 @@ public class CostPartMana extends CostPart {
this.restriction = xCantBe0 || isExiledCreatureCost || isEnchantedCreatureCost? null : restriction;
}
// This version of the constructor allows to explicitly set exiledCreatureCost/enchantedCreatureCost, used only when copying costs
public CostPartMana(final ManaCost cost, String restriction, boolean exiledCreatureCost, boolean enchantedCreatureCost) {
this.cost = cost;
this.xCantBe0 = "XCantBe0".equals(restriction);
this.isExiledCreatureCost = exiledCreatureCost;
this.isEnchantedCreatureCost = enchantedCreatureCost;
this.restriction = xCantBe0 || isExiledCreatureCost || isEnchantedCreatureCost? null : restriction;
}
/**
* Gets the mana.
*