This commit is contained in:
Aaron Kimbre 2022-12-24 09:08:41 -06:00
parent 9e530b91d6
commit 8f9df9178a
3 changed files with 7 additions and 10 deletions

View File

@ -16,8 +16,11 @@ void ApplyBuffBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitS
if (buffComponent == nullptr) return; if (buffComponent == nullptr) return;
buffComponent->ApplyBuff(m_BuffId, m_Duration, context->originator, m_AddImmunity, m_ApplyOnTeammates m_CancelOnDamaged, m_CancelOnDeath, buffComponent->ApplyBuff(m_BuffId, m_Duration, context->originator,
m_CancelOnLogout, m_CancelOnRemoveBuff, m_CancelOnUi, m_CancelOnUnequip, m_CancelOnZone, m_CancelOnDamageAbsDone, m_UseRefCount); 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) { void ApplyBuffBehavior::UnCast(BehaviorContext* context, BehaviorBranchContext branch) {

View File

@ -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 cancelOnDamaged, bool cancelOnDeath, bool cancelOnLogout, bool cancelOnRemoveBuff,
bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, bool cancelOnDamageAbsDone, bool cancelOnUi, bool cancelOnUnequip, bool cancelOnZone, bool cancelOnDamageAbsDone,
bool useRefCount) { bool useRefCount) {
// Prevent buffs from stacking.
if (HasBuff(id)) {
if (useRefCount){
auto buff = m_Buffs.find(id);
} else return;
}
GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, (uint32_t)id, GameMessages::SendAddBuff(const_cast<LWOOBJID&>(m_Parent->GetObjectID()), source, (uint32_t)id,
(uint32_t)duration * 1000, addImmunity, applyOnTeammates, cancelOnDamaged, cancelOnDeath, (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.cancelOnZone = cancelOnZone;
buff.useRefCount = useRefCount; buff.useRefCount = useRefCount;
buff.refcount = 1; buff.refcount = 1;
m_Buffs.emplace(id, buff); m_Buffs.emplace(id, buff);
} }

View File

@ -45,7 +45,7 @@ struct Buff
bool cancelOnZone = false; bool cancelOnZone = false;
bool useRefCount = false; bool useRefCount = false;
uint32_t refcount = 1 uint32_t refcount = 1;
}; };