mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
cost adjustments moved closer to payment (by human)
X/MK have to be announced to have their costs reduced.
This commit is contained in:
@@ -345,35 +345,6 @@ public class Cost {
|
|||||||
return splitStr;
|
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() {
|
public final Cost copyWithNoMana() {
|
||||||
Cost toRet = new Cost(0);
|
Cost toRet = new Cost(0);
|
||||||
toRet.isAbility = this.isAbility;
|
toRet.isAbility = this.isAbility;
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import forge.game.player.AIPlayer;
|
|||||||
public class CostPartMana extends CostPart {
|
public class CostPartMana extends CostPart {
|
||||||
// "Leftover"
|
// "Leftover"
|
||||||
private final ManaCost cost;
|
private final ManaCost cost;
|
||||||
private ManaCost adjustedCost;
|
|
||||||
private boolean xCantBe0 = false;
|
private boolean xCantBe0 = false;
|
||||||
private final String restriction;
|
private final String restriction;
|
||||||
|
|
||||||
@@ -78,21 +77,13 @@ public class CostPartMana extends CostPart {
|
|||||||
return !xCantBe0;
|
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.
|
* Gets the mana to pay.
|
||||||
*
|
*
|
||||||
* @return the mana to pay
|
* @return the mana to pay
|
||||||
*/
|
*/
|
||||||
public final ManaCost getManaToPay() {
|
public final ManaCost getManaToPay() {
|
||||||
return adjustedCost == null ? cost : adjustedCost;
|
return cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -134,8 +125,8 @@ public class CostPartMana extends CostPart {
|
|||||||
for(int i = 0; i < timesMultikicked; i++)
|
for(int i = 0; i < timesMultikicked; i++)
|
||||||
toPay.combineManaCost(mkCost);
|
toPay.combineManaCost(mkCost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
toPay.applySpellCostChange(ability);
|
||||||
if (!toPay.isPaid()) {
|
if (!toPay.isPaid()) {
|
||||||
InputPayment inpPayment = new InputPayManaOfCostPayment(toPay, ability);
|
InputPayment inpPayment = new InputPayManaOfCostPayment(toPay, ability);
|
||||||
FThreads.setInputAndWait(inpPayment);
|
FThreads.setInputAndWait(inpPayment);
|
||||||
|
|||||||
@@ -197,13 +197,4 @@ public class CostPayment {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* changeCost.
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
public final void changeCost() {
|
|
||||||
this.cost.changeCost(this.ability);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ public class HumanPlaySpellAbility {
|
|||||||
boolean paymentMade = isFree;
|
boolean paymentMade = isFree;
|
||||||
|
|
||||||
if (!paymentMade) {
|
if (!paymentMade) {
|
||||||
this.payment.changeCost();
|
|
||||||
paymentMade = this.payment.payCost(game);
|
paymentMade = this.payment.payCost(game);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -179,13 +179,7 @@ public class HumanPlayer extends Player {
|
|||||||
sa.setActivatingPlayer(this);
|
sa.setActivatingPlayer(this);
|
||||||
|
|
||||||
if (sa.getPayCosts() != null) {
|
if (sa.getPayCosts() != null) {
|
||||||
final CostPayment payment = new CostPayment(sa.getPayCosts(), sa);
|
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, new CostPayment(sa.getPayCosts(), sa));
|
||||||
|
|
||||||
if (!sa.isTrigger()) {
|
|
||||||
payment.changeCost();
|
|
||||||
}
|
|
||||||
|
|
||||||
final HumanPlaySpellAbility req = new HumanPlaySpellAbility(sa, payment);
|
|
||||||
|
|
||||||
req.fillRequirements(useOldTargets, false, true);
|
req.fillRequirements(useOldTargets, false, true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user