So I made a little mod that does a few things:
1) Makes playing a low-level mage less painful.
2) Makes it viable to play a mage without taking 3X Int in Magicka. (really!)
3) Makes high-level mage PCs even more powerful. (sorry! not intentional - I don't even know if spell point cost reduction for magicka skills can be changed)
4)
5) NPCs will also regenerate magicka.
6) New in v0.4 - Set the frequency of regeneration. Unfortunately, this is also the only current setting, although more settings are planned.
It does this by allowing you and NPCs to, as you may guess, regenerate magicka.
Current (v0.5):
What does this do?
1a) You regenerate magicka a lot slower when your current magicka is low, relative to your maximum magicka. (Your regeneration will never be 0, although it can get very close...)
1b) NPCs regenerate magicka as if their current Magicka was 65% of their maximum magicka. (You can change the rate in the mod settings) This is because current NPC AI doesn't know about Magicka Regeneration or how it works, and would otherwise cripple itself.
2) You/NPCs regenerate magicka faster, the lower your maximum magicka.
3) You/NPCs regenerate magicka faster with more willpower.
What are the intended implications?
Magicka exhaustion encourages a "run-and-cast" style of gameplay.
Up to 50% of your maximum magicka is "fungible", and the remaining 40% is essentially emergency reserves, or for long-duration spells.
Willpower is more valuable, but not a lot more. At 100 Willpower, you regenerate Magicka twice as fast as at 50 Willpower. (I may increase this in the future)
A character with a maximum of 50 magicka regenerates magicka 6 times as fast as a character with 300 magicka. OTOH, it's a lot harder to exhaust 300 magicka...
The math: Magicka regeneration is based on the following formula:
Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
Simplified NPC magicka regeneration is instead based on this formula:
Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)
lowerCase names are variables
Defaults:
dividentMaximumMagicka = 150
magickaPercentExponent = 200%
minimumMagickaPercent = 1%
willpowerMultiplierPercent = 15%
_NPCsRegenerateMagicka = True
useSimplifiedNPCRegeneration = True
simplifiedMagickaPercent = 65%
Currently, you can just set the Frequency with which you regeneration magicka:
Per Second: Very fast combat regeneration; suitable for if you want spells to be very powerful.
Per 6 Seconds: Combat regeneration.
Per 30 Seconds. Fast non-combat regeneration. The default.
Per Minute: Slow non-combat regeneration.
Per 10 Minutes: Basically only rest regeneration.
Per Hour: I don't even know why this exists.
Per Day: I definitely don't even know why this exists.
Warning! The code has received very minimal testing. I cannot be held responsible for anything it does to your character(s), your computer, or anything else, and I highly recommend making a test character. That being said, it should be well-behaved, but I cannot guarantee that.
Installation:
Copy the "Magicka Regeneration.dfmod" file for your platform into your "StreamingAssets/Mods" folder.
Uninstallation:
It should uninstall by removing the "Magicka Regeneration.dfmod" file from your "StreamingAssets/Mods" folder. However, see the warning above.
Changelog:
Changes in v0.5:
* The mod no longer auto-sets "NoRegenSpellPoints = true". If you've used v0.4, you'll need to go into your save file and set that to false, if you didn't select it in character creation.
* Added protection against accidentally adding more than one magicka regeneration script.
* Added protection against magicka regeneration rollover pile-up.
* New Frequency setting: Per 30 seconds. This is now the default, on advice from Ralzar.
Changes in v0.4:
* Re-wrote the entire mod off of the documentation in this post. Thanks, Past Me!
* Magicka regeneration now works off of in-game time, not Unity Engine's Time.time or whatever I was doing before.
* Can set the Frequency of Magicka Regeneration.
* All other settings are gone.
* Scans for mobs to attach a script to once per second. This should not cause a problem.
Changes in v0.3:
* NPCs can now regenerate magicka.
* Two new toggles. Both toggles default to True.
** "NPCs Regenerate Magicka" controls whether or not NPCs regenerate magicka at all.
** "Use Simplified NPC Regeneration" determines which formula NPCs use; the same as the player, or the simplified formula. The simplified formula is recommended for AI which does not take magicka regeneration into account.
* New slider: "Simplified Magicka Percent", which defaults to 65%.
* The simplified NPC magicka regeneration formula calculates magicka regeneration as if their current magicka was always equal to the "Simplified Magicka Percent" of maximum magicka. This should allow NPCs to regenerate magicka, without favouring them.
Changes in v0.2:
* Hardcoded constants are now variables.
* Added settings so you change the variables in the formula.
* Formula is now: Per second = max((CurrentMagicka / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplierPercent )
* lowerCase names are variables.
New NPC magicka regeneration formula:
Per second = max(((simplifiedMagickaPercent * MaximumMagicka) / MaximumMagicka)^magickaPercentExponent, minimumMagickaPercent) * (dividendMaximumMagicka / MaximumMagicka) * (CurrentWillpower * willpowerMultiplier)
Old; kept for historical purposes.