diff --git a/dGame/dBehaviors/ApplyBuffBehavior.cpp b/dGame/dBehaviors/ApplyBuffBehavior.cpp index 5c6a94df..74ab72dd 100644 --- a/dGame/dBehaviors/ApplyBuffBehavior.cpp +++ b/dGame/dBehaviors/ApplyBuffBehavior.cpp @@ -16,8 +16,11 @@ void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS if (buffComponent == nullptr) return; - buffComponent->ApplyBuff(m_BuffId, m_Duration, context->originator, m_AddImmunity, m_ApplyOnTeammates m_CancelOnDamaged, m_CancelOnDeath, - m_CancelOnLogout, m_CancelOnRemoveBuff, m_CancelOnUi, m_CancelOnUnequip, m_CancelOnZone, m_CancelOnDamageAbsDone, m_UseRefCount); + buffComponent->ApplyBuff(m_BuffId, m_Duration, context->originator, + m_AddImmunity, m_ApplyOnTeammates, + m_CancelOnDamaged, m_CancelOnDeath, m_CancelOnLogout, m_CancelOnRemoveBuff, + m_CancelOnUi, m_CancelOnUnequip, m_CancelOnZone, m_CancelOnDamageAbsDone, + m_UseRefCount); } void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) { diff --git a/dGame/dComponents/BuffComponent.cpp b/dGame/dComponents/BuffComponent.cpp index 18b245d1..df13ddb6 100644 --- a/dGame/dComponents/BuffComponent.cpp +++ b/dGame/dComponents/BuffComponent.cpp @@ -90,13 +90,6 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO bool cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, bool cancelOnRemoveBuff, bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, bool cancelOnDamageAbsDone, bool useRefCount) { - // Prevent buffs from stacking. - - if (HasBuff(id)) { - if (useRefCount){ - auto buff = m_Buffs.find(id); - } else return; - } GameMessages::SendAddBuff(const_cast(m_Parent->GetObjectID()), source, (uint32_t)id, (uint32_t)duration * 1000, addImmunity, applyOnTeammates, cancelOnDamaged, cancelOnDeath, @@ -139,6 +132,7 @@ void BuffComponent::ApplyBuff(const int32_t id, const float duration, const LWOO buff.cancelOnZone = cancelOnZone; buff.useRefCount = useRefCount; buff.refcount = 1; + m_Buffs.emplace(id, buff); } diff --git a/dGame/dComponents/BuffComponent.h b/dGame/dComponents/BuffComponent.h index 353795a4..a2426890 100644 --- a/dGame/dComponents/BuffComponent.h +++ b/dGame/dComponents/BuffComponent.h @@ -45,7 +45,7 @@ struct Buff bool cancelOnZone = false; bool useRefCount = false; - uint32_t refcount = 1 + uint32_t refcount = 1; };