Energy

**Energy** is a Need common to all Cultivators and Mortals, and is a measure of how tired they are.

## Mechanics

A character will interrupt their task and start sleeping on the spot when their energy falls below 30, 20 and 0.01, unless their sleep was interrupted recently. Moreover, if they were doing a task when they fell asleep, they'll wake up again once their energy reaches 30 - which counts as sleep interrupted, with the associated negative moodlet and the "Can't sleep" modifier for 100s.

Assuming standard Energy Consumption Bonus and Energy Replenishment Bonus values, a Mortal will want a bit more than 6 hours of sleep every day. However as disciples will sleep until their energy is recovered, and never oversleep, there's no harm having additional sleep scheduled throughout the day. This also avoids the disciples falling asleep on the job as will happen if their energy falls below 30.

## Going to sleep

All characters will choose to sleep (as a behaviour):

* if they're in the Sect map and not fighting
* during a "Work" or "Sleep" period on the Work Schedule Planner if their Energy is between 0.01 and 30: however as they'll fall asleep on the spot if their energy falls below 30, this happens infrequently
* during a "Practice" or "Eat" period on the Work Schedule Planner if their energy is <0.01, same as above.

Moreover, an outer will also choose to sleep during a "Sleep" period on the Work Schedule Planner and their Energy is < 75.

The sleep duration is set until the disciple recovers Energy fully. If they're in an Injury-induced sleep or their health is below 70%, their sleep can't be interrupted. Otherwise, they'll stop sleeping if their energy is above 30 and the Work Schedule Planner is on a "Practice" or "Eat" period. This is not treated as a sleep interruption and has no adverse consequences.

## Consumption

Energy consumption rate, the rate at which Energy is consumed, depends on a character's Energy Consumption Bonus. The higher this value, the faster Energy is lost per unit time. By equipping a high Tier Talisman of Spiritual Cleansing, it is possible to have this value be reduced to zero, therefore removing the need for sleep.

Energy decreases based on the following:

* 0 If the character is sleeping, in an non-Injury-related coma or in a Breakthrough.
* The current Biome Rest Multiplier, depending on the Character's Energy level. This value is constant for all non-modded maps, but can be changed by Mods.

 30
 20
 0.01

* If the character is in an Injury-related coma, the consumption is multiplied by 3
* Finally, the consumption is multiplied by the character's s Energy Consumption Bonus.

By default (with an Energy Consumption Bonus of 1), assuming an uninterrupted work schedule and an energy above 30, a character will consume 3.65 Energy per hour. Using those assumptions, It takes about 480s for a disciple to go from 100 Energy to 30, or 19 hours and 12 minutes.

## Restoration

Mortals can only acquire Energy by sleeping, and lose Energy constantly while awake. Cultivators, however are considered to be resting during Cultivation (Practice for Xiandao Cultivation) and therefore can just recover Energy by cultivating.

The amount of Energy gained while sleeping depends on the location of sleep (Bed vs the Ground), as well as the character's Energy Replenishment Bonus. The formula is

0.417
∗
R
e
s
t
E
f
f
e
c
t
i
v
e
n
e
s
s
∗
E
n
e
r
g
y
R
e
p
l
e
n
i
s
h
m
e
n
t
B
o
n
u
s

{\displaystyle 0.417 \* RestEffectiveness \* EnergyReplenishmentBonus}

 in energy/s. By default, with a RestEffectiveness and Energy Replenishment Bonus of 1, this means a recovery of 10.425 Energy per hour.

The Energy Restoration rate (`RestEffectiveness`) is as follows:

ThingDefName
Bed

DoubleBed

BambooBed

LsDogHouse

FloorBase

Beds should therefore be placed near the working locations of Disciples to ensure that they are less likely to sleep on the floor and receive negative Moodlets.

### Ominous Room

Every 1 second, if the Character is sleeping in an Ominous room, a random roll will be carried out:

* Slightly Ominous: 0.01%
* Ominous: 0.02%
* Very Ominous: 0.05%

If this roll succeeds, a Cultivator will receive a single stack of Qi Overflow injury, and an Outer Disciple or Animal will immediately die of Heart Palpitations.

### Items

No items can restore Energy directly, however certain items such as Talisman of Spiritual Cleansing can increase the rate at which Energy is gained.

## Energy Moodlets

*See: For a list of sleep-quality and bedroom-related moodlets, see the Moodlet page*

When the energy falls below certain thresholds, negative moodlets are acquired.

 20
 0.01

This "Tired" Moodlet is unrelated to the one obtained from dismissing a Sect or Branch Leader.

## References

1. ↑ `XiaWorld.RestNeed.OnLevelChange()`
2. ↑ `CommandTakeRest.CouldBeFind()`
3. ↑ `XiaWorld.RestNeed.GetSubValue()`
4. ↑ `Settings/Biomes/BiomeBase.xml [Rest]`
5. ↑ 5.0 5.1 Settings\ThingDef\Building\Building\_Furniture.xml
6. ↑ Settings\ThingDef\Building\Building\_PANDA.xml
7. ↑ Settings\ThingDef\Building\Building\_LingShou.xml
8. ↑ Settings\ThingDef\Building\Building\_Floor.xml
9. ↑ `XiaWorld.ToilTakeRest()`
10. ↑ `XiaWorld.ToilTakeRest.OnStepToil`
11. ↑ Settings\Npc\Damages\GongDamages.xml