Assignemnt #45 Choose Your Own Adventure
Code
///Tyler Hart
///period 5
///Choose Your Own Adventure
///adventure.java
///10/15/2015
import java.util.Scanner;
public class adventure
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
String ans1,ans2,ans3,ans4;
System.out.println( "So, you are in a 20 by 20 room, there is a \"door\" and a \"bed\" that do you want to go to?" );
ans1 = keyboard.next();
if (ans1.equals("door"))
{
System.out.println("do you want to \"inspect\" the door or \"kick\" it down?");
ans2 = keyboard.next();
if (ans2.equals("kick"))
{
System.out.println("You kick down the door and get a splinter you may try to \"pull\" out the splinter or \"run\" away.");
ans3 = keyboard.next();
if (ans3.equals("run"))
{
System.out.println("Though the door you are found by a group of guards.");
System.out.println("You have lost the game.");
}
else if (ans3.equals("pull"))
{
System.out.println("You fail at pulling out the splinter.");
System.out.println("You now have a splinter in your leg.");
System.out.println("for the rest of your years.");
System.out.println("You have lost the game.");
}
else
{
System.out.println("That is not an Option");
}
}
else if (ans2.equals("inspect"))
{
System.out.println("The door is unlocked do you want to \"open\" or \"call\" your pet owl?");
ans3 = keyboard.next();
if (ans3.equals("call"))
{
System.out.println("Your pet owl calls back from the other side of the door you can tell it to \"attack\" or \"come\" to you.");
ans4 = keyboard.next();
if (ans4.equals("attack"))
{
System.out.println("Your pet owl attack you because you're the only target.");
System.out.println("You have lost the game.");
}
else if (ans4.equals("come"))
{
System.out.println("An owlbear walks though the door.");
System.out.println("You're owl was really an owlbear the hole time.");
System.out.println("You have lost the game.");
}
else
{
System.out.println("That is not an Option");
}
}
else if (ans3.equals("open"))
{
System.out.println("The guard on the other side starts telling you that.");
System.out.println("\"Your army was defeated and");
System.out.println("You have lost the game.\"");
}
else
{
System.out.println("That is not an Option");
}
}
else
{
System.out.println("please restart");
}
}
else if (ans1.equals("bed"))
{
System.out.println("you may \"sleep\" or \"lay\" down");
ans2 = keyboard.next();
if (ans2.equals("sleep"))
{
System.out.println("you wake up having all of your spell slots back, you may get \"up\" or go back to \"sleep\"");
ans3 = keyboard.next();
if (ans3.equals("sleep"))
{
System.out.println("You gain the Trait slothful");
System.out.println("You have lost the game.");
}
else if (ans3.equals("up"))
{
System.out.println("A pack of wondering jagurs enter the room ");
System.out.println("the jagurs do not speak common and attack you");
System.out.println("You cast magic missle hiting a jagur");
System.out.println("but that was only one of them.");
System.out.println("You have lost the game.");
}
else
{
System.out.println("That is not an Option");
}
}
else if(ans2.equals("lay"))
{
System.out.println("You are now just wasting time.");
System.out.println("You remember that you have homework due tomorrow.");
System.out.println("do you \"hate\" your self for not doing it or \"try\" to complete it?");
ans3 = keyboard.next();
if (ans3.equals("hate"))
{
System.out.println("Hate leads to suffering, and the dark side");
System.out.println("You will become a dark lord, only without the force");
System.out.println("You have lost the game.");
}
else if (ans3.equals("try"))
{
System.out.println("You don't have to time to finish your work");
System.out.println("You get an F on the assignment");
System.out.println("You have lost the game.");
}
else
{
System.out.println("That is not an Option");
}
}
else
{
System.out.println("That is not an Option");
}
}
else
{
System.out.println("That is not an Option");
}
}
}
Picture of the output