mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
* AI - Fixed that the AI used actions with 0 costs endless (e.g. Chimeric Idol).
This commit is contained in:
parent
05c440a160
commit
8bb2868dfa
1 changed files with 18 additions and 4 deletions
|
|
@ -185,11 +185,25 @@ public class ComputerPlayer7 extends ComputerPlayer6 {
|
|||
root = root.children.get(0);
|
||||
// int bestScore = root.getScore();
|
||||
// if (bestScore > currentScore || allowBadMoves) {
|
||||
|
||||
// prevent repeating always the same action with no cost
|
||||
boolean doThis = true;
|
||||
if (root.abilities.size() == 1) {
|
||||
for (Ability ability:root.abilities) {
|
||||
if (ability.getManaCosts().convertedManaCost() == 0 && ability.getCosts().isEmpty()) {
|
||||
if (actionCache.contains(ability.getRule() + "_" + ability.getSourceId())) {
|
||||
doThis = false; // don't do it again
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (doThis) {
|
||||
actions = new LinkedList<>(root.abilities);
|
||||
combat = root.combat;
|
||||
for (Ability ability : actions) {
|
||||
actionCache.add(ability.getRule() + "_" + ability.getSourceId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
logger.info("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue