Merge pull request #5709 from kevlahnota/master2

enable Boss dialogue
This commit is contained in:
kevlahnota
2024-07-28 15:24:04 +08:00
committed by GitHub
4 changed files with 28 additions and 18 deletions

View File

@@ -1260,8 +1260,11 @@ public class Forge implements ApplicationListener {
@Override @Override
public boolean touchDown(int x, int y, int pointer, int button) { public boolean touchDown(int x, int y, int pointer, int button) {
if (transitionScreen != null) if (transitionScreen != null) {
return false; boolean isFDialog = FOverlay.getTopOverlay() != null && FOverlay.getTopOverlay() instanceof FDialog;
if (!isFDialog)
return false;
}
if (pointer == 0) { //don't change listeners when second finger goes down for zoom if (pointer == 0) { //don't change listeners when second finger goes down for zoom
updatePotentialListeners(x, y); updatePotentialListeners(x, y);
if (keyInputAdapter != null) { if (keyInputAdapter != null) {

View File

@@ -109,7 +109,7 @@ public class DuelScene extends ForgeScene {
e.printStackTrace(); e.printStackTrace();
} }
String enemyName = enemy.getName(); String enemyName = enemy.getName();
boolean showMessages = enemy.getData().copyPlayerDeck && Current.player().isUsingCustomDeck(); boolean showMessages = enemy.getData().boss || (enemy.getData().copyPlayerDeck && Current.player().isUsingCustomDeck());
Current.player().clearBlessing(); Current.player().clearBlessing();
if ((chaosBattle || showMessages) && !winner) { if ((chaosBattle || showMessages) && !winner) {
final FBufferedImage fb = new FBufferedImage(120, 120) { final FBufferedImage fb = new FBufferedImage(120, 120) {
@@ -131,19 +131,18 @@ public class DuelScene extends ForgeScene {
"Thought you could beat me? Whew, talk about conceited.", "*Yawn* ... Huh? It's over already? But I just woke up!", "Thought you could beat me? Whew, talk about conceited.", "*Yawn* ... Huh? It's over already? But I just woke up!",
"Next time bring an army. It might give you a chance.", "The reason you lost is quite simple...", "Next time bring an army. It might give you a chance.", "The reason you lost is quite simple...",
"Is that all you can do?", "You need to learn more to stand a chance.", "You weren't that bad.", "You made an effort at least.", "Is that all you can do?", "You need to learn more to stand a chance.", "You weren't that bad.", "You made an effort at least.",
"From today, you can call me teacher.", "Hmph, predictable!", "I haven't used a fraction of my REAL power!"); "From today, you can call me teacher.", "Hmph, predictable!", "I haven't used a fraction of my REAL power!",
"Wanting something does not give you the right to have it.", "It takes skill to be this bad.",
"You're impressing me with your ability to fail so effortlessly.", "No one's good at everything . . . but you're bad at everything",
"I'd say you're really good if failing was the goal.", "It ain't getting easier, and you're not getting any better",
"Uh... you okay there?", "Are you even trying?", "Lose again? Why am I not surprised!", "That's the spirit, Go out there and lose again. I'll be waiting.");
String message = Aggregates.random(insult); String message = Aggregates.random(insult);
boolean finalWinner = winner; boolean finalWinner = winner;
FThreads.invokeInEdtNowOrLater(() -> FOptionPane.showMessageDialog(message, enemyName, fb, new Callback<Integer>() { FThreads.invokeInEdtNowOrLater(() -> FOptionPane.showMessageDialog(message, enemyName, fb, new Callback<Integer>() {
@Override @Override
public void run(Integer result) { public void run(Integer result) {
if (result == 0) { afterGameEnd(enemyName, finalWinner);
afterGameEnd(enemyName, finalWinner); exitDuelScene();
if (Config.instance().getSettingData().disableWinLose) {
MatchController.writeMatchPreferences();
exitDuelScene();
}
}
fb.dispose(); fb.dispose();
} }
})); }));
@@ -375,7 +374,7 @@ public class DuelScene extends ForgeScene {
//hostedMatch.setEndGameHook(() -> DuelScene.this.GameEnd()); //hostedMatch.setEndGameHook(() -> DuelScene.this.GameEnd());
hostedMatch.startMatch(rules, appliedVariants, players, guiMap, bossBattle ? MusicPlaylist.BOSS : MusicPlaylist.MATCH); hostedMatch.startMatch(rules, appliedVariants, players, guiMap, bossBattle ? MusicPlaylist.BOSS : MusicPlaylist.MATCH);
MatchController.instance.setGameView(hostedMatch.getGameView()); MatchController.instance.setGameView(hostedMatch.getGameView());
boolean showMessages = enemy.getData().copyPlayerDeck && Current.player().isUsingCustomDeck(); boolean showMessages = enemy.getData().boss || (enemy.getData().copyPlayerDeck && Current.player().isUsingCustomDeck());
if (chaosBattle || showMessages) { if (chaosBattle || showMessages) {
final FBufferedImage fb = new FBufferedImage(120, 120) { final FBufferedImage fb = new FBufferedImage(120, 120) {
@Override @Override

View File

@@ -272,7 +272,6 @@ public class ConsoleCommandInterpreter {
for (EnemyData E : new Array.ArrayIterator<>(WorldData.getAllEnemies())) { for (EnemyData E : new Array.ArrayIterator<>(WorldData.getAllEnemies())) {
Deck D = E.generateDeck(Current.player().isFantasyMode(), Current.player().isUsingCustomDeck() || Current.player().getDifficulty().name.equalsIgnoreCase("Hard")); Deck D = E.generateDeck(Current.player().isFantasyMode(), Current.player().isUsingCustomDeck() || Current.player().getDifficulty().name.equalsIgnoreCase("Hard"));
DeckProxy DP = new DeckProxy(D, "Constructed", GameType.Constructed, null); DeckProxy DP = new DeckProxy(D, "Constructed", GameType.Constructed, null);
ColorSet colorSet = DP.getColor();
System.out.printf("Deck: %s\n%s\n\n", D.getName(), DP.getDeck().getMain().toCardList("\n") System.out.printf("Deck: %s\n%s\n\n", D.getName(), DP.getDeck().getMain().toCardList("\n")
); );
} }
@@ -282,9 +281,8 @@ public class ConsoleCommandInterpreter {
for (EnemyData E : new Array.ArrayIterator<>(WorldData.getAllEnemies())) { for (EnemyData E : new Array.ArrayIterator<>(WorldData.getAllEnemies())) {
Deck D = E.generateDeck(Current.player().isFantasyMode(), Current.player().isUsingCustomDeck() || Current.player().getDifficulty().name.equalsIgnoreCase("Hard")); Deck D = E.generateDeck(Current.player().isFantasyMode(), Current.player().isUsingCustomDeck() || Current.player().getDifficulty().name.equalsIgnoreCase("Hard"));
DeckProxy DP = new DeckProxy(D, "Constructed", GameType.Constructed, null); DeckProxy DP = new DeckProxy(D, "Constructed", GameType.Constructed, null);
ColorSet colorSet = DP.getColor(); System.out.printf("%s Colors: %s | Deck Colors: %s (%s)%s\n", E.name, E.colors, DP.getColorIdentity().toEnumSet().toString(), DP.getName()
System.out.printf("%s Colors: %s | Deck Colors: %s (%s)\n", E.name, E.colors, DP.getColorIdentity().toEnumSet().toString(), DP.getName() , E.boss ? " - BOSS" : "");
);
} }
return "Enemy color Identity dumped to stdout."; return "Enemy color Identity dumped to stdout.";
}); });

View File

@@ -713,8 +713,18 @@ public class CardUtil {
public static Deck getDeck(String path, boolean forAI, boolean isFantasyMode, String colors, boolean isTheme, boolean useGeneticAI, CardEdition starterEdition, boolean discourageDuplicates) public static Deck getDeck(String path, boolean forAI, boolean isFantasyMode, String colors, boolean isTheme, boolean useGeneticAI, CardEdition starterEdition, boolean discourageDuplicates)
{ {
if(path.endsWith(".dck")) if(path.endsWith(".dck")) {
return DeckSerializer.fromFile(Config.instance().getFile(path).file()); FileHandle fileHandle = Config.instance().getFile(path);
Deck deck = null;
if (fileHandle != null) {
deck = DeckSerializer.fromFile(fileHandle.file());
}
if (deck == null) {
deck = DeckgenUtil.getRandomOrPreconOrThemeDeck(colors, true, false, true);
System.err.println("Error loading Deck: " + path + "\nGenerating random deck: " + deck.getName());
}
return deck;
}
if(forAI && (isFantasyMode||useGeneticAI)) { if(forAI && (isFantasyMode||useGeneticAI)) {
Deck deck = DeckgenUtil.getRandomOrPreconOrThemeDeck(colors, forAI, isTheme, useGeneticAI); Deck deck = DeckgenUtil.getRandomOrPreconOrThemeDeck(colors, forAI, isTheme, useGeneticAI);