From 0660939cec8b54c383e320947f9c0516adcf12f0 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Mon, 19 Jan 2026 22:42:43 +0100 Subject: [PATCH] Added ActiveEffects to Beastbound features --- module/data/actor/character.mjs | 17 +++---- module/data/actor/companion.mjs | 10 ++++ ...re_Advanced_Training_uGcs785h94RMtueH.json | 46 ++++++++++++++++++- ...ture_Expert_Training_iCXtOWBKv1FdKdWz.json | 46 ++++++++++++++++++- templates/sheets/actors/companion/header.hbs | 2 +- 5 files changed, 108 insertions(+), 13 deletions(-) diff --git a/module/data/actor/character.mjs b/module/data/actor/character.mjs index d97e8b03..897c4790 100644 --- a/module/data/actor/character.mjs +++ b/module/data/actor/character.mjs @@ -725,17 +725,14 @@ export default class DhCharacter extends BaseDataActor { }; } } - } - _onUpdate(changes, options, userId) { - super._onUpdate(changes, options, userId); - - if (game.user.id === userId) { - /* Companion updates */ - if (this.companion) { - if (changes.system.levelData?.level?.current !== undefined) { - this.companion.update(this.companion.toObject(), { diff: false, recursive: false }); - } + /* Force companion data prep */ + if (this.companion) { + if ( + changes.system?.levelData?.level?.current !== undefined && + changes.system.levelData.level.current !== this._source.levelData.level.current + ) { + this.companion.update(this.companion.toObject(), { diff: false, recursive: false }); } } } diff --git a/module/data/actor/companion.mjs b/module/data/actor/companion.mjs index 51113452..a2cb5db3 100644 --- a/module/data/actor/companion.mjs +++ b/module/data/actor/companion.mjs @@ -177,6 +177,16 @@ export default class DhCompanion extends BaseDataActor { changes.system.experiences[experience].core = true; } } + + /* Force partner data prep */ + if (this.partner) { + if ( + changes.system?.levelData?.level?.current !== undefined && + changes.system.levelData.level.current !== this._source.levelData.level.current + ) { + this.partner.update(this.partner.toObject(), { diff: false, recursive: false }); + } + } } async _preDelete() { diff --git a/src/packs/subclasses/feature_Advanced_Training_uGcs785h94RMtueH.json b/src/packs/subclasses/feature_Advanced_Training_uGcs785h94RMtueH.json index 8f9c63f1..16a5cd79 100644 --- a/src/packs/subclasses/feature_Advanced_Training_uGcs785h94RMtueH.json +++ b/src/packs/subclasses/feature_Advanced_Training_uGcs785h94RMtueH.json @@ -16,7 +16,51 @@ "artist": "" } }, - "effects": [], + "effects": [ + { + "name": "Advanced Training", + "type": "base", + "system": { + "rangeDependence": { + "enabled": false, + "type": "withinRange", + "target": "hostile", + "range": "melee" + } + }, + "_id": "bKOuMxhB2Jth3j2T", + "img": "icons/creatures/mammals/wolf-howl-moon-gray.webp", + "changes": [ + { + "key": "system.companionData.levelupChoices", + "mode": 2, + "value": "2", + "priority": null + } + ], + "disabled": false, + "duration": { + "startTime": null, + "combat": null, + "seconds": null, + "rounds": null, + "turns": null, + "startRound": null, + "startTurn": null + }, + "description": "

Choose two additional level-up options for your companion.

", + "origin": null, + "tint": "#ffffff", + "transfer": true, + "statuses": [], + "sort": 0, + "flags": {}, + "_stats": { + "compendiumSource": null + }, + "_key": "!items.effects!uGcs785h94RMtueH.bKOuMxhB2Jth3j2T" + } + ], "sort": 0, "ownership": { "default": 0, diff --git a/src/packs/subclasses/feature_Expert_Training_iCXtOWBKv1FdKdWz.json b/src/packs/subclasses/feature_Expert_Training_iCXtOWBKv1FdKdWz.json index e5850da6..06819dc9 100644 --- a/src/packs/subclasses/feature_Expert_Training_iCXtOWBKv1FdKdWz.json +++ b/src/packs/subclasses/feature_Expert_Training_iCXtOWBKv1FdKdWz.json @@ -16,7 +16,51 @@ "artist": "" } }, - "effects": [], + "effects": [ + { + "name": "Expert Training", + "type": "base", + "system": { + "rangeDependence": { + "enabled": false, + "type": "withinRange", + "target": "hostile", + "range": "melee" + } + }, + "_id": "rknTONvaUDZ2Yz1W", + "img": "icons/creatures/mammals/dog-husky-white-blue.webp", + "changes": [ + { + "key": "system.companionData.levelupChoices", + "mode": 2, + "value": "1", + "priority": null + } + ], + "disabled": false, + "duration": { + "startTime": null, + "combat": null, + "seconds": null, + "rounds": null, + "turns": null, + "startRound": null, + "startTurn": null + }, + "description": "

Choose an additional level-up option for your companion.

", + "origin": null, + "tint": "#ffffff", + "transfer": true, + "statuses": [], + "sort": 0, + "flags": {}, + "_stats": { + "compendiumSource": null + }, + "_key": "!items.effects!iCXtOWBKv1FdKdWz.rknTONvaUDZ2Yz1W" + } + ], "sort": 0, "ownership": { "default": 0, diff --git a/templates/sheets/actors/companion/header.hbs b/templates/sheets/actors/companion/header.hbs index 9688b7e9..8b63e396 100644 --- a/templates/sheets/actors/companion/header.hbs +++ b/templates/sheets/actors/companion/header.hbs @@ -41,7 +41,7 @@ {{/if}} - {{document.system.levelData.level.current}} + {{document.system.levelData.level.changed}}