Modify Affiliate plug in with new payment structure

I have a project which pay affiliates 100%, but I would like to have the referrer to earn the commission on sale number 2, 4, 6, 11, 16, and every 5 until eternity etc. Is this possible?