mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 16:09:03 +01:00
Fixed multiclass feature/item linking
This commit is contained in:
parent
92f55db564
commit
2b5d04abef
4 changed files with 20 additions and 9 deletions
|
|
@ -349,8 +349,8 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
||||||
if (!acc) acc = {};
|
if (!acc) acc = {};
|
||||||
acc[traitKey] = {
|
acc[traitKey] = {
|
||||||
label: game.i18n.localize(abilities[traitKey].label),
|
label: game.i18n.localize(abilities[traitKey].label),
|
||||||
old: this.actor.system.traits[traitKey].max,
|
old: this.actor.system.traits[traitKey].value,
|
||||||
new: this.actor.system.traits[traitKey].max + advancement.trait[traitKey]
|
new: this.actor.system.traits[traitKey].value + advancement.trait[traitKey]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return acc;
|
return acc;
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,8 @@ export default class DhCharacter extends BaseDataActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
get tier() {
|
get tier() {
|
||||||
return this.levelData.level.current === 1
|
const currentLevel = this.levelData.level.current;
|
||||||
|
return currentLevel === 1
|
||||||
? 1
|
? 1
|
||||||
: Object.values(game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers).find(
|
: Object.values(game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.LevelTiers).tiers).find(
|
||||||
tier => currentLevel >= tier.levels.start && currentLevel <= tier.levels.end
|
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 => ({
|
...(this.class?.subclass?.system?.features?.map(x => ({
|
||||||
linkUuid: this.class.subclass.uuid,
|
linkUuid: this.class.subclass.uuid,
|
||||||
feature: x
|
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) {
|
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 => ({
|
const itemLinks = [
|
||||||
linkUuid: this.class.value.uuid,
|
...(this.class?.value?.system?.linkedItems?.map(x => ({ linkUuid: this.class.value.uuid, item: x })) ?? []),
|
||||||
item: x
|
...(this.multiclass?.value?.system?.linkedItems?.map(x => ({
|
||||||
}));
|
linkUuid: this.multiclass.value.uuid,
|
||||||
|
item: x
|
||||||
|
})) ?? [])
|
||||||
|
];
|
||||||
for (let { linkUuid, item } of itemLinks) {
|
for (let { linkUuid, item } of itemLinks) {
|
||||||
await item.update({
|
await item.update({
|
||||||
'system.itemLinks': Object.keys(CONFIG.DH.ITEM.itemLinkItemTypes).reduce((acc, type) => {
|
'system.itemLinks': Object.keys(CONFIG.DH.ITEM.itemLinkItemTypes).reduce((acc, type) => {
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ export default class BaseDataItem extends foundry.abstract.TypeDataModel {
|
||||||
this.updateSource({ actions: [action] });
|
this.updateSource({ actions: [action] });
|
||||||
}
|
}
|
||||||
|
|
||||||
options.origUuid = data.uuid;
|
options.origUuid = data.uuid ?? `Item.${data._id}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
_onCreate(data, options) {
|
_onCreate(data, options) {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex: 1;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue