mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Added visualisation of domain card levels
This commit is contained in:
parent
3717e2ddd4
commit
6ef691445e
4 changed files with 40 additions and 13 deletions
|
|
@ -838,7 +838,7 @@
|
|||
"content": "Returning to the previous level selection will remove all selections made for this level. Do you want to proceed?"
|
||||
},
|
||||
"Selections": {
|
||||
"emptyDomainCardHint": "Domain Card Level {level} or below"
|
||||
"emptyDomainCardHint": "{domain} level {level} or below"
|
||||
},
|
||||
"summary": {
|
||||
"levelAchievements": "Level Achievements",
|
||||
|
|
|
|||
|
|
@ -179,6 +179,20 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
};
|
||||
const allDomainCardKeys = Object.keys(allDomainCards);
|
||||
|
||||
const classDomainsData = this.actor.system.class.value.system.domains.map(domain => ({
|
||||
domain,
|
||||
multiclass: false
|
||||
}));
|
||||
const multiclassDomainsData = (this.actor.system.multiclass?.value?.system?.domains ?? []).map(
|
||||
domain => ({ domain, multiclass: true })
|
||||
);
|
||||
const domainsData = [...classDomainsData, ...multiclassDomainsData];
|
||||
const multiclassDomain = this.levelup.classUpgradeChoices?.multiclass?.domain;
|
||||
if (multiclassDomain) {
|
||||
if (!domainsData.some(x => x.domain === multiclassDomain))
|
||||
domainsData.push({ domain: multiclassDomain, multiclass: true });
|
||||
}
|
||||
|
||||
context.domainCards = [];
|
||||
for (var key of allDomainCardKeys) {
|
||||
const domainCard = allDomainCards[key];
|
||||
|
|
@ -189,10 +203,16 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
|
||||
context.domainCards.push({
|
||||
...(card.toObject?.() ?? card),
|
||||
emptySubtext: game.i18n.format(
|
||||
'DAGGERHEART.Application.LevelUp.Selections.emptyDomainCardHint',
|
||||
{ level: domainCard.level }
|
||||
),
|
||||
emptySubtexts: domainsData.map(domain => {
|
||||
const levelMax = domain.multiclass
|
||||
? Math.ceil(this.levelup.currentLevel / 2)
|
||||
: this.levelup.currentLevel;
|
||||
|
||||
return game.i18n.format('DAGGERHEART.Application.LevelUp.Selections.emptyDomainCardHint', {
|
||||
domain: game.i18n.localize(domains[domain.domain].label),
|
||||
level: levelMax
|
||||
});
|
||||
}),
|
||||
path: domainCard.data
|
||||
? `${domainCard.path}.data`
|
||||
: `levels.${domainCard.level}.achievements.domainCards.${key}.uuid`,
|
||||
|
|
@ -207,10 +227,6 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
possibleSubclasses.push(this.actor.system.multiclass.subclass);
|
||||
}
|
||||
|
||||
// const featureStateIncrease = advancementChoices.subclass?.reduce((acc, subclass) => {
|
||||
// if(subclass.secondaryData.featureState) acc += 1;
|
||||
// return acc;
|
||||
// }, 0) ?? 0;
|
||||
context.subclassCards = [];
|
||||
if (advancementChoices.subclass?.length > 0) {
|
||||
const featureStateIncrease = Object.values(this.levelup.levels).reduce((acc, level) => {
|
||||
|
|
@ -554,6 +570,8 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
if (event.target.closest('.domain-cards')) {
|
||||
const target = event.target.closest('.card-preview-container');
|
||||
if (item.type === 'domainCard') {
|
||||
const { multiclass } = this.levelup.classUpgradeChoices;
|
||||
const isMulticlass = !multiclass ? false : item.system.domain === multiclass.domain;
|
||||
if (
|
||||
!this.actor.system.domains.includes(item.system.domain) &&
|
||||
this.levelup.classUpgradeChoices?.multiclass?.domain !== item.system.domain
|
||||
|
|
@ -564,7 +582,10 @@ export default class DhlevelUp extends HandlebarsApplicationMixin(ApplicationV2)
|
|||
return;
|
||||
}
|
||||
|
||||
if (item.system.level > Number(target.dataset.limit)) {
|
||||
if (
|
||||
(isMulticlass ? Math.ceil(this.levelup.currentLevel / 2) : this.levelup.currentLevel) <
|
||||
item.system.level
|
||||
) {
|
||||
ui.notifications.error(
|
||||
game.i18n.localize('DAGGERHEART.Application.LevelUp.notifications.error.domainCardToHighLevel')
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<div class="preview-empty-container">
|
||||
<div class="preview-empty-inner-container">
|
||||
<i class="preview-add-icon fa-solid fa-plus"></i>
|
||||
<div class="preview-empty-subtext">{{this.emptySubtext}}</div>
|
||||
<div class="preview-empty-subtext">{{> @partial-block }}</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,11 @@
|
|||
|
||||
<div class="levelup-card-selection domain-cards">
|
||||
{{#each this.domainCards}}
|
||||
{{> "systems/daggerheart/templates/components/card-preview.hbs" this }}
|
||||
{{#> "systems/daggerheart/templates/components/card-preview.hbs" this }}
|
||||
{{#each this.emptySubtexts}}
|
||||
<div>{{this}}</div>
|
||||
{{/each}}
|
||||
{{/"systems/daggerheart/templates/components/card-preview.hbs"}}
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -74,7 +78,9 @@
|
|||
<h3>{{localize "DAGGERHEART.Application.LevelUp.summary.multiclass"}}</h3>
|
||||
|
||||
<div class="levelup-card-selection multiclass-cards" data-path="{{this.multiclass.path}}" data-tier="{{this.multiclass.tier}}" data-min-cost="{{this.multiclass.minCost}}" data-amount="{{this.multiclass.amount}}" data-value="{{this.multiclass.value}}" data-type="{{this.multiclass.type}}">
|
||||
{{> "systems/daggerheart/templates/components/card-preview.hbs" this.multiclass }}
|
||||
{{#> "systems/daggerheart/templates/components/card-preview.hbs" this.multiclass }}
|
||||
{{this.multiclass.emptySubtext}}
|
||||
{{/"systems/daggerheart/templates/components/card-preview.hbs"}}
|
||||
<div class="levelup-domains-selection-container">
|
||||
{{#each this.multiclass.domains}}
|
||||
<div class="levelup-domain-selection-container {{#if this.disabled}}disabled{{/if}}" {{#if (not this.disabled)}}data-action="selectDomain" data-uuid="{{../multiclass.uuid}}" data-domain="{{this.id}}" data-path="{{../multiclass.path}}" {{/if}}>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue