Guest User

E-sim best equipment + estimated damage calculator

a guest
May 10th, 2014
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <iomanip>
  4.  
  5. using namespace std;
  6.  
  7. int estimatedDamage(int missQ, int dmgQ, int maxQ, int avoidQ, int critQ, double baseMin, double baseMax)//# of bonuses
  8. {
  9.     ofstream results;
  10.     results.open("estimatedDamage.txt", ios::app);
  11.     double miss, dmg, max, avoid, crit, damage;
  12.     int hits = 155;
  13.     miss = 6.75;
  14.     dmg = 5;
  15.     max = 10;
  16.     avoid = 5;
  17.     crit = 5;//5128 / 7692
  18. //    double baseMin = 5128;
  19. //    double baseMax = 7692;
  20.  
  21.     double noEquipDmg = (baseMin + baseMax)/2 * 1.2 * 1.2 * 1.2 * 1.125 * 0.875 * (1 + 5*(1+2/3)/100) * hits;
  22.  
  23.     miss = 0.875 + miss * missQ / 100;
  24.     if(miss > 1)
  25.         miss = 1;//<--
  26.  
  27.     dmg = 1 + dmg * dmgQ / 100;//1
  28.  
  29.     max = dmg + max * maxQ / 100;//1.6
  30.  
  31.     avoid = 1.05 + avoid * avoidQ / 100;
  32.     if(avoid > 1.4)
  33.         avoid = 1.4;
  34.     avoid = (avoid - 1) * (1 + double(2)/double(3)) + 1;//1.25
  35.  
  36.     crit = 1.125 + crit * critQ /100; //1.125
  37.     if(crit > 1.4)
  38.         crit = 1.4;
  39.     //(3948 * 1 + 5923 * 1.6) / 2 * 1.2 * 1.2 * 1.2 * 1.125 * 1.25 * 1 * 155 = 2528225
  40.     //(3948 * 1 + 5923 * 1.1) / 2 * 1.2 * 1.2 * 1.2 * 1.125 * 1.(6)* 1 * 155 = 2627324
  41.     damage = (baseMin * dmg + baseMax * max) / 2 * 1.2 * 1.2 * 1.2 * crit * avoid * miss * hits;
  42.  
  43.     results<<"\n\n"<<missQ<<" miss + "<<dmgQ<<" damage + "<<maxQ<<" maximum damage + "<<avoidQ<<" avoid + "<<critQ<<" critical\n";
  44.     results<<"Estimated damage = "<<int(damage)<<" which is "<<double(damage)/double(noEquipDmg) * 100 - 100<<"% more than no equipment";
  45.     //results<<"Dmg:"<<dmg<<" max:"<<max<<" crit:"<<crit<<" avoid:"<<avoid<<" miss:"<<miss<<"\n\n";
  46.  
  47.     return damage;
  48. }
  49.  
  50. int main()
  51. {
  52.     double baseMin;
  53.     double baseMax;
  54.     double rank;
  55.     cout<<"E-sim estimated damage with best found equipment calculator V1.0 by TheJoris\n\n";
  56.     cout<<"Enter your minimum BASE HIT: ";
  57.     cin>>baseMin;
  58.     cout<<"Enter your maximum BASE HIT: ";
  59.     cin>>baseMax;
  60. //    cout<<"Enter your military rank bonus: ";
  61. //    cin>>rank;
  62.     ofstream results("estimatedDamage.txt");
  63.     results<<"Calculating estimated damage with different equipment sets:";
  64.     results.close();
  65.     int miss = 0, dmg = 0, max = 0, avoid = 0, crit = 0;//# of bonuses
  66.     int top10[10][6]={0};
  67.     int maxDmg = 0, currDmg;
  68.     int swapA, swapB, swapC, swapD, swapE, swapDmg;
  69.     for(int a = 0; a < 3; a++)//miss cycle
  70.     {
  71.         for(int b = 0; b < 11 - a; b++)//dmg cycle
  72.         {
  73.             for(int c = 0; c < 11 - a - b; c++)//max cycle
  74.             {
  75.                 for(int d = 0; d < 11 - a - b - c; d++)//avoid cycle
  76.                 {
  77.                     currDmg = estimatedDamage(a, b, c, d, 10 - a - b - c - d, baseMin, baseMax);//last one is critical chance
  78.                     if( currDmg > maxDmg)
  79.                         maxDmg = currDmg;
  80.                     for(int i = 0; i < 10; i++)
  81.                     {
  82.                         if(currDmg > top10[i][0])
  83.                         {
  84.                             for(int j = 9; j>i; j--)
  85.                             {
  86.                                 top10[j][0] = top10[j-1][0];
  87.                                 top10[j][1] = top10[j-1][1];
  88.                                 top10[j][2] = top10[j-1][2];
  89.                                 top10[j][3] = top10[j-1][3];
  90.                                 top10[j][4] = top10[j-1][4];
  91.                                 top10[j][5] = top10[j-1][5];
  92.                             }
  93.                             top10[i][0] = currDmg;
  94.                             top10[i][1] = a;
  95.                             top10[i][2] = b;
  96.                             top10[i][3] = c;
  97.                             top10[i][4] = d;
  98.                             top10[i][5] = 10 - a - b - c - d;
  99.                             break;
  100.                         }
  101.                     }
  102.                 }
  103.             }
  104.         }
  105.     }
  106.     ofstream top("top10equip.txt");
  107.     top<<"This is the top 10 calculated equipment:";
  108.     for(int i = 0; i < 10; i++)
  109.     {
  110.         top<<"\n\n#"<<i + 1<<endl;
  111.         top<<top10[i][1]<<" miss + "<<top10[i][2]<<" damage + "<<top10[i][3]<<" maximum damage + "<<top10[i][4]<<" avoid + "<<top10[i][5]<<" critical";
  112.         top<<"\nEstimated damage = "<<top10[i][0];
  113.     }
  114.     cout<<"\nMaximum damage found = "<<maxDmg<<"\n\nCheck your best equipment sets on \"top 10equip.txt\"\n\nCheck all the equipment sets on \"estimatedDamage.txt\"";
  115.     cin.get();
  116.     cin.get();
  117.     return 0;
  118. }
Advertisement
Add Comment
Please, Sign In to add comment