This commit is contained in:
250406
2026-05-18 11:29:09 +01:00
parent 0fdbfdd81c
commit 7e0b0a808a

View File

@@ -16,52 +16,37 @@ import java.util.Random;
* @author 250406
*/
public class Experientia {
Scanner scanner = new Scanner(System.in);
Random rand = new Random();
String nomeJogador;
String classe;
int nivelJogador = 1;
int xpJogador = 0;
int ouro = 0;
int vidaMax = 100;
int vidaAtual = 100;
int ataqueBase = 10;
int defesaBase = 5;
int bonusAtaque = 0;
int bonusDefesa = 0;
int pontosStatus = 0;
int refreshLojaRestantes = 3; // limite de refresh por luta
Item[] inventario = new Item[20];
int itensCount = 0;
Item[] loja = new Item[3];
String password;
boolean loggedIn = false;
boolean bossFinalDerrotado = false;
boolean admin = false;
public static void main(String[] args) throws IOException {
new Experientia().iniciar();
}
public void iniciar() throws IOException {
System.out.println("===== LOGIN =====");
System.out.println("1-Novo jogo");
System.out.println("2-Carregar jogo");
System.out.println("3-Login Admin");
int op = scanner.nextInt();
if (op == 1) {
criarPersonagem();
} else if (op == 2) {
@@ -69,48 +54,31 @@ public class Experientia {
} else if (op == 3) {
loginAdmin();
}
menu();
}
public void criarPersonagem() {
System.out.print("Nome: ");
nomeJogador = scanner.next();
if (nomeJogador.equalsIgnoreCase("Tralalero")) {
admin = true;
System.out.println("MODO SECRETO ATIVADO");
nivelJogador = 100;
xpJogador = 0;
ouro = 999999;
vidaMax = 9999;
vidaAtual = vidaMax;
ataqueBase = 999;
defesaBase = 999;
bonusAtaque = 999;
bonusDefesa = 999;
pontosStatus = 999;
itensCount = 0;
inventario = new Item[50];
return;
}
System.out.println("Classe:");
System.out.println("1-Guerreiro 2-Mago 3-Ladrão 4-Paladino 5-Assassino 6-Arqueiro");
int c = scanner.nextInt();
switch (c) {
case 1 -> {
classe = "Guerreiro";
@@ -772,38 +740,25 @@ public class Experientia {
}
public void carregarJogo() {
System.out.print("Nome do jogador: ");
String nome = scanner.next();
try (BufferedReader br = new BufferedReader(new FileReader(nome + ".txt"))) {
nomeJogador = br.readLine();
classe = br.readLine();
nivelJogador = Integer.parseInt(br.readLine());
xpJogador = Integer.parseInt(br.readLine());
ouro = Integer.parseInt(br.readLine());
vidaMax = Integer.parseInt(br.readLine());
vidaAtual = Integer.parseInt(br.readLine());
ataqueBase = Integer.parseInt(br.readLine());
defesaBase = Integer.parseInt(br.readLine());
bonusAtaque = Integer.parseInt(br.readLine());
bonusDefesa = Integer.parseInt(br.readLine());
pontosStatus = Integer.parseInt(br.readLine());
itensCount = Integer.parseInt(br.readLine());
inventario = new Item[50];
for (int i = 0; i < itensCount; i++) {
String[] parts = br.readLine().split(";");
inventario[i] = new Item(
parts[0],
parts[1],
@@ -812,13 +767,9 @@ public class Experientia {
parts[4]
);
}
System.out.println("Jogo carregado com sucesso!");
} catch (IOException e) {
System.out.println("Save não encontrado!");
try {
iniciar();
} catch (IOException ex) {
@@ -826,13 +777,9 @@ public class Experientia {
}
}
}
public void carregarInventarioAdmin() {
itensCount = 0;
for (int i = 0; i < 10; i++) {
adicionarItem(new Item(
"Espada Admin " + i,
"arma",
@@ -840,7 +787,6 @@ public class Experientia {
0,
"ADMIN"
));
adicionarItem(new Item(
"Armadura Admin " + i,
"armadura",
@@ -848,7 +794,6 @@ public class Experientia {
0,
"ADMIN"
));
adicionarItem(new Item(
"Poção Admin " + i,
"consumivel",
@@ -857,13 +802,10 @@ public class Experientia {
"ADMIN"
));
}
adicionarItem(new Item("Excalibur", "arma", 500, 0, "ÚNICO"));
adicionarItem(new Item("Armadura Divina", "armadura", 500, 0, "ÚNICO"));
}
public void login() {
System.out.println("===== LOGIN =====");
System.out.println("1-Novo jogador");
System.out.println("2-Carregar jogo");