# Roll Table

module DarkHall
	module Util
		module_function
		def success_rate(border)
			if border <= 20 then
				return ROLL_TABLE[20].round
			elsif border >= 80 then
				return ROLL_TABLE[80].round
			else
				return ROLL_TABLE[border.to_i].round
			end
		end
	end
	
	ROLL_TABLE = []
	ROLL_TABLE[3] = 0.0
	ROLL_TABLE[4] = 0.01
	ROLL_TABLE[5] = 0.03
	ROLL_TABLE[6] = 0.06
	ROLL_TABLE[7] = 0.1
	ROLL_TABLE[8] = 0.16
	ROLL_TABLE[9] = 0.23
	ROLL_TABLE[10] = 0.33
	ROLL_TABLE[11] = 0.46
	ROLL_TABLE[12] = 0.61
	ROLL_TABLE[13] = 0.8
	ROLL_TABLE[14] = 1.01
	ROLL_TABLE[15] = 1.27
	ROLL_TABLE[16] = 1.56
	ROLL_TABLE[17] = 1.89
	ROLL_TABLE[18] = 2.27
	ROLL_TABLE[19] = 2.7
	ROLL_TABLE[20] = 3.17
	ROLL_TABLE[21] = 3.7
	ROLL_TABLE[22] = 4.29
	ROLL_TABLE[23] = 4.93
	ROLL_TABLE[24] = 5.63
	ROLL_TABLE[25] = 6.4
	ROLL_TABLE[26] = 7.23
	ROLL_TABLE[27] = 8.14
	ROLL_TABLE[28] = 9.12
	ROLL_TABLE[29] = 10.17
	ROLL_TABLE[30] = 11.3
	ROLL_TABLE[31] = 12.51
	ROLL_TABLE[32] = 13.8
	ROLL_TABLE[33] = 15.18
	ROLL_TABLE[34] = 16.65
	ROLL_TABLE[35] = 18.21 
	ROLL_TABLE[36] = 19.86
	ROLL_TABLE[37] = 21.59
	ROLL_TABLE[38] = 23.39
	ROLL_TABLE[39] = 25.26
	ROLL_TABLE[40] = 27.2
	ROLL_TABLE[41] = 29.2
	ROLL_TABLE[42] = 31.24
	ROLL_TABLE[43] = 33.34
	ROLL_TABLE[44] = 35.48
	ROLL_TABLE[45] = 37.65
	ROLL_TABLE[46] = 39.85
	ROLL_TABLE[47] = 42.08
	ROLL_TABLE[48] = 44.33
	ROLL_TABLE[49] = 46.59
	ROLL_TABLE[50] = 48.86
	ROLL_TABLE[51] = 51.14
	ROLL_TABLE[52] = 53.41
	ROLL_TABLE[53] = 55.67
	ROLL_TABLE[54] = 57.92
	ROLL_TABLE[55] = 60.15
	ROLL_TABLE[56] = 62.35
	ROLL_TABLE[57] = 64.52
	ROLL_TABLE[58] = 66.66
	ROLL_TABLE[59] = 68.76
	ROLL_TABLE[60] = 70.8
	ROLL_TABLE[61] = 72.8
	ROLL_TABLE[62] = 74.74
	ROLL_TABLE[63] = 76.61
	ROLL_TABLE[64] = 78.41
	ROLL_TABLE[65] = 80.14
	ROLL_TABLE[66] = 81.79
	ROLL_TABLE[67] = 83.35
	ROLL_TABLE[68] = 84.82
	ROLL_TABLE[69] = 86.2
	ROLL_TABLE[70] = 87.49
	ROLL_TABLE[71] = 88.7
	ROLL_TABLE[72] = 89.83
	ROLL_TABLE[73] = 90.88
	ROLL_TABLE[74] = 91.86
	ROLL_TABLE[75] = 92.77
	ROLL_TABLE[76] = 93.6
	ROLL_TABLE[77] = 94.37
	ROLL_TABLE[78] = 95.07
	ROLL_TABLE[79] = 95.71
	ROLL_TABLE[80] = 96.3
	ROLL_TABLE[81] = 96.83
	ROLL_TABLE[82] = 97.3
	ROLL_TABLE[83] = 97.73
	ROLL_TABLE[84] = 98.11
	ROLL_TABLE[85] = 98.44
	ROLL_TABLE[86] = 98.73
	ROLL_TABLE[87] = 98.99
	ROLL_TABLE[88] = 99.2
	ROLL_TABLE[89] = 99.39
	ROLL_TABLE[90] = 99.54
	ROLL_TABLE[91] = 99.67
	ROLL_TABLE[92] = 99.77
	ROLL_TABLE[93] = 99.84
	ROLL_TABLE[94] = 99.9
	ROLL_TABLE[95] = 99.94
	ROLL_TABLE[96] = 99.97
	ROLL_TABLE[97] = 99.99
	ROLL_TABLE[98] = 100.0
	ROLL_TABLE[99] = 100.0
end
