<div class="coc7 chat-card chat-card-v2 item-card roll-card roll-result"
  data-actor-name="{{actorName}}"
  data-standby="{{standby}}"
  data-standby-text="{{standbyText}}"
  data-standby-text="{{standbyRightIcon}}"
  data-parent-uuid="{{parentUuid}}"
  data-uuid="{{uuid}}"
  data-context="{{context}}"
  data-raw-value="{{rawValue}}"
  data-characteristic="{{characteristic}}"
  data-attribute="{{attribute}}"
  data-skill-id="{{skill.id}}"
  data-success-required="{{successRequired}}"
  data-flagged-for-development="{{flaggedForDevelopment}}"
  data-forced="{{forced}}"
  data-forced-success="{{forcedSuccess}}"
  data-forced-failure="{{forcedFailure}}"
  data-result-type="{{resultType}}"
  data-details="{{details}}"
  data-can-be-pushed="{{canBePushed}}"
  data-pushing="{{pushing}}"
  data-has-enough-luck="{{hasEnoughLuck}}"
  data-luck-needed="{{luckNeeded}}"
  data-can-increase-success="{{canIncreaseSuccess}}"
  data-has-malfunction="{{hasMalfunction}}"
  data-malfunction-txt="{{malfunctionTxt}}"
  data-token-id="{{tokenId}}"
  data-roll-type="{{rollType}}"
  data-actor-key="{{actorKey}}"
  data-is-blind="{{isBlind}}"
  data-side="{{side}}"
  data-action="{{action}}"
  data-ref-message-id="{{referenceMessageId}}"
  data-success-level="{{successLevel}}"
  data-difficulty="{{difficulty}}"
  data-actor-id="{{actor.id}}"
  data-item-id="{{item.id}}"
  data-dice-mod="{{diceModifier}}"
  data-dice-modifier="{{diceModifier}}"
  data-flat-dice-modifier="{{flatDiceModifier}}"
  data-flat-threshold-modifier="{{flatThresholdModifier}}"
  data-ten-only-one-die="{{dices.tenOnlyOneDie}}"
  data-raw-value="{{rawValue}}"
  data-result="{{dice.total}}"
  data-is-success="{{isSuccess}}"
  data-is-failure="{{isFailure}}"
  data-is-unknown="{{isUnknown}}"
  data-luck-spent="{{luckSpent}}"
  data-total-luck-spent="{{totalLuckSpent}}"
  data-gm-difficulty-regular="{{gmDifficultyRegular}}"
  data-gm-difficulty-hard="{{gmDifficultyHard}}"
  data-gm-difficulty-extreme="{{gmDifficultyExtreme}}"
  data-gm-difficulty-critical="{{gmDifficultyCritical}}"
  data-hide-dice-result="{{hideDiceResult}}"
  data-deny-luck="{{denyLuck}}"
  data-deny-push="{{denyPush}}"
  {{#if tokenId}}data-token-id="{{tokenId}}" {{/if}}>
  {{#if standby}}
    <header class="card-header">
      <div class="left-portrait">
        {{#if displayActorOnCard}}
          <img class="portrait open-actor" data-actor-key="{{actor.actorKey}}" src="{{actor.img}}" title="{{actor.name}}" />
        {{/if}}
      </div>
      <div class="card-title">
        {{ name }}
      </div>
      <div class="right-portrait">
        {{#if standbyRightIcon}}
          <img class="portrait" src="{{standbyRightIcon}}">
        {{/if}}
      </div>
    </header>
    <div class="card-buttons owner-only" data-actor-id="{{actor.id}}" style="padding-top: 5px;margin: 0;">
      <button data-action="roll-check-card">{{localize 'CoC7.Roll'}}</button>
    </div>
  {{else}}
    {{#if isUnknown}}
      <div class="flexrow-coc7 difficulty-selector gm-visible-only" style="padding-bottom: 2px;">
        <span class="flex1 toggle-switch simple-flag {{#if gmDifficultyRegular}}switched-on{{/if}}"
        title="{{localize 'CoC7.RollDifficultyRegularTitle'}}"
        style="text-align:center;white-space: nowrap;"
        data-flag="gmDifficultyRegular"
        data-selected={{gmDifficultyRegular}}>{{localize 'CoC7.RollDifficultyRegular'}} {{regularThreshold}}%</span>
        <span class="flex1 toggle-switch simple-flag {{#if gmDifficultyHard}}switched-on{{/if}}"
        title="{{localize 'CoC7.RollDifficultyHardTitle'}}"
        style="text-align:center;white-space: nowrap;"
        data-flag="gmDifficultyHard"
        data-selected={{gmDifficultyHard}}>{{localize 'CoC7.RollDifficultyHard'}} {{hardThreshold}}%</span>
        <span class="flex1 toggle-switch simple-flag {{#if gmDifficultyExtreme}}switched-on{{/if}}"
        title="{{localize 'CoC7.RollDifficultyExtremeTitle'}}"
        style="text-align:center;white-space: nowrap;"
        data-flag="gmDifficultyExtreme"
        data-selected={{gmDifficultyExtreme}}>{{localize 'CoC7.RollDifficultyExtreme'}} {{extremeThreshold}}%</span>
        <span class="flex1 toggle-switch simple-flag {{#if gmDifficultyCritical}}switched-on{{/if}}"
        title="{{localize 'CoC7.RollDifficultyCriticalTitle'}}"
        style="text-align:center;white-space: nowrap;"
        data-flag="gmDifficultyCritical"
        data-selected={{gmDifficultyCritical}}>{{localize 'CoC7.RollDifficultyCritical'}}</span>
      </div>
    {{/if}}
    <div class="dice-roll {{#if isBlind}}gm-visible-only{{/if}}">
      <div class="dice-result" data-total="{{dices.total}}" data-ten-result="{{dices.tenResult}}">
        {{#unless dontDisplaySuccessLevel}}
          <div class="dice-formula {{#if isSuccess}}success{{/if}} {{#if isFailure}}failure{{/if}} {{#if isCritical}}critical{{/if}} {{#if isFumble}}fumble{{/if}}" title="{{successLevelIcons.hint}}">
            {{#if displayResultType}}
              {{resultType}}
            {{/if}}

            {{#if displayBothSuccessLevel}} - {{/if}}

            {{#if displayCheckSuccessLevel}}
              {{#if successLevelIcons}}
                <span class="roll-icons {{successLevelIcons.cssClass}}">
                  {{#each successLevelIcons.icons as |icon|}}
                    <i class="fas fa-{{icon}}"></i>
                  {{/each}}
                </span>
              {{else}}
                1D% {{#if dices.hasBonus}}{{dices.bonus}} {{dices.bonusType}} {{localize 'CoC7.Dice'}}{{/if}}
              {{/if}}
            {{/if}}
          </div>
        {{/unless}}
        <div class="dice-tooltip" style="display: none;">
          <section class="tooltip-part">
            <div class="dice ten-dice">
              <span class="part-formula part-header flexrow-coc7">
                {{#if dices.tenOnlyOneDie}}
                  {{localize 'CoC7.TensDie'}}
                {{else}}
                  {{dices.tens.length}} {{localize 'CoC7.TensDice'}}
                {{/if}}
                <div class="flex1"></div>
                <span class="part-total flex0">{{dices.tenResult}}</span>
              </span>
              <ol class="dice-rolls">
                {{#each dices.tens as |die key|}}
                  <li
                    data-selected="{{die.selected}}"
                    data-is-max="{{die.isMax}}"
                    data-is-min="{{die.isMin}}"
                    data-value="{{die.value}}"
                    class="roll die d10 {{#unless die.selected}}discarded{{/unless}} {{#if die.isMax}}min{{/if}} {{#if die.isMin}}max{{/if}}">{{die.value}}</li>
                {{/each}}
              </ol>
            </div>
          </section>
          <section class="tooltip-part">
            <div class="dice unit-die">
              <span class="part-formula part-header flexrow-coc7">
                {{localize 'CoC7.UnitsDie'}}
                <div class="flex1"></div>
                <span class="part-total flex0">{{dices.unit.value}}</span>
              </span>
              <ol class="dice-rolls">
                <li data-value="{{dices.unit.value}}" class="roll die d10">{{dices.unit.value}}</li>
              </ol>
            </div>
          </section>

          {{#if successRequired}}
            <h4 class="result-details">{{resultType}}, {{successRequired}}</h4>
          {{else}}
            <h4 class="result-details">{{resultType}}</h4>
          {{/if}}

          <div class="card-buttons owner-only" data-actor-id="{{actor.id}}" style="padding-top: 5px;margin: 0;">
            {{#unless isSuccess}}
              {{#if canBePushed}}
                {{#unless pushing}}
                  <button data-action="push">{{localize 'CoC7.PushSkill'}}</button>
                {{/unless}}
              {{/if}}
              {{#if hasEnoughLuck}}
                {{#unless pushing}}
                  <button class="pass-check" data-action="useLuck" data-luck-amount="{{luckNeeded}}" data-new-success-level="{{difficulty}}">{{luckNeededTxt}}</button>
                {{/unless}}
              {{/if}}
            {{/unless}}

            {{#unless pushing}}
              {{#if canIncreaseSuccess}}
                <div class="increase-success">
                  {{#each increaseSuccess as |level key|}}
                    <button
                      data-index="{{key}}"
                      data-action="useLuck"
                      data-luck-amount="{{level.luckToSpend}}"
                      data-luck-to-spend="{{level.luckToSpend}}"
                      data-new-success-level="{{level.difficulty}}"
                      data-difficulty="{{level.difficulty}}"
                      data-difficulty-name="{{difficultyName}}">{{localize 'CoC7.IncreaseSuccessLevel'}} : {{level.difficultyName}} - {{level.luckToSpend}} {{ localize 'CoC7.Luck'}}.</button>
                  {{/each}}
                </div>
              {{/if}}
            {{/unless}}
          </div>
        </div>
        {{#unless hideDiceResult}}
          <h4 id="diceResult" class="dice-total {{cssClass}}" title="{{resultType}}">{{modifiedResult}}{{#if flatDiceModifier}} ({{flatDiceModifierString}}){{/if}} {{#if pushing}} {{localize 'CoC7.PushedRoll'}}{{/if}} {{#if luckSpent}} - {{ localize 'CoC7.LuckSpentAlt' }} ({{totalLuckSpent}}){{/if}}</h4>
        {{/unless}}
        {{#if hasMalfunction}}
          <h4 class="malfunction">{{malfunctionTxt}}</h4>
        {{/if}}
      </div>
    </div>

    {{#if isBlind}}
      <div class="dice-roll user-visible-only">
        <div class="dice-result">
          <div class="dice-formula">???</div>
          {{#if forced}}
            <h4 class="dice-total {{playerCssClass}}">
              {{#if forcedSuccess}}
                Pass !
              {{else}}
                {{#if forcedFailure}}
                  Fail !
                {{else}}
                  {{#if isSuccess}}
                    Pass !
                  {{else}}
                    {{#if isFailure}}
                      Fail !
                    {{else}}
                      ??
                    {{/if}}
                  {{/if}}
                {{/if}}
              {{/if}}
            </h4>
          {{else}}
            <h4 class="dice-total">?</h4>
          {{/if}}
        </div>
      </div>
      {{#unless denyBlindTampering}}
        <div class="card-buttons gm-visible-only">
          {{#unless isUnknown}}
            <button data-action="reveal-check">{{localize 'CoC7.RevealCheck'}}</button>
          {{/unless}}
          {{#unless forced}}
            <button data-action="force-pass">{{localize 'CoC7.check.ForcePass'}}</button>
            <button data-action="force-fail">{{localize 'CoC7.check.ForceFail'}}</button>
            {{#unless isCritical}}
              <button data-action="increase-success-level">{{localize 'CoC7.IncreaseSuccessLevel'}}</button>
            {{/unless}}
            {{#unless isFumble}}
              <button data-action="decrease-success-level">{{localize 'CoC7.check.DecreaseSuccessLevel'}}</button>
            {{/unless}}
          {{/unless}}

          {{#unless skill.system.flags.developement}}
            {{#if canAwardExperience}}
              {{#if forcedSuccess}}
                <button data-action="flag-for-development">{{localize 'CoC7.check.FlagForDevelopment'}}</button>
              {{else}}
                {{#if isSuccess}}
                  <button data-action="flag-for-development">{{localize 'CoC7.check.FlagForDevelopment'}}</button>
                {{/if}}
              {{/if}}
            {{/if}}
          {{/unless}}
        </div>
      {{/unless}}
    {{/if}}
  {{/if}}
</div>