OLS/Source/ols/Public/DataAssets/OLSAbilitySetDataAsset.h

141 lines
3.8 KiB
C
Raw Permalink Normal View History

2025-01-06 21:29:37 +00:00
// © 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"
2025-01-09 23:05:57 +00:00
#include "OLSPawnDataAsset.h"
#include "OLSAbilitySetDataAsset.generated.h"
DECLARE_LOG_CATEGORY_EXTERN(LogOLSAbilitySetDataAsset, Verbose, All);
2025-01-06 21:29:37 +00:00
/**
* 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<class UOLSGameplayAbility> 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<class UGameplayEffect> 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<class UAttributeSet> 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<struct FGameplayAbilitySpecHandle> AbilitySpecHandles;
// Handles to the granted gameplay effects.
UPROPERTY()
TArray<struct FActiveGameplayEffectHandle> GameplayEffectHandles;
// Pointers to the granted attribute sets
UPROPERTY()
TArray<TObjectPtr<class UAttributeSet>> GrantedAttributeSets;
};
/**
* UOLSAbilitySetDataAsset
*
* Non-mutable data asset used to grant gameplay abilities and gameplay effects.
*/
UCLASS(BlueprintType, Const)
class OLS_API UOLSAbilitySetDataAsset : public UOLSPawnDataAsset
2025-01-06 21:29:37 +00:00
{
GENERATED_BODY()
public:
UOLSAbilitySetDataAsset(const FObjectInitializer& objectInitializer);
2025-01-06 21:29:37 +00:00
// 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<FOLSAbilitySet_GameplayAbility> GrantedGameplayAbilities;
// Gameplay effects to grant when this ability set is granted.
UPROPERTY(EditDefaultsOnly, Category = "Gameplay Effects", meta=(TitleProperty=GameplayEffect))
TArray<FOLSAbilitySet_GameplayEffect> GrantedGameplayEffects;
// Attribute sets to grant when this ability set is granted.
UPROPERTY(EditDefaultsOnly, Category = "Attribute Sets", meta=(TitleProperty=AttributeSet))
TArray<FOLSAbilitySet_AttributeSet> GrantedAttributes;
};