继承该类

virtual float CalculateBaseMagnitude_Implementation(const FGameplayEffectSpec& Spec) const override;
example:
float UMMC_MaxHealth::CalculateBaseMagnitude_Implementation(const FGameplayEffectSpec& Spec) const
{
// Gather tags from source and target
const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
const FGameplayTagContainer* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags();

FAggregatorEvaluateParameters EvaluationParameters;
EvaluationParameters.SourceTags = SourceTags;
EvaluationParameters.TargetTags = TargetTags;

float Vigor = 0.f;
GetCapturedAttributeMagnitude(VigorDef, Spec, EvaluationParameters, Vigor);
Vigor = FMath::Max<float>(Vigor, 0.f);

ICombatInterface* CombatInterface = Cast<ICombatInterface>(Spec.GetContext().GetSourceObject());
const int32 PlayerLevel = CombatInterface->GetPlayerLevel();

return 80.f + 2.5f * Vigor + 10.f * PlayerLevel;
}
posted on 2025-09-03 22:47  偷懒的阿贤  阅读(14)  评论(0)    收藏  举报