simplify DS4Actor._getOriginatingItemOfActiveEffect

This commit is contained in:
Johannes Loher 2021-02-16 14:52:22 +01:00
parent 66334d338f
commit 4e2691e19f

View file

@ -83,9 +83,7 @@ export class DS4Actor extends Actor<DS4ActorData, DS4Item> {
} }
protected _getOriginatingItemOfActiveEffect(effect: ActiveEffect<DS4Actor>): DS4Item | undefined { protected _getOriginatingItemOfActiveEffect(effect: ActiveEffect<DS4Actor>): DS4Item | undefined {
const re = /.*OwnedItem\.(.*)/; const item = this.items.find((item) => item.uuid === effect.data.origin);
const id = effect.data.origin?.match(re)?.[1] ?? "";
const item = this.items.find((item) => item.id === id);
return item ?? undefined; return item ?? undefined;
} }