// Fill out your copyright notice in the Description page of Project Settings.


#include "Helpers/StatForgeFunctionLibrary.h"

#include "Components/StatForgeComponent.h"

float UStatForgeFunctionLibrary::GetStatValue(const FName StatName, AActor* Actor)
{
	if (!Actor || StatName.IsNone()) return 0.f;
	
	UStatForgeComponent* StatForgeComponent = Actor->GetComponentByClass<UStatForgeComponent>();
	if(!StatForgeComponent) return 0.f;
	
	return StatForgeComponent->GetStatValue(StatName);
}

FGuid UStatForgeFunctionLibrary::ApplyGameplayStatEffect(const TSubclassOf<UGameplayStatEffect> EffectClass,
	TMap<FName, float> DataValueMap, AActor* Actor, int32 Stacks)
{
	if (!EffectClass || !Actor) return FGuid();
	
	UStatForgeComponent* StatForgeComponent = Actor->GetComponentByClass<UStatForgeComponent>();
	if(!StatForgeComponent) return FGuid();
	
	return StatForgeComponent->ApplyGameplayStatEffect(EffectClass, DataValueMap, Stacks);
}
