Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void refreshAoeValues(Table table) {
- for(int i = 0; i < 11; i++) {
- for(int j = 0; j < 13; j++) {
- HashMap<Integer, Integer> aoeValues = new HashMap<Integer, Integer>();
- boolean isBombUp = false;
- boolean isBombDown = false;
- boolean isBombLeft = false;
- boolean isBombRight = false;
- for(int k = 1; k < 12; k++) { // bomb range
- if (!table.getFields().get(i).get(j).isBox()) {
- int value = 0;
- try {
- if (table.getFields().get(i - k).get(j).isBox() && !isBombUp || isBombUp) {
- value++;
- isBombUp = true;
- }
- } catch (Exception e) {};
- try {
- if (table.getFields().get(i + k).get(j).isBox() && !isBombDown || isBombDown) {
- value++;
- isBombDown = true;
- }
- } catch (Exception e) {};
- try {
- if (table.getFields().get(i).get(j - k).isBox() && !isBombLeft || isBombLeft) {
- value++;
- isBombLeft = true;
- }
- } catch (Exception e) {};
- try {
- if (table.getFields().get(i).get(j + k).isBox() && !isBombRight || isBombRight) {
- value++;
- isBombRight = true;
- }
- } catch (Exception e) {};
- aoeValues.put(k, value);
- }
- table.getFields().get(i).get(j).setAoeValues(aoeValues);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement