Atually,
Calculate initial damage (taking into consideration +damage),
Then add on dragon gem bonus.
This gives you the Base attack Damage.
Then calculate initial defence (taking into consideration -damage),
Then add your Tortoise gem bonus.
This is your base Defense value.
Then you choose your min/max value for Atual attack damage by doing a rand.
Then perform your damage equation, which is something like
((((((Attack - Defense) + Fan Damage) * Potency) / Rebirth Value) / Total Bless) - Tower Defense)
But obviously its alot neater than that, and i cant really remember it because i havent worked on a potency source in a very long time.
Ill try and release a 5165 Damage calculation properly at some point.