The formulas are encoded in the game engine, and the xdb files have a clear structure; any violations of this structure can lead to the game crashing or individual elements malfunctioning (such as the bug with the instantaneous, devastating dive attack).
Some complex spells have additional parameters defined in DefaultStats; I remember that this applied to spells like summoning a Hive and creating Walls of Swords (possibly also Phoenix).
Can I change the formulas in the game engine? And where is the engine located in the files? Is DefaultStats an xdb file?