forked from public/foundryvtt-reve-de-dragon
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:
@@ -1,4 +1,5 @@
|
||||
import { SYSTEM_RDD } from "../constants.js";
|
||||
import { Misc } from "../misc.js";
|
||||
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs";
|
||||
|
||||
const CONDITIONS = "conditions"
|
||||
@@ -50,7 +51,7 @@ export class RollPartConditions extends RollPart {
|
||||
const current = this.getCurrent(rollData)
|
||||
current.min = game.settings.get(SYSTEM_RDD, this.settingMin())
|
||||
current.max = game.settings.get(SYSTEM_RDD, this.settingMax())
|
||||
current.value = current.value ?? 0
|
||||
current.value = Misc.inRange(current.value ?? 0, current.min, current.max)
|
||||
}
|
||||
|
||||
getAjustements(rollData) {
|
||||
@@ -63,12 +64,13 @@ export class RollPartConditions extends RollPart {
|
||||
|
||||
async _onRender(rollDialog, context, options) {
|
||||
const input = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="${this.code}"]`)
|
||||
|
||||
input?.addEventListener("change", e => {
|
||||
const current = this.getCurrent(rollDialog.rollData)
|
||||
current.value = parseInt(e.currentTarget.value)
|
||||
rollDialog.render()
|
||||
})
|
||||
|
||||
input?.addEventListener("input", e => this.onInputChange(e, rollDialog))
|
||||
}
|
||||
|
||||
onInputChange(event, rollDialog) {
|
||||
this.getCurrent(rollDialog.rollData).value = parseInt(event.currentTarget.value)
|
||||
rollDialog.render()
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user