mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
[Fix] 1535 - Toggle Bonuses (#1538)
* Fixed all SRD instances of Powerful and Massive * Fixed suppressed effects being added to roll formula options * Fixed weapon effects being presented when it's no the weapon itself * . * . * Fixed secondary weapons effects * Raised system version * Update module/data/action/baseAction.mjs Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> * Update module/documents/chatMessage.mjs Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com> --------- Co-authored-by: Carlos Fernandez <CarlosFdez@users.noreply.github.com>
This commit is contained in:
parent
fad09a1b3a
commit
822c522f61
18 changed files with 38 additions and 171 deletions
|
|
@ -198,7 +198,7 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
let config = this.prepareConfig(event);
|
||||
if (!config) return;
|
||||
|
||||
await this.addEffects(config);
|
||||
config.effects = await game.system.api.data.actions.actionsTypes.base.getEffects(this.actor, this.item);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.preUseAction`, this, config) === false) return;
|
||||
|
||||
|
|
@ -266,14 +266,26 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
|
|||
return config;
|
||||
}
|
||||
|
||||
/** */
|
||||
async addEffects(config) {
|
||||
let effects = [];
|
||||
if (this.actor) {
|
||||
effects = Array.from(await this.actor.allApplicableEffects());
|
||||
}
|
||||
/**
|
||||
* Get the all potentially applicable effects on the actor
|
||||
* @param {DHActor} actor The actor performing the action
|
||||
* @param {DHItem|DhActor} effectParent The parent of the effect
|
||||
* @returns {DhActiveEffect[]}
|
||||
*/
|
||||
static async getEffects(actor, effectParent) {
|
||||
if (!actor) return [];
|
||||
|
||||
return Array.from(await actor.allApplicableEffects()).filter(effect => {
|
||||
/* Effects on weapons only ever apply for the weapon itself */
|
||||
if (effect.parent.type === 'weapon') {
|
||||
/* Unless they're secondary - then they apply only to other primary weapons */
|
||||
if (effect.parent.system.secondary) {
|
||||
if (effectParent.type !== 'weapon' || effectParent.system.secondary) return false;
|
||||
} else if (effectParent?.id !== effect.parent.id) return false;
|
||||
}
|
||||
|
||||
config.effects = effects;
|
||||
return !effect.isSuppressed;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue