Fix: aucun jeu connu

La fenêtre de jet se comporte correctement si le personnage
ne sait pas jouer,
This commit is contained in:
2025-12-13 01:09:00 +01:00
parent a4e614860a
commit 97cb730ab5
3 changed files with 15 additions and 2 deletions
+1
View File
@@ -14,6 +14,7 @@
- gestion des défenses contre les armes à distance
- défense contre possession
- correction du mode "méditation" quand le haut-rêvant ne connait pas de méditation
- correction du mode "jeu" quand le personnage ne connait pas de jeux
- Corrections liées à Foundry v12/v13
- Fix ajout de notes dans le journal par un joueur (/chrono, ou clic sur le libelé de l'heure dans l'horloge)
+8 -2
View File
@@ -7,6 +7,7 @@ import { RollPartSelect } from "./roll-part-select.mjs"
import { ROLLDIALOG_SECTION, RollPart } from "./roll-part.mjs"
import { RdDItem } from "../item.js"
import { Misc } from "../misc.js"
import { Grammar } from "../grammar.js"
export const PART_JEU = "jeu"
@@ -89,14 +90,19 @@ export class RollPartJeu extends RollPartSelect {
static forceCompJeu(rollData) {
const jeu = rollData.current[PART_JEU].base ?? rollData.current[PART_JEU].comp
rollData.refs[PART_COMP].comps = [jeu].map(it => RollPartComp.extractComp(it))
if (jeu){
rollData.refs[PART_COMP].comps = [jeu].map(it => RollPartComp.extractComp(it))
}
else {
rollData.refs[PART_COMP].comps = rollData.refs[PART_COMP].all.filter(comp => comp.label == 'Jeu')
}
rollData.current[PART_COMP] = rollData.refs[PART_COMP].comps[0]
}
async _onRender(rollDialog, context, options) {
const selectjeu = rollDialog.element.querySelector(`roll-section[name="${this.code}"] select[name="select-jeu"]`)
selectjeu.addEventListener("change", e => {
selectjeu?.addEventListener("change", e => {
const selectOptions = e.currentTarget.options
const index = selectOptions.selectedIndex
this.$selectJeu(rollDialog.rollData, selectOptions[index]?.value)
+6
View File
@@ -2,6 +2,7 @@
<img src="{{current.jeu.img}}" data-tooltip="{{current.jeu.name}}" />
</roll-part-img>
<roll-part-detail>
{{#if refs.jeux}}
<subline>
<select name="select-jeu" {{#if rollData.type.retry}}disabled{{/if}}>
{{selectOptions refs.jeux selected=current.key valueAttr="key" labelAttr="label"}}
@@ -10,4 +11,9 @@
<subline>
{{> "systems/foundryvtt-reve-de-dragon/templates/partial-description.hbs" current.jeu.system}}
</subline>
{{else}}
<subline>
<p>Le personnage ne sait jouer à rien</p>
</subline>
{{/if}}
</roll-part-detail>