Guest User

Untitled

a guest
Jan 15th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 20.21 KB | None | 0 0
  1. using System;
  2. interface Herbergi
  3. {
  4.     Herbergi Run();
  5. }
  6. class Hallway : Herbergi
  7. {
  8.     public Herbergi Run()
  9.     {
  10.         Console.Clear();
  11.         while (true)
  12.         {
  13.             Console.WriteLine("You are at the hallway. What do you want to do?");
  14.             Console.Write("Command: ");
  15.             string command = Console.ReadLine().ToLower();
  16.             if (command == "go south")
  17.                 return new Gatehouse();
  18.             else if (command == "look")
  19.                 Console.WriteLine("To the south is the Gatehouse, to the north is a hall.");
  20.             else if (command == "go north")
  21.                 return new Gateroom();
  22.             else
  23.                 Console.WriteLine("Command not found.");
  24.         }
  25.     }
  26. }
  27. class ManTalk : Herbergi
  28. {
  29.     public static bool talk = false;
  30.     public Herbergi Run()
  31.     {
  32.         Console.Clear();
  33.         while (true)
  34.         {
  35.             if (talk == false)
  36.             {
  37.                 Console.WriteLine("\nMan: What do you want?\n");
  38.                 Console.WriteLine("1. I want to pass here.\n2. Nothing");
  39.                 Console.Write("Option: ");
  40.                 string option = Console.ReadLine().ToLower();
  41.                 if (option == "1")
  42.                 {
  43.                     while (true)
  44.                     {
  45.                         Console.WriteLine("\nYou: I want to pass here.\n");
  46.                         Console.WriteLine("Man: Why should I let you pass here?\n");
  47.                         Console.WriteLine("1. Nevermind, I'll just leave.\n2. I have orders from the mayor to pass here.\n3. Because someone as weak as you should not stand in my way!");
  48.                         Console.Write("Option: ");
  49.                         string option2 = Console.ReadLine().ToLower();
  50.                         if (option2 == "1")
  51.                         {
  52.                             Console.WriteLine("\nYou: Nevermind, I'll just leave.\n");
  53.                             Console.ReadKey(true);
  54.                             return new Gateroom();
  55.                         }
  56.                         else if (option2 == "2")
  57.                         {
  58.                             Console.WriteLine("\nYou: I have orders from the mayor to pass here.\n");
  59.                             Console.WriteLine("Man: Don't lie to me, you bandit!\n");
  60.                             Console.WriteLine("The man takes a sword hidden on him and stabs you in the chest.\nYou bleed out on the floor and die.");
  61.                             Console.ReadKey(true);
  62.                             return null;
  63.                         }
  64.                         else if (option2 == "3")
  65.                         {
  66.                             Console.WriteLine("\nYou: Because someone as weak as you should not stand in my way!\n");
  67.                             Console.WriteLine("");
  68.                             Console.ReadKey(true);
  69.                             return null;
  70.                         }
  71.                         else
  72.                             Console.WriteLine("Option not valid");
  73.                     }
  74.                 }
  75.                 else if (option == "2")
  76.                 {
  77.                     Console.WriteLine("\nYou: Nothing\n");
  78.                     Console.ReadKey(true);
  79.                     return new Gateroom();
  80.                 }
  81.                 else
  82.                     Console.WriteLine("Option not valid");
  83.             }
  84.             else
  85.             {
  86.                 Console.WriteLine("Man: Please pass through.");
  87.                 Console.ReadKey(true);
  88.                 return new Gateroom();
  89.             }
  90.         }
  91.     }
  92. }
  93. class Start : Herbergi
  94. {
  95.     public Herbergi Run()
  96.     {
  97.         Console.Clear();
  98.         Console.WriteLine("You wake up in a jail. You don't remember what happened.");
  99.         Console.ReadKey();
  100.         return new Jail();
  101.     }
  102. }
  103. class JailCell : Herbergi
  104. {
  105.     public static bool Key = false;
  106.     public Herbergi Run()
  107.     {
  108.         Console.Clear();
  109.         while (true)
  110.         {
  111.             Console.WriteLine("You are in a jail cell, what do you want to do.");
  112.             Console.Write("Command: ");
  113.             string command = Console.ReadLine().ToLower();
  114.            
  115.             if (command == "look")
  116.             {
  117.                 if (Key == false)
  118.                     Console.WriteLine("You are in a cell, the cell is locked.\nYou see something glitter in the drain.");
  119.                 else
  120.                     Console.WriteLine("You are in a cell, the cell is locked.");
  121.             }
  122.             else if (command == "search drain")
  123.             {
  124.                 if (Key == false)
  125.                 {
  126.                     Console.WriteLine("You find a key in the drain, you pick it up.");
  127.                     Key = true;
  128.                 }
  129.                 else
  130.                     Console.WriteLine("There is nothing more in the drain.");
  131.             }
  132.             else if (command == "open cell")
  133.             {
  134.                 if (Key == false)
  135.                     Console.WriteLine("You cannot open the cell, the cell door is locked.");
  136.                 else
  137.                 {
  138.                     Console.WriteLine("You open the cell door with the key");
  139.                     Console.ReadKey();
  140.                     return new Jail();
  141.                 }
  142.             }
  143.                
  144.            
  145.         }
  146.     }
  147. }
  148.  
  149. class Jail : Herbergi
  150. {
  151.     public Herbergi Run()
  152.     {
  153.         Console.Clear();
  154.         while (true)
  155.         {
  156.             Console.WriteLine("You are outside your cell. What do you want to do");
  157.             Console.WriteLine("Command: ");
  158.             string command = Console.ReadLine().ToLower();
  159.  
  160.             if (command == "look")
  161.                 Console.WriteLine("You seem to be in a dungeon, your cell is behind you.\nThere are stairs leading up");
  162.             else if (command == "go to cell")
  163.                 Console.WriteLine("\nYou: I don't want to go back in there.\n");
  164.             else if (command == "go up")
  165.  
  166.         }
  167.     }
  168. }
  169.  
  170. class Gateroom : Herbergi
  171. {
  172.     public Herbergi Run()
  173.     {
  174.         Console.Clear();
  175.         while (true)
  176.         {
  177.             Console.WriteLine("You are in a large hall. What do you want to do?");
  178.             Console.Write("Command: ");
  179.             string command = Console.ReadLine().ToLower();
  180.             if (command == "go south")
  181.                 return new Hallway();
  182.             else if (command == "look")
  183.                 Console.WriteLine("\nTo the south is the hallway, there is a man standing near stairs leading down.\n");
  184.             else if (command == "talk to man")
  185.                 return new ManTalk();
  186.             else if (command == "go down")
  187.             {
  188.                 if (ManTalk.talk == true)
  189.                     return null;
  190.                 else
  191.                     Console.WriteLine("The man is standing in the way.");
  192.             }
  193.             else
  194.                 Console.WriteLine("Command not found.");
  195.         }
  196.     }
  197. }
  198. class Gate2nd : Herbergi
  199. {
  200.     public static bool leaver = false;
  201.     public Herbergi Run()
  202.     {
  203.         Console.Clear();
  204.         while (true)
  205.         {
  206.             Console.WriteLine("You are on the 2nd floor in the Gatehouse. What do you want to do");
  207.             Console.Write("Command: ");
  208.             string command = Console.ReadLine().ToLower();
  209.             if (command == "go down")
  210.                 return new Gatehouse();
  211.             else if (command == "pull leaver")
  212.             {
  213.                 if (leaver == false)
  214.                 {
  215.                     Console.WriteLine("You hear the gate opening.");
  216.                     leaver = true;
  217.                 }
  218.                 else
  219.                     Console.WriteLine("You have already pulled the leaver");
  220.             }
  221.             else if (command == "push leaver")
  222.             {
  223.                 if (leaver == true)
  224.                 {
  225.                     Console.WriteLine("You hear the gate closing.");
  226.                     leaver = false;
  227.                 }
  228.                 else
  229.                     Console.WriteLine("You have already pushed the leaver");
  230.             }
  231.             else if (command == "look")
  232.                 Console.WriteLine("\nThere is a leaver on the wall, there are stairs leading down.\n");
  233.             else
  234.                 Console.WriteLine("Command not found.");
  235.         }
  236.     }
  237. }
  238. class Gatehouse : Herbergi
  239. {
  240.     public Herbergi Run()
  241.     {
  242.         Console.Clear();
  243.         while (true)
  244.         {
  245.             Console.WriteLine("You are at the first floor of the gatehouse. What do you want to do?");
  246.             Console.Write("Command: ");
  247.             string command = Console.ReadLine().ToLower();
  248.             if (command == "go north")
  249.             {
  250.                 return new Hallway();
  251.             }
  252.             else if (command == "look")
  253.                 Console.WriteLine("\nTo the north is a hallway, there is an exit to the south but the gate is closed, there are stairs leading up.\n");
  254.             else if (command == "go up")
  255.                 return new Gate2nd();
  256.             else if (command == "go south")
  257.             {
  258.                 if (Gate2nd.leaver == false)
  259.                     Console.WriteLine("The gate is closed.");
  260.                 else
  261.                     return null;
  262.             }
  263.             else
  264.                 Console.WriteLine("Command not found.");
  265.         }
  266.     }
  267. }
  268. /*class outside : Herbergi
  269. {
  270.     public Herbergi Run()
  271.     {
  272.         Console.Clear();
  273.         while (true)
  274.         {
  275.                         Console.WriteLine("You are outside of the gatehouse. what do you do?");
  276.                         Console.Write("Command: ");
  277.                         string command = Console.ReadLine() .ToLower();
  278.                         if(command == "look")
  279.                         {
  280.                                 Console.WriteLine("the gatehouse is to the north. \nThere are three houses infront of the gatehouse.\nThere is a wall around everything and you see a gate on the wall");
  281.                         }
  282.                         else if(command == "go north")
  283.                         {
  284.                                 return new Gatehouse();
  285.                         }
  286.                         else if(command == "hint")
  287.                         {
  288.                                 Console.WriteLine("you can use 'go to house1'...house2...house3...gate");
  289.                         }
  290.                         else if(command == "go to house1")
  291.                         {
  292.                                 return new house1();
  293.                         }
  294.                         else if(command == "go to house2")
  295.                         {
  296.                                 return new house2();
  297.                         }
  298.                         else if(command == "go to house3")
  299.                         {
  300.                                 return new house3();
  301.                         }
  302.                        
  303.                         else if(command == "go to gate")
  304.                         {
  305.                                 return new gate();
  306.                         }
  307.                 }
  308.         }
  309. }
  310. class gate : Herbergi
  311. {
  312.         public Herbergi Run()
  313.         {
  314.                 Console.Clear();
  315.                 while (true)
  316.                 {
  317.                         Console.WriteLine("You are at the wall. what do you do?");
  318.                         Console.Write("Command: ");
  319.                         string command = Console.ReadLine() .ToLower();
  320.                         if(command == "look")
  321.                         {
  322.                                 Console.WriteLine("you see a gate on the wall \nyou see the three houses and the gatehouse");
  323.                         }
  324.                         else if(command == "go to gatehouse")
  325.                         {
  326.                                 return new outside();
  327.                         }
  328.                         else if(command == "go to house1")
  329.                         {
  330.                                 return new house1();
  331.                         }
  332.                         else if(command == "go to house2")
  333.                         {
  334.                                 return new house2();
  335.                         }
  336.                         else if(command == "go to house3")
  337.                         {
  338.                                 return new house3();
  339.                         }
  340.                         else if (command == "talk to man")
  341.                                                         return new ManTalk2();
  342.                                                 else if (command == "open gate")
  343.                                                         {
  344.                                                                 if (ManTalk2.talk == true)
  345.                                                                         return null;
  346.                                                                 else
  347.                                                                         Console.WriteLine("The man is standing in the way.");
  348.                                                         }
  349.                 }
  350.         }
  351. }
  352. class GuardTalk : Herbergi
  353. {
  354.     public static bool Talk = false;
  355.     public Herbergi Run()
  356.     {
  357.         Console.Clear();
  358.         while (true)
  359.         {
  360.             if (Talk == false)
  361.             {
  362.                 Console.WriteLine("\nMan: What do you want?\n");
  363.                 Console.WriteLine("1. I want to pass here.\n2. Nothing");
  364.                 Console.Write("Option: ");
  365.                 string option = Console.ReadLine().ToLower();
  366.                 if (option == "1")
  367.                 {
  368.                     while (true)
  369.                     {
  370.                         Console.WriteLine("\nYou: I want to pass here.\n");
  371.                         Console.WriteLine("Man: The only way to get pass the gate is to defet me in battle");
  372.                         Console.WriteLine("1. Nevermind, I'll just leave.\n2. alright lets fight");
  373.                         Console.Write("Option: ");
  374.                         string option2 = Console.ReadLine().ToLower();
  375.                         if (option2 == "1")
  376.                         {
  377.                             Console.WriteLine("\nYou: Nevermind, I'll just leave.\n");
  378.                             Console.ReadKey(true);
  379.                             return new gate();
  380.                         }
  381.                         else if (option2 == "2")
  382.                         {
  383.                             Console.WriteLine("\nYou: I have orders from the mayor to pass here.\n");
  384.                             Console.WriteLine("Man: Ohh, I am sorry I did not know that. Please pass through.\n");
  385.                             Console.WriteLine("The man moves out of the way.");
  386.                             Talk = true;
  387.                             Console.ReadKey(true);
  388.                             return new Gateroom();
  389.                         }
  390.                         else
  391.                             Console.WriteLine("Option not valid");
  392.                     }
  393.                 }
  394.                 else if (option == "2")
  395.                 {
  396.                     Console.WriteLine("\nYou: Nothing\n");
  397.                     Console.ReadKey(true);
  398.                     return new Gateroom();
  399.                 }
  400.                 else
  401.                     Console.WriteLine("Option not valid");
  402.             }
  403.             else
  404.             {
  405.                 Console.WriteLine("Man: Please pass through.");
  406.                 Console.ReadKey(true);
  407.                 return new Gateroom();
  408.             }
  409.         }
  410.     }
  411. }
  412. class House1 : Herbergi
  413. {
  414.     public Herbergi Run()
  415.     {
  416.         Console.Clear();
  417.         while (true)
  418.         {
  419.             Console.WriteLine("You enter an empty house.");
  420.             Console.Write("Command: ");
  421.             string command = Console.ReadLine().ToLower();
  422.             if (command == "go out")
  423.             {
  424.                 return new Gatehouse();
  425.             }
  426.             else
  427.                 Console.WriteLine("Command not found.");
  428.         }
  429.     }
  430. }
  431. class House2 : Herbergi
  432. {
  433.     public Herbergi Run()
  434.     {
  435.         Console.Clear();
  436.         while (true)
  437.         {
  438.             Console.WriteLine("You enter a dark house. What do you want to do?.");
  439.             Console.Write("Command: ");
  440.             string command = Console.ReadLine().ToLower();
  441.             if (Door.torch == true)
  442.             {
  443.                 while(true)
  444.                 {
  445.                     if (command == "look")
  446.                         Console.WriteLine("You can't see anything, but you can use your torch");
  447.                    
  448.                     else if (command == "use torch")
  449.                     {
  450.                         Console.WriteLine("You take up the torch and light up the house.")
  451.                         Console.ReadKey(true);
  452.                         Console.Clear();
  453.                         while (true)
  454.                         {
  455.                             Console.WriteLine("You are in a room. What do you want to do.");
  456.                             Console.Write("Command: ");
  457.                             string command = Console.ReadLine().ToLower();
  458.                             if  (command == "look")
  459.                             {
  460.                                 Console.WriteLine("You see a key on a table across the room.");
  461.                             }
  462.                             else if (command == "pick up key")
  463.                    
  464.                 }
  465.             }
  466.             else if (command == "look")
  467.                 Console.WriteLine("You can't see anything.");
  468.             else
  469.                 Console.WriteLine("Command not found.");
  470.         }
  471.     }
  472. }
  473. class House3 : Herbergi
  474. {
  475.     public Herbergi Run()
  476.     {
  477.         Console.Clear();
  478.         while (true)
  479.         {
  480.             Console.WriteLine("You enter a house and see stairs to the right. What do you want to do?");
  481.             Console.Write("Command: ");
  482.             string command = Console.ReadLine().ToLower();
  483.             if (command == "go right")
  484.             {
  485.                 return new Upstairs();
  486.             }
  487.             else if (command == "go out")
  488.             {
  489.                 return new Gatehouse();
  490.             }
  491.             else
  492.                 Console.WriteLine("Command not found.");
  493.         }
  494.     }
  495. }
  496. class Upstairs : Herbergi
  497. {
  498.     public Herbergi Run()
  499.     {
  500.         Console.Clear();
  501.         while (true)
  502.         {
  503.             Console.WriteLine("You are upstairs. What do you want to do?");
  504.             Console.Write("Command: ");
  505.             string command = Console.ReadLine().ToLower();
  506.             if (command == "open door")
  507.             {
  508.                 return new Door();
  509.             }
  510.             else if (command == "go down");
  511.             {
  512.                 return new House3();
  513.             }
  514.             else if (command == "look");
  515.             {
  516.                 Console.WriteLine("you see a door infront of you. \nThe stairs are behind you");
  517.             }
  518.             else
  519.                 Console.WriteLine("Command not found.");
  520.         }
  521.     }
  522. }
  523. class Door : Herbergi
  524. {
  525.     public static bool torch = false;
  526.     public Herbergi Run()
  527.     {
  528.         Console.Clear();
  529.         while (true)
  530.         {
  531.             Console.WriteLine("You open the door and come into a room.");
  532.             Console.Write("Command: ");
  533.             string command = Console.ReadLine().ToLower();
  534.             if (command == "go out")
  535.             {
  536.                 return new Upstairs();
  537.             }
  538.             else if (command == "look");
  539.             }
  540.                 Console.WriteLine("The only thing in the room is a table and on the table is a torch");
  541.             }
  542.             else if (command == "pick up torch");
  543.             {
  544.                 if (torch == false)
  545.                 {
  546.                     Console.WriteLine("you pick up the torch");
  547.                     torch = true;
  548.                 }
  549.                 else
  550.                     Console.WriteLine("you already have the torch.")
  551.             }
  552.            
  553.             else
  554.                 Console.WriteLine("Command not found.");
  555.         }
  556.     }
  557. }*/
  558. class leikur
  559. {
  560.     static void Main()
  561.     {
  562.         Herbergi nextRoom = new Gatehouse();
  563.         while (nextRoom != null)
  564.         {
  565.             nextRoom = nextRoom.Run();
  566.         }
  567.     }
  568. }
Add Comment
Please, Sign In to add comment