RollV2, tchat et appel chance

gestion des appels à la chance pour tout jet V2

correction de soucis forçage du jet

continuation des messages de défense
This commit is contained in:
2025-09-27 23:48:17 +02:00
parent a7e14736e4
commit faca73b0a1
23 changed files with 240 additions and 153 deletions

View File

@@ -1,3 +1,4 @@
import { Misc } from "../misc.js"
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
export const PART_TRICHER = "tricher"
@@ -11,21 +12,20 @@ export class RollPartTricher extends RollPart {
prepareContext(rollData) {
const current = this.getCurrent(rollData)
if (current.resultat == undefined) {
current.resultat = -1
}
current.resultat = Misc.inRange(current.resultat == undefined ? -1 : current.resultat, -1, 100)
}
getAjustements(rollData) {
rollData.current.resultat = this.getCurrent(rollData).resultat
return []
}
async _onRender(rollDialog, context, options) {
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
input?.addEventListener("change", e => {
this.getCurrent(rollDialog.rollData).resultat = parseInt(e.currentTarget.value)
})
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
}
onInputChange(event, rollDialog) {
this.getCurrent(rollDialog.rollData).resultat = parseInt(event.currentTarget.value)
}
}