Compare commits

...

2 Commits

Author SHA1 Message Date
Ed_
d34201e8a1 71. Derived Attributes 2024-10-22 16:52:42 -04:00
Ed_
2d625967a9 69. Modifier Coefficients 2024-10-22 15:51:42 -04:00
7 changed files with 327 additions and 10 deletions

Binary file not shown.

View File

@ -2,10 +2,14 @@
"ColumnWidths":
{
"MaxValue": 165,
"Description": 135,
"Description": 303,
"Category": 96,
"BaseValue": 106,
"Name": 82,
"MinAttribute": 327
"BaseValue": 81,
"Name": 124,
"MinAttribute": 84,
"bUseMaxAttribute": 112,
"bUseMinAttribute": 114,
"MinValue": 73,
"MaxAttribute": 90
}
}

View File

@ -63,6 +63,70 @@ void UGasaAttributeSet::Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMan
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), MaxMana, PrevMaxMana );
}
void UGasaAttributeSet::Client_OnRep_Armor( FGameplayAttributeData& PrevArmor )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Armor ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication( FGameplayAttribute( UGasaAttributeSetProperty ), Armor, PrevArmor );
}
void UGasaAttributeSet::Client_OnRep_ArmorPenentration( FGameplayAttributeData& PrevArmorPenentration )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ArmorPenentration ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), ArmorPenentration, PrevArmorPenentration
);
}
void UGasaAttributeSet::Client_OnRep_BlockChance( FGameplayAttributeData& PrevBlockChance )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, BlockChance ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), BlockChance, PrevBlockChance
);
}
void UGasaAttributeSet::Client_OnRep_CriticalHitChance( FGameplayAttributeData& PrevCriticalHitChance )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitChance ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitChance, PrevCriticalHitChance
);
}
void UGasaAttributeSet::Client_OnRep_CriticalHitDamage( FGameplayAttributeData& PrevCriticalHitDamage )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitDamage ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitDamage, PrevCriticalHitDamage
);
}
void UGasaAttributeSet::Client_OnRep_CriticalHitResistance( FGameplayAttributeData& PrevCriticalHitResistance )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty =
FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitResistance ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), CriticalHitResistance, PrevCriticalHitResistance
);
}
void UGasaAttributeSet::Client_OnRep_HealthRegeneration( FGameplayAttributeData& PrevHealthRegeneration )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty =
FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, HealthRegeneration ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), HealthRegeneration, PrevHealthRegeneration
);
}
void UGasaAttributeSet::Client_OnRep_ManaRegeneration( FGameplayAttributeData& PrevManaRegeneration )
{
// From GAMEPLAYATTRIBUTE_REPNOTIFY
static FProperty* UGasaAttributeSetProperty = FindFieldChecked<FProperty>( StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ManaRegeneration ) );
GetOwningAbilitySystemComponentChecked()->SetBaseAttributeValueFromReplication(
FGameplayAttribute( UGasaAttributeSetProperty ), ManaRegeneration, PrevManaRegeneration
);
}
#pragma endregion Rep Notifies
void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackData const& Data )
@ -73,7 +137,7 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
if ( Data.EvaluatedData.Attribute == GetHealthAttribute() )
{
SetHealth( FMath::Clamp( GetHealth(), 0, GetMaxHealth() ) );
SetHealth( FMath::Clamp( GetHealth(), 0, 300.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetManaAttribute() )
{
@ -103,8 +167,38 @@ void UGasaAttributeSet::PostGameplayEffectExecute( FGameplayEffectModCallbackDat
{
SetMaxMana( FMath::Clamp( GetMaxMana(), 0, 99999.000000 ) );
}
Props.Populate( Data );
if ( Data.EvaluatedData.Attribute == GetArmorAttribute() )
{
SetArmor( FMath::Clamp( GetArmor(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetArmorPenentrationAttribute() )
{
SetArmorPenentration( FMath::Clamp( GetArmorPenentration(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetBlockChanceAttribute() )
{
SetBlockChance( FMath::Clamp( GetBlockChance(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetCriticalHitChanceAttribute() )
{
SetCriticalHitChance( FMath::Clamp( GetCriticalHitChance(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetCriticalHitDamageAttribute() )
{
SetCriticalHitDamage( FMath::Clamp( GetCriticalHitDamage(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetCriticalHitResistanceAttribute() )
{
SetCriticalHitResistance( FMath::Clamp( GetCriticalHitResistance(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetHealthRegenerationAttribute() )
{
SetHealthRegeneration( FMath::Clamp( GetHealthRegeneration(), 0, 999.000000 ) );
}
if ( Data.EvaluatedData.Attribute == GetManaRegenerationAttribute() )
{
SetManaRegeneration( FMath::Clamp( GetManaRegeneration(), 0, 999.000000 ) );
}
}
void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute, float& NewValue )
@ -113,7 +207,7 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
if ( Attribute == GetHealthAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, GetMaxHealth() );
NewValue = FMath::Clamp( NewValue, 0, 300.000000 );
}
if ( Attribute == GetManaAttribute() )
{
@ -143,6 +237,38 @@ void UGasaAttributeSet::PreAttributeChange( FGameplayAttribute const& Attribute,
{
NewValue = FMath::Clamp( NewValue, 0, 99999.000000 );
}
if ( Attribute == GetArmorAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetArmorPenentrationAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetBlockChanceAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetCriticalHitChanceAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetCriticalHitDamageAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetCriticalHitResistanceAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetHealthRegenerationAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
if ( Attribute == GetManaRegenerationAttribute() )
{
NewValue = FMath::Clamp( NewValue, 0, 999.000000 );
}
}
void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& OutLifetimeProps ) const
@ -157,4 +283,12 @@ void UGasaAttributeSet::GetLifetimeReplicatedProps( TArray<FLifetimeProperty>& O
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Vigor );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxHealth );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, MaxMana );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, Armor );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, ArmorPenentration );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, BlockChance );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitChance );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitDamage );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, CriticalHitResistance );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, HealthRegeneration );
DOREPLIFETIME_DEFAULT_GAS( UGasaAttributeSet, ManaRegeneration );
}

View File

@ -35,6 +35,22 @@ public:
FGameplayAttributeData MaxHealth;
UPROPERTY( ReplicatedUsing = Client_OnRep_MaxMana, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData MaxMana;
UPROPERTY( ReplicatedUsing = Client_OnRep_Armor, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData Armor;
UPROPERTY( ReplicatedUsing = Client_OnRep_ArmorPenentration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData ArmorPenentration;
UPROPERTY( ReplicatedUsing = Client_OnRep_BlockChance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData BlockChance;
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitChance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData CriticalHitChance;
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitDamage, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData CriticalHitDamage;
UPROPERTY( ReplicatedUsing = Client_OnRep_CriticalHitResistance, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData CriticalHitResistance;
UPROPERTY( ReplicatedUsing = Client_OnRep_HealthRegeneration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData HealthRegeneration;
UPROPERTY( ReplicatedUsing = Client_OnRep_ManaRegeneration, EditAnywhere, BlueprintReadWrite, Category = "Attributes|Secondary" )
FGameplayAttributeData ManaRegeneration;
UFUNCTION()
@ -53,6 +69,22 @@ public:
void Client_OnRep_MaxHealth( FGameplayAttributeData& PrevMaxHealth );
UFUNCTION()
void Client_OnRep_MaxMana( FGameplayAttributeData& PrevMaxMana );
UFUNCTION()
void Client_OnRep_Armor( FGameplayAttributeData& PrevArmor );
UFUNCTION()
void Client_OnRep_ArmorPenentration( FGameplayAttributeData& PrevArmorPenentration );
UFUNCTION()
void Client_OnRep_BlockChance( FGameplayAttributeData& PrevBlockChance );
UFUNCTION()
void Client_OnRep_CriticalHitChance( FGameplayAttributeData& PrevCriticalHitChance );
UFUNCTION()
void Client_OnRep_CriticalHitDamage( FGameplayAttributeData& PrevCriticalHitDamage );
UFUNCTION()
void Client_OnRep_CriticalHitResistance( FGameplayAttributeData& PrevCriticalHitResistance );
UFUNCTION()
void Client_OnRep_HealthRegeneration( FGameplayAttributeData& PrevHealthRegeneration );
UFUNCTION()
void Client_OnRep_ManaRegeneration( FGameplayAttributeData& PrevManaRegeneration );
#pragma region Getters
static FGameplayAttribute GetHealthAttribute()
@ -95,6 +127,52 @@ public:
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, MaxMana ) );
return Prop;
}
static FGameplayAttribute GetArmorAttribute()
{
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, Armor ) );
return Prop;
}
static FGameplayAttribute GetArmorPenentrationAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ArmorPenentration ) );
return Prop;
}
static FGameplayAttribute GetBlockChanceAttribute()
{
static FProperty* Prop = FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, BlockChance ) );
return Prop;
}
static FGameplayAttribute GetCriticalHitChanceAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitChance ) );
return Prop;
}
static FGameplayAttribute GetCriticalHitDamageAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitDamage ) );
return Prop;
}
static FGameplayAttribute GetCriticalHitResistanceAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, CriticalHitResistance ) );
return Prop;
}
static FGameplayAttribute GetHealthRegenerationAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, HealthRegeneration ) );
return Prop;
}
static FGameplayAttribute GetManaRegenerationAttribute()
{
static FProperty* Prop =
FindFieldChecked<FProperty>( UGasaAttributeSet::StaticClass(), GET_MEMBER_NAME_CHECKED( UGasaAttributeSet, ManaRegeneration ) );
return Prop;
}
FORCEINLINE float GetHealth() const { return Health.GetCurrentValue(); }
FORCEINLINE float GetMana() const { return Mana.GetCurrentValue(); }
@ -104,6 +182,14 @@ public:
FORCEINLINE float GetVigor() const { return Vigor.GetCurrentValue(); }
FORCEINLINE float GetMaxHealth() const { return MaxHealth.GetCurrentValue(); }
FORCEINLINE float GetMaxMana() const { return MaxMana.GetCurrentValue(); }
FORCEINLINE float GetArmor() const { return Armor.GetCurrentValue(); }
FORCEINLINE float GetArmorPenentration() const { return ArmorPenentration.GetCurrentValue(); }
FORCEINLINE float GetBlockChance() const { return BlockChance.GetCurrentValue(); }
FORCEINLINE float GetCriticalHitChance() const { return CriticalHitChance.GetCurrentValue(); }
FORCEINLINE float GetCriticalHitDamage() const { return CriticalHitDamage.GetCurrentValue(); }
FORCEINLINE float GetCriticalHitResistance() const { return CriticalHitResistance.GetCurrentValue(); }
FORCEINLINE float GetHealthRegeneration() const { return HealthRegeneration.GetCurrentValue(); }
FORCEINLINE float GetManaRegeneration() const { return ManaRegeneration.GetCurrentValue(); }
#pragma endregion Getters
#pragma region Setters
@ -115,6 +201,14 @@ public:
FORCEINLINE void SetVigor( float NewVal );
FORCEINLINE void SetMaxHealth( float NewVal );
FORCEINLINE void SetMaxMana( float NewVal );
FORCEINLINE void SetArmor( float NewVal );
FORCEINLINE void SetArmorPenentration( float NewVal );
FORCEINLINE void SetBlockChance( float NewVal );
FORCEINLINE void SetCriticalHitChance( float NewVal );
FORCEINLINE void SetCriticalHitDamage( float NewVal );
FORCEINLINE void SetCriticalHitResistance( float NewVal );
FORCEINLINE void SetHealthRegeneration( float NewVal );
FORCEINLINE void SetManaRegeneration( float NewVal );
#pragma endregion Setters
#pragma region AttributeSet

View File

@ -77,6 +77,78 @@ void UGasaAttributeSet::SetMaxMana( float NewVal )
AbilityComp->SetNumericAttributeBase( GetMaxManaAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetArmor( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetArmorAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetArmorPenentration( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetArmorPenentrationAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetBlockChance( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetBlockChanceAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetCriticalHitChance( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetCriticalHitChanceAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetCriticalHitDamage( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetCriticalHitDamageAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetCriticalHitResistance( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetCriticalHitResistanceAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetHealthRegeneration( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetHealthRegenerationAttribute(), NewVal );
};
}
FORCEINLINE
void UGasaAttributeSet::SetManaRegeneration( float NewVal )
{
UAbilitySystemComponent* AbilityComp = GetOwningAbilitySystemComponent();
if ( ensure( AbilityComp ) )
{
AbilityComp->SetNumericAttributeBase( GetManaRegenerationAttribute(), NewVal );
};
}
#pragma endregion Attribute Setters
namespace Gasa

View File

@ -65,9 +65,19 @@ AGasaCharacter::AGasaCharacter()
}
#pragma region Ability System
void AGasaCharacter::ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GE, float Level)
{
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
ensure(ASC);
ensure(GE);
FGameplayEffectContextHandle Context = ASC->MakeEffectContext();
FGameplayEffectSpecHandle Spec = ASC->MakeOutgoingSpec(GE, Level, Context );
ASC->ApplyGameplayEffectSpecToTarget( * Spec.Data, ASC );
}
void AGasaCharacter::InitDefaultAttributes()
{
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
UAbilitySystemComponent* ASC = GetAbilitySystemComponent();
ensure(ASC);
ensure(DefaultVitalAttributes);
ensure(DefaultPrimaryAttributes);

View File

@ -44,6 +44,9 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Ability System")
TSubclassOf<UGameplayEffect> DefaultSecondaryAttributes;
UFUNCTION(BlueprintCallable)
void ApplyEffectToSelf(TSubclassOf<UGameplayEffect> GE, float Level);
void InitDefaultAttributes();
#pragma endregion Ability System