From 14fc049ea0b52623a301b6aa8bc1bda5215859fd Mon Sep 17 00:00:00 2001 From: m888r <25947228+m888r@users.noreply.github.com> Date: Sat, 1 Jan 2022 01:46:05 -0800 Subject: [PATCH] Damage Buff source fix - inventor beehive bug (#306) * add HandleUnmanaged overload to account for skill source * add source to buff damage skill call to credit players for kills * use LWOOBJID_EMPTY default arg & behaviorcontext constructor --- dGame/dComponents/BuffComponent.cpp | 2 +- dGame/dComponents/SkillComponent.cpp | 6 +++--- dGame/dComponents/SkillComponent.h | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/dGame/dComponents/BuffComponent.cpp b/dGame/dComponents/BuffComponent.cpp index bf159964..06c859c8 100644 --- a/dGame/dComponents/BuffComponent.cpp +++ b/dGame/dComponents/BuffComponent.cpp @@ -71,7 +71,7 @@ void BuffComponent::Update(float deltaTime) buff.second.tickTime = buff.second.tick; buff.second.stacks--; - SkillComponent::HandleUnmanaged(buff.second.behaviorID, m_Parent->GetObjectID()); + SkillComponent::HandleUnmanaged(buff.second.behaviorID, m_Parent->GetObjectID(), buff.second.source); } } diff --git a/dGame/dComponents/SkillComponent.cpp b/dGame/dComponents/SkillComponent.cpp index 2f7ff7ab..0846f014 100644 --- a/dGame/dComponents/SkillComponent.cpp +++ b/dGame/dComponents/SkillComponent.cpp @@ -481,9 +481,9 @@ void SkillComponent::SyncProjectileCalculation(const ProjectileSyncEntry& entry) delete bitStream; } -void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID target) +void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID target, LWOOBJID source) { - auto* context = new BehaviorContext(target); + auto* context = new BehaviorContext(source); context->unmanaged = true; context->caster = target; @@ -496,7 +496,7 @@ void SkillComponent::HandleUnmanaged(const uint32_t behaviorId, const LWOOBJID t delete bitStream; - delete context; + delete context; } void SkillComponent::HandleUnCast(const uint32_t behaviorId, const LWOOBJID target) diff --git a/dGame/dComponents/SkillComponent.h b/dGame/dComponents/SkillComponent.h index 830b3db6..c0738efc 100644 --- a/dGame/dComponents/SkillComponent.h +++ b/dGame/dComponents/SkillComponent.h @@ -158,8 +158,9 @@ public: * Computes a server-side skill calculation without an associated entity. * @param behaviorId the root behavior ID of the skill * @param target the explicit target of the skill + * @param source the explicit source of the skill */ - static void HandleUnmanaged(uint32_t behaviorId, LWOOBJID target); + static void HandleUnmanaged(uint32_t behaviorId, LWOOBJID target, LWOOBJID source = LWOOBJID_EMPTY); /** * Computes a server-side skill uncast calculation without an associated entity.