feat: Winnable and some minor changes
This commit is contained in:
@ -22,6 +22,11 @@ public interface ApiService {
|
||||
@POST("game/new")
|
||||
Call<UnifiedResponse<Game, Error>> newGame();
|
||||
|
||||
@GET("game/winnable")
|
||||
Call<UnifiedResponse<Boolean, Error>> winnable(
|
||||
@Query("playerKey") String playerKey
|
||||
);
|
||||
|
||||
@POST("game/players/new")
|
||||
Call<UnifiedResponse<String, Error>> newPlayer(
|
||||
@Query("gameKey") String gameKey,
|
||||
|
@ -237,9 +237,8 @@ public class Chronos {
|
||||
var characters = room.getCharacters();
|
||||
if (characters.isEmpty()) {
|
||||
Cli.type("V místnosti se nenachází jediná duše...");
|
||||
} else {
|
||||
talk(characters);
|
||||
}
|
||||
talk(characters);
|
||||
|
||||
var responseRooms = apiService.getAllRooms(localData.getUserSecret()).execute();
|
||||
var rooms = responseRooms.body().getData().get().stream().filter(rm -> !rm.getId().equals(room.getId())).toList();
|
||||
|
@ -19,6 +19,7 @@ public class CommandPalette {
|
||||
USER_PROFILE,
|
||||
CHAT_OPEN,
|
||||
CHAT_SEND,
|
||||
CHECK_WINNABLE,
|
||||
EXIT,
|
||||
}
|
||||
|
||||
@ -62,6 +63,7 @@ public class CommandPalette {
|
||||
allCommands.add(new Command("Otevřít profil uživatele", CommandType.USER_PROFILE));
|
||||
allCommands.add(new Command("Otevřít chat", CommandType.CHAT_OPEN));
|
||||
allCommands.add(new Command("Odeslat zprávu do chatu", CommandType.CHAT_SEND));
|
||||
allCommands.add(new Command("Zkontrolovat vyhratelnost hry", CommandType.CHECK_WINNABLE));
|
||||
allCommands.add(new Command("Odejít ze hry", CommandType.EXIT));
|
||||
|
||||
var responseInvFull = apiService.inventoryIsFull(playerKey).execute();
|
||||
@ -115,6 +117,19 @@ public class CommandPalette {
|
||||
var chat = new Chat(apiService, playerKey);
|
||||
chat.sendMessage();
|
||||
|
||||
yield displayIndex();
|
||||
}
|
||||
case CHECK_WINNABLE -> {
|
||||
var response = apiService.winnable(playerKey).execute();
|
||||
var winnable = response.body().getData().get();
|
||||
|
||||
System.out.println(Cli.Colors.RED + "Experimentální!!!" + Cli.Colors.RESET + " Toto není 100% jestli je hra vyhratelná.");
|
||||
if (winnable) {
|
||||
Cli.info("Hra je dost možná vyhratelná!");
|
||||
} else {
|
||||
Cli.info("Hra je dost možná nevyhratelná!");
|
||||
}
|
||||
|
||||
yield displayIndex();
|
||||
}
|
||||
};
|
||||
|
@ -169,7 +169,7 @@ public class Cli {
|
||||
if (choice >= 1 && choice <= options.size()) {
|
||||
return choice - 1;
|
||||
} else {
|
||||
System.out.println("Neplatní možnost, vyberte číslo mezi 1 a " + options.size());
|
||||
System.out.println("Neplatná možnost, vyberte číslo mezi 1 a " + options.size());
|
||||
}
|
||||
} else {
|
||||
System.out.println("Neplatný vstup, vložte číslo.");
|
||||
|
Reference in New Issue
Block a user