remove Ikonis effect injection patch from Actor prototype

This commit is contained in:
CPTN Cosmo 2026-04-26 18:46:34 +02:00
parent 5e14c2a178
commit bbce05dfea

View file

@ -68,65 +68,6 @@ export function getSlotCount(item) {
} }
} }
/**
* Patches the system to ensure Ikonis effects are applied to the actor.
*/
export function patchIkonisLogic() {
console.log("DH-Ikonis | Patching Actor for Ikonis effect injection...");
const originalAllEffects = Actor.prototype.allApplicableEffects;
Actor.prototype.allApplicableEffects = function* (options) {
yield* originalAllEffects.call(this, options);
for (const item of this.items) {
if (item.type !== 'weapon' || !item.system.equipped) continue;
const installedIds = item.getFlag('dh-ikonis', 'installedAugments') || [];
const allAugs = getAugments();
for (const id of installedIds) {
const aug = allAugs.find(a => String(a.id) === String(id));
if (!aug?.featureUuid) continue;
// Try cache first, then sync
const feature = _featureCache.get(aug.featureUuid) || fromUuidSync(aug.featureUuid);
if (!feature || !feature.effects) continue;
for (const effect of feature.effects) {
if (effect.transfer) {
console.log(`DH-Ikonis | Injecting effect '${effect.name}' from augment '${feature.name}' on ${this.name}`);
// Clone the effect and set this actor as parent to ensure application
const effectData = effect.toObject();
effectData.disabled = false;
const ActiveEffectClass = getDocumentClass("ActiveEffect");
const effectInstance = new ActiveEffectClass(effectData, { parent: this });
yield effectInstance;
}
}
}
const bondedUuid = item.getFlag('dh-ikonis', 'bondedFeatureUuid');
if (bondedUuid) {
const feature = _featureCache.get(bondedUuid) || fromUuidSync(bondedUuid);
if (feature?.effects) {
for (const effect of feature.effects) {
if (effect.transfer) {
console.log(`DH-Ikonis | Injecting bonded effect '${effect.name}' from '${feature.name}' on ${this.name}`);
const effectData = effect.toObject();
effectData.disabled = false;
const ActiveEffectClass = getDocumentClass("ActiveEffect");
const effectInstance = new ActiveEffectClass(effectData, { parent: this });
yield effectInstance;
}
}
}
}
}
};
}
/** /**
* Synchronizes Ikonis Augments into the Daggerheart Homebrew settings. * Synchronizes Ikonis Augments into the Daggerheart Homebrew settings.
* This makes them "Real" Weapon Features to the system. * This makes them "Real" Weapon Features to the system.