Add expiry events to DurationData, apply duration to enchantments - #7267
Open
arbron wants to merge 1 commit into
Open
Add expiry events to DurationData, apply duration to enchantments#7267arbron wants to merge 1 commit into
DurationData, apply duration to enchantments#7267arbron wants to merge 1 commit into
Conversation
Adds `duration.expiry` to activity and spell data. Does not hide the duration field for duration-less expiry events because you may need to keep the duration data (for example, Shield has a duration of 1 Round and the expiry event of "Start of Source's Next Turn"). Changes how duration overrides are handled for applied effects by moving the logic into the activity itself, to give activities a chance to fully modify the effect being applied. In the process this also applies those same changes to applied enchantments.
Fyorl
requested changes
Sep 2, 2026
| case "second": units = "seconds"; break; | ||
| case "minute": units = "minutes"; break; | ||
| case "hour": units = "hours"; break; | ||
| case "day": units = "days" ; break; |
Contributor
There was a problem hiding this comment.
Suggested change
| case "day": units = "days" ; break; | |
| case "day": units = "days"; break; |
| const general = _loc("DND5E.EFFECT.Expiry.Group.General"); | ||
| const specific = _loc("DND5E.EFFECT.Expiry.Group.Specific"); | ||
| return [ | ||
| ...Object.entries(ActiveEffect5e.EXPIRY_EVENTS).map(([value, l]) => ({ value, label: _loc(l), group: general })), |
Contributor
There was a problem hiding this comment.
Suggested change
| ...Object.entries(ActiveEffect5e.EXPIRY_EVENTS).map(([value, l]) => ({ value, label: _loc(l), group: general })), | |
| ...Object.entries(this.EXPIRY_EVENTS).map(([value, l]) => ({ value, label: _loc(l), group: general })), |
| */ | ||
| expirySupportsDuration(expiry=this.duration.expiry) { | ||
| return !this.constructor.PSEUDO_EXPIRIES.has(expiry) && !this.constructor.DURATIONLESS_EXPIRIES.has(expiry); | ||
| return ActiveEffect5e.expirySupportsDuration(expiry); |
Contributor
There was a problem hiding this comment.
Suggested change
| return ActiveEffect5e.expirySupportsDuration(expiry); | |
| return this.constructor.expirySupportsDuration(expiry); |
| }; | ||
| } | ||
| context.expiryEvents = Object.fromEntries( | ||
| ActiveEffect.implementation.expiryOptions.map(({ value, ...data }) => [value, data]) |
Contributor
There was a problem hiding this comment.
Do these need to be alphabetised?
| /** | ||
| * System-specific "expiry" choices which do not require registration or custom expiry events, and instead | ||
| * are handled dynamically in `ActiveEffect#isExpiryEvent`. | ||
| * @type {Record<string>} |
Contributor
There was a problem hiding this comment.
Suggested change
| * @type {Record<string>} | |
| * @type {Record<string, string>} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Adds
duration.expiryto activity and spell data. Does not hide the duration field for duration-less expiry events because you may need to keep the duration data (for example, Shield has a duration of 1 Round and the expiry event of "Start of Source's Next Turn").Changes how duration overrides are handled for applied effects by moving the logic into the activity itself, to give activities a chance to fully modify the effect being applied. In the process this also applies those same changes to applied enchantments.