Fix mulligan with zero cards

This commit is contained in:
tool4EvEr
2021-08-05 21:42:04 +02:00
parent 1d4f68d95f
commit 32b4407b04
3 changed files with 2 additions and 3 deletions

View File

@@ -2066,7 +2066,7 @@ public class ComputerUtil {
// Computer mulligans if there are no cards with converted mana cost of 0 in its hand // Computer mulligans if there are no cards with converted mana cost of 0 in its hand
public static boolean wantMulligan(Player ai, int cardsToReturn) { public static boolean wantMulligan(Player ai, int cardsToReturn) {
final CardCollectionView handList = ai.getCardsIn(ZoneType.Hand); final CardCollectionView handList = ai.getCardsIn(ZoneType.Hand);
return scoreHand(handList, ai, cardsToReturn) <= 0; return !handList.isEmpty() && scoreHand(handList, ai, cardsToReturn) <= 0;
} }
public static CardCollection getPartialParisCandidates(Player ai) { public static CardCollection getPartialParisCandidates(Player ai) {

View File

@@ -116,7 +116,6 @@ public class CardFactory {
//out.setFaceDown(in.isFaceDown()); //out.setFaceDown(in.isFaceDown());
return out; return out;
} }
/** /**
@@ -740,7 +739,6 @@ public class CardFactory {
} }
} }
if (sa.hasParam("GainThisAbility") && (sa instanceof SpellAbility)) { if (sa.hasParam("GainThisAbility") && (sa instanceof SpellAbility)) {
SpellAbility root = ((SpellAbility) sa).getRootAbility(); SpellAbility root = ((SpellAbility) sa).getRootAbility();

View File

@@ -29,6 +29,7 @@ public abstract class AbstractMulligan {
public void mulligan() { public void mulligan() {
CardCollection toMulligan = new CardCollection(player.getCardsIn(ZoneType.Hand)); CardCollection toMulligan = new CardCollection(player.getCardsIn(ZoneType.Hand));
if (toMulligan.isEmpty()) return;
revealPreMulligan(toMulligan); revealPreMulligan(toMulligan);
for (final Card c : toMulligan) { for (final Card c : toMulligan) {
player.getGame().getAction().moveToLibrary(c, null); player.getGame().getAction().moveToLibrary(c, null);