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 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-26 18:45:53 -05:00
parent e9dd2c9473
commit 86ee6de544
2 changed files with 5 additions and 2 deletions

View File

@@ -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<LevelProgressionComponent>();
if (levelProgressionComponent) m_SpeedBoost = levelProgressionComponent->GetSpeedBase();

View File

@@ -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<ControllablePhysicsComponent>();
if (controllablePhysics && controllablePhysics->GetSpeedMultiplier() > 0.0f) speed *= controllablePhysics->GetSpeedMultiplier();
const auto delta = m_NextWaypoint - source;