Buffs are temporary status effects that can affect the player or enemies. They’re often used for other things too, for example buffs are used to store the current value of the player’s shields and the amount of Battle Rhythm the fighter class has. Here is an example buff, the Drenched debuff:
{id: "Drenched", type: "fireDamageResist", aura: "#59a0d1", aurasprite: "Drenched", power: 0.425, player: true, duration: 20, enemies: true, events: [
{type: "RemoveDrench", duration: 1, trigger: "tick"},
{type: "ApplyConduction", duration: 1, trigger: "tick", kind: "invis"},
{type: "ApplyConduction", duration: 1, trigger: "tickAfter", kind: "invis"},
]};
Here’s a non-exhaustive list of properties a buff can have:
id: The name of the buff. if there is a buff icon, the icon file is named ("buff" + id) and is located in the Buffs/buff folder (CASE SENSITIVE!)
type: The stat that the buff increases. This is linear. For example, this one adds 0.425 to fireDamageResist.
You can get the resulting buff using KDEntityBuffedStat(entity, buff), e.g. KDEntityBuffedStat(KinkyDungeonPlayerEntity, "fireDamageResist")
entity can also be an enemy
aura: The color of the buff ring around the player. This will also cause the buff to show up in the player's buff list. Set this to undefined if you want the buff to be hidden and invisible
aurasprite: Set to "Null" if you don't want a ring around the player. You can also add your own aura sprite to the Aura folder.
buffSprite: set to True if you want to use a custom sprite for the buff sprite in the buff list. This needs to be declared to prevent crashes or glitches from buffs without a sprite
noAuraColor: Do not colorize the ring around the player
text: The text displayed on the buff icon in the buff list
buffTextReplace: You can use a javascript object to replace certain text in the tooltip as well. E.g. {PERCENT: "100%"} will replace the string 'PERCENT' with '100%'
power: The amount this buff increases the stat by
duration: An integer that describes how long the buff lasts
player: If this buff is attached to a spell, it determines whether the buff is applied to the player if the player is in a spell's radius
enemies: If this buff is attached to a spell, it determines whether the buff is applied to a NPCs in the radius
noAlly: Does not affect NPCs that are allied to the player, only for application by spells
onlyAlly: Only affects NPCs that are allied to the player, only for application by spells
range: For application by spells, the radius this buff is applied at
tags: A list of tags that apply to the buff. There are helpful functions like KinkyDungeonRemoveBuffsWithTag which can use these
events: List of events that apply to the buff
hideHelpless: hide the buff if the enemy is helpless
To apply a buff you can use:
KinkyDungeonApplyBuffToEntity(entity, buff);
Buffs have a ‘type’ and a ‘power’. This allows you to get the total value of a buffed stat. For example, if you want to get the player’s total fire damage resistance:
KDEntityBuffedStat(KDPlayer(), "fireDamageResist")
To convert linear values into a multiplier (for example, for damage resist), you can use KinkyDungeonMultiplicativeStat(number). This applies a simple formula. The function returns 1 if you give it 0. Positive values return a value between 0 and 1, while negative values are added to 1. This is the basic formula used to calculate damage resistances in the game.