I have already done a new generator, but I think I can go farther and make something very interesting.

It will be based on several configuration files and sheets (csv files).
CSV will contain sort of databases about innate, spells and potions : it describes everything a script need to know about them (conditions to use them, name, identifier / resource, target ...)
2 types of configuration : general and local.

General will list all immunities check:
- elemental immunity check
- magic damage immunity check
- magic resistance
- minor globe of invulnerability
- various innates like rage
- foes hit points check (this one is very important for spells that depend on hp like power word sleep / stun / kill)

Local config can override general config and add others parameters.

Then, on a caster script, you just have to list spells by name. Something like this (number for random rolls) :
magic missile, 30
chromatic orb, 40
lightning bolt, 50

csv description would use the same syntax that local config, so it is easy to override something.

Then, it is possible to customize any scripts at will, or change immunities check very quickly.

Well, I will do this generator later on, when I'm finished with adventurers