Repository navigation
fix(inventory): recompute equipped armor class - #89
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 84f5ab4ec4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| items: ReturnType<InventoryRepository['getInventoryWithDetails']>['items'] | ||
| ): number { | ||
| const dexMod = Math.floor((dexterity - 10) / 2); | ||
| let armorBase = 10 + dexMod; |
There was a problem hiding this comment.
Preserve the character's authoritative AC baseline
When a character's AC comes from an explicit character_manage.create value, natural armor, or another feature not represented by an inventory item, initializing the calculation to 10 + DEX discards that AC. Because both equip and unequip now invoke this helper unconditionally, merely equipping an ordinary weapon can change an AC 18 character to 10–12 even though no armor changed; the recomputation needs to preserve non-equipment AC or run only when the complete AC basis is represented by equipped items.
Useful? React with 👍 / 👎.
What changed
properties.acas well as authoredbaseACitems.Root cause
Starter Chain Mail is persisted with
properties.ac: 16, whileinventory_manage.equiponly readproperties.baseAC. AC was also incremented/decremented from its prior value, which could drift as armor and shields changed.Validation