mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22: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);
|
root = root.children.get(0);
|
||||||
// int bestScore = root.getScore();
|
// int bestScore = root.getScore();
|
||||||
// if (bestScore > currentScore || allowBadMoves) {
|
// 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);
|
actions = new LinkedList<>(root.abilities);
|
||||||
combat = root.combat;
|
combat = root.combat;
|
||||||
for (Ability ability : actions) {
|
for (Ability ability : actions) {
|
||||||
actionCache.add(ability.getRule() + "_" + ability.getSourceId());
|
actionCache.add(ability.getRule() + "_" + ability.getSourceId());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
logger.info("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
|
logger.info("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue