mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
added cardsUsed list to test manacosts
This commit is contained in:
@@ -105,6 +105,8 @@ public class ComputerUtilMana {
|
|||||||
Map<ManaCostShard, Collection<SpellAbility>> sourcesForShards = ComputerUtilMana.groupAndOrderToPayShards(ai, manaAbilityMap, cost);
|
Map<ManaCostShard, Collection<SpellAbility>> sourcesForShards = ComputerUtilMana.groupAndOrderToPayShards(ai, manaAbilityMap, cost);
|
||||||
|
|
||||||
// Loop over mana needed
|
// Loop over mana needed
|
||||||
|
List<Card> cardsUsed = test ? new ArrayList<Card>() : null;
|
||||||
|
|
||||||
ManaCostShard toPay = null;
|
ManaCostShard toPay = null;
|
||||||
while (!cost.isPaid()) {
|
while (!cost.isPaid()) {
|
||||||
toPay = getNextShardToPay(cost, sourcesForShards);
|
toPay = getNextShardToPay(cost, sourcesForShards);
|
||||||
@@ -113,6 +115,8 @@ public class ComputerUtilMana {
|
|||||||
List<SpellAbility> payableSources = new ArrayList<SpellAbility>();
|
List<SpellAbility> payableSources = new ArrayList<SpellAbility>();
|
||||||
if( saList != null ) {
|
if( saList != null ) {
|
||||||
for (final SpellAbility ma : saList) {
|
for (final SpellAbility ma : saList) {
|
||||||
|
if( test && cardsUsed.contains(ma.getSourceCard()) )
|
||||||
|
continue;
|
||||||
if( canPayShardWithSpellAbility(toPay, ai, ma, sa, checkPlayable || !test ) ) {
|
if( canPayShardWithSpellAbility(toPay, ai, ma, sa, checkPlayable || !test ) ) {
|
||||||
payableSources.add(ma);
|
payableSources.add(ma);
|
||||||
}
|
}
|
||||||
@@ -144,6 +148,7 @@ public class ComputerUtilMana {
|
|||||||
for(Collection<SpellAbility> kv : sourcesForShards.values()) {
|
for(Collection<SpellAbility> kv : sourcesForShards.values()) {
|
||||||
kv.remove(saPayment);
|
kv.remove(saPayment);
|
||||||
}
|
}
|
||||||
|
cardsUsed.add(saPayment.getSourceCard());
|
||||||
} else {
|
} else {
|
||||||
if (saPayment.getPayCosts() != null) {
|
if (saPayment.getPayCosts() != null) {
|
||||||
final CostPayment pay = new CostPayment(saPayment.getPayCosts(), saPayment);
|
final CostPayment pay = new CostPayment(saPayment.getPayCosts(), saPayment);
|
||||||
|
|||||||
Reference in New Issue
Block a user