import { ROLL_TYPE } from "../config/system.mjs"
export default class LethalFantasyActor extends Actor {
  async _preCreate(data, options, user) {
    await super._preCreate(data, options, user)

    // Configure prototype token settings
    const prototypeToken = {}
    if (this.type === "character") {
      Object.assign(prototypeToken, {
        sight: { enabled: true },
        actorLink: true,
        disposition: CONST.TOKEN_DISPOSITIONS.FRIENDLY,
      })
      this.updateSource({ prototypeToken })
    }
  }

  async rollResource(resource) {
    if (this.type !== "character") return
    await this.system.roll(ROLL_TYPE.RESOURCE, resource)
  }

  async rollSave(save, avantage) {
    if (this.type !== "character") return
    await this.system.roll(ROLL_TYPE.SAVE, save, avantage)
  }
}
