public static int missilesHit(int missiles, int nMod, boolean maxtech) { int nRoll = d6(2) + nMod; int minimum = maxtech ? 1 : 2; nRoll = Math.min(Math.max(nRoll, minimum), 12);  if (maxtech && nRoll == 1) { return 1; } if (nRoll<2) { nRoll = 2; }  final int[][] hits = new int[][] { {2,1,1,1,1,1,1,2,2,2,2,2}, {3,1,1,1,2,2,2,2,2,3,3,3}, {4,1,2,2,2,2,3,3,3,3,4,4}, {5,1,2,2,3,3,3,3,4,4,5,5}, {6,2,2,3,3,4,4,4,5,5,6,6}, {8,2,3,3,4,4,5,5,6,7,8,8}, {9,3,3,4,5,5,5,5,7,7,9,9}, {10,3,3,4,6,6,6,6,8,8,10,10}, {12,4,4,5,8,8,8,8,10,10,12,12}, {15,5,5,6,9,9,9,9,12,12,15,15}, {20,6,6,9,12,12,12,12,16,16,20,20}};  for (int i = 0; i < hits.length; i++) { if (hits[i][0] >= missiles) { return Math.min(missiles, hits[i][nRoll-1]); } } throw new RuntimeException("Could not find number of missles in hit table");
public static int missilesHit(int missiles) { return missilesHit(missiles, 0);
    public static int missilesHit(int missiles, int nMod, boolean maxtech) {        int nRoll = d6(2) + nMod;        int minimum = maxtech ? 1 : 2;        nRoll = Math.min(Math.max(nRoll, minimum), 12);        if (maxtech && nRoll == 1) {            return 1;        }        if (nRoll<2) {            nRoll = 2;        }        final int[][] hits = new int[][] {        {2,1,1,1,1,1,1,2,2,2,2,2},        {3,1,1,1,2,2,2,2,2,3,3,3},        {4,1,2,2,2,2,3,3,3,3,4,4},        {5,1,2,2,3,3,3,3,4,4,5,5},        {6,2,2,3,3,4,4,4,5,5,6,6},        {8,2,3,3,4,4,5,5,6,7,8,8},        {9,3,3,4,5,5,5,5,7,7,9,9},        {10,3,3,4,6,6,6,6,8,8,10,10},        {12,4,4,5,8,8,8,8,10,10,12,12},        {15,5,5,6,9,9,9,9,12,12,15,15},        {20,6,6,9,12,12,12,12,16,16,20,20}};        for (int i = 0; i < hits.length; i++) {            if (hits[i][0] >= missiles) {                return Math.min(missiles, hits[i][nRoll-1]);            }        }        throw new RuntimeException("Could not find number of missles in hit table");    }