Divinity

A mechanic of Shendao Cultivation. Technically implemented as a Need.

## Effects

Divinity has the following effects:

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 `GodPowerEffectCoun`t 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 of:

* 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 values:

* 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.

## Modifying

Each Component of Divinity can be influences separately.

### Need Value Changes

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.

### 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

1. ↑ XiaWorld.GodPowerNeed
2. ↑ XiaWorld.GodPowerNeed.ValueChange
3. ↑ 3.0 3.1 3.2 XiaWorld.GodPowerNeed.OnStep
4. ↑ XiaWorld.GodPowerNeed.RealValue
5. ↑ Panel\_ThingInfo.ShowNpc
6. ↑ XiaWorld.GodPowerNeed.GetSubValue
7. ↑ `Settings/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.