Advertisement
Guest User

story class

a guest
Apr 18th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 9.22 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package escapegame;
  6.  
  7. /**
  8.  *
  9.  * @author 136-pghanem
  10.  */
  11. import java.util.Scanner;
  12. import java.util.Random;
  13.  
  14. public class code {
  15.  
  16.     Scanner input = new Scanner(System.in);
  17.     int help;
  18.     Inventory run = new Inventory();
  19.  
  20.     public void instructions() {
  21.         if (help == 0) {
  22.             System.out.println(" Welcome to DEATH HOSPITAL!");
  23.             System.out.println(" Written and coded by Peter Ghanem");
  24.         }
  25.         System.out.println(" COMMON COMMANDS:");
  26.         System.out.println("'Take' : Enter this when you see an object you want to take");
  27.         System.out.println("'Combine' : Enter this when you want to combine 2 or more items");
  28.         System.out.println("'Use' : Enter this to use an item on the environment");
  29.         System.out.println("'East' : Enter east, west, north or south to move to that side of the room");
  30.         System.out.println(" Enter 'help' anytime to get these instructions again");
  31.         help += 1;
  32.         System.out.println("");
  33.         System.out.println("");
  34.         wake();
  35.     }
  36.  
  37.     public void main() {
  38.         String choice;
  39.         run.displayBoard();
  40.         int reset = 0;
  41.         System.out.println("Looking north you see a boarded up window");
  42.         System.out.println("To your west, you see a door");
  43.         System.out.println("To your east, you see an old cabinet full of medicine");
  44.         do {
  45.             choice = input.nextLine();
  46.             choice = choice.toLowerCase();
  47.             if (choice.contains("east") || choice.contains("cabinet")) {
  48.                 eastCabinet();
  49.             } else if (choice.contains("west") || choice.contains("door")) {
  50.                 westDoor();
  51.             } else if (choice.contains("north") || choice.contains("window")) {
  52.                 northDirtyWindow();
  53.             } else {
  54.                 System.out.println("Invalid Entry.");
  55.             }
  56.         } while (reset != 1);
  57.     }
  58.  
  59.     public void wake() {
  60.         run.inv();
  61.         run.displayBoard();
  62.         String choice;
  63.         int reset = 0;
  64.         System.out.println("You wake up. Silence. You open your eyes to a destroyed medical room.");
  65.         System.out.println("You remember nothing.");
  66.         System.out.println("Looking north you see a boarded up window");
  67.         System.out.println("To your west, you see a door");
  68.         System.out.println("To your east, you see an old cabinet full of medicine");
  69.         do {
  70.             choice = input.nextLine();
  71.             choice = choice.toLowerCase();
  72.             if (choice.contains("east") || choice.contains("cabinet")) {
  73.  
  74.                 eastCabinet();
  75.             } else if (choice.contains("west") || choice.contains("door")) {
  76.                 westDoor();
  77.             } else if (choice.contains("help") || choice.contains("instructions")) {
  78.                 instructions();
  79.             } else if (choice.contains("north") || choice.contains("window")) {
  80.                 northDirtyWindow();
  81.             } else {
  82.                 System.out.println("Invalid Entry.");
  83.             }
  84.         } while (reset != 1);
  85.     }
  86.  
  87.     public void eastCabinet() {
  88.         String choice;
  89.         run.displayBoard();
  90.         int reset = 0;
  91.         System.out.println("You walk over to the cabinet");
  92.         System.out.println("You see one drawer half open, the rest seem to be locked");
  93.         if (run.check(" SYRINGE ") == true) {
  94.             System.out.println("On the ground you see a syringe filled with clear liquid");
  95.         }
  96.         do {
  97.             choice = input.nextLine();
  98.             choice = choice.toLowerCase();
  99.             if (choice.contains("open") || choice.contains("drawer")) {
  100.                 eastOpenCabinet();
  101.             } else if (choice.contains("syringe") || choice.contains("take") && (run.check(" SYRINGE ") == true)) {
  102.                 run.add(" SYRINGE ");
  103.                 main();
  104.             } else if (choice.contains("help") || choice.contains("instructions")) {
  105.                 instructions();
  106.             } else if (choice.contains("north") || choice.contains("window")) {
  107.                 northDirtyWindow();
  108.             } else if (choice.contains("west") || choice.contains("door")) {
  109.                 westDoor();
  110.             } else {
  111.                 System.out.println("Invalid Entry.");
  112.             }
  113.         } while (reset != 1);
  114.     }
  115.  
  116.     public void northDirtyWindow() {
  117.         String choice;
  118.         int reset = 0;
  119.         run.displayBoard();
  120.         System.out.println("You walk up to the large, dirty window, covered in a thick layer of grime.");
  121.         System.out.println("It looks like it has not been cleaned in years");
  122.         do {
  123.             choice = input.nextLine();
  124.             choice = choice.toLowerCase();
  125.  
  126.             if (choice.contains("look") || choice.contains("see")) {
  127.                 System.out.println("You try looking outside, but the dirt is too thick");
  128.                 System.out.println("Perhaps some kind of cleaner would clear it up");
  129.             } else if (choice.contains("help") || choice.contains("instructions")) {
  130.                 instructions();
  131.             } else if (choice.contains("open") || choice.contains("break")) {
  132.                 System.out.println("The window is locked, and too thick to be broken");
  133.             } else if (choice.contains("west")) {
  134.                 westDoor();
  135.             } else if (choice.contains("clean") || choice.contains("wipe")) {
  136.                 if ((run.check("  GAUZE  ") == true) && (run.check(" ALCOHOL ") == true)) {
  137.                     northCleanWindow();
  138.                 } else {
  139.                     System.out.println("You try looking outside, but you can't see anything");
  140.                     System.out.println("Maybe if you had some cleaning supplies...");
  141.  
  142.                 }
  143.             } else {
  144.                 System.out.println("Invalid Entry.");
  145.             }
  146.         } while (reset != 1);
  147.  
  148.  
  149.     }
  150.  
  151.     public void westDoor() {
  152.         String choice;
  153.         int reset = 0;
  154.         run.displayBoard();
  155.         System.out.println("You approach the old white wooden door");
  156.         System.out.println("There are bloody handprints all along the bottom");
  157.         if (run.check("  GAUZE  ") == true) {
  158.             System.out.println("You see some gauze and rubbing alcohol to the side");
  159.         }
  160.         do {
  161.             choice = input.nextLine();
  162.             choice = choice.toLowerCase();
  163.             if (choice.contains("open")) {
  164.                 System.out.println("The door is locked");
  165.             } else if (choice.contains("take") || choice.contains("alcohol") || choice.contains("gauze") && (run.check("  GAUZE  ") == true)) {
  166.                 run.add("  GAUZE  ");
  167.                 run.add(" ALCOHOL ");
  168.                 main();
  169.             } else if (choice.contains("north") || choice.contains("window")) {
  170.                 northDirtyWindow();
  171.             } else if (choice.contains("help") || choice.contains("instructions")) {
  172.                 instructions();
  173.             } else if (choice.contains("east") || choice.contains("cabinet")) {
  174.                 eastCabinet();
  175.             } else {
  176.                 System.out.println("Invalid Entry.");
  177.             }
  178.         } while (reset != 1);
  179.     }
  180.  
  181.     public void northCleanWindow() {
  182.         String choice;
  183.         int reset = 0;
  184.         run.remove(" ALCOHOL ");
  185.         run.remove("  GAUZE  ");
  186.         run.displayBoard();
  187.         System.out.println("You clean the window using the alcohol and gauze");
  188.         System.out.println("Good as new!");
  189.         do {
  190.             choice = input.nextLine();
  191.             choice = choice.toLowerCase();
  192.             if (choice.contains("east") || choice.contains("cabinet")) {
  193.                 eastCabinet();
  194.             } else if (choice.contains("west") || choice.contains("door")) {
  195.                 westDoor();
  196.             } else if (choice.contains("north") || choice.contains("window")) {
  197.                 northDirtyWindow();
  198.             } else {
  199.                 System.out.println("Invalid Entry.");
  200.             }
  201.  
  202.  
  203.         } while (reset != 1);
  204.     }
  205.  
  206.     public void eastOpenCabinet() {
  207.         String choice;
  208.         int reset = 0;
  209.         System.out.println("You open the drawer");
  210.         if (run.check("RUSTY KEY") == true) {
  211.             System.out.println("You see a rusted key");
  212.         }
  213.         do {
  214.             choice = input.nextLine();
  215.             choice = choice.toLowerCase();
  216.             if (choice.contains("take") || choice.contains("key") && (run.check("RUSTY KEY") == true)) {
  217.                 run.add("RUSTY KEY");
  218.                 main();
  219.             } else if (choice.contains("north") || choice.contains("window")) {
  220.                 northDirtyWindow();
  221.             } else if (choice.contains("combine")) {
  222.                 combine();
  223.             } else if (choice.contains("help") || choice.contains("instructions")) {
  224.                 instructions();
  225.             } else if (choice.contains("west") || choice.contains("door")) {
  226.                 westDoor();
  227.             } else {
  228.                 System.out.println("Invalid Entry.");
  229.             }
  230.         } while (reset != 1);
  231.  
  232.     }
  233.  
  234.     public void combine() {
  235.     }
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement