Fix shard sort order when deciding if a mana cost is payable.

Prior to this change, the logic would conclude that a {1}{W} cost is not payable with an untapped Scoured Barrens (w/b) and Jungle Hollow (b/g) on the field.

The code is unfortunately too tangled (has too many dependencies) to write a unit test for this. Ideally, we should refactor so it wouldn't depend on the player, etc and just take parameters that can be fed test data.
This commit is contained in:
Myrd
2014-12-16 20:26:41 +00:00
parent 8c25bfd8b7
commit 6be85a1741
2 changed files with 9 additions and 7 deletions

View File

@@ -697,11 +697,7 @@ public class ComputerUtilMana {
// * pay hybrids
// * pay phyrexian, keep mana for colorless
// * pay colorless
Iterator<ManaCostShard> shards = cost.getDistinctShards().iterator();
if (shards.hasNext()) {
return shards.next();
}
return null;
return cost.getShardToPayByPriority(cost.getDistinctShards(), MagicColor.ALL_COLORS);
}
private static void adjustManaCostToAvoidNegEffects(ManaCostBeingPaid cost, final Card card, Player ai) {