mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
CardProperty: hasXCost, it should check ManaCost
This commit is contained in:
@@ -2880,7 +2880,7 @@ public class ComputerUtil {
|
|||||||
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
AiController aic = ((PlayerControllerAi) ai.getController()).getAi();
|
||||||
Card targetSpellCard = null;
|
Card targetSpellCard = null;
|
||||||
for (Card c : options) {
|
for (Card c : options) {
|
||||||
if (withoutPayingManaCost && c.getManaCost() != null && c.getManaCost().getShardCount(ManaCostShard.X) > 0) {
|
if (withoutPayingManaCost && c.getManaCost() != null && c.getManaCost().countX() > 0) {
|
||||||
// The AI will otherwise cheat with the mana payment, announcing X > 0 for spells like Heat Ray when replaying them
|
// The AI will otherwise cheat with the mana payment, announcing X > 0 for spells like Heat Ray when replaying them
|
||||||
// without paying their mana cost.
|
// without paying their mana cost.
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -345,13 +345,7 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int countX() {
|
public int countX() {
|
||||||
int iX = 0;
|
return getShardCount(ManaCostShard.X);
|
||||||
for (ManaCostShard shard : shards) {
|
|
||||||
if (shard == ManaCostShard.X) {
|
|
||||||
iX++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return iX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostShard;
|
import forge.card.mana.ManaCostShard;
|
||||||
import forge.game.Direction;
|
import forge.game.Direction;
|
||||||
import forge.game.EvenOdd;
|
import forge.game.EvenOdd;
|
||||||
@@ -1389,8 +1390,8 @@ public class CardProperty {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.startsWith("hasXCost")) {
|
} else if (property.startsWith("hasXCost")) {
|
||||||
SpellAbility sa1 = card.getFirstSpellAbility();
|
ManaCost cost = card.getManaCost();
|
||||||
if (sa1 != null && !sa1.costHasManaX()) {
|
if (cost == null || cost.countX() <= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (property.startsWith("suspended")) {
|
} else if (property.startsWith("suspended")) {
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
package forge.game.cost;
|
package forge.game.cost;
|
||||||
|
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.card.mana.ManaCostShard;
|
|
||||||
import forge.game.mana.ManaConversionMatrix;
|
import forge.game.mana.ManaConversionMatrix;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
@@ -77,7 +76,7 @@ public class CostPartMana extends CostPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final int getAmountOfX() {
|
public final int getAmountOfX() {
|
||||||
return this.cost.getShardCount(ManaCostShard.X);
|
return this.cost.countX();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user