GASATHON/Project/Source/Gasa/AbilitySystem/GasaAttributeSet.cpp

159 lines
6.6 KiB
C++
Raw Normal View History

2024-10-22 10:25:27 -07:00
// Generated by GasaEditor/GasaGen/GasaGen_AttributeSets.cpp
#include "GasaAttributeSet.h"
2024-04-21 15:56:57 -07:00
#include "GasaAttributeSet_Inlines.h"
2024-04-24 17:18:38 -07:00
#include "EffectProperties.h"
2024-04-13 07:19:45 -07:00
#include "AbilitySystemComponent.h"
#include "Net/UnrealNetwork.h"
#include "Networking/GasaNetLibrary.h"
2024-10-19 19:34:51 -07:00
#include "GameplayEffectExtension.h"
2024-10-22 10:25:27 -07:00
UGasaAttributeSet::UGasaAttributeSet() {}
#pragma region Rep Notifies
2024-10-22 10:25:27 -07:00
void UGasaAttributeSet::Client_OnRep_Health( FGameplayAttributeData& PrevHealth )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Health ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Health, PrevHealth );
}
void UGasaAttributeSet::Client_OnRep_Mana( FGameplayAttributeData& PrevMana )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Mana ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Mana, PrevMana );
}
void UGasaAttributeSet::Client_OnRep_Strength( FGameplayAttributeData& PrevStrength )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Strength ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Strength, PrevStrength );
}
void UGasaAttributeSet::Client_OnRep_Intelligence( FGameplayAttributeData& PrevIntelligence )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Intelligence ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), Intelligence, PrevIntelligence
);
}
void UGasaAttributeSet::Client_OnRep_Resilience( FGameplayAttributeData& PrevResilience )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Resilience ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), Resilience, PrevResilience
);
}
void UGasaAttributeSet::Client_OnRep_Vigor( FGameplayAttributeData& PrevVigor )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Vigor ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Vigor, PrevVigor );
}
2024-04-24 21:30:54 -07:00
void UGasaAttributeSet::Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth )
{
2024-04-22 09:01:30 -07:00
// From GAMEPLAYATTRIBUTE_REPNOTIFY
2024-04-24 21:30:54 -07:00
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxHealth ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxHealth, PrevMaxHealth );
}
2024-04-24 21:30:54 -07:00
void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana )
{
2024-04-22 09:01:30 -07:00
// From GAMEPLAYATTRIBUTE_REPNOTIFY
2024-04-24 21:30:54 -07:00
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxMana, PrevMaxMana );
}
2024-04-22 09:01:30 -07:00
#pragma endregion Rep Notifies
2024-04-24 21:30:54 -07:00
void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackData const& Data )
2024-04-24 15:18:26 -07:00
{
2024-04-24 21:30:54 -07:00
Super::PostGameplayEffectExecute( Data );
2024-04-24 17:18:38 -07:00
FEffectProperties Props;
2024-04-24 21:30:54 -07:00
Props.Populate( Data );
2024-10-19 19:34:51 -07:00
2024-10-22 10:25:27 -07:00
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
{
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
}
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
{
SetMana( FMath::Clamp( GetMana(), 0, GetMaxMana() ) );
}
if ( Data.EvaluatedData.Attribute == GetStrengthAttribute() )
{
SetStrength( FMath::Clamp( GetStrength(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetIntelligenceAttribute() )
{
SetIntelligence( FMath::Clamp( GetIntelligence(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetResilienceAttribute() )
{
SetResilience( FMath::Clamp( GetResilience(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetVigorAttribute() )
{
SetVigor( FMath::Clamp( GetVigor(), 0, 999.000000 ) );
}
2024-10-19 19:34:51 -07:00
if ( Data.EvaluatedData.Attribute == GetMaxHealthAttribute() )
{
SetMaxHealth( FMath::Clamp( GetMaxHealth(), 0, 99999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetMaxManaAttribute() )
{
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
}
2024-04-24 17:18:38 -07:00
}
2024-04-24 15:18:26 -07:00
2024-04-24 21:30:54 -07:00
void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, float& NewValue )
2024-04-24 17:18:38 -07:00
{
2024-04-24 21:30:54 -07:00
Super::PreAttributeChange( Attribute, NewValue );
2024-04-24 17:18:38 -07:00
2024-10-22 10:25:27 -07:00
if ( Attribute == GetHealthAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
}
if ( Attribute == GetManaAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, GetMaxMana() );
}
if ( Attribute == GetStrengthAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetIntelligenceAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetResilienceAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetVigorAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
2024-04-24 21:30:54 -07:00
if ( Attribute == GetMaxHealthAttribute() )
2024-04-24 15:18:26 -07:00
{
2024-04-24 21:30:54 -07:00
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
2024-04-24 15:18:26 -07:00
}
2024-04-24 21:30:54 -07:00
if ( Attribute == GetMaxManaAttribute() )
2024-04-24 15:18:26 -07:00
{
2024-04-24 21:30:54 -07:00
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
2024-04-24 15:18:26 -07:00
}
}
2024-04-24 17:18:38 -07:00
2024-04-24 21:30:54 -07:00
void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps ) const
{
2024-04-24 21:30:54 -07:00
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
2024-10-22 10:25:27 -07:00
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Health );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Mana );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Strength );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Intelligence );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Resilience );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
2024-04-24 21:30:54 -07:00
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
}