<div class="les-oublies-roll-dialog les-oublies-roll-dialog--attack">
  <div class="sheet-grid sheet-grid-2 attack-dialog-grid">
    <section class="sheet-card">
      <h2>{{attackTitle}}</h2>
      <div class="dialog-field-grid dialog-field-grid--attack">
        <div class="field-row field-row--wide">
          <label>Arme</label>
          <input type="text" value="{{#if weapon}}{{weapon.name}}{{else}}Arme improvisée{{/if}}" disabled />
        </div>
        <div class="field-row">
          <label>Compétence</label>
          <select name="attackerSkill">
            {{#each attackSkills as |skill|}}
              <option value="{{skill.value}}" {{#if (eq skill.value @root.values.attackerSkill)}}selected{{/if}}>{{skill.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Circonstance</label>
          <select name="difficultyPreset">
            <option value="0">Aucune (0)</option>
            {{#each difficultyOptions as |entry|}}
              <option value="{{entry.value}}">{{entry.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Ajustement libre</label>
          <input name="customDifficulty" type="number" value="{{values.customDifficulty}}" />
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.rolls.rollMode"}}</label>
          <select name="attackerRollMode">
            {{#each rollModes as |mode|}}
              <option value="{{mode.value}}" {{#if (eq mode.value @root.values.attackerRollMode)}}selected{{/if}}>{{mode.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.rolls.extraDie"}}</label>
          <select name="attackerExtraDie">
            {{#each extraDieModes as |mode|}}
              <option value="{{mode.value}}" {{#if (eq mode.value @root.values.attackerExtraDie)}}selected{{/if}}>{{mode.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Prime</label>
          <select name="primeId">
            {{#each primeOptions as |option|}}
              <option value="{{option.value}}" {{#if (eq option.value @root.values.primeId)}}selected{{/if}}>{{option.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Pénalité</label>
          <select name="penaltyId">
            {{#each penaltyOptions as |option|}}
              <option value="{{option.value}}" {{#if (eq option.value @root.values.penaltyId)}}selected{{/if}}>{{option.label}}</option>
            {{/each}}
          </select>
        </div>
      </div>
      <p class="help-text">{{localize "LESOUBLIES.rolls.resourceState"}} : Songes {{attackerResources.songesPoints}} / {{attackerResources.songesValue}} · Cauchemar {{attackerResources.cauchemarPoints}} / {{attackerResources.cauchemarValue}}</p>
    </section>

    <section class="sheet-card">
      <h2>{{localize "LESOUBLIES.rolls.defender"}}</h2>
      <p class="help-text target-status" data-target-status data-state="{{targetStatus.state}}">{{targetStatus.message}}</p>
      <div class="dialog-field-grid dialog-field-grid--defender">
        <div class="field-row field-row--wide">
          <label>Adversaire</label>
          <select name="defenderActorId">
            {{#each targetOptions as |entry|}}
              <option value="{{entry.value}}" {{#if (eq entry.value @root.values.defenderActorId)}}selected{{/if}}>{{entry.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row field-row--wide">
          <label>Cible</label>
          <input name="defenderLabel" type="text" value="{{values.defenderLabel}}" />
        </div>
        <div class="field-row">
          <label>Réaction</label>
          <select name="defenderSkill">
            {{#each reactionSkills as |skill|}}
              <option value="{{skill.value}}" {{#if (eq skill.value @root.values.defenderSkill)}}selected{{/if}}>{{skill.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Score défense</label>
          <input name="defenderScore" type="number" value="{{values.defenderScore}}" {{#if targetActor}}disabled{{/if}} />
        </div>
        <div class="field-row">
          <label>Difficulté défense</label>
          <input name="defenderDifficulty" type="number" value="{{values.defenderDifficulty}}" />
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.rolls.rollMode"}}</label>
          <select name="defenderRollMode">
            {{#each rollModes as |mode|}}
              <option value="{{mode.value}}" {{#if (eq mode.value @root.values.defenderRollMode)}}selected{{/if}}>{{mode.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.rolls.extraDie"}}</label>
          <select name="defenderExtraDie">
            {{#each extraDieModes as |mode|}}
              <option value="{{mode.value}}" {{#if (eq mode.value @root.values.defenderExtraDie)}}selected{{/if}}>{{mode.label}}</option>
            {{/each}}
          </select>
        </div>
        <div class="field-row">
          <label>Protection</label>
          <input name="targetProtection" type="number" value="{{values.targetProtection}}" />
        </div>
        <div class="field-row">
          <label>Dégâts de base</label>
          <input name="baseDamage" type="number" value="{{values.baseDamage}}" />
        </div>
        <div class="field-row field-row--wide">
          <label>Libellé dégâts</label>
          <input name="baseDamageLabel" type="text" value="{{values.baseDamageLabel}}" />
        </div>
        <div class="field-row field-row--wide field-row--toggle">
          <label>Appliquer à la cible</label>
          <input name="applyToTarget" type="checkbox" {{checked values.applyToTarget}} {{#unless targetActor}}disabled{{/unless}} />
        </div>
        <div class="field-row field-row--wide">
          <label>Notes</label>
          <input name="notes" type="text" value="{{values.notes}}" />
        </div>
      </div>
      <div class="dialog-field-grid dialog-field-grid--resources">
        <div class="field-row">
          <label>{{localize "LESOUBLIES.ui.songes"}}</label>
          <input name="defenderSongesValue" type="number" value="{{defenderResources.songesValue}}" {{#if targetActor}}disabled{{/if}} />
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.labels.pointsSonges"}}</label>
          <input name="defenderSongesPoints" type="number" value="{{defenderResources.songesPoints}}" {{#if targetActor}}disabled{{/if}} />
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.ui.cauchemar"}}</label>
          <input name="defenderCauchemarValue" type="number" value="{{defenderResources.cauchemarValue}}" {{#if targetActor}}disabled{{/if}} />
        </div>
        <div class="field-row">
          <label>{{localize "LESOUBLIES.labels.pointsCauchemar"}}</label>
          <input name="defenderCauchemarPoints" type="number" value="{{defenderResources.cauchemarPoints}}" {{#if targetActor}}disabled{{/if}} />
        </div>
      </div>
    </section>
  </div>
</div>
