Download LyraStarterGame/Source/LyraGame/AbilitySystem/Executions/LyraHealExecution.cpp from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/AbilitySystem/Executions/LyraHealExecution.cpp
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/AbilitySystem/Executions/LyraHealExecution.cpp
-
curl -L -o LyraHealExecution.cpp https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/AbilitySystem/Executions/LyraHealExecution.cpp
1.84 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| struct FHealStatics | |
| { | |
| FGameplayEffectAttributeCaptureDefinition BaseHealDef; | |
| FHealStatics() | |
| { | |
| BaseHealDef = FGameplayEffectAttributeCaptureDefinition(ULyraCombatSet::GetBaseHealAttribute(), EGameplayEffectAttributeCaptureSource::Source, true); | |
| } | |
| }; | |
| static FHealStatics& HealStatics() | |
| { | |
| static FHealStatics Statics; | |
| return Statics; | |
| } | |
| ULyraHealExecution::ULyraHealExecution() | |
| { | |
| RelevantAttributesToCapture.Add(HealStatics().BaseHealDef); | |
| } | |
| void ULyraHealExecution::Execute_Implementation(const FGameplayEffectCustomExecutionParameters& ExecutionParams, FGameplayEffectCustomExecutionOutput& OutExecutionOutput) const | |
| { | |
| const FGameplayEffectSpec& Spec = ExecutionParams.GetOwningSpec(); | |
| const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags(); | |
| const FGameplayTagContainer* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags(); | |
| FAggregatorEvaluateParameters EvaluateParameters; | |
| EvaluateParameters.SourceTags = SourceTags; | |
| EvaluateParameters.TargetTags = TargetTags; | |
| float BaseHeal = 0.0f; | |
| ExecutionParams.AttemptCalculateCapturedAttributeMagnitude(HealStatics().BaseHealDef, EvaluateParameters, BaseHeal); | |
| const float HealingDone = FMath::Max(0.0f, BaseHeal); | |
| if (HealingDone > 0.0f) | |
| { | |
| // Apply a healing modifier, this gets turned into + health on the target | |
| OutExecutionOutput.AddOutputModifier(FGameplayModifierEvaluatedData(ULyraHealthSet::GetHealingAttribute(), EGameplayModOp::Additive, HealingDone)); | |
| } | |
| } | |