From 86ee6de54410def67ce55cd05977305175a4798e Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Sat, 26 Sep 2026 18:45:53 -0500 Subject: [PATCH] fix: slows and speed buffs change enemy movement speed Speed buffs (BuffParameters "speed", for example the slow from the Great Katana of Freezing and the Shurikens of Ice) and speed behaviours go through ControllablePhysicsComponent's speed multiplier, which only players' clients used. Enemies move with MovementAIComponent, which ignored it, so slows had no effect on them. - MovementAIComponent scales its waypoint speed by the entity's speed multiplier when one is set. - RemoveSpeedboost set the multiplier of any entity without a LevelProgressionComponent (every enemy and pet) to 0 once its last boost ended, which was harmless while nothing read it for them. It now goes back to the normal base of 500 (multiplier 1). Needs an in-game check with the freezing katana charge-up against an enemy. Fixes #1179 Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/ControllablePhysicsComponent.cpp | 2 +- dGame/dComponents/MovementAIComponent.cpp | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/ControllablePhysicsComponent.cpp b/dGame/dComponents/ControllablePhysicsComponent.cpp index 86be8622b..9778ae301 100644 --- a/dGame/dComponents/ControllablePhysicsComponent.cpp +++ b/dGame/dComponents/ControllablePhysicsComponent.cpp @@ -289,7 +289,7 @@ void ControllablePhysicsComponent::RemoveSpeedboost(float value) { } // Recalculate speedboost since we removed one - m_SpeedBoost = 0.0f; + m_SpeedBoost = 500.0f; // Entities without level progression (enemies, pets) go back to the normal multiplier of 1 if (m_ActiveSpeedBoosts.empty()) { // no active speed boosts left, so return to base speed auto* levelProgressionComponent = m_Parent->GetComponent(); if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase(); diff --git a/dGame/dComponents/MovementAIComponent.cpp b/dGame/dComponents/MovementAIComponent.cpp index f5ef9f367..dbb623a07 100644 --- a/dGame/dComponents/MovementAIComponent.cpp +++ b/dGame/dComponents/MovementAIComponent.cpp @@ -155,7 +155,10 @@ void MovementAIComponent::Update(const float deltaTime) { } else { m_CurrentSpeed = std::min(m_CurrentSpeed + m_Acceleration, m_MaxSpeed); - const auto speed = m_CurrentSpeed * m_BaseSpeed; // scale speed based on base speed + // scale speed based on base speed, and by any speed buffs or slows on this entity + auto speed = m_CurrentSpeed * m_BaseSpeed; + const auto* const controllablePhysics = m_Parent->GetComponent(); + if (controllablePhysics && controllablePhysics->GetSpeedMultiplier() > 0.0f) speed *= controllablePhysics->GetSpeedMultiplier(); const auto delta = m_NextWaypoint - source;