// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action. #pragma once #include "CoreMinimal.h" #include "GameplayTagContainer.h" #include "OLSPawnDataAsset.h" #include "OLSAbilitySetDataAsset.generated.h" DECLARE_LOG_CATEGORY_EXTERN(LogOLSAbilitySetDataAsset, Verbose, All); /** * FOLSAbilitySet_GameplayAbility * * Data used by the ability set to grant gameplay abilities. */ USTRUCT(BlueprintType) struct FOLSAbilitySet_GameplayAbility { GENERATED_BODY() public: // Gameplay ability to grant. UPROPERTY(EditDefaultsOnly) TSubclassOf Ability = nullptr; // Tag used to process input for the ability. UPROPERTY(EditDefaultsOnly, Meta = (Categories = "InputTag")) FGameplayTag InputTag = FGameplayTag::EmptyTag; // Level of ability to grant. UPROPERTY(EditDefaultsOnly) int32 AbilityLevel = 1; }; /** * FOLSAbilitySet_GameplayEffect * * Data used by the ability set to grant gameplay effects. */ USTRUCT(BlueprintType) struct FOLSAbilitySet_GameplayEffect { GENERATED_BODY() public: // Gameplay effect to grant. UPROPERTY(EditDefaultsOnly) TSubclassOf GameplayEffect = nullptr; // Level of gameplay effect to grant. UPROPERTY(EditDefaultsOnly) float EffectLevel = 1.0f; }; /** * FOLSAbilitySet_AttributeSet * * Data used by the ability set to grant attribute sets. */ USTRUCT(BlueprintType) struct FOLSAbilitySet_AttributeSet { GENERATED_BODY() public: // Gameplay effect to grant. UPROPERTY(EditDefaultsOnly) TSubclassOf AttributeSet = nullptr; }; /** * FOLSAbilitySet_GrantedHandles * * Data used to store handles to what has been granted by the ability set. */ USTRUCT(BlueprintType) struct FOLSAbilitySet_GrantedHandles { GENERATED_BODY() public: void AddAbilitySpecHandle(const struct FGameplayAbilitySpecHandle& handle); void AddGameplayEffectHandle(const struct FActiveGameplayEffectHandle& handle); void AddAttributeSet(class UAttributeSet* set); void TakeFromAbilitySystem(class UOLSAbilitySystemComponent* olsASC); protected: // Handles to the granted abilities. UPROPERTY() TArray AbilitySpecHandles; // Handles to the granted gameplay effects. UPROPERTY() TArray GameplayEffectHandles; // Pointers to the granted attribute sets UPROPERTY() TArray> GrantedAttributeSets; }; /** * UOLSAbilitySetDataAsset * * Non-mutable data asset used to grant gameplay abilities and gameplay effects. */ UCLASS(BlueprintType, Const) class OLS_API UOLSAbilitySetDataAsset : public UOLSPawnDataAsset { GENERATED_BODY() public: UOLSAbilitySetDataAsset(const FObjectInitializer& objectInitializer); // Grants the ability set to the specified ability system component. // The returned handles can be used later to take away anything that was granted. void GiveToAbilitySystem(class UOLSAbilitySystemComponent* olsASC, FOLSAbilitySet_GrantedHandles* outGrantedHandlePtrs, class UObject* sourceObject = nullptr) const; protected: // Gameplay abilities to grant when this ability set is granted. UPROPERTY(EditDefaultsOnly, Category = "Gameplay Abilities", meta=(TitleProperty=Ability)) TArray GrantedGameplayAbilities; // Gameplay effects to grant when this ability set is granted. UPROPERTY(EditDefaultsOnly, Category = "Gameplay Effects", meta=(TitleProperty=GameplayEffect)) TArray GrantedGameplayEffects; // Attribute sets to grant when this ability set is granted. UPROPERTY(EditDefaultsOnly, Category = "Attribute Sets", meta=(TitleProperty=AttributeSet)) TArray GrantedAttributes; };