Fix plague of vermin crash

This commit is contained in:
Chris H
2024-05-13 23:21:25 -04:00
parent decd8f8f8e
commit e317ffbe4c

View File

@@ -1851,7 +1851,11 @@ public class AiController {
} else if (sa.hasSVar("EnergyToPay")) {
return AbilityUtils.calculateAmount(source, sa.getSVar("EnergyToPay"), sa);
} else if ("Vermin".equals(logic)) {
return MyRandom.getRandom().nextInt(Math.max(player.getLife() - 5, 0));
if (player.getLife() < 5) {
return min;
}
return MyRandom.getRandom().nextInt(Math.max(player.getLife() - 5, 1));
} else if ("SweepCreatures".equals(logic)) {
int minAllowedChoice = AbilityUtils.calculateAmount(source, sa.getParam("Min"), sa);
int choiceLimit = AbilityUtils.calculateAmount(source, sa.getParam("Max"), sa);