mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-12 19:28:21 +00:00
Use new logic for applying speed changes in ApplyBuff (#919)
This commit is contained in:
parent
bbd5a49ea2
commit
6ec921025d
@ -170,17 +170,10 @@ void BuffComponent::ApplyBuffEffect(int32_t id) {
|
|||||||
|
|
||||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination);
|
destroyable->SetMaxImagination(destroyable->GetMaxImagination() + maxImagination);
|
||||||
} else if (parameter.name == "speed") {
|
} else if (parameter.name == "speed") {
|
||||||
const auto speed = parameter.value;
|
|
||||||
|
|
||||||
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
||||||
|
if (!controllablePhysicsComponent) return;
|
||||||
if (controllablePhysicsComponent == nullptr) return;
|
const auto speed = parameter.value;
|
||||||
|
controllablePhysicsComponent->AddSpeedboost(speed);
|
||||||
const auto current = controllablePhysicsComponent->GetSpeedMultiplier();
|
|
||||||
|
|
||||||
controllablePhysicsComponent->SetSpeedMultiplier(current + ((speed - 500.0f) / 500.0f));
|
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(this->GetParent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -213,17 +206,10 @@ void BuffComponent::RemoveBuffEffect(int32_t id) {
|
|||||||
|
|
||||||
destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination);
|
destroyable->SetMaxImagination(destroyable->GetMaxImagination() - maxImagination);
|
||||||
} else if (parameter.name == "speed") {
|
} else if (parameter.name == "speed") {
|
||||||
const auto speed = parameter.value;
|
|
||||||
|
|
||||||
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
auto* controllablePhysicsComponent = this->GetParent()->GetComponent<ControllablePhysicsComponent>();
|
||||||
|
if (!controllablePhysicsComponent) return;
|
||||||
if (controllablePhysicsComponent == nullptr) return;
|
const auto speed = parameter.value;
|
||||||
|
controllablePhysicsComponent->RemoveSpeedboost(speed);
|
||||||
const auto current = controllablePhysicsComponent->GetSpeedMultiplier();
|
|
||||||
|
|
||||||
controllablePhysicsComponent->SetSpeedMultiplier(current - ((speed - 500.0f) / 500.0f));
|
|
||||||
|
|
||||||
EntityManager::Instance()->SerializeEntity(this->GetParent());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user