Feature: Add "Available (No Cantrips)" option to Item Choice Advancement#6609
Open
CATFOOL wants to merge 1 commit intofoundryvtt:5.3.xfrom
Open
Feature: Add "Available (No Cantrips)" option to Item Choice Advancement#6609CATFOOL wants to merge 1 commit intofoundryvtt:5.3.xfrom
CATFOOL wants to merge 1 commit intofoundryvtt:5.3.xfrom
Conversation
arbron
requested changes
Feb 10, 2026
| this.advancement.actor, { added, removed, level: this.featureLevel } | ||
| ) === true); | ||
| const validSpell = !validateSpellLevel || (i.system.level <= maxSlot); | ||
| const validSpell = !validateSpellLevel || (i.system.level <= maxSlot && i.system.level >= minSpellLevel); |
Collaborator
There was a problem hiding this comment.
Suggested change
| const validSpell = !validateSpellLevel || (i.system.level <= maxSlot && i.system.level >= minSpellLevel); | |
| const validSpell = !validateSpellLevel || ((i.system.level >= minSlot) && (i.system.level <= maxSlot)); |
| const spellLevel = this.advancement.configuration.restriction.level; | ||
| const maxSlot = this._maxSpellSlotLevel(); | ||
| const validateSpellLevel = (this.advancement.configuration.type === "spell") && (spellLevel === "available"); | ||
| const minSpellLevel = spellLevel === "availableNoCantrips" ? 1 : 0; |
Collaborator
There was a problem hiding this comment.
I'd probably just name this minSlot to match with the existing maxSlot. Alternatively you could rename the existing maxSlot to maxLevel if you think that would make more sense.
Suggested change
| const minSpellLevel = spellLevel === "availableNoCantrips" ? 1 : 0; | |
| const minSlot = spellLevel === "availableNoCantrips" ? 1 : 0; |
Comment on lines
+222
to
+223
| : config.restriction.level === "available" ? 0 | ||
| : Number(config.restriction.level), |
Collaborator
There was a problem hiding this comment.
We should probably leave the min level as undefined in cases where we don't care about it so that players are still free to set the filter to a higher level if they want to only look at higher levels spells.
Suggested change
| : config.restriction.level === "available" ? 0 | |
| : Number(config.restriction.level), | |
| : config.restriction.level === "available" ? undefined : Number(config.restriction.level), |
Comment on lines
+318
to
+319
| const minLevel = spellLevel === "availableNoCantrips" ? 1 : 0; | ||
| if ( item.system.level > maxSlot || item.system.level < minLevel ) { |
Collaborator
There was a problem hiding this comment.
Same naming comment as above.
Suggested change
| const minLevel = spellLevel === "availableNoCantrips" ? 1 : 0; | |
| if ( item.system.level > maxSlot || item.system.level < minLevel ) { | |
| const minSlot = spellLevel === "availableNoCantrips" ? 1 : 0; | |
| if ( (item.system.level < minSlot) || (item.system.level > maxSlot) ) { |
Collaborator
|
There is also going to be a re-writing of |
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.
This PR adds a new option Available (No Cantrips) (availableNoCantrips) to the Spell Level restriction in the Item Choice Advancement configuration.
Currently, the Available option allows players to choose spells of any level for which they have spell slots, but this includes Cantrips (0-level spells). There are cases (e.g., specific feats or class features) where a player should be allowed to choose from any leveled spell they can cast, but not Cantrips. This new option fills that gap.