Skip to content

DamageTypeDefinition ​

Inherits: DatabaseResource < Resource

A type of damage that can be dealt and resisted: Physical, Fire, Frost, Poison ...

Description ​

A damage type is a label, plus one optional job: it can apply effects to whoever it hurts ("fire always burns", "poison always poisons"). When a hit of this type lands, apply_hit_effects starts each effect in applied_effects on the target, with the attacker as the originator. See docs/systems/entity-stats.md, section 28.

Properties ​

ColorcolorColor.WHITE
Array[int]applied_effects[]
floatapply_chance100.0
boolapply_on_periodic_hitsfalse

Methods ​

intget_id()
boolapplies_effects()
Array[EffectInstance]apply_hit_effects( combat_manager: CombatManager, result: DamageResult )

Property descriptions ​

Color color = Color.WHITE ​

The color that stands for this in the interface

Effects Applied On Hit

Array[int] applied_effects = [] ​

The effects (Effect ids) put on the target whenever a hit of this damage type lands: a burn for Fire, a poison for Poison. Empty (default) = the damage type applies nothing. Each effect follows its own stacking rules, so a burn that refreshes stays one burn however often it is hit

float apply_chance = 100.0 ​

The chance (0 to 100) that the effects are applied when a hit lands. 100 = always

bool apply_on_periodic_hits = false ​

Do the ticks of a damage-over-time effect apply them too? Off by default: a burn that burns would otherwise re-apply itself on every tick. The effects in applied_effects (and the effects inside them) never re-apply them either way

Method descriptions ​

int get_id() ​

Get unique identifier

bool applies_effects() ​

Does the damage type apply effects?

Array[EffectInstance] apply_hit_effects( combat_manager: CombatManager, result: DamageResult ) ​

A hit of this damage type has landed (result is complete): puts the effects on the target. Nothing happens for a hit that was avoided, immune, redirected or reduced to nothing, for a target that is not an entity or object, or for a hit caused by one of this damage type's own effects. Returns the instances that were started (an instant effect has finished by then)