Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /*
  2. * Gets the next two hits from the queue.
  3. */
  4. List<Hit> hits = player.getHitQueue();
  5. Hit first = null;
  6. if(hits.size() > 0) {
  7. for(int i = 0; i < hits.size(); i++) {
  8. Hit hit = hits.get(i);
  9. if(hit.getDelay() < 1) {
  10. first = hit;
  11. hits.remove(hit);
  12. break;
  13. }
  14. }
  15. }
  16. if (first != null) {
  17. player.setPrimaryHit(first);
  18. player.getUpdateFlags().flag(UpdateFlag.HIT);
  19. }
  20. Hit second = null;
  21. if(hits.size() > 0) {
  22. for(int i = 0; i < hits.size(); i++) {
  23. Hit hit = hits.get(i);
  24. if(hit.getDelay() < 1) {
  25. second = hit;
  26. hits.remove(hit);
  27. break;
  28. }
  29. }
  30. }
  31. if (second != null) {
  32. player.setSecondaryHit(second);
  33. player.getUpdateFlags().flag(UpdateFlag.HIT_2);
  34. }
  35. if(hits.size() > 0) {//tells us we still have more hits
  36. Iterator<Hit> hitIt = hits.iterator();
  37. while(hitIt.hasNext()) {
  38. Hit hit = hitIt.next();
  39. if(hit.getDelay() > 0) {
  40. hit.setDelay(hit.getDelay() - 1);
  41. }
  42. if(hit.getHitPriority() == HitPriority.LOW_PRIORITY) {
  43. hitIt.remove();
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement