Scanner reader = new Scanner(System.in);
String continue;
do {
if (eHealth > 0 && pHealth > 0) {
if (ranAway != true && stuck = true){
stuck = false;
System.out.println("You are now stuck with the monster forever. Good job.\n"
+ "Would you like to fight again?\n");
continue = reader.nextLine();
if ("Yes".equals(continue) || "yes".equals(continue)){
pHealth = 1500;
assignHealth();
Fight();
}else if ("No".equals(continue) || "no".equals(continue)) {
System.exit(0);
}
}else if (ranAway = true && stuck != true) {
ranAway = false;
System.out.println("You ran away from your problems like the coward you are.\n"
+ "Do you want to fight again\n");
continue = reader.nextLine();
if ("Yes".equals(continue) || "yes".equals(continue)){
pHealth = 1500;
assignHealth();
Fight();
}else if ("No".equals(continue) || "no".equals(continue)) {
System.exit(0);
}
}else {
Fight();
}
}else if (eHealth > 0 && pHealth <= 0){
System.out.println("Oh noes. You got de_stroyed by the monster! What a shame.\n"
+ "Would you like to fight again?\n");
continue = reader.nextLine();
if ("Yes".equals(continue) || "yes".equals(continue)){
pHealth = 1500;
assignHealth();
Fight();
}else if ("No".equals(continue) || "no".equals(continue)) {
System.exit(0);
}
}else if (eHealth <= 0 && pHealth > 0){
System.out.println("Congrats! You killed the troll!\n"
+ "Would you like to play again?\n");
continue = reader.nextLine();
if ("Yes".equals(continue) || "yes".equals(continue)){
pHealth = 1500;
assignHealth();
Fight();
}else if ("No".equals(continue) || "no".equals(continue)) {
System.exit(0);
}
}
}
This is the section throwing errors. The context is just a small fight against a troll. The option to restart is given. Some items will activate the booleans you end up seeing. The main lines that seem to be giving errors are the IF statements as well as the String continue;. How can I solve this?