LAST EDITED ON May-11-10 AT 06:54 AM (Pacific)it appears that the game adds the following to each category (fire, etc.) of spell points at level up:
stat_bonus + spells_known*2 + regeneration + 1d(skill/20)-1
stat_bonus is determined as follows:
x=round_down( (int+pie)/2 )
if x>13, stat_bonus = 1;
if x>16, stat_bonus = 2;
* spells_known is the number of spells the character knows of the appropriate spell category (fire, etc.)
* regeneration is the character's spell point regeneration for the appropriate spell category (fire, etc.) as shown in Mad God's editor
* skill is the magic skill of the character's current class (priest=theology, etc.)
whenever you learn a new spell, you also get additional mana of 1d(skill/20) + 2*spell_level. if after everything your mana is less than the spell's mana cost, it's set to the spell's mana cost.
---
EDIT: this seems awfully high to me, but this is what the code says. i might be missing something. also, i did this by looking at the code for non-magic-using classes (rangers and so on). it may be different for magic-using classes (priests, alchemists, etc.)