Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. public class WN8Formula {
  2.  
  3. public static double calculate(List<List<AccountBattleInfo>> accountBattleInfoData, TankExpectedValues tankExpectedValues) {
  4. double playerDamageTotal = 0.0, playerWinBattlesTotal = 0;
  5. double playerFragsTotal = 0, playerSpottedTotal = 0, playerDefTotal = 0;
  6.  
  7. double expectedDamageTotal = 0.0000, expectedWinBattlesTotal = 0.0000;
  8. double expectedFragsTotal = 0.0000, expectedSpottedTotal = 0.0000, expectedDefTotal = 0.0000;
  9. int allCountBattles = 0;
  10. int allRandomBattles = 0;
  11. int allCompanyBattles = 0;
  12.  
  13. for(int i=0; i< accountBattleInfoData.size(); i++) {
  14. for(int j=0; j<accountBattleInfoData.get(i).size(); j++) {
  15. //get(i) - игрок клана. //get(j) - танк
  16. int gameRandomTankBattles = accountBattleInfoData.get(i).get(j).getRadndoStatistics().getBattles();
  17. int gameCompanyTankBattles = accountBattleInfoData.get(i).get(j).getCompanyStatics().getBattles();
  18. allRandomBattles = gameRandomTankBattles;
  19. allCompanyBattles = gameCompanyTankBattles;
  20. //System.out.println(gameTankBattles);
  21. allCountBattles += gameRandomTankBattles + gameCompanyTankBattles;
  22. //if(gameTankBattles == 0) continue;
  23. int gameTankId = accountBattleInfoData.get(i).get(j).getTankId();
  24.  
  25. playerDamageTotal += (accountBattleInfoData.get(i).get(j).getRadndoStatistics().getDamageDealt() +
  26. accountBattleInfoData.get(i).get(j).getCompanyStatics().getDamageDealt());
  27.  
  28. playerFragsTotal += (accountBattleInfoData.get(i).get(j).getRadndoStatistics().getFrags()
  29. + accountBattleInfoData.get(i).get(j).getCompanyStatics().getFrags());
  30.  
  31. playerSpottedTotal += (accountBattleInfoData.get(i).get(j).getRadndoStatistics().getSpottedTanks()
  32. + accountBattleInfoData.get(i).get(j).getCompanyStatics().getSpottedTanks());
  33.  
  34. playerDefTotal += (accountBattleInfoData.get(i).get(j).getRadndoStatistics().getDefencePoints()
  35. +accountBattleInfoData.get(i).get(j).getCompanyStatics().getDefencePoints());
  36.  
  37. playerWinBattlesTotal += (accountBattleInfoData.get(i).get(j).getRadndoStatistics().getWinRatio() * gameRandomTankBattles
  38. + accountBattleInfoData.get(i).get(j). getCompanyStatics().getWinRatio()* gameCompanyTankBattles);
  39.  
  40. for(int k=0; k<tankExpectedValues.getData().size(); k++) {
  41. if(tankExpectedValues.getData().get(k).getIdNum() == gameTankId ) {
  42.  
  43. expectedDamageTotal += tankExpectedValues.getData().get(k).getExpDamage() * (gameRandomTankBattles + gameCompanyTankBattles);
  44. expectedFragsTotal += tankExpectedValues.getData().get(k).getExpFrag() * (gameRandomTankBattles + gameCompanyTankBattles);
  45. expectedSpottedTotal += tankExpectedValues.getData().get(k).getExpSpot() * (gameRandomTankBattles + gameCompanyTankBattles);
  46. expectedDefTotal += tankExpectedValues.getData().get(k).getExpDef() * (gameRandomTankBattles + gameCompanyTankBattles);
  47. expectedWinBattlesTotal += tankExpectedValues.getData().get(k).getExpWinRate() * (gameRandomTankBattles + gameCompanyTankBattles);
  48.  
  49. /* expectedDamageTotal = 1162.12 * gameTankBattles;
  50. expectedFragsTotal = 0.88 * gameTankBattles ;
  51. expectedSpottedTotal = 1.31 * gameTankBattles;
  52. expectedDefTotal = 0.91 * gameTankBattles;
  53. expectedWinBattlesTotal = 51.62 * gameTankBattles; */
  54. }
  55. }
  56. }
  57. }
  58.  
  59. double rDamage = playerDamageTotal/expectedDamageTotal;
  60. double rSpot = ((double)playerSpottedTotal/expectedSpottedTotal);
  61. double rFrag = ((double)playerFragsTotal/expectedFragsTotal);
  62. double rDef = ((double) playerDefTotal/expectedDefTotal);
  63. double rWin = playerWinBattlesTotal/expectedWinBattlesTotal;
  64.  
  65. double rDamageC = Math.max(0, (rDamage - 0.22) / (1 - 0.22));
  66. double rSpotC = Math.max(0, Math.min(rDamageC + 0.1, (rSpot - 0.38) / (1 - 0.38)));
  67. double rFragC = Math.max(0, Math.min(rDamageC + 0.2, (rFrag - 0.12) / (1 - 0.12)));
  68. double rDefC = Math.max(0, Math.min(rDamageC + 0.1, (rDef - 0.10) / (1 - 0.10)));
  69. double rWinC = Math.max(0, (rWin - 0.71) / (1 - 0.71));
  70.  
  71. // Вывод боев на экран
  72. System.out.println(allRandomBattles);
  73. System.out.println(allCompanyBattles);
  74. System.out.println(allCountBattles);
  75.  
  76. double WN8 = 980 * rDamageC
  77. + 210 * rDamageC * rFragC
  78. + 155 * rFragC * rSpotC
  79. + 75 * rDefC * rFragC
  80. + 145 * Math.min(1.8, rWinC);
  81.  
  82.  
  83.  
  84. return WN8;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement