Add support for "loric" role type in game logic#76
Add support for "loric" role type in game logic#76ratteler50 wants to merge 4 commits intotchajed:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new loric role type and threads it through role typing plus key setup/selection/script/UI behaviors so it’s treated similarly to other special roles (notably fabled / travellers) in core gameplay flows.
Changes:
- Adds
loricto the canonicalRoleTypeslist and treats it as “special” inCharacterInfo. - Updates setup and randomizer logic so
loricroles are required selections and do not go in the bag. - Updates script filtering and character sheet UI pluralization to recognize
loric.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/js/roles/character_sheet.tsx | Updates role-type pluralization rules for UI headers to include loric. |
| src/js/randomizer/selection.ts | Ensures loric roles are always included in required selections (like fabled). |
| src/js/botc/setup.ts | Excludes loric roles from going into the bag (like fabled). |
| src/js/botc/script.ts | Treats loric as allowable in “base three” scripts when edition is other. |
| src/js/botc/roles.ts | Extends the core RoleTypes/RoleType definition and CharacterInfo.special to include loric. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const RoleTypes = [ | ||
| "townsfolk", | ||
| "outsider", | ||
| "minion", | ||
| "demon", | ||
| "fabled", | ||
| "loric", | ||
| "travellers", | ||
| ] as const; |
There was a problem hiding this comment.
RoleTypes now includes "loric", but there are other role-type unions hardcoded elsewhere (e.g. Override.homebrew.roleType in src/js/botc/overrides.ts) that still only allow townsfolk/outsider/minion/demon/fabled/travellers. This makes the type surface inconsistent and prevents defining homebrew overrides with the new role type. Prefer reusing the shared RoleType type (or at least add "loric" to the union) so the codebase stays in sync when role types evolve.
| function pluralRole(roleType: string): string { | ||
| return ["townsfolk", "fabled", "travellers"].includes(roleType) | ||
| return ["townsfolk", "fabled", "loric", "travellers"].includes(roleType) | ||
| ? roleType | ||
| : roleType + "s"; |
There was a problem hiding this comment.
pluralRole takes roleType: string, but this function is only intended to handle known role types and RoleType is already imported in this file. Typing the parameter as RoleType (or RoleType | string if needed) would prevent accidental calls with arbitrary strings and make future additions like "loric" safer to roll out consistently.
Sets the `base` option to `"./"` in `vite.config.ts`. This allows the application to be deployed to a subpath like `public.twitarr.com/botc` by making all asset imports relative (e.g. `./assets/...`) instead of absolute to the domain root (e.g. `/assets/...`). Co-authored-by: ratteler50 <4249192+ratteler50@users.noreply.github.com>
Updates `nav.tsx` to construct URLs using a relative path against `window.location.href` rather than the absolute `window.location.origin`. This ensures that in-app navigation works correctly when the application is hosted in a subpath. Co-authored-by: ratteler50 <4249192+ratteler50@users.noreply.github.com>
…417250942 Use relative paths for Vite assets
This pull request introduces support for a new role type,
loric, across several parts of the codebase. The main changes ensure thatloricis treated similarly to existing special roles likefabledandtravellersin role definitions, setup logic, script filtering, selection requirements, and UI pluralization.Role definition and handling:
loricto theRoleTypesarray and updated theCharacterInfoclass so thatloricis considered a special role alongsidefabledandtravellers. [1] [2]Setup and filtering logic:
goesInBagfunction insetup.tsso that characters with theloricrole type do not go in the bag, matching the behavior forfabled.onlyBaseThreefunction inscript.tsto includeloricas a valid role type for base three scripts.Selection and UI:
requiredSelectionfunction inselection.tsso thatloricroles are always required selections, just likefabled.pluralRolefunction incharacter_sheet.tsxto treatloricas a plural role type for UI display purposes.