Implement ReputationVector data model with per-entity multi-dimensional tracking #210
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
#201 Epic: Reputation Data Model & Storage
aethyr/Aethyr
Reference: aethyr/Aethyr#210
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
feature/m4-reputation-vector-data-modelImplement ReputationVector data model with per-entity multi-dimensional tracking (#210)Background and Context
The Reputation & Social Standing system requires a foundational data model to store and manage reputation scores between a player and any number of entities (factions, settlements, NPCs). The
ReputationVectorclass serves as this foundation.Reputation scores are stored as a hash of
{entity_id => score}where each score is clamped to the range-100..+100. The class provides a clean API for reading, writing, and modifying reputation values. All mutations publish a Wisper event:reputation_changedso that other systems (propagation, UI, gameplay effects) can react to changes.Data is persisted in
player.info["reputation"]as a serializable hash structure. The class must handle missing or uninitialized reputation data gracefully, defaulting to 0 (Neutral) for unknown entities.Expected Behavior
ReputationVector.new(player)initializes fromplayer.info["reputation"]or creates an empty hash if none exists.get_reputation(entity)returns the integer score for the given entity, defaulting to 0 if not found.set_reputation(entity, value)sets the score, clamping to-100..+100, saves toplayer.info["reputation"], and publishes:reputation_changedvia Wisper with{player: player, entity: entity, old_score: old, new_score: new}.modify_reputation(entity, delta)addsdeltato the current score, clamping the result, saves, and publishes the event.-100..+100.Acceptance Criteria
ReputationVectorclass exists inlib/aethyr/core/reputation/reputation_vector.rb.get_reputation(entity)returns 0 for unknown entities and the stored score for known entities.set_reputation(entity, value)clamps to-100..+100and persists toplayer.info["reputation"].modify_reputation(entity, delta)correctly adds delta and clamps.:reputation_changedis published on everyset_reputationandmodify_reputationcall with correct payload.Subtasks
lib/aethyr/core/reputation/reputation_vector.rbwith theReputationVectorclass.initialize(player)loading fromplayer.info["reputation"].get_reputation(entity)with default-to-zero behavior.set_reputation(entity, value)with clamping, persistence, and Wisper event.modify_reputation(entity, delta)with clamping, persistence, and Wisper event.tests/unit/reputation_vector.featurecovering initialization, get/set/modify operations, clamping, default values, and Wisper event publishing.tests/integration/for reputation vector persistence and event handling.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 code 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.