User blog comment:Amphitere/Amphitere's Skilling/@comment-6122528-20130823183241

Amphitere and I have been discussing this data for a couple of months. Here's a general formula that I believe captures all cases:

t = target skill level of enhancee

s=skill level of enhancer

e=rarity of enhancee

z=rarity of enhancer

Rarities are encoded as numbers: 1=common, 2=commmon EX,.... 6 =UREX

percent chance =

(10/(t*(max(1,2(e-4)))))*(s+1)*(z + min(1, 5-e)*(max(0,5-e))/(max(1,5-e))*max(min(0,4-e),z-2*(e-1))  + max(0, e-4)*max(0, 6-e)*max(0, z-2)  + max(0, e-5)*max(0, 1+3(z-3))  )

That's awfully messy. I suspect there's a simpler way to express the last term, but I don't see it yet.

If we break it down into different enhancee rarities it's much simpler:

For e=1..4:

percent=(10/t)*(s+1)*(z+ max(min(0,4-e),z-2*(e-1)))

For e=5 (UR enhancee)

percent=(10/(2*t))*(s+1)*(z+max(0,z-2)))

For e=6 (UREX enhancee)

percent=(10/(4*t))*(s+1)*(z+max(0, 1+3*(z-3)))

The crazy final termin the general formula is the result of trying to string all of these difference cases together. As you can see, an algorithm using if statements looks a lot cleaner.