Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <iomanip>
- using namespace std;
- int estimatedDamage(int missQ, int dmgQ, int maxQ, int avoidQ, int critQ, double baseMin, double baseMax)//# of bonuses
- {
- ofstream results;
- results.open("estimatedDamage.txt", ios::app);
- double miss, dmg, max, avoid, crit, damage;
- int hits = 155;
- miss = 6.75;
- dmg = 5;
- max = 10;
- avoid = 5;
- crit = 5;//5128 / 7692
- // double baseMin = 5128;
- // double baseMax = 7692;
- double noEquipDmg = (baseMin + baseMax)/2 * 1.2 * 1.2 * 1.2 * 1.125 * 0.875 * (1 + 5*(1+2/3)/100) * hits;
- miss = 0.875 + miss * missQ / 100;
- if(miss > 1)
- miss = 1;//<--
- dmg = 1 + dmg * dmgQ / 100;//1
- max = dmg + max * maxQ / 100;//1.6
- avoid = 1.05 + avoid * avoidQ / 100;
- if(avoid > 1.4)
- avoid = 1.4;
- avoid = (avoid - 1) * (1 + double(2)/double(3)) + 1;//1.25
- crit = 1.125 + crit * critQ /100; //1.125
- if(crit > 1.4)
- crit = 1.4;
- //(3948 * 1 + 5923 * 1.6) / 2 * 1.2 * 1.2 * 1.2 * 1.125 * 1.25 * 1 * 155 = 2528225
- //(3948 * 1 + 5923 * 1.1) / 2 * 1.2 * 1.2 * 1.2 * 1.125 * 1.(6)* 1 * 155 = 2627324
- damage = (baseMin * dmg + baseMax * max) / 2 * 1.2 * 1.2 * 1.2 * crit * avoid * miss * hits;
- results<<"\n\n"<<missQ<<" miss + "<<dmgQ<<" damage + "<<maxQ<<" maximum damage + "<<avoidQ<<" avoid + "<<critQ<<" critical\n";
- results<<"Estimated damage = "<<int(damage)<<" which is "<<double(damage)/double(noEquipDmg) * 100 - 100<<"% more than no equipment";
- //results<<"Dmg:"<<dmg<<" max:"<<max<<" crit:"<<crit<<" avoid:"<<avoid<<" miss:"<<miss<<"\n\n";
- return damage;
- }
- int main()
- {
- double baseMin;
- double baseMax;
- double rank;
- cout<<"E-sim estimated damage with best found equipment calculator V1.0 by TheJoris\n\n";
- cout<<"Enter your minimum BASE HIT: ";
- cin>>baseMin;
- cout<<"Enter your maximum BASE HIT: ";
- cin>>baseMax;
- // cout<<"Enter your military rank bonus: ";
- // cin>>rank;
- ofstream results("estimatedDamage.txt");
- results<<"Calculating estimated damage with different equipment sets:";
- results.close();
- int miss = 0, dmg = 0, max = 0, avoid = 0, crit = 0;//# of bonuses
- int top10[10][6]={0};
- int maxDmg = 0, currDmg;
- int swapA, swapB, swapC, swapD, swapE, swapDmg;
- for(int a = 0; a < 3; a++)//miss cycle
- {
- for(int b = 0; b < 11 - a; b++)//dmg cycle
- {
- for(int c = 0; c < 11 - a - b; c++)//max cycle
- {
- for(int d = 0; d < 11 - a - b - c; d++)//avoid cycle
- {
- currDmg = estimatedDamage(a, b, c, d, 10 - a - b - c - d, baseMin, baseMax);//last one is critical chance
- if( currDmg > maxDmg)
- maxDmg = currDmg;
- for(int i = 0; i < 10; i++)
- {
- if(currDmg > top10[i][0])
- {
- for(int j = 9; j>i; j--)
- {
- top10[j][0] = top10[j-1][0];
- top10[j][1] = top10[j-1][1];
- top10[j][2] = top10[j-1][2];
- top10[j][3] = top10[j-1][3];
- top10[j][4] = top10[j-1][4];
- top10[j][5] = top10[j-1][5];
- }
- top10[i][0] = currDmg;
- top10[i][1] = a;
- top10[i][2] = b;
- top10[i][3] = c;
- top10[i][4] = d;
- top10[i][5] = 10 - a - b - c - d;
- break;
- }
- }
- }
- }
- }
- }
- ofstream top("top10equip.txt");
- top<<"This is the top 10 calculated equipment:";
- for(int i = 0; i < 10; i++)
- {
- top<<"\n\n#"<<i + 1<<endl;
- top<<top10[i][1]<<" miss + "<<top10[i][2]<<" damage + "<<top10[i][3]<<" maximum damage + "<<top10[i][4]<<" avoid + "<<top10[i][5]<<" critical";
- top<<"\nEstimated damage = "<<top10[i][0];
- }
- cout<<"\nMaximum damage found = "<<maxDmg<<"\n\nCheck your best equipment sets on \"top 10equip.txt\"\n\nCheck all the equipment sets on \"estimatedDamage.txt\"";
- cin.get();
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment