Skip to content

Add support for "loric" role type in game logic#76

Open
ratteler50 wants to merge 4 commits intotchajed:mainfrom
ratteler50:main
Open

Add support for "loric" role type in game logic#76
ratteler50 wants to merge 4 commits intotchajed:mainfrom
ratteler50:main

Conversation

@ratteler50
Copy link
Contributor

This pull request introduces support for a new role type, loric, across several parts of the codebase. The main changes ensure that loric is treated similarly to existing special roles like fabled and travellers in role definitions, setup logic, script filtering, selection requirements, and UI pluralization.

Role definition and handling:

  • Added loric to the RoleTypes array and updated the CharacterInfo class so that loric is considered a special role alongside fabled and travellers. [1] [2]

Setup and filtering logic:

  • Modified the goesInBag function in setup.ts so that characters with the loric role type do not go in the bag, matching the behavior for fabled.
  • Updated the onlyBaseThree function in script.ts to include loric as a valid role type for base three scripts.

Selection and UI:

  • Changed the requiredSelection function in selection.ts so that loric roles are always required selections, just like fabled.
  • Updated the pluralRole function in character_sheet.tsx to treat loric as a plural role type for UI display purposes.

Copilot AI review requested due to automatic review settings February 24, 2026 02:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 loric to the canonical RoleTypes list and treats it as “special” in CharacterInfo.
  • Updates setup and randomizer logic so loric roles 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.

Comment on lines 28 to 36
export const RoleTypes = [
"townsfolk",
"outsider",
"minion",
"demon",
"fabled",
"loric",
"travellers",
] as const;
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 118 to 121
function pluralRole(roleType: string): string {
return ["townsfolk", "fabled", "travellers"].includes(roleType)
return ["townsfolk", "fabled", "loric", "travellers"].includes(roleType)
? roleType
: roleType + "s";
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
google-labs-jules bot and others added 3 commits March 4, 2026 18:43
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
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.

2 participants