1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-03 09:18:59 -09:00

Some more changes to logging of ComputerPlayer.

This commit is contained in:
LevelX2 2013-02-22 08:40:32 +01:00
parent 541e1cd2a9
commit 0af121c3e4
3 changed files with 9 additions and 8 deletions
Mage.Server.Plugins
Mage.Player.AI.MA/src/mage/player/ai
Mage.Player.AI/src/main/java/mage/player/ai

View file

@ -185,7 +185,7 @@ public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements
}
protected void printOutState(Game game, UUID playerId) {
if (lastTurnOutput < game.getTurnNum()) {
if (lastTurnOutput != game.getTurnNum()) {
lastTurnOutput = game.getTurnNum();
logger.info(new StringBuilder("------------------------ ").append("Turn: ").append(game.getTurnNum()).append(" --------------------------------------------------------------").toString());
}

View file

@ -151,7 +151,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 implements Player {
actionCache.add(ability.getRule() + "_" + ability.getSourceId());
}
} else {
System.out.println("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
logger.debug("[" + game.getPlayer(playerId).getName() + "][pre] Action: skip");
}
}
}
@ -176,7 +176,7 @@ public class ComputerPlayer7 extends ComputerPlayer6 implements Player {
//System.out.println("[" + game.getPlayer(playerId).getName() + "][post] Action: not better score");
//}
} else {
System.out.println("[" + game.getPlayer(playerId).getName() + "][post] Action: skip");
logger.debug("[" + game.getPlayer(playerId).getName() + "][post] Action: skip");
}
}
}

View file

@ -462,10 +462,11 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
}
else {
targets = threats(opponentId, source.getSourceId(), ((TargetPermanent)target).getFilter(), game, target.getTargets());
}
//targets = threats(null, source.getSourceId(), ((TargetPermanent)target).getFilter(), game, target.getTargets());
}
if (targets.isEmpty() && target.isRequired()) {
targets = game.getBattlefield().getActivePermanents(((TargetPermanent)target).getFilter(), playerId, game);
targets = threats(null, source.getSourceId(), ((TargetPermanent)target).getFilter(), game, target.getTargets());
Collections.reverse(targets);
//targets = game.getBattlefield().getActivePermanents(((TargetPermanent)target).getFilter(), playerId, game);
}
for (Permanent permanent: targets) {
if (((TargetPermanent)target).canTarget(playerId, permanent.getId(), source, game)) {
@ -1766,8 +1767,8 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
protected List<Permanent> threats(UUID playerId, UUID sourceId, FilterPermanent filter, Game game, List<UUID> targets) {
List<Permanent> threats = playerId == null ?
game.getBattlefield().getAllActivePermanents(filter, game) :
game.getBattlefield().getActivePermanents(filter, this.playerId, sourceId, game);
game.getBattlefield().getActivePermanents(filter, this.getId(), sourceId, game) : // all permanents within the range of the player
game.getBattlefield().getAllActivePermanents(filter, playerId, game); // all controlled permanents of playerId
Iterator<Permanent> it = threats.iterator();
while (it.hasNext()) { // remove permanents already targeted