cost adjustments moved closer to payment (by human)

X/MK have to be announced to have their costs reduced.
This commit is contained in:
Maxmtg
2013-04-16 20:37:51 +00:00
parent 4d7b221eb5
commit a77dd8c547
5 changed files with 4 additions and 58 deletions

View File

@@ -345,35 +345,6 @@ public class Cost {
return splitStr;
}
/**
* <p>
* changeCost.
* </p>
*
* @param sa
* a {@link forge.card.spellability.SpellAbility} object.
*/
public final void changeCost(final SpellAbility sa) {
boolean costChanged = false;
// TODO: Change where ChangeCost happens
for (final CostPart part : this.costParts) {
if (part instanceof CostPartMana) {
final ManaCost mana = new ManaCost(new ManaCostParser(part.toString()));
final ManaCostBeingPaid changedCost = new ManaCostBeingPaid(mana);
changedCost.applySpellCostChange(sa);
((CostPartMana)part).setAdjustedMana(changedCost.toManaCost());
costChanged = true;
}
}
if (!costChanged) {
// Spells with a cost of 0 should be affected too
final ManaCostBeingPaid changedCost = new ManaCostBeingPaid("0");
changedCost.applySpellCostChange(sa);
this.costParts.add(new CostPartMana(changedCost.toManaCost(), null, false));
}
}
public final Cost copyWithNoMana() {
Cost toRet = new Cost(0);
toRet.isAbility = this.isAbility;

View File

@@ -38,7 +38,6 @@ import forge.game.player.AIPlayer;
public class CostPartMana extends CostPart {
// "Leftover"
private final ManaCost cost;
private ManaCost adjustedCost;
private boolean xCantBe0 = false;
private final String restriction;
@@ -78,21 +77,13 @@ public class CostPartMana extends CostPart {
return !xCantBe0;
}
/**
* Used to set mana cost after applying static effects that change costs.
*/
public void setAdjustedMana(ManaCost manaCost) {
// this is set when static effects of LodeStone Golems or Thalias are applied
adjustedCost = manaCost;
}
/**
* Gets the mana to pay.
*
* @return the mana to pay
*/
public final ManaCost getManaToPay() {
return adjustedCost == null ? cost : adjustedCost;
return cost;
}
@Override
@@ -134,8 +125,8 @@ public class CostPartMana extends CostPart {
for(int i = 0; i < timesMultikicked; i++)
toPay.combineManaCost(mkCost);
}
toPay.applySpellCostChange(ability);
if (!toPay.isPaid()) {
InputPayment inpPayment = new InputPayManaOfCostPayment(toPay, ability);
FThreads.setInputAndWait(inpPayment);

View File

@@ -197,13 +197,4 @@ public class CostPayment {
}
return true;
}
/**
* <p>
* changeCost.
* </p>
*/
public final void changeCost() {
this.cost.changeCost(this.ability);
}
}

View File

@@ -94,7 +94,6 @@ public class HumanPlaySpellAbility {
boolean paymentMade = isFree;
if (!paymentMade) {
this.payment.changeCost();
paymentMade = this.payment.payCost(game);
}

View File

@@ -179,13 +179,7 @@ public class HumanPlayer extends Player {
sa.setActivatingPlayer(this);
if (sa.getPayCosts() != null) {
final CostPayment payment = new CostPayment(sa.getPayCosts(), sa);
if (!sa.isTrigger()) {
payment.changeCost();
}
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, new CostPayment(sa.getPayCosts(), sa));
req.fillRequirements(useOldTargets, false, true);
} else {