Professional Documents
Culture Documents
*;
import javax.swing.JFrame;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
if(choice.equals("sonic")) {
sonic=adventureGame.sonic(name);
if (sonic) {
exitloop=false;
System.out.println("You have completed a level!");
System.out.println("Choose one of the remaining paths by typing in:");
System.out.println("knight, or thor. ");
String b = sc.nextLine();
b.toLowerCase();
if (b.equals("knight")) {
knight=adventureGame.knight(name);
if (knight) {
System.out.println("You have completed a level!");
System.out.println("Complete the last path: thor");
thor=adventureGame.thor(name);
if (thor)
System.out.print("Congratulations! You completed all three paths!");
}
} else {
thor=adventureGame.thor(name);
if (thor) {
System.out.println("You have completed a level!");
System.out.println("Complete the last path: knight");
knight=adventureGame.knight(name);
if (knight)
System.out.print("Congratulations! You completed all three paths!");
}
}
}
}
if(choice.equals("thor")) {
thor=adventureGame.thor(name);
if (thor) {
exitloop=false;
System.out.println("You have completed a level!");
System.out.println("Choose one of the remaining paths by typing in:");
System.out.println("knight, or sonic. ");
String c = sc.nextLine();
c.toLowerCase();
if (c.equals("knight")) {
knight=adventureGame.knight(name);
if (knight) {
System.out.println("You have completed a level!");
System.out.println("Complete the last path: sonic");
sonic=adventureGame.sonic(name);
if (sonic)
System.out.print("Congratulations! You completed all three paths!");
}
} else {
sonic=adventureGame.sonic(name);
if (sonic) {
System.out.println("You have completed a level!");
System.out.println("Complete the last path: knight");
knight=adventureGame.knight(name);
if (knight)
System.out.print("Congratulations! You completed all three paths!");
}
}
}
}
}
public static boolean knight (String name) {
Scanner sc = new Scanner (System.in);
Scanner sc1 = new Scanner (System.in);
System.out.println("Today you are the gallant knight named Sir Anthony III.");
System.out.println("");
System.out.println("Please make sure to answer questions as directed; if the question in a yes or no question enter yes or no \nIf the question asks you to decide on
two actions, enter 1 or 2, with 1 being the first action and two being the second.");
System.out.println("");
System.out.println("");
System.out.println(" You wake up in the morning of the twelfth century to the rise of a beatiful sun. "
+ "\n You look down at your body and are suprised to find it fitted in silk linens."
+ "\n Quickly you take in your surroundings. The walls are beatifully crafted and seems to be made of limestone."
+ "\n You glance out of the window and see that you are almost a hundred feet up. You realize that you are in a castle."
+ "\n Do you want to exit the room? yes/no");
JFrame frame = new JFrame();
ImageIcon icon = new ImageIcon("Pics/room.png");
JLabel label = new JLabel(icon);
frame.add(label);
frame.setDefaultCloseOperation
(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
}
System.out.println("The servant looks up cheerfully: Hello sir Anthony, how may I help you?");
System.out.println("Do you tell him your secret that you are not Sir Anthony? yes/no");
String word1 = sc.nextLine();
word1.toLowerCase();
if (word1.equals("yes")) {
System.out.println("The servant appears confused, and ignores you.");
}
System.out.println("The servant says: Well the King has requested you in the banquet hall.");
System.out.println("You continue walking forward and find yourself in the doorway to a grand banquet.");
System.out.println("A long table fitted with bronze draperies occupies the middle of the room.");
System.out.println("A man fitted in a fine robe and crown bellows:"
+ " \n Welcome Sir Anthony! we have been missing your company.");
System.out.println("Do you try to 1- sit down somewhere or 2- stay standing?");
int sit = sc.nextInt();
System.out.println("You do so and try not to speak as your voice would almost certainly betray you.");
System.out.println("You end up only saying short phrases but the King has found you out!");
System.out.println("He says: you are not Sir Anthony, but rather an imposter!");
System.out.println("Do you 1-deny the accusation or 2-accept it?");
int acc = sc.nextInt();
if (acc==1) {
System.out.println("You deny the Kings accusation but it doesn't seem to phase him.");
}
if (acc==2) {
System.out.println("The king orders for you to be imprisoned"
+ "\non charges of impersonation.");
JFrame frame2 = new JFrame();
ImageIcon icon2 = new ImageIcon("Pics/jail.png");
JLabel label2 = new JLabel(icon2);
frame2.add(label2);
frame2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame2.pack();
frame2.setVisible(true);
System.out.println("The day ends with you in prison, you have failed. Try Again.\n \n \n");
return false;
}
System.out.println("");
}else if(exit.equals("no")) {
System.out.println("Scared witless, you remain in your room for several hours \n before you hear a knock on your door."
+ "A servant calls: Sir Anthony, are you ok?"
+ "do you answer with: Yes I am fine? yes or no.");
String voice = sc.nextLine();
voice.toLowerCase();
if(voice.equals("yes")) {
System.out.println("The servant says: Good, well it's 12oclock and dinner is ready,\n the King was worried because you missed breakfast.");
} else if(voice.equals("no")) {
System.out.println("The servant says: I am so sorry, well, it's 12oclock and dinner is ready, \nthe King was worried because you missed
breakfast.");
}
System.out.println("You ponder if you should go to dinner; do you go?");
String dinner = sc.nextLine();
dinner.toLowerCase();
if(dinner.equals("yes")) {
} else if (dinner.equals("no")) {
System.out.println("An hour has passed and you have not moved: do you want to remain in locked in your room for the rest of the day?");
String room = sc.nextLine();
room.toLowerCase();
if (room.equals("yes")) {
System.out.println("You remain locked in your room until the day ends and you are no longer Sir Anthony, you have failed.Try again \n \n
\n ");
return false;
}else if (room.equals("no")) {
System.out.println("An hour has passed, do you go to dinner now?");
String hour = sc.nextLine();
hour.toLowerCase();
}
System.out.print("\"You pry open the door carefully and now you are looking down a limestone corridor about 12 feet high.\"\r\n" +
"+ \"You turn left along the corridor and find yourself over looking a beautiful courtyard lined with flowers of all kinds and highly
maintained bushes.\"\r\n" +
"+ \"You glance around and see stairs on the other side of the corridor\"\r\n" +
"+ \"Do you want to take the stairs to enter the dining hall? yes/no\"");
String stairs = sc.nextLine();
stairs.toLowerCase();
if(stairs.equals("no")) {
System.out.println("The day is nearly over, do you want to do nothing?");
String end = sc.nextLine();
end.toLowerCase();
if (end.equals("yes")) {
System.out.println("You return to your room and remain locked \nin your room until the day ends and you are no longer Sir
Anthony, you have failed.Try again \n \n \n ");
return false;
}
}
}
System.out.println("You decide to enter the dining hall on the ground floor.");
System.out.println("A long table fitted with bronze draperies occupies the middle of the room.");
return false;
}