Script for calculating GDR effectiveness
It uses the Monte Carlo method (i.e. sums up hundreds of thousands random damage vs. AC calculations and gets the average from it).
If anyone wants some additional functionality from the script, post here, I will update the script. It's 1 page long, so don't be intimidated to make your own changes.
Turns out GDR works differently than I thought; it doesn't help blocking damage that much, but it reduces AVERAGE melee damage dealt to you significantly.
- Code:
tries = 10000
x = 1
blocked = 0
blockedbygdr = 0
ac = 40
dam = 40
gdr = 0.39
math.randomseed(os.time())
R = math.random
print("ac?: ")
ac = io.read('*n')
print("damage?: ")
dam = io.read('*n')
print("gdr?: ")
gdr = io.read('*n')
maximumpotentialdamage = dam*gdr
if maximumpotentialdamage > ac/2 then
maximumpotentialdamage = ac/2
end
maximumpotentialdamage = math.floor(maximumpotentialdamage)
damagetotal = 0
damagetotalgdr = 0
while x < tries do
local damagerolled = R(1,dam)
local acrolled = R(0,ac)
if acrolled >= damagerolled then
blocked = blocked+1
else
damagetotal = damagetotal + damagerolled - acrolled
if acrolled < maximumpotentialdamage then
acrolled = maximumpotentialdamage
end
if acrolled >= damagerolled then
blockedbygdr = blockedbygdr + 1
else
damagetotalgdr = damagetotalgdr + damagerolled - acrolled
end
end
x = x+1
end
print("blocks / +gdr = " .. math.floor((blocked/tries)*100+0.5) .. "% / " .. math.floor(((blocked/tries)*100 + (blockedbygdr/tries)*100)+0.5) .. "%")
print("damage on average / with gdr = " .. (damagetotal/tries) .. " / " .. (damagetotalgdr/tries))
print("gdr reduced average damage by " .. math.floor(100-((damagetotalgdr/tries)/(damagetotal/tries))*100+0.5) .."%")
os.execute('pause')
BTW. I'd like to make a webpage with such functionality so people without Lua could use it, I just don't know where to start. I'm kinda a Web retard. Little help? Is there a free hosting somewhere where I can simply upload a page and get a link to share with others? Without making accounts, passwords and all that bullshit.