diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 4d5a378c..3475c471 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -937,8 +937,13 @@ void GameMessages::SendResurrect(Entity* entity) { if (destroyableComponent != nullptr && entity->GetLOT() == 1) { auto* levelComponent = entity->GetComponent(); if (levelComponent) { - destroyableComponent->SetHealth(levelComponent->GetLevel() >= 45 ? 8 : 4); - destroyableComponent->SetImagination(levelComponent->GetLevel() >= 45 ? 20 : 6); + int32_t healthToRestore = levelComponent->GetLevel() >= 45 ? 8 : 4; + if (healthToRestore > destroyableComponent->GetMaxHealth()) healthToRestore = destroyableComponent->GetMaxHealth(); + destroyableComponent->SetHealth(healthToRestore); + + int32_t imaginationToRestore = levelComponent->GetLevel() >= 45 ? 20 : 6; + if (imaginationToRestore > destroyableComponent->GetMaxImagination()) imaginationToRestore = destroyableComponent->GetMaxImagination(); + destroyableComponent->SetImagination(imaginationToRestore); } } });