I have SourceTags and TargetTags in a UGameplayEffectExecutionCalculation Execute_Implementation function.
Like so:
const FGameplayTagContainer* SourceTags = Spec.CapturedSourceTags.GetAggregatedTags();
const FGameplayTagContainer* TargetTags = Spec.CapturedTargetTags.GetAggregatedTags();
I need to determine if a value in the calculation will be: 1 if normal, 2 if target is weak against source DamageType, or 0.5 if target is protected against source DamageType.
How would I?
-
Get “DamageType” Tags from Source tags.
-
Check the “Weakness” Tags in Target tags for the matching end “DamageType” tag to determine if weak against DamageType.
-
Check the “Protection” Tags in Target tags for the matching end “DamageType” tag to determine if strong against DamageType
For example:
Source has DamageType.Axe in it’s Tags and Target has Weakness.Axe in it’s Tags so the value would be 2. If the Target had Protection.Axe then the value would be 0.5. If no tags in target then the value would be 1. If there were both Protection and Weakness then it would be an error but I guess I would swallow it and the value would still be 1.
Is there a function already that would do what I want or how would I write it? It seems simple if I was familiar with Unreal C++ with GameplayTags and GameplayTag Containers I don’t program with C++ much and use Blueprints most of the time.