Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add cosmere initiative system #33

Merged
merged 3 commits into from
Aug 30, 2024

Conversation

jsc17
Copy link
Contributor

@jsc17 jsc17 commented Aug 28, 2024

New PR due to changing to the 0.1.0 branch:

Overrides Foundry's default initiative rolling system to use the Cosmere RPGs slow/fast popcorn style initiative system. Implements a bucket/phases system to group combatants based on turn speed and whether they are a player character or an adversary. Defaults all combatants to slow turn speed when they are added to the combat. Added buttons to the combat tracker allowing them to switch turn speed and indicate they have acted for the turn, and set some basic styling for the combat-tracker template.

Done:

  • Create flags on combatant creation to store turn speed and activation status, defaulting to slow for the turn speed.
  • Set initiative based on turn speed/character type, instead of rolling
  • Add buttons to combat tracker to switch turn speed and indicate the character has activated for the turn (using default foundry icons as placeholders)
  • Add headers to the combat tracker to sort player/npc turns (Fast Players, Fast NPCs, etc ...)
  • Add context menu option to combat tracker combatants to reset activation status
  • Set localization for all text values

Copy link
Collaborator

@stanavdb stanavdb left a comment

Choose a reason for hiding this comment

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

No real comments on the implementation. Some minor style/typescript comments & tips. However when I run it locally I get an error when adding a combatant to a combat.

Error: An error occurred while rendering CosmereCombatTracker 24. The partial combatant could not be found

It looks like the combatant partial is not getting preloaded. (Maybe something when wrong when merging with release-0.1.0?) Preloading of partials should be set up in the preloadHandlebarsTemplates function, found at: util/handlebars/index.ts

src/system/applications/combat/combat-tracker.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combat-tracker.ts Outdated Show resolved Hide resolved
);
}

//toggles combatant turn speed on clicking the "fast/slow" text on the combat tracker window
Copy link
Collaborator

Choose a reason for hiding this comment

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

This can also be set up as a doc comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly sure what you mean here. Can you elaborate a bit?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If you use JSDoc comments (comments starting with /**) instead of regular comments, then your comment will show up alongside intellisense on most IDEs. Have a look at the Actor document for some examples.

Broadly: Any comments that explain the functionality (for someone who might want to use that function/variable/parameter/etc.) should be doc comments. Any comments that explain the implementation should be regular comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was a pretty good explanation. I hadn't used JSDoc comments before so I didn't realize they did that for intellisense. I've expanded the comments in the code I've added.

src/system/applications/combat/combatant.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combat-tracker.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combatant.ts Outdated Show resolved Hide resolved
@jsc17
Copy link
Contributor Author

jsc17 commented Aug 30, 2024

Yeah, when switching to the 0.1.0 branch I moved the template into preloadHandleBarTemplates, but didn't commit the updated function. Fixed that and implemented most of the other changes you mentioned.

@jsc17 jsc17 requested a review from stanavdb August 30, 2024 02:18
Copy link
Collaborator

@stanavdb stanavdb left a comment

Choose a reason for hiding this comment

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

Noticed a few more things that I'd missed/hadn't been able to check yet last time.

src/system/applications/combat/combat-tracker.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combat-tracker.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combat.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combatant.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combatant.ts Outdated Show resolved Hide resolved
src/system/applications/combat/combatant.ts Outdated Show resolved Hide resolved
src/templates/combat/combatant.hbs Outdated Show resolved Hide resolved
src/templates/combat/combatant.hbs Outdated Show resolved Hide resolved
@jsc17 jsc17 requested a review from stanavdb August 30, 2024 15:36
@stanavdb stanavdb merged commit 301ecd9 into the-metalworks:release-0.1.0 Aug 30, 2024
1 check passed
@jsc17 jsc17 deleted the combat-tracker branch August 30, 2024 17:43
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