<div class="lethalfantasy-roll-dialog">

  <fieldSet class="">
    <legend>{{localize (concat "LETHALFANTASY.Label." rollType)}}
      -
      {{actorName}}</legend>

    {{#if rollTarget.tokenId}}
      <div class="dialog-save">
        <a
          class="goto-token-button"
          data-action="gotoToken"
          data-token-id="{{rollTarget.tokenId}}"
        >{{localize "LETHALFANTASY.Label.gotoToken"}} </a>
      </div>
    {{/if}}

    {{#if (match rollType "attack")}}
      <div class="dialog-save">Attack roll ! - {{rollTarget.name}}</div>
    {{/if}}
    {{#if (match rollType "defense")}}
      <div class="dialog-save">Defense roll ! - {{rollTarget.name}}</div>
    {{/if}}

    {{#if hasModifier}}
      <div class="dialog-save">{{upperFirst rollName}}
        :
        {{baseFormula}}
        +
        {{baseValue}}</div>
    {{else}}
      <div class="dialog-save">{{upperFirst rollName}} : {{baseFormula}}</div>
    {{/if}}

    {{#if rollTarget.weapon}}
      <div class="dialog-save">{{localize "LETHALFANTASY.Label.baseModifier"}}
        :
        {{rollTarget.charModifier}}</div>
      {{#if (match rollType "defense")}}
        <div class="dialog-save">Armor defense modifier :
          {{rollTarget.armorDefense}}</div>
      {{/if}}
      <div class="dialog-save">{{localize "LETHALFANTASY.Label.weapon"}}
        :
        {{rollTarget.weapon.name}}</div>
      <div class="dialog-save">{{localize "LETHALFANTASY.Label.skill"}}
        :
        {{rollTarget.name}}</div>
      <div class="dialog-save">{{localize "LETHALFANTASY.Label.skillBonus"}}
        :
        {{rollTarget.weaponSkillModifier}}</div>
    {{/if}}

    {{#if (match rollType "attack")}}
      <div class="dialog-save">Add Granted Attack Dice
        <input type="checkbox" data-action="selectGranted" name="granted" />
      </div>
      {{#if isRangedAttack}}
        <div class="dialog-save">Point Blank Range Attack
          <input
            type="checkbox"
            data-action="selectPointBlank"
            name="pointBlankV"
          />
        </div>
        <div class="dialog-save">Beyond Skill Range Attack
          <input
            type="checkbox"
            data-action="selectBeyondSkill"
            name="beyondSkillV"
          />
        </div>
        <div class="dialog-save">Let it Fly (Pure D20E)
          <input
            type="checkbox"
            data-action="selectLetItFly"
            name="letItFlyV"
          />
        </div>
        <div class="dialog-save">Aiming
          <select name="attackerAim" data-tooltip-direction="UP">
            {{selectOptions attackerAimChoices selected=attackerAim}}
          </select>
        </div>
      {{/if}}

    {{/if}}
    {{#if (match rollType "defense")}}
      <div class="dialog-save">Add Granted Defense Dice
        <input type="checkbox" data-action="selectGranted" name="granted" />
      </div>
      <div class="dialog-warning">
        <i class="fa-solid fa-triangle-exclamation"></i>
        {{localize "LETHALFANTASY.Warning.defenseShieldOrder"}}
      </div>
    {{/if}}
    {{#if (match rollType "damage")}}
      <div class="dialog-save">Add Granted Damage Dice
        <input type="checkbox" data-action="selectGranted" name="granted" />
      </div>
    {{/if}}

    {{#if rollTarget.staticModifier}}
      <div class="dialog-save">Static modifier : +{{rollTarget.staticModifier}}</div>
    {{/if}}

  </fieldSet>

  {{#if hasFavor}}
    <fieldSet class="dialog-favor">
      <legend>{{localize "LETHALFANTASY.Roll.favorDisfavor"}}</legend>
      <select name="favor" class="favor-choice" data-tooltip-direction="UP">
        {{selectOptions choiceFavor selected=favor}}
      </select>
    </fieldSet>
  {{/if}}

  {{#if hasModifier}}
    <fieldSet class="dialog-modifier">
      <legend>{{localize "LETHALFANTASY.Roll.modifierBonusMalus"}}</legend>
      <select name="modifier" data-tooltip-direction="UP">
        {{selectOptions choiceModifier selected=modifier}}
      </select>

      {{#if (eq rollType "save")}}
        <div>
          <span>Save against spell (+{{rollTarget.actorModifiers.saveModifier}})
            ?</span>
          <input
            type="checkbox"
            name="saveSpellCheck"
            data-action="saveSpellCheck"
            {{#if saveSpell}}checked{{/if}}
          />
        </div>
      {{/if}}
    </fieldSet>
  {{/if}}

  {{#if hasChangeDice}}
    <fieldSet class="dialog-modifier">
      <legend>{{localize "LETHALFANTASY.Roll.changeDice"}}</legend>
      <select name="changeDice" data-tooltip-direction="UP">
        {{selectOptions choiceDice selected=changeDice}}
      </select>
    </fieldSet>
  {{/if}}

  <fieldSet>
    <legend>{{localize "LETHALFANTASY.Roll.visibility"}}</legend>
    <select name="visibility">
      {{selectOptions rollModes selected=visibility localize=true}}
    </select>
  </fieldSet>

</div>