mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Fixed so subclass features beyond foundation are only transferred when they should (#582)
This commit is contained in:
parent
04fbf9db4f
commit
3c470a2d2e
19 changed files with 674 additions and 172 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue