mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
- Fix SimulateMatch not initializing Commander appropriately
This commit is contained in:
@@ -69,7 +69,6 @@ public class SimulateMatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<RegisteredPlayer> pp = new ArrayList<RegisteredPlayer>();
|
List<RegisteredPlayer> pp = new ArrayList<RegisteredPlayer>();
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@@ -85,7 +84,15 @@ public class SimulateMatch {
|
|||||||
String name = String.format("Ai(%s)-%s", i, d.getName());
|
String name = String.format("Ai(%s)-%s", i, d.getName());
|
||||||
sb.append(name);
|
sb.append(name);
|
||||||
|
|
||||||
pp.add(new RegisteredPlayer(d).setPlayer(GamePlayerUtil.createAiPlayer(name, i-1)));
|
RegisteredPlayer rp = null;
|
||||||
|
|
||||||
|
if (type.equals(GameType.Commander)) {
|
||||||
|
rp = RegisteredPlayer.forCommander(d);
|
||||||
|
} else {
|
||||||
|
rp = new RegisteredPlayer(d);
|
||||||
|
}
|
||||||
|
rp.setPlayer(GamePlayerUtil.createAiPlayer(name, i - 1));
|
||||||
|
pp.add(rp);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
sb.append(" - ").append(Lang.nounWithNumeral(nGames, "game")).append(" of ").append(type);
|
sb.append(" - ").append(Lang.nounWithNumeral(nGames, "game")).append(" of ").append(type);
|
||||||
@@ -93,6 +100,8 @@ public class SimulateMatch {
|
|||||||
System.out.println(sb.toString());
|
System.out.println(sb.toString());
|
||||||
|
|
||||||
GameRules rules = new GameRules(type);
|
GameRules rules = new GameRules(type);
|
||||||
|
rules.setAppliedVariants(EnumSet.of(type));
|
||||||
|
|
||||||
Match mc = new Match(rules, pp, "Test");
|
Match mc = new Match(rules, pp, "Test");
|
||||||
for (int iGame = 0; iGame < nGames; iGame++) {
|
for (int iGame = 0; iGame < nGames; iGame++) {
|
||||||
simulateSingleMatch(mc, iGame);
|
simulateSingleMatch(mc, iGame);
|
||||||
@@ -132,6 +141,10 @@ public class SimulateMatch {
|
|||||||
System.out.println(String.format("\nGame %d ended in %d ms. %s has won!\n", 1+iGame, sw.getTime(), g1.getOutcome().getWinningLobbyPlayer().getName()));
|
System.out.println(String.format("\nGame %d ended in %d ms. %s has won!\n", 1+iGame, sw.getTime(), g1.getOutcome().getWinningLobbyPlayer().getName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Match simulateOffthreadGame(List<Deck> decks, GameType format, int games) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private static Deck deckFromCommandLineParameter(String deckname, GameType type) {
|
private static Deck deckFromCommandLineParameter(String deckname, GameType type) {
|
||||||
int dotpos = deckname.lastIndexOf('.');
|
int dotpos = deckname.lastIndexOf('.');
|
||||||
if(dotpos > 0 && dotpos == deckname.length()-4)
|
if(dotpos > 0 && dotpos == deckname.length()-4)
|
||||||
|
|||||||
Reference in New Issue
Block a user