Nouvelle fenêtre de jets de dés
This commit is contained in:
31
module/roll/roll-part-enctotal.mjs
Normal file
31
module/roll/roll-part-enctotal.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import { RdDItemCompetence } from "../item-competence.js"
|
||||
import { RdDCarac } from "../rdd-carac.js"
|
||||
import { RollPartCheckbox } from "./roll-part-checkbox.mjs"
|
||||
|
||||
const ENCTOTAL = "enctotal"
|
||||
|
||||
export class RollPartEncTotal extends RollPartCheckbox {
|
||||
|
||||
get code() { return ENCTOTAL }
|
||||
get useCheckboxTemplate() { return false }
|
||||
|
||||
visible(rollData) {
|
||||
return RdDCarac.isAgiliteOuDerobee(rollData.current.carac.key)
|
||||
&& RdDItemCompetence.isMalusEncombrementTotal(rollData.current.comp?.key)
|
||||
}
|
||||
|
||||
async _onRender(rollDialog, context, options) {
|
||||
super._onRender(rollDialog, context, options)
|
||||
|
||||
const inputMalusEnc = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="malusenc"]`)
|
||||
|
||||
inputMalusEnc?.addEventListener("change", e => {
|
||||
this.getCurrent(rollDialog.rollData).value = parseInt(e.currentTarget.value)
|
||||
rollDialog.render()
|
||||
})
|
||||
}
|
||||
|
||||
getCheckboxIcon(rollData) { return '<i class="fa-solid fa-weight-hanging"></i>' }
|
||||
getCheckboxLabel(rollData) { return "Enc. total" }
|
||||
getCheckboxValue(rollData) { return - rollData.active.actor.getEncTotal() }
|
||||
}
|
Reference in New Issue
Block a user