1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-10 01:01:05 -09:00

Changes to try and better handle X mana costs with minimum X values with AI decisions

This commit is contained in:
Michael Simons 2018-06-03 22:50:56 -04:00
parent de9042dafe
commit b0d1f86890

View file

@ -1472,18 +1472,25 @@ public class ComputerPlayer extends PlayerImpl implements Player {
int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost(); int numAvailable = getAvailableManaProducers(game).size() - ability.getManaCosts().convertedManaCost();
if (numAvailable < 0) { if (numAvailable < 0) {
numAvailable = 0; numAvailable = 0;
} } else {
if (numAvailable > max) { if (numAvailable < min) {
numAvailable = max; numAvailable = min;
}
if (numAvailable > max) {
numAvailable = max;
}
} }
return numAvailable; return numAvailable;
} }
@Override @Override
public int announceXCost(int min, int max, String message, Game game, Ability ability, VariableCost variablCost) { public int announceXCost(int min, int max, String message, Game game, Ability ability, VariableCost variablCost) {
log.debug("announceXMana"); log.debug("announceXCost");
//TODO: improve this //TODO: improve this
int value = RandomUtil.nextInt(max + 1); int value = RandomUtil.nextInt(max + 1);
if (value < min) {
value = min;
}
if (value < max) { if (value < max) {
value++; value++;
} }