Fixed a bug of computer player handling TargetCreatureOrPlayerAmount.

This commit is contained in:
LevelX2 2014-08-18 23:52:35 +02:00
parent edd1563c12
commit d46b4a7248

View file

@ -692,7 +692,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
UUID opponentId = game.getOpponents(playerId).iterator().next();
if (target instanceof TargetCreatureOrPlayerAmount) {
if (game.getPlayer(opponentId).getLife() <= target.getAmountRemaining()) {
if (outcome.equals(Outcome.Damage) && game.getPlayer(opponentId).getLife() <= target.getAmountRemaining()) {
target.addTarget(opponentId, target.getAmountRemaining(), source, game);
return true;
}
@ -711,6 +711,17 @@ public class ComputerPlayer extends PlayerImpl implements Player {
}
}
}
if (outcome.isGood() && target.canTarget(playerId, playerId, source, game)) {
target.addTarget(opponentId, target.getAmountRemaining(), source, game);
return true;
} else if (target.canTarget(playerId, opponentId, source, game)){
// no permanent target so take opponent
target.addTarget(opponentId, target.getAmountRemaining(), source, game);
return true;
} else if (target.canTarget(playerId, playerId, source, game)) {
target.addTarget(opponentId, target.getAmountRemaining(), source, game);
return true;
}
}
return false;
}