Restored delevel on partner removal

This commit is contained in:
WBHarry 2025-07-01 03:43:15 +02:00
parent 9905a38b7e
commit 9850d5f6e8

View file

@ -51,8 +51,8 @@ export default class DhCompanionSheet extends DaggerheartSheet(ActorSheetV2) {
} }
async onPartnerChange(event) { async onPartnerChange(event) {
const partner = game.actors.find(a => a.uuid === event.target.value);
if (event.target.value) { if (event.target.value) {
const partner = game.actors.find(a => a.uuid === event.target.value);
await partner.update({ 'system.companion': this.document.uuid }); await partner.update({ 'system.companion': this.document.uuid });
} else { } else {
const update = { 'system.companion': null }; const update = { 'system.companion': null };
@ -74,6 +74,10 @@ export default class DhCompanionSheet extends DaggerheartSheet(ActorSheetV2) {
} }
await this.document.update({ 'system.partner': event.target.value }); await this.document.update({ 'system.partner': event.target.value });
if (!partner) {
await this.document.updateLevel(1);
}
} }
static async attackRoll(event) { static async attackRoll(event) {