[AKH] Fix game slowdown from Cascading Cataracts. Closes #7649. (#9068)

This commit is contained in:
Alex Vasile 2022-07-04 22:20:54 -04:00 committed by GitHub
parent dca2ae546e
commit a8a16968d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -93,13 +93,19 @@ public class AddManaInAnyCombinationEffect extends ManaEffect {
ManaOptions allPossibleMana = new ManaOptions();
for (int i = 0; i < count; ++i) {
ManaOptions currentPossibleMana = new ManaOptions();
for (ColoredManaSymbol coloredManaSymbol : manaSymbols) {
currentPossibleMana.add(new Mana(coloredManaSymbol));
if (manaSymbols.size() == 5) { // If all colors available, then it's the same as any, but this is much faster
currentPossibleMana.add(new Mana(0, 0, 0, 0, 0, 0, 1, 0));
} else {
for (ColoredManaSymbol coloredManaSymbol : manaSymbols) {
currentPossibleMana.add(new Mana(coloredManaSymbol));
}
}
allPossibleMana.addMana(currentPossibleMana);
}
allPossibleMana.removeDuplicated();
return allPossibleMana.stream().collect(Collectors.toList());
return new ArrayList<>(allPossibleMana);
} else {
int amountOfManaLeft = amount.calculate(game, source, this);