diff --git a/Changelog.md b/Changelog.md index a6d877d..7b5662d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,2 +1,6 @@ -## v0.0.1 -- Restores DFreds CE functionality for dnd5e system 3.x version. Change the setting in DFreds CE to NONE, regarding replacing the core status effects. +## v1.0.0 +- Initial release. +- Adds on all relevant system's status effects MidiQOL flags. +- Reinstates usability of DFreds CE in Foundry 11/12 and mainly dnd5e v3.x (change the modify status effects setting in DFreds CE to NONE). +- Rest Recovery compatibility with its exhaustion automation. If enabled, RR's automation takes priority. +- Check the readme for more info and a way to reinstate usability of Condition Lab Triggler too on dnd5e v3.x. diff --git a/README.md b/README.md index 14fb9f8..2a2e64a 100644 --- a/README.md +++ b/README.md @@ -5,5 +5,28 @@ A small module for Foundry and Dnd5e which contains scripts that thislonelybugbe The ones included can at any point be altered, based on functionality absorbed/fixed/removed from relevant modules or the system. -The initial commit hooks on preCreateActiveEffect and preUpdateActiveEffect, in order to add the proper MidiQOL flags to the system's core status effects, resolving the current issue with DFreds CE not being compatible with dnd5e v3.x. -- Set the Replace core status effects setting in DFreds CE, to NONE. +The initial commit hooks on `preCreateActiveEffect` and `preUpdateActiveEffect`, in order to add the proper `MidiQOL flags` to the system's core status effects for: +- `blinded`, +- `dodging`, +- `encumbered`: Needs the system's setting for `Encumbrance Tracking` set to `Variant (encumbered & heavily encumbered), +- `exhaustion (1-5)`, +- `frightened`, +- `invisible`, +- `paralyzed`, +- `petrified`, +- `poisoned`, +- `prone`, +- `restrained`, +- `silenced`: Forces spells with V component to fail. You can create an Active Effect with `flags.midi-qol.fail.spell.vocal | Override | false | 20` which will cancel it out (think Subtle spell), +- `stunned`, +- `unconscious`. + +## Compatibility notes. +- `DFreds Convenient Effects`: For compatibility make sure that you set the `Modify Status Effects` to `NONE`. As a side effect DFreds CE will be usable on dnd5e 3.x and Foundry 11/12. +- `Rest Recovery`: Provides exhaustion automation (when that setting is enabled it will take priority; NEEDS to reload Foundry if you change any relevant settings in RR). +- `Condition Lab Trigger`: For compatibility you need to make sure to force the default system's status effects, instead of the ones altered by CLT. To do that you need a World script which follows. +```js +Hooks.once('ready', () => { + CONFIG.statusEffects = CONFIG.defaultStatusEffects; +}); +``` diff --git a/module.json b/module.json index dd8dfc5..299afbd 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "id": "bugs", "title": "Bugbear's Scripts", "description": "A small module for Foundry and Dnd5e which contains scripts thislonelybugbear finds useful.", - "version": "0.0.1", + "version": "1.0.0", "authors": [ { "name": "thatlonelybugbear", @@ -41,6 +41,6 @@ "url": "https://github.com/thatlonelybugbear/bugs", "license": "https://raw.githubusercontent.com/thatlonelybugbear/bugs/main/LICENSE", "manifest": "https://github.com/thatlonelybugbear/bugs/releases/latest/download/module.json", - "download": "https://github.com/thatlonelybugbear/bugs/releases/download/v0.0.1/module.zip", + "download": "https://github.com/thatlonelybugbear/bugs/releases/download/v1.0.0/module.zip", "changelog": "https://raw.githubusercontent.com/thatlonelybugbear/bugs/main/Changelog.md" } diff --git a/scripts/bugs-main.mjs b/scripts/bugs-main.mjs index 085bba2..cc620f4 100644 --- a/scripts/bugs-main.mjs +++ b/scripts/bugs-main.mjs @@ -2,21 +2,50 @@ const statusEffects = {}; statusEffects[staticID('blinded')] = { changes: [ { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, ], }; +statusEffects[staticID('dodging')] = { + changes: [ + { + key: 'flags.midi-qol.grants.disadvantage.attack.all', + mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, + value: + 'target.canSee && !["incapacitated","grappled","paralyzed","petrified","restrained","stunned","unconscious"].some(el=>workflow.targets.first()?.actor.statuses.has(el)) && workflow.targets.first()?.actor.system.attributes.exhaustion !== 5' , + }, + ], +}; +statusEffects[staticID('encumbered')] = { + changes: [ + { + key: 'flags.midi-qol.disadvantage.ability.check.all', + mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, + value: 'fromUuidSync(targetUuid).actor.statuses.has("exceedingCarryingCapacity") || fromUuidSync(targetUuid).actor.statuses.has("heavilyEncumbered")', + }, + { + key: 'flags.midi-qol.disadvantage.ability.save.all', + mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, + value: 'fromUuidSync(targetUuid).actor.statuses.has("exceedingCarryingCapacity") || fromUuidSync(targetUuid).actor.statuses.has("heavilyEncumbered")', + }, + { + key: 'flags.midi-qol.disadvantage.attack.all', + mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, + value: 'fromUuidSync(tokenUuid).actor.statuses.has("exceedingCarryingCapacity") || fromUuidSync(tokenUuid).actor.statuses.has("heavilyEncumbered")', + }, + ], +}; statusEffects[staticID('exhaustion')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -30,7 +59,7 @@ statusEffects[staticID('exhaustion')] = { statusEffects[staticID('exhaustion2')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -44,7 +73,7 @@ statusEffects[staticID('exhaustion2')] = { statusEffects[staticID('exhaustion3')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -54,12 +83,12 @@ statusEffects[staticID('exhaustion3')] = { value: '1', }, { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.ability.save.all`, + key: 'flags.midi-qol.disadvantage.ability.save.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -68,7 +97,7 @@ statusEffects[staticID('exhaustion3')] = { statusEffects[staticID('exhaustion4')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -78,12 +107,12 @@ statusEffects[staticID('exhaustion4')] = { value: '1', }, { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.ability.save.all`, + key: 'flags.midi-qol.disadvantage.ability.save.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -92,7 +121,7 @@ statusEffects[staticID('exhaustion4')] = { statusEffects[staticID('exhaustion5')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -102,12 +131,12 @@ statusEffects[staticID('exhaustion5')] = { value: '1', }, { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.ability.save.all`, + key: 'flags.midi-qol.disadvantage.ability.save.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -116,17 +145,18 @@ statusEffects[staticID('exhaustion5')] = { statusEffects[staticID('frightened')] = { changes: [ { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, ], }; +/* statusEffects[staticID('grappled')] = { changes: [ { @@ -137,15 +167,16 @@ statusEffects[staticID('grappled')] = { }, ], }; +*/ statusEffects[staticID('invisible')] = { changes: [ { - key: `flags.midi-qol.advantage.attack.all`, + key: 'flags.midi-qol.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.disadvantage.attack.all`, + key: 'flags.midi-qol.grants.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -154,47 +185,41 @@ statusEffects[staticID('invisible')] = { statusEffects[staticID('paralyzed')] = { changes: [ { - key: `flags.midi-qol.fail.ability.save.dex`, + key: 'flags.midi-qol.fail.ability.save.dex', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.fail.ability.save.str`, + key: 'flags.midi-qol.fail.ability.save.str', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.critical.range`, + key: 'flags.midi-qol.grants.critical.range', mode: CONST.ACTIVE_EFFECT_MODES.OVERRIDE, value: '5', }, - { - key: 'system.attributes.movement.all', - mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '0', - priority: 25, - }, ], }; statusEffects[staticID('petrified')] = { changes: [ { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.fail.ability.save.dex`, + key: 'flags.midi-qol.fail.ability.save.dex', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.fail.ability.save.str`, + key: 'flags.midi-qol.fail.ability.save.str', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -213,23 +238,17 @@ statusEffects[staticID('petrified')] = { mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: 'magical', }, - { - key: 'system.attributes.movement.all', - mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '0', - priority: 25, - }, ], }; statusEffects[staticID('poisoned')] = { changes: [ { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.ability.check.all`, + key: 'flags.midi-qol.disadvantage.ability.check.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -238,32 +257,22 @@ statusEffects[staticID('poisoned')] = { statusEffects[staticID('prone')] = { changes: [ { - key: `flags.midi-qol.grants.advantage.attack.mwak`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '1', + value: 'getDistance(fromUuidSync(tokenUuid),workflow.targets.first()) <= 5', }, { - key: `flags.midi-qol.grants.advantage.attack.msak`, + key: 'flags.midi-qol.grants.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '1', - }, - { - key: `flags.midi-qol.grants.disadvantage.attack.rwak`, - mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '1', - }, - { - key: `flags.midi-qol.grants.disadvantage.attack.rsak`, - mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '1', + value: 'getDistance(fromUuidSync(tokenUuid),workflow.targets.first()) > 5', }, { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: 'system.attributes.movement.all', + key: 'system.attributes.movement.walk', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '*0.5', priority: 25, @@ -273,42 +282,45 @@ statusEffects[staticID('prone')] = { statusEffects[staticID('restrained')] = { changes: [ { - key: `flags.midi-qol.disadvantage.ability.save.dex`, + key: 'flags.midi-qol.disadvantage.ability.save.dex', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.disadvantage.attack.all`, + key: 'flags.midi-qol.disadvantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, + ], +}; +statusEffects[staticID('silenced')] = { + changes: [ { - key: 'system.attributes.movement.all', + key: 'flags.midi-qol.fail.spell.vocal', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '0', - priority: 25, + value: 'fromUuidSync(tokenUuid)?.actor.appliedEffects.some(e=>e.name == "Subtle Spell") ? 1 : 0', }, ], }; statusEffects[staticID('stunned')] = { changes: [ { - key: `flags.midi-qol.fail.ability.save.dex`, + key: 'flags.midi-qol.fail.ability.save.dex', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.fail.ability.save.str`, + key: 'flags.midi-qol.fail.ability.save.str', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, @@ -317,31 +329,25 @@ statusEffects[staticID('stunned')] = { statusEffects[staticID('unconscious')] = { changes: [ { - key: `flags.midi-qol.fail.ability.save.dex`, + key: 'flags.midi-qol.fail.ability.save.dex', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.fail.ability.save.str`, + key: 'flags.midi-qol.fail.ability.save.str', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.advantage.attack.all`, + key: 'flags.midi-qol.grants.advantage.attack.all', mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, value: '1', }, { - key: `flags.midi-qol.grants.critical.range`, + key: 'flags.midi-qol.grants.critical.range', mode: CONST.ACTIVE_EFFECT_MODES.OVERRIDE, value: '5', }, - { - key: 'system.attributes.movement.all', - mode: CONST.ACTIVE_EFFECT_MODES.CUSTOM, - value: '0', - priority: 25, - }, ], };