RosettaCodeData/Task/RPG-attributes-generator/MiniScript/rpg-attributes-generator.mini

27 lines
611 B
Plaintext

roll = function()
results = []
for i in range(0,3)
results.push ceil(rnd * 6)
end for
results.sort
results.remove 0
return results.sum
end function
while true
attributes = []
gt15 = 0 // (how many attributes > 15)
for i in range(0,5)
attributes.push roll
if attributes[i] > 15 then gt15 = gt15 + 1
end for
print "Attribute values: " + attributes.join(", ")
print "Attributes total: " + attributes.sum
if attributes.sum >= 75 and gt15 >= 2 then break
print "Attributes failed, rerolling"
print
end while
print "Success!"