Fixed multiclass feature/item linking

This commit is contained in:
WBHarry 2025-07-23 19:24:57 +02:00
parent 92f55db564
commit 2b5d04abef
4 changed files with 20 additions and 9 deletions

View file

@ -349,8 +349,8 @@ export default class DhCharacterLevelUp extends LevelUpBase {
if (!acc) acc = {};
acc[traitKey] = {
label: game.i18n.localize(abilities[traitKey].label),
old: this.actor.system.traits[traitKey].max,
new: this.actor.system.traits[traitKey].max + advancement.trait[traitKey]
old: this.actor.system.traits[traitKey].value,
new: this.actor.system.traits[traitKey].value + advancement.trait[traitKey]
};
}
return acc;

View file

@ -263,7 +263,8 @@ export default class DhCharacter extends BaseDataActor {
}
get tier() {
return this.levelData.level.current === 1
const currentLevel = this.levelData.level.current;
return currentLevel === 1
? 1
: Object.values(game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers).find(
tier => currentLevel >= tier.levels.start && currentLevel <= tier.levels.end
@ -543,6 +544,14 @@ export default class DhCharacter extends BaseDataActor {
...(this.class?.subclass?.system?.features?.map(x => ({
linkUuid: this.class.subclass.uuid,
feature: x
})) ?? []),
...(this.multiclass?.value?.system?.features?.map(x => ({
linkUuid: this.multiclass.value.uuid,
feature: x
})) ?? []),
...(this.multiclass?.subclass?.system?.features?.map(x => ({
linkUuid: this.multiclass.subclass.uuid,
feature: x
})) ?? [])
];
for (let { linkUuid, feature } of featureLinks) {
@ -554,10 +563,13 @@ export default class DhCharacter extends BaseDataActor {
});
}
const itemLinks = this.class?.value?.system?.linkedItems?.map(x => ({
linkUuid: this.class.value.uuid,
item: x
}));
const itemLinks = [
...(this.class?.value?.system?.linkedItems?.map(x => ({ linkUuid: this.class.value.uuid, item: x })) ?? []),
...(this.multiclass?.value?.system?.linkedItems?.map(x => ({
linkUuid: this.multiclass.value.uuid,
item: x
})) ?? [])
];
for (let { linkUuid, item } of itemLinks) {
await item.update({
'system.itemLinks': Object.keys(CONFIG.DH.ITEM.itemLinkItemTypes).reduce((acc, type) => {

View file

@ -125,7 +125,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
this.updateSource({ actions: [action] });
}
options.origUuid = data.uuid;
options.origUuid = data.uuid ?? `Item.${data._id}`;
}
_onCreate(data, options) {