diff --git a/src/module/chat-message/helpers.ts b/src/module/chat-message/helpers.ts index beca5c9508f..668f022b249 100644 --- a/src/module/chat-message/helpers.ts +++ b/src/module/chat-message/helpers.ts @@ -94,6 +94,11 @@ async function applyDamageFromMessage({ for (const token of tokens) { if (!token.actor) continue; + // Add roll option for ally/enemy status + if (token.actor.alliance && message.actor) { + const allyOrEnemy = token.actor.alliance === message.actor.alliance ? "ally" : "enemy"; + messageRollOptions.push(`origin:${allyOrEnemy}`); + } // If no target was acquired during a roll, set roll options for it during damage application if (!messageRollOptions.some((o) => o.startsWith("target"))) { @@ -113,7 +118,7 @@ async function applyDamageFromMessage({ : []; const contextClone = token.actor.getContextualClone(originRollOptions, ephemeralEffects); const rollOptions = new Set([ - ...messageRollOptions.filter((o) => !/^(?:self|target):/.test(o)), + ...messageRollOptions.filter((o) => !/^(?:self|target)(?::|$)/.test(o)), ...effectRollOptions, ...originRollOptions, ...contextClone.getSelfRollOptions(),