Guest User

Untitled

a guest
Feb 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. public static void startTurn() {
  2. hps = new int[8192];
  3. best = new int[8192];
  4. current = new int[8192];
  5. shooters = new int[Game.allyCombat.size()];
  6. targets = new int[8192][0];
  7. targetsLength = new int[8192];
  8. int shootIndex = 0;
  9.  
  10. Arrays.fill(best, -1);
  11. Arrays.fill(current, -1);
  12.  
  13. for (Robot r: Game.allEnemies) {
  14. hps[r.predictableId()] = (int) r.health;
  15. types[r.predictableId()] = r.unitType().ordinal();
  16. }
  17. for (Robot r: Game.allyCombat) {
  18. if (r.unitType() == UnitType.Healer) continue;
  19. if (r.attackHeat() >= 10) continue;
  20. shooters[shootIndex++] = r.predictableId();
  21. damage[r.predictableId()] = Constants.attackDamage(r.unitType());
  22. Robot[] myTargets = Game.senseNearbyUnits(r.tile(), Constants.attackRange(r.unitType()), Game.enemy());
  23. targets[r.predictableId()] = new int[256];
  24. for (Robot e: myTargets) {
  25. targets[r.predictableId()][targetsLength[r.predictableId()]++] = e.predictableId();
  26. if (hps[e.predictableId()] > 0) {
  27. if (r.unitType() == UnitType.Mage) {
  28. Robot[] adj = Game.senseNearbyUnits(e.tile(), 2);
  29. for (Robot f: adj) {
  30. aoe[e.predictableId()][aoeLength[e.predictableId()]++] = f.predictableId();
  31. }
  32. } else {
  33. current[r.predictableId()] = e.predictableId();
  34. hps[e.predictableId()] -= damage[r.predictableId()];
  35. }
  36. }
  37. }
  38. if (Movement.moves.containsKey(r) && Movement.moves.get(r) != Direction.Center) {
  39. myTargets = Game.senseNearbyUnits(r.tile().add(Movement.moves.get(r)), Constants.attackRange(r.unitType()), Game.enemy());
  40. outer: for (Robot e: myTargets) {
  41. for (int i = 0; i < targetsLength[r.predictableId()]; i++) {
  42. if (targets[r.predictableId()][i] == e.predictableId()) continue outer;
  43. }
  44. targets[r.predictableId()][targetsLength[r.predictableId()]++] = e.predictableId();
  45. targetsLength[r.predictableId()]++;
  46. if (hps[e.predictableId()] > 0) {
  47. if (r.unitType() == UnitType.Mage) {
  48. Robot[] adj = Game.senseNearbyUnits(e.tile(), 2);
  49. for (Robot f: adj) {
  50. aoe[e.predictableId()][aoeLength[e.predictableId()]++] = f.predictableId();
  51. }
  52. } else {
  53. current[r.predictableId()] = e.predictableId();
  54. hps[e.predictableId()] -= damage[r.predictableId()];
  55. }
  56. }
  57. }
  58. }
  59. }
  60. }
Add Comment
Please, Sign In to add comment