mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
HumanPlaySpellAbility: announceValuesLikeX check for X in other CostParts too
This commit is contained in:
@@ -33,6 +33,8 @@ import forge.game.GameObject;
|
|||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardPlayOption;
|
import forge.game.card.CardPlayOption;
|
||||||
|
import forge.game.cost.Cost;
|
||||||
|
import forge.game.cost.CostPart;
|
||||||
import forge.game.cost.CostPartMana;
|
import forge.game.cost.CostPartMana;
|
||||||
import forge.game.cost.CostPayment;
|
import forge.game.cost.CostPayment;
|
||||||
import forge.game.mana.ManaPool;
|
import forge.game.mana.ManaPool;
|
||||||
@@ -246,7 +248,8 @@ public class HumanPlaySpellAbility {
|
|||||||
|
|
||||||
boolean needX = true;
|
boolean needX = true;
|
||||||
final boolean allowZero = !ability.hasParam("XCantBe0");
|
final boolean allowZero = !ability.hasParam("XCantBe0");
|
||||||
final CostPartMana manaCost = ability.getPayCosts().getCostMana();
|
final Cost cost = ability.getPayCosts();
|
||||||
|
final CostPartMana manaCost = cost.getCostMana();
|
||||||
final PlayerController controller = ability.getActivatingPlayer().getController();
|
final PlayerController controller = ability.getActivatingPlayer().getController();
|
||||||
final Card card = ability.getHostCard();
|
final Card card = ability.getHostCard();
|
||||||
|
|
||||||
@@ -277,7 +280,17 @@ public class HumanPlaySpellAbility {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needX && manaCost != null && manaCost.getAmountOfX() > 0) {
|
if (needX && manaCost != null) {
|
||||||
|
boolean xInCost = manaCost.getAmountOfX() > 0;
|
||||||
|
if (!xInCost) {
|
||||||
|
for (final CostPart part : cost.getCostParts()) {
|
||||||
|
if (part.getAmount().equals("X")) {
|
||||||
|
xInCost = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (xInCost) {
|
||||||
final String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
|
final String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
|
||||||
if ("Count$xPaid".equals(sVar) || sVar.isEmpty()) {
|
if ("Count$xPaid".equals(sVar) || sVar.isEmpty()) {
|
||||||
final Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
|
final Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
|
||||||
@@ -286,9 +299,10 @@ public class HumanPlaySpellAbility {
|
|||||||
}
|
}
|
||||||
card.setXManaCostPaid(value);
|
card.setXManaCostPaid(value);
|
||||||
}
|
}
|
||||||
} else if (needX && manaCost != null && manaCost.getMana().isZero() && ability.isSpell()) {
|
} else if (manaCost.getMana().isZero() && ability.isSpell()) {
|
||||||
card.setXManaCostPaid(0);
|
card.setXManaCostPaid(0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user