mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-14 20:51:07 +01:00
Fixed domaincard level max for selections in a tier
This commit is contained in:
parent
6ef691445e
commit
43c8e54e5d
2 changed files with 28 additions and 11 deletions
|
|
@ -204,9 +204,12 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
context.domainCards.push({
|
context.domainCards.push({
|
||||||
...(card.toObject?.() ?? card),
|
...(card.toObject?.() ?? card),
|
||||||
emptySubtexts: domainsData.map(domain => {
|
emptySubtexts: domainsData.map(domain => {
|
||||||
const levelMax = domain.multiclass
|
const levelBase = domain.multiclass
|
||||||
? Math.ceil(this.levelup.currentLevel / 2)
|
? Math.ceil(this.levelup.currentLevel / 2)
|
||||||
: this.levelup.currentLevel;
|
: this.levelup.currentLevel;
|
||||||
|
const levelMax = domainCard.secondaryData?.limit
|
||||||
|
? Math.min(domainCard.secondaryData.limit, levelBase)
|
||||||
|
: levelBase;
|
||||||
|
|
||||||
return game.i18n.format('DAGGERHEART.Application.LevelUp.Selections.emptyDomainCardHint', {
|
return game.i18n.format('DAGGERHEART.Application.LevelUp.Selections.emptyDomainCardHint', {
|
||||||
domain: game.i18n.localize(domains[domain.domain].label),
|
domain: game.i18n.localize(domains[domain.domain].label),
|
||||||
|
|
@ -216,7 +219,7 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
path: domainCard.data
|
path: domainCard.data
|
||||||
? `${domainCard.path}.data`
|
? `${domainCard.path}.data`
|
||||||
: `levels.${domainCard.level}.achievements.domainCards.${key}.uuid`,
|
: `levels.${domainCard.level}.achievements.domainCards.${key}.uuid`,
|
||||||
limit: domainCard.level,
|
limit: domainCard.secondaryData?.limit ?? null,
|
||||||
compendium: 'domains'
|
compendium: 'domains'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -582,10 +585,9 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
const levelBase = isMulticlass ? Math.ceil(this.levelup.currentLevel / 2) : this.levelup.currentLevel;
|
||||||
(isMulticlass ? Math.ceil(this.levelup.currentLevel / 2) : this.levelup.currentLevel) <
|
const levelMax = target.dataset.limit ? Math.min(Number(target.dataset.limit), levelBase) : levelBase;
|
||||||
item.system.level
|
if (levelMax < item.system.level) {
|
||||||
) {
|
|
||||||
ui.notifications.error(
|
ui.notifications.error(
|
||||||
game.i18n.localize('DAGGERHEART.Application.LevelUp.notifications.error.domainCardToHighLevel')
|
game.i18n.localize('DAGGERHEART.Application.LevelUp.notifications.error.domainCardToHighLevel')
|
||||||
);
|
);
|
||||||
|
|
@ -668,15 +670,23 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
update[
|
const updateData = {
|
||||||
`levels.${this.levelup.currentLevel}.choices.${button.dataset.option}.${button.dataset.checkboxNr}`
|
|
||||||
] = {
|
|
||||||
tier: Number(button.dataset.tier),
|
tier: Number(button.dataset.tier),
|
||||||
minCost: Number(button.dataset.cost),
|
minCost: Number(button.dataset.cost),
|
||||||
amount: button.dataset.amount ? Number(button.dataset.amount) : null,
|
amount: button.dataset.amount ? Number(button.dataset.amount) : null,
|
||||||
value: button.dataset.value,
|
value: button.dataset.value,
|
||||||
type: button.dataset.type
|
type: button.dataset.type
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (button.dataset.type === 'domainCard') {
|
||||||
|
updateData.secondaryData = {
|
||||||
|
limit: Math.max(...this.levelup.tiers[button.dataset.tier].belongingLevels)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
update[
|
||||||
|
`levels.${this.levelup.currentLevel}.choices.${button.dataset.option}.${button.dataset.checkboxNr}`
|
||||||
|
] = updateData;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.levelup.updateSource(update);
|
await this.levelup.updateSource(update);
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
);
|
);
|
||||||
|
|
||||||
const { multiclass, subclasses } = this.classUpgradeChoices;
|
const { multiclass, subclasses } = this.classUpgradeChoices;
|
||||||
return tierKeys.map(tierKey => {
|
return tierKeys.map((tierKey, tierIndex) => {
|
||||||
const tier = this.tiers[tierKey];
|
const tier = this.tiers[tierKey];
|
||||||
const multiclassInTier = multiclass?.tier === Number(tierKey);
|
const multiclassInTier = multiclass?.tier === Number(tierKey);
|
||||||
const subclassInTier = subclasses.some(x => x.tier === Number(tierKey));
|
const subclassInTier = subclasses.some(x => x.tier === Number(tierKey));
|
||||||
|
|
@ -216,8 +216,15 @@ export class DhLevelup extends foundry.abstract.DataModel {
|
||||||
|
|
||||||
return checkbox;
|
return checkbox;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let label = game.i18n.localize(option.label);
|
||||||
|
if (optionKey === 'domainCard') {
|
||||||
|
const maxLevel = tier.belongingLevels[tier.belongingLevels.length - 1];
|
||||||
|
label = game.i18n.format(option.label, { maxLevel });
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
label: game.i18n.localize(option.label),
|
label: label,
|
||||||
checkboxGroups: chunkify(checkboxes, option.minCost, chunkedBoxes => {
|
checkboxGroups: chunkify(checkboxes, option.minCost, chunkedBoxes => {
|
||||||
const anySelected = chunkedBoxes.some(x => x.selected);
|
const anySelected = chunkedBoxes.some(x => x.selected);
|
||||||
const anyDisabled = chunkedBoxes.some(x => x.disabled);
|
const anyDisabled = chunkedBoxes.some(x => x.disabled);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue