Commit ef15bb8d authored by Michael Kamensky's avatar Michael Kamensky

Merge branch 'master' into 'master'

Fix London Mulligan AI so that the necessary number of cards is actually returned each time

See merge request core-developers/forge!1846
parents b7b8103b 09e0967c
......@@ -555,12 +555,15 @@ public class PlayerControllerAi extends PlayerController {
// TODO This is better than it was before, but still suboptimal (but fast).
// Maybe score a bunch of hands based on projected hand size and return the "duds"
CardCollection hand = new CardCollection(player.getCardsIn(ZoneType.Hand));
CardCollection landsInHand = CardLists.filter(hand, Presets.LANDS);
int numLandsInHand = landsInHand.size();
int numLandsDesired = (mulliganingPlayer.getStartingHandSize() - cardsToReturn) / 2;
CardCollection toReturn = new CardCollection();
for (int i = 0; i < cardsToReturn; i++) {
hand.removeAll(toReturn);
CardCollection landsInHand = CardLists.filter(hand, Presets.LANDS);
int numLandsInHand = landsInHand.size() - CardLists.filter(toReturn, Presets.LANDS).size();
// If we're flooding with lands, get rid of the worst land we have
if (numLandsInHand > 0 && numLandsInHand > numLandsDesired) {
CardCollection producingLands = CardLists.filter(landsInHand, Presets.LANDS_PRODUCING_MANA);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment