// Copyright Echo Devgroup #include "AbilitySystem/MMC/MMC_MaxHealth.h" #include "AbilitySystem/AuraAttributeSet.h" #include "Interact/CombatInterface.h" UMMC_MaxHealth::UMMC_MaxHealth() { VigorDef.AttributeToCapture = UAuraAttributeSet::GetVigorAttribute(); VigorDef.AttributeSource = EGameplayEffectAttributeCaptureSource::Target; VigorDef.bSnapshot = false; RelevantAttributesToCapture.Add(VigorDef); } float UMMC_MaxHealth::CalculateBaseMagnitude_Implementation(const FGameplayEffectSpec& Spec) const { const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags(); const FGameplayTagContainer* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags(); FAggregatorEvaluateParameters EvaluateParams; EvaluateParams.SourceTags = SourceTags; EvaluateParams.TargetTags = TargetTags; float Vigor = 0.f; GetCapturedAttributeMagnitude(VigorDef, Spec, EvaluateParams, Vigor); Vigor = FMath::Max(Vigor, 0.0f); ICombatInterface* CombatInterface = Cast(Spec.GetContext().GetSourceObject()); const int32 PlayerLevel = CombatInterface->GetPlayerLevel(); return 80.f + 2.5f * Vigor + 10.f * PlayerLevel; }