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 #4906
This commit is contained in:
parent
de9042dafe
commit
b0d1f86890
1 changed files with 11 additions and 4 deletions
|
@ -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++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue