diff --git a/Source/OpenPF2Core/Private/Abilities/PF2AttackAttributeStatics.cpp b/Source/OpenPF2Core/Private/Abilities/PF2AttackAttributeStatics.cpp index 1f61f3a8a..b563aafbc 100644 --- a/Source/OpenPF2Core/Private/Abilities/PF2AttackAttributeStatics.cpp +++ b/Source/OpenPF2Core/Private/Abilities/PF2AttackAttributeStatics.cpp @@ -9,6 +9,7 @@ #include "Abilities/PF2AttributeSetMacros.h" #include "Utilities/PF2ArrayUtilities.h" +#include "Utilities/PF2GameplayAbilityUtilities.h" TArray FPF2AttackAttributeStatics::GetAllDamageCaptures() const { @@ -44,6 +45,22 @@ const FGameplayEffectAttributeCaptureDefinition* FPF2AttackAttributeStatics::Get return Result; } +FGameplayTag FPF2AttackAttributeStatics::GetDamageTypeForDamageAttribute(const FGameplayAttribute& Attribute) const +{ + FGameplayTag FoundTag; + + for (const auto& Pair : this->DamageTypeToTransientDamageAttributeMap) + { + if (Pair.Value == Attribute.AttributeName) + { + FoundTag = PF2GameplayAbilityUtilities::GetTag(Pair.Key); + break; + } + } + + return FoundTag; +} + FPF2AttackAttributeStatics::FPF2AttackAttributeStatics(): TmpAttackRollCountProperty(nullptr), TmpAttackRollSizeProperty(nullptr), diff --git a/Source/OpenPF2Core/Public/Abilities/PF2AttackAttributeStatics.h b/Source/OpenPF2Core/Public/Abilities/PF2AttackAttributeStatics.h index 5aef12972..7eec771d6 100644 --- a/Source/OpenPF2Core/Public/Abilities/PF2AttackAttributeStatics.h +++ b/Source/OpenPF2Core/Public/Abilities/PF2AttackAttributeStatics.h @@ -138,6 +138,18 @@ struct OPENPF2CORE_API FPF2AttackAttributeStatics : FPF2AttributeStaticsBase const FGameplayEffectAttributeCaptureDefinition* GetDamageCaptureForDamageType( const FName& DamageTypeName) const; + /** + * Gets the damage type tag that corresponds to the specified transient damage attribute. + * + * @param Attribute + * The attribute for which a damage type is desired. + * + * @return + * Either the tag for the type of damage that was provided; or, a gameplay tag that is not valid if there is no + * damage type that corresponds to the given attribute. + */ + FGameplayTag GetDamageTypeForDamageAttribute(const FGameplayAttribute& Attribute) const; + protected: // ================================================================================================================= // Protected Constructors