Bugfix Larger Health Values Break Health UI

This commit is contained in:
Philip W 2023-04-28 04:47:24 +01:00
parent 38ffd4f339
commit cf433291a9
8 changed files with 17 additions and 12 deletions

BIN
Content/BlueprintAI/AI/AIBruh.uasset (Stored with Git LFS)

Binary file not shown.

BIN
Content/BlueprintAI/AI/AIBruh_Boss.uasset (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Levels/Enemy_Test.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Levels/Top_layer_level.umap (Stored with Git LFS)

Binary file not shown.

BIN
Content/Levels/Tutorial.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -388,7 +388,9 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, FString DamageType)
void ATurnBaseCombatV2::UpdateProgressBars() const
{
EnemyHealthBar->SetPercent(*EnemyHealth / 100.0f);
FProperty* MaxHealthProperty = EnemyActor->GetClass()->FindPropertyByName(FName("MaxHealth"));
int32* EnemyMaxHealthPtr = MaxHealthProperty->ContainerPtrToValuePtr<int32>(EnemyActor);
EnemyHealthBar->SetPercent(static_cast<float>(*EnemyHealth) / static_cast<float>(*EnemyMaxHealthPtr));
}
float ATurnBaseCombatV2::CalculateEscapePercentage() const