Add game.actors.party and refine logic

This commit is contained in:
Carlos Fernandez 2026-04-15 18:29:17 -04:00
parent b08b8b93b6
commit 031f497c33
5 changed files with 22 additions and 18 deletions

View file

@ -191,13 +191,11 @@ export const getDeleteKeys = (property, innerProperty, innerPropertyDefaultValue
const nativeReplaceFormulaData = Roll.replaceFormulaData;
Roll.replaceFormulaData = function (formula, baseData = {}, { missing, warn = false } = {}) {
/* Inserting global data */
const data = {
...baseData,
partySize:
!game.actors ? 0 :
game.actors.find(x => x.type === 'party' && x.system.active)?.system.partyMembers.length ?? 0,
const data = {
...baseData,
partySize: game.actors?.party?.system.partyMembers.length ?? 0
};
const terms = Object.keys(CONFIG.DH.GENERAL.multiplierTypes).map(type => {
return { term: type, default: 1 };
});