fork download
  1. /*
  2.  * Dire_Storm
  3.  * Gunner DPS Calculator
  4.  * 11 July 2016
  5.  */
  6.  
  7. #include <iostream>
  8. #include <iomanip>
  9. #include <string>
  10.  
  11. const int weapons = 33;
  12.  
  13. struct Gun{ // Gunner's weapon
  14. std::string name; // Name of gun
  15. int AT_min; // Minimum ATtack damage
  16. int AT_max; // Maximum ATtack damage
  17. int AGI_min; // Fastest rate of fire (minimum number of frames between shots)
  18. int AGI_max; // Slowest rate of fire (maximum number of frames between shots)
  19. int PC; // Projectile count
  20. };
  21.  
  22. struct Character{ // Gunner character
  23. int STR; // STRength stat in Gunner
  24. int DEX; // DEXterity stat in Gunner
  25. };
  26.  
  27. // Sets values to each Gun (Gun catalogue)
  28. void setGuns(Gun Guns[]){
  29. Guns[0].name = "Gun";
  30. Guns[0].AT_min = 2;
  31. Guns[0].AT_max = 6;
  32. Guns[0].AGI_min = 20;
  33. Guns[0].AGI_max = 30;
  34. Guns[0].PC = 1;
  35.  
  36. Guns[1].name = "Handgun";
  37. Guns[1].AT_min = 8;
  38. Guns[1].AT_max = 12;
  39. Guns[1].AGI_min = 20;
  40. Guns[1].AGI_max = 30;
  41. Guns[1].PC = 1;
  42.  
  43. Guns[2].name = "Submachine-gun";
  44. Guns[2].AT_min = 4;
  45. Guns[2].AT_max = 8;
  46. Guns[2].AGI_min = 5;
  47. Guns[2].AGI_max = 10;
  48. Guns[2].PC = 1;
  49.  
  50. Guns[3].name = "Shotgun";
  51. Guns[3].AT_min = 1;
  52. Guns[3].AT_max = 20;
  53. Guns[3].AGI_min = 50;
  54. Guns[3].AGI_max = 60;
  55. Guns[3].PC = 5;
  56.  
  57. Guns[4].name = "Rifle";
  58. Guns[4].AT_min = 20;
  59. Guns[4].AT_max = 40;
  60. Guns[4].AGI_min = 50;
  61. Guns[4].AGI_max = 60;
  62. Guns[4].PC = 1;
  63.  
  64. /*Guns[5].name = "Grenade";
  65.   Guns[5].AT_min = 8;
  66.   Guns[5].AT_max = 12;
  67.   Guns[5].AGI_min = 70;
  68.   Guns[5].AGI_max = 80;
  69.   Guns[5].PC = 1;*/
  70.  
  71. /*Guns[6].name = "Laser Gun";
  72.   Guns[6].AT_min = 8;
  73.   Guns[6].AT_max = 12;
  74.   Guns[6].AGI_min = 20;
  75.   Guns[6].AGI_max = 30;
  76.   Guns[6].PC = 1;*/
  77.  
  78. /*Guns[7].name = "Bazooka";
  79.   Guns[7].AT_min = 40;
  80.   Guns[7].AT_max = 60;
  81.   Guns[7].AGI_min = 80;
  82.   Guns[7].AGI_max = 90;
  83.   Guns[7].PC = 1;*/
  84.  
  85. Guns[8].name = "Homing Laser";
  86. Guns[8].AT_min = 8;
  87. Guns[8].AT_max = 12;
  88. Guns[8].AGI_min = 20;
  89. Guns[8].AGI_max = 30;
  90. Guns[8].PC = 2;
  91.  
  92. Guns[9].name = "Beretta";
  93. Guns[9].AT_min = 24;
  94. Guns[9].AT_max = 36;
  95. Guns[9].AGI_min = 20;
  96. Guns[9].AGI_max = 30;
  97. Guns[9].PC = 1;
  98.  
  99. Guns[10].name = "Uzi";
  100. Guns[10].AT_min = 12;
  101. Guns[10].AT_max = 24;
  102. Guns[10].AGI_min = 5;
  103. Guns[10].AGI_max = 10;
  104. Guns[10].PC = 1;
  105.  
  106. Guns[11].name = "Remington";
  107. Guns[11].AT_min = 1;
  108. Guns[11].AT_max = 40;
  109. Guns[11].AGI_min = 50;
  110. Guns[11].AGI_max = 60;
  111. Guns[11].PC = 7;
  112.  
  113. Guns[12].name = "Sniper Rifle";
  114. Guns[12].AT_min = 60;
  115. Guns[12].AT_max = 80;
  116. Guns[12].AGI_min = 50;
  117. Guns[12].AGI_max = 60;
  118. Guns[12].PC = 1;
  119.  
  120. /*Guns[13].name = "Grenade Launcher";
  121.   Guns[13].AT_min = 12;
  122.   Guns[13].AT_max = 24;
  123.   Guns[13].AGI_min = 70;
  124.   Guns[13].AGI_max = 80;
  125.   Guns[13].PC = 1;*/
  126.  
  127. /*Guns[14].name = "Laser Beam Gun";
  128.   Guns[14].AT_min = 16;
  129.   Guns[14].AT_max = 24;
  130.   Guns[14].AGI_min = 20;
  131.   Guns[14].AGI_max = 30;
  132.   Guns[14].PC = 1;*/
  133.  
  134. /*Guns[15].name = "Cannon";
  135.   Guns[15].AT_min = 80;
  136.   Guns[15].AT_max = 120;
  137.   Guns[15].AGI_min = 80;
  138.   Guns[15].AGI_max = 90;
  139.   Guns[15].PC = 1;*/
  140.  
  141. Guns[16].name = "Homing Laser Beam";
  142. Guns[16].AT_min = 8;
  143. Guns[16].AT_max = 12;
  144. Guns[16].AGI_min = 20;
  145. Guns[16].AGI_max = 30;
  146. Guns[16].PC = 5;
  147.  
  148. Guns[17].name = "3-Round Burst";
  149. Guns[17].AT_min = 24;
  150. Guns[17].AT_max = 36;
  151. Guns[17].AGI_min = 20;
  152. Guns[17].AGI_max = 30;
  153. Guns[17].PC = 3;
  154.  
  155. Guns[18].name = "Missile";
  156. Guns[18].AT_min = 300;
  157. Guns[18].AT_max = 500;
  158. Guns[18].AGI_min = 160;
  159. Guns[18].AGI_max = 180;
  160. Guns[18].PC = 1;
  161.  
  162. Guns[19].name = "Mini Uzi";
  163. Guns[19].AT_min = 12;
  164. Guns[19].AT_max = 24;
  165. Guns[19].AGI_min = 5;
  166. Guns[19].AGI_max = 10;
  167. Guns[19].PC = 2;
  168.  
  169. Guns[20].name = "Scattergun";
  170. Guns[20].AT_min = 1;
  171. Guns[20].AT_max = 80;
  172. Guns[20].AGI_min = 50;
  173. Guns[20].AGI_max = 60;
  174. Guns[20].PC = 9;
  175.  
  176. Guns[21].name = "Hunting Gun";
  177. Guns[21].AT_min = 140;
  178. Guns[21].AT_max = 160;
  179. Guns[21].AGI_min = 50;
  180. Guns[21].AGI_max = 60;
  181. Guns[21].PC = 1;
  182.  
  183. /*Guns[22].name = "M9 Grenade";
  184.   Guns[22].AT_min = 18;
  185.   Guns[22].AT_max = 48;
  186.   Guns[22].AGI_min = 20;
  187.   Guns[22].AGI_max = 30;
  188.   Guns[22].PC = 1;*/
  189.  
  190. /*Guns[23].name = "Power Laser Gun";
  191.   Guns[23].AT_min = 24;
  192.   Guns[23].AT_max = 36;
  193.   Guns[23].AGI_min = 20;
  194.   Guns[23].AGI_max = 30;
  195.   Guns[23].PC = 1;*/
  196.  
  197. /*Guns[24].name = "Napalm Bomb";
  198.   Guns[24].AT_min = 0;
  199.   Guns[24].AT_max = 0;
  200.   Guns[24].AGI_min = 160;
  201.   Guns[24].AGI_max = 180;
  202.   Guns[24].PC = 1;*/
  203.  
  204. /*Guns[25].name = "Wave Cannon";
  205.   Guns[25].AT_min = 120;
  206.   Guns[25].AT_max = 180;
  207.   Guns[25].AGI_min = 80;
  208.   Guns[25].AGI_max = 90;
  209.   Guns[25].PC = 1;*/
  210.  
  211. Guns[26].name = "Pierce Homing";
  212. Guns[26].AT_min = 12;
  213. Guns[26].AT_max = 16;
  214. Guns[26].AGI_min = 20;
  215. Guns[26].AGI_max = 30;
  216. Guns[26].PC = 7;
  217.  
  218. Guns[27].name = "Magnum";
  219. Guns[27].AT_min = 80;
  220. Guns[27].AT_max = 120;
  221. Guns[27].AGI_min = 20;
  222. Guns[27].AGI_max = 30;
  223. Guns[27].PC = 1;
  224.  
  225. Guns[28].name = "Micro Uzi";
  226. Guns[28].AT_min = 16;
  227. Guns[28].AT_max = 32;
  228. Guns[28].AGI_min = 5;
  229. Guns[28].AGI_max = 10;
  230. Guns[28].PC = 3;
  231.  
  232. Guns[29].name = "Triple Shotgun";
  233. Guns[29].AT_min = 1;
  234. Guns[29].AT_max = 120;
  235. Guns[29].AGI_min = 50;
  236. Guns[29].AGI_max = 60;
  237. Guns[29].PC = 15;
  238.  
  239. Guns[30].name = "Rail Gun";
  240. Guns[30].AT_min = 300;
  241. Guns[30].AT_max = 320;
  242. Guns[30].AGI_min = 50;
  243. Guns[30].AGI_max = 60;
  244. Guns[30].PC = 1;
  245.  
  246. /*Guns[31].name = "Napalm Gun";
  247.   Guns[31].AT_min = 26;
  248.   Guns[31].AT_max = 96;
  249.   Guns[31].AGI_min = 70;
  250.   Guns[31].AGI_max = 80;
  251.   Guns[31].PC = 1;*/
  252.  
  253. /*Guns[32].name = "Slow Laser Gun";
  254.   Guns[32].AT_min = 32;
  255.   Guns[32].AT_max = 48;
  256.   Guns[32].AGI_min = 20;
  257.   Guns[32].AGI_max = 30;
  258.   Guns[32].PC = 1;*/
  259. }
  260.  
  261. // Sets values to the Gunner character
  262. void getStats(Character &Gunner1, int &LVL){
  263. std::cout << "Enter characters' level: ";
  264. std::cin >> LVL;
  265. std::cout << LVL << std::endl;
  266. Gunner1.STR = LVL - 1; // Evenly distribute STR and DEX
  267. Gunner1.DEX = LVL - 1;
  268. }
  269.  
  270.  
  271. // Calculates DPS for each gun equipped on the gunner character
  272. // How to get DPS: (AT + STR*2%) * (AGI / 2%*DEX)
  273. void calcDPS(Character Gunner1, Gun Guns[], int LVL){
  274. float DPS; // Damage per 60 frames
  275. float DPS_max = 0; // Maximum DPS
  276. int DPS_max_STR, DPS_max_DEX; // STR and DEX allocation for maximum DPS
  277. int AGImin, AGImax; // Minimum and maximum ATtack damage
  278. float AGI; // Average AGIlity (number of frames between shots)
  279. int ATmin, ATmax; // Minimum and maximum ATtack damage
  280. float AT; // Average ATtack damage
  281. int range = (LVL - 1) * 2; // Range of stats to calculate (currently set to go from 0 to max)
  282.  
  283. for (int i = 0; i < weapons; i++){ // Runs for the number of weapons
  284.  
  285. if (Guns[i].name == "") continue; // Skip over commented out Guns
  286.  
  287. for (int k = 0; k <= range; k++){ // Loop for going through full range of STR/DEX
  288.  
  289. // Calculates average AT
  290. ATmin = Guns[i].AT_min * (1 + 0.02 * (Gunner1.STR - (range/2 - k))); // Minimum AT calculation
  291. ATmax = Guns[i].AT_max * (1 + 0.02 * (Gunner1.STR - (range/2 - k))); // Maximum AT calculation
  292. AT = (ATmin + ATmax) / 2.; // Average AT calculation
  293.  
  294. // Calculates average AGI
  295. AGImin = Guns[i].AGI_min / (1 + 0.02 * (Gunner1.DEX + range/2 - k)); // Minimum AGI calculation
  296. if (AGImin < 5) AGImin = 5; // AGImin caps at 5
  297. AGImax = Guns[i].AGI_max / (1 + 0.02 * (Gunner1.DEX + range/2 - k)); // Maximum AGI calculation
  298. if (AGImax < 10) AGImax = 10; // AGImin caps at 10
  299. AGI = (AGImin + AGImax) / 2.; // Average AGI calculation
  300.  
  301. // Calculates average DPS
  302. DPS = AT * (60 / AGI);
  303.  
  304. // Calculates maximum DPS
  305. if (DPS > DPS_max){
  306. DPS_max = DPS; // Store maximum DPS
  307. DPS_max_STR = Gunner1.STR - (range/2 - k); // Store STR parameter of maximum DPS
  308. DPS_max_DEX = Gunner1.DEX + (range/2 - k); // Store DEX parameter of maximum DPS
  309. }
  310. }
  311.  
  312. // Outputs table of optimum STR/DEX allocation for maximum DPS of each Gun
  313. std::cout << "DPS max for " << std::setw(17) << Guns[i].name << ": ";
  314. std::cout << "STR " << std::setw(3) << DPS_max_STR; // STR
  315. std::cout << " DEX " << std::setw(3) << DPS_max_DEX; // DEX
  316. std::cout << " DPS = " << DPS_max * Guns[i].PC << std::endl; // DPS
  317. DPS_max = DPS_max_STR = DPS_max_DEX = 0; // Reset maximums
  318. }
  319. std::cout << std::endl;
  320. }
  321.  
  322. int main(){
  323. Character Gunner1; // Gunner character
  324. Gun Guns[weapons]; // Array of guns to calculate
  325. int LVL; // Level of your team
  326.  
  327. setGuns(Guns);
  328.  
  329. getStats(Gunner1, LVL);
  330. while (LVL){
  331. calcDPS(Gunner1, Guns, LVL);
  332. getStats(Gunner1, LVL);
  333. }
  334.  
  335. return 0;
  336. }
  337.  
Success #stdin #stdout 0.01s 5300KB
stdin
15
14
13
12
11
10
0
stdout
Enter characters' level: 15
DPS max for               Gun: STR  25  DEX   3  DPS = 15.6522
DPS max for           Handgun: STR  19  DEX   9  DPS = 39.5122
DPS max for    Submachine-gun: STR  25  DEX   3  DPS = 72
DPS max for           Shotgun: STR  15  DEX  13  DPS = 94.186
DPS max for             Rifle: STR  15  DEX  13  DPS = 54.4186
DPS max for      Homing Laser: STR  19  DEX   9  DPS = 79.0244
DPS max for           Beretta: STR  15  DEX  13  DPS = 121.579
DPS max for               Uzi: STR  28  DEX   0  DPS = 220
DPS max for         Remington: STR  15  DEX  13  DPS = 258.837
DPS max for      Sniper Rifle: STR  15  DEX  13  DPS = 126.977
DPS max for Homing Laser Beam: STR  19  DEX   9  DPS = 197.561
DPS max for     3-Round Burst: STR  15  DEX  13  DPS = 364.737
DPS max for           Missile: STR  15  DEX  13  DPS = 232.836
DPS max for          Mini Uzi: STR  28  DEX   0  DPS = 440
DPS max for        Scattergun: STR  15  DEX  13  DPS = 659.302
DPS max for       Hunting Gun: STR  15  DEX  13  DPS = 272.093
DPS max for     Pierce Homing: STR  22  DEX   6  DPS = 390.698
DPS max for            Magnum: STR  15  DEX  13  DPS = 410.526
DPS max for         Micro Uzi: STR  27  DEX   1  DPS = 876
DPS max for    Triple Shotgun: STR  15  DEX  13  DPS = 1643.02
DPS max for          Rail Gun: STR  15  DEX  13  DPS = 562.326

Enter characters' level: 14
DPS max for               Gun: STR   0  DEX  26  DPS = 15
DPS max for           Handgun: STR  13  DEX  13  DPS = 39.4737
DPS max for    Submachine-gun: STR  25  DEX   1  DPS = 72
DPS max for           Shotgun: STR  10  DEX  16  DPS = 91.4634
DPS max for             Rifle: STR  10  DEX  16  DPS = 52.6829
DPS max for      Homing Laser: STR  13  DEX  13  DPS = 78.9474
DPS max for           Beretta: STR  13  DEX  13  DPS = 118.421
DPS max for               Uzi: STR  25  DEX   1  DPS = 216
DPS max for         Remington: STR  10  DEX  16  DPS = 250.976
DPS max for      Sniper Rifle: STR  10  DEX  16  DPS = 122.927
DPS max for Homing Laser Beam: STR  13  DEX  13  DPS = 197.368
DPS max for     3-Round Burst: STR  13  DEX  13  DPS = 355.263
DPS max for           Missile: STR  13  DEX  13  DPS = 225.672
DPS max for          Mini Uzi: STR  25  DEX   1  DPS = 432
DPS max for        Scattergun: STR  10  DEX  16  DPS = 638.78
DPS max for       Hunting Gun: STR  10  DEX  16  DPS = 263.415
DPS max for     Pierce Homing: STR  13  DEX  13  DPS = 386.842
DPS max for            Magnum: STR  13  DEX  13  DPS = 396.316
DPS max for         Micro Uzi: STR  25  DEX   1  DPS = 864
DPS max for    Triple Shotgun: STR  10  DEX  16  DPS = 1591.46
DPS max for          Rail Gun: STR  13  DEX  13  DPS = 544.884

Enter characters' level: 13
DPS max for               Gun: STR   0  DEX  24  DPS = 14.5455
DPS max for           Handgun: STR  13  DEX  11  DPS = 37.5
DPS max for    Submachine-gun: STR  19  DEX   5  DPS = 64
DPS max for           Shotgun: STR  10  DEX  14  DPS = 88.2353
DPS max for             Rifle: STR  15  DEX   9  DPS = 50.8696
DPS max for      Homing Laser: STR  13  DEX  11  DPS = 75
DPS max for           Beretta: STR  11  DEX  13  DPS = 113.684
DPS max for               Uzi: STR  23  DEX   1  DPS = 208
DPS max for         Remington: STR  10  DEX  14  DPS = 242.118
DPS max for      Sniper Rifle: STR  15  DEX   9  DPS = 118.696
DPS max for Homing Laser Beam: STR  13  DEX  11  DPS = 187.5
DPS max for     3-Round Burst: STR  11  DEX  13  DPS = 341.053
DPS max for           Missile: STR  11  DEX  13  DPS = 218.507
DPS max for          Mini Uzi: STR  23  DEX   1  DPS = 416
DPS max for        Scattergun: STR  15  DEX   9  DPS = 616.304
DPS max for       Hunting Gun: STR  11  DEX  13  DPS = 254.651
DPS max for     Pierce Homing: STR  13  DEX  11  DPS = 367.5
DPS max for            Magnum: STR  11  DEX  13  DPS = 383.684
DPS max for         Micro Uzi: STR  24  DEX   0  DPS = 840
DPS max for    Triple Shotgun: STR  11  DEX  13  DPS = 1538.37
DPS max for          Rail Gun: STR  11  DEX  13  DPS = 527.442

Enter characters' level: 12
DPS max for               Gun: STR   0  DEX  22  DPS = 14.5455
DPS max for           Handgun: STR  13  DEX   9  DPS = 36.5854
DPS max for    Submachine-gun: STR  19  DEX   3  DPS = 64
DPS max for           Shotgun: STR  15  DEX   7  DPS = 85.2632
DPS max for             Rifle: STR  15  DEX   7  DPS = 49.2632
DPS max for      Homing Laser: STR  13  DEX   9  DPS = 73.1707
DPS max for           Beretta: STR   9  DEX  13  DPS = 110.526
DPS max for               Uzi: STR  21  DEX   1  DPS = 204
DPS max for         Remington: STR   9  DEX  13  DPS = 234.419
DPS max for      Sniper Rifle: STR  15  DEX   7  DPS = 114.947
DPS max for Homing Laser Beam: STR  13  DEX   9  DPS = 182.927
DPS max for     3-Round Burst: STR   9  DEX  13  DPS = 331.579
DPS max for           Missile: STR   9  DEX  13  DPS = 211.343
DPS max for          Mini Uzi: STR  21  DEX   1  DPS = 408
DPS max for        Scattergun: STR  15  DEX   7  DPS = 596.842
DPS max for       Hunting Gun: STR  15  DEX   7  DPS = 246.316
DPS max for     Pierce Homing: STR  13  DEX   9  DPS = 358.537
DPS max for            Magnum: STR   9  DEX  13  DPS = 371.053
DPS max for         Micro Uzi: STR  22  DEX   0  DPS = 828
DPS max for    Triple Shotgun: STR  15  DEX   7  DPS = 1487.37
DPS max for          Rail Gun: STR   9  DEX  13  DPS = 510

Enter characters' level: 11
DPS max for               Gun: STR   0  DEX  20  DPS = 13.7143
DPS max for           Handgun: STR  13  DEX   7  DPS = 34.8837
DPS max for    Submachine-gun: STR  19  DEX   1  DPS = 64
DPS max for           Shotgun: STR  10  DEX  10  DPS = 82.4176
DPS max for             Rifle: STR  10  DEX  10  DPS = 47.4725
DPS max for      Homing Laser: STR  13  DEX   7  DPS = 69.7674
DPS max for           Beretta: STR   7  DEX  13  DPS = 107.368
DPS max for               Uzi: STR  19  DEX   1  DPS = 196
DPS max for         Remington: STR   9  DEX  11  DPS = 226.517
DPS max for      Sniper Rifle: STR   7  DEX  13  DPS = 110.93
DPS max for Homing Laser Beam: STR  13  DEX   7  DPS = 174.419
DPS max for     3-Round Burst: STR   7  DEX  13  DPS = 322.105
DPS max for           Missile: STR   7  DEX  13  DPS = 204.179
DPS max for          Mini Uzi: STR  19  DEX   1  DPS = 392
DPS max for        Scattergun: STR   7  DEX  13  DPS = 577.674
DPS max for       Hunting Gun: STR  13  DEX   7  DPS = 238.105
DPS max for     Pierce Homing: STR   7  DEX  13  DPS = 342.632
DPS max for            Magnum: STR   7  DEX  13  DPS = 358.421
DPS max for         Micro Uzi: STR  19  DEX   1  DPS = 792
DPS max for    Triple Shotgun: STR  13  DEX   7  DPS = 1440
DPS max for          Rail Gun: STR  13  DEX   7  DPS = 493.263

Enter characters' level: 10
DPS max for               Gun: STR   0  DEX  18  DPS = 13.3333
DPS max for           Handgun: STR   9  DEX   9  DPS = 33.6585
DPS max for    Submachine-gun: STR  13  DEX   5  DPS = 60
DPS max for           Shotgun: STR   5  DEX  13  DPS = 80.2326
DPS max for             Rifle: STR   5  DEX  13  DPS = 46.0465
DPS max for      Homing Laser: STR   9  DEX   9  DPS = 67.3171
DPS max for           Beretta: STR   5  DEX  13  DPS = 102.632
DPS max for               Uzi: STR  17  DEX   1  DPS = 192
DPS max for         Remington: STR   5  DEX  13  DPS = 219.767
DPS max for      Sniper Rifle: STR   5  DEX  13  DPS = 107.442
DPS max for Homing Laser Beam: STR   9  DEX   9  DPS = 168.293
DPS max for     3-Round Burst: STR   5  DEX  13  DPS = 307.895
DPS max for           Missile: STR   9  DEX   9  DPS = 197.352
DPS max for          Mini Uzi: STR  17  DEX   1  DPS = 384
DPS max for        Scattergun: STR   5  DEX  13  DPS = 558.837
DPS max for       Hunting Gun: STR  11  DEX   7  DPS = 230.526
DPS max for     Pierce Homing: STR   5  DEX  13  DPS = 331.579
DPS max for            Magnum: STR   5  DEX  13  DPS = 347.368
DPS max for         Micro Uzi: STR  18  DEX   0  DPS = 768
DPS max for    Triple Shotgun: STR  11  DEX   7  DPS = 1392.63
DPS max for          Rail Gun: STR  11  DEX   7  DPS = 477.474

Enter characters' level: 0