Program Listing for File GKAbilityStatic.h

↰ Return to documentation for file (Source/Gamekit/Abilities/GKAbilityStatic.h)

// BSD 3-Clause License Copyright (c) 2022, Pierre Delaunay All rights reserved.

#pragma once

// Gamekit
#include "Gamekit/Animation/GKAnimationSet.h"
#include "Gamekit/GKAssetManager.h"
#include "Gamekit/Gamekit.h"
#include "Gamekit/Projectiles/GKProjectile.h"
#include "Gamekit/Utilities/GKBitFlag.h"

// Unreal Engine
#include "Abilities/GameplayAbilityTargetActor.h"
#include "Engine/DataTable.h"
#include "GameplayAbilitySpec.h"
#include "Styling/SlateBrush.h"

// Generated
#include "GKAbilityStatic.generated.h"

class UGKGameplayAbility;

// MOBA/Hack'n Slash like Ability binding
UENUM(BlueprintType)
enum class EGK_AbilityKind : uint8
{
    None        UMETA(DisplayName = "None"),
    Item        UMETA(DisplayName = "Item"),
    Skill       UMETA(DisplayName = "Skill"),
    Ultimate    UMETA(DisplayName = "Ultimate"),
    // Note: Perk/Talent Can be Gameplay Effect directly
};

// MOBA/Hack'n Slash like Ability binding
UENUM(BlueprintType)
enum class EGK_ActivationBehavior : uint8
{
    Hidden       UMETA(DisplayName = "Hidden"),       // Not shown in UI
    Passive      UMETA(DisplayName = "Passive"),      // Passive ability, enabled as soon as it is equiped
    NoTarget     UMETA(DisplayName = "NoTarget"),     // Ability is cast as soon as the input is pressed
    Targeted     UMETA(DisplayName = "Targeted"),     // Ability targets something
    Charge       UMETA(DisplayName = "Charge"),       // Ability consume charges on activation
    Channel      UMETA(DisplayName = "Channel"),      // Plays animation until the ends and cast spells at the end
    Toggle       UMETA(DisplayName = "Toggle"),       // Ability is Active or not
};

UENUM(BlueprintType)
enum class EGK_TargetMode : uint8 {
    None            UMETA(DisplayName = "None"),
    ActorTarget     UMETA(DisplayName = "ActorTarget"),
    PointTarget     UMETA(DisplayName = "PointTarget"),
    VectorTarget    UMETA(DisplayName = "VectorTarget"),
};

// This is create because we cannot use include AGKAbilityTarget_Actor
// in AbilityStatic
UENUM(BlueprintType)
enum class EGK_TargetingMode : uint8
{
    None                  UMETA(DisplayName = "None"),
    PlayerControllerTrace UMETA(DisplayName = "PlayerControllerTrace"),
};

UENUM(BlueprintType)
enum class EGK_ItemSlot : uint8
{
    None,

    Head,
    Neck,
    Shoulders,
    Shirt,
    Chest,
    Belt,
    Legs,
    Feet,
    Wrist,
    Gloves,
    Finger1,
    Finger2,
    Trinket1,
    Trinket2,
    Back,
    RightHand,
    LeftHand,
    Tabard,

    Ranged,
    Ammo,
};

UENUM(BlueprintType)
enum class EGK_EffectSlot : uint8
{
    // Default Slot, for easier edit in editor
    None,

    TargetEffect,   // Effects applied to the target
                    // In the case of a projectile, the projectile will apply the effects
                    // to the hit

    CasterEffect,   // Effects applied to the Caster


    PassiveEffect,  // Effects that are applied once the ability is learnt
};

USTRUCT(BlueprintType)
struct GAMEKIT_API FGKAbilityCost
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    FGameplayAttribute Attribute;

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    TArray<float> Value;
};

USTRUCT(BlueprintType)
struct GAMEKIT_API FGKAbilityEffect
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    FName EffectName;

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    TArray<float> Curve;

    // Gameplay effect have their own curve data
    // but we want it to use our curve, but the GA system does not like that much
    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    TSubclassOf<UGameplayEffect> GameplayEffectClass;
};


USTRUCT(BlueprintType)
struct GAMEKIT_API FGKAbilityEffects
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY(EditAnywhere, BlueprintReadOnly)
    TArray<FGKAbilityEffect> Effects;
};

USTRUCT(BlueprintType)
struct GAMEKIT_API FGKAbilityStatic: public FTableRowBase
{
    GENERATED_USTRUCT_BODY()

    public:
    FGKAbilityStatic();

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    bool bAutoGenerate;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    FName Name;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    EGK_AbilityKind AbilityKind;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    FText LocalName;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    FText LocalDescription;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Common)
    class UTexture2D *Icon;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    int32 MaxLevel;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    bool bLoop;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    TArray<int32> MaxStackCount;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    FGameplayTag StackTag;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    EGK_ActivationBehavior AbilityBehavior;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    float Duration;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    TMap<EGK_EffectSlot, FGKAbilityEffects> AbilityEffects;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    FGKAbilityCost Cost;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    FGameplayTagContainer CooldownTags;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Ability)
    TArray<float> Cooldown;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
    int32 Price;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
    EGK_ItemSlot Slot;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Item)
    int32 MaxStack;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    bool bIgnoreRange;

    // Should be a TArray | Ability Level can change this
    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    float CastMaxRange;

    // Should be a TArray | Ability Level can change this
    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    float CastMinRange;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target, meta = (Bitmask, BitmaskEnum = "ETeamAttitude"))
    int32 TargetActorFaction;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    TSubclassOf<AActor> TargetFilterClass;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    TSubclassOf<AGameplayAbilityTargetActor> AbilityTargetActorClass;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    TArray<TEnumAsByte<EObjectTypeQuery>> TargetObjectTypes;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Target)
    EGK_TargetMode TargetMode;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Animation)
    float CastTime;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Animation)
    float ChannelTime;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Animation)
    EGK_AbilityAnimation AbilityAnimation;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Projectile);
    TSubclassOf<AGKProjectile> ProjectileActorClass;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Projectile)
    FGKProjectileStatic ProjectileData;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = AreaOfEffect);
    TSubclassOf<AActor> ImpactActorClass;

    UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = AreaOfEffect)
    float AreaOfEffect;
};