Implement CombatAction data model with 19 properties #269
Labels
No labels
Blocked
Duplicate
MoSCoW/Could Have
MoSCoW/Must Have
MoSCoW/Should Have
Points/1
Points/13
Points/2
Points/21
Points/3
Points/5
Points/8
Priority/Backlog
Priority/Critical
Priority/High
Priority/Low
Priority/Medium
State/Completed
State/In progress
State/In review
State/Paused
State/Unverified
State/Verified
State/Wont Do
Type/Bug
Type/Epic
Type/Feature
Type/Legendary
Type/Task
Type/Testing
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#268 Epic: Combat Resolution Engine
aethyr/Aethyr
Reference: aethyr/Aethyr#269
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Metadata
feat(combat): implement CombatAction data model with 19 propertiesfeature/m4-combat-actionBackground and Context
Each combat action (attack, block, stance change) is described by a CombatAction data model with 19 properties: name, ap_cost, delay, hand, base_damage, damage_type, strikes (array of target offsets), pattern (relative cell offsets), final_offset (hand position after action), momentum (:sustained or :interrupted), skill_requirements, equipment_requirements, description, category, and more.
Expected Behavior
CombatAction is a value object with all 19 properties. It supports validation (are requirements met?), pattern projection (given origin, which grid cells are targeted?), and serialization.
Acceptance Criteria
valid_for?(combatant)checks skill and equipment requirementsproject_pattern(origin_row, origin_col)returns absolute grid cells from relative offsetstotal_ap_costreturns ap_cost (may be modified by stance)Subtasks
lib/aethyr/core/combat/combat_action.rbwith CombatAction classvalid_for?(combatant)checking skill levels and equipmentproject_pattern(row, col)translating relative offsets to absolute grid positionsto_handfrom_hfor serializationtests/unit/combat_action.featurecovering property storage, validation, pattern projection, serialization.tests/integration/for combat action creation and validation during combat.bundle exec rake unit_profileand verify no performance regressions.bundle exec rake unit. If coverage is <97% then review the current unit test coverage report atbuild/tests/unit/coverage/and use it to write new Cucumber based unit tests to improve coverage. Specifically, write Cucumber/Gherkin style unit tests that are descriptively named and specifically improve coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerunbundle exec rake unitto verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.bundle exec rake(default task: unit tests with coverage) andbundle exec rake integration, fix any errors if needed ensuring both pass across entire code base, do not ignore any failure even if it seems unrelated to this commit, fix it.Definition of Done
This issue is complete when:
master, reviewed, and merged before this issue is marked done.Implementation Progress
Completed Subtasks
lib/aethyr/core/combat/combat_action.rbwith CombatAction classvalid_for?(combatant)checking skill levels and equipmentproject_pattern(row, col)translating relative offsets to absolute grid positionsto_handfrom_hfor serializationtests/unit/combat_action.featurewith 67 scenarios covering property storage, validation, pattern projection, and serializationtests/integration/combat_action.featurewith 3 scenarios for combat action creation and validationImplementation Details
CombatAction Class (
lib/aethyr/core/combat/combat_action.rb)The CombatAction is a value object with 19 properties as specified:
name- String display nameap_cost- Integer (1-3)delay- Integer rounds before activationhand- Symbol (:right, :left, :both, :either)base_damage- Integerdamage_type- Symbol (:slash, :pierce, :blunt, :none)strikes- Array or nil (all steps)pattern- Array of [row_offset, col_offset] pairsfinal_offset- [row_offset, col_offset]momentum- Symbol (:sustained, :interrupted)requires_position- Optional grid positionrequires_equipment- Symbol (:weapon, :shield, :empty, :two_handed)requires_weapon_class- Symbol (:sword, :axe, :mace, :dagger, :staff, :polearm)requires_config- Symbol (:dual_wield, :two_handed, :weapon_shield)source_skill- Symbolmin_skill_level- Integerstance_change- Optional symboldescription- Stringtags- SetKey Methods Implemented
valid_for?(combatant)- Validates skill level, equipment, weapon class, and weapon config requirementsproject_pattern(origin_row, origin_col)- Projects relative pattern offsets to absolute grid coordinatestotal_ap_cost- Returns the action point cost (extensible for stance modifiers)strike_at?(step_index)- Checks if a pattern step is a strike pointstrike_indices- Returns all strike point indicestag?(tag)/has_tag?(tag)- Tag checkingattack?,defend?,shield_sweep?,multi_strike?- Convenience tag predicatesto_h/from_h- Serialization/deserializationDesign Decisions
# typed: strict) for type safetytag?is the primary method name per RuboCop conventions;has_tag?is aliased for clarityTest Results
Remaining Work
PR #328 created and ready for review: #328
All tests passing: