diff --git a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset index 1797a7b..1e2f7ec 100644 --- a/Content/Blueprints/Combat_UI/BookCombat_UI.uasset +++ b/Content/Blueprints/Combat_UI/BookCombat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8679be9a07e030f59c091a5347c504f457e38df8731e3817e3418032e278af65 -size 132557 +oid sha256:6c5fcc9889b89941b5a0a8d8ab6dec169e3409c426d30d3e4c20cdaee22b5453 +size 164265 diff --git a/Content/Blueprints/Combat_UI/Combat_UI.uasset b/Content/Blueprints/Combat_UI/Combat_UI.uasset index 31e369c..9996d3c 100644 --- a/Content/Blueprints/Combat_UI/Combat_UI.uasset +++ b/Content/Blueprints/Combat_UI/Combat_UI.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:fffe659c4cd31c2e7931a4f31faa4d9e14646e1be50743c4fa9d6f276397c37f -size 37826 +oid sha256:4437094a6e73b899dd4ec398c22ccf5914a0cc512faf2b9ef2cf1ed9452536e5 +size 95430 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index ac64e95..ef67e59 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -242,6 +242,9 @@ void ATurnBaseCombatV2::BeginPlay() EscapePercentageTextBlock = Cast(BookHUD->GetWidgetFromName("EscapePercentage_Text")); DamageMultiplierTextBlock = Cast(BookHUD->GetWidgetFromName("DamageMultiplier_Text")); HealingJellyAmountTextBlock = Cast(BookHUD->GetWidgetFromName("HealingAmount_Text")); + DamageAmountEnemyTextBlock = Cast(HUD->GetWidgetFromName("DamageAmountEnemy_Text")); + DamageAmountPlayerTextBlock = Cast(BookHUD->GetWidgetFromName("DamageAmountPlayer_Text")); + StatusTextBlock = Cast(HUD->GetWidgetFromName("Status_Text")); PlayerHealthBar = Cast(BookHUD->GetWidgetFromName("PlayerHealthBar")); EnemyHealthBar = Cast(HUD->GetWidgetFromName("EnemyHealthBar")); ProbertiumResourceBar = Cast(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(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(EnemyActor->GetClass(), "IsBoss"); const FBoolProperty* IsBossBoolProperty = CastFieldChecked(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(); diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index a857da3..35de317 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -169,6 +169,12 @@ private: UTextBlock* DamageMultiplierTextBlock; UPROPERTY() UTextBlock* HealingJellyAmountTextBlock; + UPROPERTY() + UTextBlock* DamageAmountEnemyTextBlock; + UPROPERTY() + UTextBlock* DamageAmountPlayerTextBlock; + UPROPERTY() + UTextBlock* StatusTextBlock; UPROPERTY() UProgressBar* PlayerHealthBar;