#pragma once #include "CoreMinimal.h" #include "Components/ActorComponent.h" #include "ActiveStatusEffectBank.h" #include "Templates/SubclassOf.h" #include "StatusEffectsComponent.generated.h" class AActor; class UHealthComponentBase; class UObject; class UStatusEffect; class UStatusEffectExclusiveKey; UCLASS(Blueprintable, ClassGroup=Custom, meta=(BlueprintSpawnableComponent)) class UStatusEffectsComponent : public UActorComponent { GENERATED_BODY() public: protected: UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true)) TArray ActiveStatusEffects; UPROPERTY(BlueprintReadWrite, EditAnywhere, Instanced, Transient, meta=(AllowPrivateAccess=true)) UHealthComponentBase* OwnerHealth; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true)) TSet ActiveExclusiveKeys; UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) bool IgnoreAll; public: UStatusEffectsComponent(); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) static bool TryPushActiveStatusEffect(TSubclassOf StatusEffect, AActor* Target, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) static bool TryPopActiveStatusEffect(TSubclassOf StatusEffect, AActor* Target, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) bool PushActiveStatusEffectInstance(UStatusEffect* StatusEffect, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) bool PushActiveStatusEffect(TSubclassOf StatusEffect, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) void PopAllActiveStatusEffectsOfType(TSubclassOf StatusEffect, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) void PopAllActiveStatusEffects(AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) bool PopActiveStatusEffectInstance(UStatusEffect* StatusEffect, AActor* Owner); UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) bool PopActiveStatusEffect(TSubclassOf StatusEffect, AActor* Owner); protected: UFUNCTION(BlueprintCallable) void OnDeath(UHealthComponentBase* HealthComponent); public: UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable, BlueprintPure) bool HasActiveEffect(TSubclassOf StatusEffect) const; UFUNCTION(BlueprintCallable, BlueprintPure) int32 GetStackAmount(TSubclassOf StatusEffect, AActor* Owner) const; UFUNCTION(BlueprintCallable, BlueprintPure) int32 GetFullStackAmount(TSubclassOf StatusEffect) const; UFUNCTION(BlueprintAuthorityOnly, BlueprintCallable) static UStatusEffect* CreateStatusEffectInstance(TSubclassOf StatusEffect, UObject* Owner); };