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; }

View File

@@ -1,7 +1,7 @@
Name:Back from the Brink
ManaCost:4 U U
Types:Enchantment
A:AB$ CopyPermanent | Cost$ ExileFromGrave<1/Creature> Mana<X\Remembered> | Defined$ Exiled | SorcerySpeed$ True | SpellDescription$ Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery.
A:AB$ CopyPermanent | Cost$ ExileFromGrave<1/Creature> Mana<X\Exiled> | Defined$ Exiled | SorcerySpeed$ True | SpellDescription$ Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery.
SVar:NonStackingEffect:True
SVar:Picture:http://www.wizards.com/global/images/magic/general/back_from_the_brink.jpg
Oracle:Exile a creature card from your graveyard and pay its mana cost: Put a token onto the battlefield that's a copy of that card. Activate this ability only any time you could cast a sorcery.

View File

@@ -731,9 +731,9 @@ public class HumanPlay {
return done;
}
public static boolean payManaCost(final CostPartMana mc, final SpellAbility ability, final Player activator) {
public static boolean payManaCost(final ManaCost realCost, final CostPartMana mc, final SpellAbility ability, final Player activator) {
final Card source = ability.getSourceCard();
ManaCostBeingPaid toPay = new ManaCostBeingPaid(mc.getManaToPay(), mc.getRestiction());
ManaCostBeingPaid toPay = new ManaCostBeingPaid(realCost, mc.getRestiction());
boolean xWasBilled = false;
String xInCard = source.getSVar("X");

View File

@@ -1082,7 +1082,14 @@ public class PlayerControllerHuman extends PlayerController {
@Override
public boolean payManaCost(CostPartMana costPartMana, PaymentDecision pd, SpellAbility sa) {
// TODO Auto-generated method stub
return HumanPlay.payManaCost(costPartMana, sa, player);
ManaCost toPay;
if ( costPartMana.isExiledCreatureCost() )
toPay = sa.getPaidList("Exiled").get(0).getManaCost();
else
toPay = costPartMana.getManaToPay();
return HumanPlay.payManaCost(toPay, costPartMana, sa, player);
}
@Override