From eda89672b4e588ff41f11c561d41d76dfadf07ef Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 22 May 2023 18:22:53 +0100 Subject: [PATCH] Bugfix Insta Kill if Two or More Goats Attacking at Once --- Content/BlueprintAI/AI/AIBruh.uasset | 4 ++-- Content/Blueprints/Combat_UI/CombatCharacter.uasset | 4 ++-- Content/Levels/Build.umap | 4 ++-- Content/Levels/Top_layer_level.umap | 4 ++-- Content/Levels/Tutorial.umap | 4 ++-- .../TurnBasedCombatV2/TurnBaseCombatV2.cpp | 7 +++---- .../TurnBasedCombatV2/TurnBaseCombatV2.h | 2 ++ 7 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Content/BlueprintAI/AI/AIBruh.uasset b/Content/BlueprintAI/AI/AIBruh.uasset index a27f188..d9bffe1 100644 --- a/Content/BlueprintAI/AI/AIBruh.uasset +++ b/Content/BlueprintAI/AI/AIBruh.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a9889fded33312a545955891e4d26cc0587c03dce0f0ca94026f81f512d63e79 -size 127551 +oid sha256:c1fa306226c67f19b3cacee9ccb029c43cd7f852aeaf9991a97200adf1680489 +size 118076 diff --git a/Content/Blueprints/Combat_UI/CombatCharacter.uasset b/Content/Blueprints/Combat_UI/CombatCharacter.uasset index b8d5dfd..a41ea29 100644 --- a/Content/Blueprints/Combat_UI/CombatCharacter.uasset +++ b/Content/Blueprints/Combat_UI/CombatCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:35730f8f29cba65b4dc0d24bebd32638b6c15d556649971f81070c7e04289e31 -size 291263 +oid sha256:f79e50037de3803312127d0d8f246d2fcb3ff5cf578c8787b8b71f9912dcd5b7 +size 285350 diff --git a/Content/Levels/Build.umap b/Content/Levels/Build.umap index 6630526..ca70f1c 100644 --- a/Content/Levels/Build.umap +++ b/Content/Levels/Build.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5ede46e78730fddc11f0f66363ef87e76e955dbbb7c35f27cdd0ba0b405d45bc -size 5331476 +oid sha256:0464148e35f23ace7d17a6dc4c509b52ee33a6803243ec4a5e239e288778cb18 +size 5334633 diff --git a/Content/Levels/Top_layer_level.umap b/Content/Levels/Top_layer_level.umap index 6328772..33fa2b0 100644 --- a/Content/Levels/Top_layer_level.umap +++ b/Content/Levels/Top_layer_level.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dedd979f41fe8e3cd615aa11ff545a2fc6daf6a70ee3abc9ac6fc058bd017478 -size 244897 +oid sha256:bf45f26a67267c8485935d0542e38acc6779dc2fabea6fadd189d2e9eed36dcf +size 243297 diff --git a/Content/Levels/Tutorial.umap b/Content/Levels/Tutorial.umap index 3a74606..467f694 100644 --- a/Content/Levels/Tutorial.umap +++ b/Content/Levels/Tutorial.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7b008b10c12d0295dba3131c677d6ff129a9808f353a27ceedf67fbd266012e1 -size 269742 +oid sha256:ec83194ad4a3a06b53a14675450f1c8b5fde964e26f2719d7d616c917e2ecc33 +size 268142 diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index 7f5e986..2e98e04 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -54,7 +54,7 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot) EscapePercentage = CalculateEscapePercentage(); EscapePercentageTextBlock->SetText(FText::Join(FText::FromString(""), FText::FromString(FString::FromInt(EscapePercentage * 100)), FText::FromString("%"))); bIsInCombat = true; - UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetInstigatorController())->GetBlackboardComponent(); + UBlackboardComponent* EnemyBlackboard = Cast(EnemyActor->GetInstigatorController())->GetBlackboardComponent(); Cast(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden); HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast(PlayerActor)->Inventory->GetItemAmount(0), 0, 99)))); @@ -80,7 +80,6 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, const bool bWasShot) PlayerController->SetInputMode(FInputModeGameAndUI()); PlayerController->bShowMouseCursor = true; - if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; EnemyBlackboard->SetValueAsBool("IsInCombat", true); const FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health")); int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr(Enemy); @@ -158,6 +157,7 @@ void ATurnBaseCombatV2::CombatCheck(const bool bWasShot) void ATurnBaseCombatV2::EndCombat() { + GetWorldTimerManager().ClearTimer(EnemyTurnTimerHandle); BookHUD->SetVisibility(ESlateVisibility::Hidden); HUD->RemoveFromParent(); BookStaticMeshComponent->SetVisibility(false); @@ -580,8 +580,7 @@ void ATurnBaseCombatV2::SwitchTurn() TurnIndicatorTextBlock->SetText(FText::FromString("Enemy Turn")); DisableButtons(); - FTimerHandle UnusedHandle; - GetWorldTimerManager().SetTimer(UnusedHandle, this, &ATurnBaseCombatV2::EnemyTurn, 2.0f, false); + GetWorldTimerManager().SetTimer(EnemyTurnTimerHandle, this, &ATurnBaseCombatV2::EnemyTurn, 2.0f, false); //activeActor = bIsPlayerTurn ? enemyActor : playerActor; } diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h index d464590..019ac62 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.h @@ -146,6 +146,8 @@ protected: private: bool IsValidCombo(const FString& Combo) const; bool IsSpecialCombo(const FString& Combo) const; + UPROPERTY() + FTimerHandle EnemyTurnTimerHandle; UPROPERTY() APostProcessVolume* PostProcessVolume;