mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
Simplify implementation of pre-announcing X
This commit is contained in:
@@ -132,14 +132,13 @@ public class CostPayment {
|
||||
}
|
||||
|
||||
public boolean payCost(final CostDecisionMakerBase decisionMaker) {
|
||||
|
||||
final List<CostPart> costParts = this.getCost().getCostPartsWithZeroMana();
|
||||
for (final CostPart part : costParts) {
|
||||
PaymentDecision pd = part.accept(decisionMaker);
|
||||
|
||||
if ( null == pd || !part.payAsDecided(decisionMaker.getPlayer(), pd, ability))
|
||||
return false;
|
||||
|
||||
if (pd == null || !part.payAsDecided(decisionMaker.getPlayer(), pd, ability)) {
|
||||
return false;
|
||||
}
|
||||
this.paidCostParts.add(part);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,11 +29,7 @@ public class ManaCostAdjustment {
|
||||
|
||||
public static final void adjust(ManaCostBeingPaid cost, final SpellAbility sa, boolean test) {
|
||||
final Game game = sa.getActivatingPlayer().getGame();
|
||||
// Beached
|
||||
final Card originalCard = sa.getHostCard();
|
||||
if (sa.isXCost() && !originalCard.isCopiedSpell()) {
|
||||
originalCard.setXManaCostPaid(0);
|
||||
}
|
||||
|
||||
if (sa.isTrigger()) {
|
||||
return;
|
||||
|
||||
@@ -696,6 +696,9 @@ public class HumanPlay {
|
||||
toPay.setXManaCostPaid(xPaid, ability.getParam("XColor"));
|
||||
source.setXManaCostPaid(xPaid);
|
||||
}
|
||||
else if (source.getXManaCostPaid() > 0) { //ensure pre-announced X value retained
|
||||
toPay.setXManaCostPaid(source.getXManaCostPaid(), ability.getParam("XColor"));
|
||||
}
|
||||
|
||||
int timesMultikicked = source.getKickerMagnitude();
|
||||
if (timesMultikicked > 0 && ability.isAnnouncing("Multikicker")) {
|
||||
@@ -716,7 +719,7 @@ public class HumanPlay {
|
||||
if (isActivatedSa) {
|
||||
ManaCostAdjustment.adjust(toPay, ability, false);
|
||||
}
|
||||
|
||||
|
||||
InputPayMana inpPayment;
|
||||
if (ability.isOffering() && ability.getSacrificedAsOffering() == null) {
|
||||
System.out.println("Sacrifice input for Offering cancelled");
|
||||
|
||||
@@ -229,20 +229,12 @@ public class HumanPlaySpellAbility {
|
||||
|
||||
if (needX && manaCost != null && manaCost.getAmountOfX() > 0) {
|
||||
String sVar = ability.getSVar("X"); //only prompt for new X value if card doesn't determine it another way
|
||||
if ("Count$xPaid".equals(sVar) || StringUtils.isNumeric(sVar) || sVar.isEmpty()) {
|
||||
if ("Count$xPaid".equals(sVar) || sVar.isEmpty()) {
|
||||
Integer value = controller.announceRequirements(ability, "X", allowZero && manaCost.canXbe0());
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ability.setSVar("X", value.toString());
|
||||
card.setSVar("X", value.toString());
|
||||
|
||||
// announce to sub-abilities
|
||||
SpellAbility sub = ability;
|
||||
while ((sub = sub.getSubAbility()) != null) {
|
||||
sub.setSVar("X", value.toString());
|
||||
}
|
||||
card.setXManaCostPaid(value);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user