[PR] Removing refreshables the user doesn't have during rest actions (#1449)

* Marking up the places that need changing for bug #1160

* Creating a shared method called isItemAvailable and using it in downtime

* Explicitely adding the false value rather than relying on undefined returns. Oops

* Removing spaces

* Removing a needless return line

* Adding missing semicolon
This commit is contained in:
Nick Salyzyn 2025-12-20 14:00:16 -07:00 committed by GitHub
parent 605a23ab58
commit 0508bf4188
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 47 additions and 37 deletions

View file

@ -194,27 +194,10 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
}
prepareDerivedData() {
/* Preventing subclass features from transferring to actor if they do not have the right subclass advancement */
if (this.parent?.type === 'feature') {
const origSubclassParent = this.parent.system.originItemType === 'subclass';
if (origSubclassParent) {
const subclass = this.parent.parent.items.find(
x =>
x.type === 'subclass' &&
x.system.isMulticlass === (this.parent.system.identifier === 'multiclass')
);
if (subclass) {
const featureState = subclass.system.featureState;
if (
(this.parent.system.identifier === CONFIG.DH.ITEM.featureSubTypes.specialization &&
featureState < 2) ||
(this.parent.system.identifier === CONFIG.DH.ITEM.featureSubTypes.mastery && featureState < 3)
) {
this.transfer = false;
}
}
/* Check for item availability such as in the case of subclass advancement. */
if (this.parent?.parent?.system?.isItemAvailable) {
if (!this.parent.parent.system.isItemAvailable(this.parent)) {
this.transfer = false;
}
}
}