This commit is contained in:
WBHarry 2025-07-17 13:33:57 +02:00
parent ad9e0aa558
commit 29ce21d606
11 changed files with 198 additions and 65 deletions

View file

@ -559,6 +559,11 @@
"description": "You reduce incoming magic damage by your Armor Score before applying it to your damage thresholds."
}
},
"BeastformType": {
"normal": "Normal",
"evolved": "Evolved",
"hybrid": "Hybrid"
},
"Burden": {
"oneHanded": "One-Handed",
"twoHanded": "Two-Handed"
@ -1194,7 +1199,8 @@
"recovery": "Recovery",
"setup": "Setup",
"equipment": "Equipment",
"attachments": "Attachments"
"attachments": "Attachments",
"advanced": "Advanced"
},
"Tiers": {
"singular": "Tier",
@ -1290,6 +1296,7 @@
},
"Beastform": {
"FIELDS": {
"beastformType": { "label": "Beastform Type" },
"tier": { "label": "Tier" },
"examples": { "label": "Examples" },
"advantageOn": { "label": "Gain Advantage On" },
@ -1299,6 +1306,14 @@
"placeholder": "Using character dimensions",
"height": { "label": "Height" },
"width": { "label": "Width" }
},
"evolved": {
"maximumTier": { "label": "Maximum Tier" }
},
"hybrid": {
"beastformOptions": { "label": "Nr Beastforms" },
"advantages": { "label": "Nr Advantages" },
"features": { "label": "Nr Features" }
}
},
"dialogTitle": "Beastform Selection",

View file

@ -37,6 +37,12 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
}
};
// _attachPartListeners(partId, htmlElement, options) {
// super._attachPartListeners(partId, htmlElement, options);
// htmlElement.querySelector('');
// }
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
@ -60,8 +66,15 @@ export default class BeastformDialog extends HandlebarsApplicationMixin(Applicat
this.render();
}
static selectBeastform(_, target) {
static async selectBeastform(_, target) {
this.selected = this.selected === target.dataset.uuid ? null : target.dataset.uuid;
const beastform = this.selected ? await foundry.utils.fromUuid(this.selected) : null;
if (beastform && beastform.system.beastformType !== CONFIG.DH.ITEM.beastformTypes.normal.id) {
this.element.classList.add('expanded');
} else {
this.element.classList.remove('expanded');
}
this.render();
}

View file

@ -15,6 +15,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-features.hbs',
scrollable: ['.features']
},
advanced: { template: 'systems/daggerheart/templates/sheets/items/beastform/advanced.hbs' },
effects: {
template: 'systems/daggerheart/templates/sheets/global/tabs/tab-effects.hbs',
scrollable: ['.effects']
@ -23,7 +24,7 @@ export default class BeastformSheet extends DHBaseItemSheet {
static TABS = {
primary: {
tabs: [{ id: 'settings' }, { id: 'features' }, { id: 'effects' }],
tabs: [{ id: 'settings' }, { id: 'features' }, { id: 'advanced' }, { id: 'effects' }],
initial: 'settings',
labelPrefix: 'DAGGERHEART.GENERAL.Tabs'
}
@ -33,7 +34,14 @@ export default class BeastformSheet extends DHBaseItemSheet {
async _prepareContext(_options) {
const context = await super._prepareContext(_options);
context.document = context.document.toObject();
const data = { ...context.document.toObject() };
context.document = {
...data,
system: {
...data.system,
features: this.document.system.features
}
};
context.document.effects = this.document.effects.map(effect => {
const data = effect.toObject();
data.id = effect.id;

View file

@ -1350,3 +1350,18 @@ export const itemResourceTypes = {
label: 'DAGGERHEART.CONFIG.ItemResourceType.diceValue'
}
};
export const beastformTypes = {
normal: {
id: 'normal',
label: 'DAGGERHEART.CONFIG.BeastformType.normal'
},
evolved: {
id: 'evolved',
label: 'DAGGERHEART.CONFIG.BeastformType.evolved'
},
hybrid: {
id: 'hybrid',
label: 'DAGGERHEART.CONFIG.BeastformType.hybrid'
}
};

View file

@ -19,6 +19,11 @@ export default class DHBeastform extends BaseDataItem {
const fields = foundry.data.fields;
return {
...super.defineSchema(),
beastformType: new fields.StringField({
required: true,
choices: CONFIG.DH.ITEM.beastformTypes,
initial: CONFIG.DH.ITEM.beastformTypes.normal.id
}),
tier: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.tiers,
@ -40,7 +45,25 @@ export default class DHBeastform extends BaseDataItem {
}),
examples: new fields.StringField(),
advantageOn: new fields.StringField(),
features: new ForeignDocumentUUIDArrayField({ type: 'Item' })
features: new ForeignDocumentUUIDArrayField({ type: 'Item' }),
evolved: new fields.SchemaField({
maximumTier: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.tiers,
initial: CONFIG.DH.GENERAL.tiers.tier1.id
})
}),
hybrid: new fields.SchemaField({
maximumTier: new fields.StringField({
required: true,
choices: CONFIG.DH.GENERAL.tiers,
initial: CONFIG.DH.GENERAL.tiers.tier1.id,
label: 'DAGGERHEART.ITEMS.Beastform.FIELDS.evolved.maximumTier.label'
}),
beastformOptions: new fields.NumberField({ required: true, integer: true, initial: 2, min: 2 }),
advantages: new fields.NumberField({ required: true, integer: true, initial: 2, min: 2 }),
features: new fields.NumberField({ required: true, integer: true, initial: 2, min: 2 })
})
};
}

View file

@ -1,46 +0,0 @@
@import '../../utils/colors.less';
.application.daggerheart.dh-style.views.beastform-selection {
.beastforms-container {
display: flex;
flex-direction: column;
gap: 4px;
.beastforms-tier {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 4px;
.beastform-container {
position: relative;
display: flex;
justify-content: center;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
cursor: pointer;
&.inactive {
opacity: 0.4;
}
img {
width: 100%;
border-radius: 6px;
}
.beastform-title {
position: absolute;
top: 4px;
display: flex;
flex-wrap: wrap;
font-size: 16px;
margin: 0 4px;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
color: light-dark(@beige, @dark);
background-image: url('../assets/parchments/dh-parchment-light.png');
}
}
}
}
}

View file

@ -10,6 +10,80 @@
}, {});
.application.daggerheart.dh-style.views.beastform-selection {
transition: all 0.3s ease;
&.expanded {
width: 900px !important;
.beastforms-outer-container .advanced-container {
max-width: 300px;
}
}
.beastforms-outer-container {
display: flex;
overflow: hidden;
.beastforms-container {
display: flex;
flex-direction: column;
gap: 4px;
max-width: 566px;
.beastforms-tier {
display: grid;
grid-template-columns: 1fr 1fr 1fr 1fr;
gap: 4px;
.beastform-container {
position: relative;
display: flex;
justify-content: center;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
cursor: pointer;
&.inactive {
opacity: 0.4;
}
img {
width: 100%;
border-radius: 6px;
}
.beastform-title {
position: absolute;
top: 4px;
display: flex;
flex-wrap: wrap;
font-size: 16px;
margin: 0 4px;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
color: light-dark(@dark, @beige);
background-image: url('../assets/parchments/dh-parchment-light.png');
}
}
}
}
.advanced-container {
max-width: 0;
transition: all 0.3s ease;
}
}
// .advanced-container {
// position: absolute;
// top: 0;
// right: -300px;
// height: 100%;
// width: 300px;
// border: 1px solid @golden;
// background: url("../systems/daggerheart/assets/parchments/dh-parchment-light.png") no-repeat center;
// }
footer {
margin-top: 8px;
display: flex;

View file

@ -12,7 +12,6 @@
@import './downtime/downtime-container.less';
@import './beastform/beastform-container.less';
@import './beastform/sheet.less';
@import './character-creation/creation-action-footer.less';

View file

@ -1,17 +1,23 @@
<div>
<div class="beastforms-container">
{{#each beastformTiers as |tier tierKey|}}
<fieldset class="beastforms-tier">
<legend>{{tier.label}}</legend>
{{#each tier.values as |form uuid|}}
<div data-action="selectBeastform" data-uuid="{{uuid}}" data-tooltip="{{concat "#item#" uuid}}" class="beastform-container {{#if (and @root.canSubmit (not form.selected))}}inactive{{/if}}">
<img src="{{form.value.img}}" />
<div class="beastform-title">{{form.value.name}}</div>
</div>
{{/each}}
</fieldset>
{{/each}}
<div class="beastforms-outer-container">
<div class="beastforms-container">
{{#each beastformTiers as |tier tierKey|}}
<fieldset class="beastforms-tier">
<legend>{{tier.label}}</legend>
{{#each tier.values as |form uuid|}}
<div data-action="selectBeastform" data-uuid="{{uuid}}" data-tooltip="{{concat "#item#" uuid}}" class="beastform-container {{#if (and @root.canSubmit (not form.selected))}}inactive{{/if}}">
<img src="{{form.value.img}}" />
<div class="beastform-title">{{form.value.name}}</div>
</div>
{{/each}}
</fieldset>
{{/each}}
</div>
<div class="advanced-container">
Test
</div>
</div>
<footer>
<button type="button" data-action="submitBeastform" {{#if (not canSubmit)}}disabled{{/if}}>{{localize "DAGGERHEART.ITEMS.Beastform.transform"}}</button>
</footer>

View file

@ -0,0 +1,27 @@
<section
class='tab {{tabs.advanced.cssClass}} {{tabs.advanced.id}}'
data-tab='{{tabs.advanced.id}}'
data-group='{{tabs.advanced.group}}'
>
{{formGroup systemFields.beastformType value=source.system.beastformType localize=true blank=false}}
{{#if (eq source.system.beastformType 'evolved')}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.CONFIG.BeastformType.evolved"}}</legend>
{{formGroup systemFields.evolved.fields.maximumTier value=source.system.evolved.maximumTier localize=true blank=false}}
</fieldset>
{{/if}}
{{#if (eq source.system.beastformType 'hybrid')}}
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.CONFIG.BeastformType.hybrid"}}</legend>
{{formGroup systemFields.hybrid.fields.maximumTier value=source.system.hybrid.maximumTier localize=true blank=false}}
<div class="nest-inputs">
{{formGroup systemFields.hybrid.fields.beastformOptions value=source.system.hybrid.beastformOptions localize=true}}
{{formGroup systemFields.hybrid.fields.advantages value=source.system.hybrid.advantages localize=true}}
{{formGroup systemFields.hybrid.fields.features value=source.system.hybrid.features localize=true}}
</div>
</fieldset>
{{/if}}
</section>

View file

@ -9,7 +9,6 @@
</div>
{{formGroup systemFields.advantageOn value=source.system.advantageOn localize=true}}
<fieldset class="two-columns even">
<legend>{{localize "DAGGERHEART.ITEMS.Beastform.tokenTitle"}}</legend>