Feature/517 action cost on success (#546)

* Add checkboxes

* Consume post roll logic
This commit is contained in:
Dapoulp 2025-08-03 18:45:11 +02:00 committed by GitHub
parent 90a97c7105
commit c46d676cc3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 93 additions and 18 deletions

View file

@ -4,6 +4,9 @@
<a><i class="fa-solid fa-plus icon-button" data-action="addElement"></i></a>
</legend>
{{#each source as |cost index|}}
{{#if @root.hasRoll}}
{{formField ../fields.consumeOnSuccess value=cost.consumeOnSuccess name=(concat "cost." index ".consumeOnSuccess") classes="checkbox" rootId=partId localize=true}}
{{/if}}
<div class="nest-inputs">
{{formField ../fields.scalable label="Scalable" value=cost.scalable name=(concat "cost." index ".scalable") classes="checkbox"}}
{{formField ../fields.key choices=(@root.disableOption index @root.costOptions ../source) label="Resource" value=cost.key name=(concat "cost." index ".key") localize=true blank=false}}

View file

@ -1,5 +1,8 @@
<fieldset class="one-column">
<legend>{{localize "DAGGERHEART.GENERAL.uses"}}</legend>
{{#if hasRoll}}
{{formField fields.consumeOnSuccess value=source.consumeOnSuccess name="uses.consumeOnSuccess" classes="checkbox" rootId=partId localize=true}}
{{/if}}
<div class="nest-inputs">
{{formField fields.value label="Spent" value=source.value name="uses.value" rootId=partId}}
{{formField fields.max label="Max" value=source.max name="uses.max" rootId=partId}}

View file

@ -6,9 +6,10 @@
<div class="form-group">
<div class="form-fields nest-inputs">
<input name="uses.enabled" type="checkbox"{{#if uses.enabled}} checked{{/if}}>
<label for="uses.enabled">Uses</label>
<label for="uses.enabled">Uses{{#if uses.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}{{/if}}</span></label>
</div>
</div>
<div></div>
<label class="modifier-label">{{uses.value}}/{{formulaValue uses.max @root.rollConfig.data}}</label>
</li>
{{/if}}
@ -17,11 +18,13 @@
<div class="form-group">
<div class="form-fields nest-inputs">
<input name="costs.{{index}}.enabled" type="checkbox"{{#if enabled}} checked{{/if}}>
<label>{{label}}</label>
<label>{{label}}{{#if cost.consumeOnSuccess}}<span class="hint">{{localize "DAGGERHEART.ACTIONS.Settings.consumeOnSuccess.short"}}</span>{{/if}}</label>
</div>
</div>
{{#if (and scalable (gt maxStep 1))}}
<input type="range" value="{{scale}}" min="1" max="{{maxStep}}" step="1" name="costs.{{index}}.scale">
<input type="range" value="{{scale}}" min="0" max="{{maxStep}}" step="1" name="costs.{{index}}.scale" data-tooltip="{{localize "DAGGERHEART.ACTIONS.Settings.cost.stepTooltip" step=step}}" data-tooltip-direction="UP">
{{else}}
<div></div>
{{/if}}
<label class="modifier-label">{{total}}/{{max}}</label>
</li>