fix: Buff FX not playing and general BuffComponent improvements (#1296)

* fix: Buff FX not playing

Fixes an issue where buff effects would not play at all.

Tested that frakjaw and maelstrom dagger now play their respective effects when you are effected by them

fix: buffs general improvements

add new arguments

* Remove duplicated code

* fix times and remove buff
This commit is contained in:
David Markowitz
2023-12-01 08:12:48 -08:00
committed by GitHub
parent 0b9dbaedbf
commit eca87c7257
6 changed files with 187 additions and 52 deletions

View File

@@ -14,8 +14,7 @@ class Entity;
/**
* Extra information on effects to apply after applying a buff, for example whether to buff armor, imag or health and by how much
*/
struct BuffParameter
{
struct BuffParameter {
int32_t buffId;
std::string name;
float value;
@@ -26,8 +25,7 @@ struct BuffParameter
/**
* Meta information about a buff that can be applied, e.g. how long it's applied, who applied it, etc.
*/
struct Buff
{
struct Buff {
int32_t id = 0;
float time = 0;
float tick = 0;
@@ -35,6 +33,15 @@ struct Buff
int32_t stacks = 0;
LWOOBJID source = 0;
int32_t behaviorID = 0;
bool cancelOnDamaged = false;
bool cancelOnDeath = false;
bool cancelOnLogout = false;
bool cancelOnRemoveBuff = false;
bool cancelOnUi = false;
bool cancelOnUnequip = false;
bool cancelOnZone = false;
bool applyOnTeammates = false;
uint32_t refCount = 0;
};
/**
@@ -74,14 +81,17 @@ public:
*/
void ApplyBuff(int32_t id, float duration, LWOOBJID source, bool addImmunity = false, bool cancelOnDamaged = false,
bool cancelOnDeath = true, bool cancelOnLogout = false, bool cancelOnRemoveBuff = true,
bool cancelOnUi = false, bool cancelOnUnequip = false, bool cancelOnZone = false);
bool cancelOnUi = false, bool cancelOnUnequip = false, bool cancelOnZone = false, bool applyOnTeammates = false);
void ApplyBuffFx(uint32_t buffId, const BuffParameter& buffName);
void RemoveBuffFx(uint32_t buffId, const BuffParameter& buffName);
/**
* Removes a buff from the parent entity, reversing its effects
* @param id the id of the buff to remove
* @param removeImmunity whether or not to remove immunity on removing the buff
*/
void RemoveBuff(int32_t id, bool fromUnEquip = false, bool removeImmunity = false);
void RemoveBuff(int32_t id, bool fromUnEquip = false, bool removeImmunity = false, bool ignoreRefCount = false);
/**
* Returns whether or not the entity has a buff identified by `id`