Merge pull request #65 from TheRiverNyx/main

upgrade to ue 5.6 and other stuffs
This commit is contained in:
Lore Natusol
2025-11-06 19:38:03 -07:00
committed by GitHub
19 changed files with 71 additions and 22 deletions

View File

@@ -1,10 +1,14 @@
{ {
"version": "1.0", "version": "1.0",
"components": [ "components": [
"Component.Unreal.Debugger",
"Component.Unreal.Ide",
"Microsoft.Net.Component.4.6.2.TargetingPack", "Microsoft.Net.Component.4.6.2.TargetingPack",
"Microsoft.VisualStudio.Component.VC.14.38.17.8.ATL",
"Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64", "Microsoft.VisualStudio.Component.VC.14.38.17.8.x86.x64",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.22621", "Microsoft.VisualStudio.Component.Windows11SDK.22621",
"Microsoft.VisualStudio.Workload.CoreEditor", "Microsoft.VisualStudio.Workload.CoreEditor",
"Microsoft.VisualStudio.Workload.ManagedDesktop", "Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Workload.NativeDesktop", "Microsoft.VisualStudio.Workload.NativeDesktop",

View File

@@ -1,6 +1,6 @@
{ {
"FileVersion": 3, "FileVersion": 3,
"EngineAssociation": "5.4", "EngineAssociation": "5.6",
"Category": "", "Category": "",
"Description": "", "Description": "",
"Modules": [ "Modules": [

View File

@@ -66,3 +66,23 @@ void UHealthAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCall
} }
} }
void UHealthAttributeSet::PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue)
{
Super::PostAttributeChange(Attribute, OldValue, NewValue);
if (Attribute == GetHealthAttribute())
{
const float ClampedHealth = FMath::Clamp(NewValue, 0.0f, GetMaxHealth());
if (ClampedHealth != NewValue)
{
SetHealth(ClampedHealth);
}
}
if (Attribute == GetMaxHealthAttribute())
{
const float ClampedMaxHealth = FMath::Max(1.0f, NewValue);
if (ClampedMaxHealth != NewValue)
{
SetMaxHealth(ClampedMaxHealth);
}
}
}

View File

@@ -48,8 +48,12 @@ void ULevelAttributeSet::ConsumeXPGain()
const float Gain = GetXPGain(); const float Gain = GetXPGain();
if (Gain > 0.0f) if (Gain > 0.0f)
{ {
SetXP(GetXP() + Gain); float OldXP = GetXP();
float NewXP =OldXP + Gain;
SetXP(NewXP);
SetXPGain(0.0f); SetXPGain(0.0f);
OnXPChanged.Broadcast(this, GetXP(), Gain);
OnLevelChanged.Broadcast(this, GetXP()-Gain, Level.GetCurrentValue());
} }
} }
@@ -108,5 +112,6 @@ void ULevelAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallb
SetLevel(static_cast<float>(Lvl)); SetLevel(static_cast<float>(Lvl));
SetXP(FMath::Clamp(GetXP(),0.0f,ComputeXPForLevel(Lvl))); SetXP(FMath::Clamp(GetXP(),0.0f,ComputeXPForLevel(Lvl)));
SetXPToNextLevel(ComputeXPForLevel(Lvl)); SetXPToNextLevel(ComputeXPForLevel(Lvl));
OnXPToNextLevelChanged.Broadcast(this, XPToNextLevel.GetCurrentValue(), XPToNextLevel.GetCurrentValue());
} }
} }

View File

@@ -38,6 +38,7 @@ void UManaAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallba
if (Data.EvaluatedData.Attribute == GetManaAttribute()) if (Data.EvaluatedData.Attribute == GetManaAttribute())
{ {
SetMana(FMath::Clamp(GetMana(), 0.0f, GetMaxMana())); SetMana(FMath::Clamp(GetMana(), 0.0f, GetMaxMana()));
;
} }
if (Data.EvaluatedData.Attribute == GetCostAttribute()) if (Data.EvaluatedData.Attribute == GetCostAttribute())
{ {
@@ -48,7 +49,9 @@ void UManaAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallba
if (OldMana!=NewMana) if (OldMana!=NewMana)
{ {
SetMana(NewMana); SetMana(NewMana);
OnManaChanged.Broadcast(this, OldMana, NewMana);
} }
OnManaChanged.Broadcast(this, OldMana, NewMana);
SetCost(0.0f); SetCost(0.0f);
} }
if (Data.EvaluatedData.Attribute==GetRestoreAttribute()) if (Data.EvaluatedData.Attribute==GetRestoreAttribute())
@@ -60,7 +63,9 @@ void UManaAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCallba
if (OldMana!=NewMana) if (OldMana!=NewMana)
{ {
SetMana(NewMana); SetMana(NewMana);
OnManaChanged.Broadcast(this, OldMana, NewMana);
} }
OnManaChanged.Broadcast(this, OldMana, NewMana);
SetRestore(0.0f); SetRestore(0.0f);
} }
} }

View File

@@ -45,6 +45,7 @@ void UStaminaAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCal
if (OldStamina!=NewStamina) if (OldStamina!=NewStamina)
{ {
SetStamina(NewStamina); SetStamina(NewStamina);
OnMaxStaminaChanged.Broadcast(this, OldStamina, NewStamina);
} }
SetDrain(0.0f); SetDrain(0.0f);
} }
@@ -57,6 +58,7 @@ void UStaminaAttributeSet::PostGameplayEffectExecute(const FGameplayEffectModCal
if (OldStamina!=NewStamina) if (OldStamina!=NewStamina)
{ {
SetStamina(NewStamina); SetStamina(NewStamina);
OnMaxStaminaChanged.Broadcast(this, OldStamina, NewStamina);
} }
} }
} }

View File

@@ -33,6 +33,7 @@ void AMagickPlayerState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& O
DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, ManaSet, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, ManaSet, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, HealthSet, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, HealthSet, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, StaminaSet, COND_None, REPNOTIFY_Always); DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, StaminaSet, COND_None, REPNOTIFY_Always);
DOREPLIFETIME_CONDITION_NOTIFY(AMagickPlayerState, LevelSet, COND_None, REPNOTIFY_Always);
} }
void AMagickPlayerState::SetupAbilityActorInfo() void AMagickPlayerState::SetupAbilityActorInfo()
@@ -70,5 +71,9 @@ void AMagickPlayerState::SetupAbilityActorInfo()
ElistriaAbilitySystemComponent->AddAttributeSetSubobject(LevelSet.Get()); ElistriaAbilitySystemComponent->AddAttributeSetSubobject(LevelSet.Get());
} }
} }
}
void AMagickPlayerState::OnRep_ElistriaAbilitySystemComponent()
{
// Whenever the ability system component is replicated, we need to refresh the actor info
return;
} }

View File

@@ -24,6 +24,10 @@ public:
virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override; virtual void PostGameplayEffectExecute(const FGameplayEffectModCallbackData& Data) override;
virtual void PostAttributeChange(const FGameplayAttribute& Attribute, float OldValue, float NewValue) override;
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override; virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
UPROPERTY(VisibleAnywhere,BlueprintReadOnly,ReplicatedUsing=OnRep_Health) UPROPERTY(VisibleAnywhere,BlueprintReadOnly,ReplicatedUsing=OnRep_Health)

View File

@@ -11,7 +11,6 @@
/** /**
* *
*/ */
UCLASS() UCLASS()
class ELISTRIA_CALLING_API UStaminaAttributeSet : public UElistriaAttributeSetBase class ELISTRIA_CALLING_API UStaminaAttributeSet : public UElistriaAttributeSetBase
{ {

View File

@@ -31,7 +31,7 @@ public:
void SetupAbilityActorInfo(); void SetupAbilityActorInfo();
protected: protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Abilities, Replicated) UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Abilities, ReplicatedUsing = OnRep_ElistriaAbilitySystemComponent)
TObjectPtr<class UElistriaAbilitySystemComponent> ElistriaAbilitySystemComponent; TObjectPtr<class UElistriaAbilitySystemComponent> ElistriaAbilitySystemComponent;
UPROPERTY(Replicated) UPROPERTY(Replicated)
@@ -46,6 +46,8 @@ protected:
UPROPERTY(Replicated) UPROPERTY(Replicated)
TObjectPtr<ULevelAttributeSet> LevelSet; TObjectPtr<ULevelAttributeSet> LevelSet;
UFUNCTION()
void OnRep_ElistriaAbilitySystemComponent();
private: private:
}; };