mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
- 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:
@@ -764,7 +764,7 @@ public class Cost {
|
|||||||
String r1 = ((CostPartMana) part).getRestiction();
|
String r1 = ((CostPartMana) part).getRestiction();
|
||||||
String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2);
|
String r = r1 == null ? r2 : ( r2 == null ? r1 : r1 + "." + r2);
|
||||||
costParts.remove(costPart2);
|
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) {
|
} else if (part instanceof CostDiscard || part instanceof CostTapType) {
|
||||||
boolean alreadyAdded = false;
|
boolean alreadyAdded = false;
|
||||||
for (final CostPart other : costParts) {
|
for (final CostPart other : costParts) {
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ public class CostPartMana extends CostPart {
|
|||||||
this.restriction = xCantBe0 || isExiledCreatureCost || isEnchantedCreatureCost? null : restriction;
|
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.
|
* Gets the mana.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user