Advertisement
Bradmasta

Main Floor

Nov 9th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.20 KB | None | 0 0
  1. import java.util.*;
  2. public class TxtAdventGameMainFloor {
  3. String roomName[] = {"MainHall", "North Corridor", "East Corridor", "West Corridor", "Basement Main", "Eastern Room"
  4. ,"North-Eastern Room", "North-West Hall", "North-West Northern Room", "North-West Western Room", "North-West Southern Room"
  5. , "West Northern Room", "West Southern Room", "Upstairs Main", "Basement East Hall", "Basement East South",
  6. "Basement East South South Room ", "Basement West Hall", "Basement West-North Hall", "Basement West-West-North Hall", "Basement West Hall Dead End",
  7. "Basement East East Hall", "Basement East East South Hall", "Basement East East South East Hall", "Basement Far East Room", "Basement Far East North Room",
  8. "Basement Far East South Room", "Basement North East Room", "Basement Far North Room", "29", "30",
  9. "31", "32", "33", "34", "35",
  10. "36", "37"};
  11. int whereToGo[][] =
  12. {{1, 0, 2, 3, 0, 0, 0}, {1, 0, 6, 7, 1, 1, 1}, {2, 2, 5, 0, 2, 4, 2}, {11, 12, 0, 3, 13, 3, 3}, {4, 4, 14, 17, 2, 4, 4},
  13. {5, 5, 5, 5, 2, 5, 5}, {6, 6, 6, 1, 6, 6, 6}, {8, 10, 1, 9, 7, 7, 7}, {8, 7, 8, 8, 8, 8, 8}, {9, 9, 7, 9, 9, 9, 9},
  14. {7, 10, 10, 10, 10, 10, 10}, {-1, 3, -1, -1, -1, -1, 11}, {3, -1, -1, -1, -1, -1, 12}, {29, -1, -1, -1, -1, 3, 13}, {-1, 15, -1, 4, -1, -1, 14},
  15. {14, 16, -1, -1, -1, -1, 15}, {15, -1, -1, -1, -1, -1, 16}, {18, -1, 4, -1, -1, -1, 17}, {-1, 17, 21, 19, -1, -1, 18},
  16. {-1, 20, 18, -1, -1, -1, 19}, {19, -1, -1, -1, -1, -1, 20}, {27, 22, -1, 18, -1, -1, 21}, {21, -1, 23, -1, -1, -1, 22},
  17. {-1, -1, 24, 22, -1, -1, 23}, {25, 26, -1, 23, -1, -1, 24}, {-1, 24, -1, -1, -1, -1, 25}, {24, -1, -1, -1, -1, -1, 26},
  18. {28, 21, -1, -1, -1, -1, 27}, {-1, 27, -1, -1, -1, -1, 28}, {36, 13, 33, 30, -1, -1, 29}, {31, 32, 29, -1, -1, -1, 30},
  19. {-1, 30, -1, -1, -1, -1, 31}, {30, -1, -1, -1, -1, -1, 32}, {34, 34, -1, 29, -1, -1, 33}, {-1, 33, -1, -1, -1, -1, 34},
  20. {33, -1, -1, -1, -1, -1, 35}, {37, 29, -1, -1, -1, -1, 36}, {-1, -1, -1, -1, -1, -1, 37}};
  21. String[] directions = {"North", "South", "East", "West", "Up", "Down"};
  22.  
  23.  
  24.  
  25. int room = whereToGo[0][6];
  26. int myStats[] = {50, 7, 5, 7};
  27. int invo[] = {2, 0, 0 , 0, 0, 0, 0};
  28. int flags[] = {0, 0, 0, 0, 0, 0, 0, 0};
  29.  
  30. TxtAdventUserInput newScan = new TxtAdventUserInput();
  31. TxtAdventRandNum newRand = new TxtAdventRandNum();
  32.  
  33.  
  34.  
  35. public void StartGame(String input) {
  36.  
  37. int randRoom = newRand.randRoom();
  38.  
  39. switch(randRoom) {
  40.  
  41. case(1):
  42. room = whereToGo[0][6];
  43. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  44. break;
  45. case(2):
  46. room = whereToGo[1][6];
  47. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  48. break;
  49. case(3):
  50. room = whereToGo[2][6];
  51. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  52. break;
  53. default:
  54. room = whereToGo[3][6];
  55. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  56. break;
  57. }
  58.  
  59.  
  60. }
  61. public void MainHall(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  62.  
  63. room = whereToGo[0][6];
  64.  
  65. String directChoice;
  66.  
  67. System.out.println("You are in the " + roomName[0]);
  68. System.out.println(" ");
  69. System.out.println("You see: Nothing");
  70. System.out.println(" ");
  71. System.out.println("You can go the following directions: ");
  72. System.out.println(" ");
  73. System.out.println(directions[0] + ", " + directions[1] + ", " + directions[2] + ", " + directions[3]);
  74. System.out.println(" ");
  75. System.out.println("Where do you want to go/what would you like to interact with?");
  76. System.out.println(" ");
  77.  
  78. directChoice = newScan.Scanner();
  79.  
  80. directChoice = directChoice.substring(0, 1).toLowerCase();
  81.  
  82.  
  83. switch (directChoice) {
  84.  
  85. case "i":
  86. room = whereToGo[0][6];
  87. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  88. break;
  89. case "n":
  90. room = whereToGo[0][0];
  91. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  92. break;
  93.  
  94. case "s":
  95. room = whereToGo[0][0];
  96. System.out.println("The door to the outside is locked.");
  97. System.out.println(" ");
  98. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  99. break;
  100. case "e":
  101. room = whereToGo[0][2];
  102. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  103. break;
  104. case "w":
  105. room = whereToGo[0][3];
  106. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  107. break;
  108. case "u":
  109. System.out.println("You can't go " + directions[4] + "!");
  110. System.out.println(" ");
  111. room = whereToGo[0][6];
  112. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  113. break;
  114. case "d":
  115. System.out.println("You can't go " + directions[5] + "!");
  116. System.out.println(" ");
  117. room = whereToGo[0][6];
  118. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  119. break;
  120. default:
  121. System.out.println("Unrecognized input.");
  122. System.out.println(" ");
  123. room = whereToGo[0][6];
  124. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  125.  
  126. }
  127. }
  128.  
  129. public void MainFloorNCorridor(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  130. // DONE.
  131.  
  132.  
  133.  
  134. room = whereToGo[1][6];
  135.  
  136. String directChoice;
  137.  
  138. System.out.println("You are in the " + roomName[1]);
  139. System.out.println(" ");
  140. System.out.println("You see: Nothing");
  141. System.out.println(" ");
  142. System.out.println("You can go the following directions: ");
  143. System.out.println(" ");
  144. System.out.println(directions[1] + ", " + directions[2] + ", " + directions[3]);
  145. System.out.println(" ");
  146. System.out.println("Where do you want to go/what would you like to interact with?");
  147. System.out.println(" ");
  148.  
  149. directChoice = newScan.Scanner();
  150.  
  151. directChoice = directChoice.substring(0, 1).toLowerCase();
  152.  
  153. switch (directChoice) {
  154. case "i":
  155. room = whereToGo[1][6];
  156. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  157. break;
  158. case "n":
  159. System.out.println("You can't go " + directions[0] + "!");
  160. System.out.println(" ");
  161. room = whereToGo[1][6];
  162. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  163. break;
  164.  
  165. case "s":
  166. room = whereToGo[1][1];
  167. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  168. break;
  169.  
  170. case "e":
  171. room = whereToGo[1][2];
  172. MainNERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  173. break;
  174. case "w":
  175. room = whereToGo[1][3];
  176. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  177. break;
  178. case "u":
  179. System.out.println("You can't go " + directions[4] + "!");
  180. System.out.println(" ");
  181. room = whereToGo[1][6];
  182. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  183. break;
  184.  
  185. case "d":
  186. System.out.println("You can't go " + directions[5] + "!");
  187. System.out.println(" ");
  188. room = whereToGo[1][6];
  189. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  190. break;
  191.  
  192. default:
  193. System.out.println("Unrecognized input.");
  194. System.out.println(" ");
  195. room = whereToGo[1][6];
  196. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  197.  
  198. }
  199.  
  200. }
  201. public void MainFloorECorridor(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  202. // DONE.
  203.  
  204.  
  205. room = whereToGo[2][6];
  206.  
  207. String directChoice;
  208.  
  209. System.out.println("You are in the " + roomName[2]);
  210. System.out.println(" ");
  211. System.out.println("You see: A trapdoor");
  212. System.out.println(" ");
  213. System.out.println("You can go the following directions: ");
  214. System.out.println(" ");
  215. System.out.println(directions[2] + ", " + directions[3] + ", " + directions[5]);
  216. System.out.println(" ");
  217. System.out.println("Where do you want to go/what would you like to interact with?");
  218. System.out.println(" ");
  219.  
  220. directChoice = newScan.Scanner();;
  221.  
  222. directChoice = directChoice.substring(0, 1).toLowerCase();
  223.  
  224. switch (directChoice) {
  225. case "i":
  226. room = whereToGo[2][6];
  227. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  228. break;
  229. case "n":
  230. System.out.println("You can't go " + directions[0] + "!");
  231. System.out.println(" ");
  232. room = whereToGo[2][6];
  233. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  234. break;
  235. case "s":
  236. System.out.println("You can't go " + directions[1] + "!");
  237. System.out.println(" ");
  238. room = whereToGo[2][6];
  239. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  240. break;
  241. case "t":
  242. if(invo[4] == 1 && flags[2] == 0) {
  243. System.out.println("You open the trapdoor!");
  244. System.out.println(" ");
  245. flags[2] = 1;
  246. room = whereToGo[1][6];
  247. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  248. break;
  249. }
  250. else if (flags[2] == 1) {
  251. System.out.println("You already opened the trapdoor! You can go down it now!");
  252. System.out.println(" ");
  253. room = whereToGo[1][6];
  254. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  255. }
  256. else {
  257. System.out.println("You don't have the key to open this yet.");
  258. System.out.println(" ");
  259. room = whereToGo[1][6];
  260. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  261. }
  262. break;
  263. case "d":
  264. if(flags[2] == 0) {
  265. System.out.println("You haven't opened this door yet.");
  266. System.out.println(" ");
  267. room = whereToGo[2][6];
  268. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  269. }
  270. else {
  271. room = whereToGo[2][5];
  272. TxtAdventGameBasement baseFloor = new TxtAdventGameBasement();
  273. baseFloor.BasementMain(room, roomName, whereToGo, directions, myStats, invo, flags);
  274. }
  275. break;
  276.  
  277.  
  278. case "e":
  279. room = whereToGo[2][2];
  280. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  281. break;
  282. case "w":
  283. room = whereToGo[2][3];
  284. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  285. break;
  286. case "u":
  287. System.out.println("You can't go " + directions[4] + "!");
  288. System.out.println(" ");
  289. room = whereToGo[2][6];
  290. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  291. break;
  292. default:
  293. System.out.println("Unrecognized input.");
  294. System.out.println(" ");
  295. room = whereToGo[2][6];
  296. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  297.  
  298. }
  299.  
  300. }
  301. public void MainFloorWCorridor(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  302. // DONE.
  303.  
  304.  
  305. room = whereToGo[3][6];
  306.  
  307. String directChoice;
  308.  
  309. System.out.println("You are in the " + roomName[3]);
  310. System.out.println(" ");
  311. System.out.println("You see: A Locked Door");
  312. System.out.println(" ");
  313. System.out.println("You can go the following directions: ");
  314. System.out.println(" ");
  315. System.out.println(directions[0] + ", " + directions[1] + ", " + directions[2] + ", " + directions[4]);
  316. System.out.println(" ");
  317. System.out.println("Where do you want to go/what would you like to interact with?");
  318. System.out.println(" ");
  319.  
  320. directChoice = newScan.Scanner();
  321.  
  322. directChoice = directChoice.substring(0, 1).toLowerCase();
  323.  
  324. switch (directChoice) {
  325. case "i":
  326. room = whereToGo[3][6];
  327. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  328. break;
  329. case "n":
  330. room = whereToGo[3][0];
  331. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  332. break;
  333. case "s":
  334. room = whereToGo[3][1];
  335. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  336. break;
  337.  
  338. case "e":
  339. room = whereToGo[3][2];
  340. MainHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  341. break;
  342. case "w":
  343. System.out.println("You can't go " + directions[3] + "!");
  344. System.out.println(" ");
  345. room = whereToGo[3][6];
  346. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  347. break;
  348. case "u":
  349. if (invo[5] == 1) {
  350. System.out.println("You opened the door to the upstairs!");
  351. System.out.println(" ");
  352. flags[3] = 1;
  353. room = whereToGo[3][6];
  354. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  355. }
  356. else if (flags[3] == 1) {
  357. room = whereToGo[3][4];
  358. TxtAdventGameUpstairsMain upFloor = new TxtAdventGameUpstairsMain();
  359. upFloor.UpstairsMain(room, roomName, whereToGo, directions, myStats, invo, flags);
  360. }
  361. else {
  362. System.out.println("You haven't unlocked this yet!");
  363. System.out.println(" ");
  364. room = whereToGo[3][6];
  365. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  366. }
  367. break;
  368. case "d":
  369. System.out.println("You can't go " + directions[5] + "!");
  370. System.out.println(" ");
  371. room = whereToGo[3][6];
  372. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  373. break;
  374. default:
  375. System.out.println("Unrecognized input.");
  376. System.out.println(" ");
  377. room = whereToGo[3][6];
  378. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  379.  
  380. }
  381.  
  382. }
  383. public void MainERoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  384. // DONE.
  385. room = whereToGo[5][6];
  386.  
  387. String directChoice;
  388. System.out.println("You are in the " + roomName[5]);
  389. System.out.println(" ");
  390.  
  391. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  392.  
  393. System.out.println("You see: Nothing");
  394. System.out.println(" ");
  395. System.out.println("You can go the following directions: ");
  396. System.out.println(" ");
  397. System.out.println(directions[3]);
  398. System.out.println(" ");
  399. System.out.println("Where do you want to go/what would you like to interact with?");
  400. System.out.println(" ");
  401.  
  402. directChoice = newScan.Scanner();
  403.  
  404. directChoice = directChoice.substring(0, 1).toLowerCase();
  405.  
  406. switch (directChoice) {
  407. case "i":
  408. room = whereToGo[5][6];
  409. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  410. break;
  411. case "n":
  412. System.out.println("You can't go " + directions[0] + "!");
  413. System.out.println(" ");
  414. room = whereToGo[5][6];
  415. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  416. break;
  417. case "s":
  418. System.out.println("You can't go " + directions[1] + "!");
  419. System.out.println(" ");
  420. room = whereToGo[5][6];
  421. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  422. break;
  423. case "e":
  424. System.out.println("You can't go " + directions[2] + "!");
  425. System.out.println(" ");
  426. room = whereToGo[5][6];
  427. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  428. break;
  429. case "w":
  430. room = whereToGo[5][3];
  431. MainFloorECorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  432. break;
  433. case "u":
  434. System.out.println("You can't go " + directions[4] + "!");
  435. System.out.println(" ");
  436. room = whereToGo[5][6];
  437. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  438. break;
  439. case "d":
  440. System.out.println("You can't go " + directions[5] + "!");
  441. System.out.println(" ");
  442. room = whereToGo[5][6];
  443. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  444. break;
  445. default:
  446. System.out.println("Unrecognized input.");
  447. System.out.println(" ");
  448. room = whereToGo[5][6];
  449. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  450.  
  451. }
  452. }
  453. public void MainNERoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  454. // DONE.
  455. room = whereToGo[6][6];
  456.  
  457. String directChoice;
  458.  
  459.  
  460. System.out.println("You are in the " + roomName[6]);
  461. System.out.println(" ");
  462.  
  463. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  464.  
  465. System.out.println("You see: Nothing");
  466. System.out.println(" ");
  467. System.out.println("You can go the following directions: ");
  468. System.out.println(" ");
  469. System.out.println(directions[3]);
  470. System.out.println(" ");
  471. System.out.println("Where do you want to go/what would you like to interact with?");
  472. System.out.println(" ");
  473.  
  474. directChoice = newScan.Scanner();
  475.  
  476. directChoice = directChoice.substring(0, 1).toLowerCase();
  477.  
  478. switch (directChoice) {
  479. case "i":
  480. room = whereToGo[6][6];
  481. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  482. break;
  483. case "n":
  484. System.out.println("You can't go " + directions[0] + "!");
  485. System.out.println(" ");
  486. room = whereToGo[6][6];
  487. MainNERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  488. break;
  489. case "s":
  490. System.out.println("You can't go " + directions[1] + "!");
  491. System.out.println(" ");
  492. room = whereToGo[6][6];
  493. MainNERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  494. break;
  495. case "e":
  496. System.out.println("You can't go " + directions[2] + "!");
  497. System.out.println(" ");
  498. room = whereToGo[6][6];
  499. MainNERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  500. break;
  501. case "w":
  502. room = whereToGo[6][3];
  503. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  504. break;
  505. case "u":
  506. System.out.println("You can't go " + directions[4] + "!");
  507. System.out.println(" ");
  508. room = whereToGo[6][6];
  509. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  510. break;
  511. case "d":
  512. System.out.println("You can't go " + directions[5] + "!");
  513. System.out.println(" ");
  514. room = whereToGo[6][6];
  515. MainERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  516. break;
  517. default:
  518. System.out.println("Unrecognized input.");
  519. System.out.println(" ");
  520. room = whereToGo[6][6];
  521. MainNERoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  522.  
  523. }
  524. }
  525.  
  526. public void MainNWHall(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  527. // DONE.
  528. room = whereToGo[7][6];
  529.  
  530. String directChoice;
  531.  
  532.  
  533.  
  534. System.out.println("You are in the " + roomName[7]);
  535. System.out.println(" ");
  536.  
  537. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  538.  
  539. System.out.println("You see: Nothing");
  540. System.out.println(" ");
  541. System.out.println("You can go the following directions: ");
  542. System.out.println(" ");
  543. System.out.println(directions[0] + ", " +directions[1] + ", " + directions[2] + ", " + directions[3]);
  544. System.out.println(" ");
  545. System.out.println("Where do you want to go/what would you like to interact with?");
  546. System.out.println(" ");
  547.  
  548. directChoice = newScan.Scanner();
  549.  
  550. directChoice = directChoice.substring(0, 1).toLowerCase();
  551.  
  552. switch (directChoice) {
  553. case "i":
  554. room = whereToGo[7][6];
  555. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  556. break;
  557.  
  558. case "n":
  559. room = whereToGo[7][0];
  560. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  561. break;
  562.  
  563. case "s":
  564. room = whereToGo[7][1];
  565. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  566. break;
  567. case "e":
  568. room = whereToGo[7][2];
  569. MainFloorNCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  570. break;
  571. case "w":
  572. room = whereToGo[7][3];
  573. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  574. break;
  575. case "u":
  576. System.out.println("You can't go " + directions[4] + "!");
  577. System.out.println(" ");
  578. room = whereToGo[7][6];
  579. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  580. break;
  581. case "d":
  582. System.out.println("You can't go " + directions[5] + "!");
  583. System.out.println(" ");
  584. room = whereToGo[7][6];
  585. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  586. break;
  587. default:
  588. System.out.println("Unrecognized input.");
  589. System.out.println(" ");
  590. room = whereToGo[7][6];
  591. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  592.  
  593. }
  594. }
  595.  
  596. public void MainNWNRoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  597. // DONE.
  598. room = whereToGo[8][6];
  599.  
  600. String directChoice;
  601.  
  602.  
  603.  
  604. System.out.println("You are in the " + roomName[8]);
  605. System.out.println(" ");
  606.  
  607. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  608.  
  609. System.out.println("You see: Nothing");
  610. System.out.println(" ");
  611. System.out.println("You can go the following directions: ");
  612. System.out.println(" ");
  613. System.out.println(directions[1]);
  614. System.out.println(" ");
  615. System.out.println("Where do you want to go/what would you like to interact with?");
  616. System.out.println(" ");
  617.  
  618. directChoice = newScan.Scanner();
  619.  
  620. directChoice = directChoice.substring(0, 1).toLowerCase();
  621.  
  622. switch (directChoice) {
  623. case "i":
  624. room = whereToGo[8][6];
  625. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  626. break;
  627. case "n":
  628. System.out.println("You can't go " + directions[0] + "!");
  629. System.out.println(" ");
  630. room = whereToGo[8][6];
  631. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  632. break;
  633. case "s":
  634. room = whereToGo[8][1];
  635. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  636. break;
  637. case "e":
  638. System.out.println("You can't go " + directions[2] + "!");
  639. System.out.println(" ");
  640. room = whereToGo[8][6];
  641. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  642. break;
  643. case "w":
  644. System.out.println("You can't go " + directions[3] + "!");
  645. System.out.println(" ");
  646. room = whereToGo[8][6];
  647. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  648. break;
  649. case "u":
  650. System.out.println("You can't go " + directions[4] + "!");
  651. System.out.println(" ");
  652. room = whereToGo[8][6];
  653. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  654. break;
  655. case "d":
  656. System.out.println("You can't go " + directions[5] + "!");
  657. System.out.println(" ");
  658. room = whereToGo[8][6];
  659. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  660. break;
  661. default:
  662. System.out.println("Unrecognized input.");
  663. System.out.println(" ");
  664. room = whereToGo[8][6];
  665. MainNWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  666.  
  667. }
  668. }
  669.  
  670. public void MainNWWRoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  671. // DONE.
  672. room = whereToGo[9][6];
  673.  
  674. String directChoice;
  675. Random newRand = new Random();
  676. int encChance = newRand.nextInt(9) + 1;
  677.  
  678.  
  679. System.out.println("You are in the " + roomName[9]);
  680. System.out.println(" ");
  681. if (flags[0] == 0) {
  682. if (encChance >= 1) {
  683. System.out.println("A Dark Knight appears!");
  684. System.out.println(" ");
  685. flags[0] = 1;
  686. TxtAdventGameEasyEnc newEnc = new TxtAdventGameEasyEnc();
  687. newEnc.randEncounterEasy(room, roomName, whereToGo, directions, myStats, invo, flags);
  688.  
  689. }
  690. }
  691. else {
  692. System.out.println("You see: Nothing");
  693. System.out.println(" ");
  694. System.out.println("You can go the following directions: ");
  695. System.out.println(" ");
  696. System.out.println(directions[2]);
  697. System.out.println(" ");
  698. System.out.println("You can interact with the following: Chest");
  699. System.out.println(" ");
  700. System.out.println("Where do you want to go/what would you like to interact with?");
  701. System.out.println(" ");
  702.  
  703. directChoice = newScan.Scanner();
  704.  
  705. directChoice = directChoice.substring(0, 1).toLowerCase();
  706.  
  707. switch (directChoice) {
  708. case "i":
  709. room = whereToGo[9][6];
  710. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  711. break;
  712. case "n":
  713. System.out.println("You can't go " + directions[0] + "!");
  714. System.out.println(" ");
  715. room = whereToGo[9][6];
  716. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  717. break;
  718. case "s":
  719. System.out.println("You can't go " + directions[1] + "!");
  720. System.out.println(" ");
  721. room = whereToGo[9][6];
  722. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  723. break;
  724. case "e":
  725. room = whereToGo[9][2];
  726. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  727. break;
  728. case "w":
  729. System.out.println("You can't go " + directions[3] + "!");
  730. System.out.println(" ");
  731. room = whereToGo[9][6];
  732. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  733. break;
  734. case "u":
  735. System.out.println("You can't go " + directions[4] + "!");
  736. System.out.println(" ");
  737. room = whereToGo[9][6];
  738. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  739. break;
  740. case "d":
  741. System.out.println("You can't go " + directions[5] + "!");
  742. System.out.println(" ");
  743. room = whereToGo[9][6];
  744. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  745. break;
  746. case "c":
  747. if (flags[1] == 1) {
  748. System.out.println("You already opened this chest.");
  749. System.out.println(" ");
  750. System.out.println("You exit the room.");
  751. System.out.println(" ");
  752. room = whereToGo[9][2];
  753. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  754. }
  755. else
  756.  
  757. System.out.println("You open the chest and receive a key! I wonder what it goes to..");
  758. System.out.println(" ");
  759. System.out.println("You exit the room.");
  760. System.out.println(" ");
  761. flags[1] = 1;
  762. invo[4] = invo[4] + 1;
  763. room = whereToGo[9][2];
  764. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  765. break;
  766. default:
  767. System.out.println("Unrecognized input.");
  768. System.out.println(" ");
  769. room = whereToGo[9][6];
  770. MainNWWRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  771.  
  772. }
  773. }
  774. }
  775. public void MainNWSRoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  776. // DONE.
  777. room = whereToGo[10][6];
  778. String directChoice;
  779.  
  780.  
  781.  
  782. System.out.println("You are in the " + roomName[10]);
  783. System.out.println(" ");
  784. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  785.  
  786. System.out.println("You see: Nothing");
  787. System.out.println(" ");
  788. System.out.println("You can go the following directions: ");
  789. System.out.println(" ");
  790. System.out.println(directions[0]);
  791. System.out.println(" ");
  792. System.out.println("Where do you want to go/what would you like to interact with?");
  793. System.out.println(" ");
  794.  
  795. directChoice = newScan.Scanner();
  796.  
  797. directChoice = directChoice.substring(0, 1).toLowerCase();
  798.  
  799. switch (directChoice) {
  800.  
  801. case "i":
  802. room = whereToGo[10][6];
  803. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  804. break;
  805. case "n":
  806. room = whereToGo[10][0];
  807. MainNWHall(room, roomName, whereToGo, directions, myStats, invo, flags);
  808. break;
  809. case "s":
  810. System.out.println("You can't go " + directions[1] + "!");
  811. System.out.println(" ");
  812. room = whereToGo[10][6];
  813. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  814. break;
  815. case "e":
  816. System.out.println("You can't go " + directions[2] + "!");
  817. System.out.println(" ");
  818. room = whereToGo[10][6];
  819. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  820. break;
  821. case "w":
  822. System.out.println("You can't go " + directions[3] + "!");
  823. System.out.println(" ");
  824. room = whereToGo[10][6];
  825. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  826. break;
  827. case "u":
  828. System.out.println("You can't go " + directions[4] + "!");
  829. System.out.println(" ");
  830. room = whereToGo[10][6];
  831. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  832. break;
  833. case "d":
  834. System.out.println("You can't go " + directions[5] + "!");
  835. System.out.println(" ");
  836. room = whereToGo[10][6];
  837. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  838. break;
  839. default:
  840. System.out.println("Unrecognized input.");
  841. System.out.println(" ");
  842. room = whereToGo[10][6];
  843. MainNWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  844.  
  845. }
  846. }
  847.  
  848. public void MainWNRoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  849. // DONE.
  850. room = whereToGo[11][6];
  851. String directChoice;
  852.  
  853.  
  854. System.out.println("You are in the " + roomName[11]);
  855. System.out.println(" ");
  856. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  857.  
  858. System.out.println("You see: Nothing");
  859. System.out.println(" ");
  860. System.out.println("You can go the following directions: ");
  861. System.out.println(" ");
  862. System.out.println(directions[1]);
  863. System.out.println(" ");
  864. System.out.println("Where do you want to go/what would you like to interact with?");
  865. System.out.println(" ");
  866.  
  867. directChoice = newScan.Scanner();
  868.  
  869. directChoice = directChoice.substring(0, 1).toLowerCase();
  870.  
  871. switch (directChoice) {
  872.  
  873. case "i":
  874. room = whereToGo[11][6];
  875. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  876. break;
  877. case "n":
  878. System.out.println("You can't go " + directions[0] + "!");
  879. System.out.println(" ");
  880. room = whereToGo[11][6];
  881. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  882. break;
  883. case "s":
  884. room = whereToGo[11][1];
  885. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  886. break;
  887. case "e":
  888. System.out.println("You can't go " + directions[2] + "!");
  889. System.out.println(" ");
  890. room = whereToGo[11][6];
  891. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  892. break;
  893. case "w":
  894. System.out.println("You can't go " + directions[3] + "!");
  895. System.out.println(" ");
  896. room = whereToGo[11][6];
  897. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  898. break;
  899. case "u":
  900. System.out.println("You can't go " + directions[4] + "!");
  901. System.out.println(" ");
  902. room = whereToGo[11][6];
  903. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  904. break;
  905. case "d":
  906. System.out.println("You can't go " + directions[5] + "!");
  907. System.out.println(" ");
  908. room = whereToGo[11][6];
  909. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  910. break;
  911. default:
  912. System.out.println("Unrecognized input.");
  913. System.out.println(" ");
  914. room = whereToGo[11][6];
  915. MainWNRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  916.  
  917. }
  918. }
  919.  
  920. public void MainWSRoom(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  921. // DONE.
  922. room = whereToGo[12][6];
  923. String directChoice;
  924.  
  925.  
  926.  
  927. System.out.println("You are in the " + roomName[12]);
  928. System.out.println(" ");
  929.  
  930. enemyEnc(room, roomName, whereToGo, directions, myStats, invo, flags);
  931.  
  932.  
  933. System.out.println("You see: Nothing");
  934. System.out.println(" ");
  935. System.out.println("You can go the following directions: ");
  936. System.out.println(" ");
  937. System.out.println(directions[0]);
  938. System.out.println(" ");
  939. System.out.println("Where do you want to go/what would you like to interact with?");
  940. System.out.println(" ");
  941.  
  942. directChoice = newScan.Scanner();
  943.  
  944. directChoice = directChoice.substring(0, 1).toLowerCase();
  945.  
  946. switch (directChoice) {
  947.  
  948. case "i":
  949. room = whereToGo[12][6];
  950. invoCheck(room, roomName, whereToGo, directions, myStats, invo, flags);
  951. break;
  952. case "n":
  953. room = whereToGo[12][0];
  954. MainFloorWCorridor(room, roomName, whereToGo, directions, myStats, invo, flags);
  955. break;
  956. case "s":
  957. System.out.println("You can't go " + directions[1] + "!");
  958. System.out.println(" ");
  959. room = whereToGo[12][6];
  960. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  961. break;
  962. case "e":
  963. System.out.println("You can't go " + directions[2] + "!");
  964. System.out.println(" ");
  965. room = whereToGo[12][6];
  966. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  967. break;
  968. case "w":
  969. System.out.println("You can't go " + directions[3] + "!");
  970. System.out.println(" ");
  971. room = whereToGo[12][6];
  972. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  973. break;
  974. case "u":
  975. System.out.println("You can't go " + directions[4] + "!");
  976. System.out.println(" ");
  977. room = whereToGo[12][6];
  978. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  979. break;
  980. case "d":
  981. System.out.println("You can't go " + directions[5] + "!");
  982. System.out.println(" ");
  983. room = whereToGo[12][6];
  984. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  985. break;
  986. default:
  987. System.out.println("Unrecognized input.");
  988. System.out.println(" ");
  989. room = whereToGo[12][6];
  990. MainWSRoom(room, roomName, whereToGo, directions, myStats, invo, flags);
  991.  
  992. }
  993. }
  994.  
  995.  
  996.  
  997. public void invoCheck(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  998.  
  999. final int RETRY = 0;
  1000. int choice;
  1001. System.out.println("Your Inventory:\n Health Potion: " + invo[0] + "\n Attack Boost: " + invo[1] + "\n Speed Boost: " + invo[2] + "\n Defence Boost: " + invo[3] + "\n Downstairs Key: " + invo[4] + "\n Upstairs Key: " + invo[5] + "\n Final Key: " + invo[6]);
  1002. System.out.println(" ");
  1003.  
  1004. while (RETRY >= 0) {
  1005. System.out.println("Return to the game?");
  1006. System.out.println(" ");
  1007. System.out.println("1) Yes\n2) Not yet");
  1008.  
  1009. try {
  1010. choice = newScan.ScannerInt();
  1011. if (choice == 1) {
  1012. System.out.println("And we continue!");
  1013. System.out.println(" ");
  1014. TxtAdventGameRoomIndex roomFind = new TxtAdventGameRoomIndex();
  1015. roomFind.room(room, roomName, whereToGo, directions, myStats, invo, flags);
  1016.  
  1017. }
  1018. else if (choice == 2) {
  1019. System.out.println("You should consider returning! Enemys lurk about!");
  1020. System.out.println(" ");
  1021. }
  1022.  
  1023. else {
  1024. System.out.println("Not a valid option");
  1025. System.out.println(" ");
  1026.  
  1027.  
  1028. }
  1029.  
  1030. }
  1031. catch (InputMismatchException error) {
  1032. System.out.println("Can't use letters/symbols/other nonsense here!");
  1033. }
  1034. break;
  1035. }
  1036.  
  1037. }
  1038. public void enemyEnc(int room, String roomName[], int[][] whereToGo, String[] directions, int[] myStats, int[] invo, int[] flags) {
  1039.  
  1040.  
  1041. if (newRand.randEnemyEnc() < 3) {
  1042. System.out.println("A Dark Knight appears!");
  1043. System.out.println(" ");
  1044. TxtAdventGameEasyEnc newEnc = new TxtAdventGameEasyEnc();
  1045. newEnc.randEncounterEasy(room, roomName, whereToGo, directions, myStats, invo, flags);
  1046. }
  1047.  
  1048. }
  1049. public void endGame() {
  1050.  
  1051. System.out.println("More to come; game still in construction!");
  1052. System.exit(0);
  1053. }
  1054.  
  1055. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement