mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
Multiclass levelup fixes
This commit is contained in:
parent
569e567dfd
commit
4551a2bcfe
3 changed files with 24 additions and 4 deletions
|
|
@ -166,6 +166,7 @@ export default class DhCharacterLevelUp extends LevelUpBase {
|
|||
context.multiclass = {
|
||||
...data,
|
||||
...(multiclass.toObject?.() ?? multiclass),
|
||||
type: 'multiclass',
|
||||
uuid: multiclass.uuid,
|
||||
domains:
|
||||
multiclass?.system?.domains.map(key => {
|
||||
|
|
|
|||
|
|
@ -452,6 +452,12 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
return;
|
||||
}
|
||||
|
||||
const secondaryData = Object.keys(
|
||||
foundry.utils.getProperty(this.levelup, `${target.dataset.path}.secondaryData`)
|
||||
).reduce((acc, key) => {
|
||||
acc[`-=${key}`] = null;
|
||||
return acc;
|
||||
}, {});
|
||||
await this.levelup.updateSource({
|
||||
multiclass: {
|
||||
class: item.uuid,
|
||||
|
|
@ -464,7 +470,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
amount: target.dataset.amount ? Number(target.dataset.amount) : null,
|
||||
value: target.dataset.value,
|
||||
type: target.dataset.type,
|
||||
data: item.uuid
|
||||
data: item.uuid,
|
||||
secondaryData: secondaryData
|
||||
}
|
||||
});
|
||||
this.render();
|
||||
|
|
@ -538,10 +545,21 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
static async selectDomain(_, button) {
|
||||
const option = foundry.utils.getProperty(this.levelup, button.dataset.path);
|
||||
const domain = option.secondaryData.domain ? null : button.dataset.domain;
|
||||
const update = { [`${button.dataset.path}.secondaryData.domain`]: domain };
|
||||
|
||||
await this.levelup.updateSource({
|
||||
[`${button.dataset.path}.secondaryData.domain`]: domain
|
||||
const domainCards = this.levelup.levels[this.levelup.currentLevel].achievements.domainCards;
|
||||
const illegalDomainCards = option.secondaryData.domain
|
||||
? Object.keys(domainCards)
|
||||
.map(key => ({ ...domainCards[key], key }))
|
||||
.filter(
|
||||
x => x.uuid && foundry.utils.fromUuidSync(x.uuid).system.domain === option.secondaryData.domain
|
||||
)
|
||||
: [];
|
||||
illegalDomainCards.forEach(card => {
|
||||
update[`levels.${this.levelup.currentLevel}.achievements.domainCards.${card.key}.uuid`] = null;
|
||||
});
|
||||
|
||||
await this.levelup.updateSource(update);
|
||||
this.render();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue