Skip to content

applyBuff ​

Function of @v12-engine/engine

ts
export declare function applyBuff(world: World, target: Entity, buff: string, duration?: number, source?: Entity, level?: number, ability?: string): BuffInstance | undefined;

Puts a buff on an entity. Buffs do not stack with themselves: a second one of the same kind renews the first when it lasts longer (BuffDef.stacking says otherwise). Returns the one of it this was about: the one put on, or the one there already that it renewed, replaced or left as it was; none where it was refused (its carrier dead, an unstoppable carrier, the beforeBuff hook). What stacks or shields the buff as it is put on goes by that one: with perSource, the source's own; with independent, the new one