mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix X shards in combat tax missing from total cost (#5154)
This commit is contained in:
@@ -286,6 +286,10 @@ public class CombatUtil {
|
||||
// If there's a better way of handling this somewhere deeper in the code, feel free to remove
|
||||
final SpellAbility fakeSA = new SpellAbility.EmptySa(attacker, attacker.getController());
|
||||
fakeSA.setCardState(attacker.getCurrentState());
|
||||
// need to set this for "CostContainsX" restriction
|
||||
fakeSA.setPayCosts(attackCost);
|
||||
// prevent recalculating X
|
||||
fakeSA.setSVar("X", "0");
|
||||
return attacker.getController().getController().payManaOptional(attacker, attackCost, fakeSA,
|
||||
"Pay additional cost to declare " + attacker + " an attacker", ManaPaymentPurpose.DeclareAttacker);
|
||||
}
|
||||
@@ -347,6 +351,8 @@ public class CombatUtil {
|
||||
|
||||
SpellAbility fakeSA = new SpellAbility.EmptySa(blocker, blocker.getController());
|
||||
fakeSA.setCardState(blocker.getCurrentState());
|
||||
fakeSA.setPayCosts(blockCost);
|
||||
fakeSA.setSVar("X", "0");
|
||||
return blocker.getController().getController().payManaOptional(blocker, blockCost, fakeSA, "Pay cost to declare " + blocker + " a blocker. ", ManaPaymentPurpose.DeclareBlocker);
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ public class CostPartMana extends CostPart {
|
||||
if (isCostPayAnyNumberOfTimes) {
|
||||
int timesToPay = AbilityUtils.calculateAmount(sa.getHostCard(), sa.getSVar("NumTimes"), sa);
|
||||
if (timesToPay == 0) {
|
||||
return ManaCost.NO_COST;
|
||||
return ManaCost.ZERO;
|
||||
}
|
||||
ManaCostBeingPaid totalMana = new ManaCostBeingPaid(getMana());
|
||||
for (int i = 1; i < timesToPay; i++) {
|
||||
|
||||
@@ -254,7 +254,12 @@ public class StaticAbilityCantAttackBlock {
|
||||
if (remember) {
|
||||
hostCard.addRemembered(attacker);
|
||||
}
|
||||
// keep X shards
|
||||
boolean addX = costString.startsWith("X");
|
||||
costString = Integer.toString(AbilityUtils.calculateAmount(hostCard, stAb.getSVar(costString), stAb));
|
||||
if (addX) {
|
||||
costString += " X";
|
||||
}
|
||||
if (remember) {
|
||||
hostCard.removeRemembered(attacker);
|
||||
}
|
||||
@@ -288,7 +293,11 @@ public class StaticAbilityCantAttackBlock {
|
||||
}
|
||||
String costString = stAb.getParam("Cost");
|
||||
if (stAb.hasSVar(costString)) {
|
||||
costString = Integer.toString(AbilityUtils.calculateAmount(hostCard, costString, stAb));
|
||||
boolean addX = costString.startsWith("X");
|
||||
costString = Integer.toString(AbilityUtils.calculateAmount(hostCard, stAb.getSVar(costString), stAb));
|
||||
if (addX) {
|
||||
costString += " X";
|
||||
}
|
||||
}
|
||||
|
||||
return new Cost(costString, true);
|
||||
|
||||
Reference in New Issue
Block a user