Old School RuneScape math

Run Settings
LanguagePython
Language Version
Run Command
from math import ceil, floor def roll(stat, level, potion_base=0, potion_procent=0, prayer=0, style_bonus=False): e = ceil((level+potion_base+floor(level*potion_procent/100))*(1+(prayer/100)))+8 + style_bonus*3 b = stat return e * (b + 64) def rate(attack, defence): if attack < defence: return attack/(2*(defence+1)) return 1-(defence+2)/(2*(attack+1)) def strength(stat, level, potion_base=0, potion_procent=0, prayer=0, style=False): effective = (level+potion_base+floor(level*potion_procent/100))*(1+(prayer/100)) + style*3 bonus = stat return int(1.3+effective/10+bonus/80+effective*bonus/640) def display(r): return f'{int(r*1000)/10}%' def dps(attack, strength, defence): return rate(attack, defence)*(1+strength)/2/2.4 hakkeAtt = roll(173, 99, 5, 15, 15, True) hakkeDef = roll(300, 70, 5, 15, 15) hakkeStr = strength(119, 50, 5, 15, 15) chadAtt = roll(161, 99, 5, 15, 20) chadDef = roll(269, 99, 5, 15, 25) chadStr = strength(154, 99, 5, 15, 23, True) iblisAtt = roll(117, 51, 5, 15, 15) iblisStr = strength(76, 99, 5, 15, 18, True) olmDef = roll(200, 150) print('Iblis träffar olm med', display(rate(iblisAtt, olmDef))) iblis_dps_olm = dps(iblisAtt, iblisStr, olmDef) hakke_dps_olm = dps(hakkeAtt, hakkeStr, olmDef) hakke_dps_chad = dps(hakkeAtt, hakkeStr, chadDef) chad_dps_hakke = dps(chadAtt, chadStr, hakkeDef) chad_dps_olm = dps(chadAtt, chadStr, olmDef) print('Iblis dps vs. olm', iblis_dps_olm*100//1/100) print('Hakke dps vs. olm', hakke_dps_olm*100//1/100) print('Hakke dps vs. chad', hakke_dps_chad*100//1/100) print('Chad dps vs. hakke', chad_dps_hakke*100//1/100) print('Chad dps vs. olm', chad_dps_olm*100//1/100) print('Hakke träffar', display(rate(hakkeAtt, chadDef))) print('Chad träffar', display(rate(chadAtt, hakkeDef))) print('Hakke skadar max', hakkeStr) print('Chad skadar max', chadStr)
Editor Settings
Theme
Key bindings
Full width
Lines