<section
  class="character-main character-main-{{ifThen isPlayMode 'play' 'edit'}}"
>
  {{log "character-main" this}}

  <fieldset>
    <legend>{{localize "LETHALFANTASY.Label.pc"}}</legend>
    <div class="character-pc character-pc-{{ifThen isPlayMode 'play' 'edit'}}">
      <div class="character-left">
        <div class="character-left-image">
          <img
            class="character-img"
            src="{{actor.img}}"
            data-edit="img"
            data-action="editImage"
            data-tooltip="{{actor.name}}"
          />
        </div>

        <fieldset class="">
          <div class="flexrow character-hp">
            <span class="name">{{localize "LETHALFANTASY.Label.HP"}}</span>
            {{formInput
              systemFields.hp.fields.value
              value=system.hp.value
              disabled=isPlayMode
              classes="character-hp-value"
            }}
            &nbsp;/&nbsp;
            {{formInput
              systemFields.hp.fields.max
              value=system.hp.max
              disabled=isPlayMode
              classes="character-hp-value"
            }}
          </div>
          <div class="flexrow character-hp">
            <span class="name">{{localize "LETHALFANTASY.Label.grit"}}</span>
            {{formInput
              systemFields.grit.fields.current
              value=system.grit.current
              disabled=isPlayMode
              classes="character-hp"
            }}
            <span class="name">{{localize "LETHALFANTASY.Label.earned"}}</span>
            {{formInput
              systemFields.grit.fields.earned
              value=system.grit.earned
              disabled=isPlayMode
              classes="character-hp"
            }}
          </div>
          <div class="flexrow character-hp">
            <span class="name">{{localize "LETHALFANTASY.Label.luck"}}</span>
            {{formInput
              systemFields.luck.fields.current
              value=system.luck.current
              disabled=isPlayMode
              classes="character-hp"
            }}
            <span class="name">{{localize "LETHALFANTASY.Label.earned"}}</span>
            {{formInput
              systemFields.luck.fields.earned
              value=system.luck.earned
              disabled=isPlayMode
              classes="character-hp"
            }}
          </div>

          <div class="flexrow">
            <span class="" data-tooltip="Damage reduction">{{localize
                "LETHALFANTASY.Label.damageResistanceShort"
              }}
            </span>
            <input
              type="text"
              class="character-damage-reduction"
              data-tooltip="DR (armor+natural+magical)"
              disabled
              value={{damageReduction}}
            />
            <input
              type="text"
              class="character-damage-reduction"
              data-tooltip="DR (shield)"
              disabled
              value={{damageReductionShield}}
            />

          </div>

        </fieldset>

      </div>
      <div class="character-right">
        <div class="character-name">
          {{formInput
            fields.name
            value=source.name
            rootId=partId
            disabled=isPlayMode
          }}
          <a
            class="control"
            data-action="toggleSheet"
            data-tooltip="LETHALFANTASY.ToggleSheet"
            data-tooltip-direction="UP"
          >
            <i class="fa-solid fa-user-{{ifThen isPlayMode 'lock' 'pen'}}"></i>
          </a>
        </div>

        <fieldset
          class="character-characteristics character-characteristics-{{ifThen
              isPlayMode
              'play'
              'edit'
            }}"
        >
          <legend>{{localize "LETHALFANTASY.Label.Saves"}}</legend>
          <div class="character-saves">
            <div class="character-save">
              <span class="name"><a
                  class="rollable"
                  data-roll-type="save"
                  data-roll-key="will"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.will"}}
                </a></span>
              {{formField
                systemFields.saves.fields.will.fields.value
                value=system.saves.will.value
                disabled=true
              }}
              <span class="name">
                <a
                  class="rollable"
                  data-roll-type="save"
                  data-roll-key="dodge"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.dodge"}}
                </a>
              </span>
              {{formField
                systemFields.saves.fields.dodge.fields.value
                value=system.saves.dodge.value
                disabled=true
              }}
              <span class="name">
                <a
                  class="rollable"
                  data-roll-type="save"
                  data-roll-key="toughness"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.toughness"}}
                </a>
              </span>
              {{formField
                systemFields.saves.fields.toughness.fields.value
                value=system.saves.toughness.value
                disabled=true
              }}
            </div>
            <div class="character-save">
              <span class="name">
                <a
                  class="rollable"
                  data-roll-type="save"
                  data-roll-key="contagion"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.contagion"}}
                </a>
              </span>
              {{formField
                systemFields.saves.fields.contagion.fields.value
                value=system.saves.contagion.value
                disabled=true
              }}

              <span class="name">
                <a
                  class="rollable"
                  data-roll-type="save"
                  data-roll-key="poison"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.poison"}}
                </a>
              </span>
              {{formField
                systemFields.saves.fields.poison.fields.value
                value=system.saves.poison.value
                disabled=true
              }}

              <!--
              <span class="name-pain">
                <a class="rollable" data-roll-type="save" data-roll-key="pain" data-roll-dice="D12"><i
                    class="lf-roll-small fa-solid fa-dice-d12"></i>
                  {{localize "LETHALFANTASY.Label.saves.pain"}}
                </a>
              </span>
              <span class="name-pain">
                <a class="rollable" data-roll-type="save" data-roll-key="pain" data-roll-dice="D20"><i
                    class="lf-roll-small fa-solid fa-dice-d20"></i>
                  {{localize "LETHALFANTASY.Label.saves.pain"}}
                </a>
              </span>
              {{formField systemFields.saves.fields.pain.fields.value value=system.saves.pain.value disabled=true}}

              <span data-tooltip="Pain save if wound exceeds">
                {{formField systemFields.hp.fields.painDamage value=system.hp.painDamage disabled=isPlayMode
                tooltip="Pain Damage"}}
              </span>
              -->

            </div>
          </div>
        </fieldset>

        <fieldset
          class="character-characteristics character-characteristics-{{ifThen
              isPlayMode
              'play'
              'edit'
            }}"
        >
          <legend>{{localize "LETHALFANTASY.Label.Challenges"}}</legend>
          <div class="character-challenges">
            <div class="character-challenge">
              <span class="name"><a
                  class="rollable"
                  data-roll-type="challenge"
                  data-roll-key="str"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>{{localize
                    "LETHALFANTASY.Label.challenges.strength"
                  }}</a></span>
              {{formField
                systemFields.challenges.fields.str.fields.value
                value=system.challenges.str.value
                disabled=true
              }}
              <span class="name"><a
                  class="rollable"
                  data-roll-type="challenge"
                  data-roll-key="agility"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>{{localize
                    "LETHALFANTASY.Label.challenges.agility"
                  }}</a></span>
              {{formField
                systemFields.challenges.fields.agility.fields.value
                value=system.challenges.agility.value
                disabled=true
              }}
              <span class="name"><a
                  class="rollable"
                  data-roll-type="challenge"
                  data-roll-key="dying"
                ><i class="lf-roll-small fa-solid fa-dice-d20"></i>{{localize
                    "LETHALFANTASY.Label.challenges.dying"
                  }}</a></span>
              {{formField
                systemFields.challenges.fields.dying.fields.value
                value=system.challenges.dying.value
                disabled=true
              }}
            </div>
          </div>
        </fieldset>

        <fieldset
          class="character-characteristics character-characteristics-{{ifThen
              isPlayMode
              'play'
              'edit'
            }}"
        >
          <legend>{{localize "LETHALFANTASY.Label.Movement"}}</legend>
          <div class="character-movements">
            <div class="character-movement">
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.walk"
                }}</span>
              {{formField
                systemFields.movement.fields.walk
                value=system.movement.walk
                disabled=isPlayMode
              }}
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.jog"
                }}</span>
              {{formField
                systemFields.movement.fields.jog
                value=system.movement.jog
                disabled=isPlayMode
              }}
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.run"
                }}</span>
              {{formField
                systemFields.movement.fields.run
                value=system.movement.run
                disabled=isPlayMode
              }}
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.sprint"
                }}</span>
              {{formField
                systemFields.movement.fields.sprint
                value=system.movement.sprint
                disabled=isPlayMode
              }}
            </div>
            <div class="character-movement">
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.jumpBroad"
                }}</span>
              {{formField
                systemFields.jump.fields.broad
                value=system.jump.broad
                disabled=isPlayMode
              }}
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.jumpRunning"
                }}</span>
              {{formField
                systemFields.jump.fields.running
                value=system.jump.running
                disabled=isPlayMode
              }}
              <span class="name">{{localize
                  "LETHALFANTASY.Label.movement.jumpVertical"
                }}</span>
              {{formField
                systemFields.jump.fields.vertical
                value=system.jump.vertical
                disabled=isPlayMode
              }}
            </div>
          </div>
        </fieldset>

      </div>
    </div>
  </fieldset>

  <fieldset
    class="character-characteristics character-characteristics-{{ifThen
        isPlayMode
        'play'
        'edit'
      }}"
  >
    <legend>{{localize "LETHALFANTASY.Label.characteristics"}}</legend>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.str"}}</span>
      {{formField
        systemFields.characteristics.fields.str.fields.value
        value=system.characteristics.str.value
        disabled=isPlayMode
        data-char-id="str"
      }}
      {{formField
        systemFields.characteristics.fields.str.fields.percent
        value=system.characteristics.str.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.int"}}</span>
      {{formField
        systemFields.characteristics.fields.int.fields.value
        value=system.characteristics.int.value
        disabled=isPlayMode
        data-char-id="int"
      }}

      {{formField
        systemFields.characteristics.fields.int.fields.percent
        value=system.characteristics.int.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.wis"}}</span>
      {{formField
        systemFields.characteristics.fields.wis.fields.value
        value=system.characteristics.wis.value
        disabled=isPlayMode
        data-char-id="wis"
      }}

      {{formField
        systemFields.characteristics.fields.wis.fields.percent
        value=system.characteristics.wis.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.dex"}}</span>
      {{formField
        systemFields.characteristics.fields.dex.fields.value
        value=system.characteristics.dex.value
        disabled=isPlayMode
        data-char-id="wis"
      }}

      {{formField
        systemFields.characteristics.fields.dex.fields.percent
        value=system.characteristics.dex.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.con"}}</span>
      {{formField
        systemFields.characteristics.fields.con.fields.value
        value=system.characteristics.con.value
        disabled=isPlayMode
        data-char-id="con"
      }}

      {{formField
        systemFields.characteristics.fields.con.fields.percent
        value=system.characteristics.con.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.cha"}}</span>
      {{formField
        systemFields.characteristics.fields.cha.fields.value
        value=system.characteristics.cha.value
        disabled=isPlayMode
        data-char-id="cha"
      }}

      {{formField
        systemFields.characteristics.fields.cha.fields.percent
        value=system.characteristics.cha.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
    <div class="character-characteristic">
      <span>{{localize "LETHALFANTASY.Label.luc"}}</span>
      {{formField
        systemFields.characteristics.fields.luc.fields.value
        value=system.characteristics.luc.value
        disabled=isPlayMode
        data-char-id="luc"
      }}

      {{formField
        systemFields.characteristics.fields.luc.fields.percent
        value=system.characteristics.luc.percent
        disabled=isPlayMode
        type="number"
      }}
    </div>
  </fieldset>

</section>