Advertisement
Guest User

Untitled

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