Fix #20: Load equipment and inventory data in ability handler #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Problem Description
When characters used abilities (e.g., "ChargeUp"), the returned BattleNad struct contained empty weapon and armor data, even though the character had valid equipment IDs. This was causing incomplete character data to be displayed during ability usage.
Changes Made
Handler.sol: Added equipment and inventory loading in
_handleAbilityfunction to match the behavior of_handleCombatattacker = attacker.loadEquipment()after verifying character is aliveattacker.inventory = inventories[attacker.id]to load inventory datadefender = defender.loadEquipment()for defenders in offensive abilitiesStorage.sol: Fixed variable shadowing warning in
_getKillerfunctionTests: Added two new test cases to verify equipment loading:
test_Ability_EquipmentAndInventoryLoading: Tests non-offensive abilitiestest_Ability_OffensiveWithEquipmentLoading: Tests offensive abilities with targetsTest Results
All tests are passing, confirming that equipment and inventory data are now properly loaded during ability usage.
Closes
Fixes #20