<form class="skill-roll-dialog">
  <header class="roll-dialog-header">
    {{#if img}}
    <img class="actor-icon" src="{{img}}" data-edit="img" title="{{name}}" />
    {{/if}}
    <h1 class="dialog-roll-title roll-dialog-header">{{title}}</h1>
  </header>

  <div class="flexcol">
    <div class="flexrow">
      {{#if (eq attrKey "tochoose")}}
      <span class="roll-dialog-label"><strong>Attribut</strong></span>
      <select
        class="status-small-label color-class-common"
        id="attrKey"
        type="text"
        name="attrKey"
        value="attrKey"
        data-dtype="string"
      >
        {{selectOptions attributs selected=attrKey}}
      </select>
      {{else}}
      <span class="roll-dialog-label"><strong>{{attr.label}}</strong></span>
      <span class="small-label roll-dialog-label">{{attr.value}}</span>
      {{/if}}
    </div>

    {{#if nbAdversites}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong>Malus d'adversités</strong></span>
      <span class="small-label roll-dialog-label">- {{nbAdversites}}</span>
    </div>
    {{/if}} {{#if competence}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong>{{competence.name}}</strong></span>
      <span class="small-label roll-dialog-label"><strong>{{competence.system.niveau}}</strong></span>
    </div>
    {{#if maitrises}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong>Maîtrise</strong></span>
      <select
        class="status-small-label color-class-common"
        id="select-maitrise"
        type="text"
        name="select-maitrise"
        value="maitriseId"
        data-dtype="string"
      >
        {{selectOptions maitrises selected=maitriseId valueAttr="key"
        nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    {{/if}} {{else}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong>Second Attribut</strong></span>
      <select
        class="status-small-label color-class-common"
        id="attrKey2"
        type="text"
        name="attrKey2"
        value="attrKey2"
        data-dtype="string"
      >
        {{#select attrKey2}}
        <option value="none">Aucun</option>
        {{#each attributs as |attrLabel attrKey|}}
        <option value="{{attrKey}}">{{attrLabel}}</option>
        {{/each}} {{/select}}
      </select>
    </div>
    {{/if}} {{#if (count talents)}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong></strong>Talents</strong></span>
      <select
        class="flex1"
        name="competence-talents"
        id="competence-talents"
        data-type="String"
        multiple
      >
        {{#each talents as |talent key|}}
        <option value="{{talent._id}}">{{talent.name}}</option>
        {{/each}}
      </select>
    </div>
    {{/if}} {{#if conditionsCommunes}}
    <div class="flexrow">
      <span class="roll-dialog-label">En surplomb, défenseur au sol (+3)?</span>
      <input type="checkbox" id="defenseur-au-sol" {{checked defenseurAuSol}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur aveuglé (+10)?</span>
      <input
        type="checkbox"
        id="defenseur-aveugle"
        {{checked
        defenseurAveugle}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur de dos (+5)?</span>
      <input type="checkbox" id="defenseur-de-dos" {{checked defenseurDeDos}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur immobilisé (+5)?</span>
      <input
        type="checkbox"
        id="defenseur-immobilise"
        {{checked
        defenseurImmobilise}}
      />
    </div>
    {{/if}} {{#if (or immobiliser repousser)}}
    <div class="flexrow">
      <span class="roll-dialog-label">Cible consciente?</span>
      <input type="checkbox" id="cibleconsciente" {{checked cibleconsciente}} />
    </div>
    {{/if}} {{#if arme}} {{#if arme.system.isMelee}} {{#if bonusArmeNaturelle}}
    <div class="flexrow">
      <span class="roll-dialog-label">Arme naturelle/fortune en défense</span>
      <span class="small-label roll-dialog-label">{{bonusArmeNaturelle}}</span>
    </div>
    {{/if}}
    <div class="flexrow">
      <span class="roll-dialog-label">En surplomb, défenseur au sol (+3)?</span>
      <input type="checkbox" id="defenseur-au-sol" {{checked defenseurAuSol}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >Attaquants multiples (après le premier) (+3)?</span
      >
      <input
        type="checkbox"
        id="attaquants-multiple"
        {{checked
        attaquantsMultiples}}
      />
    </div>
    {{#if hasAmbidextre}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >Première attaque avec deux armes (-3)?</span
      >
      <input type="checkbox" id="ambidextre-1" {{checked attaqueAmbidextre1}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >Seconde attaque avec deux armes (-6)?</span
      >
      <input type="checkbox" id="ambidextre-2" {{checked attaqueAmbidextre2}} />
    </div>
    {{/if}} {{#if hasFeinte}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >Feinte (<strong>cout : 1 BA</strong>) ?</span
      >
      <input type="checkbox" id="feinte" {{checked feinte}} />
    </div>
    {{/if}}
    <div class="flexrow">
      <span class="roll-dialog-label"><strong></strong>Soutiens</strong></span>
      <select
        class="status-small-label color-class-common"
        name="soutiens"
        id="soutiens"
        data-type="Number"
      >
        {{selectOptions config.optionsSoutiens selected=soutiens valueAttr="key"
        nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur aveuglé (+10)?</span>
      <input
        type="checkbox"
        id="defenseur-aveugle"
        {{checked
        defenseurAveugle}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur de dos (+5)?</span>
      <input type="checkbox" id="defenseur-de-dos" {{checked defenseurDeDos}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >Défenseur dans espace restreint (+3)?</span
      >
      <input
        type="checkbox"
        id="defenseur-restreint"
        {{checked
        defenseurRestreint}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Défenseur immobilisé (+5)?</span>
      <input
        type="checkbox"
        id="defenseur-immobilise"
        {{checked
        defenseurImmobilise}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Charge ?</span>
      <input type="checkbox" id="attaque-charge" {{checked attaqueCharge}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Contenir?</span>
      <input type="checkbox" id="contenir" {{checked contenir}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Désarmer (SD+10)?</span>
      <input type="checkbox" id="attaque-desarme" {{checked attaqueDesarme}} />
    </div>
    {{#if isMonte}}
    <div class="flexrow">
      <span class="roll-dialog-label">Charge de cavalerie?</span>
      <input
        type="checkbox"
        id="charge-cavalerie"
        {{checked
        chargeCavalerie}}
      />
    </div>
    {{/if}} {{else}}
    <div class="flexrow">
      <span class="roll-dialog-label">Tireur en déplacement ?</span>
      <select
        class="item-field-label-long"
        type="text"
        id="tireur-deplacement"
        data-dtype="string"
      >
        {{selectOptions config.optionsTireurDeplacement
        selected=tireurDeplacement valueAttr="key" nameAttr="key"
        labelAttr="label"}}
      </select>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Couvert de la cible ?</span>
      <select
        class="item-field-label-long"
        type="text"
        id="cible-couvert"
        data-dtype="string"
      >
        {{selectOptions config.optionsCouvert selected=cibleCouvert
        valueAttr="key" nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Cible se déplace vite (SD+3)?</span>
      <input
        type="checkbox"
        id="tireur-cible-deplace"
        {{checked
        cibleDeplace}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Cible corps à corps (SD+3)?</span>
      <input type="checkbox" id="tireur-cible-cac" {{checked cibleCaC}} />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Taille de la cible ?</span>
      <select
        class="item-field-label-long"
        type="text"
        id="taille-cible"
        data-dtype="string"
      >
        {{selectOptions config.optionsTailleCible selected=tailleCible
        valueAttr="key" nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    {{/if}} {{/if}}

    <div class="flexrow">
      <span class="roll-dialog-label">Bonus/Malus </span>
      <select
        class="roll-dialog-label"
        id="bonus-malus-context"
        type="text"
        value="{{bonusMalusContext}}"
        data-dtype="Number"
      >
        {{selectOptions config.optionsBonusMalus selected=bonusMalusContext
        valueAttr="key" nameAttr="key" labelAttr="label"}}
      </select>
    </div>

    {{#if (or armeDefense arme.system.isDistance)}} {{#if
    arme.system.isDistance}}
    <div class="flexrow">
      <span class="roll-dialog-label">SD de distance</span>
      <select
        class="item-field-label-long"
        type="text"
        id="distance-tir"
        data-dtype="string"
      >
        {{selectOptions config.optionsDistanceTir selected=distanceTir
        valueAttr="key" nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    {{else}}
    <div class="flexrow">
      {{#if desengager}}
      <span class="roll-dialog-label">C. Offensive adversaire </span>
      {{else}}
      <span class="roll-dialog-label">C. Défensive adversaire</span>
      {{/if}}
      <span class="roll-dialog-label"><strong>{{difficulte}}</strong> </span>
    </div>
    {{/if}} {{else}} {{#if isInit}} {{else}}
    <div class="flexrow">
      <span class="roll-dialog-label">Difficulté : </span>
      <select
        class="roll-dialog-label"
        id="difficulte"
        type="text"
        name="difficulte"
        data-dtype="String"
      >
        {{selectOptions config.optionsDifficulte selected=difficulte
        valueAttr="key" nameAttr="key" labelAttr="label"}}
      </select>
    </div>
    {{/if}} {{/if}}
  </div>
</form>
