latest monte carlo ai - has a memory leak

This commit is contained in:
BetaSteward 2012-01-10 21:29:53 -05:00
parent a06f27ec89
commit dfffdfcf8c
38 changed files with 677 additions and 286 deletions

View file

@ -182,21 +182,21 @@ public class Spell<T extends Spell<T>> implements StackObject, Card {
String name = null;
if (object == null) {
Player targetPlayer = game.getPlayer(targetId);
if (player != null) name = targetPlayer.getName();
if (targetPlayer != null) name = targetPlayer.getName();
} else {
name = object.getName();
}
if (name != null && player.chooseUse(ability.getEffects().get(0).getOutcome(), "Change target from " + name + "?", game)) {
if (!player.chooseTarget(ability.getEffects().get(0).getOutcome(), newTarget, ability, game))
newTarget.addTarget(targetId, ability, game);
newTarget.addTarget(targetId, ability, game, false);
}
else {
newTarget.addTarget(targetId, ability, game);
newTarget.addTarget(targetId, ability, game, false);
}
}
target.clearChosen();
for (UUID newTargetId: newTarget.getTargets()) {
target.addTarget(newTargetId, ability, game);
target.addTarget(newTargetId, ability, game, false);
}
}
return true;