I was planning to write about this, but there's a basic formula.
There's a Spell Power stat and an HP Factor Stat (whatever you think of calling it).
When both are multiplied, they equal 100%, although I think that's not entirely required.
Hold on.. revising algo first...
For the SNES+GBA version, it is simply this:
Damage = maxHP/ Spell Power * Elemental Multiplier
Elemental Multipliers:
Weak vs Element = 2
Strong vs Elemental = 1/2
If you absorb this element and are using the SNES version, then apply against my magic damage algo.
If you absorb this element and are using the GBA version:
If single targeted, use my magic damage algo, but substitute the second value in the list as the spell power.
If multitargeted, simply invert the damage by multiplying by -1.