Bugfix Enemy Always Started First
This commit is contained in:
parent
37268a3dc2
commit
4f336263fb
BIN
Content/BlueprintAI/AI/AIBruh.uasset
(Stored with Git LFS)
BIN
Content/BlueprintAI/AI/AIBruh.uasset
(Stored with Git LFS)
Binary file not shown.
@ -76,7 +76,7 @@ void UHoldToInitCombat::OnClickDown()
|
||||
EnemyBlackboard = Cast<AAIController>(TargetEnemy->GetInstigatorController())->GetBlackboardComponent();
|
||||
if (!EnemyBlackboard->GetValueAsBool("WasInCombat"))
|
||||
{
|
||||
Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->StartCombat(TargetEnemy);
|
||||
Cast<ATurnBaseCombatV2>(GetWorld()->GetGameState())->StartCombat(TargetEnemy, true);
|
||||
return;
|
||||
}
|
||||
InitCombatWidget->SetVisibility(ESlateVisibility::Hidden);
|
||||
|
@ -32,7 +32,7 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
|
||||
}
|
||||
}
|
||||
|
||||
void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
||||
void ATurnBaseCombatV2::StartCombat(AActor* Enemy, bool bWasShot)
|
||||
{
|
||||
if (Enemy == nullptr) return;
|
||||
EnemyActor = Enemy;
|
||||
@ -71,11 +71,11 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
|
||||
return;
|
||||
}
|
||||
|
||||
CombatCheck();
|
||||
CombatCheck(bWasShot);
|
||||
//DrawDebugPoint(GetWorld(), Enemy->GetActorLocation(), 10, FColor::Red, false, 10);
|
||||
}
|
||||
|
||||
void ATurnBaseCombatV2::CombatCheck()
|
||||
void ATurnBaseCombatV2::CombatCheck(bool bWasShot)
|
||||
{
|
||||
const UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(EnemyActor->GetInstigatorController())->GetBlackboardComponent();
|
||||
|
||||
@ -93,15 +93,18 @@ void ATurnBaseCombatV2::CombatCheck()
|
||||
ClearBattleLog();
|
||||
EnableButtons();
|
||||
|
||||
if (EnemyBlackboard->GetValueAsBool("Sight"))
|
||||
FProperty* ReactionSpeedProperty = EnemyActor->GetClass()->FindPropertyByName(FName("ReactionSpeed"));
|
||||
float* EnemyReactionSpeedPtr = ReactionSpeedProperty->ContainerPtrToValuePtr<float>(EnemyActor);
|
||||
if (EnemyBlackboard->GetValueAsBool("Sight") && !bWasShot)
|
||||
{
|
||||
//bEnemyHasExtraTurn = true;
|
||||
SwitchTurn();
|
||||
}
|
||||
else
|
||||
else if (Cast<ATempCharacter>(PlayerActor)->ReactionSpeed > *EnemyReactionSpeedPtr && bWasShot)
|
||||
{
|
||||
bPlayerHasExtraTurn = true;
|
||||
}
|
||||
TurnIndicatorTextBlock->SetText(FText::FromString("Player Turn"));
|
||||
}
|
||||
|
||||
void ATurnBaseCombatV2::EndCombat()
|
||||
|
@ -97,9 +97,9 @@ public:
|
||||
FString BattleLog;
|
||||
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void StartCombat(AActor* Enemy);
|
||||
void StartCombat(AActor* Enemy, bool bWasShot = false);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void CombatCheck();
|
||||
void CombatCheck(bool bWasShot = false);
|
||||
UFUNCTION(BlueprintCallable)
|
||||
void EndCombat();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user