Oh, I know the mana depletion part is easy. But the consequences and conditions in which it is regenerated might not necessarily be. I just made this little thing that could potentially cover one aspect, - depending on your approach, of course, and with some work - and it was trickier than I thought it would be when I first sat down and started on it.
Events-
Time - Every 2.00 seconds of game time
Conditions-
Actions -
Unit Group - Pick every unit in (Units in (Playable map area) matching ((Mana of (Picked unit)) Equal to 0.00)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Picked unit) has buff Bedroom ) Equal to True
Then - Actions
Trigger - Run GoToBed <gen> (checking conditions)
Else - Actions
Unit - Make (Triggering unit) Sleep when unprovoked
Unit - Remove Fatigue from (Triggering unit)
Unit Group - Pick every unit in (Units in (Playable map area) matching (((Picked unit) has buff Sleeping (Trigger induced)) Equal to True)) and do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Mana of (Picked unit)) Equal to (Max mana of (Picked unit))
Then - Actions
Unit - Add Fatigue to (Picked unit)
Unit - Wake up (Picked unit)
Else - Actions
Unit - Make (Picked unit) Sleep when unprovokedI'm not sure about how the "sleep" unit actions function, but I think it gets the idea across. Of course, I made assumptions about what approach to sleeping you would take, which I don't know, and this example isn't completely functional and wouldn't necessarily work with what you're doing. I imagine a megabeast falling asleep would be boring. Just to throw out some other ideas on this:
This idea: Instead of negative mana regeneration, a passive ability with a mana cost that doesn't show up in the units in-game list might work. Copying, say, the blood mage's sphere ability and removing all the art, editing cooldown, and changing mana cost to 1.
Another possibility: Or instead, negative mana regeneration could be the case, and sleeping adds a personalized version of brilliance aura instead of removing the passive Fatigue ability. Beds could have that as well, making dwarves in beds recover faster. Actually, this might be better than the first possibility I mentioned.
And there are probably more ways to do it. I just thought I'd throw around some ideas. If you want help with scripting, I'd be happy to take a look at any little problems that happen to be lying around.