Buffs
Info
Dependencies:
- PermMem
- FrameFunctions
Implementation:
Buffs.d on GitHub
This package allows you to easily create status effects that can affect any NPC. Status effects on the hero are displayed graphically in a bar.
Initialization
Initialize with LeGo_Buffs flag.
Warning
This package is still experimental and not included in the LeGo_All initialization flag.
Functions
Buff_Apply
Buff_Apply
Applies a status effect to an NPC.
-
var C_NPC npc
NPC to be affected by this effect -
var int buff
The instance of the effect to apply to the NPC
Return value
The function returns the handle of the buff, which was just generated.
Buff_ApplyUnique
Buff_ApplyUnique
Buff_Apply, but nothing happens if a status effect of that kind is already on the NPC.
-
var C_NPC npc
NPC to be affected by this effect -
var int buff
The instance of the effect to apply to the NPC
Return value
The function returns the handle of the buff, which was just generated or 0 if the buff is already applied on the NPC.
Buff_ApplyOrRefresh
Buff_ApplyOrRefresh
Buff_Apply, but if a status effect of this type is already affecting the NPC, the duration will be reset.
-
var C_NPC npc
NPC to be affected by this effect -
var int buff
The instance of the effect to apply to the NPC
Return value
The function returns the handle of the buff, which was just generated or refreshed.
Buff_Refresh
Buff_Refresh
Resets the duration of the buff.
var int buffHandle
Handle of the buff to refresh
Buff_Remove
Buff_Remove
Removes the buff from the all NPCs.
var int buffHandle
Handle of the buff to remove
Buff_RemoveAll
Buff_RemoveAll
Removes the buffs form the NPC.
var C_NPC npc
NPC whose buff should be removed
Buff_GetNpc
Buff_GetNpc
Returns a pointer to the NPC, which is affected by the buff.
var int buffHandle
Handle of the buff
Return value
The function returns a pointer to the NPC, which is affected by the buff.
Buff_Has
Buff_Has
Checks if the NPC already has an effect applied.
-
var C_NPC npc
Checked NPC -
var int buff
The instance of the effect
Return value
The function returns TRUE if the NPC has an effect applied. FALSE is returned otherwise.
SAVE_GetFuncID
SAVE_GetFuncID
Same as MEM_GetFuncID but gets the current instance.
var func f
Function whose ID is got
Return value
The function returns the ID of given function.
lCBuff class
The buffs package implements an lCBuff class, which looks like this:
Examples
Delayed poison
Damage should also be added:
SAVE_GetFuncID instead of MEM_GetFuncID. For example, if this buff is now applied to the hero, by calling Buff_Apply(hero, deadly_poison), he loses a total of 30 HP over 10 seconds.