mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Fixed a bug preventing the AI profile from being correctly restored between matches in a duel.
This commit is contained in:
@@ -147,12 +147,13 @@ public class MatchController {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
String currentAiProfile = Singletons.getModel().getPreferences().getPref(FPref.UI_CURRENT_AI_PROFILE);
|
String currentAiProfile = Singletons.getModel().getPreferences().getPref(FPref.UI_CURRENT_AI_PROFILE);
|
||||||
|
String lastProfileChosen = this.getPlayedGames().isEmpty() ? currentAiProfile : p.getLobbyPlayer().getAiProfile();
|
||||||
|
|
||||||
// TODO: implement specific AI profiles for quest mode.
|
// TODO: implement specific AI profiles for quest mode.
|
||||||
boolean wantRandomProfile = currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_DUEL)
|
boolean wantRandomProfile = currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_DUEL)
|
||||||
|| (this.getPlayedGames().isEmpty() && currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_MATCH));
|
|| (this.getPlayedGames().isEmpty() && currentAiProfile.equals(AiProfileUtil.AI_PROFILE_RANDOM_MATCH));
|
||||||
|
|
||||||
String profileToSet = wantRandomProfile ? AiProfileUtil.getRandomProfile() : currentAiProfile;
|
String profileToSet = wantRandomProfile ? AiProfileUtil.getRandomProfile() : lastProfileChosen;
|
||||||
|
|
||||||
p.getLobbyPlayer().setAiProfile(profileToSet);
|
p.getLobbyPlayer().setAiProfile(profileToSet);
|
||||||
System.out.println(String.format("AI profile %s was chosen for the lobby player %s.", p.getLobbyPlayer().getAiProfile(), p.getLobbyPlayer().getName()));
|
System.out.println(String.format("AI profile %s was chosen for the lobby player %s.", p.getLobbyPlayer().getAiProfile(), p.getLobbyPlayer().getName()));
|
||||||
|
|||||||
Reference in New Issue
Block a user