Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <random>
  4. using namespace std;
  5.  
  6.  
  7.  
  8.  
  9.  
  10. void Header(int level,int exp,int maxexp);
  11. void Header(int level,int exp,int maxexp) {
  12. system("cls");
  13. cout << " _____ _____ _____ " << endl;
  14. cout << " | __ \\| __ \\ / ____|" << endl;
  15. cout << " | |__) | |__) | | __ " << endl;
  16. cout << " | _ /| ___/| | |_ |" << endl;
  17. cout << " | | \\ \\| | | |__| |" << endl;
  18. cout << " |_| \\_\\_| \\_____|" << endl;
  19. cout << " Level - " << level << " | EXP - " << exp << "/" << maxexp << endl;
  20. cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << endl;
  21. cout << "\n";
  22. }
  23.  
  24.  
  25. int main() {
  26. random_device random;
  27. string playername;
  28. string gamestarted;
  29. int playerhealth = 3000;
  30. int playerattack = 200;
  31. int playerdefense = 100;
  32. int ai1;
  33. int player;
  34. int ai1hp = 2000;
  35. int ai1def = 50;
  36. int ai1atk = 150;
  37. int exp = 0;
  38. int maxexp = 500;
  39. int level = 1;
  40. int levelchoice;
  41. int criticalhit;
  42. bool playing = true;
  43. if (level == 20) {
  44. Header(level, exp, maxexp);
  45. system("color a");
  46. cout << "You have beat the game! Congratulations on level 20!" << endl;
  47. abort();
  48. }
  49. Header(level, exp, maxexp);
  50. cout << "What is your name?" << endl;
  51. cin >> playername;
  52.  
  53. Header(level, exp, maxexp);
  54. cout << "Welcome " + playername + "!" << endl;
  55. system("pause");
  56.  
  57. system("color a");
  58. Header(level, exp, maxexp);
  59. cout << "\n In this game, you fight enimies to gain exp and level up! After every level, your stats get a boost! \n that means you can fight higher leveled enimes and get more xp to level! \n Eventually, you can level up so much that you can face randomly generated very hard enimies!" << endl;
  60. system("pause");
  61. while (playing == 1) {
  62.  
  63. system("color c");
  64. Header(level, exp, maxexp);
  65. cout << "Select the fight you would like to do! You should choose the fight of your level." << endl;
  66. cout << "1 - The first fight" << endl;
  67. cout << "2 - NULL" << endl;
  68. cout << "3 - NULL" << endl;
  69. cout << "4 - NULL" << endl;
  70. cout << "5 - NULL" << endl;
  71. cout << "6 - NULL" << endl;
  72. cout << "7 - NULL" << endl;
  73. cout << "8 - NULL" << endl;
  74. cout << "9 - NULL" << endl;
  75. cout << "10 - NULL" << endl;
  76. cout << "Type the number of the fight to start it!" << endl;
  77. cin >> levelchoice;
  78. if (levelchoice == 1) {
  79. ai1hp = 2000;
  80. playerhealth = 3000;
  81. Header(level, exp, maxexp);
  82. cout << "The first ememy has 2000 HP, 50 defense and 150 attack points." << endl;
  83. system("pause");
  84. Header(level, exp, maxexp);
  85. cout << "The fight has begun!" << endl;
  86. while (playerhealth > 0 && ai1hp > 0) {
  87. player = ai1atk - playerdefense;
  88. ai1 = playerattack - ai1def;
  89. playerhealth = playerhealth - player;
  90. ai1hp = ai1hp - ai1;
  91. criticalhit = random() % 10;
  92. if (criticalhit > 8) {
  93. cout << "You landed a CRITICAL HIT! - and did 500 extra damage!" << endl;
  94. ai1hp = ai1hp - 500;
  95. }
  96. }
  97. if (playerhealth <= 0 && ai1hp <= 0) {
  98. cout << "It was a draw!" << endl;
  99. system("pause");
  100. }
  101. else if (playerhealth <= 0 || ai1hp <= 0) {
  102. cout << "The fight has ended! Calculating results... " << endl;
  103. }
  104. if (playerhealth <= 0 && ai1hp > 0) {
  105. cout << "You lost! Try again! \n" << endl;
  106. system("pause");
  107. }
  108. else if (ai1hp <= 0 && playerhealth > 0) {
  109. cout << "You won!" << endl;
  110. cout << "You were left with " << playerhealth << " HP when you won! \n" << endl;
  111. exp = exp + 250;
  112. system("pause");
  113. }
  114. }
  115. else if (levelchoice == 2) {
  116. }
  117. else if (levelchoice == 3) {
  118. }
  119. else if (levelchoice == 4) {
  120. }
  121. else if (levelchoice == 5) {
  122. }
  123. else if (levelchoice == 6) {
  124. }
  125. else if (levelchoice == 7) {
  126. }
  127. else if (levelchoice == 8) {
  128. }
  129. else if (levelchoice == 9) {
  130. }
  131. else if (levelchoice == 10) {
  132. }
  133. else {
  134. system("cls");
  135. system("color c");
  136. int x = 1;
  137. while (x > 0) {
  138. cout << x + " ";
  139. x++;
  140. }
  141. }
  142. }
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement