From f8106530596202535870dc4245fc78c538029590 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sat, 22 Nov 2025 23:23:24 +0100 Subject: [PATCH] Added immunity for hidden and SRD additions for immunity --- lang/en.json | 3 +- module/applications/hud/tokenHUD.mjs | 5 +- module/data/actor/adversary.mjs | 5 +- module/data/actor/character.mjs | 5 +- module/data/actor/companion.mjs | 5 +- ...dversary_Chaos_Skull_jDmHqGvzg5wjgmxE.json | 54 ++++++++++++++++++- .../adversary_Gorgon_8mJYMpbLTb8qIOrr.json | 17 ++++-- ...Card_Force_of_Nature_LzVpMkD5I4QeaIHf.json | 14 +++-- styles/less/hud/token-hud/token-hud.less | 37 ++++++++++++- templates/hud/tokenHUD.hbs | 7 ++- 10 files changed, 131 insertions(+), 21 deletions(-) diff --git a/lang/en.json b/lang/en.json index 8822bdc3..7cd10e2a 100755 --- a/lang/en.json +++ b/lang/en.json @@ -2728,7 +2728,8 @@ "rightClickExtand": "Right-Click to extand", "companionPartnerLevelBlock": "The companion needs an assigned partner to level up.", "configureAttribution": "Configure Attribution", - "deleteItem": "Delete Item" + "deleteItem": "Delete Item", + "immune": "Immune" } } } diff --git a/module/applications/hud/tokenHUD.mjs b/module/applications/hud/tokenHUD.mjs index a5fd719f..8898ff0b 100644 --- a/module/applications/hud/tokenHUD.mjs +++ b/module/applications/hud/tokenHUD.mjs @@ -33,7 +33,10 @@ export default class DHTokenHUD extends foundry.applications.hud.TokenHUD { : context.canToggleCombat; context.systemStatusEffects = Object.keys(context.statusEffects).reduce((acc, key) => { const effect = context.statusEffects[key]; - if (effect.systemEffect) acc[key] = effect; + if (effect.systemEffect) { + const disabled = !effect.isActive && this.actor.system.rules.conditionImmunities[key]; + acc[key] = { ...effect, disabled }; + } return acc; }, {}); diff --git a/module/data/actor/adversary.mjs b/module/data/actor/adversary.mjs index 6142fd78..5e25202c 100644 --- a/module/data/actor/adversary.mjs +++ b/module/data/actor/adversary.mjs @@ -59,8 +59,9 @@ export default class DhpAdversary extends BaseDataActor { }), rules: new fields.SchemaField({ conditionImmunities: new fields.SchemaField({ - vulnerable: new fields.BooleanField({ initial: false }), - restrained: new fields.BooleanField({ initial: false }) + hidden: new fields.BooleanField({ initial: false }), + restrained: new fields.BooleanField({ initial: false }), + vulnerable: new fields.BooleanField({ initial: false }) }) }), attack: new ActionField({ diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index 7b7f4ab7..638da365 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -284,8 +284,9 @@ export default class DhCharacter extends BaseDataActor { }) }), conditionImmunities: new fields.SchemaField({ - vulnerable: new fields.BooleanField({ initial: false }), - restrained: new fields.BooleanField({ initial: false }) + hidden: new fields.BooleanField({ initial: false }), + restrained: new fields.BooleanField({ initial: false }), + vulnerable: new fields.BooleanField({ initial: false }) }), runeWard: new fields.BooleanField({ initial: false }), burden: new fields.SchemaField({ diff --git a/module/data/actor/companion.mjs b/module/data/actor/companion.mjs index b5258c5a..a66cd028 100644 --- a/module/data/actor/companion.mjs +++ b/module/data/actor/companion.mjs @@ -53,8 +53,9 @@ export default class DhCompanion extends BaseDataActor { ), rules: new fields.SchemaField({ conditionImmunities: new fields.SchemaField({ - vulnerable: new fields.BooleanField({ initial: false }), - restrained: new fields.BooleanField({ initial: false }) + hidden: new fields.BooleanField({ initial: false }), + restrained: new fields.BooleanField({ initial: false }), + vulnerable: new fields.BooleanField({ initial: false }) }) }), attack: new ActionField({ diff --git a/src/packs/adversaries/adversary_Chaos_Skull_jDmHqGvzg5wjgmxE.json b/src/packs/adversaries/adversary_Chaos_Skull_jDmHqGvzg5wjgmxE.json index 446aee22..c63ced47 100644 --- a/src/packs/adversaries/adversary_Chaos_Skull_jDmHqGvzg5wjgmxE.json +++ b/src/packs/adversaries/adversary_Chaos_Skull_jDmHqGvzg5wjgmxE.json @@ -239,7 +239,59 @@ }, "_id": "m6uPm4vujrUjSFPw", "img": "icons/magic/air/fog-gas-smoke-blue-gray.webp", - "effects": [], + "effects": [ + { + "name": "Levitation", + "type": "base", + "system": { + "rangeDependence": { + "enabled": false, + "type": "withinRange", + "target": "hostile", + "range": "melee" + } + }, + "_id": "k6iaQVfMZhrpwYQj", + "img": "icons/magic/air/fog-gas-smoke-blue-gray.webp", + "changes": [ + { + "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 + }, + "description": "

The Skull levitates several feet off the ground and can’t be Restrained.

", + "origin": null, + "tint": "#ffffff", + "transfer": true, + "statuses": [], + "sort": 0, + "flags": {}, + "_stats": { + "compendiumSource": null, + "duplicateSource": null, + "exportSource": null, + "coreVersion": "13.351", + "systemId": "daggerheart", + "systemVersion": "1.2.4", + "createdTime": 1763845938979, + "modifiedTime": 1763846023794, + "lastModifiedBy": "Q4RzhhaPfvLUzzbw" + }, + "_key": "!actors.items.effects!jDmHqGvzg5wjgmxE.m6uPm4vujrUjSFPw.k6iaQVfMZhrpwYQj" + } + ], "folder": null, "sort": 0, "ownership": { diff --git a/src/packs/adversaries/adversary_Gorgon_8mJYMpbLTb8qIOrr.json b/src/packs/adversaries/adversary_Gorgon_8mJYMpbLTb8qIOrr.json index ed8cf539..378fffd2 100644 --- a/src/packs/adversaries/adversary_Gorgon_8mJYMpbLTb8qIOrr.json +++ b/src/packs/adversaries/adversary_Gorgon_8mJYMpbLTb8qIOrr.json @@ -355,7 +355,14 @@ "range": "melee" } }, - "changes": [], + "changes": [ + { + "key": "system.rules.conditionImmunities.hidden", + "mode": 5, + "value": "1", + "priority": null + } + ], "disabled": false, "duration": { "startTime": null, @@ -366,7 +373,7 @@ "startRound": null, "startTurn": null }, - "description": "

You Glow until the end of the scene and can’t become Hidden. Attack rolls made against you have advantage.

", + "description": "

You Glow until the end of the scene and can’t become Hidden. Attack rolls made against you have advantage.

", "tint": "#ffffff", "statuses": [], "sort": 0, @@ -375,12 +382,12 @@ "compendiumSource": null, "duplicateSource": null, "exportSource": null, - "coreVersion": "13.346", + "coreVersion": "13.351", "systemId": "daggerheart", "systemVersion": "0.0.1", "createdTime": 1754079525282, - "modifiedTime": 1754079558712, - "lastModifiedBy": "MQSznptE5yLT7kj8" + "modifiedTime": 1763847816177, + "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!actors.items.effects!8mJYMpbLTb8qIOrr.NepVGKOo1lHYjA1F.bYBrgiSwHwYfQyjn" } diff --git a/src/packs/domains/domainCard_Force_of_Nature_LzVpMkD5I4QeaIHf.json b/src/packs/domains/domainCard_Force_of_Nature_LzVpMkD5I4QeaIHf.json index b3d55ab5..1770b72d 100644 --- a/src/packs/domains/domainCard_Force_of_Nature_LzVpMkD5I4QeaIHf.json +++ b/src/packs/domains/domainCard_Force_of_Nature_LzVpMkD5I4QeaIHf.json @@ -122,6 +122,12 @@ "mode": 2, "value": "10", "priority": null + }, + { + "key": "system.rules.conditionImmunities.restrained", + "mode": 5, + "value": "1", + "priority": null } ], "disabled": false, @@ -134,7 +140,7 @@ "startRound": null, "startTurn": null }, - "description": "", + "description": "", "tint": "#ffffff", "statuses": [], "sort": 0, @@ -143,12 +149,12 @@ "compendiumSource": null, "duplicateSource": null, "exportSource": null, - "coreVersion": "13.346", + "coreVersion": "13.351", "systemId": "daggerheart", "systemVersion": "0.0.1", "createdTime": 1754120504134, - "modifiedTime": 1754340362524, - "lastModifiedBy": "Q9NoTaEarn3VMS6Z" + "modifiedTime": 1763846303087, + "lastModifiedBy": "Q4RzhhaPfvLUzzbw" }, "_key": "!items.effects!LzVpMkD5I4QeaIHf.ptBC882plZW39Ld9" } diff --git a/styles/less/hud/token-hud/token-hud.less b/styles/less/hud/token-hud/token-hud.less index 9849512b..ec67b524 100644 --- a/styles/less/hud/token-hud/token-hud.less +++ b/styles/less/hud/token-hud/token-hud.less @@ -1,6 +1,18 @@ .theme-light .daggerheart.placeable-hud { - .status-effects .effect-control { - filter: none; + .status-effects { + .effect-control { + filter: none; + } + + .effect-control-container { + .effect-control { + filter: none; + } + + .effect-control-disabled-marker { + color: @red; + } + } } } @@ -21,4 +33,25 @@ } } } + + .status-effects { + .effect-control-container { + position: relative; + + .effect-control-disabled-marker { + position: absolute; + height: 100%; + width: 100%; + top: -1px; + left: 1px; + color: @medium-red; + font-weight: 700; + font-size: 2.1em; + rotate: 29deg; + display: flex; + align-items: center; + justify-content: center; + } + } + } } diff --git a/templates/hud/tokenHUD.hbs b/templates/hud/tokenHUD.hbs index 0ea047c5..aaf2f5f9 100644 --- a/templates/hud/tokenHUD.hbs +++ b/templates/hud/tokenHUD.hbs @@ -46,7 +46,12 @@
{{#each systemStatusEffects as |status|}} - +
+ + {{#if status.disabled}} + / + {{/if}} +
{{/each}} {{#if genericStatusEffects}}