From 610d263e19ebe981ba88877e15bc7d7790101b65 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Fri, 24 Apr 2026 19:53:44 +0200 Subject: [PATCH] Fixed so that ORIGIN effect values are handled differently depending on if they target the item or the origin --- module/documents/activeEffect.mjs | 19 +++- .../feature_Unstoppable_PnD2UCgzIlwX6cY3.json | 93 +++++++++++-------- 2 files changed, 68 insertions(+), 44 deletions(-) diff --git a/module/documents/activeEffect.mjs b/module/documents/activeEffect.mjs index 227e2613..65fdd274 100644 --- a/module/documents/activeEffect.mjs +++ b/module/documents/activeEffect.mjs @@ -172,24 +172,33 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect { static getChangeValue(model, change, effect) { let key = change.value.toString(); const isOriginTarget = key.toLowerCase().includes('origin.@'); - let parseModel = model; + let actorModel = model; + let itemModel = effect.parent; if (isOriginTarget && effect.origin) { - key = change.key.replaceAll(/origin\.@/gi, '@'); try { const originEffect = foundry.utils.fromUuidSync(effect.origin); const doc = originEffect.parent?.parent instanceof game.system.api.documents.DhpActor ? originEffect.parent : originEffect.parent.parent; - if (doc) parseModel = doc; + if (doc) { + if (doc instanceof game.system.api.documents.DHItem) { + itemModel = doc; + key = key.replaceAll(/origin\.@/gi, ''); + } else { + actorModel = doc; + key = key.replaceAll(/origin\.@/gi, '@'); + } + + } } catch (_) {} } const stackingParsedValue = effect.system.stacking ? Roll.replaceFormulaData(key, { stacks: effect.system.stacking.value }) : key; - const evalValue = itemAbleRollParse(stackingParsedValue, parseModel, effect.parent); - return evalValue ?? key; + const evalValue = itemAbleRollParse(stackingParsedValue, actorModel, itemModel); + return evalValue ? evalValue : key; } /** diff --git a/src/packs/classes/feature_Unstoppable_PnD2UCgzIlwX6cY3.json b/src/packs/classes/feature_Unstoppable_PnD2UCgzIlwX6cY3.json index 9c9ecf61..3a1cfeab 100644 --- a/src/packs/classes/feature_Unstoppable_PnD2UCgzIlwX6cY3.json +++ b/src/packs/classes/feature_Unstoppable_PnD2UCgzIlwX6cY3.json @@ -67,49 +67,54 @@ "type": "withinRange", "target": "hostile", "range": "melee" + }, + "changes": [ + { + "key": "system.bonuses.damage.physical.bonus", + "type": "add", + "value": "ORIGIN.@item.@system.resource.value", + "priority": null, + "phase": "initial" + }, + { + "key": "system.bonuses.damage.magical.bonus", + "type": "add", + "value": "ORIGIN.@item.@system.resource.value", + "priority": null, + "phase": "initial" + }, + { + "key": "system.rules.damageReduction.reduceSeverity.physical", + "type": "add", + "value": 1, + "priority": null, + "phase": "initial" + }, + { + "key": "system.rules.conditionImmunities.vulnerable", + "type": "override", + "value": 1, + "priority": null, + "phase": "initial" + }, + { + "key": "system.rules.conditionImmunities.restrained", + "type": "override", + "value": 1, + "priority": null, + "phase": "initial" + } + ], + "duration": { + "type": "" } }, - "changes": [ - { - "key": "system.bonuses.damage.physical.bonus", - "mode": 2, - "value": "ORIGIN.@item.resource.value", - "priority": null - }, - { - "key": "system.bonuses.damage.magical.bonus", - "mode": 2, - "value": "ORIGIN.@item.resource.value", - "priority": null - }, - { - "key": "system.rules.damageReduction.reduceSeverity.physical", - "mode": 2, - "value": "1", - "priority": null - }, - { - "key": "system.rules.conditionImmunities.vulnerable", - "mode": 5, - "value": "1", - "priority": null - }, - { - "key": "system.rules.conditionImmunities.restrained", - "mode": 5, - "value": "1", - "priority": null - } - ], "disabled": false, "duration": { - "startTime": null, - "combat": null, - "seconds": null, - "rounds": null, - "turns": null, - "startRound": null, - "startTurn": null + "value": null, + "units": "seconds", + "expiry": null, + "expired": false }, "description": "", "tint": "#ffffff", @@ -119,6 +124,16 @@ "_stats": { "compendiumSource": null }, + "start": { + "time": 0, + "combat": null, + "combatant": null, + "initiative": null, + "round": null, + "turn": null + }, + "showIcon": 1, + "folder": null, "_key": "!items.effects!PnD2UCgzIlwX6cY3.xzQtFSuDS48kUdAZ" } ],