Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,19 @@ void UGMCAbility::RemoveAbilityCost() {
}
}

TMap<FGameplayTag, float> UGMCAbility::GetAbilityCostValues() const
{
TMap<FGameplayTag, float> CostMap;
if (!AbilityCost) return CostMap;

const UGMCAbilityEffect* EffectCDO = AbilityCost->GetDefaultObject<UGMCAbilityEffect>();

for (const FGMCAttributeModifier& Modifier : EffectCDO->EffectData.Modifiers)
{
CostMap.Add(Modifier.AttributeTag, Modifier.GetValue());
}
return CostMap;
}

void UGMCAbility::ModifyBlockOtherAbility(FGameplayTagContainer TagToAdd, FGameplayTagContainer TagToRemove) {
for (auto Tag : TagToAdd) {
Expand Down
5 changes: 5 additions & 0 deletions Source/GMCAbilitySystem/Public/Ability/GMCAbility.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ class GMCABILITYSYSTEM_API UGMCAbility : public UObject, public IGameplayTaskOwn
// Remove the ability cost effect (if applicable)
UFUNCTION(BlueprintCallable, Category = "GMCAbilitySystem")
virtual void RemoveAbilityCost();

// Retrieves the attribute costs of this ability from its AbilityCost effect class.
// @return A map of GameplayTags (Attributes) to their respective modifier values.
UFUNCTION(BlueprintPure, Category = "GMCAbilitySystem")
TMap<FGameplayTag, float> GetAbilityCostValues() const;

// Live modifying the BlockOtherAbility tags
UFUNCTION(BlueprintCallable, Category = "GMCAbilitySystem")
Expand Down