mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Fixed effects not being creatable when not on an actor
This commit is contained in:
parent
d7ce388cad
commit
d79c236cfe
1 changed files with 32 additions and 28 deletions
|
|
@ -108,37 +108,41 @@ export default class DhActiveEffect extends foundry.documents.ActiveEffect {
|
||||||
update.img = 'icons/magic/life/heart-cross-blue.webp';
|
update.img = 'icons/magic/life/heart-cross-blue.webp';
|
||||||
}
|
}
|
||||||
|
|
||||||
const existingEffect = this.actor.effects.find(x => x.origin === data.origin);
|
if (this.actor) {
|
||||||
const stacks = Boolean(data.system?.stacking);
|
const existingEffect = this.actor.effects.find(x => x.origin === data.origin);
|
||||||
if (existingEffect && !stacks) return false;
|
const stacks = Boolean(data.system?.stacking);
|
||||||
|
if (existingEffect && !stacks) return false;
|
||||||
|
|
||||||
if (existingEffect && stacks) {
|
if (existingEffect && stacks) {
|
||||||
const incrementedValue = existingEffect.system.stacking.value + 1;
|
const incrementedValue = existingEffect.system.stacking.value + 1;
|
||||||
await existingEffect.update({
|
await existingEffect.update({
|
||||||
'system.stacking.value': Math.min(incrementedValue, existingEffect.system.stacking.max ?? Infinity)
|
'system.stacking.value': Math.min(incrementedValue, existingEffect.system.stacking.max ?? Infinity)
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const statuses = Object.keys(data.statuses ?? {});
|
if (this.parent) {
|
||||||
const immuneStatuses =
|
const statuses = Object.keys(data.statuses ?? {});
|
||||||
statuses.filter(
|
const immuneStatuses =
|
||||||
status =>
|
statuses.filter(
|
||||||
this.parent.system.rules?.conditionImmunities &&
|
status =>
|
||||||
this.parent.system.rules.conditionImmunities[status]
|
this.parent.system.rules?.conditionImmunities &&
|
||||||
) ?? [];
|
this.parent.system.rules.conditionImmunities[status]
|
||||||
if (immuneStatuses.length > 0) {
|
) ?? [];
|
||||||
update.statuses = statuses.filter(x => !immuneStatuses.includes(x));
|
if (immuneStatuses.length > 0) {
|
||||||
const conditions = CONFIG.DH.GENERAL.conditions();
|
update.statuses = statuses.filter(x => !immuneStatuses.includes(x));
|
||||||
const scrollingTexts = immuneStatuses.map(status => ({
|
const conditions = CONFIG.DH.GENERAL.conditions();
|
||||||
text: game.i18n.format('DAGGERHEART.ACTIVEEFFECT.immuneStatusText', {
|
const scrollingTexts = immuneStatuses.map(status => ({
|
||||||
status: game.i18n.localize(conditions[status].name)
|
text: game.i18n.format('DAGGERHEART.ACTIVEEFFECT.immuneStatusText', {
|
||||||
})
|
status: game.i18n.localize(conditions[status].name)
|
||||||
}));
|
})
|
||||||
if (update.statuses.length > 0) {
|
}));
|
||||||
setTimeout(() => scrollingTexts, 500);
|
if (update.statuses.length > 0) {
|
||||||
} else {
|
setTimeout(() => scrollingTexts, 500);
|
||||||
this.parent.queueScrollText(scrollingTexts);
|
} else {
|
||||||
|
this.parent.queueScrollText(scrollingTexts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue