<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">{{localize "MNBL.attribute"}}</span>
      <select
        class="status-small-label color-class-common"
        id="attrKey"
        type="text"
        name="attrKey"
        value="attrKey"
        data-dtype="string"
      >
        {{selectOptions config.attributs selected=attrKey}}
      </select>
      {{else}}
      <span class="roll-dialog-label">{{attr.label}}</span>
      <span class="small-label">{{attr.value}}</span>
      {{/if}}
    </div>

    {{#if competence}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{competence.name}}</span>
      <span class="small-label">{{competence.system.niveau}}</span>
    </div>
    {{/if}} {{#if rune}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{rune.name}}</span>
      <span class="small-label">{{rune.system.formule}}</span>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">Lancement</span>
      <select
        class="roll-dialog-label"
        id="runemode"
        type="text"
        name="runemode"
        value="{{runemode}}"
        data-dtype="String"
      >
        {{selectOptions config.lancementRuneOptions selected=runemode}}
      </select>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.soulpoints"}}</span>
      <select
        class="roll-dialog-label"
        id="runeame"
        type="text"
        name="runeame"
        value="{{runeame}}"
        data-dtype="Number"
      >
        {{selectOptions config.pointsAmeOptions selected=runeame}}
      </select>
    </div>
    <div class="flexrow">
      <label class="roll-dialog-label" for="runeautocible">Rune uniquement sur soi-même ?</label>
      <input type="checkbox" id="runeautocible" name="runeautocible" />
    </div>
    {{/if}} {{#if arme}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.weapon"}} : </span>
      <span class="roll-dialog-label"
        >{{arme.name}} (+{{arme.system.bonusmaniementoff}})</span
      >
    </div>
    {{#if arme.system.isMelee}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.attack"}} : </span>
      <select
        class="roll-dialog-label"
        id="typeAttaque"
        type="text"
        name="typeAttaque"
        value="{{typeAttaque}}"
        data-dtype="String"
      >
        {{selectOptions config.attaques selected=typeAttaque }}
      </select>
    </div>
    {{#if isMonte}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.attackmountbonus"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="isMonte"
        name="isMonte"
        {{checked
        isMonte}}
      />
    </div>
    {{/if}} {{/if}} {{/if}} {{#if difficulte}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.targetdefense"}} :
      </span>
      <span class="roll-dialog-label"><strong>{{difficulte}}</strong> </span>
    </div>
    {{/if}} {{#if arme}} {{#if arme.system.isDistance}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        ><strong>{{localize "MNBL.shootmodifier"}}</strong></span
      >
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.aimingbonus"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="visee"
        name="visee"
        {{checked
        visee}}
      />
    </div>
    {{#if defender}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.targetseeshoot"}}
        (-{{defender.system.attributs.adr.value}})? :
      </span>
      <input
        class=""
        type="checkbox"
        id="cibleconsciente"
        name="cibleconsciente"
        {{checked
        cibleconsciente}}
      />
    </div>
    {{else}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.notarget"}} ! </span>
    </div>
    {{/if}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.runningtarget"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="ciblecourt"
        name="ciblecourt"
        {{checked
        ciblecourt}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.hascover"}} ? : </span>
      <select
        class="roll-dialog-label"
        id="typeCouvert"
        type="text"
        name="typeCouvert"
        value="{{typeCouvert}}"
        data-dtype="String"
      >
        {{selectOptions config.couverts labelAttr="name" selected=typeCouvert}}
      </select>
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.range"}} </span>
      <select
        class="roll-dialog-label"
        id="difficulte"
        type="text"
        name="difficulte"
        value="{{difficulte}}"
        data-dtype="Number"
      >
        {{selectOptions config.listePortees selected=difficulte}}
      </select>
    </div>
    {{/if}} {{/if}} {{#if hasDesavantageBonus}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        ><strong>{{localize "MNBL.disadvantagepositions"}}</strong></span
      >
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.targetground"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="cibleausol"
        name="cibleausol"
        {{checked
        cibleausol}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.unarmedtarget"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="cibledesarmee"
        name="cibledesarmee"
        {{checked
        cibledesarmee}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.smallroomtarget"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="ciblerestreint"
        name="ciblerestreint"
        {{checked
        ciblerestreint}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.targetcantmove"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="cibleimmobilisée"
        name="cibleimmobilisée"
        {{checked
        cibleimmobilisée}}
      />
    </div>
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.targetbelow"}} ? :
      </span>
      <input
        class=""
        type="checkbox"
        id="ciblesurplomb"
        name="ciblesurplomb"
        {{checked
        ciblesurplomb}}
      />
    </div>
    {{/if}}

    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.healthmalus"}} : </span>
      <span class="roll-dialog-label">{{malusSante}}</span>
    </div>

    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.soulmalus"}} : </span>
      <span class="roll-dialog-label">{{malusAme}}</span>
    </div>

    {{#if (count modifiers)}}
    <div class="flexrow">
      <span class="roll-dialog-label"
        >{{localize "MNBL.registeredmodifiers"}} :
      </span>
    </div>
    {{#each modifiers as |modifier idx|}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{modifier.name}} : </span>
      <span class="roll-dialog-label">{{modifier.system.value}}</span>
      <input
        class="apply-modifier"
        data-modifier-idx="{{idx}}"
        id="apply-modifier"
        type="checkbox"
        name="apply-modifier"
        value="{{modifier.system.apply}}"
        {{checked
        modifier.system.apply}}
      />
    </div>
    {{/each}} {{/if}}

    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.modifier"}} : </span>
      <select
        class="roll-dialog-label"
        id="modificateur"
        type="text"
        name="modificateur"
        value="{{modificateur}}"
        data-dtype="Number"
      >
        {{selectOptions config.modificateurOptions valueAttr="key"
        nameAttr="key" labelAttr="label" selected=modificateur }}
      </select>
    </div>

    {{#if selectDifficulte}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.difficulty"}} : </span>
      <select
        class="roll-dialog-label"
        id="difficulte"
        type="text"
        name="difficulte"
        value="{{difficulte}}"
        data-dtype="Number"
      >
        {{selectOptions config.difficulteOptions selected=difficulte}}
      </select>
    </div>
    {{/if}} {{#if canEclatDoubleD20}}
    <div class="flexrow">
      <span class="roll-dialog-label">{{localize "MNBL.doubleD20"}}</span>
      <input
        class=""
        id="doubleD20"
        type="checkbox"
        name="doubleD20"
        value="{{doubleD20}}"
        {{checked
        doubleD20}}
      />
    </div>
    {{/if}}
  </div>
  <footer class="dialog-buttons">
    <button type="button" class="rolld10">
      <i class="fas fa-check"></i> Lancer 1d10
    </button>
    <button type="button" class="rolld20">
      <i class="fas fa-check"></i> Lancer 1d20
    </button>
    <button type="button" class="cancel">
      <i class="fas fa-times"></i> Annuler
    </button>
  </footer>
</form>
