mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
ComputerUtil: scoreHand, prevent crash on zero lands deck
This commit is contained in:
@@ -1543,6 +1543,14 @@ public class ComputerUtil {
|
||||
return handList.size();
|
||||
}
|
||||
|
||||
CardCollectionView library = ai.getZone(ZoneType.Library).getCards();
|
||||
int landsInDeck = CardLists.filter(library, CardPredicates.isType("Land")).size();
|
||||
|
||||
// no land deck, can't do anything better
|
||||
if (landsInDeck == 0) {
|
||||
return handList.size();
|
||||
}
|
||||
|
||||
final CardCollectionView lands = CardLists.filter(handList, new Predicate<Card>() {
|
||||
@Override
|
||||
public boolean apply(final Card c) {
|
||||
@@ -1581,9 +1589,6 @@ public class ComputerUtil {
|
||||
return score;
|
||||
}
|
||||
|
||||
CardCollectionView library = ai.getZone(ZoneType.Library).getCards();
|
||||
int landsInDeck = CardLists.filter(library, CardPredicates.isType("Land")).size();
|
||||
|
||||
// otherwise, reject bad hands or return score
|
||||
if ( landSize < 2) {
|
||||
// BAD Hands, 0 or 1 lands
|
||||
|
||||
Reference in New Issue
Block a user