diff --git a/module/applications/sheets/api/base-item.mjs b/module/applications/sheets/api/base-item.mjs index 5e7e8d59..e7d9b54b 100644 --- a/module/applications/sheets/api/base-item.mjs +++ b/module/applications/sheets/api/base-item.mjs @@ -35,7 +35,7 @@ export default class DHBaseItemSheet extends DHApplicationMixin(ItemSheetV2) { /** @inheritdoc */ static TABS = { primary: { - tabs: [{ id: 'description' }, { id: 'actions' }, { id: 'settings' }], + tabs: [{ id: 'description' }, { id: 'settings' }, { id: 'actions' }], initial: 'description', labelPrefix: 'DAGGERHEART.GENERAL.Tabs' } diff --git a/module/applications/sheets/items/weapon.mjs b/module/applications/sheets/items/weapon.mjs index fdce55fc..2f1e8111 100644 --- a/module/applications/sheets/items/weapon.mjs +++ b/module/applications/sheets/items/weapon.mjs @@ -31,13 +31,15 @@ export default class WeaponSheet extends DHBaseItemSheet { /**@inheritdoc */ async _preparePartContext(partId, context) { super._preparePartContext(partId, context); - + console.log(this) switch (partId) { case 'settings': context.features = this.document.system.features.map(x => x.value); + context.systemFields.attack.fields = this.document.system.attack.schema.fields; + // context.isNPC = true; break; } - + console.log(context) return context; } diff --git a/module/data/item/weapon.mjs b/module/data/item/weapon.mjs index e6cfcbf0..47ca1462 100644 --- a/module/data/item/weapon.mjs +++ b/module/data/item/weapon.mjs @@ -49,6 +49,30 @@ export default class DHWeapon extends BaseDataItem { actionIds: new fields.ArrayField(new fields.StringField({ required: true })) }) ), + attack: new ActionField({ + initial: { + name: 'Attack', + img: 'icons/skills/melee/blood-slash-foam-red.webp', + _id: foundry.utils.randomID(), + systemPath: 'attack', + type: 'attack', + range: 'melee', + target: { + type: 'any', + amount: 1 + }, + roll: { + type: 'weapon' + }, + damage: { + parts: [ + { + multiplier: 'prof' + } + ] + } + } + }), actions: new fields.ArrayField(new ActionField()) }; } diff --git a/styles/daggerheart.css b/styles/daggerheart.css index 8fd6142e..f15583d2 100755 --- a/styles/daggerheart.css +++ b/styles/daggerheart.css @@ -4069,10 +4069,11 @@ body.theme-light.application.daggerheart .character-sidebar-sheet .experience-va .application.sheet.daggerheart.actor.dh-style.character .window-content { display: grid; grid-template-columns: 275px 1fr; - grid-template-rows: 283px 1fr; + grid-template-rows: auto 1fr; gap: 15px 0; height: 100%; width: 100%; + overflow: auto; } .application.sheet.daggerheart.actor.dh-style.character .window-content .character-sidebar-sheet { grid-row: 1 / span 2; @@ -4313,7 +4314,7 @@ body.theme-light.application.daggerheart .character-sidebar-sheet .experience-va .application.sheet.daggerheart.actor.dh-style.adversary .window-content { display: grid; grid-template-columns: 275px 1fr; - grid-template-rows: 283px 1fr; + grid-template-rows: auto 1fr; gap: 15px 0; height: 100%; width: 100%; diff --git a/templates/actionTypes/damage.hbs b/templates/actionTypes/damage.hbs index 26964a4a..59519e6d 100644 --- a/templates/actionTypes/damage.hbs +++ b/templates/actionTypes/damage.hbs @@ -4,20 +4,20 @@ Damage {{#unless (eq path 'system.attack.')}}{{/unless}} - {{#unless @root.isNPC}} + {{#unless (or @root.isNPC path)}} {{#if @root.hasBaseDamage}} {{formField @root.fields.damage.fields.includeBase value=@root.source.damage.includeBase label="Include Item Damage" name="damage.includeBase" classes="checkbox" }} {{/if}} {{/unless}} {{#each source.parts as |dmg index|}} - {{#if @root.isNPC}} + {{#if (or @root.isNPC ../path)}} {{formField ../fields.value.fields.custom.fields.enabled value=dmg.value.custom.enabled name=(concat ../path "damage.parts." index ".value.custom.enabled") classes="checkbox"}} {{#if dmg.value.custom.enabled}} {{formField ../fields.value.fields.custom.fields.formula value=dmg.value.custom.formula name=(concat ../path "damage.parts." index ".value.custom.formula") localize=true}} {{else}}
- {{formField ../fields.value.fields.flatMultiplier value=dmg.value.flatMultiplier name=(concat ../path "damage.parts." index ".value.flatMultiplier") label="Multiplier" classes="inline-child" }} + {{#if @root.isNPC}}{{formField ../fields.value.fields.flatMultiplier value=dmg.value.flatMultiplier name=(concat ../path "damage.parts." index ".value.flatMultiplier") label="Multiplier" classes="inline-child" }}{{/if}} {{formField ../fields.value.fields.dice value=dmg.value.dice name=(concat ../path "damage.parts." index ".value.dice") classes="inline-child"}} {{formField ../fields.value.fields.bonus value=dmg.value.bonus name=(concat ../path "damage.parts." index ".value.bonus") localize=true classes="inline-child"}}
diff --git a/templates/actionTypes/part/damage-part.hbs b/templates/actionTypes/part/damage-part.hbs new file mode 100644 index 00000000..e69de29b diff --git a/templates/sheets/items/weapon/settings.hbs b/templates/sheets/items/weapon/settings.hbs index 5fe0b9bd..6ea96dc7 100644 --- a/templates/sheets/items/weapon/settings.hbs +++ b/templates/sheets/items/weapon/settings.hbs @@ -31,4 +31,22 @@ {{localize "TYPES.Item.feature"}} +
+ {{localize "DAGGERHEART.GENERAL.attack"}} + {{formField systemFields.attack.fields.roll.fields.trait value=document.system.attack.roll.trait name="system.attack.roll.trait" label="DAGGERHEART.GENERAL.Trait.single" localize=true }} + {{formField systemFields.attack.fields.range value=document.system.attack.range label="Range" name="system.attack.range" localize=true}} + {{#if systemFields.attack.fields.target.fields}} + {{ formField systemFields.attack.fields.target.fields.type value=document.system.attack.target.type label="Target" name="system.attack.target.type" localize=true }} + {{#if (and document.system.attack.target.type (not (eq document.system.attack.target.type 'self')))}} + {{ formField systemFields.attack.fields.target.fields.amount value=document.system.attack.target.amount label="Amount" name="system.attack.target.amount" }} + {{/if}} + {{/if}} +
+ {{!--
+ {{localize "DAGGERHEART.GENERAL.attack"}} + {{formField systemFields.attack.fields.damage.dice value=source.dice name=(concat "damage.parts." realIndex "." target ".dice")}} + {{formField systemFields.attack.fields.damage.bonus value=source.bonus name=(concat "damage.parts." realIndex "." target ".bonus") localize=true}} + {{formField ../../fields.type value=dmg.type name=(concat "damage.parts." realIndex ".type") localize=true}} +
--}} + {{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields.parts.element.fields source=document.system.attack.damage path="system.attack."}} \ No newline at end of file