Hello, I need some help with my if statement.
I want to create a simple text base game.
The game begin with the character reaching the top floor of a castle and encounters the final boss. The character can has two choices, fight or kneel before the boss.
Right now if i type "fight" it display the following message, "You have decided to fight"
and if i type "knee" it will display the following "You have decided to join the Bloody Mistress"
How could i add an if statement into an if statement.
So if I type "fight" it display the following message, "You have decided to fight" followed by typing "axe" to display "You used your axe, your attack was avoided");
Can someone please help me!
Here are my codes:
import java.util.Scanner;
public class TxtG
{
public static String A = "fight";
public static String B = "axe";
public static String C = "kneel";
public static void main(String[] args)
{
Scanner x = new Scanner(System.in);
System.out.println("You gave reached the 100th Floor of the Castle of Blood");
System.out.println("The Bloody Mistress awaits you at the center of the room");
System.out.println("Will you fight her?");
System.out.println("Or will you kneel before her?");
System.out.println("Choice: ");
String i = x.nextLine();
if(i.equals(A))
{
System.out.println("You have decided to fight");
if(A.equals(B))
{
System.out.println("You used your axe, your attack was avoided");
}
}
else if(i.equals(C))
{
System.out.println("You have decided to join the Bloody Mistress");
System.out.println("You will help her kill the Priestess of Hope");
}
}
}