The basic concept is that simply having an effect available for spell creation does _not_ mean that you can create spells with that effect at any magnitude; instead, the more often you use the effect (and the more powerful it is when you use it), the more you understand it -- and as your understanding increases, so does the maximum magnitude of the effect, for purposes of spell creation. This seems to me to fit very well with the 'you improve the things you actually use' philosophy behind the leveling system, and it also seems more realistic -- simply reaching Destruction Mastery doesn't mean you should be able to create massive lightning spells, if you've only cast fire spells the entire time....
Before I actually spend too much time on it, however, I'd like to make sure what I'd need to do is actually impossible, so I'd appreciate it if someone would let me know if any of the following steps aren't possible/feasible:
- Intercept spellcasting with a handler
- In the handler, have an OBSE array indexed by the string value of the spell reference ID which records how many times that spell has been cast.
- On entering the spell creation menu, go through the array tracking the spells cast, and determine the increase in understanding for the effects
- For each entry in the spells cast array, loop through each effect in the spell, incrementing the counter for the effect by the magnitude of the effect * the number of times the spell was cast; increment the (special) counter for duration by the duration of the effect * the number of times the spell was cast; and increment the (special) counter for area of effect by the area * the number of times the spell was cast.
- The counters for area and duration are 'global'; that is, there's only one counter for them, rather than one per effect
- (optional optimization) Possibly do this periodically, to minimize the delay when entering the spell creation menu (but when?)
- For each entry in the spells cast array, loop through each effect in the spell, incrementing the counter for the effect by the magnitude of the effect * the number of times the spell was cast; increment the (special) counter for duration by the duration of the effect * the number of times the spell was cast; and increment the (special) counter for area of effect by the area * the number of times the spell was cast.
- When adding an effect to a spell, set the maximum magnitude available for the effect to a value based on the counter for that effect (tentatively, the value needed for a given magnitude is 100*Magnitude*ln(Magnitude)). Set the maximum area and duration the same way, based on their counters.
The first two steps I'm pretty sure are feasible; its the last step I'm not sure about. Is it feasible? Are there any really bad ideas, scripting/performance-wise, in my basic plan?