Fix: malus encombrement
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# 13.0
|
# 13.0
|
||||||
|
|
||||||
|
## 13.0.32 - Le surpoids d'Illysis
|
||||||
|
|
||||||
|
- Le malus d'encombrement sur jet d'Agilité avec Natation ou Acrobatie peuvent être changés, et sont correctement arrondis
|
||||||
|
|
||||||
## 13.0.31 - Les choix multiples d'Illysis
|
## 13.0.31 - Les choix multiples d'Illysis
|
||||||
|
|
||||||
- les défauts de caractéristique/difficulté des compétences ne sont pris que si aucun autre choix n'est fait
|
- les défauts de caractéristique/difficulté des compétences ne sont pris que si aucun autre choix n'est fait
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export class RollPartCheckbox extends RollPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getCheckboxLabelAjustement(rollData) {
|
getCheckboxLabelAjustement(rollData) {
|
||||||
return `${this.getCheckboxIcon(rollData)} ${this.getRefs(rollData).label}`
|
return `${this.getCheckboxIcon(rollData)} ${this.getCheckboxLabel(rollData)}`
|
||||||
}
|
}
|
||||||
|
|
||||||
async _onRender(rollDialog, context, options) {
|
async _onRender(rollDialog, context, options) {
|
||||||
|
|||||||
@@ -15,18 +15,32 @@ export class RollPartEncTotal extends RollPartCheckbox {
|
|||||||
&& RdDItemCompetence.isMalusEncombrementTotal(rollData.current.comp?.key)
|
&& RdDItemCompetence.isMalusEncombrementTotal(rollData.current.comp?.key)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadRefs(rollData) {
|
||||||
|
const refs = this.getRefs(rollData)
|
||||||
|
refs.malusEnc = - Math.floor(rollData.active.actor.getEncTotal())
|
||||||
|
const current = this.getCurrent(rollData)
|
||||||
|
current.value = refs.malusEnc
|
||||||
|
}
|
||||||
|
|
||||||
async _onRender(rollDialog, context, options) {
|
async _onRender(rollDialog, context, options) {
|
||||||
super._onRender(rollDialog, context, options)
|
super._onRender(rollDialog, context, options)
|
||||||
|
|
||||||
const inputMalusEnc = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="malusenc"]`)
|
const inputMalusEnc = rollDialog.element.querySelector(`roll-section[name="${this.code}"] input[name="malusenc"]`)
|
||||||
|
|
||||||
inputMalusEnc?.addEventListener("change", e => {
|
inputMalusEnc?.addEventListener("change", e => {
|
||||||
this.getCurrent(rollDialog.rollData).value = parseInt(e.currentTarget.value)
|
const malusEnc = Math.floor(e.currentTarget.value)
|
||||||
|
const rollData = rollDialog.rollData
|
||||||
|
const refs = this.getRefs(rollData)
|
||||||
|
const current = this.getCurrent(rollData)
|
||||||
|
if (refs.malusEnc == current.value) {
|
||||||
|
current.value = malusEnc
|
||||||
|
}
|
||||||
|
refs.malusEnc = malusEnc
|
||||||
rollDialog.render()
|
rollDialog.render()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
getCheckboxIcon(rollData) { return `<img src="${RDD_CONFIG.icons.surenc}">` }
|
getCheckboxIcon(rollData) { return `<img src="${RDD_CONFIG.icons.surenc}">` }
|
||||||
getCheckboxLabel(rollData) { return "Enc. total" }
|
getCheckboxLabel(rollData) { return "Enc. total" }
|
||||||
getCheckboxValue(rollData) { return - rollData.active.actor.getEncTotal() }
|
getCheckboxValue(rollData) { return this.getCurrent(rollData).value }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
{{#if current.icon}}{{{current.icon}}}{{/if}}
|
||||||
{{current.label}}
|
{{current.label}}
|
||||||
</label>
|
</label>
|
||||||
<label for="malusenc"></label>
|
<label for="malusenc">Enc. total</label>
|
||||||
<input type="number"
|
<input type="number"
|
||||||
name='malusenc'
|
name='malusenc'
|
||||||
value="{{current.value}}"
|
value="{{current.value}}"
|
||||||
|
|||||||
Reference in New Issue
Block a user