mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-11 19:25:21 +01:00
[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:
parent
605a23ab58
commit
0508bf4188
4 changed files with 47 additions and 37 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue