magic update #2

This commit is contained in:
Nyx
2025-09-26 17:50:32 -06:00
parent 6da5d7f1fb
commit dc2c5af68a
34 changed files with 449 additions and 20 deletions

View File

@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AbilitySystemComponent.h"
#include "ElistriaAbilitySystemComponent.generated.h"
/**
*
*/
UCLASS()
class ELISTRIA_CALLING_API UElistriaAbilitySystemComponent : public UAbilitySystemComponent
{
GENERATED_BODY()
};

View File

@@ -0,0 +1,17 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "HealthAttributeSet.generated.h"
/**
*
*/
UCLASS()
class ELISTRIA_CALLING_API UHealthAttributeSet : public UAttributeSet
{
GENERATED_BODY()
};

View File

@@ -0,0 +1,19 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "MagickPlayerController.generated.h"
/**
*
*/
UCLASS()
class ELISTRIA_CALLING_API AMagickPlayerController : public APlayerController
{
GENERATED_BODY()
virtual void OnPossess(APawn* InPawn) override;
};

View File

@@ -0,0 +1,36 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/PlayerState.h"
#include "AbilitySystemInterface.h"
#include "ElistriaAbilitySystemComponent.h"
#include "ManaAttributeSet.h"
#include "MagickPlayerController.h"
#include "MagickPlayerState.generated.h"
UCLASS(Config=game)
class ELISTRIA_CALLING_API AMagickPlayerState : public APlayerState, public IAbilitySystemInterface
{
GENERATED_BODY()
virtual void BeginPlay() override;
public:
AMagickPlayerState();
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
virtual UElistriaAbilitySystemComponent* GetAbilitySystemComponent() const override;
void SetupAbilityActorInfo();
protected:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Abilities, Replicated)
TObjectPtr<class UElistriaAbilitySystemComponent> ElistriaAbilitySystemComponent;
UPROPERTY(Replicated)
TObjectPtr<class UManaAttributeSet> ManaSet;
};

View File

@@ -0,0 +1,52 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "AttributeSet.h"
#include "AbilitySystemComponent.h"
#include "Net/UnrealNetwork.h"
#include "ManaAttributeSet.generated.h"
/**
*
*/
#define ATTRIBUTE_ACCESSORS(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_PROPERTY_GETTER(ClassName, PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_GETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_SETTER(PropertyName) \
GAMEPLAYATTRIBUTE_VALUE_INITTER(PropertyName)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FAttributeChangedEvent, UAttributeSet*, AttributeSet, float, OldValue, float, NewValue);
UCLASS()
class ELISTRIA_CALLING_API UManaAttributeSet : public UAttributeSet
{
GENERATED_BODY()
public:
UManaAttributeSet();
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Mana)
FGameplayAttributeData Mana;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_MaxMana)
FGameplayAttributeData MaxMana;
ATTRIBUTE_ACCESSORS(UManaAttributeSet, Mana)
ATTRIBUTE_ACCESSORS(UManaAttributeSet, MaxMana)
UFUNCTION()
void OnRep_Mana(const FGameplayAttributeData& OldValue);
UFUNCTION()
void OnRep_MaxMana(const FGameplayAttributeData& OldValue);
UPROPERTY(BlueprintAssignable)
FAttributeChangedEvent OnManaChanged;
UPROPERTY(BlueprintAssignable)
FAttributeChangedEvent OnMaxManaChanged;
};