Divinity

A mechanic of Shendao Cultivation. Technically implemented as a NeedXiaWorld.GodPowerNeed.
== Effects ==
Divinity has the following effectsXiaWorld.GodPowerNeed.ValueChange:
Each point of Divinity translates directly into a Stack of GodPractice_GodPowerEffect Modifier. The Modifier has an effect of reducing Mood Multiplier by -0.005 BAddP, or Base Percentage type Addition, as well as adding to the GodPowerEffectCount Flag.
When Divinity<=30, GodPractice_GodPowerEffect_A is applied. The stack value is equal to 30 - Divinity. The Modifier has the following effects:
* -2% Base (BAddP) Artifact Power Bonus (NpcFight_FabaoPowerAddP)
* -2% Base (BAddP) Artifact Qi Recovery Bonus (NpcFight_FabaoLingRecoverAddP)
* -2% Base (BAddP) Artifact Max Qi Bonus (NpcFight_FabaoMaxLingAddP)
* -2% Base (BAddP) Barrier Power Bonus (NpcFight_ShieldConversionRateAddP)
* -2% Base (BAddP) Spell Power Bonus (NpcFight_SpellPowerAddP)
* -2% Base (BAddP) Spell Qi Cost Bonus (NpcFight_SpellLingCostAddP)
When Divinity is above 30, GodPractice_GodPowerEffect_B is applied. The stack value is equal to Divinity - 30. The Modifier has the following effects:
* 2% Base (BAddP) Artifact Power Bonus (NpcFight_FabaoPowerAddP)
* 2% Base (BAddP) Artifact Qi Recovery Bonus (NpcFight_FabaoLingRecoverAddP)
* 2% Base (BAddP) Artifact Max Qi Bonus (NpcFight_FabaoMaxLingAddP)
* 2% Base (BAddP) Barrier Power Bonus (NpcFight_ShieldConversionRateAddP)
* 2% Base (BAddP) Spell Power Bonus (NpcFight_SpellPowerAddP)
* 2% Base (BAddP) Spell Qi Cost Bonus (NpcFight_SpellLingCostAddP)
When the Divinity is equal to 100, a timer for Ascension will be triggered.
== Components ==
The Real Value (RealValue) of Divinity (Need) is made up ofXiaWorld.GodPowerNeed.RealValue:
* Base Value of Need + Modified Divinity + Divinity (GodPractice_GodPowerAddV Property)
The resulting RealValue is capped between 0 and 100. Image on the right shows the following valuesPanel_ThingInfo.ShowNpc:
* Divinity - Real Value of Divinity, based on the formula above
* Base Divinity - Need Value + GodPractice_GodPowerAddV Property SecondValue
* Modified Divinity - Need fParam, the modified Divinity from Restrained/Indulgence states
Humanity is the inverse value of the Real Value of Divinity (100% - Divinity) displayed.
Before forming their Divine Realm, a Shendao Cultivator has the Value capped at 50.XiaWorld.GodPowerNeed.OnStep
== Modifying ==
Each Component of Divinity can be influences separately.
=== Need Value ChangesXiaWorld.GodPowerNeed.GetSubValue ===
The "Base Value for the Need (not to be mixed up with Base Divinity, which is this value together the Divinity Property) can change over time. The change (SubValue) on each step is based on the following:
* Default change of -0.00016666668 (-0.00016666667 listed in alternative decompilations)
* In Restrained, Default Change multiplied by (1 + (Smallest value between 10 and 100 / Distress))
* In Indulgence, Default Change divided by (Smallest value between 10 and Distress / 20) 
Change is 0 in the following situations:
* Character is not following a Shendao Law
* Character is a God (Npc.IsGod is set to 1)
* Character is below Divine Stage and Real Value is Greater Than or Equal To 50
The SubValue is the amount subtracted from the "Base" Value. Which means that unlike other Needs, Divinity will naturally increase over time.
=== Divinity (GodPractice_GodPowerAddV) Property Changes ===
The Divinity Property can be influenced just like any other Property. The following is a list of all modifications to that Property. All of them are of the AddV (Flat Addition) type.
Source
Modifier	Effect on Divinity	Notes
Sarira (consuming)
Dan_XianBoneBall	+25 	
Sarira (held effect)
Modifier_Item_XianBoneBall	+5 	
Tree of Prayers
GodCityBuiling_WishTree	-1 	To a total of -9 with all of them built
Mortal Melancholia
GodCityBuiling_HongChenKuHai	-15 	
Pilgrim State bonus
GodPractice_Gong_Qi	+3 	
Divine State bonus
GodPractice_Gong_GodCity	+5 	Unapplied as this bonus is never receivedSettings/Practice/Gong/God/God_Gong_[1 to 3].xml all add Gong_Gold and GodPractice_Gong_GodCity as modifiers, the first one being the Xiandao golden core state modifier. This results in GodPractice_Gong_GodCity never being applied..
Attainment State bonus
GodPractice_Gong_God	+7 	
Talisman of Divine Authority
Spell_GodPractice3	+9 	Listed effect is Base for Talisman
Talisman of Divine Concealment
Spell_GodPractice4	-3 	Listed effect is Base for Talisman
=== Modified Divinity Changes ===
Modified/Temporary Divinity changes over time, and is related to the current Behavior Kind.
* In Balance (g_emPracticeBehaviourKind.None), there is no change in the value.
* In Restrained (g_emPracticeBehaviourKind.God_Renunciation), as long as (Modified Divinity + Base Divinity) is less than 100, Modified Divinity increases over time to 50% of Base Divinity, as listed on the tooltip.
* In Indulgence (g_emPracticeBehaviourKind.God_Indulge), Modified Divinity decreases over time to -50% of Base Divinity, as listed on the tooltip.
When the Special Flag FLAG_GODPRACTICE_GODLIKE is applied on the Shendao, the Modified Divinity is equal to (99.99 - Base Divinity), as listed on the tooltip.
== Trivia ==
* A commonly made mistake is that Divinity is a special Need that caps out at 110. The Shendao Guide by Glitchy also mentions it. This is supported by the observation that a Shendao at Attainment State will eventually ascend, even on Balanced. It's further supported by a Tier 12 Talisman of Divine Concealment keeping the value below 100. The root cause is the Divinity bonus from breaking through to a higher state, which results in +3 for Divine State and +10 for Attainment State.
* A similar reasoning is why consuming (and holding) Sarira is suggested to avoid for Shendao Cultivators.
== References ==
Category:Shendao Cultivation
Category:Needs
Category:Game Mechanics