Updated Combat UI for Damage & Status Indicator, Miss Chance & Removed Battle Log
This commit is contained in:
parent
6e21026fcb
commit
7b185adaf4
BIN
Content/Blueprints/Combat_UI/BookCombat_UI.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/BookCombat_UI.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
Content/Blueprints/Combat_UI/Combat_UI.uasset
(Stored with Git LFS)
BIN
Content/Blueprints/Combat_UI/Combat_UI.uasset
(Stored with Git LFS)
Binary file not shown.
@ -242,6 +242,9 @@ void ATurnBaseCombatV2::BeginPlay()
|
||||
EscapePercentageTextBlock = Cast<UTextBlock>(BookHUD->GetWidgetFromName("EscapePercentage_Text"));
|
||||
DamageMultiplierTextBlock = Cast<UTextBlock>(BookHUD->GetWidgetFromName("DamageMultiplier_Text"));
|
||||
HealingJellyAmountTextBlock = Cast<UTextBlock>(BookHUD->GetWidgetFromName("HealingAmount_Text"));
|
||||
DamageAmountEnemyTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("DamageAmountEnemy_Text"));
|
||||
DamageAmountPlayerTextBlock = Cast<UTextBlock>(BookHUD->GetWidgetFromName("DamageAmountPlayer_Text"));
|
||||
StatusTextBlock = Cast<UTextBlock>(HUD->GetWidgetFromName("Status_Text"));
|
||||
PlayerHealthBar = Cast<UProgressBar>(BookHUD->GetWidgetFromName("PlayerHealthBar"));
|
||||
EnemyHealthBar = Cast<UProgressBar>(HUD->GetWidgetFromName("EnemyHealthBar"));
|
||||
ProbertiumResourceBar = Cast<UProgressBar>(BookHUD->GetWidgetFromName("ProbertiumResourceBar"));
|
||||
@ -393,7 +396,11 @@ void ATurnBaseCombatV2::RevertActionPoints()
|
||||
|
||||
void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
*PlayerHealth -= FMath::Clamp(Damage * BaseDefenseMultiplier, 0, 100);
|
||||
DamageAmountPlayerTextBlock->SetText(FText::FromString("-" + FString::FromInt(Damage * BaseDefenseMultiplier)));
|
||||
const FString Command3 = FString::Printf(TEXT("PlayDamagePlayerTextAnimation"));
|
||||
BookHUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
UpdateProgressBars();
|
||||
AddBattleLogMessage("Player was damaged for " + FString::FromInt(Damage * BaseDefenseMultiplier) + " HP by " + DamageType + ".");
|
||||
if (*EnemyHealth <= 0)
|
||||
@ -403,7 +410,6 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
|
||||
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);
|
||||
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command = FString::Printf(TEXT("TriggerDeathAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||
return;
|
||||
@ -418,7 +424,6 @@ void ATurnBaseCombatV2::DamagePlayer(int Damage, const FString& DamageType)
|
||||
DeathScreenWidget->AddToViewport();
|
||||
return;
|
||||
}
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command = FString::Printf(TEXT("PlayCameraShakeShoot"));
|
||||
PlayerActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||
RedVignetteMaterialInstance->SetScalarParameterValue(FName("BlendWeight"), 1.0f);
|
||||
@ -431,15 +436,18 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, const FString& DamageType)
|
||||
{
|
||||
*EnemyHealth -= FMath::Clamp(Damage * BaseDamageMultiplier, 0, 100);
|
||||
UpdateProgressBars();
|
||||
DamageAmountEnemyTextBlock->SetText(FText::FromString("-" + FString::FromInt(Damage * BaseDamageMultiplier)));
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command = FString::Printf(TEXT("PlayDamageEnemyTextAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||
AddBattleLogMessage("Enemy was damaged for " + FString::FromInt(Damage * BaseDamageMultiplier) + " HP by " + DamageType + ".");
|
||||
|
||||
FProperty* IsBossProperty = FindFieldChecked<FProperty>(EnemyActor->GetClass(), "IsBoss");
|
||||
const FBoolProperty* IsBossBoolProperty = CastFieldChecked<FBoolProperty>(IsBossProperty);
|
||||
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command = FString::Printf(TEXT("TriggerDamageAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||
const FString Command2 = FString::Printf(TEXT("TriggerDamageAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
|
||||
}
|
||||
|
||||
//Ends Combat if either the player or enemy is dead
|
||||
@ -448,9 +456,8 @@ void ATurnBaseCombatV2::DamageEnemy(int Damage, const FString& DamageType)
|
||||
EndCombat();
|
||||
if (IsBossBoolProperty->GetPropertyValue_InContainer(EnemyActor))
|
||||
{
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command = FString::Printf(TEXT("TriggerDeathAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command, AR, nullptr, true);
|
||||
const FString Command2 = FString::Printf(TEXT("TriggerDeathAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
|
||||
return;
|
||||
}
|
||||
EnemyActor->Destroy();
|
||||
@ -619,6 +626,10 @@ void ATurnBaseCombatV2::RunButtonOnClick()
|
||||
if (FMath::RandRange(0.0f, 1.0f) >= EscapePercentage)
|
||||
{
|
||||
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("Escape Failed"));
|
||||
StatusTextBlock->SetText(FText::FromString("Escape Failed"));
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
EscapePercentage = CalculateEscapePercentage();
|
||||
EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%")));
|
||||
SwitchTurn();
|
||||
@ -729,7 +740,17 @@ void ATurnBaseCombatV2::EnableButtons() const
|
||||
|
||||
void ATurnBaseCombatV2::EnemyTurn()
|
||||
{
|
||||
DamagePlayer(10);
|
||||
if (FMath::RandRange(1, 100) > 30) DamagePlayer(10);
|
||||
else
|
||||
{
|
||||
StatusTextBlock->SetText(FText::FromString("Missed"));
|
||||
FOutputDeviceNull AR;
|
||||
const FString Command3 = FString::Printf(TEXT("PlayStatusAnimation"));
|
||||
HUD->CallFunctionByNameWithArguments(*Command3, AR, nullptr, true);
|
||||
const FString Command2 = FString::Printf(TEXT("TriggerAttackAnimation"));
|
||||
EnemyActor->CallFunctionByNameWithArguments(*Command2, AR, nullptr, true);
|
||||
}
|
||||
|
||||
OnEnemyTurn.Broadcast(EnemyActor, PlayerActor);
|
||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
||||
EnableButtons();
|
||||
|
@ -169,6 +169,12 @@ private:
|
||||
UTextBlock* DamageMultiplierTextBlock;
|
||||
UPROPERTY()
|
||||
UTextBlock* HealingJellyAmountTextBlock;
|
||||
UPROPERTY()
|
||||
UTextBlock* DamageAmountEnemyTextBlock;
|
||||
UPROPERTY()
|
||||
UTextBlock* DamageAmountPlayerTextBlock;
|
||||
UPROPERTY()
|
||||
UTextBlock* StatusTextBlock;
|
||||
|
||||
UPROPERTY()
|
||||
UProgressBar* PlayerHealthBar;
|
||||
|
Loading…
Reference in New Issue
Block a user