mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58: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.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
import forge.LobbyPlayer;
|
|
||||||
import forge.Singletons;
|
import forge.Singletons;
|
||||||
import forge.assets.FSkinProp;
|
import forge.assets.FSkinProp;
|
||||||
import forge.game.GameView;
|
import forge.game.GameView;
|
||||||
import forge.game.player.PlayerView;
|
|
||||||
import forge.gui.SOverlayUtils;
|
import forge.gui.SOverlayUtils;
|
||||||
import forge.gui.framework.FScreen;
|
import forge.gui.framework.FScreen;
|
||||||
import forge.match.NextGameDecision;
|
import forge.match.NextGameDecision;
|
||||||
import forge.model.FModel;
|
import forge.model.FModel;
|
||||||
import forge.player.GamePlayerUtil;
|
|
||||||
import forge.quest.QuestController;
|
import forge.quest.QuestController;
|
||||||
import forge.quest.QuestDraftUtils;
|
import forge.quest.QuestDraftUtils;
|
||||||
import forge.screens.home.quest.CSubmenuChallenges;
|
import forge.screens.home.quest.CSubmenuChallenges;
|
||||||
@@ -75,34 +72,18 @@ public class QuestDraftWinLose extends ControlWinLose {
|
|||||||
@Override
|
@Override
|
||||||
public final boolean populateCustomPanel() {
|
public final boolean populateCustomPanel() {
|
||||||
QuestController quest = FModel.getQuest();
|
QuestController quest = FModel.getQuest();
|
||||||
|
final boolean gameHadHumanPlayer = matchUI.hasLocalPlayers();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastGame.isMatchOver()) {
|
if (lastGame.isMatchOver()) {
|
||||||
String winner = lastGame.getWinningPlayer().getName();
|
final String winner = lastGame.getWinningPlayer().getName();
|
||||||
|
|
||||||
quest.getAchievements().getCurrentDraft().setWinner(winner);
|
quest.getAchievements().getCurrentDraft().setWinner(winner);
|
||||||
quest.save();
|
quest.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gameHadHumanPlayer) {
|
if (!gameHadHumanPlayer) {
|
||||||
if (lastGame.isMatchOver()) {
|
QuestDraftUtils.matchInProgress = false;
|
||||||
this.actionOnQuitMatch();
|
QuestDraftUtils.update(matchUI);
|
||||||
QuestDraftUtils.matchInProgress = false;
|
|
||||||
QuestDraftUtils.update(matchUI);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.actionOnContinue();
|
|
||||||
QuestDraftUtils.update(matchUI);
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -223,9 +223,13 @@ public class HostedMatch {
|
|||||||
match.startGame(game);
|
match.startGame(game);
|
||||||
|
|
||||||
// After game is over...
|
// After game is over...
|
||||||
if (match.isMatchOver() && humanCount == 0) {
|
if (humanCount == 0) {
|
||||||
// ... if no human players, let AI decide next game
|
// ... 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);
|
rules.canCloneUseTargetsImage = FModel.getPreferences().getPrefBoolean(FPref.UI_CLONE_MODE_SOURCE);
|
||||||
|
|
||||||
final HostedMatch newMatch = GuiBase.getInterface().hostMatch();
|
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) {
|
public static void continueMatches(final IGuiGame gui) {
|
||||||
|
|||||||
Reference in New Issue
Block a user