Fixed so subclass features beyond foundation are only transferred when they should (#582)

This commit is contained in:
WBHarry 2025-08-05 04:19:30 +02:00 committed by GitHub
parent 04fbf9db4f
commit 3c470a2d2e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 674 additions and 172 deletions

View file

@ -147,4 +147,29 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
cls.create(msg);
}
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')
);
const featureState = subclass.system.featureState;
const featureType = subclass
? (subclass.system.features.find(x => x.item?.uuid === this.parent.uuid)?.type ?? null)
: null;
if (
(featureType === CONFIG.DH.ITEM.featureSubTypes.specialization && featureState < 2) ||
(featureType === CONFIG.DH.ITEM.featureSubTypes.mastery && featureState < 3)
) {
this.transfer = false;
}
}
}
}
}