Bugfix Insta Kill if Two or More Goats Attacking at Once

This commit is contained in:
Philip W 2023-05-22 18:22:53 +01:00
parent 9c747a96c2
commit eda89672b4
7 changed files with 15 additions and 14 deletions

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

Binary file not shown.

Binary file not shown.

BIN
Content/Levels/Build.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

@ -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<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(EnemyActor->GetInstigatorController())->GetBlackboardComponent();
Cast<UQuestSystem>(PlayerActor->GetComponentByClass(UQuestSystem::StaticClass()))->QuestWidgetInstance->SetVisibility(ESlateVisibility::Hidden);
HealingJellyAmountTextBlock->SetText(FText::FromString(FString::FromInt(FMath::Clamp(Cast<ATempCharacter>(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<int32>(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;
}

View File

@ -146,6 +146,8 @@ protected:
private:
bool IsValidCombo(const FString& Combo) const;
bool IsSpecialCombo(const FString& Combo) const;
UPROPERTY()
FTimerHandle EnemyTurnTimerHandle;
UPROPERTY()
APostProcessVolume* PostProcessVolume;