It is based on ratio between both cards attack. For example we have Lyse Teria and Wanda. If a player use 4 pills on Lyse Teria her attack will be 4*8=32 and if the other player use 3 pills on Wanda then she will have an attack of 3*8=24. Now for random. Lyse Teria chance of winning is her attack over the total attack of both cards. 32 / (32+24) = 57% while Wanda's is 24 / (32+24) = 43%. So Lyse Teria can will in 6 out of 10 while Wanda can upset Lyse Teria in 4 out of 10 matches.