Insanity
Insanity is the resource used by the Demented metaclass: Writhing One and Cultist of Entropy. It was introduced as part of the Forbidden Cults DLC.
Insanity can vary from 0 to 100%. It has an associated chaotic percentage, varying from 0 to 50%, that determines how much damage and cooldowns may randomly fluctuate up or down. This effect applies to all talents used by the character, even those that do not use insanity as a resource, and includes runes and infusions. The relationship between chaotic percentage and insanity is as follows:
Chaotic Percentage = 50 * ( current insanity / max insanity ) 2
Insanity naturally decays by -0.6% per turn. It can only be gained by talent use in combat. If the player casts an insanity generating talent at an out of sight enemy that was not yet aware of the player (e.g. corner sniping), that talent will not generate any insanity since the player will be deemed to be out of combat at the time of casting.
Insanity is reset to zero on most level transition, including:
- Moving into and out of zones on the worldmap
- Going up and down floors in the same zone
- Entering a zone due to some event trigger (e.g. Unknown Tunnels, Dark Crypt, Ambush)
- Being swallowed by a tentacle
Some exceptions to this rule are:
- Getting hit by the Fearscape talent
- Following the Grand Corruptor to attack Zigur
Mechanics
As opposed to other resources, such as the effects from Equilibrium which only have a chance of occurring, if the player has any insanity when a talent goes on cooldown or does damage then a chaotic event will happen. This is done by superloading the Actor:startTalentCooldown and DamageProjector:base functions.
A random value is selected between -chaotic percentage and +chaotic percentage and applied separately for talent cooldown and damage, the value -4% might be selected to apply to talent cooldown and +13% to apply to damage on the same turn.
The chaotic event value is multiplied by the standard value and then added to that value, for example the cooldown calculation adds the existing cooldown data.cd to the existing cooldown multiplied by the selected chaotic event (ief):
local ncd = data.cd + math.floor(data.cd * ief / 100)