Files
tedwardsandCursor ff5640a020 Establish UE 5.8 known-good baseline with Batch 1 archaeology docs.
Initialize Git with LFS for binary assets and add standard Unreal Engine .gitignore/.gitattributes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 19:40:19 -07:00

37 lines
1.3 KiB
C++

// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Actors/RIREffectActor.h"
#include "GameplayEffect.h"
#include "AbilitySystemComponent.h"
#include "AbilitySystemBlueprintLibrary.h"
// Sets default values
ARIREffectActor::ARIREffectActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SetRootComponent(CreateDefaultSubobject<USceneComponent>("SceneRoot"));
}
// Called when the game starts or when spawned
void ARIREffectActor::BeginPlay()
{
Super::BeginPlay();
}
void ARIREffectActor::ApplyEffectToTarget(AActor* TargetActor, TSubclassOf<UGameplayEffect> GamePlayEffectClass)
{
UAbilitySystemComponent* TargetAbilitySystemComponent = UAbilitySystemBlueprintLibrary::GetAbilitySystemComponent(TargetActor);
if (TargetAbilitySystemComponent == nullptr) return;
check (GamePlayEffectClass);
FGameplayEffectContextHandle EffectContextHandle = TargetAbilitySystemComponent->MakeEffectContext();
EffectContextHandle.AddSourceObject(this);
const FGameplayEffectSpecHandle EffectSpecHandle = TargetAbilitySystemComponent->MakeOutgoingSpec(GamePlayEffectClass, 1.f, EffectContextHandle);
TargetAbilitySystemComponent->ApplyGameplayEffectSpecToSelf(*EffectSpecHandle.Data.Get());
}