Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.76 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cstdlib>
  4. #include <limits>
  5.  
  6. using namespace std;
  7.  
  8. void divider(){
  9. cout << "\n------------------------------------------------------------------\n";
  10. }
  11.  
  12.  
  13. void gunChoose(string gun){
  14. cout << "You have chosen the " << gun << endl;
  15. }
  16.  
  17. void pressContinue(){
  18. string temp;
  19. divider();
  20. cin.ignore();
  21. cin.ignore();
  22.  
  23. }
  24.  
  25. string introduction() { //Introduce storyline
  26. string playerName;
  27. string shipName;
  28. string introduction,introduction2, introduction3;
  29. string introduction4, introduction5;
  30. string divider = "\n------------------------------------------------------------------\n";
  31.  
  32. cout << "What is your name? \n";
  33. cin >> playerName;
  34.  
  35. cout << "Bot: Welcome. " << playerName << " I am here to give you details on a new mission assigned to you.\n"
  36. << "20 years ago, 2089: The Vatican defeats The Syndicate, a global world power trying to destroy Religion and place in power\n"
  37. << "a dictatorship under a man by the name of The Rook. After his defeat, he and his solder minions called the Pawns and the Buggers\n"
  38. << "ran into hiding. But now, he is planning a new revolution. The Pawns are weak creatures and the Buggers are stronger creatures\n"
  39. << "Throughout this mission, you will have to fight many of them. When you do encounter one, press 1 to fire a weapon at them\n"
  40. << "I warn you, this leaves you open to attack. If you are low on health, press 2 to heal up.\n";
  41. introduction = "I am your A.I Bot. I am here simply to guide you on your mission,\n";
  42. introduction2 = "The Vatican has ordered you to take your ship throughout the Galaxy in order to find the ancient key.\n";
  43. introduction3 = "This key will bring us access to the weapons of mass destruction, so we can spread Christianity throughout the Galaxy and defeat The\n";
  44. introduction4 = "Syndicate. In order to do this you must fight others in the search for the key, and solve puzzles ";
  45. introduction5 = "in order to find the key, you must find three separate parts. Enter the name of your vehicle to begin:\n ";
  46.  
  47.  
  48. cout << divider << introduction << introduction2 << introduction3 << introduction4 << introduction5 << endl;
  49. cin >> shipName;
  50.  
  51. cout << "Bot: Very well, I hope the " << shipName << " is suitable for this mission.\n";
  52.  
  53. return playerName;
  54. }
  55.  
  56.  
  57. void potionSelect(int& incHealth,int& incDamage,int& incShield,string& potion){
  58. string select;
  59. cout << "Select which potion you would like to bring on your journey. "
  60. << "You may only bring one.\n"
  61. << " a. Health\n b. Attack\n c. Shield\n";
  62. cin >> select;
  63. if (select == "a"){
  64. potion = "Health";
  65. incHealth = 5;
  66. } else if (select == "b"){
  67. potion = "Attack";
  68. incDamage = 1;
  69. } else if (select == "c"){
  70. potion = "Shield";
  71. incShield = 1;
  72. }
  73.  
  74. //return increaseHealth,increaseDamage,increaseShield;
  75.  
  76. }
  77.  
  78. void pawnAttack(int& pawnHealth,int& gunDamage,int& health){ //Whenever a pawn attacks
  79. int random;
  80. int random1;
  81. int choose;
  82. divider();
  83.  
  84. cout << "You have encountered a Pawn!\n"
  85. << "What are you going to do?\n(1-Use Gun, 2-Rest)";
  86. divider();
  87. while (pawnHealth > 0 && health > 0){ //While Loop
  88. random = (rand() % 4) + 2;
  89. cin >> choose;
  90. if (choose == 1){
  91. //random1 = (rand() % 4) + 3;
  92. cout << "Pawn lost " << gunDamage << " health\n";
  93. pawnHealth -= gunDamage;
  94. cout << "Pawn health: " << pawnHealth << endl;
  95. cout << "Your health: " << health << endl;
  96. divider();
  97. if (random == 3){
  98. health -= 4;
  99. pawnHealth += 2;
  100. cout << "Pawn attacked you.\nYou have " << health << " health now\n"
  101. << "Pawn healed up by 2\n"
  102. << "Pawn Health: "<< pawnHealth << endl
  103. << "Your Health: " << health << endl;
  104. divider();
  105. }
  106. } else if (choose == 2){
  107. health += 1; //Making it different from Bugger
  108. cout << "Health increased by 1" << endl;
  109. if (random == 3){ //Heal
  110. health += 2;
  111. cout << "You were lucky and gained an extra 2 in health\n";
  112. cout << "You have " << health << " health now\n";
  113. cout << "Pawn Health: " << pawnHealth << endl
  114. << "Your Health: " << health << endl;
  115. } else if (random == 2){ //Pawn attacks
  116. health -= 2;
  117. cout << "Pawn attacked you.\nYou have " << health << " health now\n";
  118. cout << "Pawn Health: " << pawnHealth << endl
  119. << "Your Health: " << health << endl;
  120. }
  121. }
  122. }
  123. divider();
  124.  
  125. if (health <= 0){
  126. cout << "Game Over!\n";
  127. exit(0);
  128. } else if (pawnHealth <= 0){
  129. cout << "You have defeated the Pawn!\n";
  130. }
  131. health += 5;
  132. pawnHealth = 10;
  133.  
  134. }
  135.  
  136.  
  137.  
  138.  
  139.  
  140. void buggerAttack(int& buggerHealth,int& gunDamage,int& health){ //Whenever a Bugger attacks player
  141. int random;
  142. int random1;
  143. int choose;
  144. divider();
  145.  
  146. cout << "You have encountered a Bugger!\n"
  147. << "What are you going to do?\n(1-Use Gun, 2-Rest)";
  148. divider();
  149. while (buggerHealth > 0 && health > 0){ //While Loop
  150. random = (rand() % 4) + 2;
  151. cin >> choose;
  152. if (choose == 1){
  153. cout << "Bugger lost " << gunDamage << " health\n";
  154. buggerHealth -= gunDamage;
  155. cout << "Bugger health: " << buggerHealth << endl;
  156. cout << "Your health: " << health << endl;
  157. divider();
  158. if (random == 3){
  159. health -= 3; //Bugger attacks player
  160. buggerHealth += 3;
  161. cout << "Bugger attacked you.\nYou have " << health << " health now\n"
  162. << "Bugger healed up by 3\n"
  163. << "Bugger Health: "<< buggerHealth << endl
  164. << "Your Health: " << health << endl;
  165. divider();
  166. }
  167. } else if (choose == 2){
  168. health += 2;
  169. cout << "Health boosted by 2" << endl;
  170. if (random == 2){ //Player has chosen to heal
  171. health += 3;
  172. cout << "You were lucky and gained an additional 3 health from resting\n";
  173. cout << "You have " << health << " health now\n"
  174. << "Bugger Health: "<< buggerHealth << endl
  175. << "Your Health: " << health << endl;
  176. } else if (random == 3){
  177. health -= 4; //Health Loss
  178. cout << "Bugger attacked you.\nYou have " << health << " health now\n"
  179. << "Bugger Health: "<< buggerHealth << endl
  180. << "Your Health: " << health << endl;
  181. } else {
  182. cout << "Nothing\n";
  183. }
  184. }
  185. }
  186. divider();
  187.  
  188. if (health <= 0){
  189. cout << "Game Over!\n";
  190. exit(0);
  191. } else if (buggerHealth <= 0){
  192. cout << "You have defeated the Bugger!\n";
  193. }
  194.  
  195. health += 5;
  196. buggerHealth = 15;
  197.  
  198. }
  199.  
  200.  
  201. int Venus(int& pawnHealth, int& buggerHealth, int& gunDamage, int& health, int& key){ //If user inputs Venus
  202. int input; //Prompt user input
  203. cout << "Bot: . . . Initializing. . .\n"
  204. << "Now entering Venus Airstrip District 7\n";
  205.  
  206. cout << "Bot: Analyzing landform. There are several harmful"
  207. << "entities across the barrier. Would you like to cross? (1-Yes, 2-No)\n";
  208. cin >> input;
  209.  
  210. switch (input){ //Crossing the barrier
  211. case 1: //1-YES
  212. cout << "Crossing into Inner Venus\n";
  213. pawnAttack(pawnHealth,gunDamage,health);
  214. break;
  215. case 2: //2-NO
  216. cout << "Leaving Venus\n ";
  217. break;
  218. }
  219. pressContinue();
  220. cout << "Bot: We have to be careful. Venus is known to be one of the largest bases of The Syndicate\n"
  221. << "The key is here somewhere, but I am afraid we may have to cross some more pawns in the way\n";
  222. //pressContinue();
  223. cout << "Bot: Look! Three pathways.\n";
  224. int indicator = 0;
  225. while (indicator == 0){
  226.  
  227. cout << "Where would you like to go?\n1.Path 1\n2.Path 2\n3.Path 3\n";
  228. int chosen;
  229. cin >> chosen;
  230. switch (chosen){
  231. case 1:
  232. //for (int i; i < 3; i++){
  233. pawnAttack(pawnHealth,gunDamage,health);
  234. pawnAttack(pawnHealth,gunDamage,health);
  235. //}
  236. buggerAttack(buggerHealth,gunDamage,health);
  237. cout << "Bot: All that for nothing huh. Let's go somewhere else.";
  238. pressContinue();
  239. break;
  240. case 2:
  241. cout << "Bot: Looks like you found a medkit.";
  242. cout << "Health boosted by 5";
  243. health += 5;
  244. pressContinue();
  245. cout << "Still no key parts.";
  246. pressContinue();
  247. break;
  248. case 3:
  249. //for (int i; i < 4; i++){
  250. pawnAttack(pawnHealth,gunDamage,health);
  251.  
  252. //}
  253. cout << "You found another key part!\nMission Venus Complete!";
  254. key = 1;
  255. return key;
  256. indicator = 1;
  257. break;
  258. }
  259. }
  260.  
  261.  
  262.  
  263. }
  264.  
  265.  
  266.  
  267.  
  268.  
  269. int mars(int& pawnHealth, int& buggerHealth, int& gunDamage, int& health, int& key){
  270. int inputMars,responseCave1,responseCave2,responseCave3,letterAnalysis,caveIndicator;
  271. cout << "Bot: . . . Initializing. . .\n";
  272. cout << "Now entering Mars landing zone. 7\n";
  273. cout << "Bot: It is best to start with searching with the main cave on Mars\n";
  274. caveIndicator = 0;
  275. while (caveIndicator == 0){ // helps sey cave 3 as the correct cave to search
  276. cout << "\tPlease enter: 1 - Right; 2 - Left; 3 - Straight Forward\n";
  277. cin >> responseCave1; // searching the cave
  278. switch (responseCave1) { // gives the options for the other caves
  279. case 1:
  280. cout << "Bot: The tunnel to the right is filled with dangerous entities\n";
  281. cout << "Bot: There was a dangerous alien pawn thing. I think it wants to fight.\n";
  282. cout << "You: Not on my christian minecraft server!";
  283. pawnAttack(pawnHealth,gunDamage,health);
  284. cout << "You defeat the dangerous entity, but this cave is a dead end\n";
  285. break;
  286. case 2:
  287. cout << "Bot: The room is cave is full scattered papers, but only three stand out.\n";
  288. cout << "\n -------------------------------------------------------- \n";
  289. cout << "You grab the the three papers, which do you read first?\n";
  290. cout << "The first paper states:\n";
  291. cout << "\t GOing ThrOugh THE tunnel.\n";
  292. cout << "The second paper states:\n";
  293. cout << "\tTesting tHese clues In the Rigid tunnel Doors\n";
  294. cout << "The third and final Paper states:\n";
  295. cout << "\t Determined tO find the correct doOR.";
  296. cout << "\n --------------------------------------------------------- \n";
  297. cout << "Bot: There seem to be a code in these letters, You should test the 1 - capital letters or 2 - lowercase letters\n" << endl;
  298. cin >> letterAnalysis;
  299. if (letterAnalysis == 1) {
  300. cout << "You: The capital letters seem to form a phrase.\n";
  301. cout << "Bot: The phrase is: GO TO THE THIRD DOOR\n";
  302. cout << "You: Since the third option is the middle door, we should try that next!\n";
  303. }
  304. else if (letterAnalysis == 2) {
  305. cout << "Bot: There are way to many letters for this to be a code\n"
  306. << "Bot: We should try the upper case letters.";
  307. cout << "You: The capital letters seem to form a phrase.\n";
  308. cout << "Bot: The phrase is: GO TO THE THIRD DOOR";
  309. cout << "You: Since the third option is the middle door, we should try that next!";
  310. }
  311. break;
  312. case 3:
  313. cout << "Bot: This appears to be the correct cave, but there is a pawn guarding the peice of the key.\n";
  314. pawnAttack(pawnHealth,gunDamage,health);
  315. cout << "Bot: The pawn dropped 2 medkits, but now there is a bugger coming!";
  316. cout << "You quickly use the medkit before begining the fight with the bugger.";
  317. health += 5; // value of one medkit because you lose the value of one medkit later
  318. cout << "You gained 10 health!";
  319. cout << "The bugger attacks as you use the medkits, and you lose 5 of the 1 health you just gained.";
  320. buggerAttack(buggerHealth,gunDamage,health); divider();
  321. cout << "Bot: You defeated the bugger and discovered part of the key!";
  322. caveIndicator == 1; // ends loop after finding key
  323. key = 1;
  324. return key;
  325. break;
  326. }
  327. }
  328.  
  329.  
  330. }
  331.  
  332.  
  333.  
  334.  
  335. int plusGun(int& gunDamage){
  336. gunDamage += 2;
  337. return gunDamage;
  338. }
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348. int Jupiter(string name, int& buggerHealth, int& gunDamage, int& health, int& key, int& pawnHealth){
  349. int select;
  350.  
  351. cout << "Jupes: Welcome to Jupiter!" << name << " Please accept our hospitality.";
  352. divider();
  353. pressContinue();
  354. cout << "There are many dangerous creatures out there. I am not sure if you would like to venture\n"; pressContinue();
  355. cout << "but we do know your duties to your country and your Religion.\n"; pressContinue();
  356. cout << "We also want to show our appreciation for what your father did for us many years ago\n"
  357. << "He killed off millions of buggers and pawns off our planet years ago, which helped us to\n"
  358. << "thrive and prosper for many years to come, even though they still lived. As a token of appreciation, let us upgrade your gun\n"; divider();
  359. cout << "Bot: Would you like these Jupiterians to upgrade your gun? (1-Yes, 2-No)\n";
  360. cin >> select;
  361. if (select == 1){
  362. plusGun(gunDamage);
  363. cout << "Very well. ABDUL! Come upgrade this man's gun immediately!\n";
  364.  
  365. } else if (select == 2){
  366. cout << "That is fine with us. It is an offer, not a force feed.\n"
  367. << "Good luck on your journey!\n"; divider();
  368. }
  369. cout << "Jupes: Be safe my friend. Here, take this. It is a Jupiter Emerald. It will keep you safe.\n"; divider();
  370. int indicator = 0;
  371. while (indicator == 0){
  372. cout << "Bot: This place is scary! Based on this map, there are three places you can go.\n"
  373. << "1. Devil's Temple\n2. Florida\n3. Meridian Oasis\nChoose one!";
  374. cin >> select;
  375. switch(select){
  376. case 1:
  377. indicator = 1;
  378. buggerAttack(buggerHealth,gunDamage,health); divider();
  379. cout << "Bot: Look! You found another part of the key!\n";
  380. key = 1;
  381. return key;
  382. cout << "Bot: Mission Jupiter complete!"; //KEY FOUND
  383. pressContinue();
  384. break;
  385. case 2:
  386. divider();
  387. cout << "Bot: Very eerie place and lots of people!\n"
  388. << "Watch out for Pawns here. I heard there are a lot.\n"; pressContinue();
  389. pawnAttack(pawnHealth,gunDamage,health);
  390. cout << "Bot: Ugh.Nothing here! We need to go to a different place.\n\n";
  391. break;
  392. case 3:
  393. divider();
  394. cout << "This place seems peaceful.\n";
  395. pressContinue();
  396. cout << "Wow! Look a chest! Let's open it!\n";
  397. pressContinue();
  398. cout << "You found an M16!! Would you like to swap with your old gun?\n(1-Yes, 2-No)";
  399. int userInput;
  400. cin >> userInput;
  401. if (userInput == 1){
  402. gunDamage == 3.5;
  403. cout << "Gun updgraded\n";
  404. } else {
  405. cout << "Gun Discarded.\n";
  406. }
  407. cout <<"Bot: Let's keep moving. We don't want to lose track of time.\n";
  408. pressContinue();
  409. pawnAttack(pawnHealth,gunDamage,health);
  410. cout << "Rats! Key parts are nowhere to be found. But in the meanwhile "
  411. << "There is this medkit. I would advise you use it. (1-Take The Meds 2-Discard the Meds)";
  412. cin >> userInput;
  413. if (userInput == 1){
  414. health += 5;
  415. cout << "Health increased by 5\n";
  416. } else {
  417. cout << "Medkit Discarded\n";
  418. }
  419. cout << "Bot: Let's move!\n";
  420. break;
  421. }
  422.  
  423. }
  424.  
  425. }
  426.  
  427.  
  428.  
  429.  
  430. void endGame(int& keyVenus,int& keyMars,int& keyJupiter){
  431. int sum = keyVenus + keyJupiter + keyMars;
  432. if (sum == 3){
  433. cout << "Congratulations, you've won the game! You found all three parts of the Key";
  434. exit(0);
  435. }
  436. }
  437.  
  438. int main(){
  439.  
  440. string gun;
  441. string armor;
  442. string shield;
  443. string potion;
  444. string medkit;
  445. string select;
  446.  
  447.  
  448.  
  449. int health = 25; //Health
  450. int gunDamage; //How much damage the weapon will inflict upon the enemy
  451. int armorStrength;
  452. int shieldStrength;
  453. int attack;
  454. int pawnHealth = 10; int buggerHealth = 20;
  455. string playerName;
  456. int increaseDamage;
  457. int increaseHealth;
  458. int increaseShield;
  459. int sum;
  460.  
  461. introduction(); //Displays Intro
  462. divider();
  463. cout << "Bot: First things first, we must provide you with the proper equipment\n"
  464. << "Choose a type of gun\n a. AK47\n b. P90\n c. RheinmetallMG\n d. M4\n";
  465.  
  466. string gunChoice;
  467. cin >> gunChoice;
  468. if (gunChoice == "a"){
  469. gun = "AK47";
  470. gunDamage = 1;
  471. gunChoose(gunChoice);
  472. } else if (gunChoice == "b"){
  473. gun = "P90";
  474. gunDamage = 2;
  475. gunChoose(gunChoice);
  476. } else if (gunChoice == "c"){
  477. gun = "RheinmetalMG";
  478. gunDamage = 2.2;
  479. gunChoose(gunChoice);
  480. } else if (gunChoice == "d"){
  481. gun = "M4";
  482. gunDamage = 2.5;
  483. gunChoose(gun);
  484. }
  485.  
  486. int keyVenus = 0;
  487. int keyJupiter = 0;
  488. int keyMars = 0;
  489. divider();
  490.  
  491. potionSelect(increaseHealth,increaseDamage,increaseShield,potion);
  492. cout << "Bot: Very well! You are all set for the journey."
  493. << "I will be assisting you at all times.\n";
  494.  
  495. while (select != "Exit"){
  496.  
  497. endGame(keyVenus,keyMars,keyJupiter);
  498. divider();
  499. cout << "What planet would you like to visit?\n"
  500. << " a. Venus\n b. Mars\n c. Jupiter\n d. Mercury\n ";
  501.  
  502. cin >> select;
  503.  
  504. divider();
  505.  
  506.  
  507. if (select == "a"){
  508. Venus(pawnHealth,buggerHealth,gunDamage,health,keyVenus);
  509. if(health == 0){
  510. break;
  511. }
  512. } else if (select == "b"){
  513. mars(pawnHealth, buggerHealth, gunDamage, health, keyMars);
  514. } else if (select == "c"){
  515. Jupiter(playerName,buggerHealth,gunDamage,health,keyJupiter,pawnHealth);
  516. if(health == 0){
  517. break;
  518. }
  519. } else if (select == "d"){
  520.  
  521. }
  522.  
  523. }
  524.  
  525.  
  526. return 0;
  527.  
  528. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement