Added effects to domainCards

This commit is contained in:
WBHarry 2025-06-25 17:40:33 +02:00
parent d9c003b64b
commit edbb32ccc0
8 changed files with 68 additions and 13 deletions

View file

@ -4,20 +4,56 @@ const { ItemSheetV2 } = foundry.applications.sheets;
export default class DomainCardSheet extends DHItemSheetV2(ItemSheetV2) {
static DEFAULT_OPTIONS = {
classes: ['domain-card'],
position: { width: 450, height: 700 }
position: { width: 450, height: 700 },
actions: {
addEffect: this.addEffect,
editEffect: this.editEffect,
removeEffect: this.removeEffect
}
};
static PARTS = {
header: { template: 'systems/daggerheart/templates/sheets/items/domainCard/header.hbs' },
tabs: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-navigation.hbs' },
description: { template: 'systems/daggerheart/templates/sheets/global/tabs/tab-description.hbs' },
settings: {
template: 'systems/daggerheart/templates/sheets/items/domainCard/settings.hbs',
scrollable: ['.settings']
},
actions: {
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-actions.hbs',
scrollable: ['.actions']
},
settings: {
template: 'systems/daggerheart/templates/sheets/items/domainCard/settings.hbs',
scrollable: ['.settings']
effects: {
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
scrollable: ['.effects']
}
};
static TABS = {
...super.TABS,
effects: {
active: false,
cssClass: '',
group: 'primary',
id: 'effects',
icon: null,
label: 'DAGGERHEART.Sheets.Feature.Tabs.Effects'
}
};
static async addEffect() {
await this.document.createEmbeddedDocuments('ActiveEffect', [
{ name: game.i18n.localize('DAGGERHEART.Feature.NewEffect') }
]);
}
static async editEffect(_, target) {
const effect = this.document.effects.get(target.dataset.effect);
effect.sheet.render(true);
}
static async removeEffect(_, target) {
await this.document.effects.get(target.dataset.effect).delete();
}
}

View file

@ -16,10 +16,18 @@ export default class DHDomainCard extends BaseDataItem {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
domain: new fields.StringField({ choices: SYSTEM.DOMAIN.domains, required: true, blank: true }),
domain: new fields.StringField({
choices: SYSTEM.DOMAIN.domains,
required: true,
initial: SYSTEM.DOMAIN.domains.arcana.id
}),
level: new fields.NumberField({ initial: 1, integer: true }),
recallCost: new fields.NumberField({ initial: 0, integer: true }),
type: new fields.StringField({ choices: SYSTEM.DOMAIN.cardTypes, required: true, blank: true }),
type: new fields.StringField({
choices: SYSTEM.DOMAIN.cardTypes,
required: true,
initial: SYSTEM.DOMAIN.cardTypes.ability.id
}),
foundation: new fields.BooleanField({ initial: false }),
inVault: new fields.BooleanField({ initial: false }),
actions: new fields.ArrayField(new ActionField())

View file

@ -4,6 +4,10 @@ export default class DhActiveEffect extends ActiveEffect {
return !this.parent.system.equipped;
}
if (this.parent.type === 'domainCard') {
return this.parent.system.inVault;
}
return super.isSuppressed;
}

View file

@ -4071,6 +4071,9 @@ div.daggerheart.views.multiclass {
gap: 10px;
grid-template-columns: 1fr 1.5fr 1.5fr;
}
.application.sheet.daggerheart.dh-style.class .tab.settings .fieldsets-section .drop-section {
width: 100%;
}
.application.sheet.daggerheart.dh-style.class .tab.settings .list-items {
margin-bottom: 10px;
width: 100%;

View file

@ -7,6 +7,10 @@
display: grid;
gap: 10px;
grid-template-columns: 1fr 1.5fr 1.5fr;
.drop-section {
width: 100%;
}
}
.list-items {

View file

@ -6,12 +6,12 @@
<div class='status-value'>
<p><input class="bar-input" name="system.resources.hitPoints.value" value="{{document.system.resources.hitPoints.value}}" type="number"></p>
<p>/</p>
<p class="bar-label">{{document.system.resources.hitPoints.max}}</p>
<p class="bar-label">{{document.system.resources.hitPoints.maxTotal}}</p>
</div>
<progress
class='progress-bar'
value='{{document.system.resources.hitPoints.value}}'
max='{{document.system.resources.hitPoints.max}}'
max='{{document.system.resources.hitPoints.maxTotal}}'
></progress>
<div class="status-label">
<h4>Health</h4>
@ -22,12 +22,12 @@
<div class='status-value'>
<p><input class="bar-input" name="system.resources.stress.value" value="{{document.system.resources.stress.value}}" type="number"></p>
<p>/</p>
<p class="bar-label">{{document.system.resources.stress.max}}</p>
<p class="bar-label">{{document.system.resources.stress.maxTotal}}</p>
</div>
<progress
class='progress-bar stress-color'
value='{{document.system.resources.stress.value}}'
max='{{document.system.resources.stress.max}}'
max='{{document.system.resources.stress.maxTotal}}'
></progress>
<div class="status-label">
<h4>Stress</h4>

View file

@ -7,11 +7,11 @@
<legend>{{localize tabs.settings.label}}</legend>
<span>{{localize "DAGGERHEART.Sheets.DomainCard.Type"}}</span>
{{formField systemFields.type value=source.system.type localize=true blank=""}}
{{formField systemFields.type value=source.system.type localize=true}}
<span>{{localize "DAGGERHEART.Sheets.DomainCard.Foundation"}}</span>
{{formField systemFields.foundation value=source.system.foundation }}
<span>{{localize "DAGGERHEART.Sheets.DomainCard.Domain"}}</span>
{{formField systemFields.domain value=source.system.domain localize=true blank=""}}
{{formField systemFields.domain value=source.system.domain localize=true}}
<span>{{localize "DAGGERHEART.Sheets.DomainCard.Level"}}</span>
{{formField systemFields.level value=source.system.level data-dtype="Number"}}
<span>{{localize "DAGGERHEART.Sheets.DomainCard.RecallCost"}}</span>

View file

@ -4,7 +4,7 @@
<h1 class='item-name'><input type='text' name='name' value='{{source.name}}' /></h1>
<div class='item-description'>
<h3>{{localize 'TYPES.Item.subclass'}}</h3>
<h3>{{localize (concat 'DAGGERHEART.Abilities.' source.system.spellcastingTrait '.name')}}</h3>
{{#if source.system.spellcastingTrait}}<h3>{{localize (concat 'DAGGERHEART.Abilities.' source.system.spellcastingTrait '.name')}}</h3>{{/if}}
</div>
</div>
</header>