import { RdDCarac } from "../rdd-carac.js"
import { RdDUtility } from "../rdd-utility.js"
import { RollPartCheckbox } from "./roll-part-checkbox.mjs"

const ETHYLISME = "ethylisme"

export class RollPartEthylisme extends RollPartCheckbox {

  get code() { return ETHYLISME }

  isValid(rollData) { return rollData.active.actor.isPersonnage()}

  visible(rollData) {
    return rollData.active.actor.isAlcoolise() && !RdDCarac.isChance(rollData.current.carac.key)
  }

  getCheckboxIcon(rollData) {
    return '<i class="fa-solid fa-champagne-glasses"></i>'
  }

  getCheckboxLabel(rollData) {
    return `${RdDUtility.getNomEthylisme(rollData.active.actor.ethylisme())}`
  }

  getCheckboxValue(rollData) {
    return rollData.active.actor.malusEthylisme()
  }
}
