Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void startTurn() {
- hps = new int[8192];
- best = new int[8192];
- current = new int[8192];
- shooters = new int[Game.allyCombat.size()];
- targets = new int[8192][0];
- targetsLength = new int[8192];
- int shootIndex = 0;
- Arrays.fill(best, -1);
- Arrays.fill(current, -1);
- for (Robot r: Game.allEnemies) {
- hps[r.predictableId()] = (int) r.health;
- types[r.predictableId()] = r.unitType().ordinal();
- }
- for (Robot r: Game.allyCombat) {
- if (r.unitType() == UnitType.Healer) continue;
- if (r.attackHeat() >= 10) continue;
- shooters[shootIndex++] = r.predictableId();
- damage[r.predictableId()] = Constants.attackDamage(r.unitType());
- Robot[] myTargets = Game.senseNearbyUnits(r.tile(), Constants.attackRange(r.unitType()), Game.enemy());
- targets[r.predictableId()] = new int[256];
- for (Robot e: myTargets) {
- targets[r.predictableId()][targetsLength[r.predictableId()]++] = e.predictableId();
- if (hps[e.predictableId()] > 0) {
- if (r.unitType() == UnitType.Mage) {
- Robot[] adj = Game.senseNearbyUnits(e.tile(), 2);
- for (Robot f: adj) {
- aoe[e.predictableId()][aoeLength[e.predictableId()]++] = f.predictableId();
- }
- } else {
- current[r.predictableId()] = e.predictableId();
- hps[e.predictableId()] -= damage[r.predictableId()];
- }
- }
- }
- if (Movement.moves.containsKey(r) && Movement.moves.get(r) != Direction.Center) {
- myTargets = Game.senseNearbyUnits(r.tile().add(Movement.moves.get(r)), Constants.attackRange(r.unitType()), Game.enemy());
- outer: for (Robot e: myTargets) {
- for (int i = 0; i < targetsLength[r.predictableId()]; i++) {
- if (targets[r.predictableId()][i] == e.predictableId()) continue outer;
- }
- targets[r.predictableId()][targetsLength[r.predictableId()]++] = e.predictableId();
- targetsLength[r.predictableId()]++;
- if (hps[e.predictableId()] > 0) {
- if (r.unitType() == UnitType.Mage) {
- Robot[] adj = Game.senseNearbyUnits(e.tile(), 2);
- for (Robot f: adj) {
- aoe[e.predictableId()][aoeLength[e.predictableId()]++] = f.predictableId();
- }
- } else {
- current[r.predictableId()] = e.predictableId();
- hps[e.predictableId()] -= damage[r.predictableId()];
- }
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment