gestion des appels à la chance pour tout jet V2 correction de soucis forçage du jet continuation des messages de défense
32 lines
935 B
JavaScript
32 lines
935 B
JavaScript
import { Misc } from "../misc.js"
|
|
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
|
|
|
|
export const PART_TRICHER = "tricher"
|
|
|
|
export class RollPartTricher extends RollPart {
|
|
|
|
get code() { return PART_TRICHER }
|
|
get section() { return ROLLDIALOG_SECTION.CONDITIONS }
|
|
|
|
visible(rollData) { return game.user.isGM }
|
|
|
|
prepareContext(rollData) {
|
|
const current = this.getCurrent(rollData)
|
|
current.resultat = Misc.inRange(current.resultat == undefined ? -1 : current.resultat, -1, 100)
|
|
}
|
|
|
|
getAjustements(rollData) {
|
|
return []
|
|
}
|
|
|
|
async _onRender(rollDialog, context, options) {
|
|
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
|
|
|
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
|
|
}
|
|
|
|
onInputChange(event, rollDialog) {
|
|
this.getCurrent(rollDialog.rollData).resultat = parseInt(event.currentTarget.value)
|
|
}
|
|
}
|