mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fix (now really, I hope) ai vs ai matches in quest tournament mode.
This commit is contained in:
@@ -19,16 +19,13 @@ package forge.screens.match;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import forge.LobbyPlayer;
|
||||
import forge.Singletons;
|
||||
import forge.assets.FSkinProp;
|
||||
import forge.game.GameView;
|
||||
import forge.game.player.PlayerView;
|
||||
import forge.gui.SOverlayUtils;
|
||||
import forge.gui.framework.FScreen;
|
||||
import forge.match.NextGameDecision;
|
||||
import forge.model.FModel;
|
||||
import forge.player.GamePlayerUtil;
|
||||
import forge.quest.QuestController;
|
||||
import forge.quest.QuestDraftUtils;
|
||||
import forge.screens.home.quest.CSubmenuChallenges;
|
||||
@@ -75,34 +72,18 @@ public class QuestDraftWinLose extends ControlWinLose {
|
||||
@Override
|
||||
public final boolean populateCustomPanel() {
|
||||
QuestController quest = FModel.getQuest();
|
||||
|
||||
final LobbyPlayer questLobbyPlayer = GamePlayerUtil.getQuestPlayer();
|
||||
final Iterable<PlayerView> players = lastGame.getPlayers();
|
||||
boolean gameHadHumanPlayer = false;
|
||||
for (final PlayerView p : players) {
|
||||
if (p.isLobbyPlayer(questLobbyPlayer)) {
|
||||
gameHadHumanPlayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
final boolean gameHadHumanPlayer = matchUI.hasLocalPlayers();
|
||||
|
||||
if (lastGame.isMatchOver()) {
|
||||
String winner = lastGame.getWinningPlayer().getName();
|
||||
final String winner = lastGame.getWinningPlayer().getName();
|
||||
|
||||
quest.getAchievements().getCurrentDraft().setWinner(winner);
|
||||
quest.save();
|
||||
}
|
||||
|
||||
if (!gameHadHumanPlayer) {
|
||||
if (lastGame.isMatchOver()) {
|
||||
this.actionOnQuitMatch();
|
||||
QuestDraftUtils.matchInProgress = false;
|
||||
QuestDraftUtils.update(matchUI);
|
||||
}
|
||||
else {
|
||||
this.actionOnContinue();
|
||||
QuestDraftUtils.update(matchUI);
|
||||
}
|
||||
QuestDraftUtils.matchInProgress = false;
|
||||
QuestDraftUtils.update(matchUI);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,9 +223,13 @@ public class HostedMatch {
|
||||
match.startGame(game);
|
||||
|
||||
// After game is over...
|
||||
if (match.isMatchOver() && humanCount == 0) {
|
||||
if (humanCount == 0) {
|
||||
// ... if no human players, let AI decide next game
|
||||
addNextGameDecision(null, NextGameDecision.CONTINUE);
|
||||
if (match.isMatchOver()) {
|
||||
addNextGameDecision(null, NextGameDecision.QUIT);
|
||||
} else {
|
||||
addNextGameDecision(null, NextGameDecision.CONTINUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -196,7 +196,7 @@ public class QuestDraftUtils {
|
||||
rules.canCloneUseTargetsImage = FModel.getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE);
|
||||
|
||||
final HostedMatch newMatch = GuiBase.getInterface().hostMatch();
|
||||
newMatch.startMatch(rules, null, nextMatch.matchStarter, nextMatch.humanPlayer, gui);
|
||||
newMatch.startMatch(rules, null, nextMatch.matchStarter, nextMatch.humanPlayer, GuiBase.getInterface().getNewGuiGame());
|
||||
}
|
||||
|
||||
public static void continueMatches(final IGuiGame gui) {
|
||||
|
||||
Reference in New Issue
Block a user