Advertisement
Guest User

Untitled

a guest
Sep 27th, 2016
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.91 KB | None | 0 0
  1.  private static void refreshAoeValues(Table table) {
  2.         for(int i = 0; i < 11; i++) {
  3.             for(int j = 0; j < 13; j++) {
  4.                 HashMap<Integer, Integer> aoeValues = new HashMap<Integer, Integer>();
  5.                 boolean isBombUp = false;
  6.                 boolean isBombDown = false;
  7.                 boolean isBombLeft = false;
  8.                 boolean isBombRight = false;
  9.                 for(int k = 1; k < 12; k++) { // bomb range
  10.                     if (!table.getFields().get(i).get(j).isBox()) {
  11.                         int value = 0;
  12.                         try {
  13.                             if (table.getFields().get(i - k).get(j).isBox() && !isBombUp || isBombUp) {
  14.                                 value++;
  15.                                 isBombUp = true;
  16.                             }
  17.                         } catch (Exception e) {};
  18.                         try {
  19.                             if (table.getFields().get(i + k).get(j).isBox() && !isBombDown || isBombDown) {
  20.                                 value++;
  21.                                 isBombDown = true;
  22.                             }
  23.                         } catch (Exception e) {};
  24.                         try {
  25.                             if (table.getFields().get(i).get(j - k).isBox() && !isBombLeft || isBombLeft) {
  26.                                 value++;
  27.                                 isBombLeft = true;
  28.                             }
  29.                         } catch (Exception e) {};
  30.                         try {
  31.                             if (table.getFields().get(i).get(j + k).isBox() && !isBombRight || isBombRight) {
  32.                                 value++;
  33.                                 isBombRight = true;
  34.                             }
  35.                         } catch (Exception e) {};
  36.                         aoeValues.put(k, value);
  37.                     }
  38.                     table.getFields().get(i).get(j).setAoeValues(aoeValues);
  39.                 }
  40.             }
  41.         }
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement