update document instantiation to use class constructors instead of fromObject for better compatibility

This commit is contained in:
CPTN Cosmo 2026-04-26 18:10:40 +02:00
parent 0f9c20a041
commit 81a267b228

View file

@ -99,7 +99,8 @@ export function patchIkonisLogic() {
// Clone the effect and set this actor as parent to ensure application
const effectData = effect.toObject();
effectData.disabled = false;
const effectInstance = getDocumentClass("ActiveEffect").fromObject(effectData, { parent: this });
const ActiveEffectClass = getDocumentClass("ActiveEffect");
const effectInstance = new ActiveEffectClass(effectData, { parent: this });
yield effectInstance;
}
}
@ -115,7 +116,8 @@ export function patchIkonisLogic() {
const effectData = effect.toObject();
effectData.disabled = false;
const effectInstance = getDocumentClass("ActiveEffect").fromObject(effectData, { parent: this });
const ActiveEffectClass = getDocumentClass("ActiveEffect");
const effectInstance = new ActiveEffectClass(effectData, { parent: this });
yield effectInstance;
}
}
@ -159,9 +161,9 @@ export function patchDhCharacter(DhCharacter) {
if (bondedUuid) {
const feature = _featureCache.get(bondedUuid) || fromUuidSync(bondedUuid);
if (feature) {
// Use getDocumentClass to ensure we have the correct Item class
// Use constructor to ensure compatibility
const ItemClass = getDocumentClass("Item");
const featureClone = ItemClass.fromObject(feature.toObject(), { parent: this.parent });
const featureClone = new ItemClass(feature.toObject(), { parent: this.parent });
ikonisFeatures.push(featureClone);
console.log(`DH-Ikonis | Resolved bonded feature: ${feature.name}`);
}
@ -178,9 +180,9 @@ export function patchDhCharacter(DhCharacter) {
const feature = _featureCache.get(aug.featureUuid) || fromUuidSync(aug.featureUuid);
if (feature) {
// Use getDocumentClass to ensure we have the correct Item class
// Use constructor to ensure compatibility
const ItemClass = getDocumentClass("Item");
const featureClone = ItemClass.fromObject(feature.toObject(), { parent: this.parent });
const featureClone = new ItemClass(feature.toObject(), { parent: this.parent });
ikonisFeatures.push(featureClone);
console.log(`DH-Ikonis | Resolved augment feature: ${feature.name}`);
}