Nouvelle fenêtre de jets de dés
This commit is contained in:
42
module/roll/roll-part-appelmoral.mjs
Normal file
42
module/roll/roll-part-appelmoral.mjs
Normal file
@@ -0,0 +1,42 @@
|
||||
import { RdDCarac } from "../rdd-carac.js"
|
||||
import { RollPartCheckbox } from "./roll-part-checkbox.mjs"
|
||||
|
||||
export const PART_APPELMORAL = "appelmoral"
|
||||
|
||||
export class RollPartAppelMoral extends RollPartCheckbox {
|
||||
|
||||
get code() { return PART_APPELMORAL }
|
||||
get useCheckboxTemplate() { return false }
|
||||
get isDefaultChecked() { return false }
|
||||
|
||||
visible(rollData) {
|
||||
return rollData.active.actor.isPersonnage() && RdDCarac.isActionPhysique(rollData.current.carac.key)
|
||||
}
|
||||
|
||||
restore(rollData) {
|
||||
this.getCurrent(rollData).checked = this.getSaved(rollData).checked ?? false
|
||||
}
|
||||
|
||||
store(rollData, targetData) {
|
||||
this.setSaved(targetData, { checked: this.getCurrent(rollData).checked })
|
||||
}
|
||||
|
||||
loadRefs(rollData) {
|
||||
const refs = this.getRefs(rollData)
|
||||
refs.moral = rollData.active.actor.getMoralTotal()
|
||||
refs.label = refs.moral > 0 ? "Appel au moral" : "Énergie du désespoir"
|
||||
}
|
||||
|
||||
getCheckboxIcon(rollData) {
|
||||
const refs = this.getRefs(rollData)
|
||||
if (refs.moral > 0) {
|
||||
return '<i class="fa-regular fa-face-smile-beam"></i>'
|
||||
}
|
||||
if (refs.moral < 0) {
|
||||
return '<i class="fa-regular fa-face-sad-tear"></i>'
|
||||
}
|
||||
return '<i class="fa-regular fa-face-meh"></i>'
|
||||
}
|
||||
getCheckboxLabel(rollData) { return "Appel au moral" }
|
||||
getCheckboxValue(rollData) { return 1 }
|
||||
}
|
||||
Reference in New Issue
Block a user