I'm not an expert, but as far as I know it works like this:
The to-hit chance is simply Accuracy minus Dodge. If you hit is then calculated by a random number between zero and your to-hit chance (I may be wrong about this). You always have a 3% chance to hit or miss, no matter how high Accuracy or Dodge is.
Damage is then calculated using this formula:
Max Damage = Attack*Attack/(Attack+Defense)
Min Damage = Max Attack/2
Any elemental damage is added after the calculation.
I hope this helps.