Magical Attack Damage Formulas
The damage formula is basically:
BASE MAGICAL DAMAGE = (ATTACK - DEFENSE) * (MND_STAT + LVL)
Where the above formula uses the following abbreviations:
ATTACK = Attack rating of spell/ability being used
DEFENSE = A small fraction of the defender's total RES - something like [RES/16].
MND_STAT = Attacker's MND for holy elemental attacks, INT for all others
LVL = Attacker's experience level
This is the base formula, and there is also a damage "normalizer" so things don't get completely out-of-whack.