mudanças
This commit is contained in:
@@ -10,8 +10,6 @@ import java.io.IOException;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -80,11 +78,11 @@ public class Experientia {
|
|||||||
System.out.print("Nome: ");
|
System.out.print("Nome: ");
|
||||||
nomeJogador = scanner.next();
|
nomeJogador = scanner.next();
|
||||||
|
|
||||||
if (nomeJogador.equalsIgnoreCase("admin")) {
|
if (nomeJogador.equalsIgnoreCase("Tralalero")) {
|
||||||
|
|
||||||
admin = true;
|
admin = true;
|
||||||
|
|
||||||
System.out.println("MODO ADMIN ATIVADO");
|
System.out.println("MODO SECRETO ATIVADO");
|
||||||
|
|
||||||
nivelJogador = 100;
|
nivelJogador = 100;
|
||||||
xpJogador = 0;
|
xpJogador = 0;
|
||||||
@@ -511,42 +509,30 @@ public class Experientia {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GameOver() {
|
public void GameOver() {
|
||||||
|
|
||||||
System.out.println("\nGAME OVER");
|
System.out.println("\nGAME OVER");
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
|
||||||
System.out.println("\nQueres recomeçar?");
|
System.out.println("\nQueres recomeçar?");
|
||||||
System.out.println("1-Sim");
|
System.out.println("1-Sim");
|
||||||
System.out.println("2-Não");
|
System.out.println("2-Não");
|
||||||
|
|
||||||
int op = scanner.nextInt();
|
int op = scanner.nextInt();
|
||||||
|
|
||||||
if (op == 1) {
|
if (op == 1) {
|
||||||
resetJogo();
|
resetJogo();
|
||||||
System.out.println("Recomeçaste com o personagem atual!");
|
System.out.println("Recomeçaste com o personagem atual!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op == 2) {
|
if (op == 2) {
|
||||||
System.out.println("A sair do jogo...");
|
System.out.println("A sair do jogo...");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Opção inválida");
|
System.out.println("Opção inválida");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void adicionarItem(Item i) {
|
public void adicionarItem(Item i) {
|
||||||
|
|
||||||
if (admin) {
|
if (admin) {
|
||||||
|
|
||||||
if (itensCount >= inventario.length) {
|
if (itensCount >= inventario.length) {
|
||||||
inventario = java.util.Arrays.copyOf(inventario, inventario.length + 20);
|
inventario = java.util.Arrays.copyOf(inventario, inventario.length + 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
inventario[itensCount++] = i;
|
inventario[itensCount++] = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -557,26 +543,19 @@ public class Experientia {
|
|||||||
System.out.println("Inventário cheio");
|
System.out.println("Inventário cheio");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removerItem(int i) {
|
public void removerItem(int i) {
|
||||||
|
|
||||||
if (i < 0 || i >= itensCount) {
|
if (i < 0 || i >= itensCount) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = i; j < itensCount - 1; j++) {
|
for (int j = i; j < itensCount - 1; j++) {
|
||||||
inventario[j] = inventario[j + 1];
|
inventario[j] = inventario[j + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
inventario[itensCount - 1] = null;
|
inventario[itensCount - 1] = null;
|
||||||
|
|
||||||
itensCount--;
|
itensCount--;
|
||||||
|
|
||||||
if (itensCount < 0) {
|
if (itensCount < 0) {
|
||||||
itensCount = 0;
|
itensCount = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void gerarLoja() {
|
public void gerarLoja() {
|
||||||
|
|
||||||
for (int i = 0; i < loja.length; i++) {
|
for (int i = 0; i < loja.length; i++) {
|
||||||
@@ -889,15 +868,11 @@ public class Experientia {
|
|||||||
System.out.println("1-Novo jogador");
|
System.out.println("1-Novo jogador");
|
||||||
System.out.println("2-Carregar jogo");
|
System.out.println("2-Carregar jogo");
|
||||||
System.out.println("3-Login Admin");
|
System.out.println("3-Login Admin");
|
||||||
|
|
||||||
int op = scanner.nextInt();
|
int op = scanner.nextInt();
|
||||||
|
|
||||||
if (op == 1) {
|
if (op == 1) {
|
||||||
|
|
||||||
criarPersonagem();
|
criarPersonagem();
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
} else if (op == 2) {
|
} else if (op == 2) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
carregarJogo();
|
carregarJogo();
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
@@ -907,20 +882,14 @@ public class Experientia {
|
|||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
}
|
}
|
||||||
} else if (op == 3) {
|
} else if (op == 3) {
|
||||||
|
|
||||||
System.out.print("Nome admin: ");
|
System.out.print("Nome admin: ");
|
||||||
String n = scanner.next();
|
String n = scanner.next();
|
||||||
|
|
||||||
System.out.print("Password: ");
|
System.out.print("Password: ");
|
||||||
String p = scanner.next();
|
String p = scanner.next();
|
||||||
|
|
||||||
if (n.equals("adminPro") && p.equals("adimn.epvc")) {
|
if (n.equals("adminPro") && p.equals("adimn.epvc")) {
|
||||||
|
|
||||||
admin = true;
|
admin = true;
|
||||||
loggedIn = true;
|
loggedIn = true;
|
||||||
|
|
||||||
System.out.println("ADMIN LOGIN OK");
|
System.out.println("ADMIN LOGIN OK");
|
||||||
|
|
||||||
nivelJogador = 100;
|
nivelJogador = 100;
|
||||||
ouro = 999999;
|
ouro = 999999;
|
||||||
vidaMax = 9999;
|
vidaMax = 9999;
|
||||||
@@ -928,46 +897,31 @@ public class Experientia {
|
|||||||
ataqueBase = 999;
|
ataqueBase = 999;
|
||||||
defesaBase = 999;
|
defesaBase = 999;
|
||||||
pontosStatus = 999;
|
pontosStatus = 999;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Login inválido");
|
System.out.println("Login inválido");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loginAdmin() {
|
public void loginAdmin() {
|
||||||
|
|
||||||
System.out.print("Nome admin: ");
|
System.out.print("Nome admin: ");
|
||||||
String nome = scanner.next();
|
String nome = scanner.next();
|
||||||
|
System.out.print("AdminPassword: ");
|
||||||
System.out.print("Password: ");
|
|
||||||
String pass = scanner.next();
|
String pass = scanner.next();
|
||||||
|
if (nome.equals("tuffdasilva") && pass.equals("tungtung")) {
|
||||||
if (nome.equals("admin.epvc") && pass.equals("1234")) {
|
|
||||||
|
|
||||||
admin = true;
|
admin = true;
|
||||||
|
|
||||||
System.out.println("ADMIN LOGIN OK");
|
System.out.println("ADMIN LOGIN OK");
|
||||||
|
|
||||||
nivelJogador = 100;
|
nivelJogador = 100;
|
||||||
xpJogador = 0;
|
xpJogador = 0;
|
||||||
ouro = 999999;
|
ouro = 999999;
|
||||||
|
|
||||||
vidaMax = 9999;
|
vidaMax = 9999;
|
||||||
vidaAtual = vidaMax;
|
vidaAtual = vidaMax;
|
||||||
|
|
||||||
ataqueBase = 999;
|
ataqueBase = 999;
|
||||||
defesaBase = 999;
|
defesaBase = 999;
|
||||||
|
|
||||||
bonusAtaque = 999;
|
bonusAtaque = 999;
|
||||||
bonusDefesa = 999;
|
bonusDefesa = 999;
|
||||||
|
|
||||||
pontosStatus = 999;
|
pontosStatus = 999;
|
||||||
|
|
||||||
inventario = new Item[200];
|
inventario = new Item[200];
|
||||||
|
|
||||||
carregarInventarioAdmin();
|
carregarInventarioAdmin();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
System.out.println("Login inválido");
|
System.out.println("Login inválido");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user