- Generalize SweepCreatures logic (By Invitation Only)

This commit is contained in:
Michael Kamensky
2021-11-01 22:07:51 +03:00
parent a4beec94a7
commit 993e460cbe

View File

@@ -1923,11 +1923,12 @@ public class AiController {
} else if ("Vermin".equals(logic)) { } else if ("Vermin".equals(logic)) {
return MyRandom.getRandom().nextInt(Math.max(player.getLife() - 5, 0)); return MyRandom.getRandom().nextInt(Math.max(player.getLife() - 5, 0));
} else if ("SweepCreatures".equals(logic)) { } else if ("SweepCreatures".equals(logic)) {
int choiceLimit = AbilityUtils.calculateAmount(source, sa.getParam("Max"), sa);
int maxCreatures = 0; int maxCreatures = 0;
for (Player opp : player.getOpponents()) { for (Player opp : player.getOpponents()) {
maxCreatures = Math.max(maxCreatures, opp.getCreaturesInPlay().size()); maxCreatures = Math.max(maxCreatures, opp.getCreaturesInPlay().size());
} }
return Math.min(13, maxCreatures); return Math.min(choiceLimit, maxCreatures);
} }
return max; return max;
} }