This commit is contained in:
Dapoolp 2025-07-07 00:52:26 +02:00
parent ee4a5d17a6
commit e311829b0c
7 changed files with 53 additions and 8 deletions

View file

@ -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'
}

View file

@ -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;
}

View file

@ -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())
};
}

View file

@ -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%;

View file

@ -4,20 +4,20 @@
Damage
{{#unless (eq path 'system.attack.')}}<a><i class="fa-solid fa-plus icon-button" data-action="addDamage"></i></a>{{/unless}}
</legend>
{{#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"}}
<input type="hidden" name="{{../path}}damage.parts.{{index}}.value.multiplier" value="{{dmg.value.multiplier}}">
{{#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}}
<div class="nest-inputs">
{{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"}}
</div>

View file

@ -31,4 +31,22 @@
<span>{{localize "TYPES.Item.feature"}}</span>
<input type="text" class="features-input" value="{{features}}" />
</fieldset>
<fieldset class="two-columns">
<legend>{{localize "DAGGERHEART.GENERAL.attack"}}</legend>
{{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}}
</fieldset>
{{!-- <fieldset class="two-columns">
<legend>{{localize "DAGGERHEART.GENERAL.attack"}}</legend>
{{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}}
</fieldset> --}}
{{> 'systems/daggerheart/templates/actionTypes/damage.hbs' fields=systemFields.attack.fields.damage.fields.parts.element.fields source=document.system.attack.damage path="system.attack."}}
</section>