back from the brink now brings back the cards (but created 2 copies for unknown reason)

This commit is contained in:
Maxmtg
2014-01-22 07:14:53 +00:00
parent 37d45ffbeb
commit 4163c56502
5 changed files with 23 additions and 15 deletions

View File

@@ -86,13 +86,8 @@ public class Cost {
* @return a {@link java.lang.String} object.
*/
public final ManaCost getTotalMana() {
for (final CostPart part : this.costParts) {
if (part instanceof CostPartMana) {
return ((CostPartMana) part).getManaToPay();
}
}
return ManaCost.ZERO;
CostPartMana manapart = getCostMana();
return manapart == null ? ManaCost.ZERO : manapart.getManaToPay();
}
private Cost(int colorlessmana) {

View File

@@ -29,11 +29,11 @@ public class CostPartMana extends CostPart {
// "Leftover"
private final ManaCost cost;
private boolean xCantBe0 = false;
private boolean isRememberedCreatureCost = false;
private boolean isExiledCreatureCost = false;
private final String restriction;
public boolean shouldPayLast() {
return isRememberedCreatureCost;
return isExiledCreatureCost;
}
/**
* Instantiates a new cost mana.
@@ -47,8 +47,8 @@ public class CostPartMana extends CostPart {
public CostPartMana(final ManaCost cost, String restriction) {
this.cost = cost;
this.xCantBe0 = "XCantBe0".equals(restriction);
this.isRememberedCreatureCost = "Remembered".equalsIgnoreCase(restriction);
this.restriction = xCantBe0 || isRememberedCreatureCost ? null : restriction;
this.isExiledCreatureCost = "Exiled".equalsIgnoreCase(restriction);
this.restriction = xCantBe0 || isExiledCreatureCost ? null : restriction;
}
/**
@@ -81,6 +81,12 @@ public class CostPartMana extends CostPart {
return cost;
}
/**
* @return the isExiledCreatureCost
*/
public boolean isExiledCreatureCost() {
return isExiledCreatureCost;
}
@Override
public boolean isReusable() { return true; }