Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. @Override
  2. public List<SpellDpsDetailStats> getSpellDpsDetailStatsBySimulationRunId(Integer simulationRunId) {
  3.  
  4. Double avgDetailDps = 0.0;
  5. Double avgDetailResistedDps = 0.0;
  6. Double avgDetailAbsorbedDps = 0.0;
  7.  
  8. List<SpellDpsDetailStats> spellDpsDetailStats = new ArrayList<>();
  9. List<SpellDpsDetailGrouped> spellDpsDetailGrouped = spelldmgRepository.findSpellDmgDetailResistedAborbedTotalBySimulationId(simulationRunId);
  10.  
  11. for(SpellDpsDetailGrouped sd : spellDpsDetailGrouped) {
  12. try {
  13. double fightLength = getFightLengthInSeconds(simulationRunId);
  14. avgDetailDps = sd.getTotalDamage() / fightLength;
  15. avgDetailResistedDps = sd.getTotalResisted() / fightLength;
  16. avgDetailAbsorbedDps = sd.getTotalAbsorbed() / fightLength;
  17.  
  18. } catch (Exception e) {
  19. e.printStackTrace();
  20. }
  21.  
  22. Long normalCounter = spelldmgRepository.findCountNormalHitsBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  23. Long missCounter = spelldmgRepository.findCountMissBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  24. Long resistCounter = spelldmgRepository.findCountResistHitsBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  25. Long dodgeCounter = spelldmgRepository.findCountDodgeBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  26. Long parryCounter = spelldmgRepository.findCountParryBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  27. Long critCounter = spelldmgRepository.findCountCritHitsBySimulationIdAndSpellId(simulationRunId, sd.getSpellId());
  28.  
  29. Double normalRate = (normalCounter / (double) sd.getCountTotalHits()) * 100;
  30. Double missRate = (missCounter / (double) sd.getCountTotalHits()) * 100;
  31. Double resistRate = (resistCounter / (double) sd.getCountTotalHits()) * 100;
  32. Double dodgeRate = (dodgeCounter / (double) sd.getCountTotalHits()) * 100;
  33. Double parryRate = (parryCounter / (double) sd.getCountTotalHits()) * 100;
  34. Double critRate = (critCounter / (double) sd.getCountTotalHits()) * 100;
  35.  
  36. SpellDpsDetailStats spellDpsDetailStatsEntry = new SpellDpsDetailStats(sd.getSpellName(), avgDetailDps, avgDetailResistedDps, avgDetailAbsorbedDps, resistRate, critRate, normalRate, missRate, dodgeRate, parryRate, sd.getTotalDamage(), normalCounter, sd.getCountTotalHits());
  37. spellDpsDetailStats.add(spellDpsDetailStatsEntry);
  38. }
  39.  
  40. return spellDpsDetailStats;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement