Add custom formula to weapon base attack

This commit is contained in:
Dapoolp 2025-08-15 20:54:33 +02:00
parent b3c0344b91
commit 7ffcfe8a1a
3 changed files with 25 additions and 10 deletions

View file

@ -64,6 +64,14 @@
"exactHint": "The Character's Tier is used if empty", "exactHint": "The Character's Tier is used if empty",
"label": "Beastform" "label": "Beastform"
}, },
"damage": {
"multiplier": "Multiplier",
"flatMultiplier": "Flat Multiplier"
},
"general": {
"customFormula": "Custom Formula",
"formula": "Formula"
},
"displayInChat": "Display in chat" "displayInChat": "Display in chat"
}, },
"RollField": { "RollField": {

View file

@ -23,14 +23,14 @@ export class DHActionDiceData extends foundry.abstract.DataModel {
multiplier: new fields.StringField({ multiplier: new fields.StringField({
choices: CONFIG.DH.GENERAL.multiplierTypes, choices: CONFIG.DH.GENERAL.multiplierTypes,
initial: 'prof', initial: 'prof',
label: 'Multiplier' label: "DAGGERHEART.ACTIONS.Config.damage.multiplier"
}), }),
flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: 'Flat Multiplier' }), flatMultiplier: new fields.NumberField({ nullable: true, initial: 1, label: "DAGGERHEART.ACTIONS.Config.damage.flatMultiplier" }),
dice: new fields.StringField({ choices: CONFIG.DH.GENERAL.diceTypes, initial: 'd6', label: 'Dice' }), dice: new fields.StringField({ choices: CONFIG.DH.GENERAL.diceTypes, initial: 'd6', label: "DAGGERHEART.GENERAL.Dice.single" }),
bonus: new fields.NumberField({ nullable: true, initial: null, label: 'Bonus' }), bonus: new fields.NumberField({ nullable: true, initial: null, label: "DAGGERHEART.GENERAL.bonus" }),
custom: new fields.SchemaField({ custom: new fields.SchemaField({
enabled: new fields.BooleanField({ label: 'Custom Formula' }), enabled: new fields.BooleanField({ label: "DAGGERHEART.ACTIONS.Config.general.customFormula" }),
formula: new FormulaField({ label: 'Formula', initial: '' }) formula: new FormulaField({ label: "DAGGERHEART.ACTIONS.Config.general.formula", initial: '' })
}) })
}; };
} }

View file

@ -21,10 +21,17 @@
{{#with systemFields.attack.fields.damage.fields.parts.element.fields as | fields | }} {{#with systemFields.attack.fields.damage.fields.parts.element.fields as | fields | }}
{{#with (lookup ../document.system.attack.damage.parts 0) as | source | }} {{#with (lookup ../document.system.attack.damage.parts 0) as | source | }}
<legend>{{localize "DAGGERHEART.GENERAL.damage"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.damage"}}</legend>
<span>{{localize "DAGGERHEART.ACTIONS.Config.general.customFormula"}}</span>
{{formInput fields.value.fields.custom.fields.enabled value=source.value.custom.enabled name="system.attack.damage.parts.0.value.custom.enabled"}}
{{#if source.value.custom.enabled}}
<span>{{localize "DAGGERHEART.ACTIONS.Config.general.formula"}}</span>
{{formInput fields.value.fields.custom.fields.formula value=source.value.custom.formula name="system.attack.damage.parts.0.value.custom.formula"}}
{{else}}
<span>{{localize "DAGGERHEART.GENERAL.Dice.single"}}</span> <span>{{localize "DAGGERHEART.GENERAL.Dice.single"}}</span>
{{formInput fields.value.fields.dice value=source.value.dice name="system.attack.damage.parts.0.value.dice"}} {{formInput fields.value.fields.dice value=source.value.dice name="system.attack.damage.parts.0.value.dice"}}
<span>{{localize "DAGGERHEART.GENERAL.bonus"}}</span> <span>{{localize "DAGGERHEART.GENERAL.bonus"}}</span>
{{formInput fields.value.fields.bonus value=source.value.bonus name="system.attack.damage.parts.0.value.bonus" localize=true}} {{formInput fields.value.fields.bonus value=source.value.bonus name="system.attack.damage.parts.0.value.bonus" localize=true}}
{{/if}}
<span>{{localize "DAGGERHEART.GENERAL.type"}}</span> <span>{{localize "DAGGERHEART.GENERAL.type"}}</span>
{{formInput fields.type value=source.type name="system.attack.damage.parts.0.type" localize=true}} {{formInput fields.type value=source.type name="system.attack.damage.parts.0.type" localize=true}}
<input type="hidden" name="system.attack.damage.parts.0.value.multiplier" value="{{source.value.multiplier}}"> <input type="hidden" name="system.attack.damage.parts.0.value.multiplier" value="{{source.value.multiplier}}">