notjacob

C++ test pre1

Nov 21st, 2019
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. int main() {
  4. srand(time(NULL));
  5. int critChance = rand() % 20 + 1;
  6.  
  7. int player = 0;
  8. int dragon = 0;
  9. int worm = 0;
  10.  
  11. int attacking = 0;
  12. bool dead = false;
  13. bool restart = false;
  14. int health = 10;
  15.  
  16. //classes
  17. int knight = 1;
  18. int mage = 2;
  19. int brute = 3;
  20.  
  21. int ismage = 0;
  22. int isknight = 0;
  23. int isbrute = 0;
  24.  
  25. //knight attacks
  26. int slash = 0;
  27. int swing = 0;
  28. int stab = 0;
  29.  
  30. //mage attacks
  31. int fireball = 0;
  32. int poison = 0;
  33. int lightning = 0;
  34.  
  35. //brute attacks
  36. int maul = 0;
  37. int beat = 0;
  38. int clobber = 0;
  39.  
  40. //dragon attacks
  41. int burn = 0;
  42. int torture = 0;
  43. int roast = 0;
  44.  
  45. //worm attacks
  46. int suck = 0;
  47. int consume = 0;
  48. int bury = 0;
  49.  
  50. //-----------------------------------------------
  51. //start story
  52. int answer1 = 0;
  53. int answer2 = 0;
  54. int answer3 = 0;
  55. int max = 0;
  56. dead = true;
  57. while (dead == true) {
  58. dead = false;
  59. std::cout << "==========================\nWelcome to the story!\n==========================\n";
  60. std::cout << "Here you will be given a quiz, which will select your class!\n";
  61. std::cout << "==========================";
  62. std::cout << "Q1) How do you prefer to handle situations?\n\n1. With Honor\n2. With Knowledge\n3. With Force\n";
  63. std::cin >> answer1;
  64.  
  65. if (answer1 == 1) {
  66. isknight++;
  67. }
  68. else if (answer1 == 2) {
  69. ismage++;
  70. }
  71. else if (answer1 == 3) {
  72. isbrute++;
  73. }
  74. else {
  75. std::cout << "Invalid Answer\n";
  76. }
  77. //---------------------------------------------
  78.  
  79. std::cout << "Q2) Which quality do you value most?\n\n1. strength\n2. honor\n3. wisdom\n";
  80. std::cin >> answer2;
  81.  
  82. if (answer2 == 1) {
  83. isbrute++;
  84. }
  85. else if (answer2 == 2) {
  86. isknight++;
  87. }
  88. else if (answer2 == 3) {
  89. ismage++;
  90. }
  91. else {
  92. std::cout << "Invalid Answer\n";
  93. }
  94. //---------------------------------------------
  95. std::cout << "Q3) If you were being attacked by someone, what would you do?\n\n1. Freeze them with your ice spell\n2. honor your vows and parry them like a proper servant of the king\n3. beat them to death\n";
  96. std::cin >> answer3;
  97.  
  98. if (answer3 == 1) {
  99. ismage++;
  100. }
  101. else if (answer3 == 2) {
  102. isknight++;
  103. }
  104. else if (answer3 == 3) {
  105. isbrute++;
  106. }
  107. else {
  108. std::cout << "Invalid Answer\n";
  109. }
  110. //---------------------------------------------
  111. std::string classtype;
  112.  
  113. if (ismage > max) {
  114. max = ismage;
  115. classtype = "Mage";
  116. player = 2;
  117. }
  118. if (isbrute > max) {
  119. max = isbrute;
  120. classtype = "Brute";
  121. player = 3;
  122. }
  123. if (isknight > max) {
  124. max = isknight;
  125. classtype = "Knight";
  126. player = 1;
  127. }
  128. std::cout << "You have been assigned the class " << classtype << "! Good luck!\n";
  129.  
  130. //STORYLINE
  131. //======================================================
  132. int beginn = 0;
  133. int begin = 0;
  134. while (begin == 0) {
  135. std::cout << "Ready to begin?\n1) yes\n2) no\n";
  136. std::cin >> beginn;
  137. begin = 1;
  138. if (beginn == 1) {
  139. std::cout << "Starting the story!\n";
  140. begin = 2;
  141. }
  142. else if (beginn == 2) {
  143. std::cout << "Ok! Tell us when you are ready!\n";
  144. begin = 0;
  145. }
  146. else {
  147. std::cout << "Invalid Option\n";
  148. begin = 0;
  149. }
  150. }
  151. while (begin == 2) {
  152. if (player == 2) {
  153. int returntodoor = 0;
  154. int gotobeginquest = 0;
  155. int mtcheck = 0;
  156. int answer4 = 0;
  157. int answer5 = 0;
  158. int answer6 = 0;
  159. begin = 3;
  160.  
  161.  
  162. std::cout << "'Ah, what a beautiful morning' you say, rising out of bed.\n";
  163. std::cout << "You open your book to where you left off last night.\n";
  164. std::cout << "Suddenly, you hear a knock at the door\n";
  165. returntodoor = 1;
  166. while (returntodoor == 1) {
  167.  
  168. std::cout << "Go to the door? (checkpoint)\n1. Yes\n2.No\n";
  169. std::cin >> answer4;
  170. returntodoor = 0;
  171.  
  172. if (answer4 == 2) {
  173. std::cout << "You feel like going to the door would be for the better\n";
  174. returntodoor = 1;
  175. }
  176.  
  177.  
  178.  
  179. if (answer4 == 1) {
  180. returntodoor = 0;
  181. std::cout << "You see a boy holding a newspaper standing at your door.\n";
  182. std::cout << "You take the newspaper and read it.\n";
  183. std::cout << "'UNKNOWN TERROR RAVAGING KINGDOM! Killer expected to receive opulent reward.'\n";
  184. std::cout << "The mentioned lucrative reward intrigues you.\n";
  185. std::cout << "You decide to speak to the sheriff. He probably knows something.\n";
  186. while (gotobeginquest == 0) {
  187. std::cout << "Speak to the sheriff?\n1. yes\n2. no\n";
  188. std::cin >> answer5;
  189. gotobeginquest = 1;
  190. if (answer5 == 2) {
  191. std::cout << "You go back to bed. The Kingdom is obliterated by a powerful beast. You die.\n";
  192. returntodoor = 1;
  193. }
  194. else if (answer5 == 1) {
  195. dead = false;
  196. std::cout << "You visit the sheriff. He instructs you to go through the mountains to find your foe.\n";
  197. std::cout << "Head to the mountains?\n1) yes\n2) no\n";
  198. std::cin >> answer6;
  199. if (answer6 == 2) {
  200. std::cout << "You decide today is a lazy day, and go back to bed. The Kingdom is ravaged by a ferocious beast. You die.\n";
  201. returntodoor = 1;
  202.  
  203. }
  204.  
  205. else if (answer6 == 1) {
  206. int answer7 = 0;
  207. dead = false;
  208. returntodoor = 0;
  209. std::cout << "In the height of the mountains, you see some fur poking out from behind a rock.\n";
  210. std::cout << "Investigate?\n1) Yes\n2) No\n";
  211. std::cin >> answer7;
  212. if (answer7 == 2) {
  213. std::cout << "You turn your back, and are mauled by a crazy wolf. You die.\n";
  214. returntodoor = 1;
  215. }
  216.  
  217. else if (answer7 == 1) {
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228. }
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238. }
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249. }
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. }
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282. }
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. }
  301. }
  302. }
  303. }
Advertisement
Add Comment
Please, Sign In to add comment