Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package escapegame;
- /**
- *
- * @author 136-pghanem
- */
- import java.util.Scanner;
- import java.util.Random;
- public class code {
- Scanner input = new Scanner(System.in);
- int help;
- Inventory run = new Inventory();
- public void instructions() {
- if (help == 0) {
- System.out.println(" Welcome to DEATH HOSPITAL!");
- System.out.println(" Written and coded by Peter Ghanem");
- }
- System.out.println(" COMMON COMMANDS:");
- System.out.println("'Take' : Enter this when you see an object you want to take");
- System.out.println("'Combine' : Enter this when you want to combine 2 or more items");
- System.out.println("'Use' : Enter this to use an item on the environment");
- System.out.println("'East' : Enter east, west, north or south to move to that side of the room");
- System.out.println(" Enter 'help' anytime to get these instructions again");
- help += 1;
- System.out.println("");
- System.out.println("");
- wake();
- }
- public void main() {
- String choice;
- run.displayBoard();
- int reset = 0;
- System.out.println("Looking north you see a boarded up window");
- System.out.println("To your west, you see a door");
- System.out.println("To your east, you see an old cabinet full of medicine");
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("east") || choice.contains("cabinet")) {
- eastCabinet();
- } else if (choice.contains("west") || choice.contains("door")) {
- westDoor();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void wake() {
- run.inv();
- run.displayBoard();
- String choice;
- int reset = 0;
- System.out.println("You wake up. Silence. You open your eyes to a destroyed medical room.");
- System.out.println("You remember nothing.");
- System.out.println("Looking north you see a boarded up window");
- System.out.println("To your west, you see a door");
- System.out.println("To your east, you see an old cabinet full of medicine");
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("east") || choice.contains("cabinet")) {
- eastCabinet();
- } else if (choice.contains("west") || choice.contains("door")) {
- westDoor();
- } else if (choice.contains("help") || choice.contains("instructions")) {
- instructions();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void eastCabinet() {
- String choice;
- run.displayBoard();
- int reset = 0;
- System.out.println("You walk over to the cabinet");
- System.out.println("You see one drawer half open, the rest seem to be locked");
- if (run.check(" SYRINGE ") == true) {
- System.out.println("On the ground you see a syringe filled with clear liquid");
- }
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("open") || choice.contains("drawer")) {
- eastOpenCabinet();
- } else if (choice.contains("syringe") || choice.contains("take") && (run.check(" SYRINGE ") == true)) {
- run.add(" SYRINGE ");
- main();
- } else if (choice.contains("help") || choice.contains("instructions")) {
- instructions();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else if (choice.contains("west") || choice.contains("door")) {
- westDoor();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void northDirtyWindow() {
- String choice;
- int reset = 0;
- run.displayBoard();
- System.out.println("You walk up to the large, dirty window, covered in a thick layer of grime.");
- System.out.println("It looks like it has not been cleaned in years");
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("look") || choice.contains("see")) {
- System.out.println("You try looking outside, but the dirt is too thick");
- System.out.println("Perhaps some kind of cleaner would clear it up");
- } else if (choice.contains("help") || choice.contains("instructions")) {
- instructions();
- } else if (choice.contains("open") || choice.contains("break")) {
- System.out.println("The window is locked, and too thick to be broken");
- } else if (choice.contains("west")) {
- westDoor();
- } else if (choice.contains("clean") || choice.contains("wipe")) {
- if ((run.check(" GAUZE ") == true) && (run.check(" ALCOHOL ") == true)) {
- northCleanWindow();
- } else {
- System.out.println("You try looking outside, but you can't see anything");
- System.out.println("Maybe if you had some cleaning supplies...");
- }
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void westDoor() {
- String choice;
- int reset = 0;
- run.displayBoard();
- System.out.println("You approach the old white wooden door");
- System.out.println("There are bloody handprints all along the bottom");
- if (run.check(" GAUZE ") == true) {
- System.out.println("You see some gauze and rubbing alcohol to the side");
- }
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("open")) {
- System.out.println("The door is locked");
- } else if (choice.contains("take") || choice.contains("alcohol") || choice.contains("gauze") && (run.check(" GAUZE ") == true)) {
- run.add(" GAUZE ");
- run.add(" ALCOHOL ");
- main();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else if (choice.contains("help") || choice.contains("instructions")) {
- instructions();
- } else if (choice.contains("east") || choice.contains("cabinet")) {
- eastCabinet();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void northCleanWindow() {
- String choice;
- int reset = 0;
- run.remove(" ALCOHOL ");
- run.remove(" GAUZE ");
- run.displayBoard();
- System.out.println("You clean the window using the alcohol and gauze");
- System.out.println("Good as new!");
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("east") || choice.contains("cabinet")) {
- eastCabinet();
- } else if (choice.contains("west") || choice.contains("door")) {
- westDoor();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void eastOpenCabinet() {
- String choice;
- int reset = 0;
- System.out.println("You open the drawer");
- if (run.check("RUSTY KEY") == true) {
- System.out.println("You see a rusted key");
- }
- do {
- choice = input.nextLine();
- choice = choice.toLowerCase();
- if (choice.contains("take") || choice.contains("key") && (run.check("RUSTY KEY") == true)) {
- run.add("RUSTY KEY");
- main();
- } else if (choice.contains("north") || choice.contains("window")) {
- northDirtyWindow();
- } else if (choice.contains("combine")) {
- combine();
- } else if (choice.contains("help") || choice.contains("instructions")) {
- instructions();
- } else if (choice.contains("west") || choice.contains("door")) {
- westDoor();
- } else {
- System.out.println("Invalid Entry.");
- }
- } while (reset != 1);
- }
- public void combine() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement