mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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();
|
||||
Card targetSpellCard = null;
|
||||
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
|
||||
// without paying their mana cost.
|
||||
continue;
|
||||
|
||||
@@ -345,13 +345,7 @@ public final class ManaCost implements Comparable<ManaCost>, Iterable<ManaCostSh
|
||||
* @return
|
||||
*/
|
||||
public int countX() {
|
||||
int iX = 0;
|
||||
for (ManaCostShard shard : shards) {
|
||||
if (shard == ManaCostShard.X) {
|
||||
iX++;
|
||||
}
|
||||
}
|
||||
return iX;
|
||||
return getShardCount(ManaCostShard.X);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import forge.card.ColorSet;
|
||||
import forge.card.MagicColor;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
import forge.game.Direction;
|
||||
import forge.game.EvenOdd;
|
||||
@@ -1389,8 +1390,8 @@ public class CardProperty {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("hasXCost")) {
|
||||
SpellAbility sa1 = card.getFirstSpellAbility();
|
||||
if (sa1 != null && !sa1.costHasManaX()) {
|
||||
ManaCost cost = card.getManaCost();
|
||||
if (cost == null || cost.countX() <= 0) {
|
||||
return false;
|
||||
}
|
||||
} else if (property.startsWith("suspended")) {
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
package forge.game.cost;
|
||||
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostShard;
|
||||
import forge.game.mana.ManaConversionMatrix;
|
||||
import forge.game.player.Player;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
@@ -77,7 +76,7 @@ public class CostPartMana extends CostPart {
|
||||
}
|
||||
|
||||
public final int getAmountOfX() {
|
||||
return this.cost.getShardCount(ManaCostShard.X);
|
||||
return this.cost.countX();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user