mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 20:58:03 +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();
|
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>() {
|
final CardCollectionView lands = CardLists.filter(handList, new Predicate<Card>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(final Card c) {
|
public boolean apply(final Card c) {
|
||||||
@@ -1581,9 +1589,6 @@ public class ComputerUtil {
|
|||||||
return score;
|
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
|
// otherwise, reject bad hands or return score
|
||||||
if ( landSize < 2) {
|
if ( landSize < 2) {
|
||||||
// BAD Hands, 0 or 1 lands
|
// BAD Hands, 0 or 1 lands
|
||||||
|
|||||||
Reference in New Issue
Block a user