Skip to content

feat(beasts): wild beast taming, pet loyalty moods, and combat attack commands - #203

Open
angelTomo9 wants to merge 2 commits into
Bitcoindefi:mainfrom
angelTomo9:feat-beast-taming-1787871647584
Open

feat(beasts): wild beast taming, pet loyalty moods, and combat attack commands#203
angelTomo9 wants to merge 2 commits into
Bitcoindefi:mainfrom
angelTomo9:feat-beast-taming-1787871647584

Conversation

@angelTomo9

Copy link
Copy Markdown

Summary

Implements wild creature taming, pet loyalty mood progression, diet feeding, and pet combat commands for OpenAO MMORPG.

Features

  • Beast species catalog (Dire Wolf, Shadow Panther, Griffon, Forest Bear)
  • Beastmaster skill and target health ratio probability formula
  • Pet loyalty mood tiers (Rebellious, Content, Devoted) affecting combat output
  • Species-specific diet feeding mechanics and loyalty recovery
  • Full unit test coverage under Vitest

Comment thread api/src/lib/beastTamingLoyalty.ts
Comment thread api/src/lib/beastTamingLoyalty.ts Outdated
@gitar-bot

gitar-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 2 resolved / 2 findings

Implements wild beast taming, pet loyalty moods, and combat attack commands with full unit test coverage. Fixed crashes in feedPet and commandAttack when handling unknown species, and corrected the inverted baseTamingDifficulty naming.

✅ 2 resolved
Edge Case: feedPet/commandAttack crash on unknown species

📄 api/src/lib/beastTamingLoyalty.ts:140-144 📄 api/src/lib/beastTamingLoyalty.ts:172-181
attemptTame guards against an unrecognized species with if (!data) return {...}, but feedPet and commandAttack look up BEAST_SPECIES_DATA[pet.species] and immediately dereference data.preferredDiet / data.baseAttackDamage with no such guard. If a TamedPetCompanion is ever reconstructed from persisted/network data with a species string outside the union (types don't protect at runtime), data is undefined and both methods throw a TypeError instead of returning the structured { success: false, reason } they promise. Add the same if (!data) guard used in attemptTame.

Quality: baseTamingDifficulty name is inverted vs. its usage

📄 api/src/lib/beastTamingLoyalty.ts:13 📄 api/src/lib/beastTamingLoyalty.ts:105
The field is documented as "0 to 1 (lower is harder)" and named baseTamingDifficulty, but it is used as a direct multiplier on successRate, so a higher value makes a creature easier to tame. That means it behaves as a base success/tameability rate, not a difficulty. The GRIFFON (0.20) being the hardest to tame while FOREST_BEAR (0.35) is easier is only clear once you trace the formula. Rename to baseTameChance (or invert the semantics) to avoid future contributors misreading the values.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 5 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

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