export default class CthulhuEternalRoll extends Roll {
/**
* The HTML template path used to render dice checks of this type
* @type {string}
*/
static CHAT_TEMPLATE = "systems/fvtt-cthulhu-eternal/templates/chat-message.hbs"
get type() {
return this.options.type
}
get isDamage() {
return this.type === ROLL_TYPE.DAMAGE
}
get target() {
return this.options.target
}
get value() {
return this.options.value
}
get actorId() {
return this.options.actorId
}
get actorName() {
return this.options.actorName
}
get actorImage() {
return this.options.actorImage
}
get introText() {
return this.options.introText
}
get introTextTooltip() {
return this.options.introTextTooltip
}
get help() {
return this.options.help
}
get gene() {
return this.options.gene
}
get modifier() {
return this.options.modifier
}
get resultType() {
return this.options.resultType
}
get isFailure() {
return this.resultType === "failure"
}
get hasTarget() {
return this.options.hasTarget
}
get targetName() {
return this.options.targetName
}
get targetArmor() {
return this.options.targetArmor
}
get targetMalus() {
return this.options.targetMalus
}
get realDamage() {
return this.options.realDamage
}
/**
* Generates introductory text based on the roll type.
*
* @returns {string} The formatted introductory text for the roll.
*/
_createIntroText() {
let text
switch (this.type) {
case "skill":
const skillLabel = game.i18n.localize(`CTHULHUETERNAL.Character.FIELDS.caracteristiques.${this.target}.valeur.label`)
text = game.i18n.format("CTHULHUETERNAL.Roll.skill", { skill: "skill" })
text = text.concat(" ").concat(`Seuil : ${this.treshold}`)
break
}
return text
}
/**
* Generates an introductory text tooltip with characteristics and modifiers.
*
* @returns {string} A formatted string containing the value, help, hindrance, and modifier.
*/
_createIntroTextTooltip() {
let tooltip = game.i18n.format("CTHULHUETERNAL.Tooltip.saveIntroTextTooltip", { value: this.value, help: this.help, gene: this.gene, modifier: this.modifier })
if (this.hasTarget) {
tooltip = tooltip.concat(` Target : ${this.targetName}`)
}
return tooltip
}
/**
* Prompt the user with a dialog to configure and execute a roll.
*
* @param {Object} options Configuration options for the roll.
* @param {string} options.rollType The type of roll being performed.
* @param {string} options.rollTarget The target of the roll.
* @param {string} options.actorId The ID of the actor performing the roll.
* @param {string} options.actorName The name of the actor performing the roll.
* @param {string} options.actorImage The image of the actor performing the roll.
* @param {boolean} options.hasTarget Whether the roll has a target.
* @param {Object} options.data Additional data for the roll.
*
* @returns {Promise