This commit is contained in:
Dapoolp 2025-08-26 16:48:02 +02:00
parent cd7c1fb672
commit a659375157
7 changed files with 31 additions and 32 deletions

View file

@ -96,6 +96,7 @@
"attackName": "Attack Name", "attackName": "Attack Name",
"includeBase": { "label": "Include Item Damage" }, "includeBase": { "label": "Include Item Damage" },
"multiplier": "Multiplier", "multiplier": "Multiplier",
"saveHint": "Set a default Trait to enable Reaction Roll. It can be changed later in Reaction Roll Dialog.",
"resultBased": { "resultBased": {
"label": "Formula based on Hope/Fear result." "label": "Formula based on Hope/Fear result."
}, },

View file

@ -141,7 +141,7 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.roll[key] = value; this.roll[key] = value;
}); });
} }
if(rest.trait) this.config.roll.trait = rest.trait; if(rest.hasOwnProperty("trait")) this.config.roll.trait = rest.trait;
this.config.extraFormula = rest.extraFormula; this.config.extraFormula = rest.extraFormula;
this.render(); this.render();
} }
@ -160,20 +160,18 @@ export default class D20RollDialog extends HandlebarsApplicationMixin(Applicatio
this.config.experiences.indexOf(button.dataset.key) > -1 this.config.experiences.indexOf(button.dataset.key) > -1
? this.config.experiences.filter(x => x !== button.dataset.key) ? this.config.experiences.filter(x => x !== button.dataset.key)
: [...this.config.experiences, button.dataset.key]; : [...this.config.experiences, button.dataset.key];
if (this.config?.data?.parent?.type === 'character' || this.config?.data?.parent?.type === 'companion') { this.config.costs =
this.config.costs = this.config.costs.indexOf(this.config.costs.find(c => c.extKey === button.dataset.key)) > -1
this.config.costs.indexOf(this.config.costs.find(c => c.extKey === button.dataset.key)) > -1 ? this.config.costs.filter(x => x.extKey !== button.dataset.key)
? this.config.costs.filter(x => x.extKey !== button.dataset.key) : [
: [ ...this.config.costs,
...this.config.costs, {
{ extKey: button.dataset.key,
extKey: button.dataset.key, key: this.config?.data?.parent?.isNPC ? 'fear' : 'hope',
key: 'hope', value: 1,
value: 1, name: this.config.data?.experiences?.[button.dataset.key]?.name
name: this.config.data?.experiences?.[button.dataset.key]?.name }
} ];
];
}
this.render(); this.render();
} }

View file

@ -43,6 +43,9 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
/** /**
* Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property. * Create a Map containing each Action step based on fields define in schema. Ordered by Fields order property.
*
* Each step can be called individually as long as needed config is provided.
* Ex: <action>.workflow.get("damage").execute(config)
* @returns {Map} * @returns {Map}
*/ */
defineWorkflow() { defineWorkflow() {
@ -254,7 +257,8 @@ export default class DHBaseAction extends ActionMixin(foundry.abstract.DataModel
} }
/** /**
* * Consume Action configured resources & uses.
* That method is only used when we want those resources to be consumed outside of the use method workflow.
* @param {object} config Object that contains workflow datas. Usually made from Action Fields prepareConfig methods. * @param {object} config Object that contains workflow datas. Usually made from Action Fields prepareConfig methods.
* @param {boolean} successCost * @param {boolean} successCost
*/ */

View file

@ -624,6 +624,7 @@
.form-group { .form-group {
justify-content: end; justify-content: end;
flex-wrap: nowrap;
} }
.hint { .hint {

View file

@ -18,7 +18,7 @@
color: var(--color-form-hint); color: var(--color-form-hint);
} }
&:hover { .form-group:hover {
.hint { .hint {
color: var(--color-form-hint-hover); color: var(--color-form-hint-hover);
} }

View file

@ -1,6 +1,9 @@
<fieldset class="flex"> <fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</legend> <legend>{{localize "DAGGERHEART.GENERAL.Roll.reaction"}}</legend>
{{formField fields.trait label="Trait" name="save.trait" value=source.trait localize=true}} <p class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.saveHint"}}</p>
{{formField fields.difficulty label="Difficulty" name="save.difficulty" value=source.difficulty disabled=(not source.trait) placeholder=@root.baseSaveDifficulty}} <div class="nest-inputs">
{{formField fields.damageMod label="Damage on Save" name="save.damageMod" value=source.damageMod localize=true disabled=(not source.trait)}} {{formField fields.trait label="Trait" name="save.trait" value=source.trait localize=true}}
{{formField fields.difficulty label="Difficulty" name="save.difficulty" value=source.difficulty disabled=(not source.trait) placeholder=@root.baseSaveDifficulty}}
{{formField fields.damageMod label="Damage on Save" name="save.damageMod" value=source.damageMod localize=true disabled=(not source.trait)}}
</div>
</fieldset> </fieldset>

View file

@ -75,16 +75,8 @@
{{#each experiences}} {{#each experiences}}
{{#if name}} {{#if name}}
<div class="experience-chip {{#if (includes ../selectedExperiences id)}}selected{{/if}}" data-action="selectExperience" data-key="{{id}}" data-tooltip="{{this.description}}"> <div class="experience-chip {{#if (includes ../selectedExperiences id)}}selected{{/if}}" data-action="selectExperience" data-key="{{id}}" data-tooltip="{{this.description}}">
{{#if (includes ../selectedExperiences id)}} <span><i class="{{ifThen (includes ../selectedExperiences id) "fa-solid" "fa-regular"}} fa-circle"></i></span>
<span><i class="fa-solid fa-circle"></i></span> <span class="label">{{name}} +{{value}}</span>
{{else}}
<span><i class="fa-regular fa-circle"></i></span>
{{/if}}
{{#if (eq @root.rollType 'D20Roll')}}
<span class="label">{{name}} +{{modifier}}</span>
{{else}}
<span class="label">{{name}} +{{value}}</span>
{{/if}}
</div> </div>
{{/if}} {{/if}}
{{/each}} {{/each}}
@ -129,7 +121,7 @@
{{#if abilities}} {{#if abilities}}
<span>{{localize "DAGGERHEART.GENERAL.traitModifier"}}</span> <span>{{localize "DAGGERHEART.GENERAL.traitModifier"}}</span>
<select name="trait"> <select name="trait">
{{selectOptions abilities selected=@root.rollConfig.roll.trait valueAttr="id" labelAttr="label" localize=true}} {{selectOptions abilities selected=@root.rollConfig.roll.trait valueAttr="id" labelAttr="label" blank="" localize=true}}
</select> </select>
{{/if}} {{/if}}
{{/unless}} {{/unless}}