mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-23 10:59:54 +02:00
.
This commit is contained in:
parent
3840f39c97
commit
1755165ab8
1 changed files with 19 additions and 7 deletions
|
|
@ -341,19 +341,31 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
||||||
static async getEffects(actor, effectParent) {
|
static async getEffects(actor, effectParent) {
|
||||||
if (!actor) return [];
|
if (!actor) return [];
|
||||||
|
|
||||||
return Array.from(await actor.allApplicableEffects({ noTransferArmor: true, noSelfArmor: true })).filter(
|
// Changes on weapon effects are not typically only applicable to show in the roll dialog for the weapon itself
|
||||||
effect => {
|
// The exemptions to this rule are listed below
|
||||||
|
const weaponTrasnferredEffectKeys = [
|
||||||
|
'system.bonuses.roll.spellcasting'
|
||||||
|
];
|
||||||
|
|
||||||
|
return Array.from(await actor.allApplicableEffects({ noTransferArmor: true, noSelfArmor: true })).reduce(
|
||||||
|
(acc, effect) => {
|
||||||
|
const effectData = effect.toObject();
|
||||||
/* Effects on weapons only ever apply for the weapon itself */
|
/* Effects on weapons only ever apply for the weapon itself */
|
||||||
if (effect.parent.type === 'weapon') {
|
if (effect.parent.type === 'weapon') {
|
||||||
/* Unless they're secondary - then they apply only to other primary weapons */
|
/* Unless they're secondary - then they apply only to other primary weapons */
|
||||||
if (effect.parent.system.secondary) {
|
if (effect.parent.system.secondary) {
|
||||||
if (effectParent?.type !== 'weapon' || effectParent?.system.secondary) return false;
|
if (effectParent?.type !== 'weapon' || effectParent?.system.secondary)
|
||||||
} else if (effectParent?.id !== effect.parent.id) return false;
|
effectData.system.changes.filter(x => weaponTrasnferredEffectKeys.includes(x.key));
|
||||||
|
} else if (effectParent?.id !== effect.parent.id)
|
||||||
|
effectData.system.changes.filter(x => weaponTrasnferredEffectKeys.includes(x.key));
|
||||||
}
|
}
|
||||||
|
|
||||||
return !effect.isSuppressed;
|
if (!effect.isSuppressed) {
|
||||||
}
|
acc.push(effectData);
|
||||||
);
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
|
}, []);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue