Fixed choosing replacement effects for similar effects (didn't ask to choose);

This commit is contained in:
magenoxx 2011-08-18 18:54:52 +04:00
parent 0d40cc7cf2
commit 3f4ed0a919
2 changed files with 7 additions and 2 deletions

View file

@ -164,19 +164,24 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
game.getState().setPriorityPlayerId(getId());
replacementEffectChoice.getChoices().clear();
int count = 1;
for (ReplacementEffect effect: rEffects) {
replacementEffectChoice.getChoices().add(effect.getText(null));
replacementEffectChoice.getChoices().add(count + ". " + effect.getText(null));
count++;
}
if (replacementEffectChoice.getChoices().size() == 1)
return 0;
while (!abort) {
game.fireChooseEvent(playerId, replacementEffectChoice);
waitForResponse();
System.out.println(response.getString());
if (response.getString() != null) {
replacementEffectChoice.setChoice(response.getString());
count = 1;
for (int i = 0; i < rEffects.size(); i++) {
if (replacementEffectChoice.getChoice().equals(rEffects.get(i).getText(null)))
if (replacementEffectChoice.getChoice().equals(count + ". " + rEffects.get(i).getText(null)))
return i;
count++;
}
}
}