diff --git a/lang/en.json b/lang/en.json index 75f2b886..f2cbd1d4 100755 --- a/lang/en.json +++ b/lang/en.json @@ -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", diff --git a/module/applications/dialogs/beastformDialog.mjs b/module/applications/dialogs/beastformDialog.mjs index 367311b0..c7429e70 100644 --- a/module/applications/dialogs/beastformDialog.mjs +++ b/module/applications/dialogs/beastformDialog.mjs @@ -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(); } diff --git a/module/applications/sheets/items/beastform.mjs b/module/applications/sheets/items/beastform.mjs index 194f3ab1..17df8568 100644 --- a/module/applications/sheets/items/beastform.mjs +++ b/module/applications/sheets/items/beastform.mjs @@ -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; diff --git a/module/config/itemConfig.mjs b/module/config/itemConfig.mjs index ede5ef08..bd19f0bf 100644 --- a/module/config/itemConfig.mjs +++ b/module/config/itemConfig.mjs @@ -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' + } +}; diff --git a/module/data/item/beastform.mjs b/module/data/item/beastform.mjs index b7ea5cb9..d6f69346 100644 --- a/module/data/item/beastform.mjs +++ b/module/data/item/beastform.mjs @@ -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 }) + }) }; } diff --git a/styles/less/dialog/beastform/beastform-container.less b/styles/less/dialog/beastform/beastform-container.less deleted file mode 100644 index bf0d0cae..00000000 --- a/styles/less/dialog/beastform/beastform-container.less +++ /dev/null @@ -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'); - } - } - } - } -} diff --git a/styles/less/dialog/beastform/sheet.less b/styles/less/dialog/beastform/sheet.less index bd757b87..6d8cba9e 100644 --- a/styles/less/dialog/beastform/sheet.less +++ b/styles/less/dialog/beastform/sheet.less @@ -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; diff --git a/styles/less/dialog/index.less b/styles/less/dialog/index.less index f3e86518..66fd981d 100644 --- a/styles/less/dialog/index.less +++ b/styles/less/dialog/index.less @@ -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'; diff --git a/templates/dialogs/beastformDialog.hbs b/templates/dialogs/beastformDialog.hbs index 05f87b89..0988e4f8 100644 --- a/templates/dialogs/beastformDialog.hbs +++ b/templates/dialogs/beastformDialog.hbs @@ -1,17 +1,23 @@