Skip to content

Add Blueprint-accessible GetAbilityCostValues to UGMCAbility#11

Open
Qwigs wants to merge 1 commit into
DeepWorldsSA:devfrom
Qwigs:dev
Open

Add Blueprint-accessible GetAbilityCostValues to UGMCAbility#11
Qwigs wants to merge 1 commit into
DeepWorldsSA:devfrom
Qwigs:dev

Conversation

@Qwigs
Copy link
Copy Markdown

@Qwigs Qwigs commented Jun 3, 2026

Added a helper function to easily retrieve and map the attribute costs associated with an ability.

Functionality: Iterates through the AbilityCost effect CDO to extract the modifiers.

Returns: A TMap<FGameplayTag, float> that maps attribute tags directly to their exact modifier values.

Use Case: Simplifies querying and accessing ability costs for UI display and Blueprint logic.

Summary by CodeRabbit

  • New Features
    • Added GetAbilityCostValues() method to retrieve cost values for abilities. Available in both Blueprints and code, the method returns a map of attribute tags with their associated cost values configured for each ability.

Added a helper function to easily retrieve and map the attribute costs associated with an ability.

Functionality: Iterates through the AbilityCost effect CDO to extract the modifiers.

Returns: A TMap<FGameplayTag, float> that maps attribute tags directly to their exact modifier values.

Use Case: Simplifies querying and accessing ability costs for UI display and Blueprint logic.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 3, 2026

Review Change Stack

Walkthrough

This PR adds a new Blueprint-pure accessor method GetAbilityCostValues() to the UGMCAbility class. The method returns a TMap<FGameplayTag, float> representing the ability's cost values extracted from its AbilityCost effect data, with null safety handling.

Changes

Ability Cost Values Accessor

Layer / File(s) Summary
GetAbilityCostValues accessor
Source/GMCAbilitySystem/Public/Ability/GMCAbility.h, Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp
New Blueprint-pure method GetAbilityCostValues() is declared and implemented to return ability cost values as a tag-to-float map sourced from AbilityCost effect modifiers, with null safety when AbilityCost is absent.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A tiny method hops into place,
Mapping costs with elegant grace,
Tags to floats in a map so neat,
This accessor makes ability stats complete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a Blueprint-accessible getter method for ability cost values to the UGMCAbility class.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Infer (1.2.0)
Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp

Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp:1:13: fatal error: 'Ability/GMCAbility.h' file not found
1 | <U+FEFF>#include "Ability/GMCAbility.h"
| ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
Error: the following clang command did not run successfully:
/opt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/bin/clang-18
@/tmp/coderabbit-infer/537b5510f0887d1fd8327657c34e67121c579d38-49026f1a585c7a19/tmp/clang_command_.tmp.48e4da.txt
++Contents of '/tmp/coderabbit-infer/537b5510f0887d1fd8327657c34e67121c579d38-49026f1a585c7a19/tmp/clang_command_.tmp.48e4da.txt':
"-cc1" "-load"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../../facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib"
"-add-plugin" "BiniouASTExporter" "-plugin-arg-BiniouASTExporter" "-"
"-plugin-arg-BiniouASTExporter" "PREPEND_CURRENT_DIR=1"
"-plugin-arg-BiniouASTExporter" "MAX_STRING_SIZE=65535" "-cc1" "-triple"
"x

... [truncated 1164 characters] ...

"-internal-isystem" "/usr/local/include" "-internal-isystem"
"/usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include"
"-internal-externc-isystem" "/usr/include/x86_64-linux-gnu"
"-internal-externc-isystem" "/include" "-internal-externc-isystem"
"/usr/include" "-Wno-ignored-optimization-argument" "-Wno-everything"
"-fdeprecated-macro" "-ferror-limit" "19" "-fgnuc-version=4.2.1"
"-fskip-odr-check-in-gmf" "-fcxx-exceptions" "-fexceptions"
"-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o"
"/tmp/coderabbit-infer/49026f1a585c7a19/file.o" "-x" "c++"
"Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp" "-O0"
"-fno-builtin" "-include"
"/opt/infer-linux-x86_64-v1.2.0/lib/infer/infer/bin/../lib/clang_wrappers/global_defines.h"
"-Wno-everything"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp (1)

147-159: 💤 Low value

Consider defensive handling for potential duplicate AttributeTags.

The current implementation uses CostMap.Add(), which will assert in development builds if the same AttributeTag appears multiple times in the Modifiers array. While duplicate tags are likely a data configuration error, using CostMap.Emplace() or checking Contains() before adding would make the code more resilient.

🛡️ Optional: Make duplicate key handling explicit
 	for (const FGMCAttributeModifier& Modifier : EffectCDO->EffectData.Modifiers)
 	{
-		CostMap.Add(Modifier.AttributeTag, Modifier.GetValue()); 
+		CostMap.Emplace(Modifier.AttributeTag, Modifier.GetValue());
 	}

Or to accumulate values from duplicate tags:

 	for (const FGMCAttributeModifier& Modifier : EffectCDO->EffectData.Modifiers)
 	{
-		CostMap.Add(Modifier.AttributeTag, Modifier.GetValue()); 
+		float& Value = CostMap.FindOrAdd(Modifier.AttributeTag, 0.0f);
+		Value += Modifier.GetValue();
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp` around lines 147 -
159, The GetAbilityCostValues function currently uses
CostMap.Add(Modifier.AttributeTag, Modifier.GetValue()) which will assert on
duplicate AttributeTags; update UGMCAbility::GetAbilityCostValues to handle
duplicates defensively by either using CostMap.Emplace(Modifier.AttributeTag,
Modifier.GetValue()) after checking !CostMap.Contains(Modifier.AttributeTag), or
explicitly accumulate values when duplicates are valid (e.g., if
CostMap.Contains(AttributeTag) then sum Modifier.GetValue() into existing
entry), referencing AbilityCost, UGMCAbilityEffect, FGMCAttributeModifier and
CostMap in your changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp`:
- Around line 147-159: The GetAbilityCostValues function currently uses
CostMap.Add(Modifier.AttributeTag, Modifier.GetValue()) which will assert on
duplicate AttributeTags; update UGMCAbility::GetAbilityCostValues to handle
duplicates defensively by either using CostMap.Emplace(Modifier.AttributeTag,
Modifier.GetValue()) after checking !CostMap.Contains(Modifier.AttributeTag), or
explicitly accumulate values when duplicates are valid (e.g., if
CostMap.Contains(AttributeTag) then sum Modifier.GetValue() into existing
entry), referencing AbilityCost, UGMCAbilityEffect, FGMCAttributeModifier and
CostMap in your changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8b77e5da-1802-4728-adf0-01936851b4b3

📥 Commits

Reviewing files that changed from the base of the PR and between 6d9e2c0 and 537b551.

📒 Files selected for processing (2)
  • Source/GMCAbilitySystem/Private/Ability/GMCAbility.cpp
  • Source/GMCAbilitySystem/Public/Ability/GMCAbility.h

@Qwigs
Copy link
Copy Markdown
Author

Qwigs commented Jun 4, 2026

May want to change Add to FindOrAdd if there are duplicate tags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant