diff --git a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp index a249022..80e801e 100644 --- a/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp +++ b/Source/the_twilight_abyss/TurnBasedCombatV2/TurnBaseCombatV2.cpp @@ -3,8 +3,9 @@ #include "TurnBaseCombatV2.h" #include "CoreMinimal.h" -#include "BehaviorTree/BlackboardComponent.h" +#include "AIController.h" #include "Blueprint/UserWidget.h" +#include "BehaviorTree/BlackboardComponent.h" #include "Components/TextBlock.h" #include "Components/ProgressBar.h" #include "GameFramework/Character.h" @@ -24,8 +25,10 @@ ATurnBaseCombatV2::ATurnBaseCombatV2() void ATurnBaseCombatV2::StartCombat(AActor* Enemy) { if (Enemy == nullptr) return; - UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetComponentByClass(UBlackboardComponent::StaticClass())); + UBlackboardComponent* EnemyBlackboard = Cast(Enemy->GetInstigatorController())->GetBlackboardComponent(); + if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; + EnemyBlackboard->SetValueAsBool("IsInCombat", true); FProperty* HealthProperty = Enemy->GetClass()->FindPropertyByName(FName("Health")); int32* EnemyHealthPtr = HealthProperty->ContainerPtrToValuePtr(Enemy); diff --git a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs index 98ba233..b8c5d17 100644 --- a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs +++ b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs @@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG", "Niagara", "AIModule" }); PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" }); diff --git a/Source/the_twilight_abyssEditor.Target.cs b/Source/the_twilight_abyssEditor.Target.cs index 6a6f8ad..527000c 100644 --- a/Source/the_twilight_abyssEditor.Target.cs +++ b/Source/the_twilight_abyssEditor.Target.cs @@ -9,6 +9,7 @@ public class the_twilight_abyssEditorTarget : TargetRules { Type = TargetType.Editor; DefaultBuildSettings = BuildSettingsVersion.V2; + IncludeOrderVersion = EngineIncludeOrderVersion.Unreal5_1; ExtraModuleNames.AddRange( new string[] { "the_twilight_abyss" } ); } }