mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Minor logic tweak (Buyback)
- hasXInAnyCostPart doesn't need a SA parameter now that it's in Cost. - Fixed a minor mistype on mobile Forge.
This commit is contained in:
@@ -671,7 +671,7 @@ public class AiController {
|
||||
|
||||
// This is for playing spells regularly (no Cascade/Ripple etc.)
|
||||
private AiPlayDecision canPlayAndPayFor(final SpellAbility sa) {
|
||||
boolean xCost = sa.getPayCosts().hasXInAnyCostPart(sa);
|
||||
boolean xCost = sa.getPayCosts().hasXInAnyCostPart();
|
||||
|
||||
if (!xCost && !ComputerUtilCost.canPayCost(sa, player)) {
|
||||
// for most costs, it's OK to check if they can be paid early in order to avoid running a heavy API check
|
||||
@@ -708,7 +708,7 @@ public class AiController {
|
||||
return canPlaySa(((WrappedAbility) sa).getWrappedAbility());
|
||||
}
|
||||
|
||||
// Trying to play a card that has Buyback without a Buyback cost
|
||||
// Trying to play a card that has Buyback without a Buyback cost, look for possible additional considerations
|
||||
if (card.hasKeyword(Keyword.BUYBACK) && !sa.isBuyBackAbility() && !canPlaySpellWithoutBuyback(card, sa)) {
|
||||
return AiPlayDecision.NeedsToPlayCriteriaNotMet;
|
||||
}
|
||||
|
||||
@@ -935,10 +935,9 @@ public class Cost implements Serializable {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean hasXInAnyCostPart(SpellAbility sa) {
|
||||
public boolean hasXInAnyCostPart() {
|
||||
boolean xCost = false;
|
||||
if (sa.getPayCosts() != null) {
|
||||
for (CostPart p : sa.getPayCosts().getCostParts()) {
|
||||
for (CostPart p : this.getCostParts()) {
|
||||
if (p instanceof CostPartMana) {
|
||||
if (((CostPartMana) p).getAmountOfX() > 0) {
|
||||
xCost = true;
|
||||
@@ -949,7 +948,6 @@ public class Cost implements Serializable {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return xCost;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user