Skip to content

feat(pet): BodyGene 9→34 — 解鎖 25 個原本無法顯示的家族#106

Merged
hanfour merged 1 commit into
mainfrom
feat/bodygene-unlock-25-families
Jun 14, 2026
Merged

feat(pet): BodyGene 9→34 — 解鎖 25 個原本無法顯示的家族#106
hanfour merged 1 commit into
mainfrom
feat/bodygene-unlock-25-families

Conversation

@hanfour

@hanfour hanfour commented Jun 14, 2026

Copy link
Copy Markdown
Owner

驗證自動生成的倉鼠時發現的重大缺口:SpeciesCatalog 定義 34 個家族(資產 pipeline + pig-boar 等稀有度標記都瞄準它們),但 BodyGene 只有 9 個 case。resolvedSpeciesIDbody.rawValue → 其餘 25 個家族(cow/deer/duck/fox/hamster/…/wolf)任何寵物都選不到 —— 229 個 bundled zip(占 bundle 71%,含 32 個已有 v5 動畫)是無法顯示的死資產

內容

  • BodyGene:+25 case,讓每個 catalog 家族都能孵化
  • displayName:+25 個繁中台灣用語名稱
  • defaultSpeciesID:+25(各家族第一個 catalog variant;BodyGeneMappingTests 釘住每個都 resolve)
  • from(personalityGene:):重構成 allCases 加權表 —— cat 維持主導(v5 覆蓋最好)、8 個 core 家族常見、25 個擴充家族 ~1.4%/個的可達尾巴。未來加 case 自動擴展
  • PetBehaviorProviderFactory:default: → 新 GenericBehavior(接地行走);bespoke 行為日後再加

注意

許多擴充家族只有 v4(旋轉-only)資產,所以那些寵物會靜態顯示正確 species(renderer 1-frame fallback),等 v5 動畫生成後才會動;缺的 stage 優雅 fallback。

測試

count 9→34;脆弱的 hatch-band 斷言換成「sweep 證明每個家族可孵化」;新增 test_everyCatalogFamilyHasABodyGene 回歸守衛(未來 catalog 家族不能再悄悄變不可達)。PeerDropPet 495/0、iOS build 綠。

🤖 Generated with Claude Code

Found while verifying the auto-generated hamster in the app: SpeciesCatalog
defines 34 families (and the asset pipeline + variant-rarity tags like
`pig-boar` target them), but BodyGene had only 9 cases. `resolvedSpeciesID`
keys on `body.rawValue`, so the other 25 families (cow, deer, duck, fox,
hamster, …, wolf) could NEVER be selected by any pet — 229 bundled zips (71%
of the bundle, incl. 32 with v5 walk/idle animation) were unreachable dead
assets.

- BodyGene: +25 cases so every catalog family is hatchable.
- displayName: +25 zh-Hant台灣用語 names.
- defaultSpeciesID: +25 (each family's first catalogued variant;
  BodyGeneMappingTests pins that each resolves).
- from(personalityGene:): refactored to a weighted table over allCases — cat
  stays dominant (best v5 coverage), the 8 core families common, the 25
  expansion families a ~1.4%-each reachable tail. Auto-scales on future adds.
- PetBehaviorProviderFactory: a `default:` → new GenericBehavior (grounded
  walker) for the expansion families; bespoke behaviours can come later.

Note: many expansion families ship v4 rotation-only assets, so those pets
render the correct species statically (renderer's 1-frame fallback) until v5
animations are generated; partial-coverage stages fall back gracefully.

Tests: count 9→34; replaced brittle hatch-band asserts with a sweep proving
every family is hatchable; new test_everyCatalogFamilyHasABodyGene regression
guard so a future catalog family can't silently become unreachable again.
Decoder-throws test now uses a genuinely-unknown string. PeerDropPet 495/0;
iOS build green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hanfour hanfour merged commit df9f6e1 into main Jun 14, 2026
2 checks passed
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